Examples of LinearGradientPaint


Examples of org.apache.batik.ext.awt.LinearGradientPaint

  // as a single color using the color and opacity of the last gradient
  // stop.
        if (p1.getX() == p2.getX() && p1.getY() == p2.getY()) {
            return colors[colors.length-1];
  } else {
      return new LinearGradientPaint(p1,
             p2,
             offsets,
             colors,
             spreadMethod,
             colorSpace,
View Full Code Here

Examples of org.apache.batik.ext.awt.LinearGradientPaint

    solid_icons_map_.put("fill_color", new SolidColoredIcon(Color.BLACK, 20, 20, 2, 2));
    solid_icons_map_.put("text_color", new SolidColoredIcon(Color.BLACK, 20, 20, 2, 2));

    gradient_icons_map_.put(
      "fill_gradient",
      new GradientIcon(new LinearGradientPaint(
    JGradientChooser.START_,
    JGradientChooser.CENTER_,
    JGradientChooser.fractions_,
    JGradientChooser.colors,
    MultipleGradientPaint.NO_CYCLE,
View Full Code Here

Examples of org.apache.batik.ext.awt.LinearGradientPaint

    if (type_.getSelectedIndex() == 0)
    {
      if (repeat_.getSelectedIndex() == 0)
      {
        gradient_ =
          new LinearGradientPaint(
            JGradientChooser.START_,
            JGradientChooser.CENTER_,
            JGradientChooser.fractions_,
            colors,
            MultipleGradientPaint.NO_CYCLE,
            MultipleGradientPaint.SRGB);
      }
      else
        if (repeat_.getSelectedIndex() == 1)
        {
          gradient_ =
            new LinearGradientPaint(
              JGradientChooser.START_,
              JGradientChooser.CENTER_,
              JGradientChooser.fractions_,
              colors,
              MultipleGradientPaint.REFLECT,
              MultipleGradientPaint.SRGB);
        }
        else
        {
          gradient_ =
            new LinearGradientPaint(
              JGradientChooser.START_,
              JGradientChooser.CENTER_,
              JGradientChooser.fractions_,
              colors,
              MultipleGradientPaint.REPEAT,
View Full Code Here

Examples of org.apache.batik.ext.awt.LinearGradientPaint

   */
  public void paintIcon(Component comp, Graphics g, int x, int y)
  {
    if (gradient_ instanceof LinearGradientPaint)
    {
      LinearGradientPaint tmp_gradient = (LinearGradientPaint) gradient_;

      Point2D.Float start =  new Point2D.Float(start_.x+x,start_.y+y);
      Point2D.Float end =  new Point2D.Float(center_.x+x,center_.y+y);

      transformed_gradient_ =
        new LinearGradientPaint(start, end, tmp_gradient.getFractions(), tmp_gradient.getColors(), tmp_gradient.getCycleMethod(), MultipleGradientPaint.SRGB);
    }
    else
    {
      RadialGradientPaint tmp_gradient = (RadialGradientPaint) gradient_;

      Point2D.Float center =  new Point2D.Float(center_.x+x,center_.y+y);
        Point2D.Float end =  new Point2D.Float(end_.x+x,end_.y+y);

      transformed_gradient_ =
        new RadialGradientPaint(
          center,
          (float) center.distance(end) / 2,
          center,
          tmp_gradient.getFractions(),
          tmp_gradient.getColors(),
          tmp_gradient.getCycleMethod(),
          MultipleGradientPaint.SRGB);
    }

    Graphics2D g2 = (Graphics2D) g;
    Color c = g.getColor();
View Full Code Here

Examples of org.apache.batik.ext.awt.LinearGradientPaint

  {
    String rv = "";

    if (gradient instanceof LinearGradientPaint)
    {
      LinearGradientPaint tmp_gradient = (LinearGradientPaint) gradient;
      rv = "<linearGradient id=\"" + name + "\" gradientUnits = \"userSpaceOnUse\"";
      rv += " x1=\"" + tmp_gradient.getStartPoint().getX() + "\"";
      rv += " y1=\"" + tmp_gradient.getStartPoint().getY() + "\"";
      rv += " x2=\"" + tmp_gradient.getEndPoint().getX() + "\"";
      rv += " y2=\"" + tmp_gradient.getEndPoint().getY() + "\"";
      rv += " spreadMethod=\"" + translateCycleMethodToSVG(tmp_gradient.getCycleMethod()) + "\">";
      rv += "<stop offset=\"0\" " + toSVGGradientColor(tmp_gradient.getColors()[0]) + "/>";
      rv += "<stop offset=\"1\" " + toSVGGradientColor(tmp_gradient.getColors()[1]) + "/>";
      rv += "</linearGradient>";
    }
    else
    {
      RadialGradientPaint tmp_gradient = (RadialGradientPaint) gradient;
      rv = "<radialGradient id=\"" + name + "\" gradientUnits = \"userSpaceOnUse\"";
      rv += " cx=\"" + tmp_gradient.getCenterPoint().getX() + "\"";
      rv += " cy=\"" + tmp_gradient.getCenterPoint().getY() + "\"";
      rv += " r=\"" + tmp_gradient.getRadius() + "\"";
      rv += " fx=\"" + tmp_gradient.getFocusPoint().getX() + "\"";
      rv += " fy=\"" + tmp_gradient.getFocusPoint().getY() + "\"";
      rv += " spreadMethod=\"" + translateCycleMethodToSVG(tmp_gradient.getCycleMethod()) + "\">";
      rv += "<stop offset=\"0\" " + toSVGGradientColor(tmp_gradient.getColors()[0]) + "/>";
      rv += "<stop offset=\"1\" " + toSVGGradientColor(tmp_gradient.getColors()[1]) + "/>";
      rv += "</radialGradient>";
    }

    return rv;
  }
View Full Code Here

Examples of org.apache.batik.ext.awt.LinearGradientPaint

  {
    if (gradient_ != null)
    {
      if (gradient_ instanceof LinearGradientPaint)
      {
        LinearGradientPaint tmp_gradient = (LinearGradientPaint) gradient_;
        Point2D.Double start = new Point2D.Double(tmp_gradient.getStartPoint().getX() + x, tmp_gradient.getStartPoint().getY() + y);
        Point2D.Double end = new Point2D.Double(tmp_gradient.getEndPoint().getX() + x, tmp_gradient.getEndPoint().getY() + y);
        gradient_ = new LinearGradientPaint(start, end, tmp_gradient.getFractions(), tmp_gradient.getColors(), tmp_gradient.getCycleMethod(), tmp_gradient.getColorSpace());
      }
      else
      {
        RadialGradientPaint tmp_gradient = (RadialGradientPaint) gradient_;
        Point2D.Double center = new Point2D.Double(tmp_gradient.getCenterPoint().getX() + x, tmp_gradient.getCenterPoint().getY() + y);
        gradient_ =
          new RadialGradientPaint(
            center,
            tmp_gradient.getRadius(),
            center,
            tmp_gradient.getFractions(),
            tmp_gradient.getColors(),
            tmp_gradient.getCycleMethod(),
            tmp_gradient.getColorSpace());
      }
    }
  }
View Full Code Here

Examples of org.apache.batik.ext.awt.LinearGradientPaint

    if (xml_gradient.getNodeName().equals("linearGradient"))
    {
      Point2D.Double start = new Point2D.Double(Double.parseDouble(xml_gradient.getAttribute("x1")), Double.parseDouble(xml_gradient.getAttribute("y1")));
      Point2D.Double end = new Point2D.Double(Double.parseDouble(xml_gradient.getAttribute("x2")), Double.parseDouble(xml_gradient.getAttribute("y2")));
      awt_gradient =
        new LinearGradientPaint(
          start,
          end,
          JGradientChooser.fractions_,
          translateSVGGradientColorsToAWT(xml_gradient),
          translateSVGSpreadToCycleMethod(xml_gradient),
View Full Code Here

Examples of org.apache.batik.ext.awt.LinearGradientPaint

      double y = ((event.getY() - offset_y_) / scale_);

      if (gradient_ instanceof LinearGradientPaint)
      {
        gradient =
          new LinearGradientPaint(
            gradient_start_,
            new Point2D.Double(x, y),
            gradient_.getFractions(),
            gradient_.getColors(),
            gradient_.getCycleMethod(),
View Full Code Here

Examples of org.apache.batik.ext.awt.LinearGradientPaint

  // as a single color using the color and opacity of the last gradient
  // stop.
        if (p1.getX() == p2.getX() && p1.getY() == p2.getY()) {
            return colors[colors.length-1];
  } else {
      return new LinearGradientPaint(p1,
             p2,
             offsets,
             colors,
             spreadMethod,
             colorSpace,
View Full Code Here

Examples of org.apache.batik.ext.awt.LinearGradientPaint

  // as a single color using the color and opacity of the last gradient
  // stop.
        if (p1.getX() == p2.getX() && p1.getY() == p2.getY()) {
            return colors[colors.length-1];
  } else {
      return new LinearGradientPaint(p1,
             p2,
             offsets,
             colors,
             spreadMethod,
             colorSpace,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.