Top |
Functions
Object Hierarchy
GBoxed ├── VipsArea ├── VipsArrayDouble ├── VipsArrayImage ├── VipsArrayInt ├── VipsBlob ├── VipsRefString ├── VipsSaveString ╰── 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.
Initial 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()
.
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()
.
[constructor]
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. |
[out][optional] |
n |
optionally return number of elements here. |
[out][optional] |
type |
optionally return element type here. |
[out][optional] |
sizeof_type |
optionally return |
[out][optional] |
vips_ref_string_new ()
VipsRefString *
vips_ref_string_new (const char *str
);
Create a new refstring. These are reference-counted immutable strings, used to store string data in vips image metadata.
Strings must be valid utf-8; use blob for binary data.
See also: vips_area_unref()
.
vips_ref_string_get ()
const char * vips_ref_string_get (VipsRefString *refstr
,size_t *length
);
Get a pointer to the private string inside a refstr. Handy for language bindings.
See also: vips_value_get_ref_string()
.
Parameters
refstr |
the VipsRefString to fetch from |
|
length |
return length here, optionally. |
[out][optional] |
vips_blob_new ()
VipsBlob * vips_blob_new (VipsCallbackFn free_fn
,const void *data
,size_t length
);
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_copy ()
VipsBlob * vips_blob_copy (const void *data
,size_t length
);
Like vips_blob_new()
, but take a copy of the data. Useful for bindings
which struggle with callbacks.
See also: vips_blob_new()
.
vips_blob_get ()
const void * vips_blob_get (VipsBlob *blob
,size_t *length
);
Get the data from a VipsBlob.
See also: vips_blob_new()
.
vips_blob_set ()
void vips_blob_set (VipsBlob *blob
,VipsCallbackFn free_fn
,const void *data
,size_t length
);
Any old data is freed and new data attached.
It's sometimes useful to be able to create blobs as empty and then fill them later.
See also: vips_blob_new()
.
Parameters
blob |
VipsBlob to set |
|
free_fn |
|
[scope async][allow-none] |
data |
data to store. |
[array length=length][element-type guint8][transfer full] |
length |
number of bytes in |
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
.
str
should be a valid utf-8 string.
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 them much more efficient than
regular GValue
strings.
str
should be a valid utf-8 string.
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
,const 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 size 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_blob_free ()
void vips_value_set_blob_free (GValue *value
,void *data
,size_t length
);
Just like vips_value_set_blob()
, but when
value
is freed, data
will be
freed with g_free()
.
This can be easier to call for language bindings.
See also: vips_value_set_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.
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()
.
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()
.
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()
.
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()
.
[skip]
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()
.