jjzjj

UIGraphicsGetCurrentContext

全部标签

iphone - 如何在ipad中平滑线条

当用户触摸开始移动结束ipad时,我记录了每个点,然后我将这些点添加到名为path的CGMutablePathRef中,然后我使用以下代码来绘制用户在ipad中触摸的线条(路径)。CGContextRefcontext=UIGraphicsGetCurrentContext();CGContextSetLineCap(context,kCGLineCapRound);CGContextSetLineJoin(context,kCGLineJoinRound);CGContextSetStrokeColorWithColor(context,[UIColorredColor]);CGCo

ios - 绘制完成后清除 CGPath 路径

我在iOS中用touchesMoved()方法编写了一个绘图程序。CGContextAddPath(UIGraphicsGetCurrentContext(),path);CGPathMoveToPoint(path,NULL,lastPoint.x,lastPoint.y);CGPathAddLineToPoint(path,NULL,lastPoint.x,lastPoint.y);CGContextDrawPath(UIGraphicsGetCurrentContext(),kCGPathStroke);如何清除绘制的路径并恢复原始View? 最佳答案

objective-c - Objective-C : Background & Frame Issue During Orientation Change

每当我将iPad切换为横屏模式时,背景和框架都会出现问题。肖像:风景:我无法在黄色箭头后的那一侧绘画,我的背景仍然是肖像并不断重复。这是我的代码在viewDidLoad上:background=[[UIColoralloc]initWithPatternImage:[UIImageimageNamed:@"mickey.png"]];self.view.backgroundColor=background;touchDraw=[[UIImageViewalloc]initWithImage:nil];touchDraw.frame=self.view.frame;[self.viewa

iphone - 在 ios7 中绘图时滞后

我有一个应用程序,我在其中对View进行一些草绘。到目前为止,在我安装ios7之前一切正常。我的应用程序使用触摸移动方法来识别移动的变化。但是,当我画一条线时,会调用touches方法,但直到我在ios7中touch结束时,线才会更新。所以画图有一点点滞后。它在ios6和ios7模拟器上工作正常,但是当我在真实的ios7设备上测试它时,绘图有延迟算法。-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{if(!isImageSelection){mouseSwiped=NO;UITouch*touch=[touche

ios - 如何使用 GraphicContext 在 Objective C 中获得锥形线笔刷效果

我正在做一个书法应用程序,我想修改下面的代码,以便当用户结束笔触时,线条会逐渐变细并变细,就像使用真正的书法笔一样(轻弹效果)。我知道touchesEnded可能是执行此操作的更好方法,但我只是想知道在ObjectiveC的Xcode中使用CGRect或UIKit中的GraphicsContext以编程方式在笔画结束时轻弹的最佳方法是什么。-(void)touchesMoved:(NSSet*)toucheswithEvent:(UIEvent*)event{mouseSwiped=YES;UITouch*touch=[touchesanyObject];currentPoint=[t

iOS Core Graphics 如何删除绘图

我正在按照我的涂鸦应用程序教程进行操作。http://www.raywenderlich.com/18840/how-to-make-a-simple-drawing-app-with-uikit他的删除功能是使用白色绘图。但是我正在使用图像背景,当我删除时,我真的需要删除。我试过了CGContextSetBlendMode(UIGraphicsGetCurrentContext(),kCGBlendModeClear);但它不起作用。这是我的代码:-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{_mouseSw

IOS:在 View 中绘制图像

我有这段代码可以在View中着色:UITouch*touch=[touchesanyObject];CGPointcurrentPoint=[touchlocationInView:drawImage];UIGraphicsBeginImageContext(drawImage.frame.size);[drawImage.imagedrawInRect:CGRectMake(0,0,drawImage.frame.size.width,drawImage.frame.size.height)];CGContextSetLineCap(UIGraphicsGetCurrentConte

ios - 空图形上下文

这是我正在使用的代码摘录:dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW,0),^{UIGraphicsBeginImageContextWithOptions(irect.size,YES,0.0);CGContextRefcontext=UIGraphicsGetCurrentContext();if(context==0)NSLog(@"NullGraphicsContext");elseNSLog(@"OK");....//VariousdrawingfunctionsUIImage*im

iphone - iOS 有触摸画线的 SDK 吗?

有没有我可以用来触摸画线的框架。基本上,我想为客户添加在iPad/iPhone上签名并将其捕获为图像的功能。非常感谢任何帮助。谢谢。 最佳答案 您可以使用UIKIT框架中提供的核心图形来满足您的要求。我在我的应用程序中有类似的需求,但用途不同,如果需要,我可以为您提供代码。TQ.h文件#importtypedefenum_DrawingMode{DrawingModePen=0,DrawingModeEraser=1,}DrawingMode;@interfaceDrawingView:UIView{CGPointlastPoint

iphone - 用阴影画线,但只想保留阴影。操作系统

我想画一strip阴影的线,但我不想保留线,只保留阴影。我试图将线条的描边颜色设置为清除,但当我这样做时阴影也消失了。下面的代码创建了2条线,我只想保留阴影,因为它看起来更好,而且不像线那样像素化。这可能吗?CGContextSetLineWidth(UIGraphicsGetCurrentContext(),2.0);CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(),0.0,0.0,0.0,1.0);CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(),YES