1.1.7 • Published 11 years ago

openvg-canvas v1.1.7

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

node-openvg-canvas

Canvas implementation on node-openvg

This module implements a HTML5 Canvas on OpenVG (node-openvg). It is targeted to the raspberry-pi. By using the OpenVG APIs on the Raspberry PI, all graphics code will run on the GPU with hardware acceleration.

This library aims for API compatibility with node-canvas where it applies / makes sense. While node-canvas is targeted to create images off screen, node-openvg-canvas is targeted to on screen usage, but not yet for user interaction.

Currently there are only plans to implement the 2d context. Implementing the 3d context (web gl) should be possible by mapping OpenGL/ES.

0. Installation

This module is targeted for node 0.8.x. Node >= 0.8.10 will compile out of the box on the raspberry.

Fetch the source:

git clone https://github.com/luismreis/node-openvg-canvas.git

Build the package:

cd node-openvg-canvas
npm install

To test:

export PATH=$PWD/bin:$PATH
examples/swissClock.js

1. Documentation

Canvas implementation status (by WHATWG Canvas IDL class/interface definition)

  • CanvasRenderingContext2D
    1. state - save/restore (done)
    2. matrix transformations: scale, transform, etc (done)
    3. compositing - alpha, composite operation (done)
    4. image smoothing (done)
    5. stroke/fill style
    6. gradients (done)
    7. patterns (to do)
    8. shadows (to do - after v. 1.0)
    9. clear/fill/stroke rect (done)
    10. beginPath, fill, stroke /default path/ (done)
    11. fill, stroke /custom path/ (to do)
    12. focus ring (no plan to implement)
    13. scrollPathIntoView (no plan to implement)
    14. clip/reset clip (to do)
    15. isPointInPath (to do - after v. 1.0 - help appreciated)
    16. fill/stroke/measure text (done)
    17. drawImage (done)
    18. hit regions (no plan to implement)
    19. create/get/put image data (done)
  • CanvasDrawingStyles
    1. drawing styles - line width, cap, join, miter limit (done)
    2. dashed lines (to do)
    3. text - font, textAlign, textBaseline (done)
  • CanvasPathMethods (only implemented for the context's currentDefaultPath)
    1. closePath() (done)
    2. moveTo, lineTo (done)
    3. quadraticCurveTo, bezierCurveTo (done - untested)
    4. arcTo (to do)
    5. rect (done)
    6. arc (done)
    7. ellipse (done - rotation parameter ignored)
  • CanvasGradient (done)
  • CanvasPattern (to do)
  • TextMetrics (done)
  • HitRegionOptions (no plan to implement)
  • ImageData (done)
  • Path (to do)

Differences from the HTML5 Canvas object / node-canvas

The HTML5 Canvas is used inside the browser runtime, so, its rendering is controlled automatically (and implicitly) by the browser.

node-canvas code explicitly calls toBuffer or similar functions to render images.

Code running on node-openvg-canvas must explicitly swap display buffers, to do so, either call vg.egl.swapBuffers from node-openvg or use the included requestAnimationFrame shim (for more information look at the clock examples) that does this after calling your paint (callback) function.

License

(The MIT License)

Copyright (c) 2012 Luis Reis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.1.7

11 years ago

1.1.6

11 years ago

1.1.5

11 years ago

1.1.4

11 years ago

1.1.3

11 years ago

1.1.2

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.0

11 years ago

0.2.0

11 years ago

0.1.1

12 years ago

0.1.0

12 years ago