source: trunk/poppler/mypoppler/splash/SplashBitmap.h @ 461

Last change on this file since 461 was 461, checked in by Silvan Scherrer, 11 years ago

poppler update to 0.14.2

File size: 2.8 KB
Line 
1//========================================================================
2//
3// SplashBitmap.h
4//
5//========================================================================
6
7//========================================================================
8//
9// Modified under the Poppler project - http://poppler.freedesktop.org
10//
11// All changes made under the Poppler project to this file are licensed
12// under GPL version 2 or later
13//
14// Copyright (C) 2007 Ilmari Heikkinen <ilmari.heikkinen@gmail.com>
15// Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com>
16// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
17// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
18// Copyright (C) 2010 Adrian Johnson <ajohnson@redneon.com>
19// Copyright (C) 2010 Harry Roberts <harry.roberts@midnight-labs.org>
20//
21// To see a description of the changes please see the Changelog file that
22// came with your tarball or type make ChangeLog if you are building from git
23//
24//========================================================================
25
26#ifndef SPLASHBITMAP_H
27#define SPLASHBITMAP_H
28
29#ifdef USE_GCC_PRAGMAS
30#pragma interface
31#endif
32
33#include "SplashTypes.h"
34#include <stdio.h>
35
36class ImgWriter;
37
38//------------------------------------------------------------------------
39// SplashBitmap
40//------------------------------------------------------------------------
41
42class SplashBitmap {
43public:
44
45  // Create a new bitmap.  It will have <widthA> x <heightA> pixels in
46  // color mode <modeA>.  Rows will be padded out to a multiple of
47  // <rowPad> bytes.  If <topDown> is false, the bitmap will be stored
48  // upside-down, i.e., with the last row first in memory.
49  SplashBitmap(int widthA, int heightA, int rowPad,
50               SplashColorMode modeA, GBool alphaA,
51               GBool topDown = gTrue);
52
53  ~SplashBitmap();
54
55  int getWidth() { return width; }
56  int getHeight() { return height; }
57  int getRowSize() { return rowSize; }
58  int getAlphaRowSize() { return width; }
59  SplashColorMode getMode() { return mode; }
60  SplashColorPtr getDataPtr() { return data; }
61  Guchar *getAlphaPtr() { return alpha; }
62
63  SplashError writePNMFile(char *fileName);
64  SplashError writePNMFile(FILE *f);
65 
66  SplashError writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI);
67  SplashError writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI);
68  SplashError writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI);
69
70  void getPixel(int x, int y, SplashColorPtr pixel);
71  Guchar getAlpha(int x, int y);
72
73private:
74
75  int width, height;            // size of bitmap
76  int rowSize;                  // size of one row of data, in bytes
77                                //   - negative for bottom-up bitmaps
78  SplashColorMode mode;         // color mode
79  SplashColorPtr data;          // pointer to row zero of the color data
80  Guchar *alpha;                // pointer to row zero of the alpha data
81                                //   (always top-down)
82
83  friend class Splash;
84};
85
86#endif
Note: See TracBrowser for help on using the repository browser.