# Renderer

Module hilo/renderer/Renderer Requires hilo/core/Class, hilo/util/util Source Renderer.js
Renderer Renderer is the base class of renderer.

### Properties

| Property | Defined
--- | --- | ---
| canvas:Object The canvas of renderer. | Renderer
| renderType:String The render type of renderer, readonly. | Renderer
| stage:Object The stage of renderer, readonly. | Renderer

### Methods

| Method | Defined
--- | --- | ---
| Renderer(properties:Object) Constructor | Renderer
| clear(x:Number, y:Number, width:Number, height:Number) Clear the given region of canvas. | Renderer
| draw(target:View) Draw the visual object. | Renderer
| endDraw(target:View) The handling method after draw the visual object. | Renderer
| hide() Hide the visual object. | Renderer
| remove(target:View) Remove the visual object from canvas. | Renderer
| resize(width:Number, height:Number) Resize the renderer's canvas. | Renderer
| startDraw(target:View) Prepare for draw visual object. | Renderer
| transform() Transfrom the visual object. | Renderer

### Property Detail

canvas:Object
The canvas of renderer. It can be a dom element, such as a div element, or a canvas element. readonly.
renderType:String
The render type of renderer, readonly.
stage:Object
The stage of renderer, readonly.

### Constructor

Renderer(properties:Object)

parameters
properties:Object — The properties to create a renderer, contains all writeable props of this class.

### Method Detail

clear(x:Number, y:Number, width:Number, height:Number)
Clear the given region of canvas. The subclass need to implement it.

parameters
x:Number — The position on the x axis of the given region.
y:Number — The position on the y axis of the given region.
width:Number — The width of the given region.
height:Number — The height of the given region.

draw(target:View)
Draw the visual object. The subclass need to implement it.

parameters
target:View — The visual target to draw.

endDraw(target:View)
The handling method after draw the visual object. The subclass need to implement it.

parameters
target:View — The visual target to draw.

hide()
Hide the visual object. The subclass need to implement it.
remove(target:View)
Remove the visual object from canvas. Notice that it dosen't remove the object from stage. The subclass need to implement it.

parameters
target:View — The visual target to remove.

resize(width:Number, height:Number)
Resize the renderer's canvas.

parameters
width:Number — The width of renderer's canvas.
height:Number — The height of the renderer's canvas.

startDraw(target:View)
Prepare for draw visual object. The subclass need to implement it.

parameters
target:View — The visual target to draw.

transform()
Transfrom the visual object. The subclass need to implement it.