views:

13

answers:

0

All,

I have a square region where I have two 45 degree triangles that are opposite of each other (i.e. mirror image). I've created a CGMutablePathRef for each triangle so I can use that as my clipping path when drawing an image. The problem is that I am getting a diagonal line in the resulting image that divides the two triangles. How do I get rid of the diagonal line? Here is my code.

CGMutablePathRef triangle1 = getTriangle1();
CGMutablePathRef triangle2 = getTriangle2();

CGContextSetShouldAntialias(context,true);
CGContextSetAllowsAntialiasing(context,true);

CGContextSaveGState(context);
CGContextAddPath(context, triangle1);
CGContextClip(context);
CGContextDrawImage(context, rect, myImage.CGImage);
CGContextRestoreGState(context);

CGContextSaveGState(context);
CGContextAddPath(context, triangle2);
CGContextClip(context);
CGContextDrawImage(context, rect, myImage.CGImage);
CGContextRestoreGState(context);

Thanks.