riCOM_cpp
This repository contains the C++ implementation of the riCOM (Real Time Centre Of Mass) algorithm for 4D Scanning electron microscopy.
Functions
SDL_Utils Namespace Reference

Functions

void draw_pixel (SDL_Surface *surface, int x, int y, float val, int col_map)
 
void draw_pixel (SDL_Surface *surface, int x, int y, float ang, float mag, int col_map)
 

Function Documentation

◆ draw_pixel() [1/2]

void SDL_Utils::draw_pixel ( SDL_Surface *  surface,
int  x,
int  y,
float  ang,
float  mag,
int  col_map 
)

Definition at line 105 of file GuiUtils.cpp.

106  {
107  tinycolormap::Color c = mag * tinycolormap::GetColor(ang, tinycolormap::ColormapType(col_map));
108  Uint32 px = SDL_MapRGB(surface->format, (Uint8)(c.ri()), (Uint8)(c.gi()), (Uint8)(c.bi()));
109  Uint32 *const target_pixel = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch + x * surface->format->BytesPerPixel);
110  *target_pixel = px;
111  }

◆ draw_pixel() [2/2]

void SDL_Utils::draw_pixel ( SDL_Surface *  surface,
int  x,
int  y,
float  val,
int  col_map 
)

Definition at line 97 of file GuiUtils.cpp.

98  {
99  tinycolormap::Color c = tinycolormap::GetColor(val, tinycolormap::ColormapType(col_map));
100  Uint32 px = SDL_MapRGB(surface->format, (Uint8)(c.ri()), (Uint8)(c.gi()), (Uint8)(c.bi()));
101  Uint32 *const target_pixel = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch + x * surface->format->BytesPerPixel);
102  *target_pixel = px;
103  }