PDA

View Full Version : RGB in Thinbasic and Delphi / Lazarus



zak
29-10-2011, 16:35
i have tried to port MathArt canvas (http://www.thinbasic.com/community/showthread.php?11272-math-Art-using-the-Canvas) version to delphi and lazarus, the same algorithm gives almost the same shape but the thinbasic shape are more beautifull than delphi, and the delphi shape have more details:
7573 7574

checking the first pixel color in thinbasic it is :
red,green,blue = -250, -85, 48 and the same for delphi
but thinbasic RGB convert the negative value to zero, so the above color will be 0,0,48 and delphi RGB convert the negative values like this:
RGB(-250+256, -85+256, 48 ) = RGB(6,171,48 )
so if we instruct delphi to behave like thinbasic ie to convert negatives to zero it will produce again beautifull shape.


there are many annoyances in pascal such as the extreme strict we must use, as an example integer variable = Cos(4.23); will produce an error "Incompatible types: 'Integer' and 'Extended'", other annoyance is the Round function, it behaves in the most bizzare way as explained here: http://www.festra.com/eng/tip-rounding.htm
he provide another function to correct the situation.

thinbasic code available in the above link
attached delphi 7.0 code with executable here ( there is no canvas_scale in delphi like that in thinbasic as in the top link second version)
the same code can be used for Lazarus

Petr Schreiber
29-10-2011, 19:13
Hi Zak,

thanks for this information, especially the Round behavior is something I didn't know before.

I am personally not a big Delphi/Pascal fan, but many of my friends like it very much, so it is, as with everything else, matter of personal preference.


Petr

kryton9
30-10-2011, 09:29
That is an interesting difference Zak.

Petr, Delphi was super till it became .netizied -- Lazarus is nice, but not as smooth to work in as Delphi. At least you like C# now, so I am happy.

Michael Hartlef
21-11-2011, 15:50
I find Lazarus pretty good now, clsoe to Delphi6 at its time. I revamped my editor IndeEd for ther Corona SDK with it and under OSX. Most likely in 2-3 weeks I will restart its development and then port the program overt to windows, still using Lazarus.