首页 > 代码库 > 圆筒绘画

圆筒绘画



CGContextRef context=UIGraphicsGetCurrentContext(); CGColorSpaceRef colorSp=CGColorSpaceCreateDeviceRGB(); CGFloat components[]={1.0,0.0,0.0,1.0, 0,1,0,1, 0,0,1,1 }; CGFloat location[]={0.1,0.5,0.9}; CGGradientRef gradient=CGGradientCreateWithColorComponents(colorSp, components, location, 3); //创建一直线,沿直线渐变// CGContextDrawLinearGradient(context, gradient, CGPointMake(0, 50), CGPointMake(50, 150), 0); CGContextDrawRadialGradient(context, gradient, CGPointMake(200, 300), 130, CGPointMake(100, 200), 60, 0); // CGContextStrokePath(context); //圆筒 int j=10; for (int i=60; i<270; i=i+10) { j=j+5; CGContextDrawRadialGradient(context, gradient, CGPointMake(150, i),j, CGPointMake(150, i+10),j+4, 0); }

 

圆筒绘画