代码之家  ›  专栏  ›  技术社区  ›  DevDevDev

保存Coregraphics绘图操作?

  •  0
  • DevDevDev  · 技术社区  · 15 年前

    我有什么办法可以做到:

    @实施myview

    - (void)drawRect:(CGRect)rect
    {
       // Get the thing I'm supposed to draw (CGImageRef, pattern, etc.) and draw it
       // i.e. not real code
       CGContextDrawWhatever(self.objectThatHoldsDrawing.drawing);
    }
    
    1 回复  |  直到 15 年前
        1
  •  1
  •   MrMage    15 年前

    看一看 CGPathRef , CGLayer (或者甚至可能只是 CALayer 但这基本上相当于 drawRect: 方法)和渲染(例如缓冲)到图像上下文,然后只渲染图像。