我有一个关于UIBezierPath的问题.
例如,我有这条路:
现在我想要一个从白色到红色的颜色渐变.从左到右.
这是我的代码:
UIBezierPath *bezierPath;
bezierPath = [UIBezierPath bezierPathWithArcCenter:_center radius:_radius startAngle:((4 * angle)) endAngle:(((20) * angle)) clockwise:YES];
[bezierPath addLineToPoint:_center];
[bezierPath closePath];
UIColor *color = [UIColor colorWithHue:0/sectors saturation:1. brightness:1. alpha:1];
[color setFill];
[color setStroke];
[bezierPath fill];
[bezierPath stroke];
Run Code Online (Sandbox Code Playgroud)
谁能帮我?
编辑1:
我有这个色轮:
UIBezierPath *bezierPath;
for ( int i = 0; i < 360; i++) {
bezierPath = [UIBezierPath bezierPathWithArcCenter:_center radius:_radius startAngle:((i * angle)) endAngle:(((i + 1) * angle)) clockwise:YES];
[bezierPath addLineToPoint:_center];
[bezierPath closePath];
UIColor *color = [UIColor colorWithHue:i/sectors saturation:1. brightness:1. alpha:1]; …
Run Code Online (Sandbox Code Playgroud) 我在 Linux 内核模块中创建目录时遇到问题。
我想要的:在内核模块中创建一个目录。
这是我的实际代码:
struct file *fp = (struct file *) NULL;
fp = filp_open("/home/testdir", O_DIRECTORY|O_CREAT, S_IRUSR);
Run Code Online (Sandbox Code Playgroud)
但它创建一个文件而不是目录。
我尝试使用与上面相同的代码而不使用标志“O_DIRECTORY”:
struct file *fp = (struct file *) NULL;
fp = filp_open("/home/testdir", O_CREAT, S_IRUSR);
Run Code Online (Sandbox Code Playgroud)
并且结果与之前的结果类似。
我不明白这种行为。我究竟做错了什么?
编辑 1:我正在 Raspberry PI、Raspbian 上编码,内核版本:4.4.43-v7