Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created March 28, 2011 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewxhill/890806 to your computer and use it in GitHub Desktop.
Save andrewxhill/890806 to your computer and use it in GitHub Desktop.
canvas marker
renderMarkers: function(w,h,error){
var cnvs = $("<canvas width="+w+" height="+h+">");
var ctx = cnvs[0].getContext("2d");
ctx.drawImage(this.pmBackground, 0, 0, w, h);
if (this.type){
ctx.drawImage(this.pmType, 0, 0, w, h);
}
if (error){
ctx.drawImage(this.pmError, 0, 0, w, h);
}
ctx.drawImage(this.pmForeground, 0, 0, w, h);
var dataURL = cnvs[0].toDataURL("image/png");
return dataURL;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment