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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnVect Built-in Rulers Calibrating Unit

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
rd3 Posted - Aug 03 2017 : 02:17:14
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)



2   L A T E S T    R E P L I E S    (Newest First)
rd3 Posted - Aug 04 2017 : 02:29:23
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;
xequte Posted - Aug 03 2017 : 23:57:27
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