コード例 #1
0
std::unique_ptr<InterpolableValue> consumeCurvetoCubicSmooth(
    const PathSegmentData& segment,
    PathCoordinates& coordinates) {
  bool isAbsolute = isAbsolutePathSegType(segment.command);
  std::unique_ptr<InterpolableList> result = InterpolableList::create(4);
  result->set(
      0, consumeControlAxis(segment.x2(), isAbsolute, coordinates.currentX));
  result->set(
      1, consumeControlAxis(segment.y2(), isAbsolute, coordinates.currentY));
  result->set(
      2, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX));
  result->set(
      3, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY));
  return std::move(result);
}
コード例 #2
0
std::unique_ptr<InterpolableValue> consumeArc(const PathSegmentData& segment,
                                              PathCoordinates& coordinates) {
  bool isAbsolute = isAbsolutePathSegType(segment.command);
  std::unique_ptr<InterpolableList> result = InterpolableList::create(7);
  result->set(
      0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX));
  result->set(
      1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY));
  result->set(2, InterpolableNumber::create(segment.r1()));
  result->set(3, InterpolableNumber::create(segment.r2()));
  result->set(4, InterpolableNumber::create(segment.arcAngle()));
  result->set(5, InterpolableBool::create(segment.largeArcFlag()));
  result->set(6, InterpolableBool::create(segment.sweepFlag()));
  return std::move(result);
}
コード例 #3
0
std::unique_ptr<InterpolableValue> consumeSingleCoordinate(
    const PathSegmentData& segment,
    PathCoordinates& coordinates) {
  bool isAbsolute = isAbsolutePathSegType(segment.command);
  std::unique_ptr<InterpolableList> result = InterpolableList::create(2);
  result->set(
      0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX));
  result->set(
      1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY));

  if (toAbsolutePathSegType(segment.command) == PathSegMoveToAbs) {
    // Any upcoming 'closepath' commands bring us back to the location we have
    // just moved to.
    coordinates.initialX = coordinates.currentX;
    coordinates.initialY = coordinates.currentY;
  }

  return std::move(result);
}
コード例 #4
0
std::unique_ptr<InterpolableValue> consumeLinetoVertical(
    const PathSegmentData& segment,
    PathCoordinates& coordinates) {
  bool isAbsolute = isAbsolutePathSegType(segment.command);
  return consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY);
}