Page 1 of 1

Layer brush and FreeBrush()

Posted: Mon Jul 18, 2022 6:42 pm
by Flinx
Hello

I create some buttons by converting a path into a brush with PathToBrush(), displaying it as a layer brush with DisplayBrush and then assigning a button with MakeButton(). While doing this, I collect the IDs in a table, which can be used to remove them later.
I now noticed that it also works to release the brush with FreeBrush() directly after creating the layer with DisplayBrush().
Does the layer of type #BRUSH really not need the original brush anymore? Then I could omit the corresponding table.

Ralf

Re: Layer brush and FreeBrush()

Posted: Fri Jul 22, 2022 10:50 pm
by airsoftsoftwair
Flinx wrote: Mon Jul 18, 2022 6:42 pm Does the layer of type #BRUSH really not need the original brush anymore?
Yes, you can free the brush right after the layer has been created. Hollywood will keep an internal copy of the brush and automatically garbage collect it once it's no longer needed.