LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Canvas Clear - Clears the portion of a Loaded image

 

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.

 

BeforeAfter

                               BEFORE                                                             AFTER

 

 

Thanks

Raunak

0 Kudos
Message 1 of 3
(3,403 Views)

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

0 Kudos
Message 2 of 3
(3,375 Views)

Dear Luis,

 

I actually found the soultion by using CanvasUpdate in the panel_CB function and it works fine.

 

Anyways thanks for your help.

 

0 Kudos
Message 3 of 3
(3,370 Views)