简体   繁体   中英

Add Opacity to CGPath

CGPathRef defines an opaque type that represents an immutable graphics path. CGMutablePathRef defines an opaque type that represents a mutable graphics path.

But how do we change the opacity in the CGPath in CoreGraphics ? Can it be addd in percentage?

It's called "alpha" in UIKit and Core Graphics. For example:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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