Package java.awt.image

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


/* 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


/*     */       }
/* 208 */       out.writeBoolean(cm.hasAlpha());
/* 209 */       out.writeBoolean(cm.isAlphaPremultiplied());
/* 210 */       out.writeInt(cm.getTransparency());
/*     */
/* 213 */       SampleModel sm = cm.createCompatibleSampleModel(1, 1);
/* 214 */       out.writeInt(sm.getTransferType());
/* 215 */     } else if ((this.colorModel instanceof IndexColorModel)) {
/* 216 */       IndexColorModel cm = (IndexColorModel)this.colorModel;
/* 217 */       out.writeInt(3);
/* 218 */       int size = cm.getMapSize();
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

          final SampleModel oldSM = sourceRaster.getSampleModel();
          final ColorModel cm = new ComponentColorModel(ColorSpace
              .getInstance(ColorSpace.CS_GRAY), false, false,
              Transparency.OPAQUE, oldSM.getDataType());
          layout.setColorModel(cm);
          layout.setSampleModel(cm.createCompatibleSampleModel(oldSM
              .getWidth(), oldSM.getHeight()));
          hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout));
          output = (GridCoverage2D) new SelectSampleDimension()
              .doOperation(parameters, hints);
        }
View Full Code Here

              numbands >= 3 ? new int[] { 8, 8, 8, 8 }
                  : new int[] { 8, 8 }, true, false,
              Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);
          final ImageLayout imageLayout = new ImageLayout();
          imageLayout.setColorModel(cm);
          imageLayout.setSampleModel(cm.createCompatibleSampleModel(finalImage.getWidth(), finalImage.getHeight()));
          // merge and go to rgb
          finalImage =
            new ImageWorker(finalImage)
              .setRenderingHints(hints)
              .setRenderingHint(JAI.KEY_IMAGE_LAYOUT,imageLayout)
View Full Code Here

                final ColorModel cm = new ComponentColorModel(ColorSpace
                                .getInstance(ColorSpace.CS_GRAY), false, false,
                                Transparency.OPAQUE, DataBuffer.TYPE_SHORT);
                // building the final image layout
                final Dimension tileSize = ImageUtilities.toTileSize(new Dimension(originalGridRange.getSpan(0), originalGridRange.getSpan(1)));
                final SampleModel sm = cm .createCompatibleSampleModel(tileSize.width, tileSize.height);               

                ImageLayout il = new ImageLayout(0, 0, originalGridRange.getSpan(0),originalGridRange.getSpan(1));
                il.setTileGridXOffset(0).setTileGridYOffset(0).setTileWidth(tileSize.width).setTileHeight(tileSize.height);
                il.setColorModel(cm).setSampleModel(sm);
                setlayout(il);
View Full Code Here

                    type); // Type of primitive array used to represent pixel.
            /*
             * Creating the final image layout which should allow us to change color model.
             */
            layout.setColorModel(newCm);
            layout.setSampleModel(newCm.createCompatibleSampleModel(image.getWidth(),
                    image.getHeight()));
        } else {
            final int numBands = image.getSampleModel().getNumBands();
            final ColorModel newCm = new ComponentColorModel(new BogusColorSpace(numBands), false, // If true, supports transparency.
                    false, // If true, alpha is premultiplied.
View Full Code Here

                    type); // Type of primitive array used to represent pixel.
            /*
             * Creating the final image layout which should allow us to change color model.
             */
            layout.setColorModel(newCm);
            layout.setSampleModel(newCm.createCompatibleSampleModel(image.getWidth(),
                    image.getHeight()));
        }
        hints.put(JAI.KEY_IMAGE_LAYOUT, layout);
        return hints;
    }
View Full Code Here

            final ComponentColorModel destinationColorModel = new ComponentColorModel(
                    numDestinationBands >= 3 ? ColorSpace.getInstance(ColorSpace.CS_sRGB)
                            : ColorSpace.getInstance(ColorSpace.CS_GRAY), bits, alpha,
                    cm.isAlphaPremultiplied(), alpha ? Transparency.TRANSLUCENT
                            : Transparency.OPAQUE, datatype);
            final SampleModel destinationSampleModel = destinationColorModel
                    .createCompatibleSampleModel(image.getWidth(), image.getHeight());
            layout.setColorModel(destinationColorModel);
            layout.setSampleModel(destinationSampleModel);
            image = LookupDescriptor.create(image, lut, hints);
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.