本文整理汇总了C++中SVGLength::computeValue方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGLength::computeValue方法的具体用法?C++ SVGLength::computeValue怎么用?C++ SVGLength::computeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGLength
的用法示例。
在下文中一共展示了SVGLength::computeValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
if (unicode::get_float(rotate, &rot)) {
_doRotateAnim=rotate_angle;
}
}
if(_doRotateAnim!=rotate_no) {
std::vector<float> v;
v.push_back(rot);
v.push_back(0);
v.push_back(0);
_rotateToAnimate = new SVGRotateTransform(v);
MYGET_ANIMATED_VAL(transform).insertItemBefore(_rotateToAnimate, 1);
}
}
_doBezierAnim = true;
}
else {
const SVGLengthList& values = GET_SIMPLE_VAL(Values);
unsigned int valuesSize = values.numberOfItems();
if(valuesSize) {
if(valuesSize % 2) {
std::cerr << "'values' for 'animateMotion' must be a list of pair of length" << __FL__;
return;
}
if(keytimes.numberOfItems()) {
if(keytimes.numberOfItems()!=values.numberOfItems()) {
std::cerr << "'keyTimes' and 'values' have different size" << __FL__;
return;
}
for(unsigned int i=0;
i<values.numberOfItems();
++++i) {
SVGLength l = values.getItem(i);
float v1 = l.computeValue();
l = values.getItem(i+1);
float v2 = l.computeValue();
//_keyFrames.push_back(KeyFrame(KeyFrame::ValueType<float,float>(v1,v2), keytimes.getItem(i).getValue().getValue()));
_keyFrames.push_back(KeyFrame(KeyFrame::ValueType(v1,v2), keytimes.getItem(i).GET_SIMPLE_VAL(Value)));
}
}
else {
unsigned int num = values.numberOfItems();
float t=0;
float dt=1./((num>>1)-1);
for(unsigned int i=0;
i<num;
++++i) {
SVGLength l = values.getItem(i);
float v1 = l.computeValue();
l = values.getItem(i+1);
float v2 = l.computeValue();
_keyFrames.push_back(KeyFrame(KeyFrame::ValueType(v1,v2), t));
t+=dt;
}
}
}
else {
unicode::String* fromstr = GET_SIMPLE_VAL(From);
unicode::String* tostr = GET_SIMPLE_VAL(To);
unicode::String* bystr = GET_SIMPLE_VAL(By);
//std::cerr << DBGVAR(attrName) << DBGVAR(attrType) << DBGVAR(fromstr) << DBGVAR(tostr) << __FL__;
SVGList<SVGLength> from, to, by;
bool fromb=false, tob=false, byb=false;
示例2: switch
void
SVGAnimateElement::animationTraverse(svgl::AnimationInfo* animinfo)
{
unicode::String* attrName = GET_SIMPLE_VAL(AttributeName);
SVG_ANIMATION_ATTRIBUTE_TYPE attrType = GET_SIMPLE_VAL(AttributeType);
_elementToAnimate = animinfo->element;
_attributeToAnimate=0;
switch (attrType) {
case SVG_ANIMATION_ATTRIBUTE_TYPE_CSS:
std::cerr << "CSS animation not supported" << __FL__;
return;
break;
default:
attributeType.setValue(SVG_ANIMATION_ATTRIBUTE_TYPE_AUTO);
case SVG_ANIMATION_ATTRIBUTE_TYPE_AUTO:
case SVG_ANIMATION_ATTRIBUTE_TYPE_XML:
{
_attributeToAnimate = _elementToAnimate->getAttributeByName(attrName);
}
break;
#if 0
default:
std::cerr << "SVG_ANIMATION_ATTRIBUTE is set to UNKNOWN" << __FL__;
break;
#endif
}
if(_attributeToAnimate==0) {
if(css::CSSStyleDeclaration::isStyleAttribute(attrName)) {
std::cerr << "attribute '" << attrName << "' for element '" << _elementToAnimate->getDtdElement() << "' is a style attribute and is not yet supported yet '<animate>'" << __FL__;
}
else {
std::cerr << "attribute '" << attrName << "' does not exist for element " << _elementToAnimate->getDtdElement() << __FL__;
}
return;
}
if(!_attributeToAnimate->canBeSetAsDouble()) {
_attributeToAnimate=0;
std::cerr << "attribute '" << attrName << "' in element '" << _elementToAnimate->getDtdElement() << "' can not be set as double" << __FL__;
return;
}
const SVGLengthList& values = GET_SIMPLE_VAL(Values);
#if 0
std::cerr << "-- values" << __FL__;
for(unsigned int t=0; t<values.size(); ++t)
std::cerr << values[t] << " ";
std::cerr << std::endl;
#endif
if(values.numberOfItems()) {
const SVGNumberList& keytimes = GET_SIMPLE_VAL(KeyTimes);
#if 0
std::cerr << "** keytimes " << __FL__;
#endif
if(keytimes.numberOfItems()) {
if(keytimes.numberOfItems()!=values.numberOfItems()) {
std::cerr << "'keyTimes' and 'values' have different size" << __FL__;
return;
}
for(std::vector<float>::size_type i=0;
i<values.numberOfItems();
++i) {
SVGLength l = values.getItem(i);
float v = l.computeValue();
_keyFrames.push_back(KeyFrame(v, keytimes.getItem(i).GET_SIMPLE_VAL(Value)));
// std::cerr << values[i] << " " << keytimes[i];
}
// std::cerr << std::endl;
}
else {
for(std::vector<float>::size_type i=0;
i<values.numberOfItems();
++i) {
float t=i/((float)values.numberOfItems()-1);
SVGLength l = values.getItem(i);
float v = l.computeValue();
_keyFrames.push_back(KeyFrame(v, t));
}
}
}
else {
unicode::String* fromstr = GET_SIMPLE_VAL(From);
unicode::String* tostr = GET_SIMPLE_VAL(To);
unicode::String* bystr = GET_SIMPLE_VAL(By);
//std::cerr << DBGVAR(attrName) << DBGVAR(attrType) << DBGVAR(fromstr) << DBGVAR(tostr) << __FL__;
SVGLength froml, tol, byl;
bool fromb=false, tob=false, byb=false;
froml.dom_setValueAsString(fromstr);
tol.dom_setValueAsString(tostr);
byl.dom_setValueAsString(bystr);
//.........这里部分代码省略.........