One of the meters that is not used as often in Rainmeter is the Bitmap meter. This is primarily due to the fact that the options can be a little hard to grasp at first, and that there is a fair amount of "outside" work that needs to be done in some kind of image editing tool.
However, if you take a little time to understand how it works, and are willing to use some creativity with PhotoShop or Gimp or Paint.NET or other image editor of choice, some very nice results can be had with this meter.
The Bitmap meter is an image-based meter that uses images laid out to create a bitmap. This is not the .bmp image format used in Windows, but a way in Rainmeter of talking about an image in any of the supported formats (.png, .jpg, .bmp, .tif) that can be divided into frames, based on the percentage value of a measure.
This is similar to how images are created for the Button meter, where the single image consists of equally sized frames, laid out either horizontally or vertically.
The meter then uses the percentage value of a measure in the option, to divide the image into the separate frames for display. All you have to do is tell the meter what the MeasureName is, and how many logical frames there are in the image with the BitmapFrames option. The meter will take it from there.
It might help first thing, to show an example of a bitmap image. We will use this image again later in one of our examples.
This is simply a .png image with the 10 numbers from 0 to 9, laid out horizontally and equally spaced. The image is 640 pixels wide, with each of the numbers taking up 64 pixels of width.
With this image, if we set a Bitmap meter with , it will use the percentage measure value with that number of frames to determine which part of the image, which "frame", to display. This will become clearer as we look at our examples.
First, here is a .rmskin with all three examples we will be discussing:
Simpy install this .rmskin, and in Manage you can load the skin that you want to play with.
Our first example uses the percentage value of a measure and displays the frame from the bitmap image that corresponds. This is the most basic and perhaps the most common use for a Bitmap meter.
Code: Select all
[Rainmeter] Update=1000 [MeasureDayofYear] Measure=Time Format=%#j MinValue=1 MaxValue=366 [MeterBitmapValue] Meter=Bitmap MeasureName=MeasureDayofYear BitmapImage=#@#Images\Quarters.png BitmapFrames=4 [MeterDayOfYear] Meter=String MeasureName=MeasureDayofYear X=50 Y=4R FontSize=12 FontColor=241,199,108,255 SolidColor=47,47,47,255 Padding=2,2,2,2 StringAlign=Center AntiAlias=1 Text=Day: %1
Then we have our bitmap image, in this case laid out with four "frames":
The meter will take the percentage that the measure value is at, divide the image into four BitmapFrames "frames", and display the portion of the image that corresponds to the percentage range. So in this case, the first quarter of the year is from day 1 to day 92 (1/4 of 365) and day 68 falls in that first 1/4 of the range. That "frame" of the image is displayed.
Another use of the Bitmap meter is to display an animation. For this use, you simply create a bitmap image with as many "frames" as you want in your animation, and loop through them one at a time.
Code: Select all
[Rainmeter] Update=45 [MeasureAnimLoop] Measure=Calc Formula=(MeasureAnimLoop + 1) % 37 MinValue=0 MaxValue=38 [MeterAnim] Meter=Bitmap MeasureName=MeasureAnimLoop BitmapImage=#@#Images\XAnim.png BitmapFrames=37
Our counter Calc measure simply counts from 0 to 37, the same number we have in , and displays that "frame" on each update. We are controlling the speed of the animation with the option in the [Rainmeter] section of the skin.
The last example we will show uses a very powerful additional feature of the Bitmap meter. This allows us to use the meter to display a measure value's number as images, one for each "digit" of the value.
First, let's look at our result, code and the bitmap image we use. Then we will explain a bit how it works.
Code: Select all
[Rainmeter] Update=1000 [MeasureCPU] Measure=CPU [MeterCellBack1] Meter=Image ImageName=#@#Images\CellBack.png X=0 Y=0 [MeterCellBack2] Meter=Image ImageName=#@#Images\CellBack.png X=3R Y=0r [MeterCellBack3] Meter=Image ImageName=#@#Images\CellBack.png X=3R Y=0r [MeterCPU] Meter=Bitmap MeasureName=MeasureCPU X=8 Y=8 BitmapImage=#@#Images\Numbers.png BitmapFrames=10 BitmapExtend=1 BitmapDigits=3 BitmapSeparation=12 [MeterCellFore1] Meter=Image ImageName=#@#Images\CellFore.png X=0 Y=0 [MeterCellFore2] Meter=Image ImageName=#@#Images\CellFore.png X=3R Y=0r [MeterCellFore3] Meter=Image ImageName=#@#Images\CellFore.png X=3R Y=0r
First off, the meter is being driven by a simple CPU measure, which will return a percentage value from 0 to 100.
Next we have our bitmap image. If we think back to how the Bitmap meter worked for us in the BitValue example, We had a "frame" for each of the percentage value ranges that the measure returns. We certainly don't want to have to create a gigantic image that has all the possible numbers between 000 and 100, that would be a massive undertaking and make for a very large image file.
Let's see how we solve this...
Three additional options
With this option, you tell the meter how many digits the value can consist of. Since we are measuring a percentage between 0 and 100, the number of digits we want to display is 3.
If set to , this will tell the meter to "extend" the display, to show frames, with each corresponding to the "digit" of the measure value. So if the measure value is as in our example, the meter will extend to display the frames for "0", "2" and "5".
This is used to help with positioning the frames when . You can use a negative or positive number to move the position of the frames relative to each other to the left or right (or up and down if the bitmap image is laid out vertically) until you get the look you want.
Take a close look at the code for this example above, hopefully it will become clear when you play around with it a bit.
Hope this helps with understanding the Bitmap meter. It can be used to create some very creative and active skins.