Buggy code:
public final class Image extends Resource implements Drawable { public int type ; public int handle ; int transparentPixel = - 1 ; GC memGC ; byte [ ] alphaData ; int alpha = - 1 ; ImageData data ; static final int DEFAULT_SCANLINE_PAD = 4 ; Image ( ) { } public Image ( Device device , int width , int height ) { } public Image ( Device device , Image srcImage , int flag ) { } public Image ( Device device , Rectangle bounds ) { } public Image ( Device device , ImageData data ) { } public Image ( Device device , ImageData source , ImageData mask ) { } public Image ( Device device , InputStream stream ) { } public Image ( Device device , String filename ) { } int createDIBFromDDB ( int hDC , int hBitmap , int width , int height ) { } int [ ] createGdipImage ( ) { } public void dispose ( ) { } public boolean equals ( Object object ) { } public Color getBackground ( ) { } public Rectangle getBounds ( ) { } public ImageData getImageData ( ) { } public int hashCode ( ) { } void init ( Device device , int width , int height ) { } static int createDIB ( int width , int height , int depth ) { } static void GetIconInfo ( Image image , ICONINFO info ) { } static int [ ] init ( Device device , Image image , ImageData i ) { if ( image != null ) image . device = device ; <START_BUG> if ( ( ( ( i . depth ) == 1 ) && ( ( i . getTransparencyType ( ) ) != ( SWT . TRANSPARENCY_MASK ) ) ) || ( ( i . depth ) == 2 ) ) { <END_BUG> ImageData img = new ImageData ( i . width , i . height , 4 , i . palette ) ; ImageData . blit ( BLIT_SRC , i . data , i . depth , i . bytesPerLine , i . getByteOrder ( ) , 0 , 0 , i . width , i . height , null , null , null , ALPHA_OPAQUE , null , 0 , 0 , 0 , img . data , img . depth , img . bytesPerLine , i . getByteOrder ( ) , 0 , 0 , img . width , img . height , null , null , null , false , false ) ; img . transparentPixel = i . transparentPixel ; img . maskPad = i . maskPad ; img . maskData = i . maskData ; img . alpha = i . alpha ; img . alphaData = i . alphaData ; i = img ; } if ( i . palette . isDirect ) { final PaletteData palette = i . palette ; final int redMask = palette . redMask ; final int greenMask = palette . greenMask ; final int blueMask = palette . blueMask ; int newDepth = i . depth ; int newOrder = ImageData . MSB_FIRST ; PaletteData newPalette = null ; switch ( i . depth ) { case 8 : newDepth = 16 ; newOrder = ImageData . LSB_FIRST ; newPalette = new PaletteData ( 31744 , 992 , 31 ) ; break ; case 16 : newOrder = ImageData . LSB_FIRST ; if ( ! ( ( ( redMask == 31744 ) && ( greenMask == 992 ) ) && ( blueMask == 31 ) ) ) { newPalette = new PaletteData ( 31744 , 992 , 31 ) ; } break ; case 24 : if ( ! ( ( ( redMask == 255 ) && ( greenMask == 65280 ) ) && ( blueMask == 16711680 ) ) ) { newPalette = new PaletteData ( 255 , 65280 , 16711680 ) ; } break ; case 32 : if ( ! ( ( ( redMask == 65280 ) && ( greenMask == 16711680 ) ) && ( blueMask == - 16777216 ) ) ) { newPalette = new PaletteData ( 65280 , 16711680 , - 16777216 ) ; } break ; default : SWT . error ( ERROR_UNSUPPORTED_DEPTH ) ; } if ( newPalette != null ) { ImageData img = new ImageData ( i . width , i . height , newDepth , newPalette ) ; ImageData . blit ( BLIT_SRC , i . data , i . depth , i . bytesPerLine , i . getByteOrder ( ) , 0 , 0 , i . width , i . height , redMask , greenMask , blueMask , ALPHA_OPAQUE , null , 0 , 0 , 0 , img . data , img . depth , img . bytesPerLine , newOrder , 0 , 0 , img . width , img . height , newPalette . redMask , newPalette . greenMask , newPalette . blueMask , false , false ) ; if ( ( i . transparentPixel ) != ( - 1 ) ) { img . transparentPixel = newPalette . getPixel ( palette . getRGB ( i . transparentPixel ) ) ; } img . maskPad = i . maskPad ; img . maskData = i . maskData ; img . alpha = i . alpha ; img . alphaData = i . alphaData ; i = img ; } } RGB [ ] rgbs = i . palette . getRGBs ( ) ; boolean useBitfields = ( OS . IsWinCE ) && ( ( ( i . depth ) == 16 ) || ( ( i . depth ) == 32 ) ) ; BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER ( ) ; bmiHeader . biSize = BITMAPINFOHEADER . sizeof ; bmiHeader . biWidth = i . width ; bmiHeader . biHeight = - ( i . height ) ; bmiHeader . biPlanes = 1 ;

Fix:
if ( ( ( ( OS . IsWin95 ) && ( ( i . depth ) == 1 ) ) && ( ( i . getTransparencyType ( ) ) != ( SWT . TRANSPARENCY_MASK ) ) ) || ( ( i . depth ) == 2 ) ) {