AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem in scaling using biliner interpolation

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits
View previous topic :: View next topic  
Author Message
Raj
Guest





PostPosted: Tue Nov 25, 2003 10:33 am    Post subject: Problem in scaling using biliner interpolation Reply with quote



Hi ,
I am trying to write a function which rescales a bufferedimage using
JAI biliner interpolation

But it seems the rescaled image looses the data and now only a part of
the rescaled image is visible.I read the JAI documentation and read
somewhere that its because of not giving the proper renderinghint to
extend the border.
So i created the renderinghint and added it to the the JAI.create
method,still the result is same.

What am i doing wrong???I am new to this and am totally flabbergasted
Sad
Help me!!!

Copying the code below

Thanx a lot
Raj


public static BufferedImage _rescale(BufferedImage image, float
xScale,
float yScale)
{
if((xScale == 1.0f)&& (yScale == 1.0f)){return image;}
// Interpolation interp = Interpolation.getInstance(
// Interpolation.INTERP_BICUBIC);
Interpolation interp =
Interpolation.getInstance(Interpolation.INTERP_BILINEAR);
ParameterBlock params = new ParameterBlock();
params.addSource(image);
params.add(xScale);
params.add(yScale);

/** Add x translate */
params.add(0.0F);

/** Add y translate */
params.add(0.0F);

/** Adds interpolation method */
params.add(interp);


RenderingHints rh = new RenderingHints(JAI.KEY_BORDER_EXTENDER,
BorderExtender.createInstance(BorderExtender.BORDER_COPY));





RenderedOp outputImage = JAI.create("scale", params,rh);
//RenderedOp outputImage = JAI.create("scale", params);
Raster raster = outputImage.getData();
//BufferedImage result=new BufferedImage();
BufferedImage result = new BufferedImage(raster.getWidth(),
raster.getHeight(),
IMAGE_TYPE);

System.out.println(raster.getWidth()+"---"+
raster.getHeight());
result.setData(raster);
return result;
}
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.