001: /*
002: * $RCSfile: IIPDescriptor.java,v $
003: *
004: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
005: *
006: * Use is subject to license terms.
007: *
008: * $Revision: 1.1 $
009: * $Date: 2005/02/11 04:57:37 $
010: * $State: Exp $
011: */
012: package javax.media.jai.operator;
013:
014: import java.awt.RenderingHints;
015: import java.awt.color.ICC_Profile;
016: import java.awt.geom.AffineTransform;
017: import java.awt.geom.Rectangle2D;
018: import java.awt.image.RenderedImage;
019: import java.awt.image.renderable.ParameterBlock;
020: import java.awt.image.renderable.RenderableImage;
021: import java.net.URL;
022: import javax.media.jai.JAI;
023: import javax.media.jai.OperationDescriptorImpl;
024: import javax.media.jai.ParameterBlockJAI;
025: import javax.media.jai.RenderableOp;
026: import javax.media.jai.RenderedOp;
027: import javax.media.jai.registry.RenderableRegistryMode;
028: import javax.media.jai.registry.RenderedRegistryMode;
029:
030: /**
031: * An <code>OperationDescriptor</code> describing the "IIP" operation.
032: *
033: * <p> This operation provides client-side support of the Internet Imaging
034: * Protocol (IIP) in both the rendered and renderable modes. It creates
035: * a <code>java.awt.image.RenderedImage</code> or a
036: * <code>java.awt.image.renderable.RenderableImage</code> based on the
037: * data received from the IIP server, and optionally applies a sequence
038: * of operations to the created image.
039: *
040: * <p> The operations that may be applied and the order in which they are
041: * applied are defined in section 2.2.1.1 of the Internet Imaging Protocol
042: * Specification version 1.0.5. Some or all of the requested operations
043: * may be executed on the IIP server if it is determined that the server
044: * supports such operations. Any of the requested operations not supported
045: * by the server will be executed on the host on which the operation chain
046: * is rendered.
047: *
048: * <p> The processing sequence for the supplied operations is as follows:
049: * <ul>
050: * <li> filtering (blur or sharpen);
051: * <li> tone and color correction ("color twist");
052: * <li> contrast adjustment;
053: * <li> selection of source rectangle of interest;
054: * <li> spatial orientation (rendering-independent affine transformation);
055: * <li> selection of destination rectangle of interest;
056: * <li> rendering transformation (renderable mode only);
057: * <li> transposition (rotation and/or mirroring).
058: * </ul>
059: *
060: * <p> As indicated, the rendering transformation is performed only in
061: * renderable mode processing. This transformation is derived from the
062: * <code>AffineTransform</code> supplied in the <code>RenderContext</code>
063: * when rendering actually occurs. Rendered mode processing creates
064: * a <code>RenderedImage</code> which is the default rendering of the
065: * <code>RenderableImage</code> created in renderable mode processing.
066: *
067: * <p> The "URL" parameter specifies the URL of the IIP image as a
068: * <code>java.lang.String</code>. It must represent a valid URL, and
069: * include any required FIF or SDS commands. It cannot be <code>null</code>.
070: *
071: * <p> The "subImages" parameter optionally indicates the sub-images to
072: * be used by the server to get the images at each resolution level. The
073: * values in this <code>int</code> array cannot be negative. If this
074: * parameter is not specified, or if the array is too short (length is 0),
075: * or if a negative value is specified, then this operation will use the
076: * zeroth sub-image of the resolution level actually processed.
077: *
078: * <p> The "filter" parameter specifies a blur or sharpen operation: a
079: * positive value indicates sharpen and a negative value blur. A unit
080: * step should produce a perceptible change in the image. The default
081: * value is 0 which signifies that no filtering will occur.
082: *
083: * <p> The "colorTwist" parameter represents a 4x4 matrix stored in row-major
084: * order and should have an array length of at least 16. If an array of
085: * length greater than 16 is specified, all elements from index 16 and beyond
086: * are ignored. Elements 12, 13 and 14 must be 0. This matrix will be
087: * applied to the (possibly padded) data in an intermediate normalized
088: * PhotoYCC color space with a premultiplied alpha channel. This operation
089: * will force an alpha channel to be added to the image if the last column
090: * of the last row of the color twist matrix is not 1.0F. Also, if the image
091: * originally has a grayscale color space it will be cast up to RGB if
092: * casting the data back to grayscale after applying the color twist matrix
093: * would result in any loss of data.
094: *
095: * <p> The "contrast" parameter specifies a contrast enhancement operation
096: * with increasing contrast for larger value. It must be greater than or equal
097: * to 1.0F. A value of 1.0F indicates no contrast adjustment.
098: *
099: * <p> The "sourceROI" parameter specifies the rectangle of interest in the
100: * source image in rendering-independent coordinates. The intersection of
101: * this rectangle with the rendering-independent bounds of the source image
102: * must equal itself. The rendering-independent bounds of the source image
103: * are defined to be (0.0F, 0.0F, r, 1.0F) where <i>r</i> is the aspect ratio
104: * (width/height) of the source image. Note that the source image will not
105: * in fact be cropped to these limits but values outside of this rectangle
106: * will be suppressed.
107: *
108: * <p> The "transform" parameter represents an affine backward mapping to be
109: * applied in rendering-independent coordinates. Note that the direction
110: * of transformation is opposite to that of the <code>AffineTransform</code>
111: * supplied in the <code>RenderContext</code> which is a forward mapping. The
112: * default value of this transform is the identity mapping. The supplied
113: * <code>AffineTransform</code> must be invertible.
114: *
115: * <p> The "aspectRatio" parameter specifies the rendering-independent width
116: * of the destination image and must be positive. The rendering-independent
117: * bounds of the destination image are (0.0F, 0.0F, aspectRatio, 1.0F). If
118: * this parameter is not provided the destination aspect ratio defaults to
119: * that of the source.
120: *
121: * <p> The "destROI" parameter specifies the rectangle of interest in the
122: * destination image in rendering-independent coordinates. This rectangle must
123: * have a non-empty intersection with the rendering-independent bounds of the
124: * destination image but is not constrained to the destination image bounds.
125: *
126: * <p> A counterclockwise rotation may be applied to the destination image.
127: * However, the angle is limited to 0, 90, 180, or 270 degrees. By default,
128: * the destination image is not rotated.
129: *
130: * <p> The "mirrorAxis" parameter may be <code>null</code>, in which case
131: * no flipping is applied, or a <code>String</code> of "x", "X", "y", or
132: * "Y".
133: *
134: * <p> The "ICCProfile" parameter may only be used with client-side processing
135: * or with server-side processing if the connection protocol supports the
136: * ability to transfer a profile.
137: *
138: * <p> The "JPEGQuality" and "JPEGTable" parameters are only used with
139: * server-side processing. If provided, JPEGQuality must be in the range
140: * [0,100] and JPEGTable in [1,255].
141: *
142: * <p> There is no source image associated with this operation.
143: *
144: * <p><table border=1>
145: * <caption>Resource List</caption>
146: * <tr><th>Name</th> <th>Value</th></tr>
147: * <tr><td>GlobalName</td> <td>IIP</td></tr>
148: * <tr><td>LocalName</td> <td>IIP</td></tr>
149: * <tr><td>Vendor</td> <td>com.sun.media.jai</td></tr>
150: * <tr><td>Description</td> <td>Provides client support of the Internet
151: * Imaging Protocol in the rendered and
152: * renderable modes.</td></tr>
153: * <tr><td>DocURL</td> <td>http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/IIPDescriptor.html</td></tr>
154: * <tr><td>Version</td> <td>1.0</td></tr>
155: * <tr><td>arg0Desc</td> <td>The URL of the IIP image.</td></tr>
156: * <tr><td>arg1Desc</td> <td>The sub-images to be used by the server
157: * for images at each resolution level.</td></tr>
158: * <tr><td>arg2Desc</td> <td>The filtering value.</td></tr>
159: * <tr><td>arg3Desc</td> <td>The color twist matrix.</td></tr>
160: * <tr><td>arg4Desc</td> <td>The contrast value.</td></tr>
161: * <tr><td>arg5Desc</td> <td>The source rectangle of interest in
162: * rendering-independent coordinates.</td></tr>
163: * <tr><td>arg6Desc</td> <td>The rendering-independent spatial orientation
164: * transform.</td></tr>
165: * <tr><td>arg7Desc</td> <td>The aspect ratio of the destination
166: * image.</td></tr>
167: * <tr><td>arg8Desc</td> <td>The destination rectangle of interest in
168: * rendering-independent coordinates.</td></tr>
169: * <tr><td>arg9Desc</td> <td>The counterclockwise rotation angle to be
170: * applied to the destination.</td></tr>
171: * <tr><td>arg10Desc</td> <td>The mirror axis.</td></tr>
172: * <tr><td>arg11Desc</td> <td>The ICC profile used to represent the color
173: * space of the source image.</td></tr>
174: * <tr><td>arg12Desc</td> <td>The JPEG quality factor.</td></tr>
175: * <tr><td>arg13Desc</td> <td>The JPEG compression group index
176: * number.</td></tr>
177: * </table></p>
178: *
179: * <p><table border=1>
180: * <caption>Parameter List</caption>
181: * <tr><th>Name</th> <th>Class Type</th>
182: * <th>Default Value</th></tr>
183: * <tr><td>URL</td> <td>java.lang.String</td>
184: * <td>NO_PARAMETER_DEFAULT</td>
185: * <tr><td>subImages</td> <td>int[]</td>
186: * <td>{ 0 }</td>
187: * <tr><td>filter</td> <td>java.lang.Float</td>
188: * <td>0.0F</td>
189: * <tr><td>colorTwist</td> <td>float[]</td>
190: * <td>null</td>
191: * <tr><td>contrast</td> <td>java.lang.Float</td>
192: * <td>1.0F</td>
193: * <tr><td>sourceROI</td> <td>java.awt.geom.Rectangle2D.Float</td>
194: * <td>null</td>
195: * <tr><td>transform</td> <td>java.awt.geom.AffineTransform</td>
196: * <td>identity transform</td>
197: * <tr><td>aspectRatio</td> <td>java.lang.Float</td>
198: * <td>null</td>
199: * <tr><td>destROI</td> <td>java.awt.geom.Rectangle2D.Float</td>
200: * <td>null</td>
201: * <tr><td>rotation</td> <td>java.lang.Integer</td>
202: * <td>0</td>
203: * <tr><td>mirrorAxis</td> <td>java.lang.String</td>
204: * <td>null</td>
205: * <tr><td>ICCProfile</td> <td>java.awt.color.ICC_Profile</td>
206: * <td>null</td>
207: * <tr><td>JPEGQuality</td> <td>java.lang.Integer</td>
208: * <td>null</td>
209: * <tr><td>JPEGTable</td> <td>java.lang.Integer</td>
210: * <td>null</td>
211: * </table></p>
212: *
213: * @see <a href="http://www.digitalimaging.org">Digital Imaging Group</a>
214: * @see java.awt.image.RenderedImage
215: * @see java.awt.image.renderable.RenderableImage
216: * @see IIPResolutionDescriptor
217: */
218: public class IIPDescriptor extends OperationDescriptorImpl {
219:
220: /**
221: * The resource strings that provide the general documentation
222: * and specify the parameter list for this operation.
223: */
224: private static final String[][] resources = {
225: { "GlobalName", "IIP" },
226: { "LocalName", "IIP" },
227: { "Vendor", "com.sun.media.jai" },
228: { "Description", JaiI18N.getString("IIPDescriptor0") },
229: {
230: "DocURL",
231: "http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/IIPDescriptor.html" },
232: { "Version", JaiI18N.getString("DescriptorVersion") },
233: { "arg0Desc", JaiI18N.getString("IIPDescriptor1") },
234: { "arg1Desc", JaiI18N.getString("IIPDescriptor2") },
235: { "arg2Desc", JaiI18N.getString("IIPDescriptor3") },
236: { "arg3Desc", JaiI18N.getString("IIPDescriptor4") },
237: { "arg4Desc", JaiI18N.getString("IIPDescriptor5") },
238: { "arg5Desc", JaiI18N.getString("IIPDescriptor6") },
239: { "arg6Desc", JaiI18N.getString("IIPDescriptor7") },
240: { "arg7Desc", JaiI18N.getString("IIPDescriptor8") },
241: { "arg8Desc", JaiI18N.getString("IIPDescriptor9") },
242: { "arg9Desc", JaiI18N.getString("IIPDescriptor10") },
243: { "arg10Desc", JaiI18N.getString("IIPDescriptor11") },
244: { "arg11Desc", JaiI18N.getString("IIPDescriptor12") },
245: { "arg12Desc", JaiI18N.getString("IIPDescriptor13") },
246: { "arg13Desc", JaiI18N.getString("IIPDescriptor14") } };
247:
248: /** The parameter class types for this operation. */
249: private static final Class[] paramClasses = {
250: java.lang.String.class, // arg0
251: int[].class, // arg1
252: java.lang.Float.class, // arg2
253: float[].class, // arg3
254: java.lang.Float.class, // arg4
255: java.awt.geom.Rectangle2D.Float.class, // arg5
256: java.awt.geom.AffineTransform.class, // arg6
257: java.lang.Float.class, // arg7
258: java.awt.geom.Rectangle2D.Float.class, // arg8
259: java.lang.Integer.class, // arg9
260: java.lang.String.class, // arg10
261: java.awt.color.ICC_Profile.class, // arg11
262: java.lang.Integer.class, // arg12
263: java.lang.Integer.class // arg13
264: };
265:
266: /** The parameter names for this operation. */
267: private static final String[] paramNames = { "URL", "subImages",
268: "filter", "colorTwist", "contrast", "sourceROI",
269: "transform", "aspectRatio", "destROI", "rotation",
270: "mirrorAxis", "ICCProfile", "JPEGQuality", "JPEGTable" };
271:
272: /**
273: * The parameter default values for this operation. For those parameters
274: * whose default value is <code>null</code>, an appropriate value is
275: * chosen by the individual implementation.
276: */
277: private static final Object[] paramDefaults = {
278: NO_PARAMETER_DEFAULT, new int[] { 0 },
279: new java.lang.Float(0.0F), null, new java.lang.Float(1.0F),
280: null, new AffineTransform(), null, null, new Integer(0),
281: null, null, null, null };
282:
283: /** Constructor. */
284: public IIPDescriptor() {
285: super (resources, 0, paramClasses, paramNames, paramDefaults);
286: }
287:
288: /**
289: * Overrides super class's default implementation to return
290: * <code>true</code> because this operation supports renderable mode.
291: */
292: public boolean isRenderableSupported() {
293: return true;
294: }
295:
296: /**
297: * Returns the minimum legal value of a specified numeric parameter
298: * for this operation. If the supplied <code>index</code> does not
299: * correspond to a numeric parameter, this method returns
300: * <code>null</code>.
301: *
302: * @throws ArrayIndexOutOfBoundsException if <code>index</code> is less
303: * than 0 or greater than 13.
304: */
305: public Number getParamMinValue(int index) {
306: if (index == 0 || index == 1 || index == 3 || index == 5
307: || index == 6 || index == 8 || index == 10
308: || index == 11) {
309: return null;
310: } else if (index == 2) {
311: return new java.lang.Float(-java.lang.Float.MAX_VALUE);
312: } else if (index == 7) {
313: return new java.lang.Float(0.0F);
314: } else if (index == 4) {
315: return new java.lang.Float(1.0F);
316: } else if (index == 12 || index == 9) {
317: return new Integer(0);
318: } else if (index == 13) {
319: return new Integer(1);
320: } else {
321: throw new ArrayIndexOutOfBoundsException();
322: }
323: }
324:
325: /**
326: * Returns the maximum legal value of a specified numeric parameter
327: * for this operation. If the supplied <code>index</code> does not
328: * correspond to a numeric parameter, this method returns
329: * <code>null</code>.
330: *
331: * @throws ArrayIndexOutOfBoundsException if <code>index</code> is less
332: * than 0 or greater than 13.
333: */
334: public Number getParamMaxValue(int index) {
335: if (index == 0 || index == 1 || index == 3 || index == 5
336: || index == 6 || index == 8 || index == 10
337: || index == 11) {
338: return null;
339: } else if (index == 2 || index == 4 || index == 7) {
340: return new java.lang.Float(java.lang.Float.MAX_VALUE);
341: } else if (index == 9) {
342: return new Integer(270);
343: } else if (index == 12) {
344: return new Integer(100);
345: } else if (index == 13) {
346: return new Integer(255);
347: } else {
348: throw new ArrayIndexOutOfBoundsException();
349: }
350: }
351:
352: /**
353: * Validates the input parameters.
354: *
355: * <p> In addition to the standard checks performed by the
356: * superclass method, this method checks that:
357: * <ul>
358: * <li> the supplied URL string specifies a valid protocol;
359: * <li> the color twist, if not <code>null</code>, has an array
360: * length of at least 16 (all elements from index 16 and beyond are
361: * ignored and elements 12, 13, and 14 are set to 0);
362: * <li> both the source and dest ROI, if not <code>null</code>, has
363: * a width and height greater than 0;
364: * <li> the mirror axis, if not <code>null</code>, has a
365: * <code>String</code> of "x", "X", "y", or "Y";
366: * <li> the destination rotation is one of the valid degrees
367: * (0, 90. 180, 270).
368: * </ul>
369: */
370: protected boolean validateParameters(ParameterBlock args,
371: StringBuffer msg) {
372: if (!super .validateParameters(args, msg)) {
373: return false;
374: }
375:
376: try {
377: new URL((String) args.getObjectParameter(0));
378: } catch (Exception e) {
379: msg.append(getName() + " "
380: + JaiI18N.getString("IIPDescriptor15"));
381: return false;
382: }
383:
384: int[] subImages = (int[]) args.getObjectParameter(1);
385: if (subImages.length < 1) {
386: args.set(paramDefaults[1], 1);
387: }
388:
389: float[] colorTwist = (float[]) args.getObjectParameter(3);
390: if (colorTwist != null) {
391: if (colorTwist.length < 16) {
392: msg.append(getName() + " "
393: + JaiI18N.getString("IIPDescriptor16"));
394: return false;
395: }
396:
397: /* Make sure elements 12, 13, and 14 are 0. */
398: colorTwist[12] = 0;
399: colorTwist[13] = 0;
400: colorTwist[14] = 0;
401: args.set(colorTwist, 3);
402: }
403:
404: float contrast = args.getFloatParameter(4);
405: if (contrast < 1.0F) {
406: msg.append(getName() + " "
407: + JaiI18N.getString("IIPDescriptor20"));
408: return false;
409: }
410:
411: java.awt.geom.Rectangle2D.Float sourceROI = (java.awt.geom.Rectangle2D.Float) args
412: .getObjectParameter(5);
413: if (sourceROI != null
414: && (sourceROI.getWidth() < 0.0 || sourceROI.getHeight() < 0.0)) {
415: msg.append(getName() + " "
416: + JaiI18N.getString("IIPDescriptor17"));
417: return false;
418: }
419:
420: AffineTransform tf = (AffineTransform) args
421: .getObjectParameter(6);
422: if (tf.getDeterminant() == 0.0) {
423: msg.append(getName() + " "
424: + JaiI18N.getString("IIPDescriptor24"));
425: return false;
426: }
427:
428: if (args.getObjectParameter(7) != null) {
429: float aspectRatio = args.getFloatParameter(7);
430: if (aspectRatio < 0.0F) {
431: msg.append(getName() + " "
432: + JaiI18N.getString("IIPDescriptor21"));
433: return false;
434: }
435: }
436:
437: java.awt.geom.Rectangle2D.Float destROI = (java.awt.geom.Rectangle2D.Float) args
438: .getObjectParameter(8);
439: if (destROI != null
440: && (destROI.getWidth() < 0.0 || destROI.getHeight() < 0.0)) {
441: msg.append(getName() + " "
442: + JaiI18N.getString("IIPDescriptor17"));
443: return false;
444: }
445:
446: int rotation = args.getIntParameter(9);
447: if (rotation != 0 && rotation != 90 && rotation != 180
448: && rotation != 270) {
449: msg.append(getName() + " "
450: + JaiI18N.getString("IIPDescriptor18"));
451: return false;
452: }
453:
454: String mirrorAxis = (String) args.getObjectParameter(10);
455: if (mirrorAxis != null && !mirrorAxis.equalsIgnoreCase("x")
456: && !mirrorAxis.equalsIgnoreCase("y")) {
457: msg.append(getName() + " "
458: + JaiI18N.getString("IIPDescriptor19"));
459: return false;
460: }
461:
462: if (args.getObjectParameter(12) != null) {
463: int JPEGQuality = args.getIntParameter(12);
464: if (JPEGQuality < 0 || JPEGQuality > 100) {
465: msg.append(getName() + " "
466: + JaiI18N.getString("IIPDescriptor22"));
467: return false;
468: }
469: }
470:
471: if (args.getObjectParameter(13) != null) {
472: int JPEGIndex = args.getIntParameter(13);
473: if (JPEGIndex < 1 || JPEGIndex > 255) {
474: msg.append(getName() + " "
475: + JaiI18N.getString("IIPDescriptor23"));
476: return false;
477: }
478: }
479:
480: return true;
481: }
482:
483: /**
484: * Provides client support of the Internet Imaging Protocol in the rendered and renderable mode.
485: *
486: * <p>Creates a <code>ParameterBlockJAI</code> from all
487: * supplied arguments except <code>hints</code> and invokes
488: * {@link JAI#create(String,ParameterBlock,RenderingHints)}.
489: *
490: * @see JAI
491: * @see ParameterBlockJAI
492: * @see RenderedOp
493: *
494: * @param URL The URL of the IIP image.
495: * @param subImages The sub-images to be used by the server for images at each resolution level.
496: * May be <code>null</code>.
497: * @param filter The filtering value.
498: * May be <code>null</code>.
499: * @param colorTwist The color twist matrix.
500: * May be <code>null</code>.
501: * @param contrast The contrast value.
502: * May be <code>null</code>.
503: * @param sourceROI The source rectangle of interest in rendering-independent coordinates.
504: * May be <code>null</code>.
505: * @param transform The rendering-independent spatial orientation transform.
506: * May be <code>null</code>.
507: * @param aspectRatio The aspect ratio of the destination image.
508: * May be <code>null</code>.
509: * @param destROI The destination rectangle of interest in rendering-independent coordinates.
510: * May be <code>null</code>.
511: * @param rotation The counterclockwise rotation angle to be applied to the destination.
512: * May be <code>null</code>.
513: * @param mirrorAxis The mirror axis.
514: * May be <code>null</code>.
515: * @param ICCProfile The ICC profile used to represent the color space of the source image.
516: * May be <code>null</code>.
517: * @param JPEGQuality The JPEG quality factor.
518: * May be <code>null</code>.
519: * @param JPEGTable The JPEG compression group index number.
520: * May be <code>null</code>.
521: * @param hints The <code>RenderingHints</code> to use.
522: * May be <code>null</code>.
523: * @return The <code>RenderedOp</code> destination.
524: * @throws IllegalArgumentException if <code>URL</code> is <code>null</code>.
525: */
526: public static RenderedOp create(String URL, int[] subImages,
527: Float filter, float[] colorTwist, Float contrast,
528: Rectangle2D.Float sourceROI, AffineTransform transform,
529: Float aspectRatio, Rectangle2D.Float destROI,
530: Integer rotation, String mirrorAxis,
531: ICC_Profile ICCProfile, Integer JPEGQuality,
532: Integer JPEGTable, RenderingHints hints) {
533: ParameterBlockJAI pb = new ParameterBlockJAI("IIP",
534: RenderedRegistryMode.MODE_NAME);
535:
536: pb.setParameter("URL", URL);
537: pb.setParameter("subImages", subImages);
538: pb.setParameter("filter", filter);
539: pb.setParameter("colorTwist", colorTwist);
540: pb.setParameter("contrast", contrast);
541: pb.setParameter("sourceROI", sourceROI);
542: pb.setParameter("transform", transform);
543: pb.setParameter("aspectRatio", aspectRatio);
544: pb.setParameter("destROI", destROI);
545: pb.setParameter("rotation", rotation);
546: pb.setParameter("mirrorAxis", mirrorAxis);
547: pb.setParameter("ICCProfile", ICCProfile);
548: pb.setParameter("JPEGQuality", JPEGQuality);
549: pb.setParameter("JPEGTable", JPEGTable);
550:
551: return JAI.create("IIP", pb, hints);
552: }
553:
554: /**
555: * Provides client support of the Internet Imaging Protocol in the rendered and renderable mode.
556: *
557: * <p>Creates a <code>ParameterBlockJAI</code> from all
558: * supplied arguments except <code>hints</code> and invokes
559: * {@link JAI#createRenderable(String,ParameterBlock,RenderingHints)}.
560: *
561: * @see JAI
562: * @see ParameterBlockJAI
563: * @see RenderableOp
564: *
565: * @param URL The URL of the IIP image.
566: * @param subImages The sub-images to be used by the server for images at each resolution level.
567: * May be <code>null</code>.
568: * @param filter The filtering value.
569: * May be <code>null</code>.
570: * @param colorTwist The color twist matrix.
571: * May be <code>null</code>.
572: * @param contrast The contrast value.
573: * May be <code>null</code>.
574: * @param sourceROI The source rectangle of interest in rendering-independent coordinates.
575: * May be <code>null</code>.
576: * @param transform The rendering-independent spatial orientation transform.
577: * May be <code>null</code>.
578: * @param aspectRatio The aspect ratio of the destination image.
579: * May be <code>null</code>.
580: * @param destROI The destination rectangle of interest in rendering-independent coordinates.
581: * May be <code>null</code>.
582: * @param rotation The counterclockwise rotation angle to be applied to the destination.
583: * May be <code>null</code>.
584: * @param mirrorAxis The mirror axis.
585: * May be <code>null</code>.
586: * @param ICCProfile The ICC profile used to represent the color space of the source image.
587: * May be <code>null</code>.
588: * @param JPEGQuality The JPEG quality factor.
589: * May be <code>null</code>.
590: * @param JPEGTable The JPEG compression group index number.
591: * May be <code>null</code>.
592: * @param hints The <code>RenderingHints</code> to use.
593: * May be <code>null</code>.
594: * @return The <code>RenderableOp</code> destination.
595: * @throws IllegalArgumentException if <code>URL</code> is <code>null</code>.
596: */
597: public static RenderableOp createRenderable(String URL,
598: int[] subImages, Float filter, float[] colorTwist,
599: Float contrast, Rectangle2D.Float sourceROI,
600: AffineTransform transform, Float aspectRatio,
601: Rectangle2D.Float destROI, Integer rotation,
602: String mirrorAxis, ICC_Profile ICCProfile,
603: Integer JPEGQuality, Integer JPEGTable, RenderingHints hints) {
604: ParameterBlockJAI pb = new ParameterBlockJAI("IIP",
605: RenderableRegistryMode.MODE_NAME);
606:
607: pb.setParameter("URL", URL);
608: pb.setParameter("subImages", subImages);
609: pb.setParameter("filter", filter);
610: pb.setParameter("colorTwist", colorTwist);
611: pb.setParameter("contrast", contrast);
612: pb.setParameter("sourceROI", sourceROI);
613: pb.setParameter("transform", transform);
614: pb.setParameter("aspectRatio", aspectRatio);
615: pb.setParameter("destROI", destROI);
616: pb.setParameter("rotation", rotation);
617: pb.setParameter("mirrorAxis", mirrorAxis);
618: pb.setParameter("ICCProfile", ICCProfile);
619: pb.setParameter("JPEGQuality", JPEGQuality);
620: pb.setParameter("JPEGTable", JPEGTable);
621:
622: return JAI.createRenderable("IIP", pb, hints);
623: }
624: }
|