当前位置: 首页>>代码示例>>C++>>正文


C++ SVGLength::valueInSpecifiedUnits方法代码示例

本文整理汇总了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;
}
开发者ID:PyroOS,项目名称:Pyro,代码行数:28,代码来源:SVGImage.cpp

示例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());
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:8,代码来源:V8SVGLength.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:42,代码来源:


注:本文中的SVGLength::valueInSpecifiedUnits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。