Files
rspektrum/src/render.h
T
tyler 7240cf8ecf refactor: modal-gate helper + data-driven colormap table
Two extensibility easy-wins, both behavior-preserving:

- UiModalOpen() centralizes the "an overlay owns input" check that was
  copy-pasted as `!showFileBrowser && !showAbout` across 6 input gates.
  New overlays now update one place.
- Colormaps become a COLORMAPS[] table (name + function) indexed by enum.
  GetColormapColor and the sidebar both read it, so adding a colormap is
  one enum value + one Cmap* fn + one row — and the sidebar name can no
  longer drift from the enum (deleted the parallel colormapNames[] array).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 01:53:55 -07:00

31 lines
1.1 KiB
C

// render.h - UI scaling, colormaps, spectrogram texture generation, drawing
#ifndef RENDER_H
#define RENDER_H
#include "spectrogram_types.h"
// --- UI scaling & scaled text ---
float GetUIScale(void);
void DrawTextScaled(const char* text, float x, float y, float baseSize, Color color);
float MeasureTextScaled(const char* text, float baseSize);
// --- Colormaps ---
void GenerateColormapTexture(void);
const char* ColormapName(ColormapType type);
// --- Spectrogram texture ---
// GenerateSpectrogramTexture recomputes the synchrosqueezed reassignment (use
// when the STFT changes). ColorizeSpectrogram only re-maps the cached
// reassignment to colors (use for dB-floor / colormap changes).
void GenerateSpectrogramTexture(StftResult* stft, Image* image, Texture2D* texture);
void ColorizeSpectrogram(Image* image, Texture2D* texture);
// --- On-screen drawing (operate on the global app state) ---
void DrawSpectrogramGrid(Rectangle bounds, int numCellsX, int numCellsY, Color color);
void DrawLabels(Rectangle bounds);
void DrawSelection(Rectangle bounds);
void DrawSelectionDrag(Rectangle bounds);
void DrawPlayhead(Rectangle bounds);
#endif // RENDER_H