User Tools

Site Tools




23.3.1 Properties and constants of the Paint class

This chapter presents properties and selected constants of the Paint class (gb.qt4). Properties

The Paint class has these properties:

PropertyData typeDescription
AntiAlias BooleanDetermines or specifies with True that the image is drawn with anti-aliasing (edge smoothing).
BackgroundIntegerSets the background colour or reads out the colour. This is equivalent to setting the Brush property with the result of the colour method.
Brush PaintBrushSets 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.
BrushOriginPointFReturns or sets the brush origin. Setting is the same as a suitable translation of the brush with Paintbrush.Translate.
ClipExtentsPaintExtentsCalculates a bounding box in user coordinates for the area within the current clip → Chapter 23.3.6 PaintExtents
ClipRectRectSets the clipping region as a rectangle or reads the current clipping region.
DashFloat[ ]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.
DashOffsetFloatReturns or sets the offset in the dash pattern (in coordinate units).
DeviceObjectSpecifies the object to be drawn on with the Paint class.
FillRuleIntegerThe 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.
FontFontSets the font or reads the font with which text is drawn.
LineCapIntegerDetermines 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.
LineJoinIntegerDetermines or specifies the way in which lines are joined. This property has one of the following values: LineJoinMiter (default) or LineJoinRound or LineJoinBevel.
LineWidthFloatSets the line thickness with which lines are drawn or reads the line thickness.
MatrixPaintMatrixSets the current transformation matrix (CTM - Current Transformation Matrix) or returns this matrix → Chapter 23.3.5 PaintMatrix.
MiterLimitFloatSets the current angle limit or reads out this value in conjunction with the LineJoin property and the set value LineJoinMiter.
OperatorIntegerReturns 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 → .
PathExtentsPathExtentsCalculates 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.
PathOutlinePointF[ ][ ] Returns an array of polygons corresponding to the current drawing path.
ResolutionXIntegerReturns the horizontal resolution (DPI) of the object being drawn on.
ResolutionYIntegerReturns the vertical resolution of the object being drawn on.
WidthFloatReturns the width of the object being drawn on.
HeightFloatReturns the height of the object being drawn on.
XFloatGives the x-coordinate of the current point.
YFloatGives the y-coordinate of the current point.

Table : Properties of the Paint class Selected constants

Only a few selected constants are described for the Paint class. For more information, it is worth taking a look at the pages at

LineCapButt0Specifies the rendering of the start and end points exactly at the point boundary in connection with the Paint.Stroke method.
LineCapRound1Specifies 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.
LineCapSquare2Specifies 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.
ExtendPad0Pixels that lie outside the brush space are given the colour of the nearest pixel within the brush space.
ExtendRepeat1The pattern is tiled by repeating it.
ExtendReflect2The brush is tiled by reflecting on the edges.

Table : Selected constants of the Paint class

Note: You can only pass the Extend constants as parameters to the Paint.LinearGradient() and Paint.RadialGradient() methods.

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.1/start.txt · Last modified: 04.03.2024 by emma

Page Tools