On Fri, 2009-03-06 at 17:09 -0800, Christine Meranda wrote:
> I am using clutter-cairo 0.82 and clutter 0.8.8 (pyclutter, actually,
> and pycairo) to create a custom GradientRectangle object to draw a basic
> rectangular gradient.
> The class extends CloneTexture and passes a CairoTexture object to the
> superclass constructor after drawing the requested gradient.
why?
just subclass CairoTexture instead. you should override the
do_allocate() method, chain up to the parent class' do_allocate()
method, resize the image surface using the new allocation area and then
paint on the cairo context object:
def do_allocate (self, box, absolute_origin_changed)
# chain up
clutter.Actor.do_allocate(self, box, absolute_origin_changed)
# resize the image surface
self.surface_resize(box.get_size())
# create the context
cr = self.create()
# ... redraw on the cairo context...
# destroy the context, or just return to let the GC
# get rid of it
del(cr)
> cr.set_source(linear)
> cr.fill()
you have to destroy the cairo context in order to get its contents
uploaded to the CairoTexture, either explicitly using:
del(cr)
or letting the garbage collector do its job when the cr symbol goes out
of scope (I prefer explicit deletion).
ciao,
Emmanuele.
--
Emmanuele Bassi, Intel Open Source Technology Center
--
To unsubscribe send a mail to [email protected]