pnggroup4image.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00022 
00023 #if !defined PNGGROUP4IMAGE_HEADER
00024 #define PNGGROUP4IMAGE_HEADER
00025 
00026 #include "whiptk/whipcore.h"
00027 #include "whiptk/file.h"
00028 #include "whiptk/drawable.h"
00029 
00034 
00035 
00039 class WHIPTK_API WT_PNG_Group4_Image : public WT_Drawable
00040 {
00041         friend class WT_W2D_Class_Factory;
00042         friend class WT_Opcode;
00043 
00044 public:
00046     enum WT_PNG_Group4_Image_Format
00047     {
00048         Group4X_Mapped      = WD_IMAGE_GROUP4X_MAPPED_EXT_OPCODE,
00049         Group4              = WD_IMAGE_GROUP4_BITONAL_EXT_OPCODE,
00050         PNG                 = WD_IMAGE_PNG_EXT_OPCODE
00051     };
00052 
00053 protected:
00054 
00055     WT_Unsigned_Integer16   m_rows;
00056     WT_Unsigned_Integer16   m_columns;
00057     WT_Byte                 m_format;
00058     WT_Integer32            m_identifier;
00059     WT_Integer32            m_dpi;
00060     WT_Color_Map *          m_color_map;
00061     WT_Integer32            m_data_size;
00062     WT_Byte *               m_data;
00063     WT_Logical_Point        m_min_corner;
00064     WT_Logical_Point        m_max_corner;
00065     WT_Boolean              m_transformed;
00066     WT_Boolean              m_relativized;
00067     WT_Boolean              m_local_data_copy;
00068     WT_Boolean              m_local_color_map_copy;
00069 
00070     // Scratchpad for conversion method use
00071     WT_Byte *               m_source_data;
00072     int                     m_src_byte_position;
00073     int                     m_src_bits_used;
00074     int                     m_dst_bits_used;
00075     int                     m_data_allocated;
00076 
00077     enum
00078     {
00079         Starting,
00080         Getting_Columns,
00081         Getting_Col_Row_Comma,
00082         Getting_Rows,
00083         Getting_Min_Corner,
00084         Getting_Max_Corner,
00085         Getting_Format,
00086         Getting_Identifier,
00087         Getting_Color_Map_Size,
00088         Getting_Color_Map_Opcode,
00089         Getting_Color_Map,
00090         Getting_Pre_Data_Size_Whitespace,
00091         Getting_Pre_Data_Size_Open_Paren,
00092         Getting_Data_Size,
00093         Getting_Data,
00094         Getting_Close
00095     }                       m_stage;
00096 
00097     WT_Opcode               m_colormap_opcode;
00098 
00099 
00100 public:
00101     WT_PNG_Group4_Image (WT_PNG_Group4_Image const &)
00102       : WT_Drawable()
00103       , m_rows()
00104       , m_columns()
00105       , m_format()
00106       , m_identifier()
00107       , m_dpi()
00108       , m_color_map()
00109       , m_data_size()
00110       , m_data()
00111       , m_min_corner()
00112       , m_max_corner()
00113       , m_transformed()
00114       , m_relativized()
00115       , m_local_data_copy()
00116       , m_local_color_map_copy()
00117       , m_source_data()
00118       , m_src_byte_position()
00119       , m_src_bits_used()
00120       , m_dst_bits_used()
00121       , m_data_allocated()
00122       , m_stage()
00123       , m_colormap_opcode()
00124     {
00125         WD_Complain ("cannot copy WT_PNG_Group4_Image");
00126     } // prohibited
00127 
00128     WT_PNG_Group4_Image & operator= (WT_PNG_Group4_Image const &)
00129     {
00130         WD_Complain ("cannot assign WT_PNG_Group4_Image");
00131         return *this;
00132     } // prohibited
00133 
00135     WT_PNG_Group4_Image ()
00136                 : m_rows(0)
00137                 , m_columns(0)
00138                 , m_format(PNG)
00139                 , m_identifier(0)
00140                 , m_dpi(0)
00141                 , m_color_map(WD_Null)
00142                 , m_data_size(0)
00143                 , m_data(WD_Null)
00144                 , m_min_corner(0,0)
00145                 , m_max_corner(0,0)
00146                 , m_transformed(WD_False)
00147                 , m_relativized(WD_False)
00148                 , m_local_data_copy(WD_False)
00149                 , m_local_color_map_copy(WD_False)
00150                 , m_stage(Starting)
00151             { }
00152 
00153 
00154 
00157     WT_PNG_Group4_Image (int image_type)
00158                 : m_rows(0)
00159                 , m_columns(0)
00160                 , m_format(static_cast<WT_Byte>(image_type))
00161                 , m_identifier(0)
00162                 , m_dpi(0)
00163                 , m_color_map(WD_Null)
00164                 , m_data_size(0)
00165                 , m_data(WD_Null)
00166                 , m_min_corner(0,0)
00167                 , m_max_corner(0,0)
00168                 , m_transformed(WD_False)
00169                 , m_relativized(WD_False)
00170                 , m_local_data_copy(WD_False)
00171                 , m_local_color_map_copy(WD_False)
00172                 , m_stage(Getting_Columns)
00173             { }
00174 
00175 
00177     WT_PNG_Group4_Image(
00178             WT_Unsigned_Integer16       rows, 
00179             WT_Unsigned_Integer16       columns, 
00180             WT_PNG_Group4_Image_Format  format, 
00181             WT_Integer32                identifier, 
00182             WT_Color_Map const *        color_map, 
00183             WT_Integer32                data_size, 
00184             WT_Byte *                   data, 
00185             WT_Logical_Point const &    min_corner, 
00186             WT_Logical_Point const &    max_corner, 
00187             WT_Boolean                  copy, 
00188             WT_Integer32                dpi=-1 
00189             ) throw(WT_Result);
00190 
00192     virtual ~WT_PNG_Group4_Image()
00193     {
00194         if (m_local_data_copy)
00195             delete [] m_data;
00196 
00197         if (m_local_color_map_copy)
00198             delete m_color_map;
00199     }
00200 public:
00201 
00203 
00204     WT_Color_Map const * color_map() const
00205     {   return m_color_map;     }
00207     WT_Unsigned_Integer16 columns() const
00208     {   return m_columns;  }
00209     WT_Unsigned_Integer16& columns() 
00210     {   return m_columns;  }
00212     WT_Byte const * data() const
00213     {   return m_data;  }
00215     WT_Integer32 data_size() const
00216     {   return m_data_size; }
00218     WT_Byte format() const
00219     {   return m_format;  }
00220     WT_Byte& format() 
00221     {   return m_format;  }
00223     WT_Integer32 identifier() const
00224     {   return m_identifier;    }
00225     WT_Integer32 const& dpi() const
00226     {   return m_dpi;   }
00227     WT_Integer32& dpi()
00228     {   return m_dpi;   }
00230     WT_Logical_Point const & max_corner() const
00231     {   return m_max_corner;    }
00232     WT_Logical_Point& max_corner() 
00233     {   return m_max_corner;    }
00235     WT_Logical_Point const & min_corner() const
00236     {   return m_min_corner;    }
00237     WT_Logical_Point& min_corner()
00238     {   return m_min_corner;    }
00240     WT_Unsigned_Integer16 rows() const
00241     {   return m_rows;  }
00242     WT_Unsigned_Integer16& rows() 
00243     {   return m_rows;  }
00244 
00245     WT_Result set(WT_Color_Map const* pColorMap);
00247 
00249 
00250     virtual void        de_relativize(WT_File & file);
00252     virtual void        relativize(WT_File & file);
00254     virtual void           transform(WT_Transform const & transform);
00256 
00258     WT_ID            object_id() const;
00259     WT_Result        serialize(WT_File & file) const;
00260     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00261     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00262     WT_Result        process(WT_File & file);
00263     virtual void     update_bounds(WT_File * file);
00265 
00267 
00269     static WT_Result default_process(
00270         WT_PNG_Group4_Image & item, 
00271         WT_File & file 
00272         );
00273 };
00275 
00276 #endif // PNGGROUP4IMAGE_HEADER

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5