aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/je_image.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-23 12:23:58 +0800
committerchai <chaifix@163.com>2018-10-23 12:23:58 +0800
commit40fc27154fe754181934dc7ee31375e6bdfb33fc (patch)
tree897ad98d759bc308ef66561181ba88b85f2ccd47 /src/libjin/Graphics/je_image.h
parent1480c9445100075c9e1a894eb07c0ef727b509a1 (diff)
*merge from minimal
Diffstat (limited to 'src/libjin/Graphics/je_image.h')
-rw-r--r--src/libjin/Graphics/je_image.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/libjin/Graphics/je_image.h b/src/libjin/Graphics/je_image.h
new file mode 100644
index 0000000..04ee4d2
--- /dev/null
+++ b/src/libjin/Graphics/je_image.h
@@ -0,0 +1,60 @@
+#ifndef __JE_IMAGE_H
+#define __JE_IMAGE_H
+
+#include "je_bitmap.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+
+ ///
+ /// A readonly bitmap.
+ ///
+ /// Just like bitmap but only from image file. The pixels data is readonly.
+ ///
+ class Image : public Bitmap
+ {
+ public:
+ ///
+ /// Create image from image file.
+ ///
+ /// @param path Image path.
+ /// @return Image if created successfully, otherwise return null.
+ ///
+ static Image* createImage(const char* path);
+
+ ///
+ /// Create image from image data.
+ ///
+ /// @param imgData Image data to create image.
+ /// @param size Size of image data.
+ /// @return Image if created successfully, otherwise return null.
+ ///
+ static Image* createImage(const void* imgData, size_t size);
+
+ ///
+ /// Image destructor.
+ ///
+ ~Image();
+
+ private:
+ ///
+ /// Image constructor.
+ ///
+ Image();
+
+ // Disable setters inherited from Bitmap.
+ void bind(Color* pixels, int w, int h);
+ void resetPixels(const Color* pixels, int w, int h);
+ void resetPixels(const Color& pixels, int w, int h);
+ void setPixel(const Color& pixel, int x, int y);
+ void setPixels(Color pixels);
+ void setPixels(Color* pixels);
+
+ };
+
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif \ No newline at end of file