summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf-src/xpdf/ShadingImage.h
blob: 3bbff6922a44f430db3b77e7592a27f01dcabaa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//========================================================================
//
// ShadingImage.h
//
// Convert shading patterns to bitmaps.
//
// Copyright 2020 Glyph & Cog, LLC
//
//========================================================================

#ifndef SHADINGIMAGE_H
#define SHADINGIMAGE_H

#include <aconf.h>

#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif

#include "SplashTypes.h"

class GfxState;
class GfxShading;
class SplashBitmap;
class Splash;

class ShadingImage {
public:

  // Generate a [mode] bitmap for [shading], using the clipping and
  // CTM info from [state].  Returns the bitmap and sets [xOut],[yOut]
  // to the upper-left corner of the region in device space.  Returns
  // NULL if the clip region is empty.
  static SplashBitmap *generateBitmap(GfxState *state, GfxShading *shading,
				      SplashColorMode mode,
				      GBool reverseVideo,
				      Splash *parentSplash,
				      SplashBitmap *parentBitmap,
				      int *xOut, int *yOut);


private:

  static SplashBitmap *generateFunctionBitmap(GfxState *state,
					      GfxFunctionShading *shading,
					      SplashColorMode mode,
					      GBool reverseVideo,
					      Splash *parentSplash,
					      SplashBitmap *parentBitmap,
					      int *xOut, int *yOut);
  static SplashBitmap *generateAxialBitmap(GfxState *state,
					   GfxAxialShading *shading,
					   SplashColorMode mode,
					   GBool reverseVideo,
					   Splash *parentSplash,
					   SplashBitmap *parentBitmap,
					   int *xOut, int *yOut);
  static SplashBitmap *generateRadialBitmap(GfxState *state,
					    GfxRadialShading *shading,
					    SplashColorMode mode,
					    GBool reverseVideo,
					    Splash *parentSplash,
					    SplashBitmap *parentBitmap,
					    int *xOut, int *yOut);
  static SplashBitmap *generateGouraudTriangleBitmap(
					GfxState *state,
					GfxGouraudTriangleShading *shading,
					SplashColorMode mode,
					GBool reverseVideo,
					Splash *parentSplash,
					SplashBitmap *parentBitmap,
					int *xOut, int *yOut);
  static void gouraudFillTriangle(GfxState *state, SplashBitmap *bitmap,
				  SplashColorMode mode,
				  GBool reverseVideo,
				  int xMin, int yMin, int xMax, int yMax,
				  double x0, double y0, double *color0,
				  double x1, double y1, double *color1,
				  double x2, double y2, double *color2,
				  GfxGouraudTriangleShading *shading);
  static SplashBitmap *generatePatchMeshBitmap(GfxState *state,
					       GfxPatchMeshShading *shading,
					       SplashColorMode mode,
					       GBool reverseVideo,
					       Splash *parentSplash,
					       SplashBitmap *parentBitmap,
					       int *xOut, int *yOut);
  static void fillPatch(GfxState *state, Splash *splash,
			SplashColorMode mode, GBool reverseVideo,
			int xMin, int yMin,
			GfxPatch *patch,
			GfxPatchMeshShading *shading,
			int depth);
  static void computeShadingColor(GfxState *state,
				  SplashColorMode mode,
				  GBool reverseVideo,
				  GfxColor *color,
				  SplashColorPtr sColor);
  static void transformBBox(GfxState *state,
			    double uxMin, double uyMin,
			    double uxMax, double uyMax,
			    double *dxMin, double *dyMin,
			    double *dxMax, double *dyMax);
};

#endif