Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Get Color RGB under Cursor from Control ?
Get Color RGB under Cursor from Control ? [message #465912] Wed, 21 December 2005 21:12 Go to next message
lemi is currently offline lemiFriend
Messages: 8
Registered: July 2009
Junior Member
Is there a way to get the pixel color (RGB) from a control, widget, or
canvas?
The only way i found was to grab pixel RGB from ImageData, but that does
not really help a lot.

thanks

lemi
Re: Get Color RGB under Cursor from Control ? [message #465921 is a reply to message #465912] Thu, 22 December 2005 14:31 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
There is no single method for getting a color at a pixel location from a
widget.

You could use GC.copyArea() to get an image of the screen at that location
and get the pixel value from the image.

See:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet95.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup

"lemi" <chlache@talita.org> wrote in message
news:docghm$dov$1@utils.eclipse.org...
> Is there a way to get the pixel color (RGB) from a control, widget, or
> canvas?
> The only way i found was to grab pixel RGB from ImageData, but that does
> not really help a lot.
>
> thanks
>
> lemi
Re: Get Color RGB under Cursor from Control ? [message #465927 is a reply to message #465921] Thu, 22 December 2005 19:19 Go to previous message
lemi is currently offline lemiFriend
Messages: 8
Registered: July 2009
Junior Member
Thank you, i thought of this, but it seemed quite strange.

lemi

Veronika Irvine wrote:
> There is no single method for getting a color at a pixel location from a
> widget.
>
> You could use GC.copyArea() to get an image of the screen at that location
> and get the pixel value from the image.
>
> See:
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet95.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup
>
> "lemi" <chlache@talita.org> wrote in message
> news:docghm$dov$1@utils.eclipse.org...
>
>>Is there a way to get the pixel color (RGB) from a control, widget, or
>>canvas?
>>The only way i found was to grab pixel RGB from ImageData, but that does
>>not really help a lot.
>>
>>thanks
>>
>>lemi
>
>
>
Previous Topic:sort a tree with swt 3.1
Next Topic:Do not allow to check grayed checkboxes in CheckboxTableViewer
Goto Forum:
  


Current Time: Thu Jun 20 01:40:47 GMT 2019

Powered by FUDForum. Page generated in 0.01474 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top