Oxygen Basic

Programming => Example Code => Topic started by: Aaron on March 19, 2014, 02:06:56 PM

Title: No Alpha Stored
Post by: Aaron on March 19, 2014, 02:06:56 PM
Hi,

It isn't possible to get an Alpha value.
In internal pixel array is no alpha stored,  only R, G, B.

No matter, who needs an alpha ( Romeo Giulietta).

A test here:
Code: [Select]
include "ss.inc"
Openwindow 320,240,1

byte r=1,g=1,b=1,a=1
For x=0, 319
For y=0, 239
    Color Rnd(64,255),Rnd(64,255),Rnd(64,255),225
    SetPixel x,y
Next
Next

pixel = GetPixel 160,120
r = GetR(pixel)
g = GetG(pixel)
b = GetB(pixel)
a = GetA(pixel)

color r, g, b, 255
Fillcircle 120, 80,40

pixel = GetPixel 220,200
r = GetR(pixel)
g = GetG(pixel)
b = GetB(pixel)
a = GetA(pixel)

color r, g, b, 255
FillRect 100,140,40,40


color 255,255,255,255
DrawString 0,0, r " " g " " b " " a
waitkey
closewindow
Title: Re: No Alpha Stored
Post by: JRS on March 19, 2014, 02:40:46 PM
It seems the alpha value is only needed on pixel creation. It's a part of the color creation internal SDL function. All we are seeing is the results of that color (alpha) translation. Knowing what the original values are doesn't seem possible. So much for sampling pixels as map position indicators.

Title: Re: No Alpha Stored
Post by: Aaron on March 19, 2014, 02:51:41 PM
Hi John,

May be I have to look a bit deeper into the matter.
Title: Re: No Alpha Stored
Post by: JRS on March 19, 2014, 03:58:08 PM
Great!

Looking forward to what you come up with.

Making your SDL source available would also be a big help.