Page 1 of 1

[Suggestion] Basic Shadow & Blur for Shapes and Bar Meters

Posted: June 18th, 2018, 7:58 am
by Amplifyr
The String Shadow has been there for quite some time. But, we haven't seen the feature extend to other Meters in Rainmeter. Here are a couple of things that I would like to see come to Rainmeter soon.
  1. Would like a basic blur for shape meters. I'm not talking about blurring the background behind the shapes like Acrylic or Aero, but the shape itself. A blurry rectangle or oval etc.
  2. I would like to have basic shadows for shape meters and bar meters. Implementing the blur feature above should enable you to do this. As we already have a good shadow setting for string meters. This shouldn't be too hard (especially for bars and rectangles.)
I feel these features are somewhat long due. Hope they get implemented soon. :)

Re: [Suggestion] Basic Shadow & Blur for Shapes and Bar Meters

Posted: November 1st, 2020, 12:05 am
by mpurses
I would love this feature as well. When making the Daylight curves via equations in my World Map skin, I would love to make these via the shape meter. But have to do it by making images that have the edge blur I want...
Space-Locations2.png
https://www.deviantart.com/michaelpurses/art/Sonder-Rainmeter-skin-838147223

Re: [Suggestion] Basic Shadow & Blur for Shapes and Bar Meters

Posted: November 1st, 2020, 2:06 am
by Jeff
Judging by the Github repo, they're probably waiting for the original Direct2D dev to come back, which *checks clock on hand*, yeah it's gonna be some time. Looking at the code they even use the effect call that works on all bitmaps and it's not specific to text.
Use MagickMeter in the meanwhile until the devs ditch windows 7 to add all D2D effects

Re: [Suggestion] Basic Shadow & Blur for Shapes and Bar Meters

Posted: November 1st, 2020, 2:14 am
by Jeff
Just realized this thread is 2 years old

Re: [Suggestion] Basic Shadow & Blur for Shapes and Bar Meters

Posted: November 2nd, 2020, 12:04 pm
by Bekarfel

Re: [Suggestion] Basic Shadow & Blur for Shapes and Bar Meters

Posted: November 2nd, 2020, 1:57 pm
by Jeff
Bekarfel wrote: November 2nd, 2020, 12:04 pm There is a plugin that will do this
https://forum.rainmeter.net/viewtopic.php?f=127&t=23106
This plugin just adds a style to the child window (skins windows form) that uses Windows 10's Blur and that style can be seen as the acrylic blur on the entire bounding box of the skin, it doesn't add shadow effects to the meters like OP said

Re: [Suggestion] Basic Shadow & Blur for Shapes and Bar Meters

Posted: November 2nd, 2020, 5:11 pm
by Yincognito
Yep, this is a bit problematic to do with the current Rainmeter capabilities. So far, there are more or less 2 solutions for it, but they are not perfect and require a certain scenario in order to work:

- for "regular" shapes (i.e. a circle, a rectangle), something similar to a blur can be achieved by applying a linear or radial gradient from full opacity to full transparency on either the fill color of the shape or its stroke color
- for "irregular shapes", a similar effect can be achieved by replicating the meter into multiple similarly shaped but larger meters that are filled with a gradually "fading" (in terms of transparency) color

As for the daylight map (nice one, by the way), a somewhat similar effect to bluring its "edges" can potentially be achieved / approximated by drawing something like this (I took the interactive cubic bezier shape example here as a base, but obviously it can be adjusted to other scenarios, including sin() and cos() ones)...

Code:

Code: Select all

[Variables]
; BC = Base Color; SW = Stroke Width; AC = Alpha Change
BC=255,0,0
SW=2
AC=(255/5)

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255

---Meters---

