Create a filled path of the specified Java 2D Shape and color.

@param shape Java 2D shape
@param color the color to fill the shape with
@return a new general path
326062
public static GeneralPath shapeOf(Shape shape, Color color) {
        List<PathElement> elements = new ArrayList<PathElement>();
        PathIterator pathIt = shape.getPathIterator(new AffineTransform());
        double[] data = new double[6];
        while (!pathIt.isDone()) {
            switch (pathIt.currentSegment(data)) {
                case PathIterator.SEG_MOVETO:
                    elements.add(new MoveTo(data));
                    break;
                case PathIterator.SEG_LINETO:
                    elements.add(new LineTo(data));
                    break;
                case PathIterator.SEG_CLOSE:
                    elements.add(new Close());
                    break;
                case PathIterator.SEG_QUADTO:
                    elements.add(new QuadTo(data));
                    break;
                case PathIterator.SEG_CUBICTO:
                    elements.add(new CubicTo(data));
                    break;
            }
            pathIt.next();
        }
        return new GeneralPath(elements, color, pathIt.getWindingRule(), 0d, true);
    }
123593
@SuppressWarnings("unchecked")
    static <T> Node<T> emptyNode(StreamShape shape) {
        switch (shape) {
            case REFERENCE:    return (Node<T>) EMPTY_NODE;
            case INT_VALUE:    return (Node<T>) EMPTY_INT_NODE;
            case LONG_VALUE:   return (Node<T>) EMPTY_LONG_NODE;
            case DOUBLE_VALUE: return (Node<T>) EMPTY_DOUBLE_NODE;
            default:
                throw new IllegalStateException("Unknown shape " + shape);
        }
    }
790829
def add_path(self, w, h):
        """"""
        custGeom = self.spPr.custGeom
        if custGeom is None:
            raise ValueError('shape must be freeform')
        pathLst = custGeom.get_or_add_pathLst()
        return pathLst.add_path(w=w, h=h)
1094301
public void addShape(Shape shape) {
		if (shape.points.length != points.length) {
			throw new RuntimeException("Attempt to morph between two shapes with different vertex counts");
		}
		
		Shape prev = (Shape) shapes.get(shapes.size()-1);
		if (equalShapes(prev, shape)) {
			shapes.add(prev);
		} else {
			shapes.add(shape);
		}
		
		if (shapes.size() == 2) {
			next = (Shape) shapes.get(1);
		}
	}
531460
public static final void fill(final Shape shape, final ShapeFill fill) {
        if (!validFill(shape)) {
    		return;
    	}
        
        Texture t = TextureImpl.getLastBind();
        TextureImpl.bindNone();

        final float center[] = shape.getCenter();
        fill(shape, new PointCallback() {
			public float[] preRenderPoint(Shape shape, float x, float y) {
	            fill.colorAt(shape, x, y).bind();
	            Vector2f offset = fill.getOffsetAt(shape, x, y);
	            
	            return new float[] {offset.x + x,offset.y + y};
			}
    	});
        
        if (t == null) {
        	TextureImpl.bindNone();
        } else {
        	t.bind();
        }
    }
284683
public java.awt.Image createAwtImage(Color foreground, Color background) {
        if (image == null)
            return null;
        int f = foreground.getRGB();
        int g = background.getRGB();
        Canvas canvas = new Canvas();

        int w = width + 2 * ws;
        int h = height + 2 * ws;
        int pix[] = new int[w * h];
        int stride = (w + 7) / 8;
        int ptr = 0;
        for (int k = 0; k < h; ++k) {
            int p = k * stride;
            for (int j = 0; j < w; ++j) {
                int b = image[p + (j / 8)] & 0xff;
                b <<= j % 8;
                pix[ptr++] = (b & 0x80) == 0 ? g : f;
            }
        }
        java.awt.Image img = canvas.createImage(new MemoryImageSource(w, h, pix, 0, w));
        return img;
    }
18759
function (path) {
		var attr = {
			// subpixel precision down to 0.1 (width and height = 1px)
			coordsize: '10 10'
		};
		if (isArray(path)) {
			attr.d = path;
		} else if (isObject(path)) { // attributes
			extend(attr, path);
		}
		// create the shape
		return this.createElement('shape').attr(attr);
	}
1134792
public JFreeChartRender setGridPaint(Color color) {
        getPlot().setRangeGridlinePaint(color);
        getPlot().setDomainGridlinePaint(color);
        return this;
    }
484720
public static java.awt.Color convertColor(cz.vutbr.web.csskit.Color src)
    {
        return new java.awt.Color(src.getRGB(), true);
    }
571834
public void setColor(@ColorInt int color) {
    this.color = color;
    if (!style.isFullyLoaded()) {
      // We are in progress of loading a new style
      return;
    }

    fillExtrusionLayer.setProperties(fillExtrusionColor(color));
  }
