On Thursday 13 September 2001 09:15, you wrote:
> Hi Everyone
>
> Can anyone please give me a hand I have created a
> canvas and I need a function to return the colour
> of a given pixel on the canvas, is there a pre-define
> function that I am missing or do I need to
> write my own?
> Is there anyway of detecting if a pixel exists at a
> particular location?
>
> dc.pixelcolor();  ???????????????????
>
> long ScribbleWindow::onMouseDown(FXObject*,FXSelector,void* ptr)
> {
> 	FXEvent *ev=(FXEvent*)ptr;
> 	canvas->grab();
> 	FXDCWindow dc(canvas);
>
> 	start_x=ev->last_x;
> 	start_y=ev->last_y;
>
> 	if(  dc.pixelcolor( start_x , start_y ) == BLACK )
> 	{
> 		............................
> 		............................
> 		............................
> 	}
> 	return 1;
> }
>
> Regards Roger


  FXColor color=dc.readPixel(FXint x,FXint y);


is the one you want.

You can read a whole FXImage back as well, via FXImage::restore()
which reads back client side pixel buffer from the off-screen
pixmap in the server, i.e. it does the opposite from FXImage::render().


Hope this helps,

		Jeroen

