This chapter presents properties and selected constants of the Paint class (gb.qt4).
The Paint class has these properties:
Property | Data type | Description |
---|---|---|
AntiAlias | Boolean | Determines or specifies with True that the image is drawn with anti-aliasing (edge smoothing). |
Background | Integer | Sets the background colour or reads out the colour. This is equivalent to setting the Brush property with the result of the colour method. |
Brush | PaintBrush | Sets the brush properties or reads the values. The default brush has a solid, opaque black colour (lines) or the default background colour when painting in a DrawingArea (area) → Chapter 23.3.7 PaintBrush. |
BrushOrigin | PointF | Returns or sets the brush origin. Setting is the same as a suitable translation of the brush with Paintbrush.Translate. |
ClipExtents | PaintExtents | Calculates a bounding box in user coordinates for the area within the current clip → Chapter 23.3.6 PaintExtents |
ClipRect | Rect | Sets the clipping region as a rectangle or reads the current clipping region. |
Dash | Float[ ] | Sets the dash pattern or returns it as a float array. The property is only used in conjunction with the Paint.Stroke method. The number of elements in the float array must always be even. |
DashOffset | Float | Returns or sets the offset in the dash pattern (in coordinate units). |
Device | Object | Specifies the object to be drawn on with the Paint class. |
FillRule | Integer | The fill rule specifies which regions are inside or outside a complex (possibly self-intersecting) path. This property can have one of the following values: FillRuleWinding (default value) or FillRuleEvenOdd. |
Font | Font | Sets the font or reads the font with which text is drawn. |
LineCap | Integer | Determines or sets the end of the line for the current drawing with Paint.Stroke. This property has one of the following values: LineCapButt (default value) or LineCapRound or LineCapSquare. |
LineJoin | Integer | Determines or specifies the way in which lines are joined. This property has one of the following values: LineJoinMiter (default) or LineJoinRound or LineJoinBevel. |
LineWidth | Float | Sets the line thickness with which lines are drawn or reads the line thickness. |
Matrix | PaintMatrix | Sets the current transformation matrix (CTM - Current Transformation Matrix) or returns this matrix → Chapter 23.3.5 PaintMatrix. |
MiterLimit | Float | Sets the current angle limit or reads out this value in conjunction with the LineJoin property and the set value LineJoinMiter. |
Operator | Integer | Returns or sets the composition operator that is used for all drawing operations. The composition operator defines how colours on the drawing area are linked to colours drawn above them. The standard is OperatorOver, the “draw over”. The following applies to the definition of the operators → http://cairographics.org/operators/ . |
PathExtents | PathExtents | Calculates a bounding box (in the coordinates of the CTM) that contains all points of the current path. If the current path is empty, an empty rectangle is returned. Stroke() parameters, fill rules, artboard boundaries and clipping are not taken into account. |
PathOutline | PointF[ ][ ] | Returns an array of polygons corresponding to the current drawing path. |
ResolutionX | Integer | Returns the horizontal resolution (DPI) of the object being drawn on. |
ResolutionY | Integer | Returns the vertical resolution of the object being drawn on. |
Width | Float | Returns the width of the object being drawn on. |
Height | Float | Returns the height of the object being drawn on. |
X | Float | Gives the x-coordinate of the current point. |
Y | Float | Gives the y-coordinate of the current point. |
Table 23.3.1.1.1 : Properties of the Paint class
Only a few selected constants are described for the Paint class. For more information, it is worth taking a look at the pages at http://gambaswiki.org/wiki/comp/gb.qt4/paint.
Constant | Value | Description |
---|---|---|
LineCapButt | 0 | Specifies the rendering of the start and end points exactly at the point boundary in connection with the Paint.Stroke method. |
LineCapRound | 1 | Specifies the rendering of the start and end points with a circular end, where the centre of the end circle is exactly the start and end point. |
LineCapSquare | 2 | Specifies the rendering of the start and end points with a (semi) circular end, whereby the centre of the end circle is exactly the start and end point. |
ExtendPad | 0 | Pixels that lie outside the brush space are given the colour of the nearest pixel within the brush space. |
ExtendRepeat | 1 | The pattern is tiled by repeating it. |
ExtendReflect | 2 | The brush is tiled by reflecting on the edges. |
Table 23.3.1.2.1 : Selected constants of the Paint class
Note: You can only pass the Extend constants as parameters to the Paint.LinearGradient() and Paint.RadialGradient() methods.