MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / gradientRGBA

Function gradientRGBA

tests/unit/engine/Poseidon/Graphics/test_image.cpp:32–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30// --- Helper: gradient RGBA test image ---
31
32static std::vector<uint8_t> gradientRGBA(int w, int h)
33{
34 std::vector<uint8_t> data(w * h * 4);
35 for (int y = 0; y < h; ++y)
36 {
37 for (int x = 0; x < w; ++x)
38 {
39 int i = y * w + x;
40 data[i * 4 + 0] = static_cast<uint8_t>(x * 255 / (w - 1));
41 data[i * 4 + 1] = static_cast<uint8_t>(y * 255 / (h - 1));
42 data[i * 4 + 2] = static_cast<uint8_t>((x + y) * 255 / (w + h - 2));
43 data[i * 4 + 3] = 255;
44 }
45 }
46 return data;
47}
48
49// --- Helper: compute PSNR between two RGBA buffers ---
50

Callers 1

test_image.cppFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected