kernel: tweak gaussian deviation

So that the shadow doesn't look cut off or fuzzy.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-04-19 00:11:54 +01:00
parent eb2b0a6fa1
commit 452e313c64
4 changed files with 62 additions and 6 deletions

View File

@ -18,8 +18,16 @@ typedef struct conv {
double attr_pure sum_kernel(const conv *map, int x, int y, int width, int height);
double attr_pure sum_kernel_normalized(const conv *map, int x, int y, int width, int height);
/// Create a kernel with gaussian distribution of radius r
conv *gaussian_kernel(double r);
/// Create a kernel with gaussian distribution with standard deviation `r`, and size
/// `size`.
conv *gaussian_kernel(double r, int size);
/// Create a gaussian kernel with auto detected standard deviation. The choosen standard
/// deviation tries to make sure the outer most pixels of the shadow are completely
/// transparent.
///
/// @param[in] shadow_radius the radius of the shadow
conv *gaussian_kernel_autodetect_deviation(int shadow_radius);
/// preprocess kernels to make shadow generation faster
/// shadow_sum[x*d+y] is the sum of the kernel from (0, 0) to (x, y), inclusive