[cairo] 1.9.8: problem with direct access to image surface data

cu cairouser at yahoo.com
Tue Jun 15 09:22:25 PDT 2010


Dear all,

 As of 1.9.8 it appears that simply setting image surface data does not
work anymore. I.e. if I use cairo_image_surface_get_data() on BGRA
surface, then set the data bytes directly, then attempt to create a
pattern from this surface and use it as a fill elsewhere - the surface
is treated as "empty", resulting in nothing being drawn.

By experimenting I found that performing any action on the surface,
after the surface data was set, will "validate" it.  I.e. if I draw even
a single pixel (move_to(0,0) -> line_to(0,0), stroke), or even save the
surface as png - the data that was previously set into surface will
become visible.

We use direct access to surface memory to load various image types (such
as JPEG, for example) and then use these as patterns to draw into other
surfaces. While the workaround is not terribly bad, it seems
unnecessary. Would it be possible to restore the behavior of 1.9.6 and
before?


More information about the cairo mailing list