Forum > Packages and Libraries

Copy Cairo surface image to TLazIntfImage?

(1/1)

Troodon:
What is the simplest way to copy (the content of) a Cairo surface to a TLazIntfImage? Thanks.

felipemdc:
Which type do you have exactly? Please provide a link to the Cairo docs pointing to this type. There you should also be able to find a function to read the pixels of the cairo surface. I think that you can copy then with a loop, iterating through all pixels.

TLazIntfImage.Pixels[x,y] can be used to write to the pixels. You need to set a size for it before doing that.

Troodon:
CAIRO_FORMAT_ARGB32
http://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t

Thanks.

felipemdc:
So, you can either create a new TLazIntfImage, fill the raw image data and the pointer to the data, or make a double-loop to copy each pixel.

I recommend that you choose a solution, try to implement it, and then ask again more precise questions if you face problems implementing the conversion.

Navigation

[0] Message Index

Go to full version