Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 38312 - Allow better Integration with existing java2d
Summary: Allow better Integration with existing java2d
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 37724
  Show dependency tree
 
Reported: 2003-06-01 21:17 EDT by cmeadows CLA
Modified: 2019-09-04 01:55 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cmeadows CLA 2003-06-01 21:17:53 EDT
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.
Comment 1 Steve Northover CLA 2003-06-17 14:57:39 EDT
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.
Comment 2 Lars Vogel CLA 2019-09-04 01:55:28 EDT
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.

--