Monado OpenXR Runtime
Loading...
Searching...
No Matches
u_frame_scribble.cpp File Reference

xrt_frame helpers for scribbling onto frames. More...

#include "xrt/xrt_frame.h"
#include "xrt/xrt_config_have.h"
#include "u_frame_scribble.h"
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc.hpp>
Include dependency graph for u_frame_scribble.cpp:

Functions

static bool mat_from_frame (const struct xrt_frame *frame, cv::Mat &out_mat)
 
static cv::Scalar scalar_from_rgba_u8 (const struct xrt_colour_rgba_u8 *color)
 
static double pixel_size_to_text_scale (float pixel_size, int font_face, int thickness)
 
void u_frame_scribble_rect (struct xrt_frame *frame, const struct xrt_rect *rect, bool fill, const struct xrt_colour_rgba_u8 *color)
 Scribbles a rectangle onto a frame.
 
void u_frame_scribble_cross (struct xrt_frame *frame, uint32_t x, uint32_t y, uint32_t size, const struct xrt_colour_rgba_u8 *color)
 Scribbles a cross onto a frame.
 
void u_frame_scribble_line (struct xrt_frame *frame, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, const struct xrt_colour_rgba_u8 *color)
 Scribbles a line onto a frame.
 
void u_frame_scribble_text (struct xrt_frame *frame, uint32_t x, uint32_t y, const char *text, float size, const struct xrt_colour_rgba_u8 *color)
 Scribbles text onto a frame.
 

Detailed Description

xrt_frame helpers for scribbling onto frames.

Author
Beyley Cardellio ep1cm.nosp@m.1n10.nosp@m.n123@.nosp@m.gmai.nosp@m.l.com

Function Documentation

◆ u_frame_scribble_cross()

void u_frame_scribble_cross ( struct xrt_frame frame,
uint32_t  x,
uint32_t  y,
uint32_t  size,
const struct xrt_colour_rgba_u8 color 
)

Scribbles a cross onto a frame.

Parameters
frameThe frame to scribble on.
xThe x coordinate of the center of the cross.
yThe y coordinate of the center of the cross.
sizeThe size of the cross in pixels (from center to edge horizontally).
colorThe color to scribble with.

References u_frame_scribble_line().

◆ u_frame_scribble_line()

void u_frame_scribble_line ( struct xrt_frame frame,
uint32_t  x0,
uint32_t  y0,
uint32_t  x1,
uint32_t  y1,
const struct xrt_colour_rgba_u8 color 
)

Scribbles a line onto a frame.

Parameters
frameThe frame to scribble on.
x0The x coordinate of the start of the line.
y0The y coordinate of the start of the line.
x1The x coordinate of the end of the line.
y1The y coordinate of the end of the line.
colorThe color to scribble with.

Referenced by u_frame_scribble_cross().

◆ u_frame_scribble_rect()

void u_frame_scribble_rect ( struct xrt_frame frame,
const struct xrt_rect rect,
bool  fill,
const struct xrt_colour_rgba_u8 color 
)

Scribbles a rectangle onto a frame.

Parameters
frameThe frame to scribble on.
rectThe rectangle to scribble.
fillWhether to fill the rectangle or just draw the outline.
colorThe color to scribble with.

◆ u_frame_scribble_text()

void u_frame_scribble_text ( struct xrt_frame frame,
uint32_t  x,
uint32_t  y,
const char *  text,
float  size,
const struct xrt_colour_rgba_u8 color 
)

Scribbles text onto a frame.

Parameters
frameThe frame to scribble on.
xThe x coordinate of the text baseline.
yThe y coordinate of the text baseline.
textThe text to scribble.
sizeThe desired pixel height of the text.
colorThe color to scribble with.