blob: c742a64dfc281a9ae800bc9b8790be7a31db525a (
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
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
* @brief Metafile input - common functions
*//*
* Authors:
* David Mathog
*
* Copyright (C) 2013 Authors
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
#ifndef SEEN_INKSCAPE_EXTENSION_INTERNAL_METAFILE_INOUT_H
#define SEEN_INKSCAPE_EXTENSION_INTERNAL_METAFILE_INOUT_H
#define PNG_SKIP_SETJMP_CHECK // else any further png.h include blows up in the compiler
#include <png.h>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <map>
#include <stack>
#include <glibmm/ustring.h>
#include <3rdparty/libuemf/uemf.h>
#include <2geom/affine.h>
#include <2geom/pathvector.h>
#include "extension/implementation/implementation.h"
class SPObject;
namespace Inkscape {
class Pixbuf;
namespace Extension {
namespace Internal {
/* A coloured pixel. */
struct pixel_t {
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t opacity;
};
/* A picture. */
struct bitmap_t {
pixel_t *pixels;
size_t width;
size_t height;
};
/* structure to store PNG image bytes */
struct MEMPNG {
char *buffer;
size_t size;
};
using PMEMPNG = MEMPNG *;
class Metafile
: public Inkscape::Extension::Implementation::Implementation
{
public:
Metafile() = default;
~Metafile() override;
protected:
static uint32_t sethexcolor(U_COLORREF color);
static pixel_t *pixel_at (bitmap_t * bitmap, int x, int y);
static void my_png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
static void toPNG(PMEMPNG accum, int width, int height, const char *px);
static gchar *bad_image_png();
static void setViewBoxIfMissing(SPDocument *doc);
static int combine_ops_to_livarot(const int op);
private:
};
} // namespace Internal
} // namespace Extension
} // namespace Inkscape
#endif // SEEN_INKSCAPE_EXTENSION_INTERNAL_METAFILE_INOUT_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
|