in java/TJUnitTest.java [167:234]
static void initBuf(Object buf, int w, int pitch, int h, int pf,
boolean bottomUp) throws Exception {
int roffset = TJ.getRedOffset(pf);
int goffset = TJ.getGreenOffset(pf);
int boffset = TJ.getBlueOffset(pf);
int aoffset = TJ.getAlphaOffset(pf);
int ps = TJ.getPixelSize(pf);
int index, row, col, halfway = 16;
if (pf == TJ.PF_GRAY) {
fillArray(buf, 0);
for (row = 0; row < h; row++) {
for (col = 0; col < w; col++) {
if (bottomUp)
index = pitch * (h - row - 1) + col;
else
index = pitch * row + col;
if (((row / 8) + (col / 8)) % 2 == 0)
setVal(buf, index, (row < halfway) ? maxSample : 0);
else
setVal(buf, index, (row < halfway) ? redToY : yellowToY);
}
}
return;
}
if (pf == TJ.PF_CMYK) {
fillArray(buf, maxSample);
for (row = 0; row < h; row++) {
for (col = 0; col < w; col++) {
if (bottomUp)
index = (h - row - 1) * w + col;
else
index = row * w + col;
if (((row / 8) + (col / 8)) % 2 == 0) {
if (row >= halfway) setVal(buf, index * ps + 3, 0);
} else {
setVal(buf, index * ps + 2, 0);
if (row < halfway)
setVal(buf, index * ps + 1, 0);
}
}
}
return;
}
fillArray(buf, 0);
for (row = 0; row < h; row++) {
for (col = 0; col < w; col++) {
if (bottomUp)
index = pitch * (h - row - 1) + col * ps;
else
index = pitch * row + col * ps;
if (((row / 8) + (col / 8)) % 2 == 0) {
if (row < halfway) {
setVal(buf, index + roffset, maxSample);
setVal(buf, index + goffset, maxSample);
setVal(buf, index + boffset, maxSample);
}
} else {
setVal(buf, index + roffset, maxSample);
if (row >= halfway)
setVal(buf, index + goffset, maxSample);
}
if (aoffset >= 0)
setVal(buf, index + aoffset, maxSample);
}
}
}