summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorHubert Figuiere <hub@stansmith.figuiere.net>2008-08-26 16:40:45 -0600
committerHubert Figuiere <hub@stansmith.figuiere.net>2008-08-26 16:40:45 -0600
commit18adebbade482b983ca0e4bbcd884943bf6439f3 (patch)
tree87bc558f7277f4f2c36ee55125c9a4186773c09c /demo
parent7358b5bbe9557bc777cc9ad70761cf664d9f8e1a (diff)
* demo/pixbufload.c:
* gnome/pixbuf-loader.c: * include/libopenraw++/bitmapdata.h: * include/libopenraw++/rawfile.h * include/libopenraw/Makefile.am: * include/libopenraw/bitmapdata.h: * include/libopenraw/demosaic.h: * include/libopenraw/libopenraw.h: * include/libopenraw/rawfile.h: * lib/Makefile.am: * lib/bimedian_demosaic.cpp: * lib/capi/Makefile.am: * lib/capi/bitmapdata.cpp: * lib/capi/rawfile.cpp: * lib/demosaic.h: * lib/rawfile.cpp: Reorganize demosaic support. Remove or_demosaic from the public API. Add API for "rendering" to RawFile and the corresponding C API. Expose BitmapData as a result. Fix the demo and GNOME support to use that new API.
Diffstat (limited to 'demo')
-rw-r--r--demo/pixbufload.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/demo/pixbufload.c b/demo/pixbufload.c
index 030c1eb..300c522 100644
--- a/demo/pixbufload.c
+++ b/demo/pixbufload.c
@@ -28,8 +28,9 @@
static void pixbuf_free(guchar * data, gpointer u)
{
- (void)u;
- free(data);
+ ORBitmapDataRef b = (ORBitmapDataRef)u;
+ (void)data;
+ or_bitmapdata_release(b);
}
int
@@ -47,30 +48,20 @@ main(int argc, char **argv)
ORRawFileRef raw_file = or_rawfile_new(filename, OR_DATA_TYPE_NONE);
if(raw_file) {
- or_error err;
- ORRawDataRef rawdata = or_rawdata_new();
-/* int32_t orientation = or_rawfile_get_orientation(raw_file);*/
-
- err = or_rawfile_get_rawdata(raw_file, rawdata, 0);
- if(err == OR_ERROR_NONE) {
- or_cfa_pattern pattern;
- uint32_t x,y;
- uint16_t *src;
- uint8_t *dst;
- pattern = or_rawdata_get_cfa_pattern(rawdata);
- x = y = 0;
- or_rawdata_dimensions(rawdata, &x, &y);
- dst = (uint8_t*)malloc(sizeof(uint8_t) * 3 * x * y);
- src = (uint16_t*)or_rawdata_data(rawdata);
- /* check the size of the data*/
- or_demosaic(src , x, y, pattern, dst);
- pixbuf = gdk_pixbuf_new_from_data(dst, GDK_COLORSPACE_RGB,
- FALSE, 8, x , y ,
- ( x - 2 )* 3,
- pixbuf_free, NULL);
- }
- or_rawdata_release(rawdata);
- or_rawfile_release(raw_file);
+ or_error err;
+ ORBitmapDataRef bitmapdata = or_bitmapdata_new();
+ err = or_rawfile_get_rendered_image(raw_file, bitmapdata, 0);
+ if(err == OR_ERROR_NONE) {
+ uint32_t x,y;
+ x = y = 0;
+ or_bitmapdata_dimensions(bitmapdata, &x, &y);
+ pixbuf = gdk_pixbuf_new_from_data(or_bitmapdata_data(bitmapdata),
+ GDK_COLORSPACE_RGB,
+ FALSE, 8, x , y ,
+ ( x - 2 )* 3,
+ pixbuf_free, bitmapdata);
+ }
+ or_rawfile_release(raw_file);
}