LB Booster
« semi-transparent sprite »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:36am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: semi-transparent sprite  (Read 1731 times)
tsh73
Guest
xx Re: semi-transparent sprite
« Reply #6 on: Feb 20th, 2012, 07:25am »

Quote:
The norm in Windows is for sprites/icons to have a pre-multiplied foreground; that is, the sprite's foreground should be multiplied by the alpha value (transparency). You are not doing that in your program,

I was never aware of it. Looks really interesting.
Thanks for the info.
I will do some tinkering with that, when time permits.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: semi-transparent sprite
« Reply #7 on: Feb 20th, 2012, 09:17am »

on Feb 20th, 2012, 07:25am, Guest-tsh73 wrote:
I will do some tinkering with that, when time permits.

In your slide rule program you could usefully change this line:

Code:
#gr2 "color red" 
to
Code:
#gr2 "color 63 0 0" 

Since the 'transparency' value for the line is set to 192 (lightgray) the amplitude of the 'foreground' shouldn't exceed 63, so that when it is superimposed on a white background it doesn't clip.

You probably won't see any difference, but this change would give a slightly more realistic 'semi-transparent' line if it was superimposed on a more complex background.

Richard.
User IP Logged

tsh73
Guest
xx Re: semi-transparent sprite
« Reply #8 on: Feb 20th, 2012, 10:11am »

Quote:
You probably won't see any difference

Exactly.
But it always nice to know "why".
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: semi-transparent sprite
« Reply #9 on: Feb 25th, 2012, 5:40pm »

on Feb 18th, 2012, 5:06pm, Richard Russell wrote:
I take it back: it's not LB misbehaving

I know I keep changing my mind, but LB definitely isn't exhibiting true transparency. Try running this program under both LB (4.04) and LBB (1.80):

Code:
'LB vs LBB difference
nomainwin

WindowWidth = 600
WindowHeight =  300

open "test" for graphics_nsb as #gr
#gr "trapclose [quit]"
#gr "down"

loadbmp "bg", "C:\progra~1\libert~1.04\sprites\bg1.bmp"
#gr "background bg"

d=130
for i = 0 to 255
    c$=i;" ";i;" ";i
    #gr "color ";c$
    #gr "line ";i;" ";0;" ";i;" ";d
    #gr "color black "
    #gr "line ";i;" ";d;" ";i;" ";2*d
next
#gr "Getbmp sprite 0 0 256 ";2*d
#gr "Addsprite sprite sprite"
#gr "Spritexy sprite 0 0"
#gr "SpriteScale sprite 234"

#gr, "Drawsprites"
wait

[quit]
    close #gr
    unloadbmp "sprite"
    unloadbmp "bg"
end 

Under LBB the transparency works as you would expect, with the sprite being fully opaque on the left and fully transparent on the right, with a gradual transition.

But under LB the sky and the clouds behave as they do in LBB, but the mountains and the rest of the background behave as though the sprite is fully opaque in the left half and fully transparent in the right half:

User Image

In other words, depending on the background colour the sprite exhibits both linear transparency (like LBB does now) and binary transparency (like LBB did previously). My mind is boggling at this result - it appears to make no sense at all!

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls