Javascript 将谷歌地图插件设为黑色/白色或使用棕褐色滤镜
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6588549/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Make google maps plugin black/white or with sepia filter
提问by Sonne
I'm wondering if it is possible to display Google Maps in black/white or with a sepia filter. Can it be done with some Canvas magic? Or overlaying? Or some other method?
我想知道是否可以以黑/白或棕褐色过滤器显示谷歌地图。可以用一些 Canvas 魔法来完成吗?还是叠加?或者其他什么方法?
回答by Pixelomo
Check this fiddle out, I've desaturated all elements to create the black and white effect, for example:
检查这个小提琴,我已经降低了所有元素的饱和度以创建黑白效果,例如:
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [
{ "saturation": -100 },
{ "lightness": -8 },
{ "gamma": 1.18 }
]
}
You can style your maps using this wizard
or using Snazzy Mapswhich is very user-friendly.
或者使用非常人性化的Snazzy Maps。
回答by Michal
Yes you can use styled maps feature of google api.
是的,您可以使用 google api 的样式地图功能。
Here is an example http://www.programmableweb.com/news/make-your-google-map-stand-out-styles/2010/05/20
这是一个示例 http://www.programmableweb.com/news/make-your-google-map-stand-out-styles/2010/05/20
Here are the docs http://code.google.com/apis/maps/documentation/javascript/maptypes.html#StyledMaps
这是文档 http://code.google.com/apis/maps/documentation/javascript/maptypes.html#StyledMaps
and here is a WYSIWYG wizard to recolor your map http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html
这是一个 WYSIWYG 向导来重新着色您的地图 http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html
回答by zuloo
http://www.nihilogic.dk/labs/imagefx/brings a sepia and a desaturate (black and white) filter... But it wont work in Safari and IE can only desaturate, no sepia
http://www.nihilogic.dk/labs/imagefx/带来了棕褐色和去饱和(黑白)滤镜......但它在 Safari 中不起作用,IE 只能去饱和,没有棕褐色
回答by Bill Bonar
I have this link in my history. Someone has done it in flash http://www.anttikupila.com/GoogleMapsBw/1
我的历史上有这个链接。有人用 flash http://www.anttikupila.com/GoogleMapsBw/ 1
EDIT: After considering your idea, I also found this exampleI like it and you may be able to attach a listener to alter the images as they are loaded. but it may not work smoothly.
编辑:在考虑了您的想法后,我还发现我喜欢这个示例,您可以附加一个侦听器来在加载图像时对其进行更改。但它可能无法顺利运行。