aboutsummaryrefslogtreecommitdiff
path: root/fiv-io.h
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-12-28 19:58:14 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-12-28 20:18:25 +0100
commitbf47782f0a4720da8b6aeb39cfc128b6b26ded6e (patch)
treee56f6968653df7c5129e5130e7cb7093211849ae /fiv-io.h
parentc1af556751e196aba1f66aa06ce36f00d07d7ca7 (diff)
downloadfiv-bf47782f0a4720da8b6aeb39cfc128b6b26ded6e.tar.gz
fiv-bf47782f0a4720da8b6aeb39cfc128b6b26ded6e.tar.xz
fiv-bf47782f0a4720da8b6aeb39cfc128b6b26ded6e.zip
Move thumbnails into their own source file
And clean up identifiers.
Diffstat (limited to 'fiv-io.h')
-rw-r--r--fiv-io.h51
1 files changed, 3 insertions, 48 deletions
diff --git a/fiv-io.h b/fiv-io.h
index 52fd691..54e2727 100644
--- a/fiv-io.h
+++ b/fiv-io.h
@@ -31,6 +31,9 @@ FivIoProfile fiv_io_profile_new(const void *data, size_t len);
FivIoProfile fiv_io_profile_new_sRGB(void);
void fiv_io_profile_free(FivIoProfile self);
+// From libwebp, verified to exactly match [x * a / 255].
+#define PREMULTIPLY8(a, x) (((uint32_t) (x) * (uint32_t) (a) * 32897U) >> 23)
+
// --- Loading -----------------------------------------------------------------
extern const char *fiv_io_supported_media_types[];
@@ -69,9 +72,6 @@ extern cairo_user_data_key_t fiv_io_key_page_next;
/// There is no wrap-around. This is a weak pointer.
extern cairo_user_data_key_t fiv_io_key_page_previous;
-/// If non-NULL, indicates a thumbnail of insufficient quality.
-extern cairo_user_data_key_t fiv_io_key_thumbnail_lq;
-
cairo_surface_t *fiv_io_open(
const gchar *path, FivIoProfile profile, gboolean enhance, GError **error);
cairo_surface_t *fiv_io_open_from_data(const char *data, size_t len,
@@ -113,48 +113,3 @@ FivIoOrientation fiv_io_exif_orientation(const guint8 *exif, gsize len);
/// Save metadata attached by this module in Exiv2 format.
gboolean fiv_io_save_metadata(
cairo_surface_t *page, const gchar *path, GError **error);
-
-// --- Thumbnails --------------------------------------------------------------
-
-// And this is how you avoid glib-mkenums.
-typedef enum _FivIoThumbnailSize {
-#define FIV_IO_THUMBNAIL_SIZES(XX) \
- XX(SMALL, 128, "normal") \
- XX(NORMAL, 256, "large") \
- XX(LARGE, 512, "x-large") \
- XX(HUGE, 1024, "xx-large")
-#define XX(name, value, dir) FIV_IO_THUMBNAIL_SIZE_ ## name,
- FIV_IO_THUMBNAIL_SIZES(XX)
-#undef XX
- FIV_IO_THUMBNAIL_SIZE_COUNT,
-
- FIV_IO_THUMBNAIL_SIZE_MIN = 0,
- FIV_IO_THUMBNAIL_SIZE_MAX = FIV_IO_THUMBNAIL_SIZE_COUNT - 1
-} FivIoThumbnailSize;
-
-GType fiv_io_thumbnail_size_get_type(void) G_GNUC_CONST;
-#define FIV_TYPE_IO_THUMBNAIL_SIZE (fiv_io_thumbnail_size_get_type())
-
-typedef struct _FivIoThumbnailSizeInfo {
- int size; ///< Nominal size in pixels
- const char *thumbnail_spec_name; ///< thumbnail-spec directory name
-} FivIoThumbnailSizeInfo;
-
-extern FivIoThumbnailSizeInfo
- fiv_io_thumbnail_sizes[FIV_IO_THUMBNAIL_SIZE_COUNT];
-
-enum {
- FIV_IO_WIDE_THUMBNAIL_COEFFICIENT = 2
-};
-
-/// Returns this user's root thumbnail directory.
-gchar *fiv_io_get_thumbnail_root(void);
-
-/// Generates wide thumbnails of up to the specified size, saves them in cache.
-gboolean fiv_io_produce_thumbnail(
- GFile *target, FivIoThumbnailSize size, GError **error);
-
-/// Retrieves a thumbnail of the most appropriate quality and resolution
-/// for the target file.
-cairo_surface_t *fiv_io_lookup_thumbnail(
- GFile *target, FivIoThumbnailSize size);