~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/contrib/source_exporter/wxPdfDocument/include/wx/pdfimage.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
///////////////////////////////////////////////////////////////////////////////
 
2
// Name:        pdfimage.h
 
3
// Purpose:     
 
4
// Author:      Ulrich Telle
 
5
// Modified by:
 
6
// Created:     2005-08-11
 
7
// Copyright:   (c) Ulrich Telle
 
8
// Licence:     wxWindows licence
 
9
///////////////////////////////////////////////////////////////////////////////
 
10
 
 
11
/// \file pdfimage.h Interface of the wxPdfImage class
 
12
 
 
13
#ifndef _PDFIMAGE_H_
 
14
#define _PDFIMAGE_H_
 
15
 
 
16
#include <wx/filesys.h>
 
17
#include <wx/image.h>
 
18
 
 
19
#include "wx/pdfdocdef.h"
 
20
 
 
21
// Forward declarations
 
22
 
 
23
class WXDLLIMPEXP_PDFDOC wxPdfDocument;
 
24
 
 
25
/// Class representing image objects. (For internal use only)
 
26
class WXDLLIMPEXP_PDFDOC wxPdfImage
 
27
{
 
28
public:
 
29
  /// Constructor
 
30
  wxPdfImage(wxPdfDocument* document, int index, const wxString& name, const wxString& type);
 
31
 
 
32
  /// Constructor
 
33
  wxPdfImage(wxPdfDocument* document, int index, const wxString& name, const wxImage& image);
 
34
 
 
35
  /// Constructor
 
36
  wxPdfImage(wxPdfDocument* document, int index, const wxString& name, wxInputStream& stream, const wxString& mimeType);
 
37
 
 
38
  /// Destructor
 
39
  virtual ~wxPdfImage();
 
40
 
 
41
  /// Set image index
 
42
  void SetIndex(int index) { m_index = index; }
 
43
 
 
44
  /// Get image index
 
45
  int  GetIndex() { return m_index; }
 
46
 
 
47
  /// Set object index
 
48
  void SetObjIndex(int n) { m_n = n; }
 
49
 
 
50
  /// Get object index
 
51
  int  GetObjIndex() { return m_n; }
 
52
 
 
53
  /// Set mask flag
 
54
  void SetMaskImage(int maskImage) { m_maskImage = maskImage; }
 
55
 
 
56
  /// Check mask flag
 
57
  int GetMaskImage() { return m_maskImage; }
 
58
 
 
59
  /// Set image type
 
60
  void SetType(const wxString& type) { m_type = type; }
 
61
 
 
62
  /// Get image type
 
63
  wxString GetType() { return m_type; }
 
64
 
 
65
  /// Check whether image has to be handled as a form object
 
66
  bool IsFormObject() { return m_isFormObj; }
 
67
 
 
68
  /// Set image file name
 
69
  void SetName(const wxString& name) { m_name = name; }
 
70
 
 
71
  /// Get image file name
 
72
  wxString GetName() { return m_name; }
 
73
 
 
74
  /// Get image width in pixels
 
75
  int GetWidth() { return m_width; }
 
76
 
 
77
  /// Get image height in pixels
 
78
  int GetHeight() { return m_height; }
 
79
 
 
80
  /// Get image offset in X direction
 
81
  int GetX() { return m_x; }
 
82
 
 
83
  /// Get image offset in Y direction
 
84
  int GetY() { return m_y; }
 
85
 
 
86
  /// Get color space
 
87
  wxString GetColorSpace() { return m_cs; }
 
88
 
 
89
  /// Get bits per component
 
90
  int GetBitsPerComponent() { return m_bpc; }
 
91
 
 
92
  /// Get compression filter specification
 
93
  wxString GetF() { return m_f; }
 
94
 
 
95
  /// Get additional PDF parameter
 
96
  wxString GetParms() { return m_parms; }
 
97
 
 
98
  /// Get palette size
 
99
  int GetPaletteSize() { return m_palSize; }
 
100
 
 
101
  /// Get palette data
 
102
  char* GetPalette() { return m_pal; }
 
103
 
 
104
  /// Get transparency size
 
105
  int GetTransparencySize() { return m_trnsSize; }
 
106
 
 
107
  /// Get transparency data
 
108
  char* GetTransparency() { return m_trns; }
 
109
 
 
110
  /// Get image data size
 
111
  int GetDataSize() { return m_dataSize; }
 
112
 
 
113
  /// Get image data
 
114
  char* GetData() { return m_data; }
 
115
 
 
116
  /// Parse image file
 
117
  bool Parse();
 
118
 
 
119
protected:
 
120
  /// Extract info from a wxImage
 
121
  bool ConvertWxImage(const wxImage& image);
 
122
 
 
123
  /// Extract info from a JPEG file
 
124
  bool ParseJPG(wxInputStream* imageStream);
 
125
 
 
126
  /// Extract info from a PNG file
 
127
  bool ParsePNG(wxInputStream* imageStream);
 
128
 
 
129
  /// Extract info from a GIF file
 
130
  bool ParseGIF(wxInputStream* imageStream);
 
131
 
 
132
  /// Extract info from a WMF file
 
133
  bool ParseWMF(wxInputStream* imageStream);
 
134
 
 
135
  /// Read a 4-byte integer from file (big endian)
 
136
  int ReadIntBE(wxInputStream* imageStream);
 
137
 
 
138
  /// Read a 4-byte integer from file (little endian)
 
139
  int ReadIntLE(wxInputStream* imageStream);
 
140
  
 
141
  /// Read a 4-byte unsigned integer from file (big endian)
 
142
  unsigned int ReadUIntBE(wxInputStream* imageStream);
 
143
 
 
144
  /// Read a 4-byte unsigned integer from file (little endian)
 
145
  unsigned int ReadUIntLE(wxInputStream* imageStream);
 
146
  
 
147
  /// Read a 2-byte integer from file (big endian)
 
148
  short ReadShortBE(wxInputStream* imageStream);
 
149
 
 
150
  /// Read a 2-byte integer from file (little endian)
 
151
  short ReadShortLE(wxInputStream* imageStream);
 
152
 
 
153
  /// Read a unsigned 2-byte integer from file (big endian)
 
154
  unsigned short ReadUShortBE(wxInputStream* imageStream);
 
155
 
 
156
  /// Read a unsigned 2-byte integer from file (little endian)
 
157
  unsigned short ReadUShortLE(wxInputStream* imageStream);
 
158
 
 
159
  /// Get the file system for accessing image files
 
160
  static wxFileSystem* GetFileSystem();
 
161
 
 
162
protected:
 
163
  wxPdfDocument* m_document;  ///< Document this image belongs to
 
164
  int            m_index;     ///< Index number of this image
 
165
  int            m_n;         ///< Image object index
 
166
  wxString       m_type;      ///< Image type
 
167
  wxString       m_name;      ///< Image name
 
168
  int            m_maskImage; ///< Id of associated image mask
 
169
 
 
170
  int            m_width;     ///< Image width in pixels
 
171
  int            m_height;    ///< Image height in pixels
 
172
  wxString       m_cs;        ///< Colorspace
 
173
  char           m_bpc;       ///< Bits per color
 
174
  wxString       m_f;         ///< Compression method
 
175
  wxString       m_parms;     ///< Additional PDF parameters
 
176
  int            m_palSize;   ///< Size of palette
 
177
  char*          m_pal;       ///< Palette data
 
178
  int            m_trnsSize;  ///< Transparency color size
 
179
  char*          m_trns;      ///< Transparency color data
 
180
  int            m_dataSize;  ///< Image data size
 
181
  char*          m_data;      ///< Image data
 
182
 
 
183
  bool           m_isFormObj; ///< Flag whether image must be treated as form object
 
184
  int            m_x;         ///< Offset in X direction
 
185
  int            m_y;         ///< Offset in Y direction
 
186
 
 
187
  bool           m_fromWxImage;  ///< Flag whether image originated from wxImage
 
188
  bool           m_validWxImage; ///< Flag whether wxImage conversion went ok
 
189
 
 
190
  wxFSFile*      m_imageFile;    ///< File system file of image
 
191
  wxInputStream* m_imageStream;  ///< Stream containing the image data
 
192
 
 
193
  static wxFileSystem* ms_fileSystem; ///< File system for accessing image files
 
194
};
 
195
 
 
196
#endif