1 //========================================================================
5 // Copyright 2003 Glyph & Cog, LLC
7 //========================================================================
9 #ifndef XSPLASHOUTPUTDEV_H
10 #define XSPLASHOUTPUTDEV_H
12 #ifdef USE_GCC_PRAGMAS
17 #include "SplashTypes.h"
18 #include "SplashOutputDev.h"
20 //------------------------------------------------------------------------
22 #define xOutMaxRGBCube 6 // max size of RGB color cube
24 //------------------------------------------------------------------------
26 //------------------------------------------------------------------------
28 class XSplashOutputDev: public SplashOutputDev {
31 XSplashOutputDev(Display *displayA, int screenNumA,
32 Visual *visualA, Colormap colormapA,
33 GBool reverseVideoA, SplashColor paperColorA,
34 GBool installCmapA, int rgbCubeSizeA,
35 GBool incrementalUpdateA,
36 void (*redrawCbkA)(void *data),
37 void *redrawCbkDataA);
39 virtual ~XSplashOutputDev();
41 //----- initialization and control
44 virtual void startPage(int pageNum, GfxState *state);
47 virtual void endPage();
49 // Dump page contents to display.
52 //----- update text state
53 virtual void updateFont(GfxState *state);
56 virtual void drawChar(GfxState *state, double x, double y,
58 double originX, double originY,
59 CharCode code, Unicode *u, int uLen);
60 virtual GBool beginType3Char(GfxState *state, double x, double y,
62 CharCode code, Unicode *u, int uLen);
64 //----- special access
66 // Clear out the document (used when displaying an empty window).
69 // Copy the rectangle (srcX, srcY, width, height) to (destX, destY)
71 void redraw(int srcX, int srcY,
72 Drawable destDrawable, GC destGC,
74 int width, int height);
76 // Find a string. If <startAtTop> is true, starts looking at the
77 // top of the page; else if <startAtLast> is true, starts looking
78 // immediately after the last find result; else starts looking at
79 // <xMin>,<yMin>. If <stopAtBottom> is true, stops looking at the
80 // bottom of the page; else if <stopAtLast> is true, stops looking
81 // just before the last find result; else stops looking at
83 GBool findText(Unicode *s, int len,
84 GBool startAtTop, GBool stopAtBottom,
85 GBool startAtLast, GBool stopAtLast,
87 int *xMax, int *yMax);
89 // Get the text which is inside the specified rectangle.
90 GString *getText(int xMin, int yMin, int xMax, int yMax);
94 GBool incrementalUpdate; // incrementally update the display?
95 void (*redrawCbk)(void *data);
97 TextPage *text; // text from the current page
99 Display *display; // X display pointer
100 Visual *visual; // X visual
101 Guint depth; // visual depth
102 GBool trueColor; // set if using a TrueColor visual
103 int rDiv, gDiv, bDiv; // RGB right shifts (for TrueColor)
104 int rShift, gShift, bShift; // RGB left shifts (for TrueColor)
105 int rgbCubeSize; // size of color cube (for non-TrueColor)
106 Gulong // color cube (for non-TrueColor)
107 colors[xOutMaxRGBCube * xOutMaxRGBCube * xOutMaxRGBCube];