ios - How to increase the Gaussian Blur as the user scrolls up -


i have uiimage inside uiimageview on gaussian blur filter radius of 50 has been applied of now. per new requirement, need set initial gaussian blur @ 3px. increase 3px 10 px user scrolls view? please me understand how can done?

this code i'm using blur image of radius of 50.

- (uiimage *)blurwithcoreimage:(uiimage *)sourceimage blurvalue:(int)valblur {      ciimage *inputimage = [ciimage imagewithcgimage:sourceimage.cgimage];      // apply affine-clamp filter stretch image not     // shrunken when gaussian blur applied      cgaffinetransform transform = cgaffinetransformidentity;     cifilter *clampfilter = [cifilter filterwithname:@"ciaffineclamp"];     [clampfilter setvalue:inputimage forkey:@"inputimage"];     [clampfilter setvalue:[nsvalue valuewithbytes:&transform   objctype:@encode(cgaffinetransform)] forkey:@"inputtransform"];      cifilter *gaussianblurfilter = [cifilter filterwithname: @"cigaussianblur"];     [gaussianblurfilter setvalue:clampfilter.outputimage forkey: @"inputimage"];     [gaussianblurfilter setvalue:[nsstring stringwithformat:@"%d",valblur] forkey:@"inputradius"];      cicontext *context = [cicontext contextwithoptions:nil];     cgimageref cgimage = [context createcgimage:gaussianblurfilter.outputimage fromrect:[inputimage extent]];      // set output context.     uigraphicsbeginimagecontext(self.view.frame.size);     cgcontextref outputcontext = uigraphicsgetcurrentcontext();      // invert image coordinates     cgcontextscalectm(outputcontext, 1.0, -1.0);     cgcontexttranslatectm(outputcontext, 0, -self.view.frame.size.height);      // draw base image.     cgcontextdrawimage(outputcontext, self.view.frame, cgimage);      // apply white tint     cgcontextsavegstate(outputcontext);     cgcontextsetfillcolorwithcolor(outputcontext, [uicolor colorwithwhite:1 alpha:0.2].cgcolor);     cgcontextfillrect(outputcontext, self.view.frame);     cgcontextrestoregstate(outputcontext);      // output image ready.     uiimage *outputimage = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();      return outputimage; } 

-(void)scrollviewdidscroll:(uiscrollview *)scrollview {     /* offset @ bottom of scroll view. */     cgfloat totalscroll = scrollview.contentsize.height - scrollview.bounds.size.height;      /* current offset. */     cgfloat offset = - scrollview.contentoffset.y;      /* percentage of current offset / bottom offset. */     cgfloat percentage = offset / totalscroll;      /* when percentage = 0, blur should 3 should flip percentage. */     imageview.blurlevel= (3.0f + percentage); } 

source : sfos


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -