//
// ViewController.m
// GPUImageTest
//
// Created by 志刚杨 on 16/6/8.
// Copyright © 2016年 voidcat. All rights reserved.
//
#import "ViewController.h"
#import <GPUImage/GPUImageBrightnessFilter.h>
#import <GPUImage/GPUImageTiltShiftFilter.h>
#import <GPUImage/GPUImagePicture.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIImage *pic = [UIImage imageNamed:@"999.jpg"];
//创建滤镜
//GPUImageBrightnessFilter *filter = [[GPUImageBrightnessFilter alloc] init];
GPUImageTiltShiftFilter *filter = [[GPUImageTiltShiftFilter alloc] init];
//filter.brightness = 0.5;
filter.blurRadiusInPixels = 20;
[filter forceProcessingAtSize:pic.size];
[filter useNextFrameForImageCapture];
//获取数据源
GPUImagePicture *gpic = [[GPUImagePicture alloc] initWithImage:pic];
[gpic addTarget:filter];
[gpic processImage];
UIImage *newImage = [filter imageFromCurrentFramebuffer];
UIImageView *imgageView = [[UIImageView alloc] initWithImage:newImage];
imgageView.frame = self.view.frame;
[self.view addSubview:imgageView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
发表回复