we simply override the draw method
971510
function (destCtx, debug) {
                if (!this.visible) {
                    return;
                }

                // auto goto next frame
                if (this.currentAnimName.length) {
                    this.advanceFrame(this.currentAnimName);
                }

                var w = this.getCurrentWidth(),
                    scaledW = w * this.scale,
                    h = this.getCurrentHeight(),
                    scaledH = h * this.scale,
                    subScaledW = (scaledW / 2) | 0,
                    subScaledH = (scaledH / 2) | 0,
                    x = this.getCurrentOffsetX(),
                    y = this.getCurrentOffsetY(),
                    drawX = this.x + this.getCurrentShiftX(),
                    drawY = this.y + this.getCurrentShiftY(),
                    mapOffsetX = this.currentMap && this.currentMap.viewportX || 0,

                    mapOffsetY = this.currentMap && this.currentMap.viewportY || 0;

                // TODO: fix map position when rotate is used
                if ($.isEmptyObject(this.fxQueue)) {
                    if (this.type === 'enemy1' && window.todo)
                        var date = new Date().getTime();
                    destCtx.drawImage(this.image, x, y, w, h, drawX + mapOffsetX, drawY + mapOffsetY, scaledW, scaledH);
                    if (this.type === 'enemy1' && window.todo) {
                        var date2 = new Date().getTime();
                        console.log('drawSprite call duration:', date2 - date);
                    }
                    if (this.isDebug === true || debug === true) {
                        this.showHitBox(destCtx);
                    }
                } else {
                    this.executeFx(destCtx);
                    // translate to keep the object as its position
                    destCtx.save();
                    destCtx.translate(drawX + mapOffsetX + subScaledW, drawY + mapOffsetY + subScaledH);
                    destCtx.rotate(this.angle);
                    destCtx.drawImage(this.image, x, y, w, h, -subScaledW, -subScaledH, scaledW, scaledH);
                    if (this.isDebug === true || debug === true) {
                        this.showHitBox(destCtx);
                    }
                    destCtx.restore();
                }
            }
947059
def redraw(self):
        """"""
        if self.__drawing_queued == False: #if we are moving, then there is a timeout somewhere already
            self.__drawing_queued = True
            self._last_frame_time = dt.datetime.now()
            gobject.timeout_add(1000 / self.framerate, self.__redraw_loop)
863986
function overrideAPI(qr) {
    var methods = [ 'canvas', 'image', 'save', 'saveSync', 'toDataURL' ];
    var i;

    function overrideMethod(name) {
      qr[name] = function () {
        throw new Error(name + ' requires HTML5 canvas element support');
      };
    }

    for (i = 0; i < methods.length; i++) {
      overrideMethod(methods[i]);
    }
  }
1272797
def _prepare_draw(self, view=None):
        

        if self._changed['pos']:
            self.pos_buf.set_data(self._pos)
            self._changed['pos'] = False

        if self._changed['color']:
            self.color_buf.set_data(self._color)
            self._program.vert['color'] = self.color_buf
            self._changed['color'] = False

        return True
1257928
@Override
	public void draw(float x,float y,float width,float height) {
		init();
		draw(x,y,width,height,Color.white);
	}
373615
public void draw(GraphicContext graphicContext) {
        /*
         * Swap bitmaps here (and only here).
         * Swapping is done when layer manager has finished. Else draw old bitmap again.
         * This draw() is always called when layer manager has finished. This ensures that the
         * last generated frame is always put on screen.
         */

        // FIXME: resetting the background color is redundant if the background color of the map view is already set
        graphicContext.fillColor(this.displayModel.getBackgroundColor());

        swapBitmaps();

        synchronized (this.matrix) {
            Bitmap b = this.odBitmap.lock();
            if (b != null) {
                graphicContext.drawBitmap(b, this.matrix);
            }
        }

        /*
         * Release here so destroy() can free resources
         */
        this.odBitmap.release();
    }
592199
@Override
  public void draw(Canvas canvas) {
    mBounds = getBounds();
    canvas.clipRect(mBounds);

    //new turn
    if (mNewTurn) {
      mColorsIndex = decrementColor(mColorsIndex);
      mNewTurn = false;

      if (isFinishing()) {
        mStartSection++;

        if (mStartSection > mSectionsCount) {
          stop();
          return;
        }
      }
      if (mCurrentSections < mSectionsCount) {
        mCurrentSections++;
      }
    }

    if (mUseGradients)
      prepareGradient();

    drawStrokes(canvas);
  }
746393
public void redraw(){
        mItemCount = getShouldDrawCount();
        mPreviousSelectedIndicator = null;
        for(View i:mIndicators){
            removeView(i);
        }


        for(int i =0 ;i< mItemCount; i++){
            ImageView indicator = new ImageView(mContext);
            indicator.setImageDrawable(mUnselectedDrawable);
            indicator.setPadding((int)mUnSelectedPadding_Left,
                    (int)mUnSelectedPadding_Top,
                    (int)mUnSelectedPadding_Right,
                    (int)mUnSelectedPadding_Bottom);
            addView(indicator);
            mIndicators.add(indicator);
        }
        setItemAsSelected(mPreviousSelectedPosition);
    }
