2012-09-09 17:18:09 +00:00
|
|
|
/*
|
|
|
|
* Misc functions
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* by WangLu
|
|
|
|
* 2012.08.10
|
|
|
|
*/
|
|
|
|
|
2012-09-10 17:53:33 +00:00
|
|
|
#include <errno.h>
|
2012-09-13 03:38:56 +00:00
|
|
|
#include <cctype>
|
2012-09-10 17:53:33 +00:00
|
|
|
|
2012-09-09 17:18:09 +00:00
|
|
|
#include <GfxState.h>
|
|
|
|
#include <GfxFont.h>
|
|
|
|
#include <CharTypes.h>
|
|
|
|
#include <GlobalParams.h>
|
|
|
|
#include <Object.h>
|
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
using std::cerr;
|
|
|
|
using std::endl;
|
|
|
|
using std::string;
|
2012-09-10 05:03:25 +00:00
|
|
|
using std::map;
|
2012-09-10 17:53:33 +00:00
|
|
|
using std::ostream;
|
2012-09-10 05:03:25 +00:00
|
|
|
|
2012-09-11 13:52:46 +00:00
|
|
|
namespace pdf2htmlEX {
|
|
|
|
|
2012-10-01 17:59:04 +00:00
|
|
|
void css_fix_rectangle_border_width(double x1, double y1,
|
|
|
|
double x2, double y2,
|
|
|
|
double border_width,
|
|
|
|
double & x, double & y, double & w, double & h,
|
|
|
|
double & border_top_bottom_width,
|
|
|
|
double & border_left_right_width)
|
|
|
|
{
|
|
|
|
w = x2 - x1;
|
|
|
|
if(w > border_width)
|
|
|
|
{
|
|
|
|
w -= border_width;
|
|
|
|
border_left_right_width = border_width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
border_left_right_width = border_width + w/2;
|
|
|
|
w = 0;
|
|
|
|
}
|
|
|
|
x = x1 - border_width / 2;
|
|
|
|
|
|
|
|
h = y2 - y1;
|
|
|
|
if(h > border_width)
|
|
|
|
{
|
|
|
|
h -= border_width;
|
|
|
|
border_top_bottom_width = border_width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
border_top_bottom_width = border_width + h/2;
|
|
|
|
h = 0;
|
|
|
|
}
|
|
|
|
y = y1 - border_width / 2;
|
|
|
|
}
|
|
|
|
|
2012-10-01 20:06:38 +00:00
|
|
|
ostream & operator << (ostream & out, const GfxRGB & rgb)
|
|
|
|
{
|
|
|
|
auto flags= out.flags();
|
|
|
|
out << std::dec << "rgb("
|
|
|
|
<< (int)colToByte(rgb.r) << ","
|
|
|
|
<< (int)colToByte(rgb.g) << ","
|
|
|
|
<< (int)colToByte(rgb.b) << ")";
|
|
|
|
out.flags(flags);
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2012-09-11 13:52:46 +00:00
|
|
|
} // namespace pdf2htmlEX
|