EditorFactory - Module for object management in a Canvas

Share your advanced PureBasic knowledge/code with the community.
User avatar
blueb
Addict
Addict
Posts: 1116
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: EditorFactory - Module for object management in a Canvas

Post by blueb »

Merci ShadowSorm :D
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
ShadowStorm
Enthusiast
Enthusiast
Posts: 303
Joined: Tue Feb 14, 2017 12:07 pm

Re: EditorFactory - Module for object management in a Canvas

Post by ShadowStorm »

blueb wrote: Thu Jan 30, 2025 4:26 pm Merci ShadowSorm :D
De rien, si tu as besoin d'aide hésite pas :)
I am French, I do not speak English.
My apologies for the mistakes.

I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
punak
User
User
Posts: 89
Joined: Tue Sep 07, 2021 12:08 pm

Re: EditorFactory - Module for object management in a Canvas

Post by punak »

Hello
How can we save the result of drawing by EditorFactory on canvas as svg?
User avatar
STARGÅTE
Addict
Addict
Posts: 2235
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: EditorFactory - Module for object management in a Canvas

Post by STARGÅTE »

punak wrote: Tue Sep 02, 2025 7:42 pm Hello
How can we save the result of drawing by EditorFactory on canvas as svg?
There is no module function for this.
However, PureBasic has the command SvgVectorOutput(), which you can use in the StartVectorDrawing() function, instead of the CanvasVectorOutput().

In principle, there is only one call of StartVectorDrawing() in the EditorFactory-include, it's in the private module function: ObjectDrawing(), you can search for it in the source code. So it should be possible to add an additional parameter to trigger an output to a SVG file.
However, I never tried the SvgVectorOutput() command, I'm not sure if it has the same functionality for drawings as CanvasVectorOutput().

I can try it on weekend, or you can try it yourself.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
punak
User
User
Posts: 89
Joined: Tue Sep 07, 2021 12:08 pm

Re: EditorFactory - Module for object management in a Canvas

Post by punak »

@STARGÅTE : Thanks for your help.
Another question : How do I create a snap to grid mode to move objects?
User avatar
STARGÅTE
Addict
Addict
Posts: 2235
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: EditorFactory - Module for object management in a Canvas

Post by STARGÅTE »

punak wrote: Wed Sep 03, 2025 8:05 pm @STARGÅTE : Thanks for your help.
Another question : How do I create a snap to grid mode to move objects?
With the module function SetObjectMovementStep() and SetObjectResizeStep() you can define a grid snapping for movements and resizing. You can define it by default (for new objects), for all objects, or a specific object.
For example, the call of EditorFactory::SetObjectMovementStep(#Object_Default, 10, 10) defines a 10-px-grid for all new objects.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
punak
User
User
Posts: 89
Joined: Tue Sep 07, 2021 12:08 pm

Re: EditorFactory - Module for object management in a Canvas

Post by punak »

Hello again,
How to enable z-order feature in this module? I want an object to be placed above other objects when I click on it.

Of course, if possible, please add the save to svg function.
User avatar
STARGÅTE
Addict
Addict
Posts: 2235
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: EditorFactory - Module for object management in a Canvas

Post by STARGÅTE »

punak wrote: Fri Sep 05, 2025 12:48 pm Hello again,
How to enable z-order feature in this module? I want an object to be placed above other objects when I click on it.
Please take a look in Example04_Object-order.pb from the download.
SetObjectLayer() can be used to change the z-order and with CanvasObjectsEvent() you can detect a click.
punak wrote: Fri Sep 05, 2025 12:48 pm Of course, if possible, please add the save to svg function.
I will try it on weekend, as I said.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
STARGÅTE
Addict
Addict
Posts: 2235
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: EditorFactory - Module for object management in a Canvas

Post by STARGÅTE »

punak wrote: Tue Sep 02, 2025 7:42 pm How can we save the result of drawing by EditorFactory on canvas as svg?
I quickly checked the option to save the canvas output as a SVG.
Indeed, it is relatively easy to add this feature.
However, the saved SVG image is simplified and not complete:
- In my test, text (with fonts) was not exported.
- Color gradient areas were just solid color.
If both is not relevant to you, I can provide you with a procedure.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
punak
User
User
Posts: 89
Joined: Tue Sep 07, 2021 12:08 pm

Re: EditorFactory - Module for object management in a Canvas

Post by punak »

Thanks for following up on my request.
I am building a visual calendar designer using your powerful EditorFactory - Module and of course, with the copilot laborious consultations :D
Your designer's output is a vector file for graphic designers.

The font problem seems to be a bug (SvgVectorOutput) and needs to be fixed. I mentioned it in the following thread.
viewtopic.php?t=87523
For other cases, it doesn't matter at all, just draw the same simple shape, it's great.
punak
User
User
Posts: 89
Joined: Tue Sep 07, 2021 12:08 pm

Re: EditorFactory - Module for object management in a Canvas

Post by punak »

I'm posting again because I'm in a bit of a hurry.
Now, if I use svgVectorOutput instead of canvasVectoroutput in the objectdrawing function, will there be any problems with the drawing???
User avatar
STARGÅTE
Addict
Addict
Posts: 2235
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: EditorFactory - Module for object management in a Canvas

Post by STARGÅTE »

I will upload an experimental version for you in a few hours and send you a PN.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply