简体   繁体   English

将不透明度添加到CGPath

[英]Add Opacity to CGPath

CGPathRef defines an opaque type that represents an immutable graphics path. CGPathRef定义了代表不可变图形路径的不透明类型。 CGMutablePathRef defines an opaque type that represents a mutable graphics path. CGMutablePathRef定义了不透明的类型,该类型表示可变的图形路径。

But how do we change the opacity in the CGPath in CoreGraphics ? 但是,我们如何更改CoreGraphicsCGPath中的不透明度? Can it be addd in percentage? 可以按百分比添加吗?

It's called "alpha" in UIKit and Core Graphics. 在UIKit和Core Graphics中被称为“ alpha”。 For example: 例如:

UIColor *color = [[UIColor alloc] initWithWhite:0.5f alpha:0.5f];
CGContextSetStrokeColor(context, color.CGColor); // Assuming you have a context.
CGContextStrokePath(context);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM