|
|
@@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
* libpipi Proper image processing implementation library |
|
|
|
* libpipi Pathetic image processing interface library |
|
|
|
* Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org> |
|
|
|
* 2008 Jean-Yves Lamoureux <jylam@lnxscene.org> |
|
|
|
* All Rights Reserved |
|
|
@@ -37,7 +37,7 @@ pipi_image_t *pipi_load_coreimage(const char *name) |
|
|
|
|
|
|
|
NSBitmapImageRep * myImage; |
|
|
|
myImage = [[NSBitmapImageRep alloc] initWithCIImage:source]; |
|
|
|
|
|
|
|
|
|
|
|
pipi_image_t *img; |
|
|
|
img = pipi_new(w, h); |
|
|
|
img->p[PIPI_PIXELS_RGBA_C].pixels = [myImage bitmapData]; |
|
|
@@ -49,11 +49,11 @@ pipi_image_t *pipi_load_coreimage(const char *name) |
|
|
|
img->last_modified = PIPI_PIXELS_RGBA_C; |
|
|
|
|
|
|
|
img->codec_priv = (void*)[myImage bitmapFormat]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pipi_pixels_t *p = pipi_getpixels(img, PIPI_PIXELS_RGBA_C); |
|
|
|
|
|
|
|
[autoreleasepool release]; |
|
|
|
|
|
|
|
[autoreleasepool release]; |
|
|
|
return img; |
|
|
|
} |
|
|
|
|
|
|
@@ -63,7 +63,7 @@ int pipi_save_coreimage(pipi_image_t *img, const char *name) |
|
|
|
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; |
|
|
|
printf("%d\n", img->last_modified); |
|
|
|
pipi_pixels_t *p = pipi_getpixels(img, PIPI_PIXELS_RGBA_C); |
|
|
|
|
|
|
|
|
|
|
|
NSString *n = [NSString stringWithCString: name]; |
|
|
|
NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] |
|
|
|
initWithBitmapDataPlanes:NULL |
|
|
@@ -80,12 +80,12 @@ int pipi_save_coreimage(pipi_image_t *img, const char *name) |
|
|
|
]; |
|
|
|
if(bitmap == nil) return -1; |
|
|
|
memcpy([bitmap bitmapData], p->pixels, p->w*p->h*4); |
|
|
|
|
|
|
|
[[bitmap representationUsingType:NSPNGFileType properties:nil] writeToFile:n atomically:YES]; |
|
|
|
[autoreleasepool release]; |
|
|
|
|
|
|
|
[[bitmap representationUsingType:NSPNGFileType properties:nil] writeToFile:n atomically:YES]; |
|
|
|
[autoreleasepool release]; |
|
|
|
|
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |