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
 Drawing Units: BaseLayer=Bitmap; LayerN=PolylineLayer - Layer Units
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

andyhill

Australia
137 Posts

Posted - Feb 18 2025 :  17:25:40  Show Profile  Reply
My PC has a display of 144dpi per inch.

millimeter:= 1 * (Screen.PixelsPerInch * 25.4); // 57px per mm

BaseLayer is overlayed with PolyLine Layers

eg.
ImageEnView.LayersAdd(ielkPolyline);
with TIEPolylineLayer(ImageEnView.CurrentLayer) do begin
AddPoint(FrmTblRec.Left, FrmTblRec.Top, iepbBitmap); // 1, 1, 3779, 3779
AddPoint(FrmTblRec.Right, FrmTblRec.Top, iepbBitmap);
AddPoint(FrmTblRec.Right, FrmTblRec.Bottom, iepbBitmap);
AddPoint(FrmTblRec.Left, FrmTblRec.Bottom, iepbBitmap);
PolylineClosed:= True;

I want to draw on LayerN (points in millimeters)

Later I want to read from LayerN (PosX and PosY in millimeters)

I understand a scale needs to be set based against the BaseLayer, at present 3779px = 1mtr approx

Having a seniors moment, can we not just set drawing units per layer ?

Andy

xequte

38796 Posts

Posted - Feb 18 2025 :  22:36:07  Show Profile  Reply
Hi Andy

There is a helper method to perform these kinds of conversions:

http://www.imageen.com/help/IEConvertToUnits.html

e.g.

// Convert 4 inches to pixels at the current DPI of the image
in := IEConvertToUnits( 4, ieuInches, ieuPixels, ImageEnView1.IO.Params.DPI );


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: