wrong alpha color

New to FreeBASIC? Post your questions here.
Post Reply
toto971
Posts: 86
Joined: Jul 22, 2013 15:27

wrong alpha color

Post by toto971 »

hello all,
see this code

Code: Select all

#include "fbgfx.bi"

dim as any ptr imags

using fb
screenres 1280,800,32,,GFX_SHAPED_WINDOW
    Color RGBA(255,0,255,255),RGBA(255,0,255,255)
    cls
imags= ImageCreate( 1280, 600 )      
circle imags,(100,100),25,rgba(243,50,133,65),,,,f
circle imags,(100,120),25,rgba(123,150,233,65),,,,f

put(0,0),imags,alpha,255          ' normal color
put step(120,120),imags,alpha,21 ' with alpha 
sleep
why i can't get good transparency color ?
thanks
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Re: wrong alpha color

Post by Merick »

I did a quick edit:

Code: Select all

#include "fbgfx.bi"

dim as any ptr imags

using fb
screenres 1280,800,32,,GFX_SHAPED_WINDOW
Color RGBA(255,0,255,255),RGBA(255,0,255,255)
cls
imags= ImageCreate( 1280, 600 )
circle imags,(100,100),25,rgba(243,50,133,65),,,,f
circle imags,(100,120),25,rgba(123,150,233,65),,,,f

dim as ubyte i
dim as string k
while k = ""
	k = inkey
   i += 1
	put(0,0),imags,alpha,255          ' normal color
	put (120,120),imags,alpha, i ' with alpha
	sleep 5
	cls
wend
sleep
From the results of this, I think the problem is that the colors of the circles are getting blended with the pink color that is used to set the transparent areas of the window. As the alpha value goes up, less of the pink color shows through the circles return to the original color.
Post Reply