/* 
 *  call-seq:
 *     zoom(zoom, smooth=false)  ->  Surface
 *
 *  Return a zoomed version of the Surface.
 *
 *  This method takes these arguments:
 *  zoom::    a Numeric factor to scale by in both x and y directions,
 *            or an Array with separate x and y scale factors.
 *  smooth::  whether to anti-alias the new surface.
 *            By the way, if true, the new surface will be 32bit RGBA.
 */
VALUE rbgm_transform_zoom(int argc, VALUE *argv, VALUE self)
{
  SDL_Surface *src, *dst;
  double zoomx, zoomy;
  int smooth = 0;

  if(argc < 1)             /* smooth is optional, so only 1 required*/
    rb_raise(rb_eArgError,"wrong number of arguments (%d for 1)",argc);
  Data_Get_Struct(self,SDL_Surface,src);

  if(TYPE(argv[0])==T_ARRAY)
  {
    zoomx = NUM2DBL(rb_ary_entry(argv[0],0));
    zoomy = NUM2DBL(rb_ary_entry(argv[0],1));
  }
  else if(FIXNUM_P(argv[0]) || TYPE(argv[0])==T_FLOAT)
  {
    zoomx = NUM2DBL(argv[0]);
    zoomy = zoomx;
  }
  else
    rb_raise(rb_eArgError,"wrong zoom factor type (expected Array or Numeric)");

  if(argc > 1)
    smooth = argv[1];

  dst = zoomSurface(src,zoomx,zoomy,smooth);
  if(dst == NULL)
    rb_raise(eSDLError,"Could not rotozoom surface: %s",SDL_GetError());
  return Data_Wrap_Struct(cSurface,0,SDL_FreeSurface,dst);
}