158 lines
7.1 KiB
C
158 lines
7.1 KiB
C
|
/* LIBPIKABASE - The PIKA Basic Library
|
||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||
|
*
|
||
|
* pikametadata.h
|
||
|
* Copyright (C) 2013 Hartmut Kuhse <hartmutkuhse@src.gnome.org>
|
||
|
*
|
||
|
* This library is free software: you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 3 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library 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
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
|
* License along with this library. If not, see
|
||
|
* <https://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
#ifndef __PIKA_METADATA_H__
|
||
|
#define __PIKA_METADATA_H__
|
||
|
|
||
|
G_BEGIN_DECLS
|
||
|
|
||
|
#define PIKA_TYPE_METADATA (pika_metadata_get_type ())
|
||
|
#define PIKA_METADATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_METADATA, PikaMetadata))
|
||
|
#define PIKA_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_METADATA, PikaMetadataClass))
|
||
|
#define PIKA_IS_METADATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_METADATA))
|
||
|
#define PIKA_IS_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_METADATA))
|
||
|
#define PIKA_METADATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_METADATA, PikaMetadataClass))
|
||
|
|
||
|
|
||
|
/**
|
||
|
* PikaMetadataLoadFlags:
|
||
|
* @PIKA_METADATA_LOAD_COMMENT: Load the comment
|
||
|
* @PIKA_METADATA_LOAD_RESOLUTION: Load the resolution
|
||
|
* @PIKA_METADATA_LOAD_ORIENTATION: Load the orientation (rotation)
|
||
|
* @PIKA_METADATA_LOAD_COLORSPACE: Load the colorspace
|
||
|
* @PIKA_METADATA_LOAD_ALL: Load all of the above
|
||
|
*
|
||
|
* What metadata to load when importing images.
|
||
|
**/
|
||
|
typedef enum
|
||
|
{
|
||
|
PIKA_METADATA_LOAD_COMMENT = 1 << 0,
|
||
|
PIKA_METADATA_LOAD_RESOLUTION = 1 << 1,
|
||
|
PIKA_METADATA_LOAD_ORIENTATION = 1 << 2,
|
||
|
PIKA_METADATA_LOAD_COLORSPACE = 1 << 3,
|
||
|
|
||
|
PIKA_METADATA_LOAD_ALL = 0xffffffff
|
||
|
} PikaMetadataLoadFlags;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* PikaMetadataSaveFlags:
|
||
|
* @PIKA_METADATA_SAVE_EXIF: Save EXIF
|
||
|
* @PIKA_METADATA_SAVE_XMP: Save XMP
|
||
|
* @PIKA_METADATA_SAVE_IPTC: Save IPTC
|
||
|
* @PIKA_METADATA_SAVE_THUMBNAIL: Save a thumbnail of the image
|
||
|
* @PIKA_METADATA_SAVE_COLOR_PROFILE: Save the image's color profile
|
||
|
* Since: 2.10.10
|
||
|
* @PIKA_METADATA_SAVE_COMMENT: Save the image's comment
|
||
|
* Since: 3.0
|
||
|
* @PIKA_METADATA_SAVE_ALL: Save all of the above
|
||
|
*
|
||
|
* What kinds of metadata to save when exporting images.
|
||
|
**/
|
||
|
typedef enum
|
||
|
{
|
||
|
PIKA_METADATA_SAVE_EXIF = 1 << 0,
|
||
|
PIKA_METADATA_SAVE_XMP = 1 << 1,
|
||
|
PIKA_METADATA_SAVE_IPTC = 1 << 2,
|
||
|
PIKA_METADATA_SAVE_THUMBNAIL = 1 << 3,
|
||
|
PIKA_METADATA_SAVE_COLOR_PROFILE = 1 << 4,
|
||
|
PIKA_METADATA_SAVE_COMMENT = 1 << 5,
|
||
|
|
||
|
PIKA_METADATA_SAVE_ALL = 0xffffffff
|
||
|
} PikaMetadataSaveFlags;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* PikaMetadataColorspace:
|
||
|
* @PIKA_METADATA_COLORSPACE_UNSPECIFIED: Unspecified
|
||
|
* @PIKA_METADATA_COLORSPACE_UNCALIBRATED: Uncalibrated
|
||
|
* @PIKA_METADATA_COLORSPACE_SRGB: sRGB
|
||
|
* @PIKA_METADATA_COLORSPACE_ADOBERGB: Adobe RGB
|
||
|
*
|
||
|
* Well-defined colorspace information available from metadata
|
||
|
**/
|
||
|
typedef enum
|
||
|
{
|
||
|
PIKA_METADATA_COLORSPACE_UNSPECIFIED,
|
||
|
PIKA_METADATA_COLORSPACE_UNCALIBRATED,
|
||
|
PIKA_METADATA_COLORSPACE_SRGB,
|
||
|
PIKA_METADATA_COLORSPACE_ADOBERGB
|
||
|
} PikaMetadataColorspace;
|
||
|
|
||
|
|
||
|
GType pika_metadata_get_type (void) G_GNUC_CONST;
|
||
|
|
||
|
PikaMetadata * pika_metadata_new (void);
|
||
|
PikaMetadata * pika_metadata_duplicate (PikaMetadata *metadata);
|
||
|
|
||
|
PikaMetadata * pika_metadata_deserialize (const gchar *metadata_xml);
|
||
|
gchar * pika_metadata_serialize (PikaMetadata *metadata);
|
||
|
gchar * pika_metadata_get_guid (void);
|
||
|
|
||
|
void pika_metadata_add_xmp_history (PikaMetadata *metadata,
|
||
|
gchar *state_status);
|
||
|
|
||
|
PikaMetadata * pika_metadata_load_from_file (GFile *file,
|
||
|
GError **error);
|
||
|
gboolean pika_metadata_save_to_file (PikaMetadata *metadata,
|
||
|
GFile *file,
|
||
|
GError **error);
|
||
|
|
||
|
gboolean pika_metadata_set_from_exif (PikaMetadata *metadata,
|
||
|
const guchar *exif_data,
|
||
|
gint exif_data_length,
|
||
|
GError **error);
|
||
|
gboolean pika_metadata_set_from_iptc (PikaMetadata *metadata,
|
||
|
const guchar *iptc_data,
|
||
|
gint iptc_data_length,
|
||
|
GError **error);
|
||
|
gboolean pika_metadata_set_from_xmp (PikaMetadata *metadata,
|
||
|
const guchar *xmp_data,
|
||
|
gint xmp_data_length,
|
||
|
GError **error);
|
||
|
|
||
|
void pika_metadata_set_pixel_size (PikaMetadata *metadata,
|
||
|
gint width,
|
||
|
gint height);
|
||
|
void pika_metadata_set_bits_per_sample (PikaMetadata *metadata,
|
||
|
gint bits_per_sample);
|
||
|
|
||
|
gboolean pika_metadata_get_resolution (PikaMetadata *metadata,
|
||
|
gdouble *xres,
|
||
|
gdouble *yres,
|
||
|
PikaUnit *unit);
|
||
|
void pika_metadata_set_resolution (PikaMetadata *metadata,
|
||
|
gdouble xres,
|
||
|
gdouble yres,
|
||
|
PikaUnit unit);
|
||
|
|
||
|
PikaMetadataColorspace
|
||
|
pika_metadata_get_colorspace (PikaMetadata *metadata);
|
||
|
void pika_metadata_set_colorspace (PikaMetadata *metadata,
|
||
|
PikaMetadataColorspace colorspace);
|
||
|
|
||
|
gboolean pika_metadata_is_tag_supported (const gchar *tag,
|
||
|
const gchar *mime_type);
|
||
|
|
||
|
G_END_DECLS
|
||
|
|
||
|
#endif /* __PIKA_METADATA_H__ */
|