| View previous topic :: View next topic |
| Author |
Message |
kuat
Joined: 09 Mar 2009 Posts: 5
|
Posted: Mon Mar 09, 2009 7:15 am Post subject: png Alpha level |
|
|
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 |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Wed Mar 11, 2009 6:49 am Post subject: |
|
|
| 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 |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Wed Mar 11, 2009 5:15 pm Post subject: |
|
|
| There is another formula that doesn't require so many float, should be faster. |
|
| Back to top |
|
 |
kuat
Joined: 09 Mar 2009 Posts: 5
|
Posted: Thu Mar 12, 2009 9:47 pm Post subject: |
|
|
Thanx guys!
i'll try it later =D |
|
| Back to top |
|
 |
|