113 int blurquality =
item->drawing().blurQuality();
118 if (!filter_area)
return 1;
126 if (!(resolution.first > 0 && resolution.second > 0)) {
146 if (!i->can_handle_affine(pbtrans)) {
152 auto slot =
FilterSlot(bgdc, graphic, units,
rc, blurquality);
155 i->render_cairo(slot);
168 cairo_surface_destroy(
result);
175 primitives.emplace_back(std::move(primitive));
191 if (i) i->area_enlarge(bbox,
item->ctm());
231 double len_x = bbox ? bbox->width() : 0;
232 double len_y = bbox ? bbox->height() : 0;
237 length.update(12, 6,
scale);
238 return length.computed;
240 auto const region_x_computed = compute(
_region_x, len_x);
241 auto const region_y_computed = compute(
_region_y, len_y);
242 auto const region_w_computed = compute(
_region_width, len_x);
248 minp[X] = bbox->left() + region_x_computed;
250 minp[X] = bbox->left() + region_x_computed * len_x;
253 maxp[X] = minp[X] + region_w_computed;
255 maxp[X] = minp[X] + region_w_computed * len_x;
259 minp[Y] = bbox->top() + region_y_computed;
261 minp[Y] = bbox->top() + region_y_computed * len_y;
264 maxp[Y] = minp[Y] + region_h_computed;
266 maxp[Y] = minp[Y] + region_h_computed * len_y;
275 g_warning(
"Error in Inkscape::Filters::Filter::filter_effect_area: unrecognized value of _filter_units");
288 double f = i->complexity(ctm);
298 if (i && i->uses_background()) {
344 if (x_pixels >= 0 && y_pixels >= 0) {
375 std::pair<double, double> resolution;
384 resolution.second = y_len;
386 auto origo = area.
min() * trans;
389 double i_len = (origo - max_i).length();
390 double j_len = (origo - max_j).length();
393 double aspect_ratio = i_len / j_len;
396 j_len = i_len / aspect_ratio;
400 i_len = j_len * aspect_ratio;
403 resolution.first = i_len;
404 resolution.second = j_len;
3x3 affine transformation matrix.
void set_cairo_surface_ci(cairo_surface_t *surface, SPColorInterpolation ci)
Set the color_interpolation_value for a Cairo surface.
Cairo integration helpers.
3x3 matrix representing an affine transformation.
Axis aligned, non-empty, generic rectangle.
CPoint min() const
Get the corner of the rectangle with smallest coordinate values.
CPoint max() const
Get the corner of the rectangle with largest coordinate values.
Axis-aligned rectangle that can be empty.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
Minimal wrapper over Cairo.
Geom::Rect targetLogicalBounds() const
void setSource(cairo_pattern_t *source)
void paint(double alpha=1.0)
void setOperator(cairo_operator_t op)
SVG drawing item for display.
void set_automatic_resolution(bool const automatic)
Sets, if filter resolution is automatic.
Geom::Affine get_matrix_display2pb() const
Gets the display coordinates to pixblock coordinates transformation matrix.
void set_paraller(bool const paraller)
Sets, if x and y axis in pixblock coordinates should be paraller to x and y of user coordinates.
void set_filter_area(Geom::OptRect const &area)
Sets the filter effects area in user coordinates.
void set_item_bbox(Geom::OptRect const &bbox)
Sets the item bounding box in user coordinates.
void set_ctm(Geom::Affine const &ctm)
Sets the current transformation matrix, i.e.
void set_resolution(double const x_res, double const y_res)
Sets the resolution, the filter should be rendered with.
void set_x(SVGLength const &length)
void reset_resolution()
Resets the filter resolution to its default value, i.e.
std::vector< std::unique_ptr< FilterPrimitive > > primitives
static int _resolution_limit(FilterQuality quality)
void set_height(SVGLength const &length)
Filter()
Creates a new filter with space for one filter element.
void set_y(SVGLength const &length)
std::pair< double, double > _filter_resolution(Geom::Rect const &area, Geom::Affine const &trans, FilterQuality q) const
void update()
Update any embedded DrawingItems prior to rendering.
bool uses_background() const
int render(Inkscape::DrawingItem const *item, DrawingContext &graphic, DrawingContext *bgdc, RenderContext &rc) const
Given background state from bgdc and an intermediate rendering from the surface backing graphic,...
void set_filter_units(SPFilterUnits unit)
Set the filterUnits-property.
void area_enlarge(Geom::IntRect &area, Inkscape::DrawingItem const *item) const
Modifies the given area to accommodate for filters needing pixels outside the rendered area.
void set_primitive_units(SPFilterUnits unit)
Set the primitiveUnits-property.
void add_primitive(std::unique_ptr< FilterPrimitive > primitive)
Creates a new filter primitive under this filter object.
void clear_primitives()
Removes all filter primitives from this filter.
SPFilterUnits _filter_units
SPFilterUnits _primitive_units
void set_resolution(double x_pixels)
Sets the width of intermediate images in pixels.
int _output_slot
Image slot from which filter output should be read.
Geom::OptRect filter_effect_area(Geom::OptRect const &bbox) const
Returns the filter effects area in user coordinate system.
double complexity(Geom::Affine const &ctm) const
void set_width(SVGLength const &length)
int _slot_count
Amount of image slots used when this filter was rendered last time.
void set(Unit u, float v)
Cairo drawing context with Inkscape extensions.
Canvas item belonging to an SVG drawing element.
Cairo surface that remembers its origin.
struct _cairo_surface cairo_surface_t
Helper class to stream background task notifications as a series of messages.
TODO: insert short description here.
@ SP_FILTER_UNITS_USERSPACEONUSE
@ SP_FILTER_UNITS_OBJECTBOUNDINGBOX
@ SP_CSS_COLOR_INTERPOLATION_SRGB