MXVK Vulkan Framework 0.35.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
mxvk::SDLRendererPixelPlotter Struct Reference

Pixel plotter adapter that writes packed MXVK colors to an SDL renderer. More...

#include <mxvk/include/mxvk/mxvk_math.h>

Public Member Functions

void operator() (int x, int y, MXCOLOR color) const
 Plot one pixel if the renderer is valid.
void operator() (int x, int y, MXCOLOR color) const
 Plot one pixel if the renderer is valid.

Public Attributes

SDL_Renderer * renderer = nullptr
 SDL renderer receiving plotted pixels.

Detailed Description

Pixel plotter adapter that writes packed MXVK colors to an SDL renderer.

Definition at line 1901 of file mxvk_math.h.

Member Function Documentation

◆ operator()() [1/2]

void mxvk::SDLRendererPixelPlotter::operator() ( int x,
int y,
MXCOLOR color ) const
inline

Plot one pixel if the renderer is valid.

Definition at line 1906 of file mxvk_math.h.

1906 {
1907 if (renderer == nullptr) {
1908 return;
1909 }
1910 SDL_SetRenderDrawColor(renderer, color_r(color), color_g(color), color_b(color), color_a(color));
1911 SDL_RenderPoint(renderer, static_cast<float>(x), static_cast<float>(y));
1912 }
constexpr std::uint8_t color_r(MXCOLOR color)
Extract the red component from a packed ARGB color.
Definition mxvk_math.h:52
constexpr std::uint8_t color_g(MXCOLOR color)
Extract the green component from a packed ARGB color.
Definition mxvk_math.h:55
constexpr std::uint8_t color_a(MXCOLOR color)
Extract the alpha component from a packed ARGB color.
Definition mxvk_math.h:61
constexpr std::uint8_t color_b(MXCOLOR color)
Extract the blue component from a packed ARGB color.
Definition mxvk_math.h:58
SDL_Renderer * renderer
SDL renderer receiving plotted pixels.
Definition mxvk_math.h:1903

◆ operator()() [2/2]

void mxvk::SDLRendererPixelPlotter::operator() ( int x,
int y,
MXCOLOR color ) const
inline

Plot one pixel if the renderer is valid.

Definition at line 1871 of file mxvk_math_eigen.hpp.

1871 {
1872 if (renderer == nullptr) {
1873 return;
1874 }
1875 SDL_SetRenderDrawColor(renderer, color_r(color), color_g(color), color_b(color), color_a(color));
1876 SDL_RenderPoint(renderer, static_cast<float>(x), static_cast<float>(y));
1877 }

Member Data Documentation

◆ renderer

SDL_Renderer * mxvk::SDLRendererPixelPlotter::renderer = nullptr

SDL renderer receiving plotted pixels.

Definition at line 1903 of file mxvk_math.h.


The documentation for this struct was generated from the following files: