BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Canvas->Rectangle w/ Brush & Pen Clear

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Nicholas Gessler
Guest





PostPosted: Wed Mar 07, 2007 9:10 am    Post subject: Canvas->Rectangle w/ Brush & Pen Clear Reply with quote



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





PostPosted: Wed Mar 07, 2007 6:39 pm    Post subject: Re: Canvas->Rectangle w/ Brush & Pen Clear Reply with quote



"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





PostPosted: Thu Mar 08, 2007 12:53 am    Post subject: Re: Canvas->Rectangle w/ Brush & Pen Clear Reply with quote



JD,
Thanks for the suggestions. I'll give them a try...
Nick
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.