aboutsummaryrefslogtreecommitdiff
path: root/include/GtkGif.hpp
blob: 7b1de4021a5535731b0988f452866a831c66d9e9 (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
#pragma once

#include <dchat/Gif.hpp>
#include <cairomm/context.h>
#include <cairomm/surface.h>

namespace dchat
{
    class GtkGif : public Gif
    {
    public:
        GtkGif(StringView fileContent);
        virtual ~GtkGif(){}

        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;
        // Size of texture data is same as the size that the texture was created with (also same size returned by @getSize function)
        void updateTexture(void *textureData) override;
    private:
        Cairo::RefPtr<Cairo::ImageSurface> surface;
    };
}