ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Change units of measure
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

rico

Russia
6 Posts

Posted - Jul 18 2013 :  10:48:24  Show Profile  Reply
Property "AcquireParams.PhysicalWidth" returns the data in inches. How to switch the units to millimeters?

w2m

USA
1990 Posts

Posted - Jul 18 2013 :  13:36:59  Show Profile  Reply
There is not a method to do this. You have to do it yourself:
var
  i: integer;
  iPhysicalWidthINCH: double;
  iPhysicalHeightINCH: double;
  iPhysicalWidthMM: double;
  iPhysicalHeightMM: double;
  iPhysicalWidthPixels: integer;
  iPhysicalHeightPixels: integer;
  iString: string;
begin
  iPhysicalWidthINCH := ImageEnView1.IO.AcquireParams.PhysicalWidth;
  PhysicalWidthINCH1.Caption := 'Physical Width (Inch): ' +
    FormatFloat('##.##', iPhysicalWidthINCH);

  iPhysicalHeightINCH :=
      ImageEnView1.IO.AcquireParams.PhysicalHeight;
  PhysicalHeightINCH1.Caption := 'Physical Height (Inch): ' +
    FormatFloat('##.##', iPhysicalHeightINCH);

  iPhysicalWidthMM := ImageEnView1.IO.AcquireParams.PhysicalWidth * 25.4;
  PhysicalWidthMM1.Caption := 'Physical Width (mm): ' + FormatFloat
    ('####', (iPhysicalWidthMM));

  iPhysicalHeightMM := ImageEnView1.IO.AcquireParams.PhysicalHeight * 25.4;
  PhysicalHeightMM1.Caption := 'Physical Height (mm): ' + FormatFloat('####', iPhysicalHeightMM);

  iPhysicalWidthPixels := ImageEnView1.IO.AcquireParams.PhysicalWidthPixels;
  { Add commas to string }
  iString := IntToStr(iPhysicalWidthPixels);
  i := Length(iString) - 2;
  while i > 1 do
  begin
    Insert(SysUtils.ThousandSeparator, iString, i);
    i := i - 3;
  end;

  PhysicalWidthPixels1.Caption := 'Physical Width (pixels): ' + iString;
  { Add commas to string }
  iPhysicalHeightPixels := ImageEnView1.IO.AcquireParams.PhysicalHeightPixels;
  iString := IntToStr(iPhysicalHeightPixels);
  i := Length(iString) - 2;
  while i > 1 do
  begin
    Insert(SysUtils.ThousandSeparator, iString, i);
    i := i - 3;
  end;
  PhysicalHeightPixels1.Caption := 'Physical Height (pixels): ' + iString;
end;

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: