Paint this canvas using the specified clip.
761072
function (clip) {
    var width = this.getUnscaledWidth();
    var height = this.getUnscaledHeight();
    this.draw(clip);
    this.lastClip = clip;
    this.invalid = false;
  }
207516
def fill_area(self, x, y, width, height, color, opacity = 1):
        """"""
        self.save_context()
        self.rectangle(x, y, width, height)
        self._add_instruction("clip")
        self.rectangle(x, y, width, height)
        self.fill(color, opacity)
        self.restore_context()
822148
def paintEvent(self, event):
        
        if not self.toPlainText() and not self.hasFocus() and self._placeholder:
            p = QtGui.QPainter(self.viewport())
            p.setClipping(False)
            col = self.palette().text().color()
            col.setAlpha(128)
            oldpen = p.pen()
            p.setPen(col)
            p.drawText(self.viewport().geometry(), QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop, self._placeholder)
            p.setPen(oldpen)
        else:
            return super(JB_PlainTextEdit, self).paintEvent(event)
1061400
def paintEvent(self, e):
        
        self._update_visible_blocks(e)
        super(CodeEdit, self).paintEvent(e)
        self.painted.emit(e)
1003754
def paintEvent(self, event):
        
        # use the base technique for the dialog mode
        if self.currentMode() == XPopupWidget.Mode.Dialog:
            super(XPopupWidget, self).paintEvent(event)
            return
        
        # setup the coloring options
        palette = self.palette()
        
        with XPainter(self) as painter:
            pen = QPen(palette.color(palette.Window).darker(130))
            pen.setWidthF(1.75)
            painter.setPen(pen)
            painter.setRenderHint(painter.Antialiasing)
            painter.setBrush(palette.color(palette.Window))
            painter.drawPath(self.borderPath())
475566
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) {
        context.getPainter().paintTextFieldBackground(context, g, 0, 0, c.getWidth(), c.getHeight());
        // If necessary, paint the placeholder text.
        if (placeholderText != null && ((JTextComponent) c).getText().length() == 0 && !c.hasFocus()) {
            paintPlaceholderText(context, g, c);
        }
    }
747385
def drawOverlay(self, painter, option, rect, icon):
        
        if icon and not icon.isNull():
            painter.drawPixmap(rect, icon.pixmap(rect.width(), rect.height()))
861947
private void paintHover(Graphics2D g, JComponent c, int width, int height) {
        paintMenu(g, c, width, height, hover);
    }
110581
def _repaint(self, drawing_context):
        """"""

        # canvas size
        canvas_width = self.canvas_size[1]
        canvas_height = self.canvas_size[0]

        left = self.display_limits[0]
        right = self.display_limits[1]

        # draw left display limit
        if left > 0.0:
            with drawing_context.saver():
                drawing_context.begin_path()
                drawing_context.move_to(left * canvas_width, 1)
                drawing_context.line_to(left * canvas_width, canvas_height-1)
                drawing_context.line_width = 2
                drawing_context.stroke_style = "#000"
                drawing_context.stroke()

        # draw right display limit
        if right < 1.0:
            with drawing_context.saver():
                drawing_context.begin_path()
                drawing_context.move_to(right * canvas_width, 1)
                drawing_context.line_to(right * canvas_width, canvas_height-1)
                drawing_context.line_width = 2
                drawing_context.stroke_style = "#FFF"
                drawing_context.stroke()

        # draw border
        with drawing_context.saver():
            drawing_context.begin_path()
            drawing_context.move_to(0,canvas_height)
            drawing_context.line_to(canvas_width,canvas_height)
            drawing_context.line_width = 1
            drawing_context.stroke_style = "#444"
            drawing_context.stroke()
