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
 Vector drawing, resize the base area

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
Kostas Posted - Jun 29 2021 : 18:07:47
Hello all,

Please look at the picture.

I start drawing with a 2000 X 1000 rectangle that is the gray area.
Then I create the text elements outside the rectangle.

Using the LayersRect() method, I get a rectangle with the boundaries of all layers. This is the blue rectangle.

GetIdealZoom refers to the original 2000 x 1000 rectangle.

How can I adjust the original rectangle 2000 x 1000 to the dimensions of the blue rectangle so that the zooming works?



ImageEnView1.LockUpdate();
ImageEnView1.ClearAll;
ImageEnView1.Proc.Clear;
ImageEnView1.Proc.ImageResize(2000, 1000);

//Draw all elements here.

ImageEnView1.UnlockUpdate();
ImageEnView1.Zoom := ImageEnView1.GetIdealZoom * 0.9;



11   L A T E S T    R E P L I E S    (Newest First)
Kostas Posted - Jul 07 2021 : 08:09:56
ImageEN and their support is fantastic.
Now everything works perfectly.


procedure LabelinigXAxis;
          begin
            ImageEnView1.LayersAdd( ielkText );
            with TIETextLayer( ImageEnView1.CurrentLayer ) do
            begin
              Text := 'That is a very loooooooooooooooooooooooooooooooooooooong text.'; //'Headline Top';
              Font.Name := 'Arial';
              Font.Size := Round(5*multi);
              Font.Style := [fsBold];
              TextOverflow := ieoShrink;
              WordWrap := false;
              SizeToText();
              PosX := (LimitsRect.Width div 2) - (Width div 2);
              PosY := 0 + (Height div 2) - Round(15*multi);
            end;
          end;



Have a nice day, Nigel


xequte Posted - Jul 07 2021 : 06:57:25
Hi Kostas

Have you tried setting TextOverflow to ieoShrink?

https://www.imageen.com/help/TIETextLayer.TextOverflow.html

Nigel
Xequte Software
www.imageen.com
Kostas Posted - Jul 06 2021 : 17:10:13
Hi Nigel,

Unfortunately, I now have one more problem.

Depending on the zoom position, some text is cut off and it has nothing to do with the length.

If I change the zoom (change the height of the form) there are places where the texts are cut off.

I absolutely have to prevent that. Do you have any idea?

I've expanded the example.











attach/Kostas/202176171239_DrawVectors3.zip
2.98 KB
Kostas Posted - Jul 06 2021 : 07:58:53
If I use your suggestion with LayersRepositionAll together with ResetState everything works perfectly.
Thank you very much, Nigel.
xequte Posted - Jul 05 2021 : 20:25:30
Hi Kostas

Sorry for the delay. The issue here is that because they layers are positioned offset (not originating at 0,0) then they are not adequately centered (rightly or wrongly ImageEn considers the origin position when centering the view.

The solution is to give your layer group the origin of 0,0:

var 
  rect: TIERectangle;
begin
  rect := ImageEnView1.LayersRect(False, True);
  ImageEnView1.LayersRepositionAll(-rect.X, - rect.Y);


Here's a full example:

// Zoom so layers fill entire view area

// Make IEView consider all layers when calculating image bounds
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [loDynamicCanvas];

// Position layers so origin is 0,0
rect := ImageEnView1.LayersRect(False, True);
ImageEnView1.LayersRepositionAll(-rect.X, - rect.Y);

// Adjust zoom so all layers fill the view area
ImageEnView1.Fit();


In v10.0.2 you can also do it this way:

// Adjust view to show all layers
var
  rect: TIERectangle;
begin
  // Make IEView consider all layers when calculating image bounds
  ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [loDynamicCanvas];

  // Position layers so origin is 0,0
  rect := ImageEnView1.LayersRect(False, True);
  ImageEnView1.LayersRepositionAll(-rect.X, - rect.Y);

  // Get updated layer rect and show it at size of control
  rect := ImageEnView1.LayersRect(False, True);
  ImageEnView1.VisibleBitmapRect := IERectangleToRect( rect );
end;


Nigel
Xequte Software
www.imageen.com
Kostas Posted - Jul 05 2021 : 17:23:29
Hi Nigel,

Regarding the second question: Clear All for drawing new objects, I have found the solution.

I ran that to clean up.


  ImageEnView1.LockUpdate();
  ImageEnView1.ClearAll;
  ImageEnView1.LayersClear;
  ImageEnView1.Proc.Clear;

  //Draw new objects

  ImageEnView1.UnlockUpdate();


And that's how it works.


  ImageEnView1.LockUpdate();
  ImageEnView1.ClearAll;
  ImageEnView1.ResetState; //<<<<<<<<<<<<<<

  //Draw new objects

  ImageEnView1.UnlockUpdate();

Kostas Posted - Jul 03 2021 : 09:50:22
Hi Nigel,

Thank you for taking the time to do it. I appreciate that.

I've revised the demo.

Please two more questions:
-I still have to draw a lot of complex graphics like this. Is my approach the right way to draw lines, texts and polilines? Texts are not always drawn cleanly depending on the zoom lavel.

-If you click the Draw button a second time, the next graphic is drawn slightly offset. Apparently I'm not removing everything right.

Draw vectors

attach/Kostas/2021739503_DrawVectors.zip
3.18 KB
xequte Posted - Jul 03 2021 : 00:41:18
Hi

Can you give me the code to generate your content (I was testing again the version that you emailed me earlier, which is different).

I suspect the issue is related to the size/position of your layer 0 (perhaps make it a different color so it is easier to see its effect).


Nigel
Xequte Software
www.imageen.com
Kostas Posted - Jul 02 2021 : 12:08:27
Hi Nogel,

Unfortunately it did not work.

These are my results










Do you have another idea?
xequte Posted - Jul 02 2021 : 01:08:58
Hi Kostas

GetIdealZoom seems to be returning the correct dimensions even when layers are outside the background layer.

This works for me:

ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [loDynamicCanvas];
ImageEnView1.Zoom := ImageEnView1.GetIdealZoom;


Can you confirm what you are seeing?


These might also be useful to you:

https://www.imageen.com/help/TImageEnView.LayersRect.html


Enabling loDynamicCanvas:

https://www.imageen.com/help/TImageEnView.LayerOptions.html


Turning off Center:
https://www.imageen.com/help/TImageEnView.Center.html


Nigel
Xequte Software
www.imageen.com
xequte Posted - Jun 29 2021 : 18:50:58
Hi Kostas

I'll need to come back to you on this later in the week when I have a chance to investigate the best solution. Perhaps, we need an extra parameter for GetIdealZoom().

Nigel
Xequte Software
www.imageen.com