Scale operator's 'translate' values

View: New views
3 Messages — Rating Filter:   Alert me  

Scale operator's 'translate' values

by dirkbertels :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm having trouble with the scale operator, the scaling goes well but the translation doesn't seem to make a difference.
In my operations chain I have the following operation

 private RenderedImage zoomOperator(RenderedImage source, double zoomFactor)
   {
      if ( source == null ){
         return null;
      }
      ParameterBlock pb = new ParameterBlock();
      pb.addSource(source);
      pb.add((float)zoomFactor);
      pb.add((float)zoomFactor);
      pb.add(100.0f); // X translation
      pb.add(100.0f); // Y translation
      pb.add(new InterpolationNearest());
 
      ImageLayout il = new ImageLayout();
      il.setTileWidth(tileSize);
      il.setTileHeight(tileSize);
      RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il);

      RenderedImage img = JAI.create("scale", pb, hints);

      return img;
   }

whatever values I put for the x- and y-translation makes no difference whatsoever

Re: Scale operator's 'translate' values

by jai-interest-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think it's the same as with the "translate" operator.  Compare  img.getMinX() and img.getMinY() just before and after the "scale" operation. I think what you need is a combination of "translate" and "crop".

Hope this helps,
Helmut
[Message sent by forum member 'helaha' (e288cc@...)]

http://forums.java.net/jive/thread.jspa?messageID=369808

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Scale operator's 'translate' values

by Rafael Santos-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> I think it's the same as with the "translate" operator.  Compare  img.getMinX() and img.getMinY() just before and after the "scale" operation. I think what you need is a combination of "translate" and "crop".
>  
Helmut is right -- please check the "crop" operator example in
https://jaistuff.dev.java.net/operators.html

Rafael


---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...