Scribus
Open source desktop publishing at your fingertips
WPGBitmap.h
1 /* libwpg
2  * Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
3  * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02111-1301 USA
19  *
20  * For further information visit http://libwpg.sourceforge.net
21  */
22 
23 /* "This product is not manufactured, approved, or supported by
24  * Corel Corporation or Corel Corporation Limited."
25  */
26 
27 #ifndef __WPGBITMAP_H__
28 #define __WPGBITMAP_H__
29 
30 #include "WPGRect.h"
31 #include "WPGColor.h"
32 #include "WPGString.h"
33 
34 namespace libwpg
35 {
36 
37 class WPGBitmap
38 {
39 public:
40  WPGRect rect;
41 
42  WPGBitmap(int width, int height);
43 
44  WPGBitmap(int width, int height, bool verticalFlip, bool horizontalFlip);
45 
46  WPGBitmap(const WPGBitmap&);
47 
48  WPGBitmap& operator=(const WPGBitmap&);
49 
50  void copyFrom(const WPGBitmap&);
51 
52  ~WPGBitmap();
53 
54  // return width in pixel
55  int width() const;
56 
57  // return height in pixel
58  int height() const;
59 
60  WPGColor pixel(int x, int y) const;
61 
62  void setPixel(int x, int y, const WPGColor& color);
63 
64  void generateBase64DIB(WPGString& bmp) const;
65 
66  static void base64Encode(WPGString& base64, const char *data, const int len);
67 
68 private:
69  class Private;
70  Private* const d;
71  static void writeU16(char *buffer, unsigned &position, const int value);
72  static void writeU32(char *buffer, unsigned &position, const int value);
73  static void writeU8(char *buffer, unsigned &position, const int value);
74 };
75 
76 } // namespace libwpg
77 
78 #endif // __WPGBITMAP_H__
Definition: WPGBitmap.cpp:38
Definition: WPGBitmap.h:37
Definition: WPGString.h:32
Definition: WPGRect.h:34
Binary buffer.
Definition: pdbim.h:93
Definition: WPGBinaryData.h:34
Definition: WPGColor.h:32