本文整理汇总了C++中SVGPreserveAspectRatio类的典型用法代码示例。如果您正苦于以下问题:C++ SVGPreserveAspectRatio类的具体用法?C++ SVGPreserveAspectRatio怎么用?C++ SVGPreserveAspectRatio使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SVGPreserveAspectRatio类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: meetOrSliceAttrGetter
static v8::Handle<v8::Value> meetOrSliceAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
SVGPropertyTearOff<SVGPreserveAspectRatio>* wrapper = V8SVGPreserveAspectRatio::toNative(info.Holder());
SVGPreserveAspectRatio& impInstance = wrapper->propertyReference();
SVGPreserveAspectRatio* imp = &impInstance;
return v8Integer(imp->meetOrSlice(), info.GetIsolate());
}
示例2: parseAttribute
void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == SVGNames::preserveAspectRatioAttr) {
SVGPreserveAspectRatio preserveAspectRatio;
preserveAspectRatio.parse(value);
setPreserveAspectRatioBaseValue(preserveAspectRatio);
return;
}
SVGParsingError parseError = NoError;
if (name == SVGNames::xAttr)
setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
else if (name == SVGNames::yAttr)
setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
else if (name == SVGNames::widthAttr)
setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
else if (name == SVGNames::heightAttr)
setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
reportAttributeParsingError(parseError, name, value);
SVGGraphicsElement::parseAttribute(name, value);
SVGExternalResourcesRequired::parseAttribute(name, value);
SVGURIReference::parseAttribute(name, value);
}
示例3: PackPreserveAspectRatio
static PRUint64
PackPreserveAspectRatio(const SVGPreserveAspectRatio& par)
{
// All preserveAspectRatio values are enum values (do not interpolate), so we
// can safely collate them and treat them as a single enum as for SMIL.
PRUint64 packed = 0;
packed |= PRUint64(par.GetDefer() ? 1 : 0) << 16;
packed |= PRUint64(par.GetAlign()) << 8;
packed |= PRUint64(par.GetMeetOrSlice());
return packed;
}
示例4: parseAttribute
void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == SVGNames::preserveAspectRatioAttr) {
SVGPreserveAspectRatio preserveAspectRatio;
preserveAspectRatio.parse(value);
setPreserveAspectRatioBaseValue(preserveAspectRatio);
return;
}
SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value);
SVGURIReference::parseAttribute(name, value);
SVGExternalResourcesRequired::parseAttribute(name, value);
}
示例5: viewBoxToViewTransform
AffineTransform SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio& preserveAspectRatio, float viewWidth, float viewHeight)
{
if (!viewBoxRect.width() || !viewBoxRect.height())
return AffineTransform();
return preserveAspectRatio.getCTM(viewBoxRect.x(), viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), viewWidth, viewHeight);
}
示例6: parseViewBox
bool SVGFitToViewBox::parseAttribute(Document* document, Attribute* attr)
{
if (attr->name() == SVGNames::viewBoxAttr) {
FloatRect viewBox;
if (!attr->value().isNull())
parseViewBox(document, attr->value(), viewBox);
setViewBoxBaseValue(viewBox);
return true;
} else if (attr->name() == SVGNames::preserveAspectRatioAttr) {
SVGPreserveAspectRatio preserveAspectRatio;
preserveAspectRatio.parse(attr->value());
setPreserveAspectRatioBaseValue(preserveAspectRatio);
return true;
}
return false;
}
示例7: meetOrSliceAttrSetter
static void meetOrSliceAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
SVGPropertyTearOff<SVGPreserveAspectRatio>* wrapper = V8SVGPreserveAspectRatio::toNative(info.Holder());
if (wrapper->isReadOnly()) {
setDOMException(NO_MODIFICATION_ALLOWED_ERR, info.GetIsolate());
return;
}
SVGPreserveAspectRatio& impInstance = wrapper->propertyReference();
SVGPreserveAspectRatio* imp = &impInstance;
int v = toUInt32(value);
ExceptionCode ec = 0;
imp->setMeetOrSlice(v, ec);
if (UNLIKELY(ec))
setDOMException(ec, info.GetIsolate());
if (!ec)
wrapper->commitChange();
return;
}
示例8: ToPreserveAspectRatio
static nsresult
ToPreserveAspectRatio(const nsAString &aString,
SVGPreserveAspectRatio *aValue)
{
if (aString.IsEmpty() || NS_IsAsciiWhitespace(aString[0])) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
nsWhitespaceTokenizer tokenizer(aString);
if (!tokenizer.hasMoreTokens()) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
const nsAString &token = tokenizer.nextToken();
nsresult rv;
SVGPreserveAspectRatio val;
val.SetDefer(token.EqualsLiteral("defer"));
if (val.GetDefer()) {
if (!tokenizer.hasMoreTokens()) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
rv = val.SetAlign(GetAlignForString(tokenizer.nextToken()));
} else {
rv = val.SetAlign(GetAlignForString(token));
}
if (NS_FAILED(rv)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
if (tokenizer.hasMoreTokens()) {
rv = val.SetMeetOrSlice(GetMeetOrSliceForString(tokenizer.nextToken()));
if (NS_FAILED(rv)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
} else {
val.SetMeetOrSlice(nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_MEET);
}
if (tokenizer.hasMoreTokens()) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
*aValue = val;
return NS_OK;
}
示例9: while
bool SVGViewSpec::parseViewSpec(const String& viewSpec)
{
const UChar* currViewSpec = viewSpec.deprecatedCharacters();
const UChar* end = currViewSpec + viewSpec.length();
if (currViewSpec >= end || !m_contextElement)
return false;
if (!skipString(currViewSpec, end, svgViewSpec, WTF_ARRAY_LENGTH(svgViewSpec)))
return false;
if (currViewSpec >= end || *currViewSpec != '(')
return false;
currViewSpec++;
while (currViewSpec < end && *currViewSpec != ')') {
if (*currViewSpec == 'v') {
if (skipString(currViewSpec, end, viewBoxSpec, WTF_ARRAY_LENGTH(viewBoxSpec))) {
if (currViewSpec >= end || *currViewSpec != '(')
return false;
currViewSpec++;
FloatRect viewBox;
if (!SVGFitToViewBox::parseViewBox(&m_contextElement->document(), currViewSpec, end, viewBox, false))
return false;
setViewBoxBaseValue(viewBox);
if (currViewSpec >= end || *currViewSpec != ')')
return false;
currViewSpec++;
} else if (skipString(currViewSpec, end, viewTargetSpec, WTF_ARRAY_LENGTH(viewTargetSpec))) {
if (currViewSpec >= end || *currViewSpec != '(')
return false;
const UChar* viewTargetStart = ++currViewSpec;
while (currViewSpec < end && *currViewSpec != ')')
currViewSpec++;
if (currViewSpec >= end)
return false;
setViewTargetString(String(viewTargetStart, currViewSpec - viewTargetStart));
currViewSpec++;
} else
return false;
} else if (*currViewSpec == 'z') {
if (!skipString(currViewSpec, end, zoomAndPanSpec, WTF_ARRAY_LENGTH(zoomAndPanSpec)))
return false;
if (currViewSpec >= end || *currViewSpec != '(')
return false;
currViewSpec++;
if (!parseZoomAndPan(currViewSpec, end, m_zoomAndPan))
return false;
if (currViewSpec >= end || *currViewSpec != ')')
return false;
currViewSpec++;
} else if (*currViewSpec == 'p') {
if (!skipString(currViewSpec, end, preserveAspectRatioSpec, WTF_ARRAY_LENGTH(preserveAspectRatioSpec)))
return false;
if (currViewSpec >= end || *currViewSpec != '(')
return false;
currViewSpec++;
SVGPreserveAspectRatio preserveAspectRatio;
if (!preserveAspectRatio.parse(currViewSpec, end, false))
return false;
setPreserveAspectRatioBaseValue(preserveAspectRatio);
if (currViewSpec >= end || *currViewSpec != ')')
return false;
currViewSpec++;
} else if (*currViewSpec == 't') {
if (!skipString(currViewSpec, end, transformSpec, WTF_ARRAY_LENGTH(transformSpec)))
return false;
if (currViewSpec >= end || *currViewSpec != '(')
return false;
currViewSpec++;
SVGTransformable::parseTransformAttribute(m_transform, currViewSpec, end, SVGTransformable::DoNotClearList);
if (currViewSpec >= end || *currViewSpec != ')')
return false;
currViewSpec++;
} else
return false;
if (currViewSpec < end && *currViewSpec == ';')
currViewSpec++;
}
if (currViewSpec >= end || *currViewSpec != ')')
return false;
return true;
}