gpt4 book ai didi

iphone - 放大CATiledLayer时如何在未转换的上下文上绘制?

转载 作者:行者123 更新时间:2023-11-29 11:24:26 25 4
gpt4 key购买 nike

我正在使用CATiledLayer进行数据可视化。默认情况下,drawLayer函数获取转置和缩放的上下文,这使绘图代码与缩放级别和所请求的图块无关。
但是,我想使用缩放功能来更改数据的水平范围,而不会发生实际的缩放。

到目前为止,我得到了以下代码:

(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context {

/* retrieve the transformation matrix from the context. */
CGAffineTransform contextTrans = CGContextGetCTM(context);

/* Scale the context back, so all items will still have the same size */
CGContextScaleCTM(context, 1.0/contextTrans.a, 1.0/contextTrans.d);

<.. loop through all datapoints ..> {
/* Transpose the point-centers to the new zoomed context */
xCoord = xCoord * contextTrans.a;
yCoord = yCoord * contextTrans.d;
}
<.. drawing code ..>
}


这可行,但缺点是放大时元素变得模糊。(每个屏幕像素仅渲染1 / zoomfactor像素)
有什么方法可以防止这种模糊现象的发生?
或者,是否有其他方法可以吸引未转换的上下文,而不是转置的上下文?

最佳答案

我认为my answer to this question应该可以满足您的需求。

关于iphone - 放大CATiledLayer时如何在未转换的上下文上绘制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3970988/

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