Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java Advanced Imaging API - PlanarImage

10 views
Skip to first unread message

Frank-Michael Moser

unread,
Jan 11, 2000, 3:00:00 AM1/11/00
to
It seems that both the problems are solved by the
JavaBeansTM Activation Framework (JAF)
http://web2.java.sun.com/beans/glasgow/jaf.html

Frank-Michael Moser wrote:
>
> Two problems turned out to be to hard for me.
>
> #1
> How to determine the codec of a just loaded
> javax.media.jai.PlanarImage:
> PlanarImage src = JAI.create("fileload", name);
> Now I want to know if 'name' is a TIFF-, a JPEG-, a
> BMP-file or ...?
>
> #2
> How to copy a PlanarImage or an java.awt.Image
> or maybe a java.awt.Graphics to the System-Clipboard?
> How to get or create the special Transferable-Object.
>
> Frank-Michael

Frank-Michael Moser

unread,
Jan 13, 2000, 3:00:00 AM1/13/00
to
Not really:

#1
JAF is able to determine the MIME-Typ of a given file
but with respect to the filename-suffix only.
But this one has no relevance when loading a file
via JAI.

#2
The clipboard handling within one JVM is really simple.
But if you want to make the clipboard content
(more complex than plain text) accesssible for
non-Java-applications, it seems there is no way around
the use of the JNI.
The following article I found in the forum archiv
maintainedby Sun:
########################################################
As for images JDK1.1 definately does not support it.
JDK1.2 says it does but I have not been able to get it to work.
The best way is to use JNI and write a small DLL.

Use the PixelGrabber class to get the contents of the canvar graphics
into an integer array.
For MS Windows one needs to use the following WINSDK api -
convert image data to DIB (device independant bitmap) format.
PixelGrabber class may be used here.

call C function using JNI passing in the DIB data -
The C function does -

OpenClipboard EmptyClipboard

GlobalAlloc a buffer fro header + image data GlobalLock the buffer Setup
header BITMAPHEADERINFO append image data to the buffer
GlobalUnlock the buffer do not free the buffer

SetClipboardData(buffer) CloseClipboard
############################################################

Any suggestions?!?

F.-M.

0 new messages