|
|
|
|
|
|
Re: Insert image as shape [message #1012018 is a reply to message #1011979] |
Wed, 20 February 2013 17:54 |
Emerson Simbolon Messages: 12 Registered: April 2012 |
Junior Member |
|
|
Thanks Michael, now it works
However, to make sure I will use the feature, I want to ask, can I add/register the picture at run time. E.g, user just added a picture through a form, then, he opens the Graphiti editor. At that time, the picture shows up in the palette, ready to be included in the canvas. If this is not possible, maybe I will code the feature myself. But, if it is possible, I'll worship Graphiti for make me save my precious hours.
Thanks as always.
Emerson
|
|
|
|
Re: Insert image as shape [message #1063192 is a reply to message #1012910] |
Wed, 12 June 2013 15:14 |
Andrej K Messages: 26 Registered: March 2013 Location: germany |
Junior Member |
|
|
I have additional question about images
in my resize feature I'm resizing my Images to the correct size
and i want to put resized image into the shape, how i can do this? If i try with this code i get nothing/no image
(through debug mode, i can see that all images are correct "mapped" into the hashmap")
for (Shape shapeInside : cs.getChildren()) {//find/manipulate alls hapes(text,image,rectangle...)
if(shapeInside.getGraphicsAlgorithm() instanceof Image){//find my Image
int iconSide=...;//compute new Image Size
conv.rasterizeImage("name", ""+this.elementToResize, iconSide,iconSide ); //convert new Image
imgName= "name"+"_"+this.elementToResize+".png";
iwas=new ImageProvider();
Image entityIcon;
IGaService gaService = Graphiti.getGaService();
int id = iwas.getImageId(imgName); //output is an index for the given imgName
Image imgIcon = gaService.createImage(shapeInside,ImageProvider.resizedIcons[id]);
imgIcon.setWidth(iconSide);
imgIcon.setHeight(iconSide);
imgIcon.setProportional(true);
imgIcon.setX(20);
imgIcon.setY(20);
gaService.setLocationAndSize(imgIcon, 0, 0, iconSide, iconSide);
}
...
}
if i change the id to for example to 0 or 4(and this image exists/ was resized at the last start) in the line:
Image imgIcon = gaService.createImage(shapeInside,ImageProvider.resizedIcons[id]);
so the Image is displayed correct
what I'm doing wrong? or how can i do this another way?
|
|
|
|
Powered by
FUDForum. Page generated in 0.05604 seconds