GTKD Cairo get pixel color
Mike Wey via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jan 5 14:02:33 PST 2016
On 01/04/2016 11:08 PM, TheDGuy wrote:
> On Monday, 4 January 2016 at 21:42:16 UTC, Mike Wey wrote:
>> On 01/04/2016 09:13 PM, TheDGuy wrote:
>>> [...]
>>
>> I don't have any issues with either getPixelsWithLength and savev.
>> for the savev call there is an missing \ just before test.jpg, but
>> that might be a copy and paste error?
>>
>> For the options that are available for savev the documentation of
>> GDK-PixBuff lists the few available options.
>> https://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-File-saving.html#gdk-pixbuf-save
>>
>>
>> Although i'm on Linux so that might make an difference.
>
> Ups, that was my fault, sry :(
>
> But how do i get now the color for each pixel out of the ubyte[]?
It looks like the array has the R, G and B values like this:
[R, G, B, R, G, B, R, G, B, R, G, B, .......]
for every pixel from left to right top to bottom,
So data[0] gives you the Red value for the pixel at 0,0.
data[1] the Blue value and data[2] the green value.
data[3] would then be Red for pixel 1,0.
--
Mike Wey
More information about the Digitalmars-d-learn
mailing list