Discuss the development of new homebrew software, tools and libraries.
Moderators: cheriff , TyRaNiD
lifecat9
Posts: 7 Joined: Fri Aug 29, 2008 12:45 pm
Post
by lifecat9 » Mon Sep 15, 2008 7:16 pm
My Code :
Code: Select all
#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);
}
ne0h
Posts: 386 Joined: Thu Feb 21, 2008 2:15 am
Post
by ne0h » Tue Sep 16, 2008 12:15 am
You are blitting your image in the pn2 surface!
Code: Select all
#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...
lifecat9
Posts: 7 Joined: Fri Aug 29, 2008 12:45 pm
Post
by lifecat9 » Tue Sep 16, 2008 2:43 am
ne0h wrote: You are blitting your image in the pn2 surface!
Code: Select all
#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?
Raphael
Posts: 646 Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:
Post
by Raphael » Tue Sep 16, 2008 5:18 am
Short answer: you simply can't on PSP
lifecat9
Posts: 7 Joined: Fri Aug 29, 2008 12:45 pm
Post
by lifecat9 » Tue Sep 16, 2008 10:10 pm
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.
Raphael
Posts: 646 Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:
Post
by Raphael » Wed Sep 17, 2008 1:47 am
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.