chroma: add scaling modes to header
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I8935a2a5a8e5e33d38e937502b3b82456a6a6964
This commit is contained in:
parent
5fd2e5660f
commit
74f46f45bf
2 changed files with 34 additions and 0 deletions
32
include/chroma.h
vendored
32
include/chroma.h
vendored
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue