Home » Eclipse Projects » Remote Application Platform (RAP) » Decorate TreeItem(is it possible to decorate TreeItem?)
| |
Re: Decorate TreeItem [message #901444 is a reply to message #898327] |
Sun, 12 August 2012 12:47 |
Nir Zinger Messages: 5 Registered: July 2012 |
Junior Member |
|
|
Hi,
First of all, thank you for the reply
Second of all, sorry I didnt reply untill today, just had more important tasks to handle before this.
the solution of creating the images is the last thing i'll try to do, as we have 5 images, with 3-5 states on each one. and more then one icon can be on the main image.
its many combinations bottom line.
Well, I looked at the Markup system, and tried it. It seemed like saving the space for the image, but it didnt display it. (probably I had issues with the path to the image, although i tried many combinations, even like "c:\blabla.gif").
I thought about merging the images, found a code via google, but it didnt work well. it almost did the trick, but not perfectly. the images where "merged" togather, but the colors of the second image were corrupted.. instead of red (down status icon)..
it all became gray/black. is there a different way to merge the images? below is the code that I tried.
in RWT there is no way to use GC on image anymore (image not implementing drawable).
if there was, i could try to create image from main image, and draw the other images on it. anyways its not possible due to the issue below, btw I saw a bug on it, will it be solved some day ? (https://bugs.eclipse.org/bugs/show_bug.cgi?id=318900)
Edited:
I understood the code below not working well for me because the palette. the palette im using is the one from main image, thats why it looks ok on main image but not on icon, if i use the icon palette, its the opposite of course (although not sure I really understood how this Pallete works)
*sigh*
Any ideas maybe please?
public Image getImage(Object element) {
EntityData nodeData = (EntityData) element;
Image mainImage = NODE_IMAGES.get(nodeData.getType());
Image downImg = ImageConsts.Images.DOWN_IMG;
ImageData mainImageData = mainImage.getImageData();
ImageData iconImageData = downImg.getImageData();
ImageData targetData = targetData = new ImageData(mainImageData.width, mainImageData.height,
mainImageData.depth, mainImageData.palette);
merge(mainImageData, iconImageData, targetData, mainImageData.width-8, mainImageData.height-8);
Image returnedImage = new Image(InsitePlugin.getDisplay(), targetData);
return returnedImage;
}
private static void merge(ImageData sourceData1, ImageData sourceData2,
ImageData targetData, int startX, int startY) {
// Merge the 1st Image
merge(sourceData1, targetData, sourceData1.x, sourceData1.x);
// Merge the 2nd Image
merge(sourceData2, targetData, startX, startY);
}
private static void merge(ImageData sourceData, ImageData targetData, int startX, int startY) {
int i;
i = sourceData.x;
for (; i < sourceData.width; i++) {
int j = sourceData.y;
for (; j < sourceData.height; j++) {
targetData.setPixel(startX + i, startY + j, sourceData.getPixel(i, j));
}
}
}
not working well, the colors not stay as the original image.
[Updated on: Sun, 12 August 2012 13:15] Report message to a moderator
|
|
| |
Re: Decorate TreeItem [message #901526 is a reply to message #901444] |
Mon, 13 August 2012 08:51 |
Tim Buschtoens Messages: 396 Registered: July 2009 |
Senior Member |
|
|
Hi.
Am 12.08.2012 14:47, schrieb Nir Zinger:
> Well, I looked at the Markup system, and tried it. It seemed like saving
> the space for the image, but it didnt display it. (probably I had issues
> with the path to the image, although i tried many combinations, even
> like "c:\blabla.gif").
You need to register the images first. For 1.5 there is no one ideal way
to do that yet. However, it's basically the same as when you register
images for use with a custom widget, which is mentioned here:
http://www.eclipse.org/rap/developers-guide/devguide.php?topic=rwt/custom-widget.html#browserResources
I hope that helps.
Greetings,
Tim
--
Tim Buschtöns
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
| |
Goto Forum:
Current Time: Thu Jan 16 06:42:50 GMT 2025
Powered by FUDForum. Page generated in 0.03257 seconds
|