From 9944c67465d8c8c19908a1786412d90a7a59fd53 Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 12 Oct 2005 18:27:59 +0000 Subject: [PATCH] new function rgba_to_image() --- lib/python/image.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/python/image.c b/lib/python/image.c index 8b390eb..f178255 100644 --- a/lib/python/image.c +++ b/lib/python/image.c @@ -94,3 +94,33 @@ RGBA* image_toRGBA(PyObject*_image) PyErr_SetString(PyExc_Exception, setError("Unsupported image format: %s (try .convert(\"RGBA\")", image->image->mode)); return 0; } + +extern PyObject*PyImagingNew(Imaging imOut); + +PyObject* rgba_to_image(RGBA*rgba, int width, int height) +{ +#ifndef WIN32 + Imaging img = ImagingNew("RGBA", width, height); + int y; + if(!img->image32) { + fprintf(stderr, "No array allocated!\n"); + return 0; + } + for(y=0;yimage32[y]); + RGBA* src = &rgba[width*y]; + int x; + for(x=0;x