Rev | Line | |
---|
[483] | 1 | define([ |
---|
| 2 | "./_base", |
---|
| 3 | "./canvas"], |
---|
| 4 | function(gfx, canvas){ |
---|
| 5 | |
---|
| 6 | /*===== |
---|
| 7 | return { |
---|
| 8 | // summary: |
---|
| 9 | // A module that adds canvas-specific features to the gfx api. You should require this module |
---|
| 10 | // when your application specifically targets the HTML5 Canvas renderer. |
---|
| 11 | } |
---|
| 12 | =====*/ |
---|
| 13 | |
---|
| 14 | var ext = gfx.canvasext = {}; |
---|
| 15 | |
---|
| 16 | canvas.Surface.extend({ |
---|
| 17 | |
---|
| 18 | getImageData: function(rect){ |
---|
| 19 | // summary: |
---|
| 20 | // Returns the canvas pixel buffer. |
---|
| 21 | // rect: dojox/gfx.Rectangle |
---|
| 22 | // The canvas area. |
---|
| 23 | |
---|
| 24 | // flush pending renders queue, if any |
---|
| 25 | if("pendingRender" in this){ |
---|
| 26 | this._render(true); // force render even if there're pendingImages |
---|
| 27 | } |
---|
| 28 | return this.rawNode.getContext("2d").getImageData(rect.x, rect.y, rect.width, rect.height); |
---|
| 29 | }, |
---|
| 30 | |
---|
| 31 | getContext: function(){ |
---|
| 32 | // summary: |
---|
| 33 | // Returns the surface CanvasRenderingContext2D. |
---|
| 34 | return this.rawNode.getContext("2d"); |
---|
| 35 | } |
---|
| 36 | }); |
---|
| 37 | |
---|
| 38 | return ext; |
---|
| 39 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.