backend: add new image property: corner radius

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2021-07-16 19:11:23 +01:00
parent ad18d129cc
commit de31cd4096
3 changed files with 6 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ typedef void (*backend_ready_callback_t)(void *);
// particular order:
//
// Color inversion -> Dimming -> Opacity multiply -> Limit maximum brightness
// (Corner radius could be applied in any order)
enum image_properties {
// Whether the color of the image is inverted
// 1 boolean, default: false
@@ -54,6 +55,9 @@ enum image_properties {
// brightness down to the max brightness value.
// 1 double, default: 1
IMAGE_PROPERTY_MAX_BRIGHTNESS,
// Gives the image a rounded corner.
// 1 double, default: 0
IMAGE_PROPERTY_CORNER_RADIUS,
};
enum image_operations {

View File

@@ -449,6 +449,7 @@ bool default_set_image_property(backend_t *base attr_unused, enum image_properti
tex->ewidth = iargs[0];
tex->eheight = iargs[1];
break;
case IMAGE_PROPERTY_CORNER_RADIUS: tex->corner_radius = dargs[0]; break;
case IMAGE_PROPERTY_MAX_BRIGHTNESS: tex->max_brightness = dargs[0]; break;
}

View File

@@ -37,6 +37,7 @@ struct backend_image {
double opacity;
double dim;
double max_brightness;
double corner_radius;
// Effective size of the image
int ewidth, eheight;
bool color_inverted;