/*
7 * Krzysztof KosiĆski <tweenk.pl@gmail.com>
9 * Copyright (C) 2011 Authors
10 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
31 defer([
this, pixbuf = std::move(pixbuf)] ()
mutable {
150 if (greyscale_exception) {
156 if (greyscale_exception) {
215 for (
unsigned i = 0; i < 3; ++i) {
216 for (
unsigned j = i+1; j < 4; ++j) {
225 auto pixels =
_pixbuf->pixels();
228 size_t rowstride =
_pixbuf->rowstride();
241 if ((ix < 0) || (iy < 0) || (ix >=
width) || (iy >=
height))
244 auto pix_ptr = pixels + iy * rowstride + ix * 4;
249 alpha = (px & 0xff000000) >> 24;
253 throw std::runtime_error(
"Unrecognized pixel format");
255 float alpha_f = (alpha / 255.0f) *
_opacity;
256 return alpha_f > 0.01 ? this :
nullptr;
Cairo software blending templates.
void ink_cairo_surface_filter(cairo_surface_t *in, cairo_surface_t *out, Filter &&filter)
Cairo integration helpers.
Affine inverse() const
Compute the inverse matrix.
Coord nearestTime(Point const &p, Coord from=0, Coord to=1) const override
Compute a time value at which the curve comes closest to a specified point.
Point pointAt(Coord t) const override
Evaluate the curve at a specified time value.
Axis aligned, non-empty, generic rectangle.
bool contains(GenericRect< C > const &r) const
Check whether the rectangle includes all points in the given rectangle.
C width() const
Get the horizontal extent of the rectangle.
CPoint corner(unsigned i) const
Return the n-th corner of the rectangle.
Axis-aligned rectangle that can be empty.
Two-dimensional point that doubles as a vector.
constexpr Coord y() const noexcept
constexpr Coord x() const noexcept
Axis aligned, non-empty rectangle.
IntRect roundOutwards() const
Return the smallest integer rectangle which contains this one.
RAII idiom for saving the state of DrawingContext.
Minimal wrapper over Cairo.
void setSource(cairo_pattern_t *source)
cairo_surface_t * rawTarget()
void scale(Geom::Scale const &s)
void transform(Geom::Affine const &trans)
void paint(double alpha=1.0)
void rectangle(Geom::Rect const &r)
void patternSetExtend(cairo_extend_t extend)
void lineTo(Geom::Point const &p)
void moveTo(Geom::Point const &p)
void translate(Geom::Point const &t)
void setLineWidth(double w)
void patternSetFilter(cairo_filter_t filter)
void setClipbox(Geom::Rect const &box)
void setScale(double sx, double sy)
Geom::Rect _clipbox
for preserveAspectRatio
DrawingImage(Drawing &drawing)
SPImageRendering style_image_rendering
unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset) override
unsigned _renderItem(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags, DrawingItem const *stop_at) const override
void setPixbuf(std::shared_ptr< Inkscape::Pixbuf const > pb)
void setOrigin(Geom::Point const &o)
std::shared_ptr< Inkscape::Pixbuf const > _pixbuf
Geom::Rect bounds() const
void setStyle(SPStyle const *style, SPStyle const *context_style=nullptr) override
Process information related to the new style.
DrawingItem * _pickItem(Geom::Point const &p, double delta, unsigned flags) override
SVG drawing item for display.
DrawingItem * pick(Geom::Point const &p, double delta, unsigned flags=0)
Get the item under the specified point.
Geom::OptIntRect _bbox
Bounding box in display (pixel) coords including stroke.
virtual void setStyle(SPStyle const *style, SPStyle const *context_style=nullptr)
Process information related to the new style.
void _markForUpdate(unsigned state, bool propagate)
Marks the item as needing a recomputation of internal data.
Geom::Affine _ctm
Total transform from item coords to display coords.
uint32_t imageOutlineColor() const
ColorMode colorMode() const
auto & grayscaleMatrix() const
bool imageOutlineMode() const
T< SPAttr::IMAGE_RENDERING, SPIEnum< SPImageRendering > > image_rendering
Cairo drawing context with Inkscape extensions.
Bitmap image belonging to an SVG drawing.
struct _cairo_surface cairo_surface_t
auto floor(Geom::Rect const &rect)
Angle distance(Angle const &a, Angle const &b)
GenericOptRect< IntCoord > OptIntRect
Helper class to stream background task notifications as a series of messages.
Geom::PathVector outline(Geom::Path const &input, double width, double miter, LineJoinType join, LineCapType butt, double tolerance)
Strokes the path given by input.
static double distance_to_segment(Geom::Point const &p, Geom::Point const &a1, Geom::Point const &a2)
Calculates the closest distance from p to the segment a1-a2.
@ SP_CSS_IMAGE_RENDERING_PIXELATED
@ SP_CSS_IMAGE_RENDERING_OPTIMIZEQUALITY
@ SP_CSS_IMAGE_RENDERING_AUTO
@ SP_CSS_IMAGE_RENDERING_OPTIMIZESPEED
@ SP_CSS_IMAGE_RENDERING_CRISPEDGES