Inkscape
Vector Graphics Editor
Inkscape::Extension::Internal::PrintEmf Class Reference

#include <emf-print.h>

Inheritance diagram for Inkscape::Extension::Internal::PrintEmf:
Inkscape::Extension::Internal::PrintMetafile Inkscape::Extension::Implementation::Implementation

Public Member Functions

 PrintEmf ()
 
unsigned int setup (Inkscape::Extension::Print *module) override
 
unsigned int begin (Inkscape::Extension::Print *module, SPDocument *doc) override
 
unsigned int finish (Inkscape::Extension::Print *module) override
 
unsigned int fill (Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox) override
 
unsigned int stroke (Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox) override
 
unsigned int image (Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, Geom::Affine const &transform, SPStyle const *style) override
 Some parts based on win32.cpp by Lauris Kaplinski lauri.nosp@m.s@ka.nosp@m.plins.nosp@m.ki.c.nosp@m.om. More...
 
unsigned int text (Inkscape::Extension::Print *module, char const *text, Geom::Point const &p, SPStyle const *style) override
 
- Public Member Functions inherited from Inkscape::Extension::Internal::PrintMetafile
 PrintMetafile ()=default
 
 ~PrintMetafile () override
 
bool textToPath (Inkscape::Extension::Print *ext) override
 Tell the printing engine whether text should be text or path. More...
 
unsigned int bind (Inkscape::Extension::Print *module, Geom::Affine const &transform, float opacity) override
 
unsigned int release (Inkscape::Extension::Print *module) override
 
- Public Member Functions inherited from Inkscape::Extension::Implementation::Implementation
 Implementation ()=default
 
virtual ~Implementation ()=default
 
virtual bool load (Inkscape::Extension::Extension *)
 
virtual void unload (Inkscape::Extension::Extension *)
 
virtual ImplementationDocumentCachenewDocCache (Inkscape::Extension::Extension *, SPDesktop *)
 Create a new document cache object. More...
 
virtual bool check (Inkscape::Extension::Extension *)
 Verify any dependencies. More...
 
virtual bool cancelProcessing ()
 
virtual void commitDocument ()
 
virtual SPDocumentnew_from_template (Inkscape::Extension::Template *)
 
virtual void get_template_presets (const Template *tmod, TemplatePresets &presets) const
 
virtual void resize_to_template (Inkscape::Extension::Template *tmod, SPDocument *doc, SPPage *page)
 
virtual bool match_template_size (Inkscape::Extension::Template *tmod, double width, double height)
 
virtual SPDocumentopen (Inkscape::Extension::Input *, gchar const *)
 
virtual void save (Inkscape::Extension::Output *, SPDocument *, gchar const *)
 Find out information about the file. More...
 
virtual void export_raster (Inkscape::Extension::Output *, const SPDocument *, std::string const &, gchar const *)
 
virtual Gtk::Widget * prefs_effect (Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal< void()> *changeSignal, ImplementationDocumentCache *docCache)
 Find out information about the file. More...
 
virtual void effect (Inkscape::Extension::Effect *, SPDesktop *, ImplementationDocumentCache *)
 
virtual void effect (Inkscape::Extension::Effect *, SPDocument *document)
 
virtual bool apply_filter (Inkscape::Extension::Effect *module, SPItem *item)
 
virtual unsigned setup (Inkscape::Extension::Print *)
 
virtual unsigned set_preview (Inkscape::Extension::Print *)
 
virtual unsigned begin (Inkscape::Extension::Print *, SPDocument *)
 
virtual unsigned finish (Inkscape::Extension::Print *)
 
virtual bool textToPath (Inkscape::Extension::Print *)
 Tell the printing engine whether text should be text or path. More...
 
virtual bool fontEmbedded (Inkscape::Extension::Print *)
 Get "fontEmbedded" param, i.e. More...
 
virtual unsigned bind (Inkscape::Extension::Print *, Geom::Affine const &, float)
 
virtual unsigned release (Inkscape::Extension::Print *)
 
virtual unsigned fill (Inkscape::Extension::Print *, Geom::PathVector const &, Geom::Affine const &, SPStyle const *, Geom::OptRect const &, Geom::OptRect const &, Geom::OptRect const &)
 
virtual unsigned stroke (Inkscape::Extension::Print *, Geom::PathVector const &, Geom::Affine const &, SPStyle const *, Geom::OptRect const &, Geom::OptRect const &, Geom::OptRect const &)
 
