ios - CAShapeLayer strokeColor from image pattern UIColor to CGColor upside down -
i'm using cabasicanimation
draw uibezierpaths
have in array using cashapelayer
cashapelayer *shapelayer = [cashapelayer layer]; shapelayer.path = [path cgpath]; shapelayer.strokecolor = path.color.cgcolor;
my path.color
uicolor
image pattern. when converted cgcolor
image pattern
upside down. know because ios , core graphics use different starting points drawing.
i have tried
shapelayer.transform = catransform3dmakerotation(m_pi, 0.0, 0.0, 1.0);
and
shapelayer.geometryflipped = yes;
but none of them worked.
how flip strokecolor
image pattern 180 degree match origin uicolor
?
as have correctly suspected, coordinate system differs. in case, origin @ bottom left @ (0, 0)
.
so compensate either flip image using image editor or in code so:
uiimage *flippedpatternimage = [uiimage imagewithcgimage:patternimage.cgimage scale:1.0f orientation:uiimageorientationleftmirrored]; uicolor *colorwithimagepattern = [uicolor colorwithpatternimage:flippedpatternimage];
and assign strokecolor
:
shapelayer.strokecolor = path.color.cgcolor;
Comments
Post a Comment