initial port for Cevo game in C++ (libs)
This commit is contained in:
commit
8436242032
375 files changed
+46282
No files matched your search
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <QImage>
|
||||
|
||||
namespace Dpi {
|
||||
|
||||
// Mirrors Dpi.PixelPointer.pas / NativePixelPointer.pas: a cursor for fast
|
||||
// pixel-by-pixel iteration over a 32-bit ARGB QImage, addressing native
|
||||
// (physical) pixels directly. The image must use QImage::Format_ARGB32 (or
|
||||
// Format_ARGB32_Premultiplied) for the scanline arithmetic below to be valid.
|
||||
class PixelPointer {
|
||||
public:
|
||||
PixelPointer() = default;
|
||||
PixelPointer(QImage *image, int baseX, int baseY);
|
||||
|
||||
void setXY(int x, int y);
|
||||
void setX(int x);
|
||||
void nextPixel();
|
||||
void previousPixel();
|
||||
void nextLine();
|
||||
void previousLine();
|
||||
bool posValid() const;
|
||||
|
||||
QRgb pixelARGB() const;
|
||||
void setPixelARGB(QRgb value);
|
||||
QRgb pixelRGB() const; // alpha forced to 0xFF
|
||||
void setPixelRGB(QRgb value);
|
||||
|
||||
int x() const { return m_x; }
|
||||
int y() const { return m_y; }
|
||||
|
||||
private:
|
||||
QImage *m_image = nullptr;
|
||||
int m_x = 0;
|
||||
int m_y = 0;
|
||||
int m_width = 0;
|
||||
int m_height = 0;
|
||||
};
|
||||
|
||||
} // namespace Dpi
|
||||
Reference in new issue
Block a user