Binds a Canvas Immediate API to a canvas context, to allow drawing geometries to the context's canvas.
The units for geometry coordinates are css pixels relative to the top left corner of the canvas element.
var canvas = document.createElement('canvas');var render = ol.render.toContext(canvas.getContext('2d'), { size: [100, 100] });render.setFillStrokeStyle(new ol.style.Fill({ color: blue }));render.drawPolygon( new ol.geom.Polygon([[[0, 0], [100, 100], [100, 0], [0, 0]]])); Copy
var canvas = document.createElement('canvas');var render = ol.render.toContext(canvas.getContext('2d'), { size: [100, 100] });render.setFillStrokeStyle(new ol.style.Fill({ color: blue }));render.drawPolygon( new ol.geom.Polygon([[[0, 0], [100, 100], [100, 0], [0, 0]]]));
Canvas context.
Optional
Options.
Canvas Immediate.
Generated using TypeDoc
Binds a Canvas Immediate API to a canvas context, to allow drawing geometries to the context's canvas.
The units for geometry coordinates are css pixels relative to the top left corner of the canvas element.