aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/je_image.h
blob: 15baed3ec33a3c2127d17f97f3c8bb344e691fdd (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
50
51
52
53
54
55
56
57
58
59
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