[cairo] offsetting a fill image pattern

Behdad Esfahbod behdad at behdad.org
Tue Mar 25 05:07:45 PDT 2008


On Tue, 2008-03-25 at 07:22 -0400, Theo Veenker wrote:
> Theo Veenker wrote:
> > Hi,
> > 
> > When filling a shape with an image pattern, is it possible to
> > control the origin of the image within the shape? For instance
> > lets say I have a rectangle of size 100x100 at -50,-50. When
> > filling this with an image pattern the image fill starts at 0,0
> > which in this case is the center of the rectangle. I like to be
> > able to offset the fill within the rectangle without changing
> > the anchor point of the rectangle. Can this be done?
> 
> Never mind, I found it. Just need to apply a translate on the
> pattern's transformation matrix.

cairo_set_source_surface() also takes a x,y pair that ends up there.

> Theo

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



More information about the cairo mailing list