-
Notifications
You must be signed in to change notification settings - Fork 76
/
pdf-image-source.h
55 lines (44 loc) · 1.72 KB
/
pdf-image-source.h
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- mode: c ; c-basic-offset: 4; indent-tabs-mode: nil; -*-
// (c) 2023 Henner Zeller <[email protected]>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://gnu.org/licenses/gpl-2.0.txt>
#ifndef PDF_SOURCE_H_
#define PDF_SOURCE_H_
#include <csignal>
#include <memory>
#include <string>
#include <vector>
#include "display-options.h"
#include "framebuffer.h"
#include "image-source.h"
#include "renderer.h"
#include "timg-time.h"
namespace timg {
class PDFImageSource final : public ImageSource {
public:
explicit PDFImageSource(const std::string &filename)
: ImageSource(filename) {}
bool LoadAndScale(const DisplayOptions &options, int frame_offset,
int frame_count) final;
void SendFrames(const Duration &duration, int loops,
const volatile sig_atomic_t &interrupt_received,
const Renderer::WriteFramebufferFun &sink) final;
std::string FormatTitle(const std::string &format_string) const final;
private:
int IndentationIfCentered(const timg::Framebuffer &image) const;
DisplayOptions options_;
double orig_width_, orig_height_;
std::vector<std::unique_ptr<timg::Framebuffer>> pages_;
};
} // namespace timg
#endif // QOI_SOURCE_H_