Package org.fonteditor.elements.points

Examples of org.fonteditor.elements.points.FEPoint


public class Slanter {
  public static void slant(FEGlyph glyph, DisplayOptions gdo) {
    int slant_factor = gdo.getSlant();
    if (slant_factor != 0) {
      FEPointList point_list = glyph.getFEPointList(gdo);
      FEPoint point;
     
      int len = point_list.getNumber();
      if (slant_factor > 0) {
        for (int index = len; --index >= 0;) {
          point = point_list.getPoint(index);
          point.setX(point.getX() + ((slant_factor * (0x10000 - point.getY())) >> 8));
        }
      } else if (slant_factor < 0) {
        for (int index = len; --index >= 0;) {
          point = point_list.getPoint(index);
          point.setX(point.getX() - ((slant_factor * point.getY()) >> 8));
        }
      }
    }
  }
View Full Code Here


    graphics_polygon = null;
  }

  private void drawConstructionPoints(Graphics g, FEPointList fepl, Coords c) {
    for (int i = 0; i < number_of_curves; i++) {
      FEPoint p1;
      FEPoint p2;
      FEPoint p3;
      FEPoint p4;
      Curve pe;

      pe = curve[i];
      p1 = pe.returnStartPoint();
      p2 = pe.returnStartControlPoint();
View Full Code Here

    }
  }

  private void drawConstructionLines(Graphics g, Coords c) {
    for (int i = 0; i < number_of_curves; i++) {
      FEPoint p1;
      FEPoint p2;
      FEPoint p3;
      FEPoint p4;
      Curve pe;

      pe = curve[i];
      p1 = pe.returnStartPoint();
      p2 = pe.returnStartControlPoint();
View Full Code Here

  public static void expand(FEGlyph glyph, DisplayOptions gdo) {
    int expand_factor = gdo.getExpand();
    if (expand_factor > 0) {
      FEPointList fepl_of_glyph = glyph.getFEPointList(gdo);
      for (int index = fepl_of_glyph.getNumber(); --index >= 0;) {
        FEPoint point = fepl_of_glyph.getPoint(index);
        point.setX((point.getX() * expand_factor) >> 10);
      }
    }
  }
View Full Code Here

    // boolean direction = p.getDirection();// set back to null at the bottom if you use this line...
    FEPointList fepl = p.getFEPointList();

    if (fepl.getNumber() > 1)
    {
      FEPoint current_point;
      FEPoint next_point;
      //      FEPoint[] array = fepl.getPoints();
      int increasing;

      increasing = (fepl.getPoint(fepl.getNumber() - 2).getX() < fepl
          .getPoint(fepl.getNumber() - 1).getX()) ? 1 : -1;
      current_point = fepl.getPoint(fepl.getNumber() - 1);
      for (int i = 0; i < fepl.getNumber(); i++)
      {
        int cpx = current_point.getX();

        next_point = fepl.getPoint(i);
        if (Utils.equalsApprox(current_point.getX(), next_point.getX(),
            TOLERANCE))
        {
          boolean dir = current_point.getY() > next_point.getY();

          slider_manager_vertical.add(new Slider(VERTICAL,
              Slider.PARALLEL, dir, Math.abs(next_point.getY()
                  - current_point.getY()), current_point));
        }
        else
        {
          if (increasing > 0)
          {
            if (cpx > next_point.getX())
            {
              slider_manager_vertical.add(new Slider(VERTICAL,
                  Slider.INFLECTION, true, Math
                      .abs(next_point.getY()
                          - current_point.getY()),
                  current_point));
            }
            // else {
            //  }
          }

          if (increasing < 0)
          {
            if (cpx < next_point.getX())
            {
              slider_manager_vertical.add(new Slider(VERTICAL,
                  Slider.INFLECTION, true, Math
                      .abs(next_point.getY()
                          - current_point.getY()),
                  current_point));
            }
            // else {
            //  }
          }

          if (cpx > next_point.getX())
          {
            increasing = -1;
          }

          if (cpx < next_point.getX())
          {
            increasing = 1;
          }
        }
        current_point = next_point;
      }

      increasing = (fepl.getPoint(fepl.getNumber() - 2).getY() < fepl
          .getPoint(fepl.getNumber() - 1).getY()) ? 1 : -1;
      current_point = fepl.getPoint(fepl.getNumber() - 1);

      for (int i = 0; i < fepl.getNumber(); i++)
      {
        int cpy = current_point.getY();

        next_point = fepl.getPoint(i);
        if (Utils.equalsApprox(current_point.getY(), next_point.getY(),
            TOLERANCE))
        {
          boolean dir = current_point.getX() > next_point.getX();

          slider_manager_horizontal.add(new Slider(HORIZONTAL,
              Slider.PARALLEL, dir, Math.abs(next_point.getX()
                  - current_point.getX()), current_point));
        }
        else
        {
          if (increasing > 0)
          {
            if (cpy > next_point.getY())
            {
              slider_manager_horizontal.add(new Slider(
                  HORIZONTAL, Slider.INFLECTION, true, Math
                      .abs(next_point.getX()
                          - current_point.getX()),
                  current_point));
            }
            // else {
            //  }
          }

          if (increasing < 0)
          {
            if (cpy < next_point.getY())
            {
              slider_manager_horizontal.add(new Slider(
                  HORIZONTAL, Slider.INFLECTION, true, Math
                      .abs(next_point.getX()
                          - current_point.getX()),
                  current_point));
            }
            // else {
            //  }
          }

          if (cpy > next_point.getY())
          {
            increasing = -1;
          }

          if (cpy < next_point.getY())
          {
            increasing = 1;
          }
        }
        current_point = next_point;
View Full Code Here

        boolean direction = slider.isHomewards();
        int type = slider.getType();
        boolean parallel = (type == Slider.PARALLEL);

        g.setColor(parallel ? Color.red : Color.blue);
        WideLine.renderRound(g, new FEPoint(0, slider.getPosition()),
            new FEPoint(0xFFFF, slider.getPosition()), 0x50, c);
        if (parallel)
        {
          if (direction)
          {
            WideLine.renderRound(g, new FEPoint(0x7FFF - HEAD_SIZE,
                slider.getPosition() - HEAD_SIZE), new FEPoint(
                0x7FFF, slider.getPosition()), 0x50, c);
            WideLine.renderRound(g, new FEPoint(0x7FFF - HEAD_SIZE,
                slider.getPosition() + HEAD_SIZE), new FEPoint(
                0x7FFF, slider.getPosition()), 0x50, c);
          }
          else
          {
            WideLine.renderRound(g,
                new FEPoint(HEAD_SIZE, slider.getPosition()
                    - HEAD_SIZE),
                new FEPoint(0, slider.getPosition()), 0x50, c);
            WideLine.renderRound(g,
                new FEPoint(HEAD_SIZE, slider.getPosition()
                    + HEAD_SIZE),
                new FEPoint(0, slider.getPosition()), 0x50, c);
          }
        }
      }
    }
  }
View Full Code Here

        boolean direction = slider.isHomewards();
        int type = slider.getType();
        boolean parallel = (type == Slider.PARALLEL);

        g.setColor(parallel ? Color.red : Color.blue);
        WideLine.renderRound(g, new FEPoint(slider.getPosition(), 0),
            new FEPoint(slider.getPosition(), 0xFFFF), 0x50, c);
        if (parallel)
        {
          if (direction)
          {
            WideLine.renderRound(g,
                new FEPoint(slider.getPosition() - HEAD_SIZE,
                    0xFFFF - HEAD_SIZE),
                new FEPoint(slider.getPosition(), 0xFFFF),
                0x50, c);
            WideLine.renderRound(g,
                new FEPoint(slider.getPosition() + HEAD_SIZE,
                    0xFFFF - HEAD_SIZE),
                new FEPoint(slider.getPosition(), 0xFFFF),
                0x50, c);
          }
          else
          {
            WideLine.renderRound(g,
                new FEPoint(slider.getPosition() - HEAD_SIZE,
                    HEAD_SIZE),
                new FEPoint(slider.getPosition(), 0), 0x50, c);
            WideLine.renderRound(g,
                new FEPoint(slider.getPosition() + HEAD_SIZE,
                    HEAD_SIZE),
                new FEPoint(slider.getPosition(), 0), 0x50, c);
          }
        }
      }
    }
  }
