-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
210 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
= 0.0.1 | ||
* Initial | ||
= 1.0.0 | ||
* Initial Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# How to Contribute | ||
|
||
Yay, you're interested in helping this thing suck less. Good for you! | ||
|
||
Some things you should be familiar with before getting started | ||
|
||
- Unit testing (with [QUnit](http://qunitjs.com)) | ||
- [Grunt](http://gruntjs.org) (available via `npm install -g grunt-cli`) | ||
- [Node/NPM](https://npmjs.org/) (available via homebrew) | ||
|
||
## Project Layout | ||
|
||
- `src/` - Coffeescript Source files | ||
- `dist/` - Compiled, Concatinated, and Minified | ||
- `test/` - Unit Testing Resources | ||
|
||
|
||
## Development | ||
|
||
Once you have NPM and Grunt installed, clone the repository and install all dependancies | ||
|
||
git clone git@.....hidpi-canvas-polyfill.git | ||
cd hidpi-canvas-polyfill | ||
npm install | ||
|
||
Then to build a distribution run this grunt task | ||
|
||
grunt dist | ||
|
||
This will generate the compiled (and minified) sourc in your `dist/` directory | ||
along with a distributable zip archive. | ||
|
||
Any time you change any of the `src/**/*.js` files you'll | ||
need to re-run this command. | ||
|
||
You can also use | ||
|
||
grunt watch | ||
|
||
to automatically reconcat the unminified file everytime you | ||
change any of the `src/**/*.js` files. | ||
|
||
## Testing | ||
|
||
### Writing Tests | ||
|
||
The `test/` directory mirrors the `src/` directory for test organization, make | ||
sure to organize and produce tests that fit the patterns present. | ||
|
||
### Running Tests | ||
|
||
grunt test | ||
|
||
## On Contribution | ||
|
||
### Be a Chameleon | ||
|
||
Try your best to follow the present code formatting and patterns in place. | ||
|
||
### Pull Requests | ||
|
||
Good Pull Requests include: | ||
|
||
- A clear explaination of the problem (or enhancement) | ||
- Clean commit history (squash where it makes sense) | ||
- Relevant Tests (either updated and/or new) | ||
|
||
# TODO | ||
|
||
A few things it currently lacks that I'd like to see improved | ||
|
||
- Better touch support | ||
- Responsive interactivity | ||
- Better handling of a large number of "bubbles" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,57 @@ | ||
hidpi-canvas | ||
=========== | ||
# HiDPI Canvas Polyfill | ||
|
||
This is a drop-in polyfill to scale canvas appropriately to maintain sharpness | ||
in browsers that currently do not provide the appropriately scaled backing | ||
store to do this automatically. | ||
|
||
As of this writing Safari is the only browser that accounts for this. | ||
|
||
The goal of this drop-in is to make this behavior consistent accross all browsers, | ||
without having to modify any of your canvas code. | ||
|
||
## Scope | ||
|
||
Currently this plugin handles most general cross browser drawing functions, but | ||
feel free to send Pull Requests as you find functions you need supported. | ||
|
||
If the function simply needs all or some of it's arguments multiplied by the ratio, | ||
it should simply require you to add it to the `ratioArgs` object, following the proper | ||
pattern. | ||
|
||
It currently leaves images alone, so to retinize images on your canvas, simply | ||
duplicate the getPixelRatio function in your code and divide your image dimensions | ||
by the provided ratio. | ||
|
||
```js | ||
var getPixelRatio = function(context) { | ||
var backingStore = context.backingStorePixelRatio || | ||
context.webkitBackingtorePixelRatio || | ||
context.mozBackingStorePixelRatio || | ||
context.msBackingStorePixelRatio || | ||
context.oBackingStorePixelRatio || | ||
context.backingStorePixelRatio || 1; | ||
|
||
return (window.devicePixelRatio || 1) / backingStore; | ||
}; | ||
``` | ||
|
||
## Usage | ||
|
||
To use this module, simply include it before any of your canvas code | ||
|
||
```html | ||
... | ||
<script src=".../hidpi-canvas.min.js"></script> | ||
<script src=".../your-canvas-stuff.js"></script> | ||
... | ||
``` | ||
|
||
## TODO | ||
|
||
- More Complete context function converage | ||
- Figure out how to write tests | ||
|
||
## Development | ||
|
||
See [CONTRIBUTING.md](https://github.com/jondavidjohn/hidpi-canvas-polyfill/blob/develop/CONTRIBUTING.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters