See ContentStream#draw_rectangle.
966199
def draw_rectangle(x, y, width, height, attr = {})
            last_content_stream.draw_rectangle(x, y, width, height, attr); self
        end
629484
public void drawImage(Image img, Rectangle rect, Rectangle clipRect) {
		drawImage(img, rect, clipRect, 1);
	}
1009070
public void draw()
	{
		m_rootItem.updateColSpans();

		String nbRows = String.valueOf( m_rows.size() );
		int nbHeaders = m_rowHeaders.size();

		for( int i = 0; i < nbHeaders; i++ )
			m_rowHeaders.get( i ).m_td.setAttribute( "rowspan", nbRows );
	}

	public class RowHdrImpl
	{
		Element m_tr;
		Element m_td;

		public void setText( String text )
		{
			m_td.setInnerText( text );
		}
	}

	public RowHdrImpl addRowHeader()
	{
		RowHdrImpl item = new RowHdrImpl();
		m_rowHeaders.add( item );

		if( m_rows.isEmpty() )
		{
			Element tr = DOM.createTR();
			m_rows.add( tr );
			m_thead.appendChild( tr );
		}

		item.m_tr = m_rows.get( 0 );

		item.m_td = DOM.createTH();
		item.m_tr.appendChild( item.m_td );

		return item;
	}

	public class ItemImpl
	{
		int m_level = -2;
		int m_nbLeaves = -1;

		ItemImpl m_parent;
		ArrayList<ItemImpl> m_childs = new ArrayList<ItemImpl>();

		Element m_tr = null;
		Element m_td = null;

		ItemImpl( ItemImpl parent )
		{
			m_parent = parent;
			if( m_parent != null )
				m_parent.m_childs.add( this );
		}

		public void setText( String text )
		{
			m_td.setInnerText( text );
		}

		public void setWidget( Widget w )
		{
			setText( "" );
			add( w, m_td );
		}

		void updateColSpans()
		{
			for( ItemImpl c : m_childs )
			{
				int nbLeaf = c.getNbLeaves();
				c.m_td.setAttribute( "colspan", String.valueOf( nbLeaf ) );
				c.updateColSpans();
			}
		}

		int getNbLeaves()
		{
			if( m_nbLeaves == -1 )
			{
				if( m_childs.isEmpty() )
					m_nbLeaves = 1;
				else
				{
					int nb = 0;
					for( ItemImpl c : m_childs )
						nb += c.getNbLeaves();
					m_nbLeaves = nb;
				}
			}

			return m_nbLeaves;
		}

		int getLevel()
		{
			if( m_level == -2 )
			{
				if( m_parent == null )
					m_level = -1;
				else
					m_level = 1 + m_parent.getLevel();
			}

			return m_level;
		}

		ItemImpl getPreviousAtSameLevel()
		{
			return getPreviousAtLevel( getLevel() );
		}

		ItemImpl getLastDescendant( int level )
		{
			int myLevel = getLevel();
			if( level > myLevel )
				return null;
			if( myLevel == level )
				return this;

			int i = m_childs.size() - 1;
			while( i >= 0 )
			{
				ItemImpl t = getLastDescendant( level );
				if( t != null )
					return t;
				i--;
			}

			return null;
		}

		ItemImpl getPreviousAtLevel( int level )
		{
			if( m_parent == null )
				return null;

			ItemImpl position = this;
			ItemImpl ancestor = m_parent;
			while( ancestor != null )
			{
				int prevIdx = ancestor.m_childs.indexOf( position ) - 1;
				while( prevIdx >= 0 )
				{
					// test getLastDescendant( level )
					ItemImpl t = ancestor.m_childs.get( prevIdx ).getLastDescendant( level );
					if( t != null )
						return t;
					prevIdx--;
				}

				// did not find, so go to superior parent
				position = ancestor;
				ancestor = ancestor.m_parent;
			}

			// did not find, so return null
			return null;
		}
	}

	public ItemImpl addItem( ItemImpl parentItem )
	{
		ItemImpl item = new ItemImpl( parentItem == null ? m_rootItem : parentItem );
		int level = item.getLevel();

		while( m_rows.size() < level + 1 )
		{
			Element tr = DOM.createTR();
			m_thead.appendChild( tr );
			m_rows.add( tr );
		}

		item.m_tr = m_rows.get( level );

		// th is inserted after the last child of our parent
		item.m_td = DOM.createTH();
		ItemImpl previousItem = item.getPreviousAtSameLevel();
		if( previousItem != null )
			item.m_tr.insertAfter( item.m_td, previousItem.m_td );
		else
			item.m_tr.appendChild( item.m_td );

		return item;
	}
}
154220
function(rectangle) {
        var topLeft = this.viewport.pixelFromPointNoRotate(rectangle.getTopLeft(), true);
        var size = this.viewport.deltaPixelsFromPointsNoRotate(rectangle.getSize(), true);

        return new $.Rect(
            topLeft.x * $.pixelDensityRatio,
            topLeft.y * $.pixelDensityRatio,
            size.x * $.pixelDensityRatio,
            size.y * $.pixelDensityRatio
        );
    }
