如何提取UIImage或CGImageRef的alphachannel并将其转换为可与CGImageMaskCreate一起使用的mask?例如:本质上,给定任何图像,我不关心图像内部的颜色。我只想创建一个表示alphachannel的灰度图像。然后可以使用此图像来屏蔽其他图像。当您为其提供图标图像时,在UIBarButtonItem中有一个示例行为。根据Apple文档,它指出:Theimagesdisplayedonthebararederivedfromthisimage.Ifthisimageistoolargetofitonthebar,itisscaledtofit.Typi
如何提取UIImage或CGImageRef的alphachannel并将其转换为可与CGImageMaskCreate一起使用的mask?例如:本质上,给定任何图像,我不关心图像内部的颜色。我只想创建一个表示alphachannel的灰度图像。然后可以使用此图像来屏蔽其他图像。当您为其提供图标图像时,在UIBarButtonItem中有一个示例行为。根据Apple文档,它指出:Theimagesdisplayedonthebararederivedfromthisimage.Ifthisimageistoolargetofitonthebar,itisscaledtofit.Typi