|
using System;
using System.Windows;
using System.Windows.Media;
namespace RZWScreenSaver{
static class SizeScaleExtension{
static public bool IsPortrait(this Size size){
return size.Height > size.Width;
}
static public Size ScaleToArea(this Size size, double newArea){
var width = Math.Sqrt(newArea*size.Width/size.Height);
var height = newArea/width;
return new Size(width,height);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.