本文整理汇总了C++中SVGFilterElement::primitiveUnits_attr方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGFilterElement::primitiveUnits_attr方法的具体用法?C++ SVGFilterElement::primitiveUnits_attr怎么用?C++ SVGFilterElement::primitiveUnits_attr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGFilterElement
的用法示例。
在下文中一共展示了SVGFilterElement::primitiveUnits_attr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculatePrimitiveSubRegion
void PSVGFEElement::CalculatePrimitiveSubRegion(PSVGFilterElement* pFilterElement, PSVGElement* pReferencingElement, /*in,out*/gm::RectF& subRegion)
{
ISVGFilterPrimitiveStandardAttributes* pStdAttributes = dynamic_cast<ISVGFilterPrimitiveStandardAttributes*>(m_pNode);
ASSERT(pStdAttributes != NULL);
SVGFilterElement* psvgFilterElement = static_cast<SVGFilterElement*>(pFilterElement->m_pNode);
ISVGLength* xLength = pStdAttributes->get_x()->get_animVal();
ISVGLength* yLength = pStdAttributes->get_y()->get_animVal();
ISVGLength* widthLength = pStdAttributes->get_width()->get_animVal();
ISVGLength* heightLength = pStdAttributes->get_height()->get_animVal();
// RectD filterRegion = pReferencingElement->m_filterRect;
// RectD subRegion;
if (psvgFilterElement->primitiveUnits_attr().m_animated->m_animVal->m_value == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
{
gm::RectD rect = pReferencingElement->m_bounds;
if (pStdAttributes->get_xAttr()->get_specified())
{
if (xLength->get_unitType() == SVG_LENGTHTYPE_PERCENTAGE)
subRegion.X = rect.X + (xLength->get_valueInSpecifiedUnits() * rect.Width/100);
else
subRegion.X = rect.X + (xLength->get_value() * rect.Width);
}
//else
// subRegion.X = filterRegion.X;
if (pStdAttributes->get_yAttr()->get_specified())
{
if (yLength->get_unitType() == SVG_LENGTHTYPE_PERCENTAGE)
subRegion.Y = rect.Y + (yLength->get_valueInSpecifiedUnits() * rect.Height/100);
else
subRegion.Y = rect.Y + (yLength->get_value() * rect.Height);
}
//else
// subRegion.Y = filterRegion.Y;
if (pStdAttributes->get_widthAttr()->get_specified())
{
if (widthLength->get_unitType() == SVG_LENGTHTYPE_PERCENTAGE)
subRegion.Width = (widthLength->get_valueInSpecifiedUnits() * rect.Width/100);
else
subRegion.Width = (widthLength->get_value() * rect.Width);
}
//else
// subRegion.Width = filterRegion.Width;
if (pStdAttributes->get_heightAttr()->get_specified())
{
if (heightLength->get_unitType() == SVG_LENGTHTYPE_PERCENTAGE)
subRegion.Height = (heightLength->get_valueInSpecifiedUnits() * rect.Height/100);
else
subRegion.Height = (heightLength->get_value() * rect.Height);
}
//else
// subRegion.Height = filterRegion.Height;
}
else
{
gm::RectD rect = pReferencingElement->GetViewportElement()->GetViewBox();
if (pStdAttributes->get_xAttr()->get_specified())
{
if (xLength->get_unitType() == SVG_LENGTHTYPE_PERCENTAGE)
subRegion.X = rect.X + (xLength->get_valueInSpecifiedUnits() * rect.Width/100);
else
subRegion.X = xLength->get_value();
}
//else
// subRegion.X = filterRegion.X;
if (pStdAttributes->get_yAttr()->get_specified())
{
if (yLength->get_unitType() == SVG_LENGTHTYPE_PERCENTAGE)
subRegion.Y = rect.Y + (yLength->get_valueInSpecifiedUnits() * rect.Height/100);
else
subRegion.Y = yLength->get_value();
}
//else
// subRegion.Y = filterRegion.Y;
if (pStdAttributes->get_widthAttr()->get_specified())
{
if (widthLength->get_unitType() == SVG_LENGTHTYPE_PERCENTAGE)
subRegion.Width = (widthLength->get_valueInSpecifiedUnits() * rect.Width/100);
else
subRegion.Width = widthLength->get_value();
}
//else
// subRegion.Width = filterRegion.Width;
if (pStdAttributes->get_heightAttr()->get_specified())
{
if (heightLength->get_unitType() == SVG_LENGTHTYPE_PERCENTAGE)
subRegion.Height = (heightLength->get_valueInSpecifiedUnits() * rect.Height/100);
else
subRegion.Height = heightLength->get_value();
//.........这里部分代码省略.........