Draw the base circle or sausage within which all the other
decorations are added.
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);
        }
    }
996196
private void drawKnob() {
		// Abort if not attached
		if (!isAttached()) {
			return;
		}

		// Move the knob to the correct position
		Element knobElement = knobImage.getElement();
		int lineWidth = lineElement.getOffsetWidth();
		int knobWidth = knobElement.getOffsetWidth();
		int knobLeftOffset = (int) (lineLeftOffset + (getKnobPercent() * lineWidth) - (knobWidth / 2));
		knobLeftOffset = Math.min(knobLeftOffset, lineLeftOffset + lineWidth - (knobWidth / 2) - 1);
		DOM.setStyleAttribute(knobElement, "left", knobLeftOffset + "px");
	}
815997
function addInteraction() {
  let value = typeSelect.value;
  if (value !== 'None') {
    let geometryFunction;
    if (value === 'Square') {
      value = 'Circle';
      geometryFunction = createRegularPolygon(4);
    } else if (value === 'Box') {
      value = 'Circle';
      geometryFunction = createBox();
    } else if (value === 'Star') {
      value = 'Circle';
      geometryFunction = function(coordinates, geometry) {
        const center = coordinates[0];
        const last = coordinates[1];
        const dx = center[0] - last[0];
        const dy = center[1] - last[1];
        const radius = Math.sqrt(dx * dx + dy * dy);
        const rotation = Math.atan2(dy, dx);
        const newCoordinates = [];
        const numPoints = 12;
        for (let i = 0; i < numPoints; ++i) {
          const angle = rotation + i * 2 * Math.PI / numPoints;
          const fraction = i % 2 === 0 ? 1 : 0.5;
          const offsetX = radius * fraction * Math.cos(angle);
          const offsetY = radius * fraction * Math.sin(angle);
          newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);
        }
        newCoordinates.push(newCoordinates[0].slice());
        if (!geometry) {
          geometry = new Polygon([newCoordinates]);
        } else {
          geometry.setCoordinates([newCoordinates]);
        }
        return geometry;
      };
    }
    draw = new Draw({
      source: source,
      type: value,
      geometryFunction: geometryFunction
    });
    map.addInteraction(draw);
  }
}
1249316
def draw(self):
        
        obverse = slice(0, None)
        reverse = slice(None, None, -1)
        width = self.barwidth
        height = self.barheight
        nbars = len(self.bar)
        length = height
        direction = self.direction
        colors = self.bar['color'].tolist()
        labels = self.key['label'].tolist()
        themeable = self.theme.figure._themeable

        # When there is more than one guide, we keep
        # record of all of them using lists
        if 'legend_title' not in themeable:
            themeable['legend_title'] = []
        if 'legend_text_colorbar' not in themeable:
            themeable['legend_text_colorbar'] = []

        # .5 puts the ticks in the middle of the bars when
        # raster=False. So when raster=True the ticks are
        # in between interpolation points and the matching is
        # close though not exactly right.
        _from = self.bar['value'].min(), self.bar['value'].max()
        tick_locations = rescale(self.key['value'],
                                 (.5, nbars-.5),
                                 _from) * length/nbars

        if direction == 'horizontal':
            width, height = height, width
            length = width

        if self.reverse:
            colors = colors[::-1]
            labels = labels[::-1]
            tick_locations = length - tick_locations[::-1]

        # title #
        title_box = TextArea(self.title,
                             textprops=dict(color='black'))
        themeable['legend_title'].append(title_box)

        # colorbar and ticks #
        da = ColoredDrawingArea(width, height, 0, 0)
        if self.raster:
            add_interpolated_colorbar(da, colors, direction)
        else:
            add_segmented_colorbar(da, colors, direction)

        if self.ticks:
            _locations = tick_locations
            if not self.draw_ulim:
                _locations = _locations[:-1]

            if not self.draw_llim:
                _locations = _locations[1:]

            add_ticks(da, _locations, direction)

        # labels #
        if self.label:
            labels_da, legend_text = create_labels(da, labels,
                                                   tick_locations,
                                                   direction)
            themeable['legend_text_colorbar'].extend(legend_text)
        else:
            labels_da = ColoredDrawingArea(0, 0)

        # colorbar + labels #
        if direction == 'vertical':
            packer, align = HPacker, 'bottom'
            align = 'center'
        else:
            packer, align = VPacker, 'right'
            align = 'center'
        slc = obverse if self.label_position == 'right' else reverse
        if self.label_position in ('right', 'bottom'):
            slc = obverse
        else:
            slc = reverse
        main_box = packer(children=[da, labels_da][slc],
                          sep=self._label_margin,
                          align=align,
                          pad=0)

        # title + colorbar(with labels) #
        lookup = {
            'right': (HPacker, reverse),
            'left': (HPacker, obverse),
            'bottom': (VPacker, reverse),
            'top': (VPacker, obverse)}
        packer, slc = lookup[self.title_position]
        children = [title_box, main_box][slc]
        box = packer(children=children,
                     sep=self._title_margin,
                     align=self._title_align,
                     pad=0)
        return box
478096
def draw_circle(self, color, world_loc, world_radius, thickness=0):
    """"""
    if world_radius > 0:
      center = self.world_to_surf.fwd_pt(world_loc).round()
      radius = max(1, int(self.world_to_surf.fwd_dist(world_radius)))
      pygame.draw.circle(self.surf, color, center, radius,
                         thickness if thickness < radius else 0)
358739
function drawLegend(obj) {
            if (obj.data) {

                svg.select('.donut-text')
                    .text(() => centeredTextFunction(obj.data))
                    .attr('dy', '.2em')
                    .attr('text-anchor', 'middle');

                svg.select('.donut-text').call(wrapText, legendWidth);
            }
        }
254735
function() {
    var hand = game.player.hand;
    var steps = game.player.steps;
    var scaleFactor = this.scale * 6;

    // Calculate the position of each hand relative to the steps taken.
    var xScale = Math.cos(steps * 2);
    var yScale = Math.sin(steps * 4);
    var bobX = xScale * scaleFactor;
    var bobY = yScale * scaleFactor;
    var x = (canvas.width - (hand.width * this.scale) + scaleFactor) + bobX;
    var y = (canvas.height - (hand.height * this.scale) + scaleFactor) + bobY;
    var w = hand.width * this.scale;
    var h = hand.height * this.scale;

    ctx.drawImage(hand.image, x, y, w, h);
  }
1078658
def draw(self):
        """"""
        from onshapepy import Part
        CAD = Part(
            'https://cad.onshape.com/documents/b4cfd328713460beeb3125ac/w/3928b5c91bb0a0be7858d99e/e/6f2eeada21e494cebb49515f'
        )
        CAD.params = {
            'channel_L': self.channel_L,
            'channel_W': self.channel_W,
            'channel_H': self.downstream_H,
            'channel_pairs': self.channel_n/2,
            'baffle_S': self.baffle_S,
        }
344493
def draw(self):
        """"""
        for fig in self.figs2draw:
            fig.canvas.draw()
        self._figs2draw.clear()
66969
def draw(self):
        """"""
        for fig in set(chain(*map(
                lambda arr: arr.psy.plotter.figs2draw, self.with_plotter))):
            self.logger.debug("Drawing figure %s", fig.number)
            fig.canvas.draw()
        for arr in self:
            if arr.psy.plotter is not None:
                arr.psy.plotter._figs2draw.clear()
        self.logger.debug("Done drawing.")
840698
def draw(self):
        """"""

        self.context.set_source_rgb(*self._get_background_color())
        self.context.rectangle(*self.rect)
        self.context.fill()

        # If show frozen is active, show frozen pattern
        if self.view_frozen and self.cell_attributes[self.key]["frozen"]:
            self._draw_frozen_pattern()
1041658
def draw(self, **kwargs):
        

        ax = mp.gca()
        shape = matplotlib.patches.Polygon(self.polygon, **kwargs)
        ax.add_artist(shape)
379775
def add_border(cell_ref, args = :all)
      cells = self[cell_ref]
      BorderCreator.new(self, cells, args).draw
    end
171171
def circle(self, clear_screen=True, x=50, y=50, radius=40, fill_color='black', outline_color='black'):
        

        if clear_screen:
            self.clear()

        x1 = x - radius
        y1 = y - radius
        x2 = x + radius
        y2 = y + radius

        return self.draw.ellipse((x1, y1, x2, y2), fill=fill_color, outline=outline_color)
