diff --git a/src/config/ui_preferences_display_background.cpp b/src/config/ui_preferences_display_background.cpp index aad7e851..300bc237 100644 --- a/src/config/ui_preferences_display_background.cpp +++ b/src/config/ui_preferences_display_background.cpp @@ -40,6 +40,7 @@ static const cfg_auto_combo_option g_background_fill_options { _T("Default"), BackgroundFillType::Default }, { _T("Solid colour"), BackgroundFillType::SolidColour }, { _T("Gradient"), BackgroundFillType::Gradient }, + { _T("Average image colour"), BackgroundFillType::AverageImageColor }, }; static const cfg_auto_combo_option g_background_image_options[] = { @@ -48,7 +49,7 @@ static const cfg_auto_combo_option g_background_image_optio { _T("Custom image"), BackgroundImageType::CustomImage }, }; -static cfg_auto_combo cfg_background_fill_type(GUID_CFG_BACKGROUND_MODE, +static cfg_auto_combo cfg_background_fill_type(GUID_CFG_BACKGROUND_MODE, IDC_BACKGROUND_FILL_TYPE, BackgroundFillType::Default, g_background_fill_options); diff --git a/src/img_processing.cpp b/src/img_processing.cpp index 543ec4b8..952bea9f 100644 --- a/src/img_processing.cpp +++ b/src/img_processing.cpp @@ -370,6 +370,41 @@ void transpose_image_noalloc(int width, int height, const uint8_t* in_pixels, ui } } } + +RGBAColour compute_average_colour(const Image& img) +{ + if(!img.valid()) + { + return {}; + } + + uint64_t total_r = 0; + uint64_t total_g = 0; + uint64_t total_b = 0; + + for(int y=0; y