@
#.draw
@comp WebGL
@kind Method
@private

@sign public this .draw()

An internal method to draw the entity on the webgl canvas element. Rather then rendering directly, it writes relevent information into a buffer to allow batch rendering.
170812
function() {
        if (!this.ready) return;

        var pos = this.drawVars.pos;
        pos._x = this._x;
        pos._y = this._y;
        pos._w = this._w;
        pos._h = this._h;

        var coord = this.__coord || [0, 0, 0, 0];
        var co = this.drawVars.co;
        co.x = coord[0];
        co.y = coord[1];
        co.w = coord[2];
        co.h = coord[3];

        // Handle flipX, flipY
        // (Just swap the positions of e.g. x and x+w)
        if (this._flipX) {
            co.x = co.x + co.w;
            co.w = -co.w;
        }
        if (this._flipY) {
            co.y = co.y + co.h;
            co.h = -co.h;
        }

        //Draw entity
        var gl = this._drawContext;
        this.drawVars.gl = gl;
        var prog = (this.drawVars.program = this.program);

        // The program might need to refer to the current element's index
        prog.setCurrentEntity(this);

        // Write position; x, y, w, h
        prog.writeVector(
            "aPosition",
            this._x,
            this._y,
            this._x,
            this._y + this._h,
            this._x + this._w,
            this._y,
            this._x + this._w,
            this._y + this._h
        );

        // Write orientation
        prog.writeVector(
            "aOrientation",
            this._origin.x + this._x,
            this._origin.y + this._y,
            (this._rotation * Math.PI) / 180
        );

        // Write z, alpha
        prog.writeVector("aLayer", this._globalZ, this._alpha);

        // This should only need to handle *specific* attributes!
        this.trigger("Draw", this.drawVars);

        // Register the vertex groups to be drawn, referring to this entities position in the big buffer
        prog.addIndices(prog.ent_offset);

        return this;
    }
1234724
function() {
        var draw = OpenLayers.Tile.Image.prototype.shouldDraw.call(this);
        if(draw) {

            // this.url isn't set to the currect value yet, so we call getURL
            // on the layer and store the result in a local variable
            var url = this.layer.getURL(this.bounds);

            var usedIFrame = this.useIFrame;
            this.useIFrame = this.maxGetUrlLength !== null &&
                             !this.layer.async &&
                             url.length > this.maxGetUrlLength;

            var fromIFrame = usedIFrame && !this.useIFrame;
            var toIFrame = !usedIFrame && this.useIFrame;

            if(fromIFrame || toIFrame) {

                // Switching between GET (image) and POST (iframe).

                // We remove the imgDiv (really either an image or an iframe)
                // from the frame and set it to null to make sure initImage
                // will call getImage.

                if(this.imgDiv && this.imgDiv.parentNode === this.frame) {
                    this.frame.removeChild(this.imgDiv);
                }
                this.imgDiv = null;

                // And if we had an iframe we also remove the event pane.

                if(fromIFrame) {
                    this.frame.removeChild(this.frame.firstChild);
                }
            }
        }
        return OpenLayers.Tile.Image.prototype.draw.apply(this, arguments);
    }
1197066
function() {
        OpenLayers.Control.prototype.draw.apply(this, arguments);
        
        this.map.events.on({
            'changebaselayer': this.updateAttribution,
            'changelayer': this.updateAttribution,
            'addlayer': this.updateAttribution,
            'removelayer': this.updateAttribution,
            scope: this
        });
        this.updateAttribution();
        
        return this.div;    
    }
524376
function draw(renderer, container) {
         var translateX = this.pos.x + this.offset.x;
         var translateY = this.pos.y + this.offset.y; // translate the world coordinates by default to screen coordinates

         container.currentTransform.translate(-translateX, -translateY); // clip to camera bounds

         renderer.clipRect(0, 0, this.width, this.height);
         this.preDraw(renderer);
         container.preDraw(renderer); // draw all objects,
         // specifying the viewport as the rectangle area to redraw

         container.draw(renderer, this); // draw the viewport/camera effects

         this.drawFX(renderer);
         container.postDraw(renderer);
         this.postDraw(renderer); // translate the world coordinates by default to screen coordinates

         container.currentTransform.translate(translateX, translateY);
       }
