Peter Damoc wrote:
> Is Float Canvas a God Object?
Well, Matthias has written a very flexible and powerful framework, which
does it make a bit of work to understand, but the goal is that the
easy things will still be easy.
> FC2 looks really great for what I need. I will try to dress it up
> in an API that I can use and will get back with the results.
I'm wondering what you mean by this -- It should have an API that is
easy to use already -- if not, we have some work to do!
Anyway, nice to have you on board, Peter - having a real user with a
non-trivial problem (other than me) should help us get it into shape.
Maybe we can start with your needs and build a "how to make custom
drawing objects" tutorial.
> Now, the first thing I notice is that I don't seam to have direct access
> to drawing
That is the whole point of FloatCanvas! However, if you want to create
new types of objects, then yes, you do need direct access to drawing,
and I think Matthias has answered your questions about that -- or at
least started to.
> self.fc.create( 'Circle', 50, parent = self.renderer, name = 'r%d' % 1,
> pos = (0, 0), look = fc.SolidColourLook( line_colour = 'blue',
> fill_colour = (255,0,0,128) ) )
>
> route... seams like a recipe for spaghetti.
Why is that? In fact, the whole point of this sort of API is that it
makes for less spaghetti -- if you want a Circle with those properties,
then that's what you get, and that's all you need to do - you can forget
about OnPaint handlers, zooming and scaling, etc, etc.
> The second thing is the coordinate system.
Another point of FloatCanvas, and why it is called that, is that you can
use whatever the heck coordinate system you want -- (0,0) doesn't have
to be anywhere near your area of interest, y can be up or down, you can
even have arbitrary transformations, for non-Cartesian coordinates.
> Can this be changed to
> something like "upper left is (0,0)"? Can I zoom-in using this kind of
> coordinates (kinda like viewing a zoomed in picture).
A third point -- arbitrary zooming and scaling. FC1 is a little weak in
forcing a particular point to be at a corner -- it is based on the
paradigm of zooming to show a given rectangle (Bounding Box) of your
drawing on the screen, putting the center of that rect at the center of
the window -- thus it is awkward to, for instance, put (0,0) at the top
left corner of the window. But I think FC2 has addressed that -- or
will, anyway.
Nitro wrote:
> I am also thinking about doing a
> generic Path primitive, so you can do arbitrary GC drawing without having
> to use the GC directly,
I think this is critical to allowing folks to create whatever custom
objects they want.
> It is also possible to make upper left (0,0). Right now I haven't made
> this customizable, it will be with one of the next svn checkins.
excellent!
Peter Damoc wrote:
> To give you a better idea, think of Photoshop and how it handles Layers
> and Groups.
> I need something similar. The Layer in my concept is a transparent
> drawing surface.
This is built in to FC2 (I think -- I'm new to it too!)
FC1 did not support this because it was incredibly slow to draw masked
bitmaps, and transparent bitmaps didn't exist.
> My problem is that the current code draws everything at every frame (my
> output has some animation withing the drawing)
> What I want is to isolate the things that change from the things that do
> not change.
Well, FC 1 did support a "foreground" layer to support this, but then
the animation had to be on top of everything else, which is often the
case (but not always).
You could create layers ("groups"), but they would have to be re-drawn
when anything changed. Don't be too afraid of this though, drawing is
pretty quick much of the time, if you don't have 1000s of complex objects.
> So, in an ideal world where this layer would have existed, I would have
> called a specific layer's redraw method to make it adjust to the
> animation frame that it should display and after that, call the Group's
> refresh equivalent. This will cause the group representation to be
> changed by blit-ing all the group's layers onto a new surface.
> So, basically I need access to something similar to a DC.
> I need to draw, lines, rectangles, splines and bitmaps.
ah, no you don't -- you need to _create_ lines, rectangles, splines and
bitmaps, and have FC draw them for you when needed. But I suspect you
know that now.
Welcome aboard,
-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