ios – 在客观c中绘制人体

ios – 在客观c中绘制人体,第1张

概述我需要在我的一个 iphone应用程序中绘制一个人体.任何人都可以帮助我 我正在尝试“drawInContext”,但没有想到如何绘制它 下面是我想在我的应用程序中的图像 下面是我正在尝试的代码,它向我展示了人体的线条 - (void)drawInContext:(CGContextRef)context{ int lineWidth = ([[UIDevice currentDevic 我需要在我的一个 iphone应用程序中绘制一个人体.任何人都可以帮助我

我正在尝试“drawInContext”,但没有想到如何绘制它

下面是我想在我的应用程序中的图像

下面是我正在尝试的代码,它向我展示了人体的线条

- (voID)drawInContext:(CGContextRef)context{    int linewidth = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) ? 2 : 10;CGContextSetlinewidth(context,linewidth);//At this point we have a NSArray filled with at least 1 NSValue//NSLog(@"Number of Segments %d",_jointSkeletonSegments.count);for (NSValue *ourPointNSValue in _jointSkeletonSegments){    struct SkeletonSegment ourPoint;    [ourPointNSValue getValue:&ourPoint];    //Draw the lines    [self drawlineWithCGPoint:ourPoint.startposition             andSecondCGPoint:ourPoint.endposition                  withContext:context];    //Draw the points    [self drawPointWithCGPoint:ourPoint.startposition withContext:context];    [self drawPointWithCGPoint:ourPoint.endposition withContext:context];}}- (voID)drawlineWithCGPoint:(CGPoint)startPoint andSecondCGPoint:(CGPoint)endPoint withContext:(CGContextRef)context{//DecIDe what color we wantUIcolor *ourcolor = [UIcolor greencolor];//DrawCGContextSaveGState(context);CGContextSetlineCap(context,kCGlineCapRound);CGContextSetstrokecolorWithcolor(context,ourcolor.CGcolor);CGContextMovetoPoint(context,startPoint.x + 0.5,startPoint.y + 0.5);CGContextAddlinetoPoint(context,endPoint.x + 0.5,endPoint.y + 0.5);CGContextstrokePath(context);CGContextRestoreGState(context);}- (voID)drawPointWithCGPoint:(CGPoint)point withContext:(CGContextRef)context{CGRect rect = CGRectZero;int pointSize = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) ? 10 : 20;CGContextSaveGState(context);//Make the new rect in the center of the coordinate.rect = CGRectMake(point.x - pointSize/2,point.y - pointSize/2,pointSize,pointSize);CGContextstrokeEllipseInRect(context,rect);CGContextFillEllipseInRect(context,rect);CGContextRestoreGState(context);}

谢谢,
Rafeeq

解决方法 您是否看过应用程序 Paint Code它是一个绘图包,允许您绘制任何图像然后它编写目标C代码来绘制它! 总结

以上是内存溢出为你收集整理的ios – 在客观c中绘制人体全部内容,希望文章能够帮你解决ios – 在客观c中绘制人体所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1010532.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存