Pixel format for pgBitBlt call's byte array parameter

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
biermana
Posts: 12
Joined: Mon Jun 27, 2005 3:23 pm

Pixel format for pgBitBlt call's byte array parameter

Post by biermana »

Hi,

I searched docs, couldn't find the answer so posting question here...

In the function call:

void pgBitBlt(unsigned long x,unsigned long y,unsigned long w,unsigned long h,unsigned long mag,const unsigned short *d);

what is the pixel format for the byte array referenced by last parameter *d ?

Is is 32bpp rgb or 16bpp rgb or something else?

Thanks for the help.

Thanks,
Tony
maddogjt1
Posts: 13
Joined: Mon Jun 27, 2005 3:06 pm

Post by maddogjt1 »

I believe that it is 16 bpp BGR format XBBBBBGGGGGRRRRR but don't hold me to it.
KprOfTime
Posts: 3
Joined: Mon Jun 27, 2005 3:34 pm

Post by KprOfTime »

Yeah, that's the format as far as I can tell. I use this snippet to convert 24bpp RGB to the format the PSP VRAM uses:

Code: Select all

unsigned short gfxRGB(unsigned char r,unsigned char g,unsigned char b)
{
	return &#40;&#40;b&0xf8&#41;<<7&#41;+&#40;&#40;g&0xf8&#41;<<2&#41;+&#40;&#40;r&0xf8&#41;>>3&#41;+0x8000;
&#125;
I got the code from somewhere on this forum, and it's helped me to write a function for loading BMPs for game graphics from the mem card, which is nice.
User avatar
ReKleSS
Posts: 73
Joined: Sat Jun 18, 2005 12:57 pm
Location: Melbourne, Australia

Post by ReKleSS »

I've been using bbbbbgggggrrrrrx as the format. It seems to work. Not sure where I found it thought, so I can't confirm if it's correct.
inomine
Posts: 53
Joined: Thu May 05, 2005 7:26 pm

Re: Pixel format for pgBitBlt call's byte array parameter

Post by inomine »

biermana wrote:
Is is 32bpp rgb or 16bpp rgb or something else?
For a start it's BGR (Blue, Green, Red) rather than the standard sequence of RGB. Secondly the mode is changeable, nem's defauls to 16 bits, there is also appear to be other modes which might well be 32 bit, but I am not sure if anyone has posted the information.
Post Reply