> what is a "gum"?
Huh, sorry, I meant a rubber (same word in French)
I want to change the values of the image's pixels rubbed, so i should take the
whole rubbed pixels or merge the added lines with the bitmap ?
I didn't saw any rubber example on floatcanvas. Any idea ?
In fact WorldToPixel and PixelToWorld were the solutions for
conversions, thanks
> That's what InForeground is for.
is it a function or an attribute ? I started wxPython 1 month ago, and
programmation for 8 months so I'm quite slow :s
> Can you make a small sample of what you are trying to do? It's hard to
> debug with just snippets of code.
The shorter I can:
###in a file similar to GUIMode
class GUIgomme(GUIBase):
Cursor = wx.NullCursor
def __init__(self, parent):
GUIBase.__init__(self, parent)
self.StartRBBox = None
self.PrevRBBox = None
self.Souris1 = None #souris = mouse
self.Souris2 = None
self.curLigne = self.Ligne = []
self.coul = "red" #color
self.epaisseur = 3 #thickness
def SetCouleur(self,couleur): #
self.coul=couleur # called by my program controller
def SetEpaisseur(self,taille):#
self.epaisseur=taille #
def convert(self,tuple):
(x,y)=tuple
x=int(x) #pour pixeliser.. :s
y=int(y)
return self.parent.PixelToWorld(tuple)
def OnLeftDown(self, event):
self.Souris2=None
self.parent.CaptureMouse()
self.Souris1=event.GetPosition()
self.curLigne = [self.convert(self.Souris1)]
def OnLeftUp(self, event):
# Allways raise the Move event.
self.parent._RaiseMouseEvent(event,FloatCanvas.EVT_FC_MOTION)
if self.Souris1!=None :
self.Souris2=event.GetPosition()
self.curLigne.append(self.convert(self.Souris2))
self.parent.AddLine(self.curLigne,
LineWidth = self.epaisseur*self.parent.Scale,
LineColor = self.coul)
self.Ligne.append(self.curLigne)
self.curLigne = []
self.parent.Draw()
self.Souris1=None
def OnMove(self, event):
##if big zoom, how to aliasing the rubber ?
# Allways raise the Move event.
self.parent._RaiseMouseEvent(event,FloatCanvas.EVT_FC_MOTION)
if self.Souris1!=None :
self.Souris2=event.GetPosition()
self.curLigne.append(self.convert(self.Souris2))
self.parent.AddLine(self.curLigne,
LineWidth = self.epaisseur*self.parent.Scale,
LineColor = self.coul) #faire un linewidth
"dynamique"
self.parent.Draw()
self.UpdateScreen()#parent.Draw()
#################working on a smoother rubber ...
# if event.Dragging() and event.LeftIsDown():
# self.pos=self.Souris1
# dc = wx.ClientDC(self.parent)
# dc.BeginDrawing()
# dc.SetPen(wx.Pen(self.coul, self.epaisseur*self.parent.Scale,
# wx.SHORT_DASH)) #wx.SOLID..
# dc.SetBrush(wx.TRANSPARENT_BRUSH)
# #dc.SetLogicalFunction(wx.XOR)
# newPos = event.GetPositionTuple()
# coords = ( self.convert(self.pos) +self.convert(newPos) )
# #self.curLigne.append(coords)
# dc.DrawLineList(*coords)
# self.pos = newPos
# event.Skip()
def UpdateScreen(self):
for item in self.parent._DrawList:
item.SetLineWidth(self.epaisseur*self.parent.Scale)
in UpdateScreen I resize all added lines, but I want to resize in function of
the thickness of each lines.. not with the last thickness, is there a
way to get
each line thickness, in order to :
item.SetLineWidth(item.GetlineWidth()*self.parent.Scale) ?
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas