Top |
Functions
Object Hierarchy
GBoxed ├── VipsArea ├── VipsArrayDouble ├── VipsArrayImage ├── VipsArrayInt ├── VipsBlob ╰── VipsThing
Functions
vips_area_new ()
VipsArea * vips_area_new (VipsCallbackFn free_fn
,void *data
);
A VipsArea wraps a chunk of memory. It adds reference counting and a free
function. It also keeps a count and a GType
, so the area can be an array.
This type is used for things like passing an array of double or an array of VipsObject pointers to operations, and for reference-counted immutable strings.
Inital count == 1, so _unref()
after attaching somewhere.
See also: vips_area_unref()
.
vips_area_new_array ()
VipsArea * vips_area_new_array (GType type
,size_t sizeof_type
,int n
);
An area which holds an array of elements of some GType
. To set values for
the elements, get the pointer and write.
See also: vips_area_unref()
.
Parameters
type |
|
|
sizeof_type |
sizeof() an element in the array |
|
n |
number of elements in the array |
vips_area_new_array_object ()
VipsArea *
vips_area_new_array_object (int n
);
An area which holds an array of GObject
s. See vips_area_new_array()
. When
the area is freed, each GObject
will be unreffed.
Add an extra NULL element at the end, handy for eg.
vips_image_pipeline_array()
etc.
See also: vips_area_unref()
.
vips_area_get_data ()
void * vips_area_get_data (VipsArea *area
,size_t *length
,int *n
,GType *type
,size_t *sizeof_type
);
Return the data pointer plus optionally the length in bytes of an area,
the number of elements, the GType
of each element and the sizeof()
each
element.
Parameters
area |
VipsArea to fetch from |
|
length |
optionally return length in bytes here. |
[allow-none] |
n |
optionally return number of elements here. |
[allow-none] |
type |
optionally return element type here. |
[allow-none] |
sizeof_type |
optionally return |
[allow-none] |
vips_blob_new ()
VipsBlob * vips_blob_new (VipsCallbackFn free_fn
,const void *data
,size_t size
);
Like vips_area_new()
, but track a length as well. The returned VipsBlob
takes ownership of data
and will free it with free_fn
. Pass NULL for
free_fn
to not transfer ownership.
An area of mem with a free func and a length (some sort of binary object, like an ICC profile).
See also: vips_area_unref()
.
vips_blob_get ()
const void * vips_blob_get (VipsBlob *blob
,size_t *size
);
Get the data from a VipsBlob.
See also: vips_blob_new()
.
vips_array_double_new ()
VipsArrayDouble * vips_array_double_new (const double *array
,int n
);
Allocate a new array of doubles and copy array
into it. Free with
vips_area_unref()
.
See also: VipsArea.
vips_array_double_newv ()
VipsArrayDouble * vips_array_double_newv (int n
,...
);
Allocate a new array of n
doubles and copy @... into it. Free with
vips_area_unref()
.
See also: vips_array_double_new()
vips_array_double_get ()
double * vips_array_double_get (VipsArrayDouble *array
,int *n
);
Fetch a double array from a VipsArrayDouble. Useful for language bindings.
vips_array_int_new ()
VipsArrayInt * vips_array_int_new (const int *array
,int n
);
Allocate a new array of ints and copy array
into it. Free with
vips_area_unref()
.
See also: VipsArea.
vips_array_int_newv ()
VipsArrayInt * vips_array_int_newv (int n
,...
);
Allocate a new array of n
ints and copy @... into it. Free with
vips_area_unref()
.
See also: vips_array_int_new()
vips_array_int_get ()
int * vips_array_int_get (VipsArrayInt *array
,int *n
);
Fetch an int array from a VipsArrayInt. Useful for language bindings.
vips_value_set_area ()
void vips_value_set_area (GValue *value
,VipsCallbackFn free_fn
,void *data
);
Set value to be a ref-counted area of memory with a free function.
vips_value_get_area ()
void * vips_value_get_area (const GValue *value
,size_t *length
);
Get the pointer from an area. Don't touch count (area is static).
vips_value_get_save_string ()
const char *
vips_value_get_save_string (const GValue *value
);
Get the C string held internally by the GValue.
vips_value_set_save_string ()
void vips_value_set_save_string (GValue *value
,const char *str
);
Copies the C string into value
.
vips_value_set_save_stringf ()
void vips_value_set_save_stringf (GValue *value
,const char *fmt
,...
);
Generates a string and copies it into value
.
vips_value_get_ref_string ()
const char * vips_value_get_ref_string (const GValue *value
,size_t *length
);
Get the C string held internally by the GValue
.
vips_value_set_ref_string ()
void vips_value_set_ref_string (GValue *value
,const char *str
);
Copies the C string str
into value
.
vips_ref_string are immutable C strings that are copied between images by
copying reference-counted pointers, making the much more efficient than
regular GValue
strings.
vips_value_get_blob ()
void * vips_value_get_blob (const GValue *value
,size_t *length
);
Returns the data pointer from a blob. Optionally returns the length too.
blobs are things like ICC profiles or EXIF data. They are relocatable, and are saved to VIPS files for you coded as base64 inside the XML. They are copied by copying reference-counted pointers.
See also: vips_value_set_blob()
vips_value_set_blob ()
void vips_value_set_blob (GValue *value
,VipsCallbackFn free_fn
,void *data
,size_t length
);
Sets value
to hold a data
. When value
is freed, data
will be
freed with free_fn
. value
also holds a note of the length of the memory
area.
blobs are things like ICC profiles or EXIF data. They are relocatable, and are saved to VIPS files for you coded as base64 inside the XML. They are copied by copying reference-counted pointers.
See also: vips_value_get_blob()
vips_value_set_array ()
void vips_value_set_array (GValue *value
,int n
,GType type
,size_t sizeof_type
);
Set value
to be an array of things.
This allocates memory but does not initialise the contents: get the pointer and write instead.
Parameters
value |
|
[out] |
n |
number of elements |
|
type |
the type of each element |
|
sizeof_type |
the sizeof each element |
vips_value_get_array ()
void * vips_value_get_array (const GValue *value
,int *n
,GType *type
,size_t *sizeof_type
);
Return the pointer to the array held by value
.
Optionally return the other properties of the array in n
, type
,
sizeof_type
.
See also: vips_value_set_array()
.
Parameters
value |
|
|
n |
return the number of elements here, optionally. |
[allow-none] |
type |
return the type of each element here, optionally. |
[allow-none] |
sizeof_type |
return the sizeof each element here, optionally. |
[allow-none] |
vips_value_get_array_double ()
double * vips_value_get_array_double (const GValue *value
,int *n
);
Return the start of the array of doubles held by value
.
optionally return the number of elements in n
.
See also: vips_array_double_new()
.
vips_value_set_array_double ()
void vips_value_set_array_double (GValue *value
,const double *array
,int n
);
Set value
to hold a copy of array
. Pass in the array length in n
.
See also: vips_array_double_get()
.
Parameters
value |
|
[out] |
array |
array of doubles. |
[array length=n][allow-none] |
n |
the number of elements |
vips_value_get_array_int ()
int * vips_value_get_array_int (const GValue *value
,int *n
);
Return the start of the array of ints held by value
.
optionally return the number of elements in n
.
See also: vips_array_int_new()
.
vips_value_set_array_int ()
void vips_value_set_array_int (GValue *value
,const int *array
,int n
);
Set value
to hold a copy of array
. Pass in the array length in n
.
See also: vips_array_int_get()
.
Parameters
value |
|
[out] |
array |
array of ints. |
[array length=n][allow-none] |
n |
the number of elements |
vips_value_get_array_object ()
GObject ** vips_value_get_array_object (const GValue *value
,int *n
);
Return the start of the array of GObject
held by value
.
Optionally return the number of elements in n
.
See also: vips_area_new_array_object()
.
vips_value_set_array_object ()
void vips_value_set_array_object (GValue *value
,int n
);
Set value
to hold an array of GObject
. Pass in the array length in n
.
See also: vips_value_get_array_object()
.