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

https://github.com/gloubibou/NSImage-HHTint
This category on NSImage adds a single method:
- (NSImage *)hh_imageTintedWithColor:(NSColor *)tint;
This method creates a tinted copy of the image. Colored / gray pixels of the original image lead to pixels of an equally dark shade of the tint color.
This code was originally written for Tembo.app. The navigation bar in Tembo is build from grayscale images. At runtime these are tinted to a dark blue. In Tembo's drill-down view the same process is applied to a stock NSSegementedControl to make it match the color of the navigation bar.
这个category给NSImage添加了一个方法:
- (NSImage *)hh_imageTintedWithColor:(NSColor *)tint;
这个方法会创建一个image的copy备份,之前灰度的图片会填充上一些颜色。
这份代码最初是写给应用Tembo.app的。Tembo应用中导航栏上的图片是灰白图片,运行时动态的填充为深蓝色。在Tembo的下拉view中,NSSegementedControl也用了同样的方式,在下拉过程中填充颜色来保持与导航栏上的颜色一致。
[翻译] NSImage+HHTint - Tints grayscale images using CoreImage的更多相关文章
- 【翻译】给初学者的 Neural Networks / 神经网络 介绍
本文翻译自 SATYA MALLICK 的 "Neural Networks : A 30,000 Feet View for Beginners" 原文链接: https:// ...
- 百度翻译api 实现简易微信翻译小程序
介绍 口袋翻译 口袋翻译 微信小程序 翻译功能 含7类语言的相互翻译 包含最近10条的翻译历史回溯功能 微信搜索:简e翻译 功能展示 使用百度翻译api需要申请 appid 与 key 并在 ap ...
- 调用百度API写了一个js翻译小工具
目前还未完成的功能有:textarea高度自适应,移动端与pc端都写了.效果如图: html: <!DOCTYPE html> <html lang="en"&g ...
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
随机推荐
- 自然语言处理--Word2vec(一)
一.自然语言处理与深度学习 自然语言处理应用 深度学习模型 为什么需要用深度学习来处理呢 二.语言模型 1.语言模型实例: 机器翻译 拼写纠错 ...
- Python虚拟环境中pip install时没有权限问题
virtualenv Permission denied 新建的python虚拟环境的目录的所属者必须是当前用户,才不会出现这种错误 比如 virtualenv py27 sudo chown zzf ...
- Shiro的Filter机制详解---源码分析
Shiro的Filter机制详解 首先从spring-shiro.xml的filter配置说起,先回答两个问题: 1, 为什么相同url规则,后面定义的会覆盖前面定义的(执行的时候只执行最后一个). ...
- Druid连接池(三)
十二.Druid缓存 连接Oracle数据库,打开PSCache,在其他的数据库连接池都会存在内存占用过多的问题,Druid是唯一解决这个问题的连接池. Oracle数据库下PreparedState ...
- C# 新建 exe文件,并且自定义协议从浏览器中启动该程序
1. C# 新建一个 exe 文件: 打开你的 vs ,[文件] ---> [新建] ---> [项目] 选择 Windows 窗体应用,并起一个名字: 接着该文件会在当前项目的 myap ...
- [POI 2014]RAJ-Rally
Description 题库链接 给定一个 \(N\) 个点 \(M\) 条边的有向无环图,每条边长度都是 \(1\).请找到一个点,使得删掉这个点后剩余的图中的最长路径最短. \(1\leq N\l ...
- HTML5本地存储localStorage、sessionStorage基本用法、遍历操作、异常处理等
HTML5 的本地存储 API 中的 localStorage 与 sessionStorage 在使用方法上是相同的,区别在于 sessionStorage 在关闭页面后即被清空,而 localSt ...
- Spring Boot + MyBatis + Druid + Redis + Thymeleaf 整合小结
Spring Boot + MyBatis + Druid + Redis + Thymeleaf 整合小结 这两天闲着没事想利用**Spring Boot**加上阿里的开源数据连接池**Druid* ...
- fuzhou 1075 分解素因子
Problem 1075 分解素因子 Accept: 1331 Submit: 2523Time Limit: 1000 mSec Memory Limit : 32768 KB Prob ...
- UVA11624(KB1-J)
Fire! Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of ...