public RenderedImage createScaledRendering(int w,int h,RenderingHints hints){
  double sx=(double)w / getWidth();
  double sy=(double)h / getHeight();
  if (Math.abs(sx / sy - 1.0) < 0.01) {
    sx=sy;
  }
  AffineTransform usr2dev=AffineTransform.getScaleInstance(sx,sy);
  RenderContext newRC=new RenderContext(usr2dev,hints);
  return createRendering(newRC);
}

public RenderedImage createScaledRendering ( int w , int h , RenderingHints hints ) { double sx = ( double ) w / getWidth ( ) ; double sy = ( double ) h / getHeight ( ) ; if ( Math . abs ( sx / sy - 1.0 ) < 0.01 ) { sx = sy ; } AffineTransform usr2dev = AffineTransform . getScaleInstance ( sx , sy ) ; RenderContext newRC = new RenderContext ( usr2dev , hints ) ; return createRendering ( newRC ) ; }
creates a renderedimage instance of this image with width w , and height h in pixels . the rendercontext is built automatically with an appropriate usr2dev transform and an area of interest of the full image . all the rendering hints come from hints passed in . < p > if w = = 0 , it will be taken to equal math . round ( h * ( getwidth ( ) / getheight ( ) ) ) . similarly , if h = = 0 , it will be taken to equal math . round ( w * ( getheight ( ) / getwidth ( ) ) ) . one of w or h must be non - zero or else an illegalargumentexception will be thrown . < p > the created renderedimage may have a property identified by the string hints_observed to indicate which renderinghints were used to create the image . in addition any renderedimages that are obtained via the getsources ( ) method on the created renderedimage may have such a property .
