Ebiten: vector: Add various shapes

Created on 14 Apr 2019  Â·  16Comments  Â·  Source: hajimehoshi/ebiten

  • Rectangle
  • Circle
  • Ellipse
  • Arc

This should be easily implemented by using LineTo.

feature help-wanted

Most helpful comment

In the meantime, if anyone wants vectors (and they aren't rendered/updated on every frame) they can use https://github.com/fogleman/gg to render into a texture, and then create a new *ebiten.Image from it. If the shapes need to be dynamic, you could use a "is dirty" pattern: http://gameprogrammingpatterns.com/dirty-flag.html

All 16 comments

As per our talk on slack, I propose we could port Allegro's triangulator to Go,
(https://github.com/liballeg/allegro5/blob/master/addons/primitives/triangulator.c),
then implement the same functions as the allegro primitives, ported to Go. These are based on triangulations as well. The API is: https://www.allegro.cc/manual/5/primitives.html

Thank you for the info! Please give some time to consider since I don't have enough bandwidth...

  • Let's add ArcTo
  • Rename BezierCurveTo to CubicTo?
  • Rename QuadraticCurveTo to QuadTo?
  • Add ConicTo? (See https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/curves/beziers#the-conic-b%C3%A9zier-curve)

https://skia.org/user/api/SkPath_Reference#SkPath_arcTo

An arc is represented as a conic Bezier curve. Interesting.

arcTo appends at most one Line and one conic. arcTo implements the functionality of PostScript arct and HTML Canvas arcTo.

any news?

There is a 'vector' package and an example using it.

  • github.com/hajimehoshi/ebiten/vector
  • github.com/hajimehoshi/ebiten/examples/vector

The API is still unstable.

Now vector has Path and you can add segments by LineTo, QuadTo and CubicTo. They are similar to Skia's functions. The path can also be filled with a solid color. ConicTo does not exist yet.

https://github.com/google/skia/blob/master/src/core/SkPath.cpp I'm referring Skia implementation to add more user-friendly functions like arcTo. It would take more time than I expected and I'll do this in the next milestone maybe...

In the meantime, if anyone wants vectors (and they aren't rendered/updated on every frame) they can use https://github.com/fogleman/gg to render into a texture, and then create a new *ebiten.Image from it. If the shapes need to be dynamic, you could use a "is dirty" pattern: http://gameprogrammingpatterns.com/dirty-flag.html

Is this still ongoing or was it closed by #1111 or PRs that are related to that

This is not related to #1111. I don't have enough bandwidth to work on this now.

I'm busy with porting Ebiten to Switch and fixing audio issues for v2.1.0. Let me change the milestone.

Do you mean the Nintendo Switch? That's great news! 🙂

Op za 16 jan. 2021 13:45 schreef Hajime Hoshi notifications@github.com:

I'm busy with porting Ebiten to Switch and fixing audio issues for v2.1.0.
Let me change the milestone.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/hajimehoshi/ebiten/issues/844#issuecomment-761558034,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAARM6MZJLQFP6DQWM54T3DS2GC7HANCNFSM4HF2SHFQ
.

Yes :-)

Wonderful! Please document it well, I would love to port my puzzle game to
the Switch.

Op za 16 jan. 2021 18:17 schreef Hajime Hoshi notifications@github.com:

Yes :-)

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/hajimehoshi/ebiten/issues/844#issuecomment-761600071,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAARM6KUHCBRTRI5WCEVEC3S2HC4DANCNFSM4HF2SHFQ
.

Of course we're preparing documentations, but unfortunately I cannot make the document public due to the NDA.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hajimehoshi picture hajimehoshi  Â·  6Comments

mortenson picture mortenson  Â·  7Comments

hajimehoshi picture hajimehoshi  Â·  6Comments

hajimehoshi picture hajimehoshi  Â·  3Comments

hajimehoshi picture hajimehoshi  Â·  4Comments