[05 Mar 2010] Moving Layers ontop of a Brush?

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

[05 Mar 2010] Moving Layers ontop of a Brush?

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 05 Mar 2010 10:08:13 -0000

Is it possible to move a layer which was drawn on a brush, i.e.

Code: Select all

SelectBrush(1)
Circle(10,10,10,{name="myCircle"})
EndSelect
?

Something like:

Code: Select all

SetLayerStyle("myCircle",{x=30,y=40})
seems to have no effect.

Thanks, Tom
PEB
Posts: 576
Joined: Sun Feb 21, 2010 1:28 am

[05 Mar 2010] Re: Moving Layers ontop of a Brush?

Post by PEB »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 05 Mar 2010 16:47:29 -0000

By using SelectBrush(), your circle becomes part of the brush (not a separate layer).

So if you want it to treat it as a separate layer, then you can draw it over the brush, but do not make it part of the brush. In other words, don't use SelectBrush() when you draw your circle.
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[05 Mar 2010] Re: Moving Layers ontop of a Brush?

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 05 Mar 2010 23:05:12 +0100
By using SelectBrush(), your circle becomes part of the brush (not a separate layer).
Not really, because the layer still exists and is not freed. You can access it with GetAttribute() and also SetLayerStyle() does not cause an error on that layer. Unfortunately, it also has no effect to use SetLayerStyle().

More over, by using SelectBGPic(), the circle also does not become part of the BGPic :-), so this behaviour seems to be somehow inconsistent.
So if you want it to treat it as a separate layer, then you can draw it over the brush, but do not make it part of the brush. In other words, don't use SelectBrush() when you draw your circle.
That doest not work in my case, because I want to have a "whole" in a layer, which shows the layer behinde. The only way to do that, which i can see, is, to draw the circle on a brush and then to select the brush's alpha channel. Unfortunately, then, you cannot move the circle anymore.

The final (not very nice) solution is then, to make the brush double as hight and double as wide as the screen resolution and then to move the entire brush (inclusively the circle). This isn't too fast on high resolution screens :-)

Thanks for your response! Tom
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[07 Mar 2010] Re: Re: Moving Layers ontop of a Brush?

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 07 Mar 2010 22:28:41 +0100
Not really, because the layer still exists and is not freed. You can access it with GetAttribute() and also SetLayerStyle() does not cause an error on that layer. Unfortunately, it also has no effect to use SetLayerStyle().
No, Paul is right :) Whenever SelectBrush() is active, no layers are added. You might not get an error message, but the layer is definitely not added. You will always be drawing directly to the brush. Just try:

Code: Select all

EnableLayers
CreateBrush(1, 320, 256)
SelectBrush(1)
Box(0, 0, 320, 256, #RED, {Name = "bla"})
EndSelect
DebugPrint(GetAttribute(#DISPLAY, 0, #ATTRLAYERS))
WaitLeftMouse
End
This will print 0.
More over, by using SelectBGPic(), the circle also does not become part of the BGPic :-), so this behaviour seems to be somehow inconsistent.
Yes, it is inconsistent, read the doc on SelectBGPic() which elaborates extensively on this topic :) By using one of the optional arguments you can force SelectBGPic() into a mode that is similar to that of SelectBrush(). The default mode, however, is #SELMODE_LAYERS.
That doest not work in my case, because I want to have a "whole" in a layer, which shows the layer behinde. The only way to do that, which i can see, is, to draw the circle on a brush and then to select the brush's alpha channel. Unfortunately, then, you cannot move the circle anymore.

The final (not very nice) solution is then, to make the brush double as hight and double as wide as the screen resolution and then to move the entire brush (inclusively the circle). This isn't too fast on high resolution screens :-)
You can force a layer refresh by using the "ID" tag of SetLayerStyle(), i.e.

Code: Select all

DisplayBrush(1, 0, 0)
.... modify brush here...
SetLayerStyle(1, {ID = 1})   ; update brush layer
Admittedly, this is not very convenient. But I hope to implement a SelectLayer() function some time soon.
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[09 Mar 2010] Re: Moving Layers ontop of a Brush?

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 09 Mar 2010 20:30:37 +0100
No, Paul is right :) Whenever SelectBrush() is active, no layers are added. You might not get an error message, but the layer is definitely not added. You will always be drawing directly to the brush. Just try:

Code: Select all

EnableLayers
CreateBrush(1, 320, 256)
SelectBrush(1)
Box(0, 0, 320, 256, #RED, {Name = "bla"})
EndSelect
DebugPrint(GetAttribute(#DISPLAY, 0, #ATTRLAYERS))
WaitLeftMouse
End
This will print 0.
True :-) Thanks!
You can force a layer refresh by using the "ID" tag of SetLayerStyle(), i.e.

Code: Select all

DisplayBrush(1, 0, 0)
.... modify brush here...
SetLayerStyle(1, {ID = 1})   ; update brush layer
Maybe this is faster? Hm. Have to test this. For now, i move the whole brush with double size of the display, which works ok, but is much slower than moving just a circle :-)

I just wanted to create a AVI which shows what I'm currently doing. Unfortunately, it's pretty slow to create a 800x600 presentation -- even on a Peg2 and writing to RAM: ;-) After some mouse interactions, it then even crashed before the video was done :-(. Too bad :-)

Oh, another Bug report:

The transition effect: #WATER2 causes on AOS4 always a system freeze!

Thanks a lot!

Tom
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[13 Mar 2010] Re: Re: Moving Layers ontop of a Brush?

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 13 Mar 2010 00:33:41 +0100
Maybe this is faster? Hm. Have to test this. For now, i move the whole brush with double size of the display, which works ok, but is much slower than moving just a circle :-)

I just wanted to create a AVI which shows what I'm currently doing. Unfortunately, it's pretty slow to create a 800x600 presentation -- even on a Peg2 and writing to RAM: ;-) After some mouse interactions, it then even crashed before the video was done :-(. Too bad :-)
Of course that doesn't help me to solve the problem :-) I need clear instructions how to reproduce the crash here :)
Oh, another Bug report:

The transition effect: #WATER2 causes on AOS4 always a system freeze!
Hmm, couldn't reproduce this either. I guess it only happens with a certain layer setup or something, so I'd need a small example that demonstrates the crash.
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[07 Apr 2010] Re: Moving Layers ontop of a Brush?

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 07 Apr 2010 08:57:03 -0000
You can force a layer refresh by using the "ID" tag of SetLayerStyle(), i.e.

Code: Select all

DisplayBrush(1, 0, 0)
.... modify brush here...
SetLayerStyle(1, {ID = 1})   ; update brush layer
To get rid of the crashes (see post about stack problems before), i decided to change the implemention in the way you suggested it here. No, i always update the brush by redrawing the part which have changed instead of moving the whole brush.

This works nicely. It's still not as smooth as moving a reasonable sized layer around, but it is not slower than moving a huge (with double the size of the display) layer around and there's no crash anymore.

So, thanks for this suggestion, it makes my life a tick easier ;-)

regards, Tom
Locked