Recent

Author Topic: Get an error when compiling SuperFormula  (Read 3226 times)

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Get an error when compiling SuperFormula
« Reply #15 on: December 25, 2022, 09:16:54 am »
Wow thanks KodeZwerg. Looks like I was messing up quite a bit.
The program now saves to Png. I played around with it saving and experimenting with the edit boxes. The second does not increment after saving but is just where you would put a new number to begin with. With VB6 I was using a loop to increment to the previous value shown in the 2nd edit box but it would update to the new value (a bit different to your method). Looks like Lazarus uses more code to do something similar.

Merry Christmas KodeZwerg.

Thanks for your kind help. It was very appreciated.

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: Get an error when compiling SuperFormula
« Reply #16 on: December 25, 2022, 10:41:50 pm »
Merry Xmas :)

I would have another remark about a memory leak when calling ComputeFlatImage. You can avoid it by assigning the result to a variable, and freeing it after calling png.Assign.

Regards
Conscience is the debugger of the mind

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2080
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Get an error when compiling SuperFormula
« Reply #17 on: December 27, 2022, 04:30:17 pm »
Merry xmas, you are welcome and yes, my try is not based on internal number counting, i do physical counting but giving chance that you can set a starting number.
This all was not really fully tested, just quick written down as how my belly told me to do so when there is a need to free, please read documentation to understand what and why.
Ofc feel free to change whatever you want to change but when you just internal count without physical check, it might happen that you overwrite.
As a small goodie I did add a simple padding method so your numbering will be displayed good sorted in your "explorer/whatever you use to display files" and of course change my hardcoded way to take the executable filepath as the absolute and set/use own ways.

If you now having ??? in your mind when I say padding and sorting, your way would create files like "file1 file2 file3 etc and file10 file 11 etc" the explorer would than display them like "file1 file10 file2 file20 etc...."
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Get an error when compiling SuperFormula
« Reply #18 on: December 31, 2022, 02:22:48 am »
Hi KodeZwerg.

Yes I saw how you added padding so that explorer sorts properly. Attached is a Vb6 program I made to draw stars with the save function that I initially thought, where after each save it increments to the next value but at any time can be changed to any number. A bit different to your Lazarus way.

Also included in the Vb6 demo is saving the settings to a listbox (which saves and loads to a simple txt file) so that one can retrieve the saved designs by clicking on a listbox row at any time. The SuperFormula program lacks that capability, but unfortunately it is beyond my ability at the moment (I am still learning about graphics and saving to png). The SuperFormula demo saves to a dat file in the prgram's folder. Would very much like to see a listbox feature added to the SuperFormula Demo.

I am quite grateful for all your help. Learning Lazarus has many hurdles so I am very much on a learning curve, TRYING to work things out.
« Last Edit: December 31, 2022, 03:32:57 am by Boleeman »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2080
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Get an error when compiling SuperFormula
« Reply #19 on: December 31, 2022, 10:00:13 am »
One week after next year (and if I do not forget) I can write you a larger example based on the SuperFormula demo with additions that I see on your image.
Its easy, trust me  :-*
Happy new eve celebration  O:-)
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Get an error when compiling SuperFormula
« Reply #20 on: December 31, 2022, 09:01:56 pm »
Happy New Year KodeZwerg.

Wow. Thanks for offering to add in the saving features. In Vb6 I create a fixed array and add in the scrollbox values separated by commas, then add them to a listbox and add click event to load the listbox row that was clicked. Doing it the Lazarus way I don't know.

It took me almost half a day to add your saving routine to another Polygon program that I was practicing on (finally got it somehow working then VisualLab helped me out some more). It is so nice that you are both helping me out. Much appreciated. Take care and have a safe and happy New Year.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2080
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Get an error when compiling SuperFormula
« Reply #21 on: January 11, 2023, 05:22:35 pm »
An extended Demo modification by KodeZwerg.

Changes to original:
 + compatible to current FPC/Lazarus
 + added 2 edits for filename handling
 + added listbox as preset/shape changer
 + added save to png
 + added save/load presets

Enjoy!
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Get an error when compiling SuperFormula
« Reply #22 on: January 13, 2023, 01:11:52 am »
Wow KodeZwerg thanks very much for adding those extra features. I am blown away.
Much appreciated. Now one can view the saved designs and play around with the different settings a lot more.

After running the program I relised that you placed the listbox to the side so that resizing shows the rest of the text. I was trying to move the Tpanel and controls to the side to allow for more room for the SuperShape but had problems (wanted to shift the controls like shown in the attached picture). I selected the whole form set all the archors off to none and tried shifting and resizing but had problems. Everything seems stuck together and could not be moved and resized. Maybe there is a little trick that I do not know.

