JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
ImageTstFiles.java
Go to the documentation of this file.
1/**
2 * Copyright 2014 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.opengl.test.junit.jogl.util.texture;
29
30import java.io.IOException;
31import java.io.InputStream;
32import java.net.URLConnection;
33import java.util.ArrayList;
34
35import com.jogamp.common.util.IOUtil;
36
37public class ImageTstFiles {
38 public static final String[] pngFileNames = new String[] {
39 "bug724-transparent-grey_gimpexp.png",
40 "bug724-transparent-grey_orig.png",
41 "cross-grey-alpha-16x16.png",
42 "grayscale_texture.png",
43 "pointer-grey-alpha-16x24.png",
44 "test-ntscI_3-01-160x90.png",
45 "test-ntscI_4-01-160x90.png",
46 "test-ntscIG3-01-160x90.png",
47 "test-ntscIG4-01-160x90.png",
48 "test-ntscN_3-01-160x90.png",
49 "test-ntscN_4-01-160x90.png",
50 "test-ntscNG4-01-160x90.png",
51 "test-ntscP_3-01-160x90.png",
52 "test-ntscP_4-01-160x90.png"
53 };
54
55 public static final String[] jpgFileNames = new String[] {
56 "bug745_qttdef_post_frame.jpg",
57 "darwin_03_N_4-YCCK-640x452.jpg", // local
58 "darwin_03_N_4-YCCK.jpg", // local
59 "j1-baseline.jpg",
60 "j2-progressive.jpg",
61 "j3-baseline_gray.jpg",
62 "test-cmyk-01.jpg",
63 "test-ntscN_3-01-160x90-60pct-yuv422h-base.jpg",
64 "test-ntscN_3-01-160x90-60pct-yuv422h-prog.jpg",
65 "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg",
66 "test-ntscN_3-01-160x90-90pct-yuv444-prog.jpg",
67 "test-ycck-01.jpg" };
68
69 public static final String[] tgaFileNames = new String[] {
70 "bug744-rle32.tga",
71 "bug982.rle32.256x256.tga",
72 "test-u32.tga"
73 };
74 public static final String[] ddsFileNames = new String[] {
75 "test-64x32_DXT1.dds",
76 "test-64x32_DXT5.dds",
77 "test-64x32_uncompressed.dds"
78 };
79
80 public static class NamedInputStream {
81 final String fullPath;
82 final String basePath;
83 final InputStream stream;
84 public NamedInputStream(final String fullPath, final String basePath, final InputStream stream) {
85 this.fullPath = fullPath;
86 this.basePath = basePath;
87 this.stream = stream;
88 }
89 }
90 public ArrayList<NamedInputStream> pngStreams;
91 public ArrayList<NamedInputStream> jpgStreams;
92 public ArrayList<NamedInputStream> tgaStreams;
93 public ArrayList<NamedInputStream> ddsStreams;
94 public ArrayList<NamedInputStream> allStreams;
95
96 private final ArrayList<NamedInputStream> init(final String[] source) throws IOException {
97 final ArrayList<NamedInputStream> sink = new ArrayList<NamedInputStream>();
98 for(int i=0; i<source.length; i++) {
99 final URLConnection testTextureUrlConn = IOUtil.getResource(source[i], this.getClass().getClassLoader(), this.getClass());
100 if( null != testTextureUrlConn ) {
101 final InputStream s = testTextureUrlConn.getInputStream();
102 if( null != s ) {
103 sink.add(new NamedInputStream(testTextureUrlConn.getURL().toString(), source[i], s));
104 }
105 }
106 }
107 return sink;
108 }
109
110 public void init() throws IOException {
115 allStreams = new ArrayList<NamedInputStream>();
116 allStreams.addAll(pngStreams);
117 allStreams.addAll(jpgStreams);
118 allStreams.addAll(tgaStreams);
119 allStreams.addAll(ddsStreams);
120 }
121 public void clear() {
122 pngStreams.clear();
123 jpgStreams.clear();
124 tgaStreams.clear();
125 ddsStreams.clear();
126 allStreams.clear();
127 }
128}
NamedInputStream(final String fullPath, final String basePath, final InputStream stream)