melatonin_blur icon indicating copy to clipboard operation
melatonin_blur copied to clipboard

Using spread will mess up the aspect ratio of the shadow

Open christoph-hart opened this issue 1 year ago • 1 comments

I'm writing a CSS renderer in JUCE and your blur module does the job almost perfectly. However the following CSS code:

{
	background: #666;
	height: 80px;
	margin: 20px;
	border: 5px solid green;
	box-shadow: 0px 0px 0px  5px    red;	
        /*          x   y   blur spread color */
}

renders this output:

image

This is because it retains the aspect ratio of the path when using spread. If I change the scaling to not preserve the aspect ratio by passing in false as last parameter here:

https://github.com/sudara/melatonin_blur/blob/ae44478ff6de763551923c37afb0c81ea96243a8/melatonin/internal/rendered_single_channel_shadow.cpp#L28

I get this beauty:

image

Is there a reason why you retain the aspect ratio of the path when scaling up? Looks good with a square, not so good with any other shape :)

christoph-hart avatar Mar 13 '24 22:03 christoph-hart

Hi there!

I totally missed this, didn't get a notification. I think I was on vacation?..

a CSS renderer in JUCE

Wow!

almost perfectly

I'll take it!

Is there a reason why

Sounds like a bug worth resolving. I'd be happy to take a PR for it if you felt motivated, especially if there's a test case added for it. Otherwise I can take a look...

sudara avatar May 11 '24 18:05 sudara