diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-08-07 05:59:08 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-08-07 06:54:59 -0700 |
commit | abd93adab83bc2573b052f0c1181c3e638e88537 (patch) | |
tree | 836279ca673296447c4aa7fcaa04d0d2f6c597b5 /src/til_fb.h | |
parent | 8d990b8929964fcf88a023128dc26f27a13f264c (diff) |
modules/drizzle: add a mapped overlay style
this introduces a style= setting with values:
style=mask simple alpha mask overlay
style=map displacement mapped overlay
I might add a lighting option for the style=map mode with a
moving light source or something like that, but it's already
pretty slow as-is.
This is mostly just for more testing of the snapshotting, but
there's some interesting compositions enabled like:
module=compose,layers=submit:moire:drizzle
or just moire:drizzle, when style=map happens.
Diffstat (limited to 'src/til_fb.h')
-rw-r--r-- | src/til_fb.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/til_fb.h b/src/til_fb.h index da86605..80ffeb4 100644 --- a/src/til_fb.h +++ b/src/til_fb.h @@ -80,6 +80,23 @@ static inline uint32_t til_fb_fragment_get_pixel_unchecked(til_fb_fragment_t *fr } +/* gets a pixel from the fragment, coordinates are clipped to the fragment's frame bounds */ +static inline uint32_t til_fb_fragment_get_pixel_clipped(til_fb_fragment_t *fragment, int x, int y) +{ + if (x < 0) + x = 0; + else if (x >= fragment->frame_width) + x = fragment->frame_width - 1; + + if (y < 0) + y = 0; + else if (y >= fragment->frame_height) + y = fragment->frame_height - 1; + + return til_fb_fragment_get_pixel_unchecked(fragment, x, y); +} + + /* puts a pixel into the fragment, no bounds checking is performed. */ static inline void til_fb_fragment_put_pixel_unchecked(til_fb_fragment_t *fragment, uint32_t flags, int x, int y, uint32_t pixel) { |