Bug in Image.Image->bitscale()?

larcky <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
Hi

Using Pike 8.0 (release 182) I noticed the Image.Image->bitscale() method
doesn't work as per the  documentation
<http://pike.lysator.liu.se/generated/manual/modref/ex/predef_3A_3A/Image/Image/bitscale.html> 
.
This says if you give it two ints for the new image size (xsize and ysize)
and one of them is 0, it'll preserve the aspect ratio of the original image. 
Actually it just sets that 0 to a 1.  I kludged a fix for my own use by
changing src/modules/Image/image.c:

FROM
  if( newx < 1 ) newx = 1;
  if( newy < 1 ) newy = 1;

TO:
  if( newx < 1 )
  {
      newx = 1.0 * newy / oldy * oldx;
      newx = MAXIMUM(1, newx);
  }
  if( newy < 1 ) 
  {
      newy = 1.0 * newx / oldx * oldy;
      newy = MAXIMUM(1, newy);
  } 

Thanks.




--
View this message in context: http://pike.1058338.n5.nabble.com/Bug-in-Image-Image-bitscale-tp5712878.html
Sent from the Pike - User mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.