[vwnc] Cairo context

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Cairo context

Annick
Using cairo is not straightforward since it is not an object framework.
For instance if you translate a graphicsContext and then open a  
cairoContext on it using:
newCairoContextWhile: the new context is not translated (inherits no  
state).

Annick Fron


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Cairo context

Travis Griggs-3

On Sep 17, 2009, at 2:59 AM, Annick Fron wrote:

> Using cairo is not straightforward since it is not an object  
> framework.
> For instance if you translate a graphicsContext and then open a
> cairoContext on it using:
> newCairoContextWhile: the new context is not translated (inherits no
> state).

Interesting.

It *should* reflect the same translation and clip. The code found in  
ScreenGraphicsContext>>newCairoContextWhile: reads

cr translate: self translation.
self clippingRectangleOrNil
        ifNotNil:
                [:rect |
                cr
                        rectangle: rect;
                        clip]

If it's not working, the following snippet shouldn't show the correct  
thing:

win := ApplicationWindow new.
win component: CompositePart new.
vb := VisualBlock block:
                                [:gc :box |
                                gc newCairoContextWhile:
                                                [:cr |
                                                cr
                                                        source: ColorValue royalBlue;
                                                        paint]].
win component add: vb in: (100 @ 200 extent: 50 @ 80).
win openWithExtent: 300 @ 300

Does it show correctly for you? Is there a more involved case you have  
were translation appears to not work?

--
Travis Griggs
Objologist
Time and Countertops. They both get used up way too fast.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc