Some encode/decode practice.

This commit is contained in:
James Grogan 2022-11-21 17:45:12 +00:00
parent 8a41337e2d
commit ff962a6b16
29 changed files with 727 additions and 305 deletions

View file

@ -23,4 +23,19 @@ public:
}
}
}
static void drawAlternatingStrips(std::vector<unsigned char>& data, unsigned width, unsigned height, unsigned channels, unsigned bytesPerRow)
{
for(unsigned jdx=0;jdx<height;jdx++)
{
const auto heightOffset = jdx*bytesPerRow;
for(unsigned idx=0;idx<width*channels;idx+=channels)
{
const auto index = heightOffset + idx;
data[index] = (idx%2 == 0) ? 255*jdx/(height+1) : 0;
data[index+1] = 0;
data[index+2] = 0;
}
}
}
};