I have a requirement where i need to mask and clear the masked portion of the images. I am done with masking part of the requirement. I am using color matrix to mask my image also the selected portion in the image is blacked out. For this the color matrix setting used is ,
colormatrix obj = new colormatrix ( { 255,0,0,0,0} {0,255,0,0,0} { 0,0,255,0,0} { 0,0,0,1,0} { 0,0,0,0,1} )
and then i m drawing the selcted portion of the image over the original image.
Now on clearing the mask i need to revert back the original image on those seletced area. How can i implement this support.
I may have 5 selected mask region in the image and saying ClearMask needs to revert back the original image one by one from the last selection to the first selection.
Please let me know if required further info on this.
Your masking operation is destructive to the information in the original image. The only way you have to undo this masking is to copy the area to be masked to a temporary buffer and restore it from there.
An alternative method is to use XOR operation on the masked area. Assuming B/W image, each pixel value is XOR-ed with '1'. You then see a 'negative image' under the mask. Repeating this operation restores the original image. When image is more than 1 bit-per-pixel, replace the 1 with the appropriate 0xff values.