/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3u-20010217-1422 (Alpha 5)
 * 
 * This file is not intended to be easily readable and contains a number of 
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG 
 * interface file instead. 
 * ----------------------------------------------------------------------------- */

/* Implementation : RUBY */

#define SWIGRUBY
/***********************************************************************
 * common.swg
 *
 *     This file contains generic SWIG runtime support for pointer
 *     type checking as well as a few commonly used macros to control
 *     external linkage.
 *
 * Author : David Beazley (beazley@cs.uchicago.edu)
 *
 * Copyright (c) 1999-2000, The University of Chicago
 * 
 * This file may be freely redistributed without license or fee provided
 * this copyright message remains intact.
 ************************************************************************/

#include <string.h>

#if defined(_WIN32) || defined(__WIN32__)
#       if defined(_MSC_VER)
#               if defined(STATIC_LINKED)
#                       define SWIGEXPORT(a) a
#               else
#                       define SWIGEXPORT(a) __declspec(dllexport) a
#               endif
#       else
#               if defined(__BORLANDC__)
#                       define SWIGEXPORT(a) a _export
#               else
#                       define SWIGEXPORT(a) a
#       endif
#endif
#else
#       define SWIGEXPORT(a) a
#endif

#ifdef SWIG_GLOBAL
#define SWIGRUNTIME(a) SWIGEXPORT(a)
#else
#define SWIGRUNTIME(a) static a
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef struct swig_type_info {
  char  *name;                 
  void *(*converter)(void *);
  char  *str;
  struct swig_type_info  *next;
  struct swig_type_info  *prev;
} swig_type_info;

#ifdef SWIG_NOINCLUDE
SWIGEXPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
SWIGEXPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
SWIGEXPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
#else

static swig_type_info *swig_type_list = 0;

/* Register a type mapping with the type-checking */
SWIGRUNTIME(swig_type_info *)
SWIG_TypeRegister(swig_type_info *ti)
{
  swig_type_info *tc, *head, *ret, *next;
  /* Check to see if this type has already been registered */
  tc = swig_type_list;
  while (tc) {
    if (strcmp(tc->name, ti->name) == 0) {
      /* Already exists in the table.  Just add additional types to the list */
      head = tc;
      next = tc->next;
      goto l1;
    }
    tc = tc->prev;
  }
  head = ti;
  next = 0;

  /* Place in list */
  ti->prev = swig_type_list;
  swig_type_list = ti;

  /* Build linked lists */
 l1:
  ret = head;
  tc = ti + 1;
  /* Patch up the rest of the links */
  while (tc->name) {
    head->next = tc;
    tc->prev = head;
    head = tc;
    tc++;
  }
  head->next = next;
  return ret;
}

/* Check the typename */
SWIGRUNTIME(swig_type_info *) 
SWIG_TypeCheck(char *c, swig_type_info *ty)
{
  swig_type_info *s;
  if (!ty) return 0;        /* Void pointer */
  s = ty->next;             /* First element always just a name */
  while (s) {
    if (strcmp(s->name,c) == 0) {
      if (s == ty->next) return s;
      /* Move s to the top of the linked list */
      s->prev->next = s->next;
      if (s->next) {
	s->next->prev = s->prev;
      }
      /* Insert s as second element in the list */
      s->next = ty->next;
      if (ty->next) ty->next->prev = s;
      ty->next = s;
      return s;
    }
    s = s->next;
  }
  return 0;
}

/* Cast a pointer (needed for C++ inheritance */
SWIGRUNTIME(void *) 
SWIG_TypeCast(swig_type_info *ty, void *ptr) 
{
  if ((!ty) || (!ty->converter)) return ptr;
  return (*ty->converter)(ptr);
}

/* Search for a swig_type_info structure */
SWIGRUNTIME(void *)
SWIG_TypeQuery(const char *name) {
  swig_type_info *ty = swig_type_list;
  while (ty) {
    if (ty->str && (strcmp(name,ty->str) == 0)) return ty;
    if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
    ty = ty->prev;
  }
  return 0;
}

#endif

#ifdef __cplusplus
}
#endif



/* ruby.swg */
#include "ruby.h"

#define NUM2USHRT(n) NUM2UINT(n)
#define NUM2SHRT(n) (\
    (SHRT_MIN <= NUM2INT(n) && NUM2INT(n) <= SHRT_MAX)\
    ? (short)NUM2INT(n)\
    : (rb_raise(rb_eArgError, "integer %d out of range of `short'",\
               NUM2INT(n)), (short)0)\
)

