Project

General

Profile

Feature #6802 » 0001-Revert-WPdfImage.C-to-version-w-o-transparency.patch

Bruce Toll, 12/11/2018 11:08 PM

View differences:

src/Wt/WPdfImage.C
HPDF_Page_Concat(page_, 1, 0, 0, 1, x_, y_);
HPDF_Page_GSave(page_); // for painter->combinedTransform()
}
void WPdfImage::done()
......
void WPdfImage::setChanged(WFlags<PainterChangeFlag> flags)
{
if (!flags.empty()) {
if (!(flags & (PainterChangeFlag::Transform | PainterChangeFlag::Clipping)).empty()) {
HPDF_Page_GRestore(page_);
HPDF_Page_GSave(page_);
HPDF_ExtGState gstate;
gstate = HPDF_CreateExtGState (pdf_);
currentFont_ = WFont();
HPDF_Page_GSave(page_);
if (painter()->hasClipping()) {
const WTransform& t = painter()->clipPathTransform();
if (!painter()->clipPath().isEmpty()) {
applyTransform(t);
applyTransform(t);
drawPlainPath(painter()->clipPath());
HPDF_Page_Clip(page_);
HPDF_Page_EndPath(page_);
drawPlainPath(painter()->clipPath());
HPDF_Page_Clip(page_);
HPDF_Page_EndPath(page_);
applyTransform(t.inverted());
}
applyTransform(t.inverted());
}
applyTransform(painter()->combinedTransform());
flags = PainterChangeFlag::Pen |
PainterChangeFlag::Brush |
PainterChangeFlag::Font;
}
if (flags.test(PainterChangeFlag::Pen)) {
const WPen& pen = painter()->pen();
if (pen.style() != PenStyle::None) {
const WColor& color = pen.color();
HPDF_Page_SetRGBStroke(page_,
color.red() / 255.,
color.green() / 255.,
color.blue() / 255.);
HPDF_ExtGState_SetAlphaStroke (gstate, color.alpha()/255.);
color.red() / 255.,
color.green() / 255.,
color.blue() / 255.);
WLength w = painter()->normalizedPenWidth(pen.width(), false);
HPDF_Page_SetLineWidth(page_, w.toPixels());
......
}
}
}
}
if (flags.test(PainterChangeFlag::Brush)) {
const WBrush& brush = painter()->brush();
if (brush.style() != BrushStyle::None) {
const WColor& color = painter()->brush().color();
HPDF_Page_SetRGBFill(page_,
color.red() / 255.,
color.green() / 255.,
color.blue() / 255.);
HPDF_ExtGState_SetAlphaFill (gstate, color.alpha()/255.);
color.red() / 255.,
color.green() / 255.,
color.blue() / 255.);
}
}
HPDF_Page_SetExtGState (page_, gstate);
if (flags.test(PainterChangeFlag::Font)) {
const WFont& font = painter()->font();
if (font == currentFont_ && !trueTypeFonts_->busy())
......
void WPdfImage::drawPath(const WPainterPath& path)
{
if (path.isEmpty())
return;
drawPlainPath(path);
paintPath();
......
void WPdfImage::drawPlainPath(const WPainterPath& path)
{
if (path.isEmpty())
return;
const std::vector<WPainterPath::Segment>& segments = path.segments();
if (segments.size() > 0
(1-1/8)