我正在使用以下代码在NSImage上绘制NSString。如何使此文本透明
text.draw(at: NSZeroPoint, withAttributes: [NSFontAttributeName: font, NSForegroundColorAttributeName: NSColor.white])
如何使该文本透明?
请指教
您可以将NSColor方法与AlphaComponent(_ :)一起使用,并更改其颜色不透明度。
text.draw(at: NSZeroPoint,
withAttributes: [NSFontAttributeName: font,
NSForegroundColorAttributeName: NSColor.white.withAlphaComponent(0.5)])
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句