ios - Generate a CGPath from another path's line width outline -
i might not explaining in best way possible, please bear me.
what have drawn cgpath on top of mkmapview object:
the way able achieve create cgpath darker blue line, create copy of path, , stroke thicker version of semi-transparent blue color. here's code i'm using this:
// set shadow around path line cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsavegstate(context); cgcontextsetrgbstrokecolor(context, 0.0f, 0.0f, 0.0f, 0.0f); cgcontextsetrgbfillcolor(context, 0.0f, 0.0f, 1.0f, 0.4f); cgpathref shadowpath = cgpathcreatecopybystrokingpath(self.path.cgpath, null, 80.0f, kcglinecapround, kcglinejoinround, 0.0f); cgcontextbeginpath(context); cgcontextaddpath(context, shadowpath); cgcontextdrawpath(context, kcgpathfillstroke); cgcontextrestoregstate(context); cgpathrelease(shadowpath);
works pretty well, nothing wrong far.
however, though cgpathref of outline of thicker semi-transparent blue area. here's screenshot showing pseudo-path want out of (hand drawn in red):
how possible?
simple: use cgpathcreatecopybystrokingpath
. pass in wide line width, , cap of kcglinecapround
.
Comments
Post a Comment