 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Nicholas Gessler Guest
|
Posted: Wed Mar 07, 2007 9:10 am Post subject: Canvas->Rectangle w/ Brush & Pen Clear |
|
|
I have a TImage behind a PaintBox.
Withing the PaintBox I do a series of Canvas->Rectangle
colorings. Is there any way I can do the equivalent of
a Canvas->Rectangle with the purpose of erasing the Canvas
in that spot so I can see the underlaying image there?
clNone doesn't do it. Neither does bsClear...
Thanks,
Nick |
|
| Back to top |
|
 |
JD Guest
|
Posted: Wed Mar 07, 2007 6:39 pm Post subject: Re: Canvas->Rectangle w/ Brush & Pen Clear |
|
|
"Nicholas Gessler" <gessler (AT) ucla (DOT) edu> wrote:
| Quote: |
I have a TImage behind a PaintBox.
|
I would suggest to you that there is a much better way
and that would be to get rid of the TImage and use a
TBitmap instead.
| Quote: | Withing the PaintBox I do a series of Canvas->Rectangle
colorings.
|
Add an OnPaint event to the TPaintBox where you use
TCanvas::CopyRect to paint the bitmap and then use a
series of TCanvas::FillRect to paint the colored rects.
| Quote: | Is there any way I can do the equivalent of a Canvas
Rectangle with the purpose of erasing the Canvas
in that spot so I can see the underlaying image there?
|
The only way to erase is to XOR it once to display it and XOR
is again to erase it. Using a TBitmap approach, all you would
do is remove a rect from the list and Invalidate the TPaintBox.
If you're looking for transparency, it might be easier for you
to use a second TImage instead of the TPaintBox. If you were
to set it's Transparent property to true and then set it's
lower left pixel to the desired transparent color, any drawing
operation that causes the transparent color to be drawn to the
TImage (TCanvas::FillRect is fastest) will result in that rect
being transparent, revealing the image that's under it.
~ JD |
|
| Back to top |
|
 |
Nicholas Gessler Guest
|
Posted: Thu Mar 08, 2007 12:53 am Post subject: Re: Canvas->Rectangle w/ Brush & Pen Clear |
|
|
JD,
Thanks for the suggestions. I'll give them a try...
Nick |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|