Grabbing from a PNG... problems...?

Previous topic - Next topic

bigsofty

Yes, although I think my original test image result was a little different.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

so... is it right or wrong?

bigsofty

Wrong I'm afraid, both images should be the same if all the RGBA channels have been copied.

The 1st line...
Code (glbasic) Select
DRAWRECT 0,0,512,256,RGB(255,0,0)...was in, to test if the channels were being copied correctly, its kinda irrelevant, so setting it to ...
Code (glbasic) Select
DRAWRECT 0,0,512,256,RGB(0,0,0)...results in the correct image but as you can see there is no 8bit alpha channel.

Preferably it should look like this...

Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

AndyH

I'm still not certain that GrabSprite would have any alpha information to grab, unless Gernot is storing that with the backbuffer image.  But then I would wonder for what purpose as the backbuffer is not transparent, it does not get shown on top of anything else.  You just draw to it, and as you draw any sprites with alpha information will get drawn in that way.  Grabsprite will only ever grab the pixels as they are seen, like doing a screen copy unless I have that wrong.

Perhaps what is needed is alpha support for the create screen and/or the ability to modify the alpha channel information on sprites through commands?

The issue I found was with the original image - parts of the alpha channel that were very transparent were not drawn at all.  I think it is likely to be related to the ALPHAMODE command where values in the range of -0.14 to +0.14 were not being drawn.

bigsofty

If GRABSPRITE could use a sprite as the source... that could solve this?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

Then you must use CREATESCREEN. The problem is, that some (especially 16 bit) back buffers do not have any alpha information stored. That's bad, but I can't help. Thus, I'm performing a pixel-per-pixel check when grabspriting from such a back buffer and store the transparent pixels as 0, others as 255. Alpha in between gets lost.

bigsofty

I'm away from my computer just now, I'll give CREATESCREEN a go when I come back.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)