从 Quickdraw 转换为石英 2D
我有一个旧代码,
Rect r;
GetPortBounds(some_bitmap,&r);
PixMapHandle somehandle = GetGWorldPixMap(some_bitmap);
if(LockPixels(somehandle)){
TPixel *data = (TPixel *) GetPixBaseAddr(somehandle);
long row_bytes = GetPixRowBytes(somehandle);
// doing something
UnlockPixels(somehandle);
}
有人可以帮我用quartz 2d 中的替换代码吗
I have an old code that uses,
Rect r;
GetPortBounds(some_bitmap,&r);
PixMapHandle somehandle = GetGWorldPixMap(some_bitmap);
if(LockPixels(somehandle)){
TPixel *data = (TPixel *) GetPixBaseAddr(somehandle);
long row_bytes = GetPixRowBytes(somehandle);
// doing something
UnlockPixels(somehandle);
}
Can anyone help me with the replacement code in quartz 2d
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要使用 Quartz 修改位图,您可以使用图像初始化 CGContextRef 并使用
CGContextDraw...
例程绘制到该上下文。(我为 NSView 子类编写了以下示例代码。效率有点低。如果您使用该代码,请将可以保留在 iVars 中的内容分开。)
To modify a bitmap with Quartz you can initialize a CGContextRef with the image and draw to that context with
CGContextDraw...
routines.(I wrote the following sample code for a NSView subclass. It's a bit inefficient. If you use the code, separate the stuff you can keep around in iVars.)