MCPcopy Create free account
hub / github.com/WheretIB/nullc / CanvasClearRGB

Function CanvasClearRGB

NULLC/includes/canvas.cpp:6–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4namespace NULLCCanvas
5{
6 void CanvasClearRGB(float red, float green, float blue, Canvas* ptr)
7 {
8 if(!ptr)
9 {
10 nullcThrowError("ERROR: Canvas object is nullptr");
11 return;
12 }
13 float fRed = red / 255.0f;
14 float fGreen = green / 255.0f;
15 float fBlue = blue / 255.0f;
16 for(int i = 0; i < ptr->width * ptr->height; i++)
17 {
18 ((float*)ptr->data.ptr)[i * 4 + 0] = fRed;
19 ((float*)ptr->data.ptr)[i * 4 + 1] = fGreen;
20 ((float*)ptr->data.ptr)[i * 4 + 2] = fBlue;
21 ((float*)ptr->data.ptr)[i * 4 + 3] = 1.0f;
22 }
23 }
24 void CanvasClearRGBA(float red, float green, float blue, float alpha, Canvas* ptr)
25 {
26 if(!ptr)

Callers

nothing calls this directly

Calls 1

nullcThrowErrorFunction · 0.50

Tested by

no test coverage detected