Community
Participate
Working Groups
It would be great if java2d's BufferedImage storage mechanism DataBuffer and SWT's ImageData could share the same data array. Java2d allows for very high performance of image bit manipulation by allow direct access to the data array. If this could be shared with SWT, this would be a very nice enhancement. This is an example of using java2d data directly. Using this I have direct access to the data array, since I create it myself. I would like to be able to pass this to something like SWT ImageData constructor, and have it use the same array in the same manner. Java2d will represent any changes directly to the array, but in SWT, I need to create a new Image object with the ImageData for each refresh, which incurrs a lot of overhead for bit manipulation. size = width * height ; data = new int[size] ; DataBufferInt dataBuffer = new DataBufferInt(data, size) ; ColorModel colorModel = null ; colorModel = new DirectColorModel(24, 0x00ff0000, // Red 0x0000ff00, // Green 0x000000ff, // Blue 0x0 // Alpha ); SampleModel sampleModel = colorModel.createCompatibleSampleModel( width , height ) ; WritableRaster raster = Raster.createWritableRaster(sampleModel, dataBuffer, new Point()) ; image = new BufferedImage(colorModel, raster, false, null ) ; I can draw on this buffered image using any of the java2d api, or manipulate the data array myself for the most performant renderings.
Not sure we would do this. SWT runs on platforms where AWT doesn't exist. As part of the interop work, you should be able to use Java 2D directly from in SWT.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it and remove the stalebug whiteboard tag. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. --