#ifdef __cplusplus
# define VALUEFUNC(f) ((VALUE (*)(...))f)
# define VOIDFUNC(f) ((void (*)(...))f)
#else
# define VALUEFUNC(f) (f)
# define VOIDFUNC(f) (f)
#endif

/* rubydef.swg */
#ifdef __cplusplus
extern "C" {
#endif


static VALUE _mSWIG = Qnil;
static VALUE _cSWIG_Pointer = Qnil;

/* Define ruby class for C type */
SWIGRUNTIME(void)
SWIG_define_class(swig_type_info *type)
{
    VALUE klass;
    char *klass_name = ALLOCA_N(char, 4 + strlen(type->name) + 1);

    sprintf(klass_name, "TYPE%s", type->name);
    if (NIL_P(_cSWIG_Pointer)) {
	_cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
	rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
    }
    klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
}

/* Create a new pointer object */
SWIGRUNTIME(VALUE)
SWIG_NewPointerObj(void *ptr, swig_type_info *type)
{
    char *klass_name;
    VALUE klass;

    if (!ptr)
	return Qnil;

    klass_name = ALLOCA_N(char, 4 + strlen(type->name) + 1);
    sprintf(klass_name, "TYPE%s", type->name);
    klass = rb_const_get(_mSWIG, rb_intern(klass_name));
    return Data_Wrap_Struct(klass, 0, 0, ptr);
}

/* Get type mangle from class name */
SWIGRUNTIME(char *)
SWIG_MangleStr(VALUE obj)
{
  char *c;

  if (!rb_obj_is_kind_of(obj, _cSWIG_Pointer))
    return 0;

  c = rb_class2name(rb_class_of(obj));
  c += strlen(c);
  while (*(--c) != ':');
  /* skip ":TYPE" */
  c += 5;
  return c;
}

/* Convert a pointer value */
SWIGRUNTIME(void *)
SWIG_ConvertPtr(VALUE obj, swig_type_info *ty)
{
  char *c;
  void *ptr;
  swig_type_info *tc;

  if ((c = SWIG_MangleStr(obj)) == NULL)
    rb_raise(rb_eTypeError, "Expected %s", ty->str);	
  Data_Get_Struct(obj, void, ptr);
  if (ty) {
    tc = SWIG_TypeCheck(c, ty);
    if (!tc) rb_raise(rb_eTypeError, "Expected %s", ty->str);
    ptr = SWIG_TypeCast(tc, ptr);
  }
  return ptr;
}

/* Check convert */
SWIGRUNTIME(int)
SWIG_CheckConvert(VALUE obj, swig_type_info *ty)
{
  char *c = SWIG_MangleStr(obj);
  if (!c)
    return 0;
  return SWIG_TypeCheck(c,ty) != 0;
}

#ifdef __cplusplus
}
#endif

#define SWIG_init    Init_panda
#define SWIG_name    "Panda"

static VALUE mPanda;



/*#include <panda/objects.h>*/
#include <panda/constants.h>
#include <panda/functions.h>


// constants.h
// The text drawing modes (p 343 v 1.3)
enum {
  NORMAL = 0,
  OUTLINE,
  FILLEDOUTLINE,
  INVISIBLE,
  FILLEDCLIPPED,
  STROKEDCLIPPED,
  FILLEDSTROKEDCLIPPED,
  CLIPPED
};

// The line cap styles (p 139 v 1.3 II)
enum {
  LINECAP_BUTT = 0,
  LINECAP_ROUND,
  LINECAP_PROJECTEDSQUARE,
  LINECAP_MAX                              // Not in the spec!
};

// The line join styles (p 140 v 1.3 II)
enum {
  LINEJOIN_MITER = 0,
  LINEJOIN_ROUND,
  LINEJOIN_BEVEL,
  LINEJOIN_MAX                             // Not in the spec!
};

// The image types supported
enum {
  TIFF = 0,
  JPEG,
  PNG
};

typedef panda_pdf PDF;
typedef panda_page Page;

static panda_pdf *opened_pdf;
static int        opened_pdf_flag = 0;

static VALUE cPage;
static void free_Page(Page *);
#define Wrap_Page(klass, ptr) (\
    (ptr) ? Data_Wrap_Struct(klass, 0, free_Page, ptr) : Qnil )
#define Get_Page(val, ptr) {\
    if (NIL_P(val)) ptr = NULL;\
    else {\
        if (!rb_obj_is_kind_of(val, cPage))\
            rb_raise(rb_eTypeError, "wrong argument type (expected Page)");\
        Data_Get_Struct(val, Page, ptr);\
        if (!ptr) rb_raise(rb_eRuntimeError, "This Page already released");\
    }\
}

static VALUE cPDF;
static void free_PDF(PDF *);
#define Wrap_PDF(klass, ptr) (\
    (ptr) ? Data_Wrap_Struct(klass, 0, free_PDF, ptr) : Qnil )
#define Get_PDF(val, ptr) {\
    if (NIL_P(val)) ptr = NULL;\
    else {\
        if (!rb_obj_is_kind_of(val, cPDF))\
            rb_raise(rb_eTypeError, "wrong argument type (expected PDF)");\
        Data_Get_Struct(val, PDF, ptr);\
        if (!ptr) rb_raise(rb_eRuntimeError, "This PDF already released");\
    }\
}

/* -------- TYPES TABLE (BEGIN) -------- */

static swig_type_info *swig_types[1];

/* -------- TYPES TABLE (END) -------- */

static VALUE
_wrap_Page_height_get(VALUE self) {
    Page *arg0 ;
    int result ;
    VALUE vresult = Qnil;
    
    Get_Page(self, arg0);
    result = (int ) (arg0->height);
    vresult = INT2NUM(result);
    return vresult;
}


static VALUE
_wrap_Page_width_get(VALUE self) {
    Page *arg0 ;
    int result ;
    VALUE vresult = Qnil;
    
    Get_Page(self, arg0);
    result = (int ) (arg0->width);
    vresult = INT2NUM(result);
    return vresult;
}


Page * new_Page(PDF *output,char *pageSize) {
    {
        return panda_newpage(output, pageSize);
    }
}


static VALUE
_wrap_new_Page(VALUE self, VALUE varg0, VALUE varg1) {
    PDF *arg0 ;
    char *arg1 ;
    Page *result ;
    VALUE vresult = Qnil;
    
    Get_PDF(varg0, arg0);
    arg1 = STR2CSTR(varg1);
    result = (Page *)new_Page(arg0,arg1);
    vresult = Wrap_Page(self, result);
    return vresult;
}


void  delete_Page(Page *self) {
    {
        
    }
}


static void
free_Page(Page *arg0) {
    delete_Page(arg0);
}
void  Page_setlinestart(Page *self,int x,int y) {
    {
        panda_setlinestart(self, x, y);
    }
}


static VALUE
_wrap_Page_setlinestart(VALUE self, VALUE varg1, VALUE varg2) {
    Page *arg0 ;
    int arg1 ;
    int arg2 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    arg2 = NUM2INT(varg2);
    Page_setlinestart(arg0,arg1,arg2);
    return Qnil;
}


void  Page_addlinesegment(Page *self,int x,int y) {
    {
        panda_addlinesegment(self, x, y);
    }
}


static VALUE
_wrap_Page_addlinesegment(VALUE self, VALUE varg1, VALUE varg2) {
    Page *arg0 ;
    int arg1 ;
    int arg2 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    arg2 = NUM2INT(varg2);
    Page_addlinesegment(arg0,arg1,arg2);
    return Qnil;
}


void  Page_addcubiccurvesegment(Page *self,int x,int y,int cx1,int cy1,int cx2,int cy2) {
    {
        panda_addcubiccurvesegment(self, x, y, cx1, cy1, cx2, cy2);
    }
}


