Method: draw
Check that a tile should be drawn, and draw it.

Returns:
{Boolean} Was a tile drawn? Or null if a beforedraw listener returned
false.
174755
function() {
        var shouldDraw = OpenLayers.Tile.prototype.draw.apply(this, arguments);
        if (shouldDraw) {
            // The layer's reproject option is deprecated.
            if (this.layer != this.layer.map.baseLayer && this.layer.reproject) {
                // getBoundsFromBaseLayer is defined in deprecated.js.
                this.bounds = this.getBoundsFromBaseLayer(this.position);
            }
            if (this.isLoading) {
                //if we're already loading, send 'reload' instead of 'loadstart'.
                this._loadEvent = "reload";
            } else {
                this.isLoading = true;
                this._loadEvent = "loadstart";
            }
            this.renderTile();
            this.positionTile();
        } else if (shouldDraw === false) {
            this.unload();
        }
        return shouldDraw;
    }
1268977
@Override
	protected void onDraw(Canvas canvas) {

		if (adaptedImage != null)
			canvas.drawBitmap(adaptedImage, 0, 0, paint);

	}
824009
function(){
		var pos = this.getpos(0);
		if(this.prevPos.equals(pos)){ return;}

		var cell = this.prevPos.getc();
		if(!cell.isnull){
			if(cell.qnum!==-1){
				var dir = this.prevPos.getdir(pos,2);
				if(dir!==cell.NDIR){
					cell.setQdir(cell.qdir!==dir?dir:0);
					cell.draw();
				}
			}
		}
		this.prevPos = pos;
	}
217018
function() {
        OpenLayers.Control.prototype.draw.apply(this, arguments);
          
        if (!this.element && !this.anchor) {
            this.element = document.createElement("a");
            this.element.innerHTML = OpenLayers.i18n("Permalink");
            this.element.href="";
            this.div.appendChild(this.element);
        }
        this.map.events.on({
            'moveend': this.updateLink,
            'changelayer': this.updateLink,
            'changebaselayer': this.updateLink,
            scope: this
        });
        
        // Make it so there is at least a link even though the map may not have
        // moved yet.
        this.updateLink();
        
        return this.div;
    }
45106
function (renderer, dx, dy, tmxTile) {

            // check if any transformation is required
            if (tmxTile.flipped) {
                renderer.save();
                // apply the tile current transform
                renderer.translate(dx, dy);
                renderer.transform(tmxTile.currentTransform);
                // reset both values as managed through transform();
                dx = dy = 0;
            }

            // check if the tile has an associated image
            if (this.isCollection === true) {
                // draw the tile
                renderer.drawImage(
                    this.imageCollection[tmxTile.tileId],
                    0, 0,
                    tmxTile.width, tmxTile.height,
                    dx, dy,
                    tmxTile.width, tmxTile.height
                );
            } else {
                // use the tileset texture
                var offset = this.atlas[this.getViewTileId(tmxTile.tileId)].offset;
                // draw the tile
                renderer.drawImage(
                    this.image,
                    offset.x, offset.y,
                    this.tilewidth, this.tileheight,
                    dx, dy,
                    this.tilewidth + renderer.uvOffset, this.tileheight + renderer.uvOffset
                );
            }

            if (tmxTile.flipped)  {
                // restore the context to the previous state
                renderer.restore();
            }
        }
530315
def draw(self):
        
        if not self.visible:
            return

        if self.isEnabled:
        
            # Draw the dragger's current appearance to the window.
            if self.dragging:
                self.window.blit(self.surfaceDown, self.rect)
            else:  # mouse is up
                if self.mouseOver:
                    self.window.blit(self.surfaceOver, self.rect)
                else:
                    self.window.blit(self.surfaceUp, self.rect)
        else:
            self.window.blit(self.surfaceDisabled, self.rect)
698238
def draw(self, mode, selection):
        
        if not self._linked:
            raise RuntimeError('Cannot draw program if code has not been set')
        # Init
        gl.check_error('Check before draw')
        mode = as_enum(mode)
        # Draw
        if len(selection) == 3:
            # Selection based on indices
            id_, gtype, count = selection
            if count:
                self._pre_draw()
                ibuf = self._parser.get_object(id_)
                ibuf.activate()
                gl.glDrawElements(mode, count, as_enum(gtype), None)
                ibuf.deactivate()
        else:
            # Selection based on start and count
            first, count = selection
            if count:
                self._pre_draw()
                gl.glDrawArrays(mode, first, count)
        # Wrap up
        gl.check_error('Check after draw')
        self._post_draw()
671785
function (renderer, rect) {
            // use the offscreen canvas
            if (this.preRender) {
                var width = Math.min(rect.width, this.width);
                var height = Math.min(rect.height, this.height);

                // draw using the cached canvas
                renderer.drawImage(
                    this.canvasRenderer.getCanvas(),
                    rect.pos.x, rect.pos.y, // sx,sy
                    width, height,          // sw,sh
                    rect.pos.x, rect.pos.y, // dx,dy
                    width, height           // dw,dh
                );
            }
            // dynamically render the layer
            else {
                // draw the layer
                this.renderer.drawTileLayer(renderer, this, rect);
            }
        }
558680
function isRectLayer(layer) {
	var method = layer._method;
	return (method === $.fn.drawRect || method === $.fn.drawEllipse || method === $.fn.drawImage);
}
510822
def drawForeground(self, painter, rect):
        
        chart = self.chart()
        chart._drawForeground(self, painter, rect)
