~ubuntu-branches/ubuntu/lucid/swftools/lucid

« back to all changes in this revision

Viewing changes to lib/pdf/xpdf/SplashClip.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2009-04-30 05:22:19 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090430052219-l1n64qofzeq5pej8
Tags: 0.9.0-0ubuntu1
* New upstream release (LP: #369931)
  - patches/01_manpages: edited to match updated version of src/pdf2swf.1 and
    src/wav2swf.1
  - patches/02_faq: edited to match updated version of FAQ
  - patches/04_makefile: edited to delete the patch on lib/Makefile.in and 
    src/Makefile.in (applied upstream)
  - deleted patch 99_configure_for_python2.5_and_2.6 (applied upstream)
  - debian/swftools.doc: deleted installation of TODO and 
    pdf2swf/HOWTO_pdf2swf as they don't exist anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//========================================================================
 
2
//
 
3
// SplashClip.h
 
4
//
 
5
//========================================================================
 
6
 
 
7
#ifndef SPLASHCLIP_H
 
8
#define SPLASHCLIP_H
 
9
 
 
10
#include <aconf.h>
 
11
 
 
12
#ifdef USE_GCC_PRAGMAS
 
13
#pragma interface
 
14
#endif
 
15
 
 
16
#include "SplashTypes.h"
 
17
#include "SplashMath.h"
 
18
 
 
19
class SplashPath;
 
20
class SplashXPath;
 
21
class SplashXPathScanner;
 
22
class SplashBitmap;
 
23
 
 
24
//------------------------------------------------------------------------
 
25
 
 
26
enum SplashClipResult {
 
27
  splashClipAllInside,
 
28
  splashClipAllOutside,
 
29
  splashClipPartial
 
30
};
 
31
 
 
32
//------------------------------------------------------------------------
 
33
// SplashClip
 
34
//------------------------------------------------------------------------
 
35
 
 
36
class SplashClip {
 
37
public:
 
38
 
 
39
  // Create a clip, for the given rectangle.
 
40
  SplashClip(SplashCoord x0, SplashCoord y0,
 
41
             SplashCoord x1, SplashCoord y1,
 
42
             GBool antialiasA);
 
43
 
 
44
  // Copy a clip.
 
45
  SplashClip *copy() { return new SplashClip(this); }
 
46
 
 
47
  ~SplashClip();
 
48
 
 
49
  // Reset the clip to a rectangle.
 
50
  void resetToRect(SplashCoord x0, SplashCoord y0,
 
51
                   SplashCoord x1, SplashCoord y1);
 
52
 
 
53
  // Intersect the clip with a rectangle.
 
54
  SplashError clipToRect(SplashCoord x0, SplashCoord y0,
 
55
                         SplashCoord x1, SplashCoord y1);
 
56
 
 
57
  // Interesect the clip with <path>.
 
58
  SplashError clipToPath(SplashPath *path, SplashCoord *matrix,
 
59
                         SplashCoord flatness, GBool eo);
 
60
 
 
61
  // Returns true if (<x>,<y>) is inside the clip.
 
62
  GBool test(int x, int y);
 
63
 
 
64
  // Tests a rectangle against the clipping region.  Returns one of:
 
65
  //   - splashClipAllInside if the entire rectangle is inside the
 
66
  //     clipping region, i.e., all pixels in the rectangle are
 
67
  //     visible
 
68
  //   - splashClipAllOutside if the entire rectangle is outside the
 
69
  //     clipping region, i.e., all the pixels in the rectangle are
 
70
  //     clipped
 
71
  //   - splashClipPartial if the rectangle is part inside and part
 
72
  //     outside the clipping region
 
73
  SplashClipResult testRect(int rectXMin, int rectYMin,
 
74
                            int rectXMax, int rectYMax);
 
75
 
 
76
  // Similar to testRect, but tests a horizontal span.
 
77
  SplashClipResult testSpan(int spanXMin, int spanXMax, int spanY);
 
78
 
 
79
  // Clips an anti-aliased line by setting pixels to zero.  On entry,
 
80
  // all non-zero pixels are between <x0> and <x1>.  This function
 
81
  // will update <x0> and <x1>.
 
82
  void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y);
 
83
 
 
84
  // Get the rectangle part of the clip region, in integer coordinates.
 
85
  int getXMinI() { return xMinI; }
 
86
  int getXMaxI() { return xMaxI; }
 
87
  int getYMinI() { return yMinI; }
 
88
  int getYMaxI() { return yMaxI; }
 
89
 
 
90
  // Get the number of arbitrary paths used by the clip region.
 
91
  int getNumPaths() { return length; }
 
92
 
 
93
private:
 
94
 
 
95
  SplashClip(SplashClip *clip);
 
96
  void grow(int nPaths);
 
97
 
 
98
  GBool antialias;
 
99
  SplashCoord xMin, yMin, xMax, yMax;
 
100
  int xMinI, yMinI, xMaxI, yMaxI;
 
101
  SplashXPath **paths;
 
102
  Guchar *flags;
 
103
  SplashXPathScanner **scanners;
 
104
  int length, size;
 
105
};
 
106
 
 
107
#endif