CompositeRed.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:Push2Display 作者:
protected static ColorModel fixColorModel(CachableRed src) {
    ColorModel  cm = src.getColorModel();

    if (cm.hasAlpha()) {
        if (!cm.isAlphaPremultiplied())
            cm = GraphicsUtil.coerceColorModel(cm, true);
        return cm;
    }

    int b = src.getSampleModel().getNumBands()+1;
    if (b > 4)
        throw new IllegalArgumentException
            ("CompositeRed can only handle up to three band images");

    int [] masks = new int[4];
    for (int i=0; i < b-1; i++)
        masks[i] = 0xFF0000 >> (8*i);
    masks[3] = 0xFF << (8*(b-1));
    ColorSpace cs = cm.getColorSpace();

    return new DirectColorModel(cs, 8*b, masks[0], masks[1],
                                masks[2], masks[3],
                                true, DataBuffer.TYPE_INT);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号