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的更多相关文章

  1. 【翻译】给初学者的 Neural Networks / 神经网络 介绍

    本文翻译自 SATYA MALLICK 的  "Neural Networks : A 30,000 Feet View for Beginners" 原文链接: https:// ...

  2. 百度翻译api 实现简易微信翻译小程序

    介绍 口袋翻译 口袋翻译 微信小程序 翻译功能 含7类语言的相互翻译 包含最近10条的翻译历史回溯功能 微信搜索:简e翻译 功能展示   使用百度翻译api需要申请 appid 与 key 并在 ap ...

  3. 调用百度API写了一个js翻译小工具

    目前还未完成的功能有:textarea高度自适应,移动端与pc端都写了.效果如图: html: <!DOCTYPE html> <html lang="en"&g ...

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

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

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

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

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

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

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

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

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

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

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

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

随机推荐

  1. SpringMVC访问WEB-INF下的jsp的方法

    当输入localhost:8080/项目名 浏览器弹出不知道神马错误 The absolute uri: http://java.sun.com/jsp/jstl/core cannot be res ...

  2. asterisk与freepbx常用的命令

    asterisk 常用命令: 通过asterisk -r 连接我们的asterisk. 在CLI中常用的命令: sip show peers 显示所有的SIP peers(包括friends) sip ...

  3. 将已有Git库代码推送到新建库中

    cd /path/to/your/git/repo/ git remote -v git remote rm origin git remote add origin ssh://abc@gmail. ...

  4. 笔记二:python编码详解

    一:学习内容 python编码讲解 python编码说明 python中文乱码解决三部曲 二:python编码讲解 1. ASCII编码 美国信息交换标准代码(American Standard Co ...

  5. 记laravel5.5项目php-fpm迁移到swoole4.2.9

    事起说明 最近对上线半年多的laravel项目做了一次少大的改动,由php-fpm改为swoole,这里做个记录. 2019年过年前半个月,上阿里云后台查看前一天的访问请求日志,发现很多接口响应慢.翻 ...

  6. javascript实例——鼠标特效篇(包含2个实例)

    鼠标是现在电脑的基本配置之一,也是最常用的输入命令的工具之一.本文将将一些与鼠标有关系的特效. 1.跟随鼠标移动的彩色星星 如题,会根据鼠标的移动而移动,并在鼠标周围随机来回移动,让人感觉在放大缩小. ...

  7. Linq之Distinct详解

    前天在做批量数据导入新增时,要对数据进行有效性判断,其中还要去除重复,如果没出现linq的话可能会新声明一个临时对象集合,然后遍历原始数据判断把符合条件的数据添加到临时集合中,这在有了linq之后显得 ...

  8. AE开发流程

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  9. SpringBoot整合mybatis-plus入门

    pom.xml中加入如下依赖 <dependency> <groupId>com.baomidou</groupId> <artifactId>myba ...

  10. Java 源程序与编译型运行区别