| 1 |
<html> |
| 2 |
<center> |
| 3 |
<h2>Vector deformation</h2> |
| 4 |
</center> |
| 5 |
|
| 6 |
<p>This demo shows how to use advanced vector techniques to draw text |
| 7 |
using a <code>QPainterPath</code>.</p> |
| 8 |
|
| 9 |
<p>We define a vector deformation field in the shape of a lens and apply |
| 10 |
this to all points in a path. This means that what is rendered on |
| 11 |
screen is not pixel manipulation, but modified vector representations of |
| 12 |
the glyphs themselves. This is visible from the high quality of the |
| 13 |
antialiased edges for the deformed glyphs.</p> |
| 14 |
|
| 15 |
<p>To get a fairly complex path we allow the user to type in text and |
| 16 |
convert the text to paths. This is done using the |
| 17 |
<code>QPainterPath::addText()</code> function.</p> |
| 18 |
|
| 19 |
<p>The lens is drawn using a single call to <code>drawEllipse()</code>, using |
| 20 |
a <code>QRadialGradient</code> to fill it with a specialized color table, |
| 21 |
giving the effect of the Sun's reflection and a drop shadow. The lens |
| 22 |
is cached as a pixmap for better performance.</p> |
| 23 |
|
| 24 |
</html> |