diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/libply/ply-frame-buffer.c | 17 | ||||
| -rw-r--r-- | src/libply/ply-frame-buffer.h | 5 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/libply/ply-frame-buffer.c b/src/libply/ply-frame-buffer.c index 0ed6e72..5b09d76 100644 --- a/src/libply/ply-frame-buffer.c +++ b/src/libply/ply-frame-buffer.c @@ -673,9 +673,10 @@ ply_frame_buffer_fill_with_color (ply_frame_buffer_t *buffer, } bool -ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t *buffer, - ply_frame_buffer_area_t *area, - uint32_t hex_color) +ply_frame_buffer_fill_with_hex_color_at_opacity (ply_frame_buffer_t *buffer, + ply_frame_buffer_area_t *area, + uint32_t hex_color, + double opacity) { ply_frame_buffer_area_t cropped_area; uint32_t pixel_value; @@ -702,6 +703,8 @@ ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t *buffer, blue = ((double) (hex_color & 0x0000ff00) / 0x0000ff00); alpha = ((double) (hex_color & 0x000000ff) / 0x000000ff); + alpha *= opacity; + red *= alpha; green *= alpha; blue *= alpha; @@ -715,6 +718,14 @@ ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t *buffer, return ply_frame_buffer_flush (buffer); } +bool +ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t *buffer, + ply_frame_buffer_area_t *area, + uint32_t hex_color) +{ + return ply_frame_buffer_fill_with_hex_color_at_opacity (buffer, area, hex_color, 1.0); +} + bool ply_frame_buffer_fill_with_argb32_data_at_opacity (ply_frame_buffer_t *buffer, ply_frame_buffer_area_t *area, diff --git a/src/libply/ply-frame-buffer.h b/src/libply/ply-frame-buffer.h index a3e406a..a4d259f 100644 --- a/src/libply/ply-frame-buffer.h +++ b/src/libply/ply-frame-buffer.h @@ -67,6 +67,11 @@ bool ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t *buffer, ply_frame_buffer_area_t *area, uint32_t hex_color); +bool ply_frame_buffer_fill_with_hex_color_at_opacity (ply_frame_buffer_t *buffer, + ply_frame_buffer_area_t *area, + uint32_t hex_color, + double opacity); + bool ply_frame_buffer_fill_with_argb32_data (ply_frame_buffer_t *buffer, ply_frame_buffer_area_t *area, unsigned long x, |
