summary refs log tree commit diff stats
path: root/lib/newwrap/sdl/sdl_image.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/newwrap/sdl/sdl_image.nim')
-rw-r--r--lib/newwrap/sdl/sdl_image.nim242
1 files changed, 242 insertions, 0 deletions
diff --git a/lib/newwrap/sdl/sdl_image.nim b/lib/newwrap/sdl/sdl_image.nim
new file mode 100644
index 000000000..621749e32
--- /dev/null
+++ b/lib/newwrap/sdl/sdl_image.nim
@@ -0,0 +1,242 @@
+#
+#  $Id: sdl_image.pas,v 1.14 2007/05/29 21:31:13 savage Exp $
+#  
+#
+#******************************************************************************
+#                                                                              
+#       Borland Delphi SDL_Image - An example image loading library for use    
+#                                  with SDL                                    
+#       Conversion of the Simple DirectMedia Layer Image Headers               
+#                                                                              
+# Portions created by Sam Lantinga <slouken@devolution.com> are                
+# Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga                     
+# 5635-34 Springhouse Dr.                                                      
+# Pleasanton, CA 94588 (USA)                                                   
+#                                                                              
+# All Rights Reserved.                                                         
+#                                                                              
+# The original files are : SDL_image.h                                         
+#                                                                              
+# The initial developer of this Pascal code was :                              
+# Matthias Thoma <ma.thoma@gmx.de>                                             
+#                                                                              
+# Portions created by Matthias Thoma are                                       
+# Copyright (C) 2000 - 2001 Matthias Thoma.                                    
+#                                                                              
+#                                                                              
+# Contributor(s)                                                               
+# --------------                                                               
+# Dominique Louis <Dominique@SavageSoftware.com.au>                            
+#                                                                              
+# Obtained through:                                                            
+# Joint Endeavour of Delphi Innovators ( Project JEDI )                        
+#                                                                              
+# You may retrieve the latest version of this file at the Project              
+# JEDI home page, located at http://delphi-jedi.org                            
+#                                                                              
+# The contents of this file are used with permission, subject to               
+# the Mozilla Public License Version 1.1 (the "License"); you may              
+# not use this file except in compliance with the License. You may             
+# obtain a copy of the License at                                              
+# http://www.mozilla.org/MPL/MPL-1.1.html                                      
+#                                                                              
+# Software distributed under the License is distributed on an                  
+# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or               
+# implied. See the License for the specific language governing                 
+# rights and limitations under the License.                                    
+#                                                                              
+# Description                                                                  
+# -----------                                                                  
+#   A simple library to load images of various formats as SDL surfaces         
+#                                                                              
+# Requires                                                                     
+# --------                                                                     
+#   SDL.pas in your search path.                                               
+#                                                                              
+# Programming Notes                                                            
+# -----------------                                                            
+#   See the Aliens Demo on how to make use of this libaray                     
+#                                                                              
+# Revision History                                                             
+# ----------------                                                             
+#   April    02 2001 - MT : Initial Translation                                
+#                                                                              
+#   May      08 2001 - DL : Added ExternalSym derectives and copyright header  
+#                                                                              
+#   April   03 2003 - DL : Added jedi-sdl.inc include file to support more     
+#                          Pascal compilers. Initial support is now included   
+#                          for GnuPascal, VirtualPascal, TMT and obviously     
+#                          continue support for Delphi Kylix and FreePascal.   
+#                                                                              
+#   April   08 2003 - MK : Aka Mr Kroket - Added Better FPC support            
+#                                                                              
+#   April   24 2003 - DL : under instruction from Alexey Barkovoy, I have added
+#                          better TMT Pascal support and under instruction     
+#                          from Prof. Abimbola Olowofoyeku (The African Chief),
+#                          I have added better Gnu Pascal support              
+#                                                                              
+#   April   30 2003 - DL : under instruction from David Mears AKA              
+#                          Jason Siletto, I have added FPC Linux support.      
+#                          This was compiled with fpc 1.1, so remember to set  
+#                          include file path. ie. -Fi/usr/share/fpcsrc/rtl/*   
+#                                                                              
+#
+#  $Log: sdl_image.pas,v $
+#  Revision 1.14  2007/05/29 21:31:13  savage
+#  Changes as suggested by Almindor for 64bit compatibility.
+#
+#  Revision 1.13  2007/05/20 20:30:54  savage
+#  Initial Changes to Handle 64 Bits
+#
+#  Revision 1.12  2006/12/02 00:14:40  savage
+#  Updated to latest version
+#
+#  Revision 1.11  2005/04/10 18:22:59  savage
+#  Changes as suggested by Michalis, thanks.
+#
+#  Revision 1.10  2005/04/10 11:48:33  savage
+#  Changes as suggested by Michalis, thanks.
+#
+#  Revision 1.9  2005/01/05 01:47:07  savage
+#  Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
+#
+#  Revision 1.8  2005/01/04 23:14:44  savage
+#  Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
+#
+#  Revision 1.7  2005/01/01 02:03:12  savage
+#  Updated to v1.2.4
+#
+#  Revision 1.6  2004/08/14 22:54:30  savage
+#  Updated so that Library name defines are correctly defined for MacOS X.
+#
+#  Revision 1.5  2004/05/10 14:10:04  savage
+#  Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
+#
+#  Revision 1.4  2004/04/13 09:32:08  savage
+#  Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
+#
+#  Revision 1.3  2004/04/01 20:53:23  savage
+#  Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
+#
+#  Revision 1.2  2004/03/30 20:23:28  savage
+#  Tidied up use of UNIX compiler directive.
+#
+#  Revision 1.1  2004/02/14 23:35:42  savage
+#  version 1 of sdl_image, sdl_mixer and smpeg.
+#
+#
+#
+#******************************************************************************
+
+import 
+  
+
+when defined(windows): 
+  const 
+    ImageLibName = "SDL_Image.dll"
+elif defined(macosx): 
+  const 
+    ImageLibName = "libSDL_image-1.2.0.dylib"
+else: 
+  const 
+    ImageLibName = "libSDL_image.so"
+const 
+  IMAGE_MAJOR_VERSION* = 1'i8
+  IMAGE_MINOR_VERSION* = 2'i8
+  IMAGE_PATCHLEVEL* = 5'i8
+
+# This macro can be used to fill a version structure with the compile-time
+#  version of the SDL_image library. 
+
+proc IMAGE_VERSION*(X: var TVersion)
+  # This function gets the version of the dynamically linked SDL_image library.
+  #   it should NOT be used to fill a version structure, instead you should
+  #   use the SDL_IMAGE_VERSION() macro.
+  # 
+proc IMG_Linked_Version*(): Pversion{.importc: "IMG_Linked_Version", 
+                                      dynlib: ImageLibName.}
+  # Load an image from an SDL data source.
+  #   The 'type' may be one of: "BMP", "GIF", "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);
+  #
+proc IMG_LoadTyped_RW*(src: PRWops, freesrc: int, theType: cstring): PSurface{.
+    cdecl, importc: "IMG_LoadTyped_RW", dynlib: ImageLibName.}
+  # Convenience functions 
+proc IMG_Load*(theFile: cstring): PSurface{.cdecl, importc: "IMG_Load", 
+    dynlib: ImageLibName.}
+proc IMG_Load_RW*(src: PRWops, freesrc: int): PSurface{.cdecl, 
+    importc: "IMG_Load_RW", dynlib: ImageLibName.}
+  # Invert the alpha of a surface for use with OpenGL
+  #  This function is now a no-op, and only provided for backwards compatibility. 
+proc IMG_InvertAlpha*(theOn: int): int{.cdecl, importc: "IMG_InvertAlpha", 
+                                        dynlib: ImageLibName.}
+  # Functions to detect a file type, given a seekable source 
+proc IMG_isBMP*(src: PRWops): int{.cdecl, importc: "IMG_isBMP", 
+                                   dynlib: ImageLibName.}
+proc IMG_isGIF*(src: PRWops): int{.cdecl, importc: "IMG_isGIF", 
+                                   dynlib: ImageLibName.}
+proc IMG_isJPG*(src: PRWops): int{.cdecl, importc: "IMG_isJPG", 
+                                   dynlib: ImageLibName.}
+proc IMG_isLBM*(src: PRWops): int{.cdecl, importc: "IMG_isLBM", 
+                                   dynlib: ImageLibName.}
+proc IMG_isPCX*(src: PRWops): int{.cdecl, importc: "IMG_isPCX", 
+                                   dynlib: ImageLibName.}
+proc IMG_isPNG*(src: PRWops): int{.cdecl, importc: "IMG_isPNG", 
+                                   dynlib: ImageLibName.}
+proc IMG_isPNM*(src: PRWops): int{.cdecl, importc: "IMG_isPNM", 
+                                   dynlib: ImageLibName.}
+proc IMG_isTIF*(src: PRWops): int{.cdecl, importc: "IMG_isTIF", 
+                                   dynlib: ImageLibName.}
+proc IMG_isXCF*(src: PRWops): int{.cdecl, importc: "IMG_isXCF", 
+                                   dynlib: ImageLibName.}
+proc IMG_isXPM*(src: PRWops): int{.cdecl, importc: "IMG_isXPM", 
+                                   dynlib: ImageLibName.}
+proc IMG_isXV*(src: PRWops): int{.cdecl, importc: "IMG_isXV", 
+                                  dynlib: ImageLibName.}
+  # Individual loading functions 
+proc IMG_LoadBMP_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadBMP_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadGIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadGIF_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadJPG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadJPG_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadLBM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadLBM_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadPCX_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPCX_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadPNM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNM_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadPNG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNG_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadTGA_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTGA_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadTIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTIF_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadXCF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXCF_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadXPM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXPM_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadXV_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXV_RW", 
+    dynlib: ImageLibName.}
+proc IMG_ReadXPMFromArray*(xpm: cstringArray): PSurface{.cdecl, 
+    importc: "IMG_ReadXPMFromArray", dynlib: ImageLibName.}
+  # Error Macros 
+  # We'll use SDL for reporting errors 
+proc IMG_SetError*(fmt: cstring)
+proc IMG_GetError*(): cstring
+# implementation
+
+proc IMAGE_VERSION(X: var TVersion) = 
+  X.major = IMAGE_MAJOR_VERSION
+  X.minor = IMAGE_MINOR_VERSION
+  X.patch = IMAGE_PATCHLEVEL
+
+proc IMG_SetError(fmt: cstring) = 
+  SetError(fmt)
+
+proc IMG_GetError(): cstring = 
+  result = GetError()
/profani-tty/commit/src/theme.c?id=cd4465394b65e824123b69f3a97bd1e8be5a03d0'>cd446539 ^
5875dcfd ^











