Geometrize Haxe Library

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

Script này sẽ không được không được cài đặt trực tiếp. Nó là một thư viện cho các script khác để bao gồm các chỉ thị meta // @require https://update.greasyfork.org/scripts/585407/1866784/Geometrize%20Haxe%20Library.js

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

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

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

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

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

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Tác giả
cubic074
Phiên bản
0.0.1.20260703143909
Đã tạo
03-07-2026
Đã cập nhật
03-07-2026
Kích thước
90 KB
Giấy phép
N/A

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)