RE: [wxpython-users] What's going on with wx.Pen()?
by Marlin Rowley other posts by this author
May 8 2008 5:19PM messages near this date
Re: [wxpython-users] What's going on with wx.Pen()?
|
Re: RE: [wxpython-users] What's going on with wx.Pen()?
When you say "rubber-banding" what do you mean?
If I take the XOR away, I get the rectangle redrawing over itself continuously as I draw out
a rectangle.
Are you saying that as I:
event.Dragging() and even.LeftIsDown():
# Refresh the background with the bitmap
# draw a solid rectangle
> Date: Thu, 8 May 2008 15:33:49 -0700> From: timr@[...].com> To: wxpython-users@[...].org>
Subject: Re: [wxpython-users] What's going on with wx.Pen()?> > Marlin Rowley wrote:> >> > I
'm confused. I've set up a rectangular region program that will draw > > a rectangle and dyn
amically size it when the user drags the mouse. > > This is going to be used for viewing onl
y images within the window. I > > want the pen to be bright red. And I want it to be that wa
y ALL the > > time! For some reason, when I change the background color of my brush > > to s
omething OTHER than black, I get a different color. Why?> > Is it really that confusing? Not
ice:> > > > def OnMotion(self,event):> > if event.Dragging() and event.LeftIsDown():> > # ge
t device context of canvas> > dc= wx.BufferedDC(wx.ClientDC(self),self.buffer)> > > > # Set
logical function to XOR for rubberbanding> > dc.SetLogicalFunction(wx.XOR)> > That's the rea
son. You are drawing with a red pen, but the logical > function means that the color of the
pen is XOR-ed with the color of the > background. When the background is black, the pixel va
lue is 0, and > anything XORed with 0 is itself. When the background is not black, > XORing
with red simple inverts the red component in whatever color was > there before.> > This is a
bsolutely normal behavior for rubber banding. If you really > want a red rubber band all of
the time, then you can't use a simple > erase-the-old and draw-the-new scheme for drawing th
e rubber band. You > will have to use some kind of double-buffered scheme, by keeping a copy
> of the background in a bitmap. Then every time the rubber banding > changes, you'll have
to copy the virgin bitmap to the screen, then draw > the rubber band on top of it.> > -- > T
im Roberts, timr@[...].com> Providenza & Boekelheide, Inc.> > ______________________________
_________________> wxpython-users mailing list> wxpython-users@[...].org> http://lists.wxwid
gets.org/mailman/listinfo/wxpython-users
_________________________________________________________________
With Windows Live for mobile, your contacts travel with you.
http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_Refresh_mobile_052008
Thread:
Marlin Rowley
Tim Roberts
Marlin Rowley
Tim Roberts
Marlin Rowley
Christopher Barker
Marlin Rowley
Christopher Barker
Christopher Barker
Marlin Rowley
|