随笔分类 - Quartz 2D
摘要:x轴缩放:CABasicAnimation *theAnimation;theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.scale.x"];theAnimation.duration=8;theAnimation.rem...
阅读全文
摘要:图形上下文栈存储着图形的现有的绘画状态,如果有需求,在同一个View中画不同粗细的线,就需要保存两份绘画状态,每份绘画状态保存一种属性- (void)drawRect:(CGRect)rect { // Drawing code // 需求: 先画一个矩形,颜色为红色,线宽为3 ...
阅读全文
摘要:1.画图片- (void)drawRect:(CGRect)rect { // Drawing code UIImage *image = [UIImage imageNamed:@"papa"]; // 在这个点画 [image drawAtPoint:CG...
阅读全文
摘要:Paths中的几个重要元素Pointsvoid CGContextMoveToPoint ( CGContextRef c, CGFloat x, CGFloat y);指定一个点成为current pointQuartz会跟踪current point一般执行完一个相关函数后,current po...
阅读全文
摘要:1.画三角形- (void)drawRect:(CGRect)rect { // 获取上下文 CGContextRef ctx = UIGraphicsGetCurrentContext(); // 确定三个点 CGContextMoveToPoint(ctx, 30...
阅读全文