iphone - Issue in Cropping Image -
below code, having issue cropping image, can please solve this.
uigraphicsbeginimagecontext(self.view.bounds.size); cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextmovetopoint(context, newpoint1.x, newpoint1.y); cgcontextaddlinetopoint(context, newpoint1.x, newpoint2.y); cgcontextaddlinetopoint(context, newpoint2.x, newpoint2.y); cgcontextaddlinetopoint(context, newpoint2.x, newpoint1.y); cgcontextaddlinetopoint(context, newpoint1.x, newpoint1.y); cgcontextclosepath(context); uicolor *blue = [uicolor colorwithred: (0.0/255.0 ) green: (0.0/255.0) blue: (255.0/255.0) alpha:0.4]; cgcontextsetfillcolorwithcolor(context, blue.cgcolor); cgcontextdrawpath(context, kcgpathfillstroke);
leave use following method cropping image
- (uiimage *)capturescreeninrect:(cgrect)captureframe { calayer *layer; layer = self.view.layer; uigraphicsbeginimagecontext(self.view.frame.size); cgcontextcliptorect (uigraphicsgetcurrentcontext(),captureframe); [layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *screenimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return screenimage; }
Comments
Post a Comment