Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
nr-filter-slot.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SEEN_NR_FILTER_SLOT_H
3#define SEEN_NR_FILTER_SLOT_H
4
5/*
6 * A container class for filter slots. Allows for simple getting and
7 * setting images in filter slots without having to bother with
8 * table indexes and such.
9 *
10 * Author:
11 * Niko Kiirala <niko@kiirala.com>
12 *
13 * Copyright (C) 2006,2007 Niko Kiirala
14 *
15 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
16 */
17
18#include <map>
19#include "nr-filter-types.h"
20#include "nr-filter-units.h"
21
22extern "C" {
23typedef struct _cairo cairo_t;
24typedef struct _cairo_surface cairo_surface_t;
25}
26
27namespace Inkscape {
28class DrawingContext;
29class DrawingItem;
30class RenderContext;
31
32namespace Filters {
33
34class FilterSlot final
35{
36public:
38 FilterSlot(DrawingContext *bgdc, DrawingContext &graphic, FilterUnits const &units, RenderContext &rc, int blurquality);
39
42
50 cairo_surface_t *getcairo(int slot);
51
56 void set(int slot, cairo_surface_t *s);
57
58 cairo_surface_t *get_result(int slot_nr);
59
60 void set_primitive_area(int slot, Geom::Rect &area);
61 Geom::Rect get_primitive_area(int slot) const;
62
64 int get_slot_count() const { return _slots.size(); }
65
67 int get_blurquality() const { return _blurquality; }
68
70 int get_device_scale() const { return device_scale; }
71
72 FilterUnits const &get_units() const { return _units; }
74
75 RenderContext &get_rendercontext() const { return rc; }
76
77private:
78 using SlotMap = std::map<int, cairo_surface_t *>;
80
81 // We need to keep track of the primitive area as this is needed in feTile
82 using PrimitiveAreaMap = std::map<int, Geom::Rect>;
84
96
101
102 void _set_internal(int slot, cairo_surface_t *s);
103};
104
105} // namespace Filters
106} // namespace Inkscape
107
108#endif // SEEN_NR_FILTER_SLOT_H
109/*
110 Local Variables:
111 mode:c++
112 c-file-style:"stroustrup"
113 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
114 indent-tabs-mode:nil
115 fill-column:99
116 End:
117*/
118// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Axis aligned, non-empty, generic rectangle.
Axis aligned, non-empty rectangle.
Definition rect.h:92
Minimal wrapper over Cairo.
void _set_internal(int slot, cairo_surface_t *s)
void set_primitive_area(int slot, Geom::Rect &area)
cairo_surface_t * _get_stroke_paint() const
cairo_surface_t * getcairo(int slot)
Returns the pixblock in specified slot.
cairo_surface_t * _get_transformed_source_graphic() const
int get_device_scale() const
Gets the device scale; for high DPI monitors.
std::map< int, cairo_surface_t * > SlotMap
cairo_surface_t * get_result(int slot_nr)
RenderContext & get_rendercontext() const
cairo_surface_t * _get_transformed_background() const
~FilterSlot()
Destroys the FilterSlot object and all its contents.
Geom::Rect get_primitive_area(int slot) const
Geom::IntRect _background_area
needed to extract background
int get_slot_count() const
Returns the number of slots in use.
FilterUnits const & get_units() const
cairo_surface_t * _get_fill_paint() const
int get_blurquality() const
Gets the gaussian filtering quality.
std::map< int, Geom::Rect > PrimitiveAreaMap
cairo_surface_t * _source_graphic
struct _cairo_surface cairo_surface_t
Helper class to stream background task notifications as a series of messages.
TODO: insert short description here.
struct _cairo cairo_t
Definition path-cairo.h:16