Recent

Author Topic: Fractals Image: AutoSize Image Canvas Size to Fit Image  (Read 1216 times)

Boleeman

  • Hero Member
  • *****
  • Posts: 766
Fractals Image: AutoSize Image Canvas Size to Fit Image
« on: July 01, 2023, 01:56:30 pm »
Hi All.

I have been playing around with a LSystem Fractal Image program and wondered if anyone could possibly help in explaining how to add an AutoSize Image Canvas Size to Fit Image  feature.

When I change the recursion level of a given fractal it's rendered image gets bigger and is not shown completely on the Timage. Is there a way of setting the image size automatically by pre-calculating the range of X and Y pixel values?

Attached is a screenshot.
After compiling, click Pentaplexity in the listbox to render it. then change iterations to 5 in the memo and click Draw.
When iterations = 4 is changed to iterations = 5  the picture becomes too big for the image control

Thanx in advance.

I thought of using a BgraBmp image with a viewport to scroll, but not sure really how to do it?
« Last Edit: July 01, 2023, 02:01:07 pm by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 766
Re: Fractals Image: AutoSize Image Canvas Size to Fit Image
« Reply #1 on: July 02, 2023, 08:26:02 am »
Actually had an idea for autosizing.

Use a buffer and create 2 dynamic arrays that store the X and Y coordinates of the points that are calculated by the fractal rules.
Then find the maximum X and Y values

Set the image size to just a bit bigger than that size.

Lastly write the fractal image to canvas.

« Last Edit: July 05, 2023, 11:50:38 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 766
Re: Fractals Image: AutoSize Image Canvas Size to Fit Image
« Reply #2 on: July 21, 2023, 05:44:16 pm »
Some sample pictures from the program:


lainz

  • Hero Member
  • *****
  • Posts: 4659
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Fractals Image: AutoSize Image Canvas Size to Fit Image
« Reply #3 on: July 22, 2023, 02:33:43 pm »
Attached the PNG with transparency. Requires BGRABitmap and BGRAControls.

Edit: wrong post, but of the same author so no problem?
« Last Edit: July 22, 2023, 02:42:48 pm by lainz »

Boleeman

  • Hero Member
  • *****
  • Posts: 766
Re: Fractals Image: AutoSize Image Canvas Size to Fit Image
« Reply #4 on: July 22, 2023, 05:55:25 pm »
No problem here.

Wow thanks Sooooooo Much Lainz. So much appreciated.

Attached I have a whole lot of presets for the lsystem program. If anyone wants to play around compile the program in post 1 and then just copy the presets into the samples folder. Below are some latest pictures.

I spent a number of "Addicted Hours making all sorts of cool graphics designs". 212 different designs so far. The Lsystem program has a lot of potential to make so very cool graphics designs. I will now try to implement the BGRABitmap into it.

I am so happy playing with Lazarus. Along with BGRABitmap I see how it has great graphics effects (much better than VB6). I just came across that hurdle of implementing BGRABitmap and understanding what to do in different parts of a program. The examples in the Wiki show small bits and pieces but Lainz' code really helped.


« Last Edit: July 23, 2023, 02:43:34 pm by Boleeman »

 

TinyPortal © 2005-2018