You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by vh...@apache.org on 2009/03/05 12:04:00 UTC
svn commit: r750418 [3/7] - in /xmlgraphics/commons/trunk:
examples/java/image/loader/ examples/java/image/writer/
examples/java/java2d/ps/ examples/java/ps/ examples/java/xmp/
src/java/org/apache/xmlgraphics/image/
src/java/org/apache/xmlgraphics/imag...
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRaw.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRaw.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRaw.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRaw.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,19 +29,19 @@
public class ImageLoaderFactoryRaw extends AbstractImageLoaderFactory {
/** MIME type for EMF (Windows Enhanced Metafile) */
- public static final String MIME_EMF = "image/x-emf";
-
+ public static final String MIME_EMF = "image/x-emf";
+
private static final String[] MIMES = new String[] {
MimeConstants.MIME_PNG,
MimeConstants.MIME_JPEG,
MIME_EMF};
-
+
private static final ImageFlavor[][] FLAVORS = new ImageFlavor[][] {
{ImageFlavor.RAW_PNG},
{ImageFlavor.RAW_JPEG},
{ImageFlavor.RAW_EMF}};
-
+
/**
* Returns the MIME type for a given ImageFlavor if it is from a format that is consumed
* without being undecoded. If the ImageFlavor is no raw flavor, an IllegalArgumentException
@@ -64,7 +64,7 @@
public String[] getSupportedMIMETypes() {
return MIMES;
}
-
+
/** {@inheritDoc} */
public ImageFlavor[] getSupportedFlavors(String mime) {
for (int i = 0, c = MIMES.length; i < c; i++) {
@@ -74,7 +74,7 @@
}
throw new IllegalArgumentException("Unsupported MIME type: " + mime);
}
-
+
/** {@inheritDoc} */
public ImageLoader newImageLoader(ImageFlavor targetFlavor) {
if (targetFlavor.equals(ImageFlavor.RAW_JPEG)) {
@@ -83,7 +83,7 @@
return new ImageLoaderRaw(targetFlavor);
}
}
-
+
/** {@inheritDoc} */
public int getUsagePenalty(String mime, ImageFlavor flavor) {
return 0;
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRawCCITTFax.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRawCCITTFax.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRawCCITTFax.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderFactoryRawCCITTFax.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,11 +32,11 @@
private static final String[] MIMES = new String[] {
MimeConstants.MIME_TIFF};
-
+
private static final ImageFlavor[][] FLAVORS = new ImageFlavor[][] {
{ImageFlavor.RAW_CCITTFAX}};
-
+
/**
* Returns the MIME type for a given ImageFlavor if it is from a format that is consumed
* without being undecoded. If the ImageFlavor is no raw flavor, an IllegalArgumentException
@@ -59,7 +59,7 @@
public String[] getSupportedMIMETypes() {
return MIMES;
}
-
+
/** {@inheritDoc} */
public ImageFlavor[] getSupportedFlavors(String mime) {
for (int i = 0, c = MIMES.length; i < c; i++) {
@@ -69,7 +69,7 @@
}
throw new IllegalArgumentException("Unsupported MIME type: " + mime);
}
-
+
/** {@inheritDoc} */
public ImageLoader newImageLoader(ImageFlavor targetFlavor) {
if (targetFlavor.equals(ImageFlavor.RAW_CCITTFAX)) {
@@ -78,7 +78,7 @@
throw new IllegalArgumentException("Unsupported image flavor: " + targetFlavor);
}
}
-
+
/** {@inheritDoc} */
public int getUsagePenalty(String mime, ImageFlavor flavor) {
return 0;
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderInternalTIFF.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderInternalTIFF.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderInternalTIFF.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderInternalTIFF.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -53,7 +53,7 @@
public ImageLoaderInternalTIFF() {
//nop
}
-
+
/** {@inheritDoc} */
public ImageFlavor getTargetFlavor() {
return ImageFlavor.RENDERED_IMAGE;
@@ -70,8 +70,8 @@
org.apache.xmlgraphics.image.codec.tiff.TIFFImage img
= new org.apache.xmlgraphics.image.codec.tiff.TIFFImage
(seekStream, null, 0);
-
+
return new ImageRendered(info, img, null);
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRaw.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRaw.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRaw.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRaw.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -46,7 +46,7 @@
public ImageLoaderRaw(ImageFlavor targetFlavor) {
this.targetFlavor = targetFlavor;
this.mime = ImageLoaderFactoryRaw.getMimeForRawFlavor(targetFlavor);
- }
+ }
/** {@inheritDoc} */
public ImageFlavor getTargetFlavor() {
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawCCITTFax.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawCCITTFax.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawCCITTFax.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawCCITTFax.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -77,7 +77,7 @@
long stripOffset;
long stripLength;
TIFFDirectory dir;
-
+
Source src = session.needSource(info.getOriginalURI());
ImageInputStream in = ImageUtil.needImageInputStream(src);
in.mark();
@@ -85,7 +85,7 @@
SeekableStream seekable = new SeekableStreamAdapter(in);
dir = new TIFFDirectory(seekable, 0);
TIFFField fld;
-
+
fld = dir.getField(TIFFImageDecoder.TIFF_COMPRESSION);
if (fld != null) {
compression = fld.getAsInt(0);
@@ -123,7 +123,7 @@
} finally {
in.reset();
}
-
+
in.seek(stripOffset);
InputStream subin = new SubInputStream(ImageUtil.needInputStream(src), stripLength, true);
if (fillOrder == 2) {
@@ -135,7 +135,7 @@
ImageUtil.removeStreams(src);
return rawImage;
}
-
+
private static class FillOrderChangeInputStream extends FilterInputStream {
protected FillOrderChangeInputStream(InputStream in) {
@@ -163,7 +163,7 @@
return FLIP_TABLE[b] & 0xff;
}
}
-
+
// Table to be used when fillOrder = 2, for flipping bytes.
// Copied from XML Graphics Commons' TIFFFaxDecoder class
private static final byte[] FLIP_TABLE = {
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRawCCITTFax.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRawCCITTFax.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRawCCITTFax.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRawCCITTFax.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,12 +26,12 @@
/**
* This class is an implementation of the Image interface exposing a 1-bit bitmap image stream
- * that can be decoded by the PostScript or PDF CCITTFaxDecode filter.
+ * that can be decoded by the PostScript or PDF CCITTFaxDecode filter.
*/
public class ImageRawCCITTFax extends ImageRawStream {
private int compression;
-
+
/**
* Main constructor.
* @param info the image info object
@@ -42,7 +42,7 @@
super(info, ImageFlavor.RAW_CCITTFAX, in);
this.compression = compression;
}
-
+
/**
* Returns the image's color space
* @return the color space
@@ -58,5 +58,5 @@
public int getCompression() {
return this.compression;
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRawJPEG.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRawJPEG.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRawJPEG.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRawJPEG.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@
/**
* This class is an implementation of the Image interface exposing a JPEG file. It provides an
- * InputStream to access the JPEG content and some additional information on the image.
+ * InputStream to access the JPEG content and some additional information on the image.
*/
public class ImageRawJPEG extends ImageRawStream {
@@ -35,7 +35,7 @@
private ColorSpace colorSpace;
private ICC_Profile iccProfile;
private boolean invertImage = false;
-
+
/**
* Main constructor.
* @param info the image info object
@@ -53,7 +53,7 @@
this.iccProfile = iccProfile;
this.invertImage = invertImage;
}
-
+
/**
* Returns the SOFn identifier of the image which describes the coding format of the image.
* @return the SOFn identifier
@@ -61,7 +61,7 @@
public int getSOFType() {
return this.sofType;
}
-
+
/**
* Returns the ICC color profile if one is associated with the JPEG image.
* @return the ICC color profile or null if there's no profile
@@ -69,7 +69,7 @@
public ICC_Profile getICCProfile() {
return this.iccProfile;
}
-
+
/**
* Indicates whether the image should be inverted when interpreting it.
* @return true if the image is to be inverted
@@ -85,5 +85,5 @@
public ColorSpace getColorSpace() {
return this.colorSpace;
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRendered.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRendered.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRendered.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/ImageRendered.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@
private RenderedImage red;
private Color transparentColor;
-
+
/**
* Main constructor.
* @param info the image info object
@@ -47,7 +47,7 @@
this.red = red;
this.transparentColor = transparentColor;
}
-
+
/** {@inheritDoc} */
public ImageFlavor getFlavor() {
return ImageFlavor.RENDERED_IMAGE;
@@ -57,7 +57,7 @@
public boolean isCacheable() {
return true;
}
-
+
/**
* Returns the contained RenderedImage instance.
* @return the RenderedImage instance
@@ -80,7 +80,7 @@
}
return null;
}
-
+
/**
* Returns the transparent color if available.
* @return the transparent color or null
@@ -88,5 +88,5 @@
public Color getTransparentColor() {
return this.transparentColor;
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/JPEGConstants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/JPEGConstants.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/JPEGConstants.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/JPEGConstants.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@
int SOF2 = 0xc2;
/** Progressive DCT only PDF 1.3 */
int SOFA = 0xca;
-
+
/** Application marker, JFIF, JFXX, CIFF */
int APP0 = 0xe0;
/** Application marker, EXIF, XMP */
@@ -51,17 +51,17 @@
/** Application marker, ICC, FlashPix */
int APP2 = 0xe2;
/** Application marker APPD/APP13, Photoshop, Adobe_CM */
- int APPD = 0xed;
+ int APPD = 0xed;
/** Application marker APPE/APP14, Adobe */
- int APPE = 0xee;
+ int APPE = 0xee;
/** Application marker APPF/APP15, GraphicConverter */
int APPF = 0xef;
-
+
/** Start of Scan */
int SOS = 0xda;
/** start of Image */
- int SOI = 0xd8;
+ int SOI = 0xd8;
/** end of Image */
- int EOI = 0xd9;
+ int EOI = 0xd9;
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/JPEGFile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/JPEGFile.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/JPEGFile.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/JPEGFile.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@
protected static Log log = LogFactory.getLog(JPEGFile.class);
private DataInput in;
-
+
/**
* Constructor for ImageInputStreams.
* @param in the input stream to read the image from
@@ -45,7 +45,7 @@
public JPEGFile(ImageInputStream in) {
this.in = in;
}
-
+
/**
* Constructor for InputStreams.
* @param in the input stream to read the image from
@@ -53,7 +53,7 @@
public JPEGFile(InputStream in) {
this.in = new java.io.DataInputStream(in);
}
-
+
/**
* Returns the {@link DataInput} instance this object operates on.
* @return the data input instance
@@ -61,7 +61,7 @@
public DataInput getDataInput() {
return this.in;
}
-
+
/**
* Reads the next marker segment identifier and returns it.
* @return the marker segment identifier
@@ -92,7 +92,7 @@
int reclen = in.readUnsignedShort();
return reclen;
}
-
+
/**
* Skips the current marker segment.
* The method assumes the file cursor is right after the segment header.
@@ -102,5 +102,5 @@
int reclen = readSegmentLength();
in.skipBytes(reclen - 2);
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderBMP.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderBMP.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderBMP.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderBMP.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,7 +39,7 @@
/** Length of the BMP header */
protected static final int BMP_SIG_LENGTH = 2;
-
+
/** offset to width */
private static final int WIDTH_OFFSET = 18;
@@ -69,15 +69,15 @@
ByteOrder oldByteOrder = in.getByteOrder();
try {
ImageSize size = new ImageSize();
-
+
// BMP uses little endian notation!
in.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-
+
in.skipBytes(WIDTH_OFFSET);
int width = in.readInt();
int height = in.readInt();
size.setSizeInPixels(width, height);
-
+
in.skipBytes(12);
int xRes = in.readInt();
double xResDPI = UnitConv.in2mm(xRes / 1000d);
@@ -90,7 +90,7 @@
if (yResDPI == 0) {
yResDPI = context.getSourceResolution();
}
-
+
size.setResolution(xResDPI, yResDPI);
size.calcSizeFromPixels();
return size;
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderEMF.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderEMF.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderEMF.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderEMF.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,7 +39,7 @@
/** Length of the EMF header */
protected static final int EMF_SIG_LENGTH = 88;
-
+
/** offset to signature */
private static final int SIGNATURE_OFFSET = 40;
/** offset to width */
@@ -63,7 +63,7 @@
}
ImageInputStream in = ImageUtil.needImageInputStream(src);
byte[] header = getHeader(in, EMF_SIG_LENGTH);
- boolean supported
+ boolean supported
= ( (header[SIGNATURE_OFFSET + 0] == (byte) 0x20)
&& (header[SIGNATURE_OFFSET + 1] == (byte) 0x45)
&& (header[SIGNATURE_OFFSET + 2] == (byte) 0x4D)
@@ -84,15 +84,15 @@
ByteOrder oldByteOrder = in.getByteOrder();
try {
ImageSize size = new ImageSize();
-
+
// BMP uses little endian notation!
in.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-
+
//resolution
in.skipBytes(WIDTH_OFFSET);
int width = (int)in.readUnsignedInt();
int height = (int)in.readUnsignedInt();
-
+
in.skipBytes(HRES_PIXEL_OFFSET - WIDTH_OFFSET - 8);
long hresPixel = in.readUnsignedInt();
long vresPixel = in.readUnsignedInt();
@@ -101,12 +101,12 @@
double resHorz = hresPixel / UnitConv.mm2in(hresMM);
double resVert = vresPixel / UnitConv.mm2in(vresMM);
size.setResolution(resHorz, resVert);
-
+
width = (int)Math.round(UnitConv.mm2mpt(width / 100f));
height = (int)Math.round(UnitConv.mm2mpt(height / 100f));
size.setSizeInMillipoints(width, height);
size.calcPixelsFromSize();
-
+
return size;
} finally {
in.setByteOrder(oldByteOrder);
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderEPS.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderEPS.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderEPS.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderEPS.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader.impl;
import java.awt.geom.Rectangle2D;
@@ -49,7 +49,7 @@
public static final Object EPS_BINARY_HEADER = EPSBinaryFileHeader.class;
/** Key for bounding box used in custom objects of the ImageInfo class. */
public static final Object EPS_BOUNDING_BOX = Rectangle2D.class;
-
+
/** {@inheritDoc} */
public ImageInfo preloadImage(String uri, Source src, ImageContext context)
throws IOException {
@@ -73,7 +73,7 @@
in.reset();
in.mark(); //Mark start of file again
in.seek(binaryHeader.psStart);
-
+
} else if (magic == 0x53502125L) { //"%!PS" in little endian
supported = true; //ascii EPS
in.reset();
@@ -81,7 +81,7 @@
} else {
in.reset();
}
-
+
if (supported) {
ImageInfo info = new ImageInfo(uri, MimeConstants.MIME_EPS);
boolean success = determineSize(in, context, info);
@@ -115,7 +115,7 @@
offsets.tiffLength = in.readUnsignedInt();
return offsets;
}
-
+
private boolean determineSize(ImageInputStream in, ImageContext context, ImageInfo info)
throws IOException {
@@ -158,7 +158,7 @@
} catch (DSCException e) {
throw new IOException("Error while parsing EPS file: " + e.getMessage());
}
-
+
ImageSize size = new ImageSize();
size.setSizeInMillipoints(
(int)Math.round(bbox.getWidth() * 1000),
@@ -177,7 +177,7 @@
* Holder class for various pointers to the contents of the EPS file.
*/
public static class EPSBinaryFileHeader {
-
+
private long psStart = 0;
private long psLength = 0;
private long wmfStart = 0;
@@ -192,7 +192,7 @@
public long getPSStart() {
return psStart;
}
-
+
/**
* Returns the length of the PostScript section.
* @return the length of the PostScript section (in bytes)
@@ -200,7 +200,7 @@
public long getPSLength() {
return psLength;
}
-
+
/**
* Indicates whether the EPS has a WMF preview.
* @return true if there is a WMF preview
@@ -208,7 +208,7 @@
public boolean hasWMFPreview() {
return (wmfStart != 0);
}
-
+
/**
* Returns the start offset of the WMF preview.
* @return the start offset (or 0 if there's no WMF preview)
@@ -216,7 +216,7 @@
public long getWMFStart() {
return wmfStart;
}
-
+
/**
* Returns the length of the WMF preview.
* @return the length of the WMF preview (in bytes)
@@ -224,7 +224,7 @@
public long getWMFLength() {
return wmfLength;
}
-
+
/**
* Indicates whether the EPS has a TIFF preview.
* @return true if there is a TIFF preview
@@ -232,7 +232,7 @@
public boolean hasTIFFPreview() {
return (tiffStart != 0);
}
-
+
/**
* Returns the start offset of the TIFF preview.
* @return the start offset (or 0 if there's no TIFF preview)
@@ -240,7 +240,7 @@
public long getTIFFStart() {
return tiffStart;
}
-
+
/**
* Returns the length of the TIFF preview.
* @return the length of the TIFF preview (in bytes)
@@ -248,7 +248,7 @@
public long getTIFFLength() {
return tiffLength;
}
-
+
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderGIF.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderGIF.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderGIF.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderGIF.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader.impl;
import java.io.IOException;
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderTIFF.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderTIFF.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderTIFF.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderTIFF.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader.impl;
import java.io.IOException;
@@ -49,7 +49,7 @@
private static final int TIFF_SIG_LENGTH = 8;
- /** {@inheritDoc}
+ /** {@inheritDoc}
* @throws ImageException */
public ImageInfo preloadImage(String uri, Source src, ImageContext context)
throws IOException, ImageException {
@@ -79,7 +79,7 @@
}
if (supported) {
- ImageInfo info = createImageInfo(uri, in, context);
+ ImageInfo info = createImageInfo(uri, in, context);
return info;
} else {
return null;
@@ -92,7 +92,7 @@
in.mark();
try {
int pageIndex = ImageUtil.needPageIndexFromURI(uri);
-
+
SeekableStream seekable = new SeekableStreamAdapter(in);
TIFFDirectory dir;
try {
@@ -136,20 +136,20 @@
info = new ImageInfo(uri, MimeConstants.MIME_TIFF);
info.setSize(size);
-
+
TIFFField fld;
-
+
fld = dir.getField(TIFFImageDecoder.TIFF_COMPRESSION);
if (fld != null) {
int compression = fld.getAsInt(0);
info.getCustomObjects().put("TIFF_COMPRESSION", new Integer(compression));
}
-
+
fld = dir.getField(TIFFImageDecoder.TIFF_TILE_WIDTH);
if (fld != null) {
info.getCustomObjects().put("TIFF_TILED", Boolean.TRUE);
}
-
+
int stripCount;
fld = dir.getField(TIFFImageDecoder.TIFF_ROWS_PER_STRIP);
if (fld == null) {
@@ -158,7 +158,7 @@
stripCount = (int)(size.getHeightPx() / fld.getAsLong(0));
}
info.getCustomObjects().put("TIFF_STRIP_COUNT", new Integer(stripCount));
-
+
try {
//Check if there is a next page
new TIFFDirectory(seekable, pageIndex + 1);
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderFactoryImageIO.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderFactoryImageIO.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderFactoryImageIO.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderFactoryImageIO.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,22 +33,22 @@
private static final ImageFlavor[] FLAVORS = new ImageFlavor[] {
ImageFlavor.RENDERED_IMAGE,
ImageFlavor.BUFFERED_IMAGE};
-
+
/** {@inheritDoc} */
public String[] getSupportedMIMETypes() {
return ImageIO.getReaderMIMETypes();
}
-
+
/** {@inheritDoc} */
public ImageFlavor[] getSupportedFlavors(String mime) {
return FLAVORS;
}
-
+
/** {@inheritDoc} */
public ImageLoader newImageLoader(ImageFlavor targetFlavor) {
return new ImageLoaderImageIO(targetFlavor);
}
-
+
/** {@inheritDoc} */
public int getUsagePenalty(String mime, ImageFlavor flavor) {
return 0;
@@ -58,5 +58,5 @@
public boolean isAvailable() {
return (getSupportedMIMETypes().length > 0);
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/ImageConversionEdge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/ImageConversionEdge.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/ImageConversionEdge.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/ImageConversionEdge.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@
this.source = new ImageRepresentation(converter.getSourceFlavor());
this.target = new ImageRepresentation(converter.getTargetFlavor());
}
-
+
/**
* Returns the wrapped ImageConverter.
* @return the ImageConverter
@@ -51,7 +51,7 @@
public ImageConverter getImageConverter() {
return this.converter;
}
-
+
/** {@inheritDoc} */
public int getPenalty() {
return getImageConverter().getConversionPenalty();
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/ImageRepresentation.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/ImageRepresentation.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/ImageRepresentation.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/ImageRepresentation.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,13 +24,13 @@
/**
* This class represents a combination of MIME type and an image flavor.
- * It is used in conjunction with Dijkstra's algorithm to find and construct a
+ * It is used in conjunction with Dijkstra's algorithm to find and construct a
* conversion pipeline for images.
*/
public class ImageRepresentation implements Vertex {
private ImageFlavor flavor;
-
+
/**
* Main constructor
* @param flavor the image flavor
@@ -41,7 +41,7 @@
}
this.flavor = flavor;
}
-
+
/**
* Returns the image flavor.
* @return the image flavor
@@ -64,10 +64,10 @@
public int compareTo(Object obj) {
return toString().compareTo(((ImageRepresentation)obj).toString());
}
-
+
/** {@inheritDoc} */
public String toString() {
return getFlavor().toString();
}
-
+
}
\ No newline at end of file
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader.pipeline;
import java.util.Collection;
@@ -50,12 +50,12 @@
protected static Log log = LogFactory.getLog(PipelineFactory.class);
private ImageManager manager;
-
+
private int converterEdgeDirectoryVersion = -1;
-
+
/** Holds the EdgeDirectory for all image conversions */
private DefaultEdgeDirectory converterEdgeDirectory;
-
+
/**
* Main constructor.
* @param manager the ImageManager instance
@@ -63,12 +63,12 @@
public PipelineFactory(ImageManager manager) {
this.manager = manager;
}
-
+
private DefaultEdgeDirectory getEdgeDirectory() {
ImageImplRegistry registry = manager.getRegistry();
if (registry.getImageConverterModifications() != converterEdgeDirectoryVersion) {
Collection converters = registry.getImageConverters();
-
+
//Rebuild edge directory
DefaultEdgeDirectory dir = new DefaultEdgeDirectory();
Iterator iter = converters.iterator();
@@ -76,13 +76,13 @@
ImageConverter converter = (ImageConverter)iter.next();
dir.addEdge(new ImageConversionEdge(converter));
}
-
+
converterEdgeDirectoryVersion = registry.getImageConverterModifications();
this.converterEdgeDirectory = dir; //Replace (thread-safe)
}
return this.converterEdgeDirectory;
}
-
+
/**
* Creates and returns an {@link ImageProviderPipeline} that allows to load an image of the
* given MIME type and present it in the requested image flavor.
@@ -98,7 +98,7 @@
ImageProviderPipeline pipeline = findPipeline(dir, originalImage.getFlavor(), destination);
return pipeline;
}
-
+
/**
* Creates and returns an {@link ImageProviderPipeline} that allows to load an image of the
* given MIME type and present it in the requested image flavor.
@@ -111,10 +111,10 @@
String originalMime = imageInfo.getMimeType();
ImageImplRegistry registry = manager.getRegistry();
ImageProviderPipeline pipeline = null;
-
+
//Get snapshot to avoid concurrent modification problems (thread-safety)
DefaultEdgeDirectory dir = getEdgeDirectory();
-
+
ImageLoaderFactory[] loaderFactories = registry.getImageLoaderFactories(
imageInfo, targetFlavor);
if (loaderFactories != null) {
@@ -137,7 +137,7 @@
log.trace("No ImageLoaderFactory found that can load this format directly."
+ " Trying ImageConverters instead...");
}
-
+
ImageRepresentation destination = new ImageRepresentation(targetFlavor);
//Get Loader for originalMIME
// --> List of resulting flavors, possibly multiple loaders
@@ -157,7 +157,7 @@
}
}
}
-
+
//Build final pipeline
if (candidates.size() > 0) {
pipeline = (ImageProviderPipeline)candidates.first();
@@ -169,7 +169,7 @@
}
return pipeline;
}
-
+
private static class PipelineComparator implements Comparator {
public int compare(Object o1, Object o2) {
@@ -178,19 +178,19 @@
//Lowest penalty first
return p1.getConversionPenalty() - p2.getConversionPenalty();
}
-
+
}
-
+
private ImageProviderPipeline findPipeline(DefaultEdgeDirectory dir,
ImageFlavor originFlavor, ImageRepresentation destination) {
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(
dir);
- ImageRepresentation origin = new ImageRepresentation(originFlavor);
+ ImageRepresentation origin = new ImageRepresentation(originFlavor);
dijkstra.execute(origin, destination);
if (log.isTraceEnabled()) {
log.trace("Lowest penalty: " + dijkstra.getLowestPenalty(destination));
}
-
+
Vertex prev = destination;
Vertex pred = dijkstra.getPredecessor(destination);
if (pred == null) {
@@ -209,13 +209,13 @@
ImageProviderPipeline pipeline = new ImageProviderPipeline(manager.getCache(), null);
Iterator iter = stops.iterator();
while (iter.hasNext()) {
- ImageConversionEdge edge = (ImageConversionEdge)iter.next();
+ ImageConversionEdge edge = (ImageConversionEdge)iter.next();
pipeline.addConverter(edge.getImageConverter());
}
return pipeline;
}
}
-
+
/**
* Finds and returns an array of {@link ImageProviderPipeline} instances which can handle
* the given MIME type and return one of the given {@link ImageFlavor}s.
@@ -232,7 +232,7 @@
}
return candidates;
}
-
+
/**
* Finds and returns an array of {@link ImageProviderPipeline} instances which can handle
* the convert the given {@link Image} and return one of the given {@link ImageFlavor}s.
@@ -249,6 +249,6 @@
}
return candidates;
}
-
-
+
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageConverter.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageConverter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageConverter.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader.spi;
import java.io.IOException;
@@ -37,7 +37,7 @@
int MINIMAL_CONVERSION_PENALTY = 1;
/** Default/Medium conversion penalty (if there's some effort to convert the image format) */
int MEDIUM_CONVERSION_PENALTY = 10;
-
+
/**
* Converts an image into a different representation.
* @param src the source image
@@ -47,23 +47,23 @@
* @throws IOException if an I/O error occurs while converting the image
*/
Image convert(Image src, Map hints) throws ImageException, IOException;
-
+
/**
* Returns the flavor that this converter converts images into.
* @return the target flavor
*/
ImageFlavor getTargetFlavor();
-
+
/**
* Returns the flavor that this converter expects.
* @return the source flavor
*/
ImageFlavor getSourceFlavor();
-
+
/**
* Returns the conversion penalty for the conversion that this implementation supports.
* @return the conversion penalty (must be a non-negative integer)
*/
int getConversionPenalty();
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageLoader.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageLoader.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageLoader.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader.spi;
import java.io.IOException;
@@ -46,7 +46,7 @@
*/
Image loadImage(ImageInfo info, Map hints, ImageSessionContext session)
throws ImageException, IOException;
-
+
/**
* Loads and returns an image.
* @param info the image info object indicating the image
@@ -57,18 +57,18 @@
*/
Image loadImage(ImageInfo info, ImageSessionContext session)
throws ImageException, IOException;
-
+
/**
* Returns the image flavor that is returned by this ImageLoader implementation.
* @return the target image flavor
*/
ImageFlavor getTargetFlavor();
-
+
/**
* Returns the penalty assigned to using this image loader. The value is used to select the
* best processing chain for images.
* @return the usage penalty (must be a non-negative integer)
*/
int getUsagePenalty();
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageLoaderFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageLoaderFactory.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageLoaderFactory.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/spi/ImageLoaderFactory.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,10 +32,10 @@
/**
* Returns an array of MIME types supported by this implementation.
- * @return the MIME type array
+ * @return the MIME type array
*/
String[] getSupportedMIMETypes();
-
+
/**
* Returns an array of ImageFlavors that are supported by this implementation for a given
* MIME type.
@@ -43,7 +43,7 @@
* @return the ImageFlavor array
*/
ImageFlavor[] getSupportedFlavors(String mime);
-
+
/**
* Indicates whether the given image (represented by an {@link ImageInfo} object) is supported
* by the loader. By default, implementations return true assuming all images of the supported
@@ -56,14 +56,14 @@
* @return true if the image is supported by the loaders generated by this factory
*/
boolean isSupported(ImageInfo imageInfo);
-
+
/**
* Creates and returns a new ImageLoader instance.
* @param targetFlavor the target image flavor to produce
* @return a new ImageLoader instance
*/
ImageLoader newImageLoader(ImageFlavor targetFlavor);
-
+
/**
* Returns the usage penalty for a particular ImageLoader. This is used to select the best
* ImageLoader implementation for loading an image.
@@ -72,7 +72,7 @@
* @return the usage penalty (must be a non-negative integer)
*/
int getUsagePenalty(String mime, ImageFlavor flavor);
-
+
/**
* Indicates whether the underlying libraries needed by the implementation are available.
* @return true if the implementation is functional.
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/ImageInputStreamAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/ImageInputStreamAdapter.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/ImageInputStreamAdapter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/ImageInputStreamAdapter.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,15 +26,15 @@
/**
* Decorates an ImageInputStream with an InputStream interface. The methods <code>mark()</code>
- * and <code>reset()</code> are fully supported. The method <code>available()</code> will
+ * and <code>reset()</code> are fully supported. The method <code>available()</code> will
* always return 0.
*/
public class ImageInputStreamAdapter extends InputStream {
private ImageInputStream iin;
-
+
private long lastMarkPosition;
-
+
/**
* Creates a new ImageInputStreamAdapter.
* @param iin the underlying ImageInputStream
@@ -43,7 +43,7 @@
assert iin != null : "InputStream is null";
this.iin = iin;
}
-
+
/** {@inheritDoc} */
public int read(byte[] b, int off, int len) throws IOException {
return iin.read(b, off, len);
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/ImageUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/ImageUtil.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/ImageUtil.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/ImageUtil.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -88,7 +88,7 @@
* @return the InputStream
*/
public static InputStream needInputStream(Source src) {
- InputStream in = getInputStream(src);
+ InputStream in = getInputStream(src);
if (in != null) {
return in;
} else {
@@ -96,7 +96,7 @@
+ " or an ImageSource");
}
}
-
+
/**
* Returns the ImageInputStream of a Source object. This method throws an
* IllegalArgumentException if there's no ImageInputStream instance available from the
@@ -116,7 +116,7 @@
throw new IllegalArgumentException("Source must be an ImageSource");
}
}
-
+
/**
* Indicates whether the Source object has an InputStream instance.
* @param src the Source object
@@ -124,7 +124,7 @@
*/
public static boolean hasInputStream(Source src) {
if (src instanceof StreamSource) {
- InputStream in = ((StreamSource)src).getInputStream();
+ InputStream in = ((StreamSource)src).getInputStream();
return (in != null);
} else if (src instanceof ImageSource) {
return hasImageInputStream(src);
@@ -144,7 +144,7 @@
*/
public static boolean hasReader(Source src) {
if (src instanceof StreamSource) {
- Reader reader = ((StreamSource)src).getReader();
+ Reader reader = ((StreamSource)src).getReader();
return (reader != null);
} else if (src instanceof SAXSource) {
InputSource is = ((SAXSource)src).getInputSource();
@@ -162,7 +162,7 @@
*/
public static boolean hasImageInputStream(Source src) {
if (src instanceof ImageSource) {
- ImageInputStream in = ((ImageSource)src).getImageInputStream();
+ ImageInputStream in = ((ImageSource)src).getImageInputStream();
if (in != null) {
return true;
}
@@ -191,7 +191,7 @@
}
}
}
-
+
/**
* Closes the InputStreams or ImageInputStreams of Source objects. Any exception occurring
* while closing the stream is ignored.
@@ -201,7 +201,7 @@
if (src == null) {
return;
} else if (src instanceof StreamSource) {
- StreamSource streamSource = (StreamSource)src;
+ StreamSource streamSource = (StreamSource)src;
IOUtils.closeQuietly(streamSource.getInputStream());
streamSource.setInputStream(null);
IOUtils.closeQuietly(streamSource.getReader());
@@ -226,7 +226,7 @@
}
}
}
-
+
/**
* Decorates an ImageInputStream so the flush*() methods are ignored and have no effect.
* The decoration is implemented using a dynamic proxy.
@@ -253,7 +253,7 @@
}
});
}
-
+
/**
* GZIP header magic number bytes, like found in a gzipped
* files, which are encoded in Intel format (i..e. little indian).
@@ -277,7 +277,7 @@
in.reset();
return ((data[0] == GZIP_MAGIC[0]) && (data[1] == GZIP_MAGIC[1]));
}
-
+
/**
* Decorates an InputStream with a BufferedInputStream if it doesn't support mark()/reset().
* @param in the InputStream
@@ -290,7 +290,7 @@
return new java.io.BufferedInputStream(in);
}
}
-
+
/**
* Automatically decorates an InputStream so it is buffered. Furthermore, it makes sure
* it is decorated with a GZIPInputStream if the stream is GZIP compressed.
@@ -319,9 +319,9 @@
new Float(session.getTargetResolution()));
return hints;
}
-
+
private static final String PAGE_INDICATOR = "page=";
-
+
/**
* Extracts page index information from a URI. The expected pattern is "page=x" where x is
* a non-negative integer number. The page index must be specified as part of the URI fragment
@@ -370,7 +370,7 @@
}
return null;
}
-
+
/**
* Extracts page index information from a URI. The expected pattern is "page=x" where x is
* a non-negative integer number. The page index must be specified as part of the URI fragment
@@ -392,5 +392,5 @@
return 0;
}
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SeekableStreamAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SeekableStreamAdapter.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SeekableStreamAdapter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SeekableStreamAdapter.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader.util;
import java.io.IOException;
@@ -31,7 +31,7 @@
public class SeekableStreamAdapter extends SeekableStream {
private ImageInputStream iin;
-
+
/**
* Main constructor
* @param iin the ImageInputStream to operate on
@@ -39,7 +39,7 @@
public SeekableStreamAdapter(ImageInputStream iin) {
this.iin = iin;
}
-
+
/** {@inheritDoc} */
public long getFilePointer() throws IOException {
return iin.getStreamPosition();
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SoftMapCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SoftMapCache.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SoftMapCache.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SoftMapCache.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader.util;
import java.lang.ref.Reference;
@@ -39,7 +39,7 @@
private Map map;
private ReferenceQueue refQueue = new ReferenceQueue();
-
+
/**
* Creates a new soft cache.
* @param synched true if the Map containing the values should by synchronized
@@ -50,7 +50,7 @@
this.map = Collections.synchronizedMap(this.map);
}
}
-
+
/**
* Returns the value associated with the given key. If the value is not found or the value
* has been collected, null is returned.
@@ -97,25 +97,25 @@
public void put(Object key, Object value) {
map.put(key, wrapInReference(value, key));
}
-
+
/**
* Clears the cache.
*/
public void clear() {
map.clear();
}
-
+
/**
* Triggers some house-keeping, i.e. processes any pending objects in the reference queue.
*/
public void doHouseKeeping() {
checkReferenceQueue();
}
-
+
private Reference wrapInReference(Object obj, Object key) {
return new SoftReferenceWithKey(obj, key, refQueue);
}
-
+
/**
* Checks the reference queue if any references have been cleared and removes them from the
* cache.
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SoftReferenceWithKey.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SoftReferenceWithKey.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SoftReferenceWithKey.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/util/SoftReferenceWithKey.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.xmlgraphics.image.loader.util;
import java.lang.ref.ReferenceQueue;
@@ -27,9 +27,9 @@
* a reference from a Map once the referenced object is collected, for example.
*/
public class SoftReferenceWithKey extends SoftReference {
-
+
private Object key;
-
+
/**
* Creates a new SoftReference with a key.
* @param referent object the new soft reference will refer to
@@ -40,7 +40,7 @@
super(referent, q);
this.key = key;
}
-
+
/**
* Returns the key associated with this reference.
* @return the key
@@ -48,5 +48,5 @@
public Object getKey() {
return this.key;
}
-
+
}
\ No newline at end of file
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/CachableRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/CachableRed.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/CachableRed.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/CachableRed.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -62,7 +62,7 @@
return srcs; // should always be empty...
}
- public Rectangle getBounds() {
+ public Rectangle getBounds() {
return new Rectangle(getMinX(), // could we cache the rectangle??
getMinY(),
getWidth(),
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/AbstractImageWriter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/AbstractImageWriter.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/AbstractImageWriter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/AbstractImageWriter.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,5 +48,5 @@
public boolean supportsMultiImageWriter() {
return false;
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/ImageWriterUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/ImageWriterUtil.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/ImageWriterUtil.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/ImageWriterUtil.java Thu Mar 5 11:03:54 2009
@@ -41,7 +41,7 @@
throws IOException {
saveAsPNG(bitmap, 96, outputFile);
}
-
+
/**
* Saves a RenderedImage as a PNG file.
* @param bitmap the bitmap to encode
@@ -53,7 +53,7 @@
throws IOException {
saveAsFile(bitmap, resolution, outputFile, "image/png");
}
-
+
/**
* Saves a RenderedImage as a file. The image format is given through the MIME type
* @param bitmap the bitmap to encode
@@ -75,5 +75,5 @@
IOUtils.closeQuietly(out);
}
}
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/MultiImageWriter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/MultiImageWriter.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/MultiImageWriter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/MultiImageWriter.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@
/**
* Interface which allows writing multiple images into one image file if the output format
- * supports this feature.
+ * supports this feature.
*
* @version $Id$
*/
@@ -36,9 +36,9 @@
* @param params a parameters object to customize the encoding.
* @throws IOException In case of an /IO problem
*/
- public void writeImage(RenderedImage image, ImageWriterParams params)
+ public void writeImage(RenderedImage image, ImageWriterParams params)
throws IOException;
-
+
public void close() throws IOException;
-
+
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/imageio/ImageIOImageWriter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/imageio/ImageIOImageWriter.java?rev=750418&r1=750417&r2=750418&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/imageio/ImageIOImageWriter.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/imageio/ImageIOImageWriter.java Thu Mar 5 11:03:54 2009
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,9 +49,9 @@
public class ImageIOImageWriter implements ImageWriter, IIOWriteWarningListener {
private static final String STANDARD_METADATA_FORMAT = "javax_imageio_1.0";
-
+
private String targetMIME;
-
+
/**
* Main constructor.
* @param mime the MIME type of the image format
@@ -59,7 +59,7 @@
public ImageIOImageWriter(String mime) {
this.targetMIME = mime;
}
-
+
/**
* @see ImageWriter#writeImage(java.awt.image.RenderedImage, java.io.OutputStream)
*/
@@ -70,43 +70,43 @@
/**
* @see ImageWriter#writeImage(java.awt.image.RenderedImage, java.io.OutputStream, ImageWriterParams)
*/
- public void writeImage(RenderedImage image, OutputStream out,
- ImageWriterParams params)
+ public void writeImage(RenderedImage image, OutputStream out,
+ ImageWriterParams params)
throws IOException {
javax.imageio.ImageWriter iiowriter = getIIOImageWriter();
iiowriter.addIIOWriteWarningListener(this);
-
+
ImageOutputStream imgout = ImageIO.createImageOutputStream(out);
try {
-
+
ImageWriteParam iwParam = getDefaultWriteParam(iiowriter, image, params);
-
+
ImageTypeSpecifier type;
if (iwParam.getDestinationType() != null) {
type = iwParam.getDestinationType();
} else {
type = ImageTypeSpecifier.createFromRenderedImage(image);
}
-
+
//Handle metadata
IIOMetadata meta = iiowriter.getDefaultImageMetadata(
type, iwParam);
//meta might be null for some JAI codecs as they don't support metadata
if (params != null && meta != null) {
- meta = updateMetadata(meta, params);
+ meta = updateMetadata(meta, params);
}
-
+
//Write image
iiowriter.setOutput(imgout);
IIOImage iioimg = new IIOImage(image, null, meta);
iiowriter.write(null, iioimg, iwParam);
-
+
} finally {
imgout.close();
iiowriter.dispose();
}
}
-
+
private javax.imageio.ImageWriter getIIOImageWriter() {
Iterator iter = ImageIO.getImageWritersByMIMEType(getMIMEType());
javax.imageio.ImageWriter iiowriter = null;
@@ -114,12 +114,12 @@
iiowriter = (javax.imageio.ImageWriter)iter.next();
}
if (iiowriter == null) {
- throw new UnsupportedOperationException("No ImageIO codec for writing "
+ throw new UnsupportedOperationException("No ImageIO codec for writing "
+ getMIMEType() + " is available!");
}
return iiowriter;
}
-
+
/**
* Returns the default write parameters for encoding the image.
* @param iiowriter The IIO ImageWriter that will be used
@@ -128,7 +128,7 @@
* @return the IIO ImageWriteParam instance
*/
protected ImageWriteParam getDefaultWriteParam(
- javax.imageio.ImageWriter iiowriter, RenderedImage image,
+ javax.imageio.ImageWriter iiowriter, RenderedImage image,
ImageWriterParams params) {
ImageWriteParam param = iiowriter.getDefaultWriteParam();
//System.err.println("Param: " + params);
@@ -136,9 +136,9 @@
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
param.setCompressionType(params.getCompressionMethod());
}
- return param;
+ return param;
}
-
+
/**
* Updates the metadata information based on the parameters to this writer.
* @param meta the metadata
@@ -156,26 +156,26 @@
child = new IIOMetadataNode("HorizontalPixelSize");
dim.appendChild(child);
}
- child.setAttribute("value",
+ child.setAttribute("value",
Double.toString(params.getResolution().doubleValue() / 25.4));
child = getChildNode(dim, "VerticalPixelSize");
if (child == null) {
child = new IIOMetadataNode("VerticalPixelSize");
dim.appendChild(child);
}
- child.setAttribute("value",
+ child.setAttribute("value",
Double.toString(params.getResolution().doubleValue() / 25.4));
}
try {
meta.mergeTree(STANDARD_METADATA_FORMAT, root);
} catch (IIOInvalidTreeException e) {
- throw new RuntimeException("Cannot update image metadata: "
+ throw new RuntimeException("Cannot update image metadata: "
+ e.getMessage());
}
}
return meta;
}
-
+
/**
* Returns a specific metadata child node
* @param n the base node
@@ -209,12 +209,12 @@
* @see javax.imageio.event.IIOWriteWarningListener#warningOccurred(
* javax.imageio.ImageWriter, int, java.lang.String)
*/
- public void warningOccurred(javax.imageio.ImageWriter source,
+ public void warningOccurred(javax.imageio.ImageWriter source,
int imageIndex, String warning) {
- System.err.println("Problem while writing image using ImageI/O: "
+ System.err.println("Problem while writing image using ImageI/O: "
+ warning);
}
-
+
/**
* @see org.apache.xmlgraphics.image.writer.ImageWriter#createMultiImageWriter(
* java.io.OutputStream)
@@ -237,7 +237,7 @@
private javax.imageio.ImageWriter iiowriter;
private ImageOutputStream imageStream;
-
+
public IIOMultiImageWriter(OutputStream out) throws IOException {
this.iiowriter = getIIOImageWriter();
if (!iiowriter.canWriteSequence()) {
@@ -245,38 +245,38 @@
+ " multiple images to a single image file.");
}
iiowriter.addIIOWriteWarningListener(ImageIOImageWriter.this);
-
+
imageStream = ImageIO.createImageOutputStream(out);
iiowriter.setOutput(imageStream);
iiowriter.prepareWriteSequence(null);
}
-
+
public void writeImage(RenderedImage image, ImageWriterParams params) throws IOException {
if (iiowriter == null) {
throw new IllegalStateException("MultiImageWriter already closed!");
}
ImageWriteParam iwParam = getDefaultWriteParam(iiowriter, image, params);
-
+
ImageTypeSpecifier type;
if (iwParam.getDestinationType() != null) {
type = iwParam.getDestinationType();
} else {
type = ImageTypeSpecifier.createFromRenderedImage(image);
}
-
+
//Handle metadata
IIOMetadata meta = iiowriter.getDefaultImageMetadata(
type, iwParam);
//meta might be null for some JAI codecs as they don't support metadata
if (params != null && meta != null) {
- meta = updateMetadata(meta, params);
+ meta = updateMetadata(meta, params);
}
-
+
//Write image
IIOImage iioimg = new IIOImage(image, null, meta);
iiowriter.writeToSequence(iioimg, iwParam);
}
-
+
public void close() throws IOException {
imageStream.close();
imageStream = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org