View Javadoc

1   /* -------------------------------------------------------------------
2    * Java source file for the class TextureLoader
3    * 
4    * Copyright (c), 2003, Masahiro Takatsuka.
5    * All Rights Researved.
6    * 
7    * Original Author: Masahiro Takatsuka (masa@jbeans.net)
8    * $Author: takatsukam $
9    * 
10   * $Date: 2004/03/03 11:53:07 $
11   * 
12   * $Id: TextureLoader.java,v 1.3 2004/03/03 11:53:07 takatsukam Exp $
13   * 
14   * Reference:		Document no:
15   * ___				___
16   * 
17   * To Do:
18   * ___
19   * 
20  ------------------------------------------------------------------- */
21  
22  /* --------------------------- Package ---------------------------- */
23  package net.jbeans.j3d.util.texture;
24  
25  /* ------------------ Import classes (packages) ------------------- *//package-summary/html">class="comment"> ------------------ Import classes (packages) ------------------- *//package-summary.html">class="comment">/* ------------------ Import classes (packages) ------------------- *//package-summary.html">class="comment"> ------------------ Import classes (packages) ------------------- */
26  import java.awt.*;
27  import java.net.*;
28  import javax.media.j3d.*;
29  import javax.vecmath.*;
30  
31  /*====================================================================
32                  Implementation of class TextureLoader                 
33  ====================================================================*/
34  /***
35   * generally describe TextureLoader in here
36   * 
37   * @version $Revision: 1.3 $
38   * @author Masahiro Takatsuka (masa@jbeans.net)
39   * @see com.sun.j3d.utils.image.TextureLoader
40   */
41  
42  public class TextureLoader extends com.sun.j3d.utils.image.TextureLoader {
43      private static Component sObserver;
44  	
45      /***
46       * Specify an object to server as the image observer.
47       * Use this method once before constructing any texture loaders.
48       * @param imageObserver     the object to be used in subsequent
49       * TextureLoader constuctions
50       */
51      public static void setImageObserver(Component imageObserver){
52          sObserver = imageObserver;
53      }
54  
55      /***
56       * Retreve the object used as the image observer for TextureLoader
57       * objects.
58       * Use this method when the image observer is needed.
59       * @return the object used in as the image observer in subsequent
60       * TextureLoader constuctions
61       */
62      public static Component getImageObserver(){
63          return sObserver;
64      }
65  
66      // constructors without an image observer argument
67      /***
68       * Constructs a TextureLoader object loading the specified iamge in
69       * default (RGBA) format.
70       * The an image observer must be set using the setImageObserver() method
71       * before using this constructor.
72       * @param image     the image object to load
73       */
74      public TextureLoader(Image image){
75          super(image, sObserver);
76      }
77  
78      /***
79       * Constructs a TextureLoader object loading the specified image
80       * and option flags in the default (RGBA) format.
81       * The an image observer must be set using the setImageObserver() method
82       * before using this constructor.
83       * @param image     the image object to load
84       * @param flags     the flags to use in construction (e.g. generate mipmap)
85       */
86      public TextureLoader(Image image, int flags){
87          super(image, flags, sObserver);
88      }
89  
90      /***
91       * Constructs a TextureLoader object loading the specified file
92       * using the specified format.
93       * The an image observer must be set using the setImageObserver() method
94       * before using this constructor.
95       * @param image     the image object to load
96       * @param format    specificaiton of which channels to use (e.g. RGB)
97       */
98      public TextureLoader(Image image, String format){
99          super(image, format, sObserver);
100     }
101 
102     /***
103      * Constructs a TextureLoader object loading the specified file
104      * with specified format and flags.
105      * The an image observer must be set using the setImageObserver() method
106      * before using this constructor.
107      * @param image     the image object to load
108      * @param format    specificaiton of which channels to use (e.g. RGB)
109      * @param flags     the flags to use in construction (e.g. generate mipmap)
110      */
111     public TextureLoader(Image image, String format, int flags){
112         super(image, format, flags, sObserver);
113     }
114 
115     /***
116      * Constructs a TextureLoader object loading the specified file
117      * using the default format (RGBA).
118      * The an image observer must be set using the setImageObserver() method
119      * before using this constructor.
120      * @param fname     the name of the file to load
121      */
122     public TextureLoader(String fname){
123         super(fname, sObserver);
124     }
125 
126     /***
127      * Constructs a TextureLoader object loading the specified file
128      * with the specified flags.
129      * The an image observer must be set using the setImageObserver() method
130      * before using this constructor.
131      * @param fname     the name of the file to load
132      * @param flags     the flags to use in construction (e.g. generate mipmap)
133      */
134     public TextureLoader(String fname, int flags){
135         super(fname, flags, sObserver);
136     }
137 
138     /***
139      * Constructs a TextureLoader object loading the specified file
140      * using the specified format.
141      * The an image observer must be set using the setImageObserver() method
142      * before using this constructor.
143      * @param fname     the name of the file to load
144      * @param format    specificaiton of which channels to use (e.g. RGB)
145      */
146     public TextureLoader(String fname, String format){
147         super(fname, format, sObserver);
148     }
149 
150     /***
151      * Constructs a TextureLoader object loading the specified file
152      * using the specified format and flags.
153      * The an image observer must be set using the setImageObserver() method
154      * before using this constructor.
155      * @param fname     the name of the file to load
156      * @param format    specificaiton of which channels to use (e.g. RGB)
157      * @param flags     the flags to use in construction (e.g. generate mipmap)
158      */
159     public TextureLoader(String fname, String format, int flags){
160         super(fname, format, flags, sObserver);
161     }
162 
163     /***
164      * Constructs a TextureLoader object loading the specified URL
165      * using the default format.
166      * The an image observer must be set using the setImageObserver() method
167      * before using this constructor.
168      * @param url       specifies the URL of the image to load
169      */
170     public TextureLoader(URL url){
171         super(url, sObserver);
172     }
173 
174     /***
175      * Constructs a TextureLoader object loading the specified URL
176      * using the specified flags.
177      * The an image observer must be set using the setImageObserver() method
178      * before using this constructor.
179      * @param url       specifies the URL of the image to load
180      * @param flags     the flags to use in construction (e.g. generate mipmap)
181      */
182     public TextureLoader(URL url, int flags){
183         super(url, flags, sObserver);
184     }
185 
186     /***
187      * Constructs a TextureLoader object loading the specified URL
188      * using the specified format.
189      * The an image observer must be set using the setImageObserver() method
190      * before using this constructor.
191      * @param url       specifies the URL of the image to load
192      * @param format    specificaiton of which channels to use (e.g. RGB)
193      */
194     public TextureLoader(URL url, String format){
195         super(url, format, sObserver);
196     }
197 
198     /***
199      * Constructs a TextureLoader object loading the specified URL
200      * using the specified format and flags.
201      * The an image observer must be set using the setImageObserver() method
202      * before using this constructor.
203      * @param url       specifies the URL of the image to load
204      * @param format    specificaiton of which channels to use (e.g. RGB)
205      * @param flags     the flags to use in construction (e.g. generate mipmap)
206      */
207     public TextureLoader(URL url, String format, int flags){
208         super(url, format, flags, sObserver);
209     }
210 
211 } // end of TexturedPlane class
212