i'm developing an application in objective-c for iOS. I have some data related to gps coordinates that i get from CoreData and i want to represent that data over a map drawing some CGRect with some colors, to make a sort of heatmap. I'm able to do that, but my problem is that if there are two o more overlapping CGRect the alpha component of the CGRects are summed, so if there are a lot of overlapping CGRects i loose transparency. My question is if there exists something to avoid that and draw overlapping CGRects without loosing transparency. Maybe something that crops the previous CGRect and add the new one.
Any idea? Thanks in advice.
You can draw the rectangles with no transparency to a CGLayer
or a UIImage
and then draw that layer/image on top of your map with the desired transparency.
Alternatively, you could try a different blend mode, maybe kCGBlendModeSourceAtop
.