xerpi / libvita2d

Simple and Fast (using the GPU) 2D library for the PSVita
MIT License
137 stars 52 forks source link

Set Image Alpha? #47

Closed ideal-fire closed 7 years ago

ideal-fire commented 7 years ago

I'd like to set an image's alpha so I can make a fadein/fadeout effect. Is there any way to do this? I tried using vita2d_draw_texture_tint. It did change the alpha, but it also changed the image's colors.

Code I tried: vita2d_draw_texture_tint(image, 0, 0, RGBA8(255,255,255,50)); vita2d_draw_texture_tint(image, 300, 100, RGBA8(0,0,0,127)); vita2d_draw_texture_tint(image, 500, 100, RGBA8(0,0,0,255)); Result: http://i.imgur.com/0jFvBp5.jpg

xerpi commented 7 years ago

Since the blending is multiplicative, RGBA(255, 255, 255, alpha) where alpha goes from 0 to 255.