InteractiveMind
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.
The MemoryImageSource class accepts a ColorModel as a parameter to one of it's constructors — what effect will this have?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
no they are merely stored as numbers. The ColorModel takes that value and returns the colour components.
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Okay, thanks very much.
no worries :)
ASKER
Are the pixels not stored in a way based on RGB ? (a << 24)|(r << 16)|(g << 8)|(b) [or something like that]