RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
Loading...
Searching...
No Matches
chart_heat.h File Reference

chart_heat.h — a rows x cols heatmap grid with a two-stop colour ramp. 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_heat_view_t
 A heat map borrowing rows * cols row-major values, with ramp stops at v0 < v1. More...

Functions

rmgui_color_t rmgui_chart_heat_color (const rmgui_style_resolved_t *rs, int32_t v, int32_t v0, int32_t v1)
 The ramp colour of value v between v0 and v1: rs->background at v0, rs->series[0] at v1, linear in between, each channel (bg*(256-t) + fg*t + 128) >> 8 with t = (v - v0)*256/(v1 - v0) computed in 64 bits; alpha is 255.
void rmgui_chart_heat_paint (rmgui_fb_t *fb, rmgui_rect_t rect, rmgui_rect_t clip, const rmgui_style_resolved_t *rs, const int32_t *cells, size_t rows, size_t cols, int32_t v0, int32_t v1)
 Paints the rows x cols grid of cells[r * cols + c] over rect: cell (r, c) spans x rect.x + c*rect.w/cols to rect.x + (c+1)*rect.w/cols and y likewise over rect.h, filled with rmgui_chart_heat_color of its value.
void rmgui_chart_heat_paint_to (rmgui_target_t *, rmgui_rect_t, rmgui_rect_t, const rmgui_style_resolved_t *, const int32_t *, size_t, size_t, int32_t, int32_t)
 Explicit destination heat cells with the CPU color ramp and clipping.
int rmgui_chart_heat_draw (const rmgui_ui_t *ui, const rmgui_chart_heat_view_t *heat, rmgui_rect_t rect)
 Draw the heat map.

Detailed Description

chart_heat.h — a rows x cols heatmap grid with a two-stop colour ramp.

Values are raw int32 in the caller's unit; the ramp blends in integer RGB only.

Function Documentation

◆ rmgui_chart_heat_color()

rmgui_color_t rmgui_chart_heat_color ( const rmgui_style_resolved_t * rs,
int32_t v,
int32_t v0,
int32_t v1 )

The ramp colour of value v between v0 and v1: rs->background at v0, rs->series[0] at v1, linear in between, each channel (bg*(256-t) + fg*t + 128) >> 8 with t = (v - v0)*256/(v1 - v0) computed in 64 bits; alpha is 255.

Values outside [v0, v1] clamp to the nearest stop. v1 <= v0 (an empty ramp) returns rs->background; NULL rs returns transparent black.

◆ rmgui_chart_heat_paint()

void rmgui_chart_heat_paint ( rmgui_fb_t * fb,
rmgui_rect_t rect,
rmgui_rect_t clip,
const rmgui_style_resolved_t * rs,
const int32_t * cells,
size_t rows,
size_t cols,
int32_t v0,
int32_t v1 )

Paints the rows x cols grid of cells[r * cols + c] over rect: cell (r, c) spans x rect.x + c*rect.w/cols to rect.x + (c+1)*rect.w/cols and y likewise over rect.h, filled with rmgui_chart_heat_color of its value.

NULL fb, rs or cells, zero rows or cols, an empty rect, or v1 <= v0 paints nothing. Pixels are written only inside clip ∩ rect.

◆ rmgui_chart_heat_paint_to()

void rmgui_chart_heat_paint_to ( rmgui_target_t * ,
rmgui_rect_t ,
rmgui_rect_t ,
const rmgui_style_resolved_t * ,
const int32_t * ,
size_t ,
size_t ,
int32_t ,
int32_t  )

Explicit destination heat cells with the CPU color ramp and clipping.

RECORD appends bounded value commands; failures latch without allocation.

◆ rmgui_chart_heat_draw()

int rmgui_chart_heat_draw ( const rmgui_ui_t * ui,
const rmgui_chart_heat_view_t * heat,
rmgui_rect_t rect )

Draw the heat map.

Returns 0 or -1 for invalid arguments or style; paint errors are reported by the target.