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 

png Alpha level

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



Joined: 09 Mar 2009
Posts: 5

PostPosted: Mon Mar 09, 2009 7:15 am    Post subject: png Alpha level Reply with quote

Hi there, it's my first post and i have a question.
Is there any way to improve graphics.h to make a funcion wich you can set the level of alpha transparency?

Let me explain:
I'm trying to port a little fade in and fade out Allegro funcion that uses "set_trans_blender" method, and the lib graphics.h does'nt any funcion like that...



Sorry About my very bad english... =x
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Wed Mar 11, 2009 6:49 am    Post subject: Reply with quote

Code:
void XgeSetImageOpacity(XgeImage* image, int opacity)
{
    int i;
    int size = image->TextureWidth * image->TextureHeight;
    XgeColor* data = image->data;
    for(i = 0; i < size; i++, data++)
        *data = *data + (((int)((float)((float)0xFF / 100.00f) * (float)opacity) - A(*data)) << 24);
}

;)
_________________
Get Xplora!
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Mar 11, 2009 5:15 pm    Post subject: Reply with quote

There is another formula that doesn't require so many float, should be faster.
Back to top
View user's profile Send private message
kuat



Joined: 09 Mar 2009
Posts: 5

PostPosted: Thu Mar 12, 2009 9:47 pm    Post subject: Reply with quote

Thanx guys!

i'll try it later =D
Back to top
View user's profile Send private message
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