From 915013de65572c846607f0f2429afe944faf21f8 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Sun, 16 Sep 2012 20:47:42 +0800 Subject: [PATCH] border styles --- src/HTMLRenderer/general.cc | 66 +++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/src/HTMLRenderer/general.cc b/src/HTMLRenderer/general.cc index 5ea6476..6e5963a 100644 --- a/src/HTMLRenderer/general.cc +++ b/src/HTMLRenderer/general.cc @@ -420,12 +420,72 @@ void HTMLRenderer::draw_annot_link (AnnotLink * al) x2 = default_ctm[0] * x2 + default_ctm[2] * y2 + default_ctm[4]; y2 = default_ctm[1] * x2 + default_ctm[3] * y2 + default_ctm[5]; - html_fout << "
"; + << "height:" << (y2-y1) << "px;"; + + auto * border = al->getBorder(); + if(border) + { + double w = border->getWidth(); + if(w > 0) + { + html_fout << "border-width:" << _round(w) << "px;"; + auto style = border->getStyle(); + switch(style) + { + case AnnotBorder::borderSolid: + html_fout << "border-style:solid;"; + break; + case AnnotBorder::borderDashed: + html_fout << "border-style:dashed;"; + break; + case AnnotBorder::borderBeveled: + html_fout << "border-style:outset;"; + break; + case AnnotBorder::borderInset: + html_fout << "border-style:inset;"; + break; + case AnnotBorder::borderUnderlined: + html_fout << "border-style:none;border-bottom-style:solid;"; + break; + default: + cerr << "Warning:Unknown annotation border style: " << style << endl; + html_fout << "border-style:solid;"; + } + + + auto color = al->getColor(); + double r,g,b; + if(color && (color->getSpace() == AnnotColor::colorRGB)) + { + const double * v = color->getValues(); + r = v[0]; + g = v[1]; + b = v[2]; + } + else + { + r = g = b = 0; + } + + html_fout << "border-color:rgb(" + << dec << (int)dblToByte(r) << "," << (int)dblToByte(g) << "," << (int)dblToByte(b) << hex + << ");"; + } + else + { + html_fout << "border-style:none;"; + } + } + else + { + html_fout << "border-style:none;"; + } + + html_fout << "\">"; if(dest_str != "") {