From d63c9d696eb6e2539528b99afc21f4086c9defe3 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 23 May 2021 20:48:35 +0900 Subject: Renaming of files in preparation for code style tools. Signed-off-by: Michele Calgaro (cherry picked from commit 8b78a8791bc539bcffe7159f9d9714d577cb3d7d) --- filters/karbon/png/Makefile.am | 2 +- filters/karbon/png/pngexport.cc | 96 ---------------------------------------- filters/karbon/png/pngexport.cpp | 96 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 97 deletions(-) delete mode 100644 filters/karbon/png/pngexport.cc create mode 100644 filters/karbon/png/pngexport.cpp (limited to 'filters/karbon/png') diff --git a/filters/karbon/png/Makefile.am b/filters/karbon/png/Makefile.am index 520531d6..e4fb6c11 100644 --- a/filters/karbon/png/Makefile.am +++ b/filters/karbon/png/Makefile.am @@ -20,7 +20,7 @@ noinst_HEADERS = \ pngexport.h libkarbonpngexport_la_SOURCES = \ - pngexport.cc + pngexport.cpp libkarbonpngexport_la_METASOURCES = \ AUTO diff --git a/filters/karbon/png/pngexport.cc b/filters/karbon/png/pngexport.cc deleted file mode 100644 index 89b43d03..00000000 --- a/filters/karbon/png/pngexport.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002, The Karbon Developers - - 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; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "pngexport.h" -#include "vdocument.h" -#include "vselection.h" -#include "vkopainter.h" -#include "vlayer.h" -#include "vcomputeboundingbox.h" - -#include - - -typedef KGenericFactory PngExportFactory; -K_EXPORT_COMPONENT_FACTORY( libkarbonpngexport, PngExportFactory( "kofficefilters" ) ) - - -PngExport::PngExport( KoFilter*, const char*, const TQStringList& ) - : KoFilter() -{ -} - -KoFilter::ConversionStatus -PngExport::convert( const TQCString& from, const TQCString& to ) -{ - if ( to != "image/png" || from != "application/x-karbon" ) - { - return KoFilter::NotImplemented; - } - - KoStoreDevice* storeIn = m_chain->storageFile( "root", KoStore::Read ); - if( !storeIn ) - return KoFilter::StupidError; - - TQDomDocument domIn; - domIn.setContent( storeIn ); - TQDomElement docNode = domIn.documentElement(); - - // load the document and export it: - VDocument doc; - doc.load( docNode ); - - // calculate the documents bounding box - VComputeBoundingBox bbox( true ); - doc.accept( bbox ); - const KoRect &rect = bbox.boundingRect(); - - // create image with correct width and height - TQImage img( int( rect.width() ), int( rect.height() ), 32 ); - //img.setAlphaBuffer( true ); - - // Create painter and set up objects to draw - VKoPainter p( img.bits(), rect.width(), rect.height() ); - p.clear( tqRgba( 0xFF, 0xFF, 0xFF, 0xFF ) ); - p.setWorldMatrix( TQWMatrix().translate( -rect.x(), -rect.y() ) ); - - doc.draw( &p, &rect ); - - TQImage image = img.swapRGB(); - TQImage mirrored = image.mirror( false, true ); - // save png - mirrored.save( m_chain->outputFile(), "PNG" ); - - return KoFilter::OK; -} - -#include "pngexport.moc" - diff --git a/filters/karbon/png/pngexport.cpp b/filters/karbon/png/pngexport.cpp new file mode 100644 index 00000000..89b43d03 --- /dev/null +++ b/filters/karbon/png/pngexport.cpp @@ -0,0 +1,96 @@ +/* This file is part of the KDE project + Copyright (C) 2002, The Karbon Developers + + 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; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "pngexport.h" +#include "vdocument.h" +#include "vselection.h" +#include "vkopainter.h" +#include "vlayer.h" +#include "vcomputeboundingbox.h" + +#include + + +typedef KGenericFactory PngExportFactory; +K_EXPORT_COMPONENT_FACTORY( libkarbonpngexport, PngExportFactory( "kofficefilters" ) ) + + +PngExport::PngExport( KoFilter*, const char*, const TQStringList& ) + : KoFilter() +{ +} + +KoFilter::ConversionStatus +PngExport::convert( const TQCString& from, const TQCString& to ) +{ + if ( to != "image/png" || from != "application/x-karbon" ) + { + return KoFilter::NotImplemented; + } + + KoStoreDevice* storeIn = m_chain->storageFile( "root", KoStore::Read ); + if( !storeIn ) + return KoFilter::StupidError; + + TQDomDocument domIn; + domIn.setContent( storeIn ); + TQDomElement docNode = domIn.documentElement(); + + // load the document and export it: + VDocument doc; + doc.load( docNode ); + + // calculate the documents bounding box + VComputeBoundingBox bbox( true ); + doc.accept( bbox ); + const KoRect &rect = bbox.boundingRect(); + + // create image with correct width and height + TQImage img( int( rect.width() ), int( rect.height() ), 32 ); + //img.setAlphaBuffer( true ); + + // Create painter and set up objects to draw + VKoPainter p( img.bits(), rect.width(), rect.height() ); + p.clear( tqRgba( 0xFF, 0xFF, 0xFF, 0xFF ) ); + p.setWorldMatrix( TQWMatrix().translate( -rect.x(), -rect.y() ) ); + + doc.draw( &p, &rect ); + + TQImage image = img.swapRGB(); + TQImage mirrored = image.mirror( false, true ); + // save png + mirrored.save( m_chain->outputFile(), "PNG" ); + + return KoFilter::OK; +} + +#include "pngexport.moc" + -- cgit v1.2.1