Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Color problems in Glib of StarterWare

$
0
0

Hi all,

After researching a lot in graphic library of StarterWare, I found that there may have some problems in color order.

We can see that all color definitons (in file glib.h) are defined in R-G-B order. For example:

#define ClrBlue 0x000000FF
#define ClrLime 0x0000FF00
#define ClrRed  0x00FF0000

C image array (which are created by pnmtoc tool as instructed at http://processors.wiki.ti.com/index.php/StarterWare_Graphics#Porting_StellarisWare_graphics_application_to_StarterWare) are in R-G-B order too.

Besides that, LCD contronller desired RGB data for 12-, 16-, 24- BPP modes.(AM335x Technical Reference Manual p.1234).

However, graphic functions use B-G-R order to draw its components.

Ex: In GrOffScreen24BPPPixelDrawMultiple function (offscr24bpp.c):

...

case 16:
{
unsigned short pixColor = 0; /* 16bpp */

pucData++;
while(lCount--)
{
pixColor = *(pucData+1);
pixColor |= (*(pucData)) << 8;

*pucPtr++ = (pixColor & 0x1F) << 3; /* Blue */ 
*pucPtr++ = (pixColor & 0x07E0) >> 3; /* Green */ 
*pucPtr++ = (pixColor & 0x0000F800) >> 8; /* Red */ 
*pucPtr++ = 0x0; /* Alpha */

pucData += 2;
}
break;
}
case 32: /* 24bpp with 1-byte hole */
{
//pucData++;
while(lCount--)
{
*pucPtr++ = *(pucData+3);
*pucPtr++ = *(pucData+2);
*pucPtr++ = *(pucData+1);
*pucPtr++ = *(pucData+0);

pucData += 4;
}
break;
}

I think these code will change pixel data from RGB order to BGR order!

Let me know if I was wrong!

Best regards,

TinND



Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>