Symbian
Symbian OS Library

FAQ-0542 What does 256 colours in the Symbian PersonalJava Runtime really mean?

[Index][spacer] [Previous] [Next]



 

Classification: Java Category: AWT
Created: 11/20/2000 Modified: 08/24/2001
Number: FAQ-0542
Platform: Not Applicable

Question:
I am aware that the Symbian PersonalJava Runtime supports only 256 colours, but how many colours could I expect to see in a colour gradient?

Answer:
The Symbian Java Runtime uses a subset of the 4k colours associated with an image depth of four. The full 4k set includes 16 shades of each basic colour and every permutation of these shades (163 = 4k).

The subset is formed as follows:
Each basic colour (Red, Green and Blue) is still assigned sixteen levels of brightness, specified in hexidecimal (00->ff). All other colours are then built from combinations of only six of these levels of brightness, 00, 33, 66, 99, cc and ff. Thus 63 =216, plus the extra ten levels of brighness for the basic colours, and ten for grey = 256 colours. The colours are represented as 0x00RRGGBB, where 00 is dark and ff is light. RR=GG=BB represents grey, except the two extremes of black (R=G=B=00) and white (R=G=B=ff).

A colour gradient is defined as a set of colours where the R, G, and B values are increasing in proportion. So for the basic colours of Red, Green and Blue, a colour gradient will show 15 distinct levels of brightness at best (eg 0x00000011, 0x00000022, ....... , 0x000000ee, 0x000000ff). Grey will also display 15 levels of brightness but as for the intermediate colours it depends on which colour is chosen. For example, the following gradient contains five distinct levels of brightness:

0x00330033, 0x00660066, 0x00990099, 0x00cc00cc, 0x00ff00ff.

This is, however, as good as it gets for the intermediate colours. As the numbers have to be within the hexidecimal set, increasing or decreasing some colours in the gradient would put them outside of the set and they will therefore not be supported. As an example, 0x00330099 would stand alone in a colour gradient.

In addition to the above, and more serious, the 256 colour image support in ER5 and v6.0 does not dither images. Instead the system performs a closest match substitution. To see this, look at the dither test applet included with JDK1.1.8 with your PC set to 256 colour mode. Then compare the results on the emulator with the PC display set to 16M colours and the emulator set to 256 colours. In the emulator, you should see bands of solid colour rather than a smooth (modulo dither) gradient.

This will continue to be the case with the 6.0 and 6.1 releases of the Symbian platform.

For reference, the 256 Symbian RGB values are:

0x00000000 0x00000033 0x00000066 0x00000099 0x000000cc 0x000000ff
0x00003300 0x00003333 0x00003366 0x00003399 0x000033cc 0x000033ff
0x00006600 0x00006633 0x00006666 0x00006699 0x000066cc 0x000066ff
0x00009900 0x00009933 0x00009966 0x00009999 0x000099cc 0x000099ff
0x0000cc00 0x0000cc33 0x0000cc66 0x0000cc99 0x0000cccc 0x0000ccff
0x0000ff00 0x0000ff33 0x0000ff66 0x0000ff99 0x0000ffcc 0x0000ffff
0x00330000 0x00330033 0x00330066 0x00330099 0x003300cc 0x003300ff
0x00333300 0x00333333 0x00333366 0x00333399 0x003333cc 0x003333ff
0x00336600 0x00336633 0x00336666 0x00336699 0x003366cc 0x003366ff
0x00339900 0x00339933 0x00339966 0x00339999 0x003399cc 0x003399ff
0x0033cc00 0x0033cc33 0x0033cc66 0x0033cc99 0x0033cccc 0x0033ccff
0x0033ff00 0x0033ff33 0x0033ff66 0x0033ff99 0x0033ffcc 0x0033ffff
0x00660000 0x00660033 0x00660066 0x00660099 0x006600cc 0x006600ff
0x00663300 0x00663333 0x00663366 0x00663399 0x006633cc 0x006633ff
0x00666600 0x00666633 0x00666666 0x00666699 0x006666cc 0x006666ff
0x00669900 0x00669933 0x00669966 0x00669999 0x006699cc 0x006699ff
0x0066cc00 0x0066cc33 0x0066cc66 0x0066cc99 0x0066cccc 0x0066ccff
0x0066ff00 0x0066ff33 0x0066ff66 0x0066ff99 0x0066ffcc 0x0066ffff
0x00990000 0x00990033 0x00990066 0x00990099 0x009900cc 0x009900ff
0x00993300 0x00993333 0x00993366 0x00993399 0x009933cc 0x009933ff
0x00996600 0x00996633 0x00996666 0x00996699 0x009966cc 0x009966ff
0x00999900 0x00999933 0x00999966 0x00999999 0x009999cc 0x009999ff
0x0099cc00 0x0099cc33 0x0099cc66 0x0099cc99 0x0099cccc 0x0099ccff
0x0099ff00 0x0099ff33 0x0099ff66 0x0099ff99 0x0099ffcc 0x0099ffff
0x00cc0000 0x00cc0033 0x00cc0066 0x00cc0099 0x00cc00cc 0x00cc00ff
0x00cc3300 0x00cc3333 0x00cc3366 0x00cc3399 0x00cc33cc 0x00cc33ff
0x00cc6600 0x00cc6633 0x00cc6666 0x00cc6699 0x00cc66cc 0x00cc66ff
0x00cc9900 0x00cc9933 0x00cc9966 0x00cc9999 0x00cc99cc 0x00cc99ff
0x00cccc00 0x00cccc33 0x00cccc66 0x00cccc99 0x00cccccc 0x00ccccff
0x00ccff00 0x00ccff33 0x00ccff66 0x00ccff99 0x00ccffcc 0x00ccffff
0x00ff0000 0x00ff0033 0x00ff0066 0x00ff0099 0x00ff00cc 0x00ff00ff
0x00ff3300 0x00ff3333 0x00ff3366 0x00ff3399 0x00ff33cc 0x00ff33ff
0x00ff6600 0x00ff6633 0x00ff6666 0x00ff6699 0x00ff66cc 0x00ff66ff
0x00ff9900 0x00ff9933 0x00ff9966 0x00ff9999 0x00ff99cc 0x00ff99ff
0x00ffcc00 0x00ffcc33 0x00ffcc66 0x00ffcc99 0x00ffcccc 0x00ffccff
0x00ffff00 0x00ffff33 0x00ffff66 0x00ffff99 0x00ffffcc 0x00ffffff
0x00111111 0x00222222 0x00444444 0x00555555 0x00777777
0x00000011 0x00000022 0x00000044 0x00000055 0x00000077
0x00001100 0x00002200 0x00004400 0x00005500 0x00007700
0x00110000 0x00220000 0x00440000 0x00550000 0x00770000
0x00880000 0x00aa0000 0x00bb0000 0x00dd0000 0x00ee0000
0x00008800 0x0000aa00 0x0000bb00 0x0000dd00 0x0000ee00
0x00000088 0x000000aa 0x000000bb 0x000000dd 0x000000ee
0x00888888 0x00aaaaaa 0x00bbbbbb 0x00dddddd 0x00eeeeee