Re: [GD-DEVEL] get data from gdImagePtr
| From: | Karl Lehenbauer | Date: | Tue, 10 Jan 2012 17:42:35 +0000 |
| Subject: | Re: [GD-DEVEL] get data from gdImagePtr | ||
| References: | 1 | Groups: | php.gd.devel |
| Request: | Send a blank email to php-gd-devel+get-685@lists.php.net to get a copy of this message | ||
There is a call in the GD library called getImageGetPixel that takes a
gdImagePtr and x and y pixel coordinates and returns the color table index
or an encoded RGB color if it's a truecolor image. You can obtain the
individual colors using gdImageRed, gdImageBlue and gdImageGreen with the
image pointer and returned color as arguments.
You can get the image height and width using gdIMageSY and geImageSX with
the image pointer as an argument.
You'll need to make calls to allocate your Qpixmap of the right size and
then iterate through all the pixels of the GD image, pulling the colors of
each pixel in turn and using whatever calls your Qt library uses to write
the colors into the Qpixmap.
Hope that helps!
On 1/10/12 8:18 AM, "Mohammed Rashad" <mohammedrashadkm@gmail.com> wrote:
>this may seems offtopic for php developers but not for gd-devs
>I am doing some vector rendering using libgd. I filled the gdImagePtr with
>drawpoint/drawline/drawpolygon functions. now if I save the gdImagePtr to
>some file i will get png/jpeg image.
>
>upto here its fine
>
>
>now comes the real problem......
>
>I am using Qt as a front end for displaying image from gd. currently it
>works like this gdImagePtr --> pngfile --> QPixmap --> Qt
>
>I dont want to create a png file everytime the gdImagePtr is update (each
>zoom/pan will update gdImagePtr)
>
>so converting to file and reading again is a overhead in my case
>I want to show gdImagePtr on QPixmap with all conversion process running
>on
>memory.
>
>Is that possible in gd?
>
>
>How to pull chunk of data from gdImagePtr?
>
>Any will be much appreciated...
>
>Thanks in Advance
>
>--
>Regards,
> Rashad