I have integrate draw line in my application i have not used OpenGL
or any other similar framework.
So now i want to give glow effect to their lines so how
-(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];
}
Set the shadow in your graphics context to have a zero size offset, a blur of around 6-10 (change according to taste) and the same colour as your stroke colour. This will give all subsequent drawing a glow effect. The command is
CGContextSetShadowWithColor()
Documented here.