[cairo] Filling with a pattern

Hakki Dogusan dogusanh at tr.net
Thu Jul 8 06:30:56 PDT 2010


Hi,

07/07/2010 22:19, Alexander Shulgin wrote:
> On Wed, Jul 7, 2010 at 15:22, Hakki Dogusan<dogusanh at tr.net>  wrote:
>> Hi,
>>
>> I'm trying to fill a rectangle with a -hatch- pattern. I want to apply same
>> pattern independent of current scale; ie. pattern's scale shouldn't change.
>>
>> Can you help me, please?
>
> This must be a FAQ :)
>
> Try reordering your cairo_set_source and cairo_scale calls.
>

Thanks. But in my case cairo_scale is being called very early :)

I solved my problem as follows:

cairo_save(cr);
{
     ...
         cairo_pattern_t* pattern = create_pattern();
         cairo_identity_matrix (cr);
         cairo_set_source(cr, pattern);
         cairo_fill (cr);
     ...
}
cairo_restore(cr);



> --
> Alex
>

--
Regards,
Hakki Dogusan
http://www.dynaset.org/dogusanh/


More information about the cairo mailing list