Image-Scale

 view release on metacpan or  search on metacpan

Scale.xs  view on Meta::CPAN

#ifdef _MSC_VER
#define NO_XSLOCKS // Needed to avoid PerlProc_setjmp/PerlProc_longjmp unresolved symbols
#endif

// On Debian, pngconf.h might complain about setjmp.h being loaded before PNG
// so we have to load png.h first
#ifdef HAVE_PNG
#include <png.h>
#endif

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"

#include "common.c"
#include "image.c"

MODULE = Image::Scale		PACKAGE = Image::Scale

PROTOTYPES: ENABLE

void
__init(HV *self)
PPCODE:
{
  SV *pv = NEWSV(0, sizeof(image));
  image *im = (image *)SvPVX(pv);

  SvPOK_only(pv);

  if ( !image_init(self, im) ) {
    // Return undef on any errors during header reading
    SvREFCNT_dec(pv);
    XSRETURN_UNDEF;
  }

  XPUSHs( sv_2mortal( sv_bless(
    newRV_noinc(pv),
    gv_stashpv("Image::Scale::XS", 1)
  ) ) );
}

int
width(HV *self)
CODE:
{
  image *im = (image *)SvPVX(SvRV(*(my_hv_fetch(self, "_image"))));

  RETVAL = im->width;
}
OUTPUT:
  RETVAL

int
height(HV *self)
CODE:
{
  image *im = (image *)SvPVX(SvRV(*(my_hv_fetch(self, "_image"))));

  RETVAL = im->height;
}
OUTPUT:
  RETVAL

int
resized_width(HV *self)
CODE:
{
  image *im = (image *)SvPVX(SvRV(*(my_hv_fetch(self, "_image"))));

  RETVAL = im->target_width;
}
OUTPUT:
  RETVAL

int
resized_height(HV *self)
CODE:
{
  image *im = (image *)SvPVX(SvRV(*(my_hv_fetch(self, "_image"))));

  RETVAL = im->target_height;
}
OUTPUT:



( run in 1.279 second using v1.01-cache-2.11-cpan-71847e10f99 )