1 /**
  2  * Hilo
  3  * Copyright 2015 alibaba.com
  4  * Licensed under the MIT License
  5  */
  6 
  7 /**
  8  * @class Renderer Renderer is the base class of renderer.
  9  * @param {Object} properties The properties to create a renderer, contains all writeable props of this class.
 10  * @module hilo/renderer/Renderer
 11  * @requires hilo/core/Class
 12  * @requires hilo/util/util
 13  * @property {Object} canvas The canvas of renderer. It can be a dom element, such as a div element, or a canvas element. readonly.
 14  * @property {Object} stage The stage of renderer, readonly.
 15  * @property {String} renderType The render type of renderer, readonly.
 16  */
 17 var Renderer = Class.create(/** @lends Renderer.prototype */{
 18     constructor: function(properties){
 19         properties = properties || {};
 20         util.copy(this, properties, true);
 21     },
 22 
 23     renderType:null,
 24     canvas: null,
 25     stage: null,
 26     blendMode:'source-over',
 27 
 28     /**
 29      * Prepare for draw visual object. The subclass need to implement it.
 30      * @param {View} target The visual target to draw.
 31      */
 32     startDraw: function(target){ },
 33 
 34     /**
 35      * Draw the visual object. The subclass need to implement it.
 36      * @param {View} target The visual target to draw.
 37      */
 38     draw: function(target){ },
 39 
 40     /**
 41      * The handling method after draw the visual object. The subclass need to implement it.
 42      * @param {View} target The visual target to draw.
 43      */
 44     endDraw: function(target){ },
 45 
 46     /**
 47      * Transfrom the visual object. The subclass need to implement it.
 48      */
 49     transform: function(){ },
 50 
 51     /**
 52      * Hide the visual object. The subclass need to implement it.
 53      */
 54     hide: function(){ },
 55 
 56     /**
 57      * Remove the visual object from canvas. Notice that it dosen't remove the object from stage. The subclass need to implement it.
 58      * @param {View} target The visual target to remove.
 59      */
 60     remove: function(target){ },
 61 
 62     /**
 63      * Clear the given region of canvas. The subclass need to implement it.
 64      * @param {Number} x The position on the x axis of the given region.
 65      * @param {Number} y The position on the y axis of the given region.
 66      * @param {Number} width The width of the given region.
 67      * @param {Number} height The height of the given region.
 68      */
 69     clear: function(x, y, width, height){ },
 70 
 71     /**
 72      * Resize the renderer's canvas.
 73      * @param {Number} width The width of renderer's canvas.
 74      * @param {Number} height The height of the renderer's canvas.
 75      */
 76     resize: function(width, height){ }
 77 
 78 });