本文整理汇总了C++中SVGMaskElement::maskUnits方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGMaskElement::maskUnits方法的具体用法?C++ SVGMaskElement::maskUnits怎么用?C++ SVGMaskElement::maskUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGMaskElement
的用法示例。
在下文中一共展示了SVGMaskElement::maskUnits方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resourceBoundingBox
FloatRect LayoutSVGResourceMasker::resourceBoundingBox(
const LayoutObject* object) {
SVGMaskElement* maskElement = toSVGMaskElement(element());
ASSERT(maskElement);
FloatRect objectBoundingBox = object->objectBoundingBox();
FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement>(
maskElement, maskElement->maskUnits()->currentValue()->enumValue(),
objectBoundingBox);
// Resource was not layouted yet. Give back clipping rect of the mask.
if (selfNeedsLayout())
return maskBoundaries;
if (m_maskContentBoundaries.isEmpty())
calculateMaskContentVisualRect();
FloatRect maskRect = m_maskContentBoundaries;
if (maskElement->maskContentUnits()->currentValue()->value() ==
SVGUnitTypes::kSvgUnitTypeObjectboundingbox) {
AffineTransform transform;
transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
transform.scaleNonUniform(objectBoundingBox.width(),
objectBoundingBox.height());
maskRect = transform.mapRect(maskRect);
}
maskRect.intersect(maskBoundaries);
return maskRect;
}
示例2: resourceBoundingBox
FloatRect RenderSVGResourceMasker::resourceBoundingBox(RenderObject* object)
{
SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node());
ASSERT(maskElement);
FloatRect objectBoundingBox = object->objectBoundingBox();
FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement>(maskElement, maskElement->maskUnits(), objectBoundingBox);
// Resource was not layouted yet. Give back clipping rect of the mask.
if (selfNeedsLayout())
return maskBoundaries;
if (m_maskContentBoundaries.isEmpty())
calculateMaskContentRepaintRect();
FloatRect maskRect = m_maskContentBoundaries;
if (maskElement->maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
AffineTransform transform;
transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
maskRect = transform.mapRect(maskRect);
}
maskRect.intersect(maskBoundaries);
return maskRect;
}