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

标签 iphone ios uiscrollview quartz-graphics catiledlayer

我正在使用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/

相关文章:

iphone - TestFlight - 如何提交 Beta 应用程序审核

iPhone - 按钮背景图像

ios - 如何让应用程序在 iPod 2nd gen 上运行

swift - 在 Swift ScrollView 委托(delegate)中不起作用

ios - ScrollView 上不需要的 subview 反弹

ios - 同步 UISlider 和 UIScrollView

iphone - 将数据从一个表插入到另一个表

iphone - 如何实现如图所示的 UIPickerView,并带有组件标题?

android - 如何设置 HTML 元视口(viewport)以 100% 宽度开始?

ios - 仅在 iPhone 上的 Safari 上出现突然的 CSS 样式问题