6 import java.io.BufferedReader;
7 import java.io.PrintWriter;
8 import java.io.IOException;
18 public SFImage(
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 void setValue(
int width,
int height,
int components, byte[] pixels) {
48 this.components = components;
55 sfImage.__updateRead();
56 width = sfImage.width;
57 height = sfImage.height;
58 components = sfImage.components;
59 pixels = sfImage.pixels;
63 public void setValue(
SFImage sfImage) {
64 sfImage.__updateRead();
65 width = sfImage.width;
66 height = sfImage.height;
67 components = sfImage.components;
68 pixels = sfImage.pixels;
73 public String toString() {
75 StringBuffer sb =
new StringBuffer();
76 sb.append(width).append(
' ').append(height).append(
' ').append(components);
77 for (
int i = 0; i < pixels.length; i+=components) {
79 for (
int j = i; j < i+components; j++)
80 sb.append(
"0123456789ABCDEF".charAt((pixels[i+j] & 0xf0) >> 4))
81 .append(
"0123456789ABCDEF".charAt(pixels[i+j] & 0x0f));
86 public void __fromPerl(BufferedReader in)
throws IOException {
89 width = Integer.parseInt(in.readLine());
90 height = Integer.parseInt(in.readLine());
91 components = Integer.parseInt(in.readLine());
92 pixels =
new byte[height*width*components];
98 public void __toPerl(PrintWriter out)
throws IOException {
99 out.print(width+
" "+height+
" "+components+
" "+pixels);