00001 00002 /* 00003 TEDDY - General graphics application library 00004 Copyright (C) 1999-2002 Timo Suoranta 00005 tksuoran@cc.helsinki.fi 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 $Id: LWClip.cpp,v 1.4 2002/01/11 14:34:59 tksuoran Exp $ 00022 */ 00023 00024 00025 #include "Teddy/TeddyConfig.h" 00026 #if defined( TEDDY_INCLUDE_LW_SCENE ) 00027 00028 00029 #include "Teddy/Imports/LWClip.h" 00030 #include "Teddy/Imports/LWFile.h" 00031 00032 00033 namespace Teddy { 00034 namespace Imports { 00035 00036 00038 LWClip::LWClip( LWFile *f ){ 00039 this->f = f; 00040 image_sequence_num_digits = 0; 00041 image_sequence_flags = 0; 00042 image_sequence_offset = 0; 00043 image_sequence_loop_length = 0; 00044 plugin_animation_flags = 0; 00045 color_cycling_still_image_lo = 0; 00046 color_cycling_still_image_hi = 0; 00047 contrast_modifier = 0; 00048 contrast_modifier_envelope = 0; 00049 brightness_modifier = 0; 00050 brightness_modifier_envelope = 0; 00051 saturation_modifier = 0; 00052 saturation_modifier_envelope = 0; 00053 hue_modifier = 0; 00054 hue_modifier_envelope = 0; 00055 gamma_modifier = 0; 00056 gamma_modifier_envelope = 0; 00057 negative_modifier = 0; 00058 plugin_image_filter_flags = 0; 00059 plugin_pixel_filter_flags = 0; 00060 } 00061 00062 00063 void LWClip::processClip(){ 00064 dmsg( M_LWO, 00065 "%s::CLIP::%s (%d bytes)", 00066 did( f->getType() ), 00067 did( clip_type ), 00068 clip_length 00069 ); 00070 clip_type = f->read_ID4(); 00071 clip_length = f->read_U2(); 00072 f->pushDomain( clip_length ); 00073 00074 switch( clip_type ){ 00075 case ID_STIL: readStillImage_FNAM0 (); break; 00076 case ID_ISEQ: readImageSequence_U1_U1_I2_I2_FNAM0_S0(); break; 00077 case ID_ANIM: readAnimation_FNAM0_S0_U2_d (); break; 00078 case ID_STCC: readStillColorCycle_I2_I2_FNAM0 (); break; 00079 case ID_CONT: readContrast_FP4_VX (); break; 00080 case ID_BRIT: readBrightness_FP4_VX (); break; 00081 case ID_SATR: readSaturation_FP4_VX (); break; 00082 case ID_HUE: readHue_FP4_VX (); break; 00083 case ID_GAMM: readGamma_F4_VX (); break; 00084 case ID_NEGA: readNegative_U2 (); break; 00085 case ID_IFLT: readImageFilter_S0_U2_d (); break; 00086 case ID_PFLT: readPixelFilter_S0_U2_d (); break; 00087 } 00088 f->popDomain( true ); 00089 } 00090 00091 00100 void LWClip::readStillImage_FNAM0(){ 00101 still_image = f->read_FNAM0(); 00102 } 00103 00104 00117 void LWClip::readImageSequence_U1_U1_I2_I2_FNAM0_S0(){ 00118 image_sequence_num_digits = f->read_U1(); 00119 image_sequence_flags = f->read_U1(); 00120 image_sequence_offset = f->read_I2(); 00121 image_sequence_loop_length = f->read_I2(); 00122 image_sequence_prefix = f->read_FNAM0(); 00123 image_sequence_suffix = f->read_S0(); 00124 } 00125 00126 00135 void LWClip::readAnimation_FNAM0_S0_U2_d(){ 00136 plugin_animation_filename = f->read_FNAM0(); 00137 plugin_animation_server_name = f->read_S0(); 00138 plugin_animation_flags = f->read_U2(); 00139 00140 while( f->domainLeft() > 0 ){ 00141 U1 data = f->read_U1(); 00142 // FIX send data to plugin 00143 } 00144 } 00145 00146 00155 void LWClip::readStillColorCycle_I2_I2_FNAM0(){ 00156 color_cycling_still_image_lo = f->read_I2(); 00157 color_cycling_still_image_hi = f->read_I2(); 00158 color_cycling_still_image_name = f->read_FNAM0(); 00159 } 00160 00161 00169 void LWClip::readContrast_FP4_VX(){ 00170 contrast_modifier = f->read_FP4(); 00171 contrast_modifier_envelope = f->read_VX(); 00172 } 00173 00174 00182 void LWClip::readBrightness_FP4_VX(){ 00183 brightness_modifier = f->read_FP4(); 00184 brightness_modifier_envelope = f->read_VX(); 00185 } 00186 00187 00195 void LWClip::readSaturation_FP4_VX(){ 00196 saturation_modifier = f->read_FP4(); 00197 saturation_modifier_envelope = f->read_VX(); 00198 } 00199 00200 00208 void LWClip::readHue_FP4_VX(){ 00209 FP4 hue_modifier = f->read_FP4(); 00210 VX hue_modifier_envelope = f->read_VX(); 00211 } 00212 00213 00221 void LWClip::readGamma_F4_VX(){ 00222 gamma_modifier = f->read_F4(); 00223 gamma_modifier_envelope = f->read_VX(); 00224 } 00225 00226 00233 void LWClip::readNegative_U2(){ 00234 U2 negative_modifier = f->read_U2(); 00235 } 00236 00237 00248 void LWClip::readImageFilter_S0_U2_d(){ 00249 plugin_image_filter_server_name = f->read_S0(); 00250 plugin_image_filter_flags = f->read_U2(); 00251 00252 if( (plugin_image_filter_flags & 1 ) == 1 ){ // enable flag set? 00253 while( f->domainLeft() > 0 ){ 00254 U1 data = f->read_U1(); 00255 // FIX send data to plugin 00256 } 00257 } 00258 } 00259 00260 00268 void LWClip::readPixelFilter_S0_U2_d(){ 00269 S0 plugin_pixel_filter_server_name = f->read_S0(); 00270 U2 plugin_pixel_filter_flags = f->read_U2(); 00271 00272 if( (plugin_pixel_filter_flags & 1 ) == 1 ){ // enable flag set? 00273 while( f->domainLeft() > 0 ){ 00274 U1 data = f->read_U1(); 00275 // FIX send data to plugin 00276 } 00277 } 00278 } 00279 00280 00281 }; // namespace Imports 00282 }; // namespace Teddy 00283 00284 00285 #endif // TEDDY_INCLUDE_LW_SCENE 00286