Bug 513844 - Missing ImageDataProvider accessor in Image
Summary: Missing ImageDataProvider accessor in Image
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.6   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-17 23:04 EDT by Diego Fernandez CLA
Modified: 2017-04-14 04:49 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Fernandez CLA 2017-03-17 23:04:38 EDT
The field imageDataProvider in Image has a default access.

That makes impossible to "copy" an image using:

new Image(display, imageDataProvider)

Since is not possible to access the source imageDataProvider.

The main reasons to do something like this are:
- new Image(display, sourceImage, SWT.IMAGE_COPY) has bugs with HiDPI images (bug 491870)
- new Image(display, sourceImage.getImageData()) looses the HiDPI image, since getImageData returns the data at zoom 100
- Using getImageDataAtCurrentZoom throws ArrayIndexOutOfBounds (bug 513843)

Right now my workaround to the mentioned issues is to access imageDataProvider by reflection, resolving bug 491870 or bug 513843, makes the workaround unnecessary. However for a matter of completeness, it will be good to have the accessor or to consider bug 496409
Comment 1 Andrey Loskutov CLA 2017-03-28 04:43:39 EDT
Can you provide a patch?
Comment 2 Niraj Modi CLA 2017-04-14 04:49:14 EDT
We recently added below new API via bug 496409:
Image#getImageData(int zoom)

Also Image copy constructors are fixed, and they now copy the Providers via bug 514847.

Hope these fixes address your use-case, without the need for specific accessor for Providers.