parent
c95aa263dd
commit
517cd679d3
|
@ -23,7 +23,6 @@ pkginclude_HEADERS = \
|
||||||
intl.h \
|
intl.h \
|
||||||
mask.h \
|
mask.h \
|
||||||
memory.h \
|
memory.h \
|
||||||
meta.h \
|
|
||||||
morphology.h \
|
morphology.h \
|
||||||
mosaicing.h \
|
mosaicing.h \
|
||||||
other.h \
|
other.h \
|
||||||
|
|
|
@ -37,6 +37,39 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIPS_META_EXIF_NAME:
|
||||||
|
*
|
||||||
|
* The name that JPEG read and write operations use for the image's EXIF data.
|
||||||
|
*/
|
||||||
|
#define VIPS_META_EXIF_NAME "exif-data"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIPS_META_ICC_NAME:
|
||||||
|
*
|
||||||
|
* The name we use to attach an ICC profile. The file read and write
|
||||||
|
* operations for TIFF, JPEG, PNG and others use this item of metadata to
|
||||||
|
* attach and save ICC profiles. The profile is updated by the
|
||||||
|
* vips_icc_transform() operations.
|
||||||
|
*/
|
||||||
|
#define VIPS_META_ICC_NAME "icc-profile-data"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIPS_META_XML:
|
||||||
|
*
|
||||||
|
* The original XML that was used to code the metadata after reading a VIPS
|
||||||
|
* format file.
|
||||||
|
*/
|
||||||
|
#define VIPS_META_XML "xml-header"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIPS_META_RESOLUTION_UNIT:
|
||||||
|
*
|
||||||
|
* The JPEG and TIFF read and write operations use this to record the
|
||||||
|
* file's preferred unit for resolution.
|
||||||
|
*/
|
||||||
|
#define VIPS_META_RESOLUTION_UNIT "resolution-unit"
|
||||||
|
|
||||||
int vips_format_sizeof( VipsBandFormat format );
|
int vips_format_sizeof( VipsBandFormat format );
|
||||||
|
|
||||||
int vips_image_get_width( VipsImage *image );
|
int vips_image_get_width( VipsImage *image );
|
||||||
|
@ -63,17 +96,82 @@ int vips_image_copy_fieldsv( VipsImage *out, VipsImage *in1, ... )
|
||||||
__attribute__((sentinel));
|
__attribute__((sentinel));
|
||||||
int vips_image_copy_fields( VipsImage *out, VipsImage *in );
|
int vips_image_copy_fields( VipsImage *out, VipsImage *in );
|
||||||
|
|
||||||
int vips_image_get_int( VipsImage *im, const char *field, int *out );
|
int vips_image_set( VipsImage *image, const char *field, GValue *value );
|
||||||
int vips_image_get_double( VipsImage *im, const char *field, double *out );
|
int vips_image_get( VipsImage *image, const char *field, GValue *value_copy );
|
||||||
int vips_image_get_string( VipsImage *im, const char *field, char **out );
|
GType vips_image_get_typeof( VipsImage *image, const char *field );
|
||||||
int vips_image_get_as_string( VipsImage *im, const char *field, char **out );
|
gboolean vips_image_remove( VipsImage *image, const char *field );
|
||||||
GType vips_image_get_typeof( VipsImage *im, const char *field );
|
|
||||||
int vips_image_get( VipsImage *im, const char *field, GValue *value_copy );
|
|
||||||
|
|
||||||
typedef void *(*VipsImageMapFn)( VipsImage *image,
|
typedef void *(*VipsImageMapFn)( VipsImage *image,
|
||||||
const char *field, GValue *value, void *a );
|
const char *field, GValue *value, void *a );
|
||||||
void *vips_image_map( VipsImage *im, VipsImageMapFn fn, void *a );
|
void *vips_image_map( VipsImage *im, VipsImageMapFn fn, void *a );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIPS_TYPE_SAVE_STRING:
|
||||||
|
*
|
||||||
|
* The #GType for an "vips_save_string".
|
||||||
|
*/
|
||||||
|
#define VIPS_TYPE_SAVE_STRING (vips_save_string_get_type())
|
||||||
|
GType vips_save_string_get_type( void );
|
||||||
|
const char *vips_save_string_get( const GValue *value );
|
||||||
|
void vips_save_string_set( GValue *value, const char *str );
|
||||||
|
void vips_save_string_setf( GValue *value, const char *fmt, ... )
|
||||||
|
__attribute__((format(printf, 2, 3)));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIPS_TYPE_AREA:
|
||||||
|
*
|
||||||
|
* The #GType for an #vips_area.
|
||||||
|
*/
|
||||||
|
#define VIPS_TYPE_AREA (vips_area_get_type())
|
||||||
|
GType vips_area_get_type( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIPS_TYPE_REF_STRING:
|
||||||
|
*
|
||||||
|
* The #GType for an #vips_refstring.
|
||||||
|
*/
|
||||||
|
#define VIPS_TYPE_REF_STRING (vips_ref_string_get_type())
|
||||||
|
GType vips_ref_string_get_type( void );
|
||||||
|
int vips_ref_string_set( GValue *value, const char *str );
|
||||||
|
const char *vips_ref_string_get( const GValue *value );
|
||||||
|
size_t vips_ref_string_get_length( const GValue *value );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIPS_TYPE_BLOB:
|
||||||
|
*
|
||||||
|
* The #GType for an #vips_blob.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Also used for eg. vips_local() and friends.
|
||||||
|
*/
|
||||||
|
typedef int (*VipsCallbackFn)( void *a, void *b );
|
||||||
|
|
||||||
|
#define VIPS_TYPE_BLOB (vips_blob_get_type())
|
||||||
|
GType vips_blob_get_type( void );
|
||||||
|
void *vips_blob_get( const GValue *value, size_t *length );
|
||||||
|
int vips_blob_set( GValue *value, VipsCallbackFn free_fn,
|
||||||
|
void *data, size_t length );
|
||||||
|
|
||||||
|
int vips_image_set_area( VipsImage *image,
|
||||||
|
const char *field, VipsCallbackFn free_fn, void *data );
|
||||||
|
int vips_image_get_area( VipsImage *image, const char *field, void **data );
|
||||||
|
int vips_image_set_string( VipsImage *image,
|
||||||
|
const char *field, const char *str );
|
||||||
|
int vips_image_get_string( VipsImage *image, const char *field, char **str );
|
||||||
|
int vips_image_set_blob( VipsImage *image, const char *field,
|
||||||
|
VipsCallbackFn free_fn, void *data, size_t length );
|
||||||
|
int vips_image_get_blob( VipsImage *image, const char *field,
|
||||||
|
void **data, size_t *length );
|
||||||
|
|
||||||
|
int vips_image_get_int( VipsImage *image, const char *field, int *out );
|
||||||
|
int vips_image_set_int( VipsImage *image, const char *field, int i );
|
||||||
|
int vips_image_get_double( VipsImage *image, const char *field, double *out );
|
||||||
|
int vips_image_set_double( VipsImage *image, const char *field, double d );
|
||||||
|
int vips_image_get_string( VipsImage *image, const char *field, char **out );
|
||||||
|
int vips_image_set_string( VipsImage *image,
|
||||||
|
const char *field, const char *str );
|
||||||
|
int vips_image_get_as_string( VipsImage *image, const char *field, char **out );
|
||||||
|
GType vips_image_get_typeof( VipsImage *image, const char *field );
|
||||||
|
|
||||||
int vips_image_history_printf( VipsImage *image, const char *format, ... )
|
int vips_image_history_printf( VipsImage *image, const char *format, ... )
|
||||||
__attribute__((format(printf, 2, 3)));
|
__attribute__((format(printf, 2, 3)));
|
||||||
int vips_image_history_args( VipsImage *image,
|
int vips_image_history_args( VipsImage *image,
|
||||||
|
|
|
@ -211,8 +211,8 @@ typedef struct _VipsImage {
|
||||||
|
|
||||||
/* Extra user-defined fields ... see im_meta_get_int() etc.
|
/* Extra user-defined fields ... see im_meta_get_int() etc.
|
||||||
*/
|
*/
|
||||||
GHashTable *Meta; /* GhashTable of GValue */
|
GHashTable *meta; /* GhashTable of GValue */
|
||||||
GSList *Meta_traverse; /* traverse order for Meta */
|
GSList *meta_traverse; /* traverse order for Meta */
|
||||||
|
|
||||||
/* Part of mmap() read ... the sizeof() the header we skip from the
|
/* Part of mmap() read ... the sizeof() the header we skip from the
|
||||||
* file start. Usually VIPS_SIZEOF_HEADER, but can be something else
|
* file start. Usually VIPS_SIZEOF_HEADER, but can be something else
|
||||||
|
|
|
@ -44,16 +44,16 @@ extern "C" {
|
||||||
* We don't refcount at this level ... large meta values are refcounted by
|
* We don't refcount at this level ... large meta values are refcounted by
|
||||||
* their GValue implementation, see eg. MetaArea.
|
* their GValue implementation, see eg. MetaArea.
|
||||||
*/
|
*/
|
||||||
typedef struct _Meta {
|
typedef struct _VipsMeta {
|
||||||
VipsImage *im;
|
VipsImage *im;
|
||||||
|
|
||||||
char *field; /* strdup() of field name */
|
char *field; /* strdup() of field name */
|
||||||
GValue value; /* copy of value */
|
GValue value; /* copy of value */
|
||||||
} Meta;
|
} VipsMeta;
|
||||||
|
|
||||||
void im__meta_init_types( void );
|
void vips__meta_init_types( void );
|
||||||
void im__meta_destroy( VipsImage *im );
|
void vips__meta_destroy( VipsImage *im );
|
||||||
int im__meta_cp( VipsImage *, const VipsImage * );
|
int vips__meta_cp( VipsImage *, const VipsImage * );
|
||||||
|
|
||||||
/* Default tile geometry.
|
/* Default tile geometry.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,140 +0,0 @@
|
||||||
/* Metadata API.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (C) 1991-2005 The National Gallery
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef IM_META_H
|
|
||||||
#define IM_META_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /*__cplusplus*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IM_META_EXIF_NAME:
|
|
||||||
*
|
|
||||||
* The name that JPEG read and write operations use for the image's EXIF data.
|
|
||||||
*/
|
|
||||||
#define IM_META_EXIF_NAME "exif-data"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IM_META_ICC_NAME:
|
|
||||||
*
|
|
||||||
* The name we use to attach an ICC profile. The file read and write
|
|
||||||
* operations for TIFF, JPEG, PNG and others use this item of metadata to
|
|
||||||
* attach and save ICC profiles. The profile is updated by the
|
|
||||||
* im_icc_transform() operations.
|
|
||||||
*/
|
|
||||||
#define IM_META_ICC_NAME "icc-profile-data"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IM_META_XML:
|
|
||||||
*
|
|
||||||
* The original XML that was used to code the metadata after reading a VIPS
|
|
||||||
* format file.
|
|
||||||
*/
|
|
||||||
#define IM_META_XML "xml-header"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IM_META_RESOLUTION_UNIT:
|
|
||||||
*
|
|
||||||
* The JPEG and TIFF read and write operations use this to record the
|
|
||||||
* file's preferred unit for resolution.
|
|
||||||
*/
|
|
||||||
#define IM_META_RESOLUTION_UNIT "resolution-unit"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IM_TYPE_SAVE_STRING:
|
|
||||||
*
|
|
||||||
* The #GType for an "im_save_string".
|
|
||||||
*/
|
|
||||||
#define IM_TYPE_SAVE_STRING (im_save_string_get_type())
|
|
||||||
GType im_save_string_get_type( void );
|
|
||||||
const char *im_save_string_get( const GValue *value );
|
|
||||||
void im_save_string_set( GValue *value, const char *str );
|
|
||||||
void im_save_string_setf( GValue *value, const char *fmt, ... )
|
|
||||||
__attribute__((format(printf, 2, 3)));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IM_TYPE_AREA:
|
|
||||||
*
|
|
||||||
* The #GType for an #im_area.
|
|
||||||
*/
|
|
||||||
#define IM_TYPE_AREA (im_area_get_type())
|
|
||||||
GType im_area_get_type( void );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IM_TYPE_REF_STRING:
|
|
||||||
*
|
|
||||||
* The #GType for an #im_refstring.
|
|
||||||
*/
|
|
||||||
#define IM_TYPE_REF_STRING (im_ref_string_get_type())
|
|
||||||
GType im_ref_string_get_type( void );
|
|
||||||
int im_ref_string_set( GValue *value, const char *str );
|
|
||||||
const char *im_ref_string_get( const GValue *value );
|
|
||||||
size_t im_ref_string_get_length( const GValue *value );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IM_TYPE_BLOB:
|
|
||||||
*
|
|
||||||
* The #GType for an #im_blob.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Also used for eg. im_local() and friends.
|
|
||||||
*/
|
|
||||||
typedef int (*im_callback_fn)( void *a, void *b );
|
|
||||||
|
|
||||||
#define IM_TYPE_BLOB (im_blob_get_type())
|
|
||||||
GType im_blob_get_type( void );
|
|
||||||
void *im_blob_get( const GValue *value, size_t *length );
|
|
||||||
int im_blob_set( GValue *value, im_callback_fn free_fn,
|
|
||||||
void *data, size_t length );
|
|
||||||
|
|
||||||
int im_meta_set( VipsImage *im, const char *field, GValue *value );
|
|
||||||
gboolean im_meta_remove( VipsImage *im, const char *field );
|
|
||||||
int im_meta_get( VipsImage *im, const char *field, GValue *value_copy );
|
|
||||||
GType im_meta_get_typeof( VipsImage *im, const char *field );
|
|
||||||
|
|
||||||
int im_meta_set_int( VipsImage *im, const char *field, int i );
|
|
||||||
int im_meta_get_int( VipsImage *im, const char *field, int *i );
|
|
||||||
int im_meta_set_double( VipsImage *im, const char *field, double d );
|
|
||||||
int im_meta_get_double( VipsImage *im, const char *field, double *d );
|
|
||||||
int im_meta_set_area( VipsImage *im,
|
|
||||||
const char *field, im_callback_fn free_fn, void *data );
|
|
||||||
int im_meta_get_area( VipsImage *im, const char *field, void **data );
|
|
||||||
int im_meta_set_string( VipsImage *im, const char *field, const char *str );
|
|
||||||
int im_meta_get_string( VipsImage *im, const char *field, char **str );
|
|
||||||
int im_meta_set_blob( VipsImage *im, const char *field,
|
|
||||||
im_callback_fn free_fn, void *data, size_t length );
|
|
||||||
int im_meta_get_blob( VipsImage *im, const char *field,
|
|
||||||
void **data, size_t *length );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /*__cplusplus*/
|
|
||||||
|
|
||||||
#endif /*!IM_META_H*/
|
|
|
@ -114,7 +114,6 @@ extern "C" {
|
||||||
#include <vips/semaphore.h>
|
#include <vips/semaphore.h>
|
||||||
#include <vips/threadpool.h>
|
#include <vips/threadpool.h>
|
||||||
|
|
||||||
#include <vips/meta.h>
|
|
||||||
#include <vips/header.h>
|
#include <vips/header.h>
|
||||||
|
|
||||||
#include <vips/enumtypes.h>
|
#include <vips/enumtypes.h>
|
||||||
|
|
|
@ -203,9 +203,7 @@ VipsImage *im_open_local( VipsImage *parent,
|
||||||
int im_open_local_array( VipsImage *parent,
|
int im_open_local_array( VipsImage *parent,
|
||||||
VipsImage **images, int n, const char *filename, const char *mode );
|
VipsImage **images, int n, const char *filename, const char *mode );
|
||||||
|
|
||||||
/* uncomment this when we remove the im_callback_fn from meta.h
|
#define im_callback_fn VipsCallbackFn
|
||||||
typedef int (*im_callback_fn)( void *a, void *b );
|
|
||||||
*/
|
|
||||||
|
|
||||||
int im_add_callback( VipsImage *im,
|
int im_add_callback( VipsImage *im,
|
||||||
const char *callback, im_callback_fn fn, void *a, void *b );
|
const char *callback, im_callback_fn fn, void *a, void *b );
|
||||||
|
@ -267,20 +265,6 @@ VipsDemandStyle im_char2dhint( const char *str );
|
||||||
#define im_rect_dup vips_rect_dup
|
#define im_rect_dup vips_rect_dup
|
||||||
#define im_rect_normalise vips_rect_normalise
|
#define im_rect_normalise vips_rect_normalise
|
||||||
|
|
||||||
#define im_header_map_fn VipsImageMapFn
|
|
||||||
#define im_header_map vips_image_map
|
|
||||||
|
|
||||||
#define im_header_int vips_image_get_int
|
|
||||||
#define im_header_double vips_image_get_double
|
|
||||||
#define im_header_string vips_image_get_string
|
|
||||||
#define im_header_as_string vips_image_get_as_string
|
|
||||||
#define im_header_get_typeof vips_image_get_typeof
|
|
||||||
#define im_header_get vips_image_get
|
|
||||||
|
|
||||||
#define im_histlin vips_image_history_printf
|
|
||||||
#define im_updatehist vips_image_history_args
|
|
||||||
#define im_history_get vips_image_get_history
|
|
||||||
|
|
||||||
#define im_demand_hint vips_demand_hint
|
#define im_demand_hint vips_demand_hint
|
||||||
#define im_demand_hint_array vips_demand_hint_array
|
#define im_demand_hint_array vips_demand_hint_array
|
||||||
|
|
||||||
|
@ -369,6 +353,56 @@ typedef void (*im_wrapmany_fn)( void **in, void *out, int width,
|
||||||
int im_wrapmany( VipsImage **in, VipsImage *out,
|
int im_wrapmany( VipsImage **in, VipsImage *out,
|
||||||
im_wrapmany_fn fn, void *a, void *b );
|
im_wrapmany_fn fn, void *a, void *b );
|
||||||
|
|
||||||
|
#define IM_META_EXIF_NAME VIPS_META_EXIF_NAME
|
||||||
|
#define IM_META_ICC_NAME VIPS_META_ICC_NAME
|
||||||
|
#define IM_META_XML VIPS_META_XML
|
||||||
|
#define IM_META_RESOLUTION_UNIT VIPS_META_RESOLUTION_UNIT
|
||||||
|
#define IM_TYPE_SAVE_STRING VIPS_TYPE_SAVE_STRING
|
||||||
|
#define IM_TYPE_BLOB VIPS_TYPE_BLOB
|
||||||
|
#define IM_TYPE_AREA VIPS_TYPE_AREA
|
||||||
|
#define IM_TYPE_REF_STRING VIPS_TYPE_REF_STRING
|
||||||
|
|
||||||
|
#define im_header_map_fn VipsImageMapFn
|
||||||
|
#define im_header_map vips_image_map
|
||||||
|
|
||||||
|
#define im_header_int vips_image_get_int
|
||||||
|
#define im_header_double vips_image_get_double
|
||||||
|
#define im_header_string vips_image_get_string
|
||||||
|
#define im_header_as_string vips_image_get_as_string
|
||||||
|
#define im_header_get_typeof vips_image_get_typeof
|
||||||
|
#define im_header_get vips_image_get
|
||||||
|
|
||||||
|
#define im_histlin vips_image_history_printf
|
||||||
|
#define im_updatehist vips_image_history_args
|
||||||
|
#define im_history_get vips_image_get_history
|
||||||
|
|
||||||
|
#define im_save_string_get vips_save_string_get
|
||||||
|
#define im_save_string_set vips_save_string_set
|
||||||
|
#define im_save_string_setf vips_save_string_setf
|
||||||
|
|
||||||
|
#define im_ref_string_set vips_ref_string_set
|
||||||
|
#define im_ref_string_get vips_ref_string_get
|
||||||
|
#define im_ref_string_get_length vips_ref_string_get_length
|
||||||
|
|
||||||
|
#define im_blob_get vips_blob_get
|
||||||
|
#define im_blob_set vips_blob_set
|
||||||
|
|
||||||
|
#define im_meta_set vips_image_set
|
||||||
|
#define im_meta_remove vips_image_remove
|
||||||
|
#define im_meta_get vips_image_get
|
||||||
|
#define im_meta_get_typeof vips_image_get_typeof
|
||||||
|
|
||||||
|
#define im_meta_set_int vips_image_set_int
|
||||||
|
#define im_meta_get_int vips_image_get_int
|
||||||
|
#define im_meta_set_double vips_image_set_double
|
||||||
|
#define im_meta_get_double vips_image_get_double
|
||||||
|
#define im_meta_set_area vips_image_set_area
|
||||||
|
#define im_meta_get_area vips_image_get_area
|
||||||
|
#define im_meta_set_string vips_image_set_string
|
||||||
|
#define im_meta_get_string vips_image_get_string
|
||||||
|
#define im_meta_set_blob vips_image_set_blob
|
||||||
|
#define im_meta_get_blob vips_image_get_blob
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
|
@ -3,7 +3,6 @@ noinst_LTLIBRARIES = libiofuncs.la
|
||||||
libiofuncs_la_SOURCES = \
|
libiofuncs_la_SOURCES = \
|
||||||
enumtypes.c \
|
enumtypes.c \
|
||||||
object.c \
|
object.c \
|
||||||
meta.c \
|
|
||||||
base64.h \
|
base64.h \
|
||||||
base64.c \
|
base64.c \
|
||||||
dispatch_types.c \
|
dispatch_types.c \
|
||||||
|
|
|
@ -42,6 +42,10 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define VIPS_DEBUG
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif /*HAVE_CONFIG_H*/
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
@ -56,6 +60,7 @@
|
||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
#include <vips/buf.h>
|
#include <vips/buf.h>
|
||||||
#include <vips/thread.h>
|
#include <vips/thread.h>
|
||||||
|
#include <vips/debug.h>
|
||||||
|
|
||||||
#ifdef OS_WIN32
|
#ifdef OS_WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -152,6 +157,8 @@ vips_verror( const char *domain, const char *fmt, va_list ap )
|
||||||
vips_buf_vappendf( &vips_error_buf, fmt, ap );
|
vips_buf_vappendf( &vips_error_buf, fmt, ap );
|
||||||
vips_buf_appends( &vips_error_buf, "\n" );
|
vips_buf_appends( &vips_error_buf, "\n" );
|
||||||
g_mutex_unlock( vips__global_lock );
|
g_mutex_unlock( vips__global_lock );
|
||||||
|
|
||||||
|
VIPS_DEBUG_MSG( "vips_verror: %s\n", fmt );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -416,7 +416,7 @@ vips_image_finalize( GObject *gobject )
|
||||||
|
|
||||||
VIPS_FREE( image->Hist );
|
VIPS_FREE( image->Hist );
|
||||||
VIPS_FREEF( im__gslist_gvalue_free, image->history_list );
|
VIPS_FREEF( im__gslist_gvalue_free, image->history_list );
|
||||||
im__meta_destroy( image );
|
vips__meta_destroy( image );
|
||||||
|
|
||||||
G_OBJECT_CLASS( vips_image_parent_class )->finalize( gobject );
|
G_OBJECT_CLASS( vips_image_parent_class )->finalize( gobject );
|
||||||
}
|
}
|
||||||
|
@ -442,13 +442,13 @@ print_field_fn( VipsImage *image, const char *field, GValue *value, void *a )
|
||||||
/* Look for known enums and decode them.
|
/* Look for known enums and decode them.
|
||||||
*/
|
*/
|
||||||
extra = NULL;
|
extra = NULL;
|
||||||
if( strcmp( field, "Coding" ) == 0 )
|
if( strcmp( field, "coding" ) == 0 )
|
||||||
extra = VIPS_ENUM_NICK(
|
extra = VIPS_ENUM_NICK(
|
||||||
VIPS_TYPE_CODING, g_value_get_int( value ) );
|
VIPS_TYPE_CODING, g_value_get_int( value ) );
|
||||||
else if( strcmp( field, "BandFmt" ) == 0 )
|
else if( strcmp( field, "format" ) == 0 )
|
||||||
extra = VIPS_ENUM_NICK(
|
extra = VIPS_ENUM_NICK(
|
||||||
VIPS_TYPE_BAND_FORMAT, g_value_get_int( value ) );
|
VIPS_TYPE_BAND_FORMAT, g_value_get_int( value ) );
|
||||||
else if( strcmp( field, "Type" ) == 0 )
|
else if( strcmp( field, "interpretation" ) == 0 )
|
||||||
extra = VIPS_ENUM_NICK(
|
extra = VIPS_ENUM_NICK(
|
||||||
VIPS_TYPE_INTERPRETATION, g_value_get_int( value ) );
|
VIPS_TYPE_INTERPRETATION, g_value_get_int( value ) );
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ vips_image_print( VipsObject *object, VipsBuf *buf )
|
||||||
|
|
||||||
(void) vips_image_map( image, print_field_fn, (void *) buf );
|
(void) vips_image_map( image, print_field_fn, (void *) buf );
|
||||||
|
|
||||||
vips_buf_appendf( buf, "Hist: %s", im_history_get( image ) );
|
vips_buf_appendf( buf, "Hist: %s", vips_image_get_history( image ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
|
|
@ -213,9 +213,9 @@ vips_init( const char *argv0 )
|
||||||
|
|
||||||
/* Register base vips types.
|
/* Register base vips types.
|
||||||
*/
|
*/
|
||||||
im__meta_init_types();
|
vips__meta_init_types();
|
||||||
im__format_init();
|
|
||||||
vips__interpolate_init();
|
vips__interpolate_init();
|
||||||
|
im__format_init();
|
||||||
|
|
||||||
/* Load up any plugins in the vips libdir. We don't error on failure,
|
/* Load up any plugins in the vips libdir. We don't error on failure,
|
||||||
* it's too annoying to have VIPS refuse to start because of a broken
|
* it's too annoying to have VIPS refuse to start because of a broken
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -53,8 +53,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif /*OS_WIN32*/
|
#endif /*OS_WIN32*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
|
|
||||||
|
@ -250,7 +248,7 @@ im_strncpy( char *dest, const char *src, int n )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert( n > 0 );
|
g_assert( n > 0 );
|
||||||
|
|
||||||
for( i = 0; i < n - 1; i++ )
|
for( i = 0; i < n - 1; i++ )
|
||||||
if( !(dest[i] = src[i]) )
|
if( !(dest[i] = src[i]) )
|
||||||
|
@ -849,8 +847,8 @@ im__gvalue_ref_string_new( const char *text )
|
||||||
{
|
{
|
||||||
GValue *value;
|
GValue *value;
|
||||||
|
|
||||||
value = im__gvalue_new( IM_TYPE_REF_STRING );
|
value = im__gvalue_new( VIPS_TYPE_REF_STRING );
|
||||||
im_ref_string_set( value, text );
|
vips_ref_string_set( value, text );
|
||||||
|
|
||||||
return( value );
|
return( value );
|
||||||
}
|
}
|
||||||
|
@ -898,18 +896,19 @@ im__gslist_gvalue_merge( GSList *a, const GSList *b )
|
||||||
for( i = b; i; i = i->next ) {
|
for( i = b; i; i = i->next ) {
|
||||||
GValue *value = (GValue *) i->data;
|
GValue *value = (GValue *) i->data;
|
||||||
|
|
||||||
assert( G_VALUE_TYPE( value ) == IM_TYPE_REF_STRING );
|
g_assert( G_VALUE_TYPE( value ) == VIPS_TYPE_REF_STRING );
|
||||||
|
|
||||||
for( j = a; j; j = j->next ) {
|
for( j = a; j; j = j->next ) {
|
||||||
GValue *value2 = (GValue *) j->data;
|
GValue *value2 = (GValue *) j->data;
|
||||||
|
|
||||||
assert( G_VALUE_TYPE( value2 ) == IM_TYPE_REF_STRING );
|
g_assert( G_VALUE_TYPE( value2 ) ==
|
||||||
|
VIPS_TYPE_REF_STRING );
|
||||||
|
|
||||||
/* Just do a pointer compare ... good enough 99.9% of
|
/* Just do a pointer compare ... good enough 99.9% of
|
||||||
* the time.
|
* the time.
|
||||||
*/
|
*/
|
||||||
if( im_ref_string_get( value ) ==
|
if( vips_ref_string_get( value ) ==
|
||||||
im_ref_string_get( value2 ) )
|
vips_ref_string_get( value2 ) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,11 +939,11 @@ im__gslist_gvalue_get( const GSList *list )
|
||||||
for( p = list; p; p = p->next ) {
|
for( p = list; p; p = p->next ) {
|
||||||
GValue *value = (GValue *) p->data;
|
GValue *value = (GValue *) p->data;
|
||||||
|
|
||||||
assert( G_VALUE_TYPE( value ) == IM_TYPE_REF_STRING );
|
g_assert( G_VALUE_TYPE( value ) == VIPS_TYPE_REF_STRING );
|
||||||
|
|
||||||
/* +1 for the newline we will add for each item.
|
/* +1 for the newline we will add for each item.
|
||||||
*/
|
*/
|
||||||
length += im_ref_string_get_length( value ) + 1;
|
length += vips_ref_string_get_length( value ) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( length == 0 )
|
if( length == 0 )
|
||||||
|
@ -952,7 +951,7 @@ im__gslist_gvalue_get( const GSList *list )
|
||||||
|
|
||||||
/* More than 10MB of history? Madness!
|
/* More than 10MB of history? Madness!
|
||||||
*/
|
*/
|
||||||
assert( length < 10 * 1024 * 1024 );
|
g_assert( length < 10 * 1024 * 1024 );
|
||||||
|
|
||||||
/* +1 for '\0'.
|
/* +1 for '\0'.
|
||||||
*/
|
*/
|
||||||
|
@ -963,8 +962,8 @@ im__gslist_gvalue_get( const GSList *list )
|
||||||
for( p = list; p; p = p->next ) {
|
for( p = list; p; p = p->next ) {
|
||||||
GValue *value = (GValue *) p->data;
|
GValue *value = (GValue *) p->data;
|
||||||
|
|
||||||
strcpy( q, im_ref_string_get( value ) );
|
strcpy( q, vips_ref_string_get( value ) );
|
||||||
q += im_ref_string_get_length( value );
|
q += vips_ref_string_get_length( value );
|
||||||
strcpy( q, "\n" );
|
strcpy( q, "\n" );
|
||||||
q += 1;
|
q += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,18 +513,18 @@ rebuild_header_meta( IMAGE *im, xmlNode *i )
|
||||||
get_sprop( i, "type", type, 256 ) ) {
|
get_sprop( i, "type", type, 256 ) ) {
|
||||||
GType gtype = g_type_from_name( type );
|
GType gtype = g_type_from_name( type );
|
||||||
|
|
||||||
/* Can we convert from IM_SAVE_STRING to type?
|
/* Can we convert from VIPS_SAVE_STRING to type?
|
||||||
*/
|
*/
|
||||||
if( gtype &&
|
if( gtype &&
|
||||||
g_value_type_transformable(
|
g_value_type_transformable(
|
||||||
IM_TYPE_SAVE_STRING, gtype ) ) {
|
VIPS_TYPE_SAVE_STRING, gtype ) ) {
|
||||||
char *content;
|
char *content;
|
||||||
GValue save_value = { 0 };
|
GValue save_value = { 0 };
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
|
||||||
content = (char *) xmlNodeGetContent( i );
|
content = (char *) xmlNodeGetContent( i );
|
||||||
g_value_init( &save_value, IM_TYPE_SAVE_STRING );
|
g_value_init( &save_value, VIPS_TYPE_SAVE_STRING );
|
||||||
im_save_string_set( &save_value, content );
|
vips_save_string_set( &save_value, content );
|
||||||
xmlFree( content );
|
xmlFree( content );
|
||||||
|
|
||||||
g_value_init( &value, gtype );
|
g_value_init( &value, gtype );
|
||||||
|
@ -535,7 +535,7 @@ rebuild_header_meta( IMAGE *im, xmlNode *i )
|
||||||
"save format" ) );
|
"save format" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
if( im_meta_set( im, name, &value ) ) {
|
if( vips_image_set( im, name, &value ) ) {
|
||||||
g_value_unset( &save_value );
|
g_value_unset( &save_value );
|
||||||
g_value_unset( &value );
|
g_value_unset( &value );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
@ -551,10 +551,10 @@ rebuild_header_meta( IMAGE *im, xmlNode *i )
|
||||||
static xmlDoc *
|
static xmlDoc *
|
||||||
get_xml( IMAGE *im )
|
get_xml( IMAGE *im )
|
||||||
{
|
{
|
||||||
if( vips_image_get_typeof( im, IM_META_XML ) ) {
|
if( vips_image_get_typeof( im, VIPS_META_XML ) ) {
|
||||||
xmlDoc *doc;
|
xmlDoc *doc;
|
||||||
|
|
||||||
if( im_meta_get_area( im, IM_META_XML, (void *) &doc ) )
|
if( vips_image_get_area( im, VIPS_META_XML, (void *) &doc ) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
return( doc );
|
return( doc );
|
||||||
|
@ -605,15 +605,15 @@ im__readhist( IMAGE *im )
|
||||||
{
|
{
|
||||||
/* Junk any old xml meta.
|
/* Junk any old xml meta.
|
||||||
*/
|
*/
|
||||||
if( vips_image_get_typeof( im, IM_META_XML ) )
|
if( vips_image_get_typeof( im, VIPS_META_XML ) )
|
||||||
im_meta_set_area( im, IM_META_XML, NULL, NULL );
|
vips_image_set_area( im, VIPS_META_XML, NULL, NULL );
|
||||||
|
|
||||||
if( im__has_extension_block( im ) ) {
|
if( im__has_extension_block( im ) ) {
|
||||||
xmlDoc *doc;
|
xmlDoc *doc;
|
||||||
|
|
||||||
if( !(doc = read_xml( im )) )
|
if( !(doc = read_xml( im )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( im_meta_set_area( im, IM_META_XML,
|
if( vips_image_set_area( im, VIPS_META_XML,
|
||||||
(im_callback_fn) xmlFreeDoc, doc ) ) {
|
(im_callback_fn) xmlFreeDoc, doc ) ) {
|
||||||
xmlFreeDoc( doc );
|
xmlFreeDoc( doc );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
@ -673,25 +673,25 @@ set_field( xmlNode *node,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
save_fields_meta( Meta *meta, xmlNode *node )
|
save_fields_meta( VipsMeta *meta, xmlNode *node )
|
||||||
{
|
{
|
||||||
GType type = G_VALUE_TYPE( &meta->value );
|
GType type = G_VALUE_TYPE( &meta->value );
|
||||||
|
|
||||||
/* If we can transform to IM_TYPE_SAVE_STRING and back, we can save and
|
/* If we can transform to VIPS_TYPE_SAVE_STRING and back, we can save
|
||||||
* restore.
|
* and restore.
|
||||||
*/
|
*/
|
||||||
if( g_value_type_transformable( type, IM_TYPE_SAVE_STRING ) &&
|
if( g_value_type_transformable( type, VIPS_TYPE_SAVE_STRING ) &&
|
||||||
g_value_type_transformable( IM_TYPE_SAVE_STRING, type ) ) {
|
g_value_type_transformable( VIPS_TYPE_SAVE_STRING, type ) ) {
|
||||||
GValue save_value = { 0 };
|
GValue save_value = { 0 };
|
||||||
|
|
||||||
g_value_init( &save_value, IM_TYPE_SAVE_STRING );
|
g_value_init( &save_value, VIPS_TYPE_SAVE_STRING );
|
||||||
if( !g_value_transform( &meta->value, &save_value ) ) {
|
if( !g_value_transform( &meta->value, &save_value ) ) {
|
||||||
vips_error( "VipsImage", "%s",
|
vips_error( "VipsImage", "%s",
|
||||||
_( "error transforming to save format" ) );
|
_( "error transforming to save format" ) );
|
||||||
return( node );
|
return( node );
|
||||||
}
|
}
|
||||||
if( set_field( node, meta->field, g_type_name( type ),
|
if( set_field( node, meta->field, g_type_name( type ),
|
||||||
im_save_string_get( &save_value ) ) ) {
|
vips_save_string_get( &save_value ) ) ) {
|
||||||
g_value_unset( &save_value );
|
g_value_unset( &save_value );
|
||||||
return( node );
|
return( node );
|
||||||
}
|
}
|
||||||
|
@ -711,13 +711,14 @@ save_fields( IMAGE *im, xmlNode *node )
|
||||||
if( !(this = xmlNewChild( node, NULL, (xmlChar *) "header", NULL )) )
|
if( !(this = xmlNewChild( node, NULL, (xmlChar *) "header", NULL )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( set_field( this, "Hist",
|
if( set_field( this, "Hist",
|
||||||
g_type_name( IM_TYPE_REF_STRING ), im_history_get( im ) ) )
|
g_type_name( VIPS_TYPE_REF_STRING ),
|
||||||
|
vips_image_get_history( im ) ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( !(this = xmlNewChild( node, NULL, (xmlChar *) "meta", NULL )) )
|
if( !(this = xmlNewChild( node, NULL, (xmlChar *) "meta", NULL )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( im->Meta_traverse &&
|
if( im->meta_traverse &&
|
||||||
im_slist_map2( im->Meta_traverse,
|
im_slist_map2( im->meta_traverse,
|
||||||
(VSListMap2Fn) save_fields_meta, this, NULL ) )
|
(VSListMap2Fn) save_fields_meta, this, NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
|
@ -761,7 +762,7 @@ rpt( char ch, int n )
|
||||||
int i;
|
int i;
|
||||||
static char buf[200];
|
static char buf[200];
|
||||||
|
|
||||||
n = IM_MIN( 190, n );
|
n = VIPS_MIN( 190, n );
|
||||||
|
|
||||||
for( i = 0; i < n; i++ )
|
for( i = 0; i < n; i++ )
|
||||||
buf[i] = ch;
|
buf[i] = ch;
|
||||||
|
|
Loading…
Reference in New Issue