本文整理汇总了C++中SVGLength::put_value方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGLength::put_value方法的具体用法?C++ SVGLength::put_value怎么用?C++ SVGLength::put_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGLength
的用法示例。
在下文中一共展示了SVGLength::put_value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Move
STDMETHODIMP CESVGRectElement::Move(ISVGView* view, double dx, double dy)
{
ATLASSERT(0);
#if 0
CComQIPtr<ILSVGRectElement> rect = m_domElement;
CComPtr<ILHTMLWindow> window;
view->GetHTMLWindow(&window);
CComPtr<ILSVGElement> viewportElement;
rect->get_viewportElement(&viewportElement);
// TODO, this can't be correct
CComPtr<ILSVGRect> _rect;
window->svgGetRBBox(viewportElement, &_rect);
SVGRect viewBox = _rect;
// x
{
CComPtr<ILSVGAnimatedLength> alength;
rect->get_x(&alength);
SVGLength length;
alength->get_baseVal(&length);
if (length.GetUnitType() == SVG_LENGTHTYPE_PERCENTAGE)
{
double dx_pcnt = dx*100/viewBox.Width;
double value;
length->get_valueInSpecifiedUnits(&value);
length->put_valueInSpecifiedUnits(value+dx_pcnt);
}
else
{
double value;
length->get_value(&value);
length->put_value(value + dx);
}
}
// y
{
CComPtr<ILSVGAnimatedLength> alength;
rect->get_y(&alength);
SVGLength length;
alength->get_baseVal(&length);
if (length.GetUnitType() == SVG_LENGTHTYPE_PERCENTAGE)
{
double dy_pcnt = dy*100/viewBox.Height;
double value;
length->get_valueInSpecifiedUnits(&value);
length->put_valueInSpecifiedUnits(value+dy_pcnt);
}
else
{
double value;
length->get_value(&value);
length->put_value(value + dy);
}
}
#endif
return S_OK;
}
示例2: Resize
STDMETHODIMP CESVGRectElement::Resize(ISVGView* view, double x, double y, double width, double height)
{
ATLASSERT(0);
#if 0
CComQIPtr<ILSVGRectElement> rect = m_domElement;
CComPtr<ILHTMLWindow> window;
view->GetHTMLWindow(&window);
CComPtr<ILSVGElement> viewportElement;
rect->get_viewportElement(&viewportElement);
// TODO, this can't be correct
CComPtr<ILSVGRect> _rect;
window->svgGetRBBox(viewportElement, &_rect);
SVGRect viewBox = _rect;
// x
{
CComQIPtr<ILSVGAnimatedLength> alength;
rect->get_x(&alength);
SVGLength length;
alength->get_baseVal(&length);
if (length.GetUnitType() == SVG_LENGTHTYPE_PERCENTAGE)
{
double x_pcnt = x*100/viewBox.Width;
length->set_valueInSpecifiedUnits(x_pcnt);
}
else
{
length->put_value(x);
}
}
// y
{
CComQIPtr<ILSVGAnimatedLength> alength;
rect->get_y(&alength);
SVGLength length;
alength->get_baseVal(&length);
if (length.GetUnitType() == SVG_LENGTHTYPE_PERCENTAGE)
{
double y_pcnt = y*100/viewBox.Height;
length->set_valueInSpecifiedUnits(y_pcnt);
}
else
{
length->put_value(y);
}
}
// width
{
CComQIPtr<ILSVGAnimatedLength> alength;
rect->get_width(&alength);
SVGLength length;
alength->get_baseVal(&length);
if (length.GetUnitType() == SVG_LENGTHTYPE_PERCENTAGE)
{
double width_pcnt = width*100/viewBox.Width;
length->set_valueInSpecifiedUnits(width_pcnt);
}
else
{
length->put_value(width);
}
}
// height
{
CComQIPtr<ILSVGAnimatedLength> alength;
rect->get_height(&alength);
SVGLength length;
alength->get_baseVal(&length);
if (length.GetUnitType() == SVG_LENGTHTYPE_PERCENTAGE)
{
double height_pcnt = height*100/viewBox.Height;
length->set_valueInSpecifiedUnits(height_pcnt);
}
else
{
length->put_value(height);
}
}
#endif
return S_OK;
}