metafile-inout.cpp revision 3b70d4b4adefa3ff65931070bee74f26bab2f6f6
/** @file
* @brief Metafile input - common routines
*//*
* Authors:
* David Mathog
*
* Copyright (C) 2013 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cstring>
#include <fstream>
#include <glib.h>
#include <glibmm/miscutils.h>
#include "sp-root.h"
#include "extension/internal/metafile-inout.h" // picks up PNG
#include "path-prefix.h"
#include "sp-gradient.h"
#include "sp-image.h"
#include "sp-linear-gradient.h"
#include "sp-pattern.h"
#include "sp-radial-gradient.h"
#include "style.h"
#include "document.h"
#include "shape-editor.h"
#include "sp-namedview.h"
#include "document-undo.h"
#include "inkscape.h"
#include "preferences.h"
namespace Inkscape {
namespace Extension {
namespace Internal {
{
return;
}
/** Construct a PNG in memory from an RGB from the EMF file
from:
which was based on:
gcc -Wall -o testpng testpng.c -lpng
Originally here, but moved up
#include <png.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
*/
/* Given "bitmap", this returns the pixel of bitmap at the point
("x", "y"). */
{
}
/* Write "bitmap" to a PNG file specified by "path"; returns 0 on
success, non-zero on error. */
void
{
/* allocate or grow buffer */
/* copy new bytes to end of buffer */
}
size_t x, y;
/* The following number is set by trial and error only. I cannot
see where it it is documented in the libpng manual.
*/
int pixel_size = 3;
int depth = 8;
return;
}
return;
}
/* Set up error handling. */
return;
}
/* Set image attributes. */
);
/* Initialize rows of PNG. */
}
}
/* Write the image data to memory */
}
}
/* convert an EMF RGB(A) color to 0RGB
inverse of gethexcolor() in emf-print.cpp
*/
(U_RGBAGetB(color) );
return(out);
}
/* Return the base64 encoded png which is shown for all bad images.
Currently a random 3x4 blotch.
Caller must free.
*/
gchar *gstring = g_strdup("iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAIAAAA7ljmRAAAAA3NCSVQICAjb4U/gAAAALElEQVQImQXBQQ2AMAAAsUJQMSWI2H8qME1yMshojwrvGB8XcHKvR1XtOTc/8HENumHCsOMAAAAASUVORK5CYII=");
return(gstring);
}
/* If the viewBox is missing, set one
*/
doc->ensureUpToDate();
// Set document unit
// Set viewBox
doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc_unit), doc->getHeight().value(doc_unit)));
doc->ensureUpToDate();
// Scale and translate objects
ShapeEditor::blockSetItem(true);
double dh;
if(SP_ACTIVE_DOCUMENT){ // for file menu open or import, or paste from clipboard
}
else { // for open via --file on command line
}
// These should not affect input, but they do, so set them to a neutral state
ShapeEditor::blockSetItem(false);
// restore options
}
}
} // namespace Internal
} // namespace Extension
} // namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :