# HG changeset patch
# User mwarning
# Date 1245278382 0
# Node ID 849b66609571d0ebf0731d5ee5c2b2771711e359
# Parent 624b4a58556eb2f4bae26cbcb6d4527ee2c7d9e1
a few fixes
diff -r 624b4a58556e -r 849b66609571 demos/deform/build.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/deform/build.sh Wed Jun 17 22:39:42 2009 +0000
@@ -0,0 +1,5 @@
+#! /bin/bash
+
+../../tools/drcc/drcc deform.qrc -o qrc_deform.d
+
+ldc main.d pathdeform.d qrc_deform.d ../shared/arthurstyle.d ../shared/arthurwidgets.d -L-L../../lib -L-lqtdgui -L-lqtdcore -I../../ -I../../qt/d1 -L-lQtGui -L-lQtCore -ofbrowser -d-version=QT_NO_UITOOLS
diff -r 624b4a58556e -r 849b66609571 demos/deform/deform.qrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/deform/deform.qrc Wed Jun 17 22:39:42 2009 +0000
@@ -0,0 +1,6 @@
+
+
+ pathdeform.d
+ pathdeform.html
+
+
diff -r 624b4a58556e -r 849b66609571 demos/deform/main.d
--- a/demos/deform/main.d Wed Jun 17 17:42:02 2009 +0000
+++ b/demos/deform/main.d Wed Jun 17 22:39:42 2009 +0000
@@ -38,38 +38,37 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+module main;
-import
- pathdeform,
- arthurstyle,
- qt.gui.QApplication;
+
+import qt.gui.QApplication;
+import pathdeform;
+import arthurstyle;
int main(string[] args)
{
- //Q_INIT_RESOURCE(deform);
-
- scope app = new QApplication(args);
+ scope app = new QApplication(args);
- bool smallScreen = false;
- foreach (arg; args)
- {
- if (arg == "-small-screen")
- smallScreen = true;
- }
+ bool smallScreen = false;
+ foreach (arg; args)
+ {
+ if (arg == "-small-screen")
+ smallScreen = true;
+ }
- scope deformWidget = new PathDeformWidget(null, smallScreen);
+ scope deformWidget = new PathDeformWidget(null, smallScreen);
- QStyle arthurStyle = new ArthurStyle();
- deformWidget.setWidgetStyle(arthurStyle);
- auto widgets = deformWidget.findChildren!(QWidget);
- foreach (w; widgets)
- w.setStyle(arthurStyle);
+ QStyle arthurStyle = new ArthurStyle();
+ deformWidget.setWidgetStyle(arthurStyle);
+ QWidget[] widgets; // = qFindChildren!(QWidget)(deformWidget); //TODO
+ foreach (w; widgets)
+ w.setStyle(arthurStyle);
- if (smallScreen)
- deformWidget.showFullScreen();
- else
- deformWidget.show();
+ if (smallScreen)
+ deformWidget.showFullScreen();
+ else
+ deformWidget.show();
- return app.exec();
+ return app.exec();
}
diff -r 624b4a58556e -r 849b66609571 demos/deform/pathdeform.d
--- a/demos/deform/pathdeform.d Wed Jun 17 17:42:02 2009 +0000
+++ b/demos/deform/pathdeform.d Wed Jun 17 22:39:42 2009 +0000
@@ -38,6 +38,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+module pathdeform;
+
import arthurwidgets,
qt.gui.QPainterPath,
@@ -62,6 +64,7 @@
qt.opengl.QGLFormat,
tango.math.Math;
+
class PathDeformControls : QWidget
{
private PathDeformRenderer m_renderer;
@@ -324,7 +327,7 @@
{
m_controls.setStyle(style);
- auto widgets = m_controls.findChildren!(QWidget);
+ QWidget[] widgets; // = qFindChildren!(QWidget)(m_controls); //TODO
foreach (w; widgets)
w.setStyle(style);
}
@@ -333,7 +336,7 @@
private QRect circle_bounds(QPointF center, qreal radius, qreal compensation)
{
- return new QRect(qRound(center.x() - radius - compensation),
+ return QRect(qRound(center.x() - radius - compensation),
qRound(center.y() - radius - compensation),
qRound((radius + compensation) * 2),
qRound((radius + compensation) * 2));
@@ -415,7 +418,7 @@
f.setStyleHint(QFont.Times);
m_paths = null;
- m_pathBounds = new QRectF();
+ m_pathBounds = QRectF();
QPointF advance;
@@ -481,7 +484,7 @@
if (e.timerId == m_repaintTimer.timerId) {
- if ((new QLineF(QPointF(0,0), m_direction)).length > 1)
+ if ((QLineF(QPointF(0,0), m_direction)).length() > 1)
m_direction *= 0.995;
qreal time = m_repaintTracker.restart();
@@ -544,10 +547,10 @@
m_repaintTimer.stop();
m_offset = QPointF();
- if ((new QLineF(m_pos, QPointF(e.pos))).length <= m_radius)
+ if ((QLineF(m_pos, QPointF(e.pos))).length <= m_radius)
m_offset = m_pos - QPointF(e.pos);
- m_mousePress = e.pos;
+ m_mousePress = QPointF(e.pos);
// If we're not running in small screen mode, always assume we're dragging
m_mouseDrag = !m_smallScreen;
@@ -570,13 +573,13 @@
{
auto epos = QPointF(e.pos);
- if (!m_mouseDrag && (new QLineF(m_mousePress, QPointF(e.pos))).length() > 25.0)
+ if (!m_mouseDrag && (QLineF(m_mousePress, QPointF(e.pos))).length() > 25.0)
m_mouseDrag = true;
if (m_mouseDrag) {
QRect rectBefore = circle_bounds(m_pos, m_radius, m_fontSize);
if (e.type() == QEvent.MouseMove) {
- QLineF line = new QLineF(m_pos, epos + m_offset);
+ QLineF line = QLineF(m_pos, epos + m_offset);
line.setLength(line.length() * .1);
auto dir = QPointF(line.dx(), line.dy());
m_direction = (m_direction + dir) / 2;
diff -r 624b4a58556e -r 849b66609571 demos/deform/pathdeform.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/deform/pathdeform.html Wed Jun 17 22:39:42 2009 +0000
@@ -0,0 +1,24 @@
+
+
+Vector deformation
+
+
+This demo shows how to use advanced vector techniques to draw text
+using a QPainterPath
.
+
+We define a vector deformation field in the shape of a lens and apply
+this to all points in a path. This means that what is rendered on
+screen is not pixel manipulation, but modified vector representations of
+the glyphs themselves. This is visible from the high quality of the
+antialiased edges for the deformed glyphs.
+
+To get a fairly complex path we allow the user to type in text and
+convert the text to paths. This is done using the
+QPainterPath::addText()
function.
+
+The lens is drawn using a single call to drawEllipse()
, using
+a QRadialGradient
to fill it with a specialized color table,
+giving the effect of the Sun's reflection and a drop shadow. The lens
+is cached as a pixmap for better performance.
+
+