--- vtk-5.4.2.orig/CMakeLists.txt +++ vtk-5.4.2/CMakeLists.txt @@ -606,6 +606,9 @@ #----------------------------------------------------------------------------- # Provide options to use system versions of third-party libraries. VTK_THIRD_PARTY_OPTION(ZLIB zlib) +IF(VTK_USE_GL2PS) +VTK_THIRD_PARTY_OPTION(GL2PS gl2ps) +ENDIF(VTK_USE_GL2PS) VTK_THIRD_PARTY_OPTION(JPEG jpeg) VTK_THIRD_PARTY_OPTION(PNG png) VTK_THIRD_PARTY_OPTION(TIFF tiff) --- vtk-5.4.2.orig/vtkGenerateVTKConfig.cmake +++ vtk-5.4.2/vtkGenerateVTKConfig.cmake @@ -227,7 +227,7 @@ SET(VTK_WRAP_JAVA_EXE_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_BIN_DIR}/vtkWrapJava${VTK_EXE_EXT}) SET(VTK_JAVA_JAR_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_JAVA_DIR}/vtk.jar) ENDIF(VTK_WRAP_JAVA) -SET(VTK_ENCODESTRING_EXE_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_BIN_DIR}/vtkEncodeString${VTK_EXE_EXT}) +SET(VTK_ENCODESTRING_EXE_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_LIB_DIR}/vtkEncodeString${VTK_EXE_EXT}) # VTK style script locations. SET(VTK_DOXYGEN_HOME_CONFIG ${DOLLAR}{VTK_INSTALL_PREFIX}${VTK_INSTALL_DOXYGEN_DIR}) --- vtk-5.4.2.orig/Utilities/CMakeLists.txt +++ vtk-5.4.2/Utilities/CMakeLists.txt @@ -4,6 +4,9 @@ # Build third-party utilities. VTK_THIRD_PARTY_SUBDIR(ZLIB vtkzlib) +IF(VTK_USE_GL2PS) + VTK_THIRD_PARTY_SUBDIR(GL2PS vtkgl2ps) +ENDIF(VTK_USE_GL2PS) VTK_THIRD_PARTY_SUBDIR(JPEG vtkjpeg) VTK_THIRD_PARTY_SUBDIR(PNG vtkpng) VTK_THIRD_PARTY_SUBDIR(TIFF vtktiff) --- vtk-5.4.2.orig/Utilities/vtkgl2ps/COPYING.LGPL +++ vtk-5.4.2/Utilities/vtkgl2ps/COPYING.LGPL @@ -0,0 +1,482 @@ + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! --- vtk-5.4.2.orig/Utilities/vtkgl2ps/README.VTK.txt +++ vtk-5.4.2/Utilities/vtkgl2ps/README.VTK.txt @@ -0,0 +1,27 @@ +This directory contains the sources for the GL2PS library. The +complete GL2PS library with documentation is available from here: + + http://www.geuz.org/gl2ps/ + +We thank Christophe Geuzaine for +distributing this library under a license compatible with VTK. + +Please read the COPYING.GL2PS license before you make any +modifications to this copy of the GL2PS sources. + + +Notes on how GL2PS is built in VTK +---------------------------------- + +CMakeLists.txt is conspicuous by its absence in this directory. +Currently, the GL2PS sources are in two files, one header and the +other the library. The GL2PS code is only used in Rendering so we +simply compile gl2ps.c in the Rendering directory and build the +Rendering library along with the resulting gl2ps object file. Since +VTK ships with its own ZLIB library, GL2PS compressed output is +enabled and GL2PS_HAVE_ZLIB is defined inside +Rendering/CMakeLists.txt. Similar is the case with the +GL2PS_HAVE_LIBPNG flag. + +In order to avoid linking errors we also have modified gl2ps to +include vtk_zlib.h and vtk_png.h instead of the {zlib,png}.h headers. --- vtk-5.4.2.orig/Utilities/vtkgl2ps/gl2ps.h +++ vtk-5.4.2/Utilities/vtkgl2ps/gl2ps.h @@ -0,0 +1,196 @@ +/* $Id: gl2ps.h,v 1.1 2009-10-28 10:34:20 malaterre Exp $ */ +/* + * GL2PS, an OpenGL to PostScript Printing Library + * Copyright (C) 1999-2006 Christophe Geuzaine + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of either: + * + * a) the GNU Library General Public License as published by the Free + * Software Foundation, either version 2 of the License, or (at your + * option) any later version; or + * + * b) the GL2PS License as published by Christophe Geuzaine, either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either + * the GNU Library General Public License or the GL2PS License for + * more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library in the file named "COPYING.LGPL"; + * if not, write to the Free Software Foundation, Inc., 675 Mass Ave, + * Cambridge, MA 02139, USA. + * + * You should have received a copy of the GL2PS License with this + * library in the file named "COPYING.GL2PS"; if not, I will be glad + * to provide one. + * + * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/. + * Please report all bugs and problems to . + */ + +#ifndef __GL2PS_H__ +#define __GL2PS_H__ + +#include +#include + +/* Define GL2PSDLL at compile time to build a Windows DLL */ + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +# if defined(_MSC_VER) +# pragma warning(disable:4115) +# endif +# include +# if defined(GL2PSDLL) +# if defined(GL2PSDLL_EXPORTS) +# define GL2PSDLL_API __declspec(dllexport) +# else +# define GL2PSDLL_API __declspec(dllimport) +# endif +# else +# define GL2PSDLL_API +# endif +#else +# define GL2PSDLL_API +#endif + +#if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H) +# include +#else +# include +#endif + +/* Support for compressed PostScript/PDF/SVG and for embedded PNG + images in SVG */ + +#if defined(HAVE_ZLIB) || defined(HAVE_LIBZ) +# define GL2PS_HAVE_ZLIB +# if defined(HAVE_LIBPNG) || defined(HAVE_PNG) +# define GL2PS_HAVE_LIBPNG +# endif +#endif + +/* Version number */ + +#define GL2PS_MAJOR_VERSION 1 +#define GL2PS_MINOR_VERSION 3 +#define GL2PS_PATCH_VERSION 2 +#define GL2PS_EXTRA_VERSION "" + +#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \ + 0.01 * GL2PS_MINOR_VERSION + \ + 0.0001 * GL2PS_PATCH_VERSION) + +#define GL2PS_COPYRIGHT "(C) 1999-2006 Christophe Geuzaine (geuz@geuz.org)" + +/* Output file formats (the values and the ordering are important!) */ + +#define GL2PS_PS 0 +#define GL2PS_EPS 1 +#define GL2PS_TEX 2 +#define GL2PS_PDF 3 +#define GL2PS_SVG 4 +#define GL2PS_PGF 5 + +/* Sorting algorithms */ + +#define GL2PS_NO_SORT 1 +#define GL2PS_SIMPLE_SORT 2 +#define GL2PS_BSP_SORT 3 + +/* Message levels and error codes */ + +#define GL2PS_SUCCESS 0 +#define GL2PS_INFO 1 +#define GL2PS_WARNING 2 +#define GL2PS_ERROR 3 +#define GL2PS_NO_FEEDBACK 4 +#define GL2PS_OVERFLOW 5 +#define GL2PS_UNINITIALIZED 6 + +/* Options for gl2psBeginPage */ + +#define GL2PS_NONE 0 +#define GL2PS_DRAW_BACKGROUND (1<<0) +#define GL2PS_SIMPLE_LINE_OFFSET (1<<1) +#define GL2PS_SILENT (1<<2) +#define GL2PS_BEST_ROOT (1<<3) +#define GL2PS_OCCLUSION_CULL (1<<4) +#define GL2PS_NO_TEXT (1<<5) +#define GL2PS_LANDSCAPE (1<<6) +#define GL2PS_NO_PS3_SHADING (1<<7) +#define GL2PS_NO_PIXMAP (1<<8) +#define GL2PS_USE_CURRENT_VIEWPORT (1<<9) +#define GL2PS_COMPRESS (1<<10) +#define GL2PS_NO_BLENDING (1<<11) +#define GL2PS_TIGHT_BOUNDING_BOX (1<<12) + +/* Arguments for gl2psEnable/gl2psDisable */ + +#define GL2PS_POLYGON_OFFSET_FILL 1 +#define GL2PS_POLYGON_BOUNDARY 2 +#define GL2PS_LINE_STIPPLE 3 +#define GL2PS_BLEND 4 + +/* Text alignment (o=raster position; default mode is BL): + +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o + | o | o | | o | | | | | | | | | | | | + +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+ + C CL CR B BL BR T TL TR */ + +#define GL2PS_TEXT_C 1 +#define GL2PS_TEXT_CL 2 +#define GL2PS_TEXT_CR 3 +#define GL2PS_TEXT_B 4 +#define GL2PS_TEXT_BL 5 +#define GL2PS_TEXT_BR 6 +#define GL2PS_TEXT_T 7 +#define GL2PS_TEXT_TL 8 +#define GL2PS_TEXT_TR 9 + +typedef GLfloat GL2PSrgba[4]; + +#if defined(__cplusplus) +extern "C" { +#endif + +GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, + GLint viewport[4], GLint format, GLint sort, + GLint options, GLint colormode, + GLint colorsize, GL2PSrgba *colormap, + GLint nr, GLint ng, GLint nb, GLint buffersize, + FILE *stream, const char *filename); +GL2PSDLL_API GLint gl2psEndPage(void); +GL2PSDLL_API GLint gl2psSetOptions(GLint options); +GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]); +GL2PSDLL_API GLint gl2psEndViewport(void); +GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, + GLshort fontsize); +GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, + GLshort fontsize, GLint align, GLfloat angle); +GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str); +GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, + GLint xorig, GLint yorig, + GLenum format, GLenum type, const void *pixels); +GL2PSDLL_API GLint gl2psEnable(GLint mode); +GL2PSDLL_API GLint gl2psDisable(GLint mode); +GL2PSDLL_API GLint gl2psPointSize(GLfloat value); +GL2PSDLL_API GLint gl2psLineWidth(GLfloat value); +GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor); + +/* undocumented */ +GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height, + const GLfloat position[3], + const unsigned char *imagemap); +GL2PSDLL_API const char *gl2psGetFileExtension(GLint format); +GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format); + +#if defined(__cplusplus) +} +#endif + +#endif /* __GL2PS_H__ */ --- vtk-5.4.2.orig/Utilities/vtkgl2ps/COPYING.GL2PS +++ vtk-5.4.2/Utilities/vtkgl2ps/COPYING.GL2PS @@ -0,0 +1,25 @@ + + GL2PS LICENSE + Version 2, November 2003 + + Copyright (C) 2003, Christophe Geuzaine + +Permission to use, copy, and distribute this software and its +documentation for any purpose with or without fee is hereby granted, +provided that the copyright notice appear in all copies and that both +that copyright notice and this permission notice appear in supporting +documentation. + +Permission to modify and distribute modified versions of this software +is granted, provided that: + +1) the modifications are licensed under the same terms as this +software; + +2) you make available the source code of any modifications that you +distribute, either on the same media as you distribute any executable +or other form of this software, or via a mechanism generally accepted +in the software development community for the electronic transfer of +data. + +This software is provided "as is" without express or implied warranty. --- vtk-5.4.2.orig/Utilities/vtkgl2ps/gl2ps.c +++ vtk-5.4.2/Utilities/vtkgl2ps/gl2ps.c @@ -0,0 +1,5988 @@ +/* $Id: gl2ps.c,v 1.1 2009-10-28 10:34:20 malaterre Exp $ */ +/* + * GL2PS, an OpenGL to PostScript Printing Library + * Copyright (C) 1999-2006 Christophe Geuzaine + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of either: + * + * a) the GNU Library General Public License as published by the Free + * Software Foundation, either version 2 of the License, or (at your + * option) any later version; or + * + * b) the GL2PS License as published by Christophe Geuzaine, either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either + * the GNU Library General Public License or the GL2PS License for + * more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library in the file named "COPYING.LGPL"; + * if not, write to the Free Software Foundation, Inc., 675 Mass Ave, + * Cambridge, MA 02139, USA. + * + * You should have received a copy of the GL2PS License with this + * library in the file named "COPYING.GL2PS"; if not, I will be glad + * to provide one. + * + * Contributors: + * Michael Sweet + * Marc Ume + * Jean-Francois Remacle + * Bart Kaptein + * Quy Nguyen-Dai + * Sam Buss + * Shane Hill + * Romain Boman + * Rouben Rostamian + * Diego Santa Cruz + * Shahzad Muzaffar + * Lassi Tuura + * Guy Barrand + * Prabhu Ramachandran + * Micha Bieber + * Olivier Couet + * Shai Ayal + * Fabian Wenzel + * Ian D. Gay + * Cosmin Truta + * Baiju Devani + * Alexander Danilov + * + * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/. + * Please report all bugs and problems to . + */ + +#include "gl2ps.h" + +#include +#include +#include +#include +#include +#include + +#if defined(GL2PS_HAVE_ZLIB) +#include +#endif + +#if defined(GL2PS_HAVE_LIBPNG) +#include +#endif + +/********************************************************************* + * + * Private definitions, data structures and prototypes + * + *********************************************************************/ + +/* Magic numbers (assuming that the order of magnitude of window + coordinates is 10^3) */ + +#define GL2PS_EPSILON 5.0e-3F +#define GL2PS_ZSCALE 1000.0F +#define GL2PS_ZOFFSET 5.0e-2F +#define GL2PS_ZOFFSET_LARGE 20.0F +#define GL2PS_ZERO(arg) (fabs(arg) < 1.e-20) + +/* Primitive types */ + +#define GL2PS_NO_TYPE -1 +#define GL2PS_TEXT 1 +#define GL2PS_POINT 2 +#define GL2PS_LINE 3 +#define GL2PS_QUADRANGLE 4 +#define GL2PS_TRIANGLE 5 +#define GL2PS_PIXMAP 6 +#define GL2PS_IMAGEMAP 7 +#define GL2PS_IMAGEMAP_WRITTEN 8 +#define GL2PS_IMAGEMAP_VISIBLE 9 +#define GL2PS_SPECIAL 10 + +/* BSP tree primitive comparison */ + +#define GL2PS_COINCIDENT 1 +#define GL2PS_IN_FRONT_OF 2 +#define GL2PS_IN_BACK_OF 3 +#define GL2PS_SPANNING 4 + +/* 2D BSP tree primitive comparison */ + +#define GL2PS_POINT_COINCIDENT 0 +#define GL2PS_POINT_INFRONT 1 +#define GL2PS_POINT_BACK 2 + +/* Internal feedback buffer pass-through tokens */ + +#define GL2PS_BEGIN_OFFSET_TOKEN 1 +#define GL2PS_END_OFFSET_TOKEN 2 +#define GL2PS_BEGIN_BOUNDARY_TOKEN 3 +#define GL2PS_END_BOUNDARY_TOKEN 4 +#define GL2PS_BEGIN_STIPPLE_TOKEN 5 +#define GL2PS_END_STIPPLE_TOKEN 6 +#define GL2PS_POINT_SIZE_TOKEN 7 +#define GL2PS_LINE_WIDTH_TOKEN 8 +#define GL2PS_BEGIN_BLEND_TOKEN 9 +#define GL2PS_END_BLEND_TOKEN 10 +#define GL2PS_SRC_BLEND_TOKEN 11 +#define GL2PS_DST_BLEND_TOKEN 12 +#define GL2PS_IMAGEMAP_TOKEN 13 +#define GL2PS_DRAW_PIXELS_TOKEN 14 +#define GL2PS_TEXT_TOKEN 15 + +typedef enum { + T_UNDEFINED = -1, + T_CONST_COLOR = 1, + T_VAR_COLOR = 1<<1, + T_ALPHA_1 = 1<<2, + T_ALPHA_LESS_1 = 1<<3, + T_VAR_ALPHA = 1<<4 +} GL2PS_TRIANGLE_PROPERTY; + +typedef GLfloat GL2PSxyz[3]; +typedef GLfloat GL2PSplane[4]; + +typedef struct _GL2PSbsptree2d GL2PSbsptree2d; + +struct _GL2PSbsptree2d { + GL2PSplane plane; + GL2PSbsptree2d *front, *back; +}; + +typedef struct { + GLint nmax, size, incr, n; + char *array; +} GL2PSlist; + +typedef struct _GL2PSbsptree GL2PSbsptree; + +struct _GL2PSbsptree { + GL2PSplane plane; + GL2PSlist *primitives; + GL2PSbsptree *front, *back; +}; + +typedef struct { + GL2PSxyz xyz; + GL2PSrgba rgba; +} GL2PSvertex; + +typedef struct { + GL2PSvertex vertex[3]; + int prop; +} GL2PStriangle; + +typedef struct { + GLshort fontsize; + char *str, *fontname; + /* Note: for a 'special' string, 'alignment' holds the format + (PostScript, PDF, etc.) of the special string */ + GLint alignment; + GLfloat angle; +} GL2PSstring; + +typedef struct { + GLsizei width, height; + /* Note: for an imagemap, 'type' indicates if it has already been + written to the file or not, and 'format' indicates if it is + visible or not */ + GLenum format, type; + GLfloat *pixels; +} GL2PSimage; + +typedef struct _GL2PSimagemap GL2PSimagemap; + +struct _GL2PSimagemap { + GL2PSimage *image; + GL2PSimagemap *next; +}; + +typedef struct { + GLshort type, numverts; + GLushort pattern; + char boundary, offset, culled; + GLint factor; + GLfloat width; + GL2PSvertex *verts; + union { + GL2PSstring *text; + GL2PSimage *image; + } data; +} GL2PSprimitive; + +typedef struct { +#if defined(GL2PS_HAVE_ZLIB) + Bytef *dest, *src, *start; + uLongf destLen, srcLen; +#else + int dummy; +#endif +} GL2PScompress; + +typedef struct{ + GL2PSlist* ptrlist; + int gsno, fontno, imno, shno, maskshno, trgroupno; + int gsobjno, fontobjno, imobjno, shobjno, maskshobjno, trgroupobjno; +} GL2PSpdfgroup; + +typedef struct { + /* General */ + GLint format, sort, options, colorsize, colormode, buffersize; + char *title, *producer, *filename; + GLboolean boundary, blending; + GLfloat *feedback, offset[2], lastlinewidth; + GLint viewport[4], blendfunc[2], lastfactor; + GL2PSrgba *colormap, lastrgba, threshold, bgcolor; + GLushort lastpattern; + GL2PSvertex lastvertex; + GL2PSlist *primitives, *auxprimitives; + FILE *stream; + GL2PScompress *compress; + GLboolean header; + + /* BSP-specific */ + GLint maxbestroot; + + /* Occlusion culling-specific */ + GLboolean zerosurfacearea; + GL2PSbsptree2d *imagetree; + GL2PSprimitive *primitivetoadd; + + /* PDF-specific */ + int streamlength; + GL2PSlist *pdfprimlist, *pdfgrouplist; + int *xreflist; + int objects_stack; /* available objects */ + int extgs_stack; /* graphics state object number */ + int font_stack; /* font object number */ + int im_stack; /* image object number */ + int trgroupobjects_stack; /* xobject numbers */ + int shader_stack; /* shader object numbers */ + int mshader_stack; /* mask shader object numbers */ + + /* for image map list */ + GL2PSimagemap *imagemap_head; + GL2PSimagemap *imagemap_tail; +} GL2PScontext; + +typedef struct { + void (*printHeader)(void); + void (*printFooter)(void); + void (*beginViewport)(GLint viewport[4]); + GLint (*endViewport)(void); + void (*printPrimitive)(void *data); + void (*printFinalPrimitive)(void); + const char *file_extension; + const char *description; +} GL2PSbackend; + +/* The gl2ps context. gl2ps is not thread safe (we should create a + local GL2PScontext during gl2psBeginPage) */ + +static GL2PScontext *gl2ps = NULL; + +/* Need to forward-declare this one */ + +static GLint gl2psPrintPrimitives(void); + +/********************************************************************* + * + * Utility routines + * + *********************************************************************/ + +static void gl2psMsg(GLint level, const char *fmt, ...) +{ + va_list args; + + if(!(gl2ps->options & GL2PS_SILENT)){ + switch(level){ + case GL2PS_INFO : fprintf(stderr, "GL2PS info: "); break; + case GL2PS_WARNING : fprintf(stderr, "GL2PS warning: "); break; + case GL2PS_ERROR : fprintf(stderr, "GL2PS error: "); break; + } + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + fprintf(stderr, "\n"); + } + /* if(level == GL2PS_ERROR) exit(1); */ +} + +static void *gl2psMalloc(size_t size) +{ + void *ptr; + + if(!size) return(NULL); + ptr = malloc(size); + if(!ptr){ + gl2psMsg(GL2PS_ERROR, "Couldn't allocate requested memory"); + exit(1); + } + return(ptr); +} + +static void *gl2psRealloc(void *ptr, size_t size) +{ + if(!size) return(NULL); + ptr = realloc(ptr, size); + if(!ptr){ + gl2psMsg(GL2PS_ERROR, "Couldn't reallocate requested memory"); + exit(1); + } + return(ptr); +} + +static void gl2psFree(void *ptr) +{ + if(!ptr) return; + free(ptr); +} + +static size_t gl2psWriteBigEndian(unsigned long data, size_t bytes) +{ + size_t i; + size_t size = sizeof(unsigned long); + for(i = 1; i <= bytes; ++i){ + fputc(0xff & (data >> (size-i) * 8), gl2ps->stream); + } + return bytes; +} + +/* zlib compression helper routines */ + +#if defined(GL2PS_HAVE_ZLIB) + +static void gl2psSetupCompress(void) +{ + gl2ps->compress = (GL2PScompress*)gl2psMalloc(sizeof(GL2PScompress)); + gl2ps->compress->src = NULL; + gl2ps->compress->start = NULL; + gl2ps->compress->dest = NULL; + gl2ps->compress->srcLen = 0; + gl2ps->compress->destLen = 0; +} + +static void gl2psFreeCompress(void) +{ + if(!gl2ps->compress) + return; + gl2psFree(gl2ps->compress->start); + gl2psFree(gl2ps->compress->dest); + gl2ps->compress->src = NULL; + gl2ps->compress->start = NULL; + gl2ps->compress->dest = NULL; + gl2ps->compress->srcLen = 0; + gl2ps->compress->destLen = 0; +} + +static int gl2psAllocCompress(unsigned int srcsize) +{ + gl2psFreeCompress(); + + if(!gl2ps->compress || !srcsize) + return GL2PS_ERROR; + + gl2ps->compress->srcLen = srcsize; + gl2ps->compress->destLen = (int)ceil(1.001 * gl2ps->compress->srcLen + 12); + gl2ps->compress->src = (Bytef*)gl2psMalloc(gl2ps->compress->srcLen); + gl2ps->compress->start = gl2ps->compress->src; + gl2ps->compress->dest = (Bytef*)gl2psMalloc(gl2ps->compress->destLen); + + return GL2PS_SUCCESS; +} + +static void *gl2psReallocCompress(unsigned int srcsize) +{ + if(!gl2ps->compress || !srcsize) + return NULL; + + if(srcsize < gl2ps->compress->srcLen) + return gl2ps->compress->start; + + gl2ps->compress->srcLen = srcsize; + gl2ps->compress->destLen = (int)ceil(1.001 * gl2ps->compress->srcLen + 12); + gl2ps->compress->src = (Bytef*)gl2psRealloc(gl2ps->compress->src, + gl2ps->compress->srcLen); + gl2ps->compress->start = gl2ps->compress->src; + gl2ps->compress->dest = (Bytef*)gl2psRealloc(gl2ps->compress->dest, + gl2ps->compress->destLen); + + return gl2ps->compress->start; +} + +static size_t gl2psWriteBigEndianCompress(unsigned long data, size_t bytes) +{ + size_t i; + size_t size = sizeof(unsigned long); + for(i = 1; i <= bytes; ++i){ + *gl2ps->compress->src = (Bytef)(0xff & (data >> (size-i) * 8)); + ++gl2ps->compress->src; + } + return bytes; +} + +static int gl2psDeflate(void) +{ + /* For compatibility with older zlib versions, we use compress(...) + instead of compress2(..., Z_BEST_COMPRESSION) */ + return compress(gl2ps->compress->dest, &gl2ps->compress->destLen, + gl2ps->compress->start, gl2ps->compress->srcLen); +} + +#endif + +static int gl2psPrintf(const char* fmt, ...) +{ + int ret; + va_list args; + +#if defined(GL2PS_HAVE_ZLIB) + unsigned int oldsize = 0; + static char buf[1000]; + if(gl2ps->options & GL2PS_COMPRESS){ + va_start(args, fmt); + ret = vsprintf(buf, fmt, args); + va_end(args); + oldsize = gl2ps->compress->srcLen; + gl2ps->compress->start = (Bytef*)gl2psReallocCompress(oldsize + ret); + memcpy(gl2ps->compress->start+oldsize, buf, ret); + ret = 0; + } + else{ +#endif + va_start(args, fmt); + ret = vfprintf(gl2ps->stream, fmt, args); + va_end(args); +#if defined(GL2PS_HAVE_ZLIB) + } +#endif + return ret; +} + +static void gl2psPrintGzipHeader() +{ +#if defined(GL2PS_HAVE_ZLIB) + char tmp[10] = {'\x1f', '\x8b', /* magic numbers: 0x1f, 0x8b */ + 8, /* compression method: Z_DEFLATED */ + 0, /* flags */ + 0, 0, 0, 0, /* time */ + 2, /* extra flags: max compression */ + '\x03'}; /* OS code: 0x03 (Unix) */ + + if(gl2ps->options & GL2PS_COMPRESS){ + gl2psSetupCompress(); + /* add the gzip file header */ + fwrite(tmp, 10, 1, gl2ps->stream); + } +#endif +} + +static void gl2psPrintGzipFooter() +{ +#if defined(GL2PS_HAVE_ZLIB) + int n; + uLong crc, len; + char tmp[8]; + + if(gl2ps->options & GL2PS_COMPRESS){ + if(Z_OK != gl2psDeflate()){ + gl2psMsg(GL2PS_ERROR, "Zlib deflate error"); + } + else{ + /* determine the length of the header in the zlib stream */ + n = 2; /* CMF+FLG */ + if(gl2ps->compress->dest[1] & (1<<5)){ + n += 4; /* DICTID */ + } + /* write the data, without the zlib header and footer */ + fwrite(gl2ps->compress->dest+n, gl2ps->compress->destLen-(n+4), + 1, gl2ps->stream); + /* add the gzip file footer */ + crc = crc32(0L, gl2ps->compress->start, gl2ps->compress->srcLen); + for(n = 0; n < 4; ++n){ + tmp[n] = (char)(crc & 0xff); + crc >>= 8; + } + len = gl2ps->compress->srcLen; + for(n = 4; n < 8; ++n){ + tmp[n] = (char)(len & 0xff); + len >>= 8; + } + fwrite(tmp, 8, 1, gl2ps->stream); + } + gl2psFreeCompress(); + gl2psFree(gl2ps->compress); + gl2ps->compress = NULL; + } +#endif +} + +/* The list handling routines */ + +static void gl2psListRealloc(GL2PSlist *list, GLint n) +{ + if(!list){ + gl2psMsg(GL2PS_ERROR, "Cannot reallocate NULL list"); + return; + } + if(n <= 0) return; + if(!list->array){ + list->nmax = n; + list->array = (char*)gl2psMalloc(list->nmax * list->size); + } + else{ + if(n > list->nmax){ + list->nmax = ((n - 1) / list->incr + 1) * list->incr; + list->array = (char*)gl2psRealloc(list->array, + list->nmax * list->size); + } + } +} + +static GL2PSlist *gl2psListCreate(GLint n, GLint incr, GLint size) +{ + GL2PSlist *list; + + if(n < 0) n = 0; + if(incr <= 0) incr = 1; + list = (GL2PSlist*)gl2psMalloc(sizeof(GL2PSlist)); + list->nmax = 0; + list->incr = incr; + list->size = size; + list->n = 0; + list->array = NULL; + gl2psListRealloc(list, n); + return(list); +} + +static void gl2psListReset(GL2PSlist *list) +{ + if(!list) return; + list->n = 0; +} + +static void gl2psListDelete(GL2PSlist *list) +{ + if(!list) return; + gl2psFree(list->array); + gl2psFree(list); +} + +static void gl2psListAdd(GL2PSlist *list, void *data) +{ + if(!list){ + gl2psMsg(GL2PS_ERROR, "Cannot add into unallocated list"); + return; + } + list->n++; + gl2psListRealloc(list, list->n); + memcpy(&list->array[(list->n - 1) * list->size], data, list->size); +} + +static int gl2psListNbr(GL2PSlist *list) +{ + if(!list) + return 0; + return(list->n); +} + +static void *gl2psListPointer(GL2PSlist *list, GLint indx) +{ + if(!list){ + gl2psMsg(GL2PS_ERROR, "Cannot point into unallocated list"); + return NULL; + } + if((indx < 0) || (indx >= list->n)){ + gl2psMsg(GL2PS_ERROR, "Wrong list index in gl2psListPointer"); + return NULL; + } + return(&list->array[indx * list->size]); +} + +static void gl2psListSort(GL2PSlist *list, + int (*fcmp)(const void *a, const void *b)) +{ + if(!list) + return; + qsort(list->array, list->n, list->size, fcmp); +} + +static void gl2psListAction(GL2PSlist *list, void (*action)(void *data)) +{ + GLint i; + + for(i = 0; i < gl2psListNbr(list); i++){ + (*action)(gl2psListPointer(list, i)); + } +} + +static void gl2psListActionInverse(GL2PSlist *list, void (*action)(void *data)) +{ + GLint i; + + for(i = gl2psListNbr(list); i > 0; i--){ + (*action)(gl2psListPointer(list, i-1)); + } +} + +#if defined(GL2PS_HAVE_LIBPNG) + +static void gl2psListRead(GL2PSlist *list, int indx, void *data) +{ + if((indx < 0) || (indx >= list->n)) + gl2psMsg(GL2PS_ERROR, "Wrong list index in gl2psListRead"); + memcpy(data, &list->array[indx * list->size], list->size); +} + +static void gl2psEncodeBase64Block(unsigned char in[3], unsigned char out[4], int len) +{ + static const char cb64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + out[0] = cb64[ in[0] >> 2 ]; + out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ]; + out[2] = (len > 1) ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] : '='; + out[3] = (len > 2) ? cb64[ in[2] & 0x3f ] : '='; +} + +static void gl2psListEncodeBase64(GL2PSlist *list) +{ + unsigned char *buffer, in[3], out[4]; + int i, n, indx, len; + + n = list->n * list->size; + buffer = (unsigned char*)gl2psMalloc(n * sizeof(unsigned char)); + memcpy(buffer, list->array, n * sizeof(unsigned char)); + gl2psListReset(list); + + indx = 0; + while(indx < n) { + len = 0; + for(i = 0; i < 3; i++) { + if(indx < n){ + in[i] = buffer[indx]; + len++; + } + else{ + in[i] = 0; + } + indx++; + } + if(len) { + gl2psEncodeBase64Block(in, out, len); + for(i = 0; i < 4; i++) + gl2psListAdd(list, &out[i]); + } + } + gl2psFree(buffer); +} + +#endif + +/* Helpers for rgba colors */ + +static GLboolean gl2psSameColor(GL2PSrgba rgba1, GL2PSrgba rgba2) +{ + if(!GL2PS_ZERO(rgba1[0] - rgba2[0]) || + !GL2PS_ZERO(rgba1[1] - rgba2[1]) || + !GL2PS_ZERO(rgba1[2] - rgba2[2])) + return GL_FALSE; + return GL_TRUE; +} + +static GLboolean gl2psVertsSameColor(const GL2PSprimitive *prim) +{ + int i; + + for(i = 1; i < prim->numverts; i++){ + if(!gl2psSameColor(prim->verts[0].rgba, prim->verts[i].rgba)){ + return GL_FALSE; + } + } + return GL_TRUE; +} + +static GLboolean gl2psSameColorThreshold(int n, GL2PSrgba rgba[], + GL2PSrgba threshold) +{ + int i; + + if(n < 2) return GL_TRUE; + + for(i = 1; i < n; i++){ + if(fabs(rgba[0][0] - rgba[i][0]) > threshold[0] || + fabs(rgba[0][1] - rgba[i][1]) > threshold[1] || + fabs(rgba[0][2] - rgba[i][2]) > threshold[2]) + return GL_FALSE; + } + + return GL_TRUE; +} + +static void gl2psSetLastColor(GL2PSrgba rgba) +{ + int i; + for(i = 0; i < 3; ++i){ + gl2ps->lastrgba[i] = rgba[i]; + } +} + +static GLfloat gl2psGetRGB(GL2PSimage *im, GLuint x, GLuint y, + GLfloat *red, GLfloat *green, GLfloat *blue) +{ + + GLsizei width = im->width; + GLsizei height = im->height; + GLfloat *pixels = im->pixels; + GLfloat *pimag; + + /* OpenGL image is from down to up, PS image is up to down */ + switch(im->format){ + case GL_RGBA: + pimag = pixels + 4 * (width * (height - 1 - y) + x); + break; + case GL_RGB: + default: + pimag = pixels + 3 * (width * (height - 1 - y) + x); + break; + } + *red = *pimag; pimag++; + *green = *pimag; pimag++; + *blue = *pimag; pimag++; + + return (im->format == GL_RGBA) ? *pimag : 1.0F; +} + +/* Helper routines for pixmaps */ + +static GL2PSimage *gl2psCopyPixmap(GL2PSimage *im) +{ + int size; + GL2PSimage *image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage)); + + image->width = im->width; + image->height = im->height; + image->format = im->format; + image->type = im->type; + + switch(image->format){ + case GL_RGBA: + size = image->height * image->width * 4 * sizeof(GLfloat); + break; + case GL_RGB: + default: + size = image->height * image->width * 3 * sizeof(GLfloat); + break; + } + + image->pixels = (GLfloat*)gl2psMalloc(size); + memcpy(image->pixels, im->pixels, size); + + return image; +} + +static void gl2psFreePixmap(GL2PSimage *im) +{ + if(!im) + return; + gl2psFree(im->pixels); + gl2psFree(im); +} + +#if defined(GL2PS_HAVE_LIBPNG) + +#if !defined(png_jmpbuf) +# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) +#endif + +static void gl2psUserWritePNG(png_structp png_ptr, png_bytep data, png_size_t length) +{ + unsigned int i; + GL2PSlist *png = (GL2PSlist*)png_get_io_ptr(png_ptr); + for(i = 0; i < length; i++) + gl2psListAdd(png, &data[i]); +} + +static void gl2psUserFlushPNG(png_structp png_ptr) +{ + (void)png_ptr; // to avoid warning about unused parameter +} + +static void gl2psConvertPixmapToPNG(GL2PSimage *pixmap, GL2PSlist *png) +{ + png_structp png_ptr; + png_infop info_ptr; + unsigned char *row_data; + GLfloat dr, dg, db; + int row, col; + + if(!(png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL))) + return; + + if(!(info_ptr = png_create_info_struct(png_ptr))){ + png_destroy_write_struct(&png_ptr, NULL); + return; + } + + if(setjmp(png_jmpbuf(png_ptr))) { + png_destroy_write_struct(&png_ptr, &info_ptr); + return; + } + + png_set_write_fn(png_ptr, (void *)png, gl2psUserWritePNG, gl2psUserFlushPNG); + png_set_compression_level(png_ptr, Z_DEFAULT_COMPRESSION); + png_set_IHDR(png_ptr, info_ptr, pixmap->width, pixmap->height, 8, + PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE); + png_write_info(png_ptr, info_ptr); + + row_data = (unsigned char*)gl2psMalloc(3 * pixmap->width * sizeof(unsigned char)); + for(row = 0; row < pixmap->height; row++){ + for(col = 0; col < pixmap->width; col++){ + gl2psGetRGB(pixmap, col, row, &dr, &dg, &db); + row_data[3*col] = (unsigned char)(255. * dr); + row_data[3*col+1] = (unsigned char)(255. * dg); + row_data[3*col+2] = (unsigned char)(255. * db); + } + png_write_row(png_ptr, (png_bytep)row_data); + } + gl2psFree(row_data); + + png_write_end(png_ptr, info_ptr); + png_destroy_write_struct(&png_ptr, &info_ptr); +} + +#endif + +/* Helper routines for text strings */ + +static GLint gl2psAddText(GLint type, const char *str, const char *fontname, + GLshort fontsize, GLint alignment, GLfloat angle) +{ + GLfloat pos[4]; + GL2PSprimitive *prim; + GLboolean valid; + + if(!gl2ps || !str || !fontname) return GL2PS_UNINITIALIZED; + + if(gl2ps->options & GL2PS_NO_TEXT) return GL2PS_SUCCESS; + + glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid); + if(GL_FALSE == valid) return GL2PS_SUCCESS; /* the primitive is culled */ + + glGetFloatv(GL_CURRENT_RASTER_POSITION, pos); + + prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + prim->type = type; + prim->boundary = 0; + prim->numverts = 1; + prim->verts = (GL2PSvertex*)gl2psMalloc(sizeof(GL2PSvertex)); + prim->verts[0].xyz[0] = pos[0]; + prim->verts[0].xyz[1] = pos[1]; + prim->verts[0].xyz[2] = pos[2]; + prim->culled = 0; + prim->offset = 0; + prim->pattern = 0; + prim->factor = 0; + prim->width = 1; + glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba); + prim->data.text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring)); + prim->data.text->str = (char*)gl2psMalloc((strlen(str)+1)*sizeof(char)); + strcpy(prim->data.text->str, str); + prim->data.text->fontname = (char*)gl2psMalloc((strlen(fontname)+1)*sizeof(char)); + strcpy(prim->data.text->fontname, fontname); + prim->data.text->fontsize = fontsize; + prim->data.text->alignment = alignment; + prim->data.text->angle = angle; + + gl2psListAdd(gl2ps->auxprimitives, &prim); + glPassThrough(GL2PS_TEXT_TOKEN); + + return GL2PS_SUCCESS; +} + +static GL2PSstring *gl2psCopyText(GL2PSstring *t) +{ + GL2PSstring *text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring)); + text->str = (char*)gl2psMalloc((strlen(t->str)+1)*sizeof(char)); + strcpy(text->str, t->str); + text->fontname = (char*)gl2psMalloc((strlen(t->fontname)+1)*sizeof(char)); + strcpy(text->fontname, t->fontname); + text->fontsize = t->fontsize; + text->alignment = t->alignment; + text->angle = t->angle; + + return text; +} + +static void gl2psFreeText(GL2PSstring *text) +{ + if(!text) + return; + gl2psFree(text->str); + gl2psFree(text->fontname); + gl2psFree(text); +} + +/* Helpers for blending modes */ + +static GLboolean gl2psSupportedBlendMode(GLenum sfactor, GLenum dfactor) +{ + /* returns TRUE if gl2ps supports the argument combination: only two + blending modes have been implemented so far */ + + if( (sfactor == GL_SRC_ALPHA && dfactor == GL_ONE_MINUS_SRC_ALPHA) || + (sfactor == GL_ONE && dfactor == GL_ZERO) ) + return GL_TRUE; + return GL_FALSE; +} + +static void gl2psAdaptVertexForBlending(GL2PSvertex *v) +{ + /* Transforms vertex depending on the actual blending function - + currently the vertex v is considered as source vertex and his + alpha value is changed to 1.0 if source blending GL_ONE is + active. This might be extended in the future */ + + if(!v || !gl2ps) + return; + + if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){ + v->rgba[3] = 1.0F; + return; + } + + switch(gl2ps->blendfunc[0]){ + case GL_ONE: + v->rgba[3] = 1.0F; + break; + default: + break; + } +} + +static void gl2psAssignTriangleProperties(GL2PStriangle *t) +{ + /* int i; */ + + t->prop = T_VAR_COLOR; + + /* Uncommenting the following lines activates an even more fine + grained distinction between triangle types - please don't delete, + a remarkable amount of PDF handling code inside this file depends + on it if activated */ + /* + t->prop = T_CONST_COLOR; + for(i = 0; i < 3; ++i){ + if(!GL2PS_ZERO(t->vertex[0].rgba[i] - t->vertex[1].rgba[i]) || + !GL2PS_ZERO(t->vertex[1].rgba[i] - t->vertex[2].rgba[i])){ + t->prop = T_VAR_COLOR; + break; + } + } + */ + + if(!GL2PS_ZERO(t->vertex[0].rgba[3] - t->vertex[1].rgba[3]) || + !GL2PS_ZERO(t->vertex[1].rgba[3] - t->vertex[2].rgba[3])){ + t->prop |= T_VAR_ALPHA; + } + else{ + if(t->vertex[0].rgba[3] < 1) + t->prop |= T_ALPHA_LESS_1; + else + t->prop |= T_ALPHA_1; + } +} + +static void gl2psFillTriangleFromPrimitive(GL2PStriangle *t, GL2PSprimitive *p, + GLboolean assignprops) +{ + t->vertex[0] = p->verts[0]; + t->vertex[1] = p->verts[1]; + t->vertex[2] = p->verts[2]; + if(GL_TRUE == assignprops) + gl2psAssignTriangleProperties(t); +} + +static void gl2psInitTriangle(GL2PStriangle *t) +{ + int i; + GL2PSvertex vertex = { {-1.0F, -1.0F, -1.0F}, {-1.0F, -1.0F, -1.0F, -1.0F} }; + for(i = 0; i < 3; i++) + t->vertex[i] = vertex; + t->prop = T_UNDEFINED; +} + +/* Miscellaneous helper routines */ + +static GL2PSprimitive *gl2psCopyPrimitive(GL2PSprimitive *p) +{ + GL2PSprimitive *prim; + + if(!p){ + gl2psMsg(GL2PS_ERROR, "Trying to copy an empty primitive"); + return NULL; + } + + prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + + prim->type = p->type; + prim->numverts = p->numverts; + prim->boundary = p->boundary; + prim->offset = p->offset; + prim->pattern = p->pattern; + prim->factor = p->factor; + prim->culled = p->culled; + prim->width = p->width; + prim->verts = (GL2PSvertex*)gl2psMalloc(p->numverts*sizeof(GL2PSvertex)); + memcpy(prim->verts, p->verts, p->numverts * sizeof(GL2PSvertex)); + + switch(prim->type){ + case GL2PS_PIXMAP : + prim->data.image = gl2psCopyPixmap(p->data.image); + break; + case GL2PS_TEXT : + case GL2PS_SPECIAL : + prim->data.text = gl2psCopyText(p->data.text); + break; + default: + break; + } + + return prim; +} + +static GLboolean gl2psSamePosition(GL2PSxyz p1, GL2PSxyz p2) +{ + if(!GL2PS_ZERO(p1[0] - p2[0]) || + !GL2PS_ZERO(p1[1] - p2[1]) || + !GL2PS_ZERO(p1[2] - p2[2])) + return GL_FALSE; + return GL_TRUE; +} + +/********************************************************************* + * + * 3D sorting routines + * + *********************************************************************/ + +static GLfloat gl2psComparePointPlane(GL2PSxyz point, GL2PSplane plane) +{ + return(plane[0] * point[0] + + plane[1] * point[1] + + plane[2] * point[2] + + plane[3]); +} + +static GLfloat gl2psPsca(GLfloat *a, GLfloat *b) +{ + return(a[0]*b[0] + a[1]*b[1] + a[2]*b[2]); +} + +static void gl2psPvec(GLfloat *a, GLfloat *b, GLfloat *c) +{ + c[0] = a[1]*b[2] - a[2]*b[1]; + c[1] = a[2]*b[0] - a[0]*b[2]; + c[2] = a[0]*b[1] - a[1]*b[0]; +} + +static GLfloat gl2psNorm(GLfloat *a) +{ + return (GLfloat)sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]); +} + +static void gl2psGetNormal(GLfloat *a, GLfloat *b, GLfloat *c) +{ + GLfloat norm; + + gl2psPvec(a, b, c); + if(!GL2PS_ZERO(norm = gl2psNorm(c))){ + c[0] = c[0] / norm; + c[1] = c[1] / norm; + c[2] = c[2] / norm; + } + else{ + /* The plane is still wrong despite our tests in gl2psGetPlane. + Let's return a dummy value for now (this is a hack: we should + do more intelligent tests in GetPlane) */ + c[0] = c[1] = 0.0F; + c[2] = 1.0F; + } +} + +static void gl2psGetPlane(GL2PSprimitive *prim, GL2PSplane plane) +{ + GL2PSxyz v = {0.0F, 0.0F, 0.0F}, w = {0.0F, 0.0F, 0.0F}; + + switch(prim->type){ + case GL2PS_TRIANGLE : + case GL2PS_QUADRANGLE : + v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; + v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; + v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; + w[0] = prim->verts[2].xyz[0] - prim->verts[0].xyz[0]; + w[1] = prim->verts[2].xyz[1] - prim->verts[0].xyz[1]; + w[2] = prim->verts[2].xyz[2] - prim->verts[0].xyz[2]; + if((GL2PS_ZERO(v[0]) && GL2PS_ZERO(v[1]) && GL2PS_ZERO(v[2])) || + (GL2PS_ZERO(w[0]) && GL2PS_ZERO(w[1]) && GL2PS_ZERO(w[2]))){ + plane[0] = plane[1] = 0.0F; + plane[2] = 1.0F; + plane[3] = -prim->verts[0].xyz[2]; + } + else{ + gl2psGetNormal(v, w, plane); + plane[3] = + - plane[0] * prim->verts[0].xyz[0] + - plane[1] * prim->verts[0].xyz[1] + - plane[2] * prim->verts[0].xyz[2]; + } + break; + case GL2PS_LINE : + v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; + v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; + v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; + if(GL2PS_ZERO(v[0]) && GL2PS_ZERO(v[1]) && GL2PS_ZERO(v[2])){ + plane[0] = plane[1] = 0.0F; + plane[2] = 1.0F; + plane[3] = -prim->verts[0].xyz[2]; + } + else{ + if(GL2PS_ZERO(v[0])) w[0] = 1.0F; + else if(GL2PS_ZERO(v[1])) w[1] = 1.0F; + else w[2] = 1.0F; + gl2psGetNormal(v, w, plane); + plane[3] = + - plane[0] * prim->verts[0].xyz[0] + - plane[1] * prim->verts[0].xyz[1] + - plane[2] * prim->verts[0].xyz[2]; + } + break; + case GL2PS_POINT : + case GL2PS_PIXMAP : + case GL2PS_TEXT : + case GL2PS_SPECIAL : + case GL2PS_IMAGEMAP: + plane[0] = plane[1] = 0.0F; + plane[2] = 1.0F; + plane[3] = -prim->verts[0].xyz[2]; + break; + default : + gl2psMsg(GL2PS_ERROR, "Unknown primitive type in BSP tree"); + plane[0] = plane[1] = plane[3] = 0.0F; + plane[2] = 1.0F; + break; + } +} + +static void gl2psCutEdge(GL2PSvertex *a, GL2PSvertex *b, GL2PSplane plane, + GL2PSvertex *c) +{ + GL2PSxyz v; + GLfloat sect; + + v[0] = b->xyz[0] - a->xyz[0]; + v[1] = b->xyz[1] - a->xyz[1]; + v[2] = b->xyz[2] - a->xyz[2]; + + sect = - gl2psComparePointPlane(a->xyz, plane) / gl2psPsca(plane, v); + + c->xyz[0] = a->xyz[0] + v[0] * sect; + c->xyz[1] = a->xyz[1] + v[1] * sect; + c->xyz[2] = a->xyz[2] + v[2] * sect; + + c->rgba[0] = (1 - sect) * a->rgba[0] + sect * b->rgba[0]; + c->rgba[1] = (1 - sect) * a->rgba[1] + sect * b->rgba[1]; + c->rgba[2] = (1 - sect) * a->rgba[2] + sect * b->rgba[2]; + c->rgba[3] = (1 - sect) * a->rgba[3] + sect * b->rgba[3]; +} + +static void gl2psCreateSplitPrimitive(GL2PSprimitive *parent, GL2PSplane plane, + GL2PSprimitive *child, GLshort numverts, + GLshort *index0, GLshort *index1) +{ + GLshort i; + + if(parent->type == GL2PS_IMAGEMAP){ + child->type = GL2PS_IMAGEMAP; + child->data.image = parent->data.image; + } + else{ + if(numverts > 4){ + gl2psMsg(GL2PS_WARNING, "%d vertices in polygon", numverts); + numverts = 4; + } + switch(numverts){ + case 1 : child->type = GL2PS_POINT; break; + case 2 : child->type = GL2PS_LINE; break; + case 3 : child->type = GL2PS_TRIANGLE; break; + case 4 : child->type = GL2PS_QUADRANGLE; break; + default: child->type = GL2PS_NO_TYPE; break; + } + } + + child->boundary = 0; /* FIXME: not done! */ + child->culled = parent->culled; + child->offset = parent->offset; + child->pattern = parent->pattern; + child->factor = parent->factor; + child->width = parent->width; + child->numverts = numverts; + child->verts = (GL2PSvertex*)gl2psMalloc(numverts * sizeof(GL2PSvertex)); + + for(i = 0; i < numverts; i++){ + if(index1[i] < 0){ + child->verts[i] = parent->verts[index0[i]]; + } + else{ + gl2psCutEdge(&parent->verts[index0[i]], &parent->verts[index1[i]], + plane, &child->verts[i]); + } + } +} + +static void gl2psAddIndex(GLshort *index0, GLshort *index1, GLshort *nb, + GLshort i, GLshort j) +{ + GLint k; + + for(k = 0; k < *nb; k++){ + if((index0[k] == i && index1[k] == j) || + (index1[k] == i && index0[k] == j)) return; + } + index0[*nb] = i; + index1[*nb] = j; + (*nb)++; +} + +static GLshort gl2psGetIndex(GLshort i, GLshort num) +{ + return (i < num - 1) ? i + 1 : 0; +} + +static GLint gl2psTestSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane) +{ + GLint type = GL2PS_COINCIDENT; + GLshort i, j; + GLfloat d[5]; + + for(i = 0; i < prim->numverts; i++){ + d[i] = gl2psComparePointPlane(prim->verts[i].xyz, plane); + } + + if(prim->numverts < 2){ + return 0; + } + else{ + for(i = 0; i < prim->numverts; i++){ + j = gl2psGetIndex(i, prim->numverts); + if(d[j] > GL2PS_EPSILON){ + if(type == GL2PS_COINCIDENT) type = GL2PS_IN_BACK_OF; + else if(type != GL2PS_IN_BACK_OF) return 1; + if(d[i] < -GL2PS_EPSILON) return 1; + } + else if(d[j] < -GL2PS_EPSILON){ + if(type == GL2PS_COINCIDENT) type = GL2PS_IN_FRONT_OF; + else if(type != GL2PS_IN_FRONT_OF) return 1; + if(d[i] > GL2PS_EPSILON) return 1; + } + } + } + return 0; +} + +static GLint gl2psSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane, + GL2PSprimitive **front, GL2PSprimitive **back) +{ + GLshort i, j, in = 0, out = 0, in0[5], in1[5], out0[5], out1[5]; + GLint type; + GLfloat d[5]; + + type = GL2PS_COINCIDENT; + + for(i = 0; i < prim->numverts; i++){ + d[i] = gl2psComparePointPlane(prim->verts[i].xyz, plane); + } + + switch(prim->type){ + case GL2PS_POINT : + if(d[0] > GL2PS_EPSILON) type = GL2PS_IN_BACK_OF; + else if(d[0] < -GL2PS_EPSILON) type = GL2PS_IN_FRONT_OF; + else type = GL2PS_COINCIDENT; + break; + default : + for(i = 0; i < prim->numverts; i++){ + j = gl2psGetIndex(i, prim->numverts); + if(d[j] > GL2PS_EPSILON){ + if(type == GL2PS_COINCIDENT) type = GL2PS_IN_BACK_OF; + else if(type != GL2PS_IN_BACK_OF) type = GL2PS_SPANNING; + if(d[i] < -GL2PS_EPSILON){ + gl2psAddIndex(in0, in1, &in, i, j); + gl2psAddIndex(out0, out1, &out, i, j); + type = GL2PS_SPANNING; + } + gl2psAddIndex(out0, out1, &out, j, -1); + } + else if(d[j] < -GL2PS_EPSILON){ + if(type == GL2PS_COINCIDENT) type = GL2PS_IN_FRONT_OF; + else if(type != GL2PS_IN_FRONT_OF) type = GL2PS_SPANNING; + if(d[i] > GL2PS_EPSILON){ + gl2psAddIndex(in0, in1, &in, i, j); + gl2psAddIndex(out0, out1, &out, i, j); + type = GL2PS_SPANNING; + } + gl2psAddIndex(in0, in1, &in, j, -1); + } + else{ + gl2psAddIndex(in0, in1, &in, j, -1); + gl2psAddIndex(out0, out1, &out, j, -1); + } + } + break; + } + + if(type == GL2PS_SPANNING){ + *back = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + *front = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + gl2psCreateSplitPrimitive(prim, plane, *back, out, out0, out1); + gl2psCreateSplitPrimitive(prim, plane, *front, in, in0, in1); + } + + return type; +} + +static void gl2psDivideQuad(GL2PSprimitive *quad, + GL2PSprimitive **t1, GL2PSprimitive **t2) +{ + *t1 = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + *t2 = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + (*t1)->type = (*t2)->type = GL2PS_TRIANGLE; + (*t1)->numverts = (*t2)->numverts = 3; + (*t1)->culled = (*t2)->culled = quad->culled; + (*t1)->offset = (*t2)->offset = quad->offset; + (*t1)->pattern = (*t2)->pattern = quad->pattern; + (*t1)->factor = (*t2)->factor = quad->factor; + (*t1)->width = (*t2)->width = quad->width; + (*t1)->verts = (GL2PSvertex*)gl2psMalloc(3 * sizeof(GL2PSvertex)); + (*t2)->verts = (GL2PSvertex*)gl2psMalloc(3 * sizeof(GL2PSvertex)); + (*t1)->verts[0] = quad->verts[0]; + (*t1)->verts[1] = quad->verts[1]; + (*t1)->verts[2] = quad->verts[2]; + (*t1)->boundary = ((quad->boundary & 1) ? 1 : 0) | ((quad->boundary & 2) ? 2 : 0); + (*t2)->verts[0] = quad->verts[0]; + (*t2)->verts[1] = quad->verts[2]; + (*t2)->verts[2] = quad->verts[3]; + (*t1)->boundary = ((quad->boundary & 4) ? 2 : 0) | ((quad->boundary & 4) ? 2 : 0); +} + +static int gl2psCompareDepth(const void *a, const void *b) +{ + GL2PSprimitive *q, *w; + GLfloat dq = 0.0F, dw = 0.0F, diff; + int i; + + q = *(GL2PSprimitive**)a; + w = *(GL2PSprimitive**)b; + + for(i = 0; i < q->numverts; i++){ + dq += q->verts[i].xyz[2]; + } + dq /= (GLfloat)q->numverts; + + for(i = 0; i < w->numverts; i++){ + dw += w->verts[i].xyz[2]; + } + dw /= (GLfloat)w->numverts; + + diff = dq - dw; + if(diff > 0.){ + return -1; + } + else if(diff < 0.){ + return 1; + } + else{ + return 0; + } +} + +static int gl2psTrianglesFirst(const void *a, const void *b) +{ + GL2PSprimitive *q, *w; + + q = *(GL2PSprimitive**)a; + w = *(GL2PSprimitive**)b; + return(q->type < w->type ? 1 : -1); +} + +static GLint gl2psFindRoot(GL2PSlist *primitives, GL2PSprimitive **root) +{ + GLint i, j, count, best = 1000000, indx = 0; + GL2PSprimitive *prim1, *prim2; + GL2PSplane plane; + GLint maxp; + + if(!gl2psListNbr(primitives)){ + gl2psMsg(GL2PS_ERROR, "Cannot fint root in empty primitive list"); + return 0; + } + + *root = *(GL2PSprimitive**)gl2psListPointer(primitives, 0); + + if(gl2ps->options & GL2PS_BEST_ROOT){ + maxp = gl2psListNbr(primitives); + if(maxp > gl2ps->maxbestroot){ + maxp = gl2ps->maxbestroot; + } + for(i = 0; i < maxp; i++){ + prim1 = *(GL2PSprimitive**)gl2psListPointer(primitives, i); + gl2psGetPlane(prim1, plane); + count = 0; + for(j = 0; j < gl2psListNbr(primitives); j++){ + if(j != i){ + prim2 = *(GL2PSprimitive**)gl2psListPointer(primitives, j); + count += gl2psTestSplitPrimitive(prim2, plane); + } + if(count > best) break; + } + if(count < best){ + best = count; + indx = i; + *root = prim1; + if(!count) return indx; + } + } + /* if(indx) gl2psMsg(GL2PS_INFO, "GL2PS_BEST_ROOT was worth it: %d", indx); */ + return indx; + } + else{ + return 0; + } +} + +static void gl2psFreeImagemap(GL2PSimagemap *list){ + GL2PSimagemap *next; + while(list != NULL){ + next = list->next; + gl2psFree(list->image->pixels); + gl2psFree(list->image); + gl2psFree(list); + list = next; + } +} + +static void gl2psFreePrimitive(void *data) +{ + GL2PSprimitive *q; + + q = *(GL2PSprimitive**)data; + gl2psFree(q->verts); + if(q->type == GL2PS_TEXT || q->type == GL2PS_SPECIAL){ + gl2psFreeText(q->data.text); + } + else if(q->type == GL2PS_PIXMAP){ + gl2psFreePixmap(q->data.image); + } + gl2psFree(q); +} + +static void gl2psAddPrimitiveInList(GL2PSprimitive *prim, GL2PSlist *list) +{ + GL2PSprimitive *t1, *t2; + + if(prim->type != GL2PS_QUADRANGLE){ + gl2psListAdd(list, &prim); + } + else{ + gl2psDivideQuad(prim, &t1, &t2); + gl2psListAdd(list, &t1); + gl2psListAdd(list, &t2); + gl2psFreePrimitive(&prim); + } + +} + +static void gl2psFreeBspTree(GL2PSbsptree **tree) +{ + if(*tree){ + if((*tree)->back) gl2psFreeBspTree(&(*tree)->back); + if((*tree)->primitives){ + gl2psListAction((*tree)->primitives, gl2psFreePrimitive); + gl2psListDelete((*tree)->primitives); + } + if((*tree)->front) gl2psFreeBspTree(&(*tree)->front); + gl2psFree(*tree); + *tree = NULL; + } +} + +static GLboolean gl2psGreater(GLfloat f1, GLfloat f2) +{ + if(f1 > f2) return GL_TRUE; + else return GL_FALSE; +} + +static GLboolean gl2psLess(GLfloat f1, GLfloat f2) +{ + if(f1 < f2) return GL_TRUE; + else return GL_FALSE; +} + +static void gl2psBuildBspTree(GL2PSbsptree *tree, GL2PSlist *primitives) +{ + GL2PSprimitive *prim, *frontprim = NULL, *backprim = NULL; + GL2PSlist *frontlist, *backlist; + GLint i, indx; + + tree->front = NULL; + tree->back = NULL; + tree->primitives = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); + indx = gl2psFindRoot(primitives, &prim); + gl2psGetPlane(prim, tree->plane); + gl2psAddPrimitiveInList(prim, tree->primitives); + + frontlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); + backlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); + + for(i = 0; i < gl2psListNbr(primitives); i++){ + if(i != indx){ + prim = *(GL2PSprimitive**)gl2psListPointer(primitives,i); + switch(gl2psSplitPrimitive(prim, tree->plane, &frontprim, &backprim)){ + case GL2PS_COINCIDENT: + gl2psAddPrimitiveInList(prim, tree->primitives); + break; + case GL2PS_IN_BACK_OF: + gl2psAddPrimitiveInList(prim, backlist); + break; + case GL2PS_IN_FRONT_OF: + gl2psAddPrimitiveInList(prim, frontlist); + break; + case GL2PS_SPANNING: + gl2psAddPrimitiveInList(backprim, backlist); + gl2psAddPrimitiveInList(frontprim, frontlist); + gl2psFreePrimitive(&prim); + break; + } + } + } + + if(gl2psListNbr(tree->primitives)){ + gl2psListSort(tree->primitives, gl2psTrianglesFirst); + } + + if(gl2psListNbr(frontlist)){ + gl2psListSort(frontlist, gl2psTrianglesFirst); + tree->front = (GL2PSbsptree*)gl2psMalloc(sizeof(GL2PSbsptree)); + gl2psBuildBspTree(tree->front, frontlist); + } + else{ + gl2psListDelete(frontlist); + } + + if(gl2psListNbr(backlist)){ + gl2psListSort(backlist, gl2psTrianglesFirst); + tree->back = (GL2PSbsptree*)gl2psMalloc(sizeof(GL2PSbsptree)); + gl2psBuildBspTree(tree->back, backlist); + } + else{ + gl2psListDelete(backlist); + } + + gl2psListDelete(primitives); +} + +static void gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsilon, + GLboolean (*compare)(GLfloat f1, GLfloat f2), + void (*action)(void *data), int inverse) +{ + GLfloat result; + + if(!tree) return; + + result = gl2psComparePointPlane(eye, tree->plane); + + if(GL_TRUE == compare(result, epsilon)){ + gl2psTraverseBspTree(tree->back, eye, epsilon, compare, action, inverse); + if(inverse){ + gl2psListActionInverse(tree->primitives, action); + } + else{ + gl2psListAction(tree->primitives, action); + } + gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse); + } + else if(GL_TRUE == compare(-epsilon, result)){ + gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse); + if(inverse){ + gl2psListActionInverse(tree->primitives, action); + } + else{ + gl2psListAction(tree->primitives, action); + } + gl2psTraverseBspTree(tree->back, eye, epsilon, compare, action, inverse); + } + else{ + gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse); + gl2psTraverseBspTree(tree->back, eye, epsilon, compare, action, inverse); + } +} + +static void gl2psRescaleAndOffset() +{ + GL2PSprimitive *prim; + GLfloat minZ, maxZ, rangeZ, scaleZ; + GLfloat factor, units, area, dZ, dZdX, dZdY, maxdZ; + int i, j; + + if(!gl2psListNbr(gl2ps->primitives)) + return; + + /* get z-buffer range */ + prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, 0); + minZ = maxZ = prim->verts[0].xyz[2]; + for(i = 1; i < prim->numverts; i++){ + if(prim->verts[i].xyz[2] < minZ) minZ = prim->verts[i].xyz[2]; + if(prim->verts[i].xyz[2] > maxZ) maxZ = prim->verts[i].xyz[2]; + } + for(i = 1; i < gl2psListNbr(gl2ps->primitives); i++){ + prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, i); + for(j = 0; j < prim->numverts; j++){ + if(prim->verts[j].xyz[2] < minZ) minZ = prim->verts[j].xyz[2]; + if(prim->verts[j].xyz[2] > maxZ) maxZ = prim->verts[j].xyz[2]; + } + } + rangeZ = (maxZ - minZ); + + /* rescale z-buffer coordinate in [0,GL2PS_ZSCALE], to make it of + the same order of magnitude as the x and y coordinates */ + scaleZ = GL2PS_ZERO(rangeZ) ? GL2PS_ZSCALE : (GL2PS_ZSCALE / rangeZ); + /* avoid precision loss (we use floats!) */ + if(scaleZ > 100000.F) scaleZ = 100000.F; + + /* apply offsets */ + for(i = 0; i < gl2psListNbr(gl2ps->primitives); i++){ + prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, i); + for(j = 0; j < prim->numverts; j++){ + prim->verts[j].xyz[2] = (prim->verts[j].xyz[2] - minZ) * scaleZ; + } + if((gl2ps->options & GL2PS_SIMPLE_LINE_OFFSET) && + (prim->type == GL2PS_LINE)){ + if(gl2ps->sort == GL2PS_SIMPLE_SORT){ + prim->verts[0].xyz[2] -= GL2PS_ZOFFSET_LARGE; + prim->verts[1].xyz[2] -= GL2PS_ZOFFSET_LARGE; + } + else{ + prim->verts[0].xyz[2] -= GL2PS_ZOFFSET; + prim->verts[1].xyz[2] -= GL2PS_ZOFFSET; + } + } + else if(prim->offset && (prim->type == GL2PS_TRIANGLE)){ + factor = gl2ps->offset[0]; + units = gl2ps->offset[1]; + area = + (prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * + (prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) - + (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * + (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]); + dZdX = + ((prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) * + (prim->verts[1].xyz[2] - prim->verts[0].xyz[2]) - + (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]) * + (prim->verts[2].xyz[2] - prim->verts[1].xyz[2])) / area; + dZdY = + ((prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * + (prim->verts[2].xyz[2] - prim->verts[1].xyz[2]) - + (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * + (prim->verts[1].xyz[2] - prim->verts[0].xyz[2])) / area; + maxdZ = (GLfloat)sqrt(dZdX * dZdX + dZdY * dZdY); + dZ = factor * maxdZ + units; + prim->verts[0].xyz[2] += dZ; + prim->verts[1].xyz[2] += dZ; + prim->verts[2].xyz[2] += dZ; + } + } +} + +/********************************************************************* + * + * 2D sorting routines (for occlusion culling) + * + *********************************************************************/ + +static GLint gl2psGetPlaneFromPoints(GL2PSxyz a, GL2PSxyz b, GL2PSplane plane) +{ + GLfloat n; + + plane[0] = b[1] - a[1]; + plane[1] = a[0] - b[0]; + n = (GLfloat)sqrt(plane[0]*plane[0] + plane[1]*plane[1]); + plane[2] = 0.0F; + if(!GL2PS_ZERO(n)){ + plane[0] /= n; + plane[1] /= n; + plane[3] = -plane[0]*a[0]-plane[1]*a[1]; + return 1; + } + else{ + plane[0] = -1.0F; + plane[1] = 0.0F; + plane[3] = a[0]; + return 0; + } +} + +static void gl2psFreeBspImageTree(GL2PSbsptree2d **tree) +{ + if(*tree){ + if((*tree)->back) gl2psFreeBspImageTree(&(*tree)->back); + if((*tree)->front) gl2psFreeBspImageTree(&(*tree)->front); + gl2psFree(*tree); + *tree = NULL; + } +} + +static GLint gl2psCheckPoint(GL2PSxyz point, GL2PSplane plane) +{ + GLfloat pt_dis; + + pt_dis = gl2psComparePointPlane(point, plane); + if(pt_dis > GL2PS_EPSILON) return GL2PS_POINT_INFRONT; + else if(pt_dis < -GL2PS_EPSILON) return GL2PS_POINT_BACK; + else return GL2PS_POINT_COINCIDENT; +} + +static void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim, + GL2PSbsptree2d **tree) +{ + GLint ret = 0; + GLint i; + GLint offset = 0; + GL2PSbsptree2d *head = NULL, *cur = NULL; + + if((*tree == NULL) && (prim->numverts > 2)){ + head = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); + for(i = 0; i < prim->numverts-1; i++){ + if(!gl2psGetPlaneFromPoints(prim->verts[i].xyz, + prim->verts[i+1].xyz, + head->plane)){ + if(prim->numverts-i > 3){ + offset++; + } + else{ + gl2psFree(head); + return; + } + } + else{ + break; + } + } + head->back = NULL; + head->front = NULL; + for(i = 2+offset; i < prim->numverts; i++){ + ret = gl2psCheckPoint(prim->verts[i].xyz, head->plane); + if(ret != GL2PS_POINT_COINCIDENT) break; + } + switch(ret){ + case GL2PS_POINT_INFRONT : + cur = head; + for(i = 1+offset; i < prim->numverts-1; i++){ + if(cur->front == NULL){ + cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); + } + if(gl2psGetPlaneFromPoints(prim->verts[i].xyz, + prim->verts[i+1].xyz, + cur->front->plane)){ + cur = cur->front; + cur->front = NULL; + cur->back = NULL; + } + } + if(cur->front == NULL){ + cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); + } + if(gl2psGetPlaneFromPoints(prim->verts[i].xyz, + prim->verts[offset].xyz, + cur->front->plane)){ + cur->front->front = NULL; + cur->front->back = NULL; + } + else{ + gl2psFree(cur->front); + cur->front = NULL; + } + break; + case GL2PS_POINT_BACK : + for(i = 0; i < 4; i++){ + head->plane[i] = -head->plane[i]; + } + cur = head; + for(i = 1+offset; i < prim->numverts-1; i++){ + if(cur->front == NULL){ + cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); + } + if(gl2psGetPlaneFromPoints(prim->verts[i+1].xyz, + prim->verts[i].xyz, + cur->front->plane)){ + cur = cur->front; + cur->front = NULL; + cur->back = NULL; + } + } + if(cur->front == NULL){ + cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); + } + if(gl2psGetPlaneFromPoints(prim->verts[offset].xyz, + prim->verts[i].xyz, + cur->front->plane)){ + cur->front->front = NULL; + cur->front->back = NULL; + } + else{ + gl2psFree(cur->front); + cur->front = NULL; + } + break; + default: + gl2psFree(head); + return; + } + (*tree) = head; + } +} + +static GLint gl2psCheckPrimitive(GL2PSprimitive *prim, GL2PSplane plane) +{ + GLint i; + GLint pos; + + pos = gl2psCheckPoint(prim->verts[0].xyz, plane); + for(i = 1; i < prim->numverts; i++){ + pos |= gl2psCheckPoint(prim->verts[i].xyz, plane); + if(pos == (GL2PS_POINT_INFRONT | GL2PS_POINT_BACK)) return GL2PS_SPANNING; + } + if(pos & GL2PS_POINT_INFRONT) return GL2PS_IN_FRONT_OF; + else if(pos & GL2PS_POINT_BACK) return GL2PS_IN_BACK_OF; + else return GL2PS_COINCIDENT; +} + +static GL2PSprimitive *gl2psCreateSplitPrimitive2D(GL2PSprimitive *parent, + GLshort numverts, + GL2PSvertex *vertx) +{ + GLint i; + GL2PSprimitive *child = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + + if(parent->type == GL2PS_IMAGEMAP){ + child->type = GL2PS_IMAGEMAP; + child->data.image = parent->data.image; + } + else { + switch(numverts){ + case 1 : child->type = GL2PS_POINT; break; + case 2 : child->type = GL2PS_LINE; break; + case 3 : child->type = GL2PS_TRIANGLE; break; + case 4 : child->type = GL2PS_QUADRANGLE; break; + default: child->type = GL2PS_NO_TYPE; break; /* FIXME */ + } + } + child->boundary = 0; /* FIXME: not done! */ + child->culled = parent->culled; + child->offset = parent->offset; + child->pattern = parent->pattern; + child->factor = parent->factor; + child->width = parent->width; + child->numverts = numverts; + child->verts = (GL2PSvertex*)gl2psMalloc(numverts * sizeof(GL2PSvertex)); + for(i = 0; i < numverts; i++){ + child->verts[i] = vertx[i]; + } + return child; +} + +static void gl2psSplitPrimitive2D(GL2PSprimitive *prim, + GL2PSplane plane, + GL2PSprimitive **front, + GL2PSprimitive **back) +{ + /* cur will hold the position of the current vertex + prev will hold the position of the previous vertex + prev0 will hold the position of the vertex number 0 + v1 and v2 represent the current and previous vertices, respectively + flag is set if the current vertex should be checked against the plane */ + GLint cur = -1, prev = -1, i, v1 = 0, v2 = 0, flag = 1, prev0 = -1; + + /* list of vertices that will go in front and back primitive */ + GL2PSvertex *front_list = NULL, *back_list = NULL; + + /* number of vertices in front and back list */ + GLshort front_count = 0, back_count = 0; + + for(i = 0; i <= prim->numverts; i++){ + v1 = i; + if(v1 == prim->numverts){ + if(prim->numverts < 3) break; + v1 = 0; + v2 = prim->numverts-1; + cur = prev0; + } + else if(flag){ + cur = gl2psCheckPoint(prim->verts[v1].xyz, plane); + if(i == 0){ + prev0 = cur; + } + } + if(((prev == -1) || (prev == cur) || (prev == 0) || (cur == 0)) && + (i < prim->numverts)){ + if(cur == GL2PS_POINT_INFRONT){ + front_count++; + front_list = (GL2PSvertex*)gl2psRealloc(front_list, + sizeof(GL2PSvertex)*front_count); + front_list[front_count-1] = prim->verts[v1]; + } + else if(cur == GL2PS_POINT_BACK){ + back_count++; + back_list = (GL2PSvertex*)gl2psRealloc(back_list, + sizeof(GL2PSvertex)*back_count); + back_list[back_count-1] = prim->verts[v1]; + } + else{ + front_count++; + front_list = (GL2PSvertex*)gl2psRealloc(front_list, + sizeof(GL2PSvertex)*front_count); + front_list[front_count-1] = prim->verts[v1]; + back_count++; + back_list = (GL2PSvertex*)gl2psRealloc(back_list, + sizeof(GL2PSvertex)*back_count); + back_list[back_count-1] = prim->verts[v1]; + } + flag = 1; + } + else if((prev != cur) && (cur != 0) && (prev != 0)){ + if(v1 != 0){ + v2 = v1-1; + i--; + } + front_count++; + front_list = (GL2PSvertex*)gl2psRealloc(front_list, + sizeof(GL2PSvertex)*front_count); + gl2psCutEdge(&prim->verts[v2], + &prim->verts[v1], + plane, + &front_list[front_count-1]); + back_count++; + back_list = (GL2PSvertex*)gl2psRealloc(back_list, + sizeof(GL2PSvertex)*back_count); + back_list[back_count-1] = front_list[front_count-1]; + flag = 0; + } + prev = cur; + } + *front = gl2psCreateSplitPrimitive2D(prim, front_count, front_list); + *back = gl2psCreateSplitPrimitive2D(prim, back_count, back_list); + gl2psFree(front_list); + gl2psFree(back_list); +} + +static GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree) +{ + GLint ret = 0; + GL2PSprimitive *frontprim = NULL, *backprim = NULL; + + /* FIXME: until we consider the actual extent of text strings and + pixmaps, never cull them. Otherwise the whole string/pixmap gets + culled as soon as the reference point is hidden */ + if(prim->type == GL2PS_PIXMAP || + prim->type == GL2PS_TEXT || + prim->type == GL2PS_SPECIAL){ + return 1; + } + + if(*tree == NULL){ + if((prim->type != GL2PS_IMAGEMAP) && (GL_FALSE == gl2ps->zerosurfacearea)){ + gl2psAddPlanesInBspTreeImage(gl2ps->primitivetoadd, tree); + } + return 1; + } + else{ + switch(gl2psCheckPrimitive(prim, (*tree)->plane)){ + case GL2PS_IN_BACK_OF: return gl2psAddInBspImageTree(prim, &(*tree)->back); + case GL2PS_IN_FRONT_OF: + if((*tree)->front != NULL) return gl2psAddInBspImageTree(prim, &(*tree)->front); + else return 0; + case GL2PS_SPANNING: + gl2psSplitPrimitive2D(prim, (*tree)->plane, &frontprim, &backprim); + ret = gl2psAddInBspImageTree(backprim, &(*tree)->back); + if((*tree)->front != NULL){ + if(gl2psAddInBspImageTree(frontprim, &(*tree)->front)){ + ret = 1; + } + } + gl2psFree(frontprim->verts); + gl2psFree(frontprim); + gl2psFree(backprim->verts); + gl2psFree(backprim); + return ret; + case GL2PS_COINCIDENT: + if((*tree)->back != NULL){ + gl2ps->zerosurfacearea = GL_TRUE; + ret = gl2psAddInBspImageTree(prim, &(*tree)->back); + gl2ps->zerosurfacearea = GL_FALSE; + if(ret) return ret; + } + if((*tree)->front != NULL){ + gl2ps->zerosurfacearea = GL_TRUE; + ret = gl2psAddInBspImageTree(prim, &(*tree)->front); + gl2ps->zerosurfacearea = GL_FALSE; + if(ret) return ret; + } + if(prim->type == GL2PS_LINE) return 1; + else return 0; + } + } + return 0; +} + +static void gl2psAddInImageTree(void *data) +{ + GL2PSprimitive *prim = *(GL2PSprimitive **)data; + gl2ps->primitivetoadd = prim; + if(prim->type == GL2PS_IMAGEMAP && prim->data.image->format == GL2PS_IMAGEMAP_VISIBLE){ + prim->culled = 1; + } + else if(!gl2psAddInBspImageTree(prim, &gl2ps->imagetree)){ + prim->culled = 1; + } + else if(prim->type == GL2PS_IMAGEMAP){ + prim->data.image->format = GL2PS_IMAGEMAP_VISIBLE; + } +} + +/* Boundary construction */ + +static void gl2psAddBoundaryInList(GL2PSprimitive *prim, GL2PSlist *list) +{ + GL2PSprimitive *b; + GLshort i; + GL2PSxyz c; + + c[0] = c[1] = c[2] = 0.0F; + for(i = 0; i < prim->numverts; i++){ + c[0] += prim->verts[i].xyz[0]; + c[1] += prim->verts[i].xyz[1]; + } + c[0] /= prim->numverts; + c[1] /= prim->numverts; + + for(i = 0; i < prim->numverts; i++){ + if(prim->boundary & (GLint)pow(2., i)){ + b = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + b->type = GL2PS_LINE; + b->offset = prim->offset; + b->pattern = prim->pattern; + b->factor = prim->factor; + b->culled = prim->culled; + b->width = prim->width; + b->boundary = 0; + b->numverts = 2; + b->verts = (GL2PSvertex*)gl2psMalloc(2 * sizeof(GL2PSvertex)); + +#if 0 /* FIXME: need to work on boundary offset... */ + v[0] = c[0] - prim->verts[i].xyz[0]; + v[1] = c[1] - prim->verts[i].xyz[1]; + v[2] = 0.0F; + norm = gl2psNorm(v); + v[0] /= norm; + v[1] /= norm; + b->verts[0].xyz[0] = prim->verts[i].xyz[0] +0.1*v[0]; + b->verts[0].xyz[1] = prim->verts[i].xyz[1] +0.1*v[1]; + b->verts[0].xyz[2] = prim->verts[i].xyz[2]; + v[0] = c[0] - prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[0]; + v[1] = c[1] - prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[1]; + norm = gl2psNorm(v); + v[0] /= norm; + v[1] /= norm; + b->verts[1].xyz[0] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[0] +0.1*v[0]; + b->verts[1].xyz[1] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[1] +0.1*v[1]; + b->verts[1].xyz[2] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[2]; +#else + b->verts[0].xyz[0] = prim->verts[i].xyz[0]; + b->verts[0].xyz[1] = prim->verts[i].xyz[1]; + b->verts[0].xyz[2] = prim->verts[i].xyz[2]; + b->verts[1].xyz[0] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[0]; + b->verts[1].xyz[1] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[1]; + b->verts[1].xyz[2] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[2]; +#endif + + b->verts[0].rgba[0] = 0.0F; + b->verts[0].rgba[1] = 0.0F; + b->verts[0].rgba[2] = 0.0F; + b->verts[0].rgba[3] = 0.0F; + b->verts[1].rgba[0] = 0.0F; + b->verts[1].rgba[1] = 0.0F; + b->verts[1].rgba[2] = 0.0F; + b->verts[1].rgba[3] = 0.0F; + gl2psListAdd(list, &b); + } + } + +} + +static void gl2psBuildPolygonBoundary(GL2PSbsptree *tree) +{ + GLint i; + GL2PSprimitive *prim; + + if(!tree) return; + gl2psBuildPolygonBoundary(tree->back); + for(i = 0; i < gl2psListNbr(tree->primitives); i++){ + prim = *(GL2PSprimitive**)gl2psListPointer(tree->primitives, i); + if(prim->boundary) gl2psAddBoundaryInList(prim, tree->primitives); + } + gl2psBuildPolygonBoundary(tree->front); +} + +/********************************************************************* + * + * Feedback buffer parser + * + *********************************************************************/ + +static void gl2psAddPolyPrimitive(GLshort type, GLshort numverts, + GL2PSvertex *verts, GLint offset, + GLushort pattern, GLint factor, + GLfloat width, char boundary) +{ + GL2PSprimitive *prim; + + prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + prim->type = type; + prim->numverts = numverts; + prim->verts = (GL2PSvertex*)gl2psMalloc(numverts * sizeof(GL2PSvertex)); + memcpy(prim->verts, verts, numverts * sizeof(GL2PSvertex)); + prim->boundary = boundary; + prim->offset = offset; + prim->pattern = pattern; + prim->factor = factor; + prim->width = width; + prim->culled = 0; + + /* FIXME: here we should have an option to split stretched + tris/quads to enhance SIMPLE_SORT */ + + gl2psListAdd(gl2ps->primitives, &prim); +} + +static GLint gl2psGetVertex(GL2PSvertex *v, GLfloat *p) +{ + GLint i; + + v->xyz[0] = p[0]; + v->xyz[1] = p[1]; + v->xyz[2] = p[2]; + + if(gl2ps->colormode == GL_COLOR_INDEX && gl2ps->colorsize > 0){ + i = (GLint)(p[3] + 0.5); + v->rgba[0] = gl2ps->colormap[i][0]; + v->rgba[1] = gl2ps->colormap[i][1]; + v->rgba[2] = gl2ps->colormap[i][2]; + v->rgba[3] = gl2ps->colormap[i][3]; + return 4; + } + else{ + v->rgba[0] = p[3]; + v->rgba[1] = p[4]; + v->rgba[2] = p[5]; + v->rgba[3] = p[6]; + return 7; + } +} + +static void gl2psParseFeedbackBuffer(GLint used) +{ + char flag; + GLushort pattern = 0; + GLboolean boundary; + GLint i, sizeoffloat, count, v, vtot, offset = 0, factor = 0, auxindex = 0; + GLfloat lwidth = 1.0F, psize = 1.0F; + GLfloat *current; + GL2PSvertex vertices[3]; + GL2PSprimitive *prim; + GL2PSimagemap *node; + + current = gl2ps->feedback; + boundary = gl2ps->boundary = GL_FALSE; + + while(used > 0){ + + if(GL_TRUE == boundary) gl2ps->boundary = GL_TRUE; + + switch((GLint)*current){ + case GL_POINT_TOKEN : + current ++; + used --; + i = gl2psGetVertex(&vertices[0], current); + current += i; + used -= i; + gl2psAddPolyPrimitive(GL2PS_POINT, 1, vertices, 0, + pattern, factor, psize, 0); + break; + case GL_LINE_TOKEN : + case GL_LINE_RESET_TOKEN : + current ++; + used --; + i = gl2psGetVertex(&vertices[0], current); + current += i; + used -= i; + i = gl2psGetVertex(&vertices[1], current); + current += i; + used -= i; + gl2psAddPolyPrimitive(GL2PS_LINE, 2, vertices, 0, + pattern, factor, lwidth, 0); + break; + case GL_POLYGON_TOKEN : + count = (GLint)current[1]; + current += 2; + used -= 2; + v = vtot = 0; + while(count > 0 && used > 0){ + i = gl2psGetVertex(&vertices[v], current); + gl2psAdaptVertexForBlending(&vertices[v]); + current += i; + used -= i; + count --; + vtot++; + if(v == 2){ + if(GL_TRUE == boundary){ + if(!count && vtot == 2) flag = 1|2|4; + else if(!count) flag = 2|4; + else if(vtot == 2) flag = 1|2; + else flag = 2; + } + else + flag = 0; + gl2psAddPolyPrimitive(GL2PS_TRIANGLE, 3, vertices, offset, + pattern, factor, 1, flag); + vertices[1] = vertices[2]; + } + else + v ++; + } + break; + case GL_BITMAP_TOKEN : + case GL_DRAW_PIXEL_TOKEN : + case GL_COPY_PIXEL_TOKEN : + current ++; + used --; + i = gl2psGetVertex(&vertices[0], current); + current += i; + used -= i; + break; + case GL_PASS_THROUGH_TOKEN : + switch((GLint)current[1]){ + case GL2PS_BEGIN_OFFSET_TOKEN : offset = 1; break; + case GL2PS_END_OFFSET_TOKEN : offset = 0; break; + case GL2PS_BEGIN_BOUNDARY_TOKEN : boundary = GL_TRUE; break; + case GL2PS_END_BOUNDARY_TOKEN : boundary = GL_FALSE; break; + case GL2PS_END_STIPPLE_TOKEN : pattern = factor = 0; break; + case GL2PS_BEGIN_BLEND_TOKEN : gl2ps->blending = GL_TRUE; break; + case GL2PS_END_BLEND_TOKEN : gl2ps->blending = GL_FALSE; break; + case GL2PS_BEGIN_STIPPLE_TOKEN : + current += 2; + used -= 2; + pattern = (GLushort)current[1]; + current += 2; + used -= 2; + factor = (GLint)current[1]; + break; + case GL2PS_SRC_BLEND_TOKEN : + current += 2; + used -= 2; + gl2ps->blendfunc[0] = (GLint)current[1]; + break; + case GL2PS_DST_BLEND_TOKEN : + current += 2; + used -= 2; + gl2ps->blendfunc[1] = (GLint)current[1]; + break; + case GL2PS_POINT_SIZE_TOKEN : + current += 2; + used -= 2; + psize = current[1]; + break; + case GL2PS_LINE_WIDTH_TOKEN : + current += 2; + used -= 2; + lwidth = current[1]; + break; + case GL2PS_IMAGEMAP_TOKEN : + prim = (GL2PSprimitive *)gl2psMalloc(sizeof(GL2PSprimitive)); + prim->type = GL2PS_IMAGEMAP; + prim->boundary = 0; + prim->numverts = 4; + prim->verts = (GL2PSvertex *)gl2psMalloc(4 * sizeof(GL2PSvertex)); + prim->culled = 0; + prim->offset = 0; + prim->pattern = 0; + prim->factor = 0; + prim->width = 1; + + node = (GL2PSimagemap*)gl2psMalloc(sizeof(GL2PSimagemap)); + node->image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage)); + node->image->type = 0; + node->image->format = 0; + node->next = NULL; + + if(gl2ps->imagemap_head == NULL) + gl2ps->imagemap_head = node; + else + gl2ps->imagemap_tail->next = node; + gl2ps->imagemap_tail = node; + prim->data.image = node->image; + + current += 2; used -= 2; + i = gl2psGetVertex(&prim->verts[0], ¤t[1]); + current += i; used -= i; + + node->image->width = (GLint)current[2]; + current += 2; used -= 2; + node->image->height = (GLint)current[2]; + prim->verts[0].xyz[0] = prim->verts[0].xyz[0] - (int)(node->image->width / 2) + 0.5; + prim->verts[0].xyz[1] = prim->verts[0].xyz[1] - (int)(node->image->height / 2) + 0.5; + for(i = 1; i < 4; i++){ + for(v = 0; v < 3; v++){ + prim->verts[i].xyz[v] = prim->verts[0].xyz[v]; + prim->verts[i].rgba[v] = prim->verts[0].rgba[v]; + } + prim->verts[i].rgba[v] = prim->verts[0].rgba[v]; + } + prim->verts[1].xyz[0] = prim->verts[1].xyz[0] + node->image->width; + prim->verts[2].xyz[0] = prim->verts[1].xyz[0]; + prim->verts[2].xyz[1] = prim->verts[2].xyz[1] + node->image->height; + prim->verts[3].xyz[1] = prim->verts[2].xyz[1]; + + sizeoffloat = sizeof(GLfloat); + v = 2 * sizeoffloat; + vtot = node->image->height + node->image->height * + ((node->image->width-1)/8); + node->image->pixels = (GLfloat*)gl2psMalloc(v + vtot); + node->image->pixels[0] = prim->verts[0].xyz[0]; + node->image->pixels[1] = prim->verts[0].xyz[1]; + + for(i = 0; i < vtot; i += sizeoffloat){ + current += 2; used -= 2; + if((vtot - i) >= 4) + memcpy(&(((char*)(node->image->pixels))[i + v]), &(current[2]), sizeoffloat); + else + memcpy(&(((char*)(node->image->pixels))[i + v]), &(current[2]), vtot - i); + } + current++; used--; + gl2psListAdd(gl2ps->primitives, &prim); + break; + case GL2PS_DRAW_PIXELS_TOKEN : + case GL2PS_TEXT_TOKEN : + if(auxindex < gl2psListNbr(gl2ps->auxprimitives)) + gl2psListAdd(gl2ps->primitives, + gl2psListPointer(gl2ps->auxprimitives, auxindex++)); + else + gl2psMsg(GL2PS_ERROR, "Wrong number of auxiliary tokens in buffer"); + break; + } + current += 2; + used -= 2; + break; + default : + gl2psMsg(GL2PS_WARNING, "Unknown token in buffer"); + current ++; + used --; + break; + } + } + + gl2psListReset(gl2ps->auxprimitives); +} + +/********************************************************************* + * + * PostScript routines + * + *********************************************************************/ + +static void gl2psWriteByte(unsigned char byte) +{ + unsigned char h = byte / 16; + unsigned char l = byte % 16; + gl2psPrintf("%x%x", h, l); +} + +static void gl2psPrintPostScriptPixmap(GLfloat x, GLfloat y, GL2PSimage *im) +{ + GLuint nbhex, nbyte, nrgb, nbits; + GLuint row, col, ibyte, icase; + GLfloat dr, dg, db, fgrey; + unsigned char red = 0, green = 0, blue = 0, b, grey; + GLuint width = (GLuint)im->width; + GLuint height = (GLuint)im->height; + + /* FIXME: should we define an option for these? Or just keep the + 8-bit per component case? */ + int greyscale = 0; /* set to 1 to output greyscale image */ + int nbit = 8; /* number of bits per color compoment (2, 4 or 8) */ + + if((width <= 0) || (height <= 0)) return; + + gl2psPrintf("gsave\n"); + gl2psPrintf("%.2f %.2f translate\n", x, y); + gl2psPrintf("%d %d scale\n", width, height); + + if(greyscale){ /* greyscale */ + gl2psPrintf("/picstr %d string def\n", width); + gl2psPrintf("%d %d %d\n", width, height, 8); + gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); + gl2psPrintf("{ currentfile picstr readhexstring pop }\n"); + gl2psPrintf("image\n"); + for(row = 0; row < height; row++){ + for(col = 0; col < width; col++){ + gl2psGetRGB(im, col, row, &dr, &dg, &db); + fgrey = (0.30 * dr + 0.59 * dg + 0.11 * db); + grey = (unsigned char)(255. * fgrey); + gl2psWriteByte(grey); + } + gl2psPrintf("\n"); + } + nbhex = width * height * 2; + gl2psPrintf("%%%% nbhex digit :%d\n", nbhex); + } + else if(nbit == 2){ /* color, 2 bits for r and g and b; rgbs following each other */ + nrgb = width * 3; + nbits = nrgb * nbit; + nbyte = nbits/8; + if((nbyte * 8) != nbits) nbyte++; + gl2psPrintf("/rgbstr %d string def\n", nbyte); + gl2psPrintf("%d %d %d\n", width, height, nbit); + gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); + gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n"); + gl2psPrintf("false 3\n"); + gl2psPrintf("colorimage\n"); + for(row = 0; row < height; row++){ + icase = 1; + col = 0; + b = 0; + for(ibyte = 0; ibyte < nbyte; ibyte++){ + if(icase == 1) { + if(col < width) { + gl2psGetRGB(im, col, row, &dr, &dg, &db); + } + else { + dr = dg = db = 0; + } + col++; + red = (unsigned char)(3. * dr); + green = (unsigned char)(3. * dg); + blue = (unsigned char)(3. * db); + b = red; + b = (b<<2) + green; + b = (b<<2) + blue; + if(col < width) { + gl2psGetRGB(im, col, row, &dr, &dg, &db); + } + else { + dr = dg = db = 0; + } + col++; + red = (unsigned char)(3. * dr); + green = (unsigned char)(3. * dg); + blue = (unsigned char)(3. * db); + b = (b<<2) + red; + gl2psWriteByte(b); + b = 0; + icase++; + } + else if(icase == 2) { + b = green; + b = (b<<2) + blue; + if(col < width) { + gl2psGetRGB(im, col, row, &dr, &dg, &db); + } + else { + dr = dg = db = 0; + } + col++; + red = (unsigned char)(3. * dr); + green = (unsigned char)(3. * dg); + blue = (unsigned char)(3. * db); + b = (b<<2) + red; + b = (b<<2) + green; + gl2psWriteByte(b); + b = 0; + icase++; + } + else if(icase == 3) { + b = blue; + if(col < width) { + gl2psGetRGB(im, col, row, &dr, &dg, &db); + } + else { + dr = dg = db = 0; + } + col++; + red = (unsigned char)(3. * dr); + green = (unsigned char)(3. * dg); + blue = (unsigned char)(3. * db); + b = (b<<2) + red; + b = (b<<2) + green; + b = (b<<2) + blue; + gl2psWriteByte(b); + b = 0; + icase = 1; + } + } + gl2psPrintf("\n"); + } + } + else if(nbit == 4){ /* color, 4 bits for r and g and b; rgbs following each other */ + nrgb = width * 3; + nbits = nrgb * nbit; + nbyte = nbits/8; + if((nbyte * 8) != nbits) nbyte++; + gl2psPrintf("/rgbstr %d string def\n", nbyte); + gl2psPrintf("%d %d %d\n", width, height, nbit); + gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); + gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n"); + gl2psPrintf("false 3\n"); + gl2psPrintf("colorimage\n"); + for(row = 0; row < height; row++){ + col = 0; + icase = 1; + for(ibyte = 0; ibyte < nbyte; ibyte++){ + if(icase == 1) { + if(col < width) { + gl2psGetRGB(im, col, row, &dr, &dg, &db); + } + else { + dr = dg = db = 0; + } + col++; + red = (unsigned char)(15. * dr); + green = (unsigned char)(15. * dg); + gl2psPrintf("%x%x", red, green); + icase++; + } + else if(icase == 2) { + blue = (unsigned char)(15. * db); + if(col < width) { + gl2psGetRGB(im, col, row, &dr, &dg, &db); + } + else { + dr = dg = db = 0; + } + col++; + red = (unsigned char)(15. * dr); + gl2psPrintf("%x%x", blue, red); + icase++; + } + else if(icase == 3) { + green = (unsigned char)(15. * dg); + blue = (unsigned char)(15. * db); + gl2psPrintf("%x%x", green, blue); + icase = 1; + } + } + gl2psPrintf("\n"); + } + } + else{ /* 8 bit for r and g and b */ + nbyte = width * 3; + gl2psPrintf("/rgbstr %d string def\n", nbyte); + gl2psPrintf("%d %d %d\n", width, height, 8); + gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); + gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n"); + gl2psPrintf("false 3\n"); + gl2psPrintf("colorimage\n"); + for(row = 0; row < height; row++){ + for(col = 0; col < width; col++){ + gl2psGetRGB(im, col, row, &dr, &dg, &db); + red = (unsigned char)(255. * dr); + gl2psWriteByte(red); + green = (unsigned char)(255. * dg); + gl2psWriteByte(green); + blue = (unsigned char)(255. * db); + gl2psWriteByte(blue); + } + gl2psPrintf("\n"); + } + } + + gl2psPrintf("grestore\n"); +} + +static void gl2psPrintPostScriptImagemap(GLfloat x, GLfloat y, + GLsizei width, GLsizei height, + const unsigned char *imagemap){ + int i, size; + + if((width <= 0) || (height <= 0)) return; + + size = height + height * (width-1)/8; + + gl2psPrintf("gsave\n"); + gl2psPrintf("%.2f %.2f translate\n", x, y); + gl2psPrintf("%d %d scale\n%d %d\ntrue\n", width, height,width, height); + gl2psPrintf("[ %d 0 0 -%d 0 %d ] {<", width, height); + for(i = 0; i < size; i++){ + gl2psWriteByte(*imagemap); + imagemap++; + } + gl2psPrintf(">} imagemask\ngrestore\n"); +} + +static void gl2psPrintPostScriptHeader(void) +{ + time_t now; + + /* Since compression is not part of the PostScript standard, + compressed PostScript files are just gzipped PostScript files + ("ps.gz" or "eps.gz") */ + gl2psPrintGzipHeader(); + + time(&now); + + if(gl2ps->format == GL2PS_PS){ + gl2psPrintf("%%!PS-Adobe-3.0\n"); + } + else{ + gl2psPrintf("%%!PS-Adobe-3.0 EPSF-3.0\n"); + } + + gl2psPrintf("%%%%Title: %s\n" + "%%%%Creator: GL2PS %d.%d.%d%s, %s\n" + "%%%%For: %s\n" + "%%%%CreationDate: %s" + "%%%%LanguageLevel: 3\n" + "%%%%DocumentData: Clean7Bit\n" + "%%%%Pages: 1\n", + gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, + GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, + gl2ps->producer, ctime(&now)); + + if(gl2ps->format == GL2PS_PS){ + gl2psPrintf("%%%%Orientation: %s\n" + "%%%%DocumentMedia: Default %d %d 0 () ()\n", + (gl2ps->options & GL2PS_LANDSCAPE) ? "Landscape" : "Portrait", + (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[3] : + (int)gl2ps->viewport[2], + (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[2] : + (int)gl2ps->viewport[3]); + } + + gl2psPrintf("%%%%BoundingBox: %d %d %d %d\n" + "%%%%EndComments\n", + (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[1] : + (int)gl2ps->viewport[0], + (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[0] : + (int)gl2ps->viewport[1], + (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[3] : + (int)gl2ps->viewport[2], + (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[2] : + (int)gl2ps->viewport[3]); + + /* RGB color: r g b C (replace C by G in output to change from rgb to gray) + Grayscale: r g b G + Font choose: size fontname FC + Text string: (string) x y size fontname S?? + Rotated text string: (string) angle x y size fontname S??R + Point primitive: x y size P + Line width: width W + Line start: x y LS + Line joining last point: x y L + Line end: x y LE + Flat-shaded triangle: x3 y3 x2 y2 x1 y1 T + Smooth-shaded triangle: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 ST */ + + gl2psPrintf("%%%%BeginProlog\n" + "/gl2psdict 64 dict def gl2psdict begin\n" + "0 setlinecap 0 setlinejoin\n" + "/tryPS3shading %s def %% set to false to force subdivision\n" + "/rThreshold %g def %% red component subdivision threshold\n" + "/gThreshold %g def %% green component subdivision threshold\n" + "/bThreshold %g def %% blue component subdivision threshold\n", + (gl2ps->options & GL2PS_NO_PS3_SHADING) ? "false" : "true", + gl2ps->threshold[0], gl2ps->threshold[1], gl2ps->threshold[2]); + + gl2psPrintf("/BD { bind def } bind def\n" + "/C { setrgbcolor } BD\n" + "/G { 0.082 mul exch 0.6094 mul add exch 0.3086 mul add neg 1.0 add setgray } BD\n" + "/W { setlinewidth } BD\n"); + + gl2psPrintf("/FC { findfont exch /SH exch def SH scalefont setfont } BD\n" + "/SW { dup stringwidth pop } BD\n" + "/S { FC moveto show } BD\n" + "/SBC{ FC moveto SW -2 div 0 rmoveto show } BD\n" + "/SBR{ FC moveto SW neg 0 rmoveto show } BD\n" + "/SCL{ FC moveto 0 SH -2 div rmoveto show } BD\n" + "/SCC{ FC moveto SW -2 div SH -2 div rmoveto show } BD\n" + "/SCR{ FC moveto SW neg SH -2 div rmoveto show } BD\n" + "/STL{ FC moveto 0 SH neg rmoveto show } BD\n" + "/STC{ FC moveto SW -2 div SH neg rmoveto show } BD\n" + "/STR{ FC moveto SW neg SH neg rmoveto show } BD\n"); + + /* rotated text routines: same nameanem with R appended */ + + gl2psPrintf("/FCT { FC translate 0 0 } BD\n" + "/SR { gsave FCT moveto rotate show grestore } BD\n" + "/SBCR{ gsave FCT moveto rotate SW -2 div 0 rmoveto show grestore } BD\n" + "/SBRR{ gsave FCT moveto rotate SW neg 0 rmoveto show grestore } BD\n" + "/SCLR{ gsave FCT moveto rotate 0 SH -2 div rmoveto show grestore} BD\n"); + gl2psPrintf("/SCCR{ gsave FCT moveto rotate SW -2 div SH -2 div rmoveto show grestore} BD\n" + "/SCRR{ gsave FCT moveto rotate SW neg SH -2 div rmoveto show grestore} BD\n" + "/STLR{ gsave FCT moveto rotate 0 SH neg rmoveto show grestore } BD\n" + "/STCR{ gsave FCT moveto rotate SW -2 div SH neg rmoveto show grestore } BD\n" + "/STRR{ gsave FCT moveto rotate SW neg SH neg rmoveto show grestore } BD\n"); + + gl2psPrintf("/P { newpath 0.0 360.0 arc closepath fill } BD\n" + "/LS { newpath moveto } BD\n" + "/L { lineto } BD\n" + "/LE { lineto stroke } BD\n" + "/T { newpath moveto lineto lineto closepath fill } BD\n"); + + /* Smooth-shaded triangle with PostScript level 3 shfill operator: + x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STshfill */ + + gl2psPrintf("/STshfill {\n" + " /b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n" + " /b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n" + " /b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n" + " gsave << /ShadingType 4 /ColorSpace [/DeviceRGB]\n" + " /DataSource [ 0 x1 y1 r1 g1 b1 0 x2 y2 r2 g2 b2 0 x3 y3 r3 g3 b3 ] >>\n" + " shfill grestore } BD\n"); + + /* Flat-shaded triangle with middle color: + x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 Tm */ + + gl2psPrintf(/* stack : x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 */ + "/Tm { 3 -1 roll 8 -1 roll 13 -1 roll add add 3 div\n" /* r = (r1+r2+r3)/3 */ + /* stack : x3 y3 g3 b3 x2 y2 g2 b2 x1 y1 g1 b1 r */ + " 3 -1 roll 7 -1 roll 11 -1 roll add add 3 div\n" /* g = (g1+g2+g3)/3 */ + /* stack : x3 y3 b3 x2 y2 b2 x1 y1 b1 r g b */ + " 3 -1 roll 6 -1 roll 9 -1 roll add add 3 div" /* b = (b1+b2+b3)/3 */ + /* stack : x3 y3 x2 y2 x1 y1 r g b */ + " C T } BD\n"); + + /* Split triangle in four sub-triangles (at sides middle points) and call the + STnoshfill procedure on each, interpolating the colors in RGB space: + x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STsplit + (in procedure comments key: (Vi) = xi yi ri gi bi) */ + + gl2psPrintf("/STsplit {\n" + " 4 index 15 index add 0.5 mul\n" /* x13 = (x1+x3)/2 */ + " 4 index 15 index add 0.5 mul\n" /* y13 = (y1+y3)/2 */ + " 4 index 15 index add 0.5 mul\n" /* r13 = (r1+r3)/2 */ + " 4 index 15 index add 0.5 mul\n" /* g13 = (g1+g3)/2 */ + " 4 index 15 index add 0.5 mul\n" /* b13 = (b1+b3)/2 */ + " 5 copy 5 copy 25 15 roll\n"); + + /* at his point, stack = (V3) (V13) (V13) (V13) (V2) (V1) */ + + gl2psPrintf(" 9 index 30 index add 0.5 mul\n" /* x23 = (x2+x3)/2 */ + " 9 index 30 index add 0.5 mul\n" /* y23 = (y2+y3)/2 */ + " 9 index 30 index add 0.5 mul\n" /* r23 = (r2+r3)/2 */ + " 9 index 30 index add 0.5 mul\n" /* g23 = (g2+g3)/2 */ + " 9 index 30 index add 0.5 mul\n" /* b23 = (b2+b3)/2 */ + " 5 copy 5 copy 35 5 roll 25 5 roll 15 5 roll\n"); + + /* stack = (V3) (V13) (V23) (V13) (V23) (V13) (V23) (V2) (V1) */ + + gl2psPrintf(" 4 index 10 index add 0.5 mul\n" /* x12 = (x1+x2)/2 */ + " 4 index 10 index add 0.5 mul\n" /* y12 = (y1+y2)/2 */ + " 4 index 10 index add 0.5 mul\n" /* r12 = (r1+r2)/2 */ + " 4 index 10 index add 0.5 mul\n" /* g12 = (g1+g2)/2 */ + " 4 index 10 index add 0.5 mul\n" /* b12 = (b1+b2)/2 */ + " 5 copy 5 copy 40 5 roll 25 5 roll 15 5 roll 25 5 roll\n"); + + /* stack = (V3) (V13) (V23) (V13) (V12) (V23) (V13) (V1) (V12) (V23) (V12) (V2) */ + + gl2psPrintf(" STnoshfill STnoshfill STnoshfill STnoshfill } BD\n"); + + /* Gouraud shaded triangle using recursive subdivision until the difference + between corner colors does not exceed the thresholds: + x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STnoshfill */ + + gl2psPrintf("/STnoshfill {\n" + " 2 index 8 index sub abs rThreshold gt\n" /* |r1-r2|>rth */ + " { STsplit }\n" + " { 1 index 7 index sub abs gThreshold gt\n" /* |g1-g2|>gth */ + " { STsplit }\n" + " { dup 6 index sub abs bThreshold gt\n" /* |b1-b2|>bth */ + " { STsplit }\n" + " { 2 index 13 index sub abs rThreshold gt\n" /* |r1-r3|>rht */ + " { STsplit }\n" + " { 1 index 12 index sub abs gThreshold gt\n" /* |g1-g3|>gth */ + " { STsplit }\n" + " { dup 11 index sub abs bThreshold gt\n" /* |b1-b3|>bth */ + " { STsplit }\n" + " { 7 index 13 index sub abs rThreshold gt\n"); /* |r2-r3|>rht */ + gl2psPrintf(" { STsplit }\n" + " { 6 index 12 index sub abs gThreshold gt\n" /* |g2-g3|>gth */ + " { STsplit }\n" + " { 5 index 11 index sub abs bThreshold gt\n" /* |b2-b3|>bth */ + " { STsplit }\n" + " { Tm }\n" /* all colors sufficiently similar */ + " ifelse }\n" + " ifelse }\n" + " ifelse }\n" + " ifelse }\n" + " ifelse }\n" + " ifelse }\n" + " ifelse }\n" + " ifelse }\n" + " ifelse } BD\n"); + + gl2psPrintf("tryPS3shading\n" + "{ /shfill where\n" + " { /ST { STshfill } BD }\n" + " { /ST { STnoshfill } BD }\n" + " ifelse }\n" + "{ /ST { STnoshfill } BD }\n" + "ifelse\n"); + + gl2psPrintf("end\n" + "%%%%EndProlog\n" + "%%%%BeginSetup\n" + "/DeviceRGB setcolorspace\n" + "gl2psdict begin\n" + "%%%%EndSetup\n" + "%%%%Page: 1 1\n" + "%%%%BeginPageSetup\n"); + + if(gl2ps->options & GL2PS_LANDSCAPE){ + gl2psPrintf("%d 0 translate 90 rotate\n", + (int)gl2ps->viewport[3]); + } + + gl2psPrintf("%%%%EndPageSetup\n" + "mark\n" + "gsave\n" + "1.0 1.0 scale\n"); + + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ + gl2psPrintf("%g %g %g C\n" + "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n" + "closepath fill\n", + gl2ps->bgcolor[0], gl2ps->bgcolor[1], gl2ps->bgcolor[2], + (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], + (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], + (int)gl2ps->viewport[0], (int)gl2ps->viewport[3]); + } +} + +static void gl2psPrintPostScriptColor(GL2PSrgba rgba) +{ + if(!gl2psSameColor(gl2ps->lastrgba, rgba)){ + gl2psSetLastColor(rgba); + gl2psPrintf("%g %g %g C\n", rgba[0], rgba[1], rgba[2]); + } +} + +static void gl2psResetPostScriptColor(void) +{ + gl2ps->lastrgba[0] = gl2ps->lastrgba[1] = gl2ps->lastrgba[2] = -1.; +} + +static void gl2psEndPostScriptLine(void) +{ + int i; + if(gl2ps->lastvertex.rgba[0] >= 0.){ + gl2psPrintf("%g %g LE\n", gl2ps->lastvertex.xyz[0], gl2ps->lastvertex.xyz[1]); + for(i = 0; i < 3; i++) + gl2ps->lastvertex.xyz[i] = -1.; + for(i = 0; i < 4; i++) + gl2ps->lastvertex.rgba[i] = -1.; + } +} + +static void gl2psParseStipplePattern(GLushort pattern, GLint factor, + int *nb, int array[10]) +{ + int i, n; + int on[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + int off[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + char tmp[16]; + + /* extract the 16 bits from the OpenGL stipple pattern */ + for(n = 15; n >= 0; n--){ + tmp[n] = (char)(pattern & 0x01); + pattern >>= 1; + } + /* compute the on/off pixel sequence */ + n = 0; + for(i = 0; i < 8; i++){ + while(n < 16 && !tmp[n]){ off[i]++; n++; } + while(n < 16 && tmp[n]){ on[i]++; n++; } + if(n >= 15){ i++; break; } + } + + /* store the on/off array from right to left, starting with off + pixels. The PostScript specification allows for at most 11 + elements in the on/off array, so we limit ourselves to 5 on/off + couples (our longest possible array is thus [on4 off4 on3 off3 + on2 off2 on1 off1 on0 off0]) */ + *nb = 0; + for(n = i - 1; n >= 0; n--){ + array[(*nb)++] = factor * on[n]; + array[(*nb)++] = factor * off[n]; + if(*nb == 10) break; + } +} + +static int gl2psPrintPostScriptDash(GLushort pattern, GLint factor, char *str) +{ + int len = 0, i, n, array[10]; + + if(pattern == gl2ps->lastpattern && factor == gl2ps->lastfactor) + return 0; + + gl2ps->lastpattern = pattern; + gl2ps->lastfactor = factor; + + if(!pattern || !factor){ + /* solid line */ + len += gl2psPrintf("[] 0 %s\n", str); + } + else{ + gl2psParseStipplePattern(pattern, factor, &n, array); + len += gl2psPrintf("["); + for(i = 0; i < n; i++){ + if(i) len += gl2psPrintf(" "); + len += gl2psPrintf("%d", array[i]); + } + len += gl2psPrintf("] 0 %s\n", str); + } + + return len; +} + +static void gl2psPrintPostScriptPrimitive(void *data) +{ + int newline; + GL2PSprimitive *prim; + + prim = *(GL2PSprimitive**)data; + + if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) return; + + /* Every effort is made to draw lines as connected segments (i.e., + using a single PostScript path): this is the only way to get nice + line joins and to not restart the stippling for every line + segment. So if the primitive to print is not a line we must first + finish the current line (if any): */ + if(prim->type != GL2PS_LINE) gl2psEndPostScriptLine(); + + switch(prim->type){ + case GL2PS_POINT : + gl2psPrintPostScriptColor(prim->verts[0].rgba); + gl2psPrintf("%g %g %g P\n", + prim->verts[0].xyz[0], prim->verts[0].xyz[1], 0.5 * prim->width); + break; + case GL2PS_LINE : + if(!gl2psSamePosition(gl2ps->lastvertex.xyz, prim->verts[0].xyz) || + !gl2psSameColor(gl2ps->lastrgba, prim->verts[0].rgba) || + gl2ps->lastlinewidth != prim->width || + gl2ps->lastpattern != prim->pattern || + gl2ps->lastfactor != prim->factor){ + /* End the current line if the new segment does not start where + the last one ended, or if the color, the width or the + stippling have changed (multi-stroking lines with changing + colors is necessary until we use /shfill for lines; + unfortunately this means that at the moment we can screw up + line stippling for smooth-shaded lines) */ + gl2psEndPostScriptLine(); + newline = 1; + } + else{ + newline = 0; + } + if(gl2ps->lastlinewidth != prim->width){ + gl2ps->lastlinewidth = prim->width; + gl2psPrintf("%g W\n", gl2ps->lastlinewidth); + } + gl2psPrintPostScriptDash(prim->pattern, prim->factor, "setdash"); + gl2psPrintPostScriptColor(prim->verts[0].rgba); + gl2psPrintf("%g %g %s\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1], + newline ? "LS" : "L"); + gl2ps->lastvertex = prim->verts[1]; + break; + case GL2PS_TRIANGLE : + if(!gl2psVertsSameColor(prim)){ + gl2psResetPostScriptColor(); + gl2psPrintf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g ST\n", + prim->verts[2].xyz[0], prim->verts[2].xyz[1], + prim->verts[2].rgba[0], prim->verts[2].rgba[1], + prim->verts[2].rgba[2], prim->verts[1].xyz[0], + prim->verts[1].xyz[1], prim->verts[1].rgba[0], + prim->verts[1].rgba[1], prim->verts[1].rgba[2], + prim->verts[0].xyz[0], prim->verts[0].xyz[1], + prim->verts[0].rgba[0], prim->verts[0].rgba[1], + prim->verts[0].rgba[2]); + } + else{ + gl2psPrintPostScriptColor(prim->verts[0].rgba); + gl2psPrintf("%g %g %g %g %g %g T\n", + prim->verts[2].xyz[0], prim->verts[2].xyz[1], + prim->verts[1].xyz[0], prim->verts[1].xyz[1], + prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + } + break; + case GL2PS_QUADRANGLE : + gl2psMsg(GL2PS_WARNING, "There should not be any quad left to print"); + break; + case GL2PS_PIXMAP : + gl2psPrintPostScriptPixmap(prim->verts[0].xyz[0], prim->verts[0].xyz[1], + prim->data.image); + break; + case GL2PS_IMAGEMAP : + if(prim->data.image->type != GL2PS_IMAGEMAP_WRITTEN){ + gl2psPrintPostScriptColor(prim->verts[0].rgba); + gl2psPrintPostScriptImagemap(prim->data.image->pixels[0], + prim->data.image->pixels[1], + prim->data.image->width, prim->data.image->height, + (const unsigned char*)(&(prim->data.image->pixels[2]))); + prim->data.image->type = GL2PS_IMAGEMAP_WRITTEN; + } + break; + case GL2PS_TEXT : + gl2psPrintPostScriptColor(prim->verts[0].rgba); + gl2psPrintf("(%s) ", prim->data.text->str); + if(prim->data.text->angle) + gl2psPrintf("%g ", prim->data.text->angle); + gl2psPrintf("%g %g %d /%s ", + prim->verts[0].xyz[0], prim->verts[0].xyz[1], + prim->data.text->fontsize, prim->data.text->fontname); + switch(prim->data.text->alignment){ + case GL2PS_TEXT_C: + gl2psPrintf(prim->data.text->angle ? "SCCR\n" : "SCC\n"); + break; + case GL2PS_TEXT_CL: + gl2psPrintf(prim->data.text->angle ? "SCLR\n" : "SCL\n"); + break; + case GL2PS_TEXT_CR: + gl2psPrintf(prim->data.text->angle ? "SCRR\n" : "SCR\n"); + break; + case GL2PS_TEXT_B: + gl2psPrintf(prim->data.text->angle ? "SBCR\n" : "SBC\n"); + break; + case GL2PS_TEXT_BR: + gl2psPrintf(prim->data.text->angle ? "SBRR\n" : "SBR\n"); + break; + case GL2PS_TEXT_T: + gl2psPrintf(prim->data.text->angle ? "STCR\n" : "STC\n"); + break; + case GL2PS_TEXT_TL: + gl2psPrintf(prim->data.text->angle ? "STLR\n" : "STL\n"); + break; + case GL2PS_TEXT_TR: + gl2psPrintf(prim->data.text->angle ? "STRR\n" : "STR\n"); + break; + case GL2PS_TEXT_BL: + default: + gl2psPrintf(prim->data.text->angle ? "SR\n" : "S\n"); + break; + } + break; + case GL2PS_SPECIAL : + /* alignment contains the format for which the special output text + is intended */ + if(prim->data.text->alignment == GL2PS_PS || + prim->data.text->alignment == GL2PS_EPS) + gl2psPrintf("%s\n", prim->data.text->str); + break; + default : + break; + } +} + +static void gl2psPrintPostScriptFooter(void) +{ + gl2psPrintf("grestore\n" + "showpage\n" + "cleartomark\n" + "%%%%PageTrailer\n" + "%%%%Trailer\n" + "end\n" + "%%%%EOF\n"); + + gl2psPrintGzipFooter(); +} + +static void gl2psPrintPostScriptBeginViewport(GLint viewport[4]) +{ + GLint indx; + GLfloat rgba[4]; + int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; + + glRenderMode(GL_FEEDBACK); + + if(gl2ps->header){ + gl2psPrintPostScriptHeader(); + gl2ps->header = GL_FALSE; + } + + gl2psPrintf("gsave\n" + "1.0 1.0 scale\n"); + + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ + if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){ + glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba); + } + else{ + glGetIntegerv(GL_INDEX_CLEAR_VALUE, &indx); + rgba[0] = gl2ps->colormap[indx][0]; + rgba[1] = gl2ps->colormap[indx][1]; + rgba[2] = gl2ps->colormap[indx][2]; + rgba[3] = 1.0F; + } + gl2psPrintf("%g %g %g C\n" + "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n" + "closepath fill\n", + rgba[0], rgba[1], rgba[2], + x, y, x+w, y, x+w, y+h, x, y+h); + } + + gl2psPrintf("newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n" + "closepath clip\n", + x, y, x+w, y, x+w, y+h, x, y+h); + +} + +static GLint gl2psPrintPostScriptEndViewport(void) +{ + GLint res; + + res = gl2psPrintPrimitives(); + gl2psPrintf("grestore\n"); + return res; +} + +static void gl2psPrintPostScriptFinalPrimitive(void) +{ + /* End any remaining line, if any */ + gl2psEndPostScriptLine(); +} + +/* definition of the PostScript and Encapsulated PostScript backends */ + +static GL2PSbackend gl2psPS = { + gl2psPrintPostScriptHeader, + gl2psPrintPostScriptFooter, + gl2psPrintPostScriptBeginViewport, + gl2psPrintPostScriptEndViewport, + gl2psPrintPostScriptPrimitive, + gl2psPrintPostScriptFinalPrimitive, + "ps", + "Postscript" +}; + +static GL2PSbackend gl2psEPS = { + gl2psPrintPostScriptHeader, + gl2psPrintPostScriptFooter, + gl2psPrintPostScriptBeginViewport, + gl2psPrintPostScriptEndViewport, + gl2psPrintPostScriptPrimitive, + gl2psPrintPostScriptFinalPrimitive, + "eps", + "Encapsulated Postscript" +}; + +/********************************************************************* + * + * LaTeX routines + * + *********************************************************************/ + +static void gl2psPrintTeXHeader(void) +{ + char name[256]; + time_t now; + int i; + + if(gl2ps->filename && strlen(gl2ps->filename) < 256){ + for(i = strlen(gl2ps->filename)-1; i >= 0; i--){ + if(gl2ps->filename[i] == '.'){ + strncpy(name, gl2ps->filename, i); + name[i] = '\0'; + break; + } + } + if(i <= 0) strcpy(name, gl2ps->filename); + } + else{ + strcpy(name, "untitled"); + } + + time(&now); + + fprintf(gl2ps->stream, + "%% Title: %s\n" + "%% Creator: GL2PS %d.%d.%d%s, %s\n" + "%% For: %s\n" + "%% CreationDate: %s", + gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, + GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, + gl2ps->producer, ctime(&now)); + + fprintf(gl2ps->stream, + "\\setlength{\\unitlength}{1pt}\n" + "\\begin{picture}(0,0)\n" + "\\includegraphics{%s}\n" + "\\end{picture}%%\n" + "%s\\begin{picture}(%d,%d)(0,0)\n", + name, (gl2ps->options & GL2PS_LANDSCAPE) ? "\\rotatebox{90}{" : "", + (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); +} + +static void gl2psPrintTeXPrimitive(void *data) +{ + GL2PSprimitive *prim; + + prim = *(GL2PSprimitive**)data; + + switch(prim->type){ + case GL2PS_TEXT : + fprintf(gl2ps->stream, "\\fontsize{%d}{0}\n\\selectfont", + prim->data.text->fontsize); + fprintf(gl2ps->stream, "\\put(%g,%g){\\makebox(0,0)", + prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + switch(prim->data.text->alignment){ + case GL2PS_TEXT_C: + fprintf(gl2ps->stream, "{"); + break; + case GL2PS_TEXT_CL: + fprintf(gl2ps->stream, "[l]{"); + break; + case GL2PS_TEXT_CR: + fprintf(gl2ps->stream, "[r]{"); + break; + case GL2PS_TEXT_B: + fprintf(gl2ps->stream, "[b]{"); + break; + case GL2PS_TEXT_BR: + fprintf(gl2ps->stream, "[br]{"); + break; + case GL2PS_TEXT_T: + fprintf(gl2ps->stream, "[t]{"); + break; + case GL2PS_TEXT_TL: + fprintf(gl2ps->stream, "[tl]{"); + break; + case GL2PS_TEXT_TR: + fprintf(gl2ps->stream, "[tr]{"); + break; + case GL2PS_TEXT_BL: + default: + fprintf(gl2ps->stream, "[bl]{"); + break; + } + if(prim->data.text->angle) + fprintf(gl2ps->stream, "\\rotatebox{%g}{", prim->data.text->angle); + fprintf(gl2ps->stream, "\\textcolor[rgb]{%g,%g,%g}{{%s}}", + prim->verts[0].rgba[0], prim->verts[0].rgba[1], prim->verts[0].rgba[2], + prim->data.text->str); + if(prim->data.text->angle) + fprintf(gl2ps->stream, "}"); + fprintf(gl2ps->stream, "}}\n"); + break; + case GL2PS_SPECIAL : + /* alignment contains the format for which the special output text + is intended */ + if (prim->data.text->alignment == GL2PS_TEX) + fprintf(gl2ps->stream, "%s\n", prim->data.text->str); + break; + default : + break; + } +} + +static void gl2psPrintTeXFooter(void) +{ + fprintf(gl2ps->stream, "\\end{picture}%s\n", + (gl2ps->options & GL2PS_LANDSCAPE) ? "}" : ""); +} + +static void gl2psPrintTeXBeginViewport(GLint viewport[4]) +{ + (void)viewport; // to remove warning about unused parameter. + glRenderMode(GL_FEEDBACK); + + if(gl2ps->header){ + gl2psPrintTeXHeader(); + gl2ps->header = GL_FALSE; + } +} + +static GLint gl2psPrintTeXEndViewport(void) +{ + return gl2psPrintPrimitives(); +} + +static void gl2psPrintTeXFinalPrimitive(void) +{ +} + +/* definition of the LaTeX backend */ + +static GL2PSbackend gl2psTEX = { + gl2psPrintTeXHeader, + gl2psPrintTeXFooter, + gl2psPrintTeXBeginViewport, + gl2psPrintTeXEndViewport, + gl2psPrintTeXPrimitive, + gl2psPrintTeXFinalPrimitive, + "tex", + "LaTeX text" +}; + +/********************************************************************* + * + * PDF routines + * + *********************************************************************/ + +static int gl2psPrintPDFCompressorType(void) +{ +#if defined(GL2PS_HAVE_ZLIB) + if(gl2ps->options & GL2PS_COMPRESS){ + return fprintf(gl2ps->stream, "/Filter [/FlateDecode]\n"); + } +#endif + return 0; +} + +static int gl2psPrintPDFStrokeColor(GL2PSrgba rgba) +{ + int i, offs = 0; + + gl2psSetLastColor(rgba); + for(i = 0; i < 3; ++i){ + if(GL2PS_ZERO(rgba[i])) + offs += gl2psPrintf("%.0f ", 0.); + else if(rgba[i] < 1e-4 || rgba[i] > 1e6) /* avoid %e formatting */ + offs += gl2psPrintf("%f ", rgba[i]); + else + offs += gl2psPrintf("%g ", rgba[i]); + } + offs += gl2psPrintf("RG\n"); + return offs; +} + +static int gl2psPrintPDFFillColor(GL2PSrgba rgba) +{ + int i, offs = 0; + + for(i = 0; i < 3; ++i){ + if(GL2PS_ZERO(rgba[i])) + offs += gl2psPrintf("%.0f ", 0.); + else if(rgba[i] < 1e-4 || rgba[i] > 1e6) /* avoid %e formatting */ + offs += gl2psPrintf("%f ", rgba[i]); + else + offs += gl2psPrintf("%g ", rgba[i]); + } + offs += gl2psPrintf("rg\n"); + return offs; +} + +static int gl2psPrintPDFLineWidth(GLfloat lw) +{ + if(GL2PS_ZERO(lw)) + return gl2psPrintf("%.0f w\n", 0.); + else if(lw < 1e-4 || lw > 1e6) /* avoid %e formatting */ + return gl2psPrintf("%f w\n", lw); + else + return gl2psPrintf("%g w\n", lw); +} + +static void gl2psPutPDFText(GL2PSstring *text, int cnt, GLfloat x, GLfloat y) +{ + gl2ps->streamlength += + gl2psPrintf("BT\n" + "/F%d %d Tf\n" + "%f %f Td\n" + "(%s) Tj\n" + "ET\n", + cnt, text->fontsize, x, y, text->str); +} + +static void gl2psPutPDFImage(GL2PSimage *image, int cnt, GLfloat x, GLfloat y) +{ + gl2ps->streamlength += + gl2psPrintf("q\n" + "%d 0 0 %d %f %f cm\n" + "/Im%d Do\n" + "Q\n", + (int)image->width, (int)image->height, x, y, cnt); +} + +static void gl2psPDFstacksInit(void) +{ + gl2ps->objects_stack = 7 /* FIXED_XREF_ENTRIES */ + 1; + gl2ps->extgs_stack = 0; + gl2ps->font_stack = 0; + gl2ps->im_stack = 0; + gl2ps->trgroupobjects_stack = 0; + gl2ps->shader_stack = 0; + gl2ps->mshader_stack = 0; +} + +static void gl2psPDFgroupObjectInit(GL2PSpdfgroup *gro) +{ + if(!gro) + return; + + gro->ptrlist = NULL; + gro->fontno = gro->gsno = gro->imno = gro->maskshno = gro->shno + = gro->trgroupno = gro->fontobjno = gro->imobjno = gro->shobjno + = gro->maskshobjno = gro->gsobjno = gro->trgroupobjno = -1; +} + +/* Build up group objects and assign name and object numbers */ + +static void gl2psPDFgroupListInit(void) +{ + int i; + GL2PSprimitive *p = NULL; + GL2PSpdfgroup gro; + int lasttype = GL2PS_NO_TYPE; + GL2PSrgba lastrgba = {-1.0F, -1.0F, -1.0F, -1.0F}; + GLushort lastpattern = 0; + GLint lastfactor = 0; + GLfloat lastwidth = 1; + GL2PStriangle lastt, tmpt; + int lastTriangleWasNotSimpleWithSameColor = 0; + + if(!gl2ps->pdfprimlist) + return; + + gl2ps->pdfgrouplist = gl2psListCreate(500, 500, sizeof(GL2PSpdfgroup)); + gl2psInitTriangle(&lastt); + + for(i = 0; i < gl2psListNbr(gl2ps->pdfprimlist); ++i){ + p = *(GL2PSprimitive**)gl2psListPointer(gl2ps->pdfprimlist, i); + switch(p->type){ + case GL2PS_PIXMAP: + gl2psPDFgroupObjectInit(&gro); + gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); + gro.imno = gl2ps->im_stack++; + gl2psListAdd(gro.ptrlist, &p); + gl2psListAdd(gl2ps->pdfgrouplist, &gro); + break; + case GL2PS_TEXT: + gl2psPDFgroupObjectInit(&gro); + gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); + gro.fontno = gl2ps->font_stack++; + gl2psListAdd(gro.ptrlist, &p); + gl2psListAdd(gl2ps->pdfgrouplist, &gro); + break; + case GL2PS_LINE: + if(lasttype != p->type || lastwidth != p->width || + lastpattern != p->pattern || lastfactor != p->factor || + !gl2psSameColor(p->verts[0].rgba, lastrgba)){ + gl2psPDFgroupObjectInit(&gro); + gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); + gl2psListAdd(gro.ptrlist, &p); + gl2psListAdd(gl2ps->pdfgrouplist, &gro); + } + else{ + gl2psListAdd(gro.ptrlist, &p); + } + lastpattern = p->pattern; + lastfactor = p->factor; + lastwidth = p->width; + lastrgba[0] = p->verts[0].rgba[0]; + lastrgba[1] = p->verts[0].rgba[1]; + lastrgba[2] = p->verts[0].rgba[2]; + break; + case GL2PS_POINT: + if(lasttype != p->type || lastwidth != p->width || + !gl2psSameColor(p->verts[0].rgba, lastrgba)){ + gl2psPDFgroupObjectInit(&gro); + gro.ptrlist = gl2psListCreate(1,2,sizeof(GL2PSprimitive*)); + gl2psListAdd(gro.ptrlist, &p); + gl2psListAdd(gl2ps->pdfgrouplist, &gro); + } + else{ + gl2psListAdd(gro.ptrlist, &p); + } + lastwidth = p->width; + lastrgba[0] = p->verts[0].rgba[0]; + lastrgba[1] = p->verts[0].rgba[1]; + lastrgba[2] = p->verts[0].rgba[2]; + break; + case GL2PS_TRIANGLE: + gl2psFillTriangleFromPrimitive(&tmpt, p, GL_TRUE); + lastTriangleWasNotSimpleWithSameColor = + !(tmpt.prop & T_CONST_COLOR && tmpt.prop & T_ALPHA_1) || + !gl2psSameColor(tmpt.vertex[0].rgba, lastt.vertex[0].rgba); + if(lasttype == p->type && tmpt.prop == lastt.prop && + lastTriangleWasNotSimpleWithSameColor){ + /* TODO Check here for last alpha */ + gl2psListAdd(gro.ptrlist, &p); + } + else{ + gl2psPDFgroupObjectInit(&gro); + gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); + gl2psListAdd(gro.ptrlist, &p); + gl2psListAdd(gl2ps->pdfgrouplist, &gro); + } + lastt = tmpt; + break; + default: + break; + } + lasttype = p->type; + } +} + +static void gl2psSortOutTrianglePDFgroup(GL2PSpdfgroup *gro) +{ + GL2PStriangle t; + GL2PSprimitive *prim = NULL; + + if(!gro) + return; + + if(!gl2psListNbr(gro->ptrlist)) + return; + + prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); + + if(prim->type != GL2PS_TRIANGLE) + return; + + gl2psFillTriangleFromPrimitive(&t, prim, GL_TRUE); + + if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){ + gro->gsno = gl2ps->extgs_stack++; + gro->gsobjno = gl2ps->objects_stack ++; + } + else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){ + gro->gsno = gl2ps->extgs_stack++; + gro->gsobjno = gl2ps->objects_stack++; + gro->trgroupno = gl2ps->trgroupobjects_stack++; + gro->trgroupobjno = gl2ps->objects_stack++; + gro->maskshno = gl2ps->mshader_stack++; + gro->maskshobjno = gl2ps->objects_stack++; + } + else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){ + gro->shno = gl2ps->shader_stack++; + gro->shobjno = gl2ps->objects_stack++; + } + else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){ + gro->gsno = gl2ps->extgs_stack++; + gro->gsobjno = gl2ps->objects_stack++; + gro->shno = gl2ps->shader_stack++; + gro->shobjno = gl2ps->objects_stack++; + } + else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){ + gro->gsno = gl2ps->extgs_stack++; + gro->gsobjno = gl2ps->objects_stack++; + gro->shno = gl2ps->shader_stack++; + gro->shobjno = gl2ps->objects_stack++; + gro->trgroupno = gl2ps->trgroupobjects_stack++; + gro->trgroupobjno = gl2ps->objects_stack++; + gro->maskshno = gl2ps->mshader_stack++; + gro->maskshobjno = gl2ps->objects_stack++; + } +} + +/* Main stream data */ + +static void gl2psPDFgroupListWriteMainStream(void) +{ + int i, j, lastel; + GL2PSprimitive *prim = NULL, *prev = NULL; + GL2PSpdfgroup *gro; + GL2PStriangle t; + + if(!gl2ps->pdfgrouplist) + return; + + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + + lastel = gl2psListNbr(gro->ptrlist) - 1; + if(lastel < 0) + continue; + + prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); + + switch(prim->type){ + case GL2PS_POINT: + gl2ps->streamlength += gl2psPrintf("1 J\n"); + gl2ps->streamlength += gl2psPrintPDFLineWidth(prim->width); + gl2ps->streamlength += gl2psPrintPDFStrokeColor(prim->verts[0].rgba); + for(j = 0; j <= lastel; ++j){ + prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); + gl2ps->streamlength += + gl2psPrintf("%f %f m %f %f l\n", + prim->verts[0].xyz[0], prim->verts[0].xyz[1], + prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + } + gl2ps->streamlength += gl2psPrintf("S\n"); + gl2ps->streamlength += gl2psPrintf("0 J\n"); + break; + case GL2PS_LINE: + /* We try to use as few paths as possible to draw lines, in + order to get nice stippling even when the individual segments + are smaller than the stipple */ + gl2ps->streamlength += gl2psPrintPDFLineWidth(prim->width); + gl2ps->streamlength += gl2psPrintPDFStrokeColor(prim->verts[0].rgba); + gl2ps->streamlength += gl2psPrintPostScriptDash(prim->pattern, prim->factor, "d"); + /* start new path */ + gl2ps->streamlength += + gl2psPrintf("%f %f m\n", + prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + + for(j = 1; j <= lastel; ++j){ + prev = prim; + prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); + if(!gl2psSamePosition(prim->verts[0].xyz, prev->verts[1].xyz)){ + /* the starting point of the new segment does not match the + end point of the previous line, so we end the current + path and start a new one */ + gl2ps->streamlength += + gl2psPrintf("%f %f l\n", + prev->verts[1].xyz[0], prev->verts[1].xyz[1]); + gl2ps->streamlength += + gl2psPrintf("%f %f m\n", + prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + } + else{ + /* the two segements are connected, so we just append to the + current path */ + gl2ps->streamlength += + gl2psPrintf("%f %f l\n", + prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + } + } + /* end last path */ + gl2ps->streamlength += + gl2psPrintf("%f %f l\n", + prim->verts[1].xyz[0], prim->verts[1].xyz[1]); + gl2ps->streamlength += gl2psPrintf("S\n"); + break; + case GL2PS_TRIANGLE: + gl2psFillTriangleFromPrimitive(&t, prim, GL_TRUE); + gl2psSortOutTrianglePDFgroup(gro); + + /* No alpha and const color: Simple PDF draw orders */ + if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_1){ + gl2ps->streamlength += gl2psPrintPDFFillColor(t.vertex[0].rgba); + for(j = 0; j <= lastel; ++j){ + prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); + gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE); + gl2ps->streamlength + += gl2psPrintf("%f %f m\n" + "%f %f l\n" + "%f %f l\n" + "h f\n", + t.vertex[0].xyz[0], t.vertex[0].xyz[1], + t.vertex[1].xyz[0], t.vertex[1].xyz[1], + t.vertex[2].xyz[0], t.vertex[2].xyz[1]); + } + } + /* Const alpha < 1 and const color: Simple PDF draw orders + and an extra extended Graphics State for the alpha const */ + else if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){ + gl2ps->streamlength += gl2psPrintf("q\n" + "/GS%d gs\n", + gro->gsno); + gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); + for(j = 0; j <= lastel; ++j){ + prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); + gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE); + gl2ps->streamlength + += gl2psPrintf("%f %f m\n" + "%f %f l\n" + "%f %f l\n" + "h f\n", + t.vertex[0].xyz[0], t.vertex[0].xyz[1], + t.vertex[1].xyz[0], t.vertex[1].xyz[1], + t.vertex[2].xyz[0], t.vertex[2].xyz[1]); + } + gl2ps->streamlength += gl2psPrintf("Q\n"); + } + /* Variable alpha and const color: Simple PDF draw orders + and an extra extended Graphics State + Xobject + Shader + object for the alpha mask */ + else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){ + gl2ps->streamlength += gl2psPrintf("q\n" + "/GS%d gs\n" + "/TrG%d Do\n", + gro->gsno, gro->trgroupno); + gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); + for(j = 0; j <= lastel; ++j){ + prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); + gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE); + gl2ps->streamlength + += gl2psPrintf("%f %f m\n" + "%f %f l\n" + "%f %f l\n" + "h f\n", + t.vertex[0].xyz[0], t.vertex[0].xyz[1], + t.vertex[1].xyz[0], t.vertex[1].xyz[1], + t.vertex[2].xyz[0], t.vertex[2].xyz[1]); + } + gl2ps->streamlength += gl2psPrintf("Q\n"); + } + /* Variable color and no alpha: Shader Object for the colored + triangle(s) */ + else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){ + gl2ps->streamlength += gl2psPrintf("/Sh%d sh\n", gro->shno); + } + /* Variable color and const alpha < 1: Shader Object for the + colored triangle(s) and an extra extended Graphics State + for the alpha const */ + else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){ + gl2ps->streamlength += gl2psPrintf("q\n" + "/GS%d gs\n" + "/Sh%d sh\n" + "Q\n", + gro->gsno, gro->shno); + } + /* Variable alpha and color: Shader Object for the colored + triangle(s) and an extra extended Graphics State + + Xobject + Shader object for the alpha mask */ + else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){ + gl2ps->streamlength += gl2psPrintf("q\n" + "/GS%d gs\n" + "/TrG%d Do\n" + "/Sh%d sh\n" + "Q\n", + gro->gsno, gro->trgroupno, gro->shno); + } + break; + case GL2PS_PIXMAP: + for(j = 0; j <= lastel; ++j){ + prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); + gl2psPutPDFImage(prim->data.image, gro->imno, prim->verts[0].xyz[0], + prim->verts[0].xyz[1]); + } + break; + case GL2PS_TEXT: + for(j = 0; j <= lastel; ++j){ + prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); + gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); + gl2psPutPDFText(prim->data.text, gro->fontno, prim->verts[0].xyz[0], + prim->verts[0].xyz[1]); + } + break; + default: + break; + } + } +} + +/* Graphics State names */ + +static int gl2psPDFgroupListWriteGStateResources(void) +{ + GL2PSpdfgroup *gro; + int offs = 0; + int i; + + offs += fprintf(gl2ps->stream, + "/ExtGState\n" + "<<\n" + "/GSa 7 0 R\n"); + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + if(gro->gsno >= 0) + offs += fprintf(gl2ps->stream, "/GS%d %d 0 R\n", gro->gsno, gro->gsobjno); + } + offs += fprintf(gl2ps->stream, ">>\n"); + return offs; +} + +/* Main Shader names */ + +static int gl2psPDFgroupListWriteShaderResources(void) +{ + GL2PSpdfgroup *gro; + int offs = 0; + int i; + + offs += fprintf(gl2ps->stream, + "/Shading\n" + "<<\n"); + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + if(gro->shno >= 0) + offs += fprintf(gl2ps->stream, "/Sh%d %d 0 R\n", gro->shno, gro->shobjno); + if(gro->maskshno >= 0) + offs += fprintf(gl2ps->stream, "/TrSh%d %d 0 R\n", gro->maskshno, gro->maskshobjno); + } + offs += fprintf(gl2ps->stream,">>\n"); + return offs; +} + +/* Images & Mask Shader XObject names */ + +static int gl2psPDFgroupListWriteXObjectResources(void) +{ + int i; + GL2PSprimitive *p = NULL; + GL2PSpdfgroup *gro; + int offs = 0; + + offs += fprintf(gl2ps->stream, + "/XObject\n" + "<<\n"); + + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + if(!gl2psListNbr(gro->ptrlist)) + continue; + p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); + switch(p->type){ + case GL2PS_PIXMAP: + gro->imobjno = gl2ps->objects_stack++; + if(GL_RGBA == p->data.image->format) /* reserve one object for image mask */ + gl2ps->objects_stack++; + offs += fprintf(gl2ps->stream, "/Im%d %d 0 R\n", gro->imno, gro->imobjno); + case GL2PS_TRIANGLE: + if(gro->trgroupno >=0) + offs += fprintf(gl2ps->stream, "/TrG%d %d 0 R\n", gro->trgroupno, gro->trgroupobjno); + break; + default: + break; + } + } + offs += fprintf(gl2ps->stream,">>\n"); + return offs; +} + +/* Font names */ + +static int gl2psPDFgroupListWriteFontResources(void) +{ + int i; + GL2PSpdfgroup *gro; + int offs = 0; + + offs += fprintf(gl2ps->stream, "/Font\n<<\n"); + + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + if(gro->fontno < 0) + continue; + gro->fontobjno = gl2ps->objects_stack++; + offs += fprintf(gl2ps->stream, "/F%d %d 0 R\n", gro->fontno, gro->fontobjno); + } + offs += fprintf(gl2ps->stream, ">>\n"); + + return offs; +} + +static void gl2psPDFgroupListDelete(void) +{ + int i; + GL2PSpdfgroup *gro = NULL; + + if(!gl2ps->pdfgrouplist) + return; + + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist,i); + gl2psListDelete(gro->ptrlist); + } + + gl2psListDelete(gl2ps->pdfgrouplist); + gl2ps->pdfgrouplist = NULL; +} + +/* Print 1st PDF object - file info */ + +static int gl2psPrintPDFInfo(void) +{ + int offs; + time_t now; + struct tm *newtime; + + time(&now); + newtime = gmtime(&now); + + offs = fprintf(gl2ps->stream, + "1 0 obj\n" + "<<\n" + "/Title (%s)\n" + "/Creator (GL2PS %d.%d.%d%s, %s)\n" + "/Producer (%s)\n", + gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, + GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, + gl2ps->producer); + + if(!newtime){ + offs += fprintf(gl2ps->stream, + ">>\n" + "endobj\n"); + return offs; + } + + offs += fprintf(gl2ps->stream, + "/CreationDate (D:%d%02d%02d%02d%02d%02d)\n" + ">>\n" + "endobj\n", + newtime->tm_year+1900, + newtime->tm_mon+1, + newtime->tm_mday, + newtime->tm_hour, + newtime->tm_min, + newtime->tm_sec); + return offs; +} + +/* Create catalog and page structure - 2nd and 3th PDF object */ + +static int gl2psPrintPDFCatalog(void) +{ + return fprintf(gl2ps->stream, + "2 0 obj\n" + "<<\n" + "/Type /Catalog\n" + "/Pages 3 0 R\n" + ">>\n" + "endobj\n"); +} + +static int gl2psPrintPDFPages(void) +{ + return fprintf(gl2ps->stream, + "3 0 obj\n" + "<<\n" + "/Type /Pages\n" + "/Kids [6 0 R]\n" + "/Count 1\n" + ">>\n" + "endobj\n"); +} + +/* Open stream for data - graphical objects, fonts etc. PDF object 4 */ + +static int gl2psOpenPDFDataStream(void) +{ + int offs = 0; + + offs += fprintf(gl2ps->stream, + "4 0 obj\n" + "<<\n" + "/Length 5 0 R\n" ); + offs += gl2psPrintPDFCompressorType(); + offs += fprintf(gl2ps->stream, + ">>\n" + "stream\n"); + return offs; +} + +/* Stream setup - Graphics state, fill background if allowed */ + +static int gl2psOpenPDFDataStreamWritePreface(void) +{ + int offs; + + offs = gl2psPrintf("/GSa gs\n"); + + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ + offs += gl2psPrintPDFFillColor(gl2ps->bgcolor); + offs += gl2psPrintf("%d %d %d %d re\n", + (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], + (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); + offs += gl2psPrintf("f\n"); + } + return offs; +} + +/* Use the functions above to create the first part of the PDF*/ + +static void gl2psPrintPDFHeader(void) +{ + int offs = 0; + gl2ps->pdfprimlist = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*)); + gl2psPDFstacksInit(); + + gl2ps->xreflist = (int*)gl2psMalloc(sizeof(int) * gl2ps->objects_stack); + +#if defined(GL2PS_HAVE_ZLIB) + if(gl2ps->options & GL2PS_COMPRESS){ + gl2psSetupCompress(); + } +#endif + gl2ps->xreflist[0] = 0; + offs += fprintf(gl2ps->stream, "%%PDF-1.4\n"); + gl2ps->xreflist[1] = offs; + + offs += gl2psPrintPDFInfo(); + gl2ps->xreflist[2] = offs; + + offs += gl2psPrintPDFCatalog(); + gl2ps->xreflist[3] = offs; + + offs += gl2psPrintPDFPages(); + gl2ps->xreflist[4] = offs; + + offs += gl2psOpenPDFDataStream(); + gl2ps->xreflist[5] = offs; /* finished in gl2psPrintPDFFooter */ + gl2ps->streamlength = gl2psOpenPDFDataStreamWritePreface(); +} + +/* The central primitive drawing */ + +static void gl2psPrintPDFPrimitive(void *data) +{ + GL2PSprimitive *prim = *(GL2PSprimitive**)data; + + if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) + return; + + prim = gl2psCopyPrimitive(prim); /* deep copy */ + gl2psListAdd(gl2ps->pdfprimlist, &prim); +} + +/* close stream and ... */ + +static int gl2psClosePDFDataStream(void) +{ + int offs = 0; + +#if defined(GL2PS_HAVE_ZLIB) + if(gl2ps->options & GL2PS_COMPRESS){ + if(Z_OK != gl2psDeflate()) + gl2psMsg(GL2PS_ERROR, "Zlib deflate error"); + else + fwrite(gl2ps->compress->dest, gl2ps->compress->destLen, 1, gl2ps->stream); + gl2ps->streamlength += gl2ps->compress->destLen; + + offs += gl2ps->streamlength; + gl2psFreeCompress(); + } +#endif + + offs += fprintf(gl2ps->stream, + "endstream\n" + "endobj\n"); + return offs; +} + +/* ... write the now known length object */ + +static int gl2psPrintPDFDataStreamLength(int val) +{ + return fprintf(gl2ps->stream, + "5 0 obj\n" + "%d\n" + "endobj\n", val); +} + +/* Put the info created before in PDF objects */ + +static int gl2psPrintPDFOpenPage(void) +{ + int offs; + + /* Write fixed part */ + + offs = fprintf(gl2ps->stream, + "6 0 obj\n" + "<<\n" + "/Type /Page\n" + "/Parent 3 0 R\n" + "/MediaBox [%d %d %d %d]\n", + (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], + (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); + + if(gl2ps->options & GL2PS_LANDSCAPE) + offs += fprintf(gl2ps->stream, "/Rotate -90\n"); + + offs += fprintf(gl2ps->stream, + "/Contents 4 0 R\n" + "/Resources\n" + "<<\n" + "/ProcSet [/PDF /Text /ImageB /ImageC] %%/ImageI\n"); + + return offs; + + /* End fixed part, proceeds in gl2psPDFgroupListWriteVariableResources() */ +} + +static int gl2psPDFgroupListWriteVariableResources(void) +{ + int offs = 0; + + /* a) Graphics States for shader alpha masks*/ + offs += gl2psPDFgroupListWriteGStateResources(); + + /* b) Shader and shader masks */ + offs += gl2psPDFgroupListWriteShaderResources(); + + /* c) XObjects (Images & Shader Masks) */ + offs += gl2psPDFgroupListWriteXObjectResources(); + + /* d) Fonts */ + offs += gl2psPDFgroupListWriteFontResources(); + + /* End resources and page */ + offs += fprintf(gl2ps->stream, + ">>\n" + ">>\n" + "endobj\n"); + return offs; +} + +/* Standard Graphics State */ + +static int gl2psPrintPDFGSObject(void) +{ + return fprintf(gl2ps->stream, + "7 0 obj\n" + "<<\n" + "/Type /ExtGState\n" + "/SA false\n" + "/SM 0.02\n" + "/OP false\n" + "/op false\n" + "/OPM 0\n" + "/BG2 /Default\n" + "/UCR2 /Default\n" + "/TR2 /Default\n" + ">>\n" + "endobj\n"); +} + +/* Put vertex' edge flag (8bit) and coordinates (32bit) in shader stream */ + +static int gl2psPrintPDFShaderStreamDataCoord(GL2PSvertex *vertex, + size_t (*action)(unsigned long data, + size_t size), + GLfloat dx, GLfloat dy, + GLfloat xmin, GLfloat ymin) +{ + int offs = 0; + unsigned long imap; + GLfloat diff; + double dmax = ~1UL; + char edgeflag = 0; + + /* FIXME: temp bux fix for 64 bit archs: */ + if(sizeof(unsigned long) == 8) dmax = dmax - 2048.; + + offs += (*action)(edgeflag, 1); + + /* The Shader stream in PDF requires to be in a 'big-endian' + order */ + + if(GL2PS_ZERO(dx*dy)){ + offs += (*action)(0, 4); + offs += (*action)(0, 4); + } + else{ + diff = (vertex->xyz[0] - xmin) / dx; + if(diff > 1) + diff = 1.0F; + else if(diff < 0) + diff = 0.0F; + imap = (unsigned long)(diff * dmax); + offs += (*action)(imap, 4); + + diff = (vertex->xyz[1] - ymin) / dy; + if(diff > 1) + diff = 1.0F; + else if(diff < 0) + diff = 0.0F; + imap = (unsigned long)(diff * dmax); + offs += (*action)(imap, 4); + } + + return offs; +} + +/* Put vertex' rgb value (8bit for every component) in shader stream */ + +static int gl2psPrintPDFShaderStreamDataRGB(GL2PSvertex *vertex, + size_t (*action)(unsigned long data, + size_t size)) +{ + int offs = 0; + unsigned long imap; + double dmax = ~1UL; + + /* FIXME: temp bux fix for 64 bit archs: */ + if(sizeof(unsigned long) == 8) dmax = dmax - 2048.; + + imap = (unsigned long)((vertex->rgba[0]) * dmax); + offs += (*action)(imap, 1); + + imap = (unsigned long)((vertex->rgba[1]) * dmax); + offs += (*action)(imap, 1); + + imap = (unsigned long)((vertex->rgba[2]) * dmax); + offs += (*action)(imap, 1); + + return offs; +} + +/* Put vertex' alpha (8/16bit) in shader stream */ + +static int gl2psPrintPDFShaderStreamDataAlpha(GL2PSvertex *vertex, + size_t (*action)(unsigned long data, + size_t size), + int sigbyte) +{ + int offs = 0; + unsigned long imap; + double dmax = ~1UL; + + /* FIXME: temp bux fix for 64 bit archs: */ + if(sizeof(unsigned long) == 8) dmax = dmax - 2048.; + + if(sigbyte != 8 && sigbyte != 16) + sigbyte = 8; + + sigbyte /= 8; + + imap = (unsigned long)((vertex->rgba[3]) * dmax); + + offs += (*action)(imap, sigbyte); + + return offs; +} + +/* Put a triangles raw data in shader stream */ + +static int gl2psPrintPDFShaderStreamData(GL2PStriangle *triangle, + GLfloat dx, GLfloat dy, + GLfloat xmin, GLfloat ymin, + size_t (*action)(unsigned long data, + size_t size), + int gray) +{ + int i, offs = 0; + GL2PSvertex v; + + if(gray && gray != 8 && gray != 16) + gray = 8; + + for(i = 0; i < 3; ++i){ + offs += gl2psPrintPDFShaderStreamDataCoord(&triangle->vertex[i], action, + dx, dy, xmin, ymin); + if(gray){ + v = triangle->vertex[i]; + offs += gl2psPrintPDFShaderStreamDataAlpha(&v, action, gray); + } + else{ + offs += gl2psPrintPDFShaderStreamDataRGB(&triangle->vertex[i], action); + } + } + + return offs; +} + +static void gl2psPDFRectHull(GLfloat *xmin, GLfloat *xmax, + GLfloat *ymin, GLfloat *ymax, + GL2PStriangle *triangles, int cnt) +{ + int i, j; + + *xmin = triangles[0].vertex[0].xyz[0]; + *xmax = triangles[0].vertex[0].xyz[0]; + *ymin = triangles[0].vertex[0].xyz[1]; + *ymax = triangles[0].vertex[0].xyz[1]; + + for(i = 0; i < cnt; ++i){ + for(j = 0; j < 3; ++j){ + if(*xmin > triangles[i].vertex[j].xyz[0]) + *xmin = triangles[i].vertex[j].xyz[0]; + if(*xmax < triangles[i].vertex[j].xyz[0]) + *xmax = triangles[i].vertex[j].xyz[0]; + if(*ymin > triangles[i].vertex[j].xyz[1]) + *ymin = triangles[i].vertex[j].xyz[1]; + if(*ymax < triangles[i].vertex[j].xyz[1]) + *ymax = triangles[i].vertex[j].xyz[1]; + } + } +} + +/* Writes shaded triangle + gray == 0 means write RGB triangles + gray == 8 8bit-grayscale (for alpha masks) + gray == 16 16bit-grayscale (for alpha masks) */ + +static int gl2psPrintPDFShader(int obj, GL2PStriangle *triangles, + int size, int gray) +{ + int i, offs = 0, vertexbytes, done = 0; + GLfloat xmin, xmax, ymin, ymax; + + switch(gray){ + case 0: + vertexbytes = 1+4+4+1+1+1; + break; + case 8: + vertexbytes = 1+4+4+1; + break; + case 16: + vertexbytes = 1+4+4+2; + break; + default: + gray = 8; + vertexbytes = 1+4+4+1; + break; + } + + gl2psPDFRectHull(&xmin, &xmax, &ymin, &ymax, triangles, size); + + offs += fprintf(gl2ps->stream, + "%d 0 obj\n" + "<< " + "/ShadingType 4 " + "/ColorSpace %s " + "/BitsPerCoordinate 32 " + "/BitsPerComponent %d " + "/BitsPerFlag 8 " + "/Decode [%f %f %f %f 0 1 %s] ", + obj, + (gray) ? "/DeviceGray" : "/DeviceRGB", + (gray) ? gray : 8, + xmin, xmax, ymin, ymax, + (gray) ? "" : "0 1 0 1"); + +#if defined(GL2PS_HAVE_ZLIB) + if(gl2ps->options & GL2PS_COMPRESS){ + gl2psAllocCompress(vertexbytes * size * 3); + + for(i = 0; i < size; ++i) + gl2psPrintPDFShaderStreamData(&triangles[i], + xmax-xmin, ymax-ymin, xmin, ymin, + gl2psWriteBigEndianCompress, gray); + + if(Z_OK == gl2psDeflate() && 23 + gl2ps->compress->destLen < gl2ps->compress->srcLen){ + offs += gl2psPrintPDFCompressorType(); + offs += fprintf(gl2ps->stream, + "/Length %d " + ">>\n" + "stream\n", + (int)gl2ps->compress->destLen); + offs += gl2ps->compress->destLen * fwrite(gl2ps->compress->dest, + gl2ps->compress->destLen, + 1, gl2ps->stream); + done = 1; + } + gl2psFreeCompress(); + } +#endif + + if(!done){ + /* no compression, or too long after compression, or compress error + -> write non-compressed entry */ + offs += fprintf(gl2ps->stream, + "/Length %d " + ">>\n" + "stream\n", + vertexbytes * 3 * size); + for(i = 0; i < size; ++i) + offs += gl2psPrintPDFShaderStreamData(&triangles[i], + xmax-xmin, ymax-ymin, xmin, ymin, + gl2psWriteBigEndian, gray); + } + + offs += fprintf(gl2ps->stream, + "\nendstream\n" + "endobj\n"); + + return offs; +} + +/* Writes a XObject for a shaded triangle mask */ + +static int gl2psPrintPDFShaderMask(int obj, int childobj) +{ + int offs = 0, len; + + offs += fprintf(gl2ps->stream, + "%d 0 obj\n" + "<<\n" + "/Type /XObject\n" + "/Subtype /Form\n" + "/BBox [ %d %d %d %d ]\n" + "/Group \n<<\n/S /Transparency /CS /DeviceRGB\n" + ">>\n", + obj, + (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], + (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); + + len = (childobj>0) + ? strlen("/TrSh sh\n") + (int)log10((double)childobj)+1 + : strlen("/TrSh0 sh\n"); + + offs += fprintf(gl2ps->stream, + "/Length %d\n" + ">>\n" + "stream\n", + len); + offs += fprintf(gl2ps->stream, + "/TrSh%d sh\n", + childobj); + offs += fprintf(gl2ps->stream, + "endstream\n" + "endobj\n"); + + return offs; +} + +/* Writes a Extended graphics state for a shaded triangle mask if + simplealpha ist true the childobj argument is ignored and a /ca + statement will be written instead */ + +static int gl2psPrintPDFShaderExtGS(int obj, int childobj) +{ + int offs = 0; + + offs += fprintf(gl2ps->stream, + "%d 0 obj\n" + "<<\n", + obj); + + offs += fprintf(gl2ps->stream, + "/SMask << /S /Alpha /G %d 0 R >> ", + childobj); + + offs += fprintf(gl2ps->stream, + ">>\n" + "endobj\n"); + return offs; +} + +/* a simple graphics state */ + +static int gl2psPrintPDFShaderSimpleExtGS(int obj, GLfloat alpha) +{ + int offs = 0; + + offs += fprintf(gl2ps->stream, + "%d 0 obj\n" + "<<\n" + "/ca %g" + ">>\n" + "endobj\n", + obj, alpha); + return offs; +} + +/* Similar groups of functions for pixmaps and text */ + +static int gl2psPrintPDFPixmapStreamData(GL2PSimage *im, + size_t (*action)(unsigned long data, + size_t size), + int gray) +{ + int x, y; + GLfloat r, g, b, a; + + if(im->format != GL_RGBA && gray) + return 0; + + if(gray && gray !=8 && gray != 16) + gray = 8; + + gray /= 8; + + for(y = 0; y < im->height; ++y){ + for(x = 0; x < im->width; ++x){ + a = gl2psGetRGB(im, x, y, &r, &g, &b); + if(im->format == GL_RGBA && gray){ + (*action)((unsigned long)(a*255) << 24, gray); + } + else{ + (*action)((unsigned long)(r*255) << 24, 1); + (*action)((unsigned long)(g*255) << 24, 1); + (*action)((unsigned long)(b*255) << 24, 1); + } + } + } + + switch(gray){ + case 0: return 3 * im->width * im->height; + case 1: return im->width * im->height; + case 2: return 2 * im->width * im->height; + default: return 3 * im->width * im->height; + } +} + +static int gl2psPrintPDFPixmap(int obj, int childobj, GL2PSimage *im, int gray) +{ + int offs = 0, done = 0, sigbytes = 3; + + if(gray && gray !=8 && gray != 16) + gray = 8; + + if(gray) + sigbytes = gray / 8; + + offs += fprintf(gl2ps->stream, + "%d 0 obj\n" + "<<\n" + "/Type /XObject\n" + "/Subtype /Image\n" + "/Width %d\n" + "/Height %d\n" + "/ColorSpace %s \n" + "/BitsPerComponent 8\n", + obj, + (int)im->width, (int)im->height, + (gray) ? "/DeviceGray" : "/DeviceRGB" ); + if(GL_RGBA == im->format && gray == 0){ + offs += fprintf(gl2ps->stream, + "/SMask %d 0 R\n", + childobj); + } + +#if defined(GL2PS_HAVE_ZLIB) + if(gl2ps->options & GL2PS_COMPRESS){ + gl2psAllocCompress((int)(im->width * im->height * sigbytes)); + + gl2psPrintPDFPixmapStreamData(im, gl2psWriteBigEndianCompress, gray); + + if(Z_OK == gl2psDeflate() && 23 + gl2ps->compress->destLen < gl2ps->compress->srcLen){ + offs += gl2psPrintPDFCompressorType(); + offs += fprintf(gl2ps->stream, + "/Length %d " + ">>\n" + "stream\n", + (int)gl2ps->compress->destLen); + offs += gl2ps->compress->destLen * fwrite(gl2ps->compress->dest, gl2ps->compress->destLen, + 1, gl2ps->stream); + done = 1; + } + gl2psFreeCompress(); + } +#endif + + if(!done){ + /* no compression, or too long after compression, or compress error + -> write non-compressed entry */ + offs += fprintf(gl2ps->stream, + "/Length %d " + ">>\n" + "stream\n", + (int)(im->width * im->height * sigbytes)); + offs += gl2psPrintPDFPixmapStreamData(im, gl2psWriteBigEndian, gray); + } + + offs += fprintf(gl2ps->stream, + "\nendstream\n" + "endobj\n"); + + return offs; +} + +static int gl2psPrintPDFText(int obj, GL2PSstring *s, int fontnumber) +{ + int offs = 0; + + offs += fprintf(gl2ps->stream, + "%d 0 obj\n" + "<<\n" + "/Type /Font\n" + "/Subtype /Type1\n" + "/Name /F%d\n" + "/BaseFont /%s\n" + "/Encoding /MacRomanEncoding\n" + ">>\n" + "endobj\n", + obj, fontnumber, s->fontname); + return offs; +} + +/* Write the physical objects */ + +static int gl2psPDFgroupListWriteObjects(int entryoffs) +{ + int i,j; + GL2PSprimitive *p = NULL; + GL2PSpdfgroup *gro; + int offs = entryoffs; + GL2PStriangle *triangles; + int size = 0; + + if(!gl2ps->pdfgrouplist) + return offs; + + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + if(!gl2psListNbr(gro->ptrlist)) + continue; + p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); + switch(p->type){ + case GL2PS_POINT: + break; + case GL2PS_LINE: + break; + case GL2PS_TRIANGLE: + size = gl2psListNbr(gro->ptrlist); + triangles = (GL2PStriangle*)gl2psMalloc(sizeof(GL2PStriangle) * size); + for(j = 0; j < size; ++j){ + p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); + gl2psFillTriangleFromPrimitive(&triangles[j], p, GL_TRUE); + } + if(triangles[0].prop & T_VAR_COLOR){ + gl2ps->xreflist[gro->shobjno] = offs; + offs += gl2psPrintPDFShader(gro->shobjno, triangles, size, 0); + } + if(triangles[0].prop & T_ALPHA_LESS_1){ + gl2ps->xreflist[gro->gsobjno] = offs; + offs += gl2psPrintPDFShaderSimpleExtGS(gro->gsobjno, triangles[0].vertex[0].rgba[3]); + } + if(triangles[0].prop & T_VAR_ALPHA){ + gl2ps->xreflist[gro->gsobjno] = offs; + offs += gl2psPrintPDFShaderExtGS(gro->gsobjno, gro->trgroupobjno); + gl2ps->xreflist[gro->trgroupobjno] = offs; + offs += gl2psPrintPDFShaderMask(gro->trgroupobjno, gro->maskshno); + gl2ps->xreflist[gro->maskshobjno] = offs; + offs += gl2psPrintPDFShader(gro->maskshobjno, triangles, size, 8); + } + gl2psFree(triangles); + break; + case GL2PS_PIXMAP: + gl2ps->xreflist[gro->imobjno] = offs; + offs += gl2psPrintPDFPixmap(gro->imobjno, gro->imobjno+1, p->data.image, 0); + if(p->data.image->format == GL_RGBA){ + gl2ps->xreflist[gro->imobjno+1] = offs; + offs += gl2psPrintPDFPixmap(gro->imobjno+1, -1, p->data.image, 8); + } + break; + case GL2PS_TEXT: + gl2ps->xreflist[gro->fontobjno] = offs; + offs += gl2psPrintPDFText(gro->fontobjno,p->data.text,gro->fontno); + break; + case GL2PS_SPECIAL : + /* alignment contains the format for which the special output text + is intended */ + if(p->data.text->alignment == GL2PS_PDF) + offs += fprintf(gl2ps->stream, "%s\n", p->data.text->str); + break; + default: + break; + } + } + return offs; +} + +/* All variable data has been written at this point and all required + functioninality has been gathered, so we can write now file footer + with cross reference table and trailer */ + +static void gl2psPrintPDFFooter(void) +{ + int i, offs; + + gl2psPDFgroupListInit(); + gl2psPDFgroupListWriteMainStream(); + + offs = gl2ps->xreflist[5] + gl2ps->streamlength; + offs += gl2psClosePDFDataStream(); + gl2ps->xreflist[5] = offs; + + offs += gl2psPrintPDFDataStreamLength(gl2ps->streamlength); + gl2ps->xreflist[6] = offs; + gl2ps->streamlength = 0; + + offs += gl2psPrintPDFOpenPage(); + offs += gl2psPDFgroupListWriteVariableResources(); + gl2ps->xreflist = (int*)gl2psRealloc(gl2ps->xreflist, + sizeof(int) * (gl2ps->objects_stack + 1)); + gl2ps->xreflist[7] = offs; + + offs += gl2psPrintPDFGSObject(); + gl2ps->xreflist[8] = offs; + + gl2ps->xreflist[gl2ps->objects_stack] = + gl2psPDFgroupListWriteObjects(gl2ps->xreflist[8]); + + /* Start cross reference table. The file has to been opened in + binary mode to preserve the 20 digit string length! */ + fprintf(gl2ps->stream, + "xref\n" + "0 %d\n" + "%010d 65535 f \n", gl2ps->objects_stack, 0); + + for(i = 1; i < gl2ps->objects_stack; ++i) + fprintf(gl2ps->stream, "%010d 00000 n \n", gl2ps->xreflist[i]); + + fprintf(gl2ps->stream, + "trailer\n" + "<<\n" + "/Size %d\n" + "/Info 1 0 R\n" + "/Root 2 0 R\n" + ">>\n" + "startxref\n%d\n" + "%%%%EOF\n", + gl2ps->objects_stack, gl2ps->xreflist[gl2ps->objects_stack]); + + /* Free auxiliary lists and arrays */ + gl2psFree(gl2ps->xreflist); + gl2psListDelete(gl2ps->pdfprimlist); + gl2psPDFgroupListDelete(); + +#if defined(GL2PS_HAVE_ZLIB) + if(gl2ps->options & GL2PS_COMPRESS){ + gl2psFreeCompress(); + gl2psFree(gl2ps->compress); + gl2ps->compress = NULL; + } +#endif +} + +/* PDF begin viewport */ + +static void gl2psPrintPDFBeginViewport(GLint viewport[4]) +{ + int offs = 0; + GLint indx; + GLfloat rgba[4]; + int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; + + glRenderMode(GL_FEEDBACK); + + if(gl2ps->header){ + gl2psPrintPDFHeader(); + gl2ps->header = GL_FALSE; + } + + offs += gl2psPrintf("q\n"); + + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ + if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){ + glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba); + } + else{ + glGetIntegerv(GL_INDEX_CLEAR_VALUE, &indx); + rgba[0] = gl2ps->colormap[indx][0]; + rgba[1] = gl2ps->colormap[indx][1]; + rgba[2] = gl2ps->colormap[indx][2]; + rgba[3] = 1.0F; + } + offs += gl2psPrintPDFFillColor(rgba); + offs += gl2psPrintf("%d %d %d %d re\n" + "W\n" + "f\n", + x, y, w, h); + } + else{ + offs += gl2psPrintf("%d %d %d %d re\n" + "W\n" + "n\n", + x, y, w, h); + } + + gl2ps->streamlength += offs; +} + +static GLint gl2psPrintPDFEndViewport(void) +{ + GLint res; + + res = gl2psPrintPrimitives(); + gl2ps->streamlength += gl2psPrintf("Q\n"); + return res; +} + +static void gl2psPrintPDFFinalPrimitive(void) +{ +} + +/* definition of the PDF backend */ + +static GL2PSbackend gl2psPDF = { + gl2psPrintPDFHeader, + gl2psPrintPDFFooter, + gl2psPrintPDFBeginViewport, + gl2psPrintPDFEndViewport, + gl2psPrintPDFPrimitive, + gl2psPrintPDFFinalPrimitive, + "pdf", + "Portable Document Format" +}; + +/********************************************************************* + * + * SVG routines + * + *********************************************************************/ + +static void gl2psSVGGetCoordsAndColors(int n, GL2PSvertex *verts, + GL2PSxyz *xyz, GL2PSrgba *rgba) +{ + int i, j; + + for(i = 0; i < n; i++){ + xyz[i][0] = verts[i].xyz[0]; + xyz[i][1] = gl2ps->viewport[3] - verts[i].xyz[1]; + xyz[i][2] = 0.0F; + for(j = 0; j < 4; j++) + rgba[i][j] = verts[i].rgba[j]; + } +} + +static void gl2psSVGGetColorString(GL2PSrgba rgba, char str[32]) +{ + int r = (int)(255. * rgba[0]); + int g = (int)(255. * rgba[1]); + int b = (int)(255. * rgba[2]); + int rc = (r < 0) ? 0 : (r > 255) ? 255 : r; + int gc = (g < 0) ? 0 : (g > 255) ? 255 : g; + int bc = (b < 0) ? 0 : (b > 255) ? 255 : b; + sprintf(str, "#%2.2x%2.2x%2.2x", rc, gc, bc); +} + +static void gl2psPrintSVGHeader(void) +{ + int x, y, width, height; + char col[32]; + time_t now; + + time(&now); + + if (gl2ps->options & GL2PS_LANDSCAPE){ + x = (int)gl2ps->viewport[1]; + y = (int)gl2ps->viewport[0]; + width = (int)gl2ps->viewport[3]; + height = (int)gl2ps->viewport[2]; + } + else{ + x = (int)gl2ps->viewport[0]; + y = (int)gl2ps->viewport[1]; + width = (int)gl2ps->viewport[2]; + height = (int)gl2ps->viewport[3]; + } + + /* Compressed SVG files (.svgz) are simply gzipped SVG files */ + gl2psPrintGzipHeader(); + + gl2psPrintf("\n"); + gl2psPrintf("\n", + width, height, x, y, width, height); + gl2psPrintf("%s\n", gl2ps->title); + gl2psPrintf("\n"); + gl2psPrintf("Creator: GL2PS %d.%d.%d%s, %s\n" + "For: %s\n" + "CreationDate: %s", + GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, + GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer, ctime(&now)); + gl2psPrintf("\n"); + gl2psPrintf("\n"); + gl2psPrintf("\n"); + + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ + gl2psSVGGetColorString(gl2ps->bgcolor, col); + gl2psPrintf("\n", col, + (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], + (int)gl2ps->viewport[2], (int)gl2ps->viewport[1], + (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], + (int)gl2ps->viewport[0], (int)gl2ps->viewport[3]); + } + + gl2psPrintf("\n"); +} + +static void gl2psPrintSVGSmoothTriangle(GL2PSxyz xyz[3], GL2PSrgba rgba[3]) +{ + int i; + GL2PSxyz xyz2[3]; + GL2PSrgba rgba2[3]; + char col[32]; + + /* Apparently there is no easy way to do Gouraud shading in SVG + without explicitly pre-defining gradients, so for now we just do + recursive subdivision */ + + if(gl2psSameColorThreshold(3, rgba, gl2ps->threshold)){ + gl2psSVGGetColorString(rgba[0], col); + gl2psPrintf("\n", xyz[0][0], xyz[0][1], + xyz[1][0], xyz[1][1], xyz[2][0], xyz[2][1]); + } + else{ + /* subdivide into 4 subtriangles */ + for(i = 0; i < 3; i++){ + xyz2[0][i] = xyz[0][i]; + xyz2[1][i] = 0.5 * (xyz[0][i] + xyz[1][i]); + xyz2[2][i] = 0.5 * (xyz[0][i] + xyz[2][i]); + } + for(i = 0; i < 4; i++){ + rgba2[0][i] = rgba[0][i]; + rgba2[1][i] = 0.5 * (rgba[0][i] + rgba[1][i]); + rgba2[2][i] = 0.5 * (rgba[0][i] + rgba[2][i]); + } + gl2psPrintSVGSmoothTriangle(xyz2, rgba2); + for(i = 0; i < 3; i++){ + xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[1][i]); + xyz2[1][i] = xyz[1][i]; + xyz2[2][i] = 0.5 * (xyz[1][i] + xyz[2][i]); + } + for(i = 0; i < 4; i++){ + rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[1][i]); + rgba2[1][i] = rgba[1][i]; + rgba2[2][i] = 0.5 * (rgba[1][i] + rgba[2][i]); + } + gl2psPrintSVGSmoothTriangle(xyz2, rgba2); + for(i = 0; i < 3; i++){ + xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[2][i]); + xyz2[1][i] = xyz[2][i]; + xyz2[2][i] = 0.5 * (xyz[1][i] + xyz[2][i]); + } + for(i = 0; i < 4; i++){ + rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[2][i]); + rgba2[1][i] = rgba[2][i]; + rgba2[2][i] = 0.5 * (rgba[1][i] + rgba[2][i]); + } + gl2psPrintSVGSmoothTriangle(xyz2, rgba2); + for(i = 0; i < 3; i++){ + xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[1][i]); + xyz2[1][i] = 0.5 * (xyz[1][i] + xyz[2][i]); + xyz2[2][i] = 0.5 * (xyz[0][i] + xyz[2][i]); + } + for(i = 0; i < 4; i++){ + rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[1][i]); + rgba2[1][i] = 0.5 * (rgba[1][i] + rgba[2][i]); + rgba2[2][i] = 0.5 * (rgba[0][i] + rgba[2][i]); + } + gl2psPrintSVGSmoothTriangle(xyz2, rgba2); + } +} + +static void gl2psPrintSVGDash(GLushort pattern, GLint factor) +{ + int i, n, array[10]; + + if(!pattern || !factor) return; /* solid line */ + + gl2psParseStipplePattern(pattern, factor, &n, array); + gl2psPrintf("stroke-dasharray=\""); + for(i = 0; i < n; i++){ + if(i) gl2psPrintf(","); + gl2psPrintf("%d", array[i]); + } + gl2psPrintf("\" "); +} + +static void gl2psEndSVGLine(void) +{ + int i; + if(gl2ps->lastvertex.rgba[0] >= 0.){ + gl2psPrintf("%g,%g\"/>\n", gl2ps->lastvertex.xyz[0], + gl2ps->viewport[3] - gl2ps->lastvertex.xyz[1]); + for(i = 0; i < 3; i++) + gl2ps->lastvertex.xyz[i] = -1.; + for(i = 0; i < 4; i++) + gl2ps->lastvertex.rgba[i] = -1.; + } +} + +static void gl2psPrintSVGPixmap(GLfloat x, GLfloat y, GL2PSimage *pixmap) +{ +#if defined(GL2PS_HAVE_LIBPNG) + GL2PSlist *png; + unsigned char c; + int i; + + /* The only image types supported by the SVG standard are JPEG, PNG + and SVG. Here we choose PNG, and since we want to embed the image + directly in the SVG stream (and not link to an external image + file), we need to encode the pixmap into PNG in memory, then + encode it into base64. */ + + png = gl2psListCreate(pixmap->width * pixmap->height * 3, 1000, + sizeof(unsigned char)); + gl2psConvertPixmapToPNG(pixmap, png); + gl2psListEncodeBase64(png); + gl2psPrintf("height, pixmap->width, pixmap->height); + gl2psPrintf("xlink:href=\"data:image/png;base64,"); + for(i = 0; i < gl2psListNbr(png); i++){ + gl2psListRead(png, i, &c); + gl2psPrintf("%c", c); + } + gl2psPrintf("\"/>\n"); + gl2psListDelete(png); +#else + gl2psMsg(GL2PS_WARNING, "GL2PS has to be compiled with PNG support in " + "order to embed images in SVG streams"); +#endif +} + +static void gl2psPrintSVGPrimitive(void *data) +{ + GL2PSprimitive *prim; + GL2PSxyz xyz[4]; + GL2PSrgba rgba[4]; + char col[32]; + int newline; + + prim = *(GL2PSprimitive**)data; + + if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) return; + + /* We try to draw connected lines as a single path to get nice line + joins and correct stippling. So if the primitive to print is not + a line we must first finish the current line (if any): */ + if(prim->type != GL2PS_LINE) gl2psEndSVGLine(); + + gl2psSVGGetCoordsAndColors(prim->numverts, prim->verts, xyz, rgba); + + switch(prim->type){ + case GL2PS_POINT : + gl2psSVGGetColorString(rgba[0], col); + gl2psPrintf("\n", + xyz[0][0], xyz[0][1], 0.5 * prim->width); + break; + case GL2PS_LINE : + if(!gl2psSamePosition(gl2ps->lastvertex.xyz, prim->verts[0].xyz) || + !gl2psSameColor(gl2ps->lastrgba, prim->verts[0].rgba) || + gl2ps->lastlinewidth != prim->width || + gl2ps->lastpattern != prim->pattern || + gl2ps->lastfactor != prim->factor){ + /* End the current line if the new segment does not start where + the last one ended, or if the color, the width or the + stippling have changed (we will need to use multi-point + gradients for smooth-shaded lines) */ + gl2psEndSVGLine(); + newline = 1; + } + else{ + newline = 0; + } + gl2ps->lastvertex = prim->verts[1]; + gl2psSetLastColor(prim->verts[0].rgba); + gl2ps->lastlinewidth = prim->width; + gl2ps->lastpattern = prim->pattern; + gl2ps->lastfactor = prim->factor; + if(newline){ + gl2psSVGGetColorString(rgba[0], col); + gl2psPrintf("width); + if(rgba[0][3] < 1.0F) gl2psPrintf("stroke-opacity=\"%g\" ", rgba[0][3]); + gl2psPrintSVGDash(prim->pattern, prim->factor); + gl2psPrintf("points=\"%g,%g ", xyz[0][0], xyz[0][1]); + } + else{ + gl2psPrintf("%g,%g ", xyz[0][0], xyz[0][1]); + } + break; + case GL2PS_TRIANGLE : + gl2psPrintSVGSmoothTriangle(xyz, rgba); + break; + case GL2PS_QUADRANGLE : + gl2psMsg(GL2PS_WARNING, "There should not be any quad left to print"); + break; + case GL2PS_PIXMAP : + gl2psPrintSVGPixmap(xyz[0][0], xyz[0][1], prim->data.image); + break; + case GL2PS_TEXT : + gl2psSVGGetColorString(prim->verts[0].rgba, col); + gl2psPrintf("%s\n", + col, xyz[0][0], xyz[0][1], + prim->data.text->fontsize, + prim->data.text->fontname, + prim->data.text->str); + break; + case GL2PS_SPECIAL : + /* alignment contains the format for which the special output text + is intended */ + if(prim->data.text->alignment == GL2PS_SVG) + gl2psPrintf("%s\n", prim->data.text->str); + break; + default : + break; + } +} + +static void gl2psPrintSVGFooter(void) +{ + gl2psPrintf("\n"); + gl2psPrintf("\n"); + + gl2psPrintGzipFooter(); +} + +static void gl2psPrintSVGBeginViewport(GLint viewport[4]) +{ + GLint indx; + char col[32]; + GLfloat rgba[4]; + int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; + + glRenderMode(GL_FEEDBACK); + + if(gl2ps->header){ + gl2psPrintSVGHeader(); + gl2ps->header = GL_FALSE; + } + + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ + if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){ + glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba); + } + else{ + glGetIntegerv(GL_INDEX_CLEAR_VALUE, &indx); + rgba[0] = gl2ps->colormap[indx][0]; + rgba[1] = gl2ps->colormap[indx][1]; + rgba[2] = gl2ps->colormap[indx][2]; + rgba[3] = 1.0F; + } + gl2psSVGGetColorString(rgba, col); + gl2psPrintf("\n", col, + x, gl2ps->viewport[3] - y, + x + w, gl2ps->viewport[3] - y, + x + w, gl2ps->viewport[3] - (y + h), + x, gl2ps->viewport[3] - (y + h)); + } + + gl2psPrintf("\n", x, y, w, h); + gl2psPrintf(" \n", + x, gl2ps->viewport[3] - y, + x + w, gl2ps->viewport[3] - y, + x + w, gl2ps->viewport[3] - (y + h), + x, gl2ps->viewport[3] - (y + h)); + gl2psPrintf("\n"); + gl2psPrintf("\n", x, y, w, h); +} + +static GLint gl2psPrintSVGEndViewport(void) +{ + GLint res; + + res = gl2psPrintPrimitives(); + gl2psPrintf("\n"); + return res; +} + +static void gl2psPrintSVGFinalPrimitive(void) +{ + /* End any remaining line, if any */ + gl2psEndSVGLine(); +} + +/* definition of the SVG backend */ + +static GL2PSbackend gl2psSVG = { + gl2psPrintSVGHeader, + gl2psPrintSVGFooter, + gl2psPrintSVGBeginViewport, + gl2psPrintSVGEndViewport, + gl2psPrintSVGPrimitive, + gl2psPrintSVGFinalPrimitive, + "svg", + "Scalable Vector Graphics" +}; + +/********************************************************************* + * + * PGF routines + * + *********************************************************************/ + +static void gl2psPrintPGFColor(GL2PSrgba rgba) +{ + if(!gl2psSameColor(gl2ps->lastrgba, rgba)){ + gl2psSetLastColor(rgba); + fprintf(gl2ps->stream, "\\color[rgb]{%f,%f,%f}\n", rgba[0], rgba[1], rgba[2]); + } +} + +static void gl2psPrintPGFHeader(void) +{ + time_t now; + + time(&now); + + fprintf(gl2ps->stream, + "%% Title: %s\n" + "%% Creator: GL2PS %d.%d.%d%s, %s\n" + "%% For: %s\n" + "%% CreationDate: %s", + gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, + GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, + gl2ps->producer, ctime(&now)); + + fprintf(gl2ps->stream, "\\begin{pgfpicture}\n"); + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ + gl2psPrintPGFColor(gl2ps->bgcolor); + fprintf(gl2ps->stream, + "\\pgfpathrectanglecorners{" + "\\pgfpoint{%dpt}{%dpt}}{\\pgfpoint{%dpt}{%dpt}}\n" + "\\pgfusepath{fill}\n", + (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], + (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); + } +} + +static void gl2psPrintPGFDash(GLushort pattern, GLint factor) +{ + int i, n, array[10]; + + if(pattern == gl2ps->lastpattern && factor == gl2ps->lastfactor) + return; + + gl2ps->lastpattern = pattern; + gl2ps->lastfactor = factor; + + if(!pattern || !factor){ + /* solid line */ + fprintf(gl2ps->stream, "\\pgfsetdash{}{0pt}\n"); + } + else{ + gl2psParseStipplePattern(pattern, factor, &n, array); + fprintf(gl2ps->stream, "\\pgfsetdash{"); + for(i = 0; i < n; i++) fprintf(gl2ps->stream, "{%dpt}", array[i]); + fprintf(gl2ps->stream, "}{0pt}\n"); + } +} + +static const char *gl2psPGFTextAlignment(int align) +{ + switch(align){ + case GL2PS_TEXT_C : return "center"; + case GL2PS_TEXT_CL : return "west"; + case GL2PS_TEXT_CR : return "east"; + case GL2PS_TEXT_B : return "south"; + case GL2PS_TEXT_BR : return "south east"; + case GL2PS_TEXT_T : return "north"; + case GL2PS_TEXT_TL : return "north west"; + case GL2PS_TEXT_TR : return "north east"; + case GL2PS_TEXT_BL : + default : return "south west"; + } +} + +static void gl2psPrintPGFPrimitive(void *data) +{ + GL2PSprimitive *prim; + + prim = *(GL2PSprimitive**)data; + + switch(prim->type){ + case GL2PS_POINT : + /* Points in openGL are rectangular */ + gl2psPrintPGFColor(prim->verts[0].rgba); + fprintf(gl2ps->stream, + "\\pgfpathrectangle{\\pgfpoint{%fpt}{%fpt}}" + "{\\pgfpoint{%fpt}{%fpt}}\n\\pgfusepath{fill}\n", + prim->verts[0].xyz[0]-0.5*prim->width, + prim->verts[0].xyz[1]-0.5*prim->width, + prim->width,prim->width); + break; + case GL2PS_LINE : + gl2psPrintPGFColor(prim->verts[0].rgba); + if(gl2ps->lastlinewidth != prim->width){ + gl2ps->lastlinewidth = prim->width; + fprintf(gl2ps->stream, "\\pgfsetlinewidth{%fpt}\n", gl2ps->lastlinewidth); + } + gl2psPrintPGFDash(prim->pattern, prim->factor); + fprintf(gl2ps->stream, + "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n" + "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n" + "\\pgfusepath{stroke}\n", + prim->verts[1].xyz[0], prim->verts[1].xyz[1], + prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + break; + case GL2PS_TRIANGLE : + if(gl2ps->lastlinewidth != 0){ + gl2ps->lastlinewidth = 0; + fprintf(gl2ps->stream, "\\pgfsetlinewidth{0.01pt}\n"); + } + gl2psPrintPGFColor(prim->verts[0].rgba); + fprintf(gl2ps->stream, + "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n" + "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n" + "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n" + "\\pgfpathclose\n" + "\\pgfusepath{fill,stroke}\n", + prim->verts[2].xyz[0], prim->verts[2].xyz[1], + prim->verts[1].xyz[0], prim->verts[1].xyz[1], + prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + break; + case GL2PS_TEXT : + fprintf(gl2ps->stream, "{\n\\pgftransformshift{\\pgfpoint{%fpt}{%fpt}}\n", + prim->verts[0].xyz[0], prim->verts[0].xyz[1]); + + if(prim->data.text->angle) + fprintf(gl2ps->stream, "\\pgftransformrotate{%f}{", prim->data.text->angle); + + fprintf(gl2ps->stream, "\\pgfnode{rectangle}{%s}{\\fontsize{%d}{0}\\selectfont", + gl2psPGFTextAlignment(prim->data.text->alignment), + prim->data.text->fontsize); + + fprintf(gl2ps->stream, "\\textcolor[rgb]{%g,%g,%g}{{%s}}", + prim->verts[0].rgba[0], prim->verts[0].rgba[1], + prim->verts[0].rgba[2], prim->data.text->str); + + fprintf(gl2ps->stream, "}{}{\\pgfusepath{discard}}}\n"); + break; + case GL2PS_SPECIAL : + /* alignment contains the format for which the special output text + is intended */ + if (prim->data.text->alignment == GL2PS_PGF) + fprintf(gl2ps->stream, "%s\n", prim->data.text->str); + break; + default : + break; + } +} + +static void gl2psPrintPGFFooter(void) +{ + fprintf(gl2ps->stream, "\\end{pgfpicture}\n"); +} + +static void gl2psPrintPGFBeginViewport(GLint viewport[4]) +{ + GLint indx; + GLfloat rgba[4]; + int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; + + glRenderMode(GL_FEEDBACK); + + if(gl2ps->header){ + gl2psPrintPGFHeader(); + gl2ps->header = GL_FALSE; + } + + fprintf(gl2ps->stream, "\\begin{pgfscope}\n"); + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ + if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){ + glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba); + } + else{ + glGetIntegerv(GL_INDEX_CLEAR_VALUE, &indx); + rgba[0] = gl2ps->colormap[indx][0]; + rgba[1] = gl2ps->colormap[indx][1]; + rgba[2] = gl2ps->colormap[indx][2]; + rgba[3] = 1.0F; + } + gl2psPrintPGFColor(rgba); + fprintf(gl2ps->stream, + "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}" + "{\\pgfpoint{%dpt}{%dpt}}\n" + "\\pgfusepath{fill}\n", + x, y, w, h); + } + + fprintf(gl2ps->stream, + "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}" + "{\\pgfpoint{%dpt}{%dpt}}\n" + "\\pgfusepath{clip}\n", + x, y, w, h); +} + +static GLint gl2psPrintPGFEndViewport(void) +{ + GLint res; + res = gl2psPrintPrimitives(); + fprintf(gl2ps->stream, "\\end{pgfscope}\n"); + return res; +} + +static void gl2psPrintPGFFinalPrimitive(void) +{ +} + +/* definition of the PGF backend */ + +static GL2PSbackend gl2psPGF = { + gl2psPrintPGFHeader, + gl2psPrintPGFFooter, + gl2psPrintPGFBeginViewport, + gl2psPrintPGFEndViewport, + gl2psPrintPGFPrimitive, + gl2psPrintPGFFinalPrimitive, + "tex", + "PGF Latex Graphics" +}; + +/********************************************************************* + * + * General primitive printing routine + * + *********************************************************************/ + +/* Warning: the ordering of the backends must match the format + #defines in gl2ps.h */ + +static GL2PSbackend *gl2psbackends[] = { + &gl2psPS, /* 0 */ + &gl2psEPS, /* 1 */ + &gl2psTEX, /* 2 */ + &gl2psPDF, /* 3 */ + &gl2psSVG, /* 4 */ + &gl2psPGF /* 5 */ +}; + +static void gl2psComputeTightBoundingBox(void *data) +{ + GL2PSprimitive *prim; + int i; + + prim = *(GL2PSprimitive**)data; + + for(i = 0; i < prim->numverts; i++){ + if(prim->verts[i].xyz[0] < gl2ps->viewport[0]) + gl2ps->viewport[0] = (GLint)prim->verts[i].xyz[0]; + if(prim->verts[i].xyz[0] > gl2ps->viewport[2]) + gl2ps->viewport[2] = (GLint)(prim->verts[i].xyz[0] + 0.5F); + if(prim->verts[i].xyz[1] < gl2ps->viewport[1]) + gl2ps->viewport[1] = (GLint)prim->verts[i].xyz[1]; + if(prim->verts[i].xyz[1] > gl2ps->viewport[3]) + gl2ps->viewport[3] = (GLint)(prim->verts[i].xyz[1] + 0.5F); + } +} + +static GLint gl2psPrintPrimitives(void) +{ + GL2PSbsptree *root; + GL2PSxyz eye = {0.0F, 0.0F, 100.0F * GL2PS_ZSCALE}; + GLint used; + + used = glRenderMode(GL_RENDER); + + if(used < 0){ + gl2psMsg(GL2PS_INFO, "OpenGL feedback buffer overflow"); + return GL2PS_OVERFLOW; + } + + if(used > 0) + gl2psParseFeedbackBuffer(used); + + gl2psRescaleAndOffset(); + + if(gl2ps->header){ + if(gl2psListNbr(gl2ps->primitives) && + (gl2ps->options & GL2PS_TIGHT_BOUNDING_BOX)){ + gl2ps->viewport[0] = gl2ps->viewport[1] = 100000; + gl2ps->viewport[2] = gl2ps->viewport[3] = -100000; + gl2psListAction(gl2ps->primitives, gl2psComputeTightBoundingBox); + } + (gl2psbackends[gl2ps->format]->printHeader)(); + gl2ps->header = GL_FALSE; + } + + if(!gl2psListNbr(gl2ps->primitives)){ + /* empty feedback buffer and/or nothing else to print */ + return GL2PS_NO_FEEDBACK; + } + + switch(gl2ps->sort){ + case GL2PS_NO_SORT : + gl2psListAction(gl2ps->primitives, gl2psbackends[gl2ps->format]->printPrimitive); + gl2psListAction(gl2ps->primitives, gl2psFreePrimitive); + /* reset the primitive list, waiting for the next viewport */ + gl2psListReset(gl2ps->primitives); + break; + case GL2PS_SIMPLE_SORT : + gl2psListSort(gl2ps->primitives, gl2psCompareDepth); + if(gl2ps->options & GL2PS_OCCLUSION_CULL){ + gl2psListActionInverse(gl2ps->primitives, gl2psAddInImageTree); + gl2psFreeBspImageTree(&gl2ps->imagetree); + } + gl2psListAction(gl2ps->primitives, gl2psbackends[gl2ps->format]->printPrimitive); + gl2psListAction(gl2ps->primitives, gl2psFreePrimitive); + /* reset the primitive list, waiting for the next viewport */ + gl2psListReset(gl2ps->primitives); + break; + case GL2PS_BSP_SORT : + root = (GL2PSbsptree*)gl2psMalloc(sizeof(GL2PSbsptree)); + gl2psBuildBspTree(root, gl2ps->primitives); + if(GL_TRUE == gl2ps->boundary) gl2psBuildPolygonBoundary(root); + if(gl2ps->options & GL2PS_OCCLUSION_CULL){ + gl2psTraverseBspTree(root, eye, -GL2PS_EPSILON, gl2psLess, + gl2psAddInImageTree, 1); + gl2psFreeBspImageTree(&gl2ps->imagetree); + } + gl2psTraverseBspTree(root, eye, GL2PS_EPSILON, gl2psGreater, + gl2psbackends[gl2ps->format]->printPrimitive, 0); + gl2psFreeBspTree(&root); + /* reallocate the primitive list (it's been deleted by + gl2psBuildBspTree) in case there is another viewport */ + gl2ps->primitives = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*)); + break; + } + gl2psbackends[gl2ps->format]->printFinalPrimitive(); + + return GL2PS_SUCCESS; +} + +/********************************************************************* + * + * Public routines + * + *********************************************************************/ + +GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, + GLint viewport[4], GLint format, GLint sort, + GLint options, GLint colormode, + GLint colorsize, GL2PSrgba *colormap, + GLint nr, GLint ng, GLint nb, GLint buffersize, + FILE *stream, const char *filename) +{ + GLint indx; + int i; + + if(gl2ps){ + gl2psMsg(GL2PS_ERROR, "gl2psBeginPage called in wrong program state"); + return GL2PS_ERROR; + } + + gl2ps = (GL2PScontext*)gl2psMalloc(sizeof(GL2PScontext)); + + if(format >= 0 && format < (GLint)(sizeof(gl2psbackends)/sizeof(gl2psbackends[0]))){ + gl2ps->format = format; + } + else { + gl2psMsg(GL2PS_ERROR, "Unknown output format: %d", format); + gl2psFree(gl2ps); + gl2ps = NULL; + return GL2PS_ERROR; + } + + switch(sort){ + case GL2PS_NO_SORT : + case GL2PS_SIMPLE_SORT : + case GL2PS_BSP_SORT : + gl2ps->sort = sort; + break; + default : + gl2psMsg(GL2PS_ERROR, "Unknown sorting algorithm: %d", sort); + gl2psFree(gl2ps); + gl2ps = NULL; + return GL2PS_ERROR; + } + + if(stream){ + gl2ps->stream = stream; + } + else{ + gl2psMsg(GL2PS_ERROR, "Bad file pointer"); + gl2psFree(gl2ps); + gl2ps = NULL; + return GL2PS_ERROR; + } + + gl2ps->header = GL_TRUE; + gl2ps->maxbestroot = 10; + gl2ps->options = options; + gl2ps->compress = NULL; + gl2ps->imagemap_head = NULL; + gl2ps->imagemap_tail = NULL; + + if(gl2ps->options & GL2PS_USE_CURRENT_VIEWPORT){ + glGetIntegerv(GL_VIEWPORT, gl2ps->viewport); + } + else{ + for(i = 0; i < 4; i++){ + gl2ps->viewport[i] = viewport[i]; + } + } + + if(!gl2ps->viewport[2] || !gl2ps->viewport[3]){ + gl2psMsg(GL2PS_ERROR, "Incorrect viewport (x=%d, y=%d, width=%d, height=%d)", + gl2ps->viewport[0], gl2ps->viewport[1], + gl2ps->viewport[2], gl2ps->viewport[3]); + gl2psFree(gl2ps); + gl2ps = NULL; + return GL2PS_ERROR; + } + + gl2ps->threshold[0] = nr ? 1.0F/(GLfloat)nr : 0.064F; + gl2ps->threshold[1] = ng ? 1.0F/(GLfloat)ng : 0.034F; + gl2ps->threshold[2] = nb ? 1.0F/(GLfloat)nb : 0.100F; + gl2ps->colormode = colormode; + gl2ps->buffersize = buffersize > 0 ? buffersize : 2048 * 2048; + for(i = 0; i < 3; i++){ + gl2ps->lastvertex.xyz[i] = -1.0F; + } + for(i = 0; i < 4; i++){ + gl2ps->lastvertex.rgba[i] = -1.0F; + gl2ps->lastrgba[i] = -1.0F; + } + gl2ps->lastlinewidth = -1.0F; + gl2ps->lastpattern = 0; + gl2ps->lastfactor = 0; + gl2ps->imagetree = NULL; + gl2ps->primitivetoadd = NULL; + gl2ps->zerosurfacearea = GL_FALSE; + gl2ps->pdfprimlist = NULL; + gl2ps->pdfgrouplist = NULL; + gl2ps->xreflist = NULL; + + /* get default blending mode from current OpenGL state (enabled by + default for SVG) */ + gl2ps->blending = (gl2ps->format == GL2PS_SVG) ? GL_TRUE : glIsEnabled(GL_BLEND); + glGetIntegerv(GL_BLEND_SRC, &gl2ps->blendfunc[0]); + glGetIntegerv(GL_BLEND_DST, &gl2ps->blendfunc[1]); + + if(gl2ps->colormode == GL_RGBA){ + gl2ps->colorsize = 0; + gl2ps->colormap = NULL; + glGetFloatv(GL_COLOR_CLEAR_VALUE, gl2ps->bgcolor); + } + else if(gl2ps->colormode == GL_COLOR_INDEX){ + if(!colorsize || !colormap){ + gl2psMsg(GL2PS_ERROR, "Missing colormap for GL_COLOR_INDEX rendering"); + gl2psFree(gl2ps); + gl2ps = NULL; + return GL2PS_ERROR; + } + gl2ps->colorsize = colorsize; + gl2ps->colormap = (GL2PSrgba*)gl2psMalloc(gl2ps->colorsize * sizeof(GL2PSrgba)); + memcpy(gl2ps->colormap, colormap, gl2ps->colorsize * sizeof(GL2PSrgba)); + glGetIntegerv(GL_INDEX_CLEAR_VALUE, &indx); + gl2ps->bgcolor[0] = gl2ps->colormap[indx][0]; + gl2ps->bgcolor[1] = gl2ps->colormap[indx][1]; + gl2ps->bgcolor[2] = gl2ps->colormap[indx][2]; + gl2ps->bgcolor[3] = 1.0F; + } + else{ + gl2psMsg(GL2PS_ERROR, "Unknown color mode in gl2psBeginPage"); + gl2psFree(gl2ps); + gl2ps = NULL; + return GL2PS_ERROR; + } + + if(!title){ + gl2ps->title = (char*)gl2psMalloc(sizeof(char)); + gl2ps->title[0] = '\0'; + } + else{ + gl2ps->title = (char*)gl2psMalloc((strlen(title)+1)*sizeof(char)); + strcpy(gl2ps->title, title); + } + + if(!producer){ + gl2ps->producer = (char*)gl2psMalloc(sizeof(char)); + gl2ps->producer[0] = '\0'; + } + else{ + gl2ps->producer = (char*)gl2psMalloc((strlen(producer)+1)*sizeof(char)); + strcpy(gl2ps->producer, producer); + } + + if(!filename){ + gl2ps->filename = (char*)gl2psMalloc(sizeof(char)); + gl2ps->filename[0] = '\0'; + } + else{ + gl2ps->filename = (char*)gl2psMalloc((strlen(filename)+1)*sizeof(char)); + strcpy(gl2ps->filename, filename); + } + + gl2ps->primitives = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*)); + gl2ps->auxprimitives = gl2psListCreate(100, 100, sizeof(GL2PSprimitive*)); + gl2ps->feedback = (GLfloat*)gl2psMalloc(gl2ps->buffersize * sizeof(GLfloat)); + glFeedbackBuffer(gl2ps->buffersize, GL_3D_COLOR, gl2ps->feedback); + glRenderMode(GL_FEEDBACK); + + return GL2PS_SUCCESS; +} + +GL2PSDLL_API GLint gl2psEndPage(void) +{ + GLint res; + + if(!gl2ps) return GL2PS_UNINITIALIZED; + + res = gl2psPrintPrimitives(); + + if(res != GL2PS_OVERFLOW) + (gl2psbackends[gl2ps->format]->printFooter)(); + + fflush(gl2ps->stream); + + gl2psListDelete(gl2ps->primitives); + gl2psListDelete(gl2ps->auxprimitives); + gl2psFreeImagemap(gl2ps->imagemap_head); + gl2psFree(gl2ps->colormap); + gl2psFree(gl2ps->title); + gl2psFree(gl2ps->producer); + gl2psFree(gl2ps->filename); + gl2psFree(gl2ps->feedback); + gl2psFree(gl2ps); + gl2ps = NULL; + + return res; +} + +GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]) +{ + if(!gl2ps) return GL2PS_UNINITIALIZED; + + (gl2psbackends[gl2ps->format]->beginViewport)(viewport); + + return GL2PS_SUCCESS; +} + +GL2PSDLL_API GLint gl2psEndViewport(void) +{ + GLint res; + + if(!gl2ps) return GL2PS_UNINITIALIZED; + + res = (gl2psbackends[gl2ps->format]->endViewport)(); + + return res; +} + +GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, + GLshort fontsize, GLint alignment, GLfloat angle) +{ + return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, alignment, angle); +} + +GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize) +{ + return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, GL2PS_TEXT_BL, 0.0F); +} + +GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str) +{ + return gl2psAddText(GL2PS_SPECIAL, str, "", 0, format, 0.0F); +} + +GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, + GLint xorig, GLint yorig, + GLenum format, GLenum type, + const void *pixels) +{ + int size, i; + GLfloat pos[4], *piv; + GL2PSprimitive *prim; + GLboolean valid; + + if(!gl2ps || !pixels) return GL2PS_UNINITIALIZED; + + if((width <= 0) || (height <= 0)) return GL2PS_ERROR; + + if(gl2ps->options & GL2PS_NO_PIXMAP) return GL2PS_SUCCESS; + + if((format != GL_RGB && format != GL_RGBA) || type != GL_FLOAT){ + gl2psMsg(GL2PS_ERROR, "gl2psDrawPixels only implemented for " + "GL_RGB/GL_RGBA, GL_FLOAT pixels"); + return GL2PS_ERROR; + } + + glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid); + if(GL_FALSE == valid) return GL2PS_SUCCESS; /* the primitive is culled */ + + glGetFloatv(GL_CURRENT_RASTER_POSITION, pos); + + prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + prim->type = GL2PS_PIXMAP; + prim->boundary = 0; + prim->numverts = 1; + prim->verts = (GL2PSvertex*)gl2psMalloc(sizeof(GL2PSvertex)); + prim->verts[0].xyz[0] = pos[0] + xorig; + prim->verts[0].xyz[1] = pos[1] + yorig; + prim->verts[0].xyz[2] = pos[2]; + prim->culled = 0; + prim->offset = 0; + prim->pattern = 0; + prim->factor = 0; + prim->width = 1; + glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba); + prim->data.image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage)); + prim->data.image->width = width; + prim->data.image->height = height; + prim->data.image->format = format; + prim->data.image->type = type; + + switch(format){ + case GL_RGBA: + if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){ + /* special case: blending turned off */ + prim->data.image->format = GL_RGB; + size = height * width * 3; + prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat)); + piv = (GLfloat*)pixels; + for(i = 0; i < size; ++i, ++piv){ + prim->data.image->pixels[i] = *piv; + if(!((i+1)%3)) + ++piv; + } + } + else{ + size = height * width * 4; + prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat)); + memcpy(prim->data.image->pixels, pixels, size * sizeof(GLfloat)); + } + break; + case GL_RGB: + default: + size = height * width * 3; + prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat)); + memcpy(prim->data.image->pixels, pixels, size * sizeof(GLfloat)); + break; + } + + gl2psListAdd(gl2ps->auxprimitives, &prim); + glPassThrough(GL2PS_DRAW_PIXELS_TOKEN); + + return GL2PS_SUCCESS; +} + +GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height, + const GLfloat position[3], + const unsigned char *imagemap){ + int size, i; + int sizeoffloat = sizeof(GLfloat); + + if(!gl2ps || !imagemap) return GL2PS_UNINITIALIZED; + + if((width <= 0) || (height <= 0)) return GL2PS_ERROR; + + size = height + height * ((width-1)/8); + glPassThrough(GL2PS_IMAGEMAP_TOKEN); + glBegin(GL_POINTS); + glVertex3f(position[0], position[1],position[2]); + glEnd(); + glPassThrough((GLfloat)width); + glPassThrough((GLfloat)height); + for(i = 0; i < size; i += sizeoffloat){ + float *value = (float*)imagemap; + glPassThrough(*value); + imagemap += sizeoffloat; + } + return GL2PS_SUCCESS; +} + +GL2PSDLL_API GLint gl2psEnable(GLint mode) +{ + GLint tmp; + + if(!gl2ps) return GL2PS_UNINITIALIZED; + + switch(mode){ + case GL2PS_POLYGON_OFFSET_FILL : + glPassThrough(GL2PS_BEGIN_OFFSET_TOKEN); + glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &gl2ps->offset[0]); + glGetFloatv(GL_POLYGON_OFFSET_UNITS, &gl2ps->offset[1]); + break; + case GL2PS_POLYGON_BOUNDARY : + glPassThrough(GL2PS_BEGIN_BOUNDARY_TOKEN); + break; + case GL2PS_LINE_STIPPLE : + glPassThrough(GL2PS_BEGIN_STIPPLE_TOKEN); + glGetIntegerv(GL_LINE_STIPPLE_PATTERN, &tmp); + glPassThrough((GLfloat)tmp); + glGetIntegerv(GL_LINE_STIPPLE_REPEAT, &tmp); + glPassThrough((GLfloat)tmp); + break; + case GL2PS_BLEND : + glPassThrough(GL2PS_BEGIN_BLEND_TOKEN); + break; + default : + gl2psMsg(GL2PS_WARNING, "Unknown mode in gl2psEnable: %d", mode); + return GL2PS_WARNING; + } + + return GL2PS_SUCCESS; +} + +GL2PSDLL_API GLint gl2psDisable(GLint mode) +{ + if(!gl2ps) return GL2PS_UNINITIALIZED; + + switch(mode){ + case GL2PS_POLYGON_OFFSET_FILL : + glPassThrough(GL2PS_END_OFFSET_TOKEN); + break; + case GL2PS_POLYGON_BOUNDARY : + glPassThrough(GL2PS_END_BOUNDARY_TOKEN); + break; + case GL2PS_LINE_STIPPLE : + glPassThrough(GL2PS_END_STIPPLE_TOKEN); + break; + case GL2PS_BLEND : + glPassThrough(GL2PS_END_BLEND_TOKEN); + break; + default : + gl2psMsg(GL2PS_WARNING, "Unknown mode in gl2psDisable: %d", mode); + return GL2PS_WARNING; + } + + return GL2PS_SUCCESS; +} + +GL2PSDLL_API GLint gl2psPointSize(GLfloat value) +{ + if(!gl2ps) return GL2PS_UNINITIALIZED; + + glPassThrough(GL2PS_POINT_SIZE_TOKEN); + glPassThrough(value); + + return GL2PS_SUCCESS; +} + +GL2PSDLL_API GLint gl2psLineWidth(GLfloat value) +{ + if(!gl2ps) return GL2PS_UNINITIALIZED; + + glPassThrough(GL2PS_LINE_WIDTH_TOKEN); + glPassThrough(value); + + return GL2PS_SUCCESS; +} + +GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor) +{ + if(!gl2ps) return GL2PS_UNINITIALIZED; + + if(GL_FALSE == gl2psSupportedBlendMode(sfactor, dfactor)) + return GL2PS_WARNING; + + glPassThrough(GL2PS_SRC_BLEND_TOKEN); + glPassThrough((GLfloat)sfactor); + glPassThrough(GL2PS_DST_BLEND_TOKEN); + glPassThrough((GLfloat)dfactor); + + return GL2PS_SUCCESS; +} + +GL2PSDLL_API GLint gl2psSetOptions(GLint options) +{ + if(!gl2ps) return GL2PS_UNINITIALIZED; + + gl2ps->options = options; + + return GL2PS_SUCCESS; +} + +GL2PSDLL_API const char *gl2psGetFileExtension(GLint format) +{ + if(format >= 0 && format < (GLint)(sizeof(gl2psbackends)/sizeof(gl2psbackends[0]))) + return gl2psbackends[format]->file_extension; + else + return "Unknown format"; +} + +GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format) +{ + if(format >= 0 && format < (GLint)(sizeof(gl2psbackends)/sizeof(gl2psbackends[0]))) + return gl2psbackends[format]->description; + else + return "Unknown format"; +} --- vtk-5.4.2.orig/Utilities/kwsys/SharedForward.h.in +++ vtk-5.4.2/Utilities/kwsys/SharedForward.h.in @@ -219,7 +219,7 @@ #endif /* SUN */ -#if defined(__sparc) +#if defined(__sparc) && !defined(__linux) # define KWSYS_SHARED_FORWARD_LDD "ldd" # define KWSYS_SHARED_FORWARD_LDD_N 1 # include --- vtk-5.4.2.orig/Utilities/DICOMParser/DICOMParser.cxx +++ vtk-5.4.2/Utilities/DICOMParser/DICOMParser.cxx @@ -41,6 +41,7 @@ #include #include +#include // Define DEBUG_DICOM to get debug messages sent to dicom_stream::cerr // #define DEBUG_DICOM --- vtk-5.4.2.orig/Utilities/DICOMParser/DICOMAppHelper.cxx +++ vtk-5.4.2/Utilities/DICOMParser/DICOMAppHelper.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #if defined(__BORLANDC__) --- vtk-5.4.2.orig/Utilities/Doxygen/doxyfile.in +++ vtk-5.4.2/Utilities/Doxygen/doxyfile.in @@ -1,205 +1,333 @@ -# ------------------------------------------------------------------------- -# doxyfile for VTK -# modified by S. Barre (Time-stamp: <2005-12-05 12:59:07 barre> -# ------------------------------------------------------------------------- +# Doxyfile 1.6.2 -PROJECT_NAME = VTK - -FULL_PATH_NAMES = YES -WARN_IF_UNDOCUMENTED = NO - -GENERATE_TREEVIEW = NO -GENERATE_TODOLIST = YES -GENERATE_BUGLIST = YES -GENERATE_HTML = YES -GENERATE_HTMLHELP = YES -GENERATE_LATEX = NO -GENERATE_MAN = NO -GENERATE_RTF = NO -GENERATE_TAGFILE = "@VTK_BINARY_DIR@/Utilities/Doxygen/vtk@VTK_MAJOR_VERSION@.@VTK_MINOR_VERSION@.tag" - -PDF_HYPERLINKS = YES - -HAVE_DOT = @HAVE_DOT_YESNO@ -DOT_PATH = "@DOT_PATH@" -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CLASS_DIAGRAMS = YES -GENERATE_LEGEND = YES -GRAPHICAL_HIERARCHY = NO # would be too large for vtkObject - -ALLEXTERNALS = NO - -IMAGE_PATH = "@VTK_SOURCE_DIR@/Utilities/Doxygen" "@VTK_BINARY_DIR@/Utilities/Doxygen/contrib" \ - "@VTK_SOURCE_DIR@/Rendering" - -OUTPUT_DIRECTORY = "@VTK_BINARY_DIR@/Utilities/Doxygen/doc" - -INPUT = \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Filtering" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GenericFiltering" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GenericFiltering/Testing/Cxx" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Geovis" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Graphics" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GUISupport" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GUISupport/MFC" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GUISupport/Qt" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GUISupport/Qt/Chart" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Hybrid" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Imaging" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Infovis" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/IO" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Parallel" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Widgets" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Views" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/VolumeRendering" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_version.dox" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_class2examples.dox" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_class2tests.dox" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_events2.dox" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_events.dox" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_index.dox" - -EXCLUDE_PATTERNS = -EXCLUDE = \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkSetGet.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Filtering/vtkMarchingSquaresCases.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Filtering/vtkMarchingCubesCases.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkWindows.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkWinCE.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkTcl.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkTk.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkTclUtil.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkPython.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkPythonUtil.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkJavaAwt.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkJavaUtil.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkPythonUtil.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkTclUtil.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Parallel/vtkMPI.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Hybrid/vtk3DS.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Hybrid/vtkVRML.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/IO/vtkPLY.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering/vtkOpenGL.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering/vtkFreeTypeFontCache.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering/fonts/vtkEmbeddedFonts.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering/Testing/vtkRegressionTestImage.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/Testing/vtkTestDriver.h" \ - "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/Testing/vtkTestingColors.h" - -# TAGFILES = "@VTK_BINARY_DIR@/Utilities/Doxygen/vtk@VTK_MAJOR_VERSION@-nightly.tag"=http://www.vtk.org/doc/nightly/html - -EXTRACT_ALL = YES -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = YES -ALWAYS_DETAILED_SEC = NO -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -CASE_SENSE_NAMES = YES -VERBATIM_HEADERS = NO -SHOW_INCLUDE_FILES = YES -JAVADOC_AUTOBRIEF = YES -SORT_MEMBER_DOCS = NO -DISTRIBUTE_GROUP_DOC = YES -TAB_SIZE = 3 -DETAILS_AT_TOP = YES -SHORT_NAMES = @DOXYGEN_SHORT_NAMES@ -# PAPER_TYPE = letter - -FILE_PATTERNS = *.h -RECURSIVE = NO - -HTML_ALIGN_MEMBERS = YES - -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 3 -IGNORE_PREFIX = vtk - -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -SEARCH_INCLUDES = YES -INCLUDE_PATH = -EXPAND_ONLY_PREDEF = YES -PREDEFINED = "vtkSetMacro(name,type)= \ - virtual void Set##name (type);" \ - "vtkGetMacro(name,type)= \ - virtual type Get##name ();" \ - "vtkSetStringMacro(name)= \ - virtual void Set##name (const char*);" \ - "vtkGetStringMacro(name)= \ - virtual char* Get##name ();" \ - "vtkSetClampMacro(name,type,min,max)= \ - virtual void Set##name (type);" \ - "vtkSetObjectMacro(name,type)= \ - virtual void Set##name (type*);" \ - "vtkGetObjectMacro(name,type)= \ - virtual type *Get##name ();" \ - "vtkBooleanMacro(name,type)= \ - virtual void name##On (); \ - virtual void name##Off ();" \ - "vtkSetVector2Macro(name,type)= \ - virtual void Set##name (type, type); \ - void Set##name (type [2]);" \ - "vtkGetVector2Macro(name,type)= \ - virtual type *Get##name (); \ - virtual void Get##name (type &, type &); \ - virtual void Get##name (type [2]);" \ - "vtkSetVector3Macro(name,type)= \ - virtual void Set##name (type, type, type); \ - virtual void Set##name (type [3]);" \ - "vtkGetVector3Macro(name,type)= \ - virtual type *Get##name (); \ - virtual void Get##name (type &, type &, type &); \ - virtual void Get##name (type [3]);" \ - "vtkSetVector4Macro(name,type)= \ - virtual void Set##name (type, type, type, type); \ - virtual void Set##name (type [4]);" \ - "vtkGetVector4Macro(name,type)= \ - virtual type *Get##name (); \ - virtual void Get##name (type &, type &, type &, type &); \ - virtual void Get##name (type [4]);" \ - "vtkSetVector6Macro(name,type)= \ - virtual void Set##name (type, type, type, type, \ - type, type); \ - virtual void Set##name (type [6]);" \ - "vtkGetVector6Macro(name,type)= \ - virtual type *Get##name (); \ - virtual void Get##name (type &, type &, type &, \ - type &, type &, type &); \ - virtual void Get##name (type [6]);" \ - "vtkSetVectorMacro(name,type,count)= \ - virtual void Set##name(type data[]);" \ - "vtkGetVectorMacro(name,type,count)= \ - virtual type *Get##name (); \ - virtual void Get##name(type data[##count]);" \ - "vtkWorldCoordinateMacro(name)= \ - virtual vtkCoordinate *Get##name##Coordinate (); \ - virtual void Set##name(float x[3]); \ - virtual void Set##name(float x, float y, float z); \ - virtual float *Get##name();" \ - "vtkViewportCoordinateMacro(name)= \ - virtual vtkCoordinate *Get##name##Coordinate (); \ - virtual void Set##name(float x[2]); \ - virtual void Set##name(float x, float y); \ - virtual float *Get##name();" \ - "vtkTypeMacro(thisClass,superclass)= \ - typedef superclass Superclass; \ - virtual const char *GetClassName(); \ - static int IsTypeOf(const char *type); \ - virtual int IsA(const char *type); \ - static thisClass* SafeDownCast(vtkObject *o);" \ - "vtkTypeRevisionMacro(thisClass,superclass)= \ - typedef superclass Superclass; \ - virtual const char *GetClassName(); \ - static int IsTypeOf(const char *type); \ - virtual int IsA(const char *type); \ - static thisClass* SafeDownCast(vtkObject *o);" \ - "VTK_LEGACY(x)= x" +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = VTK +PROJECT_NUMBER = +OUTPUT_DIRECTORY = "@VTK_BINARY_DIR@/Utilities/Doxygen/doc" +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = @DOXYGEN_SHORT_NAMES@ +JAVADOC_AUTOBRIEF = YES +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 3 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +EXTENSION_MAPPING = +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = YES +SUBGROUPING = YES +TYPEDEF_HIDES_STRUCT = NO +SYMBOL_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = NO +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = NO +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Filtering" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GenericFiltering" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GenericFiltering/Testing/Cxx" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Geovis" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Graphics" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GUISupport" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GUISupport/MFC" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GUISupport/Qt" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/GUISupport/Qt/Chart" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Hybrid" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Imaging" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Infovis" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/IO" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Parallel" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Widgets" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Views" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/VolumeRendering" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_version.dox" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_class2examples.dox" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_class2tests.dox" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_events2.dox" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_events.dox" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/doc_VTK_index.dox" +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.h +RECURSIVE = NO +EXCLUDE = "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkSetGet.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Filtering/vtkMarchingSquaresCases.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Filtering/vtkMarchingCubesCases.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkWindows.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkWinCE.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkTcl.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkTk.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkTclUtil.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkPython.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkPythonUtil.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkJavaAwt.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkJavaUtil.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkPythonUtil.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/vtkTclUtil.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Parallel/vtkMPI.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Hybrid/vtk3DS.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Hybrid/vtkVRML.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/IO/vtkPLY.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering/vtkOpenGL.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering/vtkFreeTypeFontCache.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering/fonts/vtkEmbeddedFonts.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Rendering/Testing/vtkRegressionTestImage.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/Testing/vtkTestDriver.h" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/dox/Common/Testing/vtkTestingColors.h" +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = "@VTK_SOURCE_DIR@/Utilities/Doxygen" \ + "@VTK_BINARY_DIR@/Utilities/Doxygen/contrib" \ + "@VTK_SOURCE_DIR@/Rendering" +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 3 +IGNORE_PREFIX = vtk +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_TIMESTAMP = NO +HTML_ALIGN_MEMBERS = YES +HTML_DYNAMIC_SECTIONS = NO +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +GENERATE_HTMLHELP = YES +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +USE_INLINE_TREES = NO +TREEVIEW_WIDTH = 250 +FORMULA_FONTSIZE = 10 +SEARCHENGINE = NO +SERVER_BASED_SEARCH = NO +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = "vtkSetMacro(name,type)= virtual void Set##name (type);" \ + "vtkGetMacro(name,type)= virtual type Get##name ();" \ + "vtkSetStringMacro(name)= virtual void Set##name (const char*);" \ + "vtkGetStringMacro(name)= virtual char* Get##name ();" \ + "vtkSetClampMacro(name,type,min,max)= virtual void Set##name (type);" \ + "vtkSetObjectMacro(name,type)= virtual void Set##name (type*);" \ + "vtkGetObjectMacro(name,type)= virtual type *Get##name ();" \ + "vtkBooleanMacro(name,type)= virtual void name##On (); virtual void name##Off ();" \ + "vtkSetVector2Macro(name,type)= virtual void Set##name (type, type); void Set##name (type [2]);" \ + "vtkGetVector2Macro(name,type)= virtual type *Get##name (); virtual void Get##name (type &, type &); virtual void Get##name (type [2]);" \ + "vtkSetVector3Macro(name,type)= virtual void Set##name (type, type, type); virtual void Set##name (type [3]);" \ + "vtkGetVector3Macro(name,type)= virtual type *Get##name (); virtual void Get##name (type &, type &, type &); virtual void Get##name (type [3]);" \ + "vtkSetVector4Macro(name,type)= virtual void Set##name (type, type, type, type); virtual void Set##name (type [4]);" \ + "vtkGetVector4Macro(name,type)= virtual type *Get##name (); virtual void Get##name (type &, type &, type &, type &); virtual void Get##name (type [4]);" \ + "vtkSetVector6Macro(name,type)= virtual void Set##name (type, type, type, type, type, type); virtual void Set##name (type [6]);" \ + "vtkGetVector6Macro(name,type)= virtual type *Get##name (); virtual void Get##name (type &, type &, type &, type &, type &, type &); virtual void Get##name (type [6]);" \ + "vtkSetVectorMacro(name,type,count)= virtual void Set##name(type data[]);" \ + "vtkGetVectorMacro(name,type,count)= virtual type *Get##name (); virtual void Get##name(type data[##count]);" \ + "vtkWorldCoordinateMacro(name)= virtual vtkCoordinate *Get##name##Coordinate (); virtual void Set##name(float x[3]); virtual void Set##name(float x, float y, float z); virtual float *Get##name();" \ + "vtkViewportCoordinateMacro(name)= virtual vtkCoordinate *Get##name##Coordinate (); virtual void Set##name(float x[2]); virtual void Set##name(float x, float y); virtual float *Get##name();" \ + "vtkTypeMacro(thisClass,superclass)= typedef superclass Superclass; virtual const char *GetClassName(); static int IsTypeOf(const char *type); virtual int IsA(const char *type); static thisClass* SafeDownCast(vtkObject *o);" \ + "vtkTypeRevisionMacro(thisClass,superclass)= typedef superclass Superclass; virtual const char *GetClassName(); static int IsTypeOf(const char *type); virtual int IsA(const char *type); static thisClass* SafeDownCast(vtkObject *o);" \ + "VTK_LEGACY(x)= x" +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = "@VTK_BINARY_DIR@/Utilities/Doxygen/vtk@VTK_MAJOR_VERSION@.@VTK_MINOR_VERSION@.tag" +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = @HAVE_DOT_YESNO@ +DOT_FONTNAME = FreeSans +DOT_FONTSIZE = 10 +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = NO +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = svg +DOT_PATH = "@DOT_PATH@" +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = YES +GENERATE_LEGEND = YES +DOT_CLEANUP = YES --- vtk-5.4.2.orig/IO/vtkPLOT3DReader.cxx +++ vtk-5.4.2/IO/vtkPLOT3DReader.cxx @@ -28,9 +28,11 @@ vtkCxxRevisionMacro(vtkPLOT3DReader, "$Revision: 1.89 $"); vtkStandardNewMacro(vtkPLOT3DReader); +// density, sound speed, and pressure at infinity #define VTK_RHOINF 1.0 #define VTK_CINF 1.0 -#define VTK_PINF ((VTK_RHOINF*VTK_CINF) * (VTK_RHOINF*VTK_CINF) / this->Gamma) +#define VTK_PINF ((VTK_RHOINF*VTK_CINF) * (VTK_CINF) / this->Gamma) +// constant-volume specific heat #define VTK_CV (this->R / (this->Gamma-1.0)) vtkPLOT3DReader::vtkPLOT3DReader() @@ -250,16 +252,16 @@ // Estimate the size of a grid (binary file only) long vtkPLOT3DReader::EstimateSize(int ni, int nj, int nk) { - long size; // the header portion, 3 ints + long size; if (!this->TwoDimensionalGeometry) { - size = 3*4; + size = 3*4; // the header portion, 3 ints size += ni*nj*nk*3*4; // x, y, z } else { - size = 2*4; - size += ni*nj*nk*2*4; // x, y, z + size = 2*4; // the header portion, 2 ints + size += ni*nj*nk*2*4; // x, y } if (this->HasByteCount) { @@ -363,13 +365,13 @@ if (!verify) { - // We were told not the verify the number of grid. Just return it. + // We were told not to verify the number of grids. Just return it. numOutputs = numGrid; } else { // We were told to make sure that the file can really contain - // the number of grid in the header (we can only check this + // the number of grids in the header (we can only check this // if file is binary) int error=0; if ( this->BinaryFile ) @@ -523,6 +525,10 @@ { this->ReadIntBlock(fp, 1, &nk); } + else + { + nk = 1; + } vtkDebugMacro("Q, block " << i << " dimensions: " << ni << " " << nj << " " << nk); @@ -1370,9 +1376,7 @@ vtkPointData* outputPD = output->GetPointData(); vtkDataArray* density = outputPD->GetArray("Density"); vtkDataArray* momentum = outputPD->GetArray("Momentum"); - vtkDataArray* energy = outputPD->GetArray("StagnationEnergy"); - if ( density == NULL || momentum == NULL || - energy == NULL ) + if ( density == NULL || momentum == NULL ) { vtkErrorMacro(<<"Cannot compute velocity magnitude"); return; @@ -1521,9 +1525,7 @@ vtkPointData* outputPD = output->GetPointData(); vtkDataArray* density = outputPD->GetArray("Density"); vtkDataArray* momentum = outputPD->GetArray("Momentum"); - vtkDataArray* energy = outputPD->GetArray("StagnationEnergy"); - if ( density == NULL || momentum == NULL || - energy == NULL ) + if ( density == NULL || momentum == NULL ) { vtkErrorMacro(<<"Cannot compute velocity"); return; @@ -1572,10 +1574,8 @@ vtkPointData* outputPD = output->GetPointData(); vtkDataArray* density = outputPD->GetArray("Density"); vtkDataArray* momentum = outputPD->GetArray("Momentum"); - vtkDataArray* energy = outputPD->GetArray("StagnationEnergy"); if ( (points=output->GetPoints()) == NULL || - density == NULL || momentum == NULL || - energy == NULL ) + density == NULL || momentum == NULL ) { vtkErrorMacro(<<"Cannot compute vorticity"); return; @@ -1972,7 +1972,7 @@ // Now calculate the Jacobian. Grids occasionally have // singularities, or points where the Jacobian is infinite (the // inverse is zero). For these cases, we'll set the Jacobian to - // zero, which will result in a zero vorticity. + // zero, which will result in a zero pressure gradient. // aj = xxi*yeta*zzeta+yxi*zeta*xzeta+zxi*xeta*yzeta -zxi*yeta*xzeta-yxi*xeta*zzeta-xxi*zeta*yzeta; @@ -1996,7 +1996,7 @@ zetay= -aj*(xxi*zeta-zxi*xeta); zetaz= aj*(xxi*yeta-yxi*xeta); - // Finally, the vorticity components. + // Finally, the pressure gradient components. g[0]= xix*pxi+etax*peta+zetax*pzeta; g[1]= xiy*pxi+etay*peta+zetay*pzeta; g[2]= xiz*pxi+etaz*peta+zetaz*pzeta; --- vtk-5.4.2.orig/IO/vtkMultiBlockPLOT3DReader.cxx +++ vtk-5.4.2/IO/vtkMultiBlockPLOT3DReader.cxx @@ -35,9 +35,11 @@ vtkCxxRevisionMacro(vtkMultiBlockPLOT3DReader, "$Revision: 1.12 $"); vtkStandardNewMacro(vtkMultiBlockPLOT3DReader); +// density, sound speed, and pressure at infinity #define VTK_RHOINF 1.0 #define VTK_CINF 1.0 -#define VTK_PINF ((VTK_RHOINF*VTK_CINF) * (VTK_RHOINF*VTK_CINF) / this->Gamma) +#define VTK_PINF ((VTK_RHOINF*VTK_CINF) * (VTK_CINF) / this->Gamma) +// constant-volume specific heat #define VTK_CV (this->R / (this->Gamma-1.0)) struct vtkMultiBlockPLOT3DReaderInternals @@ -145,7 +147,7 @@ if ( this->QFileName == NULL || this->QFileName[0] == '\0' ) { this->SetErrorCode(vtkErrorCode::NoFileNameError); - vtkErrorMacro(<< "Must specify geometry file"); + vtkErrorMacro(<< "Must specify solution file"); return VTK_ERROR; } return this->CheckFile(qFp, this->QFileName); @@ -196,6 +198,7 @@ } } +// Read a block of floats (ascii or binary) and return number read. int vtkMultiBlockPLOT3DReader::ReadFloatBlock(FILE* fp, int n, float* block) { if (this->BinaryFile) @@ -230,7 +233,6 @@ } } -// Read a block of floats (ascii or binary) and return number read. void vtkMultiBlockPLOT3DReader::CalculateFileSize(FILE* fp) { long curPos = ftell(fp); @@ -243,16 +245,16 @@ // Estimate the size of a grid (binary file only) long vtkMultiBlockPLOT3DReader::EstimateSize(int ni, int nj, int nk) { - long size; // the header portion, 3 ints + long size; if (!this->TwoDimensionalGeometry) { - size = 3*4; + size = 3*4; // the header portion, 3 ints size += ni*nj*nk*3*4; // x, y, z } else { - size = 2*4; - size += ni*nj*nk*2*4; // x, y, z + size = 2*4; // the header portion, 2 ints + size += ni*nj*nk*2*4; // x, y } if (this->HasByteCount) { @@ -429,13 +431,13 @@ if (!verify) { - // We were told not the verify the number of grid. Just return it. + // We were told not to verify the number of grids. Just return it. numBlocks = numGrid; } else { // We were told to make sure that the file can really contain - // the number of grid in the header (we can only check this + // the number of grids in the header (we can only check this // if file is binary) int error=0; if ( this->BinaryFile ) @@ -618,6 +620,10 @@ { this->ReadIntBlock(fp, 1, &nk); } + else + { + nk = 1; + } vtkDebugMacro("Q, block " << i << " dimensions: " << ni << " " << nj << " " << nk); @@ -1397,9 +1403,7 @@ vtkPointData* outputPD = output->GetPointData(); vtkDataArray* density = outputPD->GetArray("Density"); vtkDataArray* momentum = outputPD->GetArray("Momentum"); - vtkDataArray* energy = outputPD->GetArray("StagnationEnergy"); - if ( density == NULL || momentum == NULL || - energy == NULL ) + if ( density == NULL || momentum == NULL ) { vtkErrorMacro(<<"Cannot compute velocity magnitude"); return; @@ -1545,9 +1549,7 @@ vtkPointData* outputPD = output->GetPointData(); vtkDataArray* density = outputPD->GetArray("Density"); vtkDataArray* momentum = outputPD->GetArray("Momentum"); - vtkDataArray* energy = outputPD->GetArray("StagnationEnergy"); - if ( density == NULL || momentum == NULL || - energy == NULL ) + if ( density == NULL || momentum == NULL ) { vtkErrorMacro(<<"Cannot compute velocity"); return; @@ -1595,10 +1597,8 @@ vtkPointData* outputPD = output->GetPointData(); vtkDataArray* density = outputPD->GetArray("Density"); vtkDataArray* momentum = outputPD->GetArray("Momentum"); - vtkDataArray* energy = outputPD->GetArray("StagnationEnergy"); if ( (points=output->GetPoints()) == NULL || - density == NULL || momentum == NULL || - energy == NULL ) + density == NULL || momentum == NULL ) { vtkErrorMacro(<<"Cannot compute vorticity"); return; @@ -1994,7 +1994,7 @@ // Now calculate the Jacobian. Grids occasionally have // singularities, or points where the Jacobian is infinite (the // inverse is zero). For these cases, we'll set the Jacobian to - // zero, which will result in a zero vorticity. + // zero, which will result in a zero pressure gradient. // aj = xxi*yeta*zzeta+yxi*zeta*xzeta+zxi*xeta*yzeta -zxi*yeta*xzeta-yxi*xeta*zzeta-xxi*zeta*yzeta; @@ -2018,7 +2018,7 @@ zetay= -aj*(xxi*zeta-zxi*xeta); zetaz= aj*(xxi*yeta-yxi*xeta); - // Finally, the vorticity components. + // Finally, the pressure gradient components. g[0]= xix*pxi+etax*peta+zetax*pzeta; g[1]= xiy*pxi+etay*peta+zetay*pzeta; g[2]= xiz*pxi+etaz*peta+zetaz*pzeta; --- vtk-5.4.2.orig/IO/vtkFFMPEGWriter.cxx +++ vtk-5.4.2/IO/vtkFFMPEGWriter.cxx @@ -20,7 +20,8 @@ #include "vtkErrorCode.h" extern "C" { -#include +#include +#include } //--------------------------------------------------------------------------- @@ -42,6 +43,7 @@ vtkFFMPEGWriter *Writer; AVFormatContext *avFormatContext; + struct SwsContext *img_convert_ctx; AVOutputFormat *avOutputFormat; @@ -224,6 +226,15 @@ //The yuv buffer should get deleted when this->yuv_input is. avpicture_fill((AVPicture *)this->yuvOutput, yuv, c->pix_fmt, c->width, c->height); + //set up to use sws_scale + img_convert_ctx = sws_getContext(c->width, c->height, + c->pix_fmt, + c->width, c->height, PIX_FMT_YUV420P, SWS_BICUBIC, + NULL, NULL, NULL); + if(this->img_convert_ctx == NULL) { + vtkGenericWarningMacro (<< "Cannot initialize the conversion context!"); + return(0); + } //Finally, open the file and start it off. if (url_fopen(&this->avFormatContext->pb, this->avFormatContext->filename, URL_WRONLY) < 0) @@ -256,9 +267,14 @@ } //convert that to YUV for input to the codec - img_convert((AVPicture *)this->yuvOutput, cc->pix_fmt, - (AVPicture *)this->rgbInput, PIX_FMT_RGB24, - cc->width, cc->height); + //img_convert((AVPicture *)this->yuvOutput, cc->pix_fmt, + // (AVPicture *)this->rgbInput, PIX_FMT_RGB24, + // cc->width, cc->height); + // img_convert parameters are 2 first destination, then 4 source + // sws_scale parameters are context, 4 first source, then 2 destination + sws_scale(this->img_convert_ctx, + ((AVPicture *)this->rgbInput)->data, 0, cc->width, cc->height, + ((AVPicture *)this->yuvOutput)->data, ((AVPicture *)this->yuvOutput)->linesize); //run the encoder int toAdd = avcodec_encode_video(cc, @@ -332,7 +348,7 @@ if (this->openedFile) { av_write_trailer(this->avFormatContext); - url_fclose(&this->avFormatContext->pb); + url_fclose(this->avFormatContext->pb); this->openedFile = 0; } @@ -347,7 +363,12 @@ this->avOutputFormat = 0; } - + + if (this->img_convert_ctx) + { + sws_freeContext(this->img_convert_ctx); + } + this->closedFile = 1; } --- vtk-5.4.2.orig/IO/CMakeLists.txt +++ vtk-5.4.2/IO/CMakeLists.txt @@ -241,7 +241,8 @@ SET(KIT_LIBS ${KIT_LIBS} ${FFMPEG_avcodec_LIBRARY} ${FFMPEG_avformat_LIBRARY} - ${FFMPEG_avutil_LIBRARY}) + ${FFMPEG_avutil_LIBRARY} + ${FFMPEG_swscale_LIBRARY}) ENDIF (VTK_USE_FFMPEG_ENCODER) #----------------------------------------------------------------------------- --- vtk-5.4.2.orig/Common/vtkCommand.cxx +++ vtk-5.4.2/Common/vtkCommand.cxx @@ -48,6 +48,8 @@ "MouseMoveEvent", "MouseWheelForwardEvent", "MouseWheelBackwardEvent", + "ActiveCameraEvent", + "CreateCameraEvent", "ResetCameraEvent", "ResetCameraClippingRangeEvent", "ModifiedEvent", --- vtk-5.4.2.orig/Common/vtkCommand.h +++ vtk-5.4.2/Common/vtkCommand.h @@ -288,6 +288,8 @@ MouseMoveEvent, MouseWheelForwardEvent, MouseWheelBackwardEvent, + ActiveCameraEvent, + CreateCameraEvent, ResetCameraEvent, ResetCameraClippingRangeEvent, ModifiedEvent, --- vtk-5.4.2.orig/Rendering/vtkRenderer.cxx +++ vtk-5.4.2/Rendering/vtkRenderer.cxx @@ -709,12 +709,15 @@ this->ActiveCamera = cam; this->Modified(); + this->InvokeEvent(vtkCommand::ActiveCameraEvent, cam); } //---------------------------------------------------------------------------- vtkCamera* vtkRenderer::MakeCamera() { - return vtkCamera::New(); + vtkCamera *cam = vtkCamera::New(); + this->InvokeEvent(vtkCommand::CreateCameraEvent, cam); + return cam; } //---------------------------------------------------------------------------- --- vtk-5.4.2.orig/Rendering/CMakeLists.txt +++ vtk-5.4.2/Rendering/CMakeLists.txt @@ -174,9 +174,13 @@ IF(VTK_USE_GL2PS) SET(Kit_SRCS ${Kit_SRCS} vtkGL2PSExporter.cxx) - SET(Kit_GL2PS_SRCS ${VTK_SOURCE_DIR}/Utilities/gl2ps/gl2ps.c) - ADD_DEFINITIONS(-DGL2PS_HAVE_ZLIB) - ADD_DEFINITIONS(-DGL2PS_HAVE_LIBPNG) + + IF(VTK_USE_SYSTEM_GL2PS) + ELSE(VTK_USE_SYSTEM_GL2PS) + SET(Kit_GL2PS_SRCS ${VTK_SOURCE_DIR}/Utilities/vtkgl2ps/gl2ps.c) + ADD_DEFINITIONS(-DGL2PS_HAVE_ZLIB) + ADD_DEFINITIONS(-DGL2PS_HAVE_LIBPNG) + ENDIF(VTK_USE_SYSTEM_GL2PS) ENDIF(VTK_USE_GL2PS) IF(VTK_USE_CG_SHADERS) @@ -447,7 +451,11 @@ # Build a list of libraries to link to vtkRendering. IF(VTK_USE_GL2PS) - SET(KIT_LIBS ${KIT_LIBS} ${VTK_ZLIB_LIBRARIES} ${VTK_PNG_LIBRARIES}) + IF(VTK_USE_SYSTEM_GL2PS) + SET(KIT_LIBS ${KIT_LIBS} ${GL2PS_LIBRARIES} ${VTK_ZLIB_LIBRARIES} ${VTK_PNG_LIBRARIES}) + ELSE(VTK_USE_SYSTEM_GL2PS) + SET(KIT_LIBS ${KIT_LIBS} ${VTK_ZLIB_LIBRARIES} ${VTK_PNG_LIBRARIES}) + ENDIF(VTK_USE_SYSTEM_GL2PS) ENDIF(VTK_USE_GL2PS) IF (WIN32) --- vtk-5.4.2.orig/CMake/FindGL2PS.cmake +++ vtk-5.4.2/CMake/FindGL2PS.cmake @@ -0,0 +1,37 @@ +# - Find GL2PS library +# Find the native GL2PS includes and library +# This module defines +# GL2PS_INCLUDE_DIR, where to find tiff.h, etc. +# GL2PS_LIBRARIES, libraries to link against to use GL2PS. +# GL2PS_FOUND, If false, do not try to use GL2PS. +# also defined, but not for general use are +# GL2PS_LIBRARY, where to find the GL2PS library. + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Mathieu Malaterre +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +FIND_PATH(GL2PS_INCLUDE_DIR gl2ps.h) + +FIND_LIBRARY(GL2PS_LIBRARY NAMES gl2ps ) + +# handle the QUIETLY and REQUIRED arguments and set GL2PS_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GL2PS DEFAULT_MSG GL2PS_LIBRARY GL2PS_INCLUDE_DIR) + +IF(GL2PS_FOUND) + SET( GL2PS_LIBRARIES ${GL2PS_LIBRARY} ) +ENDIF(GL2PS_FOUND) + +MARK_AS_ADVANCED(GL2PS_INCLUDE_DIR GL2PS_LIBRARY) --- vtk-5.4.2.orig/CMake/vtkWrapJava.cmake +++ vtk-5.4.2/CMake/vtkWrapJava.cmake @@ -133,7 +133,8 @@ ENDIF (USER_JAVA_CLASSPATH) SET (OUT_TEXT) - SET (classes) + SET (sources) + SET (driver) # get the classes for this lib FOREACH(srcName ${ARGN}) @@ -147,17 +148,17 @@ SET(className "${srcPath}/${srcNameWe}.class") SET (OUT_TEXT ${OUT_TEXT} "\n dummy = new ${srcNameWe}()") - # On Unix we can just call javac ... *.java - ADD_CUSTOM_COMMAND( - OUTPUT "${className}" - COMMAND "${JAVA_COMPILE}" ARGS -classpath "${javaPath}" "${srcPath}/vtk${TARGET}Driver.java" - DEPENDS "${srcName}" - ) - - SET (classes ${classes} ${className}) + SET(driver "${srcPath}/vtk${TARGET}Driver.class") + + SET (sources ${sources} ${srcName}) ENDFOREACH(srcName) - ADD_CUSTOM_COMMAND(TARGET ${TARGET} SOURCE ${TARGET} DEPENDS ${classes}) + ADD_CUSTOM_COMMAND( + OUTPUT ${driver} + COMMAND "${JAVA_COMPILE}" ARGS -source 5 -classpath "${javaPath}" "${srcPath}/vtk${TARGET}Driver.java" + DEPENDS ${sources} + ) + ADD_CUSTOM_COMMAND(TARGET ${TARGET} SOURCE ${TARGET} DEPENDS ${driver}) SET (TARGET_NAME ${TARGET}) CONFIGURE_FILE( ${VTK_CMAKE_DIR}/vtkJavaDriver.java.in --- vtk-5.4.2.orig/CMake/FindJNI.cmake +++ vtk-5.4.2/CMake/FindJNI.cmake @@ -0,0 +1,184 @@ +# - Find JNI java libraries. +# This module finds if Java is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# JNI_INCLUDE_DIRS = the include dirs to use +# JNI_LIBRARIES = the libraries to use +# JAVA_AWT_LIBRARY = the path to the jawt library +# JAVA_JVM_LIBRARY = the path to the jvm library +# JAVA_INCLUDE_PATH = the include path to jni.h +# JAVA_INCLUDE_PATH2 = the include path to jni_md.h +# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h +# + +GET_FILENAME_COMPONENT(java_install_version + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME) + +SET(JAVA_AWT_LIBRARY_DIRECTORIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" + /usr/lib + /usr/local/lib + /usr/lib/jvm/java/lib + /usr/lib/java/jre/lib/i386 + /usr/local/lib/java/jre/lib/i386 + /usr/local/share/java/jre/lib/i386 + /usr/lib/j2sdk1.4-sun/jre/lib/i386 + /usr/lib/j2sdk1.5-sun/jre/lib/i386 + /opt/sun-jdk-1.5.0.04/jre/lib/amd64 + /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/amd64 + /usr/lib/java/jre/lib/amd64 + /usr/local/lib/java/jre/lib/amd64 + /usr/local/share/java/jre/lib/amd64 + /usr/lib/j2sdk1.4-sun/jre/lib/amd64 + /usr/lib/j2sdk1.5-sun/jre/lib/amd64 + /usr/lib/java/jre/lib/ppc + /usr/local/lib/java/jre/lib/ppc + /usr/local/share/java/jre/lib/ppc + /usr/lib/j2sdk1.4-sun/jre/lib/ppc + /usr/lib/j2sdk1.5-sun/jre/lib/ppc + /usr/lib/jvm/default-java/jre/lib/alpha + /usr/lib/jvm/default-java/jre/lib/amd64 + /usr/lib/jvm/default-java/jre/lib/arm + /usr/lib/jvm/default-java/jre/lib/i386 + /usr/lib/jvm/default-java/jre/lib/ia64 + /usr/lib/jvm/default-java/jre/lib/m68k + /usr/lib/jvm/default-java/jre/lib/mips + /usr/lib/jvm/default-java/jre/lib/mipsel + /usr/lib/jvm/default-java/jre/lib/parisc + /usr/lib/jvm/default-java/jre/lib/powerpc + /usr/lib/jvm/default-java/jre/lib/ppc + /usr/lib/jvm/default-java/jre/lib/s390 + /usr/lib/jvm/default-java/jre/lib/sparc + /usr/lib/jvm/default-java/jre/lib/x86_64 + /usr/lib/jvm/default-java/jre/lib/sh + ) + +SET(JAVA_JVM_LIBRARY_DIRECTORIES) +FOREACH(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) + SET(JAVA_JVM_LIBRARY_DIRECTORIES + ${JAVA_JVM_LIBRARY_DIRECTORIES} + "${dir}" + "${dir}/client" + "${dir}/server" + ) +ENDFOREACH(dir) + + +SET(JAVA_AWT_INCLUDE_DIRECTORIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" + $ENV{JAVA_HOME}/include + /usr/include + /usr/local/include + /usr/lib/java/include + /usr/local/lib/java/include + /usr/lib/jvm/java/include + /usr/lib/jvm/java-6-sun-1.6.0.00/include + /usr/local/share/java/include + /usr/lib/j2sdk1.4-sun/include + /usr/lib/j2sdk1.5-sun/include + /opt/sun-jdk-1.5.0.04/include + ) + +FOREACH(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") + GET_FILENAME_COMPONENT(jpath "${JAVA_PROG}" PATH) + FOREACH(JAVA_INC_PATH ../include ../java/include ../share/java/include) + IF(EXISTS ${jpath}/${JAVA_INC_PATH}) + SET(JAVA_AWT_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_DIRECTORIES} "${jpath}/${JAVA_INC_PATH}") + ENDIF(EXISTS ${jpath}/${JAVA_INC_PATH}) + ENDFOREACH(JAVA_INC_PATH) + FOREACH(JAVA_LIB_PATH + ../lib ../jre/lib ../jre/lib/i386 + ../java/lib ../java/jre/lib ../java/jre/lib/i386 + ../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386) + IF(EXISTS ${jpath}/${JAVA_LIB_PATH}) + SET(JAVA_AWT_LIBRARY_DIRECTORIES ${JAVA_AWT_LIBRARY_DIRECTORIES} "${jpath}/${JAVA_LIB_PATH}") + ENDIF(EXISTS ${jpath}/${JAVA_LIB_PATH}) + ENDFOREACH(JAVA_LIB_PATH) +ENDFOREACH(JAVA_PROG) + +IF(APPLE) + IF(EXISTS ~/Library/Frameworks/JavaVM.framework) + SET(JAVA_HAVE_FRAMEWORK 1) + ENDIF(EXISTS ~/Library/Frameworks/JavaVM.framework) + IF(EXISTS /Library/Frameworks/JavaVM.framework) + SET(JAVA_HAVE_FRAMEWORK 1) + ENDIF(EXISTS /Library/Frameworks/JavaVM.framework) + IF(EXISTS /System/Library/Frameworks/JavaVM.framework) + SET(JAVA_HAVE_FRAMEWORK 1) + ENDIF(EXISTS /System/Library/Frameworks/JavaVM.framework) + + IF(JAVA_HAVE_FRAMEWORK) + IF(NOT JAVA_AWT_LIBRARY) + SET (JAVA_AWT_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE) + ENDIF(NOT JAVA_AWT_LIBRARY) + + IF(NOT JAVA_JVM_LIBRARY) + SET (JAVA_JVM_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE) + ENDIF(NOT JAVA_JVM_LIBRARY) + + IF(NOT JAVA_AWT_INCLUDE_PATH) + IF(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h) + SET (JAVA_AWT_INCLUDE_PATH "/System/Library/Frameworks/JavaVM.framework/Headers" CACHE FILEPATH "jawt.h location" FORCE) + ENDIF(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h) + ENDIF(NOT JAVA_AWT_INCLUDE_PATH) + + # If using "-framework JavaVM", prefer its headers *before* the others in + # JAVA_AWT_INCLUDE_DIRECTORIES... (*prepend* to the list here) + # + SET(JAVA_AWT_INCLUDE_DIRECTORIES + ~/Library/Frameworks/JavaVM.framework/Headers + /Library/Frameworks/JavaVM.framework/Headers + /System/Library/Frameworks/JavaVM.framework/Headers + ${JAVA_AWT_INCLUDE_DIRECTORIES} + ) + ENDIF(JAVA_HAVE_FRAMEWORK) +ELSE(APPLE) + FIND_LIBRARY(JAVA_AWT_LIBRARY jawt + PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES} + ) + FIND_LIBRARY(JAVA_JVM_LIBRARY NAMES jvm JavaVM + PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES} + ) +ENDIF(APPLE) + +# add in the include path +FIND_PATH(JAVA_INCLUDE_PATH jni.h + ${JAVA_AWT_INCLUDE_DIRECTORIES} +) + +FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h + ${JAVA_AWT_INCLUDE_DIRECTORIES} + ${JAVA_INCLUDE_PATH}/win32 + ${JAVA_INCLUDE_PATH}/linux + ${JAVA_INCLUDE_PATH}/freebsd +) + +FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h + ${JAVA_AWT_INCLUDE_DIRECTORIES} + ${JAVA_INCLUDE_PATH} +) + +MARK_AS_ADVANCED( + JAVA_AWT_LIBRARY + JAVA_JVM_LIBRARY + JAVA_AWT_INCLUDE_PATH + JAVA_INCLUDE_PATH + JAVA_INCLUDE_PATH2 +) + +SET(JNI_LIBRARIES + ${JAVA_AWT_LIBRARY} + ${JAVA_JVM_LIBRARY} +) + +SET(JNI_INCLUDE_DIRS + ${JAVA_INCLUDE_PATH} + ${JAVA_INCLUDE_PATH2} + ${JAVA_AWT_INCLUDE_PATH} +) + --- vtk-5.4.2.orig/debian/rules +++ vtk-5.4.2/debian/rules @@ -0,0 +1,261 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +include /usr/share/python/python.mk + +PWD=$(shell pwd) +DVER=$(shell cat /etc/debian_version) +GPPVER=$(shell dpkg --status g++ | grep Version | cut -d ' ' -f 2) +export GCC=gcc +export GPP=g++ +#export CC=gcc-4.3 +#export CXX=g++-4.3 + +DEB_HOST_ARCH ?=$(shell dpkg-architecture -qDEB_HOST_ARCH) +DEB_HOST_ARCH_CPU ?=$(shell dpkg-architecture -qDEB_HOST_ARCH_CPU) + +# The next line will cause Dart to be used if it is installed... +DARTP=$(shell if [ -d /usr/share/Dart ]; then echo USE_DART; else echo DONT_USE_DART; fi ) + +# Hack for parisc64 to close bug #133696 +ifeq ($(DEB_HOST_ARCH),parisc64) +export CXXFLAGS=-g -ffunction-sections -Wall +else +export CXXFLAGS=-g -Wall +endif +export LD_LIBRARY_PATH+=:$(CURDIR)/Build/bin +export TCLLIBPATH=$(CURDIR)/Build/Wrapping/Tcl/ +export CFLAGS=-g -Wall + +# export JAVA_HOME to help FindJava.cmake and FindJNI.cmake +export JAVA_HOME=/usr/lib/jvm/default-java + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 + CXXFLAGS += -O0 +else + #optimisation seems to cause a segfault on + #arm old abi so disable it + ifeq ($(DEB_HOST_ARCH),arm) + CFLAGS += -O0 + CXXFLAGS += -O0 + else + CFLAGS += -O2 + CXXFLAGS += -O2 + endif +endif + +#ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) +#INSTALL_PROGRAM += -s +#endif + +# set the number of build jobs +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + JOBS := -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) +endif + +PYVERS=$(shell pyversions -r debian/control) + +# Automagically set BUILDNAME and version dependent items +DEBVERSION:=$(shell head -n 1 debian/changelog | sed -e 's/^[^(]*(\([^)]*\)).*/\1/') + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + # pre-load the cache to avoid setting rpath: + mkdir -p Build + cp debian/CMakeCache.txt.debian Build/CMakeCache.txt + # echo CMAKE_X_CFLAGS:STRING=-I/usr/X11R6/include >> Build/CMakeCache.txt + echo BUILDNAME:STRING=Debian-vtk_$(DEBVERSION)_$(DEB_HOST_ARCH).deb >> Build/CMakeCache.txt + echo VTK_WRAP_HINTS:FILEPATH=$(CURDIR)/Wrapping/hints >> Build/CMakeCache.txt + echo VTK_WRAP_PYTHON_EXE:FILEPATH=$(CURDIR)/Build/bin/vtkWrapPython >> Build/CMakeCache.txt + echo VTK_WRAP_TCL_EXE:FILEPATH=$(CURDIR)/Build/bin/vtkWrapTcl >> Build/CMakeCache.txt + echo CMAKE_C_FLAGS:STRING=$$CFLAGS >> Build/CMakeCache.txt + echo CMAKE_CXX_FLAGS:STRING=$$CXXFLAGS >> Build/CMakeCache.txt + + # enable VTK GUI support, but do NOT enable Qt support now to be able + # to compile for multiple Qt versions + echo VTK_USE_GUISUPPORT:BOOL=ON >> Build/CMakeCache.txt + echo VTK_USE_QVTK:BOOL=OFF >> Build/CMakeCache.txt + # do not rebuild targets when CMakefiles change to speed up future + # compilation of Qt modules + echo CMAKE_SKIP_RULE_DEPENDENCY:BOOL=ON >> Build/CMakeCache.txt + + echo PYTHON_INCLUDE_PATH:PATH=/usr/include/$(PYVERS) >> Build/CMakeCache.txt + echo PYTHON_LIBRARY:FILEPATH=/usr/lib/lib$(PYVERS).so >> Build/CMakeCache.txt + echo CMAKE_INSTALL_PREFIX:PATH=$(CURDIR)/debian/tmp/usr >> Build/CMakeCache.txt + echo VTK_INSTALL_LIB_DIR:PATH=/lib/vtk-5.4 >> Build/CMakeCache.txt + echo VTK_INSTALL_PACKAGE_DIR:PATH=/lib/vtk-5.4 >> Build/CMakeCache.txt + if [ "X$(DARTP)" = XUSE_DART ]; then echo DART_ROOT:PATH=/usr/share/Dart >> Build/CMakeCache.txt; fi + echo VTK_PYTHON_SETUP_ARGS:STRING=--install-layout=deb --root=$(CURDIR)/debian/tmp/ >> Build/CMakeCache.txt + + # use a wrapper to disable anti-aliased fonts, vtk-doc is more than 500MB large with current graphviz + chmod +x debian/dot + echo DOT_PATH:PATH=$(CURDIR)/debian >> Build/CMakeCache.txt + + cd Build && cmake .. + chmod +x debian/xvfb-run + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + #if [ "X$(DARTP)" = XUSE_DART ]; then cd Build && ../debian/xvfb-run $(MAKE) Experimental; else cd Build && $(MAKE);fi + if [ "X$(DARTP)" = XUSE_DART ]; then cd Build && xvfb-run -s "-screen 0 1024x768x24" $(MAKE) $(JOBS) Experimental; else cd Build && $(MAKE) $(JOBS);fi + if [ "X$(DARTP)" = XUSE_DART ]; then cd Build && $(MAKE) $(JOBS) ExperimentalSubmit; fi + + + touch build-stamp + +build-docs: docs-stamp +docs-stamp: + dh_testdir + cd Build/Utilities/Doxygen && $(MAKE) DoxygenDoc + + # remove zero byte files + find Build/Utilities/Doxygen/ -depth -empty | xargs rm -rf + # remove .md5 files + rm -f Build/Utilities/Doxygen/doc/html/*.md5 + + touch docs-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp docs-stamp install-stamp + rm -rf Build + rm -rf Testing + rm -f CMake/*.o CMake/*.so + rm -f Wrapping/Python/vtkGetDataRoot.pyc + rm -f Wrapping/Python/vtkpython.pyc + rm -f Xauthority + rm -f current + dh_clean + + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + # Add here commands to install the package into debian/tmp. + $(MAKE) $(JOBS) -C Build install + + $(MAKE) -C Build/GUISupport clean + + # compile GUI support for Qt version 3 + cd Build/GUISupport && \ + cmake .. -DDESIRED_QT_VERSION=3 -DQT_QMAKE_EXECUTABLE:PATH=/usr/bin/qmake-qt3 \ + -DQT_MOC_EXECUTABLE=/usr/bin/moc-qt3 -DQT_INCLUDE_DIR=/usr/include/qt3 \ + -DVTK_USE_GUISUPPORT:BOOL=ON -DVTK_USE_QVTK:BOOL=ON \ + -UQT_QT_LIBRARY -DBUILD_EXAMPLES:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr + + $(MAKE) $(JOBS) -C Build/GUISupport + $(MAKE) $(JOBS) -C Build/GUISupport DESTDIR=$(CURDIR)/debian/tmp/qt3-support install + + $(MAKE) -C Build/GUISupport clean + + # compile GUI support for Qt version 4 + cd Build/GUISupport && \ + cmake .. -DDESIRED_QT_VERSION=4 -DQT_QMAKE_EXECUTABLE:PATH=/usr/bin/qmake-qt4 \ + -DQT_MOC_EXECUTABLE=/usr/bin/moc-qt4 -DQT_INCLUDE_DIR=/usr/include/qt4 \ + -DVTK_USE_GUISUPPORT:BOOL=ON -DVTK_USE_QVTK:BOOL=ON \ + -UQT_QT_LIBRARY -DBUILD_EXAMPLES:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr + + $(MAKE) $(JOBS) -C Build/GUISupport + $(MAKE) $(JOBS) -C Build/GUISupport DESTDIR=$(CURDIR)/debian/tmp/qt4-support install + + touch install-stamp + + +# Build architecture-independent files here. +# (vtk-doc) +binary-indep: build-docs + dh_testdir -i + dh_testroot -i +# dh_installdebconf -i + dh_installdocs -i + + dh_install -i --sourcedir=$(CURDIR)/debian/tmp --list-missing + dh_lintian -i + + dh_installexamples + chmod -x debian/vtk-examples/usr/share/vtk/Rendering/Tcl/keyBottle.tcl + chmod +x debian/vtk-examples/usr/share/vtk/Build/vtkMy/Wrapping/Tcl/MakePackages.tcl + find debian/vtk-examples/usr/share/vtk -name *.py -exec chmod +x \{\} \; + chmod -x debian/vtk-examples/usr/share/vtk/GUI/Python/OrthogonalPlanesWithTkPhoto.py + chmod -x debian/vtk-examples/usr/share/vtk/ParallelProcessing/MPI/Python/ParallelCone.py + chmod -x debian/vtk-examples/usr/share/vtk/Tutorial/Step5/Java/Cone5.java + chmod -x debian/vtk-examples/usr/share/vtk/VolumeRendering/Tcl/IntermixedUnstructuredGrid.tcl + chmod -x debian/vtk-examples/usr/share/vtk/GUI/Tcl/CameraAndSliderWidgets.tcl + chmod -x debian/vtk-examples/usr/share/vtk/GUI/Tcl/AffineWidget.tcl + chmod -x debian/vtk-examples/usr/share/vtk/GUI/Qt/CTestCustom.ctest.in + chmod -x debian/vtk-examples/usr/share/vtk/GUI/Tcl/AngleWidget.tcl + chmod -x debian/vtk-examples/usr/share/vtk/Infovis/Python/* + dh_installmenu -i + dh_installman -i + dh_installinfo -i + dh_installchangelogs -i + dh_link -i + dh_strip -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: install-stamp + dh_testdir -a + dh_testroot -a + #dh_installdebconf -a + dh_installdocs -a -n + + dh_install -a --sourcedir=$(CURDIR)/debian/tmp --list-missing + dh_lintian -a + + rm -f $(CURDIR)/debian/libvtk5-dev/usr/include/vtk-5.4/vtkJavaUtil.h +# find $(CURDIR)/debian/python-vtk/usr/lib/$(PYVERS)/site-packages -name \*.pyc -exec rm \{\} \; + # Remove those files, to help debugging problems when binary-arch is run by hand + -rm -f debian/vtk-tcl/usr/lib/vtk-5.4/*TCL.so +# cd debian/libvtk-java/usr/share/java && ln -s vtk-5.4.2.jar vtk.jar + + for file in `ls debian/vtk-tcl/usr/lib/*TCL.so` ; do \ + ln -s ../`basename $$file` debian/vtk-tcl/usr/lib/vtk-5.4/`basename $$file` ; \ + done + + chmod +x debian/vtk-tcl/usr/share/tcltk/tcl8.5/vtk/FindString.tcl + chmod +x debian/python-vtk/usr/lib/vtk-5.4/testing/*py + # install python-vtk files where the default Python version expects + mkdir -p debian/python-vtk/usr/lib/$(PYVERS)/$(py_sitename)/vtk + cp -p -r debian/tmp/usr/lib/$(PYVERS)/$(py_sitename)/vtk/* debian/python-vtk/usr/lib/$(PYVERS)/$(py_sitename)/vtk/ + cp -p debian/tmp/usr/lib/$(PYVERS)/$(py_sitename)/VTK-5.4.2*.egg-info debian/python-vtk/usr/lib/$(PYVERS)/$(py_sitename)/vtk/ + + dh_installmenu -a + dh_installman -a + dh_installinfo -a + dh_installchangelogs -a + dh_link -a + dh_strip -a + dh_compress -a + dh_fixperms -a + dh_makeshlibs -a + dh_pysupport -a + dh_installdeb -a + dh_shlibdeps -a -l /usr/lib/jvm/default-java/lib + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-arch binary-indep +.PHONY: build clean binary-indep binary-arch binary install configure --- vtk-5.4.2.orig/debian/libvtk-java.shlibs +++ vtk-5.4.2/debian/libvtk-java.shlibs @@ -0,0 +1,13 @@ +libvtkGenericFilteringJava 5.4 libvtk-java +libvtkVolumeRenderingJava 5.4 libvtk-java +libvtkParallelJava 5.4 libvtk-java +libvtkRenderingJava 5.4 libvtk-java +libvtkImagingJava 5.4 libvtk-java +libvtkFilteringJava 5.4 libvtk-java +libvtkWidgetsJava 5.4 libvtk-java +libvtkInfovisJava 5.4 libvtk-java +libvtkGraphicsJava 5.4 libvtk-java +libvtkHybridJava 5.4 libvtk-java +libvtkCommonJava 5.4 libvtk-java +libvtkViewsJava 5.4 libvtk-java +libvtkIOJava 5.4 libvtk-java --- vtk-5.4.2.orig/debian/vtk-tcl.docs +++ vtk-5.4.2/debian/vtk-tcl.docs @@ -0,0 +1,2 @@ +Wrapping/Tcl/README +debian/vtk-tcl.readme.debian --- vtk-5.4.2.orig/debian/copyright +++ vtk-5.4.2/debian/copyright @@ -0,0 +1,55 @@ +This package was debianized by A. Maitland Bottoms on +Wed, 15 Mar 2000 10:52:54 -0500. + +This package was also debianized by Prabhu Ramachandran + on Mon, 24 Apr 2000 02:16:12 +0530. + +The Debian packaging is distributed under the same conditions as the +upstream. + +See the README.debian file for details on the modification of source +done for the Debian distribution of VTK. + +Home page is at: http://www.vtk.org/ +It was downloaded from http://www.vtk.org/files/release/5.4/vtk-5.4.2.tar.gz +(See also http://vtk.org/VTK/resources/software.html) + +Upstream Authors: Ken Martin, Will Schroeder, and Bill Lorensen. +kitware@kitware.com + +Copyright: + +/*========================================================================= + + Program: Visualization Toolkit + Module: $RCSfile: Copyright.txt,v $ + +Copyright (c) 1993-2008 Ken Martin, Will Schroeder, Bill Lorensen +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names + of any contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=========================================================================*/ --- vtk-5.4.2.orig/debian/libvtk5.4-qt4.shlibs +++ vtk-5.4.2/debian/libvtk5.4-qt4.shlibs @@ -0,0 +1,2 @@ +libvtkQtChart 5.4 libvtk5.4-qt4 +libQVTK 5.4 libvtk5.4-qt4 --- vtk-5.4.2.orig/debian/libvtk5.4.lintian-overrides +++ vtk-5.4.2/debian/libvtk5.4.lintian-overrides @@ -0,0 +1 @@ +libvtk5.4: package-name-doesnt-match-sonames libvtkCommon5.4 libvtkDICOMParser5.4 libvtkFiltering5.4 libvtkGenericFiltering5.4 libvtkGeovis5.4 libvtkGraphics5.4 libvtkHybrid5.4 libvtkIO5.4 libvtkImaging5.4 libvtkInfovis5.4 libvtkNetCDF5.4 libvtkParallel5.4 libvtkRendering5.4 libvtkViews5.4 libvtkVolumeRendering5.4 libvtkWidgets5.4 libvtkalglib5.4 libvtkexoIIc5.4 libvtkftgl5.4 libvtkmetaio5.4 libvtkproj4-5.4 libvtksqlite5.4 libvtksys5.4 libvtkverdict5.4 --- vtk-5.4.2.orig/debian/libvtk5.4-qt4.install +++ vtk-5.4.2/debian/libvtk5.4-qt4.install @@ -0,0 +1 @@ +qt4-support/usr/lib/vtk-5.4/lib*.so.* usr/lib --- vtk-5.4.2.orig/debian/python-vtk.dirs +++ vtk-5.4.2/debian/python-vtk.dirs @@ -0,0 +1,3 @@ +usr/bin +usr/share/doc/python-vtk +usr/lib/vtk-5.4/testing --- vtk-5.4.2.orig/debian/CMakeCache.txt.debian +++ vtk-5.4.2/debian/CMakeCache.txt.debian @@ -0,0 +1,58 @@ +BUILD_DOCUMENTATION:BOOL=ON +BUILD_EXAMPLES:BOOL=ON +BUILD_SHARED_LIBS:BOOL=ON +BUILD_TESTING:BOOL=OFF +CMAKE_ROOT:FILEPATH=/usr/share/CMake +CMAKE_CXX_SHLIB_RUNTIME_FLAG:STRING=-Wl +CMAKE_INSTALL_PREFIX:PATH=/usr +VTK_INSTALL_PREFIX:PATH=/usr +CMAKE_SKIP_RPATH:BOOL=ON +VTK_NO_LIBRARY_VERSION:BOOL=OFF +VTK_INSTALL_NO_DOCUMENTATION:BOOL=OFF +MESA_OS_LIBRARY:FILEPATH=/usr/X11R6/lib/libOSMesa.so +OPENGL_INCLUDE_PATH:PATH=/usr/include +OPENGL_LIBRARY:FILEPATH=/usr/lib/libGL.so +OSMESA_INCLUDE_PATH:PATH=/usr/include +VERBOSE_BUILD:BOOL=OFF +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE +VTK_DATA_ROOT:PATH=/usr/share/VTKData +VTK_USE_ANSI_STDLIB:BOOL=ON +VTK_USE_BOOST:BOOL=ON +VTK_USE_HYBRID:BOOL=ON +VTK_USE_MPI:BOOL=ON +VTK_USE_RENDERING:BOOL=ON +VTK_USE_VOLUMEPRO:BOOL=OFF +VTK_USE_PARALLEL:BOOL=ON +VTK_USE_INFOVIS:BOOL=ON +VTK_USE_VIEWS:BOOL=ON +VTK_USE_CG_SHADERS:BOOL=OFF +VTK_WRAP_JAVA:BOOL=ON +VTK_WRAP_PYTHON:BOOL=ON +VTK_WRAP_TCL:BOOL=ON +MPI_INCLUDE_PATH:PATH=/usr/include/mpi +VTK_INSTALL_JAVA_DIR:PATH=/share/java +TCL_INCLUDE_PATH:PATH=/usr/include/tcl8.5 +TCL_LIBRARY:FILEPATH=/usr/lib/libtcl8.5.so +TK_INCLUDE_PATH:PATH=/usr/include/tcl8.5 +TK_LIBRARY:FILEPATH=/usr/lib/libtk8.5.so +VTK_TCL_LIBRARY_DIR:FILEPATH=/usr/lib/tcl8.5 +PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python +TCL_TCLSH:FILEPATH=/usr/bin/tclsh +TK_WISH:FILEPATH=/usr/bin/wish +VTK_USE_SYSTEM_EXPAT:BOOL=ON +VTK_USE_SYSTEM_JPEG:BOOL=ON +VTK_USE_SYSTEM_PNG:BOOL=ON +VTK_USE_SYSTEM_TIFF:BOOL=ON +VTK_USE_SYSTEM_ZLIB:BOOL=ON +VTK_USE_SYSTEM_FREETYPE:BOOL=ON +VTK_USE_SYSTEM_LIBXML2:BOOL=ON +VTK_USE_GL2PS:BOOL=ON +VTK_USE_SYSTEM_GL2PS:BOOL=ON +VTK_HAVE_GETSOCKNAME_WITH_SOCKLEN_T:BOOL=ON +VTK_USE_FFMPEG_ENCODER:BOOL=ON +FFMPEG_INCLUDE_DIR:PATH=/usr/include/ffmpeg +FFMPEG_swscale_LIBRARY:FILEPATH=/usr/lib/libswscale.so +VTK_USE_MPEG2_ENCODER:BOOL=OFF +VTK_USE_METAIO:BOOL=ON +VTK_USE_MYSQL:BOOL=ON +VTK_USE_POSTGRES:BOOL=ON --- vtk-5.4.2.orig/debian/pycompat +++ vtk-5.4.2/debian/pycompat @@ -0,0 +1 @@ +2 --- vtk-5.4.2.orig/debian/libvtk5-dev.docs +++ vtk-5.4.2/debian/libvtk5-dev.docs @@ -0,0 +1 @@ +debian/README.debian --- vtk-5.4.2.orig/debian/python-vtk.manpages +++ vtk-5.4.2/debian/python-vtk.manpages @@ -0,0 +1 @@ +debian/vtkpython.1 --- vtk-5.4.2.orig/debian/libvtk5.4.docs +++ vtk-5.4.2/debian/libvtk5.4.docs @@ -0,0 +1,2 @@ +README.html +vtkLogo.jpg --- vtk-5.4.2.orig/debian/libvtk5-qt4-dev.dirs +++ vtk-5.4.2/debian/libvtk5-qt4-dev.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/include --- vtk-5.4.2.orig/debian/libvtk5-qt3-dev.dirs +++ vtk-5.4.2/debian/libvtk5-qt3-dev.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/include --- vtk-5.4.2.orig/debian/xvfb-run +++ vtk-5.4.2/debian/xvfb-run @@ -0,0 +1,123 @@ +#!/bin/sh + +# xvfb-run - run the specified command in a virtual X server + +# This script starts an instance of Xvfb, the "fake" X server, runs a +# command with that server available, and kills the X server when +# done. The return value of the command becomes the return value of +# this script. +# +# If anyone is using this to build a Debian package, make sure the +# package Build-Depends on xvfb, xbase-clients, and xfonts-base. + +set -e + +PROGNAME=xvfb-run +SERVERNUM=99 +AUTHFILE=$(pwd)/.Xauthority +ERRORFILE=/dev/null +STARTWAIT=3 +LISTENTCP="-nolisten tcp" +XAUTHPROTO=. + +# display a usage message +usage () { + cat << EOF +Usage: $PROGNAME [OPTION ...] command + +run specified X client or command in a virtual X server environment + +-a --auto-servernum try to get a free server number, starting at + --server-num +-e FILE --error-file=FILE file used to store xauth errors and Xvfb output + (defualt: $ERRORFILE) +-f FILE --auth-file=FILE file used to store auth cookie + (default: ./.Xauthority) +-h --help display this usage message and exit +-n NUM --server-num=NUM server number to use (default: $SERVERNUM) +-l --listen-tcp enable TCP port listening in the X server +-p PROTO --xauth-protocol=PROTO X authority protocol name to use + (defaults to xauth's default) +-w DELAY --wait=DELAY delay in seconds to wait for Xvfb to start + (default: $STARTWAIT) +EOF + :; +} + +# find free server number by looking at .X*-lock files in /tmp +find_free_servernum() { + i=$SERVERNUM + while [ -f /tmp/.X$i-lock ]; do + i=$(($i + 1)) + done + echo $i; +} + +# parse command line +ARGS=$(getopt --options +ae:f:hn:lp:w: \ + --long auto-servernum,authority-file:,server-num:error-file:,help,listen-tcp,wait:,xauth-protocol: \ + --name "$PROGNAME" -- "$@") + +if [ $? -ne 0 ]; then + echo "$PROGNAME: error while getting options" >&2 + exit 1 +fi + +eval set -- "$ARGS" + +while :; do + case "$1" in + -a|--auto-servernum) SERVERNUM=$(find_free_servernum) ;; + -e|--error-file) ERRORFILE="$1"; shift ;; + -f|--auth-file) AUTHFILE="$1"; shift ;; + -h|--help) SHOWHELP=1 ;; + -n|--server-num) SERVERNUM="$1"; shift ;; + -l|--listen-tcp) LISTENTCP="" ;; + -p|--xauth-protocol) XAUTHPROTO="$1"; shift ;; + -w|--wait) STARTWAIT="$1"; shift ;; + --) shift; break ;; + *) echo "$PROGNAME: error while parsing option \"$1\"" >&2; USAGE=$(usage); echo "$USAGE" >&2; exit 1 ;; + esac + shift +done + +if [ "$SHOWHELP" ]; then + usage + exit 0 +fi + +if [ -z "$*" ]; then + echo "$PROGNAME: need a command to run" >&2 + exit 2 +fi + +if ! which xauth > /dev/null; then + echo "$PROGNAME: xauth command not found; exiting." >&2 + exit 3 +fi + +# start Xvfb +rm -f $AUTHFILE +MCOOKIE=$(mcookie) +XAUTHORITY=$AUTHFILE xauth add :$SERVERNUM $XAUTHPROTO $MCOOKIE > $ERRORFILE 2>&1 +XAUTHORITY=$AUTHFILE Xvfb :$SERVERNUM -screen 0 1024x768x24 $LISTENTCP > $ERRORFILE 2>&1 & +XVFBPID=$! +sleep $STARTWAIT + +# start the command and save its exit status +set +e +DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE $@ 2>&1 +RETVAL=$? +set -e + +# kill Xvfb now that the command has exited +kill $XVFBPID + +# clean up +XAUTHORITY=$AUTHFILE xauth remove :$SERVERNUM > $ERRORFILE 2>&1 +rm $AUTHFILE + +# return the executed command's exit status +exit $RETVAL + +# vim:set ai et sts=4 sw=4 tw=0: --- vtk-5.4.2.orig/debian/libvtk5.4-qt3.shlibs +++ vtk-5.4.2/debian/libvtk5.4-qt3.shlibs @@ -0,0 +1 @@ +libQVTK 5.4 libvtk5.4-qt3 --- vtk-5.4.2.orig/debian/libvtk-java.install +++ vtk-5.4.2/debian/libvtk-java.install @@ -0,0 +1,5 @@ +usr/bin/vtkWrapJava usr/bin +usr/bin/vtkParseJava usr/bin +usr/include/vtk-5.4/vtkJavaUtil.h usr/include/vtk-5.4 +usr/lib/vtk-5.4/*Java.so* usr/lib/jni +usr/share/java/vtk.jar usr/share/java --- vtk-5.4.2.orig/debian/libvtk5.4-qt3.install +++ vtk-5.4.2/debian/libvtk5.4-qt3.install @@ -0,0 +1 @@ +qt3-support/usr/lib/vtk-5.4/lib*.so.* usr/lib --- vtk-5.4.2.orig/debian/vtk-doc.prerm +++ vtk-5.4.2/debian/vtk-doc.prerm @@ -0,0 +1,35 @@ +#!/bin/sh -e + +PACKAGE=vtk-doc + +# vtk-doc 5.0.2-4 (from etch) asked user if doxytag +# should be called in order to generate a searchable +# index. This has been disabled afterwards because +# docs are huge. Keep this maintainer script until +# after squeeze. +case "$1" in + remove|purge|upgrade) + if [ -f /usr/lib/cgi-bin/search-vtk.cgi ] ; then + rm -f /usr/lib/cgi-bin/search-vtk.cgi + fi + if [ -f /usr/share/doc/vtk-doc/html/search.idx ] ; then + rm -f /usr/share/doc/vtk-doc/html/search.idx + rm -f /usr/share/doc/vtk-doc/html/search.cgi + fi + exit 0 + ;; + failed-upgrade|abort-install|abort-upgrade|disappear) + exit 0 + ;; + *) + echo "prerm called with unknown argument \$1'" >&2 + exit 0 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 --- vtk-5.4.2.orig/debian/libvtk5.4-qt3.dirs +++ vtk-5.4.2/debian/libvtk5.4-qt3.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/lib/qt3 --- vtk-5.4.2.orig/debian/vtk-examples.docs +++ vtk-5.4.2/debian/vtk-examples.docs @@ -0,0 +1 @@ +debian/README.examples --- vtk-5.4.2.orig/debian/libvtk5-qt3-dev.install +++ vtk-5.4.2/debian/libvtk5-qt3-dev.install @@ -0,0 +1,5 @@ +qt3-support/usr/include/* usr/include +qt3-support/usr/lib/vtk-5.4/libQVTK.so usr/lib +qt3-support/usr/lib/vtk-5.4/VTKConfigQt.cmake usr/lib/vtk-5.4 +qt3-support/usr/plugins/designer/* usr/lib/qt3/plugins/designer + --- vtk-5.4.2.orig/debian/libvtk5.4.shlibs +++ vtk-5.4.2/debian/libvtk5.4.shlibs @@ -0,0 +1,24 @@ +libvtkCommon 5.4 libvtk5.4 +libvtkDICOMParser 5.4 libvtk5.4 +libvtkFiltering 5.4 libvtk5.4 +libvtkGenericFiltering 5.4 libvtk5.4 +libvtkGeovis 5.4 libvtk5.4 +libvtkGraphics 5.4 libvtk5.4 +libvtkHybrid 5.4 libvtk5.4 +libvtkIO 5.4 libvtk5.4 +libvtkImaging 5.4 libvtk5.4 +libvtkInfovis 5.4 libvtk5.4 +libvtkNetCDF 5.4 libvtk5.4 +libvtkParallel 5.4 libvtk5.4 +libvtkRendering 5.4 libvtk5.4 +libvtkViews 5.4 libvtk5.4 +libvtkVolumeRendering 5.4 libvtk5.4 +libvtkWidgets 5.4 libvtk5.4 +libvtkalglib 5.4 libvtk5.4 +libvtkexoIIc 5.4 libvtk5.4 +libvtkftgl 5.4 libvtk5.4 +libvtkmetaio 5.4 libvtk5.4 +libvtkproj4 5.4 libvtk5.4 +libvtksqlite 5.4 libvtk5.4 +libvtksys 5.4 libvtk5.4 +libvtkverdict 5.4 libvtk5.4 --- vtk-5.4.2.orig/debian/libvtk5-qt4-dev.install +++ vtk-5.4.2/debian/libvtk5-qt4-dev.install @@ -0,0 +1,5 @@ +qt4-support/usr/include/* usr/include +qt4-support/usr/lib/vtk-5.4/libQVTK.so usr/lib +qt4-support/usr/lib/vtk-5.4/libvtkQtChart.so usr/lib +qt4-support/usr/lib/vtk-5.4/VTKConfigQt.cmake usr/lib +qt4-support/usr/plugins/designer/* usr/lib/qt4/plugins/designer --- vtk-5.4.2.orig/debian/vtkpython.1 +++ vtk-5.4.2/debian/vtkpython.1 @@ -0,0 +1,35 @@ +.TH VTK 1 +.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection +.\" other parms are allowed: see man(7), man(1) +.SH NAME +vtkpython \- Visualization Tool Kit +.SH SYNOPSIS +.B vtkpython +.I vtk_script.py + +.SH "DESCRIPTION" +This manual page documents briefly the +.B vtkpython +command. +Better info can be found at +http://public.kitware.com/VTK + +.PP +.B vtkpython +This program is like the python interpreter +.I python +but is linked with The Visualization Toolkit libraries. + +.SH OPTIONS +Hopefully, it accepts the same arguments as +.I python + +.SH "SEE ALSO" +python(1) + +.SH AUTHORS +Ken Martin, Will Schroeder, and Bill Lorensen + + +This manual page was written by A. Maitland Bottoms + for the Debian GNU/Linux system (but may be used by others). --- vtk-5.4.2.orig/debian/libvtk5.4-qt4.dirs +++ vtk-5.4.2/debian/libvtk5.4-qt4.dirs @@ -0,0 +1 @@ +usr/lib --- vtk-5.4.2.orig/debian/python-vtk.install +++ vtk-5.4.2/debian/python-vtk.install @@ -0,0 +1,5 @@ +usr/bin/vtkWrapPython +usr/bin/vtkWrapPythonInit +usr/bin/vtkpython +usr/lib/vtk-5.4/*Python*.so* usr/lib +usr/lib/vtk-5.4/testing/*py usr/lib/vtk-5.4/testing/ --- vtk-5.4.2.orig/debian/libvtk5-dev.install +++ vtk-5.4.2/debian/libvtk5-dev.install @@ -0,0 +1,31 @@ +usr/bin/vtkEncodeString usr/lib/vtk-5.4 +usr/include/vtk-5.4 usr/include +../../Common/vtkTemplateAliasMacro.h usr/include/vtk-5.4 +../../Utilities/DICOMParser/Copyright.txt usr/share/doc/libvtk5-dev/copyright.DICOMParser +usr/lib/vtk-5.4/*.cmake +usr/lib/vtk-5.4/CMake +usr/lib/vtk-5.4/hints +usr/lib/vtk-5.4/libvtkalglib.so usr/lib +usr/lib/vtk-5.4/libvtkGenericFiltering.so usr/lib +usr/lib/vtk-5.4/libvtkImaging.so usr/lib +usr/lib/vtk-5.4/libvtkParallel.so usr/lib +usr/lib/vtk-5.4/libvtkViews.so usr/lib +usr/lib/vtk-5.4/libvtkCommon.so usr/lib +usr/lib/vtk-5.4/libvtkGeovis.so usr/lib +usr/lib/vtk-5.4/libvtkproj4.so usr/lib +usr/lib/vtk-5.4/libvtkDICOMParser.so usr/lib +usr/lib/vtk-5.4/libvtkInfovis.so usr/lib +usr/lib/vtk-5.4/libvtkVolumeRendering.so usr/lib +usr/lib/vtk-5.4/libvtkexoIIc.so usr/lib +usr/lib/vtk-5.4/libvtkGraphics.so usr/lib +usr/lib/vtk-5.4/libvtkRendering.so usr/lib +usr/lib/vtk-5.4/libvtkFiltering.so usr/lib +usr/lib/vtk-5.4/libvtkIO.so usr/lib +usr/lib/vtk-5.4/libvtkWidgets.so usr/lib +usr/lib/vtk-5.4/libvtksqlite.so usr/lib +usr/lib/vtk-5.4/libvtkftgl.so usr/lib +usr/lib/vtk-5.4/libvtkHybrid.so usr/lib +usr/lib/vtk-5.4/libvtkmetaio.so usr/lib +usr/lib/vtk-5.4/libvtksys.so usr/lib +usr/lib/vtk-5.4/libvtkNetCDF.so usr/lib +usr/lib/vtk-5.4/libvtkverdict.so usr/lib --- vtk-5.4.2.orig/debian/vtk-examples.compress +++ vtk-5.4.2/debian/vtk-examples.compress @@ -0,0 +1 @@ +find usr/share/doc/vtk-examples -name "changelog*" --- vtk-5.4.2.orig/debian/libvtk5-dev.dirs +++ vtk-5.4.2/debian/libvtk5-dev.dirs @@ -0,0 +1,2 @@ +usr/include +usr/lib/vtk-5.4 --- vtk-5.4.2.orig/debian/vtk-doc.docs +++ vtk-5.4.2/debian/vtk-doc.docs @@ -0,0 +1 @@ +README.html --- vtk-5.4.2.orig/debian/README.debian +++ vtk-5.4.2/debian/README.debian @@ -0,0 +1,58 @@ +vtk for Debian +-------------- + +The VTK home page is at: http://vtk.org/ + +Documentation for this package is available in the vtk-doc package. + +First Debian packaging done by: + -- A. Maitland Bottoms , Wed, 15 Mar 2000 10:52:54 -0500 + -- Prabhu Ramachandran , Thu, 18 May 2000 12:19:02 +0530 + +Debian packaging for VTK is managed at: +http://git.debian.org/?p=collab-maint/vtk.git;a=summary +git://git.debian.org/collab-maint/vtk.git + +| The Debian packaging .diff file integrates a patch contributed by +| Francesco Poli, which modifies VTK source as follows: +| +| * IO/vtkPLOT3DReader.cxx +| -> fixed a bug in ReadQHeader() that prevented 2D files to be read +| -> discarded useless StagnationEnergy loading in some PLOT3D +| function computation methods +| -> fixed a debug message +| -> fixed VTK_PINF macro definition (irrelevant as long as +| VTK_RHOINF is 1.0, but anyway...) +| -> fixed some wrong comments +| +| * IO/vtkMultiBlockPLOT3DReader.cxx +| -> fixed a bug in ReadQHeader() that prevented 2D files to be read +| -> discarded useless StagnationEnergy loading in some PLOT3D +| function computation methods +| -> fixed a debug message +| -> fixed VTK_PINF macro definition (irrelevant as long as +| VTK_RHOINF is 1.0, but anyway...) +| -> fixed some wrong comments + +The Debian .diff also adds a '#include ' to +Utilities/DICOMParser/DICOMParser.cxx +Utilities/DICOMParser/DICOMFile.cxx +Utilities/DICOMParser/DICOMAppHelper.cxx +allowing compilation with GCC 4.3. + +The Debian .diff also updates Wrapping/Python/vtk/wx/ +from upstream CVS to work with current wxPython versions. + +The default value for VTK_DATA_ROOT is /usr/share/VTKData which is +provided by the Debian vtkdata package. + +The Debian .diff has an upstream enhancement: +ENH: Add new option: VTK_USE_SYSTEM_GL2PS, to be able to use a +system installed gl2ps library, by Mathieu Malaterre + +The Debian .diff has an enhancement to +update IO/vtkFFMPEGWriter.cxx to use swscale API of +ffmpeg by A. Maitland Bottoms. + +The Debian source, vtk_5.4.2.orig.tar.gz is identical to the upstream +distributed vtk-5.4.2.tar.gz file. --- vtk-5.4.2.orig/debian/vtk-doc.doc-base +++ vtk-5.4.2/debian/vtk-doc.doc-base @@ -0,0 +1,12 @@ +Document: vtk-doc +Title: VTK class documentation +Author: Various +Abstract: VTK is a high level, object oriented visualization library. + VTK allows one to easily write C++ programs, Tcl, Python and Java + scripts that do 2D and 3D visualization. This provides exhaustive + HTML documentation for all the documented VTK classes. +Section: Science/Data Analysis + +Format: HTML +Index: /usr/share/doc/vtk-doc/html/index.html +Files: /usr/share/doc/vtk-doc/html/*.html --- vtk-5.4.2.orig/debian/libvtk5.4-qt3.lintian-overrides +++ vtk-5.4.2/debian/libvtk5.4-qt3.lintian-overrides @@ -0,0 +1 @@ +libvtk5.4-qt3: package-name-doesnt-match-sonames libQVTK5.4 --- vtk-5.4.2.orig/debian/libvtk5.4.file +++ vtk-5.4.2/debian/libvtk5.4.file @@ -0,0 +1,6 @@ +usr/lib/vtk/libvtkCommon.so +usr/lib/vtk/libvtkFiltering.so +usr/lib/vtk/libvtkImaging.so +usr/lib/vtk/libvtkGraphics.so +usr/lib/vtk/libvtkIO.so +usr/lib/vtk/libvtkRendering.so --- vtk-5.4.2.orig/debian/vtk-examples.install +++ vtk-5.4.2/debian/vtk-examples.install @@ -0,0 +1 @@ +../../Examples/* usr/share/vtk --- vtk-5.4.2.orig/debian/vtk-tcl.lintian-overrides +++ vtk-5.4.2/debian/vtk-tcl.lintian-overrides @@ -0,0 +1,15 @@ +vtk-tcl: package-name-doesnt-match-sonames libvtkCommonTCL5.4 libvtkFilteringTCL5.4 libvtkGenericFilteringTCL5.4 libvtkGeovisTCL5.4 libvtkGraphicsTCL5.4 libvtkHybridTCL5.4 libvtkIOTCL5.4 libvtkImagingTCL5.4 libvtkInfovisTCL5.4 libvtkParallelTCL5.4 libvtkRenderingTCL5.4 libvtkViewsTCL5.4 libvtkVolumeRenderingTCL5.4 libvtkWidgetsTCL5.4 +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkVolumeRenderingTCL.so.5.4.2 usr/lib/libvtkVolumeRenderingTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkCommonTCL.so.5.4.2 usr/lib/libvtkCommonTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkGenericFilteringTCL.so.5.4.2 usr/lib/libvtkGenericFilteringTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkInfovisTCL.so.5.4.2 usr/lib/libvtkInfovisTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkGraphicsTCL.so.5.4.2 usr/lib/libvtkGraphicsTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkIOTCL.so.5.4.2 usr/lib/libvtkIOTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkFilteringTCL.so.5.4.2 usr/lib/libvtkFilteringTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkViewsTCL.so.5.4.2 usr/lib/libvtkViewsTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkWidgetsTCL.so.5.4.2 usr/lib/libvtkWidgetsTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkParallelTCL.so.5.4.2 usr/lib/libvtkParallelTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkRenderingTCL.so.5.4.2 usr/lib/libvtkRenderingTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkImagingTCL.so.5.4.2 usr/lib/libvtkImagingTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkHybridTCL.so.5.4.2 usr/lib/libvtkHybridTCL.so +vtk-tcl: non-dev-pkg-with-shlib-symlink usr/lib/libvtkGeovisTCL.so.5.4.2 usr/lib/libvtkGeovisTCL.so --- vtk-5.4.2.orig/debian/README.examples +++ vtk-5.4.2/debian/README.examples @@ -0,0 +1,72 @@ +There are examples written in C++, Java, Python and Tcl. + +The Java ones won't be of much use to Debian users until +the Debian vtk maintainer understands how to make Java packages. + +They live under /usr/share/vtk +The example data is under /usr/share/VTKData +when the vtkdata package is installed. + +The Python and Tcl examples have relative paths to +the data. You can either cd to the directory with +the example to run it, or most (all?) examples will +use the VTK_DATA_ROOT environment variable. + +export VTK_DATA_ROOT=/usr/share/VTKData + + *** *** *** +For example, to compile the Cone4 Cxx example program yourself, try: + +g++ -I/usr/include/vtk-5.4 -o Cone /usr/share/vtk/Tutorial/Step1/Cxx/Cone.cxx /usr/lib/libvtkGraphics.so /usr/lib/libvtkCommon.so -L /usr/X11R6/lib -lGL -lXt -lX11 /usr/lib/libvtkImaging.so /usr/lib/libvtkRendering.so + +And then run it: + +./Cone + + *** *** *** +CMake: VTK applications often use cmake. For an example try: + + $ mkdir ~/tmp + $ cd ~/tmp + $ cmake /usr/share/vtk/Tutorial/Step1/Cxx/ + $ make + $ ./Cone + + *** *** *** +The Java examples: + + $ javac -classpath /usr/share/java/vtk.jar Cone.java + $ export CLASSPATH=/usr/share/java/vtk.jar:. + $ java Cone + + *** *** *** +The Python ones are easy, just run (to pick one): + +/usr/share/vtk/Tutorial/Step1/Python/Cone.py + +VTK is built against the default Debian python version. Try: + $ python +Python 2.5.2 (r252:60911, Jan 4 2009, 21:59:32) +[GCC 4.3.2] on linux2 +Type "help", "copyright", "credits" or "license" for more information. +>>> import vtk +>>> + + *** *** *** +The Tcl examples: + +vtk /usr/share/vtk/Tutorial/Step1/Tcl/Cone.tcl + +VTK_DATA_ROOT=/usr/share/VTKData vtk /usr/share/vtk/IO/Tcl/flamingo.tcl + +Some Tcl examples have relative paths built into the scripts, to +run them cd to the example directory first. + +cd /usr/share/vtk/Rendering/Tcl +vtk keyBottle.tcl + +VTK is built against tcl8.5, and extends it. Try: + $ tclsh + % package require vtk + 5.4 + % --- vtk-5.4.2.orig/debian/libvtk5.4.install +++ vtk-5.4.2/debian/libvtk5.4.install @@ -0,0 +1,24 @@ +usr/lib/vtk-5.4/libvtkalglib.so.* usr/lib +usr/lib/vtk-5.4/libvtkGenericFiltering.so.* usr/lib +usr/lib/vtk-5.4/libvtkImaging.so.* usr/lib +usr/lib/vtk-5.4/libvtkParallel.so.* usr/lib +usr/lib/vtk-5.4/libvtkViews.so.* usr/lib +usr/lib/vtk-5.4/libvtkCommon.so.* usr/lib +usr/lib/vtk-5.4/libvtkGeovis.so.* usr/lib +usr/lib/vtk-5.4/libvtkproj4.so.* usr/lib +usr/lib/vtk-5.4/libvtkDICOMParser.so.* usr/lib +usr/lib/vtk-5.4/libvtkInfovis.so.* usr/lib +usr/lib/vtk-5.4/libvtkVolumeRendering.so.* usr/lib +usr/lib/vtk-5.4/libvtkexoIIc.so.* usr/lib +usr/lib/vtk-5.4/libvtkGraphics.so.* usr/lib +usr/lib/vtk-5.4/libvtkRendering.so.* usr/lib +usr/lib/vtk-5.4/libvtkFiltering.so.* usr/lib +usr/lib/vtk-5.4/libvtkIO.so.* usr/lib +usr/lib/vtk-5.4/libvtkWidgets.so.* usr/lib +usr/lib/vtk-5.4/libvtksqlite.so.* usr/lib +usr/lib/vtk-5.4/libvtkftgl.so.* usr/lib +usr/lib/vtk-5.4/libvtkHybrid.so.* usr/lib +usr/lib/vtk-5.4/libvtkmetaio.so.* usr/lib +usr/lib/vtk-5.4/libvtksys.so.* usr/lib +usr/lib/vtk-5.4/libvtkNetCDF.so.* usr/lib +usr/lib/vtk-5.4/libvtkverdict.so.* usr/lib --- vtk-5.4.2.orig/debian/vtk-tcl.manpages +++ vtk-5.4.2/debian/vtk-tcl.manpages @@ -0,0 +1 @@ +debian/vtk.1 --- vtk-5.4.2.orig/debian/libvtk5.4-qt4.lintian-overrides +++ vtk-5.4.2/debian/libvtk5.4-qt4.lintian-overrides @@ -0,0 +1 @@ +libvtk5.4-qt4: package-name-doesnt-match-sonames libQVTK5.4 libvtkQtChart5.4 --- vtk-5.4.2.orig/debian/vtk-doc.compress +++ vtk-5.4.2/debian/vtk-doc.compress @@ -0,0 +1 @@ +find usr/share/doc/vtk-doc -name "changelog*" --- vtk-5.4.2.orig/debian/python-vtk.lintian-overrides +++ vtk-5.4.2/debian/python-vtk.lintian-overrides @@ -0,0 +1,16 @@ +python-vtk: package-name-doesnt-match-sonames libvtkCommonPythonD5.4 libvtkFilteringPythonD5.4 libvtkGenericFilteringPythonD5.4 libvtkGeovisPythonD5.4 libvtkGraphicsPythonD5.4 libvtkHybridPythonD5.4 libvtkIOPythonD5.4 libvtkImagingPythonD5.4 libvtkInfovisPythonD5.4 libvtkParallelPythonD5.4 libvtkRenderingPythonD5.4 libvtkRenderingPythonTkWidgets5.4 libvtkViewsPythonD5.4 libvtkVolumeRenderingPythonD5.4 libvtkWidgetsPythonD5.4 +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkImagingPythonD.so.5.4.2 usr/lib/libvtkImagingPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkParallelPythonD.so.5.4.2 usr/lib/libvtkParallelPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkHybridPythonD.so.5.4.2 usr/lib/libvtkHybridPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkIOPythonD.so.5.4.2 usr/lib/libvtkIOPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkRenderingPythonTkWidgets.so.5.4.2 usr/lib/libvtkRenderingPythonTkWidgets.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkVolumeRenderingPythonD.so.5.4.2 usr/lib/libvtkVolumeRenderingPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkWidgetsPythonD.so.5.4.2 usr/lib/libvtkWidgetsPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkCommonPythonD.so.5.4.2 usr/lib/libvtkCommonPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkRenderingPythonD.so.5.4.2 usr/lib/libvtkRenderingPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkViewsPythonD.so.5.4.2 usr/lib/libvtkViewsPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkGraphicsPythonD.so.5.4.2 usr/lib/libvtkGraphicsPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkInfovisPythonD.so.5.4.2 usr/lib/libvtkInfovisPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkGenericFilteringPythonD.so.5.4.2 usr/lib/libvtkGenericFilteringPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkFilteringPythonD.so.5.4.2 usr/lib/libvtkFilteringPythonD.so +python-vtk: non-dev-pkg-with-shlib-symlink usr/lib/libvtkGeovisPythonD.so.5.4.2 usr/lib/libvtkGeovisPythonD.so --- vtk-5.4.2.orig/debian/vtk-tcl.shlibs +++ vtk-5.4.2/debian/vtk-tcl.shlibs @@ -0,0 +1,14 @@ +libvtkCommonTCL 5.4 vtk-tcl +libvtkFilteringTCL 5.4 vtk-tcl +libvtkGenericFilteringTCL 5.4 vtk-tcl +libvtkGeovisTCL 5.4 vtk-tcl +libvtkGraphicsTCL 5.4 vtk-tcl +libvtkHybridTCL 5.4 vtk-tcl +libvtkIOTCL 5.4 vtk-tcl +libvtkImagingTCL 5.4 vtk-tcl +libvtkInfovisTCL 5.4 vtk-tcl +libvtkParallelTCL 5.4 vtk-tcl +libvtkRenderingTCL 5.4 vtk-tcl +libvtkViewsTCL 5.4 vtk-tcl +libvtkVolumeRenderingTCL 5.4 vtk-tcl +libvtkWidgetsTCL 5.4 vtk-tcl --- vtk-5.4.2.orig/debian/control +++ vtk-5.4.2/debian/control @@ -0,0 +1,186 @@ +Source: vtk +Section: graphics +Priority: optional +Maintainer: A. Maitland Bottoms +Build-Depends: debhelper (>= 7), libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev, libosmesa6-dev, + libx11-dev, libxt-dev, xvfb, x11proto-core-dev, tcl8.5-dev, tk8.5-dev, python-dev, cmake (>> 2.4), + libexpat-dev, libjpeg-dev, libpng-dev, libtiff-dev, zlib1g-dev, default-jdk, + libboost-all-dev, mpi-default-dev, libnetcdf-dev, libmysqlclient-dev, libpq-dev, libxpm-dev, + ffmpeg, libavformat-dev, libavutil-dev, libavcodec-dev, libswscale-dev, libgl2ps-dev, + libfreetype6-dev, ftgl-dev, libqt3-mt-dev, libqt4-dev, python-support (>= 0.5.3), libxml2-dev, pkg-config +Build-Depends-Indep: libdigest-md5-perl, doxygen (>= 1.6.2), graphviz, gnuplot-nox, texlive, ghostscript +XS-Python-Version: current +DM-Upload-Allowed: yes +Uploaders: Dominique Belhachemi +Standards-Version: 3.8.4 +Homepage: http://www.vtk.org/ +Vcs-Git: git://git.debian.org/git/collab-maint/vtk.git +Vcs-Browser: http://git.debian.org/?p=collab-maint/vtk.git;a=summary + +Package: vtk-doc +Architecture: all +Depends: ${misc:Depends}, doc-base +Suggests: libvtk5-dev, vtk-examples +Section: doc +Description: VTK class reference documentation + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This package contains exhaustive HTML documentation for the all the + documented VTK C++ classes. The documentation was generated using + doxygen and some excellent perl scripts from Sebastien Barre et. al. + Please read the README.docs in /usr/share/doc/vtk-doc/ for details. + The documentation is available under /usr/share/doc/vtk/html. + +Package: vtk-examples +Architecture: all +Suggests: libvtk5-dev, vtk-tcl, python-vtk, vtk-doc, python, tclsh +Section: graphics +Depends: ${misc:Depends} +Description: C++, Tcl and Python example programs/scripts for VTK + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This package contains examples from the VTK source. To compile + the C++ examples you will need to install the vtk-dev package as well. + The Python and Tcl examples can be run with the corresponding packages + (python-vtk, vtk-tcl). + +Package: libvtk5.4 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Conflicts: libvtk, libvtk32, libvtk4, libvtk4c2, libvtk4c2a, python-vtk (<< 4.4), libvtk5 +Replaces: libvtk, libvtk32, libvtk4, libvtk4c2, libvtk4c2a, libvtk5 +Suggests: openmpi-bin | lam-runtime, libvtk5-dev, vtk-examples, vtk-doc +Section: libs +Description: Visualization Toolkit - A high level 3D visualization library + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + VTK enables users to concentrate on their work by providing a large + number of excellent and feature packed high level functions that do + visualization. The library needs OpenGL to render the graphics and + for Linux machines Mesa is necessary. The terms/copyright can be read + in /usr/share/doc/vtk/README and README.html. VTK-Linux-HOWTO has + information about using vtk, getting documentataion or help and + instructions on building VTK. + . + This package provides the shared libraries needed to run C++ programs + that use VTK. + . + To compile C++ code that uses VTK you have to install libvtk5-dev. + +Package: libvtk-java +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, java-gcj-compat | java-runtime | java1-runtime | java2-runtime +Suggests: libvtk5-dev (= ${binary:Version}), vtk-examples, vtk-doc, java-virtual-machine +Section: java +Description: Visualization Toolkit - A high level 3D visualization library + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This package provides the VTK Java language support. + +Package: libvtk5-dev +Architecture: any +Conflicts: libvtk4-dev, libvtk-dev, libvtk32-dev +Replaces: libvtk4-dev, libvtk-dev, libvtk32-dev +Depends: ${misc:Depends}, libvtk5.4 (= ${binary:Version}), libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev, + libx11-dev, libxt-dev, x11proto-core-dev, libc6-dev, libxss-dev, libxft-dev, + libexpat-dev, libjpeg-dev, libpng-dev, libtiff-dev, zlib1g-dev, tcl8.5-dev, tk8.5-dev, + libboost-all-dev, mpi-default-dev, libmysqlclient-dev, libpq-dev, + libavformat-dev, libavutil-dev, libavcodec-dev, libswscale-dev, libgl2ps-dev, + libfreetype6-dev, libxml2-dev +Suggests: vtk-examples, vtk-doc +Section: libdevel +Description: VTK header files for building C++ code + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This package provides the VTK header files required to compile + C++ programs that use VTK to do 3D visualisation. + +Package: libvtk5.4-qt3 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Conflicts: libvtk5.4-qt4 +Section: libs +Description: Visualization Toolkit - A high level 3D visualization library + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This package provides the VTK GUI support for Qt3. + +Package: libvtk5-qt3-dev +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libvtk5.4-qt3 (= ${binary:Version}), libvtk5-dev (= ${binary:Version}) +Conflicts: libvtk5-qt4-dev +Section: libdevel +Description: Visualization Toolkit - A high level 3D visualization library + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This package provides the VTK header files required to compile C++ programs + that use VTK GUI support for Qt3. + +Package: libvtk5.4-qt4 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Conflicts: libvtk5.4-qt3 +Section: libs +Description: Visualization Toolkit - A high level 3D visualization library + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This package provides the VTK GUI support for Qt4. + +Package: libvtk5-qt4-dev +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libvtk5.4-qt4 (= ${binary:Version}), libvtk5-dev (= ${binary:Version}) +Conflicts: libvtk5-qt3-dev +Section: libdevel +Description: Visualization Toolkit - A high level 3D visualization library + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This package provides the VTK header files required to compile C++ programs + that use VTK GUI support for Qt4. + +Package: vtk-tcl +Architecture: any +Depends: libvtk5-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Suggests: vtk-examples, vtk-doc +Replaces: vtk +Section: interpreters +Description: Tcl bindings for VTK + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This provides the shared libraries and executable that enable one to use + VTK from Tcl/Tk scripts. You will need Tcl/Tk and vtk installed to use + this. + +Package: python-vtk +Architecture: any +Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends} +Suggests: vtk-examples, vtk-doc, mayavi2 +XB-Python-Version: ${python:Versions} +Section: python +Description: Python bindings for VTK + The Visualization Toolkit (VTK) is an object oriented, high level + library that allows one to easily write C++ programs, Tcl, Python and + Java scripts that do 3D visualization. + . + This provides the shared libraries that enable one to use VTK from Python + scripts. You will need Python and vtk installed to use this. Some useful + information may be available in /usr/share/doc/python-vtk/. --- vtk-5.4.2.orig/debian/libvtk5.4.postinst +++ vtk-5.4.2/debian/libvtk5.4.postinst @@ -0,0 +1,7 @@ +#!/bin/sh -e + +if [ "$1" = "configure" ]; then + ldconfig +fi + +#DEBHELPER# --- vtk-5.4.2.orig/debian/vtk.1 +++ vtk-5.4.2/debian/vtk.1 @@ -0,0 +1,35 @@ +.TH VTK 1 +.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection +.\" other parms are allowed: see man(7), man(1) +.SH NAME +vtk \- Visualization Tool Kit +.SH SYNOPSIS +.B vtk +.I vtk_script.tcl + +.SH "DESCRIPTION" +This manual page documents briefly the +.B vtk +command. +Better info can be found at +http://public.kitware.com/VTK + +.PP +.B vtk +This program is like the Tcl/Tk interpreter +.I wish +but is linked with The Visualization Toolkit libraries. + +.SH OPTIONS +Hopefully, it accepts the same arguments as +.I wish + +.SH "SEE ALSO" +wish(1) + +.SH AUTHORS +Ken Martin, Will Schroeder, and Bill Lorensen + + +This manual page was written by A. Maitland Bottoms + for the Debian GNU/Linux system (but may be used by others). --- vtk-5.4.2.orig/debian/vtk-examples.dirs +++ vtk-5.4.2/debian/vtk-examples.dirs @@ -0,0 +1,2 @@ +/usr/share/doc/vtk-examples/ +/usr/share/vtk --- vtk-5.4.2.orig/debian/python-vtk.docs +++ vtk-5.4.2/debian/python-vtk.docs @@ -0,0 +1 @@ +Wrapping/Python/README_WRAP.txt --- vtk-5.4.2.orig/debian/vtk-tcl.readme.debian +++ vtk-5.4.2/debian/vtk-tcl.readme.debian @@ -0,0 +1,2 @@ +The Debian vtk-tcl package installs under the default +tcl8.5 library path. --- vtk-5.4.2.orig/debian/dot +++ vtk-5.4.2/debian/dot @@ -0,0 +1,4 @@ +#! /bin/sh + +# Without this trick, vtk-doc takes more than 500MB +/usr/bin/dot $(echo " $@ " | sed -e 's/ -Tpng / -Tpng:gd /g') --- vtk-5.4.2.orig/debian/libvtk-java.dirs +++ vtk-5.4.2/debian/libvtk-java.dirs @@ -0,0 +1,4 @@ +usr/bin +usr/include/vtk-5.4 +usr/share/java +usr/lib/jni --- vtk-5.4.2.orig/debian/python-vtk.shlibs +++ vtk-5.4.2/debian/python-vtk.shlibs @@ -0,0 +1,15 @@ +libvtkCommonPythonD 5.4 python-vtk +libvtkFilteringPythonD 5.4 python-vtk +libvtkGenericFilteringPythonD 5.4 python-vtk +libvtkGeovisPythonD 5.4 python-vtk +libvtkGraphicsPythonD 5.4 python-vtk +libvtkHybridPythonD 5.4 python-vtk +libvtkIOPythonD 5.4 python-vtk +libvtkImagingPythonD 5.4 python-vtk +libvtkInfovisPythonD 5.4 python-vtk +libvtkParallelPythonD 5.4 python-vtk +libvtkRenderingPythonD 5.4 python-vtk +libvtkRenderingPythonTkWidgets 5.4 python-vtk +libvtkViewsPythonD 5.4 python-vtk +libvtkVolumeRenderingPythonD 5.4 python-vtk +libvtkWidgetsPythonD 5.4 python-vtk --- vtk-5.4.2.orig/debian/4041-plot3d_2.patch +++ vtk-5.4.2/debian/4041-plot3d_2.patch @@ -0,0 +1,73 @@ +*** vtkPLOT3DReader.cxx.old Fri Nov 10 10:11:24 2006 +--- vtkPLOT3DReader.cxx Tue Nov 14 14:52:34 2006 +*************** +*** 570,576 **** + int ni, nj, nk; + this->ReadIntBlock(fp, 1, &ni); + this->ReadIntBlock(fp, 1, &nj); +! this->ReadIntBlock(fp, 1, &nk); + vtkDebugMacro("Q, block " << i << " dimensions: " + << ni << " " << nj << " " << nk); + +--- 570,583 ---- + int ni, nj, nk; + this->ReadIntBlock(fp, 1, &ni); + this->ReadIntBlock(fp, 1, &nj); +! if (!this->TwoDimensionalGeometry) +! { +! this->ReadIntBlock(fp, 1, &nk); +! } +! else +! { +! nk = 1; +! } + vtkDebugMacro("Q, block " << i << " dimensions: " + << ni << " " << nj << " " << nk); + +*************** +*** 958,963 **** +--- 965,971 ---- + nthOutput->GetPointData()->AddArray(se); + se->Delete(); + ++ this->SkipByteCount(qFp); + + if ( this->FunctionList->GetNumberOfTuples() > 0 ) + { +*** vtkMultiBlockPLOT3DReader.cxx.old Fri Nov 10 10:11:32 2006 +--- vtkMultiBlockPLOT3DReader.cxx Tue Nov 14 14:51:31 2006 +*************** +*** 589,595 **** + int ni, nj, nk; + this->ReadIntBlock(fp, 1, &ni); + this->ReadIntBlock(fp, 1, &nj); +! this->ReadIntBlock(fp, 1, &nk); + vtkDebugMacro("Q, block " << i << " dimensions: " + << ni << " " << nj << " " << nk); + +--- 589,602 ---- + int ni, nj, nk; + this->ReadIntBlock(fp, 1, &ni); + this->ReadIntBlock(fp, 1, &nj); +! if (!this->TwoDimensionalGeometry) +! { +! this->ReadIntBlock(fp, 1, &nk); +! } +! else +! { +! nk = 1; +! } + vtkDebugMacro("Q, block " << i << " dimensions: " + << ni << " " << nj << " " << nk); + +*************** +*** 1012,1017 **** +--- 1019,1025 ---- + nthOutput->GetPointData()->AddArray(se); + se->Delete(); + ++ this->SkipByteCount(qFp); + + if ( this->FunctionList->GetNumberOfTuples() > 0 ) + { + --- vtk-5.4.2.orig/debian/vtk-doc.install +++ vtk-5.4.2/debian/vtk-doc.install @@ -0,0 +1,2 @@ +../../Build/Utilities/Doxygen/doc/html/* usr/share/doc/vtk-doc/html +../../Utilities/Upgrading usr/share/doc/vtk-doc --- vtk-5.4.2.orig/debian/vtk-doc.dirs +++ vtk-5.4.2/debian/vtk-doc.dirs @@ -0,0 +1 @@ +usr/share/doc/vtk-doc/html --- vtk-5.4.2.orig/debian/libvtk5.4.dirs +++ vtk-5.4.2/debian/libvtk5.4.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/share/doc/libvtk5.4 --- vtk-5.4.2.orig/debian/vtk-tcl.postinst +++ vtk-5.4.2/debian/vtk-tcl.postinst @@ -0,0 +1,7 @@ +#! /bin/sh -e + +if [ "$1" = "configure" ]; then + ldconfig +fi + +#DEBHELPER# --- vtk-5.4.2.orig/debian/changelog +++ vtk-5.4.2/debian/changelog @@ -0,0 +1,874 @@ +vtk (5.4.2-6ubuntu1~tj~ppa2l) lucid; urgency=low + + * debian/rules: fix build failures - use correct {site,dist}-packages locations. + + -- TJ Mon, 26 Apr 2010 18:00:00 +0100 + +vtk (5.4.2-6ubuntu1~tj~ppa1l) lucid; urgency=low + + * Publish for Ubuntu Lucid (5.2.1 in Lucid archives) + + -- TJ Mon, 26 Apr 2010 18:00:00 +0100 + +vtk (5.4.2-6) unstable; urgency=low + + * remove explicit references to python2.5 (Closes: #571519, #571491) + * make libvtk5-dev explicitly depend upon tcl8.5-dev and tk8.5-dev + (Closes: #572189) + + -- A. Maitland Bottoms Wed, 14 Apr 2010 14:40:49 -0400 + +vtk (5.4.2-5) unstable; urgency=low + + [ Dominique Belhachemi ] + * Move library file libQVTKWidgetPlugin.so from + libvtk5.4-{qt3,qt4} to libvtk5-{qt3,qt4}-dev . (Closes: #567379, #567380) + + [ Denis Barbier ] + * CMake/FindJNI.cmake: add support for SH. + Report and patch by Nobuhiro Iwamatsu. Closes: #568964 + + -- Dominique Belhachemi Mon, 15 Feb 2010 18:27:01 -0500 + +vtk (5.4.2-4) unstable; urgency=low + + * Upload to unstable + + -- A. Maitland Bottoms Tue, 26 Jan 2010 11:39:45 -0500 + +vtk (5.4.2-3) experimental; urgency=low + + [ Denis Barbier ] + * Several VTK_USE_* features have lately been enabled. Add + development packages to Depends field of libvtk5-dev, those + libraries are now listed in VTKLibraryDepends.cmake + + [ Dominique Belhachemi ] + * Use virtual packages (libexpat-dev, libjpeg-dev, libpng-dev) + * doxyfile.in updated (doxygen 1.6.2 supports SVG) + * debian/rules: removed build-stamp target from docs-stamp target + * debian/rules: removed install-stamp target from binary-indep target + + -- Dominique Belhachemi Tue, 05 Jan 2010 18:44:38 -0500 + +vtk (5.4.2-2) experimental; urgency=low + + * fix java path: /usr/share/java/vtk.jar + + -- Dominique Belhachemi Fri, 01 Jan 2010 19:39:39 -0500 + +vtk (5.4.2-1) experimental; urgency=low + + [ A. Maitland Bottoms ] + * New Upstream Version (Closes: #531989, #396283) + * Drop VTK_X3D_USE_JAVA option, it has been removed from VTK 5.4. + As a consequence, vtkHybrid does no more depend on Java libraries. + Closes: #558714, #559629 + * Turn VTK_USE_POSTGRES ON. + + [ Denis Barbier ] + * Fix FTBFS with gcj (Closes: #558716) + * Drop all prerm scripts except vtk-doc.prerm + * Copy CMake/FindJNI.cmake from 5.2.1-11, it had accidentally + been removed. + * Set JAVA_HOME in debian/rules to help FindJNI.cmake and + FindJava.cmake + * Remove debian/doxydot.sh, this script does nothing + * Use a dot wrapper, taken from gdcmtk, to generate graphs + without antialiasing, generated png files are much smaller + and do not need to be compressed. (Closes: #560661) + + -- A. Maitland Bottoms Wed, 16 Dec 2009 12:05:30 -0500 + +vtk (5.2.1-15) unstable; urgency=low + + [ Dominique Belhachemi ] + * reduce size of vtk-doc by using the svg format + * removed temporary debian/dot wrapper + + [ Denis Barbier ] + * Fix vtk.jar installation path. Closes: bug#562387 + + -- Dominique Belhachemi Mon, 11 Jan 2010 11:55:14 -0500 + +vtk (5.2.1-14) unstable; urgency=low + + * Turn VTK_X3D_USE_JAVA back OFF. Closes: bug#558675. + * Suggest openmpi-bin Closes: bug#559452. + * vtkEncodeString is in /usr/lib/vtk-5.2 Closes: bug#560817, bug#557545. + + -- A. Maitland Bottoms Sun, 03 Dec 2009 20:51:57 -0500 + +vtk (5.2.1-13) unstable; urgency=low + + * Build-Dep on mpi-default-dev for VTK_USE_MPI. Closes: bug#552357. + + -- A. Maitland Bottoms Tue, 24 Nov 2009 21:06:58 -0500 + +vtk (5.2.1-12) unstable; urgency=low + + [ A. Maitland Bottoms ] + * Update IO/vtkFFMPEGWriter.cxx to use swscale API. + * Turn VTK_USE_FFMPEG_ENCODER ON. Closes: bug#552356. + * Don't override values found by local FindJNI.cmake. Closes: bug#533193. + + [ Gerfried Fuchs ] + * Adopt package description suggestion. Closes: bug#550104. + + [ Mathieu Malaterre ] + * Suggest mayavi2 instead of removed mayavi. Closes: bug#552341. + * Remove md5 doxygen generated files Closes: bug#552343. + * VTK_X3D_USE_JAVA is ON. Closes: bug#552352. + * vtkEncodeString is now packaged. Closes: bug#552353. + * Turn VTK_USE_BOOST ON. Closes: bug#552354. + * Turn VTK_USE_MPI ON. Closes: bug#552357. + * Turn VTK_USE_MYSQL ON. Closes: bug#552359. + * Use system gl2ps library instead of convenient copy. Closes: bug#552363. + * Fix path to libQVTKWidgetPlugin.so. Closes: bug#555122. + * Turn SEARCHENGINE=NO in doxygen configuration. Closes: bug#557237. + * Compress the png files. Closes: bug#557238. + + -- A. Maitland Bottoms Sat, 21 Nov 2009 17:40:47 -0500 + +vtk (5.2.1-11) unstable; urgency=low + + * Using a local FindJNI.cmake to set JAVA_AWT_LIBRARY + + -- Dominique Belhachemi Thu, 17 Sep 2009 13:53:21 -0400 + +vtk (5.2.1-10) unstable; urgency=low + + [ Dominique Belhachemi ] + * Switched to Tcl/Tk 8.5 + * Removed transitional package gcj from Build-Depends + * Bump Standards-Version to 3.8.3 + * Added debian/python-vtk.lintian-overrides + * Added debian/vtk-tcl.lintian-overrides + * Added debian/libvtk5.2-qt4.lintian-overrides + * Added debian/libvtk5.2-qt3.lintian-overrides + * Removed debian/libvtk-java.lintian-overrides + * Compat level set to 7 + * Removed some unused shlib entries + + [ Denis Barbier ] + * Remove bashisms from debian/rules + * Remove calls to install-docs from libvtk-java.{postinst,prerm}. + * Add ${misc:Depends} to Depends field in debian/control + * Move libvtk-java section from 'interpreters' into 'java' + * Drop vtk-doc.postinst + + -- Dominique Belhachemi Sun, 06 Sep 2009 15:26:38 -0400 + +vtk (5.2.1-9) unstable; urgency=low + + [ A. Maitland Bottoms ] + * compile with support for osmesa + * Be more flexible about egg-info naming. + (Thanks Cyril Brulebois) Closes: bug#540520 + * Fix FTBFS on armel/kfreebsd-amd64/kfreebsd-i386 (when debian + arch != debian cpu). + Report and patch by AurĂ©lien Jarno. Closes: bug#541891. + + [ Denis Barbier ] + * Fix FTBFS with parallel builds. Closes: bug#543114. + There seems to be a race when compiling Java bindings with parallel builds, + modify CMake/vtkWrapJava.cmake to call javac only once for each kit. + + -- Dominique Belhachemi Sun, 30 Aug 2009 22:51:02 -0400 + +vtk (5.2.1-8) unstable; urgency=low + + * dak upload failed + + -- A. Maitland Bottoms Thu, 20 Aug 2009 09:54:34 -0400 + +vtk (5.2.1-7) unstable; urgency=low + + [ A. Maitland Bottoms ] + * Do not confuse Linux on sparc with SUN + * java-policy is to use /usr/lib/jni. Closes: bug#533198. + + [ malaterre ] + * BUG: Fix debian bug #532009. TBFS: error: AxesActor cannot be + resolved to a type. Using the latest gcj 4.4 compiler for providing + javac compiler there is an issue where -d path (destination dir) is + not *always* added to the user class path. Furthermore by the time + we compiler TestVTKCanvas, AxesActor should already have been + compiled. Thus reorder foreach loop. Closes: bug#532009 + + -- A. Maitland Bottoms Fri, 10 Jul 2009 13:58:07 -0400 + +vtk (5.2.1-6) unstable; urgency=low + + * correct python-support usage (Closes: #529961) + + -- A. Maitland Bottoms Wed, 24 Jun 2009 21:52:32 -0400 + +vtk (5.2.1-5) unstable; urgency=low + + * correct python-support shared library path (Closes: #529961) + + -- A. Maitland Bottoms Sat, 23 May 2009 09:47:08 -0400 + +vtk (5.2.1-4) unstable; urgency=low + + * new libvtk5.2 packages (Closes: #520906, #523118) + * dev packages now built for each architecture (Closes: #521451, #529292) + * consistent use of dh-install and .dirs files (Closes: #519058) + * install all qt support libraries (Closes: #520003) + * install vtkWrapPythonInit (Closes: #486794) + * libvtk5-dev depends upon libfreetype6-dev libxss-dev libxft-dev libpng12-dev (Closes: #527119) + + -- A. Maitland Bottoms Tue, 19 May 2009 21:35:17 -0400 + +vtk (5.2.1-3) unstable; urgency=low + + * Build without ccache (Closes: #522641) + * versioned dependency on libvtk5 (Closes: #520328) + * install all qt support libraries (Closes: #520003) + + -- A. Maitland Bottoms Mon, 06 Apr 2009 09:42:16 -0400 + +vtk (5.2.1-2) unstable; urgency=low + + * use a sensible default VTK_DATA_ROOT for Debian (Closes: #513822) + * python-vtk.manpages + * update copyright file + * build-depend upon gnuplot-nox rather than gnuplot + * Unset QT_QT_LIBRARY for Qt4 build (Closes: #516756) + + -- A. Maitland Bottoms Tue, 10 Mar 2009 10:32:59 -0400 + +vtk (5.2.1-1) unstable; urgency=low + + * New upstream release (Closes: #500232) + + -- A. Maitland Bottoms Wed, 11 Feb 2009 02:59:36 -0500 + +vtk (5.2.0.99-1) unstable; urgency=low + + * bump up + * add quilt + + -- Mathieu Malaterre Sun, 28 Dec 2008 01:18:04 +0100 + +vtk (5.2.0) unstable; urgency=low + + * Bump up + + -- Mathieu Malaterre Wed, 24 Dec 2008 14:55:29 +0100 + +vtk (5.0.4-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Compile with -O0 on arm to workaround fslview FTBFS. + Closes: 498053, 492538 . Thanks Peter Green. + + -- Riku Voipio Fri, 10 Oct 2008 11:28:25 +0300 + +vtk (5.0.4-1) unstable; urgency=low + + * New upstream release (Closes: #472512) + * install cstddef and vtkTemplateAliasMacro.h in libvtk5-dev (Closes: #472520) + * added cstring includes in Utilities/DICOMParser, + GCC 4.3 compilation works (Closes: #455442) + * Update wxPython support from upstream CVS, use the wx namespace + rather than the deprecated API (Closes: #448895) + + -- A. Maitland Bottoms Mon, 24 Mar 2008 15:13:54 -0400 + +vtk (5.0.3-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Fix FTBFS with gcc-4.3. Thanks to Cyril Brulebois. Closes: #455442 + + -- Andreas Barth Sun, 16 Mar 2008 23:07:05 +0000 + +vtk (5.0.3-1) unstable; urgency=low + + * New upstream release + * keep multiblock (Fortran unformatted) PLOT3D solution file patch + * Build using newer cmake, avoid /usr/lib64 path (Closes: #418201) + * Correctly close bug for vtkWrap* executables (Closes: #401746) + + -- A. Maitland Bottoms Tue, 26 Jun 2007 16:37:05 -0400 + +vtk (5.0.2.dfsg-1) unstable; urgency=high + + * Remove patent encumbered MPEG2 library from source (Closes: #408552) + * Recommend python-vtk (Closes: #405119) + * Correctly install VTKConfig.cmake (Closes: #407687) + * multiblock (Fortran unformatted) PLOT3D solution file patch (Closes: #400406) + * include vtkWrap* executables are needed to build libraries bindings for tcl and + python that extend vtk. (Closes: ##401746) + + -- A. Maitland Bottoms Tue, 20 Feb 2007 21:55:26 -0500 + +vtk (5.0.2-4) unstable; urgency=low + + * Add description of fix for two-dimensional PLOT3D to README.debian + + -- A. Maitland Bottoms Mon, 13 Nov 2006 20:55:44 -0500 + +vtk (5.0.2-3) unstable; urgency=low + + * Fixup VTKData pathname (Closes: #389549) + + -- A. Maitland Bottoms Mon, 13 Nov 2006 11:00:05 -0500 + +vtk (5.0.2-2) unstable; urgency=low + + * depend on x11proto-core-dev rather than x-dev (Closes: #389001) + + -- A. Maitland Bottoms Fri, 10 Nov 2006 23:17:11 -0500 + +vtk (5.0.2-1) unstable; urgency=low + + * New upstream release (Closes: #395566) + * Build with Qt support thanks to Michael Hanke. (Closes: #384908) + * Correct VTK_DATA_ROOT path (Closes: #389549) + * libvtk5-qt4-dev depends on libvtk5-qt4, + libvtk5-qt3-dev depends on libvtk5-qt3 (Closes: #389521) + * Apply fix for two-dimensional PLOT3D by Francesco Poli (Closes: #397186) + + -- A. Maitland Bottoms Fri, 10 Nov 2006 14:17:57 -0500 + +vtk (5.0.1-4) unstable; urgency=low + + * Remove build system paths from vtkCommonKit.cmake and + vtkRenderingKit.cmake in the libvtk5-dev package (Closes: #388736) + Thanks to Thomas Weber + + -- A. Maitland Bottoms Fri, 22 Sep 2006 09:54:24 -0400 + +vtk (5.0.1-3) experimental; urgency=low + + * Add libraries to libvtk5-qt3 and libvtk5-qt3 + * Add conflicts to libvtk5-qt3 and libvtk5-qt3 since both have libQVTK.so.5.0.1 + * Add back graphviz in Build-Depends-Indep since it is in main now. + + -- A. Maitland Bottoms Thu, 14 Sep 2006 11:58:06 -0400 + +vtk (5.0.1-2) experimental; urgency=low + + * Build with Qt support thanks to Michael Hanke. (Closes: #384908) + * Use python-support + + -- A. Maitland Bottoms Thu, 7 Sep 2006 18:38:30 -0400 + +vtk (5.0.1-1) unstable; urgency=low + + * New upstream branch + * New soversion, new library package name (Closes: #351476) + * Automatic build-time python version setting, + for new Python policy, (Closes: #373406) + -- A. Maitland Bottoms Sun, 6 Aug 2006 14:59:14 -0400 + +vtk (4.4.2-9) unstable; urgency=low + + * renamed libvtk4c2 to libvtk4c2a(libstdc++ allocator change) (Closes: #339276) + * New X dependencies - (Closes #346505) + * patch QVTKRenderWindowInteractor.py invocation of the QWidget constructor (Closes: #333812) + + -- A. Maitland Bottoms Tue, 10 Jan 2006 12:41:41 -0500 + +vtk (4.4.2-8) unstable; urgency=low + + * Fix build-depends to prefer libgl1-mesa-dev (Closes: #328971) + + -- A. Maitland Bottoms Sun, 18 Sep 2005 10:15:01 -0400 + +vtk (4.4.2-7) unstable; urgency=low + + * g++ 4.0 Transition + * Pick up some of the ubuntu patches: + Update {build-,}depends for xorg -> mesa GL/GLU transition. + Change (build-)dependencies xlibmesa-glu* to libglu*-xorg. + Fix libvtk-dev dependencies. + CXX transition: Rename libvtk4 to libvtk4c2. + debian/python-vtk.{postinst,prerm}: Remove, use dh_python. + Work around xorg reorganization, add -I/usr/X11R6/include to the path. + * Debian still has Python 2.3 as the default + + -- A. Maitland Bottoms Sun, 11 Sep 2005 21:20:03 -0400 + +vtk (4.4.2-6ubuntu2) breezy; urgency=low + + * Update {build-,}depends for xorg -> mesa GL/GLU transition. + + -- Adam Conrad Thu, 25 Aug 2005 00:35:49 +1000 + +vtk (4.4.2-6ubuntu1) breezy; urgency=low + + * Synchronise with Debian. + * Change (build-)dependencies xlibmesa-glu* to libglu*-xorg. + * Fix libvtk-dev dependencies. + * CXX transition: Rename libvtk4 to libvtk4c2. + * Tighten build dependency on ftgl-dev (>= 2.1.2-1ubuntu1). + * debian/python-vtk.{postinst,prerm}: Remove, use dh_python. + * Work around xorg reorganization, add -I/usr/X11R6/include to the path. + + -- Matthias Klose Mon, 30 May 2005 14:57:29 +0200 + +vtk (4.4.2-6) unstable; urgency=low + + * provide /usr/include/vtk/vtkAMRBox.h in libvtk4-dev (Closes: #258090) + + -- A. Maitland Bottoms Sun, 20 Mar 2005 11:48:50 -0500 + +vtk (4.4.2-5) unstable; urgency=low + + * fix dependency for GLU development package libglu-dev (Closes: #299523) + * also fix libgl-dev dependency, use XFree86 OpenGL by default + * correct version in shlibs file with dh_makeshlibs -V (Closes: #299479) + * support system lib freetype 6 (Closes: #277602) + + -- A. Maitland Bottoms Mon, 14 Mar 2005 19:13:10 -0500 + +vtk (4.4.2-4) unstable; urgency=low + + * works with mayavi and gl2ps (Closes: #237051, #232019) + * vtk-tcl depends on -dev (Closes: #231138) + * help octaviz transition out of experimental + * Build-depends upon cmake version 2.0.5 + + -- A. Maitland Bottoms Tue, 8 Mar 2005 09:56:07 -0500 + +vtk (4.4.2-3) experimental; urgency=low + + * ship Common/vtkAMRBox.h in libvtk4-dev (Closes: #258090) + * python-vtk: vtkGetDataRoot returns correct directory + + -- A. Maitland Bottoms Thu, 19 Aug 2004 09:27:41 -0400 + +vtk (4.4.2-2) experimental; urgency=low + + * Give experimental version a build with new libtiff, cmake 2.0.3 + + -- A. Maitland Bottoms Thu, 12 Aug 2004 13:40:42 -0400 + +vtk (4.4.2-1) experimental; urgency=low + + * New upstream release, use vtkIdTypeArray instead of vtkIntArray + + -- A. Maitland Bottoms Mon, 29 Mar 2004 22:34:09 -0500 + +vtk (4.4.1-2) experimental; urgency=low + + * fix some .so links (Closes: #237051) + + -- A. Maitland Bottoms Tue, 9 Mar 2004 09:16:47 -0500 + +vtk (4.4.1-1) experimental; urgency=low + + * New upstream release + + -- A. Maitland Bottoms Sun, 7 Mar 2004 23:04:50 -0500 + +vtk (4.4-2) experimental; urgency=low + + * Enable gl2ps support + + -- A. Maitland Bottoms Tue, 17 Feb 2004 21:15:18 -0500 + +vtk (4.4-1) experimental; urgency=low + + * New upstream "interim" release + + -- A. Maitland Bottoms Sun, 15 Feb 2004 08:45:07 -0500 + +vtk (4.2.6-5ubuntu1) hoary; urgency=low + + * Rebuilt for Python 2.4. + + -- Herve Cauwelier Thu, 17 Mar 2005 10:18:35 +0100 + +vtk (4.2.5-1) unstable; urgency=low + + * New upstream release + * Added conflicts line because I moved files between libvtk4 and python-vtk + (Closes: #227006) + + -- A. Maitland Bottoms Tue, 20 Jan 2004 21:19:29 -0500 + +vtk (4.2.4-4) unstable; urgency=low + + * Fix .so file handling in binary-arch only builds. (Closes: #225659) + + -- A. Maitland Bottoms Wed, 31 Dec 2003 11:22:54 -0500 + +vtk (4.2.4-3) unstable; urgency=low + + * apply patch Wrapping/Python/vtk/tk/vtkLoadPythonTkWidgets.py (again) + + -- A. Maitland Bottoms Tue, 16 Dec 2003 19:33:40 -0500 + +vtk (4.2.4-2) unstable; urgency=low + + * Fix FTBFS package bug + * Lose some cruft, adjust some rules to make backporting easier. + + -- A. Maitland Bottoms Mon, 15 Dec 2003 22:58:23 -0500 + +vtk (4.2.4-1) unstable; urgency=low + + * New upstream release + * With cmake 1.8.2+ fix_linkage is no longer needed + * update depends for python-vtk and vtk-tcl (Closes: #222927) + + -- A. Maitland Bottoms Thu, 4 Nov 2003 19:38:35 -0500 + +vtk (4.2.2-6) unstable; urgency=low + + * Fix doc-base entry for vtk-doc (Closes: #212917) + * More robust tmpfile for debian/fix_linkage (Closes: #219440) + * Fix vtk-tcl (Closes: #219722) + + -- A. Maitland Bottoms Sat, 8 Nov 2003 20:26:31 -0500 + +vtk (4.2.2-5) unstable; urgency=low + + * Enable VTK_USE_PARALLEL - with threads rather than MPI + + -- A. Maitland Bottoms Thu, 21 Aug 2003 11:08:11 -0400 + +vtk (4.2.2-4) unstable; urgency=low + + * /usr/lib/vtk/CMake/ is needed, too. (Closes: #199907) + + -- A. Maitland Bottoms Thu, 21 Aug 2003 20:42:26 -0400 + +vtk (4.2.2-3) unstable; urgency=low + + * Craft /usr/lib/vtk/VTKConfig.cmake paths by hand + to reflect the install platform rather than the build platform + (Closes: #199907) + * Don't ship any .pyc, the postinst handles it. (Closes: #206454) + * interface with tcl in Tkinter changed slightly in python 2.3, + patch Wrapping/Python/vtk/tk/vtkLoadPythonTkWidgets.py + (Closes #206455) + + -- A. Maitland Bottoms Wed, 20 Aug 2003 17:16:54 -0400 + +vtk (4.2.2-2) unstable; urgency=low + + * more python2.3 migration (Closes: #205641) + * change sections, libvtk4-dev in libdevel, python-vtk in python + * install /usr/lib/vtk/UseVTK.cmake and friends (Closes: #199907) + + -- A. Maitland Bottoms Wed, 20 Aug 2003 08:47:54 -0400 + +vtk (4.2.2-1) unstable; urgency=low + + * New upstream release + * use soname fix_linkage from Gavin Baker + * build wiith python2.3 + + -- A. Maitland Bottoms Wed, 20 Aug 2003 04:48:06 +0000 + +vtk (4.2.1-1) unstable; urgency=low + + * New upstream release + + -- A. Maitland Bottoms Fri, 7 Mar 2003 22:23:22 -0500 + +vtk (4.1.20030227-1) unstable; urgency=low + + * Upstream expat changes, try Debian's expat libary again + + -- A. Maitland Bottoms Fri, 28 Feb 2003 03:01:59 +0000 + +vtk (4.1.20030224-2) unstable; urgency=low + + * don't use Debian expat library + * more work on Tcl packaging + + -- A. Maitland Bottoms Tue, 25 Feb 2003 08:14:36 -0500 + +vtk (4.1.20030224-1) unstable; urgency=low + + * downloaded from http://www.vtk.org/files/release/4.2/ + * include Upgrading notes in vtk-doc + * install pkgIndex.tcl rather than pkgIndex.tcl.in + * use Debian expat library + + -- A. Maitland Bottoms Mon, 24 Feb 2003 18:04:37 -0500 + +vtk (4.1.20030216-2) unstable; urgency=low + + * Adjust build depends (xlibmesa-gl-dev xlibmesa-glu-dev) + use cmake 1.6.4 instead of 1.4.7 + + -- A. Maitland Bottoms Sun, 16 Feb 2003 06:01:17 -0500 + +vtk (4.1.20030216-1) unstable; urgency=low + + * New upstream release 4.2 coming soon, getting this through + the Debian autobuilders before official release might be a good thing + * source from today's nightly snapshot + * Will build with GCC 3.2 (Closes: #180767) + * Only use Dart if it is already installed, + but no Build-depends on dart-client (Closes: #175576) + + -- A. Maitland Bottoms Sat, 15 Feb 2003 23:41:34 -0500 + +vtk (4.0.dfsg-2) unstable; urgency=low + + * Plain gcc, Python cleanups, use tcl8.4 and link with tk8.4 + * Builds OK in my pbuilder environment (Closes: #164983) + + -- A. Maitland Bottoms Thu, 24 Oct 2002 21:36:48 -0400 + +vtk (4.0.dfsg-1) unstable; urgency=low + + * Now with DFSG source. (rm -rf Patented) + ...more details in README.debian + * Don't Build-Depends-Indep on graphviz. (Closes: #162460) + * Avoid g++-3.2 on sparc. + " mait: don't expect gcc-3.2 to work too well on sparc right now" + * The new "package of d00m" release. + + -- A. Maitland Bottoms Fri, 27 Sep 2002 19:13:13 -0400 + +vtk (4.0-2) unstable; urgency=low + + * Conflict/replaces older libvtk*-dev (Closes: #161429) + * Update to policy 3.5.7, use Build-Depends-Indep (Closes: #161906, #161910) + * Place supporting tcl files in /usr/lib/vtk/tcl for vtk-tcl (Closes: #162271) + * Use -ffunction-sections flag for hppa build, via CMake this time. + * Avoid time-outs on slow architectures by not running tests on arm, m68k, mipsel. + + -- A. Maitland Bottoms Wed, 25 Sep 2002 19:19:40 -0400 + +vtk (4.0-1) unstable; urgency=low + + * New upstream - major changes (Closes: #140160) + + -- A. Maitland Bottoms Mon, 26 Aug 2002 20:17:59 -0400 + +vtk (3.2-11) woody-proposed-updates; urgency=low + + * Release Team: Please consider this upload for inclusion in woody. + The following bugfixes only update packaging. + * Removed useless links + (Closes: #145868) + * Now fakeroot debian/rules binary-patented works + (Closes: #140632) + + -- A. Maitland Bottoms Fri, 5 Jul 2002 15:28:24 -0400 + +vtk (3.2-10) unstable; urgency=low + + * Fix libvtk32-dev dependencies - correctly this time :-) + (Closes: #137329) + + -- A. Maitland Bottoms Tue, 19 Mar 2002 10:34:38 -0500 + +vtk (3.2-9) unstable; urgency=low + + * Fix libvtk32-dev dependencies + (Closes: #137329) + + -- A. Maitland Bottoms Fri, 8 Mar 2002 08:32:21 -0500 + +vtk (3.2-8) unstable; urgency=low + + * Use -l flag of dh_shlibdeps after using dh_makeshlibs to ensure + the proper Depends line. + (Closes: #134824) + + -- A. Maitland Bottoms Sat, 23 Feb 2002 17:50:06 -0500 + +vtk (3.2-7) unstable; urgency=low + + * libvtk32-dev depends upon libvtk32 rather than suggests + (Closes: #133457) + + -- A. Maitland Bottoms Fri, 4 Jan 2002 10:00:01 -0500 + +vtk (3.2-6) unstable; urgency=low + + * Build binary-indep correctly + * don't hardcode dependency + (Closes: #127603) + + -- A. Maitland Bottoms Fri, 4 Jan 2002 15:01:58 -0500 + +vtk (3.2-5) unstable; urgency=low + + * Link from html documentation into example programs + * Oops, I had missed a change LaMont made + (Closes: #127175) + * Kudos to Ryan Murray for the clue I really needed + (Closes: #127178) + * ... those two were the same bug. + + -- A. Maitland Bottoms Mon, 31 Dec 2001 10:02:07 -0500 + +vtk (3.2-4) unstable; urgency=low + + * Avoid building docs in binary-arch target + * Cleaner clean rules + (Closes: #126691) + * Get Mac OS stuff out of powerpc build (common/vtkDynamicLoader.h line 61) + (Closes: #126694) + * python-vtk provides its own widgets. + (Closes: #126323) + + -- A. Maitland Bottoms Fri, 28 Dec 2001 07:51:11 -0500 + +vtk (3.2-3.7) unstable; urgency=low + + * NMU + * Make debian/cleanjava executable. + + -- LaMont Jones Tue, 25 Dec 2001 16:36:38 -0700 + +vtk (3.2-3.6) unstable; urgency=low + + * move vtkTkImageViewerWidget vtkTkImageWindowWidget vtkTkRenderWidget + into /usr/lib so that applications (such as mayavi) find them. + * Acknowledge bug fixes from previous versions: + (Closes #119233, #98011, #91238, #104718, #106242, #124370, #105761) + + -- A. Maitland Bottoms Fri, 21 Dec 2001 14:10:14 -0500 + +vtk (3.2-3.5) unstable; urgency=low + + * Clean up better to make a smaller .diff + * Add conflicts/replaces to smooth upgrade transition + + -- A. Maitland Bottoms Fri, 21 Dec 2001 09:14:54 -0500 + +vtk (3.2-3) unstable; urgency=low + + * changelog entry started Sat, 15 Dec 2001 17:54:57 -0500 + * Incorporate NMU changes from Matthias Klose 3.2-0.1, which collided in + incoming with my upload of my 3.2-2 package. + * First of these, make python-vtk installation the way a Debian Python + guru did. Acknowledge bugs closed this way... + (Closes: #119233, #98011) + * NMU is building...good. + (Closes: #91238, #104718, #106242) + * Has full set of header files. + (Closes: #124370, #105761) + * Build DFSG free, without patented functions, no graphvis dependency. + + -- A. Maitland Bottoms Tue, 18 Dec 2001 15:03:30 -0500 + +vtk (3.2-0.1) unstable; urgency=low + + * NMU. New upstream version (closes: #122863). + * Remove the task-vtk package. + * Use python v2.1 (closes: #119233). + * Adjust build dependencies. + * Apply patch to build on powerpc (closes: #106242). + * /usr/include/vtk/vtk.h: Other headers are included from current directory. + Closes: #105761. + * Build without patented modules (closes: #111405, #115375, #122795). + * Build in a subdirectory (closes: #104718). + * Remove debian/*{dirs,docs} files and integrate into rules file. + * Install all example files in vtk-examples package (closes: #122862). + * Do not compress example files (closes: #104568). + * Fixed loading of python module (closes: #98011). + * Build error on sparc. Retry with the upstream version (closes: #91238). + + -- Matthias Klose Fri, 14 Dec 2001 20:59:47 +0100 + +vtk (3.2-2) unstable; urgency=low + + * examples cooperate with new vtkdata package + closes: #104568, #122862 + * new upstream since vtk-3.1 bugs filed... + closes: #105761, #106242, #104718, #91238, #122863 + * updated for python2.1, check python library locations + closes: #98011, #111405, #119233 + * handle patented build, describe in more detail + closes: #115375, #107654 + * Punting patented build and java build for now + in order to get bugfixes in. + + -- A. Maitland Bottoms Tue, 15 May 2001 18:20:09 -0400 + +vtk (3.2-1) unstable; urgency=low + + * Official 3.2 release of VTK from Kitware. + * Assign sonames, since there are none upstream. + * Merge Prabhu's patches and 3.2beta debianization efforts. + + -- A. Maitland Bottoms Tue, 15 May 2001 18:20:09 -0400 + +vtk (3.1.2-1) unstable; urgency=low + + * New Upstream, work on sonames + + -- A. Maitland Bottoms Tue, 27 Feb 2001 18:58:48 -0500 + +vtk (3.2beta-1) unstable; urgency=low + + * Updated the sources to 3.2beta from CVS. + * Minor improvements in the packaging. + + -- Prabhu Ramachandran Sun, 25 Feb 2001 13:16:21 +0530 + +vtk (3.1.2-20001204-1) unstable; urgency=medium + + * Updated source. + * Added makefile rules for installation of examples, headers and docs. + * Fixed makefiles to reduce bloat in the python bindings. + * Python libs can also be built statically. + * Added variables to specify installation directories in user.make. + * Miscellaneous fixes/improvements to the java and python makefiles. + * Added a small hack to enable py_cpp vtk bindings - the hack will not + affect usual vtk users, it justs adds a little functionality I may need. + * Removed doxytag serach index generation from vtk-doc.postinst because + doxytag chokes. + + -- Prabhu Ramachandran Mon, 4 Dec 2000 18:29:56 +0530 + +vtk (3.1.2-20001120-1) unstable; urgency=medium + + * Updated source to the current VTK CVS tree. + * Fixed some minor packaging bugs. + * Added Sebastien Barre et. al.'s perl scripts to enable proper doxygen + documentation. Many thanks to them. + + -- Prabhu Ramachandran Tue, 21 Nov 2000 17:23:16 +0530 + +vtk (3.1-2) unstable; urgency=medium + + * Fixed some bad packaging errors in previous debs. Modified for potato. + * Added documentation based on vtkHTML and doxygen. Searcheable docs + are now part of vtk-docs and are generated at build time. Requires + doxygen to be installed, not necessarily as a deb. + * vtk-doc also adds itself to the doc-base tree. + * The newer version of Mesa labels libraries as libGL so I no longer + need to use the --mesagl option. + * vtk-python uses the site-packages/vtk directory now. + * Using the jdk1.1-dev deb instead of the jdk117 I was using. + * Many thanks to Sudhakar Chandrasekharan for help + with the packaging. + + -- Prabhu Ramachandran Thu, 18 May 2000 12:19:02 +0530 + +vtk (3.1-1) unstable; urgency=low + + * First debian package for vtk. This debianisation is based + mostly on the vtk-2.4 RPM which was built based on my original + vtk-2.2 RPM. + * Made the packages according to the debian policy v2.5 - for + slink. Will have to modify some of the dirs for potato. + * Added new configure option --with-mesagl so that vtk will work + with standard Mesa as well as accelerated GL libs provided by card + vendors like nVidia. This is done by making sure that vtk does + not use any Mesa specific extensions. + + -- Prabhu Ramachandran Wed, 3 May 2000 21:32:37 +0530 + +vtk (3.1-0.1) unstable; urgency=low + + * Initial Release. + + -- A. Maitland Bottoms Wed, 15 Mar 2000 10:52:54 -0500 + + --- vtk-5.4.2.orig/debian/vtk-tcl.install +++ vtk-5.4.2/debian/vtk-tcl.install @@ -0,0 +1,8 @@ +usr/lib/vtk-5.4/*TCL.so* usr/lib +usr/bin/vtk +usr/bin/vtkWrapTcl +usr/bin/vtkWrapTclInit +../../Wrapping/Tcl/vtkinteraction usr/share/tcltk/tcl8.5/vtk +usr/lib/vtk-5.4/testing/*tcl usr/share/tcltk/tcl8.5/vtk +usr/lib/vtk-5.4/tcl usr/lib/vtk-5.4 +usr/lib/vtk-5.4/pkgIndex.tcl usr/lib/vtk-5.4 --- vtk-5.4.2.orig/debian/compat +++ vtk-5.4.2/debian/compat @@ -0,0 +1 @@ +7 --- vtk-5.4.2.orig/debian/vtk-tcl.dirs +++ vtk-5.4.2/debian/vtk-tcl.dirs @@ -0,0 +1,3 @@ +usr/bin +usr/share/doc/vtk-tcl +usr/lib/vtk-5.4 --- vtk-5.4.2.orig/debian/watch +++ vtk-5.4.2/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://www.vtk.org/files/release/([\d\.]+)/vtk-([\d\.]+)\.tar\.gz --- vtk-5.4.2.orig/debian/python.vtk.patch +++ vtk-5.4.2/debian/python.vtk.patch @@ -0,0 +1,11 @@ +--- misc.py.orig 2004-08-23 13:19:49.000000000 +0300 ++++ misc.py 2004-08-23 13:20:23.000000000 +0300 +@@ -20,7 +20,7 @@ + try: + dataRoot = os.environ['VTK_DATA_ROOT'] + except KeyError: +- dataRoot = '../../../../VTKData' ++ dataRoot = '/usr/share/VTKData' + + return dataRoot + --- vtk-5.4.2.orig/Filtering/vtkTrivialProducer.cxx +++ vtk-5.4.2/Filtering/vtkTrivialProducer.cxx @@ -20,6 +20,7 @@ #include "vtkInformation.h" #include "vtkInformationVector.h" #include "vtkObjectFactory.h" +#include "vtkDataObject.h" vtkCxxRevisionMacro(vtkTrivialProducer, "$Revision: 1.13 $"); vtkStandardNewMacro(vtkTrivialProducer); @@ -115,6 +116,27 @@ vtkInformationVector** inputVector, vtkInformationVector* outputVector) { + if (this->Output->IsA("vtkImageData")) + { + vtkImageData* img=(vtkImageData*)(this->Output); + + vtkInformation* info = img->GetInformation(); + vtkInformation* pinfo = img->GetPipelineInformation(); + double Spacing[3]; img->GetSpacing(Spacing); + double Origin[3]; img->GetOrigin(Origin); + + if (info->Has(vtkDataObject::SPACING())) + info->Set(vtkDataObject::SPACING(),Spacing[0],Spacing[1],Spacing[2]); + + if (pinfo->Has(vtkDataObject::SPACING())) + pinfo->Set(vtkDataObject::SPACING(),Spacing[0],Spacing[1],Spacing[2]); + + if (info->Has(vtkDataObject::ORIGIN())) + info->Set(vtkDataObject::ORIGIN(),Origin[0],Origin[1],Origin[2]); + + if (pinfo->Has(vtkDataObject::ORIGIN())) + pinfo->Set(vtkDataObject::ORIGIN(),Origin[0],Origin[1],Origin[2]); + } if(request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()) && this->Output) { --- vtk-5.4.2.orig/Examples/Annotation/Tcl/textOrigin.tcl +++ vtk-5.4.2/Examples/Annotation/Tcl/textOrigin.tcl @@ -31,10 +31,13 @@ # Create the Renderer, RenderWindow, and RenderWindowInteractor. vtkRenderer ren1 +ren1 SetBackground 0.5 0.5 0.5 vtkRenderWindow renWin renWin AddRenderer ren1 vtkRenderWindowInteractor iren iren SetRenderWindow renWin +vtkInteractorStyleTrackballCamera style +iren SetInteractorStyle style # Add the actors to the renderer. ren1 AddActor axesActor --- vtk-5.4.2.orig/Examples/Annotation/Tcl/TestText.tcl +++ vtk-5.4.2/Examples/Annotation/Tcl/TestText.tcl @@ -19,7 +19,7 @@ # Create a scaled text actor. # Set the text, font, justification, and properties (bold, italics, etc.). vtkTextActor textActor - textActor ScaledTextOn + textActor SetTextScaleModeToProp textActor SetDisplayPosition 90 50 textActor SetInput "This is a sphere" @@ -47,8 +47,8 @@ # Add the actors to the renderer; set the background and size; zoom in; # and render. # -ren1 AddActor2D textActor -ren1 AddActor sphereActor +ren1 AddViewProp textActor +ren1 AddViewProp sphereActor ren1 SetBackground 1 1 1 renWin SetSize 250 125 --- vtk-5.4.2.orig/Wrapping/Java/CMakeLists.txt +++ vtk-5.4.2/Wrapping/Java/CMakeLists.txt @@ -235,17 +235,23 @@ DEPENDS ${VTK_JAR_PATH}/vtk.jar) IF(BUILD_TESTING) + IF(WIN32) + SET(SEPARATOR "\;") + ELSE(WIN32) + SET(SEPARATOR ":") + ENDIF(WIN32) + FOREACH(jfile SimpleVTK Regression + AxesActor TestVTKCanvas TestInternalFrames - ImagePlaneWidget - AxesActor) + ImagePlaneWidget) ADD_CUSTOM_COMMAND( SOURCE ${VTK_SOURCE_DIR}/Wrapping/Java/${jfile}.java COMMAND ${JAVA_COMPILE} - ARGS -classpath ${VTK_JAR_PATH}/vtk.jar + ARGS -classpath ${VTK_JAR_PATH}/vtk.jar${SEPARATOR}${VTK_BINARY_DIR}/Wrapping/Java -sourcepath ${VTK_SOURCE_DIR}/Wrapping/Java -d ${VTK_BINARY_DIR}/Wrapping/Java ${VTK_SOURCE_DIR}/Wrapping/Java/${jfile}.java @@ -256,12 +262,6 @@ SET(JAVA_TESTS ${JAVA_TESTS} ${VTK_BINARY_DIR}/Wrapping/Java/${jfile}.class) ENDFOREACH(jfile) - IF(WIN32) - SET(SEPARATOR "\;") - ELSE(WIN32) - SET(SEPARATOR ":") - ENDIF(WIN32) - # Since vtkTesting is within vtkRendering we need blockers IF(VTK_USE_RENDERING AND VTK_USE_DISPLAY) ADD_TEST(JavaRegression ${JAVA_RUNTIME} @@ -300,17 +300,23 @@ OUTPUTS ${VTK_JAR_PATH}/vtk.jar) IF(BUILD_TESTING) + IF(WIN32) + SET(SEPARATOR "\;") + ELSE(WIN32) + SET(SEPARATOR ":") + ENDIF(WIN32) + FOREACH(jfile SimpleVTK Regression + AxesActor TestVTKCanvas TestInternalFrames - ImagePlaneWidget - AxesActor) + ImagePlaneWidget) ADD_CUSTOM_COMMAND( SOURCE ${VTK_SOURCE_DIR}/Wrapping/Java/${jfile}.java COMMAND ${JAVA_COMPILE} - ARGS -classpath ${VTK_JAR_PATH}/vtk.jar + ARGS -classpath ${VTK_JAR_PATH}/vtk.jar${SEPARATOR}${VTK_BINARY_DIR}/Wrapping/Java -sourcepath ${VTK_SOURCE_DIR}/Wrapping/Java -d ${VTK_BINARY_DIR}/Wrapping/Java ${VTK_SOURCE_DIR}/Wrapping/Java/${jfile}.java @@ -320,12 +326,6 @@ SET(JAVA_TESTS ${JAVA_TESTS} ${VTK_BINARY_DIR}/Wrapping/Java/${jfile}.class) ENDFOREACH(jfile) - IF(WIN32) - SET(SEPARATOR "\;") - ELSE(WIN32) - SET(SEPARATOR ":") - ENDIF(WIN32) - # Since vtkTesting is within vtkRendering we need blockers IF(VTK_USE_RENDERING AND VTK_USE_DISPLAY) ADD_TEST(JavaRegression ${JAVA_RUNTIME} @@ -350,7 +350,7 @@ IF(NOT VTK_INSTALL_NO_RUNTIME) INSTALL(FILES ${VTK_JAR_PATH}/vtk.jar - DESTINATION ${VTK_INSTALL_JAVA_DIR_CM24}/vtk + DESTINATION ${VTK_INSTALL_JAVA_DIR_CM24} COMPONENT RuntimeLibraries) ENDIF(NOT VTK_INSTALL_NO_RUNTIME) ENDIF(JAVA_COMPILE) --- vtk-5.4.2.orig/Wrapping/Python/vtkPythonAppInit.cxx +++ vtk-5.4.2/Wrapping/Python/vtkPythonAppInit.cxx @@ -277,6 +277,7 @@ // packages in sys.path himself/herself. const char* inst_dirs[] = { "/lib/python" VTK_PYTHON_VERSION "/site-packages/vtk", // UNIX --prefix + "/lib/python" VTK_PYTHON_VERSION "/dist-packages/vtk", // Debian package prefix "/lib/python/vtk", // UNIX --home "/Lib/site-packages/vtk", "/Lib/vtk", // Windows "/site-packages/vtk", "/vtk", // Windows --- vtk-5.4.2.orig/Wrapping/Python/vtk/util/misc.py +++ vtk-5.4.2/Wrapping/Python/vtk/util/misc.py @@ -20,7 +20,7 @@ try: dataRoot = os.environ['VTK_DATA_ROOT'] except KeyError: - dataRoot = '../../../../VTKData' + dataRoot = '/usr/share/VTKData' return dataRoot --- vtk-5.4.2.orig/Wrapping/Tcl/vtkbase/vtkbase.tcl +++ vtk-5.4.2/Wrapping/Tcl/vtkbase/vtkbase.tcl @@ -100,7 +100,7 @@ variable VTK_DATA_ROOT [::vtk::get_arg_or_env_or_default \ "-D" \ "VTK_DATA_ROOT" \ - [file nativename [file join [file dirname [info script]] "../../../../VTKData"]]] + "/usr/share/VTKData"] } set VTK_DATA_ROOT $::vtk::VTK_DATA_ROOT