Re: [java2d] BufferedImage + scale

1999-02-18 Thread Jim Graham

One thing to check with "custom" buffered image object is that if the
format you were trying to construct was one of the common formats that
has a constant associated with it then you should call getType() and
verify that it was recognized as that type.  If it wasn't recognized,
then unpack BufferedImage.java from the src's zip/tar file and look at
how images of that type are constructed and compare it to the way that
you are constructing your Raster and ColorModel.

If you find differences that "fool" us into not recognizing your image
and you think that it should have been recognized, then send an example
that shows the problem to the [EMAIL PROTECTED] feedback list...

...jim

=
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/



Re: [java2d] BufferedImage + scale

1999-02-18 Thread Denis Tellier

Hi Thanh,
I send you a simplified vesrion of my classes.
I can send you Sun Raster files if you want.
Just one question:
Where can I find examples about how create a BufferedImage decoder and the use of
the DataBuffer and SampleModel (No examples at Sun or JavaWorld).
In all the examples I have seen, the author use Toolkit.loadImage, create a
BufferedImage with a graphics, and draw the image in the graphics. With this method,
you lost original model of the image.
The JPEGImageDecoder.java use native code so it can't help programmers.
And I  use high level methods like ColorModel.createCompatibleWitableRaster(), I
can't precise informations like scanlinestride.May be the problem is here. In the
BufferedImageOp, you use high levels methods to make compatible the source and the
destination.

Denis

Thanh Nguyen wrote:

> Hi Denis,
> Could you send us a small test case so that we can investigate the
> problem here? I am interested to know how you create your Raster and
> ColorModel.  For some image formats, the Graphics2D.drawImage call to
> scale an image works internally just like you would call
> AffineTransformOp.filter and unscaled Graphics2D.drawImage
> consecutively in your application code.
>
> Thanks.
> thanh
>
> > Date: Wed, 17 Feb 1999 09:15:14 +0100
> > From: Denis Tellier <[EMAIL PROTECTED]>
> > X-Accept-Language: en
> > MIME-Version: 1.0
> > To: [EMAIL PROTECTED]
> > Subject: Re: [java2d] BufferedImage + scale
> > Content-Transfer-Encoding: 7bit
> >
> > Hi,
> > I have the similar problem with "custom-made" BufferedImage. Im'using a Raster
> > with a MultiPixelPackedSampleModel and an IndexedColorModel to load a sun
> raster
> > image file coded on 8 bits. When I want to scale it, I have these problems:
> > 1-with AffineTransfromOp.filter, a java.awt.image.ImagingOpException : Unable
> to
> > transform src image is throwed.
> > 2- with Graphics2D.drawImage, the scaled image is corrupted (it is duplicated
> by
> > 8 on the width).
> >
> > But it works fine with the 24 bits sun raster file .
> >
> > So I try to convert the indexed BufferedImage to a DirectColorModel but I have
> > the same exception with ColorConvertOp.
> >
> > Denis
> >
> > =
> > To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> > Java 2D Home Page: http://java.sun.com/products/java-media/2D/

 RasParam.java
 RasImageDecoder.java
 ImageLoader.java


Re: [java2d] BufferedImage + scale

1999-02-17 Thread Denis Tellier

Hi,
I have the similar problem with "custom-made" BufferedImage. Im'using a Raster
with a MultiPixelPackedSampleModel and an IndexedColorModel to load a sun raster
image file coded on 8 bits. When I want to scale it, I have these problems:
1-with AffineTransfromOp.filter, a java.awt.image.ImagingOpException : Unable to
transform src image is throwed.
2- with Graphics2D.drawImage, the scaled image is corrupted (it is duplicated by
8 on the width).

But it works fine with the 24 bits sun raster file .

So I try to convert the indexed BufferedImage to a DirectColorModel but I have
the same exception with ColorConvertOp.

Denis

=
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/



Re: [java2d] BufferedImage + scale

1999-02-17 Thread Mick Barry

I also had image scaling problems using AffineTransform's except I wasn't
getting an exception. My problem was the image display was 'corrupt'. Sun
were aware of this problem and suggested using drawImage to do the scaling.
I also had strange problems using this but I haven't verified exactly what's
going on. I'll post my findings when I have them.

In short, it seems image scaling is 'a bit flakey' in places :(

mick

Herbert Meisenkaiser wrote:

> Hi !
>
> I have trouble with the scaling in Graphics2D ...
> When i am trying
>
>public void paintComponent ( Graphics graphics )
>{
>   super.paintComponent ( graphics );
>
>   ((Graphics2D)graphics).scale (2.0D,2.0D);
>   if (currentBufferedImage != null) ((Graphics2D)graphics).drawImage
> ( currentBufferedImage, 0,0,null
> );
>}
>
> i get a
>
> java.awt.image.ImagingOpException : Unable to transform src image
>
> ARGH!!!
> This only happens with x.0 Scalingfactors > 1.0 !!!
> When i try 1. everything works! And with an AffineTransform
> the same thing happens.
> What is wrong? Is this a known bug?
> How can i zoom a BufferedImage instead?
>
> Thanks!  TRI
> =
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 2D Home Page: http://java.sun.com/products/java-media/2D/

=
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/



RE: [java2d] BufferedImage + scale

1999-02-16 Thread Jenkins, Andrew B

Don't know what the problem is, but here's some quick and
dirty ways to scale and crop images simply using the
drawImage method:

http://www.javaworld.com/javaworld/javatips/jw-javatip32.html

Hope this helps,

--Andy

> --
> From: Herbert Meisenkaiser[SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, February 16, 1999 10:46 AM
> To:   [EMAIL PROTECTED]
> Subject:  [java2d] BufferedImage + scale
> 
> Hi !
> 
> 
> I have trouble with the scaling in Graphics2D ...
> When i am trying
> 
>public void paintComponent ( Graphics graphics )
>{
>   super.paintComponent ( graphics );
>   
>   ((Graphics2D)graphics).scale (2.0D,2.0D);
>   if (currentBufferedImage != null) ((Graphics2D)graphics).drawImage 
> ( currentBufferedImage, 0,0,null
> );
>}
> 
> i get a
> 
> java.awt.image.ImagingOpException : Unable to transform src image
> 
> ARGH!!!
> This only happens with x.0 Scalingfactors > 1.0 !!!
> When i try 1. everything works! And with an AffineTransform
> the same thing happens.
> What is wrong? Is this a known bug?
> How can i zoom a BufferedImage instead?
> 
> 
> Thanks!  TRI
> =
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 2D Home Page: http://java.sun.com/products/java-media/2D/
> 
=
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/