浏览代码

* 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 年前
父节点
当前提交
260a030eba
共有 2 个文件被更改,包括 23 次插入4 次删除
  1. +6
    -0
      pipi/codec/coreimage.h
  2. +17
    -4
      pipi/codec/coreimage.m

+ 6
- 0
pipi/codec/coreimage.h 查看文件

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

struct pipi_codec_coreimage
{
NSBitmapFormat format;
};


#endif

+ 17
- 4
pipi/codec/coreimage.m 查看文件

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

#ifdef USE_COCOA

#import <CIImage.h>


static int pipi_free_coreimage(pipi_image_t *img);

pipi_image_t *pipi_load_coreimage(const char *name)
{
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->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);

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

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

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

#endif

正在加载...
取消
保存