915017
protected void layout ()
    {
        Graphics2D gfx = (Graphics2D)_host.getComponent().getGraphics();
        Font font = gfx.getFont();
        _bounds = new Rectangle();

        // figure out which items are included
        int icount = _items.size();
        ArrayList<RadialMenuItem> items = new ArrayList<RadialMenuItem>();
        for (int i = 0; i < icount; i++) {
            RadialMenuItem item = _items.get(i);
            if (item.isIncluded(this)) {
                items.add(item);
            }
        }

        // lay out all of our menu items
        int maxwid = 0, maxhei = 0;
        icount = items.size();
        for (int i = 0; i < icount; i++) {
            RadialMenuItem item = items.get(i);
            item.layout(gfx, font);

            // track maximum menu item size
            if (item.closedBounds.width > maxwid) {
                maxwid = item.closedBounds.width;
            }
            if (item.closedBounds.height > maxhei) {
                maxhei = item.closedBounds.height;
            }
        }
        gfx.dispose();

        // use the maximum of either width or height and make a circle around that
        double radius = Math.max(_tbounds.height, _tbounds.width) / 2;

        // be sure to add a gap and space for the menu item itself
        radius += (5 + maxwid/2);

        // compute the angle between menu items (we use the diameter of the menu items as an
        // approximate measure of the distance along the circumference)
        double theta = (maxwid + 10) / radius ;

        // now position each item accordingly
        double angle = -Math.PI/2;
        for (int i = 0; i < icount; i++) {
            RadialMenuItem item = items.get(i);
            int ix = (int)(radius * Math.cos(angle));
            int iy = (int)(radius * Math.sin(angle));
            item.openBounds.x = item.closedBounds.x = ix - maxwid/2;
            item.openBounds.y = item.closedBounds.y = iy - maxhei/2;

            // move along the circle
            angle += theta;
        }

        // create and position the centerpiece label
        if (_centerIcon != null) {
            _centerLabel = new RadialLabelSausage("", _centerIcon);
            _centerLabel.layout(gfx, font);
            _centerLabel.openBounds.x = _centerLabel.closedBounds.x =
                -(_centerLabel.closedBounds.width / 2);
            _centerLabel.openBounds.y = _centerLabel.closedBounds.y =
                -(_centerLabel.closedBounds.height / 2);
        }

        // now compute the rectangle that encloses the entire menu

        // include the bounds for the centerpiece label
        if (_centerLabel != null) {
            _bounds.add(_centerLabel.openBounds);
        }

        // include the bounds for all menu items
        for (int i = 0; i < icount; i++) {
            RadialMenuItem item = items.get(i);
            // we need the open bounds rather than the closed ones
            _bounds.add(item.openBounds);
        }

        // now translate everything from the center of the target bounds to the upper left of the
        // menu bounds
        if (_centerLabel != null) {
            _centerLabel.openBounds.translate(-_bounds.x, -_bounds.y);
            _centerLabel.closedBounds.translate(-_bounds.x, -_bounds.y);
        }
        for (int i = 0; i < icount; i++) {
            RadialMenuItem item = items.get(i);
            item.openBounds.translate(-_bounds.x, -_bounds.y);
            item.closedBounds.translate(-_bounds.x, -_bounds.y);
        }

        // the origin was at the center of the encircled rectangle; we need to translate it such
        // that the origin of our bounds are in screen coordinates and at the upper left rather
        // than the center
        _bounds.x += (_tbounds.x + _tbounds.width/2);
        _bounds.y += (_tbounds.y + _tbounds.height/2);

        // now make sure the whole shebang is fully visible within the host component
        Rectangle hbounds = _host.getViewBounds();
        Point pos = SwingUtil.fitRectInRect(_bounds, hbounds);
        _bounds.setLocation(pos);
    }
684851
protected void onDraw(Effect shape, Canvas canvas, Paint paint) {
        shape.draw(canvas, paint);
    }
208575
def circle(opts = {})
      range  = Args::CardRange.new(opts[:range], deck_size: size)
      coords = Args::Coords.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
      draw   = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
      range.each { |i| @cards[i].circle(coords[i], draw[i]) }
    end