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. java基本类型自动转换

    具体自动提升类型如上图所示.其中long->float的转换一开始让我感觉有点问题,因为long是64位的,而float却是32位的. 遂找寻答案,参考博客java中long到float的自动转 ...

  2. 笔记六:python字符串运算与函数

    一:学习内容 字符串运算 字符串函数-strip() 字符串函数-大小写互换 字符串函数-字符串对齐 字符串函数-搜索 字符串函数-替换 字符串函数-split切割 字符串函数-连接join 字符串函 ...

  3. Node.js文件操作二

    前面的博客 Node.js文件操作一中主要是对文件的读写操作,其实还有文件这块还有一些其他操作. 一.验证文件path是否正确(系统是如下定义的) fs.exists = function(path, ...

  4. 本地git关联远程github

    0. 前言 我们开发的项目,均在本地开发:为了保证项目进度的一致性和公开性等,我们通常将开发过程代码或成品放置到github中,本文就讲述如何使得本地git与远程github同步! PS:以下两个名称 ...

  5. 15.Generator 函数的语法

    Generator 函数的语法 Generator 函数的语法 简介 基本概念 Generator 函数是 ES6 提供的一种异步编程解决方案,语法行为与传统函数完全不同.本章详细介绍 Generat ...

  6. Oracle数据库进行撤销

    第一步:在v$sqlarea 这视图里面找到你操作那条SQL的时间;select r.FIRST_LOAD_TIME,r. from v$sqlarea r order by r.FIRST_LOAD ...

  7. thinkphp3.2 success方法注意

    success方法的url一定要用U()方法来生成, $this->success('修改成功',U('showlist'),3);

  8. Android Studio最全插件整理

    在Android开发中,合理的使用Android Studio插件不但可以提高开发效率,还能从整体上提高代码的质量.下面就Android开发中常见的一些插件做一个整理. 1,GsonFormatGso ...

  9. Play-with-chrome之环境搭建

    前言 浏览器漏洞在 APT 攻击中用的比较多,而且这基本上是用户上网的标配了,所以研究浏览器的漏洞是十分有前景的,我认为.我选择 chrome 浏览器 ( chromium和 chrome之间的关系请 ...

  10. spring <context:annotation-config/> 注解作用

    <context:component-scan>包含<context:annotation-config/>的作用 <context:annotation-config/ ...