Browse Source

* Added free callback to CoreImage codec

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3019 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
jylam 16 years ago
parent
commit
260a030eba
2 changed files with 23 additions and 4 deletions
  1. +6
    -0
      pipi/codec/coreimage.h
  2. +17
    -4
      pipi/codec/coreimage.m

+ 6
- 0
pipi/codec/coreimage.h View File

@@ -29,4 +29,10 @@
#include "pipi.h" #include "pipi.h"
#include "pipi_internals.h" #include "pipi_internals.h"


struct pipi_codec_coreimage
{
NSBitmapFormat format;
};


#endif #endif

+ 17
- 4
pipi/codec/coreimage.m View File

@@ -20,9 +20,11 @@
#import "coreimage.h" #import "coreimage.h"


#ifdef USE_COCOA #ifdef USE_COCOA

#import <CIImage.h> #import <CIImage.h>



static int pipi_free_coreimage(pipi_image_t *img);

pipi_image_t *pipi_load_coreimage(const char *name) pipi_image_t *pipi_load_coreimage(const char *name)
{ {
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
@@ -48,11 +50,14 @@ pipi_image_t *pipi_load_coreimage(const char *name)
img->p[PIPI_PIXELS_RGBA_C].bytes = ([myImage bitsPerPixel]/8) * img->w * img->h; img->p[PIPI_PIXELS_RGBA_C].bytes = ([myImage bitsPerPixel]/8) * img->w * img->h;
img->last_modified = PIPI_PIXELS_RGBA_C; img->last_modified = PIPI_PIXELS_RGBA_C;


img->codec_priv = (void*)[myImage bitmapFormat];

img->codec_priv = (struct pipi_codec_coreimage *) malloc(sizeof(struct pipi_codec_coreimage *));
struct pipi_codec_coreimage *infos = (struct pipi_codec_coreimage *) img->codec_priv;
infos->format = [myImage bitmapFormat];


pipi_pixels_t *p = pipi_getpixels(img, PIPI_PIXELS_RGBA_C); pipi_pixels_t *p = pipi_getpixels(img, PIPI_PIXELS_RGBA_C);

img->codec_free = pipi_free_coreimage;
[autoreleasepool release]; [autoreleasepool release];
return img; return img;
} }
@@ -87,5 +92,13 @@ int pipi_save_coreimage(pipi_image_t *img, const char *name)
return 1; return 1;
} }


/*
* XXX: The following functions are local.
*/

static int pipi_free_coreimage(pipi_image_t *img)
{
return 0;
}


#endif #endif

Loading…
Cancel
Save