]> Shamusworld >> Repos - architektonas/blobdiff - src/painter.cpp
Preliminary support for Polylines.
[architektonas] / src / painter.cpp
index 853d3502690a494afdeb3635925d275fa087e6c8..2314a8559b4de310848a8af737096b0e829b3712 100644 (file)
@@ -372,6 +372,16 @@ void Painter::DrawPoint(int x, int y)
        painter->drawPoint(v.x, v.y);
 }
 
+// The rect passed in is in Qt coordinates... (?)
+void Painter::DrawRoundedRect(Rect rect, double radiusX, double radiusY)
+{
+       if (!painter)
+               return;
+
+       QRectF r(QPointF(rect.l, rect.t), QPointF(rect.r, rect.b));
+       painter->drawRoundedRect(r, radiusX, radiusY);
+}
+
 // The rect passed in is in Qt coordinates...
 void Painter::DrawRoundedRect(QRectF rect, double radiusX, double radiusY)
 {
@@ -383,35 +393,36 @@ void Painter::DrawRoundedRect(QRectF rect, double radiusX, double radiusY)
 
 // The rect passed in is in Cartesian but we want to pad it by a set number of
 // pixels (currently set at 8), so the pad looks the same regardless of zoom.
-void Painter::DrawPaddedRect(QRectF rect)
+void Painter::DrawPaddedRect(Rect rect)
 {
        if (!painter)
                return;
 
-       Vector v1 = CartesianToQtCoords(Vector(rect.x(), rect.y()));
-       Vector v2 = CartesianToQtCoords(Vector(rect.right(), rect.bottom()));
+       Vector v1 = CartesianToQtCoords(rect.TopLeft());
+       Vector v2 = CartesianToQtCoords(rect.BottomRight());
        QRectF screenRect(QPointF(v1.x, v1.y), QPointF(v2.x, v2.y));
        screenRect.adjust(-8, 8, 8, -8);        // Left/top, right/bottom
        painter->drawRect(screenRect);
 }
 
-void Painter::DrawRect(QRectF rect)
+void Painter::DrawRect(Rect rect)
 {
        if (!painter)
                return;
 
-       Vector v1 = CartesianToQtCoords(Vector(rect.x(), rect.y()));
-       Vector v2 = CartesianToQtCoords(Vector(rect.right(), rect.bottom()));
+       Vector v1 = CartesianToQtCoords(rect.TopLeft());
+       Vector v2 = CartesianToQtCoords(rect.BottomRight());
        QRectF screenRect(QPointF(v1.x, v1.y), QPointF(v2.x, v2.y));
        painter->drawRect(screenRect);
 }
 
-void Painter::DrawText(QRectF rect, int type, QString text)
+void Painter::DrawText(Rect rect, int type, QString text)
 {
        if (!painter)
                return;
 
-       painter->drawText(rect, (Qt::AlignmentFlag)type, text);
+       QRectF r(QPointF(rect.l, rect.t), QPointF(rect.r, rect.b));
+       painter->drawText(r, (Qt::AlignmentFlag)type, text);
 }
 
 void Painter::DrawArrowhead(Vector head, Vector tail, double size)