00001 // Filename: imageBuffer.I 00002 // Created by: drose (21Nov00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: ImageBuffer::has_filename 00022 // Access: Published 00023 // Description: Returns true if the filename has been set and 00024 // is available. See set_filename(). 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE bool ImageBuffer:: 00027 has_filename() const { 00028 return !_filename.empty(); 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: ImageBuffer::get_filename 00033 // Access: Published 00034 // Description: Returns the filename that has been set. This is the 00035 // name of the file as it was requested. Also see 00036 // get_fullpath(). 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE const Filename &ImageBuffer:: 00039 get_filename() const { 00040 return _filename; 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: ImageBuffer::has_alpha_filename 00045 // Access: Published 00046 // Description: Returns true if the alpha_filename has been set and 00047 // is available. See set_alpha_filename(). 00048 //////////////////////////////////////////////////////////////////// 00049 INLINE bool ImageBuffer:: 00050 has_alpha_filename() const { 00051 return !_alpha_filename.empty(); 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: ImageBuffer::get_alpha_filename 00056 // Access: Published 00057 // Description: Returns the alpha_filename that has been set. If 00058 // this is set, it represents the name of the alpha 00059 // component, which is stored in a separate file. See 00060 // also get_filename(), and get_alpha_fullpath(). 00061 //////////////////////////////////////////////////////////////////// 00062 INLINE const Filename &ImageBuffer:: 00063 get_alpha_filename() const { 00064 return _alpha_filename; 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: ImageBuffer::has_fullpath 00069 // Access: Published 00070 // Description: Returns true if the fullpath has been set and 00071 // is available. See set_fullpath(). 00072 //////////////////////////////////////////////////////////////////// 00073 INLINE bool ImageBuffer:: 00074 has_fullpath() const { 00075 return !_fullpath.empty(); 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function: ImageBuffer::get_fullpath 00080 // Access: Published 00081 // Description: Returns the fullpath that has been set. This is the 00082 // full path to the file as it was found along the 00083 // texture search path. 00084 //////////////////////////////////////////////////////////////////// 00085 INLINE const Filename &ImageBuffer:: 00086 get_fullpath() const { 00087 return _fullpath; 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: ImageBuffer::has_alpha_fullpath 00092 // Access: Published 00093 // Description: Returns true if the alpha_fullpath has been set and 00094 // is available. See set_alpha_fullpath(). 00095 //////////////////////////////////////////////////////////////////// 00096 INLINE bool ImageBuffer:: 00097 has_alpha_fullpath() const { 00098 return !_alpha_fullpath.empty(); 00099 } 00100 00101 //////////////////////////////////////////////////////////////////// 00102 // Function: ImageBuffer::get_alpha_fullpath 00103 // Access: Published 00104 // Description: 00105 // Returns the alpha_fullpath that has been set. This 00106 // is the full path to the alpha part of the image file 00107 // as it was found along the texture search path. 00108 //////////////////////////////////////////////////////////////////// 00109 INLINE const Filename &ImageBuffer:: 00110 get_alpha_fullpath() const { 00111 return _alpha_fullpath; 00112 } 00113 00114 00115 //////////////////////////////////////////////////////////////////// 00116 // Function: ImageBuffer::set_filename 00117 // Access: Public 00118 // Description: Sets the name of the file that contains the image's 00119 // contents. Normally, this is set automatically when 00120 // the image is loaded, for instance via 00121 // Texture::read(). 00122 // 00123 // The ImageBuffer's get_name() function used to return 00124 // the filename, but now returns just the basename 00125 // (without the extension), which is a more useful name 00126 // for identifying an image in show code. 00127 //////////////////////////////////////////////////////////////////// 00128 INLINE void ImageBuffer:: 00129 set_filename(const Filename &filename) { 00130 _filename = filename; 00131 } 00132 00133 //////////////////////////////////////////////////////////////////// 00134 // Function: ImageBuffer::clear_filename 00135 // Access: Public 00136 // Description: Removes the alpha filename, if it was previously set. 00137 // See set_filename(). 00138 //////////////////////////////////////////////////////////////////// 00139 INLINE void ImageBuffer:: 00140 clear_filename() { 00141 _filename = Filename(); 00142 } 00143 00144 00145 //////////////////////////////////////////////////////////////////// 00146 // Function: ImageBuffer::set_alpha_filename 00147 // Access: Public 00148 // Description: Sets the name of the file that contains the image's 00149 // alpha channel contents. Normally, this is set 00150 // automatically when the image is loaded, for instance 00151 // via Texture::read(). 00152 // 00153 // The ImageBuffer's get_filename() function returns the 00154 // name of the image file that was loaded into the 00155 // buffer. In the case where a texture specified two 00156 // separate files to load, a 1- or 3-channel color image 00157 // and a 1-channel alpha image, this Filename is update 00158 // to contain the name of the image file that was loaded 00159 // into the buffer's alpha channel. 00160 //////////////////////////////////////////////////////////////////// 00161 INLINE void ImageBuffer:: 00162 set_alpha_filename(const Filename &alpha_filename) { 00163 _alpha_filename = alpha_filename; 00164 } 00165 00166 //////////////////////////////////////////////////////////////////// 00167 // Function: ImageBuffer::clear_alpha_filename 00168 // Access: Public 00169 // Description: Removes the alpha filename, if it was previously set. 00170 // See set_alpha_filename(). 00171 //////////////////////////////////////////////////////////////////// 00172 INLINE void ImageBuffer:: 00173 clear_alpha_filename() { 00174 _alpha_filename = Filename(); 00175 } 00176 00177 //////////////////////////////////////////////////////////////////// 00178 // Function: ImageBuffer::set_fullpath 00179 // Access: Public 00180 // Description: Sets the full pathname to the file that contains the 00181 // image's contents, as found along the search path. 00182 // Normally, this is set automatically when the image is 00183 // loaded, for instance via Texture::read(). 00184 //////////////////////////////////////////////////////////////////// 00185 INLINE void ImageBuffer:: 00186 set_fullpath(const Filename &fullpath) { 00187 _fullpath = fullpath; 00188 } 00189 00190 //////////////////////////////////////////////////////////////////// 00191 // Function: ImageBuffer::clear_fullpath 00192 // Access: Public 00193 // Description: Removes the alpha fullpath, if it was previously set. 00194 // See set_fullpath(). 00195 //////////////////////////////////////////////////////////////////// 00196 INLINE void ImageBuffer:: 00197 clear_fullpath() { 00198 _fullpath = Filename(); 00199 } 00200 00201 //////////////////////////////////////////////////////////////////// 00202 // Function: ImageBuffer::set_alpha_fullpath 00203 // Access: Public 00204 // Description: Sets the full pathname to the file that contains the 00205 // image's alpha channel contents, as found along the 00206 // search path. Normally, this is set automatically 00207 // when the image is loaded, for instance via 00208 // Texture::read(). 00209 //////////////////////////////////////////////////////////////////// 00210 INLINE void ImageBuffer:: 00211 set_alpha_fullpath(const Filename &alpha_fullpath) { 00212 _alpha_fullpath = alpha_fullpath; 00213 } 00214 00215 //////////////////////////////////////////////////////////////////// 00216 // Function: ImageBuffer::clear_alpha_fullpath 00217 // Access: Public 00218 // Description: Removes the alpha fullpath, if it was previously set. 00219 // See set_alpha_fullpath(). 00220 //////////////////////////////////////////////////////////////////// 00221 INLINE void ImageBuffer:: 00222 clear_alpha_fullpath() { 00223 _alpha_fullpath = Filename(); 00224 }