This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
/
AKViewController.m
87 lines (65 loc) · 2.34 KB
/
AKViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//
// AKViewController.m
// SmapleApp
//
// Created by Jeffrey Kelley on 6/12/12.
// Copyright (c) 2012 Detroit Labs. All rights reserved.
//
#import "AKViewController.h"
#import "AmazeKit.h"
@interface AKViewController ()
@end
@implementation AKViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(20.0f, 20.0f, 250.0f, 75.0f)];
AKImageRenderer *renderer = [[AKImageRenderer alloc] init];
// Noise Effect
AKNoiseImageEffect *noiseEffect = [[AKNoiseImageEffect alloc] init];
[noiseEffect setAlpha:0.05f];
[noiseEffect setNoiseType:AKNoiseTypeBlackAndWhite];
// Gradient Effect
AKGradientImageEffect *gradientEffect = [[AKGradientImageEffect alloc] init];
[gradientEffect setBlendMode:kCGBlendModeMultiply];
UIColor *beginColor = [UIColor colorWithRed:144.0f / 255.0f
green:144.0f / 255.0f
blue:144.0f / 255.0f
alpha:1.0f];
UIColor *endColor = [UIColor colorWithRed:103.0f / 255.0f
green:103.0f / 255.0f
blue:103.0f / 255.0f
alpha:1.0f];
// Color Effect
AKColorImageEffect *colorEffect = [[AKColorImageEffect alloc] init];
[colorEffect setBlendMode:kCGBlendModeColor];
[colorEffect setColor:[UIColor colorWithRed: 0.0f / 255.0f
green:152.0f / 255.0f
blue:255.0f / 255.0f
alpha:1.0f]];
// Corner Radius Effect
AKCornerRadiusImageEffect *cornerRadiusEffect = [[AKCornerRadiusImageEffect alloc] init];
[cornerRadiusEffect setCornerRadii:AKCornerRadiiMake(50.0f, 10.0f, 10.0f, 5.0f)];
[gradientEffect setColors:[NSArray arrayWithObjects:beginColor, endColor, nil]];
[renderer setImageEffects:[NSArray arrayWithObjects:
noiseEffect,
gradientEffect,
colorEffect,
cornerRadiusEffect,
nil]];
UIImage *image = [renderer imageWithSize:[imageView frame].size
options:nil];
[imageView setImage:image];
[[self view] addSubview:imageView];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end