Hi,
I want to load and save brushes with transparency in HollyPaint.
What I've gathered from the documentation:
Mask and alpha channel are mutually exclusive.
#IMGFMT_PNG saves alpha channel if available.
RotateBrush and SetBrushTransparency are supposed to create a mask. What happens if the brush already has an alpha channel?
Mask / alpha questions
Re: Mask / alpha questions
From my knowledge RotateBrush() should use the existing alpha channel rotatin git accordingly (I've used it on PNG images), don't know what happen with SetBrushTransparency()
----------------------------
[Allanon] Fabio Falcucci | GitHub (leaving) | Gitea (my new house) | My Patreon page | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub (leaving) | Gitea (my new house) | My Patreon page | ☆★ All my links ★☆
Re: Mask / alpha questions
OK, I'm assuming that the brush functions can handle both mask and alpha channel.
I'm loading the alpha channel if available:
I'm changing from mask to alpha channel before saving:
Seems to work so far.
I'm loading the alpha channel if available:
Code: Select all
Local ispic, table = IsPicture(filename)
If ispic
Local newbrush = LoadBrush(Nil, filename, {LoadAlpha=table.Alpha})
Code: Select all
If GetAttribute(#BRUSH, Brush.brush, #ATTRHASMASK)
ChangeBrushTransparency(Brush.brush, #ALPHACHANNEL)
EndIf
SaveBrush(Brush.brush, filename, Canvas.backcolor, #IMGFMT_PNG)
- airsoftsoftwair
- Posts: 5887
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Mask / alpha questions
SetBrushTransparency() will always create a mask for the brush. If the brush already has an alpha channel, it will be deleted.
All the other image processing functions like RotateBrush(), ScaleBrush(), etc. work with both, mask and alpha channel. If there is a mask or an alpha channel, it will be processed as well.
All the other image processing functions like RotateBrush(), ScaleBrush(), etc. work with both, mask and alpha channel. If there is a mask or an alpha channel, it will be processed as well.