Forum: Multimedia
Delphi
by WojTec,
23. Jul 2012
@Furtbichler, I tested a few inputs and I see 0.45 is ok. Could you confirm?
Forum: Multimedia
Delphi
by WojTec,
23. Jul 2012
Hm, it's a bit wrong (721:4) :o
Forum: Multimedia
Delphi
by WojTec,
23. Jul 2012
Here you are :)
function GetScreenAspectRatio(const AWidth, AHeight: Cardinal): Single;
function LCD(v1, v2: Cardinal): Word;
begin
Result := 0;
if (v1 > 0) and (v2 > 0) then
begin
Forum: Multimedia
Delphi
by WojTec,
22. Jul 2012
I modified @Amateurprofi code to support x:10, changed to return float and wrote format function:
function GetScreenProportion(const AWidth, AHeight: Cardinal): string;
var
AspectRatio: Single;
X, Y: Extended;
begin
AspectRatio := GetScreenAspectRatio(AWidth, AHeight);
X := Int(AspectRatio);
Y := Frac(AspectRatio) * 100;
Forum: Multimedia
Delphi
by WojTec,
22. Jul 2012
Thanks, but for eg. 1024x768 returns 'nonstandard' :(
Forum: Multimedia
Delphi
by WojTec,
21. Jul 2012
Next attempt:
function ToFrac(const AValue: Extended; const ADivisor: Word; const AFrac: Boolean): string;
var
A, B: Integer;
I, F: Extended;
begin
B := ADivisor;
I := Int(AValue);
F := Frac(AValue);
Forum: Multimedia
Delphi
by WojTec,
21. Jul 2012
I'm just working with images in PS and start think about image proportions. Some images has quite big size and I'm interested what is its proportion. So, I ran Delphi and wrote:
var
Ratio: Cardinal;
Min, Max: Cardinal;
begin
Min := Math.Min(AWidth, AHeight);
Max := Math.Max(AWidth, AHeight);
Ratio := Max - Min;