04-22-2016 09:17 AM
Hello Guys,
I am using a canvas which has an image loaded. I creates a rectangle over specific cordinates on the canvas to depict part of the image.
Now, when i close the panel, I clear the canvas rectange using :-
CanvasClear (AttributePanelHandle, ATTR_PANEL_CANVAS, MakeRect (TOP,LEFT,HEIGHT,WIDTH));
I make this so that when I open it again I do not see previous rectangle marking.
Now the problem comes is that when I reopen my panel the rectangle is gone, but the loaded part of the image is also erased as can e seen in the below picture. How can I hoild back the loaded picture. Is there any alternative to canvas clear to remove the rectange.
BEFORE AFTER
Thanks
Raunak
04-25-2016 09:34 AM
No, you cannot erase just the rectangle's perimeter with CanvasClear.
You have two possibilities: a) you can draw the rectangle with an XOR pen (ATTR_PEN_MODE = VAL_XOR_MODE) , so that you can "erase it" by simply redrawing the same rectangle a second time. This has the downside, however, that you can't really control the foreground color of the rectangle, i.e. you can't really have it be solid red as it is now, or b) you can erase the rectangle by simply redrawing the original image over it.
Luis
04-25-2016 09:46 AM
Dear Luis,
I actually found the soultion by using CanvasUpdate in the panel_CB function and it works fine.
Anyways thanks for your help.