Warning: session_start(): open(/var/lib/php/sessions/sess_so5g5gr5b245pej7u9dlv6jik1, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass Hi15Image extends WAndHImpl is MakesBufferedImage {
short[] pixels;
*() {} // for persistence
// TODO: optimize!
*(BufferedImage img) { this(RGBImage(img)); }
*(RGBImage img) {
w = img.getWidth();
h = img.getHeight();
pixels = new short[w*h];
for y to h: for x to w:
pixels[y*w+x] = rgbIntToHi15(img.getInt(x, y));
}
RGBImage toRGB() {
RGBImage img = new RGBImage(w, h);
int i = 0, w = this.w, h = this.h;
for y to h: for x to w:
img.setPixel(x, y, hi15ToRGBInt_dirty(pixels[i++]));
ret img;
}
public BufferedImage getBufferedImage() {
ret toRGB().getBufferedImage();
}
// 0 to 32767
short getHi15Pixel(int x, int y) {
ret pixels[y*w+x];
}
// idx = index in pixel array
public short getHi15Pixel_noRangeCheck(int idx) {
ret pixels[idx];
}
static int perChannelBitCountMask(int bitCount) {
int mask = ((~0x1F) >> bitCount) & 0x1F;
int mask2 = (mask << 10) | (mask << 5) | mask;
ret mask2;
}
void reducePerChannelBitCount(int bitCount) {
if (bitCount >= 5) ret;
int mask = perChannelBitCountMask(bitCount);
short[] pixels = this.pixels;
for (int i = 0; i < pixels.length; i++)
pixels[i] = (short) (pixels[i] & mask);
}
}