virtual unsigned image (Inkscape::Extension::Print *, unsigned char *, unsigned int, unsigned int, unsigned int, Geom::Affine const &, SPStyle const *)
 
virtual unsigned text (Inkscape::Extension::Print *, char const *, Geom::Point const &, SPStyle const *)
 
virtual void processPath (Inkscape::XML::Node *)
 
virtual void setDetachBase (bool detach)
 If detach = true, when saving to a file, don't store URIs relative to the filename. More...
 

Static Public Member Functions

static void init ()
 

Protected Member Functions

void do_clip_if_present (SPStyle const *style)
 
Geom::PathVector merge_PathVector_with_group (Geom::PathVector const &combined_pathvector, SPItem const *item, const Geom::Affine &transform)
 
Geom::PathVector merge_PathVector_with_shape (Geom::PathVector const &combined_pathvector, SPItem const *item, const Geom::Affine &transform)
 
unsigned int draw_pathv_to_EMF (Geom::PathVector const &pathv, const Geom::Affine &transform)
 
Geom::Path pathv_to_simple_polygon (Geom::PathVector const &pathv, int *vertices)
 
Geom::Path pathv_to_rect (Geom::PathVector const &pathv, bool *is_rect, double *angle)
 
Geom::Point get_pathrect_corner (Geom::Path pathRect, double angle, int corner)
 
U_TRIVERTEX make_trivertex (Geom::Point Pt, U_COLORREF uc)
 
int vector_rect_alignment (double angle, Geom::Point vtest)
 
int create_brush (SPStyle const *style, PU_COLORREF fcolor) override
 
void destroy_brush () override
 
int create_pen (SPStyle const *style, const Geom::Affine &transform) override
 
void destroy_pen () override
 
- Protected Member Functions inherited from Inkscape::Extension::Internal::PrintMetafile
U_COLORREF avg_stop_color (SPGradient *gr)
 
U_COLORREF weight_opacity (U_COLORREF c1)
 
U_COLORREF weight_colors (U_COLORREF c1, U_COLORREF c2, double t)
 
void hatch_classify (char *name, int *hatchType, U_COLORREF *hatchColor, U_COLORREF *bkColor)
 
void brush_classify (SPObject *parent, int depth, Inkscape::Pixbuf const **epixbuf, int *hatchType, U_COLORREF *hatchColor, U_COLORREF *bkColor)
 
int hold_gradient (void *gr, int mode)
 
virtual int create_brush (SPStyle const *style, PU_COLORREF fcolor)=0
 
virtual void destroy_brush ()=0
 
virtual int create_pen (SPStyle const *style, const Geom::Affine &transform)=0
 
virtual void destroy_pen ()=0
 

Static Protected Member Functions

static void smuggle_adxkyrtl_out (const char *string, uint32_t **adx, double *ky, int *rtl, int *ndx, float scale)
 
- Static Protected Member Functions inherited from Inkscape::Extension::Internal::PrintMetafile
static void _lookup_ppt_fontfix (Glib::ustring const &fontname, FontfixParams &)
 
static U_COLORREF _gethexcolor (uint32_t color)
 
static uint32_t _translate_weight (unsigned inkweight)
 
static void swapRBinRGBA (char *px, int pixels)
 
static int snprintf_dots (char *s, size_t n, const char *format,...)
 
static Geom::PathVector center_ellipse_as_SVG_PathV (Geom::Point ctr, double rx, double ry, double F)
 
static Geom::PathVector center_elliptical_ring_as_SVG_PathV (Geom::Point ctr, double rx1, double ry1, double rx2, double ry2, double F)
 
static Geom::PathVector center_elliptical_hole_as_SVG_PathV (Geom::Point ctr, double rx, double ry, double F)
 
static Geom::PathVector rect_cutter (Geom::Point ctr, Geom::Point pos, Geom::Point neg, Geom::Point width)
 
static FillRule SPWR_to_LVFR (SPWindRule wr)
 

Private Member Functions

unsigned int print_pathv (Geom::PathVector const &pathv, const Geom::Affine &transform)
 
bool print_simple_shape (Geom::PathVector const &pathv, const Geom::Affine &transform)
 

Private Attributes

uint32_t hbrush
 
uint32_t hbrushOld
 
uint32_t hpen
 

Additional Inherited Members

- Protected Attributes inherited from Inkscape::Extension::Internal::PrintMetafile
double _width
 
