gpt4 book ai didi

ios - MKOverlayView 使用混合模式绘制一些东西

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:15:30 27 4
gpt4 key购买 nike

我想用混合模式绘制 map 叠加层。但是这段代码只是在没有任何混合模式的情况下绘制白色叠加层。我做错了什么?

- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context
{
UIGraphicsPushContext(context);

CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
CGContextSetBlendMode(context, kCGBlendModeSaturation);
CGContextFillRect(context, [self rectForMapRect:mapRect]);

UIGraphicsPopContext();
}

这是我想要的结果。我在 Photoshop 中制作了三层:

  1. 原始谷歌地图。
  2. 具有饱和混合模式的黑色图层。
  3. 具有排除混合模式的白色图层。 enter image description here

最佳答案

我建议使用 openstreetmap 和 wms 服务器或 mapbox 之类的服务设计您自己的 map ,而不是将此自定义 map 添加为叠加层。

这是一个关于如何将其他 map 添加为叠加层的示例:https://github.com/mtigas/iOS-MapLayerDemo

关于ios - MKOverlayView 使用混合模式绘制一些东西,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10785749/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com