[gui][patch] implement imageio SPI for gdk-pixbuf

graydon hoare graydon@redhat.com
Tue Jan 4 21:16:00 GMT 2005


hi,

this patch, which I've just committed to java-gui-branch, provides a 
javax.imageio SPI for the gdk-pixbuf library, and corrects a variety of 
small bugs in the existing imageio implementation. it also adds the 
standard static entry points to imageio. so your basic actions like

      ImageIO.write(ImageIO.read(new File("foo.jpg"),
                    "png", new File("bar.png")));

should now work. it can also use URLs and Input/OutputStreams. buffering 
is pretty crude and purely in-memory, so you will pay about 2x size of 
image worth of memory, temporarily, during a write.

the available input and output types are registered dynamically by 
querying modules in gdk-pixbuf. currently, looking at the modules which 
came with my copy of gdk-pixbuf, this means you get:

  - loading capability for ani, bpm, gif, ico, jpeg, png, pnm, ras, tga,
    tiff, wbmp, xbm and xpm

  - saving capability for jpeg and png

of course the SPI is not available if you're not using the GTK toolkit; 
it is registered dynamically depending on the choice of toolkit. also, 
multi-frame i/o and all metadata operations are currently unsupported.

-graydon


2005-01-04  Graydon Hoare  <graydon@redhat.com>

	* gnu/java/awt/ClasspathToolkit.java
	(registerImageIOSpis): New method.
	* gnu/java/awt/image/ImageDecoder.java
	(imageDecoder): New constructor using InputStream
	(startProduction): Handle existing InputStream.
	* gnu/java/awt/peer/gtk/GdkGraphics2D.java
	(findSimpleIntegerArray): Make public and static.
	(updateBufferedImage): Set each pixel, in a loop.
	* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
	Implement ImageIO SPI classes.
	(createBufferedImage): Rewrite in terms of SPI classes.
	* gnu/java/awt/peer/gtk/GtkToolkit.java
	(registerImageIOSpis): New method.
	* java/lang/reflect/natMethod.cc
	(_Jv_CallAnyMethodA): Borrow a patch from aph, applied to trunk,
	which lets JNI call interface methods properly.
	* javax/imageio/ImageIO.java
	(WriterFormatFilter.filter): Fix copy-and-paste typos.
	(WriterMIMETypeFilter.filter): Likewise.
	(ImageReaderIterator): Pass extension argument through to SPI.
	(getReadersByFilter): Likewise.
	(getWritersByFilter): Likewise.
	(getImageReadersByFormatName): Likewise.
	(getImageReadersByMIMEType): Likewise.
	(getImageReadersBySuffix): Likewise.
	(getImageWritersByFormatName): Likewise.
	(getImageWritersByMIMEType): Likewise.
	(getImageWritersBySuffix): Likewise.
	(read): Implement.
	(write): Implement.
	* javax/imageio/ImageReader.java
	(progressListeners): Initialize.
	(setInput): Implement.
	* javax/imageio/ImageWriter.java
	(progressListeners): Initialize.
	(warningListeners): Likewise.
	(warningLocales): Likewise.
	(setOutput): Test "isInstance" rather than class equality.
	* javax/imageio/spi/IIORegistry.java
	(static): Add reader and writer SPIs.
	(IIORegistry): Call ClasspathToolkit.registerImageIOSpis.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
	(query_formats): New function.
	(save_to_stream): Likewise.
	(Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_streamImage): Likewise.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: java-gui-gdk-pixbuf-imageio.patch
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050104/b3e9696d/attachment.ksh>


More information about the Java-patches mailing list