📄 iioparam.java
字号:
/** * Retrieve the number of pixel columns to advance before taking a * pixel sample. * * @return the horizontal sub-sampling interval */ public int getSourceXSubsampling() { return sourceXSubsampling; } /** * Retrieve the number of pixel rows to advance before taking a * pixel sample. * * @return the vertical sub-sampling interval */ public int getSourceYSubsampling() { return sourceYSubsampling; } /** * Retrieve the number of pixel columns to advance before taking any * pixel samples. * * @return the horizontal sub-sampling offset */ public int getSubsamplingXOffset() { return subsamplingXOffset; } /** * Retrieve the number of pixel rows to advance before taking any * pixel samples. * * @return the vertical sub-sampling offset */ public int getSubsamplingYOffset() { return subsamplingYOffset; } /** * Check if a non-null controller is currently available. * * @return true if getController returns a non-null value, false if * getController returns null */ public boolean hasController() { return getController() != null; } /** * Sets the controller for this IIOParam. This is the controller * that will be activated when activateController is called. The * argument controller overrides this IIOParam's default controller. * If the argument is null then no controller will be set, not even * the default one. To reset the default controller call * setController(getDefaultController()). * * @param controller the controller to set or null */ public void setController(IIOParamController controller) { if (controller == defaultController) { this.controller = null; no_controller = false; } else { no_controller = (controller == null); this.controller = controller; } } /** * Set the destination image type. * * If this value is set on an image reader then its read method will * return a new BufferedImage of the specified destination type. In * this case any destination image set using setDestination() is * ignored. * * If this is set on an image writer then the destination type * affects only the colour model of the destination image. The * destination type's SampleModel is ignored. The destination * type's ColorModel will override the source image's colour model. * * @param destinationType the sample and colour models of the * destination image */ public void setDestinationType (ImageTypeSpecifier destinationType) { this.destinationType = destinationType; } /** * Specify the destination pixel offset. Image writers are only * affected by this setting when ImageWriter.replacePixels is called * in which case the offset is into the region of pixels being * changed. * * @param destinationOffset the offset where pixel writing should * begin */ public void setDestinationOffset(Point destinationOffset) { if (destinationOffset == null) throw new IllegalArgumentException("destinationOffset is null"); this.destinationOffset = destinationOffset; } /** * Set the indices of the source bands to be used. Duplicate * indices are not allowed. A value of null means use all source * bands. The argument array is copied and stored, so subsequent * updates to it will not be reflected in this IIOParam. * * @param sourceBands the array of source bands to use */ public void setSourceBands(int[] sourceBands) { int[] sourceBandsCopy = new int[sourceBands.length]; System.arraycopy (sourceBands, 0, sourceBandsCopy, 0, sourceBands.length); this.sourceBands = sourceBandsCopy; } /** * Set the source region from which to read. The number of pixels * sampled from the source region depends on the source sub-sampling * settings. If the combination of this sourceRegion and the * current sub-sampling settings would result in no pixels being * sampled then an IllegalStateException will be thrown. * * The source region is specified in the source image coordinate * system which has point (0, 0) at the top-left and increases down * and to the right. The argument source region is clipped to the * image boundaries at read-time. * * A null argument sets the source region to null meaning that the * whole image should be read. * * @param sourceRegion the rectangular source region * * @exception IllegalArgumentException if sourceRegion has width or * height <= 0 or x or y < 0 * @exception IllegalStateException if the given sourceRegion and * the current sampling settings would produce zero samples */ public void setSourceRegion(Rectangle sourceRegion) { if (sourceRegion != null && (sourceRegion.x < 0 || sourceRegion.y < 0 || sourceRegion.width <= 0 || sourceRegion.height <= 0)) throw new IllegalArgumentException("illegal source region"); if (sourceRegion != null) { int num_rows = (sourceRegion.height - subsamplingYOffset + sourceYSubsampling - 1) / sourceYSubsampling; int num_columns = (sourceRegion.width - subsamplingXOffset + sourceXSubsampling - 1) / sourceXSubsampling; if (num_rows <= 0 || num_columns <= 0) throw new IllegalStateException("zero pixels in source region"); } this.sourceRegion = sourceRegion; } /** * Set the source sampling intervals and offsets. Every * sourceXSubsampling'th pixel horizontally and * sourceYSubsampling'th pixel vertically will be sampled. Sampling * will being a the subsamplingXOffset'th column and the * subsamplingYOffset'th row. * * Horizontally, the number of sampled pixels will be: * * floor((width - subsamplingXOffset + sourceXSubsampling - 1) / sourceXSubsampling) * * Vertically: * * floor((height - subsamplingYOffset + sourceYSubsampling - 1) / sourceYSubsampling) * * If the current source region setting is such that the given * sub-sampling arguments would produce zero pixel samples, an * IllegalStateException is thrown. * * The offset parameters can be used to make source regions overlap * when tiling across an image. This can eliminate seams and * better-tile images whose width or height is not a multiple of the * sampling interval. * * @param sourceXSubsampling the horizontal sampling interval * @param sourceYSubsampling the vertical sampling interval * @param subsamplingXOffset the horizontal offset of the initial * sample * @param subsamplingYOffset the vertical offset of the initial * sample * * @exception IllegalArgumentException if either subsamplingXOffset * or subsamplingYOffset is < 0 * @exception IllegalStateException if the current source region * combined with the given sub-sampling parameters would produce * zero pixel samples */ public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset) { if (subsamplingXOffset < 0 || subsamplingYOffset < 0) throw new IllegalArgumentException("subsampling offset < 0"); if (sourceRegion != null) { int num_rows = (sourceRegion.height - subsamplingYOffset + sourceYSubsampling - 1) / sourceYSubsampling; int num_columns = (sourceRegion.width - subsamplingXOffset + sourceXSubsampling - 1) / sourceXSubsampling; if (num_rows <= 0 || num_columns <= 0) throw new IllegalStateException("subsampling parameters would" + " produce zero pixel samples" + " in source region"); } this.sourceXSubsampling = sourceXSubsampling; this.sourceYSubsampling = sourceYSubsampling; this.subsamplingXOffset = subsamplingXOffset; this.subsamplingYOffset = subsamplingYOffset; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -