Исправления по кодировке цветов

main
Артём Проскурнёв 3 years ago
parent e7561ca6d1
commit acc629b024
  1. 7
      example/main.cpp
  2. 2
      qtsgraph.cpp
  3. 16
      qtsgraph.h

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

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

@ -52,14 +52,14 @@ along with Vesi. If not, see <http://www.gnu.org/licenses/>.
#include <QDebug>
#include <math.h>
#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
{

Loading…
Cancel
Save