GLBasic forum

Main forum => Bug Reports => Topic started by: spacefractal on 2012-Mar-15

Title: minor "bug": Little savebmp alpha issues
Post by: spacefractal on 2012-Mar-15
There is some alpha issues when I trying to save a screen shots from Greedy Mouse (which use white alpha). I gonna think this picture talk for itself:
(http://dl.dropbox.com/u/3236515/GreedyMouse/savepng.png)

When loaded in a paint app which use black as auto alpha, then its would look like this (I used the good old Paint Shop Pro 7):
(http://dl.dropbox.com/u/3236515/GreedyMouse/savepng2.png)

its all about some alpha issue.....

PS. Absoulutty is mightbeen just a request rather than a bug to add a optimal "noalpha" argument to the savebmp to remove it. That could fix it.
Title: Re: minor "bug": Little savebmp alpha issues
Post by: spacefractal on 2012-Mar-17
when my friend take a picture on his machine its look like this:
(http://dl.dropbox.com/u/3236515/GreedyMouse/savepng3.png)

but when open in a paint app which use black alpha then its look completly fine (so I need to get throught a paint app first, which is what I did before annonce of this game).
Title: Re: minor "bug": Little savebmp alpha issues
Post by: Kitty Hello on 2012-Mar-19
you must use a program that can edit the rgb and alpha channel. You must set a rgb colour for each alpha blended pixel.
You might be able to fix this with LOADSPRITEMEM and MEM2SPRITE yourself. But it's a hack.
Title: Re: minor "bug": Little savebmp alpha issues
Post by: spacefractal on 2012-Mar-19
yep its seen I need to look into those, but its only use on PC and MAC, but not need on mobile, so the hack like that could work.... when I done and get it to work I will post here.
Title: Re: minor "bug": Little savebmp alpha issues
Post by: spacefractal on 2012-Mar-23
seen i could just clean up the alpha and the save the image and look as its should. For interesed for others, here is the code:

Code (glbasic) Select

FUNCTION Image_Snap: File$
GLOBAL IDSNAP=0
LOCAL Width, Height, ok, a, r, g, b
LOCAL pix%[]
GETSCREENSIZE Width, Height
IF IDSNAP=0 THEN IDSNAP=GENSPRITE()
GRABSPRITE IDSNAP, 0, 0, Width, Height
IF SPRITE2MEM(pix[], IDSNAP)
LOCAL total=BOUNDS(pix[],0)
FOR i=0 TO total-1
r = bAND(pix[i], 0xff)
g = bAND(ASR(pix[i],8), 0xff)
b = bAND(ASR(pix[i],16), 0xff)
a = bAND(ASR(pix[i],24), 0xff)
a = 255
pix[i] = bOR(RGB(r,g,b), ASL(a, 24))
NEXT
IF MEM2SPRITE(pix, IDSNAP, Width, Height)
SAVESPRITE File$, IDSNAP
ENDIF
GRABSPRITE IDSNAP, 0, 0, 8, 8
ENDIF
ENDFUNCTION