Root/alpy/patches/030-png-jpeg-addons.patch

1Index: Alpy-0.1.5/_alpymodule.c
2===================================================================
3--- Alpy-0.1.5.orig/_alpymodule.c 2012-03-31 01:15:51.052570081 +0200
4+++ Alpy-0.1.5/_alpymodule.c 2012-03-31 01:20:50.874079951 +0200
5@@ -27,6 +27,8 @@
6 
7 #include "Python.h"
8 #include "allegro.h"
9+#include "loadpng.h"
10+#include "jpgalleg.h"
11 #include <stdlib.h>
12 #include <string.h>
13 #include <dlfcn.h>
14@@ -253,6 +255,10 @@
15         }
16 
17         result = install_allegro(alpy_system, &errno, atexit);
18+ if (result == 0)
19+ result = loadpng_init();
20+ if (result == 0)
21+ result = jpgalleg_init();
22 
23         return PyInt_FromLong(result);
24     }
25@@ -2599,6 +2605,12 @@
26     else if(strcmp(type, "lbm")==0) {
27         bmp = Bitmap_Object_from_BITMAP(load_lbm(filename, PAL(pal)));
28     }
29+ else if(strcmp(type, "png")==0) {
30+ bmp = Bitmap_Object_from_BITMAP(load_png(filename, PAL(pal)));
31+ }
32+ else if(strcmp(type, "jpg")==0 || strcmp(type, "jpeg")==0) {
33+ bmp = Bitmap_Object_from_BITMAP(load_jpg(filename, PAL(pal)));
34+ }
35     else {
36         PyMem_Free(filename);
37         PyErr_SetString(AllegroError, "unknown image type");
38

Archive Download this file



interactive