本文整理汇总了C++中SVGLength::valueInSpecifiedUnits方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGLength::valueInSpecifiedUnits方法的具体用法?C++ SVGLength::valueInSpecifiedUnits怎么用?C++ SVGLength::valueInSpecifiedUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGLength
的用法示例。
在下文中一共展示了SVGLength::valueInSpecifiedUnits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: size
IntSize SVGImage::size() const
{
IntSize defaultSize(300, 150);
// FIXME: Eventually we'll be passed in the dest size and can scale against that
IntSize destSize = defaultSize;
if (!m_frame || !m_frame->document())
return IntSize();
SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_frame->document())->rootElement();
if (!rootElement)
return defaultSize;
SVGLength width = rootElement->width();
SVGLength height = rootElement->height();
IntSize svgSize;
if (width.unitType() == LengthTypePercentage)
svgSize.setWidth(static_cast<int>(width.valueInSpecifiedUnits() * destSize.width()));
else
svgSize.setWidth(static_cast<int>(width.value()));
if (height.unitType() == LengthTypePercentage)
svgSize.setHeight(static_cast<int>(height.valueInSpecifiedUnits() * destSize.height()));
else
svgSize.setHeight(static_cast<int>(height.value()));
return svgSize;
}
示例2: valueInSpecifiedUnitsAttrGetter
static v8::Handle<v8::Value> valueInSpecifiedUnitsAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.SVGLength.valueInSpecifiedUnits._get");
V8SVGPODTypeWrapper<SVGLength>* impWrapper = V8SVGPODTypeWrapper<SVGLength>::toNative(info.Holder());
SVGLength impInstance = *impWrapper;
SVGLength* imp = &impInstance;
return v8::Number::New(imp->valueInSpecifiedUnits());
}
示例3: create
PassRefPtr<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(const SVGLength& length)
{
CSSPrimitiveValue::UnitTypes cssType = CSSPrimitiveValue::CSS_UNKNOWN;
switch (length.unitType()) {
case LengthTypeUnknown:
break;
case LengthTypeNumber:
cssType = CSSPrimitiveValue::CSS_NUMBER;
break;
case LengthTypePercentage:
cssType = CSSPrimitiveValue::CSS_PERCENTAGE;
break;
case LengthTypeEMS:
cssType = CSSPrimitiveValue::CSS_EMS;
break;
case LengthTypeEXS:
cssType = CSSPrimitiveValue::CSS_EXS;
break;
case LengthTypePX:
cssType = CSSPrimitiveValue::CSS_PX;
break;
case LengthTypeCM:
cssType = CSSPrimitiveValue::CSS_CM;
break;
case LengthTypeMM:
cssType = CSSPrimitiveValue::CSS_MM;
break;
case LengthTypeIN:
cssType = CSSPrimitiveValue::CSS_IN;
break;
case LengthTypePT:
cssType = CSSPrimitiveValue::CSS_PT;
break;
case LengthTypePC:
cssType = CSSPrimitiveValue::CSS_PC;
break;
default:
ASSERT_NOT_REACHED();
};
return CSSPrimitiveValue::create(length.valueInSpecifiedUnits(), cssType);
}