Closed zainnadeem closed 6 years ago
Hi @zainnadeem, thanks for filing an issue! I'm trying to understand the situation here. From your screenshots it looks like there is one image with a grid of dots and one image that looks like a round pink button - is that right? Are you able to share these images for us to investigate the issue?
**please ignore the pink dot located in the center. I've replaced that image. The issue is with the larger circle not rendering pink but instead having a dark tint.
I've attached the image below. It's a pink circle with dots in the center. When I add it as a marker to the map, it renders dark. I am using the sdk-point-overlay style in the yaml file. I've attached the png for you to test.
Desired outcome:
Outcome:
Thanks @matteblair let me know if I can provide anything else that might be useful.
With some help, I think I've found the source of this problem (thanks @karimnaaji!). When we set an icon for a map marker, we go through a series of steps to get the raw pixel data from the UIImage
so that it can be passed into the cross-platform C++ core. In that process we create a CGBitmapContext
and render the UIImage
into it with a set of options, one of which is the alpha info:
https://github.com/tangrams/tangram-es/blob/master/platforms/ios/src/TangramMap/TGMarker.mm#L158
The pixel data that we want to get out is 32bpp RGBA, not alpha-premultiplied. This is represented by the kImageAlphaLast
entry in the CGImageAlphaInfo
enum but according to the Quartz2D programming guide this option is not supported on iOS (I tried it anyway and sure enough, it generates an error and fails on iOS).
Since iOS only supports alpha-premultiplied CGBitmapContext
configurations, we will have to either:
UIImage
that doesn't use CGBitmapContext
.I'll update when I've got a working fix!
This "iOS only supports alpha-premultiplied CGBitmapContext configurations" is kinda a bummer!!
TO REPRODUCE THE ISSUE, FOLLOW THESE STEPS:
I am trying to add a png image that has an opacity of %20 percent.
RESULT:
The png is coming out dark. It seems anytime you add an image to a marker with an alpha other than 1, it darkens the image.
EXPECTED RESULT:
I expect the image to have a fully transparent background and should not tint my png. It should look like this:
ENVIRONMENT: