What is the default ColorModel for AWT Components(e.g. Frames)?
The default ColorModel depends on the characteristics of the display of the user who is running your Applet. You have to execute Component.getColorModel() at runtime and adapt to it. The basic correlations is that if you are running on anything less than 8 bits deep you will probably get an IndexColorModel, but if you are running on a deeper display you will probably get a DirectColorModel. But, don’t count on that you may get some “FoobarColorModel” if there is a screen that doesn’t match these two common color spaces. Any subclass of ColorModel can be returned by that method, Index and Direct are just the two most common mechanisms for specifying color… In any case, while it may be useful to know the color model of the underlying screen for optimizations under some circumstances, you can always invent your own color model, report pixels in that color model, and the image display code will adapt itself to your color model. If you recognize the ColorModel you get, you can generate pi