516892
@Override
    public void draw(Canvas canvas) {
        Barcode barcode = mBarcode;
        if (barcode == null) {
            return;
        }

        // Draws the bounding box around the barcode.
        RectF rect = getViewBoundingBox(barcode);

        canvas.drawRect(rect, mOverlayPaint);

        /**
         * Draw the top left corner
         */
        canvas.drawLine(rect.left, rect.top, rect.left + CORNER_WIDTH, rect.top, mRectPaint);
        canvas.drawLine(rect.left, rect.top, rect.left, rect.top + CORNER_WIDTH, mRectPaint);

        /**
         * Draw the bottom left corner
         */
        canvas.drawLine(rect.left, rect.bottom, rect.left, rect.bottom - CORNER_WIDTH, mRectPaint);
        canvas.drawLine(rect.left, rect.bottom, rect.left + CORNER_WIDTH, rect.bottom, mRectPaint);

        /**
         * Draw the top right corner
         */
        canvas.drawLine(rect.right, rect.top, rect.right - CORNER_WIDTH, rect.top, mRectPaint);
        canvas.drawLine(rect.right, rect.top, rect.right, rect.top + CORNER_WIDTH, mRectPaint);

        /**
         * Draw the bottom right corner
         */
        canvas.drawLine(rect.right, rect.bottom, rect.right - CORNER_WIDTH, rect.bottom, mRectPaint);
        canvas.drawLine(rect.right, rect.bottom, rect.right, rect.bottom - CORNER_WIDTH, mRectPaint);
    }
50676
public function draw() {
        $size = $this->barcode->getDimension(0, 0);
        $this->w = max(1, $size[0]);
        $this->h = max(1, $size[1]);
        $this->init();
        $this->barcode->draw($this->im);
    }
728465
function() {
        OpenLayers.Control.prototype.draw.apply(this, arguments);
        this.next.draw();
        this.previous.draw();
    }
954807
function() {
        OpenLayers.Control.prototype.draw.apply(this, arguments);
        if (!this.eTop) {
            // stick in the top bar
            this.eTop = document.createElement("div");
            this.eTop.className = this.displayClass + "Top";
            var theLen = this.topInUnits.length;
            this.div.appendChild(this.eTop);
            if((this.topOutUnits == "") || (this.topInUnits == "")) {
                this.eTop.style.visibility = "hidden";
            } else {
                this.eTop.style.visibility = "visible";
            }

            // and the bottom bar
            this.eBottom = document.createElement("div");
            this.eBottom.className = this.displayClass + "Bottom";
            this.div.appendChild(this.eBottom);
            if((this.bottomOutUnits == "") || (this.bottomInUnits == "")) {
                this.eBottom.style.visibility = "hidden";
            } else {
                this.eBottom.style.visibility = "visible";
            }
        }
        this.map.events.register('moveend', this, this.update);
        this.update();
        return this.div;
    }
830826
void draw(GLShader shader, InternalTransform xform, int tint,
            float dx, float dy, float dw, float dh, float sx, float sy, float sw, float sh) {
    float texWidth = width(), texHeight = height();
    drawImpl(shader, xform, ensureTexture(), tint, dx, dy, dw, dh,
             sx / texWidth, sy / texHeight, (sx + sw) / texWidth, (sy + sh) / texHeight);
  }
798973
@Override
    public void draw(GraphicContext graphicContext) {
        graphicContext.fillColor(this.displayModel.getBackgroundColor());

        // Swap bitmaps before the Canvas.drawBitmap to prevent flickering as much as possible
        swapBitmaps();

        if (this.odBitmap != null) {
            graphicContext.drawBitmap(this.odBitmap, this.matrix);
        }
    }
1166320
@Override
    public void draw(Canvas canvas) {
        drawSpacings(canvas);
        drawBaselineGrid(canvas);
        drawKeylines(canvas);
    }
1257928
@Override
	public void draw(float x,float y,float width,float height) {
		init();
		draw(x,y,width,height,Color.white);
	}
69394
function Creator(view) {
    var self = this;
    var dragging = false;

    this.node = null;
    this.lineColor = null;

    var $wrapper = $("<div/>", {
      id : "creator-wrapper"
    }).bind("remove", function(e) {
      // detach the creator when some removed the node or opened a new map
      self.detach();
      // and avoid removing from DOM
      e.stopImmediatePropagation();

      console.debug("creator detached.");
      return false;
    });

    // red dot creator element
    var $nub = $("<div/>", {
      id : "creator-nub"
    }).appendTo($wrapper);

    var $fakeNode = $("<div/>", {
      id : "creator-fakenode"
    }).appendTo($nub);

    // canvas used by the creator tool to draw new lines
    var $canvas = $("<canvas/>", {
      id : "creator-canvas",
      "class" : "line-canvas"
    }).hide().appendTo($wrapper);

    // make it draggable
    $wrapper.draggable({
      revert : true,
      revertDuration : 0,
      start : function() {
        dragging = true;
        // show creator canvas
        $canvas.show();
        if (self.dragStarted) {
          self.lineColor = self.dragStarted(self.node);
        }
      },
      drag : function(e, ui) {
        // update creator canvas
        var offsetX = ui.position.left / view.zoomFactor;
        var offsetY = ui.position.top / view.zoomFactor;

        // set depth+1 because we are drawing the canvas for the child
        var $node = $getNode(self.node);
        drawLineCanvas($canvas, self.depth + 1, offsetX, offsetY,
            $fakeNode, $node, self.lineColor);
      },
      stop : function(e, ui) {
        dragging = false;
        // remove creator canvas, gets replaced by real canvas
        $canvas.hide();
        if (self.dragStopped) {
          var $wp = $wrapper.position();
          var $wpLeft = $wp.left / view.zoomFactor;
          var $wpTop = $wp.top / view.zoomFactor;
          var nubLeft = ui.position.left / view.zoomFactor;
          var nubTop = ui.position.top / view.zoomFactor;

          var distance = mindmaps.Util.distance($wpLeft - nubLeft,
              $wpTop - nubTop);
          self.dragStopped(self.node, nubLeft, nubTop, distance);
        }

        // remove any positioning that the draggable might have caused
        $wrapper.css({
          left : "",
          top : ""
        });
      }
    });

    /**
     * Attaches the tool to a node.
     * 
     * @param {mindmaps.Node} node
     */
    this.attachToNode = function(node) {
      if (this.node === node) {
        return;
      }
      this.node = node;

      // position the nub correctly
      $wrapper.removeClass("left right");
      if (node.offset.x > 0) {
        $wrapper.addClass("right");
      } else if (node.offset.x < 0) {
        $wrapper.addClass("left");
      }

      // set border on our fake node for correct line drawing
      this.depth = node.getDepth();
      var w = view.getLineWidth(this.depth + 1);
      $fakeNode.css("border-bottom-width", w);

      var $node = $getNode(node);
      $wrapper.appendTo($node);
    };

    /**
     * Removes the tool from the current node.
     */
    this.detach = function() {
      $wrapper.detach();
      this.node = null;
    };

    /**
     * Returns whether the tool is currently in use being dragged.
     * 
     * @returns {Boolean}
     */
    this.isDragging = function() {
      return dragging;
    };
  }
