78 numLines |= buffer.buf[buffer.bufPtr++] & 0xff;
79 samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
80 samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff;
81 int numComponents = buffer.buf[buffer.bufPtr++] & 0xff;
82 componentSpecs = new ComponentSpec [numComponents];
83 for (int i = 0; i < numComponents; i++) {
84 componentSpecs[i] = new ComponentSpec(buffer);
85 }
86 buffer.bufAvail -= length;
87 }
88
89 SOFMarkerSegment(Node node) throws IIOInvalidTreeException {
90 // All attributes are optional, so setup defaults first
91 super(JPEG.SOF0);
92 samplePrecision = 8;
93 numLines = 0;
94 samplesPerLine = 0;
95 updateFromNativeNode(node, true);
96 }
97
98 protected Object clone() {
99 SOFMarkerSegment newGuy = (SOFMarkerSegment) super.clone();
100 if (componentSpecs != null) {
101 newGuy.componentSpecs = componentSpecs.clone();
102 for (int i = 0; i < componentSpecs.length; i++) {
103 newGuy.componentSpecs[i] =
104 (ComponentSpec) componentSpecs[i].clone();
105 }
106 }
107 return newGuy;
108 }
109
110 IIOMetadataNode getNativeNode() {
111 IIOMetadataNode node = new IIOMetadataNode("sof");
112 node.setAttribute("process", Integer.toString(tag-JPEG.SOF0));
113 node.setAttribute("samplePrecision",
114 Integer.toString(samplePrecision));
115 node.setAttribute("numLines",
116 Integer.toString(numLines));
117 node.setAttribute("samplesPerLine",
118 Integer.toString(samplesPerLine));
|
78 numLines |= buffer.buf[buffer.bufPtr++] & 0xff;
79 samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
80 samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff;
81 int numComponents = buffer.buf[buffer.bufPtr++] & 0xff;
82 componentSpecs = new ComponentSpec [numComponents];
83 for (int i = 0; i < numComponents; i++) {
84 componentSpecs[i] = new ComponentSpec(buffer);
85 }
86 buffer.bufAvail -= length;
87 }
88
89 SOFMarkerSegment(Node node) throws IIOInvalidTreeException {
90 // All attributes are optional, so setup defaults first
91 super(JPEG.SOF0);
92 samplePrecision = 8;
93 numLines = 0;
94 samplesPerLine = 0;
95 updateFromNativeNode(node, true);
96 }
97
98 protected SOFMarkerSegment clone() {
99 SOFMarkerSegment newGuy = (SOFMarkerSegment) super.clone();
100 if (componentSpecs != null) {
101 newGuy.componentSpecs = componentSpecs.clone();
102 for (int i = 0; i < componentSpecs.length; i++) {
103 newGuy.componentSpecs[i] =
104 (ComponentSpec) componentSpecs[i].clone();
105 }
106 }
107 return newGuy;
108 }
109
110 IIOMetadataNode getNativeNode() {
111 IIOMetadataNode node = new IIOMetadataNode("sof");
112 node.setAttribute("process", Integer.toString(tag-JPEG.SOF0));
113 node.setAttribute("samplePrecision",
114 Integer.toString(samplePrecision));
115 node.setAttribute("numLines",
116 Integer.toString(numLines));
117 node.setAttribute("samplesPerLine",
118 Integer.toString(samplesPerLine));
|