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_MEMORY = -6
 | 
				
			||||||
} chroma_error_t;
 | 
					} 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
 | 
					// Image data structure
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
  unsigned char *data; // RGBA pixel data
 | 
					  unsigned char *data; // RGBA pixel data
 | 
				
			||||||
| 
						 | 
					@ -71,6 +87,11 @@ typedef struct {
 | 
				
			||||||
  // Associated wallpaper
 | 
					  // Associated wallpaper
 | 
				
			||||||
  chroma_image_t *image;
 | 
					  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
 | 
					  // OpenGL resource cache
 | 
				
			||||||
  GLuint texture_id;
 | 
					  GLuint texture_id;
 | 
				
			||||||
  GLuint shader_program;
 | 
					  GLuint shader_program;
 | 
				
			||||||
| 
						 | 
					@ -84,6 +105,8 @@ typedef struct {
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
  char output_name[256];
 | 
					  char output_name[256];
 | 
				
			||||||
  char image_path[MAX_PATH_LEN];
 | 
					  char image_path[MAX_PATH_LEN];
 | 
				
			||||||
 | 
					  chroma_scale_mode_t scale_mode;
 | 
				
			||||||
 | 
					  chroma_filter_quality_t filter_quality;
 | 
				
			||||||
} chroma_config_mapping_t;
 | 
					} chroma_config_mapping_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Application configuration
 | 
					// Application configuration
 | 
				
			||||||
| 
						 | 
					@ -92,6 +115,10 @@ typedef struct {
 | 
				
			||||||
  int mapping_count;
 | 
					  int mapping_count;
 | 
				
			||||||
  char default_image[MAX_PATH_LEN];
 | 
					  char default_image[MAX_PATH_LEN];
 | 
				
			||||||
  bool daemon_mode;
 | 
					  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;
 | 
					} chroma_config_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Main application state
 | 
					// 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);
 | 
					void chroma_config_free(chroma_config_t *config);
 | 
				
			||||||
const char *chroma_config_get_image_for_output(chroma_config_t *config,
 | 
					const char *chroma_config_get_image_for_output(chroma_config_t *config,
 | 
				
			||||||
                                               const char *output_name);
 | 
					                                               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
 | 
					// Main loop and events
 | 
				
			||||||
int chroma_run(chroma_state_t *state);
 | 
					int chroma_run(chroma_state_t *state);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,8 @@
 | 
				
			||||||
#ifndef CHROMA_VERSION_H
 | 
					#ifndef CHROMA_VERSION_H
 | 
				
			||||||
#define CHROMA_VERSION_H
 | 
					#define CHROMA_VERSION_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef CHROMA_VERSION
 | 
				
			||||||
#define CHROMA_VERSION "1.0.1"
 | 
					#define CHROMA_VERSION "1.0.1"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // CHROMA_VERSION_H
 | 
					#endif // CHROMA_VERSION_H
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue