[03 Apr 2010] SelectAlphaChannel ?

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[03 Apr 2010] SelectAlphaChannel ?

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 03 Apr 2010 16:27:45 -0000

If i execute the following code, i get gfx errors at the corners of the drawn box. Actually, there shouldn't be any corner at all.

What I want to do is, to get a box with round corners and with a fading fill color from inside to outside. (to later simulate shadows for gfx objects).

Is this a bug? Am I doing something wrong? Or is it just not possible to do that, what I want to do :-)

regards, Tom

Code: Select all

@VERSION  4,5
@DISPLAY { Width=640, Height=480, Color = #WHITE, Title = "test" }

EnableLayers()
SetFillStyle(#NORMAL)
SetFillStyle(#FILLCOLOR)
Box(200, 200, 255, 255, #BLUE,{name="box",Roundlevel=57})

ConvertToBrush(#LAYER,"box",1)
RemoveLayer("box")

SelectAlphaChannel(1)
  For Local i=0 To 255\2
     SetAlphaIntensity(i)
     Box(i,i,255-(i*2),255-(i*2),#RED,{roundlevel=57})
   Next
EndSelect

DisplayBrush(1,200,200,{hidden=False,name="box")

Repeat
   WaitEvent
Forever
PEB
Posts: 576
Joined: Sun Feb 21, 2010 1:28 am

[03 Apr 2010] Re: SelectAlphaChannel ?

Post by PEB »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 3 Apr 2010 09:54:30 -0700 (PDT)

The reason why there are corners is because you created a brush without an alpha-channel. Try the following code:

Code: Select all

EnableLayers( )
SetFillStyle( #NORMAL)
SetFillStyle( #FILLCOLOR)
SetFormStyle(#ANTIALIAS)
CreateBrush(1, 255, 255, $0, {AlphaChannel = True, Clear = True})
SelectBrush(1, #SELMODE_COMBO)
Box(0, 0, 255, 255, #BLUE,{Roundlevel =57})
SelectAlphaChannel( 1)
For Local i=0 To 255\2
SetAlphaIntensity( i)
Box(i,i,255- (i*2),255- (i*2),#RED, {roundlevel= 57})
Next
EndSelect
DisplayBrush( 1,200,200, {hidden=False, name="box"})
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[03 Apr 2010] Re: SelectAlphaChannel ?

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 03 Apr 2010 23:20:53 +0200

Very cool. Thanks a lot!

Tom
Locked