20.70 Vector brushes

When you load a vector image using LoadBrush() or @BRUSH, you will get a special type of brush: a vector brush. When loading normal images like PNG, JPEG, etc. you will always get a raster brush. You can find out the type of a brush by querying the #ATTRTYPE attribute using GetAttribute().

The advantage of a vector brush is that you can scale and/or transform it without any quality losses. For example, the ScaleBrush(), RotateBrush(), and TransformBrush() commands will produce high-quality images when used with vector brushes. Also, when layers and the layer scaling engine are enabled, vector brush layers will be automatically scaled without any quality losses. Therefore, if you only use vector brushes and TrueType text in your script, it can be scaled to any resolution and will still appear perfectly crisp.

The disadvantage of vector brushes is that they are not supported by all image manipulating functions. Of course, all the major functions like DisplayBrush(), DisplayBrushPart(), ScaleBrush(), RotateBrush(), etc. work fine with vector brushes but certain functions like TintBrush(), GammaBrush(), SelectBrush(), etc. can only handle raster brushes. So if you want to use one of these functions on a vector brush, you need to convert the brush to a raster brush first. This can be done by using the RasterizeBrush() function. Keep in mind, though, that as soon as you convert a vector brush to a raster brush, it will no longer be possible to scale and transform it without sacrifices in quality.

Show TOC