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;
|
|
|
|
|
2013-04-06 09:01:05 +00:00
|
|
|
SplashBackgroundRenderer(HTMLRenderer * html_renderer, const Param & param)
|
2013-09-16 08:30:00 +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() { }
|
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
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2013-09-16 08:30:00 +00:00
|
|
|
void render_page(PDFDoc * doc, int pageno);
|
|
|
|
void embed_image(int pageno);
|
2012-10-02 13:11:00 +00:00
|
|
|
|
|
|
|
protected:
|
2012-10-03 14:46:27 +00:00
|
|
|
HTMLRenderer * html_renderer;
|
2013-04-06 09:01:05 +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__
|