mirror of
https://github.com/ocornut/imgui.git
synced 2026-09-27 00:13:29 +03:00
Docs: reworked Changelog, comments.
This commit is contained in:
parent
bc440d38af
commit
4f5a2aa291
6 changed files with 216 additions and 177 deletions
|
|
@ -39,156 +39,90 @@ HOW TO UPDATE?
|
|||
VERSION 1.93.0 WIP (In Progress)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
- In 1.93, the ImDrawList rendering has been improved to be more robust and more consistent over
|
||||
the whole range of shapes. The rendering now matches much closer to common vector drawing APIs,
|
||||
like html canvas. Improvements, like anti-aliased line endings and stroke position were added,
|
||||
and the coordinates passed to the API are now consistent.
|
||||
Some details are now rendered slightly differently (even if generally more consistent).
|
||||
The difference in rendering is in the range of half a pixel, but that can lead to issues like
|
||||
some lines now look blurrier or more transparent.
|
||||
The rendering of common shapes was optimized when the shapes fall on integer coordinates
|
||||
(which is most of the UI). This includes skipping anti-aliasing when not needed, or using
|
||||
textures instead of tessellated geometry to draw round corners.
|
||||
- Most of the work courtesy of @memononen, with bits from @ocornut, @thedmd, @potocpav.
|
||||
- Refer to our full guides:
|
||||
- ImDrawList Vector Rendering Reference:
|
||||
https://github.com/ocornut/imgui/wiki/Draw-List
|
||||
- Pixel Perfect Anti-aliased Rendering:
|
||||
https://github.com/ocornut/imgui/wiki/Pixel-Perfect-Rendering
|
||||
- How Anti-aliased Polyline Rendering is Implemented:
|
||||
https://github.com/ocornut/imgui/wiki/Polyline-Rendering
|
||||
- (Breaking) AddLine: removed the (+0.5f,+0.5f) offset that was sneakily added to input coordinates.
|
||||
- This fixes inconsistencies in the API and matches the PathXXX API.
|
||||
- By default, stroke thickness extends on both side of the given segment.
|
||||
e.g for a "pixel-perfect" looking line with thickness=1.0f, coords should be passed as center of each ends of the line.
|
||||
- Use `ImDrawFlags_StrokeLegacy` to use old offset if required. But you might as well apply the offset manually!
|
||||
- Generally better to use to newly introduced `AddLineH()`, `AddLineV()` functions.
|
||||
READ IF YOU ARE MINDFUL OF PIXEL-PERFECTNESS IN YOUR CUSTOM RENDERING/WIDGETS:
|
||||
- TRANSITION GUIDE FOR AXIS-ALIGNED LINES:
|
||||
- When switching from legacy `AddLine()` values to `AddLineV()`, `AddLineH()` you can keep same inputs coordinates as before.
|
||||
- Old `AddLine({x, y1}, {x, y2}, col)` --> `AddLineV(x, y1, y2, col);` // Vertical line.
|
||||
- Old `AddLine({x1, y}, {x2, y}, col)` --> `AddLineH(x1, x2, y, col);` // Horizontal line.
|
||||
- This will be equivalent and faster for thickness=1.0f lines.
|
||||
- Since `AddLine()` use default stroke pos Center and `AddLineV()`, `AddLineH()` use Inside, thickness>1.0f strokes will differ.
|
||||
Using `ImDrawFlags_StrokeCenter` will match old result more closely (aka look centered), but is more likely
|
||||
to look blurry as it already did before. Read table below about StrokePos and the
|
||||
"Pixel-Perfect Rendering" guide if you care about pixel-perfect lines.
|
||||
- TRANSITION GUIDE FOR DIAGONAL LINES:
|
||||
- Your lines will appear offset by -0.5f pixels on each axis.
|
||||
Being anti-aliased diagonal lines, they won't look particularly better or worse, just slightly offset.
|
||||
It'll likely only be noticeable if you carefully combined them with other primitives for a pixel-perfect result.
|
||||
- Old AddLine({x1, y1}, {x2, y2}, col) == AddLine({x1, y1}, {x2, y2}, col, thickness, ImDrawFlags_StrokeLegacy); // Offset by +0.5f + disable AA ends.
|
||||
== AddLine({x1 + 0.5f, y1 + 0.5f}, {x2+ 0.5f, y2 + 0.5f}, col, thickness); // Same
|
||||
This reapplies the old offset, and should get you exactly the same result you previously got for thickness=1.0f lines.
|
||||
But said result was sometimes ambiguous and renderer dependent. (#3116, #3258, #2441)
|
||||
- Old `AddLine()` did not have anti-aliased ends, which could create gaps when rendering shapes out
|
||||
of multiple contiguous lines instead of using AddPolyline(). There is a possibility that you could
|
||||
have added fudge offsets here and there which are not necessary anymore or may be simplified.
|
||||
- AddPolyline(), PathStroke(), AddTriangle(): the algorithm to render lines got overhauled.
|
||||
(#2183, #2964, #7972)
|
||||
- Generally fixed rendering of thick strokes/paths.
|
||||
- The new stroke expansion now uses corner miter calculation, which keeps thickness along
|
||||
the line segments consistent. If the corner becomes too sharp, it will be bevelled to avoid
|
||||
long spikes at corners.
|
||||
- There are also some robustness measures for the case where the line thickness is larger
|
||||
than the features being drawn.
|
||||
- Rendering artifacts are still possible when the path features are smaller than line thickness,
|
||||
but the artifacts should be more localized. The new implementation attempted to favor simple
|
||||
implementation and robustness over the corner case accuracy.
|
||||
- New rendering code fixes (subtle) inconsistencies between graphics API (e.g. DirectX vs OpenGL)
|
||||
using different diamond exits rules. New code should work precisely the same regardless
|
||||
of graphics API. (#3116, #3258, #2441)
|
||||
- Added `ImDrawFlags_AALineEnds` flag to enable anti-aliased line ends.
|
||||
- Most noticeable for thick lines.
|
||||
- Helps fills minor gaps if combining multiple individual lines.
|
||||
- Enabling AA Ends by default would be more "correct", but it is slower and increase vertex/index data.s
|
||||
- Added `ImDrawFlags_MiterOnly` flag to disable using beveled corner (closer to legacy
|
||||
rendering, slightly faster, but corners sharper than 90 degrees may expand far out).
|
||||
Automatically used by AddRect(), AddCircle(), AddNgon(), AddEllipse() etc functions
|
||||
since we know that the input path does not contains sharper corners.
|
||||
- Added `ImDrawFlags_SquareCap` flag to use extend lines ends using square caps.
|
||||
- AddConvexPolyFilled()/PathFillConvex(): improved to handle input geometry more robustly.
|
||||
The rendering of sharp corners was improved. Earlier there were issues with sharp corners
|
||||
either creating long spikes, or messing up the adjacent edge’s anti-aliasing. Now the
|
||||
anti-aliasing fringe calculation is more consistent, and sharp corners get bevelled to
|
||||
avoid spikes. There might still be issues when the smallest extent of a long thin polygon
|
||||
is less than a pixel. Also supports `ImDrawFlags_MiterOnly`, to facilitate matching
|
||||
a stroke using the same flag.
|
||||
- AddRect(), AddRectFilled(): various optimization for rounded rectangles. (#1962)
|
||||
- Integer-aligned coordinates and thicknesses will automatically use baked textures,
|
||||
saving on both CPU and vertex/index data.
|
||||
- Added `ImFontAtlasFlags_NoBakedRoundCorners` to disable baking round corners in font atlas.
|
||||
- Added `ImDrawFlags_UseTexForRoundCorners` to enable using round corners.
|
||||
- AddRectFilled(): non-integer coordinates will now display anti-aliased edges. (#6971)
|
||||
- Improved minor mismatches when overlapping strokes and filled shapes,
|
||||
e.g. when using inside strokes,
|
||||
- `AddRect()` and `AddRectFilled()` with rounding now overlap better. (#3656)
|
||||
- `AddCircle()` and `AddCircleFilled()` now overlap better.
|
||||
- Added flags to specify stroke position in all `ImDrawList` stroking functions:
|
||||
- `ImDrawFlags_StrokeInside` (default for closed primitives and AddLineH, AddLineV)
|
||||
- `ImDrawFlags_StrokeCenter` (default for paths, bezier and AddLine)
|
||||
- `ImDrawFlags_StrokeCenterBiased`
|
||||
- `ImDrawFlags_StrokeOutside`
|
||||
- `ImDrawFlags_StrokeLegacy` (may be set as default for a given scope using PushDrawFlag()).
|
||||
- Legacy code was generally applying +0.50f offset which meant that,
|
||||
- with thickness=1.0f: the stroke would appear inside.
|
||||
- with thickness>1.0f: the stroke would start expanding on both sides but starting from that slightly initial offset.
|
||||
- with thickness>1.0f for even integer values, the stroke would look blurry.
|
||||
- TL;DR; the logic didn't make much sense for thickness>1.0f.
|
||||
- Defaulting to Inside for closed shapes ensure that rectangles and lines are never blurry,
|
||||
regardless of thickness, as long as input coordinates/sizes are integers. (#9359)
|
||||
- Read our Wiki guides! Recap:
|
||||
------------------------------------------------------------------------
|
||||
Legacy Inside Outside Center CenterBiased
|
||||
--------------------------------------------------------------------------------
|
||||
Thickness=1.0f sharp sharp sharp blurry sharp
|
||||
Thickness=2.0f blurry sharp sharp sharp sharp
|
||||
Thickness=3.0f sharp sharp sharp blurry sharp
|
||||
------------------------------------------------------------------------
|
||||
- Added ImDrawList::PushDrawFlag()/PopDrawFlag() to alter certain flags for a scope,
|
||||
e.g. `PushDrawFlag(ImDrawFlags_StrokeLegacy, true);` enforce legacy tweaks.
|
||||
- (Breaking) AddRect, AddCircle, AddNgon, AddEllipse: defaulting to "inside" stroke.
|
||||
- All closed shapes with thickness=1.0f will appear identical.
|
||||
- The difference for thickness>1.0f shapes may be minimal since very large strokes
|
||||
were not well supported for widgets, but stroke will default inside widgets.
|
||||
- (Breaking) Merged `ImDrawListFlags` into `ImDrawFlags`.
|
||||
`ImDrawListFlags` was very rarely used directly. Keep inline redirection (will obsolete).
|
||||
- `ImDrawListFlags_AntiAliasedLines` -> `ImDrawFlags_AALines`
|
||||
- `ImDrawListFlags_AntiAliasedFill` -> `ImDrawFlags_AAFill`
|
||||
- `ImDrawListFlags_AntiAliasedLinesUseTex` -> `ImDrawFlags_UseTexForStrokeLegacy`
|
||||
- `ImDrawListFlags_AllowVtxOffset` -> `ImDrawFlags_UseVtxOffset`
|
||||
- `ImDrawListFlags_TextNoPixelSnap` -> `ImDrawFlags_TextNoPixelSnap`
|
||||
Unifying them allows easily using them for both per-primitives and scope alterations.
|
||||
- (Breaking) Enabling `ImFontAtlasFlags_NoBakedLines` in the font atlas will disable
|
||||
support for anti-aliased lines.
|
||||
- About `ImDrawFlags_StrokeLegacy`:
|
||||
- This is designed to emulate old coordinates:
|
||||
- Most shapes are "StrokeCenter".
|
||||
- AddLine() adds a +0.5f,+0.5f offset.
|
||||
- Closed shapes user miter angles.
|
||||
- But there are known difference between legacy code and ImDrawFlags_StrokeLegacy:
|
||||
- Thick shapes with acute angles will now preserve thickness.
|
||||
- Thick shapes with acute angles will protrude a little more.
|
||||
- About disabling anti-aliasing:
|
||||
- Disabling anti-aliasing is now emulated by using different UV coordinates.
|
||||
It does not result in a performance increase any more (however the tendency
|
||||
is that the new code behave better than old code).
|
||||
- Many thick shapes had broken corners with old no-AA code, and the old no-AA code
|
||||
was wildly different from the AA code. Not the case any more. (#288)
|
||||
- Tweaked line rendering in various locations to avoid blurryness:
|
||||
- Windows: title-bar and menu-bar border (when thickness>1.0f).
|
||||
- Tables: borders (when thickness>1.0f).
|
||||
- SeparatorText: border (when thickness>1.0f).
|
||||
- Tree: hierarchy lines (when thickness>1.0f).
|
||||
- TabBar: selected overline border ((when thickness>1.0f).
|
||||
- Demo: Custom Rendering: canvas lines.
|
||||
- Checkbox, Menus: check marks use anti-aliased ends.
|
||||
- Demo: Custom Rendering: exposed new flags; Showcasing overlapping strokes and
|
||||
filled shapes; Added an option to animation thickness; Added new shapes to
|
||||
showcase new rendering features that previously hit limitations.
|
||||
In 1.93.0, the `ImDrawList` rendering API has been improved to be more robust and
|
||||
more consistent over the whole range of shapes. The rendering now matches much closer
|
||||
to common vector drawing APIs, like html canvas. Improvements, like anti-aliased line
|
||||
endings and stroke position were added. The coordinates passed to the API are now
|
||||
consistently describing shape outlines.
|
||||
|
||||
For code using custom rendering: some details are now rendered slightly differently
|
||||
(even if generally more consistent). The difference in rendering is in the range of
|
||||
half a pixel, but that can lead to issues like some lines now look blurrier or more
|
||||
transparent. All Dear ImGui widgets should appear identical or better.
|
||||
|
||||
The rendering of common shapes was optimized when the shapes fall on integer coordinates
|
||||
(which is most of the UI). This includes skipping anti-aliasing when not needed, or
|
||||
using textures instead of tessellated geometry to draw round corners.
|
||||
The varying code-paths are designed to look indistinguishable from each others.
|
||||
|
||||
New rendering code fixes some inconsistencies between graphics APIs (e.g. DirectX vs OpenGL)
|
||||
which are using different diamond exits rules. New code should work precisely the same
|
||||
regardless of graphics API.
|
||||
|
||||
New rendering code also deals better with animating thickness and rounding
|
||||
(integer values are recommended).
|
||||
|
||||
While the current version doesn't make lots of visible use of the new features and
|
||||
facilities, they are among the pillars that will make it easier to create prettier
|
||||
contents, both for custom rendering and future versions of the library.
|
||||
|
||||
Most of the work courtesy of @memononen.
|
||||
Misc reviewing/guiding/fixing by @ocornut.
|
||||
With legacy bits from @thedmd, @potocpav.
|
||||
|
||||
Refer to our guides:
|
||||
- ImDrawList Vector Rendering Reference: https://github.com/ocornut/imgui/wiki/Draw-List
|
||||
(includes a precise list of differences between 1.92.9 and 1.93.0).
|
||||
- Pixel Perfect Anti-aliased Rendering: https://github.com/ocornut/imgui/wiki/Pixel-Perfect-Rendering
|
||||
- How Anti-aliased Polyline Rendering is Implemented: https://github.com/ocornut/imgui/wiki/Polyline-Rendering
|
||||
|
||||
Breaking Changes:
|
||||
|
||||
- DrawList:
|
||||
- AddLine(): removed the (+0.5f,+0.5f) offset that was sneakily added to input coordinates.
|
||||
- This fixes inconsistencies in the API and matches the PathXXX API.
|
||||
- By default, stroke thickness extends on both side of the given segment.
|
||||
e.g for a "pixel-perfect" looking line with thickness=1.0f, coords should be passed as center of each ends of the line.
|
||||
- Use `ImDrawFlags_StrokeLegacy` to use old offset if required. Or you can apply the offset manually!
|
||||
- Generally better to use the recently introduced `AddLineH()`, `AddLineV()` functions added in 1.92.8.
|
||||
READ IF YOU ARE MINDFUL OF PIXEL-PERFECTNESS IN YOUR CUSTOM RENDERING/WIDGETS:
|
||||
- TRANSITION GUIDE FOR AXIS-ALIGNED LINES:
|
||||
- When switching from legacy `AddLine()` values to `AddLineV()`, `AddLineH()` you can keep same inputs coordinates as before:
|
||||
- Old `AddLine({x, y1}, {x, y2}, col)` --> `AddLineV(x, y1, y2, col);` // Vertical line.
|
||||
- Old `AddLine({x1, y}, {x2, y}, col)` --> `AddLineH(x1, x2, y, col);` // Horizontal line.
|
||||
- This will be equivalent and faster for thickness=1.0f lines.
|
||||
- Since `AddLine()` use default stroke pos Center and `AddLineV()`, `AddLineH()` use Inside, thickness>1.0f strokes will differ.
|
||||
Using `ImDrawFlags_StrokeCenter` will match old result more closely (aka look centered),
|
||||
but is more likely to look blurry as it already did before.
|
||||
- Read table below about StrokePos and the "Pixel-Perfect Rendering" guide if you care about pixel-perfect lines.
|
||||
- TRANSITION GUIDE FOR DIAGONAL LINES:
|
||||
- Your lines will appear offset by -0.5f pixels on each axis.
|
||||
Being anti-aliased diagonal lines, they won't look particularly better or worse, just slightly offset.
|
||||
It'll likely only be noticeable if you carefully combined them with other primitives for a pixel-perfect result.
|
||||
- Old `AddLine({x1, y1}, {x2, y2}, col)` --> `AddLine({x1 + 0.5f, y1 + 0.5f}, {x2+ 0.5f, y2 + 0.5f}, col);` // Same
|
||||
or use `ImDrawFlags_StrokeLegacy` --> `AddLine({x1, y1}, {x2, y2}, col, thickness, ImDrawFlags_StrokeLegacy); // Offset by +0.5f + disable AA ends.
|
||||
This reapplies the old offset, and should get you exactly the same result you previously
|
||||
got for thickness=1.0f lines. But said result were previously sometimes ambiguous and
|
||||
renderer-dependent. (#3116, #3258, #2441)
|
||||
- Old code did not support anti-aliased ends, which could create gaps when rendering shapes out
|
||||
of multiple contiguous lines instead of using `AddPolyline()`. There is a possibility that you
|
||||
legacy code added fudge offsets here and there; which may not be necessary anymore if you use
|
||||
`_AALineEnds`, or if you combine rendering of contiguous lines using `AddPolyline()`.
|
||||
- AddRect, AddCircle, AddNgon, AddEllipse, AddTriangle, AddQuad: defaulting to "inside" stroke.
|
||||
- All closed shapes with thickness=1.0f will appear identical.
|
||||
- The difference for thickness>1.0f shapes may be minimal since very large strokes
|
||||
were not well supported for widgets, but stroke will default inside widgets.
|
||||
- Merged `ImDrawListFlags` into `ImDrawFlags`. `ImDrawListFlags` was rarely used directly
|
||||
and generally setup by the ImGui context. Keep inline redirection enums (will obsolete).
|
||||
- `ImDrawListFlags_AntiAliasedLines` -> `ImDrawFlags_AALines`
|
||||
- `ImDrawListFlags_AntiAliasedFill` -> `ImDrawFlags_AAFill`
|
||||
- `ImDrawListFlags_AllowVtxOffset` -> `ImDrawFlags_UseVtxOffset`
|
||||
- `ImDrawListFlags_TextNoPixelSnap` -> `ImDrawFlags_TextNoPixelSnap`
|
||||
Unifying them allows easily using them for both per-primitives and scope alterations.
|
||||
- Marked `ImDrawListFlags_AntiAliasedLinesUseTex` and `style.AntiAliasedLinesUseTex` as
|
||||
obsolete, as the new line rendering code always needs textures.
|
||||
- Enabling `ImFontAtlasFlags_NoBakedLines` in the font atlas will now disable support for
|
||||
anti-aliased lines by clearing `style.AntiAliasedLines`/`style.AntiAliasedLineEnds`.
|
||||
- Style: obsoleted `style.CurveTessellationTol (default 1.25)` which was in Pixels² unit in
|
||||
favor of `style.CurveTessellationMaxError` (default 1.12)` which is in Pixels unit. It is
|
||||
easier to tweak + this allows us to easily scale error threshold on high density screens.
|
||||
|
|
@ -200,8 +134,114 @@ Breaking Changes:
|
|||
obsoleted in 1.91.6 (December 2014), because it needed to forcefully disable support
|
||||
for `ImGuiBackendFlags_RendererHasTextures`. Use the new signature! (#9487)
|
||||
|
||||
|
||||
Other Changes:
|
||||
|
||||
- DrawList:
|
||||
- Added flags to specify stroke position in all `ImDrawList` stroking functions: [@memononen]
|
||||
- `ImDrawFlags_StrokeInside` (default for Rect, Circle/Ellipse, Triangle, Quad, Ngon + AddLineH, AddLineV)
|
||||
- `ImDrawFlags_StrokeCenter` (default for Line, Polyline, Beziers, Paths function)
|
||||
- `ImDrawFlags_StrokeCenterBiased` (center w/ bias for pixel perfect alignment)
|
||||
- `ImDrawFlags_StrokeOutside`
|
||||
- `ImDrawFlags_StrokeLegacy` (match old behavior)
|
||||
- Legacy mode may be set as default for a given scope using `PushDrawFlag(ImDrawFlags_StrokeLegacy, true)`.
|
||||
- Legacy code was generally applying +0.50f offsets which meant that,
|
||||
- with thickness=1.0f: the stroke would appear inside.
|
||||
- with thickness>1.0f: the stroke would start expanding on both sides but starting from that small initial offset.
|
||||
- with thickness>1.0f for even integer values, the stroke would look blurry.
|
||||
- TL;DR; the logic didn't make much sense for thickness>1.0f.
|
||||
- Defaulting to Inside for closed shapes ensure that rectangles and lines are
|
||||
never blurry, regardless of thickness, as long as input coordinates/sizes
|
||||
are integers. (#9359) Recap:
|
||||
------------------------------------------------------------------------
|
||||
Thickness Legacy Inside Outside Center CenterBiased
|
||||
------------------------------------------------------------------------
|
||||
1.0f sharp sharp sharp blurry sharp
|
||||
2.0f blurry sharp sharp sharp sharp
|
||||
3.0f sharp sharp sharp blurry sharp
|
||||
------------------------------------------------------------------------
|
||||
- Read our Wiki guides for more details: https://github.com/ocornut/imgui/wiki/Draw-List
|
||||
- AddPolyline(), PathStroke(), AddTriangle(): the algorithm to render lines got overhauled.
|
||||
(#2183, #2964, #7972 + #9360, #6331, #4250, #4091) [@memononen]
|
||||
- Generally fixed rendering of thick strokes/paths.
|
||||
- The new stroke expansion now uses corner miter calculation, which keeps thickness along
|
||||
the line segments consistent. If the corner becomes too sharp, it will be bevelled to
|
||||
avoid long spikes at corners.
|
||||
- There are also some robustness measures for the case where the line thickness is larger
|
||||
than the features being drawn.
|
||||
- Rendering artifacts are still possible when the path features are smaller than line thickness,
|
||||
but the artifacts should be more localized. The new implementation attempted to favor simple
|
||||
implementation and robustness over the corner case accuracy.
|
||||
- All functions: new rendering code fixes some inconsistencies between graphics APIs
|
||||
(e.g. DirectX vs OpenGL) which are using different diamond exits rules. New code should
|
||||
work precisely the same regardless of graphics API. (#3116, #3258, #2441) [@memononen]
|
||||
- Added `ImDrawFlags_AALineEnds` flag to enable anti-aliased line ends.
|
||||
- Most noticeable for thick lines.
|
||||
- Also helps fill minor gaps if combining multiple individual lines. For best looking
|
||||
continuous lines you should use AddPolyline(), it creates joins between line segments
|
||||
to avoid any gaps.
|
||||
- Added `style.AntiAliasedLineEnds` in ImGui to set default state.
|
||||
- Enabling AA Ends by default would be more "correct", but since it is very slightly
|
||||
slower and increases vertex/index data we decided to not enable it by default.
|
||||
This keeps situations such as "throw tens of thousands of lines at ImDrawList"
|
||||
optimal. You can opt-in for a given shape or in a scope using `PushDrawFlag()`.
|
||||
- Added `ImDrawFlags_MiterOnly` flag to disable using beveled corner.
|
||||
- Closer to legacy rendering and slightly faster, but corners sharper than
|
||||
90 degrees may expand far out.
|
||||
- Automatically used by AddRect(), AddCircle(), AddNgon(), AddEllipse() functions
|
||||
since we know that the input path does not contain sharper corners.
|
||||
- Added `ImDrawFlags_SquareCap` flag to extend lines ends using square caps. (#9360)
|
||||
- AddConvexPolyFilled()/PathFillConvex(): improved to handle input geometry more robustly.
|
||||
The rendering of sharp corners was improved. Earlier there were issues with sharp corners
|
||||
either creating long spikes, or messing up the adjacent edge's anti-aliasing. Now the
|
||||
anti-aliasing fringe calculation is more consistent, and sharp corners get bevelled to
|
||||
avoid spikes. There might still be issues when the smallest extent of a long thin polygon
|
||||
is less than a pixel. Also supports `ImDrawFlags_MiterOnly`, to facilitate matching
|
||||
a stroke using the same flag.
|
||||
- AddRect(), AddRectFilled(): various optimizations for rounded rectangles. (#1962)
|
||||
- Integer-aligned coordinates and thicknesses will automatically use baked textures,
|
||||
saving on both CPU and vertex/index data.
|
||||
- Enabled by default. Use `ImFontAtlasFlags_NoBakedRoundCorners` to disable baking
|
||||
round corners in font atlas.
|
||||
- Added `ImDrawFlags_UseTexForRoundCorners` flag to enable in scope or per-shape.
|
||||
Added for consistency and debugging, not really needed in practice.
|
||||
- AddRectFilled(): non-integer coordinates will now display anti-aliased edges.
|
||||
Previously, non-integer coordinates rendered with aliased edges snapped by the
|
||||
rasterizer. (#6971)
|
||||
- Improved debug-build performance in various locations.
|
||||
- Improved minor mismatches when overlapping strokes and filled shapes.
|
||||
For example, when using inside strokes,
|
||||
- `AddRect()` and `AddRectFilled()` with rounding now overlap better. (#3656)
|
||||
- `AddCircle()` and `AddCircleFilled()` now overlap better.
|
||||
- Added ImDrawList::PushDrawFlag()/PopDrawFlag() to alter certain flags for a
|
||||
scope and a given `ImDrawList`. (#9489)
|
||||
- e.g. `PushDrawFlag(ImDrawFlags_StrokeLegacy, true);` enforce legacy tweaks.
|
||||
- About `ImDrawFlags_StrokeLegacy`:
|
||||
- This is designed to emulate old behavior:
|
||||
- Most shapes use `ImDrawFlags_StrokeCenter`.
|
||||
- AddLine() add +0.5f,+0.5f offset to position.
|
||||
- AddCircle(), AddNgon() add a -0.5f offset to radius.
|
||||
- Closed shapes use miter corners.
|
||||
- Lines don't have anti-aliased ends.
|
||||
- But there are known difference between legacy code and ImDrawFlags_StrokeLegacy:
|
||||
- Thick shapes with acute angles will now preserve thickness better,
|
||||
which may make them appear as protruding a little more.
|
||||
- About disabling anti-aliasing:
|
||||
- Disabling anti-aliasing is now emulated by applying different UV coordinates.
|
||||
- It does not result in a performance increase or vertex/index data decrease any more.
|
||||
(however the tendency is that the new code behaves better than old code).
|
||||
- But may be a useful stylistic choice in some circumstances.
|
||||
- Many thick shapes had broken corners with old no-AA code, and the old no-AA code
|
||||
was wildly different from the AA code. Not the case any more. (#288)
|
||||
- Per-viewport FramebufferScale for Apple/Retina screen is applied to draw lists:
|
||||
- AA Fringe is scaled accordingly.
|
||||
- Circle and Curves tessellation error are scaled accordingly.
|
||||
- Reworked assert in PushTexture() to allow convenience grace period of using a
|
||||
texture that was queue for destroy during the frame. Make it safe to stick to
|
||||
an existing texture during the frame. (#9528, #8465)
|
||||
- Added optional `platform_io.DrawCallback_SetSamplerFromTex` standard backend-agnostic
|
||||
draw callback for requesting to use the sampler associated already associated to a texture.
|
||||
Currently only supported by the OpenGL2/3 and SDLRenderer3 backend. (#9378)
|
||||
- Drags, Sliders:
|
||||
- Fixed an overflow using `ImGuiSliderFlags_Logarithmic` with S32/S64 types which
|
||||
leads to clamped interactions. (#9526, #3361, #1823, #1316, #642) [@lailoken]
|
||||
|
|
@ -257,18 +297,19 @@ Other Changes:
|
|||
and various operators.
|
||||
- IO: restore default clipboard/ime/shell platform handlers on ClearPlatformHandlers(), fixing
|
||||
issues switching backends mid-session to one relying on default. (#9537, #8945, #2769) [@lstalmir]
|
||||
- DrawList:
|
||||
- Per-viewport FramebufferScale for Apple/Retina screen is applied to draw lists:
|
||||
- AA Fringe is scaled accordingly.
|
||||
- Circle and Curves tessellation error are scaled accordingly.
|
||||
- Reworked assert in PushTexture() to allow convenience grace period of using a
|
||||
texture that was queue for destroy during the frame. Make it safe to stick to
|
||||
an existing texture during the frame. (#9528, #8465)
|
||||
- Added optional `platform_io.DrawCallback_SetSamplerFromTex` standard backend-agnostic
|
||||
draw callback for requesting to use the sampler associated already associated to a texture.
|
||||
Currently only supported by the OpenGL2/3 and SDLRenderer3 backend. (#9378)
|
||||
- Widgets:
|
||||
- Checkbox, Menus: check marks use anti-aliased ends.
|
||||
- Tweaked rendering in various locations to avoid blurryness:
|
||||
- Windows: title-bar and menu-bar border (when thickness>1.0f).
|
||||
- SeparatorText: border (when thickness>1.0f).
|
||||
- Tree: hierarchy lines (when thickness>1.0f).
|
||||
- InputText: input caret (when thickness>1.0f).
|
||||
- TabBar: selected overline border (when thickness>1.0f).
|
||||
- Demo:
|
||||
- Added `Widgets->Mixed Values` section. (#5518, #5677, #6865)
|
||||
- Custom Rendering section: exposed new flags; showcasing overlapping strokes
|
||||
and filled shapes; added an option to animate thickness; added new shapes
|
||||
to showcase new rendering features that previously hit limitations.
|
||||
- Style Editor: fixed style/colors combo box applying style when opening Combo.
|
||||
- Backends:
|
||||
- QNX: added QNX Screen backend. (#9492) [@mgorchak-blackberry]
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
|||
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
2026/06/XX (1.XXXX) - merged ImDrawListFlags into ImDrawFlags. obsoleted ImDrawListFlags (which were rarely used directly):
|
||||
2026/10/XX (1.93.0) - merged ImDrawListFlags into ImDrawFlags. obsoleted ImDrawListFlags (which were rarely used directly):
|
||||
- ImDrawListFlags_AntiAliasedLines -> ImDrawFlags_AALines,
|
||||
- ImDrawListFlags_AntiAliasedFill -> ImDrawFlags_AAFill,
|
||||
- ImDrawListFlags_AllowVtxOffset -> ImDrawFlags_UseVtxOffset,
|
||||
|
|
|
|||
16
imgui.h
16
imgui.h
|
|
@ -3471,7 +3471,7 @@ enum ImDrawFlags_
|
|||
ImDrawFlags_SquareCap = 1 << 11, // OK -- // PathStroke(), AddPolyline(): use square cap line ends.
|
||||
|
||||
// About Stroke Ends:
|
||||
// - Rendering is optimized for fast pixel-perfect UI, so line ends are not anti-aliased by default. It cheaper (we can emit less vertices).
|
||||
// - Rendering is optimized for fast pixel-perfect UI, so line ends are not anti-aliased by default. It's cheaper (we can emit less vertices).
|
||||
// - For more free-form drawings, light graphs and markers, or when using thick strokes: you can turn them on using the ImDrawFlags_AALineEnds flag.
|
||||
// - See 'Demo->Examples->Custom Rendering' to interactively toy with those flags.
|
||||
// - 'OK*' indicates using this at the AddXXX() call site is unlikely: it would only makes sense if (1) the option is disabled in style/scope and (2) you want to forcefully enable it for a single primitives. Possible but unlikely! Only supported for functions taking flags inputs.
|
||||
|
|
@ -3483,12 +3483,12 @@ enum ImDrawFlags_
|
|||
//ImDrawFlags_NoAALineEnds = 1 << 16, // OK -- // Disable anti-aliasing ends for a given primitive.
|
||||
|
||||
// About Stroke Position:
|
||||
// - Read https://github.com/ocornut/imgui/wiki/Draw-List
|
||||
// - Read https://github.com/ocornut/imgui/wiki/Draw-List (this guide includes a precise list of differences between 1.92.9 and 1.93.0)
|
||||
// - Read https://github.com/ocornut/imgui/wiki/Pixel-Perfect-Rendering
|
||||
// Stroke Position relative to shape outline -- // Prim/Scope?
|
||||
ImDrawFlags_StrokeInside = 1 << 17, // OK -- // Draw stroke inside of the shape outline (default for closed shapes and AddLineH, AddLineV functions)
|
||||
ImDrawFlags_StrokeCenter = 2 << 17, // OK -- // Draw stroke at the center of the shape outline (default for paths, bezier, and AddLine functions)
|
||||
ImDrawFlags_StrokeCenterBiased = 3 << 17, // OK -- // Draw stroke at the center of the shape outline, so that half thickness rounded down will be outside, and rest inside the shape outline. Useful for axis-aligned shapes: AddLineH, AddLineV, AddRect. Does not animate well!
|
||||
ImDrawFlags_StrokeCenterBiased = 3 << 17, // OK -- // Draw stroke at the center of the shape outline, so that half thickness rounded down will be outside, and the rest inside the shape outline. Useful for axis-aligned shapes: AddLineH, AddLineV, AddRect. Does not animate well!
|
||||
ImDrawFlags_StrokeOutside = 4 << 17, // OK -- // Draw stroke outside of the shape outline
|
||||
ImDrawFlags_StrokeLegacy = 7 << 17, // OK OK(0) // Use legacy positioning + enable MiterOnly + disable AALineEnds. Must be all bits set.
|
||||
|
||||
|
|
@ -3502,8 +3502,8 @@ enum ImDrawFlags_
|
|||
ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone, // [Internal]
|
||||
ImDrawFlags_AllowInPushScope_ = ImDrawFlags_AAFill | ImDrawFlags_AALines | ImDrawFlags_AALineEnds | ImDrawFlags_StrokeLegacy | ImDrawFlags_TextNoPixelSnap | ImDrawFlags_UseTexForRoundCorners | ImDrawFlags_UseVtxOffset | ImDrawFlags_RoundCornersMask_, // [Internal] Values allowed in PushDrawFlag() scope.
|
||||
ImDrawFlags_AllowInFrameScope_ = ImDrawFlags_AllowInPushScope_ | ImDrawFlags_AllowTexForRoundCorners_,
|
||||
ImDrawFlags_StrokeMask_ = 0x07 << 17, // [Internal]
|
||||
ImDrawFlags_InvalidMask_ = ~0x7FFFFFF0, // [Internal] == 0x8000000F. Reserved to detect misuses.
|
||||
ImDrawFlags_StrokeMask_ = 0x07 << 17, // [Internal]
|
||||
ImDrawFlags_InvalidMask_ = ~0x7FFFFFF0, // [Internal] == 0x8000000F. Reserved to detect misuses.
|
||||
};
|
||||
|
||||
// Draw command list
|
||||
|
|
@ -3690,7 +3690,7 @@ struct ImDrawList
|
|||
IMGUI_API void _AddRectTinyRounding(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding, float thickness, ImDrawFlags flags);
|
||||
IMGUI_API void _SelectLineTexture(float screen_thickness, ImVec2* out_uv0, ImVec2* out_uv1, float* out_fringe, ImDrawFlags flags);
|
||||
IMGUI_API float _CalculateCenterBiasedOffset(float thickness);
|
||||
IMGUI_API void _AddPolyline(const ImVec2* points, int num_points, ImU32 col, float thickness, ImDrawFlags flags, float max_inner_thickness);
|
||||
IMGUI_API void _AddPolyline(const ImVec2* points, int num_points, ImU32 col, float thickness, ImDrawFlags flags, float max_inner_offset);
|
||||
};
|
||||
|
||||
// All draw data to render a Dear ImGui frame
|
||||
|
|
@ -3907,7 +3907,7 @@ enum ImFontAtlasFlags_
|
|||
ImFontAtlasFlags_None = 0,
|
||||
ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, // Don't round the height to next power of two
|
||||
ImFontAtlasFlags_NoMouseCursors = 1 << 1, // Don't build software mouse cursors into the atlas (save a little texture memory)
|
||||
ImFontAtlasFlags_NoBakedLines = 1 << 2, // [OBSOLETE] Don't build line textures into the atlas (save a little texture memory). SINCE 1.93.0 THIS PREVENT ANTI-ALIASED STROKES FROM WORKING AND WILL DISABLE AA.
|
||||
ImFontAtlasFlags_NoBakedLines = 1 << 2, // Don't build anti-aliased line textures into the atlas (save a little texture memory). SINCE 1.93.0 THIS PREVENTS ANTI-ALIASED LINES FROM WORKING AND WILL DISABLE THEM.
|
||||
ImFontAtlasFlags_NoBakedRoundCorners= 1 << 3, // Don't build round corners into the atlas.
|
||||
};
|
||||
|
||||
|
|
@ -4575,7 +4575,7 @@ enum ImDrawListFlags_
|
|||
ImDrawListFlags_None = ImDrawFlags_None,
|
||||
ImDrawListFlags_AntiAliasedFill = ImDrawFlags_AAFill,
|
||||
ImDrawListFlags_AntiAliasedLines = ImDrawFlags_AALines,
|
||||
ImDrawListFlags_AntiAliasedLinesUseTex = 0, // Only apply to StrokeLegacy mode!
|
||||
ImDrawListFlags_AntiAliasedLinesUseTex = ImDrawFlags_AALines, // No effect, anti-aliased rendering always uses textures from 1.93+
|
||||
ImDrawListFlags_AllowVtxOffset = ImDrawFlags_UseVtxOffset,
|
||||
ImDrawListFlags_TextNoPixelSnap = ImDrawFlags_TextNoPixelSnap,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10568,8 +10568,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||
ImGui::CheckboxFlags("AALineEnds", &prim_other_flags, ImDrawFlags_AALineEnds); ImGui::SameLine();
|
||||
ImGui::CheckboxFlags("MiterOnly", &prim_other_flags, ImDrawFlags_MiterOnly); ImGui::SameLine();
|
||||
ImGui::CheckboxFlags("SquareCap", &prim_other_flags, ImDrawFlags_SquareCap);
|
||||
//ImGui::CheckboxFlags("UseTexForRoundCorners", &prim_other_flags, ImDrawFlags_UseTexForRoundCorners); ImGui::SameLine();
|
||||
//ImGui::CheckboxFlags("UseTexForStrokeLegacy", &prim_other_flags, ImDrawFlags_UseTexForStrokeLegacy);
|
||||
//ImGui::CheckboxFlags("UseTexForRoundCorners", &prim_other_flags, ImDrawFlags_UseTexForRoundCorners);
|
||||
|
||||
static ImDrawFlags scope_flags = draw_list->Flags & ImDrawFlags_AllowInPushScope_; // First init copy current state.
|
||||
ImGui::SeparatorText("Current ImDrawList flags (e.g. PushDrawFlag function)");
|
||||
|
|
@ -10578,8 +10577,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||
ImGui::CheckboxFlags("AALines", &scope_flags, ImDrawFlags_AALines); ImGui::SameLine();
|
||||
ImGui::CheckboxFlags("AALineEnds", &scope_flags, ImDrawFlags_AALineEnds); ImGui::SameLine();
|
||||
ImGui::CheckboxFlags("StrokeLegacy", &scope_flags, ImDrawFlags_StrokeLegacy);
|
||||
//ImGui::CheckboxFlags("UseTexForRoundCorners", &scope_flags, ImDrawFlags_UseTexForRoundCorners); ImGui::SameLine();
|
||||
//ImGui::CheckboxFlags("UseTexForStrokeLegacy", &scope_flags, ImDrawFlags_UseTexForStrokeLegacy);
|
||||
//ImGui::CheckboxFlags("UseTexForRoundCorners", &scope_flags, ImDrawFlags_UseTexForRoundCorners);
|
||||
ImGui::PopID();
|
||||
ImGui::Spacing();
|
||||
|
||||
|
|
@ -10602,7 +10600,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||
for (int side = 0; side < 4; side++)
|
||||
{
|
||||
float t = (float)ImGui::GetTime() * 0.1f + side * pi * 0.5f;
|
||||
rotating_square[side] = { (float)cosf(t) * half_sz, (float)sin(t) * half_sz };
|
||||
rotating_square[side] = { (float)cosf(t) * half_sz, (float)sinf(t) * half_sz };
|
||||
}
|
||||
|
||||
float x = start_pos.x;
|
||||
|
|
|
|||
|
|
@ -4840,7 +4840,7 @@ static void ImFontAtlasBuildUpdateTexDataBasic(ImFontAtlas* atlas)
|
|||
|
||||
static int InitCornerGeometry(float cx, float cy, float rounding, float circle_segment_max_error, ImVec2* line_normals, float* line_distances)
|
||||
{
|
||||
// This tries to quite faithfully replication how we render the corners using tessellation.
|
||||
// This tries to quite faithfully replicate how we render the corners using tessellation.
|
||||
// Older code sampled a circle SDF directly, but it had clearly visible discrepancy between the baked corners
|
||||
// and tessellated corners due to circle_segment_max_error.
|
||||
|
||||
|
|
@ -5089,9 +5089,9 @@ static void ImFontAtlasBuildUpdateTexDataLines(ImFontAtlas* atlas)
|
|||
}
|
||||
|
||||
{
|
||||
// Calculate super sampled lin textures for smaller line widths to make transition between sizes smoother.
|
||||
// Calculate super sampled line textures for smaller line widths to make transition between sizes smoother.
|
||||
|
||||
// Calc ramp used for all the textures.
|
||||
// Calculate ramp used for all the textures.
|
||||
ImU8 ramp[IM_DRAWLIST_TEX_LINES_SAMPLE_COUNT];
|
||||
for (int n = 0; n < IM_DRAWLIST_TEX_LINES_SAMPLE_COUNT; n++)
|
||||
ramp[n] = (ImU8)(((float)n / IM_DRAWLIST_TEX_LINES_SAMPLE_COUNT) * 255.0f);
|
||||
|
|
@ -5108,7 +5108,7 @@ static void ImFontAtlasBuildUpdateTexDataLines(ImFontAtlas* atlas)
|
|||
// To super 2x sample that signal, we end up with following texture:
|
||||
// [ 0 | .5 | 1 | .5 | 0 ]
|
||||
// :.......................:
|
||||
// One might think that there should be 2 opaque pixels the the middle section, but no singe we're super sampling the triangle signal.
|
||||
// One might think that there should be 2 opaque pixels in the middle section, but no since we're super sampling the triangle signal.
|
||||
const int line_width = 1 + n;
|
||||
IM_ASSERT(IM_DRAWLIST_TEX_LINES_SAMPLE_COUNT + line_width + IM_DRAWLIST_TEX_LINES_SAMPLE_COUNT <= r.w && y < r.h); // Make sure we're inside the texture bounds before we start writing pixels
|
||||
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : (x > 0.0f
|
|||
inline double ImSign(double x) { return (x < 0.0) ? -1.0 : (x > 0.0) ? 1.0 : 0.0; }
|
||||
#ifdef IMGUI_ENABLE_SSE
|
||||
inline float ImRsqrt(float x) { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }
|
||||
// Converge to more precise solution using single step of Newton-Raphson method, repeating increase precision
|
||||
// Converge to more precise solution using single step of Newton-Raphson method, repeating increases precision
|
||||
inline float ImRsqrtPrecise(float x) { const float r = _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); return r * (1.5f - x * 0.5f * r * r); }
|
||||
#else
|
||||
inline float ImRsqrt(float x) { return 1.0f / sqrtf(x); }
|
||||
|
|
@ -933,7 +933,7 @@ IMGUI_API ImGuiStoragePair* ImLowerBound(ImGuiStoragePair* in_begin, ImGuiStorag
|
|||
#define IM_DRAWLIST_ARCFAST_SAMPLE_MAX IM_DRAWLIST_ARCFAST_TABLE_SIZE // Sample index _PathArcToFastEx() for 360 angle.
|
||||
|
||||
#ifndef IM_DRAWLIST_TEX_LINES_WIDTH_MAX
|
||||
#define IM_DRAWLIST_TEX_LINES_WIDTH_MAX (32) // The maximum line width to bake anti-aliased textures for. Build atlas with ImFontAtlasFlags_NoBakedLines to disable baking.
|
||||
#define IM_DRAWLIST_TEX_LINES_WIDTH_MAX (32) // The maximum line width to bake anti-aliased textures for.
|
||||
#endif
|
||||
#ifndef IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH
|
||||
#define IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH (4) // Calculate detailed textures for width [1..IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue