code: @Override
  	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
  	    if (!component.isRendered()) {
  	        return;
  	    }
  		Canvas canvas = (Canvas) component;
  		ResponseWriter rw = context.getResponseWriter();
  		String clientId = canvas.getClientId();
  
  		rw.startElement("canvas", canvas);
  		Tooltip.generateTooltip(context, canvas, rw);
  
  //	    rw.writeAttribute("initial-drawing", canvas.getInitial-drawing(), "initial-drawing");
  	    rw.writeAttribute("id", clientId, "id");
  	    writeAttribute(rw, "style", canvas.getStyle(), "style");
  	    String styleClass = canvas.getStyleClass();
  	    if (null != styleClass)
  	    	styleClass += Responsive.getResponsiveStyleClass(canvas, false);
  	    else
  	    	styleClass = Responsive.getResponsiveStyleClass(canvas, false);
  		writeAttribute(rw, "class", styleClass, "class");
  	    writeAttribute(rw, "width", canvas.getWidth(), "width");
  	    writeAttribute(rw, "height", canvas.getHeight(), "height");
  		rw.endElement("canvas");
  		Tooltip.activateTooltips(context, canvas);
  		Drawing drawing = canvas.getDrawing();
  		if (null != drawing) {
  			String script = ((Drawing) drawing).getJavaScript();
  			rw.startElement("script", component);
  			rw.write("\nnew function(){\n");
  			rw.write("    var canvas=document.getElementById('" + clientId + "');\n");
  			rw.write("    var ctx = canvas.getContext('2d');\n");
  
  			rw.write(script);
  			rw.write("\n}();\n");
  			rw.endElement("script");
  		}
  	}
docs: This methods generates the HTML code of the current b:canvas.
  @param context the FacesContext.
  @param component the current b:canvas.
  @throws IOException thrown if something goes wrong when writing the HTML code.