Help with GetColorAt(x, y) in c#

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

Post Reply
Thaje
Posts: 2
Joined: Sun Feb 20, 2011 12:49 am

Help with GetColorAt(x, y) in c#

Post by Thaje » Sun Feb 20, 2011 12:56 am

Hello,

I am trying to create a program in c# for reading the ink content of pdf files. What I plan to do is convert the pdf to a gflax bitmap and then read each pixel to get total ink coverage. I have done everything up to getting the color at a certain pixel.

When I do:

Code: Select all

g.GetColorAt(x, y)
It returns an 8 digit long value. My question is, how can I convert this to an RGB value?

Thanks,

Thaje

Thaje
Posts: 2
Joined: Sun Feb 20, 2011 12:49 am

Re: Help with GetColorAt(x, y) in c#

Post by Thaje » Sun Feb 20, 2011 1:44 am

Sorry guys, I figured it out myself with a bit more research. For anyone else who wants to do this, this is the code:

Code: Select all

int color = int.Parse(g.GetColorAt(x, y).ToString());
int blue = (color/256/256) % 256;
int green = (color/256) % 256;
int red = (color) % 256;

Thanks anyway,

Thaje

Post Reply