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

Output bezier splines in POVRay format. More...

#include <pov-out.h>

Inheritance diagram for Inkscape::Extension::Internal::PovOutput:
Inkscape::Extension::Implementation::Implementation

Classes

class  PovShapeInfo
 used for saving information about shapes More...
 

Public Types

typedef Glib::ustring String
 Our internal String definition.
 

Public Member Functions

 PovOutput ()
 
bool check (Inkscape::Extension::Extension *module) override
 Check whether we can actually output using this module.
 
void save (Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) override
 API call to perform the output to a file.
 
void reset ()
 Reset variables to initial state.
 
- 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 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 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 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.
 
virtual bool fontEmbedded (Inkscape::Extension::Print *)
 Get "fontEmbedded" param, i.e.
 
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.
 

Static Public Member Functions

static void init ()
 Inkscape runtime startup call.
 

Private Member Functions

void out (const char *fmt,...) G_GNUC_PRINTF(2
 Format text to our output buffer.
 
void void vec2 (double a, double b)
 Output a 2d vector.
 
void vec3 (double a, double b, double c)
 Output a 3d vector.
 
void vec4 (double a, double b, double c, double d)
 Output a 4d vector.
 
void rgbf (double r, double g, double b, double f)
 Output an rgbf color vector.
 
void segment (int segNr, double a0, double a1, double b0, double b1, double c0, double c1, double d0, double d1)
 Output one bezier's start, start-control, end-control, and end nodes.
 
bool doHeader ()
 Output the file header.
 
bool doTail ()
 Output the file footer.
 
bool doCurve (SPItem *item, const String &id)
 Output the SVG document's curve data as POV curves.
 
bool doTreeRecursive (SPDocument *doc, SPObject *obj)
 Descend the svg tree recursively, translating data.
 
bool doTree (SPDocument *doc)
 Output the curve data to buffer.
 
void saveDocument (SPDocument *doc, gchar const *filename)
 Actual method to save document.
 

Private Attributes

std::vector< PovShapeInfopovShapes
 
String outbuf
 
int nrNodes
 
int nrSegments
 
int nrShapes
 
int idIndex
 
double minx
 
double miny
 
double maxx
 
double maxy
 

Detailed Description

Output bezier splines in POVRay format.

For information,

See also
:
http://www.povray.org

Definition at line 41 of file pov-out.h.

Member Typedef Documentation

◆ String

Our internal String definition.

Definition at line 52 of file pov-out.h.

Constructor & Destructor Documentation

◆ PovOutput()

Inkscape::Extension::Internal::PovOutput::PovOutput ( )

Definition at line 96 of file pov-out.cpp.

Member Function Documentation

◆ check()

bool Inkscape::Extension::Internal::PovOutput::check ( Inkscape::Extension::Extension module)
overridevirtual

Check whether we can actually output using this module.

Make sure that we are in the database.

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

Definition at line 679 of file pov-out.cpp.

◆ doCurve()

bool Inkscape::Extension::Internal::PovOutput::doCurve ( SPItem item,
const String id 
)
private

Output the SVG document's curve data as POV curves.

Output the curve data to buffer.

For all Subpaths in the <path>

For all segments in the subpath, including extra closing segment defined by 2geom

at moment of writing, 2geom lacks proper initialization of empty intervals in rect...

For all Subpaths in the <path>

For all segments in the subpath, including extra closing segment defined by 2geom

Definition at line 269 of file pov-out.cpp.

References Inkscape::Extension::Internal::PovOutput::PovShapeInfo::color, Inkscape::Extension::Internal::dstr(), Inkscape::Extension::Internal::effective_opacity(), Inkscape::Extension::Internal::err(), Geom::GenericRect< C >::expandTo(), SPStyle::fill, SPStyle::fill_opacity, Geom::PathVector::front(), SPItem::i2dt_affine(), Inkscape::Extension::Internal::PovOutput::PovShapeInfo::id, Geom::Path::initialPoint(), is_straight_curve(), item, Geom::GenericRect< C >::max(), maxx, maxy, Geom::GenericRect< C >::min(), minx, miny, nrNodes, nrSegments, nrShapes, out(), pathv_to_linear_and_cubic_beziers(), povShapes, Inkscape::Colors::Space::RGB, rgbf(), segment(), Geom::X, and Geom::Y.

Referenced by doTreeRecursive().

◆ doHeader()

bool Inkscape::Extension::Internal::PovOutput::doHeader ( )
private

Output the file header.

Definition at line 210 of file pov-out.cpp.

References nrNodes, nrSegments, nrShapes, out(), and Inkscape::version_string.

Referenced by saveDocument().

◆ doTail()

bool Inkscape::Extension::Internal::PovOutput::doTail ( )
private

Output the file footer.

Definition at line 254 of file pov-out.cpp.

References out().

Referenced by saveDocument().

◆ doTree()

bool Inkscape::Extension::Internal::PovOutput::doTree ( SPDocument doc)
private

Output the curve data to buffer.

Definition at line 481 of file pov-out.cpp.

References doTreeRecursive(), SPDocument::getRoot(), maxx, maxy, minx, miny, out(), and povShapes.

Referenced by saveDocument().

◆ doTreeRecursive()

bool Inkscape::Extension::Internal::PovOutput::doTreeRecursive ( SPDocument doc,
SPObject obj 
)
private

Descend the svg tree recursively, translating data.

Descend into children

Definition at line 448 of file pov-out.cpp.

References buf, child, SPObject::children, doCurve(), doTreeRecursive(), SPObject::getId(), idIndex, and item.

Referenced by doTree(), and doTreeRecursive().

◆ init()

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

Inkscape runtime startup call.

This is the definition of PovRay output.

This function just calls the extension system with the memory allocated XML that describes the data.

Definition at line 697 of file pov-out.cpp.

References Inkscape::Extension::build_from_mem().

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

◆ out()

void Inkscape::Extension::Internal::PovOutput::out ( const char *  fmt,
  ... 
)
private

Format text to our output buffer.

Output data to the buffer, printf()-style.

Definition at line 127 of file pov-out.cpp.

References fmt, outbuf, va_end(), and va_start().

Referenced by doCurve(), doHeader(), doTail(), doTree(), rgbf(), segment(), vec2(), vec3(), and vec4().

◆ reset()

void Inkscape::Extension::Internal::PovOutput::reset ( )

Reset variables to initial state.

Set values back to initial state.

Definition at line 588 of file pov-out.cpp.

References idIndex, nrNodes, nrSegments, nrShapes, outbuf, and povShapes.

Referenced by saveDocument().

◆ rgbf()

void Inkscape::Extension::Internal::PovOutput::rgbf ( double  r,
double  g,
double  b,
double  f 
)
private

Output an rgbf color vector.

Definition at line 174 of file pov-out.cpp.

References out(), and vec4().

Referenced by doCurve().

◆ save()

void Inkscape::Extension::Internal::PovOutput::save ( Inkscape::Extension::Output mod,
SPDocument doc,
gchar const *  filename 
)
overridevirtual

API call to perform the output to a file.

API call to save document.

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

Definition at line 667 of file pov-out.cpp.

References saveDocument().

◆ saveDocument()

void Inkscape::Extension::Internal::PovOutput::saveDocument ( SPDocument doc,
gchar const *  filename 
)
private

Actual method to save document.

Saves the Shapes of an Inkscape SVG file as PovRay spline definitions.

Definition at line 603 of file pov-out.cpp.

References doHeader(), doTail(), doTree(), Inkscape::IO::dump_fopen_call(), Inkscape::Extension::Internal::err(), Inkscape::IO::fopen_utf8name(), outbuf, and reset().

Referenced by save().

◆ segment()

void Inkscape::Extension::Internal::PovOutput::segment ( int  segNr,
double  a0,
double  a1,
double  b0,
double  b1,
double  c0,
double  c1,
double  d0,
double  d1 
)
private

Output one bezier's start, start-control, end-control, and end nodes.

Definition at line 186 of file pov-out.cpp.

References out(), and vec2().

Referenced by doCurve().

◆ vec2()

void Inkscape::Extension::Internal::PovOutput::vec2 ( double  a,
double  b 
)
private

Output a 2d vector.

Definition at line 144 of file pov-out.cpp.

References out().

Referenced by segment().

◆ vec3()

void Inkscape::Extension::Internal::PovOutput::vec3 ( double  a,
double  b,
double  c 
)
private

Output a 3d vector.

Definition at line 154 of file pov-out.cpp.

References c, and out().

◆ vec4()

void Inkscape::Extension::Internal::PovOutput::vec4 ( double  a,
double  b,
double  c,
double  d 
)
private

Output a 4d vector.

Output a v4d ector.

Definition at line 164 of file pov-out.cpp.

References c, and out().

Referenced by rgbf().

Member Data Documentation

◆ idIndex

int Inkscape::Extension::Internal::PovOutput::idIndex
private

Definition at line 171 of file pov-out.h.

Referenced by doTreeRecursive(), and reset().

◆ maxx

double Inkscape::Extension::Internal::PovOutput::maxx
private

Definition at line 175 of file pov-out.h.

Referenced by doCurve(), and doTree().

◆ maxy

double Inkscape::Extension::Internal::PovOutput::maxy
private

Definition at line 176 of file pov-out.h.

Referenced by doCurve(), and doTree().

◆ minx

double Inkscape::Extension::Internal::PovOutput::minx
private

Definition at line 173 of file pov-out.h.

Referenced by doCurve(), and doTree().

◆ miny

double Inkscape::Extension::Internal::PovOutput::miny
private

Definition at line 174 of file pov-out.h.

Referenced by doCurve(), and doTree().

◆ nrNodes

int Inkscape::Extension::Internal::PovOutput::nrNodes
private

Definition at line 168 of file pov-out.h.

Referenced by doCurve(), doHeader(), and reset().

◆ nrSegments

int Inkscape::Extension::Internal::PovOutput::nrSegments
private

Definition at line 169 of file pov-out.h.

Referenced by doCurve(), doHeader(), and reset().

◆ nrShapes

int Inkscape::Extension::Internal::PovOutput::nrShapes
private

Definition at line 170 of file pov-out.h.

Referenced by doCurve(), doHeader(), and reset().

◆ outbuf

String Inkscape::Extension::Internal::PovOutput::outbuf
private

Definition at line 165 of file pov-out.h.

Referenced by out(), reset(), and saveDocument().

◆ povShapes

std::vector<PovShapeInfo> Inkscape::Extension::Internal::PovOutput::povShapes
private

Definition at line 162 of file pov-out.h.

Referenced by doCurve(), doTree(), and reset().


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