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
 SVG Sizing issues
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

zerob

160 Posts

Posted - Nov 12 2024 :  08:38:59  Show Profile  Reply
When i load some SVG's i've downloaded from the internet with LayersImport.
After this, i group the layers it creates together ( This .svg creates multiple layers. Some lines and some ornaments).

1. Bug:
When i resize the larger ornaments, the line layer gets resized strangely, as it gets diagonal instead of making the line thicker and still horizontal. This gets worse, the larger the line gets.

2. Bug:
Then, when i shrink the ornament layer by mouse and get it to a certain size and resize it back, then the grouped line layer gets really huge (not relative to the size difference it had to the other layers).

When i resize that ornament layer to 3 pixels and back, then the linked line layer gets extremely huge and never shrinks down. All sizing begins to lag and stutter.


Conclusion:
My issues, shouldn't the line layer just get higher instead of becomming a diagonal line?
Second issue, the calculation for the line layer gets bugy, as soon as the other layers get really small, and never recover from this.

I've sent you a mail with a demo and a video.

xequte

38607 Posts

Posted - Nov 18 2024 :  23:03:46  Show Profile  Reply
Hi

Thank you for sending a video to illustrate this issue.

1. The logic used for a line layer is that the line runs from the top-left to the bottom right of its containing box. So if you enlarge it, you will change the angle of the line. Unfortunately, when grouped this has the effect of changing the look of the image in an unexpected manner.

There's not really a good solution here (without changing the existing line logic and breaking all the existing applications that rely on it).

The correct method would probably be to move the line rather than enlarge its box when it is sized as a group, but that would make it behave differently from sizing it by itself, so not a great solution.

2. I'm still looking into this one...
Go to Top of Page

zerob

160 Posts

Posted - Nov 19 2024 :  01:56:09  Show Profile  Reply
Hi Nigel
Thanks for looking into this :-)
How about (i know, this is complicating things), letting the user chose if the line layer should react correctly or in the broken way that it was until now?
Inkscape and all vector apps draw it horizontally and just make the line thicker when resizing a layer.
All things that behave unexpectetly and strange, make designing with imageen hard. (Well, never try to resize a Line, and never try to group a line or import a SVG or PSD because then it fails. Draw that line fresh, each time you want to resize it some pixels, or don't do lines at all)
All workarounds needed, make the apps bad and disliked by the public.
But i understand you, it might be a huge and complicated task and adding yet another property to alter inner workings makes things complicated.
Go to Top of Page

xequte

38607 Posts

Posted - Nov 19 2024 :  20:33:35  Show Profile  Reply
There is another option and that is to convert it from a line to a polygon. Then sizing it will enlarge the shape rather than change the start and end point. You will need the latest beta, and can convert a line to to a polygon layer, using:

  ImageEnView1.CurrentLayer.ConvertToPolylineLayer( True );

It is still not perfect, because rectangular selection does not have a clear purpose with 1D objects.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

zerob

160 Posts

Posted - Nov 20 2024 :  09:28:44  Show Profile  Reply
Thanks, i will try it out, when you send me that beta.
Yeah, would be nice if there was a way that didn't require me to change stuff in the graphics, or to loop through all layers and check if they need to be converted, but it always is nice to have at least some solution. :-)
Go to Top of Page

zerob

160 Posts

Posted - Nov 20 2024 :  09:54:02  Show Profile  Reply
I discovered a new bug, while enabling some temporary workaround until this gets fixed.

I set a TImageEnView.OnDrawLayerGrip event and then did draw the left and right grid, to not allow changing the height.

On the small line layers, the grip gets the function to draw a [1, 3] instead of my [4, 5] and the cursor gets into that cursor, and im able to resize the layer (not in the way i planed).

Only after the layer gets bigger in height, the [4, 5] grips get working as intended.

It seems that there is a minimum height set for left and right sizing to be allowed, even on Line Layers and even when forced by me?

Also the help file has a small error... You forgot to set a "var iec: TIECanvas;" in the event.

This is my event i did, that didn't work until the height got larger:
var iec: TIECanvas;
begin
  if grip in [4,5] then
  begin
    iec := TIECanvas.Create( ABitmap.Canvas );
    IEDrawGrip( iec, rect,  ImageEnView1.GetLayersGripStyle() );
    iec.Free();
  end;


4 Left side
5 Right side
1 Right-top
3 Left-bottom
Go to Top of Page

xequte

38607 Posts

Posted - Nov 20 2024 :  15:22:35  Show Profile  Reply
Sorry, I added that code to the demo you emailed me, but don't see any issue (I see grips at all four corners regardless of the size). Can you give me some precise steps to reproduce it.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

zerob

160 Posts

Posted - Nov 20 2024 :  15:52:50  Show Profile  Reply
In my demo, i just commented out the Grouping and added a OnDrawLayerGrip.
Then, when i click the lines, i get two grips.
When i move the mouse over that grips, i see top right sizing and bottom left sizing Cursors, and im able to resize the line like if that grip
really where top right and bottom left grips (not the ones left and right 4 and 5 i wanted, but it was 1 and 3, top right and bottom left).

As soon as the line layer is sized this way by mouse, these two grips switch to my left and right sizing grips and work as intended.
But on the loaded line, before sizing, they don't change left and right of the line, but resize it top right and bottom left.
And i wanted to block hight changes by drawing only left side and right side (4 and 5) grips.

It seems that the line layer does block my grips (left and right) until the height is bigger, and then it works again.

var iec: TIECanvas;
begin
  if grip in [4,5] then
  begin
    iec := TIECanvas.Create( ABitmap.Canvas );
    IEDrawGrip( iec, rect,  ImageEnView1.GetLayersGripStyle() );
    iec.Free();
  end;
Go to Top of Page

zerob

160 Posts

Posted - Nov 20 2024 :  16:08:39  Show Profile  Reply
I think i got something wrong in my understanding...
I thought by not drawing the Grips, i would remove the ability to size the layer in that way and also hiding these cursors.
But this way i only hide the Grips, without removing any ability.

Is there a way to disable handling of any of the Grip positions to disable some sizing, or do i need to disable autocursor (but that also hides the cursor i want), and set an event on sizemove and force the height to stay the same?
Go to Top of Page

xequte

38607 Posts

Posted - Nov 21 2024 :  00:48:41  Show Profile  Reply
Hi

OnDrawLayerGrip only affects the drawing of the grip. It doesn't change its behavior.

To control sizing behavior, you would have to use the OnLayerMoveSize event:

http://www.imageen.com/help/TImageEnView.OnLayerMoveSize.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

zerob

160 Posts

Posted - Nov 21 2024 :  03:46:01  Show Profile  Reply
But what if i only want to let the user change the width and x position of a line layer and not the hight?
I can force the hight on onlayermovesize, but i can't disable the grip and the cursor change on the grip location that i want to disable.
I don't want to set "AutoCursor := False" as i want the cursor to be seen for the grips i want to show.
And i also don't want the user to be able to still click on the invisible grip "top right", to still fire that event and be able to size outside of that grip.
Is there a way to say "don't make a grip and don't handle events on these grip positions i don't want to allow" and disable showing grips and cursors or firing events on these locations?
So if somebody clicks on "top right" then not the topright event is handled but the "clicked on some other part that selects and maybe handles moving"

property SizingGripsAndHandling: [sgLeft, sgRight];
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: