93
edits
Changes
Savy Cat
,→Rotate90
img_tiny90(2, 0, 0, 2)
For any location at x & y, with width of image, height of image, and z (number of colour channels):
<nowiki>inline int idx(int x, int y, int w, int h, int z) {
return x + y * w + w * h * z;
}</nowiki>
The first portion of the index equation should look familiar (x + y * w) for indexing a square 2D matrix. Adding the result of (w * h * z) enables this to work for a rectangular matrix of z (3) dimensions.