 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
lifecat9
Joined: 29 Aug 2008 Posts: 7
|
Posted: Mon Sep 15, 2008 7:16 pm Post subject: How to cover the PNG image with another PNG image? |
|
|
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 |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Tue Sep 16, 2008 12:15 am Post subject: |
|
|
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 |
|
 |
lifecat9
Joined: 29 Aug 2008 Posts: 7
|
Posted: Tue Sep 16, 2008 2:43 am Post subject: |
|
|
| 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 |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
|
| Back to top |
|
 |
lifecat9
Joined: 29 Aug 2008 Posts: 7
|
Posted: Tue Sep 16, 2008 10:10 pm Post subject: |
|
|
| 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 |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Wed Sep 17, 2008 1:47 am Post subject: |
|
|
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 |
|
 |
|
|
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
|