Warning: session_start(): open(/var/lib/php/sessions/sess_m0t6he95t4gfisqeib2g6nfs73, 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 Image332 implements MakesBufferedImage {
int w;
byte[] pixels;
*() {} // for persistence
*(BufferedImage img) { this(RGBImage(img)); }
*(RGBImage img) {
w = img.getWidth();
int h = img.getHeight();
pixels = new byte[w*h];
for y to h: for x to w:
pixels[y*w+x] = to332(img.getInt(x, y));
}
public int getWidth() { ret w; }
public int getHeight() { ret h(); }
int h() {
ret l(pixels)/w;
}
RGBImage toRGB() {
int h = h();
RGBImage img = new RGBImage(w, h);
int i = 0;
for y to h: for x to w:
img.setPixel(x, y, from332(pixels[i++]));
ret img;
}
public BufferedImage getBufferedImage() {
ret toRGB().getBufferedImage();
}
// 0 to 255
int get332Pixel(int x, int y) {
ret ubyteToInt(pixels[y*w+x]);
}
}