double _height
 
double _doc_unit_scale
 
U_RECTL rc
 
uint32_t htextalignment
 
uint32_t hpolyfillmode
 
float htextcolor_rgb [3]
 
std::stack< Geom::Affinem_tr_stack
 
Geom::PathVector fill_pathv
 
Geom::Affine fill_transform
 
bool use_stroke
 
bool use_fill
 
bool simple_shape
 
bool usebk
 
GRADVALUES gv
 

Detailed Description

Definition at line 25 of file emf-print.h.

Constructor & Destructor Documentation

◆ PrintEmf()

Inkscape::Extension::Internal::PrintEmf::PrintEmf ( )

Definition at line 110 of file emf-print.cpp.

Member Function Documentation

◆ begin()

unsigned int Inkscape::Extension::Internal::PrintEmf::begin ( Inkscape::Extension::Print module,
SPDocument doc 
)
overridevirtual

Reimplemented from Inkscape::Extension::Implementation::Implementation.

Definition at line 122 of file emf-print.cpp.

References Inkscape::Extension::Internal::PrintMetafile::_doc_unit_scale, Inkscape::Extension::Internal::PrintMetafile::_gethexcolor(), Inkscape::XML::Node::attribute(), Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::bgc, Inkscape::Util::Quantity::convert(), U_SIZE::cx, U_SIZE::cy, SPItem::desktopVisualBounds(), U_XFORM::eDx, U_XFORM::eDy, Inkscape::Extension::Internal::eht, U_XFORM::eM11, U_XFORM::eM12, U_XFORM::eM21, U_XFORM::eM22, Inkscape::Extension::Internal::et, Inkscape::Extension::Internal::FixImageRot, Inkscape::Extension::Internal::FixPPTCharPos, Inkscape::Extension::Internal::FixPPTDashLine, Inkscape::Extension::Internal::FixPPTGrad2Polys, Inkscape::Extension::Internal::FixPPTLinGrad, Inkscape::Extension::Internal::FixPPTPatternAsHatch, SPDocument::getDocumentScale(), SPDocument::getReprNamedView(), SPDocument::getRoot(), Inkscape::Extension::Internal::PrintMetafile::gv, hbrush, hbrushOld, Geom::GenericRect< C >::height(), hpen, Inkscape::Extension::Internal::PrintMetafile::hpolyfillmode, Inkscape::Extension::Internal::PrintMetafile::htextalignment, Inkscape::Extension::Internal::PrintMetafile::htextcolor_rgb, MAX, Geom::mod(), SPDocument::preferredBounds(), Inkscape::Extension::Internal::PX2WORLD, Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::rgb, Inkscape::Extension::Internal::PrintMetafile::simple_shape, U_Utf16leEdit(), U_Utf8ToUtf16le(), Inkscape::Extension::Internal::PrintMetafile::use_fill, Inkscape::Extension::Internal::PrintMetafile::use_stroke, Inkscape::Extension::Internal::PrintMetafile::usebk, Inkscape::version_string, wchar16len(), Geom::GenericRect< C >::width(), and Geom::X.

◆ create_brush()

◆ create_pen()

◆ destroy_brush()

void Inkscape::Extension::Internal::PrintEmf::destroy_brush ( )
overrideprotectedvirtual

◆ destroy_pen()

void Inkscape::Extension::Internal::PrintEmf::destroy_pen ( )
overrideprotectedvirtual

◆ do_clip_if_present()

◆ draw_pathv_to_EMF()

unsigned int Inkscape::Extension::Internal::PrintEmf::draw_pathv_to_EMF ( Geom::PathVector const &  pathv,
const Geom::Affine transform 
)
protected

For all Subpaths in the <path>

For all segments in the subpath

Definition at line 1797 of file emf-print.cpp.

References Inkscape::Extension::Internal::et, is_straight_curve(), pathv_to_linear_and_cubic_beziers(), Inkscape::Extension::Internal::PX2WORLD, Geom::X, U_PAIR::x, Geom::Y, and U_PAIR::y.

Referenced by do_clip_if_present(), and print_pathv().

◆ fill()

unsigned int Inkscape::Extension::Internal::PrintEmf::fill ( Inkscape::Extension::Print module,
Geom::PathVector const &  pathv,
Geom::Affine const &  ctm,
SPStyle const *  style,
Geom::OptRect const &  pbox,
Geom::OptRect const &  dbox,
Geom::OptRect const &  bbox 
)
overridevirtual