Also after running the program I also noticed that if you have a more than one word description like Yellow Sun the Sun bit goes in the file number edit box when you click on another saved entry in the listbox. I think it is because you split the values using a space  I guess a simple way around it is to name with underscores like Yellow_Sun.

Once again KodeZwerg thanks for helping out. I will look at your added code and try to learn from it.
« Last Edit: January 13, 2023, 03:22:53 am by Boleeman »

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Get an error when compiling SuperFormula
« Reply #23 on: January 13, 2023, 08:07:14 am »
KodeZwerg, I see now that you got the file incrementing working after playing around with the program some more (This feature helps to make an animation sequence). I ended up making an animated Supershape gif with Pencil Animator (free).

Also added an extra edit box to give a name before adding to listbox, instead of using file name edit box.

Wow. I love the program.

Still trying to move the controls to the side, but without success.

« Last Edit: January 13, 2023, 08:20:45 am by Boleeman »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2080
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Get an error when compiling SuperFormula
« Reply #24 on: January 13, 2023, 09:55:31 am »
I am glad that you found out how my magic works  O:-)
Yes, I do use a simple space to keep track on what is what, so you can easy replace that with a ";" for example that spaces in filename/listbox are working friendly together.
Your "Description" can also be stand alone, I just did all those additions very quickly, having filename saved in listbox does not make much sense at all since I also added a compare routine that checks if input already is stored it might be better to reduce that check for the values only without names at all  :-[

To your "redesigning" problem, original author has set all to "autosize", when you turn that off you have some more control over what is where and how large is something, I made it simple for myself and kept his style working by adding to a logical position the listbox with its buttons.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2080
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Get an error when compiling SuperFormula
« Reply #25 on: January 13, 2023, 10:58:20 am »
In attachment you find updated version that handle now data per ";" seperator, skip already included data out of listbox by comparing just values without any names, ability to give descriptions, removed filename out of listbox.
If you used my prior release, you sadly need to rebuild presets from scratch.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Get an error when compiling SuperFormula
« Reply #26 on: January 13, 2023, 11:11:44 am »
Once again KodeZwerg, thanks for helping me out. I really appreciate your help.
Thanks to Lainz for the original design, as well.

The program is now much better to use when designing new shapes.

I am making some great animations now with multiple animated SuperShapes.

I am really impressed with the graphics output.

Take care friend. Your Magic is true skill.



« Last Edit: January 13, 2023, 11:20:33 am by Boleeman »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2080
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Get an error when compiling SuperFormula
« Reply #27 on: January 13, 2023, 11:54:17 am »
As you asked, here is a version where everything is left aligned and adjustable via a splitter, ie: complete UI is rebuilded  :-*

//edit
Updated from first picture to second picture the handling for descriptions. (removed the seperate dialog out of project)
« Last Edit: January 13, 2023, 01:06:46 pm by KodeZwerg »
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

circular

  • Hero Member
  • *****
  • Posts: 4221
    • Personal webpage
Re: Get an error when compiling SuperFormula
« Reply #28 on: January 13, 2023, 06:22:30 pm »
Artists at work here  :)
Conscience is the debugger of the mind

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Get an error when compiling SuperFormula
« Reply #29 on: January 13, 2023, 09:08:48 pm »
KodeZwerg, once again I thank you for your great help.
Ah, the 'You are Welcome Boleeman' in the screenshot gave me a smile.
I was so impressed with the graphics that I created over 70 Supershape Designs. I have attached a small Animated GIF showcasing all of the 70 plus designs in this thread. I reduced the file size by resizing the graphics and optimizing it, so it actually looks even better when not resized. When animating the SuperShapes I was stunned to see how nice the graphics were. The virtual layer and BGRABitmap produces nice clean images.

KodeZwerg
This program is now great at designing and storing different SuperShapes.
I see that you added a delete listbox entry, as well as an edit box for the shape description. The adjustable splitter sounds good as well. Also by moving the controls to the side the images one can now make the shapes a bit bigger (making them even more clearer.)

Thanks to KodeZwerg and Lainz (original creator).

I wonder if the graphics could possibly be saved as SVG? I think that spline/poly lines would probably need to be used to store the points in the SVG (instead of raster lines)
There is a free animator called VGC Animator on GitHub that I think imports SVG. I also know of some programs like Potrace that convert PNG/BMP to SVG, so I guess that is another way to do it.

Circular
Digital Artists at work and CREATIVE DREAMERS at play.
My old nic. at theForum was Creative Dreamer. I see that on this forumn there a some members of VB6/Net theForum and also members from the old PlanetVB Source Code site. Not sure if KodeZwerg was also a member, as the avatar and nic. seems familiar from years ago?


As a side note,, this program can even be used to make gear wheels. There is a thread here on the forum talking about animating gears so they could make use of this program to make their own specialized gear shapes.


« Last Edit: January 14, 2023, 01:53:14 am by Boleeman »

 

TinyPortal © 2005-2018