X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=image.hpp;h=f87fd98a7370a7b3fd546ec7c9760cd8a0008eb9;hp=b6d79201bffddcca414605ef7d11ef1ff6104146;hb=437aa7144a4aab438689841f3b0a7694d6b50c8e;hpb=c44e69ec78367fb2957324026894aef970f2481a diff --git a/image.hpp b/image.hpp index b6d7920..f87fd98 100644 --- a/image.hpp +++ b/image.hpp @@ -1,3 +1,6 @@ +#ifndef IMAGE_HPP +#define IMAGE_HPP + #include #include #ifdef __APPLE__ @@ -8,13 +11,25 @@ class Image { public: Image(const std::string &path); + Image(const unsigned char *data, size_t length, const char *formatHint); ~Image(); - unsigned char *data(); + unsigned char *data() const; GLfloat width() const; GLfloat height() const; + GLenum format() const; + GLint internalFormat() const; + GLenum type() const; private: #ifdef __APPLE__ + void initWithImageRef(CGImageRef ref); CFDataRef dataRef; + CGBitmapInfo info; + CGImageAlphaInfo alphaInfo; + CGColorSpaceRef colorSpace; GLfloat _width, _height; + size_t bitsPerComponent; + bool usesFloat() const; #endif }; + +#endif