# Thread: RGB in Thinbasic and Delphi / Lazarus

1. ## RGB in Thinbasic and Delphi / Lazarus

i have tried to port MathArt 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:
thinbasic.JPG delphi.JPG

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

2. 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

3. 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.

4. 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.

There are no members to list at the moment.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•