This function draws the #imageTemp canvas on top of #imageView, after which #imageTemp is cleared. This function is called each time when the user completes a drawing operation.
965748
function img_update() {
        if(!root.is('no_steps')) {
            new_canvas();
        }
        contextoList[quizJS.getCanvasIndex(root)].drawImage(canvas, 0, 0);
        context.clearRect(0, 0, canvas.width, canvas.height);
    }
906831
public void drawTop(View view, Canvas c) {
        int left = view.getLeft() - mWidth;
        int top = view.getTop() - mHeight;
        int right = view.getRight() + mWidth;
        int bottom = top + mHeight;
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
1247806
private void drawNoxItem(Canvas canvas, int position, float left, float top) {
    if (noxItemCatalog.isBitmapReady(position)) {
      Bitmap bitmap = noxItemCatalog.getBitmap(position);
      canvas.drawBitmap(bitmap, left, top, paint);
    } else if (noxItemCatalog.isDrawableReady(position)) {
      Drawable drawable = noxItemCatalog.getDrawable(position);
      drawNoxItemDrawable(canvas, (int) left, (int) top, drawable);
    } else if (noxItemCatalog.isPlaceholderReady(position)) {
      Drawable drawable = noxItemCatalog.getPlaceholder(position);
      drawNoxItemDrawable(canvas, (int) left, (int) top, drawable);
    }
  }
428452
private void drawPreviousShadow(Canvas canvas) {
		final float degreesFlipped = getDegreesFlipped();
		if (degreesFlipped > 90) {
			final int alpha = (int) (((degreesFlipped - 90) / 90f) * MAX_SHADOW_ALPHA);
			mShadowPaint.setAlpha(alpha);
			canvas.drawPaint(mShadowPaint);
		}
	}
1205054
@Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawOval(rectF, backgroundPaint);
        float realProgress = progress * DEFAULT_MAX_VALUE / progressMax;
        float angle = (rightToLeft ? 360 : -360) * realProgress / 100;
        canvas.drawArc(rectF, startAngle, angle, false, foregroundPaint);
    }
999192
function(layer, handler, options) {
        OpenLayers.Control.prototype.initialize.apply(this, [options]);
        this.callbacks = OpenLayers.Util.extend(
            {
                done: this.drawFeature,
                modify: function(vertex, feature) {
                    this.layer.events.triggerEvent(
                        "sketchmodified", {vertex: vertex, feature: feature}
                    );
                },
                create: function(vertex, feature) {
                    this.layer.events.triggerEvent(
                        "sketchstarted", {vertex: vertex, feature: feature}
                    );
                }
            },
            this.callbacks
        );
        this.layer = layer;
        this.handlerOptions = this.handlerOptions || {};
        this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults(
            this.handlerOptions.layerOptions, {
                renderers: layer.renderers, rendererOptions: layer.rendererOptions
            }
        );
        if (!("multi" in this.handlerOptions)) {
            this.handlerOptions.multi = this.multi;
        }
        var sketchStyle = this.layer.styleMap && this.layer.styleMap.styles.temporary;
        if(sketchStyle) {
            this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults(
                this.handlerOptions.layerOptions,
                {styleMap: new OpenLayers.StyleMap({"default": sketchStyle})}
            );
        }
        this.handler = new handler(this, this.callbacks, this.handlerOptions);
    }
782643
def _repaint(self, drawing_context: DrawingContext.DrawingContext):
        """"""

        # canvas size
        canvas_width = self.canvas_size.width
        canvas_height = self.canvas_size.height

        with drawing_context.saver():
            if self.__color_map_data is not None:
                rgba_image = numpy.empty((4,) + self.__color_map_data.shape[:-1], dtype=numpy.uint32)
                Image.get_rgb_view(rgba_image)[:] = self.__color_map_data[numpy.newaxis, :, :]  # scalar data assigned to each component of rgb view
                Image.get_alpha_view(rgba_image)[:] = 255
                drawing_context.draw_image(rgba_image, 0, 0, canvas_width, canvas_height)
