mirror of
https://github.com/ocornut/imgui.git
synced 2026-09-26 16:05:45 +03:00
Updated Draw List (markdown)
parent
063521d26f
commit
fdfb885d50
1 changed files with 48 additions and 42 deletions
90
Draw-List.md
90
Draw-List.md
|
|
@ -81,9 +81,11 @@ The Default Stroke Position may be overidden by passing one of the dedicated `Im
|
|||
- **ImDrawListFlags_AntiAliasedFill**: is now unsupported, fills are always anti-aliased, except when calling `AddConvexPolyFilledLegacy()` directly.
|
||||
|
||||
|
||||
# API
|
||||
# Primitives
|
||||
|
||||
## `AddLine(p1, p2, col, thickness, flags)`
|
||||
## Lines
|
||||
|
||||
### `AddLine(p1, p2, col, thickness, flags)`
|
||||
|
||||

|
||||
|
||||
|
|
@ -140,7 +142,7 @@ AddLineH( {1,5}, 2)
|
|||
|
||||
</details>
|
||||
|
||||
## `AddLineH(min_x, max_x, y, col, thickness, flags)`
|
||||
### `AddLineH(min_x, max_x, y, col, thickness, flags)`
|
||||
|
||||

|
||||
|
||||
|
|
@ -172,7 +174,7 @@ The default stroke position for `AddLineH()` is **Inside**, which means that 1px
|
|||
|
||||
</details>
|
||||
|
||||
## `AddLineV(x, min_y, max_y, col, thickness, flags)`
|
||||
### `AddLineV(x, min_y, max_y, col, thickness, flags)`
|
||||
|
||||

|
||||
|
||||
|
|
@ -204,7 +206,9 @@ The default stroke position for `AddLineV()` is "inside", which means that 1px l
|
|||
|
||||
</details>
|
||||
|
||||
## `AddRect(p_min, p_max, col, rounding, thickness, flags)`
|
||||
## Rectangles
|
||||
|
||||
### `AddRect(p_min, p_max, col, rounding, thickness, flags)`
|
||||
|
||||

|
||||
|
||||
|
|
@ -248,7 +252,7 @@ Other uses of `AddRect()` should be reviewed to see if the intended use was to d
|
|||
|
||||
</details>
|
||||
|
||||
## `AddRectFilled(p_min, p_max, col, rounding, flags)`
|
||||
### `AddRectFilled(p_min, p_max, col, rounding, flags)`
|
||||
|
||||
Draws filled rectangle from **p_min** (top-left) to **p_max** ( bottom-right), with specified color, rounding. The default rounding is **0.0**. Corner Rounding flags can be used.
|
||||
|
||||
|
|
@ -276,8 +280,9 @@ Rectangles which are draw on non-integer coordinates are anti-aliased.
|
|||
|
||||
</details>
|
||||
|
||||
## Circles, Ellipses
|
||||
|
||||
## `AddCircle(center, radius, col, num_segments, thickness, flags)`
|
||||
### `AddCircle(center, radius, col, num_segments, thickness, flags)`
|
||||
|
||||

|
||||
|
||||
|
|
@ -296,12 +301,40 @@ The 0.5px offset is now removed, and the user can use the stroke position to pla
|
|||
|
||||
</details>
|
||||
|
||||
## `AddCircleFilled(center, radius, col, num_segments)`
|
||||
### `AddCircleFilled(center, radius, col, num_segments)`
|
||||
|
||||
Draws filled circle at **center** using **radius**, with specified color.
|
||||
|
||||
### `AddEllipse(center, radius, col, rot, num_segments, thickness, flags)`
|
||||
|
||||
## `AddNgon(center, radius, col, num_segments, thickness, flags)`
|
||||

|
||||
|
||||
Draws stroked ellipse at **center** using **radius** (separate for x, y), with specified rotation, color, segment count and thickness.
|
||||
|
||||
The default rotation is *0*, segment count is *0* (calculate count automatically based on radius), default thickness is **1.0**, and default stroke position is **Inside**. Stroke Position flags can be used.
|
||||
|
||||
Stroked ellipse drawing is more complicated than other shapes and it does not handle all degenerate inputs, like thick thickness compared to ellipse size, as well as other shapes.
|
||||
|
||||
<details>
|
||||
<summary><b>Changes from versions < 1.93</b></summary>
|
||||
|
||||
The ellipse used to have center stroke position, it is not changed inside to be consistent with other primitive shapes.
|
||||
|
||||
The code did not have the 0.5px offset as other primitive drawing functions, so even 1px thick ellipses may appear smaller than before.
|
||||
|
||||
To get the old behavior set stroke position to center.
|
||||
|
||||
</details>
|
||||
|
||||
### `AddEllipseFilled(center, radius, col, rot, num_segments)`
|
||||
|
||||
Draws filled ellipse at **center** using **radius** (separate for x, y), with specified rotation, color, and segment count.
|
||||
|
||||
The default rotation is *0*, segment count is *0* (calculate count automatically based on radius).
|
||||
|
||||
## N-Gons
|
||||
|
||||
### `AddNgon(center, radius, col, num_segments, thickness, flags)`
|
||||
|
||||

|
||||
|
||||
|
|
@ -323,39 +356,13 @@ The 0.5px offset is now removed, and the user can use the stroke position to pla
|
|||
</details>
|
||||
|
||||
|
||||
## `AddNgonFilled(center, radius, col, num_segments)`
|
||||
### `AddNgonFilled(center, radius, col, num_segments)`
|
||||
|
||||
Draws filled regular polygon at **center** using circumcircle **radius**, with specified color, and segment count.
|
||||
|
||||
## General Polygons
|
||||
|
||||
## `AddEllipse(center, radius, col, rot, num_segments, thickness, flags)`
|
||||
|
||||

|
||||
|
||||
Draws stroked ellipse at **center** using **radius** (separate for x, y), with specified rotation, color, segment count and thickness.
|
||||
|
||||
The default rotation is *0*, segment count is *0* (calculate count automatically based on radius), default thickness is **1.0**, and default stroke position is **Inside**. Stroke Position flags can be used.
|
||||
|
||||
Stroked ellipse drawing is more complicated than other shapes and it does not handle all degenerate inputs, like thick thickness compared to ellipse size, as well as other shapes.
|
||||
|
||||
<details>
|
||||
<summary><b>Changes from versions < 1.93</b></summary>
|
||||
|
||||
The ellipse used to have center stroke position, it is not changed inside to be consistent with other primitive shapes.
|
||||
|
||||
The code did not have the 0.5px offset as other primitive drawing functions, so even 1px thick ellipses may appear smaller than before.
|
||||
|
||||
To get the old behavior set stroke position to center.
|
||||
|
||||
</details>
|
||||
|
||||
## `AddEllipseFilled(center, radius, col, rot, num_segments)`
|
||||
|
||||
Draws filled ellipse at **center** using **radius** (separate for x, y), with specified rotation, color, and segment count.
|
||||
|
||||
The default rotation is *0*, segment count is *0* (calculate count automatically based on radius).
|
||||
|
||||
## `AddPolyline(points, num_points, col, thickness, flags)`
|
||||
### `AddPolyline(points, num_points, col, thickness, flags)`
|
||||
|
||||

|
||||
|
||||
|
|
@ -369,7 +376,7 @@ There are some robustness measures for the case where the line thickness is larg
|
|||
|
||||
The rendering uses textures for ant ialiasing for all line thicknesses. This allows to use just one rendering function, and rendering is as fast on all sizes. There’s max line thickness, 32 (`IM_DRAWLIST_TEX_LINES_WIDTH_MAX`), after which the lines will start to become blurry.
|
||||
|
||||
### Stroke Options
|
||||
#### Stroke Options
|
||||

|
||||
|
||||
If drawing a closed shape, you can omit the last segment and use flag `ImDrawFlags_Closed`. This will also create correct line joins between the first and last segment.
|
||||
|
|
@ -382,7 +389,7 @@ The line ends can have square caps using flag `ImDrawFlags_SquareCap`, which wil
|
|||
|
||||
Shapes that do not have very sharp corners, can use `ImDrawFlags_MiterOnly` draw flag for faster rendering. When this flag is set, some safety measures are skipeed, like beveling sharp corners. A good rule of thumb is that if your shape has 90 degree or rounded corners, you should be able to use this flag.
|
||||
|
||||
### Stroke Position
|
||||
#### Stroke Position
|
||||
|
||||

|
||||
|
||||
|
|
@ -405,8 +412,7 @@ The line ends are now anti-aliased. This solves missing pixels at line ends and
|
|||
|
||||
</details>
|
||||
|
||||
|
||||
## `AddConvexPolyFilled(points, num_points, col)`
|
||||
### `AddConvexPolyFilled(points, num_points, col)`
|
||||
|
||||
Draws filled polygon described by **points** and **num_points**, with specified color. Stroke Options flags can be used.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue