Commit Graph

91 Commits

Author SHA1 Message Date
Hajime Hoshi 80e3e01e88 vector: rename functions from DrawFilled* to Fill*
Updates #3150
2025-07-06 23:57:59 +09:00
Hajime Hoshi 97ebef8298 vector: add (*Path).AddPathStroke reimplement DrawFilledPath and StrokePath
The new implementation uses Evan's method [1] using texture representing
a stencil buffer instead of the graphics library's stencil buffer.
This simplifies the implementaiton of the graphics drivers, and enables
better anti-alias without changing the rendering cost.

Also, this fixes an issue of line rendering quality

This change deprecates some existing APIs like DrawImageOptions.AntiAlias
and FillRule. Users should always use DrawFilledPath or StrokePath.

[1] https://medium.com/@evanwallace/easy-scalable-text-rendering-on-the-gpu-c3f4d782c5ac

Closes #3124
Closes #3153
2025-07-06 23:35:48 +09:00
Hajime Hoshi 0a23fdf1b0 vector: refactoring: add stroke.go 2025-07-05 15:54:06 +09:00
Hajime Hoshi f3990b859f vector: optimize rendering
* Skip rendering when a point is a NaN or Inf
* Replace a curve with a line when possible
2025-07-05 15:34:06 +09:00
Hajime Hoshi ef4133ff6d vector: refactoring: introduce vec2 2025-07-05 15:00:02 +09:00
Hajime Hoshi 8f57d19dec vector: performance optimization: reuse slices in sub paths 2025-07-01 02:56:50 +09:00
Hajime Hoshi f96d89f808 vector: add (*Path).AddPath and AddPathOptions
Closes #3266
2025-06-29 16:57:31 +09:00
Hajime Hoshi 2bad42b02d vector: refactoring: introduce subPath and remove opTypeMove and opTypeClose 2025-06-26 20:33:44 +09:00
Hajime Hoshi 4133967934 vector: better resetting flat paths 2025-06-26 17:33:52 +09:00
Hajime Hoshi 714f86a427 vector: bug fix: MoveTo should not close the path 2025-06-26 16:45:28 +09:00
Hajime Hoshi c92412bf5d vector: change MoveTo to update the starting position
Successive MoveTo calls now overwrites the previous MoveTo command
if exists.
2025-06-26 16:07:07 +09:00
Hajime Hoshi b8ac670d61 vector: update comments and variable names 2025-06-26 14:31:10 +09:00
Hajime Hoshi 4dafa5a88d vector: refactoring: rename functions 2025-06-26 00:34:54 +09:00
Hajime Hoshi 1cbf0c63dc vector: change the precision of spliting Bézier curves
The old precision was overkill.
2025-06-25 11:27:30 +09:00
Hajime Hoshi 2ba70652eb vector: refactoring 2025-06-25 00:41:47 +09:00
Hajime Hoshi 3ff920e422 vector: approximate cubic Bézier curve to multiple quad Bézier curves
This is a preparation for the future plan to render vector with Loop-Blinn
algorithm.

Updates #3153
2025-06-25 00:38:09 +09:00
Hajime Hoshi 20a2c2c0a3 vector: keep the original angle at Arc when possible 2025-05-09 00:06:39 +09:00
Hajime Hoshi 7f34354283 vector: bug fix: Arc with 2pi angle should always render a circle
Closes #3234
2025-05-09 00:03:06 +09:00
Hajime Hoshi 3455c626fb vector: add AppendVerticesAndIndicesForFilling32/Stroke32
Closes #3225
2025-04-16 22:06:11 +09:00
Hajime Hoshi db04c37f26 vector: add (*Path).ApplyGeoM
Closes #3150
Closes #3159
2024-11-09 19:06:39 +09:00
Hajime Hoshi a2490cceae vector: expose (*Path).Reset
Closes #3123
2024-10-06 03:41:41 +09:00
Hajime Hoshi adacd71167 Revert "vector: expose (*Path).Reset"
This reverts commit 62978ea270.

Reason: wrong function was exposed

