Geometrize Haxe Library

Geometrize Haxe is a Haxe library for recreating images with geometric primitives

Ten skrypt nie powinien być instalowany bezpośrednio. Jest to biblioteka dla innych skyptów do włączenia dyrektywą meta // @require https://update.greasyfork.org/scripts/585407/1866784/Geometrize%20Haxe%20Library.js

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Autor
cubic074
Wersja
0.0.1.20260703143909
Utworzono
03-07-2026
Zaktualizowano
03-07-2026
Rozmiar
89,7 KB
Licencja
Brak licencji

Geometrize Haxe Library

This is a standalone browser build of the original Geometrize algorithm. It exposes itself on globalThis.geometrize and uses a bundled Web Worker to iteratively approximate a target image with simple geometric shapes.

How It Works

The script expects specific DOM elements to exist, such as runpausebutton, stepbutton, openimageinput, circles, lines, shapesaddedtext, maxshapescaptextedit, and currentsvgcontainer.

When initialized, it:

  1. Loads a target image from the file input or from geometrize.setTargetCanvas(canvas).
  2. Converts the image into an internal bitmap.
  3. Sends the bitmap to its Web Worker.
  4. On each step, the worker searches for the best next shape.
  5. The selected shape is appended to:
    • shapeJsonData
    • shapeSvgData
    • the live SVG preview in currentsvgcontainer
  6. Generation stops when the max shape count is reached or when paused.

Exposed API

The script exposes helper methods on globalThis.geometrize:

  • geometrize.main
  • geometrize.getShapeJsonData()
  • geometrize.getShapeSvgData()
  • geometrize.getShapeCount()
  • geometrize.setTargetCanvas(canvas)
  • geometrize.setMaxShapeCount(limit)