本文整理汇总了C++中PatternAttributes::boundingBoxMode方法的典型用法代码示例。如果您正苦于以下问题:C++ PatternAttributes::boundingBoxMode方法的具体用法?C++ PatternAttributes::boundingBoxMode怎么用?C++ PatternAttributes::boundingBoxMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatternAttributes
的用法示例。
在下文中一共展示了PatternAttributes::boundingBoxMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FloatRect
static inline FloatRect calculatePatternBoundaries(PatternAttributes& attributes,
const FloatRect& objectBoundingBox,
const SVGPatternElement* patternElement)
{
if (attributes.boundingBoxMode())
return FloatRect(attributes.x().valueAsPercentage() * objectBoundingBox.width(),
attributes.y().valueAsPercentage() * objectBoundingBox.height(),
attributes.width().valueAsPercentage() * objectBoundingBox.width(),
attributes.height().valueAsPercentage() * objectBoundingBox.height());
return FloatRect(attributes.x().value(patternElement),
attributes.y().value(patternElement),
attributes.width().value(patternElement),
attributes.height().value(patternElement));
}
示例2: writeSVGResourceContainer
void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int indent)
{
writeStandardPrefix(ts, object, indent);
Element* element = static_cast<Element*>(object.node());
const AtomicString& id = element->getIdAttribute();
writeNameAndQuotedValue(ts, "id", id);
RenderSVGResourceContainer* resource = const_cast<RenderObject&>(object).toRenderSVGResourceContainer();
ASSERT(resource);
if (resource->resourceType() == MaskerResourceType) {
RenderSVGResourceMasker* masker = static_cast<RenderSVGResourceMasker*>(resource);
writeNameValuePair(ts, "maskUnits", masker->maskUnits());
writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits());
ts << "\n";
#if ENABLE(FILTERS)
} else if (resource->resourceType() == FilterResourceType) {
RenderSVGResourceFilter* filter = static_cast<RenderSVGResourceFilter*>(resource);
writeNameValuePair(ts, "filterUnits", filter->filterUnits());
writeNameValuePair(ts, "primitiveUnits", filter->primitiveUnits());
ts << "\n";
if (RefPtr<SVGFilterBuilder> builder = filter->buildPrimitives()) {
if (FilterEffect* lastEffect = builder->lastEffect())
lastEffect->externalRepresentation(ts, indent + 1);
}
#endif
} else if (resource->resourceType() == ClipperResourceType) {
RenderSVGResourceClipper* clipper = static_cast<RenderSVGResourceClipper*>(resource);
writeNameValuePair(ts, "clipPathUnits", clipper->clipPathUnits());
ts << "\n";
} else if (resource->resourceType() == MarkerResourceType) {
RenderSVGResourceMarker* marker = static_cast<RenderSVGResourceMarker*>(resource);
writeNameValuePair(ts, "markerUnits", marker->markerUnits());
ts << " [ref at " << marker->referencePoint() << "]";
ts << " [angle=";
if (marker->angle() == -1)
ts << "auto" << "]\n";
else
ts << marker->angle() << "]\n";
} else if (resource->resourceType() == PatternResourceType) {
RenderSVGResourcePattern* pattern = static_cast<RenderSVGResourcePattern*>(resource);
// Dump final results that are used for rendering. No use in asking SVGPatternElement for its patternUnits(), as it may
// link to other patterns using xlink:href, we need to build the full inheritance chain, aka. collectPatternProperties()
PatternAttributes attributes = static_cast<SVGPatternElement*>(pattern->node())->collectPatternProperties();
writeNameValuePair(ts, "patternUnits", boundingBoxModeString(attributes.boundingBoxMode()));
writeNameValuePair(ts, "patternContentUnits", boundingBoxModeString(attributes.boundingBoxModeContent()));
AffineTransform transform = attributes.patternTransform();
if (!transform.isIdentity())
ts << " [patternTransform=" << transform << "]";
ts << "\n";
} else if (resource->resourceType() == LinearGradientResourceType) {
RenderSVGResourceLinearGradient* gradient = static_cast<RenderSVGResourceLinearGradient*>(resource);
// Dump final results that are used for rendering. No use in asking SVGGradientElement for its gradientUnits(), as it may
// link to other gradients using xlink:href, we need to build the full inheritance chain, aka. collectGradientProperties()
SVGLinearGradientElement* linearGradientElement = static_cast<SVGLinearGradientElement*>(gradient->node());
LinearGradientAttributes attributes = linearGradientElement->collectGradientProperties();
writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.gradientTransform(), attributes.boundingBoxMode());
FloatPoint startPoint;
FloatPoint endPoint;
linearGradientElement->calculateStartEndPoints(attributes, startPoint, endPoint);
ts << " [start=" << startPoint << "] [end=" << endPoint << "]\n";
} else if (resource->resourceType() == RadialGradientResourceType) {
RenderSVGResourceRadialGradient* gradient = static_cast<RenderSVGResourceRadialGradient*>(resource);
// Dump final results that are used for rendering. No use in asking SVGGradientElement for its gradientUnits(), as it may
// link to other gradients using xlink:href, we need to build the full inheritance chain, aka. collectGradientProperties()
SVGRadialGradientElement* radialGradientElement = static_cast<SVGRadialGradientElement*>(gradient->node());
RadialGradientAttributes attributes = radialGradientElement->collectGradientProperties();
writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.gradientTransform(), attributes.boundingBoxMode());
FloatPoint focalPoint;
FloatPoint centerPoint;
float radius;
radialGradientElement->calculateFocalCenterPointsAndRadius(attributes, focalPoint, centerPoint, radius);
ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [radius=" << radius << "]\n";
} else
ts << "\n";
writeChildren(ts, object, indent);
}