  SDL_image v1.2.10 CFFI lisp wrapper

(in-package #:lispbuilder-sdl-image-cffi)

(defctype image-return-val-0+1 (:wrapper :int :from-c return-val-0+1))
(defctype image-type (:wrapper :string :to-c convert-image-type))
(defctype free-src :boolean)

(defconstant SDL-IMAGE-MAJOR-VERSION 1)
(defconstant SDL-IMAGE-MINOR-VERSION 2)
(defconstant SDL-IMAGE-PATCH-LEVEL 10)

(defun VERSION (x)
  (with-foreign-slots ((sdl-cffi::major sdl-cffi::minor sdl-cffi::patch) x (:struct sdl-cffi::SDL-version))
    (setf sdl-cffi::major SDL-IMAGE-MAJOR-VERSION
	  sdl-cffi::minor SDL-IMAGE-MINOR-VERSION
	  sdl-cffi::patch SDL-IMAGE-PATCH-LEVEL))
  x)

(cffi:defbitfield init-flags
  (:jpg #x01)
  (:png #x02)
  (:tif #x04))

  This function gets the version of the dynamically linked  library .
;; it should NOT be used to fill a version structure, instead you should
;; use the SDL_IMAGE_VERSION() macro.
  extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void ) ;
(defun image-linked-version ()
    (when (cffi:foreign-symbol-pointer "IMG_Linked_Version" :library 'sdl-image-cffi::sdl-image)
      (cffi:foreign-funcall-pointer (cffi:foreign-symbol-pointer "IMG_Linked_Version" :library 'sdl-cffi::sdl-image)
                                    () (:pointer (:struct sdl-cffi::sdl-version)))))

  Load an image from an SDL data source .
  The ' type ' may be one of : " BMP " , "  " , " PNG " , etc .
  If the image format supports a transparent pixel , SDL will set the
;; colorkey for the surface.  You can enable RLE acceleration on the
;; surface afterwards by calling:
;;   SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops * src , int freesrc , char * type ) ;
(defcfun ("IMG_LoadTyped_RW" IMG-Load-Typed-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops)))
  (freesrc free-src)
  (type image-type))

;; Convenience functions
  extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char * file ) ;
(defcfun ("IMG_Load" IMG-Load-img) (:pointer (:struct sdl-cffi::sdl-surface))
  (file :string))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops * src , int freesrc ) ;
(defcfun ("IMG_Load_RW" IMG-Load-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops)))
  (freesrc free-src))

  extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops * src ) ;
#+latest(defcfun ("IMG_isICO" IMG-is-ICO) image-return-val-0+1
  (src sdl-cffi::SDL-RWops))

  extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops * src ) ;
#+latest(defcfun ("IMG_isCUR" IMG-is-CUR) image-return-val-0+1
  (src sdl-cffi::SDL-RWops))

;; Functions to detect a file type, given a seekable source
  extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops * src ) ;
(defcfun ("IMG_isBMP" IMG-is-BMP) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops * src ) ;
(defcfun ("IMG_isGIF" IMG-is-GIF) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL  * src )
(defcfun ("IMG_isJPG" IMG-is-JPG) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops * src ) ;
(defcfun ("IMG_isLBM" IMG-is-LBM) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops * src ) ;
(defcfun ("IMG_isPCX" IMG-is-PCX) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops * src ) ;
(defcfun ("IMG_isPNG" IMG-is-PNG) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops * src ) ;
(defcfun ("IMG_isPNM" IMG-is-PNM) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops * src ) ;
(defcfun ("IMG_isTIF" IMG-is-TIF) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops * src ) ;
(defcfun ("IMG_isXCF" IMG-is-XCF) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops * src ) ;
(defcfun ("IMG_isXPM" IMG-is-XPM) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops * src ) ;
(defcfun ("IMG_isXV" IMG-is-XV) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

;; Individual loading functions
  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadICO_RW(SDL_RWops * src ) ;
#+latest(defcfun ("IMG_LoadICO_RW" IMG-Load-ICO-RW) sdl-cffi::sdl-surface
  (src sdl-cffi::SDL-RWops))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadCUR_RW(SDL_RWops * src ) ;
#+latest(defcfun ("IMG_LoadCUR_RW" IMG-Load-CUR-RW) sdl-cffi::sdl-surface
  (src sdl-cffi::SDL-RWops))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadBMP_RW" IMG-Load-BMP-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadGIF_RW" IMG-Load-GIF-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadJPG_RW" IMG-Load-JPG-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadLBM_RW" IMG-Load-LBM-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadPCX_RW" IMG-Load-PCX-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadPNG_RW" IMG-Load-PNG-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadPNM_RW" IMG-Load-PNM-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadTGA_RW" IMG-Load-TGA-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadTIF_RW" IMG-Load-TIF-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadXCF_RW" IMG-Load-XCF-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops * src ) ;
