You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ml...@apache.org on 2006/10/09 07:33:21 UTC
svn commit: r454289 [3/22] - in
/incubator/harmony/enhanced/classlib/trunk/modules/H-1609: ./ modules/
modules/applet/ modules/applet/src/ modules/applet/src/main/
modules/applet/src/main/java/ modules/applet/src/main/java/java/
modules/applet/src/main...
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageReader.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageReader.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageReader.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,436 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio;
+
+import javax.imageio.spi.ImageReaderSpi;
+import javax.imageio.stream.ImageInputStream;
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.event.IIOReadWarningListener;
+import javax.imageio.event.IIOReadProgressListener;
+import javax.imageio.event.IIOReadUpdateListener;
+import java.util.Locale;
+import java.util.List;
+import java.util.Iterator;
+import java.util.Set;
+import java.io.IOException;
+import java.awt.image.BufferedImage;
+import java.awt.image.Raster;
+import java.awt.image.RenderedImage;
+import java.awt.*;
+
+public abstract class ImageReader {
+
+ protected ImageReaderSpi originatingProvider;
+
+ protected Object input;
+
+ protected boolean seekForwardOnly;
+
+ protected boolean ignoreMetadata;
+
+ protected int minIndex;
+
+ protected Locale[] availableLocales;
+
+ protected Locale locale;
+
+ protected List warningListeners;
+
+ protected List warningLocales;
+
+ protected List progressListeners;
+
+ protected List updateListeners;
+
+ protected ImageReader(ImageReaderSpi originatingProvider) {
+ this.originatingProvider = originatingProvider;
+ }
+
+ public String getFormatName() throws IOException {
+ return originatingProvider.getFormatNames()[0];
+ }
+
+ public ImageReaderSpi getOriginatingProvider() {
+ return originatingProvider;
+ }
+
+ public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata) {
+ if (input != null) {
+ if (!isSupported(input) && !(input instanceof ImageInputStream)) {
+ throw new IllegalArgumentException("input " + input + " is not supported");
+ }
+ }
+ this.minIndex = 0;
+ this.seekForwardOnly = seekForwardOnly;
+ this.ignoreMetadata = ignoreMetadata;
+ this.input = input;
+ }
+
+ private boolean isSupported(Object input) {
+ ImageReaderSpi spi = getOriginatingProvider();
+ if (null != spi) {
+ Class[] outTypes = spi.getInputTypes();
+ for(int i = 0; i < outTypes.length; i++) {
+ if (outTypes[i].isInstance(input)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void setInput(Object input, boolean seekForwardOnly) {
+ setInput(input, seekForwardOnly, false);
+ }
+
+ public void setInput(Object input) {
+ setInput(input, false, false);
+ }
+
+ public Object getInput() {
+ return input;
+ }
+
+ public boolean isSeekForwardOnly() {
+ return seekForwardOnly;
+ }
+
+ public boolean isIgnoringMetadata() {
+ return ignoreMetadata;
+ }
+
+ public int getMinIndex() {
+ return minIndex;
+ }
+
+ public Locale[] getAvailableLocales() {
+ return availableLocales;
+ }
+
+ public void setLocale(Locale locale) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public Locale getLocale() {
+ return locale;
+ }
+
+ public abstract int getNumImages(boolean allowSearch) throws IOException;
+
+ public abstract int getWidth(int imageIndex) throws IOException;
+
+ public abstract int getHeight(int imageIndex) throws IOException;
+
+ public boolean isRandomAccessEasy(int imageIndex) throws IOException {
+ return false; //def
+ }
+
+ public float getAspectRatio(int imageIndex) throws IOException {
+ return (float) getWidth(imageIndex) / getHeight(imageIndex);
+ }
+
+ public ImageTypeSpecifier getRawImageType(int imageIndex) throws IOException {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public abstract Iterator getImageTypes(int imageIndex) throws IOException;
+
+ public ImageReadParam getDefaultReadParam() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public abstract IIOMetadata getStreamMetadata() throws IOException;
+
+ public IIOMetadata getStreamMetadata(String formatName, Set nodeNames)
+ throws IOException {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public abstract IIOMetadata getImageMetadata(int imageIndex) throws IOException;
+
+ public IIOMetadata getImageMetadata(int imageIndex, String formatName,
+ Set nodeNames) throws IOException {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public BufferedImage read(int imageIndex) throws IOException {
+ return read(imageIndex, null);
+ }
+
+ public abstract BufferedImage read(int imageIndex, ImageReadParam param) throws IOException;
+
+ public IIOImage readAll(int imageIndex, ImageReadParam param) throws IOException {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public Iterator readAll(Iterator params) throws IOException {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public boolean canReadRaster() {
+ return false; //def
+ }
+
+ public Raster readRaster(int imageIndex, ImageReadParam param) throws IOException {
+ throw new UnsupportedOperationException("Unsupported");
+ }
+
+ public boolean isImageTiled(int imageIndex) throws IOException {
+ return false; //def
+ }
+
+ public int getTileWidth(int imageIndex) throws IOException {
+ return getWidth(imageIndex); //def
+ }
+
+ public int getTileHeight(int imageIndex) throws IOException {
+ return getHeight(imageIndex); //def
+ }
+
+ public int getTileGridXOffset(int imageIndex) throws IOException {
+ return 0; //def
+ }
+
+ public int getTileGridYOffset(int imageIndex) throws IOException {
+ return 0; //def
+ }
+
+ public BufferedImage readTile(int imageIndex, int tileX, int tileY) throws IOException {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public Raster readTileRaster(int imageIndex, int tileX, int tileY) throws IOException {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException {
+ return read(imageIndex, param);
+ }
+
+ public boolean readerSupportsThumbnails() {
+ return false; //def
+ }
+
+ public boolean hasThumbnails(int imageIndex) throws IOException {
+ return getNumThumbnails(imageIndex) > 0; //def
+ }
+
+ public int getNumThumbnails(int imageIndex) throws IOException {
+ return 0; //def
+ }
+
+ public int getThumbnailWidth(int imageIndex, int thumbnailIndex) throws IOException {
+ return readThumbnail(imageIndex, thumbnailIndex).getWidth(); //def
+ }
+
+ public int getThumbnailHeight(int imageIndex, int thumbnailIndex) throws IOException {
+ return readThumbnail(imageIndex, thumbnailIndex).getHeight(); //def
+ }
+
+ public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) throws IOException {
+ throw new UnsupportedOperationException("Unsupported"); //def
+ }
+
+ public void abort() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected boolean abortRequested() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void clearAbortRequest() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void addIIOReadWarningListener(IIOReadWarningListener listener) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void removeIIOReadWarningListener(IIOReadWarningListener listener) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void removeAllIIOReadWarningListeners() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void addIIOReadProgressListener(IIOReadProgressListener listener) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void removeIIOReadProgressListener(IIOReadProgressListener listener) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void removeAllIIOReadProgressListeners() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void addIIOReadUpdateListener(IIOReadUpdateListener listener) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void removeIIOReadUpdateListener(IIOReadUpdateListener listener) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void removeAllIIOReadUpdateListeners() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processSequenceStarted(int minIndex) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processSequenceComplete() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processImageStarted(int imageIndex) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processImageProgress(float percentageDone) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processImageComplete() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processThumbnailStarted(int imageIndex, int thumbnailIndex) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processThumbnailProgress(float percentageDone) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processThumbnailComplete() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processReadAborted() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processPassStarted(BufferedImage theImage,
+ int pass,
+ int minPass,
+ int maxPass,
+ int minX,
+ int minY,
+ int periodX,
+ int periodY,
+ int[] bands) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processImageUpdate(BufferedImage theImage,
+ int minX,
+ int minY,
+ int width,
+ int height,
+ int periodX,
+ int periodY,
+ int[] bands) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processPassComplete(BufferedImage theImage) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processThumbnailPassStarted(BufferedImage theThumbnail,
+ int pass,
+ int minPass,
+ int maxPass,
+ int minX,
+ int minY,
+ int periodX,
+ int periodY,
+ int[] bands) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processThumbnailUpdate(BufferedImage theThumbnail,
+ int minX,
+ int minY,
+ int width,
+ int height,
+ int periodX,
+ int periodY,
+ int[] bands) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processThumbnailPassComplete(BufferedImage theThumbnail) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processWarningOccurred(String warning) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected void processWarningOccurred(String baseName, String keyword) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public void reset() {
+ // def
+ setInput(null, false);
+ setLocale(null);
+ removeAllIIOReadUpdateListeners();
+ removeAllIIOReadWarningListeners();
+ removeAllIIOReadProgressListeners();
+ clearAbortRequest();
+ }
+
+ public void dispose() {
+ // do nothing by def
+ }
+
+ protected static Rectangle getSourceRegion(ImageReadParam param, int srcWidth, int srcHeight) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected static void computeRegions(ImageReadParam param,
+ int srcWidth,
+ int srcHeight,
+ BufferedImage image,
+ Rectangle srcRegion,
+ Rectangle destRegion) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected static void checkReadParamBandSettings(ImageReadParam param,
+ int numSrcBands,
+ int numDstBands) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ protected static BufferedImage getDestination(ImageReadParam param, Iterator imageTypes,
+ int width,
+ int height)
+ throws IIOException {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageReader.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTranscoder.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTranscoder.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTranscoder.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTranscoder.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio;
+
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.ImageTypeSpecifier;
+
+public interface ImageTranscoder {
+ IIOMetadata convertStreamMetadata(IIOMetadata inData, ImageWriteParam param);
+
+ IIOMetadata convertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param);
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTranscoder.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio;
+
+import java.awt.image.ColorModel;
+import java.awt.image.SampleModel;
+import java.awt.image.BufferedImage;
+import java.awt.image.RenderedImage;
+import java.awt.color.ColorSpace;
+
+/**
+ * TODO implement all the methods
+ */
+public class ImageTypeSpecifier {
+
+ protected ColorModel colorModel;
+ protected SampleModel sampleModel;
+
+ public ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel) {
+ if (colorModel == null) {
+ throw new IllegalArgumentException("color model should not be NULL");
+ }
+ if (sampleModel == null) {
+ throw new IllegalArgumentException("sample model should not be NULL");
+ }
+ if (!colorModel.isCompatibleSampleModel(sampleModel)) {
+ throw new IllegalArgumentException("color and sample models are not compatible");
+ }
+
+ this.colorModel = colorModel;
+ this.sampleModel = sampleModel;
+ }
+
+ public ImageTypeSpecifier(RenderedImage renderedImage) {
+ if (renderedImage == null) {
+ throw new IllegalArgumentException("image should not be NULL");
+ }
+ this.colorModel = renderedImage.getColorModel();
+ this.sampleModel = renderedImage.getSampleModel();
+ }
+
+ public static ImageTypeSpecifier createPacked(ColorSpace colorSpace,
+ int redMask,
+ int greenMask,
+ int blueMask,
+ int alphaMask,
+ int transferType,
+ boolean isAlphaPremultiplied) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace,
+ int[] bandOffsets,
+ int dataType,
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+
+ public static ImageTypeSpecifier createBanded(ColorSpace colorSpace,
+ int[] bankIndices,
+ int[] bandOffsets,
+ int dataType,
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public static ImageTypeSpecifier createGrayscale(int bits,
+ int dataType,
+ boolean isSigned) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public static ImageTypeSpecifier createGrayscale(int bits,
+ int dataType,
+ boolean isSigned,
+ boolean isAlphaPremultiplied) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public static ImageTypeSpecifier createIndexed(byte[] redLUT,
+ byte[] greenLUT,
+ byte[] blueLUT,
+ byte[] alphaLUT,
+ int bits,
+ int dataType) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public static ImageTypeSpecifier createFromRenderedImage(RenderedImage image) {
+ if (null == image) {
+ throw new IllegalArgumentException("image should not be NULL");
+ }
+ return new ImageTypeSpecifier(image);
+ }
+
+ public int getBufferedImageType() {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public int getNumComponents() {
+ return colorModel.getNumComponents();
+ }
+
+ public int getNumBands() {
+ return sampleModel.getNumBands();
+ }
+
+ public int getBitsPerBand(int band) {
+ if (band < 0 || band >= getNumBands()) {
+ throw new IllegalArgumentException();
+ }
+ return sampleModel.getSampleSize(band);
+ }
+
+ public SampleModel getSampleModel() {
+ return sampleModel;
+ }
+
+ public SampleModel getSampleModel(int width, int height) {
+ if ((long)width*height > Integer.MAX_VALUE) {
+ throw new IllegalArgumentException("width * height > Integer.MAX_VALUE");
+ }
+ return sampleModel.createCompatibleSampleModel(width, height);
+ }
+
+ public ColorModel getColorModel() {
+ return colorModel;
+ }
+
+ public BufferedImage createBufferedImage(int width, int height) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public boolean equals(Object o) {
+ boolean rt = false;
+ if (o instanceof ImageTypeSpecifier) {
+ ImageTypeSpecifier ts = (ImageTypeSpecifier) o;
+ rt = colorModel.equals(ts.colorModel) && sampleModel.equals(ts.sampleModel);
+ }
+ return rt;
+ }
+}
\ No newline at end of file
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageTypeSpecifier.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriteParam.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriteParam.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriteParam.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriteParam.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio;
+
+import java.util.Locale;
+import java.awt.*;
+
+/**
+ * TODO: add the methods from the spec
+ */
+public class ImageWriteParam extends IIOParam {
+
+ public static final int MODE_DISABLED = 0;
+ public static final int MODE_DEFAULT = 1;
+ public static final int MODE_EXPLICIT = 2;
+ public static final int MODE_COPY_FROM_METADATA = 3;
+ protected boolean canWriteTiles = false;
+ protected int tilingMode = MODE_COPY_FROM_METADATA;
+ protected Dimension[] preferredTileSizes = null;
+ protected boolean tilingSet = false;
+ protected int tileWidth = 0;
+ protected int tileHeight = 0;
+ protected boolean canOffsetTiles = false;
+ protected int tileGridXOffset = 0;
+ protected int tileGridYOffset = 0;
+ protected boolean canWriteProgressive = false;
+ protected int progressiveMode = MODE_COPY_FROM_METADATA;
+ protected boolean canWriteCompressed = false;
+ protected int compressionMode = MODE_COPY_FROM_METADATA;
+ protected String[] compressionTypes = null;
+ protected String compressionType = null;
+ protected float compressionQuality = 1.0f;
+ protected Locale locale = null;
+
+ protected ImageWriteParam() {}
+
+ public ImageWriteParam(Locale locale) {
+ this.locale = locale;
+
+ }
+
+ public int getProgressiveMode() {
+ if (canWriteProgressive()) {
+ return progressiveMode;
+ }
+ throw new UnsupportedOperationException("progressive mode is not supported");
+ }
+
+ public boolean canWriteProgressive() {
+ return canWriteProgressive;
+ }
+
+ public void setProgressiveMode(int mode) {
+ if (canWriteProgressive()) {
+ if (mode < MODE_DISABLED || mode > MODE_COPY_FROM_METADATA || mode == MODE_EXPLICIT) {
+ throw new IllegalArgumentException("mode is not supported");
+ }
+ this.progressiveMode = mode;
+ }
+ throw new UnsupportedOperationException("progressive mode is not supported");
+ }
+}
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriteParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriter.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriter.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriter.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio;
+
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.spi.ImageWriterSpi;
+import javax.imageio.event.IIOWriteProgressListener;
+import javax.imageio.event.IIOWriteWarningListener;
+import java.io.IOException;
+import java.awt.image.RenderedImage;
+import java.util.Locale;
+import java.util.List;
+import java.util.Iterator;
+
+/**
+ * TODO: Implement the rest of methods
+ */
+public abstract class ImageWriter implements ImageTranscoder {
+
+ protected Locale[] availableLocales;
+ protected Locale locale;
+ protected ImageWriterSpi originatingProvider;
+ protected Object output;
+ protected List progressListeners;
+ protected List warningListeners;
+ protected List warningLocales;
+
+
+ protected ImageWriter(ImageWriterSpi originatingProvider) {
+ this.originatingProvider = originatingProvider;
+ }
+
+ public abstract IIOMetadata convertStreamMetadata(IIOMetadata iioMetadata,
+ ImageWriteParam imageWriteParam);
+
+ public abstract IIOMetadata convertImageMetadata(IIOMetadata iioMetadata,
+ ImageTypeSpecifier imageTypeSpecifier,
+ ImageWriteParam imageWriteParam);
+
+ public ImageWriterSpi getOriginatingProvider() {
+ return originatingProvider;
+ }
+
+ protected void processImageStarted(int imageIndex) {
+ if (null != progressListeners) {
+ for (Iterator iterator = progressListeners.iterator(); iterator.hasNext();) {
+ IIOWriteProgressListener listener = (IIOWriteProgressListener) iterator.next();
+ listener.imageStarted(this, imageIndex);
+ }
+ }
+ }
+
+ protected void processImageProgress(float percentageDone) {
+ if (null != progressListeners) {
+ for (Iterator iterator = progressListeners.iterator(); iterator.hasNext();) {
+ IIOWriteProgressListener listener = (IIOWriteProgressListener) iterator.next();
+ listener.imageProgress(this, percentageDone);
+ }
+ }
+ }
+
+ protected void processImageComplete() {
+ if (null != progressListeners) {
+ for (Iterator iterator = progressListeners.iterator(); iterator.hasNext();) {
+ IIOWriteProgressListener listener = (IIOWriteProgressListener) iterator.next();
+ listener.imageComplete(this);
+ }
+ }
+ }
+
+ protected void processWarningOccurred(int imageIndex, String warning) {
+ if (null == warning) {
+ throw new NullPointerException("warning message should not be NULL");
+ }
+ if (null != warningListeners) {
+ for (Iterator iterator = warningListeners.iterator(); iterator.hasNext();) {
+ IIOWriteWarningListener listener = (IIOWriteWarningListener) iterator.next();
+ listener.warningOccurred(this, imageIndex, warning);
+ }
+ }
+ }
+
+ protected void processWarningOccurred(int imageIndex, String bundle, String key) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public void setOutput(Object output) {
+ if (output != null) {
+ ImageWriterSpi spi = getOriginatingProvider();
+ if (null != spi) {
+ Class[] outTypes = spi.getOutputTypes();
+ boolean supported = false;
+ for(int i = 0; i < outTypes.length; i++) {
+ if (outTypes[i].isInstance(output)) {
+ supported = true;
+ break;
+ }
+ }
+ if (!supported) {
+ throw new IllegalArgumentException("output " + output + " is not supported");
+ }
+ }
+ }
+ this.output = output;
+ }
+
+ public void write(IIOImage image) throws IOException {
+ write(null, image, null);
+ }
+
+ public void write(RenderedImage image) throws IOException {
+ write(null, new IIOImage(image, null, null), null);
+ }
+
+ /**
+ * @throws IllegalStateException - if the output has not been set.
+ * @throws UnsupportedOperationException - if image contains a Raster and canWriteRasters returns false.
+ * @throws IllegalArgumentException - if image is null.
+ * @throws IOException - if an error occurs during writing.
+ *
+ * if !canWriteRaster() then Image must contain only RenderedImage
+
+ * @param streamMetadata <code>null</code> for default stream metadata
+ * @param image
+ * @param param <code>null</code> for default params
+ */
+ public abstract void write(IIOMetadata streamMetadata,
+ IIOImage image, ImageWriteParam param) throws IOException;
+
+ public void dispose() {
+ // def impl. does nothing according to the spec.
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/ImageWriter.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadProgressListener.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadProgressListener.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadProgressListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadProgressListener.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Sergey I. Salishev
+ * @version $Revision: 1.2 $
+ */
+package javax.imageio.event;
+
+import java.util.EventListener;
+import javax.imageio.ImageReader;
+
+/**
+ * @author Sergey I. Salishev
+ * @version $Revision: 1.2 $
+ */
+public interface IIOReadProgressListener extends EventListener {
+
+ void imageComplete(ImageReader source);
+ void imageProgress(ImageReader source, float percentageDone);
+ void imageStarted(ImageReader source, int imageIndex);
+ void readAborted(ImageReader source);
+ void sequenceComplete(ImageReader source);
+ void sequenceStarted(ImageReader source, int minIndex);
+ void thumbnailComplete(ImageReader source);
+ void thumbnailProgress(ImageReader source, float percentageDone);
+ void thumbnailStarted(ImageReader source, int imageIndex, int thumbnailIndex);
+}
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadProgressListener.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadUpdateListener.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadUpdateListener.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadUpdateListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadUpdateListener.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Sergey I. Salishev
+ * @version $Revision: 1.2 $
+ */
+package javax.imageio.event;
+
+import java.awt.image.BufferedImage;
+import java.util.EventListener;
+import javax.imageio.ImageReader;
+
+/**
+ * @author Sergey I. Salishev
+ * @version $Revision: 1.2 $
+ */
+public interface IIOReadUpdateListener extends EventListener {
+
+ void imageUpdate(ImageReader source, BufferedImage theImage, int minX,
+ int minY, int width, int height, int periodX, int periodY,
+ int[] bands);
+
+ void passComplete(ImageReader source, BufferedImage theImage);
+
+ void passStarted(ImageReader source, BufferedImage theImage, int pass,
+ int minPass, int maxPass, int minX, int minY, int periodX,
+ int periodY, int[] bands);
+
+ void thumbnailPassComplete(ImageReader source, BufferedImage theImage);
+
+ void thumbnailPassStarted(ImageReader source, BufferedImage theThumbnail,
+ int pass, int minPass, int maxPass, int minX, int minY,
+ int periodX, int periodY, int[] bands);
+
+ void thumbnailUpdate(ImageReader source, BufferedImage theThumbnail,
+ int minX, int minY, int width, int height, int periodX,
+ int periodY, int[] bands);
+}
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadUpdateListener.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadWarningListener.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadWarningListener.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadWarningListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadWarningListener.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Sergey I. Salishev
+ * @version $Revision: 1.2 $
+ */
+package javax.imageio.event;
+
+import java.util.EventListener;
+import javax.imageio.ImageReader;
+
+/**
+ * @author Sergey I. Salishev
+ * @version $Revision: 1.2 $
+ */
+public interface IIOReadWarningListener extends EventListener {
+
+ public void warningOccurred(ImageReader source, String warning);
+}
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOReadWarningListener.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteProgressListener.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteProgressListener.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteProgressListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteProgressListener.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.event;
+
+import javax.imageio.ImageWriter;
+import java.util.EventListener;
+
+public interface IIOWriteProgressListener extends EventListener {
+ void imageStarted(ImageWriter source, int imageIndex);
+ void imageProgress(ImageWriter source, float percentageDone);
+ void imageComplete(ImageWriter source);
+ void thumbnailStarted(ImageWriter source, int imageIndex, int thumbnailIndex);
+ void thumbnailProgress(ImageWriter source, float percentageDone);
+ void thumbnailComplete(ImageWriter source);
+ void writeAborted(ImageWriter source);
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteProgressListener.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteWarningListener.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteWarningListener.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteWarningListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteWarningListener.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.event;
+
+import javax.imageio.ImageWriter;
+import java.util.EventListener;
+
+public interface IIOWriteWarningListener extends EventListener {
+ void warningOccurred(ImageWriter source, int imageIndex, String warning);
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/event/IIOWriteWarningListener.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadata.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadata.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadata.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadata.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.metadata;
+
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ *
+ * TODO add all the methods from the spec
+ */
+public abstract class IIOMetadata {
+
+ protected boolean standardFormatSupported;
+ protected String nativeMetadataFormatName;
+ protected String nativeMetadataFormatClassName;
+ protected String[] extraMetadataFormatNames;
+ protected String[] extraMetadataFormatClassNames;
+ protected IIOMetadataController defaultController;
+ protected IIOMetadataController controller;
+
+ protected IIOMetadata() {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ protected IIOMetadata(boolean standardMetadataFormatSupported,
+ String nativeMetadataFormatName,
+ String nativeMetadataFormatClassName,
+ String[] extraMetadataFormatNames,
+ String[] extraMetadataFormatClassNames) {
+ // TODO implement for SpecJBB
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ //-- TODO add all the methods from the spec
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadata.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadataController.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadataController.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadataController.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadataController.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Sergey I. Salishev
+ * @version $Revision: 1.2 $
+ */
+package javax.imageio.metadata;
+
+/**
+ * @author Sergey I. Salishev
+ * @version $Revision: 1.2 $
+ */
+public interface IIOMetadataController {
+
+ public boolean activate(IIOMetadata metadata);
+}
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/metadata/IIOMetadataController.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.plugins.jpeg;
+
+public class JPEGQTable {
+
+ private final static int SIZE = 64;
+ private final static int BASELINE_MAX = 255;
+ private final static int MAX = 32767;
+
+
+ private int[] theTable;
+
+ /*
+ * K1 & K2 tables can be found in the JPEG format specification
+ * at http://www.w3.org/Graphics/JPEG/itu-t81.pdf
+ */
+
+ private static final int[] K1LumTable = new int[] {
+ 16, 11, 10, 16, 24, 40, 51, 61,
+ 12, 12, 14, 19, 26, 58, 60, 55,
+ 14, 13, 16, 24, 40, 57, 69, 56,
+ 14, 17, 22, 29, 51, 87, 80, 62,
+ 18, 22, 37, 56, 68, 109, 103, 77,
+ 24, 35, 55, 64, 81, 104, 113, 92,
+ 49, 64, 78, 87, 103, 121, 120, 101,
+ 72, 92, 95, 98, 112, 100, 103, 99
+ };
+
+ private static final int[] K2ChrTable = new int[] {
+ 17, 18, 24, 47, 99, 99, 99, 99,
+ 18, 21, 26, 66, 99, 99, 99, 99,
+ 24, 26, 56, 99, 99, 99, 99, 99,
+ 47, 66, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99
+ };
+
+ public static final JPEGQTable K1Luminance = new JPEGQTable(K1LumTable);
+ public static final JPEGQTable K1Div2Luminance = K1Luminance.getScaledInstance(0.5f, true);
+ public static final JPEGQTable K2Chrominance = new JPEGQTable(K2ChrTable);
+ public static final JPEGQTable K2Div2Chrominance = K2Chrominance.getScaledInstance(0.5f, true);;
+
+
+ public JPEGQTable(int[] table) {
+ if (table == null) {
+ throw new IllegalArgumentException("table should not be NULL");
+ }
+ if (table.length != SIZE) {
+ throw new IllegalArgumentException("illegal table size: " + table.length);
+ }
+ theTable = (int[]) table.clone();
+ }
+
+ public int[] getTable() {
+ return (int[]) theTable.clone();
+ }
+
+ public JPEGQTable getScaledInstance(float scaleFactor, boolean forceBaseline) {
+ int table[] = new int[SIZE];
+
+ int maxValue = forceBaseline ? BASELINE_MAX : MAX;
+
+ for (int i = 0; i < theTable.length; i++) {
+ int rounded = Math.round(theTable[i] * scaleFactor);
+ if (rounded < 1) {
+ rounded = 1;
+ }
+ if (rounded > maxValue) {
+ rounded = maxValue;
+ }
+ table[i] = rounded;
+ }
+ return new JPEGQTable(table);
+ }
+
+ public String toString() {
+ //-- TODO more informative info
+ return "JPEGQTable";
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.spi;
+
+import org.apache.harmony.x.imageio.plugins.jpeg.JPEGImageWriterSpi;
+import org.apache.harmony.x.imageio.plugins.jpeg.JPEGImageReaderSpi;
+import org.apache.harmony.x.imageio.spi.FileIOSSpi;
+import org.apache.harmony.x.imageio.spi.RAFIOSSpi;
+import org.apache.harmony.x.imageio.spi.FileIISSpi;
+import org.apache.harmony.x.imageio.spi.RAFIISSpi;
+
+import java.util.Arrays;
+
+import org.apache.harmony.awt.datatransfer.*;
+
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+public final class IIORegistry extends ServiceRegistry {
+
+ private static volatile IIORegistry instance;
+
+ private static final Class[] CATEGORIES = new Class[] {
+ javax.imageio.spi.ImageWriterSpi.class,
+ javax.imageio.spi.ImageReaderSpi.class,
+ javax.imageio.spi.ImageInputStreamSpi.class,
+ //javax.imageio.spi.ImageTranscoderSpi.class,
+ javax.imageio.spi.ImageOutputStreamSpi.class
+ };
+
+ private IIORegistry() {
+ super(Arrays.asList(CATEGORIES).iterator());
+ registerBuiltinSpis();
+ registerApplicationClasspathSpis();
+ }
+
+ private void registerBuiltinSpis() {
+ registerServiceProvider(new JPEGImageWriterSpi());
+ registerServiceProvider(new JPEGImageReaderSpi());
+ registerServiceProvider(new FileIOSSpi());
+ registerServiceProvider(new FileIISSpi());
+ registerServiceProvider(new RAFIOSSpi());
+ registerServiceProvider(new RAFIISSpi());
+ //-- TODO implement
+ }
+
+ public static IIORegistry getDefaultInstance() {
+ // TODO implement own instance for each ThreadGroup (see also ThreadLocal)
+ if (instance == null) {
+ synchronized(IIORegistry.class) {
+ if (instance == null) {
+ instance = new IIORegistry();
+ }
+ }
+ }
+ return instance;
+ }
+
+ public void registerApplicationClasspathSpis() {
+ //-- TODO implement for non-builtin plugins
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIORegistry.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.spi;
+
+import java.util.Locale;
+
+public abstract class IIOServiceProvider implements RegisterableService {
+
+ protected String vendorName;
+ protected String version;
+
+ public IIOServiceProvider(String vendorName, String version) {
+ if (vendorName == null) {
+ throw new NullPointerException("vendor name cannot be NULL");
+ }
+ if (version == null) {
+ throw new NullPointerException("version name cannot be NULL");
+ }
+ this.vendorName = vendorName;
+ this.version = version;
+ }
+
+ public IIOServiceProvider() {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public void onRegistration(ServiceRegistry registry, Class category) {
+ // the default impl. does nothing
+ }
+
+ public void onDeregistration(ServiceRegistry registry, Class category) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public String getVendorName() {
+ return vendorName;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public abstract String getDescription(Locale locale);
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/IIOServiceProvider.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.spi;
+
+import javax.imageio.stream.ImageInputStream;
+import java.util.Locale;
+import java.io.IOException;
+import java.io.File;
+
+public abstract class ImageInputStreamSpi extends IIOServiceProvider
+ implements RegisterableService {
+
+ protected Class inputClass;
+
+ protected ImageInputStreamSpi() {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public ImageInputStreamSpi(String vendorName, String version, Class inputClass) {
+ super(vendorName, version);
+ this.inputClass = inputClass;
+ }
+
+ public Class getInputClass() {
+ return inputClass;
+ }
+
+ public boolean canUseCacheFile() {
+ return false; //-- def
+ }
+
+ public boolean needsCacheFile() {
+ return false; // def
+ }
+
+ public abstract ImageInputStream createInputStreamInstance(Object input,
+ boolean useCache, File cacheDir)
+ throws IOException;
+
+ public ImageInputStream createInputStreamInstance(Object input) throws IOException {
+ return createInputStreamInstance(input, true, null);
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageInputStreamSpi.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.spi;
+
+import javax.imageio.stream.ImageOutputStream;
+import java.util.Locale;
+import java.io.IOException;
+import java.io.File;
+
+public abstract class ImageOutputStreamSpi extends IIOServiceProvider
+ implements RegisterableService {
+
+ protected Class outputClass;
+
+ protected ImageOutputStreamSpi() {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public ImageOutputStreamSpi(String vendorName, String version, Class outputClass) {
+ super(vendorName, version);
+ this.outputClass = outputClass;
+ }
+
+ public Class getOutputClass() {
+ return outputClass;
+ }
+
+ public boolean canUseCacheFile() {
+ return false; // def
+ }
+
+ public boolean needsCacheFile() {
+ return false; // def
+ }
+
+ public ImageOutputStream createOutputStreamInstance(Object output)
+ throws IOException {
+ return createOutputStreamInstance(output, true, null);
+ }
+
+ public abstract ImageOutputStream createOutputStreamInstance(Object output,
+ boolean useCache, File cacheDir) throws IOException;
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageOutputStreamSpi.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderSpi.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderSpi.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderSpi.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.spi;
+
+import javax.imageio.stream.ImageInputStream;
+import javax.imageio.ImageReader;
+import java.io.IOException;
+
+public abstract class ImageReaderSpi extends ImageReaderWriterSpi {
+
+ public static final Class[] STANDARD_INPUT_TYPE = new Class[] {ImageInputStream.class};
+
+ protected Class[] inputTypes;
+ protected String[] writerSpiNames;
+
+ protected ImageReaderSpi() {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public ImageReaderSpi(String vendorName, String version, String[] names, String[] suffixes,
+ String[] MIMETypes, String pluginClassName,
+ Class[] inputTypes, String[] writerSpiNames,
+ boolean supportsStandardStreamMetadataFormat,
+ String nativeStreamMetadataFormatName,
+ String nativeStreamMetadataFormatClassName,
+ String[] extraStreamMetadataFormatNames,
+ String[] extraStreamMetadataFormatClassNames,
+ boolean supportsStandardImageMetadataFormat,
+ String nativeImageMetadataFormatName,
+ String nativeImageMetadataFormatClassName,
+ String[] extraImageMetadataFormatNames,
+ String[] extraImageMetadataFormatClassNames) {
+ super(vendorName, version, names, suffixes, MIMETypes, pluginClassName,
+ supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName,
+ nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames,
+ extraStreamMetadataFormatClassNames, supportsStandardImageMetadataFormat,
+ nativeImageMetadataFormatName, nativeImageMetadataFormatClassName,
+ extraImageMetadataFormatNames, extraImageMetadataFormatClassNames);
+
+ if (inputTypes == null || inputTypes.length == 0) {
+ throw new NullPointerException("input types array cannot be NULL or empty");
+ }
+ this.inputTypes = inputTypes;
+ this.writerSpiNames = writerSpiNames;
+ }
+
+ public Class[] getInputTypes() {
+ return inputTypes;
+ }
+
+ public abstract boolean canDecodeInput(Object source) throws IOException;
+
+ public ImageReader createReaderInstance() throws IOException {
+ return createReaderInstance(null);
+ }
+
+ public abstract ImageReader createReaderInstance(Object extension) throws IOException;
+
+ public boolean isOwnReader(ImageReader reader) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public String[] getImageWriterSpiNames() {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderSpi.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.spi;
+
+/**
+ * TODO add all the methods from the spec
+ */
+public abstract class ImageReaderWriterSpi extends IIOServiceProvider
+ implements RegisterableService {
+
+ protected String[] names;
+ protected String[] suffixes;
+ protected String[] MIMETypes;
+ protected String pluginClassName;
+ protected boolean supportsStandardStreamMetadataFormat;
+ protected String nativeStreamMetadataFormatName;
+ protected String nativeStreamMetadataFormatClassName;
+ protected String[] extraStreamMetadataFormatNames;
+ protected String[] extraStreamMetadataFormatClassNames;
+ protected boolean supportsStandardImageMetadataFormat;
+ protected String nativeImageMetadataFormatName;
+ protected String nativeImageMetadataFormatClassName;
+ protected String[] extraImageMetadataFormatNames;
+ protected String[] extraImageMetadataFormatClassNames;
+
+ public ImageReaderWriterSpi(String vendorName, String version, String[] names,
+ String[] suffixes, String[] MIMETypes,
+ String pluginClassName,
+ boolean supportsStandardStreamMetadataFormat,
+ String nativeStreamMetadataFormatName,
+ String nativeStreamMetadataFormatClassName,
+ String[] extraStreamMetadataFormatNames,
+ String[] extraStreamMetadataFormatClassNames,
+ boolean supportsStandardImageMetadataFormat,
+ String nativeImageMetadataFormatName,
+ String nativeImageMetadataFormatClassName,
+ String[] extraImageMetadataFormatNames,
+ String[] extraImageMetadataFormatClassNames) {
+ super(vendorName, version);
+
+ if (names == null || names.length == 0 || pluginClassName == null) {
+ throw new NullPointerException("format names array cannot be NULL or empty");
+ }
+
+ if (pluginClassName == null) {
+ throw new NullPointerException("Plugin class name cannot bu NULL");
+ }
+
+
+ this.names = names;
+ this.suffixes = suffixes;
+ this.MIMETypes = MIMETypes;
+ this.pluginClassName = pluginClassName;
+ this.supportsStandardStreamMetadataFormat = supportsStandardStreamMetadataFormat;
+ this.nativeStreamMetadataFormatName = nativeStreamMetadataFormatName;
+ this.nativeStreamMetadataFormatClassName = nativeStreamMetadataFormatClassName;
+ this.extraStreamMetadataFormatNames = extraStreamMetadataFormatNames;
+ this.extraStreamMetadataFormatClassNames = extraStreamMetadataFormatClassNames;
+ this.supportsStandardImageMetadataFormat = supportsStandardImageMetadataFormat;
+ this.nativeImageMetadataFormatName = nativeImageMetadataFormatName;
+ this.nativeImageMetadataFormatClassName = nativeImageMetadataFormatClassName;
+ this.extraImageMetadataFormatNames = extraImageMetadataFormatNames;
+ this.extraImageMetadataFormatClassNames = extraImageMetadataFormatClassNames;
+ }
+
+ public ImageReaderWriterSpi() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ public String[] getFormatNames() {
+ return names;
+ }
+
+ public String[] getFileSuffixes() {
+ return suffixes;
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageReaderWriterSpi.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageTranscoderSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageTranscoderSpi.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageTranscoderSpi.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageTranscoderSpi.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.spi;
+
+import javax.imageio.ImageTranscoder;
+
+public abstract class ImageTranscoderSpi extends IIOServiceProvider
+ implements RegisterableService {
+
+ protected ImageTranscoderSpi() {
+ }
+
+ public ImageTranscoderSpi(String vendorName, String version) {
+ super(vendorName, version);
+ }
+
+ public abstract String getReaderServiceProviderName();
+
+ public abstract String getWriterServiceProviderName();
+
+ public abstract ImageTranscoder createTranscoderInstance();
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageTranscoderSpi.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageWriterSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageWriterSpi.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageWriterSpi.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageWriterSpi.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.spi;
+
+import javax.imageio.stream.ImageInputStream;
+import javax.imageio.ImageTypeSpecifier;
+import javax.imageio.ImageWriter;
+import java.awt.image.RenderedImage;
+import java.io.IOException;
+
+public abstract class ImageWriterSpi extends ImageReaderWriterSpi {
+
+ public static final Class[] STANDARD_OUTPUT_TYPE = new Class[] {ImageInputStream.class};
+
+ protected Class[] outputTypes;
+ protected String[] readerSpiNames;
+
+ protected ImageWriterSpi() {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public ImageWriterSpi(String vendorName, String version, String[] names,
+ String[] suffixes, String[] MIMETypes,
+ String pluginClassName,
+ Class[] outputTypes, String[] readerSpiNames,
+ boolean supportsStandardStreamMetadataFormat,
+ String nativeStreamMetadataFormatName,
+ String nativeStreamMetadataFormatClassName,
+ String[] extraStreamMetadataFormatNames,
+ String[] extraStreamMetadataFormatClassNames,
+ boolean supportsStandardImageMetadataFormat,
+ String nativeImageMetadataFormatName,
+ String nativeImageMetadataFormatClassName,
+ String[] extraImageMetadataFormatNames,
+ String[] extraImageMetadataFormatClassNames) {
+ super(vendorName, version, names, suffixes, MIMETypes, pluginClassName,
+ supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName,
+ nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames,
+ extraStreamMetadataFormatClassNames, supportsStandardImageMetadataFormat,
+ nativeImageMetadataFormatName, nativeImageMetadataFormatClassName,
+ extraImageMetadataFormatNames, extraImageMetadataFormatClassNames);
+
+ if (outputTypes == null || outputTypes.length == 0) {
+ throw new NullPointerException("output types array cannot be NULL or empty");
+ }
+
+ this.outputTypes = outputTypes;
+ this.readerSpiNames = readerSpiNames;
+ }
+
+ public boolean isFormatLossless() {
+ return true;
+ }
+
+ public Class[] getOutputTypes() {
+ return outputTypes;
+ }
+
+ public abstract boolean canEncodeImage(ImageTypeSpecifier type);
+
+ public boolean canEncodeImage(RenderedImage im) {
+ return canEncodeImage(ImageTypeSpecifier.createFromRenderedImage(im));
+ }
+
+ public ImageWriter createWriterInstance() throws IOException {
+ return createWriterInstance(null);
+ }
+
+ public abstract ImageWriter createWriterInstance(Object extension) throws IOException;
+
+ public boolean isOwnWriter(ImageWriter writer) {
+ throw new UnsupportedOperationException("Not supported yet");
+ }
+
+ public String[] getImageReaderSpiNames() {
+ return readerSpiNames;
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/ImageWriterSpi.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java Sun Oct 8 22:33:09 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Rustem V. Rafikov
+ * @version $Revision: 1.3 $
+ */
+package javax.imageio.spi;
+
+public interface RegisterableService {
+ void onRegistration(ServiceRegistry registry, Class category);
+ void onDeregistration(ServiceRegistry registry, Class category);
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/imageio/src/main/java/javax/imageio/spi/RegisterableService.java
------------------------------------------------------------------------------
svn:executable = *