| Summary: | [GC] Image class doesn't implement Drawable | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Mirko Solazzi <mirkosol> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | bugs.eclipse.org, eclipse, marco, mirkosol, mknauer, ruediger.herrmann, steeg, steffen.kriese |
| Version: | 1.3 | ||
| Target Milestone: | 3.14 M1 | ||
| Hardware: | PC | ||
| OS: | All | ||
| See Also: |
https://git.eclipse.org/r/c/rap/org.eclipse.rap/+/165695 https://git.eclipse.org/c/rap/org.eclipse.rap.git/commit/?id=a8f4ce1c2f4fb282ac90bc3d81026298ff4a34bf |
||
| Whiteboard: | |||
| Bug Depends on: | 334637 | ||
| Bug Blocks: | |||
|
Description
Mirko Solazzi
I think it is very important adding the Image creation feature on RAP.
For example if I need to create a captcha image for user registration, or if I need to create a graphic (static image) without drawing on the canvas.
It is sufficient to make the Image class "Drawable" and extend GC class method: the behaviour remains the same for instances of "Control" type while for "Image" instances you should implement the graphical operations on server memory, modifying the ImageData pixels [before saving it into a resource file] or using the native SO graphical operations inside the additional server display (X-Window) like the standard SWT does.
I do it in my web applications, by importing the original SWT package (I take the native libraries, depending on the server SO where the application server runs) and by creating images with a servlet. I cannot do the same with RAP because it overrides the SWT Image/GC classes.
The missed constructor:
Image(Device device, int width, int height)
can be implemented as:
public Image(org.eclipse.swt.graphics.Device device, int width, int height) {
super( checkDevice( device ) );
Color white = device.getSystemColor(SWT.COLOR_WHITE);
PaletteData palette = new PaletteData(0xFF0000, 0x00FF00, 0x0000FF);
ImageData imageData = new ImageData( width, height, 24 , palette );
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
imageData.setPixel(i,j,white.getRGB().hashCode());
}
}
imageData.type=SWT.IMAGE_PNG;
init( imageData );
}
*** Bug 334627 has been marked as a duplicate of this bug. *** Are there any news? :-) I try to port nebula.xygraph, which depends on it. Or is there any other way to get around this problem? What is the difference between your draw2d and the version in https://git.eclipse.org/c/rap/incubator/org.eclipse.rap.incubator.gef.git/about/ ? Btw, it would be very nice to get a draw2d version in upstream RAP :-) (In reply to Michael Fritscher from comment #5) > What is the difference between your draw2d and the version in > https://git.eclipse.org/c/rap/incubator/org.eclipse.rap.incubator.gef.git/ > about/ ? > > Btw, it would be very nice to get a draw2d version in upstream RAP :-) ?! If this question is addressed to my project - please open an issue for discussion on github - as not to distort this bugs discussion! :) Yes, it was addressed to your project - but it seems that you ripped off most things. It would be nice if you could upstream one or another improvement ;-) Yep - ripped of most things - as I want to have this as an isolated development case. Fixing it might pave the way for some bigger ports of Nebula. What is the specific reason that Image does not implement Drawable? This seems to simply be a marker interface?! New Gerrit change created: https://git.eclipse.org/r/c/rap/org.eclipse.rap/+/165695 Gerrit change https://git.eclipse.org/r/c/rap/org.eclipse.rap/+/165695 was merged to [master]. Commit: http://git.eclipse.org/c/rap/org.eclipse.rap.git/commit/?id=a8f4ce1c2f4fb282ac90bc3d81026298ff4a34bf (In reply to Marco Descher from comment #8) > What is the specific reason that Image does not implement Drawable? This > seems to simply be a marker interface?! Yeah, I wasn't able to find a good reason why it shouldn't implement Drawable, and added the marker interface just now. |