<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hmm, i wanna build a pipette tool, for getting the colorvalue at a certain pixel on my cairo_surface_t.<br><br>here is some code which I found on this list, which doesn't seem to work in my case...<br><br><br><br>void pipette (int x, int y) //arguments are coordinates the mouse<br>{<br>cairo_surface_t* imageSurface;<br><br>imageSurface=layers[model->getCurrentLayer]->getSurface() ; //gets one of my apps layers surface<br><br>unsigned* char data = cairo_image_surface_get_data(imageSurface);<br><br>int stride= cairo_image_surface_get_stride(imageSurface);<br><br>unsigned char* pixelRGB = data+(y*stride) + (x*CAIRO_FORMAT_ARGB32);<br><br>printf ("pixel rgb: %i \n", (int) pixelRGB);<br><br>}<br><br><br>This seems to only return me the adress of that pixel in int. Well, that's my guess, since the number gets higher and higher if i move the mousepointer to the bottom right corner of the window, and lower in the other direction.<br><br>Any idea for me?<br><br><br>Thanks,<br>Mike<br><br><br><br>> Date: Thu, 9 Jul 2009 11:48:47 +0200<br>> From: david@bjorkevik.se<br>> To: steril707@hotmail.com<br>> CC: cairo@cairographics.org<br>> Subject: Re: [cairo] Pixel RGB Values...<br>> <br>> Steril 707 wrote:<br>> > I am working on a little image processing app, and would need to be<br>> > able to get the RGB values of certain pixels on a surface. Is there<br>> > any way to do that already with cairo at the moment? I cannot find<br>> > anything in the API reference on that, so I thought I should ask you<br>> > people here... And, if that's not possible, are there any plans for<br>> > this to get implemented?<br>> <br>> In your question you are making an assumption: that surfaces are made<br>> out of pixels. This is certainly not always the case, for instance with<br>> Postscript or PDF surfaces.<br>> <br>> Perhaps you can give us some more info on what you want to achieve in<br>> your application?<br>> <br>> Regards,<br>> David<br><br /><hr />check out the rest of the Windows Live™.
More than mail–Windows Live™ goes way beyond your inbox.
<a href='http://www.microsoft.com/windows/windowslive/' target='_new'>More than messages</a></body>
</html>