cd446539 ^
aa6e2284 ^



cd446539 ^
cd446539 ^
aa6e2284 ^



cd446539 ^
cd446539 ^
aa6e2284 ^
cd446539 ^
aa6e2284 ^





cd446539 ^
cd446539 ^
aa6e2284 ^


cd446539 ^
aa6e2284 ^
aa6e2284 ^











cd446539 ^

e8b2b719 ^


aa6e2284 ^


c3148eb9 ^


976e5aac ^


e8b2b719 ^

29f72283 ^




f56cc976 ^






29f72283 ^

f56cc976 ^





373b3a2d ^





29f72283 ^

373b3a2d ^



29f72283 ^

373b3a2d ^

29f72283 ^

373b3a2d ^

29f72283 ^

373b3a2d ^





29f72283 ^

373b3a2d ^

581c1e8b ^

373b3a2d ^

b1de8a40 ^

373b3a2d ^




976e5aac ^



1d5ac1b4 ^









29f72283 ^

e8b2b719 ^













1a896d7b ^
e8b2b719 ^
1a896d7b ^

e8b2b719 ^


976e5aac ^







e8b2b719 ^





1a896d7b ^

e8b2b719 ^




976e5aac ^



1a896d7b ^
























































e8b2b719 ^
7398d565 ^
20fa9632 ^





05664ef0 ^
20fa9632 ^














































7398d565 ^




7398d565 ^
aa6e2284 ^


7398d565 ^
aa6e2284 ^











































7398d565 ^
ed4391ec ^
74d99375 ^

















ed4391ec ^





1d5ac1b4 ^




























































976e5aac ^
ed4391ec ^

976e5aac ^






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604