Tw1ddle / geometrize-haxe

:triangular_ruler: Geometrize is a Haxe port of primitive that geometrizes images into geometric primitives
https://www.geometrize.co.uk/
Other
348 stars 31 forks source link

expose JavaScript API #15

Closed cancerberoSgx closed 5 years ago

cancerberoSgx commented 5 years ago

This is my current work (WIP) regarding https://github.com/Tw1ddle/geometrize-haxe-web/issues/3. I just want to share it with you for review and discuss. WIP!

IMPORTANT: In order to not pollute this library with JavaScript stuff, maybe is better that this PR only contains changes related to exposing haxe classes and nothing else. Then, we can create an independent project geometrize-js which contains the library, examples and documentation. What do you think ?

TODO

Nice to have (but perhaps in another project?)

Tw1ddle commented 5 years ago

Very good! I've committed the @:exposes and ShapeType constants: https://github.com/Tw1ddle/geometrize-haxe/commit/305b9348b76fadd43a8d27b1ded9677ae249f68d

Perhaps you could create a separate repository that contains a submodule, like my web demo repo?

TypeScript definitions, this .d.ts generator might work though it's a WIP: https://github.com/nadako/hxtsdgen - the creator is really skilled and wants feedback.

Tw1ddle commented 5 years ago

Added function createFromByteArray to Bitmap.hx: https://github.com/Tw1ddle/geometrize-haxe/commit/b4b89247d44d82a3b233ff5dd46b758d8952034f

For the .hxml, I think you could include the lib in one line like this: https://github.com/Tw1ddle/geometrize-haxe-web/blob/master/GeometrizeHaxeWeb.hxml#L7

cancerberoSgx commented 5 years ago

I think those changes are all I need :) I'm now creating the following node.js projects (tell me if that's fine):

I already have implemented geometrize-jswith tests and the playground as react application and is looking fine !!! :) In the typings I took the liberty of copy&paste your haxedocs.

I will update the status here right?

Please let me know if you agree or have any concerns.

Thanks! (it was really easy to do this, haxe was very friendly) :)

Tw1ddle commented 5 years ago

Sounds like a good plan to me. Let me know if I can help at all. I'll link your work in the readme etc when you're ready :smile:

One request, if you make a commercial app please don't use "geometrize" or "primitive" as the name for it, to avoid confusion. Also, include the MIT license text: https://raw.githubusercontent.com/Tw1ddle/geometrize-haxe/master/LICENSE and, optionally, mention primitive and geometrize in the credits.