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 cover the PNG image with another PNG image?

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



Joined: 29 Aug 2008
Posts: 7

PostPosted: Mon Sep 15, 2008 7:16 pm    Post subject: How to cover the PNG image with another PNG image? Reply with quote



My Code :
Code:

#include <sdl.h>
#include <sdl_image.h>

void main(){
  Surf_Display = SDL_SetVideoMode(400,400, 32, SDL_HWSURFACE | SDL_DOUBLEBUF));
  SDL_Surface* png1 = IMG_Load("png1.png");
  SDL_Surface* png2 = IMG_Load("png2.png");
  SDL_BlitSurface(png1, NULL, png2,NULL);
  SDL_BlitSurface(png2, NULL,Surf_Display,NULL);
  SDL_Flip(Surf_Display);
 
}
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Tue Sep 16, 2008 12:15 am    Post subject: Reply with quote

You are blitting your image in the pn2 surface!
Code:

#include <sdl.h>
#include <sdl_image.h>

void main(){
  Surf_Display = SDL_SetVideoMode(400,400, 32, SDL_HWSURFACE | SDL_DOUBLEBUF));
  SDL_Surface* png1 = IMG_Load("png1.png");
  SDL_Surface* png2 = IMG_Load("png2.png");
  SDL_BlitSurface(png2, NULL,Surf_Display,NULL);
  SDL_BlitSurface(png1, NULL, Surf_Display,NULL);
  SDL_Flip(Surf_Display);
 
}

Try this...
Back to top
View user's profile Send private message
lifecat9



Joined: 29 Aug 2008
Posts: 7

PostPosted: Tue Sep 16, 2008 2:43 am    Post subject: Reply with quote

ne0h wrote:
You are blitting your image in the pn2 surface!
Code:

#include <sdl.h>
#include <sdl_image.h>

void main(){
  Surf_Display = SDL_SetVideoMode(400,400, 32, SDL_HWSURFACE | SDL_DOUBLEBUF));
  SDL_Surface* png1 = IMG_Load("png1.png");
  SDL_Surface* png2 = IMG_Load("png2.png");
  SDL_BlitSurface(png2, NULL,Surf_Display,NULL);
  SDL_BlitSurface(png1, NULL, Surf_Display,NULL);
  SDL_Flip(Surf_Display);
 
}

Try this...


That's a good idea,think you!

But the Surf_Display will lost png1 and png2's alpha informats(suppose Surf_Display is transparence).How to save alpha informats?
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Tue Sep 16, 2008 5:18 am    Post subject: Reply with quote

Short answer: you simply can't on PSP
_________________
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
Back to top
View user's profile Send private message Visit poster's website
lifecat9



Joined: 29 Aug 2008
Posts: 7

PostPosted: Tue Sep 16, 2008 10:10 pm    Post subject: Reply with quote

Raphael wrote:
Short answer: you simply can't on PSP


?????
Yes!I cross out some codes;

this is SDL problem,of course you can use SDL in PSP.
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Wed Sep 17, 2008 1:47 am    Post subject: Reply with quote

OK, a little longer answer to make it clear:
You can't write to alpha on PSP (hardware limitation unless SDL would use a software method for blended blitting which is just slow), hence why you can't save the alpha part of png1 into png2 and then blit that to screen.
You have to do as ne0h suggested and just blit your images to screen directly in the proper order.
_________________
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
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