mirror of https://github.com/adamdruppe/arsd.git
offset function
This commit is contained in:
parent
b700815aca
commit
df1dadf7ba
|
@ -1917,6 +1917,19 @@ final class Image {
|
||||||
} else static assert(0, "fill in this info for other OSes");
|
} else static assert(0, "fill in this info for other OSes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
int offsetForPixel(int x, int y) {
|
||||||
|
version(X11) {
|
||||||
|
auto offset = (y * width + x) * 4;
|
||||||
|
return offset;
|
||||||
|
} else version(Windows) {
|
||||||
|
auto itemsPerLine = ((cast(int) width * 3 + 3) / 4) * 4;
|
||||||
|
// remember, bmps are upside down
|
||||||
|
auto offset = itemsPerLine * (height - y - 1) + x * 3;
|
||||||
|
return offset;
|
||||||
|
} else static assert(0, "fill in this info for other OSes");
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
int adjustmentForNextLine() {
|
int adjustmentForNextLine() {
|
||||||
version(X11) {
|
version(X11) {
|
||||||
|
|
Loading…
Reference in New Issue