public void drawBitmap ( int x , int y , byte [ ] [ ] bitmap , boolean opaque ) { int h = bitmap . length ; if ( h == 0 ) { return ; } int w = bitmap [ 0 ] . length ; if ( w == 0 ) { return ; } for ( int i = 0 ; i < h ; i ++ ) { if ( y + i >= 0 && y + i < height ) { for ( int j = 0 ; j < w ; j ++ ) { if ( x + j * 8 >= 0 && x + j * 8 < width ) { byte b = bitmap [ i ] [ j ] ; for ( int shift = 7 ; shift >= 0 ; shift -- ) { int mask = 1 << shift ; if ( ( b & mask ) != 0 ) { setPixel ( x + j * 8 + ( 7 - shift ) , y + i , color ) ; } else if ( opaque ) { setPixel ( x + j * 8 + ( 7 - shift ) , y + i , bgcolor ) ; } } } } } } }
Draws a bitmap . Each byte of data contains values for 8 consecutive pixels in a row .