本文整理汇总了C++中SVGSVGElement::currentTranslate方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGSVGElement::currentTranslate方法的具体用法?C++ SVGSVGElement::currentTranslate怎么用?C++ SVGSVGElement::currentTranslate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGSVGElement
的用法示例。
在下文中一共展示了SVGSVGElement::currentTranslate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: localToBorderBoxTransform
// RenderBox methods will expect coordinates w/o any transforms in coordinates
// relative to our borderBox origin. This method gives us exactly that.
AffineTransform RenderSVGRoot::localToBorderBoxTransform() const
{
IntSize borderAndPadding = borderOriginToContentBox();
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
float scale = svg->currentScale();
AffineTransform ctm(scale, 0, 0, scale, borderAndPadding.width(), borderAndPadding.height());
ctm.translate(svg->currentTranslate().x(), svg->currentTranslate().y());
return svg->viewBoxToViewTransform(width(), height()) * ctm;
}
示例2: absoluteTransform
AffineTransform RenderSVGContainer::absoluteTransform() const
{
AffineTransform ctm = RenderContainer::absoluteTransform();
if (!parent()->isSVGContainer()) {
SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());
ctm.scale(svg->currentScale());
ctm.translate(svg->currentTranslate().x(), svg->currentTranslate().y());
}
ctm.translate(viewport().x(), viewport().y());
return viewportTransform() * ctm;
}
示例3: localToBorderBoxTransform
// RenderBox methods will expect coordinates w/o any transforms in coordinates
// relative to our borderBox origin. This method gives us exactly that.
AffineTransform RenderSVGRoot::localToBorderBoxTransform() const
{
IntSize borderAndPadding = borderOriginToContentBox();
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
float scale = style()->effectiveZoom();
FloatPoint translate = svg->currentTranslate();
AffineTransform ctm(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y());
return ctm * svg->viewBoxToViewTransform(width() / scale, height() / scale);
}
示例4: buildLocalToBorderBoxTransform
// RenderBox methods will expect coordinates w/o any transforms in coordinates
// relative to our borderBox origin. This method gives us exactly that.
void RenderSVGRoot::buildLocalToBorderBoxTransform()
{
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
float scale = style()->effectiveZoom();
FloatPoint translate = svg->currentTranslate();
LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
if (borderAndPadding.isEmpty() && scale == 1 && translate == FloatPoint::zero())
return;
m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_localToBorderBoxTransform;
}
示例5: buildLocalToBorderBoxTransform
// LayoutBox methods will expect coordinates w/o any transforms in coordinates
// relative to our borderBox origin. This method gives us exactly that.
void LayoutSVGRoot::buildLocalToBorderBoxTransform()
{
SVGSVGElement* svg = toSVGSVGElement(node());
ASSERT(svg);
float scale = style()->effectiveZoom();
FloatPoint translate = svg->currentTranslate();
LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
AffineTransform viewToBorderBoxTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y());
m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform);
}
示例6: paint
void RenderSVGContainer::paint(PaintInfo& paintInfo, int parentX, int parentY)
{
if (paintInfo.context->paintingDisabled())
return;
// This should only exist for <svg> renderers
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, m_x + parentX, m_y + parentY);
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE)
paintOutline(paintInfo.context, parentX, parentY, width(), height(), style());
if (paintInfo.phase != PaintPhaseForeground || !drawsContents())
return;
const SVGRenderStyle* svgStyle = style()->svgStyle();
AtomicString filterId(SVGURIReference::getTarget(svgStyle->filter()));
#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
SVGResourceFilter* filter = getFilterById(document(), filterId);
#endif
if (!firstChild()
#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
&& !filter
#endif
)
return; // Spec: groups w/o children still may render filter content.
paintInfo.context->save();
if (!parent()->isSVGContainer()) {
// Translate from parent offsets (html renderers) to a relative transform (svg renderers)
IntPoint origin;
origin.move(parentX, parentY);
origin.move(m_x, m_y);
origin.move(borderLeft(), borderTop());
origin.move(paddingLeft(), paddingTop());
if (origin.x() || origin.y()) {
paintInfo.context->concatCTM(AffineTransform().translate(origin.x(), origin.y()));
paintInfo.rect.move(-origin.x(), -origin.y());
}
parentX = parentY = 0;
SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());
paintInfo.context->concatCTM(AffineTransform().scale(svg->currentScale()));
} else {
// Only the root <svg> element should need any translations using the HTML/CSS system
// parentX, parentY are also non-zero for first-level kids of these
// CSS-transformed <svg> root-elements (due to RenderBox::paint) for any other element
// they should be 0. m_x, m_y should always be 0 for non-root svg containers
ASSERT(m_x == 0);
ASSERT(m_y == 0);
}
if (!viewport().isEmpty()) {
if (style()->overflowX() != OVISIBLE)
paintInfo.context->clip(enclosingIntRect(viewport())); // FIXME: Eventually we'll want float-precision clipping
paintInfo.context->concatCTM(AffineTransform().translate(viewport().x(), viewport().y()));
}
if (!localTransform().isIdentity())
paintInfo.context->concatCTM(localTransform());
if (!parent()->isSVGContainer()) {
SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());
paintInfo.context->concatCTM(AffineTransform().translate(svg->currentTranslate().x(), svg->currentTranslate().y()));
}
FloatRect strokeBBox = relativeBBox(true);
SVGElement* svgElement = static_cast<SVGElement*>(element());
ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement);
AtomicString clipperId(SVGURIReference::getTarget(svgStyle->clipPath()));
AtomicString maskerId(SVGURIReference::getTarget(svgStyle->maskElement()));
SVGResourceClipper* clipper = getClipperById(document(), clipperId);
SVGResourceMasker* masker = getMaskerById(document(), maskerId);
if (clipper) {
clipper->addClient(styledElement);
clipper->applyClip(paintInfo.context, strokeBBox);
} else if (!clipperId.isEmpty())
svgElement->document()->accessSVGExtensions()->addPendingResource(clipperId, styledElement);
if (masker) {
masker->addClient(styledElement);
masker->applyMask(paintInfo.context, strokeBBox);
} else if (!maskerId.isEmpty())
svgElement->document()->accessSVGExtensions()->addPendingResource(maskerId, styledElement);
float opacity = style()->opacity();
if (opacity < 1.0f) {
paintInfo.context->clip(enclosingIntRect(strokeBBox));
paintInfo.context->beginTransparencyLayer(opacity);
}
#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
if (filter)
//.........这里部分代码省略.........