From 74f46f45bf03733ad1410c44a121ca526b3a8de0 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 2 Nov 2025 01:19:18 +0300 Subject: [PATCH] chroma: add scaling modes to header Signed-off-by: NotAShelf Change-Id: I8935a2a5a8e5e33d38e937502b3b82456a6a6964 --- include/chroma.h | 32 ++++++++++++++++++++++++++++++++ include/chroma_version.h | 2 ++ 2 files changed, 34 insertions(+) diff --git a/include/chroma.h b/include/chroma.h index b49b0b6..eee298a 100644 --- a/include/chroma.h +++ b/include/chroma.h @@ -36,6 +36,22 @@ typedef enum { CHROMA_ERROR_MEMORY = -6 } chroma_error_t; +// Scaling modes for wallpaper display +typedef enum { + CHROMA_SCALE_FILL = 0, // fill entire output, crop if necessary + CHROMA_SCALE_FIT = 1, // fit image within output, add borders if needed + CHROMA_SCALE_STRETCH = 2, // stretch to fill output, may distort aspect ratio + CHROMA_SCALE_CENTER = 3 // center image at original size +} chroma_scale_mode_t; + +// Image filtering quality settings +typedef enum { + CHROMA_FILTER_NEAREST = 0, // nearest neighbor filtering (pixelated) + CHROMA_FILTER_LINEAR = 1, // linear filtering (smooth) + CHROMA_FILTER_BILINEAR = 2, // bilinear filtering (smoother) + CHROMA_FILTER_TRILINEAR = 3 // trilinear filtering (smoothest) +} chroma_filter_quality_t; + // Image data structure typedef struct { unsigned char *data; // RGBA pixel data @@ -71,6 +87,11 @@ typedef struct { // Associated wallpaper chroma_image_t *image; + // Configuration for this output + chroma_scale_mode_t scale_mode; + chroma_filter_quality_t filter_quality; + bool config_loaded; + // OpenGL resource cache GLuint texture_id; GLuint shader_program; @@ -84,6 +105,8 @@ typedef struct { typedef struct { char output_name[256]; char image_path[MAX_PATH_LEN]; + chroma_scale_mode_t scale_mode; + chroma_filter_quality_t filter_quality; } chroma_config_mapping_t; // Application configuration @@ -92,6 +115,10 @@ typedef struct { int mapping_count; char default_image[MAX_PATH_LEN]; bool daemon_mode; + + // Global scaling and filtering settings (used as defaults) + chroma_scale_mode_t default_scale_mode; + chroma_filter_quality_t default_filter_quality; } chroma_config_t; // Main application state @@ -194,6 +221,11 @@ int chroma_config_load(chroma_config_t *config, const char *config_file); void chroma_config_free(chroma_config_t *config); const char *chroma_config_get_image_for_output(chroma_config_t *config, const char *output_name); +int chroma_config_get_mapping_for_output( + chroma_config_t *config, const char *output_name, + chroma_scale_mode_t *scale_mode, chroma_filter_quality_t *filter_quality); +int chroma_config_create_sample(const char *config_file); +void chroma_config_print(const chroma_config_t *config); // Main loop and events int chroma_run(chroma_state_t *state); diff --git a/include/chroma_version.h b/include/chroma_version.h index a160ad2..1ab736b 100644 --- a/include/chroma_version.h +++ b/include/chroma_version.h @@ -1,6 +1,8 @@ #ifndef CHROMA_VERSION_H #define CHROMA_VERSION_H +#ifndef CHROMA_VERSION #define CHROMA_VERSION "1.0.1" +#endif #endif // CHROMA_VERSION_H