Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
metafile-inout.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
5 * Authors:
6 * David Mathog
7 *
8 * Copyright (C) 2013 Authors
9 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
10 */
11
12#ifndef SEEN_INKSCAPE_EXTENSION_INTERNAL_METAFILE_INOUT_H
13#define SEEN_INKSCAPE_EXTENSION_INTERNAL_METAFILE_INOUT_H
14
15#define PNG_SKIP_SETJMP_CHECK // else any further png.h include blows up in the compiler
16#include <png.h>
17#include <cstdio>
18#include <cstdlib>
19#include <cstdint>
20#include <map>
21#include <stack>
22#include <glibmm/ustring.h>
24#include <2geom/affine.h>
25#include <2geom/pathvector.h>
26
28#include "colors/utils.h"
29
30constexpr uint32_t U_RGB_COMPOSE(U_COLORREF c)
31{
32 return SP_RGBA32_U_COMPOSE(U_RGBAGetR(c), U_RGBAGetG(c), U_RGBAGetB(c), 0xff);
33}
34constexpr uint32_t U_RGBA_COMPOSE(U_COLORREF c)
35{
36 return SP_RGBA32_U_COMPOSE(U_RGBAGetR(c), U_RGBAGetG(c), U_RGBAGetB(c), U_RGBAGetA(c));
37}
38
39class SPObject;
40
41namespace Inkscape {
42class Pixbuf;
43
44namespace Extension {
45namespace Internal {
46
47/* A coloured pixel. */
48struct pixel_t {
49 uint8_t red;
50 uint8_t green;
51 uint8_t blue;
52 uint8_t opacity;
53};
54
55/* A picture. */
56struct bitmap_t {
58 size_t width;
59 size_t height;
60};
61
62/* structure to store PNG image bytes */
63struct MEMPNG {
64 char *buffer;
65 size_t size;
66};
67using PMEMPNG = MEMPNG *;
68
71{
72public:
73 Metafile() = default;
74 ~Metafile() override;
75
76protected:
77 static uint32_t sethexcolor(U_COLORREF color);
78 static pixel_t *pixel_at (bitmap_t * bitmap, int x, int y);
79 static void my_png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
80 static void toPNG(PMEMPNG accum, int width, int height, const char *px);
81 static gchar *bad_image_png();
82 static void setViewBoxIfMissing(SPDocument *doc);
83 static int combine_ops_to_livarot(const int op);
84
85
86private:
87};
88
89} // namespace Internal
90} // namespace Extension
91} // namespace Inkscape
92
93#endif // SEEN_INKSCAPE_EXTENSION_INTERNAL_METAFILE_INOUT_H
94
95/*
96 Local Variables:
97 mode:c++
98 c-file-style:"stroustrup"
99 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
100 indent-tabs-mode:nil
101 fill-column:99
102 End:
103*/
3x3 affine transformation matrix.
Base class for all implementations of modules.
static void my_png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
static pixel_t * pixel_at(bitmap_t *bitmap, int x, int y)
Construct a PNG in memory from an RGB from the EMF file.
static void toPNG(PMEMPNG accum, int width, int height, const char *px)
static void setViewBoxIfMissing(SPDocument *doc)
static int combine_ops_to_livarot(const int op)
static uint32_t sethexcolor(U_COLORREF color)
Typed SVG document implementation.
Definition document.h:103
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
constexpr uint32_t SP_RGBA32_U_COMPOSE(uint32_t r, uint32_t g, uint32_t b, uint32_t a)
Definition utils.h:60
double c[8][4]
constexpr uint32_t U_RGBA_COMPOSE(U_COLORREF c)
constexpr uint32_t U_RGB_COMPOSE(U_COLORREF c)
Helper class to stream background task notifications as a series of messages.
PathVector - a sequence of subpaths.
static const Point data[]
WMF manual 2.2.2.8.
Definition uemf.h:474
double height
double width
Structures, definitions, and function prototypes for EMF files.