diff options
Diffstat (limited to 'src/libjin/graphics/je_bitmap.h')
-rw-r--r-- | src/libjin/graphics/je_bitmap.h | 72 |
1 files changed, 21 insertions, 51 deletions
diff --git a/src/libjin/graphics/je_bitmap.h b/src/libjin/graphics/je_bitmap.h index e9c214e..c392a32 100644 --- a/src/libjin/graphics/je_bitmap.h +++ b/src/libjin/graphics/je_bitmap.h @@ -27,47 +27,35 @@ namespace JinEngine class Bitmap : public Object { public: - /// - /// Create bitmap from given file. - /// - /// @param path Path of image file. - /// @return Bitmap if create successful, otherwise retrun false. - /// - static Bitmap* createBitmap(const char* path); + /// + /// Constructor of bitmap. + /// + Bitmap(); /// - /// Create bitmap by pixels data. + /// Constructor of bitmap. /// - /// @param pixels Pixels data. /// @param width Width of bitmap. /// @param height Height of bitmap. - /// @return Return bitmap pointer if created, otherwise return null. /// - static Bitmap* createBitmap(const void* pixels, unsigned width, unsigned height); + Bitmap(unsigned w, unsigned h); - /// - /// Create bitmap from compressed image data. - /// - /// @param imgData Compressed image data. - /// @param size Size of image data. - /// @return Return bitmap pointer if created, otherwise return null. - /// - static Bitmap* createBitmap(const void* imgData, size_t size); + Bitmap(const char* path); + + Bitmap(const void* pixels, unsigned w, unsigned h); + + Bitmap(const void* imgData, size_t size); + + Bitmap(int w, int h, Color color); + + Bitmap(int w, int h, std::function<Color(int, int, int, int)> drawer); + + Bitmap(const Bitmap* bitmap); /// - /// Create bitmap with specific color and size. - /// - /// @param width Width of bitmap. - /// @param height Height of bitmap. - /// @param color Color of bitmap, black by default. - /// @return Return bitmap pointer if created, otherwise return null. + /// Destructor of bitmap /// - static Bitmap* createBitmap(int width, int height, Color color = Color::BLACK); - - /// - /// Create bitmap and set bitmap pixels with given drawer. - /// - static Bitmap* createBitmap(int width, int height, std::function<Color(int, int, int, int)> drawer); + virtual ~Bitmap(); /// /// Create bitmap with another one. @@ -75,12 +63,7 @@ namespace JinEngine /// @param bitmap Bitmap be cloned. /// @return Return bitmap pointer if created, otherwise return null. /// - static Bitmap* clone(const Bitmap* bitmap); - - /// - /// Destructor of bitmap - /// - virtual ~Bitmap(); + Bitmap* clone(); /// /// Directly bind pixels with given pixels data @@ -113,7 +96,7 @@ namespace JinEngine /// Set pixel with given color. /// /// @param color Color to be set. - /// @param x X value of pixel. + /// @param x X value of pixel. /// @param y Y value of pixel. /// void setPixel(const Color& color, int x, int y); @@ -169,19 +152,6 @@ namespace JinEngine inline Math::Vector2<int> getSize() const { return Math::Vector2<int>(width, height); } protected: - /// - /// Constructor of bitmap. - /// - Bitmap(); - - /// - /// Constructor of bitmap. - /// - /// @param width Width of bitmap. - /// @param height Height of bitmap. - /// - Bitmap(unsigned w, unsigned h); - Color * pixels; unsigned width, height; |