From 104e290f32609d4ced29fb2ff12686e2cbcb6439 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 31 Oct 2007 13:29:03 +0000 Subject: r16914@shi: ted | 2007-10-30 21:58:05 -0700 Switching everything over to a linked in libwpg (bzr r3992) --- src/extension/internal/libwpg/WPGSVGGenerator.cpp | 256 ---------------------- 1 file changed, 256 deletions(-) delete mode 100644 src/extension/internal/libwpg/WPGSVGGenerator.cpp (limited to 'src/extension/internal/libwpg/WPGSVGGenerator.cpp') diff --git a/src/extension/internal/libwpg/WPGSVGGenerator.cpp b/src/extension/internal/libwpg/WPGSVGGenerator.cpp deleted file mode 100644 index aa7272a7a..000000000 --- a/src/extension/internal/libwpg/WPGSVGGenerator.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/* libwpg - * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) - * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For further information visit http://libwpg.sourceforge.net - */ - -/* "This product is not manufactured, approved, or supported by - * Corel Corporation or Corel Corporation Limited." - */ - -#include "WPGSVGGenerator.h" - -libwpg::WPGSVGGenerator::WPGSVGGenerator(std::ostream & output_sink): m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()), m_fillRule(AlternatingFill), m_gradientIndex(1), m_outputSink(output_sink), m_oldLocale(output_sink.getloc()) -{ - // set the stream's locale to "C" when printing floats - std::locale c_locale("C"); - m_outputSink.imbue(c_locale); -} - -libwpg::WPGSVGGenerator::~WPGSVGGenerator() -{ - m_outputSink.imbue(m_oldLocale); -} - -void libwpg::WPGSVGGenerator::startDocument(double width, double height) -{ - m_outputSink << "\n"; - m_outputSink << "\n"; - - // m_outputSink << "\n"; - - m_outputSink << "\n"; - - m_gradientIndex = 1; -} - -void libwpg::WPGSVGGenerator::endDocument() -{ - m_outputSink << "\n"; -} - -void libwpg::WPGSVGGenerator::setPen(const libwpg::WPGPen& pen) -{ - m_pen = pen; -} - -void libwpg::WPGSVGGenerator::setBrush(const libwpg::WPGBrush& brush) -{ - m_brush = brush; - - if(m_brush.style == libwpg::WPGBrush::Gradient) - { - double angle = m_brush.gradient.angle(); - - m_outputSink << "\n"; - m_outputSink << " \n"; - for(unsigned c = 0; c < m_brush.gradient.count(); c++) - { - // round to nearest percentage - int ofs = (int)((100.0*m_brush.gradient.stopOffset(c))+0.5); - - libwpg::WPGColor color = m_brush.gradient.stopColor(c); - - m_outputSink << " \n"; - - // reset stream formatting - m_outputSink << std::dec; - m_outputSink.width(old_stream_size); - } - m_outputSink << " \n"; - - // not a simple horizontal gradient - if(angle != -90.0) - { - m_outputSink << " \n"; - m_outputSink << " \n"; - } - - m_outputSink << "\n"; - } -} - -void libwpg::WPGSVGGenerator::setFillRule(FillRule rule) -{ - m_fillRule = rule; -} - -void libwpg::WPGSVGGenerator::startLayer(unsigned int id) -{ - m_outputSink << "\n"; -} - -void libwpg::WPGSVGGenerator::endLayer(unsigned int) -{ - m_outputSink << "\n"; -} - -void libwpg::WPGSVGGenerator::drawRectangle(const libwpg::WPGRect& rect, double rx, double ry) -{ - m_outputSink << "\n"; -} - -void libwpg::WPGSVGGenerator::drawEllipse(const libwpg::WPGPoint& center, double rx, double ry) -{ - m_outputSink << "\n"; -} - -void libwpg::WPGSVGGenerator::drawPolygon(const libwpg::WPGPointArray& vertices) -{ - if(vertices.count() < 2) - return; - - if(vertices.count() == 2) - { - const libwpg::WPGPoint& p1 = vertices[0]; - const libwpg::WPGPoint& p2 = vertices[1]; - m_outputSink << "\n"; - } - else - { - m_outputSink << "\n"; - } -} - -void libwpg::WPGSVGGenerator::drawPath(const libwpg::WPGPath& path) -{ - m_outputSink << "\n"; -} - -// create "style" attribute based on current pen and brush -void libwpg::WPGSVGGenerator::writeStyle() -{ - m_outputSink << "style=\""; - - const libwpg::WPGColor& color = m_pen.foreColor; - m_outputSink << "stroke-width: " << 72*m_pen.width << "; "; - if(m_pen.width > 0.0) - { - m_outputSink << "stroke: rgb(" << color.red << "," << color.green << "," << color.blue << "); "; - if(color.alpha != 0) - // alpha = 0 means opacity = 1.0, alpha = 256 means opacity = 0 - m_outputSink << "stroke-opacity: " << 1.0-(color.alpha/256.0) << "; "; - } - - if(!m_pen.solid) - { - m_outputSink << "stroke-dasharray: "; - for(unsigned i = 0; i < m_pen.dashArray.count(); i++) - { - m_outputSink << 72*m_pen.dashArray.at(i)*m_pen.width; - if(i < m_pen.dashArray.count()-1) - m_outputSink << ", "; - } - m_outputSink << "; "; - } - - if(m_brush.style == libwpg::WPGBrush::NoBrush) - m_outputSink << "fill: none; "; - - if(m_fillRule == WPGSVGGenerator::WindingFill) - m_outputSink << "fill-rule: nonzero; "; - else if(m_fillRule == WPGSVGGenerator::AlternatingFill) - m_outputSink << "fill-rule: evenodd; "; - - if(m_brush.style == libwpg::WPGBrush::Gradient) - m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; - - if(m_brush.style == libwpg::WPGBrush::Solid) - m_outputSink << "fill: rgb(" << m_brush.foreColor.red << "," << m_brush.foreColor.green << "," << m_brush.foreColor.blue << "); "; - - m_outputSink << "\""; // style -} -- cgit v1.2.3