Hi Relo,
The E_RGBX macro shouldn't be used when plotting pixels directly. Here is a piece of sample code to plot a pixel and handle the several colordepths (assuming the red, green and blue values go from 0 to 255):
- Code: Select all
1 2 3 4 5 6 7 8 9 10 11 12
| switch(pixelformat) { case EDSP_TRUE12: Video_Buffer[x * xpitch + y * ypitch]=((red & 0xF0) << 4) | (green & 0xF0) | ((blue & 0xF0) >> 4); break; case EDSP_TRUE16: Video_Buffer[x * xpitch + y * ypitch]=((red & 0xF8) << 8) | ((green & 0xFC) << 3) | ((blue & 0xF8) >> 3); break; case EDSP_TRUE32: Video_Buffer[x * xpitch + y * ypitch]=(red << 16) | (green << 8) | blue; break; }
|
| 12 lines; 7 keywds; 13 nums; 83 ops; 0 strs; 0 coms Syntactic Coloring v0.4 - Dan East |
More information about the pixel formats:
For Windows Desktop the most commonly used format is EDSP_TRUE32, unless it's set to 16-bit colors in the display configuration. On Windows Mobile EDSP_TRUE16 is used, but there is a big chance that EDSP_TRUE32 is used as well or will be used in the future. For Symbian it uses all three, although EDSP_TRUE12 is used in old devices (for example, Nokia N-Gage).