aboutsummaryrefslogtreecommitdiff
path: root/include/GtkGif.hpp
blob: a4a28d7bc486b571f218c3ba4b5fc77b9ff600ee (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);
    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;
    };
}