Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Extension::Internal::PrintWmf Class Reference

#include <wmf-print.h>

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

Public Member Functions

 PrintWmf ()
 
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.
 
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.
 
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.
 
virtual bool check (Inkscape::Extension::Extension *)
 Verify any dependencies.
 
virtual bool cancelProcessing ()
 
virtual void commitDocument ()
 
virtual std::unique_ptr< 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 std::unique_ptr< SPDocumentopen (Inkscape::Extension::Input *module, char const *filename, bool is_importing)
 Open a file.
 
virtual void save (Inkscape::Extension::Output *, SPDocument *, gchar const *)
 Find out information about the file.
 
virtual void export_raster (Inkscape::Extension::Output *module, const SPDocument *doc, std::string const &png_file, gchar const *filename)
 Convert from PNG to raster format.
 
virtual Gtk::Widget * prefs_effect (Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal< void()> *changeSignal, ImplementationDocumentCache *docCache)
 Find out information about the file.
 
virtual void effect (Inkscape::Extension::Effect *, ExecutionEnv *, SPDesktop *, ImplementationDocumentCache *)
 
virtual void effect (Inkscape::Extension::Effect *, ExecutionEnv *, SPDocument *document)
 
virtual bool apply_filter (Inkscape::Extension::Effect *module, SPItem *item)
 
virtual unsigned set_preview (Inkscape::Extension::Print *)
 
virtual bool fontEmbedded (Inkscape::Extension::Print *)
 Get "fontEmbedded" param, i.e.
 
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.
 

Static Public Member Functions

static void init ()
 

Protected Member Functions

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)
 

Static Protected Member Functions

static void smuggle_adxky_out (const char *string, int16_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 hpen
 
uint32_t hbrush_null
 
uint32_t hpen_null
 
uint32_t hmiterlimit
 

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
 
std::optional< Inkscape::Colors::Colorhtextcolor_rgb
 
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 22 of file wmf-print.h.

Constructor & Destructor Documentation

◆ PrintWmf()

Inkscape::Extension::Internal::PrintWmf::PrintWmf ( )

Definition at line 109 of file wmf-print.cpp.

Member Function Documentation

◆ begin()

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

◆ create_brush()

◆ create_pen()

◆ destroy_brush()

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

◆ destroy_pen()

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

◆ fill()

unsigned int Inkscape::Extension::Internal::PrintWmf::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 658 of file wmf-print.cpp.

References bool_op_inters, 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(), Inkscape::Extension::Internal::DRAW_LINEAR_GRADIENT, Inkscape::Extension::Internal::DRAW_RADIAL_GRADIENT, fill_nonZero, fill_oddEven, SPStyle::fill_rule, Inkscape::Extension::Internal::PrintMetafile::fill_transform, Inkscape::Extension::Internal::FixPPTDashLine, Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::grad, Inkscape::Extension::Internal::PrintMetafile::gv, Inkscape::Extension::Internal::PrintMetafile::m_tr_stack, Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::mode, Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::p1, Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::p2, Inkscape::Extension::Internal::PrintMetafile::GRADVALUES::p3, print_pathv(), Inkscape::Extension::Internal::PrintMetafile::rect_cutter(), sp_pathvector_boolop(), Inkscape::Extension::Internal::PrintMetafile::SPWR_to_LVFR(), start, SPGradientVector::stops, SPStyle::stroke, SPStyle::stroke_dasharray, SPStyle::stroke_width, Inkscape::Extension::Internal::toColorRef(), Geom::unit_vector(), Inkscape::Extension::Internal::PrintMetafile::use_fill, Inkscape::Extension::Internal::PrintMetafile::use_stroke, SPGradient::vector, Inkscape::Extension::Internal::PrintMetafile::weight_colors(), Inkscape::Extension::Internal::PrintMetafile::weight_opacity(), Geom::X, and Geom::Y.

◆ finish()

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

◆ image()

unsigned int Inkscape::Extension::Internal::PrintWmf::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. Images lose their rotation, one corner stays in the same place.
  2. Transparency is lost on export. (A limitation of the WMF format.)
  3. Probably messes up if row stride != w*4
  4. 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

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 1099 of file wmf-print.cpp.

References Inkscape::Extension::Internal::PrintMetafile::m_tr_stack, Inkscape::Extension::Internal::PX2WORLD, rs, w, Geom::Affine::withoutTranslation(), Inkscape::Extension::Internal::wt, Geom::X, and Geom::Y.

◆ init()

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

Definition at line 1545 of file wmf-print.cpp.

References Inkscape::Extension::build_from_mem().

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

◆ print_pathv()

unsigned int Inkscape::Extension::Internal::PrintWmf::print_pathv ( Geom::PathVector const &  pathv,
const Geom::Affine transform 
)
private

◆ print_simple_shape()

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

For all Subpaths in the <path>

For all segments in the subpath

Definition at line 914 of file wmf-print.cpp.

References is_straight_curve(), pathv_to_linear(), Inkscape::Extension::Internal::PX2WORLD, Inkscape::Extension::Internal::wt, Geom::X, U_POINT16::x, Geom::Y, and U_POINT16::y.

Referenced by print_pathv().

◆ setup()

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

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

Definition at line 115 of file wmf-print.cpp.

◆ smuggle_adxky_out()

void Inkscape::Extension::Internal::PrintWmf::smuggle_adxky_out ( const char *  string,
int16_t **  adx,
double *  ky,
int *  rtl,
int *  ndx,
float  scale 
)
staticprotected

Definition at line 79 of file wmf-print.cpp.

References scale.

Referenced by text().

◆ stroke()

◆ text()

Member Data Documentation

◆ hbrush

uint32_t Inkscape::Extension::Internal::PrintWmf::hbrush
private

Definition at line 24 of file wmf-print.h.

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

◆ hbrush_null

uint32_t Inkscape::Extension::Internal::PrintWmf::hbrush_null
private

Definition at line 24 of file wmf-print.h.

Referenced by begin(), destroy_brush(), and finish().

◆ hmiterlimit

uint32_t Inkscape::Extension::Internal::PrintWmf::hmiterlimit
private

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

Referenced by begin(), and create_pen().

◆ hpen

uint32_t Inkscape::Extension::Internal::PrintWmf::hpen
private

Definition at line 24 of file wmf-print.h.

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

◆ hpen_null

uint32_t Inkscape::Extension::Internal::PrintWmf::hpen_null
private

Definition at line 24 of file wmf-print.h.

Referenced by begin(), destroy_pen(), and finish().


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