diff options
Diffstat (limited to 'src/libjin/Graphics/Bitmap.h')
-rw-r--r-- | src/libjin/Graphics/Bitmap.h | 101 |
1 files changed, 91 insertions, 10 deletions
diff --git a/src/libjin/Graphics/Bitmap.h b/src/libjin/Graphics/Bitmap.h index bb30bdc..4341256 100644 --- a/src/libjin/Graphics/Bitmap.h +++ b/src/libjin/Graphics/Bitmap.h @@ -44,7 +44,7 @@ namespace jin /// /// @param width Width of bitmap. /// @param height Height of bitmap. - /// @param color Color of bitmap. + /// @param color Color of bitmap, black by default. /// @return Return bitmap pointer if created, otherwise return null. /// static Bitmap* createBitmap(int width, int height, Color color = Color::BLACK); @@ -61,23 +61,104 @@ namespace jin /// Destructor of bitmap /// virtual ~Bitmap(); - /* init pixels */ - 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); - /* modify pixels */ - void setPixel(const Color& pixel, int x, int y); - void setPixels(Color pixels); - void setPixels(Color* pixels); + + /// + /// Directly bind pixels with given pixels data + /// + /// @param pixels Pixels to be binded. + /// @param width Width of bitmap + /// @param height Height of bitmap + /// + void bind(Color* pixels, int width, int height); + + /// + /// Reset pixel data with given pixels data. + /// + /// @param pixels Pixels to be set. + /// @param width Width of bitmap + /// @param height Height of bitmap + /// + void resetPixels(const Color* pixels, int width, int height); + + /// + /// Reset pixel data with given color. + /// + /// @param color Color to be set. + /// @param width Width of bitmap + /// @param height Height of bitmap + /// + void resetPixels(const Color& color, int width, int height); + + /// + /// Set pixel with given color. + /// + /// @param color Color to be set. + /// @param x X value of pixel. + /// @param y Y value of pixel. + /// + void setPixel(const Color& color, int x, int y); + + /// + /// Set pixels with given color. + /// + /// @param color Color to be set. + /// + void setPixels(Color color); + + /// + /// Set pixels with given color data. + /// + /// @param colors New pixels' colors. + /// + void setPixels(Color* colors); + + /// + /// Get pixel in given position. + /// + /// @param x X value of position. + /// @param y Y value of position. + /// Color getPixel(int x, int y); + + /// + /// Get pixels. + /// @return Colors of the bitmap. + /// const Color* getPixels() const; - /* get width and height */ + + /// + /// Get bitmap width. + /// + /// @return Width of bitmap. + /// inline int getWidth() const { return width; } + + /// + /// Get bitmap height. + /// + /// @return Height of bitmap. + /// inline int getHeight() const { return height; } + + /// + /// Get bitmap size. + /// + /// @return Size of bitmap. + /// 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; |