Reimplemented from Inkscape::Extension::Implementation::Implementation.

Definition at line 1106 of file emf-print.cpp.

References Geom::detail::bezier_clipping::angle(), bool_op_inters, U_RECT::bottom, Inkscape::Extension::Internal::PrintMetafile::center_elliptical_hole_as_SVG_PathV(), Inkscape::Extension::Internal::PrintMetafile::center_elliptical_ring_as_SVG_PathV(), create_brush(), Geom::Point::cw(), destroy_pen(), Geom::distance(), do_clip_if_present(), Inkscape::Extension::Internal::DRAW_LINEAR_GRADIENT, Inkscape::Extension::Internal::DRAW_RADIAL_GRADIENT, U_XFORM::eDx, U_XFORM::eDy, U_XFORM::eM11, U_XFORM::eM12, U_XFORM::eM21, U_XFORM::eM22, Inkscape::Extension::Internal::et, fill_nonZero, fill_oddEven, SPStyle::fill_rule, Inkscape::Extension::Internal::PrintMetafile::fill_transform, Inkscape::Extension::Internal::FixPPTDashLine, Inkscape::Extension::Internal::FixPPTGrad2Polys, Inkscape::Extension::Internal::FixPPTLinGrad, get_pathrect_corner(), Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::grad, Inkscape::Extension::Internal::PrintMetafile::gv, U_RECT::left, U_GRADIENT4::LowerRight, Inkscape::Extension::Internal::PrintMetafile::m_tr_stack, make_trivertex(), Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::mode, straightener::overlap(), Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::p1, Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::p2, Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::p3, pathv_to_rect(), print_pathv(), Inkscape::Extension::Internal::PX2WORLD, Inkscape::UI::Widget::range(), Inkscape::Extension::Internal::PrintMetafile::rect_cutter(), rgb, U_RECT::right, Rotate, sp_pathvector_boolop(), Inkscape::Extension::Internal::PrintMetafile::SPWR_to_LVFR(), start, SPGradientVector::stops, SPStyle::stroke, SPStyle::stroke_dasharray, SPStyle::stroke_width, U_RECT::top, Geom::unit_vector(), U_GRADIENT4::UpperLeft, Inkscape::Extension::Internal::PrintMetafile::use_fill, Inkscape::Extension::Internal::PrintMetafile::use_stroke, SPGradient::vector, vector_rect_alignment(), Inkscape::Extension::Internal::PrintMetafile::weight_colors(), Inkscape::Extension::Internal::PrintMetafile::weight_opacity(), Geom::X, and Geom::Y.

◆ finish()

unsigned int Inkscape::Extension::Internal::PrintEmf::finish ( Inkscape::Extension::Print module)
overridevirtual

◆ get_pathrect_corner()

Geom::Point Inkscape::Extension::Internal::PrintEmf::get_pathrect_corner ( Geom::Path  pathRect,
double  angle,
int  corner 
)
protected

◆ image()

unsigned int Inkscape::Extension::Internal::PrintEmf::image ( Inkscape::Extension::Print module,
unsigned char *  rgba_px,
unsigned int  w,
unsigned int  h,
unsigned int  rs,
Geom::Affine const &  tf_rect,
SPStyle const *  style 
)
overridevirtual

Some parts based on win32.cpp by Lauris Kaplinski lauri.nosp@m.s@ka.nosp@m.plins.nosp@m.ki.c.nosp@m.om.

Was a part of Inkscape in the past (or will be in the future?) Not in current trunk. (4/19/2012)

Limitations of this code:

  1. Transparency is lost on export. (Apparently a limitation of the EMF format.)
  2. Probably messes up if row stride != w*4
  3. There is still a small memory leak somewhere, possibly in a pixbuf created in a routine that calls this one and passes px, but never removes the rest of the pixbuf. The first time this is called it leaked 5M (in one test) and each subsequent call leaked around 200K more. If this routine is reduced to if(1)return(0); and called for a single 1280 x 1024 image then the program leaks 11M per call, or roughly the size of two bitmaps. provides indirect link to image object

Bounding rectangle in device units

Destination UL corner in logical units

Destination W & H in logical units

Source UL corner in logical units

Source W & H in logical units

DIBColors Enumeration

RasterOPeration Enumeration

(Optional) bitmapbuffer (U_BITMAPINFO section)

