Package java.awt

Examples of java.awt.BasicStroke$DashIterator$Line


     *
     * @param scale scale to compare to the base scale.
     */
    public Stroke getStrokeForScale(float scale) {
        if (baseScale != NONE && stroke instanceof BasicStroke) {
            BasicStroke bs = (BasicStroke) stroke;
            float lineWidth = bs.getLineWidth();
            float[] dash = bs.getDashArray();
            float scaleFactor = scale / baseScale;
            int endCaps = bs.getEndCap();
            int lineJoins = bs.getLineJoin();
            float miterLimit = bs.getMiterLimit();

            lineWidth *= scaleFactor;
            for (int i = 0; i < dash.length; i++) {
                dash[i] *= scaleFactor;
            }

            return new BasicStroke(lineWidth, endCaps, lineJoins, miterLimit, dash, bs.getDashPhase());
        }
        return stroke;
    }
View Full Code Here


                } else {
                    dashPhase = defaultDashPhase;
                }
            }

            setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, lineDash, dashPhase));

        } else if (basicStrokeDefined) {
            setStroke(new BasicStroke(lineWidth));
        }

        // OK, Fill pattern next...
        fPattern = props.getProperty(realPrefix + fillPatternProperty);
        if (fPattern != null && !fPattern.equals("")) {
View Full Code Here

                : fPattern));

        Stroke bs = getStroke();

        if (bs == null) {
            bs = new BasicStroke();
        }

        if (bs instanceof BasicStroke) {
            props.put(prefix + lineWidthProperty,
                    Float.toString(((BasicStroke) bs).getLineWidth()));
View Full Code Here

    public void render(Graphics2D g, Shape shape,
                       boolean replaceColorWithGradient) {

        if (matted) {
            if (stroke instanceof BasicStroke) {
                g.setStroke(new BasicStroke(((BasicStroke) stroke).getLineWidth() + 2f));
                g.setPaint(mattingPaint);
                g.draw(shape);
            }
        }
View Full Code Here

        Paint paint = getMattingPaint();

        DrawingAttributes da = new DrawingAttributes();
        da.setLinePaint(paint);
        da.setStroke(new BasicStroke(3));

        DrawingAttributes innerda = new DrawingAttributes();
        innerda.setLinePaint(Color.white);
        innerda.setStroke(new BasicStroke(1));

        OpenMapAppPartCollection collection = OpenMapAppPartCollection.getInstance();
        IconPartList parts = new IconPartList();

        if (paint instanceof Color) {
            Color color = (Color) paint;
            Paint opaqueColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), 255);
            DrawingAttributes opaqueDA = new DrawingAttributes();
            opaqueDA.setLinePaint(opaqueColor);
            opaqueDA.setStroke(new BasicStroke(3));

            parts.add(collection.get("LR_TRI", opaqueDA));
            parts.add(collection.get("UL_TRI", da));
            parts.add(collection.get("LR_TRI", innerda));
            parts.add(collection.get("UL_TRI", innerda));
View Full Code Here

        if (paint == null)
            paint = Color.black;

        DrawingAttributes da = new DrawingAttributes();
        da.setLinePaint(paint);
        da.setStroke(new BasicStroke(2));
        if (fill) {
            da.setFillPaint(paint);
        }

        OpenMapAppPartCollection collection = OpenMapAppPartCollection.getInstance();
        IconPartList parts = new IconPartList();

        if (paint instanceof Color || paint == OMColor.clear) {
            Color color = (Color) paint;
            Color opaqueColor = new Color(color.getRed(), color.getGreen(), color.getBlue());
            DrawingAttributes opaqueDA = new DrawingAttributes();
            opaqueDA.setLinePaint(opaqueColor);
            opaqueDA.setStroke(new BasicStroke(2));

            if (fill) {
                opaqueDA.setFillPaint(opaqueColor);
            }
View Full Code Here

     *         paint.
     */
    public static ImageIcon getMattedIcon(Paint mattingPaint, Paint linePaint) {
        DrawingAttributes da = new DrawingAttributes();
        da.setMattingPaint(mattingPaint);
        da.setStroke(new BasicStroke(2));

        DrawingAttributes fillda = new DrawingAttributes();
        fillda.setLinePaint(linePaint);
        fillda.setFillPaint(linePaint);
        da.setStroke(new BasicStroke(2));

        OpenMapAppPartCollection collection = OpenMapAppPartCollection.getInstance();

        IconPartList parts = new IconPartList();
        parts.add(collection.get("FILL_BOX", fillda));
View Full Code Here

            g.setPaint(attributes.fillPaint);
            g.fillRect(0, 0, width, height);
        }

        if (attributes.matted) {
            BasicStroke mattedStroke = new BasicStroke(((BasicStroke) attributes.stroke).getLineWidth() + 2f);
            g.setStroke(mattedStroke);
            g.setPaint(attributes.mattingPaint);
            g.drawLine(0, height / 2, width, height / 2);
        }
View Full Code Here

  public void setStroke(Stroke s) {
      originalStroke = s;
      this.stroke = transformStroke(s);
     
      if (stroke instanceof BasicStroke) {
        BasicStroke bs = (BasicStroke) stroke;
        setLineCap(bs.getEndCap());
        setLineJoin(bs.getLineJoin());
        setLineWidth(bs.getLineWidth());
        setMiterLimit(bs.getMiterLimit());
        // TODO: Line dash pattern
      }
  }
View Full Code Here

  }

  private Stroke transformStroke(Stroke stroke) {
      if (!(stroke instanceof BasicStroke))
          return stroke;
      BasicStroke st = (BasicStroke)stroke;
      float scale = (float)Math.sqrt(Math.abs(transform.getDeterminant()));
      float dash[] = st.getDashArray();
      if (dash != null) {
          for (int k = 0; k < dash.length; ++k)
              dash[k] *= scale;
      }
      return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
  }
View Full Code Here

TOP

Related Classes of java.awt.BasicStroke$DashIterator$Line

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.