aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-11-20 10:12:28 +0100
committerdec05eba <dec05eba@protonmail.com>2018-11-20 10:12:31 +0100
commitd6a8a286dc861026a0b1a858aa093fc432e6b9de (patch)
treecce61e9caf7740824c2eb4138a92b8fd13629850 /include
parent64ab3253562be80e726b3d69e4c3e556b055c965 (diff)
Add static image
Diffstat (limited to 'include')
-rw-r--r--include/GtkGif.hpp2
-rw-r--r--include/GtkScaledImage.hpp27
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