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

Function CanvasClearRGBA

NULLC/includes/canvas.cpp:24–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 }
23 }
24 void CanvasClearRGBA(float red, float green, float blue, float alpha, Canvas* ptr)
25 {
26 if(!ptr)
27 {
28 nullcThrowError("ERROR: Canvas object is nullptr");
29 return;
30 }
31 float fRed = red / 255.0f;
32 float fGreen = green / 255.0f;
33 float fBlue = blue / 255.0f;
34 float fAlpha = alpha / 255.0f;
35 for(int i = 0; i < ptr->width * ptr->height; i++)
36 {
37 ((float*)ptr->data.ptr)[i * 4 + 0] = fRed;
38 ((float*)ptr->data.ptr)[i * 4 + 1] = fGreen;
39 ((float*)ptr->data.ptr)[i * 4 + 2] = fBlue;
40 ((float*)ptr->data.ptr)[i * 4 + 3] = fAlpha;
41 }
42 }
43
44 void CanvasSetColor(unsigned char red, unsigned char green, unsigned char blue, Canvas* ptr)
45 {

Callers

nothing calls this directly

Calls 1

nullcThrowErrorFunction · 0.50

Tested by

no test coverage detected