Recent

Author Topic: Copy Cairo surface image to TLazIntfImage?  (Read 5458 times)

Troodon

  • Sr. Member
  • ****
  • Posts: 484
Copy Cairo surface image to TLazIntfImage?
« on: June 18, 2011, 06:35:30 pm »
What is the simplest way to copy (the content of) a Cairo surface to a TLazIntfImage? Thanks.
Lazarus/FPC on Linux

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Copy Cairo surface image to TLazIntfImage?
« Reply #1 on: June 20, 2011, 02:46:51 pm »
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

  • Sr. Member
  • ****
  • Posts: 484
Lazarus/FPC on Linux

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Copy Cairo surface image to TLazIntfImage?
« Reply #3 on: June 20, 2011, 05:14:31 pm »
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.