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

Function CanvasDrawRect

NULLC/includes/canvas.cpp:289–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287 CanvasDrawLineNoAA(int(x0), int(y0), int(x1), int(y1), ptr);
288 }
289 void CanvasDrawRect(int x1, int y1, int x2, int y2, Canvas* ptr)
290 {
291 if(!ptr)
292 {
293 nullcThrowError("ERROR: Canvas object is nullptr");
294 return;
295 }
296 for(int x = x1 < 0 ? 0 : x1, xe = x2 > ptr->width ? ptr->width : x2; x < xe; x++)
297 {
298 for(int y = y1 < 0 ? 0 : y1, ye = y2 > ptr->height ? ptr->height : y2; y < ye; y++)
299 {
300 ((float*)ptr->data.ptr)[(y*ptr->width + x) * 4 + 0] = ptr->color[0];
301 ((float*)ptr->data.ptr)[(y*ptr->width + x) * 4 + 1] = ptr->color[1];
302 ((float*)ptr->data.ptr)[(y*ptr->width + x) * 4 + 2] = ptr->color[2];
303 ((float*)ptr->data.ptr)[(y*ptr->width + x) * 4 + 3] = ptr->color[3];
304 }
305 }
306 }
307 void CanvasDrawRectA(int x1, int y1, int x2, int y2, double alpha, Canvas* ptr)
308 {
309 if(!ptr)

Callers

nothing calls this directly

Calls 1

nullcThrowErrorFunction · 0.50

Tested by

no test coverage detected