2012-04-05 4 views

답변

3

그래픽 콘텍스트의 그림자를 0 크기 오프셋, 약 6-10 (취향에 따라 변경)의 흐림 및 획 색상과 같은 색으로 설정하십시오. 그러면 모든 후속 드로잉에 광선 효과가 적용됩니다. 명령은

CGContextSetShadowWithColor() 

문서 번호 here입니다.

1
-(void)drawRect:(CGRect)rect{ 

[curImage drawAtPoint:CGPointMake(0, 0)]; 

CGPoint mid1 = midPoint(previousPoint1, previousPoint2); 

CGPoint mid2 = midPoint(currentPoint, previousPoint1); 

    CGContextRef context = UIGraphicsGetCurrentContext(); 

    [self.layer renderInContext:context]; 

    CGContextMoveToPoint(context, mid1.x, mid1.y); 
    // Use QuadCurve is the key 
    CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y); 

    CGContextSetLineCap(context, kCGLineCapRound); 
    CGContextSetLineWidth(context, self.lineWidth); 
    CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor); 
     //------------ Glow Lines ---------- 

    if (appDel.BrushType == 201) // (201 is glow brush type) 
    { 
     CGContextSetLineWidth(context, 7); 

     CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); 

     CGFloat components[4]={appDel.R_color/255.0,appDel.G_color/255.0,appDel.B_color/255.0,1.0}; 
     CGColorRef color1 = CGColorCreate(space, components); 

     CGContextSetShadowWithColor(context, CGSizeMake(0.0, 0.0), 15, color1); 

     CGContextStrokePath(UIGraphicsGetCurrentContext()); 

    } 
    //-------------- 
    CGContextStrokePath(context); 
    [super drawRect:rect]; 

    [curImage release]; 


}