-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMVLookupFilter.m
48 lines (38 loc) · 1.17 KB
/
CMVLookupFilter.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
//
// CMVLookupFilter.m
// CamvyStory
//
// Created by Camvy Films on 2014-06-04.
// Copyright (c) 2014 Camvy Films. All rights reserved.
//
#import "CMVLookupFilter.h"
#import "GPUImageLookupFilter.h"
@implementation CMVLookupFilter
- (id)init{
NSAssert(NO, @"Call initWithImageName:");
return self;
}
- (id)initWithImageName:(NSString*) imageName;
{
if (!(self = [super init]))
{
return nil;
}
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
UIImage *image = [UIImage imageNamed:imageName];
#else
NSImage *image = [NSImage imageNamed:imageName];
#endif
NSAssert(image, @"To use CMVLookupFilter you need to add %@ to your application bundle.", imageName);
lookupImageSource = [[GPUImagePicture alloc] initWithImage:image];
GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init];
[self addFilter:lookupFilter];
[lookupImageSource addTarget:lookupFilter atTextureLocation:1];
[lookupImageSource processImage];
self.initialFilters = [NSArray arrayWithObjects:lookupFilter, nil];
self.terminalFilter = lookupFilter;
return self;
}
#pragma mark -
#pragma mark Accessors
@end