当前位置: 首页>>代码示例>>Java>>正文


Java GraphicsUtil.sRGB_Unpre方法代码示例

本文整理汇总了Java中org.apache.batik.ext.awt.image.GraphicsUtil.sRGB_Unpre方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsUtil.sRGB_Unpre方法的具体用法?Java GraphicsUtil.sRGB_Unpre怎么用?Java GraphicsUtil.sRGB_Unpre使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.batik.ext.awt.image.GraphicsUtil的用法示例。


在下文中一共展示了GraphicsUtil.sRGB_Unpre方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ColorMatrixRed

import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
public ColorMatrixRed(CachableRed src, float[][] matrix){
    setMatrix(matrix);

    ColorModel srcCM = src.getColorModel();
    ColorSpace srcCS = null;
    if (srcCM != null)
        srcCS = srcCM.getColorSpace();
    ColorModel cm;
    if (srcCS == null)
        cm = GraphicsUtil.Linear_sRGB_Unpre;
    else {
        if (srcCS == ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB))
            cm = GraphicsUtil.Linear_sRGB_Unpre;
        else
            cm = GraphicsUtil.sRGB_Unpre;
    }

    SampleModel sm =
        cm.createCompatibleSampleModel(src.getWidth(),
                                       src.getHeight());

    init(src, src.getBounds(), cm, sm,
         src.getTileGridXOffset(), src.getTileGridYOffset(), null);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:25,代码来源:ColorMatrixRed.java

示例2: SpecularLightingRed

import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
public SpecularLightingRed(double ks,
                           double specularExponent,
                           Light light,
                           BumpMap bumpMap,
                           Rectangle litRegion,
                           double scaleX, double scaleY,
                           boolean linear) {
    this.ks = ks;
    this.specularExponent = specularExponent;
    this.light = light;
    this.bumpMap = bumpMap;
    this.litRegion = litRegion;
    this.scaleX = scaleX;
    this.scaleY = scaleY;
    this.linear = linear;

    ColorModel cm;
    if (linear)
        cm = GraphicsUtil.Linear_sRGB_Unpre;
    else
        cm = GraphicsUtil.sRGB_Unpre;

    int tw = litRegion.width;
    int th = litRegion.height;
    int defSz = AbstractTiledRed.getDefaultTileSize();
    if (tw > defSz) tw = defSz;
    if (th > defSz) th = defSz;
    SampleModel sm = cm.createCompatibleSampleModel(tw, th);
                                         
    init((CachableRed)null, litRegion, cm, sm,
         litRegion.x, litRegion.y, null);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:33,代码来源:SpecularLightingRed.java

示例3: fixColorModel

import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
/**
 * This function 'fixes' the source's color model.  Right now
 * it just selects if it should have one or two bands based on
 * if the source had an alpha channel.
 */
protected static ColorModel fixColorModel(CachableRed src) {
    ColorModel  cm = src.getColorModel();
    if (cm != null) {
        if (cm.hasAlpha())
            return GraphicsUtil.sRGB_Unpre;

        return GraphicsUtil.sRGB;
    }
    else {
        // No ColorModel so try to make some intelligent
        // decisions based just on the number of bands...
        // 1 bands -> replicated into RGB
        // 2 bands -> Band 0 replicated into RGB & Band 1 -> alpha premult
        // 3 bands -> sRGB (not-linear?)
        // 4 bands -> sRGB premult (not-linear?)
        SampleModel sm = src.getSampleModel();

        switch (sm.getNumBands()) {
        case 1:
            return GraphicsUtil.sRGB;
        case 2:
            return GraphicsUtil.sRGB_Unpre;
        case 3:
            return GraphicsUtil.sRGB;
        }
        return GraphicsUtil.sRGB_Unpre;
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:34,代码来源:Any2sRGBRed.java

示例4: FloodRed

import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
/**
 * Construct a fully transparent image <code>bounds</code> size, will
 * paint one tile with paint.  Thus paint should not be a pattered
 * paint or gradient but should be a solid color.
 * @param bounds the bounds of the image (in fact will respond with
 *               any request).  
 */
public FloodRed(Rectangle bounds,
                Paint paint) {
    super(); // We _must_ call init...

    ColorModel cm = GraphicsUtil.sRGB_Unpre;
    
    int defSz = AbstractTiledRed.getDefaultTileSize();

    int tw = bounds.width;
    if (tw > defSz) tw = defSz;
    int th = bounds.height;
    if (th > defSz) th = defSz;

    // fix my sample model so it makes sense given my size.
    SampleModel sm = cm.createCompatibleSampleModel(tw, th);

    // Finish initializing our base class...
    init((CachableRed)null, bounds, cm, sm, 0, 0, null);

    raster = Raster.createWritableRaster(sm, new Point(0, 0));
    BufferedImage offScreen = new BufferedImage(cm, raster,
                                                cm.isAlphaPremultiplied(),
                                                null);

    Graphics2D g = GraphicsUtil.createGraphics(offScreen);
    g.setPaint(paint);
    g.fillRect(0, 0, bounds.width, bounds.height);
    g.dispose();
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:37,代码来源:FloodRed.java

示例5: createColorModel

import org.apache.batik.ext.awt.image.GraphicsUtil; //导入方法依赖的package包/类
public ColorModel createColorModel() {
    if (Platform.isOSX)
        return GraphicsUtil.sRGB_Pre;
    return GraphicsUtil.sRGB_Unpre;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:6,代码来源:GraphicsNodeRed8Bit.java


注:本文中的org.apache.batik.ext.awt.image.GraphicsUtil.sRGB_Unpre方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。