Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » What's the difference, RGB vs Color
What's the difference, RGB vs Color [message #466412] Tue, 10 January 2006 12:33 Go to next message
Johnson is currently offline JohnsonFriend
Messages: 13
Registered: July 2009
Junior Member
SWT provides these 2 packages, I can not see the difference when using them.
org.eclipse.swt.graphics.Color
org.eclipse.swt.graphics.RGB

What are the differences of these 2 packages? And they should be used under
what conditions? Thanks
Re: What's the difference, RGB vs Color [message #466418 is a reply to message #466412] Tue, 10 January 2006 13:49 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
The Color is the actual object that will be used when rendering widgets. It has handles to operating system resources, and generally should be cached where possible using a map or similar. They must be dispose()d of after use (because they have OS resources).

An RGB, on the other hand, is merely a set of 3 numbers (red, green, blue values). It's used to specify a particular color (like 0,255,0 = blue; 255,0,0 = red etc.). You can create a Color object once you have an RGB value of what colour you want to use.

It's not necessary to create an RGB, because there's a constructor in Color that takes individual red, green and blue values. Whenever you obtain the RGB out of a Colour, it creates a new RGB instance to hold that data in, so one of the only reasons for having the RGB is that it is something that can be easily written to preferences files to denote what colour is required, and then to use it to obtain a Color instance when running.

Alex.
Re: What's the difference, RGB vs Color [message #466522 is a reply to message #466412] Tue, 10 January 2006 22:14 Go to previous message
MANMOHAN GUPTA is currently offline MANMOHAN GUPTAFriend
Messages: 8
Registered: July 2009
Junior Member
"Johnson" <ljshuenn@realtek.com.tw> wrote in message
news:dq09if$gao$1@utils.eclipse.org...
> SWT provides these 2 packages, I can not see the difference when using
them.
> org.eclipse.swt.graphics.Color
> org.eclipse.swt.graphics.RGB
>
> What are the differences of these 2 packages? And they should be used
under
> what conditions? Thanks
>
>
Previous Topic:Right-click events
Next Topic:create a plugin from source
Goto Forum:
  


Current Time: Thu Apr 18 18:18:13 GMT 2024

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

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

Back to the top