~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/poppler/splash/SplashBitmap.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
Import upstream version 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
// Copyright (C) 2010 Christian Feuers�nger <cfeuersaenger@googlemail.com>
 
21
//
 
22
// To see a description of the changes please see the Changelog file that
 
23
// came with your tarball or type make ChangeLog if you are building from git
 
24
//
 
25
//========================================================================
 
26
 
 
27
#ifndef SPLASHBITMAP_H
 
28
#define SPLASHBITMAP_H
 
29
 
 
30
#ifdef USE_GCC_PRAGMAS
 
31
#pragma interface
 
32
#endif
 
33
 
 
34
#include "SplashTypes.h"
 
35
#include <stdio.h>
 
36
 
 
37
class ImgWriter;
 
38
 
 
39
//------------------------------------------------------------------------
 
40
// SplashBitmap
 
41
//------------------------------------------------------------------------
 
42
 
 
43
class SplashBitmap {
 
44
public:
 
45
 
 
46
  // Create a new bitmap.  It will have <widthA> x <heightA> pixels in
 
47
  // color mode <modeA>.  Rows will be padded out to a multiple of
 
48
  // <rowPad> bytes.  If <topDown> is false, the bitmap will be stored
 
49
  // upside-down, i.e., with the last row first in memory.
 
50
  SplashBitmap(int widthA, int heightA, int rowPad,
 
51
               SplashColorMode modeA, GBool alphaA,
 
52
               GBool topDown = gTrue);
 
53
 
 
54
  ~SplashBitmap();
 
55
 
 
56
  int getWidth() { return width; }
 
57
  int getHeight() { return height; }
 
58
  int getRowSize() { return rowSize; }
 
59
  int getAlphaRowSize() { return width; }
 
60
  int getRowPad() { return rowPad; }
 
61
  SplashColorMode getMode() { return mode; }
 
62
  SplashColorPtr getDataPtr() { return data; }
 
63
  Guchar *getAlphaPtr() { return alpha; }
 
64
 
 
65
  SplashError writePNMFile(char *fileName);
 
66
  SplashError writePNMFile(FILE *f);
 
67
  
 
68
  SplashError writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI);
 
69
  SplashError writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI);
 
70
  SplashError writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI);
 
71
 
 
72
  void getPixel(int x, int y, SplashColorPtr pixel);
 
73
  Guchar getAlpha(int x, int y);
 
74
 
 
75
private:
 
76
 
 
77
  int width, height;            // size of bitmap
 
78
  int rowPad;
 
79
  int rowSize;                  // size of one row of data, in bytes
 
80
                                //   - negative for bottom-up bitmaps
 
81
  SplashColorMode mode;         // color mode
 
82
  SplashColorPtr data;          // pointer to row zero of the color data
 
83
  Guchar *alpha;                // pointer to row zero of the alpha data
 
84
                                //   (always top-down)
 
85
 
 
86
  friend class Splash;
 
87
};
 
88
 
 
89
#endif