Skip to content

Instantly share code, notes, and snippets.

@ddwang
Last active December 15, 2015 14:39
Show Gist options
  • Save ddwang/5276076 to your computer and use it in GitHub Desktop.
Save ddwang/5276076 to your computer and use it in GitHub Desktop.
UIImage* imageSource = [UIImage imageWithSize:CGSizeMake(640, 640)
fillColor:[NAAppTheme orange]];
GPUImagePicture* gpuSource1 = [[GPUImagePicture alloc] initWithImage:imageSource];
GPUImagePicture* gpuSource2 = [[GPUImagePicture alloc] initWithImage:imageSource];
GPUImagePerlinNoiseFilter* gpuFilter1 = [[GPUImagePerlinNoiseFilter alloc] init];
gpuFilter1.scale = 300;
GPUImageAlphaBlendFilter* gpuFilter2 = [[GPUImageAlphaBlendFilter alloc] init];
gpuFilter2.mix = 0.9;
[gpuSource1 addTarget:gpuFilter1];
[gpuFilter1 addTarget:gpuFilter2];
[gpuSource2 addTarget:gpuFilter2];
[gpuSource1 processImage];
[gpuSource2 processImage];
UIImage* brush = [gpuFilter2 imageFromCurrentlyProcessedOutput];
// [UIColor colorWithRed:0.73 green:0.87 blue:0.77 alpha:1.0]
UIImage* bg = [self createNavigationBarImage:[UIColor colorWithPatternImage:brush]];
UIColor* glossColor1 = [UIColor colorWithWhite:0.0 alpha:0.1];
UIColor* glossColor2 = [UIColor colorWithWhite:0.0 alpha:0.35];
CGRect topHalf = CGRectMake(rect.origin.x,
rect.origin.y+rect.size.height - 2,
rect.size.width,
2);
[NAAppTheme drawLinearGradient:c
rect:topHalf
startColor:glossColor1
endColor:glossColor2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment