zoukankan      html  css  js  c++  java
  • GPUImage的简单使用

    - (void)viewDidLoad

    {

        [super viewDidLoad];

       self.view.backgroundColor = [UIColor whiteColor];

        UIImage *image = [UIImage imageNamed:@"2"];

        //原图片

        UIImageView *imageOri = [[UIImageView alloc]initWithFrame:CGRectMake(5, 20, 150, 90)];

        imageOri.image = image;

        [self.view addSubview:imageOri];

        //创建一个亮度滤镜

        GPUImageBrightnessFilter *passthroughFilter = [[GPUImageBrightnessFilter alloc]init];

        passthroughFilter.brightness = - 0.5;

        //设置要渲染的滤镜

        [passthroughFilter forceProcessingAtSize:image.size];

        //获取要渲染的图片

        GPUImagePicture *stillImageSource = [[GPUImagePicture alloc]initWithImage:image];

        //添加上滤镜

        [stillImageSource addTarget:passthroughFilter];

        //开始渲染

        [stillImageSource processImage];

        //获取渲染后的图片

        UIImage *nearestNeighborImage = [passthroughFilter imageFromCurrentlyProcessedOutput];

        //加载出来

        UIImageView *imageView = [[UIImageView alloc]initWithImage:nearestNeighborImage];

        imageView.frame = CGRectMake(160, 20, 150,  90);

        [self.view addSubview:imageView];

    }

  • 相关阅读:
    java volatile关键字解惑
    Java 反射
    拷贝源实体类到目标实体类中
    Bean和Map之间的转换
    DateUtils时间的封装
    HttpClient的代码封装,便于直接调用
    HttpClient语法
    LinkedHashMap+ConcurrentHashMap+hashMap的区别
    1006 Tick and Tick
    Event Flow
  • 原文地址:https://www.cnblogs.com/qianyindichang/p/3977574.html
Copyright © 2011-2022 走看看