|
RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
|
chart_candles.h — the candlestick painter: one open/high/low/close slot per candle across rect. More...
#include <stddef.h>#include <stdint.h>#include "fb.h"#include "geom.h"#include "style.h"#include "draw_target.h"#include "ui_context.h"Data Structures | |
| struct | rmgui_chart_view_t |
| Visible chart value range [v0, v1] and time window [t0, t1] in ms. More... | |
| struct | rmgui_chart_candle_t |
| One open/high/low/close bar. More... | |
| struct | rmgui_chart_candles_view_t |
| Candles borrowing count oldest-first records and an ascending window (v0 < v1, t0 < t1). More... | |
Macros | |
| #define | RMGUI_CHART_VIEW_T_DEFINED |
Functions | |
| void | rmgui_chart_candles_paint (rmgui_fb_t *fb, rmgui_rect_t rect, rmgui_rect_t clip, const rmgui_chart_view_t *view, const rmgui_style_resolved_t *rs, const rmgui_chart_candle_t *candles, size_t count) |
| Paints count candles of candles left to right across rect, clipped to clip. | |
| void | rmgui_chart_candles_paint_to (rmgui_target_t *, rmgui_rect_t, rmgui_rect_t, const rmgui_chart_view_t *, const rmgui_style_resolved_t *, const rmgui_chart_candle_t *, size_t) |
| Explicit destination candles, preserving CPU geometry and clipping. | |
| int | rmgui_chart_candles_draw (const rmgui_ui_t *ui, const rmgui_chart_candles_view_t *candles, rmgui_rect_t rect) |
| Draw the candles. | |
chart_candles.h — the candlestick painter: one open/high/low/close slot per candle across rect.
The value/time window the chart painters map; chart_axis.h declares the same type and the guard reconciles the copies. v0 < v1 and t0 < t1: painters refuse a view that violates either bound.
| #define RMGUI_CHART_VIEW_T_DEFINED |
| void rmgui_chart_candles_paint | ( | rmgui_fb_t * | fb, |
| rmgui_rect_t | rect, | ||
| rmgui_rect_t | clip, | ||
| const rmgui_chart_view_t * | view, | ||
| const rmgui_style_resolved_t * | rs, | ||
| const rmgui_chart_candle_t * | candles, | ||
| size_t | count ) |
Paints count candles of candles left to right across rect, clipped to clip.
Candle i owns the slot starting at rect.x + i*rect.w/count (64-bit arithmetic); its body is the slot's rect.w/count px wide with at most a 1px gap, never under 1px (a count above rect.w still paints 1px columns), and its wick is the 1px vertical line at the slot centre from high to low. The body spans open to close; close >= open fills rs->up, otherwise rs->down, and the wick takes the body's colour. Every open/high/low/close clamps into [view->v0, view->v1] before mapping (v1 on rect's top row, v0 on its bottom row), so a candle outside the view paints at the rect's edge and every painted pixel stays inside rect. A malformed bar (high < low, low > max(open, close)) is the caller's problem, never a refusal: each field clamps independently and the bar paints clamped. NULL fb/rs/view/ candles, a zero count, an empty rect, or a view with v0 >= v1 or t0 >= t1 paints nothing; view->t0/t1 take part only in that check, since the slots map by index, not by time.
| void rmgui_chart_candles_paint_to | ( | rmgui_target_t * | , |
| rmgui_rect_t | , | ||
| rmgui_rect_t | , | ||
| const rmgui_chart_view_t * | , | ||
| const rmgui_style_resolved_t * | , | ||
| const rmgui_chart_candle_t * | , | ||
| size_t | ) |
Explicit destination candles, preserving CPU geometry and clipping.
RECORD appends bounded commands without allocation; failures latch.
| int rmgui_chart_candles_draw | ( | const rmgui_ui_t * | ui, |
| const rmgui_chart_candles_view_t * | candles, | ||
| rmgui_rect_t | rect ) |
Draw the candles.
Returns 0 or -1 for invalid arguments or style; paint errors are reported by the target.