From d6a8a286dc861026a0b1a858aa093fc432e6b9de Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 20 Nov 2018 10:12:28 +0100 Subject: Add static image --- include/GtkGif.hpp | 2 +- include/GtkScaledImage.hpp | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 include/GtkScaledImage.hpp (limited to 'include') 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, int width, int height); + void draw(const Cairo::RefPtr &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 +#include +#include +#include +#include + +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, int width, int height, bool circularMask); + private: + Cairo::RefPtr surface; + }; +} \ No newline at end of file -- cgit v1.2.3