diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/GtkGif.hpp | 2 | ||||
-rw-r--r-- | include/GtkScaledImage.hpp | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/include/GtkGif.hpp b/include/GtkGif.hpp index a4a28d7..7b1de40 100644 --- a/include/GtkGif.hpp +++ b/include/GtkGif.hpp @@ -12,7 +12,7 @@ namespace dchat GtkGif(StringView fileContent); virtual ~GtkGif(){} - void draw(const Cairo::RefPtr<Cairo::Context> &cairo, int width, int height); + void draw(const Cairo::RefPtr<Cairo::Context> &cairo, int width, int height, bool circularMask); protected: // Return false if texture creation failed bool createTexture(int width, int height) override; diff --git a/include/GtkScaledImage.hpp b/include/GtkScaledImage.hpp new file mode 100644 index 0000000..ceb0b7d --- /dev/null +++ b/include/GtkScaledImage.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include <dchat/StaticImage.hpp> +#include <cairomm/context.h> +#include <cairomm/surface.h> +#include <gdkmm/pixbuf.h> +#include <stdexcept> + +namespace dchat +{ + class GtkScaledImageException : public std::runtime_error + { + public: + GtkScaledImageException(const std::string &errMsg) : std::runtime_error(errMsg) {} + }; + + class GtkScaledImage : public StaticImage + { + public: + // Throws GtkScaledImageException on error + GtkScaledImage(const boost::filesystem::path &filepath); + virtual ~GtkScaledImage(){} + void draw(const Cairo::RefPtr<Cairo::Context> &cairo, int width, int height, bool circularMask); + private: + Cairo::RefPtr<Cairo::ImageSurface> surface; + }; +}
\ No newline at end of file |