如何把RGB函数的返回值还原成Red、Green、Blue
来源:互联网 发布:js两个字符串比较 编辑:程序博客网 时间:2024/06/05 11:25
RGB函数就是(1*R+256*G+65536*B)
方法一:
colour=RGB(red,green,blue)
red=colour And &HFF
green= (Color And 65280) \ 256
blue=(Color And &HFF0000) \ 65536
方法二:
Option Explicit
Private Sub Command1_Click()
GetRGB RGB(16, 39, 0)
End Sub
Sub GetRGB(ByVal color As Long, Optional ByRef red As Byte, Optional ByRef green As Byte, Optional ByRef blue As Byte)
Dim temp As String
temp = Right("000000" & Hex(color), 6)
red = "&H" & Right(temp, 2)
green = "&H" & Mid(temp, 3, 2)
blue = "&H" & Left(temp, 2)
End Sub
---------------------------------------------------------------
方法三:
R = Color And &HFF& '通过和16进制数FF进行“与”操作取得低8位
G=(Color\256) And &HFF& '先右移8位,再取低8位,相当于原来的中间8位
B = Col \ 65536 '右移16位,得到的8位,相当于原来的高8位
还有一种写法:
R = Color Mod 256
G = (Color\256) Mod 256
B = Color \65536
这种写法和上面的区别在于使用了“取余数”运算符Mod,结果和上面一样
阅读全文
0 0
- 如何把RGB函数的返回值还原成Red、Green、Blue
- rgba括号中前3个数字代表着 red green blue三种颜色的rgb值
- android 改变ImageView的颜色(Alpha值、Red值、Green值、Blue值)
- background:rgba(red,green,blue,alphavalue)
- projecteuler No.116,117 Red, green, blue tiles
- ios 的colorWithRed:green:blue:alpha:
- IOS7.0系统上,特定颜色调用`- getRed:green:blue:alpha:`方法返回结果有误的问题
- color:rgba(red,green,blue,alpha)和background-color:rgba(r,g,b,a)
- 解决[UIColor colorWithRed: green: blue: alpha:] 没有效果的问题
- Red-Green-Refactor
- cf478D Red-Green Towers
- 把函数当做返回值
- zabbix监控elasticSearch集群健康值green yellow red状态
- 将rgb值还原成图片(python)
- 把exe的flash还原成swf
- 如何把本地数据库还原到远程服务器的数据库
- codeforce 之 Red-Green Towers
- codeforces D - Red-Green Towers
- Spring boot jar包Ebean出错解决
- int 补零
- ECharts使用
- Carthage的安装和使用
- 飞天侠淘宝客源码8.0终结版仿卷皮模板-免费开源
- 如何把RGB函数的返回值还原成Red、Green、Blue
- 文章标题
- 第四天课程总结
- iOS 使用ijkplayer做直播项目流程小结
- 《Going deeper with Convolutions》论文阅读
- Python代码中的捕捉性能-内存分析
- 物联网通信技术NB-IoT与LoRa技术分析
- 课堂笔记
- pymongo