如何将一个CGContextRef复制到另一个? [英] How to copy one CGContextRef to another?
问题描述
在 -drawRect:
中,我使用 CGBitmapContextCreate()创建了辅助
CGContextRef
/ code>。
in -drawRect:
, I created a secondary CGContextRef
using CGBitmapContextCreate()
.
在处理完此上下文后,我需要将其内容复制到-drawRect:的原始上下文中。我该怎么做?
When I'm done with this context, I need to copy it's contents over to the "original" context of -drawRect:. How can I do that?
为什么要创建其他上下文:我希望让CGContextClipToMask()在具有透明背景的视图中工作。我的想法是在具有适当颜色(非透明,无Alpha)的另一个上下文中进行所有蒙版绘制和剪切,然后以某种方式将结果粘贴回原始上下文。
Reason why I create an additional context: I hope to get CGContextClipToMask() to work in a view that has a transparent background. My idea is to do all the mask-drawing and clipping in another context that has the appropriate color (non-transparent, no alpha), and then somehow paste that result back to the original context.
推荐答案
您可以使用memcpy函数。在Google上阅读如何使用它。
you can use memcpy function. Read on google for how to use it.
这篇关于如何将一个CGContextRef复制到另一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!