569544
def paintEvent(self, event):
        """"""
        painter = QPainter(self)

        color = QColor(self.color)
        color.setAlphaF(.5)
        painter.setPen(color)
        offset = self.editor.document().documentMargin() + \
            self.editor.contentOffset().x()

        for _, line_number, block in self.editor.visible_blocks:

            indentation = TextBlockHelper.get_fold_lvl(block)
            ref_lvl = indentation
            block = block.next()
            last_line = block.blockNumber()
            lvl = TextBlockHelper.get_fold_lvl(block)
            if ref_lvl == lvl:  # for zone set programmatically such as imports
                # in pyqode.python
                ref_lvl -= 1

            while (block.isValid() and
                   TextBlockHelper.get_fold_lvl(block) > ref_lvl):
                last_line = block.blockNumber()
                block = block.next()

            end_of_sub_fold = block
            if last_line:
                block = block.document().findBlockByNumber(last_line)
                while ((block.blockNumber()) and (block.text().strip() == ''
                       or block.text().strip().startswith('#'))):
                    block = block.previous()
                    last_line = block.blockNumber()

            block = self.editor.document().findBlockByNumber(line_number)
            top = int(self.editor.blockBoundingGeometry(block).translated(
                self.editor.contentOffset()).top())
            bottom = top + int(self.editor.blockBoundingRect(block).height())

            indentation = TextBlockHelper.get_fold_lvl(block)

            for i in range(1, indentation):
                if (line_number > last_line and
                        TextBlockHelper.get_fold_lvl(end_of_sub_fold) <= i):
                    continue
                else:
                    x = self.editor.fontMetrics().width(i * self.i_width *
                                                        '9') + offset
                    painter.drawLine(x, top, x, bottom)
336176
def paint(self):
        
        # nice blue color
        self.image = Image.new(mode='RGB', size=(self.width, self.height),
                               color=(47, 98, 135))
        self.paint_pattern()
        self.image.save(fp=self.filename)
1058099
def _draw(self, context, opacity):
        """"""

        # if we have been moved around, we should update bounds
        fresh_draw = len(self.__new_instructions or []) > 0
        if fresh_draw: #new stuff!
            self.paths = []
            self.__instruction_cache = self.__new_instructions
            self.__new_instructions = []
        else:
            if not self.__instruction_cache:
                return

        for instruction, args in self.__instruction_cache:
            if fresh_draw:
                if instruction in ("new_path", "stroke", "fill", "clip"):
                    self.paths.append((instruction, "path", context.copy_path()))

                elif instruction in ("save", "restore", "translate", "scale", "rotate"):
                    self.paths.append((instruction, "transform", args))

            if instruction == "set_color":
                self._set_color(context, args[0], args[1], args[2], args[3] * opacity)
            elif instruction == "show_layout":
                self._show_layout(context, *args)
            elif opacity < 1 and instruction == "paint":
                context.paint_with_alpha(opacity)
            else:
                getattr(context, instruction)(*args)
923986
protected void paintIndicator (Graphics2D gfx, Rectangle clip, SceneObjectIndicator tip)
    {
        if (clip.intersects(tip.getBounds())) {
            tip.paint(gfx);
        }
    }
499702
public void paint (Graphics2D gfx, int x, int y)
    {
        gfx.drawImage(_image, x, y, null);
    }
795680
def attach(self, canvas):
        """"""
        self.canvas = canvas

        @canvas.connect
        def on_visual_added(e):
            self.update_program(e.visual.program)
870303
def paintEvent(self, event):
        """"""
        super(FigureCanvas, self).paintEvent(event)
        # Prepare the rect on which the image is going to be painted :
        fw = self.frameWidth()
        rect = QRect(0 + fw, 0 + fw,
                     self.size().width() - 2 * fw,
                     self.size().height() - 2 * fw)

        if self.fig is None or self._blink_flag:
            return

        # Check/update the qpixmap buffer :
        qpix2paint = None
        for qpix in self._qpix_buffer:
            if qpix.size().width() == rect.width():
                qpix2paint = qpix
                break
        else:
            if self.fmt in ['image/png', 'image/jpeg']:
                qpix2paint = self._qpix_orig.scaledToWidth(
                    rect.width(), mode=Qt.SmoothTransformation)
            elif self.fmt == 'image/svg+xml':
                qpix2paint = QPixmap(svg_to_image(self.fig, rect.size()))
            self._qpix_buffer.append(qpix2paint)

        if qpix2paint is not None:
            # Paint the image on the widget :
            qp = QPainter()
            qp.begin(self)
            qp.drawPixmap(rect, qpix2paint)
            qp.end()
552506
def paint( self, painter, option, widget ):
        
        painter.save()
        pen = QPen(self.color())
        pen.setWidth(2)
        painter.setPen(pen)
        painter.drawPath(self._basePath)
        painter.setRenderHint(painter.Antialiasing)
        
        
        pen.setColor(QColor('white'))
        painter.setPen(pen)
        painter.setBrush(self.color())
        for ellipse in self._ellipses:
            painter.drawEllipse(ellipse, 6, 6)
        
        painter.restore()