PDA

View Full Version : Color Palette


msiverts
03-11-2002, 12:30 PM
Just to confirm, is the color palette supported by BREW the web safe color palette or the windows BMP color palette?

Thanks,
Matt

kamal
03-18-2002, 08:36 PM
On the device, palette is hard coded and it is device dependent. For BREW emulator, following scheme is used to map the colors:

2bit:

RGB(0, 0, 0); // black, intensity == 0
RGB(0x80, 0x80, 0x80); // dark grey, intensity == 0.33
RGB(0xc0, 0xc0, 0xc0); // light grey, intensity == 0.67
RGB(0xff, 0xff, 0xff); // white, intensity == 1.00

4bit:
RGB(0x00, 0x00, 0x00); // 0000 black
RGB(0x80, 0x00, 0x00); // 0001 dark red
RGB(0x00, 0x80, 0x00); // 0010 dark green
RGB(0x80, 0x80, 0x00); // 0011 dark yellow
RGB(0x00, 0x00, 0x80); // 0100 dark blue
RGB(0x80, 0x00, 0x80); // 0101 dark magenta
RGB(0x00, 0x80, 0x80); // 0110 dark cyan
RGB(0x80, 0x80, 0x80); // 0111 dark gray
RGB(0xc0, 0xc0, 0xc0); // 1000 light gray
RGB(0xff, 0x00, 0x00); // 1001 red
RGB(0x00, 0xff, 0x00); // 1010 green
RGB(0xff, 0xff, 0x00); // 1011 yellow
RGB(0x00, 0x00, 0xff); // 1100 blue
RGB(0xff, 0x00, 0xff); // 1101 magetta
RGB(0x00, 0xff, 0xff); // 1110 cyan
RGB(0xff, 0xff, 0xff); // 1111 white

8bit:
216 color cube

for(int i = 0; i <6; i++) {
for(int j = 0; j<6; j++) {
for (int k=0; k<6; k++) {
int index = i*36 + j*6 +k;
m_pColorTable[index] =
RGB(i*51, j*51, k*51);
}
}
}

-Kamal

rsmithop
03-12-2003, 10:52 AM
Does anyone know the internal 8bit palette for the T720?

In general, the phone seems to map colors pretty closely. But some of the colors are off when it shows a 256 color BMP.

sul
03-26-2003, 03:51 PM
I believe the T720 has a dynamic palette. The display is 12 bit and is actually capably of displaying 4096 colours. We have recently conducted tests which suggest that the BREW T720 is actually capable of displaying more than 256 colours simultaneously. For example if you blit two bitmaps each with 256 colours in unique portions of the screen...

anyway the T720 and it's display capabilities have been a constant burdon for me... I'd value anybodies thoughts on *EXACTLY* how it works...

samsonsu
03-26-2003, 05:57 PM
i also believe t720 has dynamic palette. the phone is capable of generating more than 256 colors (actually 12bit, 4096). though the number of colors can be shown on the same screen is still 256, these 256 colors can be picked in an optimized way to yield better quality.

i once wrote a small app that converts a true color image to 256 and display it. i tried both algorithms. both worked and the latter has much better quality:

- convert true color to 8bit using standard palette, that is, the web/safe (or so-called system_666) palette. the photo can be displayed correctly, but diffusion/dithering can be observed clearly.

- convert true color to 8bit using optimized palette. simply speaking, pick the most frequently used 256 colors. now the photo looks almost the same quality as 16 or 24bit on t720 screen.

i think the above can prove that t720 can generate more than 256 colors and can show any 256 colors at a time. but i'm still not sure whether it can show more than 256 colors on the same screen.

markb
03-26-2003, 06:02 PM
Originally posted by sul
I believe the T720 has a dynamic palette. The display is 12 bit and is actually capably of displaying 4096 colours.

Yes, it has 12-bit color, but I don't think it has a dynamic palette. Each 12-bit pixel has 4 bits of red, 4 bits of blue, and 4 bits of green. When you pass an 8-bit BMP to CONVERTBMP, I am guessing they drop the least significant 4 bits off of each color component in each palette entry of your bitmap.

sul
03-26-2003, 06:29 PM
> Yes, it has 12-bit color, but I don't think it has a dynamic
> palette. Each 12-bit pixel has 4 bits of red, 4 bits of blue, and
> 4 bits of green.

Absolutley, the full colour gamut consists of 4096 colours which is fully represented by the 12-bit RGB colour space.

The palette is dynamic in that you can only pass 256 colours to the display at once, and you can select the 256 colours from the 4096 colour gamut.

The question I really have is:

Consider I blit two seperate bit maps to the screen in different sizes. Say for example one bitmap covers the top half of the screen and the other covers the bottom half of the screen. Each bitmap contains 256 colours that are unique from the other bitmap. I blit my first bitmap, and it display perfectly according to the palette I selected. Then I blit the second bitmap in the lower half of the screen.
What happens?
You would think that one of two things could happen
(a) The second bitmap is displayed and also looks perfect... i.e. the device is displaying 512 colour simulataneously.
(b) The first bitmap changes to allow for the new colours required to display the second bitmap. This would happen if the display was only capable of displaying 256 colours simulatenously.

We have been testing this and trying to figure it out... in truth it seems that neither (a) nor (b) are the case... it is something in between.

Sul

markb
03-26-2003, 07:40 PM
Originally posted by sul
We have been testing this and trying to figure it out... in truth it seems that neither (a) nor (b) are the case... it is something in between.

Can you describe what it looks like? Perhaps some of the palette entries do not match up very closely with the colors that the phone is capable of displaying, so you are getting the nearest matches. Since there are about 16 million possibilities for each entry in your bitmap's palette, but only about 4000 possibilities for each pixel on the display, most colors are not going to map exactly.

sul
03-27-2003, 11:43 AM
> Since there are about 16 million possibilities for each entry
> in your bitmap's palette

This problem can be avoided by ensuring you select colours that map exactly into the 12 bit colour space. i.e. For each colour component only ever set the highest 4 bits.

> Can you describe what it looks like?

First we are using two bitmaps specially constucted for this test. Basically

We are looking for a visual change in the colours of the first bitmap as the second bitmap is blitted. Through my greatest powers of perception I can't see any change in the first bitmap when the second one appears (I held my hand over the second half of the screen so that I wasn't distracted by its appearance).

However, The fact that the colours didn't change doesn't
prove that the display can display more then 256 colours.

It appears, that because the first bitmap is not "full-screen" that the device does not actually use 256 colours to blit it. i.e. the first bitmap does not *look* as though it contains all 256 colours. My theory is that the T720 assigns a portion of the colour palette to each bitmap based on the bitmaps spatial dominance...

In truth it is really hard to tell, because trying to fit 512 colours into a 120x130 display area means you only get about 30 pixels per colour so it can be hard to see clearly.

I can post more details if people are interested, but I'm very interested in hearing if anyone else has tried to uncover this mystery.

thanks
Sul