Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add methods setAntialiasing and setPenWidth.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 3 Dec 2010 08:44:15 +0000 (09:44 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 3 Dec 2010 08:44:15 +0000 (09:44 +0100)
Thanks to Yoann Blein for his suggestion.

CHANGES
DrawingWindow.cpp
DrawingWindow.h

diff --git a/CHANGES b/CHANGES
index b44444b..951c20a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+-- ven., 03 déc. 2010 09:34:15 +0100
+
+        * Ajout des méthodes setAntialiasing et setPenWidth.
+          Merci à Yoann Blein pour sa suggestion.
+
 -- mer., 01 déc. 2010 12:11:36 +0100
 
         * Autorise un paramètre de type std::string pour drawText et drawTextBg.
index dac4246..db33a3f 100644 (file)
@@ -345,6 +345,19 @@ void DrawingWindow::setBgColor(float red, float green, float blue)
     setBgColor(QColor::fromRgbF(red, green, blue));
 }
 
+//! Change l'épaisseur du pinceau
+/*!
+ * Le pinceau à une épaisseur de 1 par défaut.
+ *
+ * \param width         épaisseur du pinceau
+ */
+void DrawingWindow::setPenWidth(int width)
+{
+    QPen pen(painter->pen());
+    pen.setWidth(width);
+    painter->setPen(pen);
+}
+
 //! Retourne la fonte courante utilisée pour dessiner du texte.
 /*!
  * \see QFont, setFont
@@ -363,6 +376,20 @@ void DrawingWindow::setFont(const QFont &font)
     painter->setFont(font);
 }
 
+//! Active ou non l'antialiasing.
+/*!
+ * Permet de lisser le dessin.
+ * Fonctionnalité désactivée par défaut.
+ *
+ * \param state         état de l'antialiasing
+ *
+ * \bug                 expérimental
+ */
+void DrawingWindow::setAntialiasing(bool state)
+{
+    painter->setRenderHint(QPainter::Antialiasing, state);
+}
+
 //! Efface la fenêtre.
 /*!
  * La fenêtre est effacée avec la couleur de fond courante.
index c38d9bd..4a9b9df 100644 (file)
@@ -45,9 +45,13 @@ public:
     void setBgColor(const char *name);
     void setBgColor(float red, float green, float blue);
 
+    void setPenWidth(int width);
+
     const QFont &getFont() const;
     void setFont(const QFont &font);
 
+    void setAntialiasing(bool state);
+
     void clearGraph();
 
     void drawPoint(int x, int y);