[Mono-dev] Cairo.ImageSurface

Philipp Baer phbaer at npw.net
Fri Apr 14 14:31:03 EDT 2006


this time I have a simple question regarding the Cairo.ImageSurface
class. The ImageSurface constructor for pre-initialized data buffers
wraps the cairo_image_surface_create_for_data function call using a
string as the data parameter. Why?

I must admit that I don't exactly know how the content of a string
is passed to the non-managed context. Because of the fact that a
string is composed of chars (which represent 2-byte unicode characters),
the raw string buffer presumably is a char array. IMO a byte array
would be much better suited (it simply is more generic).

Using the Mono.Cairo method call I was not able to create an image
surface using a pre-initialized data buffer. I either got a segfault
while trying to clear the buffer or the buffer was not displayed/not
displayed correctly. Hence, I created a new wrapper which accepts
a byte array (ref). It works well. Maybe it is a bug, maybe I didn't
get the glimpse how to use the constructor of ImageSurface.

I've attached my version of the wrapper class.

regards, phb

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ImageSurface2.cs
Type: text/x-csharp
Size: 1620 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060414/4b178848/attachment.bin 

More information about the Mono-devel-list mailing list