Page 1 of 1

GetLayerStyle()/SetLayerStyle() behaviour on AROS?

Posted: Mon Apr 07, 2025 9:29 pm
by ntromans
I don't know if I've missinterpreted the docs, but it looked to me that you should be able to GetLayerStyle() on a layer to pick up all of its attributes and then SetLayerStyle() to push them into another, essentially cloning the first later to the second. However, then I try to do this on AROS I can GetLayerStyle() OK but when I try to put the resulting table into another layer using SetLayerStyle() i get 'no pallette information included' or words to that effect. I've tried reading throught he table and removing any tags set to 'nil' but this hasn;t helped.

Cheers,
Nigel.

Re: GetLayerStyle()/SetLayerStyle() behaviour on AROS?

Posted: Fri Apr 18, 2025 10:57 pm
by airsoftsoftwair
Could be a bug. Can you post an MCVE that I can try here?

Re: GetLayerStyle()/SetLayerStyle() behaviour on AROS?

Posted: Wed May 07, 2025 9:57 pm
by ntromans
Again, many apologies for the delay in getting back to you.

To show the behaviour:

Code: Select all

; Program to test getlayerstyle and setlayerstyle

@OPTIONS {enabledebug=TRUE}
EnableLayers()

; make first shape
setfillstyle(#FILLGRADIENT,#RADIAL,#WHITE,#BLUE)
box(50,50,50,50,#BLUE,{name="box1"})

; make second shape
setfillstyle(#FILLGRADIENT,#RADIAL,#WHITE,#RED)
box(150,150,50,50,#RED,{name="box2"})

waitleftmouse()

style = {}

; get style of first
style = getlayerstyle("box1")

; set to second box
setlayerstyle("box2",style)

waitleftmouse()
The program shows two gradient filled boxes, waits for LMB press, and then ideally would copy the style of box1 to box2, except it gives the 'Image data does not have a palette" error.

Thanks,
Nigel.

Re: GetLayerStyle()/SetLayerStyle() behaviour on AROS?

Posted: Sun May 11, 2025 7:15 pm
by airsoftsoftwair
Ok, I can reproduce it. Will be fixed!

Re: GetLayerStyle()/SetLayerStyle() behaviour on AROS?

Posted: Sun May 18, 2025 5:56 pm
by airsoftsoftwair
Thinking about it again, it's not a bug. GetLayerStyle() returns all kinds of additional information like "PaletteMode", "Pen", etc tags. So you can't just grab the result table from GetLayerStyle() and inject it into SetLayerStyle(). You have to filter out the relevant attributes and pass only those to SetLayerStyle().