Commit Graph

3675 Commits

Author SHA1 Message Date
ocornut
b8516b3292 DrawList: rename ImDrawFlags_MiterOnly->ImDrawFlags_JoinMiter, ImDrawFlags_SquareCap->ImDrawFlags_CapSquare. 2026-08-06 18:12:11 +02:00
ocornut
3741affa6d Docs: reworked Changelog, comments. 2026-08-06 18:12:11 +02:00
ocornut
c5bc3ba9fe DrawList: rework _SelectFringeTexture() for use by third-party extensions + rename to _SelectLineTexture(). 2026-08-06 18:12:10 +02:00
ocornut
bc2ce848a1 DrawList: amend PushDrawFlag() to report reaching capacity. 2026-08-06 18:12:10 +02:00
ocornut
8688cab452 DrawList: removed ImDrawFlags_UseTexForStrokeLegacy as it doesn't have any use now that legacy code is out of the way. 2026-08-06 18:12:10 +02:00
Mikko Mononen
30f70ac19c DrawList: fixed rendering issues on small and degenerate shapes.
The "does stroke cover the whole shape" used to be overly pessimistic to stroking artifacts. This was due to the fringe, where the geometry would mess up before visually closing the shape.
Fixed the issue by adding max inner offest for the AddPolyline(), which limits the inner offset and also adjusts the texture coords.
Second part of the fix was to calculate the pass the max inner offset from the common shapes (circle, ngon, ellipse, rect).
While this does not fix all the ellipse rendering issues, it limits the issue a lot.
e.g. AddRect() w/ size=5, thickness=2 used to trigger AddRectFilled() fallback because threshold was pessimistic to prevent the AddPolyline() issues.
2026-08-06 18:12:09 +02:00
ocornut
06313c01ef DrawList: ImDrawFlags_AALineEnds also requires ImDrawFlags_AALine, which makes it easier for widgets to opt-in AAEnds. 2026-08-06 18:12:08 +02:00
ocornut
4fa220d168 DrawList: fixed using ImDrawFlags_UseTexForRoundCorners when ImFontAtlasFlags_NoBakedRoundCorners has also been set. 2026-08-06 18:12:08 +02:00
ocornut
b5ef1d837d DrawList: Comments. Atlas's NoBakedLines automatically disable AA at Style level. Fix passing non-Legacy stroke mask to PushDrawFlag(). Demo: Custom Rendering: use LiveEdit everywhere. 2026-08-06 18:12:07 +02:00
ocornut
b67ced86c0 DrawList: support altering RoundCorners flags in scope as an undocumented trick/hack. (9489)
Not documented because it could become troublesome if treated as a guaranteed styling feature.
2026-08-06 18:12:07 +02:00
ocornut
691ea3ff6d DrawList: removed AddPolylineLegacy(), AddConvexPolyFilledLegacy(). 2026-08-06 18:12:07 +02:00
ocornut
fe8acacdde DrawList: moved no-AA handling into _SelectFringeTexture(). 2026-08-06 18:12:06 +02:00
ocornut
4694b50924 DrawList: moved _GetStrokePos() to a local inline function. 2026-08-06 18:12:06 +02:00
ocornut
fb9fd9a250 DrawList: added PushDrawFlag(), PopDrawFlag(), ImSmallStack_<> 2026-08-06 18:12:06 +02:00
ocornut
59014d15e7 DrawList: consistently support scope flags (ImDrawFlags::Flags) + primitive flags.
ImDrawFlags_AAEnds and ImDrawFlags_StrokeLegacy ok. (the most important ones).
ImDrawFlags_UseTexForRoundCorners ok.
ImDrawFlags_AAFill, ImDrawFlags_AAStrokes: for primitives: only for selected ones taking flags params. Haven't added the flag to all functions because it feels like a fringe use case.
ImDrawFlags_TextNoPixelSnap supported in RenderText(), per-prim (9417)
2026-08-06 18:12:05 +02:00
ocornut
7a54e76cd1 DrawList: comment about ImFontAtlasFlags_NoBakedLines. 2026-08-06 18:12:05 +02:00
ocornut
d482fe328e (Breaking) Obsoleted style.AntiAliasedLinesUseTex which now only makes sense for legacy strokes. Added style.AntiAliasedLineEnds. 2026-08-06 18:12:05 +02:00
ocornut
c52b050489 (Breaking) DrawList: removed ImDrawListFlags_in favor of using ImDrawFlags. 2026-08-06 18:12:05 +02:00
ocornut
2c5adecc11 DrawList: new ImDrawFlags API (yet unused in this commit) 2026-08-06 18:12:04 +02:00
ocornut
873afffd8f DrawList: inverted ImDrawFlags_NoAAEnds into ImDrawFlags_AAEnds. 2026-08-06 18:12:04 +02:00
ocornut
f9030f92af ImFontAtlas: moved TexUv buffers and configurable defines to internals. 2026-08-06 18:12:03 +02:00
Mikko Mononen
4da24b1283 DrawList: merged _AddPolyline back into AddPolyline.
- AddPolyline used to call different versions of _AddPolyline, the separation is not needed anymore, one less function call in debug mode
2026-08-05 21:24:56 +02:00
Mikko Mononen
0ac31424b7 DrawList: increase detailed line textures from 3px to 4px to better hide the texture change.
+ amend: align #defines.
2026-08-05 21:24:55 +02:00
Mikko Mononen
2974c9155f DrawList: Optimization: added specialized 2 point polyline _AddLine(). 2026-08-05 21:24:55 +02:00
Mikko Mononen
b6d59d69aa DrawList: added _InvFringeScale to use in cases of 1/_FringeScale. 2026-08-05 21:24:54 +02:00
ocornut
98f25f94aa DrawList: renamed ImDrawFlags_StrokeCenterAligned to ImDrawFlags_StrokeCenterBiased. 2026-08-05 21:24:54 +02:00
ocornut
5565bf2c1d DrawList: avoid using output references in _SelectFringeTexture() + misc tweaks, comments.
Matching coding style and more consistent for matching with other languages.
2026-08-05 21:24:53 +02:00
Mikko Mononen
51da1f5de6 DrawList: fixed thin lines appearing too bright.
- fixed how super sampled line textures are generated (and documented wrong assumption)
- switched to more samples and smaller thickness range
- tweaked super sampled texture selection to hide the texture changed better
2026-08-05 21:24:53 +02:00
Mikko Mononen
1f61cad3d6 DrawList: extend the detailed stroke textures up stroke thickness 4. 2026-08-05 21:24:53 +02:00
Mikko Mononen
e30d8e7888 DrawList: fixed visual pop in stroke rendering when thickness is between 1 and 2 pixels.
- added animated thickness to demo to make it easier to evaluate thickness visual progression
- added super sampled textures in thickness range [1..3] to avoid visual pop
2026-08-05 21:24:52 +02:00
Mikko Mononen
7918bc0b58 DrawList: fixed and optimized _AddRectTinyRounding.
- fixed bug where fringe size was not properly applied in _AddRectTinyRounding
- optimized _AddRectTinyRounding to use less vertices
- changed _AddRectTinyRounding to use similar texturing logic as lines
- remove unused fractional line width texture
2026-08-05 21:24:52 +02:00
ocornut
df7ece5869 DrawList: Textured Round Corners: use same array for fill and strokes.
Feels like a little less book-keeping.
2026-08-05 21:24:52 +02:00
ocornut
ff4ab1b00a DrawList: renamed ImDrawFlags_StrokeCenterPixelAligned to ImDrawFlags_StrokeCenterAligned. 2026-08-05 21:24:52 +02:00
Mikko Mononen
2b0e9043dc DrawList: added ImDrawFlags_NoAAEnds which allows to disable line end AA. 2026-08-05 21:24:51 +02:00
ocornut
b7adfa395d DrawList: misc fixes, amends (replace uses of GetColorU32, macros fixes, default flags). Demo: added rotating square, added MiterOnly checkbox. 2026-08-05 21:24:51 +02:00
Mikko Mononen
6371cd7b1d DrawList: added stroke position to path rendering.
- added generic stroke position to all path rendering
- removed stroke folding in favor of limiting the miter width (simplifies the geometry cases)
- removed fractional stroke rendering in favor of using the integer sized rendering for everything
  - the rationale is that the in-between sizes are a bit blurry anyways, and the error we get from scaling is visually acceptable
