]> Shamusworld >> Repos - architektonas/blobdiff - src/painter.cpp
Various fixes to Container/Group handling, added DrawArcAction.
[architektonas] / src / painter.cpp
index 6cfd91f8ef62641d6584158631c6a3834866532a..308cab6b7bd87ed587cb884ae52113f1173abaad 100644 (file)
@@ -208,6 +208,7 @@ void Painter::DrawPoint(int x, int y)
 }
 
 
+// This is drawn in Qt coordinates...
 void Painter::DrawRoundedRect(QRectF rect, double radiusX, double radiusY)
 {
        if (!painter)
@@ -217,6 +218,22 @@ void Painter::DrawRoundedRect(QRectF rect, double radiusX, double radiusY)
 }
 
 
+// This is drawn partially in Cartesian coordinates, and partially in Qt
+// coordinates. The rect itself is in Cartesian but we want to pad it by a set
+// number of pixels.
+void Painter::DrawPaddedRect(QRectF rect)
+{
+       if (!painter)
+               return;
+
+       Vector v1 = CartesianToQtCoords(Vector(rect.x(), rect.y()));
+       Vector v2 = CartesianToQtCoords(Vector(rect.right(), rect.bottom()));
+       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)
 {
        if (!painter)