小编Dan*_*oph的帖子

带颜色渐变的UIBezierPath

我有一个关于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)

objective-c ios uibezierpath

10
推荐指数
1
解决办法
5043
查看次数

Linux 内核模块 - 创建目录

我在 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

c linux kernel-module linux-kernel

2
推荐指数
1
解决办法
3433
查看次数

标签 统计

c ×1

ios ×1

kernel-module ×1

linux ×1

linux-kernel ×1

objective-c ×1

uibezierpath ×1