X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fmoof%2Fimage.hh;fp=src%2Fmoof%2Fimage.hh;h=97572708379ba76210422f5adc708c8c8175b65e;hb=831f04d4bc19a390415ac0bbac4331c7a65509bc;hp=0000000000000000000000000000000000000000;hpb=299af4f2047e767e5d79501c26444473bda64c64;p=chaz%2Fyoink diff --git a/src/moof/image.hh b/src/moof/image.hh new file mode 100644 index 0000000..9757270 --- /dev/null +++ b/src/moof/image.hh @@ -0,0 +1,76 @@ + +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ + +#ifndef _MOOF_IMAGE_HH_ +#define _MOOF_IMAGE_HH_ + +/** + * \file image.hh + * Defines classes for loading and manipulating images. + */ + +#include + +#include +#include + + +namespace moof { + + +class image; +typedef boost::shared_ptr image_ptr; + +class image : public resource +{ +public: + + static image_ptr alloc(const std::string& name) + { + return image_ptr(new image(name)); + } + + explicit image(const std::string& name); + + bool is_valid() const; + + int width() const; + int height() const; + + unsigned depth() const; + unsigned pitch() const; + GLuint mode() const; + + std::string comment() const; + + const char* pixels() const; + char* pixels(); + + void flip(); + + void set_as_icon() const; + + static bool find_path(std::string& name); + + +private: + + static FILE* open_file(std::string& name); + + class impl; + boost::shared_ptr impl_; +}; + + +} // namespace moof + +#endif // _MOOF_IMAGE_HH_ +