1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00

Add Canvas Render.

This commit is contained in:
Gunther Brunner 2014-02-19 23:55:08 +09:00
parent 168590a1b7
commit aa28801e87
4 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,16 @@
function CanvasRender(options, canvasElement) {
this.options = options
this.context = canvasElement.getContext('2d')
}
CanvasRender.prototype.draw = function (image) {
this.context.drawImage(image, 0, 0)
}
CanvasRender.prototype.clear = function () {
var width = 300
var height = 300
ctx.clearRect(0, 0, width, height)
}
module.exports = CanvasRender

View file

@ -0,0 +1,18 @@
var canvasRender = require('./canvas')
var webGLRender = require('./webgl')
var canvasElement;
function ImageRender(options) {
this.options = options
this.render = new canvasRender();
}
ImageRender.prototype.draw = function (image) {
this.render.draw(image)
}
ImageRender.prototype.clear = function () {
this.render.clear()
}
module.exports = ImageRender

View file

@ -0,0 +1,15 @@
// Based on http://jsperf.com/canvas-drawimage-vs-webgl-drawarrays
function WebGLRender(options) {
this.options = options
}
WebGLRender.prototype.draw = function (image) {
}
WebGLRender.prototype.clear = function () {
}
module.exports = WebGLRender

View file

@ -1,3 +1,5 @@
var imageRender = require('./image-render')
module.exports = function DeviceScreenDirective($document, ScalingService, $rootScope) { module.exports = function DeviceScreenDirective($document, ScalingService, $rootScope) {
return { return {
restrict: 'E', restrict: 'E',