Gimp.ValueArray

Fields

None

Methods

class

new (n_prealloced)

class

new_from_values (values)

append (value)

copy ()

get_color_array (index)

get_core_object_array (index)

index (index)

insert (index, value)

length ()

prepend (value)

ref ()

remove (index)

truncate (n_values)

unref ()

Details

class Gimp.ValueArray

The prime purpose of a Gimp.ValueArray is for it to be used as an object property that holds an array of values. A Gimp.ValueArray wraps an array of GObject.Value elements in order for it to be used as a boxed type through %GIMP_TYPE_VALUE_ARRAY.

New in version 2.10.

classmethod new(n_prealloced)
Parameters:

n_prealloced (int) – number of values to preallocate space for

Returns:

a newly allocated Gimp.ValueArray with 0 values

Return type:

Gimp.ValueArray

Allocate and initialize a new Gimp.ValueArray, optionally preserve space for n_prealloced elements. New arrays always contain 0 elements, regardless of the value of n_prealloced.

New in version 2.10.

classmethod new_from_values(values)
Parameters:

values ([GObject.Value]) – The GObject.Value elements

Returns:

a newly allocated Gimp.ValueArray.

Return type:

Gimp.ValueArray

Allocate and initialize a new Gimp.ValueArray, and fill it with the given GObject.Values. When no GObject.Values are given, returns empty Gimp.ValueArray.

New in version 3.0.

append(value)
Parameters:

value (GObject.Value or None) – GObject.Value to copy into Gimp.ValueArray, or None

Returns:

the Gimp.ValueArray passed in as self

Return type:

Gimp.ValueArray

Insert a copy of value as last element of self. If value is None, an uninitialized value is appended.

New in version 2.10.

copy()
Returns:

a newly allocated Gimp.ValueArray.

Return type:

Gimp.ValueArray

Return an exact copy of a Gimp.ValueArray by duplicating all its values.

New in version 3.0.

get_color_array(index)
Parameters:

index (int) – index of the value of interest

Returns:

the [type`ColorArray`] stored at index in self.

Return type:

[Gegl.Color]

Return a pointer to the value at index contained in self. This value is supposed to be a [type`ColorArray`].

*Note*: most of the time, you should use the generic [method`Gimp`.ValueArray.index] to retrieve a value, then the relevant g_value_get_*() function. This alternative function is mostly there for bindings because GObject.Object-Introspection is not able yet to process correctly known boxed array types.

There are no reasons to use this function in C code.

New in version 3.0.

get_core_object_array(index)
Parameters:

index (int) – index of the value of interest

Returns:

the [type`CoreObjectArray`] stored at index in self.

Return type:

[GObject.Object]

Return a pointer to the value at index contained in self. This value is supposed to be a [type`CoreObjectArray`].

*Note*: most of the time, you should use the generic [method`Gimp`.ValueArray.index] to retrieve a value, then the relevant g_value_get_*() function. This alternative function is mostly there for bindings because GObject.Object-Introspection is not able yet to process correctly known boxed array types.

There are no reasons to use this function in C code.

New in version 3.0.

index(index)
Parameters:

index (int) – index of the value of interest

Returns:

pointer to a value at index in self

Return type:

GObject.Value

Return a pointer to the value at index contained in self.

*Note*: in binding languages, some custom types fail to be correctly passed through. For these types, you should use specific functions. For instance, in the Python binding, a [type`ColorArray`] GValue won’t be usable with this function. You should use instead [method`ValueArray`.get_color_array].

New in version 2.10.

insert(index, value)
Parameters:
Returns:

the Gimp.ValueArray passed in as self

Return type:

Gimp.ValueArray

Insert a copy of value at specified position into self. If value is None, an uninitialized value is inserted.

New in version 2.10.

length()
Return type:

int

prepend(value)
Parameters:

value (GObject.Value or None) – GObject.Value to copy into Gimp.ValueArray, or None

Returns:

the Gimp.ValueArray passed in as self

Return type:

Gimp.ValueArray

Insert a copy of value as first element of self. If value is None, an uninitialized value is prepended.

New in version 2.10.

ref()
Returns:

the same self

Return type:

Gimp.ValueArray

Adds a reference to a Gimp.ValueArray.

New in version 2.10.

remove(index)
Parameters:

index (int) – position of value to remove, which must be less than Gimp.ValueArray.length()

Returns:

the Gimp.ValueArray passed in as self

Return type:

Gimp.ValueArray

Remove the value at position index from self.

New in version 2.10.

truncate(n_values)
Parameters:

n_values (int) –

unref()

Unref a Gimp.ValueArray. If the reference count drops to zero, the array including its contents are freed.

New in version 2.10.