About Bitmap color loss..

JonMac
JonMac used Ask the Experts™
on
Hi friends
     i have a problem..In my application i am settinga a bitmap image in a view & over that image..i am drawing a line using MoveTo() & LineTo() functions through CPen Object.
Now i want to remove that line ..so how can i remove that line such that no color loss occur in the image in that position...(except redrawing the image..)

bye

JonMac
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can use Raster operation.

SetROP2 function b4 drawing the line.

Roshmon


Author

Commented:
Hi RoshMon
        How can i use this function ..suppose in the background there is a image ..& now i draw a line (in black color) using MoveTo() & Lineto() functions..now i wants to remove that black line( such that no color loss of image occur..)..then how can i remove that line ..
 pls give me a example(code.. )if possible..

bye

JonMac
By rastering, the source and dest. pixels will combine in given raster mode. So when u drawing a black line, it will not be black, that will be the combination of sorce pixel and black. Again drawing will remove that color and retain the old color.

SetROP2(hDC, R2_XORPN);
MoveTO()
LineTO()

will draw the line...

Again using MoveTo and LineTo will eraze that color.

Good Luck

Author

Commented:
Hi Roshmon
     i don't know but its not working..now i am telling u what i am doing..
    In a view(in the background there is a image) ..in OnLButtonDown() function i am drawing a line..code is

          CClientDC dc(this);
           CPen newPen;
           newPen.CreatePen(PS_SOLID,2,RGB(0,0,0));
           CPen *oldPen = dc.SelectObject(&newPen);
           dc.SetROP2(R2_XORPEN);
           dc.MoveTo(350,140);
           dc.LineTo(point.x,point.y-20);
           dc.SelectObject(oldPen);
           newPen.DeleteObject();


now i wants to delete this line in OnLButtonUp() function then what is the req. functionality..

pls help me..


JonMac

Author

Commented:
Hi roshmon
    I accept ur comment as an answer..but this method have some problems..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial