pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h

66 lines
1.8 KiB
C
Raw Normal View History

2012-10-02 12:41:39 +00:00
/*
* Splash Background renderer
* Render all those things not supported as Image, with Splash
*
2013-09-18 10:01:56 +00:00
* Copyright (C) 2012,2013 Lu Wang <coolwanglu@gmail.com>
2012-10-02 12:41:39 +00:00
*/
2012-10-02 12:56:40 +00:00
#ifndef SPLASH_BACKGROUND_RENDERER_H__
#define SPLASH_BACKGROUND_RENDERER_H__
2012-10-02 12:41:39 +00:00
2012-10-02 13:11:00 +00:00
#include <string>
2012-10-02 12:41:39 +00:00
#include <splash/SplashBitmap.h>
#include <SplashOutputDev.h>
2013-09-16 12:39:53 +00:00
#include "pdf2htmlEX-config.h"
2012-10-02 13:11:00 +00:00
#include "Param.h"
2012-11-29 09:28:05 +00:00
#include "HTMLRenderer/HTMLRenderer.h"
2012-10-02 13:11:00 +00:00
2012-10-02 12:41:39 +00:00
namespace pdf2htmlEX {
// Based on BackgroundRenderer from poppler
2013-09-18 10:01:56 +00:00
class SplashBackgroundRenderer : public BackgroundRenderer, SplashOutputDev
2012-10-02 12:41:39 +00:00
{
public:
2012-10-02 12:56:40 +00:00
static const SplashColor white;
//format: "png" or "jpg", or "" for a default format
SplashBackgroundRenderer(const std::string & format, HTMLRenderer * html_renderer, const Param & param);
2012-10-02 12:56:40 +00:00
virtual ~SplashBackgroundRenderer() { }
2013-09-16 08:30:00 +00:00
2013-09-18 10:01:56 +00:00
virtual void init(PDFDoc * doc);
virtual bool render_page(PDFDoc * doc, int pageno);
2013-09-18 10:01:56 +00:00
virtual void embed_image(int pageno);
2013-09-18 21:56:57 +00:00
// Does this device use beginType3Char/endType3Char? Otherwise,
// text in Type 3 fonts will be drawn with drawChar/drawString.
virtual GBool interpretType3Chars() { return !param.process_type3; }
2013-09-16 08:30:00 +00:00
virtual void startPage(int pageNum, GfxState *state, XRef *xrefA);
2012-10-02 12:41:39 +00:00
virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen);
2012-10-02 13:11:00 +00:00
2014-06-26 13:28:32 +00:00
//for proof
void beginTextObject(GfxState *state);
2014-06-26 13:28:32 +00:00
void beginString(GfxState *state, GooString * str);
void endTextObject(GfxState *state);
void updateRender(GfxState *state);
2014-06-26 13:28:32 +00:00
2012-10-02 13:11:00 +00:00
protected:
2013-09-18 10:01:56 +00:00
void dump_image(const char * filename, int x1, int y1, int x2, int y2);
2012-10-03 14:46:27 +00:00
HTMLRenderer * html_renderer;
2013-04-06 09:01:05 +00:00
const Param & param;
std::string format;
int drawn_char_count;
2012-10-02 12:41:39 +00:00
};
2012-10-02 12:56:40 +00:00
} // namespace pdf2htmlEX
2012-10-02 12:41:39 +00:00
2012-10-02 12:56:40 +00:00
#endif // SPLASH_BACKGROUND_RENDERER_H__