- added stroke position option for the demo
- updated the degenerate shape handling
- remove AddLine() stroke pos handling
- removed up commented out code.
2026-08-05 21:24:51 +02:00
Mikko Mononen
4c017c67e9 DrawList: use dedicated larger texture for fractional thickness lines. 2026-08-05 21:24:51 +02:00
Mikko Mononen
08e5215737 DrawList: added square cap rendering.
- Added square cap rendering to the DrawPolyline, which can be turned on by ImDrawFlags_SquareCap
- Added draw flags to AddBezierCubic() and AddBezierQuadratic()
2026-08-05 21:24:50 +02:00
Mikko Mononen
a1d903c743 DrawList: added more robust AddConvexPolyFilled(). (2183, 7972)
- add bevel handling for sharp corners
- add limit to the miter distance to avoid inner shape spikes
- add support for ImDrawFlags_MiterOnly to keep well behaved rendering fast
2026-08-05 21:24:50 +02:00
Mikko Mononen
765ef774b0 DrawList: added special case rendering for the stroked rects when the raounding radius gets really small compared to the stroke thickness.
# Conflicts:
#	imgui.h
#	imgui_draw.cpp
2026-08-05 21:24:50 +02:00
Mikko Mononen
30e53cc6d8 DrawList: improved handling of rounded stroked rectangles, where rounding is less than stroke thickness
# Conflicts:
#	imgui.h
#	imgui_draw.cpp
2026-08-05 21:24:50 +02:00
Mikko Mononen
b097a7bd33 DrawList: added better handling for rendering degenerate geometry. (2183, 7972)
- Add ImDrawFlags_MiterOnly which is used to indicate that a path contains simple geometry and can be rendered using mitered corners
- Added handling of degenerated shapes for stroked rectangle, circle, ngon, and ellipse
- Render shapes filled when outline covers the whole shape
- Clamp very small circles and ngons, and use alpha fade below one pixel
- Added correct offset for ellipse
2026-08-05 21:24:50 +02:00
Mikko Mononen
ce44b4e8be DrawList: added improved polyline rendering. (2183, 7972)
- added 2 variants of polyline rendering
- one handles integersized thickness using one strip of triangles along the line
- second handles any thickness using 2 strips of triangles long the line
2026-08-05 21:24:50 +02:00
ocornut
753cb8474d DrawList: added _GetStrokePos() helper indirection, made flags=0 select default at runtime. 2026-08-05 21:24:49 +02:00
Mikko Mononen
3bfabe3163 DrawList: added ImDrawFlags_StrokeCenterPixelAligned
- added ImDrawFlags_StrokeCenterPixelAligned which center aligns stroke so that outside of the stroke is pixel aligned
- fixed AddRect() non-rounded pixel aligned case to use correnct min/max
- fixed AddRect() default case to not adjust rounding for non-rounded rects
- fixed lineV() centered offset
- renamed ImDrawFlags_StrokeCenterPixelAligned to ImDrawFlags_StrokeCenterAligned.
- reduced debug build indirections.
2026-08-05 21:24:49 +02:00
Mikko Mononen
927df56807 DrawList: Textured Round Corners: Added flags to disable textured rounded corners (1962)
- added ImFontAtlasFlags_NoBakedRoundCorners which controls if rounded corners should be baked to texture
- added ImDrawListFlags_RoundCornersUseTex which controls if we should try to use textured roudned corners
- fixed how _FringeScaleIsInteger is calculated (we want to detect integer pixel scale)
- fixed how _FringeScale is used with textured rounded corners
2026-08-05 21:24:49 +02:00
Mikko Mononen
456858d50f DrawList: Textured Round Corners: implemented faster render path for stroked rectangles. (1962)
- added check to render simpler geometry when (stroked) rectangle has integer coords
- render non.rounded with 4 non-AA rectangles
- added textures for corners of 1-3 thickness and 1-16 rounding
- use textured corners when possible, or fallback to generic one
2026-08-05 21:24:48 +02:00
Mikko Mononen
ba66bdab22 DrawList: Textured Round Corners: first version. (1962) 2026-08-05 21:24:48 +02:00
ocornut
9169879d80 DrawList: added ImDrawFlags_StrokeLegacy support to AddLine(). 2026-08-05 21:24:48 +02:00
Mikko Mononen
484da7ed55 DrawList: added StrokePos flags: ImDrawFlags_StrokeInside, ImDrawFlags_StrokeOutside, ImDrawFlags_StrokeCenter, ImDrawFlags_StrokeLegacy. 2026-08-05 21:24:48 +02:00