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
 TImageEnVect Built-in Rulers Calibrating Unit
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

rd3

Germany
2 Posts

Posted - Aug 03 2017 :  02:17:14  Show Profile  Reply
Hi there,

let's take a look at the MeasureIt-Example:
I understand this example. But what if I use rulers with calibrated units, let's say 211px is ONE centimeter...
Then I could use the following:

ImageEnVect1.MUnit := ieuCENTIMETERS;
ImageEnVect1.SetScaleFromPixels( 211, 1 );/
Ok, I got it.

But the rulers (built-in(prefered) rulers and/or TRulerBox)...Please could anybody extend the MeasureIt-Example to suit my need. The scale does not work if I calibrated via SetScaleFromPixels().

Does the Ruler somehow interact with the Scalefactor if not done automatically? If yes, how?

Please can anybody help me and extend the MeasureIt-sample? Please take a look at the image attached. The length of [miDragLen] is Ok, But the Ruler's scale obviously not.

Thanks in advance,

Cheers
Ralph (rd3)



xequte

39053 Posts

Posted - Aug 03 2017 :  23:57:27  Show Profile  Reply
Hi

Please try this updated ruler demo. It shows how to use DPI to specify the scale of the ruler.

attach/xequte/201783235719_ImageEnViewRulers.zip
53.7 KB

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

rd3

Germany
2 Posts

Posted - Aug 04 2017 :  02:29:23  Show Profile  Reply
Yes, that's it! Thanks!

Just for the guys who want to know also the solution without downloading...


procedure TForm1.pitSet4CMClick(Sender: TObject);
const
  CM_COUNT = 4;  // How many CM does our selection represent?
var
  dotsperCmX, dotsperCmY: Double;
begin
  // Set Dots per CM
  dotsperCmX := ImageEnView1.SelectedRect.width  / CM_COUNT;
  dotsperCmY := ImageEnView1.SelectedRect.height / CM_COUNT;

  // Set Dots per Inch
  ImageEnView1.IO.Params.DpiX := Round( dotsperCmX * CM_per_Inch );
  ImageEnView1.IO.Params.DpiY := Round( dotsperCmY * CM_per_Inch );

  ImageEnView1.Update();
end;

procedure TForm1.pitSetOneInchClick(Sender: TObject);
const
  INCH_COUNT = 1;  // How many inches does our selection represent?
begin
  // Set Dots per Inch
  ImageEnView1.IO.Params.DpiX := ImageEnView1.SelectedRect.width  div INCH_COUNT;
  ImageEnView1.IO.Params.DpiY := ImageEnView1.SelectedRect.height div INCH_COUNT;
  ImageEnView1.Update();
end;
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: