gpt4 book ai didi

objective-c - 如何让用户在 iOS 中绘制重叠的颜色?

转载 作者:行者123 更新时间:2023-11-28 22:52:00 27 4
gpt4 key购买 nike

我正在创建一个 drawing application like this ,但我有一个问题。问题是,当我用一种颜色画一条线,然后用另一种颜色画一条线时,它会在线条相交的地方给出两种颜色的组合。

- (void)drawRect:(CGRect)rect
{

[curImage drawAtPoint:CGPointMake(0, 0)];
CGPoint mid1 = midPoint(previousPoint1, previousPoint2);
CGPoint mid2 = midPoint(currentPoint, previousPoint1);

CGContextRef context = UIGraphicsGetCurrentContext();

[self.layer renderInContext:context];

CGContextMoveToPoint(context, mid1.x, mid1.y);
CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, self.lineWidth);
CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor);

CGContextStrokePath(context);

[super drawRect:rect];

[curImage release];

}

项目的其余部分可用on GitHub .

最佳答案

关于objective-c - 如何让用户在 iOS 中绘制重叠的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11758287/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com