diff options
author | Karl Berry <karl@freefriends.org> | 2009-05-16 00:19:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-05-16 00:19:13 +0000 |
commit | bab45528d65eaafe68a705dbb2a57075c7b7cbd8 (patch) | |
tree | 10b4ae2b5195c8dede153ab89359ec00f55f325f /Build/source/utils/asymptote/picture.h | |
parent | 8643d90372e9c31e0f461c15c596b60a545bd7d3 (diff) |
asymptote 1.72 sources (not integrated into build yet)
git-svn-id: svn://tug.org/texlive/trunk@13110 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/picture.h')
-rw-r--r-- | Build/source/utils/asymptote/picture.h | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/picture.h b/Build/source/utils/asymptote/picture.h new file mode 100644 index 00000000000..59ce0369c34 --- /dev/null +++ b/Build/source/utils/asymptote/picture.h @@ -0,0 +1,127 @@ +/***** + * picture.h + * Andy Hamerlindl 2002/06/06 + * + * Stores a picture as a list of drawElements and handles its output to + * PostScript. + *****/ + +#ifndef PICTURE_H +#define PICTURE_H + +#include <sstream> +#include <iostream> + +#include "drawelement.h" + +namespace camp { + +class picture : public gc { +private: + bool labels; + size_t lastnumber; + size_t lastnumber3; + transform T; // Keep track of accumulative picture transform + bbox b; + bbox b_cached; // Cached bounding box + boxvector labelbounds; + bboxlist bboxstack; + bool transparency; + + static bool epsformat,pdfformat,xobject,pdf,Labels; + static double paperWidth,paperHeight; + +public: + bbox3 b3; // 3D bounding box + + typedef mem::list<drawElement*> nodelist; + nodelist nodes; + + picture() : labels(false), lastnumber(0), lastnumber3(0), T(identity), + transparency(false) {} + + // Destroy all of the owned picture objects. + ~picture(); + + // Prepend an object to the picture. + void prepend(drawElement *p); + + // Append an object to the picture. + void append(drawElement *p); + + // Enclose each layer with begin and end. + void enclose(drawElement *begin, drawElement *end); + + // Add the content of another picture. + void add(picture &pic); + void prepend(picture &pic); + + bool havelabels(); + bool have3D(); + + bbox bounds(); + bbox3 bounds3(); + + // Projected bounds of 3d picture given transform3 t (not cached). + pair bounds(double (*m)(double, double), + double (*x)(const triple&, double*), + double (*y)(const triple&, double*), + double *t=NULL); + + void texinit(); + + bool Transparency() { + return transparency; + } + + int epstopdf(const string& epsname, const string& pdfname); + + bool texprocess(const string& texname, const string& tempname, + const string& prefix, const pair& bboxshift); + + bool postprocess(const string& prename, const string& outname, + const string& outputformat, double magnification, + bool wait, bool view); + + // Ship the picture out to PostScript & TeX files. + bool shipout(picture* preamble, const string& prefix, + const string& format, double magnification=0.0, + bool wait=false, bool view=true); + + void render(GLUnurbs *nurb, double size2, + const triple &Min, const triple& Max, double perspective, + bool transparent) const; + bool shipout3(const string& prefix, const string& format, + double width, double height, double angle, const triple& m, + const triple& M, double *t, size_t nlights, triple *lights, + double *diffuse, double *ambient, double *specular, + bool viewportlighting, bool view); + + bool shipout3(const string& prefix); // Embedded PRC + + bool reloadPDF(const string& Viewer, const string& outname) const; + + picture *transformed(const transform& t); + picture *transformed(const vm::array& t); + + bool null() { + return nodes.empty(); + } + +}; + +inline picture *transformed(const transform& t, picture *p) +{ + return p->transformed(t); +} + +inline picture *transformed(const vm::array& t, picture *p) +{ + return p->transformed(t); +} + +const char *texpathmessage(); + +} //namespace camp + +#endif |