Examples of TiledImage


Examples of javax.media.jai.TiledImage

        default:
            throw new IllegalArgumentException("Wrong data type");
        }

        // Create the constant operation.
        TiledImage used = new TiledImage(sm, tileW, tileH);
       
        for (int b = 0; b < numBands; b++) {
            for (int j = 0; j < width; j++) {
                for (int k = 0; k < height; k++) {
                    //Addition of a cross on the image
                    if (j == k || j == width - k - 1) {
                        switch (dataType) {
                        case DataBuffer.TYPE_BYTE:
                            used.setSample(j, k, b, crossValueByte);
                            break;
                        case DataBuffer.TYPE_USHORT:
                            used.setSample(j, k, b, crossValueUShort);
                            break;
                        case DataBuffer.TYPE_SHORT:
                            used.setSample(j, k, b, crossValueShort);
                            break;
                        case DataBuffer.TYPE_INT:
                            used.setSample(j, k, b, crossValueInteger);
                            break;
                        case DataBuffer.TYPE_FLOAT:
                            used.setSample(j, k, b, crossValueFloat);
                            break;
                        case DataBuffer.TYPE_DOUBLE:
                            used.setSample(j, k, b, crossValueDouble);
                            break;
                        default:
                            throw new IllegalArgumentException("Wrong data type");
                        }
                      //If selected, the image could be filled
                    } else
                      // a little square of no data on the upper left is inserted
                        if( (j>=20) && (j<50) && (k>=20) && (k<50)){
                            switch (dataType) {
                            case DataBuffer.TYPE_BYTE:
                                used.setSample(j, k, b, 0);
                                break;
                            case DataBuffer.TYPE_USHORT:
                                used.setSample(j, k, b, 0);
                                break;
                            case DataBuffer.TYPE_SHORT:
                                used.setSample(j, k, b, 0);
                                break;
                            case DataBuffer.TYPE_INT:
                                used.setSample(j, k, b, 0);
                                break;
                            case DataBuffer.TYPE_FLOAT:
                                used.setSample(j, k, b, 0);
                                break;
                            case DataBuffer.TYPE_DOUBLE:
                                used.setSample(j, k, b,0);
                                break;
                            default:
                                throw new IllegalArgumentException("Wrong data type");
                            }
                           
                            if( (j>=30) && (j<40) && (k>=20) && (k<30)){
                                switch (dataType) {
                                case DataBuffer.TYPE_BYTE:
                                    used.setSample(j, k, b, crossValueByte);
                                    break;
                                case DataBuffer.TYPE_USHORT:
                                    used.setSample(j, k, b, crossValueUShort);
                                    break;
                                case DataBuffer.TYPE_SHORT:
                                    used.setSample(j, k, b, crossValueShort);
                                    break;
                                case DataBuffer.TYPE_INT:
                                    used.setSample(j, k, b, crossValueInteger);
                                    break;
                                case DataBuffer.TYPE_FLOAT:
                                    used.setSample(j, k, b, crossValueFloat);
                                    break;
                                case DataBuffer.TYPE_DOUBLE:
                                    used.setSample(j, k, b, crossValueDouble);
                                    break;
                                default:
                                    throw new IllegalArgumentException("Wrong data type");
                                }
                            }
                        }else{
                          // No Data is set
                            switch (dataType) {
                            case DataBuffer.TYPE_BYTE:
                                used.setSample(j, k, b, valueB + b);
                                break;
                            case DataBuffer.TYPE_USHORT:
                                used.setSample(j, k, b, valueUS + b);
                                break;
                            case DataBuffer.TYPE_SHORT:
                                used.setSample(j, k, b, valueS + b);
                                break;
                            case DataBuffer.TYPE_INT:
                                used.setSample(j, k, b, valueI + b);
                                break;
                            case DataBuffer.TYPE_FLOAT:
                                float data = valueF + b / 3.0f;
                                used.setSample(j, k, b, data);
                                break;
                            case DataBuffer.TYPE_DOUBLE:
                                double dataD = valueD + b / 3.0d;
                                used.setSample(j, k, b, dataD);
                                break;
                            default:
                                throw new IllegalArgumentException("Wrong data type");
                            }
                        }              
View Full Code Here

Examples of javax.media.jai.TiledImage

                 * interest.
                 */
                // Clones the coordinate point in order to allow multi-thread
                // invocation.
                final GeneralDirectPosition coordinate = new GeneralDirectPosition(this.coordinate);
                final TiledImage tiled = new TiledImage(gridBounds.x, gridBounds.y,
                        gridBounds.width, gridBounds.height, 0, 0, sampleModel, colorModel);
                final Point2D.Double point2D = new Point2D.Double();
                final int numBands = tiled.getNumBands();
                final double[] samples = new double[numBands];
                final double[] padNaNs = new double[numBands];
                Arrays.fill(padNaNs, Double.NaN);
                final WritableRectIter iterator = RectIterFactory.createWritable(tiled, gridBounds);
                if (!iterator.finishedLines()) try {
View Full Code Here

Examples of javax.media.jai.TiledImage

  }
 
    @Test
    public void testTranslatedImage() throws Exception {
      BufferedImage bi = new BufferedImage(256, 256, BufferedImage.TYPE_BYTE_GRAY);
        TiledImage image = new TiledImage(0, 0, 256, 256, 1, 1, bi.getSampleModel().createCompatibleSampleModel(256, 256), bi.getColorModel());
        Graphics g = image.createGraphics();
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, 20, 20);
        g.setColor(new Color(20, 20, 20)); // A dark gray
        g.fillRect(20, 20, 20, 20);
        g.setColor(new Color(200, 200, 200)); // A light gray
View Full Code Here

Examples of javax.media.jai.TiledImage

        g.setColor(new Color(200, 200, 200)); // A light gray
        g.fillRect(216, 236, 20, 20);
        g.dispose();
       
       
        TiledImage image=new TiledImage(
                0,
                0,
                256,
                256,
                128,
                128,
                image_.getColorModel().createCompatibleSampleModel(256, 256),
                image_.getColorModel());
        image.set(image_);
       
       
        RenderedImage indexed = quantize(image);
        assertTrue(indexed.getColorModel() instanceof IndexColorModel);
        IndexColorModel icm = (IndexColorModel) indexed.getColorModel();
View Full Code Here

Examples of javax.media.jai.TiledImage

        assertNotNull(info);
        assertEquals(0, info.getNumFeatures());
    }
   
    private static void createCoverage() {
        TiledImage image = ImageUtils.createConstantImage(WIDTH, HEIGHT, new Integer[]{0, 0, 0});
        for (int band = 0; band < image.getNumBands(); band++) {
            for (int y = 0; y < HEIGHT; y++) {
                for (int x = 0; x < WIDTH; x++) {
                    image.setSample(x, y, band, rand.nextInt(256));
                }
            }
        }
       
        GridCoverageFactory gcf = CoverageFactoryFinder.getGridCoverageFactory(null);
View Full Code Here

Examples of javax.media.jai.TiledImage

        g.setColor(new Color(200, 200, 200)); // A light gray
        g.fillRect(216, 236, 20, 20);
        g.dispose();
       
       
        TiledImage image=new TiledImage(
                0,
                0,
                256,
                256,
                128,
                128,
                image_.getColorModel().createCompatibleSampleModel(256, 256),
                image_.getColorModel());
        image.set(image_);
       
        CustomPaletteBuilder builder = new CustomPaletteBuilder(image, 256, 1, 1, 1);
        RenderedImage indexed =  builder.buildPalette().getIndexedImage();
        assertTrue(indexed.getColorModel() instanceof IndexColorModel);
        IndexColorModel icm = (IndexColorModel) indexed.getColorModel();
View Full Code Here

Examples of javax.media.jai.TiledImage

              formcov = FormatDescriptor.create(image,DataBuffer.TYPE_SHORT ,null);
            }
            if((bilEncoding.equals("application/bil8"))&&(dtype!=DataBuffer.TYPE_BYTE))            {
              formcov = FormatDescriptor.create(image,DataBuffer.TYPE_BYTE ,null);
            }
            TiledImage tiled = null;
            if (formcov!= null)
              tiled = new TiledImage(formcov,width,height);
            else
              tiled = new TiledImage(image,width,height);
            final ImageOutputStream imageOutStream = ImageIO.createImageOutputStream(outStream);
            final ImageWriter writer = writerSPI.createWriterInstance();
            writer.setOutput(imageOutStream);
            writer.write(tiled);
            imageOutStream.flush();
View Full Code Here

Examples of javax.media.jai.TiledImage

  private static Image rescaleImageViaPlanarImage(
      Integer interpolation,
      final double rescaleX,
      final double rescaleY,
      final BufferedImage image ) {
    final PlanarImage planarImage = new TiledImage(
        image,
        image.getWidth(),
        image.getHeight());

    interpolation = Interpolation.INTERP_BICUBIC;
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.