It is currently April 27th, 2024, 7:21 pm

Problem with BarImage

Get help with creating, editing & fixing problems with skins
FroznSmoke
Posts: 2
Joined: May 28th, 2012, 11:02 am

Problem with BarImage

Post by FroznSmoke »

Hey Rainmeter Forums,

Note: I just started with Rainmeter a while ago so I want to apologize for "dirty" coding and dump mistakes in advance!

Now to my problem:
I am working on a skin at the moment that should look exactly like the ingame menu from Starcraft 2. In the game thy use bars to display how many games one has won. I want to use those to display the harddrives of the computer the skin is running on. I got the exact images out of the gamefolder and have a little problem now. The bar image is the whole bar in its maximum stage, so it seemed perfect to simply use it as a bar image
BUT it has this kind of glow to it. I can cut out the beginning of the bar, the glow part, and place it as an ImageMeter, using the rest of the image as a normal BarImage, but now the end part of the glow gets cut out if the value is below 100%.
I tried to place the end part of the bar as an ImageMeter aswell with the x value on X=R but then it gets placed at the maximum end of the bar.
Using a BITMAP would be my final option, but i dont want to create a 4000 pixel long image file with various versions of the bar.

Code: Select all

[MeasureUsedDisk1]
Measure=FreeDiskSpace
Drive=#disk1#
InvertMeasure=1
UpdateDivider=120


[MeterBarStartDisk1]
Meter=IMAGE
ImageName="#ImagePath#\AmountBarStart.png"
X=600
Y=500

[MeterBarDisk1]
Meter=BAR
BarImage="#ImagePath#\AmountBar.png"
MeasureName=MeasureUsedDisk1
BarOrientation=Horizontal
Flip=0
X=632
Y=500
I hope there is a solution! Thanks for your help!
Greetz Frozn
You do not have the required permissions to view the files attached to this post.
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: Problem with BarImage

Post by AlC »

Hey,

yes with the Bar Meter this would be a little difficult (you can with calcs ...), but I tried it with the Image Meter + ScaleMargins and it works fine.

Example Code with a counter instead of the disk measure:

Code: Select all

[Rainmeter]
Update=100
DynamicWindowSize=1

[cC]
Measure=Calc
Formula=cC%100+1

[HDD]
Meter=IMAGE
ImageName=AmountBar.png
W=(404*([cC]/100)+45)
H=78
ScaleMargins=25,0,25,0
DynamicVariables=1

[cDebug]
Measure=Calc
Formula=(404*([cC]/100)+45)
DynamicVariables=1

[sDebug]
Meter=String
Y=R
Text="[cDebug] = Width#CRLF#[cC] = Value"
DynamicVariables=1
Rainmeter - You are only limited by your imagination and creativity.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problem with BarImage

Post by jsmorley »

This will take a little doing, but not impossible.

First, I don't think you need the "starting" image. Just have the left side of the main bar image have the glow as you like.

Now, to get the end, what you will need is an "ending" image. It more or less is your current starting image flipped horizontally.

Then you need to have Rainmeter figure out where to put the ending image. It won't be just relative to the main bar, as that will stick it way out at the end of the total width of the bar image. It needs to be relative to the current value of the Bar meter.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
BarImageWidth=449
disk1=C:
ImagePath=#ROOTCONFIGPATH#

[MeasureUsedDisk1]
Measure=FreeDiskSpace
Drive=#disk1#
InvertMeasure=1
UpdateDivider=120

[MeasureTotalDisk1]
Measure=FreeDiskSpace
Drive=#disk1#
Total=1
UpdateDivider=120

[MeasureCalc1]
Measure=Calc
Formula=([MeasureUsedDisk1] / [MeasureTotalDisk1])
DynamicVariables=1

[MeterBarDisk1]
Meter=BAR
BarImage="#ImagePath#\AmountBar.png"
MeasureName=MeasureUsedDisk1
BarOrientation=Horizontal
Flip=0
X=632
Y=500

[MeterBarEndDisk1]
Meter=Image
ImageName="#ImagePath#\AmountBarEnd.png"
X=(#BarImageWidth# * [MeasureCalc1] + 632)
Y=0r
DynamicVariables=1
So what I do is add a couple more measures. One to get the "total" disk space, so we can use that to figure out the percentage of the total the current "free" space is using a second Calc measure. We also need a variable to hold the total width of the bar image.

Now we can use a formula (be sure you are using Rainmeter 2.3 beta at http://rainmeter.net) in the X= option for the "end" image, to correctly place it at the end of the current bar value.

You might need to play with the images so the fade out of the "glow" looks right, but this is the general approach.
5-28-2012 8-34-21 AM.jpg
You do not have the required permissions to view the files attached to this post.
FroznSmoke
Posts: 2
Joined: May 28th, 2012, 11:02 am

Re: Problem with BarImage

Post by FroznSmoke »

Thanks sooo much!!! What you did there jsmorley was exactly what i tried, but i didnt know how. Thanks alot! I saw you solve alot of problems around here, keep it up! :thumbup:
Also thanks to ALC. I guess I'll need that sometime!
Greetz Frozn :)
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problem with BarImage

Post by jsmorley »

Glad to help.