An example of a non standard shape (pacman). Here we WILL NOT use the
genericDraw functions, but rather register a full custom node renderer for
fill, and skip the border renderer which is irrelevant for this shape
----------
550385
function(node,x,y,size,color,context) {
    context.fillStyle = 'yellow';
    context.beginPath();
    context.arc(x,y,size,1.25*Math.PI,0,false);
    context.arc(x,y,size,0,0.75*Math.PI,false);
    context.lineTo(x,y);
    context.closePath();
    context.fill();

    context.fillStyle = 'white';
    context.strokeStyle = 'black';
    context.beginPath();
    context.arc(x+size/3,y-size/3,size/4,0,2*Math.PI,false);
    context.closePath();
    context.fill();
    context.stroke();

    context.fillStyle = 'black';
    context.beginPath();
    context.arc(x+4*size/9,y-size/3,size/8,0,2*Math.PI,false);
    context.closePath();
    context.fill();
  }
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;
    }
838737
private void paintContinuous(Graphics2D g, JComponent c, int width, int height) {
        boolean useToolBarColors = isInToolBar(c);
        Shape   s;

        if (isFocused) {
            s = shapeGenerator.createSliderThumbContinuous(0, 1, width);
            g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, useToolBarColors));
            g.fill(s);
            s = shapeGenerator.createSliderThumbContinuous(1, 2, width - 2);
            g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, useToolBarColors));
            g.fill(s);
        }

        s = shapeGenerator.createSliderThumbContinuous(2, 3, width - 4);

        if (!isFocused) {
            dropShadow.fill(g, s);
        }

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

        s = shapeGenerator.createSliderThumbContinuous(3, 4, width - 6);
        g.setPaint(getCommonInteriorPaint(s, type));
        g.fill(s);
    }
130778
function(x1, y1, x2, y2, width, height, centerX, centerY, padding) {
      var points = nodeShapes['square'].points;
      
      /*
      return renderer.boxIntersectPolygon(
        x1, y1, x2, y2,
        points, 
      */
    }
497707
@Override
    protected void drawBase (Graphics2D gfx, int x, int y)
    {
        if (_active) {
            // render the sausage
            super.drawBase(gfx, x, y);

        } else {
            // render the circle
            gfx.fillOval(x, y, closedBounds.width - 1, closedBounds.height - 1);
        }
    }
1293848
public static final void draw(Shape shape, ShapeFill fill) {
        float points[] = shape.getPoints();
        
        Texture t = TextureImpl.getLastBind();
        TextureImpl.bindNone();

        float center[] = shape.getCenter();
        GL.glBegin(SGL.GL_LINE_STRIP);
        for(int i=0;i<points.length;i+=2) {
            fill.colorAt(shape, points[i], points[i + 1]).bind();
            Vector2f offset = fill.getOffsetAt(shape, points[i], points[i + 1]);
            GL.glVertex2f(points[i] + offset.x, points[i + 1] + offset.y);
        }
        
        if (shape.closed()) {
	        fill.colorAt(shape, points[0], points[1]).bind();
	        Vector2f offset = fill.getOffsetAt(shape, points[0], points[1]);
	        GL.glVertex2f(points[0] + offset.x, points[1] + offset.y);
        }
        GL.glEnd();
        
        if (t == null) {
        	TextureImpl.bindNone();
        } else {
        	t.bind();
        }
    }
975748
@Override
    protected void drawWithoutTransforms(final Context2D context, double alpha, final BoundingBox bounds)
    {
        if ((context.isSelection()) && (false == isListening()))
        {
            return;
        }
        alpha = alpha * getAttributes().getAlpha();

        if (alpha <= 0)
        {
            return;
        }
        BoundingBox bbox = getStorageBounds();

        if (null == bbox)
        {
            bbox = bounds;
        }
        final NFastArrayList<M> list = getChildNodes(bbox);

        final int size = list.size();

        final IPathClipper clip = getPathClipper();

        if ((null != clip) && (clip.isActive()))
        {
            context.save();

            clip.clip(context);

            for (int i = 0; i < size; i++)
            {
                list.get(i).drawWithTransforms(context, alpha, bbox);
            }
            context.restore();
        }
        else
        {
            for (int i = 0; i < size; i++)
            {
                list.get(i).drawWithTransforms(context, alpha, bbox);
            }
        }
    }
