├── .gitignore ├── README.md ├── bin └── node-canvas ├── binding.gyp ├── examples ├── arcTo.js ├── clipImage.js ├── clipping.js ├── clippingState.js ├── clock.js ├── color.js ├── doubleBuffering.js ├── drawImage.js ├── drawImageAlpha.js ├── ellipse.js ├── fonts.js ├── getImageData.js ├── globalAlpha.js ├── glyphs.js ├── gradients.js ├── imageSource.js ├── images │ ├── flurry.jpeg │ ├── grid.gif │ ├── grid.jpeg │ ├── grid.png │ ├── grid.pxm │ ├── grido2.png │ ├── grido4.png │ └── noisy_grid.png ├── lineDashOffset.js ├── lineDashState.js ├── pathObject.js ├── pathPrimitives.js ├── pathText.js ├── patterns.js ├── ray.js ├── screenshots │ ├── clipImage.png │ ├── clipping.png │ ├── clippingState.png │ ├── color.png │ ├── drawImage.png │ ├── drawImageAlpha.png │ ├── globalAlpha.png │ ├── imageSource_00.png │ ├── imageSource_01.png │ ├── imageSource_final.png │ ├── lineDashOffset.png │ ├── lineDashState.png │ ├── pathText.png │ └── shadows.png ├── shadows.js ├── shapes.js ├── spark.js ├── state.js ├── swissClock.js ├── textAlign.js ├── textDrawing.js ├── textSpeed.js └── util.js ├── lib ├── canvas.js ├── color.js ├── context.js ├── drawingStyle.js ├── gradient.js ├── image.js ├── matrix.js ├── path.js ├── pattern.js └── text │ ├── freetype.js │ ├── loading.js │ ├── rendering.js │ └── text.js ├── package.json ├── reference ├── arcTo.html ├── clipping.html ├── clippingState.html ├── ellipse.html ├── images │ ├── grido2.png │ ├── grido4.png │ └── noisy_grid.png ├── javascripts │ ├── arcTo.js │ └── requestAnimationFrame.js ├── lineDash.html ├── patterns.html ├── shadows.html └── stylesheets │ └── style.css ├── src ├── freeimage │ ├── freeimage.cc │ ├── freeimage.h │ ├── image.cc │ └── image.h ├── freetype.cc ├── freetype.h ├── util.cc ├── util.h └── v8_helpers.h └── tests ├── color.js └── image ├── convert-from-rgba-bits.js └── load-from-buffer.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | 4 | .lock-wscript 5 | 6 | core 7 | .gdbinit 8 | .gdb_history 9 | v8.log 10 | 11 | ._* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # node-openvg-canvas 2 | 3 | [](https://nodei.co/npm-dl/openvg-canvas/) [](https://nodei.co/npm-dl/openvg-canvas/) 4 | 5 | ## Canvas implementation on node-openvg 6 | 7 | This module implements a HTML5 Canvas on top of OpenVG (node-openvg). It is targeted to the raspberry-pi. 8 | By using the OpenVG APIs on the Raspberry PI, all graphics code will run on the GPU with hardware acceleration. 9 | 10 | This library aims for API compatibility with [node-canvas](https://github.com/learnboost/node-canvas) where it applies and makes sense. While node-canvas is targeted to create images off screen, node-openvg-canvas is targeted to main screen usage, but not yet for user interaction. 11 | 12 | Currently there are only plans to implement the 2d context. Implementing the 3d context (web gl) should be possible by mapping OpenGL/ES. 13 | 14 | ## 0. Installation 15 | 16 | This module has been tested on node 0.8, 0.10 and 0.11. Official node binaries for the 17 | raspberry pi can be found be clicking at "Other release files" link that accompanies every 18 | node release announcement, [example](http://nodejs.org/dist/v0.11.4/). 19 | 20 | ### Prerequisites 21 | 22 | node-openvg-canvas depends on freetype and freeimage. To install these libraries 23 | on the raspberry - assuming a raspbian distribution - use: 24 | 25 | sudo apt-get install libfreetype6 libfreetype6-dev libfreeimage3 libfreeimage-dev 26 | 27 | ### Source code install 28 | 29 | Fetch the source: 30 | 31 | git clone https://github.com/luismreis/node-openvg-canvas.git 32 | 33 | Build the package: 34 | 35 | cd node-openvg-canvas 36 | npm install 37 | 38 | To test: 39 | 40 | export PATH=$PWD/bin:$PATH 41 | examples/swissClock.js 42 | 43 | ### NPM / module install 44 | 45 | Run on your command line: 46 | 47 | npm install openvg-canvas --save 48 | 49 | ## 1. Documentation 50 | 51 | ### Reference 52 | 53 | * [WHATWG](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html) 54 | * [w3c](http://www.w3.org/TR/2dcontext/) 55 | 56 | ### Canvas implementation status 57 | 58 | The project now implements the full HTML 5 Canvas Level 1 specification, plus most of 59 | the non interactive features of Level 2. The current focus on the project for releases in the short term is performance. 60 | 61 | Items marked as "✘" are not planned for implementation. Some due to insufficient information (eg. focus ring), others because they don't make sense in this implementation (eg. scrollPathIntoView). 62 | 63 |
Object / Feature | Status | Notes |
---|---|---|
CanvasRenderingContext2D | ||
- state - save/restore | ✔ | |
- matrix transformations: scale, transform, etc | ✔ | |
- compositing - alpha, composite operation | ✔ | |
- image smoothing | ✔ | |
- stroke/fill style | ✔ | |
- solid colors | ✔ | |
- gradients | ✔ | |
- patterns | ✔ | (see below) |
- shadows | ✔ | |
- clear/fill/stroke rect | ✔ | |
- beginPath, paths / path methods, fill, stroke | ✔ | |
- focus ring | ✘ | |
- scrollPathIntoView | ✘ | |
- clipping region | ✔ | |
- isPointInPath | to do | Support planned. |
- fill/stroke text | ✔ | |
- measure text | ✔ | hanging and ideographic baselines not implemented. |
- drawImage | ✔ | |
- hit regions | ✘ | |
- create/get/put image data | ✔ | |
CanvasDrawingStyles | ||
- line caps/joins - line width, cap, join, miter limit | ✔ | |
- dashed lines | ✔ | |
- text - font, textAlign, textBaseline | ✔ | |
CanvasPathMethods | ✔ | |
- beginPath | ✔ | Also available on the Path object. |
- moveTo, lineTo | ✔ | |
- quadraticCurveTo, bezierCurveTo | ✔ | Untested |
- arcTo | ✔ | Implemented Canvas Level 2 (elliptical arcs) |
- rect | ✔ | |
- arc | ✔ | |
- ellipse | ✔ | |
CanvasGradient | ✔ | |
- addColorStop | ✔ | |
CanvasPattern | ✔ | OpenVG doesn't support one-directional patterns. For now only 'no-repeat' and 'repeat' work as expected. |
- setTransform | to do | Planned. |
TextMetrics | ✔ | |
HitRegionOptions | ✘ | |
ImageData | ✔ | |
Path | ✔ | (see CanvasPathMethods) |
- (constructor) | ✔ | SVG path constructor after v1.0 |
- addPath | ✔ | |
- addPathByStrokingPath | ✘ | |
- addText | ✔ | Position and Path variants |
- addPathByStrokingText | ✘ |