question: private ImageData awtToSwt ( final BufferedImage bufferedImage , final int width , final int height ) { final int [ ] awtPixels = new int [ width * height ] ; final ImageData swtImageData = new ImageData ( width , height , 24 , PALETTE_DATA ) ; swtImageData . transparentPixel = TRANSPARENT_COLOR ; final int step = swtImageData . depth / 8 ; final byte [ ] data = swtImageData . data ; bufferedImage . getRGB ( 0 , 0 , width , height , awtPixels , 0 , width ) ; for ( int i = 0 ; i < height ; i ++ ) { int idx = ( 0 + i ) * swtImageData . bytesPerLine + 0 * step ; for ( int j = 0 ; j < width ; j ++ ) { final int rgb = awtPixels [ j + i * width ] ; for ( int k = swtImageData . depth - 8 ; k >= 0 ; k -= 8 ) { data [ idx ++ ] = ( byte ) ( rgb > > k & 0xFF ) ; } } } return swtImageData ; }
target:  Transform a java2d bufferedimage to a swt image.