forked from alejandrojapkin/CocoaLUT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GPUImageCocoaLUTFilter.m
43 lines (34 loc) · 1.05 KB
/
GPUImageCocoaLUTFilter.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
//
// GPUImageCocoaLUTFilter.m
// Pods
//
// Created by Wil Gieseler on 8/10/14.
//
//
#import "GPUImageCocoaLUTFilter.h"
#import "CocoaLUT.h"
#import "LUTFormatterUnwrappedTexture.h"
#if defined(COCOAPODS_POD_AVAILABLE_GPUImage)
@implementation GPUImageCocoaLUTFilter {
GPUImagePicture *lookupImageSource;
}
- (id)initWithLUT:(LUT *)lut {
if (!(self = [super init])) {
return nil;
}
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
UIImage *image = [LUTFormatterUnwrappedTexture imageFromLUT:lut bitdepth:8];
#else
NSImage *image = [LUTFormatterUnwrappedTexture imageFromLUT:lut bitdepth:8];
#endif
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;
}
@end
#endif