ios - CoreGraphics - Gap visible between two Quadrilaterals shaped path -


i have drawn 2 quadrilaterals(4 sides) shaped paths using coregraphics. there 6 points totally, path1 uses first 4 points , path2 uses last 4 points both sharing 2 points.

the code follows

- (void)drawrect:(cgrect)rect {      cgpoint topleft = cgpointmake(121, 116);     cgpoint topright = cgpointmake(221, 216);      cgpoint middleleft = cgpointmake(121, 180);     cgpoint middleright = cgpointmake(221, 280);      cgpoint bottomleft = cgpointmake(121, 244);     cgpoint bottomright = cgpointmake(221, 344);      cgmutablepathref subpath1 = cgpathcreatemutable();     cgpathmovetopoint(subpath1, null, topleft.x, topleft.y);     cgpathaddlinetopoint(subpath1, null, topright.x, topright.y);     cgpathaddlinetopoint(subpath1, null, middleright.x, middleright.y);     cgpathaddlinetopoint(subpath1, null, middleleft.x, middleleft.y);     cgpathaddlinetopoint(subpath1, null, topleft.x, topleft.y);      cgmutablepathref subpath2 = cgpathcreatemutable();     cgpathmovetopoint(subpath2, null, middleleft.x, middleleft.y);     cgpathaddlinetopoint(subpath2, null, middleright.x, middleright.y);     cgpathaddlinetopoint(subpath2, null, bottomright.x, bottomright.y);     cgpathaddlinetopoint(subpath2, null, bottomleft.x, bottomleft.y);     cgpathaddlinetopoint(subpath2, null, middleleft.x, middleleft.y);      cgcontextref context = uigraphicsgetcurrentcontext();      cgcontextsetfillcolorwithcolor(context, [uicolor colorwithred:0.19 green:0.42 blue:0.09 alpha:1.0].cgcolor);     cgcontextsetblendmode(context, kcgblendmodemultiply);     cgcontextsetalpha(context, 1.0);      cgcontextaddpath(context, subpath1);     cgcontextfillpath(context);      cgcontextaddpath(context, subpath2);     cgcontextfillpath(context); } 

the output image

enter image description here

but in screen there odd white line appears in joining edge. want remove white line.

can how avoid white line?

add both paths context first , fill it.

- (void)drawrect:(cgrect)rect {      cgpoint topleft = cgpointmake(121, 116);     cgpoint topright = cgpointmake(221, 216);      cgpoint middleleft = cgpointmake(121, 180);     cgpoint middleright = cgpointmake(221, 280);      cgpoint bottomleft = cgpointmake(121, 244);     cgpoint bottomright = cgpointmake(221, 344);      cgmutablepathref subpath1 = cgpathcreatemutable();     cgpathmovetopoint(subpath1, null, topleft.x, topleft.y);     cgpathaddlinetopoint(subpath1, null, topright.x, topright.y);     cgpathaddlinetopoint(subpath1, null, middleright.x, middleright.y);     cgpathaddlinetopoint(subpath1, null, middleleft.x, middleleft.y);     cgpathaddlinetopoint(subpath1, null, topleft.x, topleft.y);      cgmutablepathref subpath2 = cgpathcreatemutable();     cgpathmovetopoint(subpath2, null, middleleft.x, middleleft.y);     cgpathaddlinetopoint(subpath2, null, middleright.x, middleright.y);     cgpathaddlinetopoint(subpath2, null, bottomright.x, bottomright.y);     cgpathaddlinetopoint(subpath2, null, bottomleft.x, bottomleft.y);     cgpathaddlinetopoint(subpath2, null, middleleft.x, middleleft.y);      cgcontextref context = uigraphicsgetcurrentcontext();      cgcontextsetfillcolorwithcolor(context, [uicolor colorwithred:0.19 green:0.42 blue:0.09 alpha:1.0].cgcolor);     cgcontextsetblendmode(context, kcgblendmodemultiply);     cgcontextsetalpha(context, 1.0);      // changes start here...     cgcontextaddpath(context, subpath1);     cgcontextaddpath(context, subpath2);     cgcontextfillpath(context); } 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -