Java 8 Stroke - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Stroke class.

This code example shows how to use the following methods:createStrokedShape
    @Override 
    public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
        Shape ts;
        if (onStroke) {
            ts = this.transform.createTransformedShape(
                    this.stroke.createStrokedShape(s));
        } else { 
            ts = this.transform.createTransformedShape(s);
        } 
        if (!rect.getBounds2D().intersects(ts.getBounds2D())) {
            return false; 
        } 
        Area a1 = new Area(rect);
        Area a2 = new Area(ts);
        a1.intersect(a2);
        return !a1.isEmpty();
    } 
 
    /** 
     * Not implemented - the method does nothing. 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createStrokedShape
        this.stroke2 = stroke2;
        this.operation = operation;
    } 
 
    public Shape createStrokedShape( Shape shape ) {
        Area area1 = new Area( stroke1.createStrokedShape( shape ) );
        Area area2 = new Area( stroke2.createStrokedShape( shape ) );
        switch ( operation ) {
        case ADD:
            area1.add( area2 );
            break; 
        case SUBSTRACT:
            area1.subtract( area2 );
            break; 
        case INTERSECT:
            area1.intersect( area2 );
            break; 
        case DIFFERENCE:
            area1.exclusiveOr( area2 );
            break; 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createStrokedShape
        return; 
      } 
    } 
 
    // can fall through for various reasons 
    fill(stroke.createStrokedShape(shape));
  } 
 
  @Override 
  protected void fill(Shape shape, boolean forceSimple) {
    if (forceSimple) {
      traceShape(shape, simpleFillVisitor);
    } else { 
      traceShape(shape, complexFillVisitor);
    } 
  } 
} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createStrokedShape
    @Override 
    public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
        Shape ts;
        if (onStroke) {
            ts = this.transform.createTransformedShape(
                    this.stroke.createStrokedShape(s));
        } else { 
            ts = this.transform.createTransformedShape(s);
        } 
        if (!rect.getBounds2D().intersects(ts.getBounds2D())) {
            return false; 
        } 
        Area a1 = new Area(rect);
        Area a2 = new Area(ts);
        a1.intersect(a2);
        return !a1.isEmpty();
    } 
 
    /** 
     * Not implemented - the method does nothing. 
1
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createStrokedShape
        this.stroke1 = stroke1;
        this.stroke2 = stroke2;
    } 
 
    public Shape createStrokedShape( Shape shape ) {
        return stroke2.createStrokedShape( stroke1.createStrokedShape( shape ) );
    } 
} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createStrokedShape
			return; 
		} 
		if (stroke == null) {
			stroke = graphics.getStroke();
		} 
		shape = stroke.createStrokedShape(shape);
		fillPaintedShape(graphics, shape, paint, paintBounds);
	} 
 
	/** 
	 * Converts color components from the sRGB to the CIE XYZ color space. 
	 * A D50 white point is assumed for the sRGB conversion. If the <i>xyz</i> 
	 * array is {@code null}, a new one will be created with the same 
	 * size as the <i>rgb</i> array. 
	 * 
	 * See http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html 
	 * 
	 * @param rgb Color components in the sRGB color space. 
	 * @param xyz Optional array to store color components in the CIE XYZ color space. 
	 * @return Color components in the CIE XYZ color space. 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createStrokedShape
    Stroke stroke = getStroke();
    if (stroke instanceof BasicStroke) {
      lineVisitor.setStroke((BasicStroke) stroke);
      traceShape(shape, lineVisitor);
    } else { 
      fill(stroke.createStrokedShape(shape), false);
    } 
  } 
 
  @Override 
  protected void fill(Shape shape, boolean isDefinitelySimpleConvex) {
    if (isDefinitelySimpleConvex) {
      traceShape(shape, simpleFillVisitor);
    } else { 
      traceShape(shape, complexFillVisitor);
    } 
  } 
} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createStrokedShape
        } else { 
	    // For some reason (antialiasing?) the bounds returned by  
	    // BasicStroke is off by one.  This code works around it. 
            // We've had reports that this is no longer 
            // necessary with JDK1.3. 
	    Rectangle2D rect = stroke.createStrokedShape(shape).getBounds2D();
            return new Rectangle2D.Double(rect.getX() - 1, 
                    rect.getY() - 1,
                    rect.getWidth() + 2,
                    rect.getHeight() + 2);
	} 
    } 
 
    /** Get a stroke of the given width and with no dashing. 
     * This method will generally return an existing stroke 
     * object, and can be used to save creating zillions of 
     * Stroke objects. 
     */ 
    public static BasicStroke getStroke (int width) {
        if (width < _intStrokes.length) {
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createStrokedShape
    /** Get the site that marks the "tail" of the connector. 
     */ 
    public Site getTailSite () { 
        return _tailSite;
    } 
 
    /** Inform the connector that the head site has moved. 
     * This default implementation simply calls reroute(). 
     */ 
    public void headMoved (double dx, double dy) {
        repaint(); 
        reroute(); 
        repaint(); 
    } 
 
    /** Test if this connector is hit by the given rectangle. 
     * If the connector is not visible, always return false, otherwise 
     * check to see if the rectangle intersects the path of the connector,  
     * either of its ends, or the label. 
     */ 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createStrokedShape
    /**  
     * Get the bounds of this figure. 
     */ 
    public Rectangle2D getBounds () 
    { 
        return widthStroke.createStrokedShape( shape ).getBounds2D();
    } 
     
    /**  
     * Get the shape of this figure. 
     */ 
    public Shape getShape () 
    { 
        return shape;
    } 
     
    /** 
     * Paint this figure onto the given graphics context.  
     */ 
    public void paint (Graphics2D g) 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 Stroke Methods: