Recent

Author Topic: BGRABitmap demo projects  (Read 10250 times)

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #15 on: July 07, 2018, 08:07:52 pm »
Hi, I've updated the repository with @wp fixes to the superformula.
https://forum.lazarus.freepascal.org/index.php/topic,41646.msg289584.html#msg289584

Thanks @wp!

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #16 on: July 21, 2018, 08:26:25 pm »
And finally the superformula is ready, now with the new BGRABitmap Layer Originals (is a cool way to make layers with custom properties, load and save to file as well).

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: BGRABitmap demo projects
« Reply #17 on: August 11, 2018, 07:58:31 pm »
Very beautiful  :)
Conscience is the debugger of the mind

Boleeman

  • Sr. Member
  • ****
  • Posts: 404
Re: BGRABitmap demo projects
« Reply #18 on: December 16, 2022, 10:29:54 am »
When compiling SuperFormula UI using Lazarus 2.2.4 (rev lazarus_2_2_4) FPC 3.2.2 i386-win32 I get an error on line 196:

umain.pas(196,31) Error: Incompatible types: got "<procedure variable type of procedure(TObject;TBGRALayerCustomOriginal) of object;Register>" expected "<procedure variable type of procedure(TObject;TBGRALayerCustomOriginal;var TBGRAOriginalDiff) of object;Register>"

Would you have any advice on how to fix the error?

I downloaded the source from https://github.com/bgrabitmap/demo

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #19 on: December 16, 2022, 03:38:27 pm »
Hi, the thing is that the superformula demo was made with an older version of bgrabitmap and needs to be updated.

Boleeman

  • Sr. Member
  • ****
  • Posts: 404
Re: BGRABitmap demo projects
« Reply #20 on: December 16, 2022, 11:56:58 pm »
Thanks Lainz for replying.

I will try another older version of BGRABitmap and perhaps Lazarus from Github. Perhaps versions 1 year old?

I used to play around with VB6 alot and made a SuperFormula Shape program that saves the settings using arrays to save to a simple text file via a listbox. Vb6 does not have good graphics (lazarus is way better). If you would like to play around with with my Vb6 SuperShapes program I can send it to you with a whole lot of preset shapes.

I have a Github page with VB6 related fractals at https://github.com/BoleeMan/ and other VB6 graphics  programs. I hope to learn Lazarus with BGRABitmap, so that the quality of the graphics is improved. Still on a learning curve.  I came across your Demo Source on Github after downloading Lazpaint. Your Graphics Demos are great to learn from.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2010
  • Fifty shades of code.
    • Delphi & FreePascal
Re: BGRABitmap demo projects
« Reply #21 on: December 17, 2022, 12:04:41 am »
I will try another older version of BGRABitmap and perhaps Lazarus from Github. Perhaps versions 1 year old?
Why not do what I told in your other thread?
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Boleeman

  • Sr. Member
  • ****
  • Posts: 404
Re: BGRABitmap demo projects
« Reply #22 on: December 17, 2022, 12:19:08 am »
Oh my Bad.

Sorry KodeZwerg I did not realize that you replied. Apologies.

I will go through your solution steps. Many thaks for helping out KodeZwerg.


KodeZwerg

  • Hero Member
  • *****
  • Posts: 2010
  • Fifty shades of code.
    • Delphi & FreePascal
Re: BGRABitmap demo projects
« Reply #23 on: December 17, 2022, 12:32:43 am »
You are welcome  O:-)
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: BGRABitmap demo projects
« Reply #24 on: December 18, 2022, 12:09:37 pm »
Thanks for the fix KodeZwerg I added it in the repository.

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: BGRABitmap demo projects
« Reply #25 on: December 18, 2022, 11:47:56 pm »
I am working to get my fractal program up on github. I'll give you a shout when I do.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

Boleeman

  • Sr. Member
  • ****
  • Posts: 404
Re: BGRABitmap demo projects
« Reply #26 on: December 25, 2022, 10:31:12 am »
Lainz I finally added save to Png with the generous help of KodeZwerg. I thought I would do a screen cap of your SuperFormula program with my Vb6 version to see how they compare.

Merry Christmas All. Take care.



« Last Edit: December 25, 2022, 12:53:10 pm by Boleeman »

Dzandaa

  • Full Member
  • ***
  • Posts: 249
  • From C# to Lazarus
Re: BGRABitmap demo projects
« Reply #27 on: December 25, 2022, 05:36:56 pm »
Hi,

This is A SOM (Self-organizing map) Demo I translated from one of my C# program to Pascal.

https://en.wikipedia.org/wiki/Self-organizing_map

It's one of the first program I wrote with Lazarus :)

So, be indulgent.

B->
Dzandaa

Dzandaa

  • Full Member
  • ***
  • Posts: 249
  • From C# to Lazarus
Re: BGRABitmap demo projects
« Reply #28 on: December 27, 2022, 01:02:38 pm »
Hi here is a new one I create yesterday, based on the old "Plasma"

tried in Windows and Linux

B->
Dzandaa

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: BGRABitmap demo projects
« Reply #29 on: December 28, 2022, 10:45:35 pm »
Very nice @Dzandaa  :)

I like the use of the different cores. As I was curious I added the number of cores in the constructor:
Code: Pascal  [Select][+][-]
  1.   Caption := Caption + ' (' + IntToStr(Cores) + ' cores)';

I have some remarks. I get buggy colors because of an overflow with the standard palette that can be fixed like this:
Code: Pascal  [Select][+][-]
  1. procedure TPlasmaForm.StandardPalette;
  2. var i: Integer;
  3. begin
  4.  for i := 0 to 255 do
  5.  begin
  6.    CurrentPalette[i].red := byte(Round(127.5 + 127.5 * Sin(Pi * i / 32.0)));
  7.    CurrentPalette[i].green := byte(Round(127.5 + 127.5 * Sin(Pi * i / 64.0)));
  8.    CurrentPalette[i].blue := byte(Round(127.5 + 127.5 * Sin(Pi * i / 128.0)));
  9.    CurrentPalette[i].alpha := 255;
  10.  end
  11. end;

The rightmost pixels are not drawn when not width is not divisible by Core. This can be solved like this:
Code: Pascal  [Select][+][-]
  1.   MinX := LocalThread * StepX;
  2.   if LocalThread = Cores-1 then
  3.     MaxX := Plasma.Width - 1
  4.     else MaxX := minX + StepX - 1;
  5.   Curcolor := 0;
  6.  
  7.   for y := MinY to MaxY do
  8.   begin
  9.       for x := MinX to MaxX do
  10.       begin

The HSV palette does not seem to work for me. I fixed it by using BGRABitmap HSLA colorspace (this is a bit different from the original though):
Code: Pascal  [Select][+][-]
  1. procedure TPlasmaForm.HSVPalette;
  2. var i: Integer;
  3. begin
  4.  for i := 0 to 255 do
  5.    CurrentPalette[i] := HSLA(i*256, 65535, 32768);
  6. end;
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018