Page 1 of 1

Converting a Layer to a Brush Together with Effects. Also, Bug in CreateBorderBrush()

Posted: Mon Oct 21, 2019 3:45 am
by PEB
This post includes a feature request and a bug report. (Andreas: I can separate these into different posts if you prefer.)

If I apply effects (such as border and shadow) to a layer, and then want to transfer the way that layer looks into brush, I can get pretty close by using CreateBorderBrush() and CreateShadowBrush().

Try this code:

Code: Select all

TextOut(#CENTER, #CENTER, "Test", {Name="Text", AnchorX=0.5, AnchorY=0.5})
SetLayerStyle("Text", {Font=#SERIF, FontSize=56, Color=$0, FontStyle=#ANTIALIAS, Border=True, BorderColor=ARGB(120, #YELLOW), BorderSize=5, Shadow=True, ShadowColor=ARGB(200, $0), ShadowSize=3})

ConvertToBrush(#LAYER, "Text", 1)
CreateBorderBrush(2, 1, ARGB(120, #YELLOW), 5)
CreateShadowBrush(3, 2, ARGB(200, $0), 3)

DisplayBrush(3, #CENTER+3, #CENTER+75+3)
DisplayBrush(2, #CENTER, #CENTER+75)
DisplayBrush(1, #CENTER, #CENTER+75)
Here's the bug report: CreateBorderBrush() doesn't seem to apply the alpha transparency value specified in ARGB().

Here's the feature request: Would it be possible to extend ConvertToBrush() in order to include the layer effects in use, and thus more quickly and accurately reproduce the exact look of the layer in the form of a brush?

Re: Converting a Layer to a Brush Together with Effects. Also, Bug in CreateBorderBrush()

Posted: Mon Oct 21, 2019 9:19 pm
by airsoftsoftwair
PEB wrote: Mon Oct 21, 2019 3:45 am This post includes a feature request and a bug report. (Andreas: I can separate these into different posts if you prefer.)
Yes, I'd prefer to keep feature requests and bug reports separate. And you also posted it in the wrong forum, btw :)
PEB wrote: Mon Oct 21, 2019 3:45 am If I apply effects (such as border and shadow) to a layer, and then want to transfer the way that layer looks into brush, I can get pretty close by using CreateBorderBrush() and CreateShadowBrush().
...
Here's the bug report: CreateBorderBrush() doesn't seem to apply the alpha transparency value specified in ARGB().
Thanks, will be fixed.
PEB wrote: Mon Oct 21, 2019 3:45 am Here's the feature request: Would it be possible to extend ConvertToBrush() in order to include the layer effects in use, and thus more quickly and accurately reproduce the exact look of the layer in the form of a brush?
Should be possible. I'll see what I can do.

Re: Converting a Layer to a Brush Together with Effects. Also, Bug in CreateBorderBrush()

Posted: Tue Oct 22, 2019 12:18 am
by PEB
Thanks!

Re: Converting a Layer to a Brush Together with Effects. Also, Bug in CreateBorderBrush()

Posted: Wed Dec 18, 2019 6:32 pm
by airsoftsoftwair

Code: Select all

- Fix: CreateBorderBrush() didn't apply the alpha transparency if it was present in the color passed to it