So far I have set the HTML canvas context in the tutorials shown , for example:
var canvas = document.getElementById("canvas"),
ctx = canvas.getContext("2d");
ctx.font = "15px calibri";
...
I was wondering, is it possible to set the canvas context by passing one of its methods into an object with the correct attributes? For instance:
var canvas = document.getElementById("canvas");
var context = {
font: "15px calibri",
...
);
canvas.setContext(context);
The reason for this is to create a custom canvas in angular. For example, mine controllerwill receive an item <canvas>. Method serviceB will call the return context object specified for the canvas.
The custom canvas must be converted to PNG and set as a iconmarker on Google Maps. A marker is added to cards in service:
addMarkerToMap: function(position, map, canvas) {
new google.maps.Marker({
position: position,
map: map,
icon: canvas.toDataURL("image/png")
});
}
canvas fucntion ( ) PNG icon.
EDIT:
, , (.. fillStyle), (.. beginPath()).
, ,