static VALUE
_wrap_Page_addcubiccurvesegment(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3, VALUE varg4, VALUE varg5, VALUE varg6) {
    Page *arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    int arg5 ;
    int arg6 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    arg4 = NUM2INT(varg4);
    arg5 = NUM2INT(varg5);
    arg6 = NUM2INT(varg6);
    Page_addcubiccurvesegment(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
    return Qnil;
}


void  Page_addquadraticcurvesegmentone(Page *self,int x,int y,int cx1,int cy1) {
    {
        panda_addquadraticcurvesegmentone(self, x, y, cx1, cy1);
    }
}


static VALUE
_wrap_Page_addquadraticcurvesegmentone(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3, VALUE varg4) {
    Page *arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    arg4 = NUM2INT(varg4);
    Page_addquadraticcurvesegmentone(arg0,arg1,arg2,arg3,arg4);
    return Qnil;
}


void  Page_addquadraticcurvesegmenttwo(Page *self,int x,int y,int cx1,int cy1) {
    {
        panda_addquadraticcurvesegmenttwo(self, x, y, cx1, cy1);
    }
}


static VALUE
_wrap_Page_addquadraticcurvesegmenttwo(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3, VALUE varg4) {
    Page *arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    arg4 = NUM2INT(varg4);
    Page_addquadraticcurvesegmenttwo(arg0,arg1,arg2,arg3,arg4);
    return Qnil;
}


void  Page_closeline(Page *self) {
    {
        panda_closeline(self);
    }
}


static VALUE
_wrap_Page_closeline(VALUE self) {
    Page *arg0 ;
    
    Get_Page(self, arg0);
    Page_closeline(arg0);
    return Qnil;
}


void  Page_rectangle(Page *self,int top,int left,int bottom,int right) {
    {
        panda_rectangle(self, top, left, bottom, right);
    }
}


static VALUE
_wrap_Page_rectangle(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3, VALUE varg4) {
    Page *arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    arg4 = NUM2INT(varg4);
    Page_rectangle(arg0,arg1,arg2,arg3,arg4);
    return Qnil;
}


void  Page_endline(Page *self) {
    {
        panda_endline(self);
    }
}


static VALUE
_wrap_Page_endline(VALUE self) {
    Page *arg0 ;
    
    Get_Page(self, arg0);
    Page_endline(arg0);
    return Qnil;
}


void  Page_strokeline(Page *self) {
    {
        panda_strokeline(self);
    }
}


static VALUE
_wrap_Page_strokeline(VALUE self) {
    Page *arg0 ;
    
    Get_Page(self, arg0);
    Page_strokeline(arg0);
    return Qnil;
}


void  Page_fillline(Page *self) {
    {
        panda_fillline(self);
    }
}


static VALUE
_wrap_Page_fillline(VALUE self) {
    Page *arg0 ;
    
    Get_Page(self, arg0);
    Page_fillline(arg0);
    return Qnil;
}


void  Page_setlinewidth(Page *self,int width) {
    {
        panda_setlinewidth(self, width);
    }
}


static VALUE
_wrap_Page_setlinewidth(VALUE self, VALUE varg1) {
    Page *arg0 ;
    int arg1 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    Page_setlinewidth(arg0,arg1);
    return Qnil;
}


void  Page_setlinecap(Page *self,int cap) {
    {
        panda_setlinecap(self, cap);
    }
}


static VALUE
_wrap_Page_setlinecap(VALUE self, VALUE varg1) {
    Page *arg0 ;
    int arg1 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    Page_setlinecap(arg0,arg1);
    return Qnil;
}


void  Page_setlinejoin(Page *self,int join) {
    {
        panda_setlinejoin(self, join);
    }
}


static VALUE
_wrap_Page_setlinejoin(VALUE self, VALUE varg1) {
    Page *arg0 ;
    int arg1 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    Page_setlinejoin(arg0,arg1);
    return Qnil;
}


void  Page_setlinedash(Page *self,int on,int off,int phase) {
    {
        panda_setlinedash(self, on, off, phase);
    }
}


static VALUE
_wrap_Page_setlinedash(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3) {
    Page *arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    Page_setlinedash(arg0,arg1,arg2,arg3);
    return Qnil;
}


void  Page_setfillcolor(Page *self,int red,int green,int blue) {
    {
        panda_setfillcolor(self, red, green, blue);
    }
}


static VALUE
_wrap_Page_setfillcolor(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3) {
    Page *arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    Page_setfillcolor(arg0,arg1,arg2,arg3);
    return Qnil;
}


void  Page_setlinecolor(Page *self,int red,int green,int blue) {
    {
        panda_setlinecolor(self, red, green, blue);
    }
}


static VALUE
_wrap_Page_setlinecolor(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3) {
    Page *arg0 ;
    int arg1 ;
    int arg2 ;
    int arg3 ;
    
    Get_Page(self, arg0);
    arg1 = NUM2INT(varg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    Page_setlinecolor(arg0,arg1,arg2,arg3);
    return Qnil;
}


static VALUE
_wrap_PDF_byteOffset_get(VALUE self) {
    PDF *arg0 ;
    unsigned long result ;
    VALUE vresult = Qnil;
    
    Get_PDF(self, arg0);
    result = (unsigned long ) (arg0->byteOffset);
    vresult = UINT2NUM(result);
    return vresult;
}


static VALUE
_wrap_PDF_xrefOffset_get(VALUE self) {
    PDF *arg0 ;
    unsigned long result ;
    VALUE vresult = Qnil;
    
    Get_PDF(self, arg0);
    result = (unsigned long ) (arg0->xrefOffset);
    vresult = UINT2NUM(result);
    return vresult;
}


PDF * new_PDF(char *filename,char *mode) {
    {
        if (opened_pdf_flag == 1) {
            panda_close (opened_pdf);
        }
        opened_pdf_flag = 1;
        return (opened_pdf = panda_open_actual (filename, mode, panda_false));
    }
}


static VALUE
_wrap_new_PDF(VALUE self, VALUE varg0, VALUE varg1) {
    char *arg0 ;
    char *arg1 ;
    PDF *result ;
    VALUE vresult = Qnil;
    
    arg0 = STR2CSTR(varg0);
    arg1 = STR2CSTR(varg1);
    result = (PDF *)new_PDF(arg0,arg1);
    vresult = Wrap_PDF(self, result);
    return vresult;
}


void  delete_PDF(PDF *self) {
    {
        if (self && opened_pdf_flag == 1 && opened_pdf == self) panda_close (self);
    }
}


static void
free_PDF(PDF *arg0) {
    delete_PDF(arg0);
}
void  PDF_close(PDF *self) {
    {
        opened_pdf_flag = 0;
        panda_close (self);
    }
}


static VALUE
_wrap_PDF_close(VALUE self) {
    PDF *arg0 ;
    
    Get_PDF(self, arg0);
    PDF_close(arg0);
    return Qnil;
}


void  PDF_imagebox(PDF *self,Page *target,int top,int left,int bottom,int right,char *filename,int type) {
    {
        panda_imagebox (self, target, top, left, bottom, right, filename, type);
    }
}


static VALUE
_wrap_PDF_imagebox(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3, VALUE varg4, VALUE varg5, VALUE varg6, VALUE varg7) {
    PDF *arg0 ;
    Page *arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    int arg5 ;
    char *arg6 ;
    int arg7 ;
    
    Get_PDF(self, arg0);
    Get_Page(varg1, arg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    arg4 = NUM2INT(varg4);
    arg5 = NUM2INT(varg5);
    arg6 = STR2CSTR(varg6);
    arg7 = NUM2INT(varg7);
    PDF_imagebox(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    return Qnil;
}


void  PDF_imageboxrot(PDF *self,Page *target,int top,int left,int bottom,int right,double angle,char *filename,int type) {
    {
        panda_imageboxrot (self, target, top, left, bottom, right, angle, filename, type);
    }
}


static VALUE
_wrap_PDF_imageboxrot(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3, VALUE varg4, VALUE varg5, VALUE varg6, VALUE varg7, VALUE varg8) {
    PDF *arg0 ;
    Page *arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    int arg5 ;
    double arg6 ;
    char *arg7 ;
    int arg8 ;
    
    Get_PDF(self, arg0);
    Get_Page(varg1, arg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    arg4 = NUM2INT(varg4);
    arg5 = NUM2INT(varg5);
    arg6 = NUM2DBL(varg6);
    arg7 = STR2CSTR(varg7);
    arg8 = NUM2INT(varg8);
    PDF_imageboxrot(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
    return Qnil;
}


void  PDF_setauthor(PDF *self,char *author) {
    {
        panda_setauthor (self, author);
    }
}


static VALUE
_wrap_PDF_setauthor(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    char *arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = STR2CSTR(varg1);
    PDF_setauthor(arg0,arg1);
    return Qnil;
}


void  PDF_setcreator(PDF *self,char *creator) {
    {
        panda_setcreator (self, creator);
    }
}


static VALUE
_wrap_PDF_setcreator(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    char *arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = STR2CSTR(varg1);
    PDF_setcreator(arg0,arg1);
    return Qnil;
}


void  PDF_settitle(PDF *self,char *title) {
    {
        panda_settitle (self, title);
    }
}


static VALUE
_wrap_PDF_settitle(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    char *arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = STR2CSTR(varg1);
    PDF_settitle(arg0,arg1);
    return Qnil;
}


void  PDF_setsubject(PDF *self,char *subject) {
    {
        panda_setsubject (self, subject);
    }
}


static VALUE
_wrap_PDF_setsubject(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    char *arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = STR2CSTR(varg1);
    PDF_setsubject(arg0,arg1);
    return Qnil;
}


void  PDF_setkeywords(PDF *self,char *keywords) {
    {
        panda_setkeywords (self, keywords);
    }
}


static VALUE
_wrap_PDF_setkeywords(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    char *arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = STR2CSTR(varg1);
    PDF_setkeywords(arg0,arg1);
    return Qnil;
}


void  PDF_setfont(PDF *self,char *fontname,int type,char *encoding) {
    {
        char *tempPtr;
        
        tempPtr = panda_createfont (self, fontname, type, encoding);
        panda_setfont (self, tempPtr);
        free(tempPtr);
    }
}


static VALUE
_wrap_PDF_setfont(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3) {
    PDF *arg0 ;
    char *arg1 ;
    int arg2 ;
    char *arg3 ;
    
    Get_PDF(self, arg0);
    arg1 = STR2CSTR(varg1);
    arg2 = NUM2INT(varg2);
    arg3 = STR2CSTR(varg3);
    PDF_setfont(arg0,arg1,arg2,arg3);
    return Qnil;
}


void  PDF_setfontsize(PDF *self,int size) {
    {
        panda_setfontsize (self, size);
    }
}


static VALUE
_wrap_PDF_setfontsize(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    int arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = NUM2INT(varg1);
    PDF_setfontsize(arg0,arg1);
    return Qnil;
}


void  PDF_setfontmode(PDF *self,int mode) {
    {
        panda_setfontmode (self, mode);
    }
}


static VALUE
_wrap_PDF_setfontmode(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    int arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = NUM2INT(varg1);
    PDF_setfontmode(arg0,arg1);
    return Qnil;
}


void  PDF_setcharacterspacing(PDF *self,double amount) {
    {
        panda_setcharacterspacing (self, amount);
    }
}


static VALUE
_wrap_PDF_setcharacterspacing(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    double arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = NUM2DBL(varg1);
    PDF_setcharacterspacing(arg0,arg1);
    return Qnil;
}


void  PDF_setwordspacing(PDF *self,double amount) {
    {
        panda_setwordspacing (self, amount);
    }
}


static VALUE
_wrap_PDF_setwordspacing(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    double arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = NUM2DBL(varg1);
    PDF_setwordspacing(arg0,arg1);
    return Qnil;
}


void  PDF_sethorizontalscaling(PDF *self,double scaling) {
    {
        panda_sethorizontalscaling (self, scaling);
    }
}


static VALUE
_wrap_PDF_sethorizontalscaling(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    double arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = NUM2DBL(varg1);
    PDF_sethorizontalscaling(arg0,arg1);
    return Qnil;
}


void  PDF_setleading(PDF *self,double leading) {
    {
        panda_setleading (self, leading);
    }
}


static VALUE
_wrap_PDF_setleading(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    double arg1 ;
    
    Get_PDF(self, arg0);
    arg1 = NUM2DBL(varg1);
    PDF_setleading(arg0,arg1);
    return Qnil;
}


Page * PDF_newtemplate(PDF *self,char *pageSize) {
    {
        return panda_newtemplate (self, pageSize);
    }
}


static VALUE
_wrap_PDF_newtemplate(VALUE self, VALUE varg1) {
    PDF *arg0 ;
    char *arg1 ;
    Page *result ;
    VALUE vresult = Qnil;
    
    Get_PDF(self, arg0);
    arg1 = STR2CSTR(varg1);
    result = (Page *)PDF_newtemplate(arg0,arg1);
    vresult = Wrap_Page(cPage, result);
    return vresult;
}


void  PDF_applytemplate(PDF *self,Page *target,Page *template) {
    {
        panda_applytemplate(self, target, template);
    }
}


static VALUE
_wrap_PDF_applytemplate(VALUE self, VALUE varg1, VALUE varg2) {
    PDF *arg0 ;
    Page *arg1 ;
    Page *arg2 ;
    
    Get_PDF(self, arg0);
    Get_Page(varg1, arg1);
    Get_Page(varg2, arg2);
    PDF_applytemplate(arg0,arg1,arg2);
    return Qnil;
}


void  PDF_textbox(PDF *self,Page *thisPage,int top,int left,int bottom,int right,char *text) {
    {
        panda_textbox (self, thisPage, top, left, bottom, right, text);
    }
}


static VALUE
_wrap_PDF_textbox(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3, VALUE varg4, VALUE varg5, VALUE varg6) {
    PDF *arg0 ;
    Page *arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    int arg5 ;
    char *arg6 ;
    
    Get_PDF(self, arg0);
    Get_Page(varg1, arg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    arg4 = NUM2INT(varg4);
    arg5 = NUM2INT(varg5);
    arg6 = STR2CSTR(varg6);
    PDF_textbox(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
    return Qnil;
}


void  PDF_textboxrot(PDF *self,Page *thisPage,int top,int left,int bottom,int right,double angle,char *text) {
    {
        panda_textboxrot (self, thisPage, top, left, bottom, right, angle, text);
    }
}


static VALUE
_wrap_PDF_textboxrot(VALUE self, VALUE varg1, VALUE varg2, VALUE varg3, VALUE varg4, VALUE varg5, VALUE varg6, VALUE varg7) {
    PDF *arg0 ;
    Page *arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    int arg5 ;
    double arg6 ;
    char *arg7 ;
    
    Get_PDF(self, arg0);
    Get_Page(varg1, arg1);
    arg2 = NUM2INT(varg2);
    arg3 = NUM2INT(varg3);
    arg4 = NUM2INT(varg4);
    arg5 = NUM2INT(varg5);
    arg6 = NUM2DBL(varg6);
    arg7 = STR2CSTR(varg7);
    PDF_textboxrot(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    return Qnil;
}



/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */


static swig_type_info *swig_types_initial[] = {
0
};


/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */


#ifdef __cplusplus
extern "C"
#endif
void Init_panda(void) {
    int i;
    
    mPanda = rb_define_module("Panda");
    _mSWIG = rb_define_module_under(mPanda, "SWIG");
    
    for (i = 0; swig_types_initial[i]; i++) {
        swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
        SWIG_define_class(swig_types[i]);
    }
    
    rb_define_const(mPanda, "A4", rb_str_new2("[0 0 594 841]"));
    rb_define_const(mPanda, "USLETTER", rb_str_new2("[0 0 612 792]"));
    rb_define_const(mPanda, "NORMAL", INT2NUM(NORMAL));
    rb_define_const(mPanda, "OUTLINE", INT2NUM(OUTLINE));
    rb_define_const(mPanda, "FILLEDOUTLINE", INT2NUM(FILLEDOUTLINE));
    rb_define_const(mPanda, "INVISIBLE", INT2NUM(INVISIBLE));
    rb_define_const(mPanda, "FILLEDCLIPPED", INT2NUM(FILLEDCLIPPED));
    rb_define_const(mPanda, "STROKEDCLIPPED", INT2NUM(STROKEDCLIPPED));
    rb_define_const(mPanda, "FILLEDSTROKEDCLIPPED", INT2NUM(FILLEDSTROKEDCLIPPED));
    rb_define_const(mPanda, "CLIPPED", INT2NUM(CLIPPED));
    rb_define_const(mPanda, "LINECAP_BUTT", INT2NUM(LINECAP_BUTT));
    rb_define_const(mPanda, "LINECAP_ROUND", INT2NUM(LINECAP_ROUND));
    rb_define_const(mPanda, "LINECAP_PROJECTEDSQUARE", INT2NUM(LINECAP_PROJECTEDSQUARE));
    rb_define_const(mPanda, "LINECAP_MAX", INT2NUM(LINECAP_MAX));
    rb_define_const(mPanda, "LINEJOIN_MITER", INT2NUM(LINEJOIN_MITER));
    rb_define_const(mPanda, "LINEJOIN_ROUND", INT2NUM(LINEJOIN_ROUND));
    rb_define_const(mPanda, "LINEJOIN_BEVEL", INT2NUM(LINEJOIN_BEVEL));
    rb_define_const(mPanda, "LINEJOIN_MAX", INT2NUM(LINEJOIN_MAX));
    rb_define_const(mPanda, "TIFF", INT2NUM(TIFF));
    rb_define_const(mPanda, "JPEG", INT2NUM(JPEG));
    rb_define_const(mPanda, "PNG", INT2NUM(PNG));
    
    cPage = rb_define_class_under(mPanda, "Page", rb_cObject);
    rb_define_singleton_method(cPage, "new", _wrap_new_Page, 2);
    rb_define_method(cPage, "height", _wrap_Page_height_get, 0);
    rb_define_method(cPage, "width", _wrap_Page_width_get, 0);
    rb_define_method(cPage, "setlinestart", _wrap_Page_setlinestart, 2);
    rb_define_method(cPage, "addlinesegment", _wrap_Page_addlinesegment, 2);
    rb_define_method(cPage, "addcubiccurvesegment", _wrap_Page_addcubiccurvesegment, 6);
    rb_define_method(cPage, "addquadraticcurvesegmentone", _wrap_Page_addquadraticcurvesegmentone, 4);
    rb_define_method(cPage, "addquadraticcurvesegmenttwo", _wrap_Page_addquadraticcurvesegmenttwo, 4);
    rb_define_method(cPage, "closeline", _wrap_Page_closeline, 0);
    rb_define_method(cPage, "rectangle", _wrap_Page_rectangle, 4);
    rb_define_method(cPage, "endline", _wrap_Page_endline, 0);
    rb_define_method(cPage, "strokeline", _wrap_Page_strokeline, 0);
    rb_define_method(cPage, "fillline", _wrap_Page_fillline, 0);
    rb_define_method(cPage, "setlinewidth", _wrap_Page_setlinewidth, 1);
    rb_define_method(cPage, "setlinecap", _wrap_Page_setlinecap, 1);
    rb_define_method(cPage, "setlinejoin", _wrap_Page_setlinejoin, 1);
    rb_define_method(cPage, "setlinedash", _wrap_Page_setlinedash, 3);
    rb_define_method(cPage, "setfillcolor", _wrap_Page_setfillcolor, 3);
    rb_define_method(cPage, "setlinecolor", _wrap_Page_setlinecolor, 3);
    
    cPDF = rb_define_class_under(mPanda, "PDF", rb_cObject);
    rb_define_singleton_method(cPDF, "new", _wrap_new_PDF, 2);
    rb_define_method(cPDF, "byteOffset", _wrap_PDF_byteOffset_get, 0);
    rb_define_method(cPDF, "xrefOffset", _wrap_PDF_xrefOffset_get, 0);
    rb_define_method(cPDF, "close", _wrap_PDF_close, 0);
    rb_define_method(cPDF, "imagebox", _wrap_PDF_imagebox, 7);
    rb_define_method(cPDF, "imageboxrot", _wrap_PDF_imageboxrot, 8);
    rb_define_method(cPDF, "setauthor", _wrap_PDF_setauthor, 1);
    rb_define_method(cPDF, "setcreator", _wrap_PDF_setcreator, 1);
    rb_define_method(cPDF, "settitle", _wrap_PDF_settitle, 1);
    rb_define_method(cPDF, "setsubject", _wrap_PDF_setsubject, 1);
    rb_define_method(cPDF, "setkeywords", _wrap_PDF_setkeywords, 1);
    rb_define_method(cPDF, "setfont", _wrap_PDF_setfont, 3);
    rb_define_method(cPDF, "setfontsize", _wrap_PDF_setfontsize, 1);
    rb_define_method(cPDF, "setfontmode", _wrap_PDF_setfontmode, 1);
    rb_define_method(cPDF, "setcharacterspacing", _wrap_PDF_setcharacterspacing, 1);
    rb_define_method(cPDF, "setwordspacing", _wrap_PDF_setwordspacing, 1);
    rb_define_method(cPDF, "sethorizontalscaling", _wrap_PDF_sethorizontalscaling, 1);
    rb_define_method(cPDF, "setleading", _wrap_PDF_setleading, 1);
    rb_define_method(cPDF, "newtemplate", _wrap_PDF_newtemplate, 1);
    rb_define_method(cPDF, "applytemplate", _wrap_PDF_applytemplate, 2);
    rb_define_method(cPDF, "textbox", _wrap_PDF_textbox, 6);
    rb_define_method(cPDF, "textboxrot", _wrap_PDF_textboxrot, 7);
}

