It is currently March 28th, 2024, 6:17 pm

What uses more resources? An image or a shape meter?

Get help with installing and using Rainmeter.
Post Reply
User avatar
Virginityrocks
Posts: 478
Joined: February 26th, 2011, 10:22 pm

What uses more resources? An image or a shape meter?

Post by Virginityrocks »

Let's assume I'm making a 500x500 rounded square image. I could use a 25x25 rounded image and ScaleMargins to stretch the image over the 500x500 space. Alternatively, I could use the Meter=Shape to create a similar rounded 500x500 rounded square with a specific fill color and stroke width.

Now let's assume I'm making several of these images. Which of these two methods would consume more resources?

Image
Last edited by Virginityrocks on March 31st, 2018, 2:41 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: What uses more resources? An image or a shape meter?

Post by balala »

Virginityrocks wrote:Which of these two methods would consume more resources?
I'd say that although I'm not exactly sure what the exact answer to your question is, but probably the image meter method consumes more resources, because resizing the images is a "hungry" operation. Beside this and beside what dvo said, the main advantage of creating Shape meters would be that the image is much easier to be modified. Depending on what would you like to achieve, many times this can be a great advantage.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: What uses more resources? An image or a shape meter?

Post by jsmorley »

Resizing an image from 25X25 to 500X500 and applying ScaleMargins on every skin redraw will be relatively "expensive" indeed. I can't quantify it, but I suspect using Shape meters would be quite a bit less expensive.

It takes a relatively large amount of "calculating" to resize a raster image from 25 to 500.

Probably the biggest factor to keep in mind is that images are "resized" on every skin redraw, not during the meter update. So using UpdateDivider=-1 on a static image doesn't help. With a Shape meter, all the "work" is done during the meter update and if the image is static, or should only change on demand when some other measure value changes, you can use UpdateDivider=-1 on it to drastically reduce the amount of CPU used.

On the other hand, if you can just create the image at 500X500, and not have to have any W or H on the meter at all, then there is virtually no work done by the image meter at all, and that is going to be the least expensive.

It's all relative of course, I doubt you will see any appreciable difference in any case unless you just have a boatload of these meters.
User avatar
Virginityrocks
Posts: 478
Joined: February 26th, 2011, 10:22 pm

Re: What uses more resources? An image or a shape meter?

Post by Virginityrocks »

*ScaleMargins, yes. That's what I meant to say.
jsmorley wrote:It's all relative of course, I doubt you will see any appreciable difference in any case unless you just have a boatload of these meters.
Quite a few. Enough to make at least a minor noticable difference on some PCs. Thank you. I'll start moving my image meters over to shapes.
F!.OW
Posts: 22
Joined: April 1st, 2018, 12:42 pm

Re: What uses more resources? An image or a shape meter?

Post by F!.OW »

Virginityrocks wrote:Which of these two methods would consume more resources?
When building my skins, this is something I've recently wondered about, but didn't know how to word it. Thanks for this.

I've been playing with the Shape Meter, but it hasn't been easy. I remember some users talking about creating a WYSIWYG editor for Rainmeter which is a terrible idea, but perhaps they could focus on making a shape builder or an SVG-to-Shape converter instead?

The scalability of shapes is a definite advantage, but creating more complex ones is the real challenge. I, too, would like to eventually replace my images with shapes.

If anyone is interested, here are some shapes I've created.
PYMp my shapes 2.0.rmskin
(2.7 KiB) Downloaded 39 times
PYMp my shapes V2.png
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: What uses more resources? An image or a shape meter?

Post by jsmorley »

There is a pretty good first pass at a .svg >> shape meter converter here:

https://forum.rainmeter.net/viewtopic.php?p=133076#p133076
F!.OW
Posts: 22
Joined: April 1st, 2018, 12:42 pm

Re: What uses more resources? An image or a shape meter?

Post by F!.OW »

jsmorley wrote:There is a pretty good first pass at a .svg >> shape meter converter here:

https://forum.rainmeter.net/viewtopic.php?p=133076#p133076
That's awesome! I'll definitely give it a run, thanks.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: What uses more resources? An image or a shape meter?

Post by jsmorley »

F!.OW wrote:That's awesome! I'll definitely give it a run, thanks.
That VectorConverter is pretty good, but be aware that it's a first pass, and that there are things that you can do in .svg that either the converter, or even Rainmeter itself just can't handle today. Gradient colors in shapes in .svg won't convert, and the conversion will fail for instance. But if your shapes are pretty standard, made up of rectangles and ellipses and curves and lines, and filled with solid colors, it works pretty well for me most of the time.

You can create the shapes in Inkscape, select all objects, resize the page to the size of the selected objects, and save as .svg. Then load that in VectorConverter and click "Convert". The Shape meter(s) code will be in your Windows clipboard.
F!.OW
Posts: 22
Joined: April 1st, 2018, 12:42 pm

Re: What uses more resources? An image or a shape meter?

Post by F!.OW »

jsmorley wrote:That VectorConverter is pretty good, but be aware that it's a first pass, and that there are things that you can do in .svg that either the converter, or even Rainmeter itself just can't handle today. Gradient colors in shapes in .svg won't convert, and the conversion will fail for instance. But if your shapes are pretty standard, made up of rectangles and ellipses and curves and lines, and filled with solid colors, it works pretty well for me most of the time.

You can create the shapes in Inkscape, select all objects, resize the page to the size of the selected objects, and save as .svg. Then load that in VectorConverter and click "Convert". The Shape meter(s) code will be in your Windows clipboard.
Thanks for the added information.

Most of the SVG files I've tried have worked flawlessly so far. If I do have gradients in my file, I've been replacing it with a solid color. From there, I would apply my gradient through Rainmeter. It's extra work, but that's nothing compared to trying to make a shape in Rainmeter manually.

I used to use Illustrator a number of years ago, so I found it difficult to switch to Inkscape. I'm currently using Affinity Designer, I can't stand Adobe's subscription model.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: What uses more resources? An image or a shape meter?

Post by jsmorley »

F!.OW wrote:Thanks for the added information.

Most of the SVG files I've tried have worked flawlessly so far. If I do have gradients in my file, I've been replacing it with a solid color. From there, I would apply my gradient through Rainmeter. It's extra work, but that's nothing compared to trying to make a shape in Rainmeter manually.

I used to use Illustrator a number of years ago, so I found it difficult to switch to Inkscape. I'm currently using Affinity Designer, I can't stand Adobe's subscription model.
Anything that can read and write .svg files is fine I expect.
Post Reply