libheif
Loading...
Searching...
No Matches
heif_text.h File Reference
#include "heif_image_handle.h"
#include "heif_library.h"
#include "heif_error.h"
Include dependency graph for heif_text.h:

Go to the source code of this file.

Typedefs

typedef struct heif_text_item heif_text_item

Functions

int heif_image_handle_get_number_of_text_items (const heif_image_handle *image_handle)
 Get the number of text items that are attached to an image.
int heif_image_handle_get_list_of_text_item_ids (const heif_image_handle *image_handle, heif_item_id *text_item_ids_array, int max_count)
 Get the text item identifiers for the text items attached to an image.
heif_error heif_context_get_text_item (const heif_context *context, heif_item_id text_item_id, heif_text_item **out)
 Get the text item.
heif_item_id heif_text_item_get_id (heif_text_item *text_item)
 Get the item identifier for a text item.
const char * heif_text_item_get_content (heif_text_item *text_item)
 Get the item content for a text item.
heif_error heif_text_item_get_property_extended_language (const heif_text_item *text_item, char **out_language)
 This function is similar to heif_item_get_property_extended_language(), but takes a heif_text_item as parameter.
heif_error heif_image_handle_add_text_item (heif_image_handle *image_handle, const char *content_type, const char *text, heif_text_item **out_text_item)
 Add a text item to an image.
void heif_text_item_release (heif_text_item *text_item)
 Release a text item.
heif_error heif_text_item_set_extended_language (heif_text_item *text_item, const char *language, heif_property_id *out_optional_propertyId)
 Set the extended language property to the text item.

Typedef Documentation

◆ heif_text_item

Function Documentation

◆ heif_context_get_text_item()

heif_error heif_context_get_text_item ( const heif_context * context,
heif_item_id text_item_id,
heif_text_item ** out )

Get the text item.

Caller is responsible for release of the output heif_text_item with heif_text_item_release().

Parameters
contextthe context to get the text item from, usually from a file operation
text_item_idthe identifier for the text item
outpointer to pointer to the resulting text item
Returns
heif_error_ok on success, or an error value indicating the problem

◆ heif_image_handle_add_text_item()

heif_error heif_image_handle_add_text_item ( heif_image_handle * image_handle,
const char * content_type,
const char * text,
heif_text_item ** out_text_item )

Add a text item to an image.

◆ heif_image_handle_get_list_of_text_item_ids()

int heif_image_handle_get_list_of_text_item_ids ( const heif_image_handle * image_handle,
heif_item_id * text_item_ids_array,
int max_count )

Get the text item identifiers for the text items attached to an image.

Possible usage (in C++):

int numTextItems = heif_image_handle_get_number_of_text_items(handle);
if (numTextItems > 0) {
std::vector<heif_item_id> text_item_ids(numTextItems);
heif_image_handle_get_list_of_text_item_ids(handle, text_item_ids.data(), numTextItems);
// use text item ids
}
int heif_image_handle_get_list_of_text_item_ids(const heif_image_handle *image_handle, heif_item_id *text_item_ids_array, int max_count)
Get the text item identifiers for the text items attached to an image.
int heif_image_handle_get_number_of_text_items(const heif_image_handle *image_handle)
Get the number of text items that are attached to an image.
Parameters
image_handlethe image handle for the parent image to query
text_item_ids_arrayarray to put the item identifiers into
max_countthe maximum number of text identifiers
Returns
the number of text item identifiers that were returned.

◆ heif_image_handle_get_number_of_text_items()

int heif_image_handle_get_number_of_text_items ( const heif_image_handle * image_handle)

Get the number of text items that are attached to an image.

Parameters
image_handlethe image handle for the image to query.
Returns
the number of text items, which can be zero.

◆ heif_text_item_get_content()

const char * heif_text_item_get_content ( heif_text_item * text_item)

Get the item content for a text item.

This is the payload text, in the format given by the associated content_type.

Parameters
text_itemthe text item to query
Returns
the text item content (or null if the text_item is null). The returned string shall be released with heif_string_release().

◆ heif_text_item_get_id()

heif_item_id heif_text_item_get_id ( heif_text_item * text_item)

Get the item identifier for a text item.

Parameters
text_itemthe text item to query
Returns
the text item identifier (or 0 if the text_item is null)

◆ heif_text_item_get_property_extended_language()

heif_error heif_text_item_get_property_extended_language ( const heif_text_item * text_item,
char ** out_language )

This function is similar to heif_item_get_property_extended_language(), but takes a heif_text_item as parameter.

Parameters
text_itemThe text item for which we are requesting the language.
out_languageOutput parameter for the text language. Free with heif_string_release().
Returns

◆ heif_text_item_release()

void heif_text_item_release ( heif_text_item * text_item)

Release a text item.

This should be called on items from heif_context_add_text_item().

Parameters
text_itemthe item to release.

◆ heif_text_item_set_extended_language()

heif_error heif_text_item_set_extended_language ( heif_text_item * text_item,
const char * language,
heif_property_id * out_optional_propertyId )

Set the extended language property to the text item.

This adds an RFC 5346 (IETF BCP 47) extended language tag, such as "en-AU".

Parameters
text_itemthe text item to query
languagethe language to set
out_optional_propertyIdOutput parameter for the property ID of the language property. This parameter may be NULL if the info is not required.
Returns
heif_error_ok on success, or an error value indicating the problem