| View previous topic :: View next topic |
| Author |
Message |
Moon2 Guest
|
Posted: Sat Nov 04, 2006 3:54 am Post subject: Drawing on BMP |
|
|
Hi all I would like to do the following but not sure how to do it. I want to
capture a onclick event on a bitmap that is displayed to a window. Once the
onclick event has occured I want a ghost of a line to follow the cursor
until another onclick event occurs. Okay so I get the co-ordinates where the
mouse click took place and draw a line from that to the current mouse
location (x,y). How do I go about removing the old line that was drawn and
redraw the new line.
Thanks Mike
P.S. I would like to do this so that the user can specify what distance on
the image he would like to see between two objects. |
|
| Back to top |
|
 |
Bruce Larrabee Guest
|
Posted: Sat Nov 04, 2006 5:36 am Post subject: Re: Drawing on BMP |
|
|
Hi Moon2,
Draw the line and save the starting and ending coordinates.
When you are ready to remove the line save current pen color...
TColor current_color = Canvas->Pen->Color;
Set the pen to the background color...
Canvas->Pen->Color = Canvas->Brush->Color;
Draw a line using the coordinates you saved from the line drawn.
Set the pen back to the 'current color'...
Canvas->Pen->Color = current_color;
There are many variations on this theme but this is a method I
often use.
HTH,
Bruce Larrabee |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Nov 04, 2006 9:10 am Post subject: Re: Drawing on BMP |
|
|
"Moon2" <sbi (AT) telkomsa (DOT) net> wrote in message
news:454bbab0 (AT) newsgroups (DOT) borland.com...
| Quote: | How do I go about removing the old line that was drawn
|
Set the Canvas's Pen->Mode property to either pmNot or pmXor. Keep track of
the coordinates of the line. When the line is drawn, the pixel valuess of
the Canvas background where the drawing occurs will be modified in such a
way that drawing over the same coordinates again with the same Mode will
restore the original pixel values. Then you can draw your new line and
store its new coordinates for later use.
Gambit |
|
| Back to top |
|
 |
Moon2 Guest
|
Posted: Sat Nov 04, 2006 9:10 am Post subject: Re: Drawing on BMP |
|
|
| Thanks guys I will keep you posted if i run into any problems |
|
| Back to top |
|
 |
|