阿尔法+ RGB - > ARGB? [英] alpha + RGB -> ARGB?

查看:185
本文介绍了阿尔法+ RGB - > ARGB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在AS3中,有一个实用程序或功能转换为RGB颜色(如为0xFF0000)和α值(例如.5)到32位ARGB值?

In as3, is there a utility or function to convert an RGB color (e.g. 0xFF0000) and an alpha value (e.g. .5) into a A 32-bit ARGB value?

和从ARGB为RGB +阿尔法?

And from ARGB to RGB + alpha?

一些解释:对BitmapData可以在其构造一个ARGB值,但是在精灵填充形状通常采用的RGB值。我想前面提到的公用事业,以确保色彩匹配。

Some explanation: a bitmapdata can take an ARGB value in its constructor, but filling shapes in sprites usually takes RGB values. I would like the aforementioned utilities to ensure colors match up.

推荐答案

VAR的argb :INT =(阿尔法<< 24)| RGB;
VAR RGB  :INT = 0XFFFFFF和放大器; ARGB;
VAR字母:INT =(ARGB >> 24)&0xFF的;

var argb  : int = (alpha<<24)|rgb;
var rgb   : int = 0xFFFFFF & argb;
var alpha : int = (argb>>24)&0xFF;

这篇关于阿尔法+ RGB - &GT; ARGB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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