Package java.awt.image

Examples of java.awt.image.IndexColorModel.createCompatibleSampleModel()


            if(csSerialized) {
                out.writeBoolean(cm.isAlphaPremultiplied());
                // Create a SampleModel to get the transferType. This is
                // absurd but is the only apparent way to retrieve this
                // value.
                SampleModel sm = cm.createCompatibleSampleModel(1, 1);
                out.writeInt(sm.getTransferType());
            }
        } else {
            throw new RuntimeException(JaiI18N.getString("ColorModelProxy0"));
        }
View Full Code Here


            IndexColorModel cm = new IndexColorModel(8,
                                                     256,
                                                     palette,
                                                     0,
                                                     false);
            SampleModel sm = cm.createCompatibleSampleModel(thumbWidth,
                                                            thumbHeight);
            WritableRaster raster =
                Raster.createWritableRaster(sm, buffer, null);
            return new BufferedImage(cm,
                                     raster,
View Full Code Here

/* 222 */       out.writeInt(size);
/* 223 */       out.writeObject(cmap);
/* 224 */       out.writeBoolean(cm.hasAlpha());
/* 225 */       out.writeInt(cm.getTransparentPixel());
/*     */
/* 228 */       SampleModel sm = cm.createCompatibleSampleModel(1, 1);
/* 229 */       out.writeInt(sm.getTransferType());
/* 230 */     } else if ((this.colorModel instanceof DirectColorModel)) {
/* 231 */       DirectColorModel cm = (DirectColorModel)this.colorModel;
/* 232 */       out.writeInt(4);
/* 233 */       boolean csSerialized = serializeColorSpace(cm.getColorSpace(), out);
View Full Code Here

/* 243 */         out.writeInt(cm.getAlphaMask());
/*     */       }
/* 245 */       if (csSerialized) {
/* 246 */         out.writeBoolean(cm.isAlphaPremultiplied());
/*     */
/* 250 */         SampleModel sm = cm.createCompatibleSampleModel(1, 1);
/* 251 */         out.writeInt(sm.getTransferType());
/*     */       }
/*     */     } else {
/* 254 */       throw new RuntimeException(JaiI18N.getString("ColorModelProxy0"));
/*     */     }
View Full Code Here

/* 238 */       out.writeInt(size);
/* 239 */       out.writeObject(cmap);
/* 240 */       out.writeBoolean(cm.hasAlpha());
/* 241 */       out.writeInt(cm.getTransparentPixel());
/*     */
/* 244 */       SampleModel sm = cm.createCompatibleSampleModel(1, 1);
/* 245 */       out.writeInt(sm.getTransferType());
/* 246 */     } else if ((colorModel instanceof DirectColorModel)) {
/* 247 */       DirectColorModel cm = (DirectColorModel)colorModel;
/* 248 */       out.writeInt(4);
/* 249 */       boolean csSerialized = serializeColorSpace(cm.getColorSpace(), out);
View Full Code Here

/* 259 */         out.writeInt(cm.getAlphaMask());
/*     */       }
/* 261 */       if (csSerialized) {
/* 262 */         out.writeBoolean(cm.isAlphaPremultiplied());
/*     */
/* 266 */         SampleModel sm = cm.createCompatibleSampleModel(1, 1);
/* 267 */         out.writeInt(sm.getTransferType());
/*     */       }
/*     */     } else {
/* 270 */       throw new RuntimeException(JaiI18N.getString("ColorModelState0"));
/*     */     }
View Full Code Here

        int transparentPixel = noDataValue;
        IndexColorModel colorModel = new IndexColorModel(8, mapSize, cmap, 0, true,
                transparentPixel, DataBuffer.TYPE_BYTE);

        SampleModel sampleModel = colorModel.createCompatibleSampleModel(sampleImageWidth,
                sampleImageHeight);
        ImageTypeSpecifier its = new ImageTypeSpecifier(colorModel, sampleModel);
        return its;
    }
View Full Code Here

        int transparentPixel = noDataValue;
        IndexColorModel colorModel = new IndexColorModel(8, mapSize, cmap, 0, false,
                transparentPixel, DataBuffer.TYPE_BYTE);

        SampleModel sampleModel = colorModel.createCompatibleSampleModel(sampleImageWidth,
                sampleImageHeight);
        ImageTypeSpecifier its = new ImageTypeSpecifier(colorModel, sampleModel);
        return its;
    }
View Full Code Here

  private static BufferedImage getSyntheticTranslucentIndexed() {
    final byte bb[]= new byte[256];
    for(int i =0;i<256;i++)
      bb[i]=(byte)i;
    final IndexColorModel icm = new IndexColorModel(8, 256, bb, bb, bb,bb);
    final WritableRaster raster=RasterFactory.createWritableRaster(icm.createCompatibleSampleModel(1024, 1024), null);
    for(int i= raster.getMinX();i<raster.getMinX()+raster.getWidth();i++)
      for(int j= raster.getMinY();j<raster.getMinY()+raster.getHeight();j++)
        raster.setSample(i,j, 0, (i+j)/32);
    return new BufferedImage(icm, raster, false,null);   
  }
View Full Code Here

                        new byte[]{0,        0,        (byte)255,0,16,32,64,(byte)128,1,2,3,4,5,6,7,8});
        assertEquals(16, icm.getMapSize());
       
        // create random data
        WritableRaster data = com.sun.media.jai.codecimpl.util.RasterFactory.createWritableRaster(
                        icm.createCompatibleSampleModel(32,32),
                        new Point(0,0));
        for(int x=data.getMinX();x<data.getMinX()+data.getWidth();x++){
                for(int y=data.getMinY();y<data.getMinY()+data.getHeight();y++){
                        data.setSample(x, y, 0, (x+y)%8);
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.