Details
-
Epic
-
Resolution: Done
-
P2: Important
-
None
-
None
Description
It should be possible to procedurally render certain types of graphics, such as graphs, from QML. If possible, the API should be similar to the HTML5 Canvas API to help developers familiar with that migrate.
Some preliminary work has been done here:
http://qt.gitorious.org/qt-labs/qmlcanvas
http://bugreports.qt.nokia.com/browse/QTCOMPONENTS-143
Ideally this would be extended to:
- Implement the complete HTML5 context2d API (http://dev.w3.org/html5/canvas-api/canvas-2d-api.html, http://dev.w3.org/html5/2dcontext/)
- Support tiled rendering so that the element can be "infinitely large".
- Support threaded rendering for non-blocking drawing (offscreen canvas? http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-February/025259.html)
Implementation Backlog
Add new QSGCanvasItem classAdd thread rendering support to QSGCanvasItemAdd tiled rendering support to QSGCanvasItemAdd asynchronous image loading support to QSGCanvasItemAdd QSGContext2DNode for scengraph canvas node managementAdd QSGContext2DTexture/QSGContext2DImageTexture/QSGContext2DFBOTexture/ canvas item texture managementAdd QSGContext2DTile for tiled canvas painting
Context2D APIQSGContext2D class for HTML5 context2d compatible API implementationAdd state management API (save, restore, reset) to QSGContext2DAdd transformation API (scale, rotate, translate, transform, shear) to QSGContext2DAdd stroke/fill style APIs (colors, gradients, patterns) to QSGContext2DAdd line style APIs (line width, cap, join. miterlimit) to QSGContext2DAdd shadow APIs(offsetX, offsetY, shadowColor, shadowBlur) to QSGContext2DAdd path APIs(rects, begin/close Path, moveTo, lineTo, arc/arcTo, quadratic/bezierCurveTo, fill/stroke/clip) to QSGContext2DAdd additional path APIs(ellipse, roundedrect, text path etc) to QSGContext2DAdd filter APIs(mirror, grayscale, threshold, mono, blur, invert, brightness, opaque, convolute, etc) to QSGContext2DAdd text APIs(font, strokeText, fillText, text measurement, text align/baseline) to QSGContext2DAdd drawimage APIs to QSGContext2DAdd pixel operation APIs (create/get/put image data, fast pixel access by V8 indexed array getter/setter) to QSGContext2D
Expose context2d APIs to V8 engineAdd QSGContext2DCommandBuffer for painting command streaming
DocumentationsDemos&Examples- Tests
Unit testsTest on device- Performance tuning on device