forked from coolwanglu/pdf2htmlEX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmisc.cc
More file actions
66 lines (58 loc) · 1.25 KB
/
Copy pathmisc.cc
File metadata and controls
66 lines (58 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Misc functions
*
*
* by WangLu
* 2012.08.10
*/
#include <map>
#include "misc.h"
using std::cerr;
using std::endl;
using std::string;
using std::map;
using std::ostream;
namespace pdf2htmlEX {
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;
}
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;
}
} // namespace pdf2htmlEX