Add functions for CS and ORIGIN.
Fix bug of BMP.java