Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
cairo-renderer.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN
3#define EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN
4
8/*
9 * Authors:
10 * Miklos Erdelyi <erdelyim@gmail.com>
11 * Abhishek Sharma
12 *
13 * Copyright (C) 2006 Miklos Erdelyi
14 *
15 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
16 */
17
18#include "extension/extension.h"
19#include <set>
20#include <string>
21
22//#include "libnrtype/font-instance.h"
23#include <cairo.h>
24
25class SPItem;
26class SPClipPath;
27class SPMask;
28class SPHatchPath;
29class SPPage;
30
31namespace Inkscape {
32namespace Extension {
33namespace Internal {
34
35class CairoRenderer;
36class CairoRenderContext;
37
39public:
42
44
45 void applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp);
46 void applyMask(CairoRenderContext *ctx, SPMask const *mask);
47
51 bool setupDocument(CairoRenderContext *ctx, SPDocument *doc, SPItem const *base = nullptr);
52
53
55 void renderItem(CairoRenderContext *ctx, SPItem const *item, SPItem const *origin = nullptr, SPPage const *page = nullptr);
56 void renderHatchPath(CairoRenderContext *ctx, SPHatchPath const &hatchPath, unsigned key);
57 bool renderPages(CairoRenderContext *ctx, SPDocument *doc, bool stretch_to_fit);
58 bool renderPage(CairoRenderContext *ctx, SPDocument *doc, SPPage const *page, bool stretch_to_fit);
59
60private:
62 static bool _shouldRasterize(CairoRenderContext *ctx, SPItem const *item);
63
65 static void _doRender(SPItem const *item, CairoRenderContext *ctx, SPItem const *origin = nullptr,
66 SPPage const *page = nullptr);
67
68};
69
70// FIXME: this should be a static method of CairoRenderer
71void calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect_clip, double vp_width,
72 double vp_height, double *x, double *y, double *width, double *height);
73
74} /* namespace Internal */
75} /* namespace Extension */
76} /* namespace Inkscape */
77
78#endif /* !EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN */
79
80/*
81 Local Variables:
82 mode:c++
83 c-file-style:"stroustrup"
84 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
85 indent-tabs-mode:nil
86 fill-column:99
87 End:
88*/
89// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Point origin
Definition aa.cpp:227
uint64_t page
Definition canvas.cpp:158
bool renderPage(CairoRenderContext *ctx, SPDocument *doc, SPPage const *page, bool stretch_to_fit)
void renderItem(CairoRenderContext *ctx, SPItem const *item, SPItem const *origin=nullptr, SPPage const *page=nullptr)
Traverses the object tree and invokes the render methods.
void applyMask(CairoRenderContext *ctx, SPMask const *mask)
bool renderPages(CairoRenderContext *ctx, SPDocument *doc, bool stretch_to_fit)
Handle multiple pages, pushing each out to cairo as needed using renderItem()
void renderHatchPath(CairoRenderContext *ctx, SPHatchPath const &hatchPath, unsigned key)
void applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp)
static bool _shouldRasterize(CairoRenderContext *ctx, SPItem const *item)
Decide whether the given item should be rendered as a bitmap.
bool setupDocument(CairoRenderContext *ctx, SPDocument *doc, SPItem const *base=nullptr)
Initializes the CairoRenderContext according to the specified SPDocument.
static void _doRender(SPItem const *item, CairoRenderContext *ctx, SPItem const *origin=nullptr, SPPage const *page=nullptr)
Render a single item in a fully set up context.
Typed SVG document implementation.
Definition document.h:101
Base class for visual SVG elements.
Definition sp-item.h:109
Inkscape::Extension::Extension: Frontend to certain, possibly pluggable, actions.
SPItem * item
void calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect_clip, double vp_width, double vp_height, double *x, double *y, double *width, double *height)
Helper class to stream background task notifications as a series of messages.
static cairo_user_data_key_t key
double height
double width