Updates #3123
2024-10-06 03:40:55 +09:00
Hajime Hoshi 62978ea270 vector: expose (*Path).Reset
Closes #3123
2024-10-06 03:34:43 +09:00
Hajime Hoshi fbf40a4455 vector: bug fix: isPointCloseToSegment didn't work when two p0 and p1 are the same
Closes #3061
2024-08-10 17:13:09 +09:00
Hajime Hoshi fc37cdedeb vector: reuse previous allocated subpaths
Closes #3060
2024-08-10 15:13:23 +09:00
Hajime Hoshi 309c886c2e vector: use value type for subpath
Updates #3060
2024-08-10 15:04:13 +09:00
Hajime Hoshi 68380e506e vector: reduce memory allocations by reusing the same Path objects 2024-08-10 14:02:49 +09:00
Hajime Hoshi cdb430b2a5 vector: reduce allocations 2024-08-10 05:35:29 +09:00
Hajime Hoshi 38b8ba5677 vector: lazy point calculation
This is a preparation for #2884.

Updates #2884
2024-08-10 04:09:39 +09:00
Hajime Hoshi b121468991 ebiten: add FillRuleFillAll, FillRuleEvenOdd, and FillRuleNonZero
This change also deprecates the existing constants.

Closes #3006
2024-06-08 17:58:33 +09:00
Hajime Hoshi 230619a036 vector: allow NonZero for AppendVerticesAndIndicesForStroke
Closes #2833
2024-03-23 18:51:25 +09:00
Şeta Narut 87c1766451 vector: typo (segument -> segment) (#2860) 2023-12-12 23:38:43 +09:00
Hajime Hoshi 3ca6184294 ebiten: add a new FillRule: NonZero
Closes #2782
2023-11-06 12:11:38 +09:00
Pierre Curto 4de807cc44 all: fix typos (#2558)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Pierre Curto abd293fae6 text, vector: fix typos and redundant casts (#2537) 2023-01-13 03:28:41 +09:00
Hajime Hoshi c34c072efa vector: change the specificatino of Path.ArcTo
Closes #2401
2022-10-22 02:03:27 +09:00
Hajime Hoshi fa942c824f vector: avoid adding too close points
Rendering a very thick arc caused some glitches. This change should
mitigate this issue.
2022-10-22 01:16:47 +09:00
Hajime Hoshi 6f7b1a81d7 vector: add StrokeLine, FillRect, and StrokeRect
Updates #2387
2022-10-21 22:35:01 +09:00
Hajime Hoshi dbfacb243a vector: bug fix: Arc added unexpected lines from (0, 0)
This change removes Path.cur.
2022-10-21 22:12:48 +09:00
Hajime Hoshi 436bfdb06b vector: update comments 2022-10-21 20:42:13 +09:00
Hajime Hoshi 9e6a1d7ad1 vector: update comments 2022-10-21 20:38:41 +09:00
Hajime Hoshi 6113afae46 vector: bug fix: LineTo should consider the current cursor 2022-10-21 19:25:20 +09:00
Hajime Hoshi a75472b524 vector: add (*Path).Close
Updates #2387
2022-10-21 18:16:48 +09:00
Hajime Hoshi 9a82e5cf86 vector: add a comment about blend
Updates #2396
2022-10-18 23:50:56 +09:00
Hajime Hoshi d2f6d8593b vector: add LineCap
Closes #1843
2022-10-15 00:40:28 +09:00
Hajime Hoshi 225bf1bbb4 vector: add StrokeOptions.MiterLimit 2022-10-14 23:25:59 +09:00
Hajime Hoshi 04680ff761 vector: refactoring 2022-10-14 22:56:15 +09:00
Hajime Hoshi a1a598471b vector: add LineJoin
Updates #1843
2022-10-14 22:11:00 +09:00
Hajime Hoshi f5ae18d6f6 vector: add comments 2022-10-14 19:06:33 +09:00
Hajime Hoshi 1ff55bc745 vector: remove redundant MoveTo 2022-10-11 01:18:18 +09:00