 
   draw: (drawable, quad) ->
     switch true
-      when quad not instanceof Love.Graphics.Quad then drawDrawable.apply(this, arguments)
-      when quad instanceof Love.Graphics.Quad then drawWithQuad.apply(this, arguments)
+      when quad not instanceof Love.Graphics.Quad then @drawDrawable.apply(this, arguments)
+      when quad instanceof Love.Graphics.Quad then @drawWithQuad.apply(this, arguments)
 
   line: (points...) ->
     if points.length == 1

    @element.setAttribute('height', @height)

  # INTERNAL
  drawDrawable = (drawable, x = 0, y = 0, r = 0, sx = 1, sy = sx, ox = 0, oy = 0, kx = 0, ky = 0) ->
    halfWidth = drawable.element.width / 2
    halfHeight = drawable.element.height / 2


    self.context.fillRect(0, 0, self.width, self.height)
    self.context.restore()

  getDimensions: =>
    [@getWidth(), @getHeight()]

  getHeight: =>
    @height

  getImageData: =>
    image_data = @context.getImageData(0, 0, @width, @height)
    new ImageData(image_data)

  getPixel: (self, x, y) ->
    data = self.context.getImageData(x, y, 1, 1).data
    [data[0], data[1], data[2], data[3]]

  getWidth: =>
    @width

  # TODO: wrapping also applies to textures and quads
  getWrap: (self) ->
