It is currently April 25th, 2024, 4:23 am

Semitranslucent Image with ColorMatrix

Tips and Tricks from the Rainmeter Community
User avatar
XANCI
Posts: 104
Joined: September 18th, 2011, 6:37 am
Location: Nanjing, China

Semitranslucent Image with ColorMatrix

Post by XANCI »

Sometimes we want our skin customized to various colors, not only in Font, but also IMAGE meters
Here is the color we want to paint: (R,G,B)

A simple way is to draw your image in black (0,0,0,1), then add this

Code: Select all

ColorMatrix4=R/255;G/255;B/255;1;0
makes (0,0,0,1) to (R,G,B,1)

If your image have some semitranslucent parts, say (0,0,0,0.2), you want (R,G,B,0.2)
but with

Code: Select all

ColorMatrix4=R/255;G/255;B/255;1;0
you got (0.2R,0.2G,0.2B,0.2), this looks inadequately-painted

Lets redraw your semitranslucent parts to full white (1,1,1,1), then do a little math and apply

Code: Select all

ColorMatrix1=0;0;0;-0.2666;0
ColorMatrix2=0;0;0;-0.2666;0
ColorMatrix3=0;0;0;-0.2666;0
ColorMatrix4=R/255;G/255;B/255;1;0
then you have (0,0,0,1) to (R,G,B,1), and (1,1,1,1) to (R,G,B,0.2)

with this you can have both color & transparency costomized at the same time, have some try :)
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Semitranslucent Image with ColorMatrix

Post by smurfier »

Doesn't ImageTint do the same thing?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
yudaweb
Posts: 21
Joined: September 29th, 2011, 3:49 am

Re: Semitranslucent Image with ColorMatrix

Post by yudaweb »

lets say i want a text with 100% transparent on 1st state.

onmousehover i want 100% opaque
onmouseleave i want 100% transparent (falls back to 1st state)

can sum1 writedown ur code for us coz i've been trying to figure it out
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Semitranslucent Image with ColorMatrix

Post by jsmorley »

yudaweb wrote:lets say i want a text with 100% transparent on 1st state.

onmousehover i want 100% opaque
onmouseleave i want 100% transparent (falls back to 1st state)

can sum1 writedown ur code for us coz i've been trying to figure it out
You can't have a meter that is 100% transparent use a MouseOverAction. If a meter has an alpha of zero, Rainmeter ignores it. However you can do something like this:

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeterTest]
Meter=String
FontSize=15
FontColor=255,255,255,1
SolidColor=0,0,0,1
Text=Hello World
MouseOverAction=!SetOption #CURRENTSECTION# FontColor 255,255,255,255
MouseLeaveAction=!SetOption #CURRENTSECTION# FontColor 255,255,255,1

An "alpha" of 1 is effectively invisible, while still being seen and acted upon by Rainmeter. The "SolidColor" is just there to make it easier for the mouse to see the meter object better. Without it, only the solid part of the font would be active, and it can be hard to click on things or otherwise have the mouse work on a font without having to "hunt" for solid areas. SolidColor=0,0,0,1 makes the entire meter have a square area, defined by the text, that is virtually invisible while being solid enough to support mouse actions.