1058488
function() {
        for ( var i = 0; i < this._items.length; i++ ) {
            this._items[i].draw();
        }

        this._needsDraw = false;
    }
542711
def draw(self):
        """"""
        self.screen.clear()

        x, y = 1, 1  # start point
        max_y, max_x = self.screen.getmaxyx()
        max_rows = max_y - y  # the max rows we can draw

        lines, current_line = self.get_lines()

        # calculate how many lines we should scroll, relative to the top
        scroll_top = getattr(self, 'scroll_top', 0)
        if current_line <= scroll_top:
            scroll_top = 0
        elif current_line - scroll_top > max_rows:
            scroll_top = current_line - max_rows
        self.scroll_top = scroll_top

        lines_to_draw = lines[scroll_top:scroll_top+max_rows]

        for line in lines_to_draw:
            if type(line) is tuple:
                self.screen.addnstr(y, x, line[0], max_x-2, line[1])
            else:
                self.screen.addnstr(y, x, line, max_x-2)
            y += 1

        self.screen.refresh()
920461
function drawCanvasReady() {
        $drawBoard.context = $drawBoard.getContext('2d');
        var context = $drawBoard.context;
        context.lineWidth = 3;
        //context.lineCap = 'square'; //'round';
        context.lineJoin = 'round'; //'bevel';
        context.strokeStyle = 'rgba(255,0,0,0.5)'; //"red";
    }
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()
684851
protected void onDraw(Effect shape, Canvas canvas, Paint paint) {
        shape.draw(canvas, paint);
    }
76518
function draw(renderer, text, x, y) {
         // allows to provide backward compatibility when
         // adding Bitmap Font to an object container
         if (typeof this.ancestor === "undefined") {
           // update cache
           this.setText(text); // force update bounds

           this.update(0); // save the previous global alpha value

           var _alpha = renderer.globalAlpha();

           renderer.setGlobalAlpha(_alpha * this.getOpacity());
         } else {
           // added directly to an object container
           x = this.pos.x;
           y = this.pos.y;
         }

         var strings = ("" + this._text).split("\n");

         var lX = x;
         var stringHeight = measureTextHeight(this);
         var maxWidth = 0;

         for (var i = 0; i < strings.length; i++) {
           x = lX;
           var string = me.utils.string.trimRight(strings[i]); // adjust x pos based on alignment value

           var stringWidth = measureTextWidth(this, string);

           switch (this.textAlign) {
             case "right":
               x -= stringWidth;
               break;

             case "center":
               x -= stringWidth * 0.5;
               break;

             default:
               break;
           } // adjust y pos based on alignment value


           switch (this.textBaseline) {
             case "middle":
               y -= stringHeight * 0.5;
               break;

             case "ideographic":
             case "alphabetic":
             case "bottom":
               y -= stringHeight;
               break;

             default:
               break;
           } // update initial position if required


           if (this.isDirty === true && typeof this.ancestor === "undefined") {
             if (i === 0) {
               this.pos.y = y;
             }

             if (maxWidth < stringWidth) {
               maxWidth = stringWidth;
               this.pos.x = x;
             }
           } // draw the string


           var lastGlyph = null;

           for (var c = 0, len = string.length; c < len; c++) {
             // calculate the char index
             var ch = string.charCodeAt(c);
             var glyph = this.fontData.glyphs[ch];
             var glyphWidth = glyph.width;
             var glyphHeight = glyph.height;
             var kerning = lastGlyph && lastGlyph.kerning ? lastGlyph.getKerning(ch) : 0; // draw it

             if (glyphWidth !== 0 && glyphHeight !== 0) {
               // some browser throw an exception when drawing a 0 width or height image
               renderer.drawImage(this.fontImage, glyph.x, glyph.y, glyphWidth, glyphHeight, x + glyph.xoffset, y + glyph.yoffset * this.fontScale.y, glyphWidth * this.fontScale.x, glyphHeight * this.fontScale.y);
             } // increment position


             x += (glyph.xadvance + kerning) * this.fontScale.x;
             lastGlyph = glyph;
           } // increment line


           y += stringHeight;
         }

         if (typeof this.ancestor === "undefined") {
           // restore the previous global alpha value
           renderer.setGlobalAlpha(_alpha);
         } // clear the dirty flag


         this.isDirty = false;
       }
166692
def makedraw(self):
        
        if self.draw == None:
            self.draw = imdw.Draw(self.pilimage)
957825
function(e) {
        if (!this._color) {
            return;
        }
        if (e.type === "DOM") {
            e.style.backgroundColor = this._color;
            e.style.lineHeight = 0;
        } else if (e.type === "canvas") {
            e.ctx.fillStyle = this._color;
            e.ctx.fillRect(e.pos._x, e.pos._y, e.pos._w, e.pos._h);
        } else if (e.type === "webgl") {
            e.program.draw(e, this);
        }
    }
871301
def draw(self):
        
        from calysto.display import display, clear_output
        canvas = self.render()
        clear_output(wait=True)
        display(canvas)