Java Code Examples for java.awt.image.renderable.ParameterBlock#getObjectParameter()
The following examples show how to use
java.awt.image.renderable.ParameterBlock#getObjectParameter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BinarizeDescriptor.java From pdfxtk with Apache License 2.0 | 6 votes |
/** Creates an BinarizeOpImage with a given ParameterBlock */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderingHints) { RenderedImage img = paramBlock.getRenderedSource(0); ImageLayout il = new ImageLayout(img); ColorModel cm = new IndexColorModel(1, 2, bwColors, bwColors, bwColors); SampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, img.getWidth(), img.getHeight(), 1); il.setColorModel(cm); il.setSampleModel(sm); return new BinarizeOpImage(paramBlock.getRenderedSource(0), renderingHints, il, (Integer)paramBlock.getObjectParameter(0)); }
Example 2
Source File: QuicklookOlciRIF.java From DataHubSystem with GNU Affero General Public License v3.0 | 5 votes |
/** * Creates a new instance of <code>QuicklookOlciOpImage</code> in the * rendered layer. This operator could be called by chunks of images. * A set of additional information are required to compute the pixels * adjustment such as sun azimuth/elevation and detectors... The methods to * extract these informations are also provided here before. * * @param paramBlock The three R/G/B sources images to be "Merged" together * to produce the Quicklook. * @param renderHints Optionally contains destination image layout. */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints hints) { // Get ImageLayout from renderHints if any. ImageLayout layout = RIFUtil.getImageLayoutHint(hints); // Get the number of the sources int numSources = paramBlock.getNumSources(); // Creation of a source ArrayList (better than a Vector) List<RenderedImage> sources = new ArrayList<RenderedImage>(numSources); // Addition of the sources to the List for (int i = 0; i < numSources; i++) { sources.add((RenderedImage)paramBlock.getSource(i)); } // Extracts parameters short[][] detectors = (short[][])paramBlock.getObjectParameter(0); double[][] sza = (double[][])paramBlock.getObjectParameter(1); float[][] solar_flux = (float[][])paramBlock.getObjectParameter(2); PixelCorrection[]pc=(PixelCorrection[])paramBlock.getObjectParameter(3); int[] bands = (int[])paramBlock.getObjectParameter(4); int[] coefficients = (int[])paramBlock.getObjectParameter(5); return new QuicklookOlciOpImage(sources, hints, detectors, sza, solar_flux, pc, bands, coefficients, layout); }
Example 3
Source File: WarpRIF.java From geowave with Apache License 2.0 | 5 votes |
/** * Creates a new instance of warp operator according to the warp object and interpolation method. * * @param paramBlock The warp and interpolation objects. */ @Override public RenderedImage create(final ParameterBlock paramBlock, final RenderingHints renderHints) { final Interpolation interp = (Interpolation) paramBlock.getObjectParameter(1); if ((interp instanceof InterpolationNearest) || (interp instanceof javax.media.jai.InterpolationNearest)) { // Get ImageLayout from renderHints if any. final ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints); RenderedImage source = paramBlock.getRenderedSource(0); final Warp warp = (Warp) paramBlock.getObjectParameter(0); final double[] backgroundValues = (double[]) paramBlock.getObjectParameter(2); ROI roi = null; final Object roi_ = paramBlock.getObjectParameter(3); if (roi_ instanceof ROI) { roi = (ROI) roi_; final PlanarImage temp = PlanarImage.wrapRenderedImage(source); temp.setProperty("ROI", roi); source = temp; } Range noData = (Range) paramBlock.getObjectParameter(4); noData = RangeFactory.convert(noData, source.getSampleModel().getDataType()); return new WarpNearestOpImage( source, renderHints, layout, warp, interp, roi, noData, backgroundValues); } return super.create(paramBlock, renderHints); }
Example 4
Source File: SkeletonDescriptor.java From pdfxtk with Apache License 2.0 | 5 votes |
/** Creates an RLSAOpImage with a given ParameterBlock */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderingHints) { return new SkeletonOpImage(paramBlock.getRenderedSource(0), renderingHints, new ImageLayout(paramBlock.getRenderedSource(0)), (Boolean) paramBlock.getObjectParameter(0)); }
Example 5
Source File: PowerDescriptor.java From pdfxtk with Apache License 2.0 | 5 votes |
/** Creates an PowerOpImage with a given ParameterBlock */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderingHints) { return new PowerOpImage(paramBlock.getRenderedSource(0), renderingHints, new ImageLayout(paramBlock.getRenderedSource(0)), (Double) paramBlock.getObjectParameter(0)); }
Example 6
Source File: CCDescriptor.java From pdfxtk with Apache License 2.0 | 5 votes |
/** Invokes the operator with a given ParameterBlock */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderHints) { return new CCOpImage(paramBlock.getRenderedSource(0), (Rectangle) paramBlock.getObjectParameter(0)); }
Example 7
Source File: RLSADescriptor.java From pdfxtk with Apache License 2.0 | 5 votes |
/** Creates an RLSAOpImage with a given ParameterBlock */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderHints) { return new RLSAOpImage(paramBlock.getRenderedSource(0), null, new ImageLayout(paramBlock.getRenderedSource(0)), (Integer) paramBlock.getObjectParameter(0), (Integer) paramBlock.getObjectParameter(1)); }
Example 8
Source File: ProjectionProfileDescriptor.java From pdfxtk with Apache License 2.0 | 5 votes |
public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderHints) { if (!validateParameters(paramBlock)) { return null; } return new ProjectionProfileOpImage (paramBlock.getRenderedSource(0), (Rectangle) paramBlock.getObjectParameter(0)); }
Example 9
Source File: ProjectionProfileDescriptor.java From pdfxtk with Apache License 2.0 | 5 votes |
public boolean validateParameters(ParameterBlock paramBlock) { Object arg = paramBlock.getObjectParameter(0); if (arg == null) { return false; } if (!(arg instanceof Rectangle)) { return false; } return true; }
Example 10
Source File: RandomizeDescriptor.java From pdfxtk with Apache License 2.0 | 5 votes |
/** Creates an RandomizeOpImage with a given ParameterBlock */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderingHints) { int width = ((Integer) paramBlock.getObjectParameter(0)).intValue(); int height = ((Integer) paramBlock.getObjectParameter(1)).intValue(); ImageLayout il = new ImageLayout(0, 0, width, height); int[] bits = { 8 }; ColorModel cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), bits, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); int[] bandoffsets = { 0 }; SampleModel sm = new ComponentSampleModel(DataBuffer.TYPE_BYTE, width, height, 1, width, bandoffsets); il.setColorModel(cm); il.setSampleModel(sm); return new RandomizeOpImage(il, renderingHints, (Double) paramBlock.getObjectParameter(2)); }
Example 11
Source File: QuicklookSlstrRIF.java From DataHubSystem with GNU Affero General Public License v3.0 | 4 votes |
/** * Should create a new instance of <code>QuicklookSlstrOpImage</code> in the * rendered layer. * This operator could be called by chunks of images. * A set of additional information are required to compute the pixels * adjustment such as sun azimuth/elevation and detectors... The methods to * extract these informations are also provided here before. * * @param paramBlock The three R/G/B sources images to be "Merged" together * to produce the Quicklook. * @param renderHints Optionally contains destination image layout. */ public RenderedImage create(ParameterBlock paramBlock, RenderingHints hints) { long start = System.currentTimeMillis(); RenderedImage computed_image=null; DrbImage red = (DrbImage)paramBlock.getSource(4); // S5 DrbImage green = (DrbImage)paramBlock.getSource(2); // S3 DrbImage blue = (DrbImage)paramBlock.getSource(1); // S2 PixelCorrection[]pc=(PixelCorrection[])paramBlock.getObjectParameter(0); PixelCorrection red_correction = pc!=null?pc[0]:null; PixelCorrection green_correction = pc!=null?pc[1]:null; PixelCorrection blue_correction = pc!=null?pc[2]:null; try { computed_image = naturalColors (red.getData(), red_correction , green.getData(), green_correction, blue.getData(), blue_correction); } catch (Exception e) { // Image access problem: try to reprocess this other bands LOGGER.info("Natural color band looks bad. Trying S8..."); DrbImage image = (DrbImage)paramBlock.getSource(7); // S8 PixelCorrection corr = pc!=null?pc[3]:null; try { computed_image = grayScaleBand(image.getData(), corr, true); } catch (Exception e1) { // S8 also bad band: try with S9... LOGGER.info("Thermal band S8 looks bad. Trying S9..."); image = (DrbImage)paramBlock.getSource(8); // S9 corr = pc!=null?pc[4]:null; try { computed_image = grayScaleBand(image.getData(), corr, false); } catch (Exception e2) { throw new UnsupportedOperationException( "Image cannot be processed (" + e1.getMessage() + ").", e2); } } } LOGGER.info("Quicklook generated in " + (System.currentTimeMillis() - start)/1000+" secs"); return computed_image; }