980850
def render(self, painter, node=None):
        
        policy = self.visibilityPolicy()
        
        if policy == XNodeHotspot.VisibilityPolicy.Never:
            return
        elif policy == XNodeHotspot.VisibilityPolicy.Hover and \
            not self._hovered:
            return
        elif policy == XNodeHotspot.VisibilityPolicy.NodeHover and \
            not (node and node.isHovered()):
            return
        
        # initialize the look
        painter.setPen(self.borderColor())
        painter.setBrush(self.color())
        
        # draw a circle
        if self.style() == XNodeHotspot.Style.Circle:
            painter.drawEllipse(self.rect())
        
        # draw a square
        elif self.style() == XNodeHotspot.Style.Square:
            painter.drawRect(self.rect())
        
        # draw an icon
        elif self.style() == XNodeHotspot.Style.Icon:
            rect = self.rect()
            x = int(rect.x())
            y = int(rect.y())
            w = int(rect.size().width())
            h = int(rect.size().height())
            
            icon = self.icon()
            hicon = self.hoverIcon()
            
            if not self.isEnabled():
                pixmap = icon.pixmap(w, h, QIcon.Disabled)
            elif not self._hovered:
                pixmap = icon.pixmap(w, h)
            elif hicon:
                pixmap = hicon.pixmap(w, h)
            else:
                pixmap = icon.pixmap(w, h, QIcon.Selected)
            
            painter.drawPixmap(x, y, pixmap)
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();
        }
    }
1057879
function(context, geometry, style, featureId, type) {
        var components = geometry.components;
        var len = components.length;
        context.beginPath();
        var start = this.getLocalXY(components[0]);
        var x = start[0];
        var y = start[1];
        if (!isNaN(x) && !isNaN(y)) {
            context.moveTo(start[0], start[1]);
            for (var i=1; i<len; ++i) {
                var pt = this.getLocalXY(components[i]);
                context.lineTo(pt[0], pt[1]);
            }
            if (type === "fill") {
                context.fill();
            } else {
                context.stroke();
            }
        }
    }
1087041
function drawNodeContext(nodeId, nbHops){
    clearGraph();

    var node = searchNodeInTree(gTree, nodeId);
    if (!contains(gNodesDisplayed, node.node)){
        addNodeToGraph(node.node);
        addRelToGraph(node.node);
    }

    if (node.childNodes){
        var lastNode;
        var nodesWithChildren = [node];
        for (var i = 0; i < nbHops; ++i){
            var currentNode = nodesWithChildren[i];
            if (currentNode){
                var childNodes = currentNode.childNodes;
                for (var j = 0; j < childNodes.length; ++j){
                    var currChild = childNodes[j];
                    if (!contains(gNodesDisplayed, currChild.node)){
                        addNodeToGraph(currChild.node);
                    }
                    if (contains (gNodesWithRel, currChild.node)){
                        addRelToGraph(currChild.node);
                        nodesWithChildren.push(currChild);
                    }
                }
                lastNode = currentNode;
            } else {
                nbHops = (nodesWithChildren.length > nbHops ? nbHops : nodesWithChildren.length);
            }
        }
    }

    if (isPaused){
        renderer.rerender();
    }
}
691836
def draw_rect(self, rect):
        
        check_int_err(lib.SDL_RenderDrawRect(self._ptr, rect._ptr))
212006
public void strokeRoundRectangle(Rectangle rect, Color color, float linewidth, float r) {
		template.saveState();
		setStroke(color, linewidth, null);
		template.roundRectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight(), r);
		template.stroke();
		template.restoreState();
	}
