It is currently March 28th, 2024, 10:19 pm

PreserveAspectRatio

Changes made during the Rainmeter 2.5 beta cycle and earlier.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

PreserveAspectRatio

Post by jsmorley »

We have added a new setting of PreserveAspectRatio=2 to Image meters. The purpose of this new setting for the option is to cause the image to be sized and cropped to FILL the area defined by W and H on the meter.

Previously you could use:

PreserveAspectRatio=0 with W and H to STRETCH an image to the defined area without preserving the aspect ratio.

PreserveAspectRatio=1 with any combination of W and H to FIT an image into the defined area while preserving the aspect ratio.

Now in addition you can:

PreserveAspectRatio=2 with both W and H to FILL a defined area by sizing and cropping the image while preserving the aspect ratio.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeterOrig]
Meter=Image
ImageName=#@#Images\kroes.jpg
SolidColor=233,194,159
X=(62 / 2)
Y=(57 / 2)
W=438
H=287

[MeterFrame0]
Meter=Image
ImageName=#@#Images\frame.png
X=0
Y=0
ImageAlpha=130

[Meter1]
Meter=Image
ImageName=#@#Images\kroes.jpg
SolidColor=233,194,159
X=(502 + (62 / 2))
Y=(57 / 2)
W=438
H=287
PreserveAspectRatio=1

[MeterFrame1]
Meter=Image
ImageName=#@#Images\frame.png
X=502
Y=0
ImageAlpha=130

[Meter2]
Meter=Image
ImageName=#@#Images\kroes.jpg
SolidColor=233,194,159
X=(1004 + (62 / 2))
Y=(57 / 2)
W=438
H=287
PreserveAspectRatio=2

[MeterFrame2]
Meter=Image
ImageName=#@#Images\frame.png
X=1004
Y=0
ImageAlpha=130
PreserveAspectRatio_1.0.rmskin
8-19-2012 10-37-59 AM.jpg
The first image is "stretched" to the area, the second is made to "fit" the area, and the third is made to "fill" the area.

This new setting should allow a lot more flexibility in how you make images of various sizes fit into your skin design.
You do not have the required permissions to view the files attached to this post.
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: PreserveAspectRatio

Post by MerlinTheRed »

Yes! You are my heroes!
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: PreserveAspectRatio

Post by KreAch3R »

Nicely done guys. :)
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
VClouds
Posts: 77
Joined: April 7th, 2010, 2:34 pm

Re: PreserveAspectRatio

Post by VClouds »

Excellent!
This fixes the problem of many slideshow skins... :thumbup:
User avatar
Mordasius
Posts: 1167
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: PreserveAspectRatio

Post by Mordasius »

Nice work Dev Team.. :)

But what I'd really like to know is how you got the model to stay still and not giggle while you did all that STRETCHing, FITing and FILLing to get the photos in the attachment.
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: PreserveAspectRatio

Post by thatsIch »

Yes, good thing I havent worked on that :D

Good Job!

€: ok now the question: can you set an alignment for the image, like
centercenter (default) topcenter, bottomleft etc
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: PreserveAspectRatio

Post by jsmorley »

thatsIch wrote:Yes, good thing I havent worked on that :D

Good Job!

€: ok now the question: can you set an alignment for the image, like
centercenter (default) topcenter, bottomleft etc
No, the cropping will always be either top/bottom or left/right, and it is an even amount on each side. If you want to have more control over the cropping, then just use some math and ImageCrop instead.