Scale all points by a percentage (good for evenly lengthening or shortening an openshot::Keyframe) 1.0 = same size, 1.05 = 5% increase, etc...
| 514 | // Scale all points by a percentage (good for evenly lengthening or shortening an openshot::Keyframe) |
| 515 | // 1.0 = same size, 1.05 = 5% increase, etc... |
| 516 | void Keyframe::ScalePoints(double scale) |
| 517 | { |
| 518 | // TODO: What if scale is small so that two points land on the |
| 519 | // same X coordinate? |
| 520 | // TODO: What if scale < 0? |
| 521 | |
| 522 | // Loop through each point (skipping the 1st point) |
| 523 | for (std::vector<Point>::size_type point_index = 1; point_index < Points.size(); point_index++) { |
| 524 | // Scale X value |
| 525 | Points[point_index].co.X = round(Points[point_index].co.X * scale); |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | // Flip all the points in this openshot::Keyframe (useful for reversing an effect or transition, etc...) |
| 530 | void Keyframe::FlipPoints() { |