summaryrefslogtreecommitdiff
path: root/src/setup.h
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2016-10-02 16:58:27 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2016-10-02 17:32:43 +0200
commitddd9556689af055355a07cf2766fe95eaed4e38e (patch)
treeb6de3e57a5cfbd0d855277c3b8c93f16549f0bf2 /src/setup.h
parent56ff7bc45505b3e39b2f9be70e7bee3f80ec4f70 (diff)
downloadcataract-ddd9556689af055355a07cf2766fe95eaed4e38e.tar.xz
Add support for HiDPI images
This works by creating corresponding hidpi image sizes on startup and letting the machinery generate high resolution images from the source images (no way to use supplied images). However since browsers expect exact image dimension multiples for the particular scale factor, a reference image size (scale factor 1.0x) must be read first, then cropped to match reference aspect ratio and resized to exact dimensions. That way pixel-perfect results can be achieved for the chosen scale factor. TODO: the CSS background-image: image-set() tags are not supported on Firefox. TODO: try the 1.5x scale factor
Diffstat (limited to 'src/setup.h')
-rw-r--r--src/setup.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/setup.h b/src/setup.h
index c11efed..730c035 100644
--- a/src/setup.h
+++ b/src/setup.h
@@ -25,11 +25,13 @@ G_BEGIN_DECLS
#define DEFAULT_INDEX_FILENAME "index.html"
#define THUMBNAIL_NAME_FORMAT "%.3d_%s"
+#define HIDPI_NAME_FORMAT "%s_hidpi_%gx"
#define TARGET_IMAGE_DIR_PREFIX "_"
#define DEFAULT_NO_RESIZE_THRESHOLD 1
#define DEFAULT_AVAILABILITY_THRESHOLD 1
#define DEFAULT_QUALITY_THRESHOLD 5
+#define DEFAULT_UPSCALE_THRESHOLD 33
#define SETUP_XML "setup.xml"
#define SETUP_V2_XML "setup2.xml"
@@ -38,6 +40,7 @@ G_BEGIN_DECLS
/* forward declaration */
typedef struct TGalleryDesign TGalleryDesign;
+typedef struct TImageSize TImageSize;
/* Global gallery setup */
typedef struct {
@@ -96,7 +99,7 @@ typedef enum {
CROP_STYLE_FIXED
} TCropStyle;
-typedef struct {
+struct TImageSize {
gchar *name;
gchar *tagname;
gboolean is_thumbnail;
@@ -112,8 +115,11 @@ typedef struct {
int no_resize_threshold;
int availability_threshold;
int quality_threshold;
+ gboolean is_hidpi;
+ gdouble hidpi_scale_factor;
+ TImageSize *hidpi_ref_size;
TCropStyle thumb_crop_style;
-} TImageSize;
+};
typedef struct {
gboolean enabled;
@@ -139,6 +145,10 @@ struct TGalleryDesign {
gchar **supplemental_files;
gchar *imgmagick_resize_opts;
gchar *imgmagick_thumb_opts;
+ int hidpi_upscale_threshold;
+ gdouble *hidpi_sizes;
+ int hidpi_quality;
+ int hidpi_thumbnail_quality;
};