[Curve]
Meter=Shape
Shape=Curve 100,250,400,250,100,100,400,100,0 | StrokeWidth #SW# | Stroke Color #BC#,255
Shape2=Curve (100-#SW#*1),250,(400+#SW#*1),250,(100-#SW#*1),(100-#SW#*1),(400+#SW#*1),(100-#SW#*1),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*1)
Shape3=Curve (100-#SW#*2),250,(400+#SW#*2),250,(100-#SW#*2),(100-#SW#*2),(400+#SW#*2),(100-#SW#*2),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*2)
Shape4=Curve (100-#SW#*3),250,(400+#SW#*3),250,(100-#SW#*3),(100-#SW#*3),(400+#SW#*3),(100-#SW#*3),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*3)
Shape5=Curve (100-#SW#*4),250,(400+#SW#*4),250,(100-#SW#*4),(100-#SW#*4),(400+#SW#*4),(100-#SW#*4),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*4)
Shape6=Curve (100-#SW#*5),250,(400+#SW#*5),250,(100-#SW#*5),(100-#SW#*5),(400+#SW#*5),(100-#SW#*5),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*5)
Preview:
Blur Simulation - Curve.jpg
So yeah, as I said, while the shape replication is not a problem in itself, it's a bit problematic to get the shape "segments" right, depending on how irregular the shape is. Thus, in some cases, using an image instead becomes simpler, depending on context.

Re: [Suggestion] Basic Shadow & Blur for Shapes and Bar Meters

Posted: November 4th, 2020, 2:36 pm
by mpurses
Yincognito wrote: November 2nd, 2020, 5:11 pm Yep, this is a bit problematic to do with the current Rainmeter capabilities. So far, there are more or less 2 solutions for it, but they are not perfect and require a certain scenario in order to work:

- for "regular" shapes (i.e. a circle, a rectangle), something similar to a blur can be achieved by applying a linear or radial gradient from full opacity to full transparency on either the fill color of the shape or its stroke color
- for "irregular shapes", a similar effect can be achieved by replicating the meter into multiple similarly shaped but larger meters that are filled with a gradually "fading" (in terms of transparency) color

As for the daylight map (nice one, by the way), a somewhat similar effect to bluring its "edges" can potentially be achieved / approximated by drawing something like this (I took the interactive cubic bezier shape example here as a base, but obviously it can be adjusted to other scenarios, including sin() and cos() ones)...

Code:

Code: Select all

[Variables]
; BC = Base Color; SW = Stroke Width; AC = Alpha Change
BC=255,0,0
SW=2
AC=(255/5)

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255

---Meters---

[Curve]
Meter=Shape
Shape=Curve 100,250,400,250,100,100,400,100,0 | StrokeWidth #SW# | Stroke Color #BC#,255
Shape2=Curve (100-#SW#*1),250,(400+#SW#*1),250,(100-#SW#*1),(100-#SW#*1),(400+#SW#*1),(100-#SW#*1),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*1)
Shape3=Curve (100-#SW#*2),250,(400+#SW#*2),250,(100-#SW#*2),(100-#SW#*2),(400+#SW#*2),(100-#SW#*2),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*2)
Shape4=Curve (100-#SW#*3),250,(400+#SW#*3),250,(100-#SW#*3),(100-#SW#*3),(400+#SW#*3),(100-#SW#*3),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*3)
Shape5=Curve (100-#SW#*4),250,(400+#SW#*4),250,(100-#SW#*4),(100-#SW#*4),(400+#SW#*4),(100-#SW#*4),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*4)
Shape6=Curve (100-#SW#*5),250,(400+#SW#*5),250,(100-#SW#*5),(100-#SW#*5),(400+#SW#*5),(100-#SW#*5),0 | StrokeWidth #SW# | Stroke Color #BC#,(255-#AC#*5)
Preview:
Blur Simulation - Curve.jpg
So yeah, as I said, while the shape replication is not a problem in itself, it's a bit problematic to get the shape "segments" right, depending on how irregular the shape is. Thus, in some cases, using an image instead becomes simpler, depending on context.


Thank you for that example, I'll play around with that way and see where I get. My equation for the curves (https://www.desmos.com/calculator/whscclvtn2) aren't the easiest to play with so that's why I gave up early on and went with images.

Re: [Suggestion] Basic Shadow & Blur for Shapes and Bar Meters

Posted: November 4th, 2020, 3:17 pm
by Yincognito
mpurses wrote: November 4th, 2020, 2:36 pm Thank you for that example, I'll play around with that way and see where I get. My equation for the curves (https://www.desmos.com/calculator/whscclvtn2) aren't the easiest to play with so that's why I gave up early on and went with images.
Yep, it's not that the equation is complicated, because it's not, at least not in my view (I worked with somewhat similar equations in my solar system simulator skin) - it's the fact that because Rainmeter lacks the FOR..NEXT type of statements, using such equations is better suited for positioning / moving a point along that graph, rather than drawing the entire graph using trigonometric functions. As for replicating this using the cubic bezier shape, although at first sight it would be a similar curve to that in my sample above, joined with the same curve flipped vertically, on a second look it would take more such curves to make the shapes / graphs identical.

So yeah, for this case, the image based approach is more suited. Obviously, that doesn't stop you from playing with the shape approach, but my guess is that it would take a Path shape made of multiple cubic bezier Curves (probably 3 repeating and/or flipped) to get exactly the same look.

There is also the CPU usage side of it. I'm still not sure which approach would be lighter on the CPU, especially on larger meters. Probably the image based one, but that's just speculation and not being actually tested.