Skip to content

Commit

Permalink
Merge pull request #5 from ulikoehler/master
Browse files Browse the repository at this point in the history
Add README syntax highlighting (thanks @ulikoehler!)
  • Loading branch information
pbakaus committed Jul 15, 2013
2 parents 7937b3f + e4bb5ca commit 3ff0e6a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
__Domvas implements the missing piece that connects the DOM and Canvas__. It gives to the ability to take arbitrary DOM content and paint it to a Canvas of your choice.

## Usage
```js
var canvas = document.getElementById("test");
var context = canvas.getContext('2d');

var canvas = document.getElementById("test");
var context = canvas.getContext('2d');
domvas.toImage(document.getElementById("dom"), function() {
context.drawImage(this, 20, 20);
});
```

domvas.toImage(document.getElementById("dom"), function() {
context.drawImage(this, 20, 20);
});

## Syntax

domvas.toImage(domElement, readyCallback, width, height, left, top);
```js
domvas.toImage(domElement, readyCallback, width, height, left, top);
```
readyCallback's 'this' and first argument points to a valid, preloaded image node that you can simply draw to your canvas context.

## How it works
Expand All @@ -34,4 +36,4 @@ I have written about this technique in 2008 [when I brought CSS transforms to br

## Credits / License

©2012 Paul Bakaus. Licensed under MIT. Reach out on [Twitter](http://twitter.com/pbakaus)!
©2012 Paul Bakaus. Licensed under MIT. Reach out on [Twitter](http://twitter.com/pbakaus)!

0 comments on commit 3ff0e6a

Please sign in to comment.