1140471
def draw(self, ar, can, x_tick, x_label, y):
        """"""

        rect_size = self.get_rect_size()
        line_len = self.get_line_len()

        nr_lines = len(self.label.split("\n"))
        text_height = font.text_height(self.label)[0]
        line_height = text_height / float(nr_lines)
        y_center = y + text_height - line_height / 1.5

        if self.fill_style != None:
            can.rectangle(self.line_style, self.fill_style,
                          x_tick, y_center - rect_size / 2.0,
                          x_tick + rect_size,
                          y_center + rect_size / 2.0)
        elif self.line_style != None:
            can.line(self.line_style, x_tick, y_center,
                     x_tick + line_len, y_center)
            if self.tick_mark != None:
                self.tick_mark.draw(can, x_tick + line_len / 2.0, y_center)
        elif self.tick_mark != None:
            self.tick_mark.draw(can, x_tick, y_center)

        can.show(x_label, y, self.label)
1025299
public void drawRectangle(int x, int y, int z, int width, int height, int color, int alpha)
	{
		drawRectangle(x, y, z, width, height, color, alpha, true);
	}
548980
def Draw(self, grid, attr, dc, rect, row, col, is_selected):
        """"""

        render = wx.RendererNative.Get()

        # clear the background
        dc.SetBackgroundMode(wx.SOLID)

        if is_selected:
            dc.SetBrush(wx.Brush(wx.BLUE, wx.SOLID))
            dc.SetPen(wx.Pen(wx.BLUE, 1, wx.SOLID))
        else:
            dc.SetBrush(wx.Brush(wx.WHITE, wx.SOLID))
            dc.SetPen(wx.Pen(wx.WHITE, 1, wx.SOLID))
        dc.DrawRectangleRect(rect)

        cb_lbl = grid.GetCellValue(row, col)
        string_x = rect.x + 2
        string_y = rect.y + 2
        dc.DrawText(cb_lbl, string_x, string_y)

        button_x = rect.x + rect.width - self.iconwidth
        button_y = rect.y
        button_width = self.iconwidth
        button_height = rect.height
        button_size = button_x, button_y, button_width, button_height
        render.DrawComboBoxDropButton(grid, dc, button_size,
                                      wx.CONTROL_CURRENT)