635037
private static Shape createShape(SHAPE_TYPE shapeType,
                                     GraphicInfo graphicInfo) {
        if (SHAPE_TYPE.Rectangle.equals(shapeType)) {
            // source is rectangle
            return new Rectangle2D.Double(graphicInfo.getX(),
                                          graphicInfo.getY(),
                                          graphicInfo.getWidth(),
                                          graphicInfo.getHeight());
        } else if (SHAPE_TYPE.Rhombus.equals(shapeType)) {
            // source is rhombus
            Path2D.Double rhombus = new Path2D.Double();
            rhombus.moveTo(graphicInfo.getX(),
                           graphicInfo.getY() + graphicInfo.getHeight() / 2);
            rhombus.lineTo(graphicInfo.getX() + graphicInfo.getWidth() / 2,
                           graphicInfo.getY() + graphicInfo.getHeight());
            rhombus.lineTo(graphicInfo.getX() + graphicInfo.getWidth(),
                           graphicInfo.getY() + graphicInfo.getHeight() / 2);
            rhombus.lineTo(graphicInfo.getX() + graphicInfo.getWidth() / 2,
                           graphicInfo.getY());
            rhombus.lineTo(graphicInfo.getX(),
                           graphicInfo.getY() + graphicInfo.getHeight() / 2);
            rhombus.closePath();
            return rhombus;
        } else if (SHAPE_TYPE.Ellipse.equals(shapeType)) {
            // source is ellipse
            return new Ellipse2D.Double(graphicInfo.getX(),
                                        graphicInfo.getY(),
                                        graphicInfo.getWidth(),
                                        graphicInfo.getHeight());
        }
        // unknown source element, just do not correct coordinates
        return null;
    }
1118125
function (color, point) {
            var ctx = this._canvas.getContext('2d');

            ctx.beginPath();
            ctx.fillStyle = color;
            ctx.strokeStyle = color;
            ctx.lineWidth = 0.5;

            ctx.arc(point.x, point.y, 5, 0, 2 * Math.PI, false);
            ctx.fill();

            ctx.beginPath();
            ctx.moveTo(point.x - 50, point.y);
            ctx.lineTo(point.x + 50, point.y);
            ctx.stroke();

            ctx.beginPath();
            ctx.moveTo(point.x, point.y - 50);
            ctx.lineTo(point.x, point.y + 50);
            ctx.stroke();
        }
963747
protected GradientDrawable createGradientDrawable(int color) {
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setShape(GradientDrawable.RECTANGLE);
        gradientDrawable.setColor(color);
        return gradientDrawable;
    }
463075
private static void applyShapeStyle(Element element, ShapeStyle style) {
		// First check the presence of the fill and stroke elements:
		NodeList<Element> fills = element.getElementsByTagName("fill");
		if (fills.getLength() == 0) {
			Element stroke = Dom.createElementNS(Dom.NS_VML, "stroke");
			element.appendChild(stroke);
			Element fill = Dom.createElementNS(Dom.NS_VML, "fill");
			element.appendChild(fill);
			fills = element.getElementsByTagName("fill");
		}

		// Then if fill-color then filled=true:
		if (style.getFillColor() != null) {
			element.setAttribute("filled", "true");
			fills.getItem(0).setAttribute("color", style.getFillColor());
			fills.getItem(0).setAttribute("opacity", Float.toString(style.getFillOpacity()));
		} else {
			element.setAttribute("filled", "false");
		}

		// Then if stroke-color then stroke=true:
		if (style.getStrokeColor() != null) {
			element.setAttribute("stroked", "true");
			NodeList<Element> strokes = element.getElementsByTagName("stroke");
			strokes.getItem(0).setAttribute("color", style.getStrokeColor());
			strokes.getItem(0).setAttribute("opacity", Float.toString(style.getStrokeOpacity()));
			element.setAttribute("strokeweight", Float.toString(style.getStrokeWidth()));
		} else {
			element.setAttribute("stroked", "false");
		}
	}
627935
private void paintArrowDown(Graphics2D g, JComponent c, int width, int height) {
        int xOffset = width / 2 - 3;
        int yOffset = height / 2 - 5;

        g.translate(xOffset, yOffset);

        Shape s = shapeGenerator.createArrowLeft(1, 1, 4.2, 6);

        g.setPaint(getCommonArrowPaint(s, type));
        g.fill(s);

        g.translate(-xOffset, -yOffset);
    }
1103498
private void fillInternalShadowRounded(Graphics2D g, Shape s) {
        g.setPaint(getRoundedShadowGradient(s));
        g.fill(s);
    }
984047
public void add( Color color , Point3D_F64... polygon ) {

		final Poly p = new Poly(polygon.length,color);

		for( int i = 0; i < polygon.length; i++ )
			p.pts[i] = polygon[i].copy();

		synchronized (polygons) {
			polygons.add( p );
		}
	}