Quartz 实现画图片、写文字、画线、椭圆、矩形、棱形等。三
生活随笔
收集整理的這篇文章主要介紹了
Quartz 实现画图片、写文字、画线、椭圆、矩形、棱形等。三
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
/*繪制圖片????NSString* imagePath = [[NSBundle mainBundle] pathForResource:@"dog" ofType:@"png"];????UIImage* myImageObj = [[UIImage alloc] initWithContentsOfFile:imagePath];????//[myImageObj drawAtPoint:CGPointMake(0, 0)];????[myImageObj drawInRect:CGRectMake(0, 0, 320, 480)];????NSString *s = @"我的小狗";????[s drawAtPoint:CGPointMake(100, 0) withFont:[UIFont systemFontOfSize:34.0]];*/???????/*????NSString *path = [[NSBundle mainBundle] pathForResource:@"dog" ofType:@"png"];????UIImage *img = [UIImage imageWithContentsOfFile:path];????CGImageRef image = img.CGImage;????CGContextSaveGState(context);????CGRect touchRect = CGRectMake(0, 0, img.size.width, img.size.height);????CGContextDrawImage(context, touchRect, image);????CGContextRestoreGState(context);???*/????????????/*NSString *path = [[NSBundle mainBundle] pathForResource:@"dog" ofType:@"png"];????UIImage *img = [UIImage imageWithContentsOfFile:path];????CGImageRef image = img.CGImage;????CGContextSaveGState(context);????CGContextRotateCTM(context, M_PI);????CGContextTranslateCTM(context, -img.size.width, -img.size.height);????CGRect touchRect = CGRectMake(0, 0, img.size.width, img.size.height);????CGContextDrawImage(context, touchRect, image);????CGContextRestoreGState(context);*//*????NSString *path = [[NSBundle mainBundle] pathForResource:@"dog" ofType:@"png"];????UIImage *img = [UIImage imageWithContentsOfFile:path];????CGImageRef image = img.CGImage;?????????CGContextSaveGState(context);????CGAffineTransform myAffine = CGAffineTransformMakeRotation(M_PI);????myAffine = CGAffineTransformTranslate(myAffine, -img.size.width, -img.size.height);????CGContextConcatCTM(context, myAffine);????CGContextRotateCTM(context, M_PI);????CGContextTranslateCTM(context, -img.size.width, -img.size.height);????CGRect touchRect = CGRectMake(0, 0, img.size.width, img.size.height);????CGContextDrawImage(context, touchRect, image);????CGContextRestoreGState(context);*/
總結(jié)
以上是生活随笔為你收集整理的Quartz 实现画图片、写文字、画线、椭圆、矩形、棱形等。三的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JetBrains Mikhail Vi
- 下一篇: python语言在abaqus中的应用