1336837
def rectangle(self, rect, attr=None, fill=u' '):
        '''
        x0, y0, x1, y1 = rect
        n = DWORD(0)
        if attr is None:
            attr = self.attr
        for y in range(y0, y1):
            pos = self.fixcoord(x0, y)
            self.FillConsoleOutputAttribute(self.hout, attr, x1 - x0, 
                                            pos, byref(n))
            self.FillConsoleOutputCharacterW(self.hout, ord(fill[0]), x1 - x0,
                                             pos, byref(n))
1056332
def drawRect(self, rect):
        
        r = Rect(rect)
        self.draw_cont += "%g %g %g %g re\n" % JM_TUPLE(list(r.bl * self.ipctm) + \
                                               [r.width, r.height])
        self.updateRect(r)
        self.lastPoint = r.tl
        return self.lastPoint
960940
public void drawContent(Graphics2D g)
    {
        //top left corner
        int x = absbounds.x;
        int y = absbounds.y;

        //Draw the string
        if (textEnd > textStart)
        {
            String t = text.substring(textStart, textEnd);
            Shape oldclip = g.getClip();
            if (clipblock != null)
                g.setClip(applyClip(oldclip, clipblock.getClippedContentBounds()));
            ctx.updateGraphics(g);
            
            if (wordSpacing == null && expwidth == 0)
                drawAttributedString(g, x, y, t);
            else
                drawByWords(g, x, y, t);
            
            g.setClip(oldclip);
        }
    }
806848
def draw(self):
        """"""
        if not self.visible:
            return

        self.window.blit(self.textImage, self.loc)
410611
@Override
    public void draw(@NonNull Canvas canvas) {
        pruneRipples();

        // Clip to the dirty bounds, which will be the drawable bounds if we
        // have a mask or content and the ripple bounds if we're projecting.
        final Rect bounds = getDirtyBounds();
        final int saveCount = canvas.save();
        canvas.clipRect(bounds);

        drawContent(canvas);
        drawBackgroundAndRipples(canvas);

        canvas.restoreToCount(saveCount);
    }
319858
private void drawCueList(Graphics g, Rectangle clipRect) {
        for (CueList.Entry entry : cueList.get().entries) {
            final int x = millisecondsToX(entry.cueTime);
            if ((x > clipRect.x - 4) && (x < clipRect.x + clipRect.width + 4)) {
                g.setColor(WaveformDetailComponent.cueColor(entry));
                for (int i = 0; i < 4; i++) {
                    g.drawLine(x - 3 + i, CUE_MARKER_TOP + i, x + 3 - i, CUE_MARKER_TOP + i);
                }
            }
        }
    }
474312
@Override
    public void draw(@NonNull Canvas canvas) {
        if (mIcon == null && mPlainIcon == null) return;

        Rect viewBounds = getBounds();

        updatePaddingBounds(viewBounds);
        updateTextSize(viewBounds);
        offsetIcon(viewBounds);

        if (mRoundedCornerRy > -1 && mRoundedCornerRx > -1) {
            if (mDrawBackgroundContour) {
                float halfContourSize = mBackgroundContourWidth / 2f;
                RectF rectF = new RectF(
                        halfContourSize,
                        halfContourSize,
                        viewBounds.width() - halfContourSize,
                        viewBounds.height() - halfContourSize);
                canvas.drawRoundRect(
                        rectF,
                        mRoundedCornerRx,
                        mRoundedCornerRy,
                        mBackgroundBrush.getPaint());
                canvas.drawRoundRect(
                        rectF,
                        mRoundedCornerRx,
                        mRoundedCornerRy,
                        mBackgroundContourBrush.getPaint());
            } else {
                RectF rectF = new RectF(0, 0, viewBounds.width(), viewBounds.height());
                canvas.drawRoundRect(
                        rectF,
                        mRoundedCornerRx,
                        mRoundedCornerRy,
                        mBackgroundBrush.getPaint());
            }
        }

        try {
            mPath.close();
        } catch (Exception ignored) {
        }

        if (mDrawContour) {
            canvas.drawPath(mPath, mContourBrush.getPaint());
        }

        mIconBrush.getPaint().setColorFilter(mColorFilter == null ? mTintFilter : mColorFilter);

        canvas.drawPath(mPath, mIconBrush.getPaint());
    }
212938
function(rectangle) {
        return $.Rect.fromSummits(
            this.pointFromPixel(rectangle.getTopLeft(), true),
            this.pointFromPixel(rectangle.getTopRight(), true),
            this.pointFromPixel(rectangle.getBottomLeft(), true)
        );
    }
836562
def draw_rect(
            self, x:float, y:float, w:float, h:float, *,
            stroke:Color=None,
            stroke_width:float=1,
            stroke_dash:typing.Sequence=None,
            fill:Color=None
            ) -> None:
        """"""
        pass
1137693
def draw(self):
        """"""

        # Content is only rendered within rect
        self.context.save()
        self.context.rectangle(*self.rect)
        self.context.clip()

        content = self.get_cell_content()

        pos_x, pos_y = self.rect[:2]
        self.context.translate(pos_x + 2, pos_y + 2)

        cell_attributes = self.code_array.cell_attributes

        # Do not draw cell content if cell is too small
        # This allows blending out small cells by reducing height to 0

        if self.rect[2] < cell_attributes[self.key]["borderwidth_right"] or \
           self.rect[3] < cell_attributes[self.key]["borderwidth_bottom"]:
            self.context.restore()
            return

        if self.code_array.cell_attributes[self.key]["button_cell"]:
            # Render a button instead of the cell
            label = self.code_array.cell_attributes[self.key]["button_cell"]
            self.draw_button(1, 1, self.rect[2]-5, self.rect[3]-5, label)

        elif isinstance(content, wx._gdi.Bitmap):
            # A bitmap is returned --> Draw it!
            self.draw_bitmap(content)

        elif pyplot is not None and isinstance(content, pyplot.Figure):
            # A matplotlib figure is returned --> Draw it!
            self.draw_matplotlib_figure(content)

        elif isinstance(content, basestring) and is_svg(content):
            # The content is a vaid SVG xml string
            self.draw_svg(content)

        elif content is not None:
            self.draw_text(content)

        self.context.translate(-pos_x - 2, -pos_y - 2)

        # Remove clipping to rect
        self.context.restore()