User Tools

Site Tools




23.3.7 PaintBrush

The PaintBrush (gb.qt4/5) class represents a brush for drawing lines and areas, as returned by the following methods:

  • Paint.Colour,
  • Paint.Image,
  • Paint.LinearGradient and
  • Paint.RadialGradient.

Note that the boundaries of gradient brushes are drawn without anti-aliasing when the coordinate system is scaled, as you can see in Figure Scaled, rotated LinearGradient (ExtendRepeat) with visibly missing anti-aliasing at the lower boundary:


Figure Without anti-aliasing Property PaintBrush.Matrix

The class has only one property: PaintBrush.Matrix of type PaintMatrix. It sets the brush transformation matrix or reads this matrix. This matrix describes the transformation between the brush space and the user space.

When a brush is created for the first time, a transformation matrix is always generated as an identity matrix, whereby the brush space is initially identical to the user space. Please note that the transformation matrix always maps the brush space to the user space.

For example, you duplicate an existing brush that is twice the size of the standard brush in both dimensions, because Scale modifies the existing object to which it is applied:

Dim myBrush As PaintBrush 
myBrush.Scale(2.0, 2.0) Methods

The PaintBrush class has these methods:

Translate ( TX As Float, TY As Float )Changes the brush transformation matrix by shifting the brush space origin by TX and TY. TX: Shift in the X direction TY: Shift in the Y direction
Scale ( SX As Float, SY As Float )Modifies the brush transformation matrix by scaling the X and Y brush space axes by the scaling factors SX and SY. The axes are scaled according to an existing brush transformation. SX: Scaling factor for the X dimension. SY: Scaling factor for the Y dimension.
Rotate ( Angle As Float )Changes the brush transformation matrix by rotating the brush space axes by the given rotation angle Angle (radian measure). The direction of rotation for positive rotation angles corresponds to a rotation from the positive x-axis in the direction of the positive y-axis → mathematically positive.
Reset ( )Resets the brush transformation matrix to the default value (identity).

Table : Methods of the PaintBrush class

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k23/k23.3/k23.3.7/start.txt · Last modified: 07.03.2024 by emma

Page Tools