From 12f02a8bfb89ced4a196bc37e66d213107d9f377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D0=BA=D1=83=D1=80=D0=BD=D1=91=D0=B2?= Date: Tue, 5 Jan 2021 18:27:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=AD=D0=BB=D0=BB=D0=B8=D0=BF=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 10 +++++++--- qtsgraph.cpp | 9 +++++++++ qtsgraph.h | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index bba62e0..595937c 100644 --- a/main.cpp +++ b/main.cpp @@ -25,14 +25,18 @@ void QTSGraph::PaintBox() Line(0, 0, 600, 600); SetColor(0xFF0000); Line(600, 0, 0, 600); - Rectangle(0,0,600,600); + Rectangle(0, 0, 600, 600); SetColor(clBlue); SetTextStyle(0, 45, 10); OutTextXY(30, 30, "Hello world!"); SetTextStyle(1, 0, 20); OutTextXY(210, 50, "Hello world!"); - SetTextStyle(2, 0, 30); - OutTextXY(160, 550, "Hello world!"); + SetTextStyle(2, 180, 30); + OutTextXY(460, 550, "Hello world!"); + SetColor(0x999999); + SetPenStyle(5); + SetFillStyle(1, clMagenta); + Ellipse(250, 280, 350, 320); // Конец рисования } diff --git a/qtsgraph.cpp b/qtsgraph.cpp index 2bdd0d2..3188aad 100644 --- a/qtsgraph.cpp +++ b/qtsgraph.cpp @@ -45,6 +45,15 @@ void QTSGraph::Delay(int ms) QCoreApplication::processEvents(QEventLoop::AllEvents, 50); } +void QTSGraph::Ellipse(int x1, int y1, int x2, int y2) +{ + QPainter painter(&Canvas); + painter.setPen(Pen); + painter.setBrush(Brush); + painter.drawEllipse(x1, y1, abs(x2-x1), abs(y2-y1)); + update(); +} + QRgb QTSGraph::GetPixel(int x, int y) { return Canvas.toImage().pixelColor(x, y).rgba(); diff --git a/qtsgraph.h b/qtsgraph.h index 4bc7c9f..25572a7 100644 --- a/qtsgraph.h +++ b/qtsgraph.h @@ -71,6 +71,7 @@ public: void Circle(int x, int y, int radius); void Delay(int ms = 1000); + void Ellipse(int x1, int y1, int x2, int y2); QRgb GetPixel(int x, int y); void Line(int x1, int y1, int x2, int y2); bool KeyPressed();