From acc629b024c7e02aa3fb888aec4570f691ccc494 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: Sat, 9 Jan 2021 22:51:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=20=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B5=20=D1=86=D0=B2=D0=B5=D1=82?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/main.cpp | 7 ++++--- qtsgraph.cpp | 2 +- qtsgraph.h | 16 ++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/example/main.cpp b/example/main.cpp index d2f9dfb..bc5e742 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -15,6 +15,7 @@ int main(int argc, char *argv[]) */ QTSGraph w(1024, 768); + w.SwapYAxis = false; w.show(); return a.exec(); } @@ -62,7 +63,7 @@ void QTSGraph::PaintBox() OutTextXY(20, 70, "Можно прервать, если кликнуть мышью."); while(!MouseClicked() && x < 1024) { - PutPixel(x, 50, 0x555555 + x * 16, 5); + PutPixel(x, 50, 0x555555 + x * 9999, 5); x += 1; Delay(10); } @@ -78,11 +79,11 @@ void QTSGraph::PaintBox() SetFillStyle(1, clBlack); Rectangle(10, 600, 200, 700); stringstream ss; - ss << "#" << hex << GetPixel(100,720); + ss << "0x" << hex << GetPixel(100,720); SetColor(clBlack); OutTextXY(10, 590, ss.str()); ss.str(""); - ss << "#" << hex << GetPixel(50,650); + ss << "0x" << hex << GetPixel(50,650); SetColor(clWhite); OutTextXY(30, 620, ss.str()); ss.str(""); diff --git a/qtsgraph.cpp b/qtsgraph.cpp index d215318..ee1631a 100644 --- a/qtsgraph.cpp +++ b/qtsgraph.cpp @@ -58,7 +58,7 @@ void QTSGraph::Ellipse(int x1, int y1, int x2, int y2) QRgb QTSGraph::GetPixel(int x, int y) { if(SwapYAxis) y = Canvas.height() - y - 1; - return Canvas.toImage().pixelColor(x, y).rgba(); + return Canvas.toImage().pixelColor(x, y).rgba() % 0x1000000; } QTSGraph::QTSGraph(int w, int h, int x, int y, QWidget *parent) : QMainWindow(parent) diff --git a/qtsgraph.h b/qtsgraph.h index d0b1148..5b02e45 100644 --- a/qtsgraph.h +++ b/qtsgraph.h @@ -52,14 +52,14 @@ along with Vesi. If not, see . #include #include -#define clRed 0x00FF0000 -#define clGreen 0x0000FF00 -#define clBlue 0x000000FF -#define clBlack 0x00000000 -#define clWhite 0x00FFFFFF -#define clYellow 0x00FFFF00 -#define clMagenta 0x00FF00FF -#define clCyan 0x0000FFFF +#define clRed 0xFF0000 +#define clGreen 0x00FF00 +#define clBlue 0x0000FF +#define clBlack 0x000000 +#define clWhite 0xFFFFFF +#define clYellow 0xFFFF00 +#define clMagenta 0xFF00FF +#define clCyan 0x00FFFF class QTSGraph : public QMainWindow {