CoreImage-with-EAGLContext

https://github.com/anaglik/CoreImage-with-EAGLContext

Simple example of drawing manipulated image to CIContext based on EAGLContext. This setup is recomended when applicaion needs Real-Time performance.(image is never copied to CPU memory).

一个简单的例子,在EAGLContext上下文中将被操作的图片绘制进CIContext。当你的应用需要实时变换图片的时候,建议你这么使用(图片永远不会被拷贝进内存当中)。

In this example I am using "CIMaskToAlpha" filter to replace background color of image below with color of main view.

这个例子中,我使用了CIMaskToAlpah滤镜,将下面图片的背景颜色替换成主view上背景颜色。

Result Image looks like this :

结果如下所示:

附录:

“UIImage+Blur.h” + “UIImage+Blur.m”

//
// UIImage+Blur.h
//
// Created by Luke on 13-9-3.
// Copyright (c) 2013年 LukeCheng. All rights reserved.
// #import <UIKit/UIKit.h> @interface UIImage (Blur) - (UIImage *)blur:(CGFloat)radius; - (UIImage *)blur; @end
//
// UIImage+Blur.m
//
// Created by Luke on 13-9-3.
// Copyright (c) 2013年 LukeCheng. All rights reserved.
// #import "UIImage+Blur.h" @implementation UIImage (Blur) - (UIImage *)blur:(CGFloat)radius
{
CIContext *context = [CIContext contextWithOptions:nil];
CIImage *inputImage = [[CIImage alloc] initWithImage:self];
// create gaussian blur filter
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];
[filter setValue:inputImage forKey:kCIInputImageKey];
[filter setValue:[NSNumber numberWithFloat:radius] forKey:@"inputRadius"];
// blur image
CIImage *result = [filter valueForKey:kCIOutputImageKey];
CGImageRef cgImage = [context createCGImage:result fromRect:[result extent]];
UIImage *image = [UIImage imageWithCGImage:cgImage];
CGImageRelease(cgImage); return image;
} - (UIImage *)blur
{
return [self blur:10.0f];
} @end

[翻译] CoreImage-with-EAGLContext的更多相关文章

  1. [翻译] NSImage+HHTint - Tints grayscale images using CoreImage

    NSImage+HHTint - Tints grayscale images using CoreImage https://github.com/gloubibou/NSImage-HHTint ...

  2. CoreImage 处理图片

    1.CoreImage 滤镜的使用(马赛克模糊) CoreImage是苹果公司为了简化图片处理的难度而开发出来的类库. 随着iOS版本号升级以及硬件性能的不断提升,CoreImage将支持越来越多的滤 ...

  3. iOS-图像之CoreImage框架

    1.coreImage的介绍   coreImage是IOS5中新加入的一个Objective-C的框架,提供了强大高效的图像处理功能,用来对基于像素的图像进行操作与分析.iOS提供了很多强大的滤镜( ...

  4. iOS CoreImage之滤镜简单使用

    代码地址如下:http://www.demodashi.com/demo/11605.html 老骥伏枥,志在千里 前记 最近一直在研究图像处理方面,既上一篇iOS Quart2D绘图之UIImage ...

  5. [Swift通天遁地]八、媒体与动画-(4)给相机添加CoreImage滤镜效果

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  6. iOS CoreImage图片处理动态渲染(滤镜)

    // //  ViewController.m //  CoreImageOfDong // //  Created by Dong on 15/6/30. //  Copyright (c) 201 ...

  7. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  8. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  9. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  10. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

随机推荐

  1. #!/usr/bin/python和#!/usr/bin/env 的区别

    #!/usr/bin/python 通常在一个.py文件开头都会有这个语句 它只在Linux系统下生效,意思是当作为可执行文件运行时调用的解释器的位置上面代码的意思是调用/usr/bin/下的Pyth ...

  2. 自然语言处理--TF-IDF(关键词提取)

    TF-IDF算法 TF-IDF(词频-逆文档频率)算法是一种统计方法,用以评估一字词对于一个文件集或一个语料库中的其中一份文件的重要程度.字词的重要性随着它在文件中出现的次数成正比增加,但同时会随着它 ...

  3. mac 上安装 redis

    1.从http://redis.io 下载redis包,这里选择了redis-3.2.3 2.将下载的 redis-3.2.3.tar.gz 包拷贝到 /usr/local 目录 3.执行 sudo ...

  4. SpringBoot入门 (一) HelloWorld

    一 什么是springboot springboot是一个全新的框架,它设计的目的简化spring项目的初始环境的搭建和开发,主要有以下几个特点: 1.简化初始配置 ,可与主流框架集成: 2.内置Se ...

  5. Java中float和double转换的问题

    为什么double转float不会出现数据误差,而float转double却误差如此之大?   double d = 3.14; float f = (float)d; System.out.prin ...

  6. google tensorflow bert代码分析

    参考网上博客阅读了bert的代码,记个笔记.代码是 bert_modeling.py 参考的博客地址: https://blog.csdn.net/weixin_39470744/article/de ...

  7. [codeup] 1128 出租车费

    题目描述 某市出租车计价规则如下:起步4公里10元,即使你的行程没超过4公里:接下来的4公里,每公里2元:之后每公里2.4元.行程的最后一段即使不到1公里,也当作1公里计费. 一个乘客可以根据行程公里 ...

  8. 消息管理-activemq

    1.ConnectionFactory("tcp://192.168.1.103:61616/"); 本机地址192.168.1.103 也 可以是localhost 消息的生产者 ...

  9. 使用 Flask 框架写用户登录功能的Demo时碰到的各种坑(五)——实现注册功能

    使用 Flask 框架写用户登录功能的Demo时碰到的各种坑(一)——创建应用 使用 Flask 框架写用户登录功能的Demo时碰到的各种坑(二)——使用蓝图功能进行模块化 使用 Flask 框架写用 ...

  10. ASP.NET MVC 学习笔记-4.ASP.NET MVC中Ajax的应用

    Ajax的全名为:Asynchronous Javascript And XML(异步 JavaScript 和 XML),是指一种创建交互式网页应用的网页开发技术.Ajax技术首先向Web服务器发送 ...