[OpenLayers-Users] Changing brightness of the map image
Lubos and Alena Pochman
pochmans at gmail.com
Mon Feb 4 07:48:13 PST 2013
I have Map with WMS (geoserver) base layer and I would like to change
the brightness of the map viewport.
I found great pixel library http://www.pixastic.com/lib/
and DEV demo http://dev.openlayers.org/sandbox/camptocamp/canvas/openlayers/examples/processingCanvas.html,
which works great.
Unfortunately I use OL 2.12, and the functions from the demo are not
available even in the latest devel on Github.
Is there a way in OL 2.12 to modify the image of the viewport (tile),
and replace it?
I came with the following code, to get the canvas of the image (note,
I know it will work only for untiled image):
var gridRows = currLayer.grid[0];
var img = gridRows[0].getImage();
var context = gridRows[0].getCanvasContext();
if (context) {
var newimg = Pixastic.process(img, "brightness", {brightness
: brightness, contrast : contrast, legacy : false});
}
but I am getting cross-origin error: canvas context getImageData() -
SecurityError: The operation is insecure.
How do I avoid the cross-origin error?
Will my approach modify the viewport/tile image brightness if I
overcome the cross-origin error?
Thanks for any help/hints, Lubos Pochman
More information about the Users
mailing list