248122
private void paintBorder(Graphics2D g, JComponent c, int x, int y, int width, int height) {
        boolean useToolBarColors = isInToolBar(c);
        Shape   s;

        if (focused) {
            s = shapeGenerator.createRoundRectangle(x - 2, y - 2, width + 3, height + 3, CornerSize.OUTER_FOCUS);
            g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, useToolBarColors));
            g.draw(s);
            s = shapeGenerator.createRoundRectangle(x - 1, y - 1, width + 1, height + 1, CornerSize.INNER_FOCUS);
            g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, useToolBarColors));
            g.draw(s);
        }

        if (type != CommonControlState.DISABLED) {
            s = shapeGenerator.createRoundRectangle(x + 1, x + 1, width - 2, height - 2, CornerSize.BORDER);
            internalShadow.fill(g, s, false, true);
        }

        s = shapeGenerator.createRoundRectangle(x, y, width - 1, height - 1, CornerSize.BORDER);
        g.setPaint(getTextBorderPaint(type, !focused && useToolBarColors));
        g.draw(s);
    }
459288
private void generatePatternBitmap() {
    if (getBounds().width() <= 0 || getBounds().height() <= 0) {
      return;
    }

    bitmap = Bitmap.createBitmap(getBounds().width(), getBounds().height(), Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);

    Rect r = new Rect();
    boolean verticalStartWhite = true;
    for (int i = 0; i <= numRectanglesVertical; i++) {
      boolean isWhite = verticalStartWhite;
      for (int j = 0; j <= numRectanglesHorizontal; j++) {
        r.top = i * rectangleSize;
        r.left = j * rectangleSize;
        r.bottom = r.top + rectangleSize;
        r.right = r.left + rectangleSize;
        canvas.drawRect(r, isWhite ? paintWhite : paintGray);
        isWhite = !isWhite;
      }
      verticalStartWhite = !verticalStartWhite;
    }
  }
238983
private void DrawPrimitive( DrawCuboid c, World w ) throws Exception
    {
        XMLBlockState blockType = new XMLBlockState(c.getType(), c.getColour(), c.getFace(), c.getVariant());
        if (!blockType.isValid())
            throw new Exception("Unrecogised item type: "+c.getType().value());

        int x1 = Math.min(c.getX1(), c.getX2());
        int x2 = Math.max(c.getX1(), c.getX2());
        int y1 = Math.min(c.getY1(), c.getY2());
        int y2 = Math.max(c.getY1(), c.getY2());
        int z1 = Math.min(c.getZ1(), c.getZ2());
        int z2 = Math.max(c.getZ1(), c.getZ2());

        clearEntities(w, x1, y1, z1, x2 + 1, y2 + 1, z2 + 1);

        for( int x = x1; x <= x2; x++ ) {
            for( int y = y1; y <= y2; y++ ) {
                for( int z = z1; z <= z2; z++ ) {
                    BlockPos pos = new BlockPos(x, y, z);
                    setBlockState(w, pos, blockType);
                }
            }
        }
    }
496778
function(ctx, noTransform) {
      ctx.save();
      var m = this.transformMatrix;
      if (m) {
        ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
      }
      if (!noTransform) {
        this.transform(ctx);
      }
      // ctx.globalCompositeOperation = this.fillRule;

      if (this.overlayFill) {
        ctx.fillStyle = this.overlayFill;
      }
      else if (this.fill) {
        ctx.fillStyle = this.fill.toLiveGradient
          ? this.fill.toLiveGradient(ctx)
          : this.fill;
      }

      if (this.stroke) {
        ctx.strokeStyle = this.stroke;
      }
      ctx.beginPath();

      this._render(ctx);

      if (this.fill) {
        ctx.fill();
      }
      if (this.stroke) {
        ctx.strokeStyle = this.stroke;
        ctx.lineWidth = this.strokeWidth;
        ctx.lineCap = ctx.lineJoin = 'round';
        ctx.stroke();
      }
      if (!noTransform && this.active) {
        this.drawBorders(ctx);
        this.hideCorners || this.drawCorners(ctx);
      }
      ctx.restore();
    }