size in bytes of px

(Optional) bitmapbuffer (U_BITMAPINFO section)

Parameters
rgba_pxnot used
warray of pixel values, Gdk::Pixbuf bitmap format
hwidth of bitmap
rsheight of bitmap
tf_rectrow stride (normally w*4)
styleaffine transform only used for defining location and size of rect, for all other transforms, use the one from m_tr_stack

Reimplemented from Inkscape::Extension::Implementation::Implementation.

Definition at line 1698 of file emf-print.cpp.

References do_clip_if_present(), U_XFORM::eDx, U_XFORM::eDy, U_XFORM::eM11, U_XFORM::eM12, U_XFORM::eM21, U_XFORM::eM22, Inkscape::Extension::Internal::et, Inkscape::Extension::Internal::FixImageRot, Inkscape::Extension::Internal::PrintMetafile::m_tr_stack, Inkscape::Extension::Internal::PX2WORLD, rs, w, Geom::X, U_PAIR::x, Geom::Y, and U_PAIR::y.

◆ init()

void Inkscape::Extension::Internal::PrintEmf::init ( )
static

Definition at line 2171 of file emf-print.cpp.

References Inkscape::Extension::build_from_mem().

Referenced by Inkscape::Extension::init().

◆ make_trivertex()

U_TRIVERTEX Inkscape::Extension::Internal::PrintEmf::make_trivertex ( Geom::Point  Pt,
U_COLORREF  uc 
)
protected

◆ merge_PathVector_with_group()

Geom::PathVector Inkscape::Extension::Internal::PrintEmf::merge_PathVector_with_group ( Geom::PathVector const &  combined_pathvector,
SPItem const *  item,
const Geom::Affine transform 
)
protected

◆ merge_PathVector_with_shape()

Geom::PathVector Inkscape::Extension::Internal::PrintEmf::merge_PathVector_with_shape ( Geom::PathVector const &  combined_pathvector,
SPItem const *  item,
const Geom::Affine transform 
)
protected

◆ pathv_to_rect()

Geom::Path Inkscape::Extension::Internal::PrintEmf::pathv_to_rect ( Geom::PathVector const &  pathv,
bool *  is_rect,
double *  angle 
)
protected

◆ pathv_to_simple_polygon()

Geom::Path Inkscape::Extension::Internal::PrintEmf::pathv_to_simple_polygon ( Geom::PathVector const &  pathv,
int *  vertices 
)
protected

◆ print_pathv()

◆ print_simple_shape()

bool Inkscape::Extension::Internal::PrintEmf::print_simple_shape ( Geom::PathVector const &  pathv,
const Geom::Affine transform 
)
private

◆ setup()

unsigned int Inkscape::Extension::Internal::PrintEmf::setup ( Inkscape::Extension::Print module)
overridevirtual

Reimplemented from Inkscape::Extension::Implementation::Implementation.

Definition at line 116 of file emf-print.cpp.

◆ smuggle_adxkyrtl_out()

void Inkscape::Extension::Internal::PrintEmf::smuggle_adxkyrtl_out ( const char *  string,
uint32_t **  adx,
double *  ky,
int *  rtl,
int *  ndx,
float  scale 
)
staticprotected

Definition at line 80 of file emf-print.cpp.

References scale.

Referenced by text().

◆ stroke()

◆ text()

◆ vector_rect_alignment()

int Inkscape::Extension::Internal::PrintEmf::vector_rect_alignment ( double  angle,
Geom::Point  vtest 
)
protected

Definition at line 892 of file emf-print.cpp.

References Geom::detail::bezier_clipping::angle(), Geom::are_near(), dot(), Rotate, and Geom::unit_vector().

Referenced by fill().

Member Data Documentation

◆ hbrush

uint32_t Inkscape::Extension::Internal::PrintEmf::hbrush
private

Definition at line 27 of file emf-print.h.

Referenced by begin(), create_brush(), destroy_brush(), and print_simple_shape().

◆ hbrushOld

uint32_t Inkscape::Extension::Internal::PrintEmf::hbrushOld
private

Definition at line 27 of file emf-print.h.

Referenced by begin().

◆ hpen

uint32_t Inkscape::Extension::Internal::PrintEmf::hpen
private

Definition at line 27 of file emf-print.h.

Referenced by begin(), create_pen(), destroy_pen(), and print_simple_shape().


The documentation for this class was generated from the following files: