Geometrize Haxe Library

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

このスクリプトは単体で利用できません。右のようなメタデータを含むスクリプトから、ライブラリとして読み込まれます: // @require https://update.greasyfork.org/scripts/585407/1866784/Geometrize%20Haxe%20Library.js

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
作者
cubic074
バージョン
0.0.1.20260703143909
作成日
2026/07/03
更新日
2026/07/03
大きさ
89.7KB
ライセンス
不明

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)