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


Java PackedColorModel类代码示例

本文整理汇总了Java中java.awt.image.PackedColorModel的典型用法代码示例。如果您正苦于以下问题:Java PackedColorModel类的具体用法?Java PackedColorModel怎么用?Java PackedColorModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: is_INT_PACK

import java.awt.image.PackedColorModel; //导入依赖的package包/类
public boolean is_INT_PACK(ColorModel cm) {
       // Check ColorModel is of type DirectColorModel
     if(!(cm instanceof PackedColorModel)) return false;

     PackedColorModel pcm = (PackedColorModel)cm;

     int [] masks = pcm.getMasks();

     // Check transfer type
     if(masks.length != 4) return false;

     if (masks[0] != 0x00ff0000) return false;
     if (masks[1] != 0x0000ff00) return false;
     if (masks[2] != 0x000000ff) return false;
     if (masks[3] != 0xff000000) return false;

     return true;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:19,代码来源:SVGComposite.java

示例2: info

import java.awt.image.PackedColorModel; //导入依赖的package包/类
public Struct info()  throws ExpressionException{
	if(sctInfo!=null) return sctInfo;
	
	Struct sctInfo=new StructImpl(),sct;
	
	
	sctInfo.setEL("height",new Double(getHeight()));
	sctInfo.setEL("width",new Double(getWidth()));
	sctInfo.setEL("source",source==null?"":source.getAbsolutePath());
	//sct.setEL("mime_type",getMimeType());
	
	ColorModel cm = image().getColorModel();
	sct=new StructImpl();
	sctInfo.setEL("colormodel",sct);
	
	sct.setEL("alpha_channel_support",Caster.toBoolean(cm.hasAlpha()));
	sct.setEL("alpha_premultiplied",Caster.toBoolean(cm.isAlphaPremultiplied()));
	sct.setEL("transparency",toStringTransparency(cm.getTransparency()));
	sct.setEL("pixel_size",Caster.toDouble(cm.getPixelSize()));
	sct.setEL("num_components",Caster.toDouble(cm.getNumComponents()));
	sct.setEL("num_color_components",Caster.toDouble(cm.getNumColorComponents()));
	sct.setEL("colorspace",toStringColorSpace(cm.getColorSpace()));
	
    //bits_component
	int[] bitspercomponent = cm.getComponentSize();
	Array arr=new ArrayImpl();
	Double value;
    for (int i = 0; i < bitspercomponent.length; i++) {
    	sct.setEL("bits_component_" + (i + 1),value=new Double(bitspercomponent[i]));
    	arr.appendEL(value);
    }
	sct.setEL("bits_component",arr);
	
    // colormodel_type
	if (cm instanceof ComponentColorModel)		sct.setEL("colormodel_type", "ComponentColorModel");
	else if (cm instanceof IndexColorModel)		sct.setEL("colormodel_type", "IndexColorModel");
	else if (cm instanceof PackedColorModel)	sct.setEL("colormodel_type", "PackedColorModel");
	else sct.setEL("colormodel_type", ListUtil.last(cm.getClass().getName(), '.'));

	
	getMetaData(sctInfo);
	
	ImageMeta.addInfo(format,source,sctInfo);
	
	this.sctInfo=sctInfo;
	return sctInfo;
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:48,代码来源:Image.java

示例3: info

import java.awt.image.PackedColorModel; //导入依赖的package包/类
public Struct info()  throws PageException {
	if(sctInfo!=null) return sctInfo;
	
	Struct sctInfo=new StructImpl(),sct;
	ImageMetaDrew.addInfo(format,source,sctInfo);
	sctInfo=ImageGetEXIFMetadata.flatten(sctInfo);
	
	sctInfo.setEL(KeyConstants._height,new Double(getHeight()));
	sctInfo.setEL(KeyConstants._width,new Double(getWidth()));
	sctInfo.setEL(KeyConstants._source,source==null?"":source.getAbsolutePath());
	//sct.setEL("mime_type",getMimeType());
	
	ColorModel cm = image().getColorModel();
	sct=new StructImpl();
	sctInfo.setEL("colormodel",sct);
	
	sct.setEL("alpha_channel_support",Caster.toBoolean(cm.hasAlpha()));
	sct.setEL("alpha_premultiplied",Caster.toBoolean(cm.isAlphaPremultiplied()));
	sct.setEL("transparency",toStringTransparency(cm.getTransparency()));
	sct.setEL("pixel_size",Caster.toDouble(cm.getPixelSize()));
	sct.setEL("num_components",Caster.toDouble(cm.getNumComponents()));
	sct.setEL("num_color_components",Caster.toDouble(cm.getNumColorComponents()));
	sct.setEL("colorspace",toStringColorSpace(cm.getColorSpace()));
	
    //bits_component
	int[] bitspercomponent = cm.getComponentSize();
	Array arr=new ArrayImpl();
	Double value;
    for (int i = 0; i < bitspercomponent.length; i++) {
    	sct.setEL("bits_component_" + (i + 1),value=new Double(bitspercomponent[i]));
    	arr.appendEL(value);
    }
	sct.setEL("bits_component",arr);
	
    // colormodel_type
	if (cm instanceof ComponentColorModel)		sct.setEL("colormodel_type", "ComponentColorModel");
	else if (cm instanceof IndexColorModel)		sct.setEL("colormodel_type", "IndexColorModel");
	else if (cm instanceof PackedColorModel)	sct.setEL("colormodel_type", "PackedColorModel");
	else sct.setEL("colormodel_type", ListUtil.last(cm.getClass().getName(), '.'));

	
	getMetaData(sctInfo);
	//Metadata.addInfo(format,source,sctInfo);
	Metadata.addExifInfo(format,source,sctInfo);
	this.sctInfo=sctInfo;
	return sctInfo;
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:48,代码来源:Image.java

示例4: PixelAccessor

import java.awt.image.PackedColorModel; //导入依赖的package包/类
/**
 * Constructs a <code>PixelAccessor</code> given a valid
 * <code>SampleModel</code> and a (possibly <code>null</code>)
 * <code>ColorModel</code>.
 *
 * @param sm The <code>SampleModel</code> for the image to be accessed.
 *           Must be valid.
 * @param cm The <code>ColorModel</code> for the image to be accessed.
 *           May be null.
 * @throws IllegalArgumentException  If <code>sm</code> is <code>null</code>.
 */
public PixelAccessor(SampleModel sm, ColorModel cm) {

    if ( sm == null ) {
        throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
    }

    sampleModel = sm;
    colorModel = cm;

    // Information from the SampleModel.
    isComponentSM = sampleModel instanceof ComponentSampleModel;
    isMultiPixelPackedSM = sampleModel instanceof
                           MultiPixelPackedSampleModel;
    isSinglePixelPackedSM = sampleModel instanceof
                            SinglePixelPackedSampleModel;

    bufferType = sampleModel.getDataType();
    transferType = sampleModel.getTransferType();
    numBands = sampleModel.getNumBands();
    sampleSize = sampleModel.getSampleSize();
    sampleType = isComponentSM ? bufferType : getType(sampleSize);

    // Indicates whether the pixel data may be stored in packed format.
    isPacked = sampleType == TYPE_BIT && numBands == 1;

    // Information from the ColorModel.
    hasCompatibleCM = colorModel != null &&
        JDKWorkarounds.areCompatibleDataModels(sampleModel, colorModel);

    if (hasCompatibleCM) {
        isComponentCM = colorModel instanceof ComponentColorModel;
        isIndexCM = colorModel instanceof IndexColorModel;
        isPackedCM = colorModel instanceof PackedColorModel;

        numComponents = colorModel.getNumComponents();
        componentSize = colorModel.getComponentSize();
        int tempType = getType(componentSize);

        componentType = (tempType == TYPE_BIT) ?
                         DataBuffer.TYPE_BYTE : tempType;
    } else {
        isComponentCM = false;
        isIndexCM = false;
        isPackedCM = false;
        numComponents = numBands;
        componentSize = sampleSize;
        componentType = sampleType;
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:61,代码来源:PixelAccessor.java


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