647489
function () {
      var el = this.el;
      var data = this.data;

      var quad = this.quad = document.createElement('a-entity');
      var self = this;

      quad.setAttribute('rotation', data.rotation);
      quad.setAttribute('text', {width: .25, color: '#fff', value: data.text, align: 'center'});
      el.appendChild(quad);

      // Line
      var material = this.material = new THREE.LineBasicMaterial({color: data.lineColor, opacity: data.opacity, transparent: data.opacity < 1});
      var geometry = this.geometry = new THREE.BufferGeometry();
      geometry.addAttribute('position', new THREE.BufferAttribute(new Float32Array(2 * 3), 3));

      this.line = new THREE.Line(geometry, material);
      this.el.setObject3D('tooltip-line', this.line);

    }
305766
function drawChart(canvas, data) {
        var ctx = canvas.getContext('2d'),
            color = 'rgba(0, 0, 0, 0.75)',
            height = canvas.height - 2,
            width = canvas.width,
            total = data.length,
            max = Math.max.apply(Math, data),
            xstep = 1,
            ystep = max / height,
            x = 0,
            y = height - data[0] / ystep;

        ctx.clearRect(0, 0, width, height);
        ctx.beginPath();
        ctx.strokeStyle = color;
        ctx.moveTo(x, y);

        for (var i = 1; i < total; i++) {
            x += xstep;
            y = height - data[i] / ystep + 1;
            ctx.moveTo(x, height);
            ctx.lineTo(x, y);
        }

        ctx.stroke();
    }
529586
def draw(svg, coords, options={})
      
      # Include options provided when the object was created
      options.merge!(@options)
      
      stroke_width = (options[:relativestroke]) ? relative(options[:stroke_width]) : options[:stroke_width]
      style = (options[:style]) ? options[:style] : ''
      
      if options[:shadow]
        svg.g(:class => 'shadow', :transform => "translate(#{relative(0.5)}, #{relative(0.5)})") {
          svg.polyline( :points => stringify_coords(coords).join(' '), :fill => 'transparent', 
                        :stroke => 'black', 'stroke-width' => stroke_width, 
                        :style => 'fill-opacity: 0; stroke-opacity: 0.35' )
          
          if options[:dots]
            coords.each { |coord| svg.circle( :cx => coord.first, :cy => coord.last + relative(0.9), :r => stroke_width, 
                                              :style => "stroke-width: #{stroke_width}; stroke: black; opacity: 0.35;" ) }
          end
        }
      end
    

      svg.polyline( :points => stringify_coords(coords).join(' '), :fill => 'none', :stroke => @color.to_s, 
                    'stroke-width' => stroke_width, :style => style  )
      
      if options[:dots]
        coords.each { |coord| svg.circle( :cx => coord.first, :cy => coord.last, :r => stroke_width, 
                                          :style => "stroke-width: #{stroke_width}; stroke: #{color.to_s}; fill: #{color.to_s}" ) }
      end
      
    end
263507
@Override
    public void draw() {
        if (googleRenderer == null)  {
            getPresenter().showError(new ClientRuntimeError("Google renderer not set"));
        }
        else if (!getPresenter().isDrawn())  {
            List<Displayer> displayerList = new ArrayList<Displayer>();
            displayerList.add(getPresenter());
            googleRenderer.draw(displayerList);
        }
    }