Canvas architecture

Michael van der Gulik mikevdg at gmail.com
Fri Feb 1 22:47:21 UTC 2008


On Feb 2, 2008 2:03 AM, Igor Stasenko <siguctua at gmail.com> wrote:

>
>
> Why keeping 2D and 3D apart? What i like in Opengl, that it can handle
> both 2D/3D drawing primitives, so there is no need in using another
> library to make your content 3D aware.



Because 2-D widgets are composed of lines and pixels placed on a 2-D canvas.
A button is a 2-D rectangle with a border and some black text.

3-D widgets on the other hand might be rendered... well... in 3-D. For
example, you could make a button that is a very nice curved 3-D object that
casts a slight shadow on the area of the window just below it, with actual
3-D embossed text, and has just enough subtle specular reflection added to
it that you could swear you could see your own face in it. This is the sort
of CPU-wasting stuff that would make Steve Jobs want to lick his screen.

2-D widgets and 3-D widgets in this example would need different
implementations.


>
>
> >
> > - Introduce a "needsRedraw" system of some sort. A Canvas implementation
> may
> > or may not cache its contents (as a bitmap or vectored graphics/display
> > list). Various implementations may discard the cached contents at times,
> or
> > perhaps not even cache content.
> >
> Yes, cached content can be sent multiple times to device, but if we
> talking about generic architecture, then you can't have any sorts of
> redraws, because you can't redraw just printed page on a printer, you
> only can draw new one :)
> And i'm strongly for keeping this straight: once drawing command is
> sent, there is no way back. You should not manipulate device state in
> such manner, because many devices simply can't return back to previous
> state, or it will take too much resources and time, so  this will be a
> performance killer.
>


I don't think I explained this one very well. I was referring to the Canvas
either setting a flag in itself saying "I'm dirty and need to be redrawn"
which would be polled by the application, or sending an event to the
application saying "please redraw yourself on me!". This would happen for
example when a canvas is uncovered (e.g. a window move/resize) and the
content was not cached.

Of course, printers and fully cached implementations would never need to do
this.

Gulik.


-- 
http://people.squeakfoundation.org/person/mikevdg
http://gulik.pbwiki.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080202/244e114e/attachment.htm


More information about the Squeak-dev mailing list