Layer brush and FreeBrush()

Discuss any general programming issues here
Post Reply
Flinx
Posts: 192
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Layer brush and FreeBrush()

Post 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
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Layer brush and FreeBrush()

Post 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.
Post Reply