开发者

Find the number of components in the current fill & stroke color space form CGContext?

I am looking at way of finding the color space of a CGContext?

CGBitmapContextGetColorSpace() will 开发者_JAVA技巧not work as I am working with general context and not bitmap context.

Thank you, Rahul


There does not seem to be any way to retrieve this information; for a system-provided CGContext, the color space actually used may not even be any of the publicly-defined color spaces.

There also does not seem to be any way to retrieve the current fill or stroke color or color space. But there also does not seem to be any documented restriction on the types of colors that may be passed to CGContextSetFillColorWithColor or CGContextSetStrokeColorWithColor, so in general you should just set the color you want and let the framework handle translating that into the appropriate format for the CGContext.


You can't directly read colorspace data from CGContext properties. So you'll have to work around this shortcoming in the CGContext API by - intercepting property updates on the way to the CGContext of interest, or - outputting PDF data whose stream you then examine for the colorspace & color data.


colorspaceref CGContextGetStrokeColorSpace(ccontextref);

colorspaceref CGContextGetFillColorSpace(ccontextref);

but this are priate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