1 /*
2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
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 = (ComponentSpec []) 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));
119 node.setAttribute("numFrameComponents",
120 Integer.toString(componentSpecs.length));
121 for (int i = 0; i < componentSpecs.length; i++) {
|
1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
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));
119 node.setAttribute("numFrameComponents",
120 Integer.toString(componentSpecs.length));
121 for (int i = 0; i < componentSpecs.length; i++) {
|