Automatic shadows?

33 views
Skip to first unread message

David Karger

unread,
Dec 20, 2011, 2:17:19 PM12/20/11
to google-map...@googlegroups.com
Given that there is a standard recommendation for Shadows (diagonally to the right) it would be nice if we could specify that a marker should use a "default shadow" (e.g. by setting shadowIcon=true) and have gmaps construct it for us.

Ben Appleton

unread,
Dec 20, 2011, 7:27:43 PM12/20/11
to google-map...@googlegroups.com

In browsers with Canvas one could generate a shadow image for a custom icon. However I don't think this is possible in IE7/8. So our usual approach in this case is to promote or publish a library or web service that adds this functionality on top of the API.

Android brevity

On Dec 21, 2011 6:17 AM, "David Karger" <david....@gmail.com> wrote:
Given that there is a standard recommendation for Shadows (diagonally to the right) it would be nice if we could specify that a marker should use a "default shadow" (e.g. by setting shadowIcon=true) and have gmaps construct it for us.

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/KZsxJhgQOlMJ.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Berry Ratliff

unread,
Dec 21, 2011, 9:46:02 AM12/21/11
to Google Maps JavaScript API v3
On Dec 21, 12:27 am, Ben Appleton <apple...@google.com> wrote:
> In browsers with Canvas one could generate a shadow image for a custom
> icon. However I don't think this is possible in IE7/8. So our usual
> approach in this case is to promote or publish a library or web service
> that adds this functionality on top of the API.

Even canvas has obstacles. The alpha component must be examined to
determine the non-transparent sections of the marker. The
"getImageData" method is not very efficient. The icon might reside in
a different domain. The "getImageData" method cannot access an image
from another domain. The "transform / setTransform" methods can
change shapes but cannot change colors. I am not aware of another
option.

David Karger

unread,
Dec 28, 2011, 4:52:59 PM12/28/11
to google-map...@googlegroups.com
If you want your shadow to reflect the icon's transparency it's more challenging.  But if you just want a uniformly grey shadow, you can get it by drawing "over" the icon using "destination-in" compositing (and approprite transformations).

Berry Ratliff

unread,
Dec 30, 2011, 9:55:19 AM12/30/11
to Google Maps JavaScript API v3
The marker may not be rectangular. Unless it fills the entire image
file, its opacity must be examined to determine its shape. You could
supply a "path" but it would not be automatic. I am not aware of a
"globalCompositeOperation" to combine the "alpha" of one set of pixels
with the "color" of another set of pixels.
Reply all
Reply to author
Forward
0 new messages