858591
protected void drawBars(Canvas _Canvas) {
        for (StackedBarModel model : mData) {
            float lastTop;
            float lastBottom = mGraphHeight;

            for (int index = 0; index < model.getBars().size(); index++) {
                BarModel barModel = model.getBars().get(index);

                RectF bounds = barModel.getBarBounds();
                mGraphPaint.setColor(barModel.getColor());

                float height = (bounds.height() * mRevealValue);
                lastTop = lastBottom - height;

                _Canvas.drawRect(
                        bounds.left,
                        lastTop,
                        bounds.right,
                        lastBottom,
                        mGraphPaint
                );

                if (mShowValues && barModel.isShowValue()) {
                    _Canvas.drawText(
                            String.valueOf(barModel.getValue()),
                            bounds.centerX(),
                            (lastTop + height / 2) + barModel.getValueBounds().height()/2,
                            mTextPaint
                    );
                }

                lastBottom = lastTop;

                if (mShowSeparators && index < model.getBars().size() - 1) {
                    lastBottom -= mSeparatorWidth;
                }
            }

        }
    }
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)
1156029
def paintEvent(self, event):
        
        pixmap = self.currentPixmap()
        rect   = self.currentPixmapRect()
        
        with XPainter(self) as painter:
            painter.drawPixmap(rect.x(), rect.y(), pixmap)
854530
function() {
        this.canvas.innerHTML = "";
        if ( this.useCanvas ) {
            var viewportSize = this._calculateCanvasSize();
            if( this.canvas.width != viewportSize.x ||
                this.canvas.height != viewportSize.y ) {
                this.canvas.width = viewportSize.x;
                this.canvas.height = viewportSize.y;
                this._updateImageSmoothingEnabled(this.context);
                if ( this.sketchCanvas !== null ) {
                    var sketchCanvasSize = this._calculateSketchCanvasSize();
                    this.sketchCanvas.width = sketchCanvasSize.x;
                    this.sketchCanvas.height = sketchCanvasSize.y;
                    this._updateImageSmoothingEnabled(this.sketchContext);
                }
            }
            this._clear();
        }
    }
208377
@Override
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(canvas);
        if (onClickedDrawable != null) {
            onClickedDrawable.draw(canvas);
        }
    }
462159
function (allOnTop) {

      var canvasToDrawOn = this[(allOnTop === true && this.interactive) ? 'contextTop' : 'contextContainer'];

      if (this.contextTop) {
        this.clearContext(this.contextTop);
      }

      if (allOnTop === false || (typeof allOnTop === 'undefined')) {
        this.clearContext(canvasToDrawOn);
      }

      var length = this._objects.length,
          activeGroup = this.getActiveGroup(),
          startTime = new Date();

      if (this.clipTo) {
        canvasToDrawOn.save();
        canvasToDrawOn.beginPath();
        this.clipTo(canvasToDrawOn);
        canvasToDrawOn.clip();
      }

      canvasToDrawOn.fillStyle = this.backgroundColor;
      canvasToDrawOn.fillRect(0, 0, this.width, this.height);

      if (typeof this.backgroundImage == 'object') {
        canvasToDrawOn.save();
        canvasToDrawOn.globalAlpha = this.backgroundImageOpacity;

        if (this.backgroundImageStretch) {
            canvasToDrawOn.drawImage(this.backgroundImage, 0, 0, this.width, this.height);
        }
        else {
            canvasToDrawOn.drawImage(this.backgroundImage, 0, 0);
        }
        canvasToDrawOn.restore();
      }

      if (length) {
        for (var i = 0; i < length; ++i) {
          if (!activeGroup ||
              (activeGroup && this._objects[i] && !activeGroup.contains(this._objects[i]))) {
            this._draw(canvasToDrawOn, this._objects[i]);
          }
        }
      }

      if (this.clipTo) {
        canvasToDrawOn.restore();
      }

      // delegate rendering to group selection (if one exists)
      if (activeGroup) {
        this._draw(this.contextTop, activeGroup);
      }

      if (this.overlayImage) {
        this.contextContainer.drawImage(this.overlayImage, 0, 0);
      }

      if (this.controlsAboveOverlay) {
        this.drawControls(this.contextContainer);
      }

      if (this.onFpsUpdate) {
        var elapsedTime = new Date() - startTime;
        this.onFpsUpdate(~~(1000 / elapsedTime));
      }

      this.fire('after:render');

      return this;
    }
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());
    }
1184351
@Override
	void draw(Canvas canvas) {
		updateRadius();
		getActionButton().getPaint().setShadowLayer(currentShadowRadius, getActionButton().getShadowXOffset(),
				getActionButton().getShadowYOffset(), getActionButton().getShadowColor());
		LOGGER.trace("Drawn the next Shadow Responsive Effect step");
	}
