Thanks for your answers.
> Do you want the image as displayed? Or do you want the objects as
> individual objects?
The whole image, with the draws of the gum inside (if there are)
> Are you sure you can't use a FloatCanvas Line Object instead of using
> the dc call? Part of the point of FloatCanvas is to provide an easier
> interface to drawing than DCs.
Yeah, I tried this too, but I the lines still not be at their good place.
The aim is to do a gum, for modifying images data, fourier's frequencies...
For the moment, I get the mouse positions and trace traits with it :
(in a new class in GUIMode)
def OnLeftDown(self, event):
self.curLine = []
self.pos = event.GetPositionTuple()
def OnLeftUp(self, event):
if self.parent.HasCapture():
self.curLine = []
self.ReleaseMouse()
def OnMove(self, event,cercle=False):
if event.Dragging() and event.LeftIsDown():
self.curLine=[self.pos,poscourante]
poscourante=event.GetPositionTuple()
self.parent.AddLine(self.curLine,
LineWidth = 1*self.parent.Scale,
LineColor ="green")
I'd like to see the drawing "fluently"... (UpdateScreen method ?)
The main matter is the lines are added but visibles only with a
ZoomToFit() :they are in a corner of the canvas, after some
tests I think that coordinates are wrong (because of the zoom ?) I
wrote this conversion method :
def ConvertirPixels(self,tuples):
resu=[]
for tuple in tuples:
x=-tuple[0]/self.parent.Scale -self.parent.bmp.GetSize()[0]
y=-tuple[1]/self.parent.Scale -self.parent.bmp.GetSize()[1]
resu.append((x,y))
return resu
Which makes the lines closer to my image (self.parent.bmp) but
doesn't work well. Moreover I want the gum to be active only on the
displayed image (not in the background)
Calling a dc or adding lines on my bitmap=self.AddScaledBitmap(.... as
buffer should work ?
> Canvas._Buffer
It gives me the whole canvas, background too.. and the convolution of
the ImageFromBitmap(Canvas._Buffer) I get is strange (but my
convolution script is ok)...
_-_
> i originally had a similar problem, in that i wanted the bytes of a
> png image of everything i was drawing with floatcanvas, so i do this
>
> I = wx.ImageFromBitmap(Canvas._ForgroundBuffer)
> pil = Image.new('RGB', (I.GetWidth(),I.GetHeight())
> pil.fromstring(I.GetData())
> imageData = StringIO.StringIO()
> pil.save(imageData,format='PNG',optimize=True)
> return imageData.getvalue()
>
> not sure if it's useful to you, but I hope that helps.
Thanks a lot, I really need this to make calculations (reverse
fourier, convolve) with the displayed image but... _ForgroundBuffer
still not exists, neither _ForegroundBuffer or _ForeGroundBuffer
I may need only the "_ForgroundBuffer" (if I understand it well, it's
only the objects added on the FloatCanvas), what's the right spell of
this attribute ?
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas