History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/com/sun/imageio/plugins/gif/GIFStreamMetadataFormat.java (1 of 18352 files). Show all

Unified · Split

java/pkg/com/sun/imageio/plugins/gif/GIFStreamMetadataFormat.java+106−0
@@ -0,0 +1,106 @@
1+/*
2+ * Copyright (c) 2001, 2004, 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
23+ * questions.
24+ */
25+
26+package com.sun.imageio.plugins.gif;
27+
28+import java.util.Arrays;
29+import javax.imageio.ImageTypeSpecifier;
30+import javax.imageio.metadata.IIOMetadataFormat;
31+import javax.imageio.metadata.IIOMetadataFormatImpl;
32+
33+public class GIFStreamMetadataFormat extends IIOMetadataFormatImpl {
34+
35+ private static IIOMetadataFormat instance = null;
36+
37+ private GIFStreamMetadataFormat() {
38+ super(GIFStreamMetadata.nativeMetadataFormatName,
39+ CHILD_POLICY_SOME);
40+
41+ // root -> Version
42+ addElement("Version", GIFStreamMetadata.nativeMetadataFormatName,
43+ CHILD_POLICY_EMPTY);
44+ addAttribute("Version", "value",
45+ DATATYPE_STRING, true, null,
46+ Arrays.asList(GIFStreamMetadata.versionStrings));
47+
48+ // root -> LogicalScreenDescriptor
49+ addElement("LogicalScreenDescriptor",
50+ GIFStreamMetadata.nativeMetadataFormatName,
51+ CHILD_POLICY_EMPTY);
52+ addAttribute("LogicalScreenDescriptor", "logicalScreenWidth",
53+ DATATYPE_INTEGER, true, null,
54+ "1", "65535", true, true);
55+ addAttribute("LogicalScreenDescriptor", "logicalScreenHeight",
56+ DATATYPE_INTEGER, true, null,
57+ "1", "65535", true, true);
58+ addAttribute("LogicalScreenDescriptor", "colorResolution",
59+ DATATYPE_INTEGER, true, null,
60+ "1", "8", true, true);
61+ addAttribute("LogicalScreenDescriptor", "pixelAspectRatio",
62+ DATATYPE_INTEGER, true, null,
63+ "0", "255", true, true);
64+
65+ // root -> GlobalColorTable
66+ addElement("GlobalColorTable",
67+ GIFStreamMetadata.nativeMetadataFormatName,
68+ 2, 256);
69+ addAttribute("GlobalColorTable", "sizeOfGlobalColorTable",
70+ DATATYPE_INTEGER, true, null,
71+ Arrays.asList(GIFStreamMetadata.colorTableSizes));
72+ addAttribute("GlobalColorTable", "backgroundColorIndex",
73+ DATATYPE_INTEGER, true, null,
74+ "0", "255", true, true);
75+ addBooleanAttribute("GlobalColorTable", "sortFlag",
76+ false, false);
77+
78+ // root -> GlobalColorTable -> ColorTableEntry
79+ addElement("ColorTableEntry", "GlobalColorTable",
80+ CHILD_POLICY_EMPTY);
81+ addAttribute("ColorTableEntry", "index",
82+ DATATYPE_INTEGER, true, null,
83+ "0", "255", true, true);
84+ addAttribute("ColorTableEntry", "red",
85+ DATATYPE_INTEGER, true, null,
86+ "0", "255", true, true);
87+ addAttribute("ColorTableEntry", "green",
88+ DATATYPE_INTEGER, true, null,
89+ "0", "255", true, true);
90+ addAttribute("ColorTableEntry", "blue",
91+ DATATYPE_INTEGER, true, null,
92+ "0", "255", true, true);
93+ }
94+
95+ public boolean canNodeAppear(String elementName,
96+ ImageTypeSpecifier imageType) {
97+ return true;
98+ }
99+
100+ public static synchronized IIOMetadataFormat getInstance() {
101+ if (instance == null) {
102+ instance = new GIFStreamMetadataFormat();
103+ }
104+ return instance;
105+ }
106+}