(defcfun ("IMG_LoadXPM_RW" IMG-Load-XPM-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops * src ) ; -
(defcfun ("IMG_LoadXV_RW" IMG-Load-XV-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char * *  ) ;
(defcfun ("IMG_ReadXPMFromArray" IMG-Read-XPM-From-Array) (:pointer (:struct sdl-cffi::sdl-surface))
  (char :pointer))

  We 'll use SDL for reporting errors
  # define IMG_SetError 	 SDL_SetError
  # define IMG_GetError 	 SDL_GetError

 it should NOT be used to fill a version structure, instead you should
 use the SDL_IMAGE_VERSION() macro.

 colorkey for the surface.  You can enable RLE acceleration on the
 surface afterwards by calling:
   SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);

 Convenience functions




 Functions to detect a file type, given a seekable source










 Individual loading functions













 -

  SDL_image v1.2.10 CFFI lisp wrapper

(in-package #:lispbuilder-sdl-image-cffi)

(defctype image-return-val-0+1 (:wrapper :int :from-c return-val-0+1))
(defctype image-type (:wrapper :string :to-c convert-image-type))
(defctype free-src :boolean)

(defconstant SDL-IMAGE-MAJOR-VERSION 1)
(defconstant SDL-IMAGE-MINOR-VERSION 2)
(defconstant SDL-IMAGE-PATCH-LEVEL 10)

(defun VERSION (x)
  (with-foreign-slots ((sdl-cffi::major sdl-cffi::minor sdl-cffi::patch) x (:struct sdl-cffi::SDL-version))
    (setf sdl-cffi::major SDL-IMAGE-MAJOR-VERSION
	  sdl-cffi::minor SDL-IMAGE-MINOR-VERSION
	  sdl-cffi::patch SDL-IMAGE-PATCH-LEVEL))
  x)

(cffi:defbitfield init-flags
  (:jpg #x01)
  (:png #x02)
  (:tif #x04))

  This function gets the version of the dynamically linked  library .
(defun image-linked-version ()
    (when (cffi:foreign-symbol-pointer "IMG_Linked_Version" :library 'sdl-image-cffi::sdl-image)
      (cffi:foreign-funcall-pointer (cffi:foreign-symbol-pointer "IMG_Linked_Version" :library 'sdl-cffi::sdl-image)
                                    () (:pointer (:struct sdl-cffi::sdl-version)))))

  Load an image from an SDL data source .
  The ' type ' may be one of : " BMP " , "  " , " PNG " , etc .
  If the image format supports a transparent pixel , SDL will set the
(defcfun ("IMG_LoadTyped_RW" IMG-Load-Typed-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops)))
  (freesrc free-src)
  (type image-type))

(defcfun ("IMG_Load" IMG-Load-img) (:pointer (:struct sdl-cffi::sdl-surface))
  (file :string))

(defcfun ("IMG_Load_RW" IMG-Load-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops)))
  (freesrc free-src))

#+latest(defcfun ("IMG_isICO" IMG-is-ICO) image-return-val-0+1
  (src sdl-cffi::SDL-RWops))

#+latest(defcfun ("IMG_isCUR" IMG-is-CUR) image-return-val-0+1
  (src sdl-cffi::SDL-RWops))

(defcfun ("IMG_isBMP" IMG-is-BMP) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_isGIF" IMG-is-GIF) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

  extern DECLSPEC int SDLCALL  * src )
(defcfun ("IMG_isJPG" IMG-is-JPG) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_isLBM" IMG-is-LBM) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_isPCX" IMG-is-PCX) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_isPNG" IMG-is-PNG) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_isPNM" IMG-is-PNM) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_isTIF" IMG-is-TIF) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_isXCF" IMG-is-XCF) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_isXPM" IMG-is-XPM) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_isXV" IMG-is-XV) image-return-val-0+1
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

#+latest(defcfun ("IMG_LoadICO_RW" IMG-Load-ICO-RW) sdl-cffi::sdl-surface
  (src sdl-cffi::SDL-RWops))

#+latest(defcfun ("IMG_LoadCUR_RW" IMG-Load-CUR-RW) sdl-cffi::sdl-surface
  (src sdl-cffi::SDL-RWops))

(defcfun ("IMG_LoadBMP_RW" IMG-Load-BMP-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadGIF_RW" IMG-Load-GIF-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadJPG_RW" IMG-Load-JPG-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadLBM_RW" IMG-Load-LBM-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadPCX_RW" IMG-Load-PCX-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadPNG_RW" IMG-Load-PNG-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadPNM_RW" IMG-Load-PNM-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadTGA_RW" IMG-Load-TGA-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadTIF_RW" IMG-Load-TIF-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadXCF_RW" IMG-Load-XCF-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadXPM_RW" IMG-Load-XPM-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_LoadXV_RW" IMG-Load-XV-RW) (:pointer (:struct sdl-cffi::sdl-surface))
  (src (:pointer (:struct sdl-cffi::SDL-RWops))))

(defcfun ("IMG_ReadXPMFromArray" IMG-Read-XPM-From-Array) (:pointer (:struct sdl-cffi::sdl-surface))
  (char :pointer))

  We 'll use SDL for reporting errors
  # define IMG_SetError 	 SDL_SetError
  # define IMG_GetError 	 SDL_GetError