1016519
function() {
        OpenLayers.Control.prototype.draw.apply(this, arguments);

        if (!this.element) {
            this.div.left = "";
            this.div.top = "";
            this.element = this.div;
        }

        return this.div;
    }
711335
function (renderer, rect) {
            var renderable = this.renderable;
            if (renderable instanceof me.Renderable) {
                // predraw (apply transforms)
                renderable.preDraw(renderer);

                // draw the object
                renderable.draw(renderer, rect);

                // postdraw (clean-up);
                renderable.postDraw(renderer);
            }
        }
1073152
function(pixel, drawing) {
        if(!this.line) {
            this.createFeature(pixel);
        }
        var lonlat = this.layer.getLonLatFromViewPortPx(pixel); 
        this.point.geometry.x = lonlat.lon;
        this.point.geometry.y = lonlat.lat;
        this.callback("modify", [this.point.geometry, this.getSketch(), drawing]);
        this.point.geometry.clearBounds();
        this.drawFeature();
    }
434286
def draw_tile(x = 0, y = 0, opts = {})

      opts[:canvas] ||= @canvas
      opts[:sx] ||= 0
      opts[:sy] ||= 0
      opts[:swidth] ||= width - opts[:sx]
      opts[:sheight] ||= height - opts[:sy]
      opts[:dwidth] ||= opts[:swidth]
      opts[:dheight] ||= opts[:sheight]

      %x{
        #{opts[:canvas].context}.drawImage(
          #{@img},
          #{opts[:sx]},
          #{opts[:sy]},
          #{opts[:swidth]},
          #{opts[:sheight]},
          #{x},
          #{y},
          #{opts[:dwidth]},
          #{opts[:dheight]}
        );
      }
    end
847511
def drawForeground(self, painter, rect):
        
        gantt  = self.ganttWidget()
        header = gantt.treeWidget().header()
        width  = self.sceneRect().width()
        height = header.height()
        
        for tile_rect, tile in self._tiles:
            painter.drawPixmap(tile_rect.x(), rect.top(), tile)
        
        palette = self.palette()
        textColor = palette.color(palette.Button).darker(125)
        painter.setPen(textColor)
        painter.drawLine(0, rect.top() + height, width, rect.top() + height)
951879
function() {
        if (!Crafty.DebugCanvas.context) {
            //check if canvas is supported
            if (!Crafty.support.canvas) {
                Crafty.trigger("NoCanvas");
                Crafty.stop();
                return;
            }

            //create an empty canvas element
            var c;
            c = document.createElement("canvas");
            c.width = Crafty.viewport.width;
            c.height = Crafty.viewport.height;
            c.style.position = "absolute";
            c.style.left = "0px";
            c.style.top = "0px";
            c.id = "debug-canvas";
            // The debug canvas should be on the very top; the highest a regular zindex can get is ~10000
            c.style.zIndex = 100000;

            Crafty.stage.elem.appendChild(c);
            Crafty.DebugCanvas.context = c.getContext("2d");
            Crafty.DebugCanvas._canvas = c;
        }
        //Bind rendering of canvas context (see drawing.js)
        Crafty.unbind("RenderScene", Crafty.DebugCanvas.renderScene);
        Crafty.bind("RenderScene", Crafty.DebugCanvas.renderScene);
    }
1061301
private BufferedImage drawTile(int tileWidth, int tileHeight, String text) {

		// Create the image and graphics
		BufferedImage image = new BufferedImage(tileWidth, tileHeight,
				BufferedImage.TYPE_INT_ARGB);
		Graphics2D graphics = image.createGraphics();
		graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);

		// Draw the tile fill paint
		if (tileFillColor != null) {
			graphics.setColor(tileFillColor);
			graphics.fillRect(0, 0, tileWidth, tileHeight);
		}

		// Draw the tile border
		if (tileBorderColor != null) {
			graphics.setColor(tileBorderColor);
			graphics.setStroke(new BasicStroke(tileBorderStrokeWidth));
			graphics.drawRect(0, 0, tileWidth, tileHeight);
		}

		// Determine the text bounds
		graphics.setFont(new Font(textFont, Font.PLAIN, textSize));
		FontMetrics fontMetrics = graphics.getFontMetrics();
		int textWidth = fontMetrics.stringWidth(text);
		int textHeight = fontMetrics.getAscent();

		// Determine the center of the tile
		int centerX = (int) (image.getWidth() / 2.0f);
		int centerY = (int) (image.getHeight() / 2.0f);

		// Draw the circle
		if (circleColor != null || circleFillColor != null) {
			int diameter = Math.max(textWidth, textHeight);
			float radius = diameter / 2.0f;
			radius = radius + (diameter * circlePaddingPercentage);
			int paddedDiameter = Math.round(radius * 2);

			int circleX = Math.round(centerX - radius);
			int circleY = Math.round(centerY - radius);

			// Draw the filled circle
			if (circleFillColor != null) {
				graphics.setColor(circleFillColor);
				graphics.setStroke(new BasicStroke(circleStrokeWidth));
				graphics.fillOval(circleX, circleY, paddedDiameter,
						paddedDiameter);
			}

			// Draw the circle
			if (circleColor != null) {
				graphics.setColor(circleColor);
				graphics.setStroke(new BasicStroke(circleStrokeWidth));
				graphics.drawOval(circleX, circleY, paddedDiameter,
						paddedDiameter);
			}

		}

		// Draw the text
		float textX = centerX - (textWidth / 2.0f);
		float textY = centerY + (textHeight / 2.0f);
		graphics.setColor(textColor);
		graphics.drawString(text, textX, textY);

		return image;
	}