wxMaxima
Loading...
Searching...
No Matches
pdfimage.h
Go to the documentation of this file.
1
2// Name: pdfimage.h
3// Purpose:
4// Author: Ulrich Telle
5// Created: 2005-08-11
6// Copyright: (c) Ulrich Telle
7// Licence: wxWindows licence
9
11
12#ifndef _PDF_IMAGE_H_
13#define _PDF_IMAGE_H_
14
15// wxWidgets headers
16#include <wx/filesys.h>
17#include <wx/image.h>
18#include <wx/stream.h>
19#include <wx/string.h>
20
21// wxPdfDocument headers
22#include "wx/pdfdocdef.h"
23
24// Forward declarations
25class WXDLLIMPEXP_FWD_PDFDOC wxPdfDocument;
26
28class WXDLLIMPEXP_PDFDOC wxPdfImage
29{
30public:
32 wxPdfImage(wxPdfDocument* document, int index, const wxString& name, const wxString& type);
33
35 wxPdfImage(wxPdfDocument* document, int index, const wxString& name, const wxImage& image,
36 bool jpegFormat = false);
37
39 wxPdfImage(wxPdfDocument* document, int index, const wxString& name, wxInputStream& stream, const wxString& mimeType);
40
42 virtual ~wxPdfImage();
43
45
48 void SetIndex(int index) { m_index = index; }
49
51
54 int GetIndex() { return m_index; }
55
57
60 void SetObjIndex(int n) { m_n = n; }
61
63
66 int GetObjIndex() { return m_n; }
67
69
72 void SetMaskImage(int maskImage) { m_maskImage = maskImage; }
73
75
78 int GetMaskImage() { return m_maskImage; }
79
81
84 void SetType(const wxString& type) { m_type = type; }
85
87
90 wxString GetType() { return m_type; }
91
93
96 bool IsFormObject() { return m_isFormObj; }
97
99
102 void SetName(const wxString& name) { m_name = name; }
103
105
108 wxString GetName() { return m_name; }
109
111
114 int GetWidth() { return m_width; }
115
117
120 int GetHeight() { return m_height; }
121
123
126 int GetX() { return m_x; }
127
129
132 int GetY() { return m_y; }
133
135
138 wxString GetColourSpace() { return m_cs; }
139
141
144 int GetBitsPerComponent() { return m_bpc; }
145
147
150 wxString GetF() { return m_f; }
151
153
156 wxString GetParms() { return m_parms; }
157
159
162 unsigned int GetPaletteSize() { return m_palSize; }
163
165
168 char* GetPalette() { return m_pal; }
169
171
174 unsigned int GetTransparencySize() { return m_trnsSize; }
175
177
180 char* GetTransparency() { return m_trns; }
181
183
186 unsigned int GetDataSize() { return m_dataSize; }
187
189
192 char* GetData() { return m_data; }
193
195 bool Parse();
196
197protected:
199 bool ConvertWxImage(const wxImage& image, bool jpegFormat);
200
202 bool ParseJPG(wxInputStream* imageStream);
203
205 bool ParsePNG(wxInputStream* imageStream);
206
208 bool ParseGIF(wxInputStream* imageStream);
209
211 bool ParseWMF(wxInputStream* imageStream);
212
214 int ReadIntBE(wxInputStream* imageStream);
215
217 int ReadIntLE(wxInputStream* imageStream);
218
220 unsigned int ReadUIntBE(wxInputStream* imageStream);
221
223 unsigned int ReadUIntLE(wxInputStream* imageStream);
224
226 short ReadShortBE(wxInputStream* imageStream);
227
229 short ReadShortLE(wxInputStream* imageStream);
230
232 unsigned short ReadUShortBE(wxInputStream* imageStream);
233
235 unsigned short ReadUShortLE(wxInputStream* imageStream);
236
238 static wxFileSystem* GetFileSystem();
239
240protected:
243 int m_n;
244 wxString m_type;
245 wxString m_name;
247
250 wxString m_cs;
251 char m_bpc;
252 wxString m_f;
253 wxString m_parms;
254 unsigned int m_palSize;
255 char* m_pal;
256 unsigned int m_trnsSize;
257 char* m_trns;
258 unsigned int m_dataSize;
259 char* m_data;
260
262 int m_x;
263 int m_y;
264
267
268 wxFSFile* m_imageFile;
269 wxInputStream* m_imageStream;
270
271 static wxFileSystem* ms_fileSystem;
272};
273
274#endif
Class representing a PDF document.
Definition: pdfdocument.h:176
Class representing image objects. (For internal use only)
Definition: pdfimage.h:29
void SetObjIndex(int n)
Set object index.
Definition: pdfimage.h:60
bool m_validWxImage
Flag whether wxImage conversion went ok.
Definition: pdfimage.h:266
static wxFileSystem * ms_fileSystem
File system for accessing image files.
Definition: pdfimage.h:271
int m_n
Image object index.
Definition: pdfimage.h:243
unsigned int GetDataSize()
Get image data size.
Definition: pdfimage.h:186
wxInputStream * m_imageStream
Stream containing the image data.
Definition: pdfimage.h:269
char * GetPalette()
Get palette data.
Definition: pdfimage.h:168
bool m_isFormObj
Flag whether image must be treated as form object.
Definition: pdfimage.h:261
int m_width
Image width in pixels.
Definition: pdfimage.h:248
int m_height
Image height in pixels.
Definition: pdfimage.h:249
wxString m_type
Image type.
Definition: pdfimage.h:244
void SetIndex(int index)
Set image index.
Definition: pdfimage.h:48
int GetObjIndex()
Get object index.
Definition: pdfimage.h:66
char * m_pal
Palette data.
Definition: pdfimage.h:255
char * GetData()
Get image data.
Definition: pdfimage.h:192
void SetMaskImage(int maskImage)
Set mask flag.
Definition: pdfimage.h:72
unsigned int GetPaletteSize()
Get palette size.
Definition: pdfimage.h:162
int GetBitsPerComponent()
Get bits per component.
Definition: pdfimage.h:144
wxString GetType()
Get image type.
Definition: pdfimage.h:90
void SetName(const wxString &name)
Set image file name.
Definition: pdfimage.h:102
wxString m_parms
Additional PDF parameters.
Definition: pdfimage.h:253
wxString GetName()
Get image file name.
Definition: pdfimage.h:108
int m_maskImage
Id of associated image mask.
Definition: pdfimage.h:246
int m_index
Index number of this image.
Definition: pdfimage.h:242
int m_y
Offset in Y direction.
Definition: pdfimage.h:263
int GetX()
Get image offset in X direction.
Definition: pdfimage.h:126
bool IsFormObject()
Check whether image has to be handled as a form object.
Definition: pdfimage.h:96
wxPdfDocument * m_document
Document this image belongs to.
Definition: pdfimage.h:241
unsigned int GetTransparencySize()
Get transparency size.
Definition: pdfimage.h:174
wxFSFile * m_imageFile
File system file of image.
Definition: pdfimage.h:268
wxString m_name
Image name.
Definition: pdfimage.h:245
char * m_trns
Transparency colour data.
Definition: pdfimage.h:257
int GetHeight()
Get image height in pixels.
Definition: pdfimage.h:120
wxString m_f
Compression method.
Definition: pdfimage.h:252
int GetY()
Get image offset in Y direction.
Definition: pdfimage.h:132
wxString m_cs
Colourspace.
Definition: pdfimage.h:250
wxString GetParms()
Get additional PDF parameter.
Definition: pdfimage.h:156
bool m_fromWxImage
Flag whether image originated from wxImage.
Definition: pdfimage.h:265
wxString GetColourSpace()
Get colour space.
Definition: pdfimage.h:138
char m_bpc
Bits per colour.
Definition: pdfimage.h:251
int GetWidth()
Get image width in pixels.
Definition: pdfimage.h:114
char * GetTransparency()
Get transparency data.
Definition: pdfimage.h:180
void SetType(const wxString &type)
Set image type.
Definition: pdfimage.h:84
int m_x
Offset in X direction.
Definition: pdfimage.h:262
int GetMaskImage()
Check mask flag.
Definition: pdfimage.h:78
wxString GetF()
Get compression filter specification.
Definition: pdfimage.h:150
unsigned int m_dataSize
Image data size.
Definition: pdfimage.h:258
unsigned int m_palSize
Size of palette.
Definition: pdfimage.h:254
char * m_data
Image data.
Definition: pdfimage.h:259
unsigned int m_trnsSize
Transparency colour size.
Definition: pdfimage.h:256
int GetIndex()
Get image index.
Definition: pdfimage.h:54
Compile time switches for the wxPdfDocument component.