Name
TrimBrush -- remove blank spaces from a brush (V4.6)
Synopsis
left, top = TrimBrush(id)
Function
This command will remove all bordering blank spaces from the specified brush. If the specified brush does not have a mask or an alpha channel, this function does nothing. TrimBrush() will return the number of columns removed from the left side as well as the number of rows removed from the top side of the brush. You can calculate the right/bottom trim values on your own then.

Inputs
id
brush to trim
Results
left
number of columns removed from the left
top
number of rows removed from the top
Example
CreateBrush(1, 640, 480, #BLACK, {Mask = True, Clear = True})
SelectBrush(1, #SELMODE_COMBO)
SetFillStyle(#FILLCOLOR)
Box(#CENTER, #CENTER, 100, 100, #RED)
EndSelect
TrimBrush(1)
The code above will create a 640x480 brush, draw a 100x100 red rectangle to it and then trim it down to 100x100 because all borders are blank.

Show TOC