diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-07-27 12:02:06 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2015-07-31 04:33:20 +0000 |
commit | 6a991f9cce9da6057c4a053e52e5956284805eea (patch) | |
tree | dd6b2fb68016c8723728ea9114f05b603196bfe9 /examples/widgets/doc | |
parent | ad4d25589fcd5efd4faa3074c19928d195f615bb (diff) |
Tablet example: smoother, rotation stylus, better airbrush
The drawing is antialiased and with rounded caps and joins.
Rotation stylus acts like a felt marker.
Airbrush sprays a radial gradient of color, and its alpha can
depend on the tangential pressure if so chosen.
Task-number: QTBUG-46694
Change-Id: I4fb16eb621707e3c56a75aa302dd0d3bf418a745
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Diffstat (limited to 'examples/widgets/doc')
-rw-r--r-- | examples/widgets/doc/src/tablet.qdoc | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/examples/widgets/doc/src/tablet.qdoc b/examples/widgets/doc/src/tablet.qdoc index 1ab2917b7e..bc03d46332 100644 --- a/examples/widgets/doc/src/tablet.qdoc +++ b/examples/widgets/doc/src/tablet.qdoc @@ -259,24 +259,18 @@ \snippet widgets/tablet/tabletcanvas.cpp 5 - In this function we draw on the pixmap based on the movement of the - device. If the device used on the tablet is a stylus we want to draw a - line between the positions of the stylus recorded in \c polyLine. We - also assume that this is a reasonable handling of any unknown device, - but update the statusbar with a warning so that the user can see that - for his tablet he might have to implement special handling. - If it is an airbrush we want to draw a circle of points with a - point density based on the tangential pressure, which is the position - of the finger wheel on the airbrush. We use the Qt::BrushStyle to - draw the points as it has styles that draw points with different - density; we select the style based on the tangential pressure in - \c brushPattern(). + In this function we draw on the pixmap based on the movement of the device. + If the device used on the tablet is a stylus, we want to draw a line from + the last-known position to the current position. We also assume that this + is a reasonable handling of any unknown device, but update the status bar + with a warning. If it is an airbrush, we want to draw a circle filled with + a soft gradient, whose density can depend on various event parameters. + By default it depends on the tangential pressure, which is the position of + the finger wheel on the airbrush. If it is a rotation stylus, we simulate + a felt marker by drawing trapezoidal strokes. \snippet widgets/tablet/tabletcanvas.cpp 6 - We return a brush style with a point density that increases with - the tangential pressure. - In \c updateBrush() we set the pen and brush used for drawing to match \c alphaChannelType, \c lineWidthType, \c colorSaturationType, and \c myColor. We will examine the code to |