AE IColor.rgb 的计算

原文 AE IColor.rgb 的计算方法

IColor的rgb属性 是通过对应 的红 绿 蓝 值计算出来的,那么AE的内部计算方法是什么呢?

其实就是一个256进制的BGR数。下面是转换算法:

// 组合

public static int calcRGB(int R, int G, int B)//把R G B计算合成IColor.rgb
{
    int baseNum = 33554432;
    int RGBNum = baseNum + R + G * 256 + B * 256 * 256;
    return RGBNum;
}

// 分解; 把IColor.rgb 转成 R G B的值  
 public static void getRGB(int rgb, out int R, out int G, out int B) 
{
    int baseNum = 33554432;
    int n = rgb - baseNum;
    B = n / (256 * 256);
    int d = n % (256 * 256);
    G = d / 256;
    R = d % 256;
}

原文地址:https://www.cnblogs.com/arxive/p/6110060.html