It is currently May 25th, 2020, 2:50 pm

Different gradient directions

General topics related to Rainmeter.
User avatar
Yincognito
Posts: 1611
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Different gradient directions

Post by Yincognito »

Test skin:

Code: Select all

[Variables]

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=247,47,47,255
SolidColor2=47,47,247,255
GradientAngle=90
SkinWidth=200
SkinHeight=150

---Measures---

---Meters---

[MeterTestString]
Meter=STRING
X=0
Y=0
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=247,47,47,255
SolidColor2=47,47,247,255
GradientAngle=90
Padding=4,3,4,3
FontSize=14
AntiAlias=1
Text="Same  ?  #CRLF#Gradients"
DynamicVariables=1

[MeterTestShape]
Meter=Shape
X=0R
Y=0r
Shape=Rectangle 0,0,100,50 | Fill LinearGradient SameFillGradient | StrokeWidth 0
SameFillGradient=90 | 247,47,47,255 ; 0.0 | 47,47,247,255 ; 1.0
AntiAlias=1
DynamicVariables=1
Result:
Gradients.jpg
Question:
While not a bug or anything like that, is there any particular reason for the gradient on the Shape meter (top right corner) having the opposite direction compared to the gradient on both the skin and the String meter (top left corner) - despite all of them having the same gradient parameters? Is this intentional or it's just an unintentional, minor slip up at the time of the Shape meter's development?
Why I ask:
Because, despite using the same parameters, there will be inconsistencies between skins that draw their background (or meters) using the skin and String meter "style", compared to the ones that use a Shape to draw their background. Of course, a formula quickly solves this, but I had to ask.
You do not have the required permissions to view the files attached to this post.
User avatar
Brian
Developer
Posts: 1994
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Different gradient directions

Post by Brian »

"Slip up" is a bit strong to describe this inconsistency. I actually like to think of it more as a correction.

The difference actually showed up when the gradient inline setting for the string meter was introduced. By this time during development the string meter used D2D/Directwrite to draw any string options, while the rest of Rainmeter used GDI+. Since this was a "new" feature at the time combined with the different rendering systems, there was no real reason to compare the 2 at the time.

The SolidColor/SolidColor2 gradient has been around for a very long time. I can only speculate that the gradient angle direction was decided to follow the more traditional direction of plotting coordinates on a 2D graph to make more sense to the enduser (like in Geometry class). Normally the Y coordinates increase upward from the origin on a 2D graph. So, 90 degrees from any point on a 2D graph means you would rotate counter-clockwise to reach the endpoint. In computer graphics, the coordinate system is Y-flipped - meaning the X/Y origin is the upper-left of the screen with the Y coordinates increasing downward. This is why 90 degrees from a point, rotates clockwise.

By the time gradients where done for the Shape meter, we decided to re-use gradient code from inline settings since they both implemented with D2D. When we finally converted the rest of Rainmeter to D2D, we noticed the inconsistency and basically were stuck because of backwards compatibility. We even made a note in the code describing this. https://github.com/rainmeter/rainmeter/blob/master/Common/Gfx/Canvas.cpp#L682-L690

-Brian
User avatar
Yincognito
Posts: 1611
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Different gradient directions

Post by Yincognito »

Brian wrote:
April 12th, 2020, 9:07 pm
When we finally converted the rest of Rainmeter to D2D, we noticed the inconsistency and basically were stuck because of backwards compatibility. We even made a note in the code describing this. https://github.com/rainmeter/rainmeter/blob/master/Common/Gfx/Canvas.cpp#L682-L690
Yep, it makes sense. Many thanks for answering this in detail.
Brian wrote:
April 12th, 2020, 9:07 pm
"Slip up" is a bit strong to describe this inconsistency. I actually like to think of it more as a correction.
Probably, that's why I also added "minor" in front of it - but apparently this didn't dilute the strength of the term enough, as I originally wanted to. Sorry if it sounded too harsh, it was definitely not my intention - just couldn't find a milder expression to describe it (since "inconsistency" was already used later on in the message). :oops: