1 ;;;; cl-devil -- DevIL binding for CL. See README for licensing information.
5 (define-foreign-library il
6 (:unix
(:or
"libIL" "libIL.so.1"))
7 (t (:default
"libIL")))
8 (use-foreign-library il
)
10 (defctype handle
:pointer
)
49 (:colour-index
#x1900
)
56 (:luminance-alpha
#x190A
))
60 (:unsigned-byte
#x1401
)
62 (:unsigned-short
#x1403
)
64 (:unsigned-int
#x1405
)
70 (:invalid-enum
#x0501
)
71 (:out-of-memory
#x0502
)
72 (:format-not-supported
#x0503
)
73 (:internal-error
#x0504
)
74 (:invalid-value
#x0505
)
75 (:illegal-operation
#x0506
)
76 (:illegal-file-value
#x0507
)
77 (:invalid-file-header
#x0508
)
78 (:invalid-param
#x0509
)
79 (:could-not-open-file
#x050A
)
80 (:invalid-extension
#x050B
)
81 (:file-already-exists
#x050C
)
82 (:out-format-same
#x050D
)
83 (:stack-overflow
#x050E
)
84 (:stack-underflow
#x050F
)
85 (:invalid-conversion
#x0510
)
86 (:bad-dimensions
#x0511
)
87 (:file-read-error
#x0512
)
88 (:file-write-error
#x0512
)
89 (:lib-gif-error
#x05E1
)
90 (:lib-jpeg-error
#x05E2
)
91 (:lib-png-error
#x05E3
)
92 (:lib-tiff-error
#x05E4
)
93 (:lib-mng-error
#x05E5
)
94 (:unknown-error
#x05FF
))
96 (defcenum mode
; there are some awfully
97 (:version-num
#x0DE2
) ; non-descript names in
98 (:image-width
#x0DE4
) ; DevIL...
99 (:image-height
#x0DE5
)
100 (:image-depth
#x0DE6
)
101 (:image-size-of-data
#x0DE7
)
103 (:image-bytes-per-pixel
#x0DE8
)
104 (:image-bits-per-pixel
#x0DE9
)
105 (:image-format
#x0DEA
)
107 (:palette-type
#x0DEC
)
108 (:palette-size
#x0DED
)
109 (:palette-bpp
#x0DEE
)
110 (:palette-num-cols
#x0DEF
)
111 (:palette-base-type
#x0DF0
)
113 (:num-mipmaps
#x0DF2
)
115 (:active-image
#x0DF4
)
116 (:active-mipmap
#x0DF5
)
117 (:active-layer
#x0DF6
)
119 (:image-duration
#x0DF8
)
120 (:image-planesize
#x0DF9
)
124 (:image-cubeflags
#x0DFD
)
125 (:image-origin
#x0DFE
)
126 (:image-channels
#x0DFF
)
127 (:use-key-color
#x0635
)
128 (:png-alpha-index
#x0724
))
130 (define-foreign-type pathname-string-type
()
132 (:actual-type
:string
)
133 (:simple-parser pathname-string
))
134 (eval-when (:compile-toplevel
:load-toplevel
)
135 (defmethod expand-to-foreign-dyn (value var body
(type pathname-string-type
))
136 `(with-foreign-string (,var
(if (pathnamep ,value
) (namestring ,value
) ,value
))
139 (defcfun ("ilInit" init
) :void
)
140 (defcfun ("ilShutDown" shutdown
) :void
)
141 (defcfun ("ilGenImages" %gen-images
) :void
(num :int
) (images :pointer
))
142 (defcfun ("ilBindImage" bind-image
) :void
(image :int
))
143 (defcfun ("ilDeleteImages" delete-images
) :void
(num :int
) (images :pointer
))
144 (defcfun ("ilLoadImage" load-image
) :boolean
(file-name pathname-string
))
145 (defcfun ("ilLoad" load
) :boolean
(type image-type
) (file-name pathname-string
))
146 (defcfun ("ilLoadF" load-f
) :boolean
(type image-type
) (file handle
))
147 (defcfun ("ilLoadL" load-l
) :boolean
(type image-type
) (lump :pointer
) (size :uint
))
148 (defcfun ("ilSaveImage" save-image
) :boolean
(file-name pathname-string
))
149 (defcfun ("ilSave" save
) :boolean
(type image-type
) (file-name pathname-string
))
150 (defcfun ("ilSaveF" save-f
) :boolean
(type image-type
) (file handle
))
151 (defcfun ("ilSaveL" save-l
) :boolean
(type image-type
) (lump :pointer
) (size :uint
))
152 (defcfun ("ilTexImage" tex-image
) :boolean
153 (width :uint
) (height :uint
) (depth :uint
) (bpp :uint8
) (format data-format
) (type data-type
) (data :pointer
))
154 (defcfun ("ilGetData" get-data
) :pointer
)
155 (defcfun ("ilCopyPixels" copy-pixels
) :uint
156 (x-offset :uint
) (y-offset :uint
) (z-offset :uint
) (width :uint
) (height :uint
) (depth :uint
) (format data-format
) (type data-type
) (data :pointer
))
157 (defcfun ("ilSetData" set-data
) :pointer
)
158 (defcfun ("ilSetPixels" set-pixels
) :uint
159 (x-offset :uint
) (y-offset :uint
) (z-offset :uint
) (width :uint
) (height :uint
) (depth :uint
) (format data-format
) (type data-type
) (data :pointer
))
160 (defcfun ("ilCopyImage" copy-image
) :boolean
(source :uint
))
161 (defcfun ("ilOverlayImage" overlay-image
) :boolean
(source :uint
) (x-coord :int
) (y-coord :int
) (z-coord :int
))
162 (defcfun ("ilBlit" blit
) :boolean
(source :uint
) (dest-x :int
) (dest-y :int
) (dest-z :int
) (src-x :int
) (src-y :int
) (src-z :int
) (width :uint
) (height :uint
) (depth :uint
))
163 (defcfun ("ilGetError" get-error
) error
)
165 (defcfun ("ilKeyColour" key-color
) :void
(red :float
) (green :float
) (blue :float
) (alpha :float
))
166 (defcfun ("ilGetPalette" get-palette
) :pointer
)
168 (defcfun ("ilGetInteger" get-integer
) :uint
(mode mode
))
169 (defcfun ("ilSetInteger" set-integer
) :void
(mode mode
) (param :int
))
170 (defcfun ("ilEnable" enable
) :boolean
(mode mode
))
171 (defcfun ("ilDisable" disable
) :boolean
(mode mode
))
172 (defcfun ("ilIsEnabled" enabled-p
) :boolean
(mode mode
))
174 (defcfun ("ilConvertImage" convert-image
) :boolean
(format data-format
) (type data-type
))
175 (defcfun ("ilFlipImage" flip-image
) :boolean
)