1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-09-19 13:50:06 +00:00
pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h

62 lines
1.4 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
*
* by WangLu
* 2012.08.06
*/
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>
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
class SplashBackgroundRenderer : public SplashOutputDev
{
public:
2012-10-02 12:56:40 +00:00
static const SplashColor white;
2012-10-03 14:46:27 +00:00
SplashBackgroundRenderer(HTMLRenderer * html_renderer, const Param * param)
2012-10-02 12:56:40 +00:00
: SplashOutputDev(splashModeRGB8, 4, gFalse, (SplashColorPtr)&white, gTrue, gTrue)
2012-10-03 14:46:27 +00:00
, html_renderer(html_renderer)
2012-10-02 13:11:00 +00:00
, param(param)
2012-10-02 12:56:40 +00:00
{ }
virtual ~SplashBackgroundRenderer() { }
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
2012-10-03 14:46:27 +00:00
virtual void stroke(GfxState *state) {
if(!html_renderer->can_stroke(state))
SplashOutputDev::stroke(state);
}
virtual void fill(GfxState *state) {
if(!html_renderer->can_fill(state))
SplashOutputDev::fill(state);
}
2012-10-02 13:11:00 +00:00
void render_page(PDFDoc * doc, int pageno, const std::string & filename);
protected:
2012-10-03 14:46:27 +00:00
HTMLRenderer * html_renderer;
2012-10-02 13:11:00 +00:00
const Param * param;
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__