6 import java.io.BufferedReader;
7 import java.io.PrintWriter;
8 import java.io.IOException;
18 public ConstSFImage(
int width,
int height,
int components, byte[] pixels) {
21 this.components = components;
25 public int getWidth() {
30 public int getHeight() {
35 public int getComponents() {
40 public byte[] getPixels() {
45 public String toString() {
47 StringBuffer sb =
new StringBuffer();
48 sb.append(width).append(
' ').append(height).append(
' ').append(components);
49 for (
int i = 0; i < pixels.length; i+=components) {
51 for (
int j = i; j < i+components; j++)
52 sb.append(
"0123456789ABCDEF".charAt((pixels[i+j] & 0xf0) >> 4))
53 .append(
"0123456789ABCDEF".charAt(pixels[i+j] & 0x0f));
58 public void __fromPerl(BufferedReader in)
throws IOException {
61 width = Integer.parseInt(in.readLine());
62 height = Integer.parseInt(in.readLine());
63 components = Integer.parseInt(in.readLine());
64 pixels =
new byte[height*width*components];
70 public void __toPerl(PrintWriter out)
throws IOException {
71 out.print(width+
" "+height+
" "+components+
" "+pixels);