aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Bitmap.h
blob: 6333215daab923a4b46c86bb7bd404d6d27f9601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef __JIN_BITMAP_H
#define __JIN_BITMAP_H
#include "../modules.h"
#if JIN_MODULES_RENDER

#include "../Math/Vector2.hpp"
#include "../3rdparty/GLee/GLee.h"
#include "Color.h"
namespace jin
{
namespace graphics
{

    class Bitmap
    {
    public:
        static Bitmap* createBitmap(const void* imgData, size_t size);
        static Bitmap* createBitmap(int w, int h, Color color = Color::BLACK);
        static Bitmap* clone(const Bitmap* bitmap);

        ~Bitmap();
        /* init pixels */
        void bindPixels(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);
        Color getPixel(int x, int y);
        const Color* getPixels() const;
        /* get width and height */
        inline int getWidth() const { return width; }
        inline int getHeight() const { return height; }

    private:
        Bitmap();
        Bitmap(int w, int h);

        Color * pixels;
        int width, height;

    };

}
}

#endif
#endif