View Full Code Here

        FEPointList fepl_of_glyph = glyph.getFEPointList(gdo);
        index_current = getIndexOfNextMatchingPoint(fepl_of_glyph, index_current, old_pos, pvg);
        if (index_current >= 0) {
          FEPath path = glyph.getFEPathList(gdo).getPath(fepl_of_glyph.getPoint(index_current));
          FEPointList fepl = path.getFEPointList();
          FEPoint point = fepl_of_glyph.getPoint(index_current);
          int index_on_path = fepl.getIndexOf(point);
          if (index_on_path >= 0) {

            int min_index = getIndexOfNextSlider(fepl, index_on_path, s_m, -1, pvg);
            int max_index = getIndexOfNextSlider(fepl, index_on_path, s_m, 1, pvg);
View Full Code Here

    }
  }

  private void makeSpringFromThreeCurves(Curve curve1, Curve curve2, Curve curve3) {
    if ((curve1.isStraight()) && (curve2.isStraight()) && (curve3.isStraight())) {
      FEPoint p1 = curve3.returnStartPoint();
      FEPoint p2 = curve2.returnStartPoint();

      // check distance...
      if (p1.quickDistanceFrom(p2) <= SPRING_THRESHOLD) {
        // check h or v...
        if ((p1.getX() == p2.getX()) || (p1.getY() == p2.getY())) {
          add(p1, p2);
        }
      }
    }
  }
View Full Code Here

        if (idx_p1 != idx_p2) {
          idx_p2 = findNearestPoint(idx_p1, idx_p2);
          if (idx_p1 != idx_p2) {
            idx_p1 = findNearestPoint(idx_p2, idx_p1);
            if (idx_p1 != idx_p2) {
              FEPoint fep1 = fepointlist.getPoint(idx_p1);
              FEPoint fep2 = fepointlist.getPoint(idx_p2);

              if (fep1.squaredDistanceFrom(fep2) < SPRING_THRESHOLD_SQUARED) {
                // is it headed outwards from point 1?
                LocalPathAndIndex loc1 = findLocalPathAndIndex(fep1);
                FEPath path1 = loc1.getPath();
                int index1 = loc1.getIndex();
                FEPoint fep1_plus = path1.safelyGetPoint(index1 + 1);
                FEPoint fep1_minus = path1.safelyGetPoint(index1 - 1);
                if (isClockwise(fep1, fep2, fep1_plus, fep1_minus)) {
                  // is it headed outwards from point 2?
                  LocalPathAndIndex loc2 = findLocalPathAndIndex(fep2);
                  FEPath path2 = loc2.getPath();
                  int index2 = loc2.getIndex();
                  FEPoint fep2_plus = path2.safelyGetPoint(index2 + 1);
                  FEPoint fep2_minus = path2.safelyGetPoint(index2 - 1);
                  if (isClockwise(fep2, fep1, fep2_plus, fep2_minus)) {
                    add(fep1, fep2);
                  }
                }
              }
View Full Code Here

TOP

Related Classes of org.fonteditor.elements.points.FEPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.