mirror of
https://github.com/luanti-org/minetestmapper.git
synced 2025-10-06 05:45:21 +02:00
Some more code modernization
also a few small performance improvements
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#ifndef IMAGE_HEADER
|
||||
#define IMAGE_HEADER
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <string>
|
||||
@@ -9,7 +8,6 @@ struct Color {
|
||||
Color() : r(0), g(0), b(0), a(0) {};
|
||||
Color(u8 r, u8 g, u8 b) : r(r), g(g), b(b), a(255) {};
|
||||
Color(u8 r, u8 g, u8 b, u8 a) : r(r), g(g), b(b), a(a) {};
|
||||
inline Color noAlpha() const { return Color(r, g, b); }
|
||||
|
||||
u8 r, g, b, a;
|
||||
};
|
||||
@@ -19,6 +17,9 @@ public:
|
||||
Image(int width, int height);
|
||||
~Image();
|
||||
|
||||
Image(const Image&) = delete;
|
||||
Image& operator=(const Image&) = delete;
|
||||
|
||||
void setPixel(int x, int y, const Color &c);
|
||||
Color getPixel(int x, int y);
|
||||
void drawLine(int x1, int y1, int x2, int y2, const Color &c);
|
||||
@@ -28,10 +29,6 @@ public:
|
||||
void save(const std::string &filename);
|
||||
|
||||
private:
|
||||
Image(const Image&);
|
||||
|
||||
int m_width, m_height;
|
||||
gdImagePtr m_image;
|
||||
};
|
||||
|
||||
#endif // IMAGE_HEADER
|
||||
|
Reference in New Issue
Block a user