forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to display a PNG image with libpng

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
picobsd



Joined: 19 Apr 2007
Posts: 18

PostPosted: Tue Jul 31, 2007 1:25 am    Post subject: How to display a PNG image with libpng Reply with quote

hi all
my goal is to display the opaque part of a PNG image, and skip the transparent part of it(like acdsee )

I use libpng, use Double Frame Buffer and set display mode to PSP_DISPLAY_PIXEL_FORMAT_8888
the follow is my code fragment:

for (y = 0; y < info_ptr->height; y ++)
{
png_byte *prow = prowtable[y];
for (x = 0; x < info_ptr->width; x ++)
{
b = *prow++;
g = *prow++;
r = *prow++;

a = * prow++; // It' doesnt' work

iRetCode = __rgbaToColorAuto( lpImgData,r,g,b, a);//copy to image buffer
lpImgData+=__global_iPGPixelSize;
}
}

but it does'nt work, I think the fourth byte of png pixel is not as same as psp's alpha channel, Could you please tell me How should I disp a png image correctly?
Back to top
View user's profile Send private message
picobsd



Joined: 19 Apr 2007
Posts: 18

PostPosted: Tue Jul 31, 2007 12:47 pm    Post subject: Reply with quote

I don't know why the alpha channel doesn't work when I put the color value which include rgba into Vram directly.
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Tue Jul 31, 2007 2:23 pm    Post subject: Reply with quote

Try just setting the alpha to 0xff.

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group