Forum > Ported from Delphi/Kylix

Solved: Porting efg2 Snowflake Curve Drawer

<< < (2/6) > >>

Boleeman:
Many thanks WP and Thaddy for your replies. Been a bit sick with a ticklish cough/congestion, so sorry about the late reply.

"The difference between Delphi and Lazarus: In Delphi, a bitmap is initialized filled with white color, while in Lazarus it is filled with black." That explains the Black image. Wow I did not know that.

Assert(printer.XDPI = printer.YDPI, 'Printer pixels are not square');   so that is how to use printer.XDPI and printer.YDPI
I read about printer.XDPI and printer.YDPI in some threads but did not know how to implement it. I was trying all sorts of combinations and not really going in the right direction.

Your uses clause contains both Windows and LCLIntf/LCLType. This could lead to conflicts because LCLIntf and LCLType are the "same"  Thanks for the Uses Windows clause info. I Googled what to include for TRect and it suggested the Uses Windows, with Windows put at the start. you must add unit Types to used to fix this I read about that but did not understand that from the threads that I had read (until now that I get it).

The reason for playing around with the old is that it contains a unit called MapWorldToPixel which may help me with another LSystem Fractals program in which I was searching for some sort of scaling feature. Each time you increase the level of recursion of a fractal the image gets bigger so I thought of looking at what programmers did years ago to deal with the problem of an increasing size of an image.



I went through all your recommendations WP and have got a great improvement in the program. Still getting a Black image when saving to BMP so I guess there is still that  initialized filled with white color Delphi Problem in the save to BMP part (but can print to PDF).

Also: I Opened the form in the Object Inspector and went to the Font property, but could not set set Name to "default" and "Size" to 0. Could not see where to set "default"?



I was playing with the Delphi to Lazarus conversion facility in Lazarus and have been tinkering with different Delphi codes. Kinda really cool. Had problems with Delphi graphics source code containing scanline code (looks like other people have had similar problems). Anyhow the more I play around the more I learn. With your knowledge that helps to explain things a bit better. Thanks for for great help.

wp:

--- Quote from: Boleeman on August 03, 2023, 03:26:36 pm ---I went through all your recommendations WP and have got a great improvement in the program. Still getting a Black image when saving to BMP so I guess there is still that  initialized filled with white color Delphi Problem in the save to BMP part (but can print to PDF).

--- End quote ---
Yes, it's the same story again. The button's OnClick handler creates a new bitmap which you have to fill with the background color again.


--- Quote from: Boleeman on August 03, 2023, 03:26:36 pm ---Also: I Opened the form in the Object Inspector and went to the Font property, but could not set set Name to "default" and "Size" to 0. Could not see where to set "default"?
--- End quote ---
Load the project. Make sure that the main form is selected. Click somewhere on the form where there is no control (or select the form in the tree above the property grid of the object inspector). Scroll down the property grid until you see the property "Font" in the left column. The down-arrow at the left of "Font" indicates that this property has sub-properties. Click on the arrow to drop down the sub-properties. Among them you find "Name" which is "MS Sans Serif" now. Click on the dropdown arrow at the right of "MS Sans Serif", scroll to the very top - here you can find the entry "default". Or simply click inside the name field and begin typing "default" (without quotes), press ENTER to select it. The same with the "Size" property where you simply type "0" + ENTEr.

marcov:
(afaik in recent versions of FPC (3.2.0+), Windows.Trect and types.trect are one and the same)

Boleeman:
Thanks WP for the extra guided info. and screenshot. Got the default setting done properly now and the font setting=0.
Did not realize there was a drop down arrow to the left of Font (possibly late at night sleepiness!)
Also got the image saving to bmp properly.

Thanks Marcov for the info. as well. I have version 2.2.4 Lazarus installed. May try to install the updated version of Lazarus.

Once again thanks to all for helping me out. I learnt some new skills from this exercise which will definitely help me in other projects. I am used to programming in VB6 so the extra Lazarus hints were very much appreciated.

Boleeman:
Here is the efg2 Sierpinski Triangle converted to Lazarus.

I added a line border width spinbox to make it look even better.







Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version