MCPcopy Create free account
hub / github.com/IENT/YUView / setColorInImage

Function setColorInImage

YUViewLib/src/decoder/decoderTarga.cpp:250–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void setColorInImage(
251 dec::Targa::Image &image, color_t color, unsigned x, unsigned y, const Header &header)
252{
253 unsigned idx = 0;
254
255 if (header.topToBottom)
256 idx += y * header.width * 4;
257 else
258 idx += (header.height - y - 1) * header.width * 4;
259
260 if (header.leftToRight)
261 idx += x * 4;
262 else
263 idx += (header.width - x - 1) * 4;
264
265 image.data.at(idx) = getr(color);
266 image.data.at(idx + 1) = getg(color);
267 image.data.at(idx + 2) = getb(color);
268 image.data.at(idx + 3) = geta(color);
269}
270
271void readColormap(std::ifstream &file, Header &header)
272{

Callers 2

readImageFunction · 0.85

Calls 5

getrFunction · 0.85
getgFunction · 0.85
getbFunction · 0.85
getaFunction · 0.85
atMethod · 0.45

Tested by

no test coverage detected