本文整理汇总了C++中SVGStyledTransformableElement::renderer方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGStyledTransformableElement::renderer方法的具体用法?C++ SVGStyledTransformableElement::renderer怎么用?C++ SVGStyledTransformableElement::renderer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGStyledTransformableElement
的用法示例。
在下文中一共展示了SVGStyledTransformableElement::renderer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resourceBoundingBox
FloatRect RenderSVGResourceClipper::resourceBoundingBox(const FloatRect& objectBoundingBox) const
{
FloatRect clipRect;
for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) {
if (!childNode->isSVGElement() || !static_cast<SVGElement*>(childNode)->isStyledTransformable())
continue;
SVGStyledTransformableElement* styled = static_cast<SVGStyledTransformableElement*>(childNode);
RenderStyle* style = styled->renderer() ? styled->renderer()->style() : 0;
if (!style || style->display() == NONE)
continue;
clipRect.unite(styled->renderer()->objectBoundingBox());
}
if (clipRect.isEmpty())
return FloatRect();
if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
AffineTransform obbTransform;
obbTransform.translate(objectBoundingBox.x(), objectBoundingBox.y());
obbTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
return obbTransform.mapRect(clipRect);
}
return clipRect;
}
示例2: applyResource
bool RenderSVGResourceClipper::applyResource(RenderObject* object, GraphicsContext* context)
{
ASSERT(object);
ASSERT(context);
m_clipper.add(object);
context->beginPath();
AffineTransform obbTransform;
FloatRect objectBoundingBox = object->objectBoundingBox();
bool bbox = static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
if (bbox) {
obbTransform.translate(objectBoundingBox.x(), objectBoundingBox.y());
obbTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
}
bool hasClipPath = false;
WindRule clipRule = RULE_EVENODD;
for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) {
if (!childNode->isSVGElement() || !static_cast<SVGElement*>(childNode)->isStyledTransformable())
continue;
SVGStyledTransformableElement* styled = static_cast<SVGStyledTransformableElement*>(childNode);
RenderStyle* style = styled->renderer() ? styled->renderer()->style() : 0;
if (!style || style->display() == NONE)
continue;
Path pathData = styled->toClipPath();
if (pathData.isEmpty())
continue;
if (bbox)
pathData.transform(obbTransform);
hasClipPath = true;
context->addPath(pathData);
clipRule = style->svgStyle()->clipRule();
}
if (!hasClipPath) {
Path clipPath;
clipPath.addRect(FloatRect());
context->addPath(clipPath);
}
// FIXME!
// We don't currently allow for heterogenous clip rules.
// we would have to detect such, draw to a mask, and then clip
// to that mask
context->clipPath(clipRule);
return true;
}