Link to home
Start Free TrialLog in
Avatar of InteractiveMind
InteractiveMindFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ColorModel

Can someone give me a quick run through of why you'd want to use the ColorModel class - and why it's useful ?

The MemoryImageSource class accepts a ColorModel as a parameter to one of it's constructors — what effect will this have?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of InteractiveMind

ASKER

But what does that actually mean?
Are the pixels not stored in a way based on RGB ?  (a << 24)|(r << 16)|(g << 8)|(b)  [or something like that]
no they are merely stored as numbers. The ColorModel takes that value and returns the colour components.
So, in the case of the MemoryImageSource: is there a default ColorModel that is used (if one is not specified) ?
Whats the data you're using, and how do you want it mapped?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I've got an IndexColorModel (produced using an algorithm I got elsewhere), which I pass to my MemoryImageSource constructor.

I then have an array called 'envMap' containing numbers ranging from 0-255. My rendering algorithm calculates which value to use (based on some unrelated criteria), and then passes that integer (from the envMap array) to the MemoryImageSource (or rather, sets the appropriate pixel within the pixel array to that integer).

So, the IndexColorModel in this case, would that just be using the given integer (from the envMap) to calculate the RGBA color to use?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Okay, thanks very much.
no worries :)