aboutsummaryrefslogtreecommitdiff
path: root/include/GtkScaledImage.hpp
blob: ceb0b7dcb2ded7c79667155a4244148f0e1704aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
    };
}