Recent

Author Topic: GeoPattern: Thanks WP for the Lazzed BGRABmp version  (Read 2359 times)

Boleeman

  • Hero Member
  • *****
  • Posts: 537
GeoPattern: Thanks WP for the Lazzed BGRABmp version
« on: May 11, 2024, 07:07:30 am »
Hi All.

I found a Github web site that has a program called GeoPattern, that makes nice png and svg geometric patterns. It has also been ported to many other languages (https://github.com/search?q=GeoPattern+&type=repositories&p=1).


Converted to Lazarus by WP. Wow can't believe it. A GREAT MANY THANKS to WP for the conversion and also to TRon  for looking at it and gidesa and Thaddy for your replies.

Produced some nice patterns. The extended version on GitHub has extra parameter controls.See attached pictures for what it is capable of making.



Here are also the other ports:

Rust version at (https://github.com/suyash/geopattern-rs) has some unusual patterns.

JavaScript port by Brandon Mills: https://github.com/btmills/geopattern

TypeScript port by MooYeol Lee: https://github.com/mooyoul/geo-pattern

Python port by Bryan Veloso: https://github.com/bryanveloso/geopatterns

Elixir port by Anne Johnson: https://github.com/annejohnson/geo_pattern

PHP port by Anand Capur: https://github.com/redeyeventures/geopattern-php

Go port by Pravendra Singh: https://github.com/pravj/geopattern

CoffeeScript port by Aleks (muchweb): https://github.com/muchweb/geo-pattern-coffee

Cocoa port by Matt Faluotico: https://github.com/mattfxyz/GeoPattern-Cocoa

Middleman extension by @maxmeyer: https://github.com/fedux-org/middleman-geo_pattern

Dart(Flutter) port by @suyash: https://github.com/suyash/geopattern

Lua port by Ivan Azoyan: https://github.com/azoyan/geopattern



Attached are some pics from the Lazarus port of this program.
« Last Edit: May 18, 2024, 06:40:11 am by Boleeman »

Thaddy

  • Hero Member
  • *****
  • Posts: 14846
  • Censorship about opinions does not belong here.
Well, as usual, if you have the formulae you can also do it in Pascal.
Remember the Medway disaster..

gidesa

  • Jr. Member
  • **
  • Posts: 84

I compiled the CSharp program to a DLL but was wondering how to use it in Lazarus to create the Geometric Patterns.

Your DLL is a pure Dotnet one. That is, it doesn't export any API in C ("unmanaged") format, or in Activex/Com format.
So it's unusable from FPC (or Delphi, too).

Thaddy

  • Hero Member
  • *****
  • Posts: 14846
  • Censorship about opinions does not belong here.
There are actually bindings available.
Remember the Medway disaster..

Boleeman

  • Hero Member
  • *****
  • Posts: 537
Thanks ALL for the replies.

Some more samples from the WP Lazarus Port on Github.

Once again, a BIG THANK YOU to WP for making the BGRABmp Lazarus port of this program (that saves to png and SVG). So Fantastic. Christmas has come early.
« Last Edit: May 18, 2024, 04:52:52 am by Boleeman »

gidesa

  • Jr. Member
  • **
  • Posts: 84
Thanks ALL for the replies.
I don't know how to approach this one in Lazarus.

Anyway I thought I would let people on the Lazarus Graphics forum know about it.

Indeed there are Python-Lazarus/Delphi bindings,
https://github.com/pyscripter/python4delphi.
And Lua bindings, for example https://github.com/malcome/Lua4Lazarus.
So, you can try to interface the Python or Lua library to Lazarus.
Think that Lua is much more simple to install (a single Dll, versus many Dll and other files).
And much faster, especially the LuaJit version.

Thaddy

  • Hero Member
  • *****
  • Posts: 14846
  • Censorship about opinions does not belong here.
Give us the formulae... Then we write it in pure pascal. For such things no extra dll's etc are necessary.
Remember the Medway disaster..

TRon

  • Hero Member
  • *****
  • Posts: 2801
@Thaddy, I only had a brief encounter with the code but afaik they are all wrappers around SVG not using plot routines. SO you would actually would have to look at a svg implementation for FPC that support all those routines (or redo them in Pascal ofc).

Thaddy

  • Hero Member
  • *****
  • Posts: 14846
  • Censorship about opinions does not belong here.
There are Pascal implementations for SVG. Do not know how complete they are.
Remember the Medway disaster..

wp

  • Hero Member
  • *****
  • Posts: 12070
Find in the attachment an attempt to convert some of the generators from the Lua version to Lazarus. I did not paint to svg but to a bitmap, and as a consequence there are some occasional rows of pixels at the tile boundaries which are not drawn due to rounding errors. Doing the project with BGRABitmap probably will avoid this since it supports fractional pixels, AFAIK. And I commented out the GenerateSineWave method because I did not want to spend the time to learn how the PolyBezier method works.

Usage: Just type any text into the edit box. The TGeoPattern class calculates the SHA1 hash value of the entered string and determines pattern type, color and opacity from parts of the sha1 string. All the rest is just generation of an image of simple shapes which is tiled over the display area, a paintbox here.

TRon

  • Hero Member
  • *****
  • Posts: 2801
You are fast wp.... really fast.. I was still contemplating how to approach this, e.g. use fpvectorial, bgrasvg or re-create in Pascal (your approach) and that is even in case there isn't another SVG related (vector drawing) implementation that I am not aware of.

Your speed is no match for someone ignorant to the subject trying to figure out what would be the best way  :)
« Last Edit: May 13, 2024, 12:35:36 pm by TRon »

wp

  • Hero Member
  • *****
  • Posts: 12070
Re: GeoPattern: Thanks WP for the conversion
« Reply #11 on: May 17, 2024, 06:24:08 pm »
I extended the code a bit (converted to BGRABitmap, more patterns, save to png and svg, additional control via parameters) and put the application on my GitHub: https://github.com/wp-xyz/GeoPattern/tree/main

Boleeman

  • Hero Member
  • *****
  • Posts: 537
Re: GeoPattern: Thanks WP for the conversion
« Reply #12 on: May 18, 2024, 06:34:50 am »
WP.   The BGRABmp version on Github produces some really nice patterns (with varying opacity, color, styles).
        Been playing around with the new version, making some COOL Patterns. The save to SVG is fantastic.
        Also played around with the additional control via parameters (a great feature for controlling the colors).

        Thank you for the new update.


I came across a wavey pattern that had some semi-circles.
Not sure why it happened, but thought I'd mention it (attached below).

« Last Edit: May 18, 2024, 06:39:06 am by Boleeman »

wp

  • Hero Member
  • *****
  • Posts: 12070
Re: GeoPattern: Thanks WP for the conversion
« Reply #13 on: May 18, 2024, 12:30:11 pm »
I came across a wavey pattern that had some semi-circles.
Not sure why it happened, but thought I'd mention it (attached below).
Please post the generator string that you use to create this pattern so that I can reproduce.

Boleeman

  • Hero Member
  • *****
  • Posts: 537
Re: GeoPattern: Thanks WP for the Lazzed BGRABmp version
« Reply #14 on: May 18, 2024, 07:48:58 pm »
Sorry WP but lost  the generator string.

Perhaps I will add a save and reecall the generator string to Tlistbox feature, so I don't lose it next time.

 

TinyPortal © 2005-2018