ShadingContext.java 文件源码

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

项目:sambox 作者:
/**
 * Constructor.
 *
 * @param shading the shading type to be used
 * @param cm the color model to be used
 * @param xform transformation for user to device space
 * @param matrix the pattern matrix concatenated with that of the parent content stream
 * @throws java.io.IOException if there is an error getting the color space
 * or doing background color conversion.
 */
public ShadingContext(PDShading shading, ColorModel cm, AffineTransform xform,
                      Matrix matrix) throws IOException
{
    this.shading = shading;
    shadingColorSpace = shading.getColorSpace();

    // create the output color model using RGB+alpha as color space
    ColorSpace outputCS = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    outputColorModel = new ComponentColorModel(outputCS, true, false, Transparency.TRANSLUCENT,
            DataBuffer.TYPE_BYTE);

    // get background values if available
    COSArray bg = shading.getBackground();
    if (bg != null)
    {
        background = bg.toFloatArray();
        rgbBackground = convertToRGB(background);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号