Allias Nicolas wrote:
> The whole image, with the draws of the gum inside (if there are)

what is a "gum"?

>       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 ?)

If you want really smooth drawing with a mouse move, you may need to 
draw on top of the FloatCanvas image with a wx.ClientDC -- then you need 
to do it in pixel coords, which you can get from Canvas.WorldTo Pixel()

What I do is draw that way in the OnMove event, and then when the mouse 
button is lifted, add the appropriate object to the Canvas.

Look in the Demos dir for various examples of how this is done

> The main matter is the lines are added but visibles only with a
> ZoomToFit() :

Have you tried just Draw()?

What you are doing should work, though it may  be a bit choppy. You can 
speed that up some by putting the object that is moving in the 
Foreground - then only it will get re-draw, and not everything else.

Also, do want a new line with each mouse move? or do you want to change 
the line you already have? You can do that with Line.SetPoints()

> they are in a corner of the canvas, after some
> tests I think that coordinates are wrong 
(because of the zoom ?)

It sounds like it, but the zoom should be taken care of.

> 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.

You should use Canvas.PixelToWorld() for this.


> Moreover I want the gum to be active only on the
> displayed image (not in the background)

That's what InForeground is for.

> 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..

yes, that's what it is supposed to be -- the whole canvas. There is no 
foreground bitmap, it gets re-drawn when needed, and no way to draw just 
the foreground, except to Hide() all the other stuff.

> Thanks a lot, I really need this to make calculations (reverse
> fourier, convolve) with the displayed image

In that case, you don't want PNG data -- you want RBG data, which what 
you can get from converting a bitmap to an Image, then dumping its data 
into a numpy array, for example.

> 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 ?

There is no Foreground-only Buffer, _ForegroundBuffer is the whole thing 
-- background and foreground.

Can you make a small sample of what you are trying to do? It's hard to 
debug with just snippets of code.

-Chris




-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to