Package javax.media.jai

Examples of javax.media.jai.LookupTableJAI


            case 0:
                break;
            }
        }
        // Create a LookupTableJAI object to be used with the "lookup" operator.
        LookupTableJAI table = new LookupTableJAI(tableData);
        // Do the lookup operation.
        // we should not transform on color map here
        hints.put(JAI.KEY_TRANSFORM_ON_COLORMAP, Boolean.FALSE);
        PlanarImage luImage = LookupDescriptor.create(image, table, hints);
View Full Code Here


            final byte[] lutData = new byte[256];
            // mapping all the non-transparent pixels to opaque
            Arrays.fill(lutData, (byte) 0);
            // for transparent pixels
            lutData[0] = (byte) 255;
            final LookupTableJAI lut = new LookupTableJAI(lutData);
            mask = LookupDescriptor.create(mask, lut, hints);

            /*
             * Adding to the other image exploiting the implict clamping
             */
 
View Full Code Here

            }

            // build a new palette
            IndexColorModel newColorModel = new IndexColorModel(index.getPixelSize(),
                    index.getMapSize(), reds, greens, blues, alphas);
            LookupTableJAI table = buildOpacityLookupTable(0, 1, -1);
            ImageLayout layout = new ImageLayout(image);
            layout.setColorModel(newColorModel);
            RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
            result = LookupDescriptor.create(image, table, hints);
        } else {
            // not indexed, then make sure it's some sort of component color model or turn it into one
            RenderedImage expanded;
            if (!(colorModel instanceof ComponentColorModel)) {
                expanded = new ImageWorker(image).forceComponentColorModel().getRenderedImage();
            } else {
                expanded = image;
            }

            // do we have to add the alpha band or it's there and we need to change it?

            if (!expanded.getColorModel().hasAlpha()) {
                // we just need to add it, so first build a constant image with the same structure
                // as the original image
                byte alpha = (byte) Math.round(255 * opacity);
                ImageLayout layout = new ImageLayout(image.getMinX(), image.getMinY(),
                        image.getWidth(), image.getHeight());
                RenderedOp alphaBand = ConstantDescriptor.create((float) image.getWidth(),
                        (float) image.getHeight(), new Byte[] { new Byte(alpha) },
                        new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout));

                result = BandMergeDescriptor.create(expanded, alphaBand, null);
            } else {
                // we need to transform the existing, we'll use a lookup
                final int bands = expanded.getSampleModel().getNumBands();
                int alphaBand = bands - 1;
                LookupTableJAI table = buildOpacityLookupTable(opacity, bands, alphaBand);
                result = LookupDescriptor.create(expanded, table, null);
            }
        }

        image = result;
View Full Code Here

                for (int i = 0; i < 256; i++) {
                    matrix[band][i] = (byte) i;
                }
            }
        }
        LookupTableJAI table = new LookupTableJAI(matrix);
        return table;
    }
View Full Code Here

TOP

Related Classes of javax.media.jai.LookupTableJAI

Copyright © 2018 www.massapicom. 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.