I construct the BufferedImage the following from an shortarray, billedata ;
private BufferedImage orig;
private Point P = new Point(0,0);
private DataBuffer DB;
private ColorSpace CS;
private SampleModel SM;
private WritableRaster WR;
private ColorModel CM;
public toImage(short[] billeddata,int width, int height, int inBits){
int[] bits = {inBits};
DB = new DataBufferUShort(billeddata,billeddata.length);
CS = ColorSpace.getInstance(ColorSpace.CS_GRAY);
SM = new BandedSampleModel(DB.getDataType(),width,height,1);
WR = WritableRaster.createWritableRaster(SM,DB,P);
CM = new ComponentColorModel(CS,bits,false,false,0,DB.getDataType());
orig = new BufferedImage(CM,WR,false,null);
}
Jeannette Hung wrote:
> Could you send a test case? What kind of BufferredImage are you using?
>
> jeannette
>
> > X-Accept-Language: en
> > MIME-Version: 1.0
> > Content-Transfer-Encoding: 8bit
> > Date: Wed, 3 Nov 1999 01:00:29 +0100
> > From: Ole Baunb�k Jensen <[EMAIL PROTECTED]>
> > Subject: [JAVA2D] Affintransform
> > To: [EMAIL PROTECTED]
> >
> > Hi
> >
> > I have this problem with affin transform.
> > I want to write a method where the transform is performed on a class
> > -BufferedImage-variable , 'orig'
> >
> > �i get this exception:
> > .ImagingOpException: Unable to transform src image
> >
> > heres the function, ive probably not included some important parts, but
> > maybe you can recognize the problem anyway...
> > Ive tried to use the 'createCompatibleDestImage(...); but with no
> > further luck :-(
> > ------------
> > BufferedImage orig = some generated grayscale image wich im certain i
> > can perform drawImage(...) on;
> > public void scale(double factor){
> >
> > double sx = factor;
> > double sy = factor;
> > AffineTransform tx = new AffineTransform();
> > tx.scale(sx,sy);
> > AffineTransformOp ato = new
> > AffineTransformOp(tx,AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
> > orig = ato.filter(orig,null);
> >
> > }
> >
> > ---------------
> >
> >
> > Ole
> >
> > ===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> > of the message "signoff JAVA2D-INTEREST". For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".