使用Objective C从RGB转换为HSL [英] Converting from RGB to HSL with Objective C

查看:249
本文介绍了使用Objective C从RGB转换为HSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对目标c很新,但已经编程了一段时间。我开始创建一个可以从RGB转换为HSL然后再转换回来的函数,但我感觉它太长了并朝着错误的方向前进。有没有人知道一种简单的方法来执行这种转换?

I'm quite new to objective c but have been programming for a while. I started creating a function that would convert from RGB to HSL and back again but I get a feeling it is way too long and headed in the wrong direction. Does anyone know of a simple way to perform this conversion?

推荐答案

iPhone SDK中缺少NSColor。您可以使用此实用程序从RGB转换为HSL空间并返回:

NSColor is missing in iPhone SDK. You can use this utility to convert from RGB to HSL space and back:

https://github.com/alessani/ColorConverter

这篇关于使用Objective C从RGB转换为HSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