Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#1

Compute screen proportion

  Alt 21. Jul 2012, 14:39
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:

Delphi-Quellcode:
var
  Ratio: Cardinal;
  Min, Max: Cardinal;
begin
  Min := Math.Min(AWidth, AHeight);
  Max := Math.Max(AWidth, AHeight);
  Ratio := Max - Min;

  Result := Round(Max / Ratio) + (Round(Min / Ratio) / 10);
end;
Returns 3:2, 4:3, 5:4, but not 5:3 (result is 2:2), 16:9 (result is 2:1), 16:10 (result is 3:2), 17:10 (result is 2:1). What's wrong?
  Mit Zitat antworten Zitat