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
 Drawing a polygon

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
yeohray2 Posted - Jan 18 2023 : 02:06:13
I need to draw a polygon, using the mlDrawCreatePolylineLayers setting. However, I find that I can draw smoother shapes using the miSelectPolygon setting (then create a polyline layer from the selection). It's more obvious when using a pen on a touch screen to draw the area - especially the 2nd point in the polyline layer - there seems to be an area around the first point where it will not register any changes. Using the miSelectPolygon, it's easier to draw an arbitrary shape.

Are there any settings to have the mlDrawCreatePolylineLayers setting be as responsive as the miSelectPolygon setting?

Also, there is a pause when I set the MouseInteractLayers := [mlDrawCreatePolylineLayers], before I can start drawing. Is this normal?

Thanks in advance.
Ray
10   L A T E S T    R E P L I E S    (Newest First)
yeohray2 Posted - Jan 27 2023 : 04:24:08
Hi NIgel,

I don't think anything is wrong at this point. There is just an unavoidable delay due to having to initialize the GDI+ stuff. Or were you expecting a different result?

Basically I load the image and set up the settings you suggested:

procedure TForm30.FormShow(Sender: TObject);
begin
  viewPen.IO.LoadFromFile('f:\temp\test.bmp');
  viewPen.Proc.AutoUndo := False;
  viewPen.EnableInteractionHints := True;
  IEGlobalSettings.HintStyle.Transparency := 255;
  viewPen.Update;
end;


I then have another button where I set the polyline drawing mode:

procedure TForm30.Button2Click(Sender: TObject);
begin
  viewPen.LayersAutoClosePolylines := iecmAlways;
  viewPen.MouseInteractLayers := [mlDrawCreatePolylineLayers];
end;


It is during this event that there is a delay. Which is fine because I now know to initialize the GDI+ stuff in an earlier part of my application to avoid this delay.

Ray
xequte Posted - Jan 23 2023 : 18:24:10
Sorry Ray, I'm not sure what is happening here. When setting MouseInteractLayers := [mlDrawCreatePolylineLayers], InitGDIPFont should be called automatically if EnableInteractionHints is enabled.

Nigel
Xequte Software
www.imageen.com
yeohray2 Posted - Jan 22 2023 : 10:46:54
Hi,

Settings the HintStyle.Transparency property doesn't make a difference on my system - the delay is still the same for the first call to MouseInteractLayers := [mlDrawCreatePolylineLayers];

Ray
xequte Posted - Jan 21 2023 : 15:37:34
Hi

Please try:

IEGlobalSettings().HintStyle.Transparency := 255;

And let me know if it prevents the delay completely.

Nigel
Xequte Software
www.imageen.com
yeohray2 Posted - Jan 20 2023 : 19:30:54
I didn't try that. I just called something like

viewInitGDI.IEBitmap.IECanvas.MeasureText(' ');

during a 'busy' period to initialize it and hide the delay :)
xequte Posted - Jan 20 2023 : 16:06:54
Hmmm, so if you set:

IEGlobalSettings().HintStyle.Transparency := 255;

It resolves the issue? I might make that the default for the next update.

Nigel
Xequte Software
www.imageen.com
yeohray2 Posted - Jan 20 2023 : 03:13:28
On my machine (i5-8400), it takes about 2.5 seconds before the mouse is responsive after the call to viewMain.MouseInteractLayers := [mlDrawCreatePolylineLayers];, in both debug and release modes, in both 32 and 64-bits.

And yes, it's the call to InitGDIPFont that's causing the delay. I'll follow the suggestions here (https://www.imageen.com/ieforum/topic.asp?TOPIC_ID=3727) to initialize it earlier.
xequte Posted - Jan 19 2023 : 14:46:51
Hi Ray

Sometimes the initialization of GDI+ can take a moment.

To disable undo:

ImageEnView1.Proc.AutoUndo := false;

Nigel
Xequte Software
www.imageen.com
yeohray2 Posted - Jan 19 2023 : 00:36:31
Hi Nigel,

Thanks for the suggestions, I'll play around with them and see how it goes.

Yes, the pause before drawing, it happens only the first time. How do you turn off undo? Is it to set the LayersCaching := 0;?

Ray
xequte Posted - Jan 18 2023 : 20:47:11
Hi Ray

I tried using both mlDrawCreatePolylineLayers and miSelectPolygon to draw around a circle and could not find any significant difference:



The main factor affecting smoothing is the spacing of the points, which is determined by the frequency of MouseMove calls. ImageEn is not restricting this in any way.

Can you confirm whether any of the following make any difference:
- Setting ImageEnView.LayersFastDrawing := iefDelayed; // or iefFast
- Turning off AutoShrink and AutoStretch
- Setting ImageEnView1.LayersCaching := 0;

Regarding the pause before drawing, does this only happen the first time? Does turning off undo affect it?

Nigel
Xequte Software
www.imageen.com