1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-03 08:38:39 +00:00

integrating cairo outputdev

This commit is contained in:
Lu Wang 2012-10-02 20:41:39 +08:00
parent 2b06319207
commit a9790d68b3
4 changed files with 89 additions and 1 deletions

View File

@ -20,6 +20,16 @@ include_directories(${POPPLER_INCLUDE_DIRS})
link_directories(${POPPLER_LIBRARY_DIRS})
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${POPPLER_LIBRARIES})
find_path(CAIRO_OUTPUTDEV_INCLUDE_PATH CairoOutputDev.h PATHS
${POPPLER_INCLUDE_DIRS} NO_DEFAULT_PATH)
if(CAIRO_OUTPUTDEV_INCLUDE_PATH)
message("Found CairoOutputDev.h: ${POPPLER_INCLUDE_DIRS}/CairoOutputDev.h")
set(HAVE_CAIRO 1)
else()
set(HAVE_CAIRO 0)
endif()
# fontforge starts using pkg-config 'correctly' since 2.0.0
pkg_check_modules(FONTFORGE libfontforge>=2.0.0)
if(FONTFORGE_FOUND)
@ -134,7 +144,10 @@ add_executable(pdf2htmlEX
src/include/ffw.h
src/ffw.c
src/include/BackgroundRenderer.h
src/BackgroundRenderer.cc
src/include/SplashBackgroundRenderer.h
src/SplashBackgroundRenderer.cc
src/include/CairoBackgroundRenderer.h
src/CairoBackgroundRenderer.cc
src/include/Preprocessor.h
src/Preprocessor.cc
src/include/util.h

View File

@ -0,0 +1,37 @@
/*
* Splash Background renderer
* Render all those things not supported as Image, with Splash
*
* Copyright (C) 2012 Lu Wang <coolwanglu@gmail.com>
*/
#ifndef SPLASH_BACKGROUND_RENDERER_H__
#define SPLASH_BACKGROUND_RENDERER_H__
#include <splash/SplashBitmap.h>
#include <SplashOutputDev.h>
namespace pdf2htmlEX {
// Based on BackgroundRenderer from poppler
class SplashBackgroundRenderer : public SplashOutputDev
{
public:
static const SplashColor white;
SplashBackgroundRenderer()
:SplashOutputDev(splashModeRGB8, 4, gFalse, (SplashColorPtr)&white, gTrue, gTrue)
{ }
virtual ~SplashBackgroundRenderer() { }
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);
};
}
#endif //SPLASH_BACKGROUND_RENDERER_H__

View File

@ -0,0 +1,38 @@
/*
* Splash Background renderer
* Render all those things not supported as Image, with Splash
*
* by WangLu
* 2012.08.06
*/
#ifndef BACKGROUND_RENDERER_H__
#define BACKGROUND_RENDERER_H__
#include <splash/SplashBitmap.h>
#include <SplashOutputDev.h>
namespace pdf2htmlEX {
// Based on BackgroundRenderer from poppler
class SplashBackgroundRenderer : public SplashOutputDev
{
public:
SplashBackgroundRenderer()
{
SplashColor color;
color[0] = color[1] = color[2] = 255;
SplashOutputDev(splashModeRGB8, 4, gFlase, color, gTrue, gTrue)`
}
virtual ~BackgroundRenderer() { }
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);
};
}
#endif //BACKGROUND_RENDERER_H__