Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

pnggroup4image.h

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

Generated on Tue May 17 12:07:44 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1