Inkscape
Vector Graphics Editor
|
#include <cairo-renderer.h>
Public Member Functions | |
CairoRenderer () | |
~CairoRenderer () | |
CairoRenderContext | createContext () |
void | applyClipPath (CairoRenderContext *ctx, SPClipPath const *cp) |
void | applyMask (CairoRenderContext *ctx, SPMask const *mask) |
bool | setupDocument (CairoRenderContext *ctx, SPDocument *doc, SPItem const *base=nullptr) |
Initializes the CairoRenderContext according to the specified SPDocument. | |
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 | renderHatchPath (CairoRenderContext *ctx, SPHatchPath const &hatchPath, unsigned key) |
bool | renderPages (CairoRenderContext *ctx, SPDocument *doc, bool stretch_to_fit) |
Handle multiple pages, pushing each out to cairo as needed using renderItem() | |
bool | renderPage (CairoRenderContext *ctx, SPDocument *doc, SPPage const *page, bool stretch_to_fit) |
Static Private Member Functions | |
static bool | _shouldRasterize (CairoRenderContext *ctx, SPItem const *item) |
Decide whether the given item should be rendered as a bitmap. | |
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. | |
Definition at line 38 of file cairo-renderer.h.
|
default |
|
default |
|
staticprivate |
Render a single item in a fully set up context.
Definition at line 590 of file cairo-renderer.cpp.
References _shouldRasterize(), has_hidder_filter(), SPItem::isHidden(), item, origin, page, Inkscape::Extension::Internal::sp_asbitmap_render(), and Inkscape::Extension::Internal::sp_item_invoke_render().
Referenced by applyClipPath(), and renderItem().
|
staticprivate |
Decide whether the given item should be rendered as a bitmap.
Definition at line 574 of file cairo-renderer.cpp.
References Inkscape::Extension::Internal::CairoRenderContext::getFilterToBitmap(), SPItem::isFiltered(), SPItem::isInClipPath(), and item.
Referenced by _doRender().
void Inkscape::Extension::Internal::CairoRenderer::applyClipPath | ( | CairoRenderContext * | ctx, |
SPClipPath const * | cp | ||
) |
Definition at line 759 of file cairo-renderer.cpp.
References Inkscape::Extension::Internal::CairoRenderContext::_cr, _doRender(), Inkscape::Extension::Internal::CairoRenderContext::_is_valid, child, SPObject::children, Inkscape::Extension::Internal::CairoRenderContext::CLIP_MODE_PATH, SPClipPath::clippath_units(), Geom::GenericRect< C >::dimensions(), SPClipPath::get_last_bbox(), Inkscape::Extension::Internal::CairoRenderContext::getClipMode(), Inkscape::Extension::Internal::CairoRenderContext::getCurrentState(), Inkscape::Extension::Internal::CairoRenderContext::getRenderMode(), Inkscape::Extension::Internal::CairoRenderContext::getTransform(), item, Inkscape::Extension::Internal::CairoRenderState::item_transform, Geom::GenericRect< C >::left(), Inkscape::Extension::Internal::CairoRenderContext::popState(), Inkscape::Extension::Internal::CairoRenderContext::pushState(), Inkscape::Extension::Internal::CairoRenderContext::RENDER_MODE_CLIP, Inkscape::Extension::Internal::CairoRenderContext::RENDER_MODE_NORMAL, Inkscape::Extension::Internal::CairoRenderContext::setRenderMode(), Inkscape::Extension::Internal::CairoRenderContext::setStateForItem(), Inkscape::Extension::Internal::CairoRenderContext::setTransform(), SP_CONTENT_UNITS_OBJECTBOUNDINGBOX, Geom::GenericRect< C >::top(), Inkscape::Extension::Internal::CairoRenderState::transform, Inkscape::Extension::Internal::CairoRenderContext::transform(), and SPItem::transform.
Referenced by Inkscape::Extension::Internal::CairoRenderContext::popLayer().
void Inkscape::Extension::Internal::CairoRenderer::applyMask | ( | CairoRenderContext * | ctx, |
SPMask const * | mask | ||
) |
Definition at line 812 of file cairo-renderer.cpp.
References Inkscape::Extension::Internal::CairoRenderContext::_is_valid, child, SPObject::children, Geom::GenericRect< C >::dimensions(), SPMask::get_last_bbox(), Inkscape::Extension::Internal::CairoRenderContext::getCurrentState(), item, Geom::GenericRect< C >::left(), SPMask::mask_content_units(), Inkscape::Extension::Internal::CairoRenderContext::popState(), Inkscape::Extension::Internal::CairoRenderContext::pushState(), renderItem(), Inkscape::Extension::Internal::CairoRenderContext::setTransform(), SP_CONTENT_UNITS_OBJECTBOUNDINGBOX, Geom::GenericRect< C >::top(), and Inkscape::Extension::Internal::CairoRenderState::transform.
Referenced by Inkscape::Extension::Internal::CairoRenderContext::popLayer().
CairoRenderContext Inkscape::Extension::Internal::CairoRenderer::createContext | ( | ) |
Definition at line 93 of file cairo-renderer.cpp.
Referenced by Inkscape::Extension::Internal::CairoRenderContext::createSimilar(), Inkscape::UI::Dialog::Print::draw_page(), Inkscape::Extension::Internal::pdf_render_document_to_file(), Inkscape::Extension::Internal::CairoRenderContext::popLayer(), and Inkscape::Extension::Internal::ps_print_document_to_file().
void Inkscape::Extension::Internal::CairoRenderer::renderHatchPath | ( | CairoRenderContext * | ctx, |
SPHatchPath const & | hatchPath, | ||
unsigned | key | ||
) |
Definition at line 639 of file cairo-renderer.cpp.
References SPHatchPath::calculateRenderCurve(), SVGLength::computed, key, SPHatchPath::offset, Inkscape::Extension::Internal::CairoRenderContext::popState(), Inkscape::Extension::Internal::CairoRenderContext::pushState(), Inkscape::Extension::Internal::CairoRenderContext::renderPathVector(), Inkscape::Extension::Internal::CairoRenderContext::setStateForStyle(), SPObject::style, and Inkscape::Extension::Internal::CairoRenderContext::transform().
Referenced by Inkscape::Extension::Internal::CairoRenderContext::_createHatchPainter().
void Inkscape::Extension::Internal::CairoRenderer::renderItem | ( | CairoRenderContext * | ctx, |
SPItem const * | item, | ||
SPItem const * | origin = nullptr , |
||
SPPage const * | page = nullptr |
||
) |
Traverses the object tree and invokes the render methods.
Definition at line 604 of file cairo-renderer.cpp.
References _doRender(), Inkscape::Extension::Internal::CairoRenderContext::getCurrentState(), ink_css_blend_to_cairo_operator(), item, SPStyle::mix_blend_mode, Inkscape::Extension::Internal::CairoRenderState::need_layer, origin, page, Inkscape::Extension::Internal::CairoRenderContext::popLayer(), Inkscape::Extension::Internal::CairoRenderContext::popState(), Inkscape::Extension::Internal::CairoRenderContext::pushLayer(), Inkscape::Extension::Internal::CairoRenderContext::pushState(), Inkscape::Extension::Internal::CairoRenderContext::setStateForItem(), Inkscape::Extension::Internal::CairoRenderContext::setStateMergeOpacity(), Inkscape::Extension::Internal::CairoRenderContext::setStateNeedsLayer(), SP_CSS_BLEND_NORMAL, SPObject::style, Inkscape::Extension::Internal::CairoRenderContext::transform(), and SPItem::transform.
Referenced by Inkscape::Extension::Internal::CairoRenderContext::_createPatternPainter(), applyMask(), Inkscape::UI::Dialog::Print::draw_page(), renderPage(), renderPages(), Inkscape::Extension::Internal::sp_anchor_render(), Inkscape::Extension::Internal::sp_group_render(), Inkscape::Extension::Internal::sp_shape_render(), and Inkscape::Extension::Internal::sp_use_render().
bool Inkscape::Extension::Internal::CairoRenderer::renderPage | ( | CairoRenderContext * | ctx, |
SPDocument * | doc, | ||
SPPage const * | page, | ||
bool | stretch_to_fit | ||
) |
Definition at line 710 of file cairo-renderer.cpp.
References child, Inkscape::Extension::Internal::compute_final_page_dimensions(), Inkscape::Util::Quantity::convert(), SPDocument::getDocumentScale(), SPDocument::getRoot(), Geom::Translate::inverse(), Inkscape::Extension::Internal::CairoRenderContext::nextPage(), page, Inkscape::Extension::Internal::CairoRenderContext::popState(), Inkscape::Extension::Internal::CairoRenderContext::pushState(), renderItem(), root, scale, and Inkscape::Extension::Internal::CairoRenderContext::transform().
Referenced by Inkscape::UI::Dialog::Print::draw_page(), and renderPages().
bool Inkscape::Extension::Internal::CairoRenderer::renderPages | ( | CairoRenderContext * | ctx, |
SPDocument * | doc, | ||
bool | stretch_to_fit | ||
) |
Handle multiple pages, pushing each out to cairo as needed using renderItem()
Definition at line 682 of file cairo-renderer.cpp.
References Inkscape::Extension::Internal::CairoRenderContext::destBegin(), Inkscape::Extension::Internal::CairoRenderContext::destEnd(), Inkscape::Extension::Internal::CairoRenderContext::finishPage(), SPDocument::getPageManager(), Inkscape::PageManager::getPages(), SPDocument::getRoot(), page, Inkscape::Extension::Internal::CairoRenderContext::popState(), Inkscape::Extension::Internal::CairoRenderContext::pushState(), renderItem(), and renderPage().
Referenced by Inkscape::Extension::Internal::pdf_render_document_to_file(), and Inkscape::Extension::Internal::ps_print_document_to_file().
bool Inkscape::Extension::Internal::CairoRenderer::setupDocument | ( | CairoRenderContext * | ctx, |
SPDocument * | doc, | ||
SPItem const * | base = nullptr |
||
) |
Initializes the CairoRenderContext according to the specified SPDocument.
A set*Target function can only be called on the context before setupDocument.
Definition at line 652 of file cairo-renderer.cpp.
References Inkscape::Extension::Internal::CairoRenderContext::_vector_based_target, Inkscape::Util::Quantity::convert(), Geom::GenericRect< Coord >::from_xywh(), SPDocument::getDimensions(), SPDocument::getRoot(), Geom::GenericRect< C >::height(), height, Inkscape::Extension::Internal::CairoRenderContext::setMetadata(), Inkscape::Extension::Internal::CairoRenderContext::setupSurface(), Geom::GenericRect< C >::width(), and width.
Referenced by Inkscape::UI::Dialog::Print::draw_page(), Inkscape::Extension::Internal::pdf_render_document_to_file(), and Inkscape::Extension::Internal::ps_print_document_to_file().