console.snapshot/README.md
2013-06-30 01:52:30 +01:00

30 lines
1.0 KiB
Markdown

# console.snapshot( _canvas_ )
### Snapshot a canvas and output it to the console.
`console.snapshot` takes and inputted _<canvas&rt;_ element and outputs a snapshot of it into the console. It makes debugging the canvas a less dramatic task. See [this demo](http://dunxrion.github.io/console.snapshot). `console.snapshot` is a fork of the [`console.image`](http://github.com/dunxrion/console.image) and actually does something useful.
![The demo](http://i.imgur.com/IYLD8pz.png)
## Usage
### console.snapshot( _<canvas&rt;_ )
`console.snapshot` takes in a `HTMLCanvasElement`, base64 encodes it using `toDataURL` and then outputs it to the canvas using `canvas.image`.
```js
var canvas = document.createElement("canvas"),
ctx = canvas.getContext("2d");
// ...
//draw
// ...
console.snapshot(canvas);
```
### console.image( _<url&rt;_ )
`console.image` outputs and image from a url into the console. See [console.image](http://github.com/dunxrion/console.image).
```js
console.image("http://i.imgur.com/wWPQK.gif");
```
License: MIT