308036
@Override
    protected synchronized void onDraw(@NonNull Canvas canvas) {
        super.onDraw(canvas);

        paint.setTextSize(textSize);
        paint.setStyle(Style.FILL);
        paint.setColor(defaultColor);
        paint.setAntiAlias(true);
        float minMaxLabelSize = 0;

        if (showLabels) {
            // draw min and max labels
            String minLabel = getContext().getString(R.string.demo_min_label);
            String maxLabel = getContext().getString(R.string.demo_max_label);
            minMaxLabelSize = Math.max(paint.measureText(minLabel), paint.measureText(maxLabel));
            float minMaxHeight = textOffset + thumbHalfHeight + textSize / 3;
            canvas.drawText(minLabel, 0, minMaxHeight, paint);
            canvas.drawText(maxLabel, getWidth() - minMaxLabelSize, minMaxHeight, paint);
        }
        padding = internalPad + minMaxLabelSize + thumbHalfWidth;

        // draw seek bar background line
        rect.left = padding;
        rect.right = getWidth() - padding;
        canvas.drawRect(rect, paint);

        boolean selectedValuesAreDefault = (normalizedMinValue <= minDeltaForDefault && normalizedMaxValue >= 1 - minDeltaForDefault);

        int colorToUseForButtonsAndHighlightedLine = !alwaysActive && !activateOnDefaultValues && selectedValuesAreDefault ?
                defaultColor : // default values
                activeColor;   // non default, filter is active

        // draw seek bar active range line
        rect.left = normalizedToScreen(normalizedMinValue);
        rect.right = normalizedToScreen(normalizedMaxValue);

        paint.setColor(colorToUseForButtonsAndHighlightedLine);
        canvas.drawRect(rect, paint);

        // draw minimum thumb (& shadow if requested) if not a single thumb control
        if (!singleThumb) {
            if (thumbShadow) {
                drawThumbShadow(normalizedToScreen(normalizedMinValue), canvas);
            }
            drawThumb(normalizedToScreen(normalizedMinValue), Thumb.MIN.equals(pressedThumb), canvas,
                    selectedValuesAreDefault);
        }

        // draw maximum thumb & shadow (if necessary)
        if (thumbShadow) {
            drawThumbShadow(normalizedToScreen(normalizedMaxValue), canvas);
        }
        drawThumb(normalizedToScreen(normalizedMaxValue), Thumb.MAX.equals(pressedThumb), canvas,
                selectedValuesAreDefault);

        // draw the text if sliders have moved from default edges
        if (showTextAboveThumbs && (activateOnDefaultValues || !selectedValuesAreDefault)) {
            paint.setTextSize(textSize);
            paint.setColor(textAboveThumbsColor);

            String minText = valueToString(getSelectedMinValue());
            String maxText = valueToString(getSelectedMaxValue());
            float minTextWidth = paint.measureText(minText);
            float maxTextWidth = paint.measureText(maxText);
            // keep the position so that the labels don't get cut off
            float minPosition = Math.max(0f, normalizedToScreen(normalizedMinValue) - minTextWidth * 0.5f);
            float maxPosition = Math.min(getWidth() - maxTextWidth, normalizedToScreen(normalizedMaxValue) - maxTextWidth * 0.5f);

            if (!singleThumb) {
                // check if the labels overlap, or are too close to each other
                int spacing = PixelUtil.dpToPx(getContext(), TEXT_LATERAL_PADDING_IN_DP);
                float overlap = minPosition + minTextWidth - maxPosition + spacing;
                if (overlap > 0f) {
                    // we could move them the same ("overlap * 0.5f")
                    // but we rather move more the one which is farther from the ends, as it has more space
                    minPosition -= overlap * normalizedMinValue / (normalizedMinValue + 1-normalizedMaxValue);
                    maxPosition += overlap * (1-normalizedMaxValue) / (normalizedMinValue + 1-normalizedMaxValue);
                }
                canvas.drawText(minText,
                        minPosition,
                        distanceToTop + textSize,
                        paint);

            }

            canvas.drawText(maxText,
                    maxPosition,
                    distanceToTop + textSize,
                    paint);
        }

    }
1191089
public static void drawTo(Bitmap src, Bitmap dest, int color) {
        clearBitmap(src, color);
        Canvas canvas = new Canvas(dest);
        canvas.drawBitmap(src, 0, 0, null);
        canvas.setBitmap(null);
    }