19#include <magickexport.h>
20#include <kgenericfactory.h>
21#include <KoDocument.h>
22#include <KoFilterChain.h>
25#include <kis_paint_layer.h>
27#include <kis_annotation.h>
29#include <kis_image_magick_converter.h>
31typedef KGenericFactory<MagickExport, KoFilter> MagickExportFactory;
32K_EXPORT_COMPONENT_FACTORY(libchalkmagickexport, MagickExportFactory( "kofficefilters"))
34MagickExport::MagickExport(KoFilter *, const char *, const TQStringList&) : KoFilter()
38MagickExport::~MagickExport()
42KoFilter::ConversionStatus MagickExport::convert( const TQCString& from, const TQCString& to)
44 kdDebug(41008) << "magick export! From: " << from << ", To: " << to << "\n";
46 if (from != "application/x-chalk")
47 return KoFilter::NotImplemented;
51 KisDoc *output = dynamic_cast<KisDoc* >(m_chain->inputDocument());
52 TQString filename = m_chain->outputFile();
55 return KoFilter::CreationError;
57 if (filename.isEmpty()) return KoFilter::FileNotFound;
60 url.setPath(filename);
62 KisImageSP img = output->currentImage();
66 KisPaintDeviceSP pd = new KisPaintDevice(*img->projection());
67 KisPaintLayerSP l = new KisPaintLayer(img, "projection", OPACITY_OPAQUE, pd);
69 vKisAnnotationSP_it beginIt = img->beginAnnotations();
70 vKisAnnotationSP_it endIt = img->endAnnotations();
71 if (ib.buildFile(url, l, beginIt, endIt) == KisImageBuilder_RESULT_OK) {
74 return KoFilter::InternalError;
77#include <magickexport.moc>
Build a KisImage representation of an image file.
|