Эллипс

main
Артём Проскурнёв 3 years ago
parent 925a044d44
commit 12f02a8bfb
  1. 10
      main.cpp
  2. 9
      qtsgraph.cpp
  3. 1
      qtsgraph.h

@ -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);
// Конец рисования
}

@ -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();

@ -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();

Loading…
Cancel
Save