From 7a008420cfda99a745d697f8230a45b24af01a6e Mon Sep 17 00:00:00 2001 From: Mois Moshev Date: Tue, 7 Nov 2017 22:42:27 +0200 Subject: Add configuration to build python extension docs with doxygen * Build them separately from cpp sources - separate doxyfile, separate target directory * Also add a subpage linking to common python files --- src/doxygen-main.dox | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/doxygen-main.dox b/src/doxygen-main.dox index c714c2cbf..19a40fbd0 100644 --- a/src/doxygen-main.dox +++ b/src/doxygen-main.dox @@ -157,6 +157,7 @@ namespace XML {} * - \subpage XmlTree - XML backbone of the document * - \subpage Rendering - rendering and buffering * - \subpage OtherServices - what doesn't fit in the above + * - \subpage PythonExtensions * * See also the other directories until doxygen * allows setting links to those doc files. @@ -344,6 +345,14 @@ namespace XML {} * * {\ref dialogs/} [\ref decimal-round.h] [\ref enums.h] */ +/** \page PythonExtensions Python Extensions API + * + * simplepath [\ref simplepath.py, \ref simplepath.rb] + * + * simpletransform [\ref simpletransform.py] + * + * simplestyle [\ref simplestyle.py] + */ /* -- cgit v1.2.3 From cc9be9e46e24835fa1fabd9b533faf8b765795c6 Mon Sep 17 00:00:00 2001 From: Mois Moshev Date: Tue, 14 Nov 2017 21:19:52 +0200 Subject: Remove missed part from the core doxygen-main file --- src/doxygen-main.dox | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src') diff --git a/src/doxygen-main.dox b/src/doxygen-main.dox index 19a40fbd0..36b005f81 100644 --- a/src/doxygen-main.dox +++ b/src/doxygen-main.dox @@ -157,7 +157,6 @@ namespace XML {} * - \subpage XmlTree - XML backbone of the document * - \subpage Rendering - rendering and buffering * - \subpage OtherServices - what doesn't fit in the above - * - \subpage PythonExtensions * * See also the other directories until doxygen * allows setting links to those doc files. @@ -345,15 +344,6 @@ namespace XML {} * * {\ref dialogs/} [\ref decimal-round.h] [\ref enums.h] */ -/** \page PythonExtensions Python Extensions API - * - * simplepath [\ref simplepath.py, \ref simplepath.rb] - * - * simpletransform [\ref simpletransform.py] - * - * simplestyle [\ref simplestyle.py] - */ - /* Local Variables: -- cgit v1.2.3 From 4d71c10ed216be5f0f4dc52e28696a204988dd3d Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 21 Nov 2017 00:54:29 +0100 Subject: Fix printing multiple copies of a document Previously only the first page was printed properly, all following pages were either blank or were not printed at all. This was caused by finishing/destroying the cairo surface of the cairo context associated with the GtkPrintContext used for printing which made it impossible to draw to it for any consecutive page Fixed bugs: - https://bugs.launchpad.net/inkscape/+bug/1733424 - https://bugs.launchpad.net/inkscape/+bug/490866 --- src/extension/internal/cairo-render-context.cpp | 11 +++++++---- src/extension/internal/cairo-render-context.h | 2 +- src/ui/dialog/print.cpp | 6 +++++- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 972081c0d..16100dc88 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -878,7 +878,7 @@ CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t } bool -CairoRenderContext::finish(void) +CairoRenderContext::finish(bool finish_surface) { g_assert( _is_valid ); @@ -893,10 +893,13 @@ CairoRenderContext::finish(void) } cairo_destroy(_cr); - cairo_surface_finish(_surface); - cairo_status_t status = cairo_surface_status(_surface); - cairo_surface_destroy(_surface); _cr = NULL; + + if (finish_surface) + cairo_surface_finish(_surface); + cairo_status_t status = cairo_surface_status(_surface); + if (finish_surface) + cairo_surface_destroy(_surface); _surface = NULL; if (_layout) diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index be5169a74..a0ca2665b 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -72,7 +72,7 @@ class CairoRenderContext { public: CairoRenderContext *cloneMe(void) const; CairoRenderContext *cloneMe(double width, double height) const; - bool finish(void); + bool finish(bool finish_surface = true); CairoRenderer *getRenderer(void) const; cairo_t *getCairoContext(void) const; diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 532a8c364..ea99ffa19 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -35,6 +35,10 @@ static void draw_page(GtkPrintOperation *, gint /*page_nr*/, gpointer user_data) { + // TODO: If the user prints multiple copies we render the whole page for each copy + // It would be more efficient to render the page once (e.g. in "begin_print") + // and simply print this result as often as necessary + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); struct workaround_gtkmm *junk = (struct workaround_gtkmm*)user_data; //printf("%s %d\n",__FUNCTION__, page_nr); @@ -120,7 +124,7 @@ static void draw_page(GtkPrintOperation *, ret = renderer.setupDocument (ctx, junk->_doc, TRUE, 0., NULL); if (ret) { renderer.renderItem(ctx, junk->_base); - ctx->finish(); + ctx->finish(false); // do not finish the cairo_surface_t - it's owned by our GtkPrintContext! } else { g_warning("%s", _("Could not set up Document")); -- cgit v1.2.3 From 3a4c187f4dc5a047484b018df56944b1517ccd99 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 21 Nov 2017 22:39:29 +0100 Subject: Two fixes (should work on Linux now) - do not call cairo_show_page as the GtkPrintOperation seems to do that internally (calling it manually will emit the current page, clear it, and the cleared page seems to be emitted in error later) - we can (and should) still call cairo_surface_destroy as it's doing reference counting internally (we increase the reference count in CairoRenderContext::setSurfaceTarget) and won't actually destroy anything until the count reaches zero --- src/extension/internal/cairo-render-context.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 16100dc88..4869472da 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -882,7 +882,7 @@ CairoRenderContext::finish(bool finish_surface) { g_assert( _is_valid ); - if (_vector_based_target) + if (_vector_based_target && finish_surface) cairo_show_page(_cr); // PDF+TeX Output, see CairoRenderContext::_prepareRenderGraphic() @@ -898,8 +898,7 @@ CairoRenderContext::finish(bool finish_surface) if (finish_surface) cairo_surface_finish(_surface); cairo_status_t status = cairo_surface_status(_surface); - if (finish_surface) - cairo_surface_destroy(_surface); + cairo_surface_destroy(_surface); _surface = NULL; if (_layout) -- cgit v1.2.3 From 65e7a9d99804d41811dd471698266613c8996adc Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 25 Nov 2017 14:47:21 +0100 Subject: libuemf: sync with upstream version 0.2.5 (we were already in sync but the readme did not reflect that) Only code change: wmf_free was renamed to uwmf_free in uwmf.h/c to prevent name conflict, see https://bugs.launchpad.net/inkscape/+bug/1616844 --- src/libuemf/COPYING | 340 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/libuemf/README | 150 +++++++++++++---------- src/libuemf/uemf.h | 9 +- 3 files changed, 431 insertions(+), 68 deletions(-) create mode 100644 src/libuemf/COPYING (limited to 'src') diff --git a/src/libuemf/COPYING b/src/libuemf/COPYING new file mode 100644 index 000000000..d60c31a97 --- /dev/null +++ b/src/libuemf/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, 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 software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, 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 redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +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 give any other recipients of the Program a copy of this License +along with the Program. + +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 Program or any portion +of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +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 Program, 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 Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) 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; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, 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 executable. 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. + +If distribution of executable or 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 counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program 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. + + 5. 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 Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program 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. + + 7. 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 Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program 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 Program. + +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. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program 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. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 Program +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 Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, 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 + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. 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 program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; 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 the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/src/libuemf/README b/src/libuemf/README index a3dff9b4c..f65120c30 100644 --- a/src/libuemf/README +++ b/src/libuemf/README @@ -19,7 +19,7 @@ bit Solaris (BE). libUEMF is released under the GPL 2 license, read the file 'COPYING' for more information -Version 0.2.1, released April 23, 2015. +Version 0.2.5, released Jan 03, 2017. To report bugs or provide feedback send email to David Mathog, mathog@caltech.edu. @@ -172,7 +172,7 @@ emf-inout.cpp,example emf-inout.h.example emf-print.cpp.example emf-print.h.example - Example code from Inkscape demonstrate how to integrate libUEMF with another program. + Example code from Inkscape, demonstrates how to integrate libUEMF with another program. -------------------------------------------------------------------------------------------- How to Build: @@ -181,69 +181,70 @@ In Linux/Unix like environments (omit -g flag for production versions): Build and install a shared library (example, details may vary) and then build and link the example programs to the shared library: - gcc -std=c99 -pedantic -Wall -fPIC -g -c uemf.c - gcc -std=c99 -pedantic -Wall -fPIC -g -c uemf_print.c - gcc -std=c99 -pedantic -Wall -fPIC -g -c uemf_endian.c - gcc -std=c99 -pedantic -Wall -fPIC -g -c uemf_utf.c - gcc -std=c99 -pedantic -Wall -fPIC -g -c uwmf.c - gcc -std=c99 -pedantic -Wall -fPIC -g -c uwmf_print.c - gcc -std=c99 -pedantic -Wall -fPIC -g -c uwmf_endian.c - gcc -std=c99 -pedantic -Wall -fPIC -g -c upmf.c - gcc -std=c99 -pedantic -Wall -fPIC -g -c upmf_print.c + export CFLAGS="-std=c99 -pedantic -Wall -fPIC -g -c" + gcc $CFLAGS uemf.c + gcc $CFLAGS uemf_print.c + gcc $CFLAGS uemf_endian.c + gcc $CFLAGS uemf_safe.c + gcc $CFLAGS uemf_utf.c + gcc $CFLAGS uwmf.c + gcc $CFLAGS uwmf_print.c + gcc $CFLAGS uwmf_endian.c + gcc $CFLAGS upmf.c + gcc $CFLAGS upmf_print.c + unset CFLAGS gcc -shared -Wl,-soname,libuemf.so.0 \ - -o libuemf.so.0.0.3 uemf.o uemf_utf.o uemf_print.o uemf_endian.o uwmf.o uwmf_print.o uwmf_endian.o upmf.o upmf_print.o -lc + -o libuemf.so.0.0.3 uemf.o uemf_utf.o uemf_safe.o uemf_print.o uemf_endian.o uwmf.o uwmf_print.o uwmf_endian.o upmf.o upmf_print.o -lc ln -s libuemf.so.0.0.3 libuemf.so.0 ln -s libuemf.so.0 libuemf.so /bin/cp -f libuemf.so* /usr/local/lib ldconfig - gcc -std=c99 -pedantic -Wall -g -o cutemf cutemf.c -luemf -lm - gcc -std=c99 -pedantic -Wall -g -o pmfdual2single pmfdual2single.c -luemf -lm - gcc -std=c99 -pedantic -Wall -g -o reademf reademf.c -luemf -lm - gcc -std=c99 -pedantic -Wall -g -o readwmf readwmf.c -luemf -lm - gcc -std=c99 -pedantic -Wall -g -o testbed_emf testbed_emf.c -luemf -lm - gcc -std=c99 -pedantic -Wall -g -o testbed_emf testbed_wmf.c -luemf -lm - gcc -std=c99 -pedantic -Wall -g -o test_mapmodes_emf test_mapmodes_emf.c -luemf -lm - - For simple development work just build the example programs statically linked: - gcc -std=c99 -pedantic -Wall -g -o cutemf cutemf.c uemf.c uemf_endian.c uemf_utf.c -lm - gcc -std=c99 -pedantic -Wall -g -o pmfdual2single pmfdual2single.c uemf.c uemf_endian.c uemf_utf.c upmf.c -lm - gcc -std=c99 -pedantic -Wall -g -o reademf reademf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c upmf.c upmf_print.c -lm - gcc -std=c99 -pedantic -Wall -g -o readwmf readwmf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c uwmf.c uwmf_endian.c uwmf_print.c upmf.c upmf_print.c -lm - gcc -std=c99 -pedantic -Wall -g -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_utf.c -lm - gcc -std=c99 -pedantic -Wall -g -o testbed_pmf testbed_pmf.c uemf.c uemf_endian.c uemf_utf.c upmf.c upmf.h -lm - gcc -std=c99 -pedantic -Wall -g -o testbed_wmf testbed_wmf.c uemf.c uemf_endian.c uemf_utf.c uwmf.c uwmf_endian.c -lm - gcc -std=c99 -pedantic -Wall -g -o test_mapmodes_emf test_mapmodes_emf.c uemf.c uemf_endian.c uemf_utf.c -lm + export CFLAGS="-std=c99 -pedantic -Wall -g" + export CLIBS="-luemf -lm" + gcc $CFLAGS -o cutemf cutemf.c $CLIBS + gcc $CFLAGS -o pmfdual2single pmfdual2single.c $CLIBS + gcc $CFLAGS -o reademf reademf.c $CLIBS + gcc $CFLAGS -o readwmf readwmf.c $CLIBS + gcc $CFLAGS -o testbed_emf testbed_emf.c $CLIBS + gcc $CFLAGS -o testbed_emf testbed_wmf.c $CLIBS + gcc $CFLAGS -o test_mapmodes_emf test_mapmodes_emf.c $CLIBS + + For simple development work just build the example programs statically. Set these + two variables up first: + + (linux) + export CFLAGS="-std=c99 -pedantic -Wall -g" + export CLIBS=-lm + + (Sparc)[ Solaris 8 and 9 are Big Endian, and to work around some minor incompatibilities with more recent systems, + assuming gcc is installed in /opt/csw and PATH is set correctly to use it] + export CLIBS="-lm -L/opt/csw/lib -liconv" + export CFLAGS="-DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g" + + (win32) [This uses _wfopen() instead of fopen(), with filename translation from UTF-8 to + UTF-16LE. This will allow file opens to utilize unicode names. If WIN32 is omitted on Windows + file names must be all ASCII. This works in mingw.] + export CLIBS="-lm -liconv" + export CFLAGS="-DWIN32 -std=c99 -pedantic -Wall -g" + + Then compile with: + + gcc $CFLAGS -o cutemf cutemf.c uemf.c uemf_endian.c uemf_utf.c $CLIBS + gcc $CFLAGS -o pmfdual2single pmfdual2single.c uemf.c uemf_endian.c uemf_utf.c upmf.c $CLIBS + gcc $CFLAGS -o reademf reademf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c $CLIBS + gcc $CFLAGS -o readwmf readwmf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c uwmf.c uwmf_endian.c uwmf_print.c $CLIBS + gcc $CFLAGS -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c $CLIBS + gcc $CFLAGS -o testbed_pmf testbed_pmf.c uemf.c uemf_endian.c uemf_safe.c uemf_utf.c upmf.c $CLIBS + gcc $CFLAGS -o testbed_wmf testbed_wmf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c uwmf.c uwmf_endian.c $CLIBS + gcc $CFLAGS -o test_mapmodes_emf test_mapmodes_emf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c $CLIBS Extra debugging on linux may be enabled in testbed for use under Valgrind. To build that way do instead: gcc -std=c99 -pedantic -Wall -g -DU_VALGRIND -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_print.c uemf_utf.c -lm -Sparc Solaris 8 and 9 are Big Endian, and to work around some minor incompatibilities with more recent systems, -assuming gcc is installed in /opt/csw and PATH is set correctly to use it: - - gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o cutemf cutemf.c uemf.c uemf_endian.c uemf_utf.c -lm -L/opt/csw/lib -liconv - gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o pmfdual2single pmfdual2single.c uemf.c uemf_endian.c uemf_utf.c upmf.c -lm -L/opt/csw/lib -liconv - gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o reademf reademf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c upmf.c upmf_print.c -lm -L/opt/csw/lib -liconv - gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o readwmf readwmf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c uwmf.c uwmf_endian.c uwmf_print.c upmf.c upmf_print.c -lm -L/opt/csw/lib -liconv - gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_utf.c -lm -L/opt/csw/lib -liconv - gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o testbed_pmf testbed_pmf.c uemf.c uemf_endian.c uemf_utf.c upmf.c upmf.h -lm -L/opt/csw/lib -liconv - gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o testbed_wmf testbed_wmf.c uemf.c uemf_endian.c uemf_utf.c uwmf.c uwmf_endian.c -lm -L/opt/csw/lib -liconv - gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o test_mapmodes_emf test_mapmodes_emf.c uemf.c uemf_endian.c uemf_utf.c -lm -L/opt/csw/lib -liconv - -(Note: WORDS_BIGENDIAN would also be produced by autconf's configure, if that was used.) - -Define WIN32 when compiling for Windows. This uses _wfopen() instead of fopen(), with -filename translation from UTF-8 to UTF-16LE. This will allow file opens to utilize unicode -names. If WIN32 is omitted on Windows file names must be all ASCII. To build on mingw use: - - gcc -DWIN32 -std=c99 -pedantic -Wall -g -o cutemf cutemf.c uemf.c uemf_endian.c uemf_utf.c -lm -liconv - gcc -DWIN32 -std=c99 -pedantic -Wall -g -o pmfdual2single pmfdual2single.c uemf.c uemf_endian.c uemf_utf.c upmf.c -lm -liconv - gcc -DWIN32 -std=c99 -pedantic -Wall -g -o reademf reademf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c upmf.c upmf_print.c -lm -liconv - gcc -DWIN32 -std=c99 -pedantic -Wall -g -o readwmf readwmf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c uwmf.c uwmf_endian.c uwmf_print.c upmf.c upmf_print.c -lm -liconv - gcc -DWIN32 -std=c99 -pedantic -Wall -g -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_utf.c -lm -liconv - gcc -DWIN32 -std=c99 -pedantic -Wall -g -o testbed_pmf testbed_pmf.c uemf.c uemf_endian.c uemf_utf.c upmf.c upmf.h -lm -liconv - gcc -DWIN32 -std=c99 -pedantic -Wall -g -o testbed_wmf testbed_wmf.c uemf.c uemf_endian.c uemf_utf.c uwmf.c uwmf_endian.c -lm -liconv - gcc -DWIN32 -std=c99 -pedantic -Wall -g -o test_mapmodes_emf test_mapmodes_emf.c uemf.c uemf_endian.c uemf_utf.c -lm -liconv + +and then compile as above for linux. + Dependencies: libiconv (if not built into your compiler) @@ -376,13 +377,36 @@ History (Note, version numbers in files represent the libUEMF release where it was last modified, so not all files will show the same version numbers in each release.) -0.2.1.2015_04_23 +0.2.5 2017-01-03 + Fixed a misplaced paren in uemf.h (thanks to Tavmjong Bah for noticing it) + Added more U_SIZE_* definitions in uemf.h for "cores" of record types with final + variable length arrays, such as U_SIZE_EMRNAMEDESCAPE + Removed redundant U_SIZE_BITMAPINFOHEADER definition from uwmf.h + +0.2.4 2016-01-26 + Record EXTSELECTCLIPRGN is supposed to be valid when the RgnDataSize is 0 if the RegionMode + is "COPY". Modified safe and print routines so that they would handle this situation. + U_PMR_DrawDriverstring seen for the first time and it crashed reademf. Reason, there was a spurious + "Tension" value in the structure, which offset values in the record. +0.2.3 2015-05-28 + Fixed an assortment of warnings and a couple of bugs flagged by clang static analysis. +0.2.2 2015-04-28 + Added lu_crc32 sums to record information in print statements. Affects only reademf and readwmf. + The point of this exercise is to enable the detection of differences in binary fields + which are not expanded by the print functions. This (re)uses code from Alexander Peslyak. + lu_ in name because crc32 conflicts with other libraries, like png. + Minor changes to some wmf function parameter types. + Minor changes to upmf.c so that it compiles cleanly with clang. + Restrict IS_MEM_UNSAFE 2nd parameter to be int or larger and test for negative values. + Updated the examples from Inkscape. + +0.2.1 2015-04-23 Bug in safety check on EMREXTCREATEFONTINDIRECTW because it had alternative "standard" record sizes. Changed warnings on unimplemented EMF record types encounterd in swap or safe from stdout to stderr. Added memory checking for WMF polyline and polygon records, for the variable part and some others. Note: U_WMRCREATEREGION_get does not check that the variable part stays within the record. Current implementation seems to be broken since it does not show up in XP preview. -0.2.0 2015_03_20 +0.2.0 2015-03-20 Added UEMF _safe functions to better handle corrupt records, where variable sizes fields might have been specified to read past the end of memory. These are records with offsets, arrays with counts, and bitmaps. Also any record which specifies a size smaller than the minimum @@ -390,30 +414,30 @@ History Added similar code for EMF+. These changed the API so the minor version number was bumped by 1. -0.1.18 2015_01_15 +0.1.18 2015-01-15 Pierre-Francois Carpentier sent some EMF examples which used U_EMR_EXTSELECTCLIPRGN, which had not previously been encountered and showed that the handling of regions was broken. Added tests for U_EMRFILLRGN, U_EMRFRAMERGN, U_EMRFRAMERGN, U_EMREXTSELECTCLIPRGN to testbed_emf. -0.1.18 2014_04_28 +0.1.18 2014-04-28 Fixed typo in testbed_wmf.c. "include,include" in one place should have been "exclude,exclude". -0.1.17 2014_04_25 +0.1.17 2014-04-25 Added text clipping tests to testbed_emf.c, testbed_wmf.c, and testbed_pmf.c. Added option to omit clipping tests in testbed's. -0.1.16 2014_04_14 +0.1.16 2014-04-14 Fixed bug in U_WMRRESTOREDC_set. Added clipping tests to testbed_wmf.c. -0.1.15 2014_04_04 +0.1.15 2014-04-04 Changed record flags for U_EMRSELECTCLIPPATH record, it consumes a path but does not ALTER (which forced a premature draw.) Added U_EMROFFSETCLIPRGN test to testbed_emf.c. Changed location on dist drawing where clipping appears. -0.1.14 2014_03_27 +0.1.14 2014-03-27 Fixed bug, in U_PMF_RECTN_set() in upmf.c. Never tested. Fixed a few potential bugs in upmf.c if a null pointer was passed for certain function arguments. (Previously unhandled cases.) diff --git a/src/libuemf/uemf.h b/src/libuemf/uemf.h index 05566af06..3a51e39e2 100644 --- a/src/libuemf/uemf.h +++ b/src/libuemf/uemf.h @@ -95,11 +95,11 @@ these WMF enumerations is by referencing the following table: /* File: uemf.h -Version: 0.0.33 -Date: 27-JAN-2016 +Version: 0.0.34 +Date: 03-JAN-2017 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2016 David Mathog and California Institute of Technology (Caltech) +Copyright: 2017 David Mathog and California Institute of Technology (Caltech) */ #ifndef _UEMF_ @@ -168,7 +168,6 @@ extern "C" { #define U_ROUND(A) ( (A) > 0 ? floor((A)+0.5) : ( (A) < 0 ? -floor(-(A)+0.5) : (A) ) ) #define MAKE_MIN_PTR(A,B) ( A < B ? A : B) - /* IS_MEM_UNSAFE takes 3 parameters: A start address of a block of allocated memory B offset into this block starting at A @@ -185,7 +184,7 @@ extern "C" { If B is a uint16_t gcc complains about the first test. This Macro must not be used where B needs more than 32 bits! */ -#define IS_MEM_UNSAFE(A,B,C) ( (sizeof(B) < sizeof(int) || (int)(B) < 0) ? 1 : ((int8_t *)(A) > (int8_t *)(C) ? 1 : ((int8_t *)(C) - (int8_t *)(A) >= (int)(B) ? 0 : 1 ))) +#define IS_MEM_UNSAFE(A,B,C) ( (sizeof(B) < sizeof(int) || (int)(B) < 0) ? 1 : ((int8_t *)(A) > (int8_t *)(C) ? 1 : ((int8_t *)(C) - (int8_t *)(A) >= (int)(B) ? 0 : 1 ))) //!< Return 1 when a region of memory starting at A of B bytes extends beyond pointer C /** @} */ -- cgit v1.2.3 From c14ca7462cb7b7fac0db6f79c687841f9cda9dca Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 25 Nov 2017 15:04:16 +0100 Subject: libuemf: remove COPYING again see efb5cb4a7a22316994b7a89b51d3d0ca654dabd4 --- src/libuemf/COPYING | 340 ---------------------------------------------------- 1 file changed, 340 deletions(-) delete mode 100644 src/libuemf/COPYING (limited to 'src') diff --git a/src/libuemf/COPYING b/src/libuemf/COPYING deleted file mode 100644 index d60c31a97..000000000 --- a/src/libuemf/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, 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 software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, 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 redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -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 give any other recipients of the Program a copy of this License -along with the Program. - -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 Program or any portion -of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -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 Program, 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 Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) 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; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, 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 executable. 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. - -If distribution of executable or 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 counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. 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 Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program 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. - - 7. 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 Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program 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 Program. - -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. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program 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. - - 9. The Free Software Foundation may publish revised and/or new versions -of the 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 Program -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 Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, 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 - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. 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 program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; 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 the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. -- cgit v1.2.3 From b071ae75610f98247e2efb602884e240aeeb80d8 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 25 Nov 2017 20:33:49 +0100 Subject: Allow to cancel PNG export Fixed bug: - https://bugs.launchpad.net/inkscape/+bug/1195929 --- src/ui/dialog/export.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index d878b50a4..8c710c8e5 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -851,10 +851,11 @@ void Export::onProgressCancel () unsigned int Export::onProgressCallback(float value, void *dlg) { Gtk::Dialog *dlg2 = reinterpret_cast(dlg); - if (dlg2->get_data("cancel")) { - return FALSE; - } + Export *self = reinterpret_cast(dlg2->get_data("exportPanel")); + if (self->interrupted) + return FALSE; + gint current = GPOINTER_TO_INT(dlg2->get_data("current")); gint total = GPOINTER_TO_INT(dlg2->get_data("total")); if (total > 0) { @@ -867,7 +868,6 @@ unsigned int Export::onProgressCallback(float value, void *dlg) Gtk::ProgressBar *prg = reinterpret_cast(dlg2->get_data("progress")); prg->set_fraction(value); - Export *self = reinterpret_cast(dlg2->get_data("exportPanel")); if (self) { self->_prog.set_fraction(value); } -- cgit v1.2.3 From ab36ec7de3f93896689f0b123e388982446c2525 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 26 Nov 2017 17:14:06 +0100 Subject: license fix --- src/helper/gettext.cpp | 2 +- src/helper/gettext.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/helper/gettext.cpp b/src/helper/gettext.cpp index 4d882c0cd..1942b373c 100644 --- a/src/helper/gettext.cpp +++ b/src/helper/gettext.cpp @@ -11,7 +11,7 @@ * * Inkscape is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or + * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Inkscape is distributed in the hope that it will be useful, diff --git a/src/helper/gettext.h b/src/helper/gettext.h index 689bddbbb..ecffcdc07 100644 --- a/src/helper/gettext.h +++ b/src/helper/gettext.h @@ -11,7 +11,7 @@ * * Inkscape is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or + * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Inkscape is distributed in the hope that it will be useful, -- cgit v1.2.3 From 9ca077f9c4d7a8b1b1dca9ad3ed3f6cacad521d1 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 26 Nov 2017 19:07:36 +0100 Subject: Don't translate the empty string --- src/ui/dialog/inkscape-preferences.cpp | 2 +- src/ui/dialog/symbols.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 79d8b7411..b2d4c5837 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1461,7 +1461,7 @@ void InkscapePreferences::initPageRendering() // rendering tile multiplier _rendering_tile_multiplier.init("/options/rendering/tile-multiplier", 1.0, 512.0, 1.0, 16.0, 16.0, true, false); - _page_rendering.add_line( false, _("Rendering tile multiplier:"), _rendering_tile_multiplier, _(""), + _page_rendering.add_line( false, _("Rendering tile multiplier:"), _rendering_tile_multiplier, "", _("Set the relative size of tiles used to render the canvas. The larger the value, the bigger the tile size."), false); /* blur quality */ diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 6add2b73d..60c9b2b32 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -462,7 +462,7 @@ void SymbolsDialog::showOverlay() { } else { overlay_icon->set_from_icon_name("searching", iconsize); overlay_title->set_markup(Glib::ustring("") + Glib::ustring(_("Search in all symbol sets...")) + Glib::ustring("")); - overlay_desc->set_markup(Glib::ustring("") + Glib::ustring(_("")) + Glib::ustring("")); + overlay_desc->set_markup(Glib::ustring("") + Glib::ustring("")); } } else if (!number_symbols && (current != CURRENTDOC || !search_str.empty())) { overlay_title->set_markup(Glib::ustring("") + Glib::ustring(_("No results found")) + Glib::ustring("")); -- cgit v1.2.3 From 2930567e3fed1875a3c1d903634b865b135ea6ef Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Wed, 29 Nov 2017 15:26:56 +0100 Subject: Add base interpolator parameter --- src/live_effects/lpe-powerstroke.cpp | 209 +++++++++++++++++++++++++++++------ src/live_effects/lpe-powerstroke.h | 3 +- 2 files changed, 175 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 51c8451a5..96f487211 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -164,6 +164,7 @@ static const Util::EnumDataConverter LineJoinTypeConverter(LineJoinTyp LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : Effect(lpeobject), offset_points(_("Offset points"), _("Offset points"), "offset_points", &wr, this), + interpolate_original(_("Interpolate original"), _("Interpolate original path"), "interpolate_original", &wr, this, false), sort_points(_("Sort points"), _("Sort offset points according to their time value along the curve"), "sort_points", &wr, this, true), interpolator_type(_("Interpolator type:"), _("Determines which kind of interpolator will be used to interpolate between stroke width along the path"), "interpolator_type", InterpolatorTypeConverter, &wr, this, Geom::Interpolate::INTERP_CUBICBEZIER), interpolator_beta(_("Smoothness:"), _("Sets the smoothness for the CubicBezierJohan interpolator; 0 = linear interpolation, 1 = smooth"), "interpolator_beta", &wr, this, 0.2), @@ -182,6 +183,7 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : registerParameter(&offset_points); registerParameter(&sort_points); + registerParameter(&interpolate_original); registerParameter(&interpolator_type); registerParameter(&interpolator_beta); registerParameter(&start_linecap_type); @@ -192,6 +194,7 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : scale_width.param_set_range(0.0, Geom::infinity()); scale_width.param_set_increments(0.1, 0.1); scale_width.param_set_digits(4); + interpolate_original_prev = !interpolate_original; } LPEPowerStroke::~LPEPowerStroke() @@ -566,6 +569,42 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) return path_out; } Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers(path_in); + // create stroke path where points (x,y) := (t, offset) + + if (interpolate_original) { + Geom::PathVector path_out; + for(Geom::PathVector::const_iterator path_it = path_in.begin(); path_it != path_in.end(); ++path_it) { + if (path_it->empty()) + continue; + + if (path_it->closed()) { + g_warning("Interpolate points LPE currently ignores whether path is closed or not."); + } + std::vector pts; + pts.push_back(path_it->initialPoint()); + + for (Geom::Path::const_iterator it = path_it->begin(), e = path_it->end_default(); it != e; ++it) { + pts.push_back((*it).finalPoint()); + } + //We use this fixed interpolator to simplfy the UI and for better results + Geom::Interpolate::Interpolator *interpolator = Geom::Interpolate::Interpolator::create(Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM); + Geom::Path path = interpolator->interpolateToPath(pts); + + path_out.push_back(path); + } + pathv = path_out; + } + Geom::Interpolate::Interpolator *interpolator = Geom::Interpolate::Interpolator::create(static_cast(interpolator_type.get_value())); + if (Geom::Interpolate::CubicBezierJohan *johan = dynamic_cast(interpolator)) { + johan->setBeta(interpolator_beta); + } + if (Geom::Interpolate::CubicBezierSmooth *smooth = dynamic_cast(interpolator)) { + smooth->setBeta(interpolator_beta); + } + if (interpolate_original_prev != interpolate_original) { + adjustForNewPath(pathv); + interpolate_original_prev = interpolate_original; + } Geom::Piecewise > pwd2_in = pathv[0].toPwSb(); Piecewise > der = derivative(pwd2_in); Piecewise > n = unitVector(der,0.0001); @@ -609,18 +648,116 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) // instead of the heavily compressed coordinate system of (segment_no offset, Y) in which the knots are stored double pwd2_in_arclength = length(pwd2_in); double xcoord_scaling = pwd2_in_arclength / ts.back()[Geom::X]; - for (std::size_t i = 0, e = ts.size(); i < e; ++i) { - ts[i][Geom::X] *= xcoord_scaling; + if (interpolate_original) { + size_t i = 0; + std::vector ts_aprox; + size_t steps = 0; + double distance = 0; + Geom::PathVector splits; + Geom::Coord start = 0; + for(std::vector::iterator point = ts.begin(); point != ts.end();) { + point++; + Geom::Coord end = (*point)[Geom::X]; + if (Geom::are_near(start, end,0.0001)) { + continue; + } + splits.push_back(path_in[0].portion(start, end)); + start = end; + if (end == pathv[0].size()) { + break; + } + } + size_t counter = 0; + for(Geom::PathVector::const_iterator path_it = splits.begin(); path_it != splits.end(); ++path_it) { + if (path_it->empty()) { + continue; + } + Geom::Piecewise > path_pwd = (*path_it).toPwSb(); + size_t size = (*path_it).size(); + double path_it_arclength = length(path_pwd); + Geom::Point start = ts[counter]; + counter++; + Geom::Point end = ts[counter]; + if (Geom::are_near(start[Geom::Y],end[Geom::Y],0.0001)) { + continue; + } + double gap = (start[Geom::Y] - end[Geom::Y])/size; + double width = 0; + width = start[Geom::Y]; + for (size_t j = 1; j < size; j++){ + Geom::Path current_curve = (*path_it).portion(j-1, j); + double path_it_arclength_sub = length(current_curve.toPwSb()); + double factor = path_it_arclength_sub * size/path_it_arclength; + width -= gap * factor; + ts.push_back(Geom::Point(std::floor(ts[counter-1][Geom::X]) + j, width)); + } + } + sort(ts.begin(), ts.end(), compare_offsets); } // create stroke path where points (x,y) := (t, offset) - Geom::Interpolate::Interpolator *interpolator = Geom::Interpolate::Interpolator::create(static_cast(interpolator_type.get_value())); - if (Geom::Interpolate::CubicBezierJohan *johan = dynamic_cast(interpolator)) { - johan->setBeta(interpolator_beta); - } - if (Geom::Interpolate::CubicBezierSmooth *smooth = dynamic_cast(interpolator)) { - smooth->setBeta(interpolator_beta); + + Geom::Path fixed_path; + Geom::Path fixed_mirrorpath; + Geom::Path strokepath; + if (interpolate_original) { + std::vector ts_normal; + std::vector ts_mirror; + + bool previous_isnode = false; + size_t counter = 0; + for(auto point:ts) { + Geom::Point normal_pos = pwd2_in.valueAt(point[Geom::X]) + (point[Geom::Y] * scale_width) * n.valueAt(point[Geom::X]); + Geom::Point mirror_pos = pwd2_in.valueAt(point[Geom::X]) + (point[Geom::Y] * -1 * scale_width) * n.valueAt(point[Geom::X]); + Geom::Point normal = Geom::Point(normal_pos[Geom::X] * xcoord_scaling, normal_pos[Geom::Y]); + Geom::Point mirror = Geom::Point(mirror_pos [Geom::X] * xcoord_scaling, mirror_pos [Geom::Y]); + //a bit smoothig tweak + if (counter > 2) { + Geom::Point granparent_normal = ts_normal[counter-2]; + Geom::Point parent_normal = ts_normal[counter-1]; + Geom::Point granparent_mirror = ts_mirror [counter-2]; + Geom::Point parent_mirror = ts_mirror [counter-1]; + bool isnode = ts[counter][Geom::X] == std::floor(ts[counter ][Geom::X]); + bool previous_isnode = ts[counter-1][Geom::X] == std::floor(ts[counter-1][Geom::X]); + bool ccw_toggle_normal = cross(parent_normal - granparent_normal, normal - granparent_normal) < 0; + bool ccw_toggle_mirror = cross(parent_mirror - granparent_mirror , mirror - granparent_mirror ) < 0; + Geom::Ray ray_normal_a(parent_normal, granparent_normal); + Geom::Ray ray_normal_b(parent_normal , normal); + Geom::Ray ray_mirror_a (parent_mirror, granparent_mirror); + Geom::Ray ray_mirror_b (parent_mirror , mirror); + double angle_normal = angle_between(ray_normal_a, ray_normal_b, ccw_toggle_normal); + double angle_mirror = angle_between(ray_mirror_a , ray_mirror_b , ccw_toggle_mirror); + if (point[Geom::X] > 2 && + previous_isnode && + !isnode && + !ccw_toggle_normal && + angle_normal < Geom::rad_from_deg(90)) + { + ts_normal.pop_back(); + } + if (point[Geom::X] > 2 && + previous_isnode && + !isnode && + ccw_toggle_mirror && + angle_mirror < Geom::rad_from_deg(90)) + { + ts_mirror.pop_back(); + } + } + ts_normal.push_back(normal); + ts_mirror.push_back(mirror); + counter++; + } + fixed_path = interpolator->interpolateToPath(ts_normal); + fixed_path *= Scale(1/xcoord_scaling, 1); + fixed_mirrorpath = interpolator->interpolateToPath(ts_mirror); + fixed_mirrorpath *= Scale(1/xcoord_scaling, 1); + fixed_mirrorpath = fixed_mirrorpath.reversed(); + } else { + for (std::size_t i = 0, e = ts.size(); i < e; ++i) { + ts[i][Geom::X] *= xcoord_scaling; + } + strokepath = interpolator->interpolateToPath(ts); } - Geom::Path strokepath = interpolator->interpolateToPath(ts); delete interpolator; // apply the inverse knot-xcoord scaling that was applied before the interpolation @@ -638,13 +775,13 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) y = portion(y, rtsmin.at(0), rtsmax.at(0)); } - LineJoinType jointype = static_cast(linejoin_type.get_value()); - - Piecewise > pwd2_out = compose(pwd2_in,x) + y*compose(n,x); - Piecewise > mirrorpath = reverse( compose(pwd2_in,x) - y*compose(n,x)); - - Geom::Path fixed_path = path_from_piecewise_fix_cusps( pwd2_out, y, jointype, miter_limit, LPE_CONVERSION_TOLERANCE); - Geom::Path fixed_mirrorpath = path_from_piecewise_fix_cusps( mirrorpath, reverse(y), jointype, miter_limit, LPE_CONVERSION_TOLERANCE); + if (!interpolate_original) { + LineJoinType jointype = static_cast(linejoin_type.get_value()); + Piecewise > pwd2_out = compose(pwd2_in,x) + y*compose(n,x); + Piecewise > mirrorpath = reverse( compose(pwd2_in,x) - y*compose(n,x)); + fixed_path = path_from_piecewise_fix_cusps( pwd2_out, y, jointype, miter_limit, LPE_CONVERSION_TOLERANCE); + fixed_mirrorpath = path_from_piecewise_fix_cusps( mirrorpath, reverse(y), jointype, miter_limit, LPE_CONVERSION_TOLERANCE); + } if (pathv[0].closed()) { fixed_path.close(true); path_out.push_back(fixed_path); @@ -659,31 +796,31 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) case LINECAP_PEAK: { Geom::Point end_deriv = -unitTangentAt( reverse(pwd2_in.segs.back()), 0.); - double radius = 0.5 * distance(pwd2_out.lastValue(), mirrorpath.firstValue()); - Geom::Point midpoint = 0.5*(pwd2_out.lastValue() + mirrorpath.firstValue()) + radius*end_deriv; + double radius = 0.5 * distance(fixed_path.finalPoint(), fixed_mirrorpath.initialPoint()); + Geom::Point midpoint = 0.5*(fixed_path.finalPoint() + fixed_mirrorpath.initialPoint()) + radius*end_deriv; fixed_path.appendNew(midpoint); - fixed_path.appendNew(mirrorpath.firstValue()); + fixed_path.appendNew(fixed_mirrorpath.initialPoint()); break; } case LINECAP_SQUARE: { Geom::Point end_deriv = -unitTangentAt( reverse(pwd2_in.segs.back()), 0.); - double radius = 0.5 * distance(pwd2_out.lastValue(), mirrorpath.firstValue()); - fixed_path.appendNew( pwd2_out.lastValue() + radius*end_deriv ); - fixed_path.appendNew( mirrorpath.firstValue() + radius*end_deriv ); - fixed_path.appendNew( mirrorpath.firstValue() ); + double radius = 0.5 * distance(fixed_path.finalPoint(), fixed_mirrorpath.initialPoint()); + fixed_path.appendNew( fixed_path.finalPoint() + radius*end_deriv ); + fixed_path.appendNew( fixed_mirrorpath.initialPoint() + radius*end_deriv ); + fixed_path.appendNew( fixed_mirrorpath.initialPoint() ); break; } case LINECAP_BUTT: { - fixed_path.appendNew( mirrorpath.firstValue() ); + fixed_path.appendNew( fixed_mirrorpath.initialPoint() ); break; } case LINECAP_ROUND: default: { - double radius1 = 0.5 * distance(pwd2_out.lastValue(), mirrorpath.firstValue()); - fixed_path.appendNew( radius1, radius1, M_PI/2., false, y.lastValue() < 0, mirrorpath.firstValue() ); + double radius1 = 0.5 * distance(fixed_path.finalPoint(), fixed_mirrorpath.initialPoint()); + fixed_path.appendNew( radius1, radius1, M_PI/2., false, y.lastValue() < 0, fixed_mirrorpath.initialPoint() ); break; } } @@ -696,31 +833,31 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) case LINECAP_PEAK: { Geom::Point start_deriv = unitTangentAt( pwd2_in.segs.front(), 0.); - double radius = 0.5 * distance(pwd2_out.firstValue(), mirrorpath.lastValue()); - Geom::Point midpoint = 0.5*(mirrorpath.lastValue() + pwd2_out.firstValue()) - radius*start_deriv; + double radius = 0.5 * distance(fixed_path.initialPoint(), fixed_mirrorpath.finalPoint()); + Geom::Point midpoint = 0.5*(fixed_mirrorpath.finalPoint() + fixed_path.initialPoint()) - radius*start_deriv; fixed_path.appendNew( midpoint ); - fixed_path.appendNew( pwd2_out.firstValue() ); + fixed_path.appendNew( fixed_path.initialPoint() ); break; } case LINECAP_SQUARE: { Geom::Point start_deriv = unitTangentAt( pwd2_in.segs.front(), 0.); - double radius = 0.5 * distance(pwd2_out.firstValue(), mirrorpath.lastValue()); - fixed_path.appendNew( mirrorpath.lastValue() - radius*start_deriv ); - fixed_path.appendNew( pwd2_out.firstValue() - radius*start_deriv ); - fixed_path.appendNew( pwd2_out.firstValue() ); + double radius = 0.5 * distance(fixed_path.initialPoint(), fixed_mirrorpath.finalPoint()); + fixed_path.appendNew( fixed_mirrorpath.finalPoint() - radius*start_deriv ); + fixed_path.appendNew( fixed_path.initialPoint() - radius*start_deriv ); + fixed_path.appendNew( fixed_path.initialPoint() ); break; } case LINECAP_BUTT: { - fixed_path.appendNew( pwd2_out.firstValue() ); + fixed_path.appendNew( fixed_path.initialPoint() ); break; } case LINECAP_ROUND: default: { - double radius2 = 0.5 * distance(pwd2_out.firstValue(), mirrorpath.lastValue()); - fixed_path.appendNew( radius2, radius2, M_PI/2., false, y.firstValue() < 0, pwd2_out.firstValue() ); + double radius2 = 0.5 * distance(fixed_path.initialPoint(), fixed_mirrorpath.finalPoint()); + fixed_path.appendNew( radius2, radius2, M_PI/2., false, y.firstValue() < 0, fixed_path.initialPoint() ); break; } } diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h index 4a0eda75a..53aab1b05 100644 --- a/src/live_effects/lpe-powerstroke.h +++ b/src/live_effects/lpe-powerstroke.h @@ -38,6 +38,7 @@ public: private: BoolParam sort_points; + BoolParam interpolate_original; EnumParam interpolator_type; ScalarParam interpolator_beta; ScalarParam scale_width; @@ -45,7 +46,7 @@ private: EnumParam linejoin_type; ScalarParam miter_limit; EnumParam end_linecap_type; - + bool interpolate_original_prev; LPEPowerStroke(const LPEPowerStroke&); LPEPowerStroke& operator=(const LPEPowerStroke&); }; -- cgit v1.2.3 From cd56d55f26a8c9029de91924d0ab827ad877713d Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Wed, 29 Nov 2017 15:34:49 +0100 Subject: Add BSPLine interpolator --- src/live_effects/lpe-interpolate_points.cpp | 3 +- src/live_effects/lpe-powerstroke-interpolators.h | 37 +++++++++++++++++++++++- src/live_effects/lpe-powerstroke.cpp | 3 +- 3 files changed, 40 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-interpolate_points.cpp b/src/live_effects/lpe-interpolate_points.cpp index 7d4c88dc1..c745921c2 100644 --- a/src/live_effects/lpe-interpolate_points.cpp +++ b/src/live_effects/lpe-interpolate_points.cpp @@ -25,7 +25,8 @@ static const Util::EnumData InterpolatorTypeData[] = { {Geom::Interpolate::INTERP_CUBICBEZIER , N_("CubicBezierFit"), "CubicBezierFit"}, {Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN , N_("CubicBezierJohan"), "CubicBezierJohan"}, {Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"}, - {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"} + {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"}, + {Geom::Interpolate::INTERP_BSPLINE , N_("BSpline"), "BSpline"} }; static const Util::EnumDataConverter InterpolatorTypeConverter(InterpolatorTypeData, sizeof(InterpolatorTypeData)/sizeof(*InterpolatorTypeData)); diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h index e3ab37e27..651eba057 100644 --- a/src/live_effects/lpe-powerstroke-interpolators.h +++ b/src/live_effects/lpe-powerstroke-interpolators.h @@ -15,7 +15,7 @@ #include <2geom/path.h> #include <2geom/bezier-utils.h> #include <2geom/sbasis-to-bezier.h> - +#include #include "live_effects/spiro.h" @@ -27,6 +27,7 @@ enum InterpolatorType { INTERP_LINEAR, INTERP_CUBICBEZIER, INTERP_CUBICBEZIER_JOHAN, + INTERP_BSPLINE, INTERP_SPIRO, INTERP_CUBICBEZIER_SMOOTH, INTERP_CENTRIPETAL_CATMULLROM @@ -65,6 +66,38 @@ private: Linear& operator=(const Linear&); }; +class BSpline : public Interpolator { +public: + BSpline() {}; + virtual ~BSpline() {}; + + virtual Path interpolateToPath(std::vector const &points) const { + Path path; + path.start( points.at(0) ); + for (unsigned int i = 1 ; i < points.size(); ++i) { + Geom::Point pointA = points.at(i-1); + Geom::Point pointB = points.at(i); + Geom::Ray ray(pointA, pointB); + double angle = ray.angle(); + if (angle == 0) { + continue; + } + std::cout << angle << "angle" << std::endl; + double k1 = (Geom::distance(pointA, pointB)*std::sin(angle))/2.0; + std::cout << k1 << "k1" << std::endl; + std::cout << std::sin(angle) << "std::sin(angle)" << std::endl; + Geom::Point handle_1 = Geom::Point::polar(angle, k1) + pointA; + Geom::Point handle_2 = Geom::Point::polar(angle, k1 * 2) + pointA; + path.appendNew(handle_1, handle_2, pointB); + } + return path; + }; + +private: + BSpline(const BSpline&); + BSpline& operator=(const BSpline&); +}; + // this class is terrible class CubicBezierFit : public Interpolator { public: @@ -302,6 +335,8 @@ Interpolator::create(InterpolatorType type) { return new Geom::Interpolate::CubicBezierSmooth(); case INTERP_CENTRIPETAL_CATMULLROM: return new Geom::Interpolate::CentripetalCatmullRomInterpolator(); + case INTERP_BSPLINE: + return new Geom::Interpolate::BSpline(); default: return new Geom::Interpolate::Linear(); } diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 96f487211..b2b55a08c 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -123,7 +123,8 @@ static const Util::EnumData InterpolatorTypeData[] = { {Geom::Interpolate::INTERP_CUBICBEZIER , N_("CubicBezierFit"), "CubicBezierFit"}, {Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN , N_("CubicBezierJohan"), "CubicBezierJohan"}, {Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"}, - {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"} + {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"}, + {Geom::Interpolate::INTERP_BSPLINE , N_("BSpline"), "BSpline"} }; static const Util::EnumDataConverter InterpolatorTypeConverter(InterpolatorTypeData, sizeof(InterpolatorTypeData)/sizeof(*InterpolatorTypeData)); -- cgit v1.2.3 From 9599c53b48cbd737cf4c95120f0eb654dfce7b74 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Wed, 29 Nov 2017 22:40:27 +0100 Subject: Working with BSPline interpolator --- src/live_effects/lpe-powerstroke-interpolators.h | 26 ++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h index 651eba057..baa341fcb 100644 --- a/src/live_effects/lpe-powerstroke-interpolators.h +++ b/src/live_effects/lpe-powerstroke-interpolators.h @@ -74,21 +74,17 @@ public: virtual Path interpolateToPath(std::vector const &points) const { Path path; path.start( points.at(0) ); - for (unsigned int i = 1 ; i < points.size(); ++i) { - Geom::Point pointA = points.at(i-1); - Geom::Point pointB = points.at(i); - Geom::Ray ray(pointA, pointB); - double angle = ray.angle(); - if (angle == 0) { - continue; - } - std::cout << angle << "angle" << std::endl; - double k1 = (Geom::distance(pointA, pointB)*std::sin(angle))/2.0; - std::cout << k1 << "k1" << std::endl; - std::cout << std::sin(angle) << "std::sin(angle)" << std::endl; - Geom::Point handle_1 = Geom::Point::polar(angle, k1) + pointA; - Geom::Point handle_2 = Geom::Point::polar(angle, k1 * 2) + pointA; - path.appendNew(handle_1, handle_2, pointB); + Geom::Point handle_prev = points.at(0); + for (unsigned int i = 1 ; i < points.size() - 2; ++i) { + Geom::Line line_a(points.at(i), points.at(i+1)); + Geom::Line line_b(points.at(i+1), points.at(i+2)); + Geom::Point handle_next_tmp = line_a.pointAt(line_a.nearestTime(points.at(i-1))); + Geom::Point handle_next = line_b.pointAt(line_b.nearestTime(handle_next_tmp)); + Geom::Line line_handles(handle_next, points.at(i-1)); + double angle = line_handles.angle(); + Geom::Point handle_2 = Geom::Point::polar(angle, Geom::distance(handle_next,points.at(i))) + handle_next; + path.appendNew(handle_prev, handle_2, points.at(i)); + handle_prev = handle_next; } return path; }; -- cgit v1.2.3 From 524ed2d90dbea0b3be40c0786b4200bf3f6a146c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Thu, 30 Nov 2017 02:26:02 +0100 Subject: Working bspline, to fine tune --- src/live_effects/lpe-powerstroke-interpolators.h | 41 ++++++++++++++++++------ 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h index baa341fcb..21d25a797 100644 --- a/src/live_effects/lpe-powerstroke-interpolators.h +++ b/src/live_effects/lpe-powerstroke-interpolators.h @@ -74,18 +74,41 @@ public: virtual Path interpolateToPath(std::vector const &points) const { Path path; path.start( points.at(0) ); + Geom::Point handle_1(0,0); Geom::Point handle_prev = points.at(0); - for (unsigned int i = 1 ; i < points.size() - 2; ++i) { - Geom::Line line_a(points.at(i), points.at(i+1)); - Geom::Line line_b(points.at(i+1), points.at(i+2)); - Geom::Point handle_next_tmp = line_a.pointAt(line_a.nearestTime(points.at(i-1))); - Geom::Point handle_next = line_b.pointAt(line_b.nearestTime(handle_next_tmp)); - Geom::Line line_handles(handle_next, points.at(i-1)); - double angle = line_handles.angle(); - Geom::Point handle_2 = Geom::Point::polar(angle, Geom::distance(handle_next,points.at(i))) + handle_next; + for (unsigned int i = 1 ; i < points.size() - 1; ++i) { + Geom::Line line_a(points.at(i - 1), points.at(i)); + double angle_a = line_a.angle(); + Geom::Line line_b(points.at(i),points.at(i + 1)); + double angle_b = line_b.angle(); + Geom::Line line_handles(line_a.pointAt(0.66667),line_b.pointAt(0.33334)); + line_handles *= Geom::Translate(points.at(i) - line_handles.pointAt(0.5)); + Geom::Line line_perp_a(line_a.pointAt(0.5), Geom::Point::polar(angle_a + Geom::rad_from_deg(90),1) +line_a.pointAt(0.5)); + Geom::Line line_perp_b(line_b.pointAt(0.5), Geom::Point::polar(angle_b + Geom::rad_from_deg(90),1) +line_b.pointAt(0.5)); + std::vector result = line_perp_a.intersect(line_perp_b); + Geom::Point handle_2(0,0); + if(result.size() > 0) { + Geom::Line line_to_handle_a(result[0],line_a.pointAt(0.66667)); + Geom::Line line_to_handle_b(result[0],line_b.pointAt(0.33334)); + std::vector handle_a_res = line_to_handle_a.intersect(line_handles); + std::vector handle_b_res = line_to_handle_b.intersect(line_handles); + if(handle_a_res.size() > 0) { + handle_2 = handle_a_res[0]; + } + if(handle_a_res.size() > 0) { + handle_1 = handle_b_res[0]; + } + } + if (i == 1) { + Geom::Line start_segment(handle_prev,handle_2); + handle_prev = start_segment.pointAt(0.5); + } path.appendNew(handle_prev, handle_2, points.at(i)); - handle_prev = handle_next; + handle_prev = handle_1; } + Geom::Point last = points.at(points.size()-1); + Geom::Line last_segment(last,handle_1); + path.appendNew(handle_1, last_segment.pointAt(0.5), last); return path; }; -- cgit v1.2.3 From 5981085fa98a7cc785524f89f107cc7ff43c8b42 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 26 Nov 2017 22:55:09 +0100 Subject: Make file update dialog transient for the main window This ensures the (modal) dialog is positioned on top of the Inkscape window in which the file will be opened. Before it could happen that the dialog was not even on the same monitor as the Inkscape window leaving Inkscape in a seemingly inaccessible state if it was overlooked. --- src/file-update.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/file-update.cpp b/src/file-update.cpp index 303a5c4f1..1d95b5d4c 100644 --- a/src/file-update.cpp +++ b/src/file-update.cpp @@ -318,6 +318,7 @@ void sp_file_convert_dpi(SPDocument *doc) bool backup = prefs->getBool("/options/dpifixbackup", true); if (INKSCAPE.use_gui() && sp_file_convert_dpi_method_commandline == -1) { Gtk::Dialog scale_dialog(_("Convert legacy Inkscape file")); + scale_dialog.set_transient_for( *(INKSCAPE.active_desktop()->getToplevel()) ); scale_dialog.set_border_width(10); scale_dialog.set_resizable(false); Gtk::Label explanation; -- cgit v1.2.3 From 392723017aebe8bcfcefa73107b65af0d29acd00 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 26 Nov 2017 23:03:19 +0100 Subject: Make bitmap export progress dialog transient for the main window --- src/ui/dialog/export.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 8c710c8e5..53629a1a2 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -901,6 +901,7 @@ void Export::setExporting(bool exporting, Glib::ustring const &text) Gtk::Dialog * Export::create_progress_dialog (Glib::ustring progress_text) { Gtk::Dialog *dlg = new Gtk::Dialog(_("Export in progress"), TRUE); + dlg->set_transient_for( *(INKSCAPE.active_desktop()->getToplevel()) ); Gtk::ProgressBar *prg = new Gtk::ProgressBar (); prg->set_text(progress_text); -- cgit v1.2.3 From f0be34d40fdb5840cb2ad4539db4f6dd3978cb3f Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Thu, 30 Nov 2017 22:04:34 +0100 Subject: Extensions: Don't crash on invalid effect extension output --- src/extension/implementation/script.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index eb98711bc..23c97c3b0 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -732,9 +732,14 @@ void Script::effect(Inkscape::Extension::Effect *module, SPDocument * mydoc = NULL; if (data_read > 10) { - mydoc = Inkscape::Extension::open( - Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), - tempfilename_out.c_str()); + try { + mydoc = Inkscape::Extension::open( + Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), + tempfilename_out.c_str()); + } catch (const Inkscape::Extension::Input::open_failed &e) { + /// \todo Popup dialog here + g_warning("Extension returned output that could not be parsed: %s", e.what()); + } } // data_read pump_events(); -- cgit v1.2.3 From 4648a396a0325563e55fa3c99eaba7a4ee965064 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Thu, 30 Nov 2017 22:31:40 +0100 Subject: Add a warning dialog for previous commit --- src/extension/implementation/script.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 23c97c3b0..0f0a79bfb 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -737,8 +737,12 @@ void Script::effect(Inkscape::Extension::Effect *module, Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), tempfilename_out.c_str()); } catch (const Inkscape::Extension::Input::open_failed &e) { - /// \todo Popup dialog here g_warning("Extension returned output that could not be parsed: %s", e.what()); + Gtk::MessageDialog warning( + _("The output from the extension could not be parsed."), + false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true); + warning.set_transient_for( *(INKSCAPE.active_desktop()->getToplevel()) ); + warning.run(); } } // data_read -- cgit v1.2.3 From 67f654a049a12eb86b0e2f137212a50407b8e82e Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Fri, 1 Dec 2017 20:21:25 +0100 Subject: Add show handles --- src/live_effects/lpe-show_handles.cpp | 23 +++++++++++++++++++++-- src/live_effects/lpe-show_handles.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-show_handles.cpp b/src/live_effects/lpe-show_handles.cpp index 7c298d0e7..2da570537 100644 --- a/src/live_effects/lpe-show_handles.cpp +++ b/src/live_effects/lpe-show_handles.cpp @@ -12,6 +12,7 @@ #include <2geom/svg-path-parser.h> #include "helper/geom.h" #include "desktop-style.h" +#include "display/curve.h" #include "style.h" #include "svg/svg.h" @@ -27,12 +28,14 @@ LPEShowHandles::LPEShowHandles(LivePathEffectObject *lpeobject) handles(_("Show handles"), _("Show handles"), "handles", &wr, this, true), original_path(_("Show path"), _("Show path"), "original_path", &wr, this, true), show_center_node(_("Show center of node"), _("Show center of node"), "show_center_node", &wr, this, false), + original_d(_("Show original"), _("Show original"), "original_d", &wr, this, false), scale_nodes_and_handles(_("Scale nodes and handles"), _("Scale nodes and handles"), "scale_nodes_and_handles", &wr, this, 10) { registerParameter(&nodes); registerParameter(&handles); registerParameter(&original_path); registerParameter(&show_center_node); + registerParameter(&original_d); registerParameter(&scale_nodes_and_handles); scale_nodes_and_handles.param_set_range(0, 500.); scale_nodes_and_handles.param_set_increments(1, 1); @@ -80,7 +83,7 @@ void LPEShowHandles::doBeforeEffect (SPLPEItem const* lpeitem) Geom::PathVector LPEShowHandles::doEffect_path (Geom::PathVector const & path_in) { Geom::PathVector path_out; - Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(path_in); + Geom::PathVector original_pathv = pathv_to_linear_and_cubic_beziers(path_in); if(original_path) { for (unsigned int i=0; i < path_in.size(); i++) { path_out.push_back(path_in[i]); @@ -89,10 +92,26 @@ Geom::PathVector LPEShowHandles::doEffect_path (Geom::PathVector const & path_in if(!outline_path.empty()) { outline_path.clear(); } - generateHelperPath(original_pathv); + if (original_d) { + SPCurve * shape_curve = sp_shape->getCurveBeforeLPE(); + if (shape_curve) { + Geom::PathVector original_curve = shape_curve->get_pathvector(); + if(original_path) { + for (unsigned int i=0; i < original_curve.size(); i++) { + path_out.push_back(original_curve[i]); + } + } + original_pathv.insert(original_pathv.end(), original_curve.begin(), original_curve.end()); + } + generateHelperPath(original_pathv); + shape_curve->unref(); + } else { + generateHelperPath(original_pathv); + } for (unsigned int i=0; i < outline_path.size(); i++) { path_out.push_back(outline_path[i]); } + return path_out; } diff --git a/src/live_effects/lpe-show_handles.h b/src/live_effects/lpe-show_handles.h index c46abd2c2..583be9e61 100644 --- a/src/live_effects/lpe-show_handles.h +++ b/src/live_effects/lpe-show_handles.h @@ -43,6 +43,7 @@ private: BoolParam nodes; BoolParam handles; BoolParam original_path; + BoolParam original_d; BoolParam show_center_node; ScalarParam scale_nodes_and_handles; double stroke_width; -- cgit v1.2.3 From cbdd1dfb6d9e228c82905cc5032eef81164887d6 Mon Sep 17 00:00:00 2001 From: Jabiertxo Arraiza Cenoz Date: Fri, 1 Dec 2017 20:54:29 +0100 Subject: Remobe BSPline interpolator, a non success code and remove showhandles code --- src/live_effects/lpe-interpolate_points.cpp | 3 +- src/live_effects/lpe-powerstroke-interpolators.h | 56 +----------------------- src/live_effects/lpe-powerstroke.cpp | 3 +- src/live_effects/lpe-show_handles.cpp | 23 +--------- src/live_effects/lpe-show_handles.h | 1 - 5 files changed, 5 insertions(+), 81 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-interpolate_points.cpp b/src/live_effects/lpe-interpolate_points.cpp index c745921c2..7d4c88dc1 100644 --- a/src/live_effects/lpe-interpolate_points.cpp +++ b/src/live_effects/lpe-interpolate_points.cpp @@ -25,8 +25,7 @@ static const Util::EnumData InterpolatorTypeData[] = { {Geom::Interpolate::INTERP_CUBICBEZIER , N_("CubicBezierFit"), "CubicBezierFit"}, {Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN , N_("CubicBezierJohan"), "CubicBezierJohan"}, {Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"}, - {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"}, - {Geom::Interpolate::INTERP_BSPLINE , N_("BSpline"), "BSpline"} + {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"} }; static const Util::EnumDataConverter InterpolatorTypeConverter(InterpolatorTypeData, sizeof(InterpolatorTypeData)/sizeof(*InterpolatorTypeData)); diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h index 21d25a797..e3ab37e27 100644 --- a/src/live_effects/lpe-powerstroke-interpolators.h +++ b/src/live_effects/lpe-powerstroke-interpolators.h @@ -15,7 +15,7 @@ #include <2geom/path.h> #include <2geom/bezier-utils.h> #include <2geom/sbasis-to-bezier.h> -#include + #include "live_effects/spiro.h" @@ -27,7 +27,6 @@ enum InterpolatorType { INTERP_LINEAR, INTERP_CUBICBEZIER, INTERP_CUBICBEZIER_JOHAN, - INTERP_BSPLINE, INTERP_SPIRO, INTERP_CUBICBEZIER_SMOOTH, INTERP_CENTRIPETAL_CATMULLROM @@ -66,57 +65,6 @@ private: Linear& operator=(const Linear&); }; -class BSpline : public Interpolator { -public: - BSpline() {}; - virtual ~BSpline() {}; - - virtual Path interpolateToPath(std::vector const &points) const { - Path path; - path.start( points.at(0) ); - Geom::Point handle_1(0,0); - Geom::Point handle_prev = points.at(0); - for (unsigned int i = 1 ; i < points.size() - 1; ++i) { - Geom::Line line_a(points.at(i - 1), points.at(i)); - double angle_a = line_a.angle(); - Geom::Line line_b(points.at(i),points.at(i + 1)); - double angle_b = line_b.angle(); - Geom::Line line_handles(line_a.pointAt(0.66667),line_b.pointAt(0.33334)); - line_handles *= Geom::Translate(points.at(i) - line_handles.pointAt(0.5)); - Geom::Line line_perp_a(line_a.pointAt(0.5), Geom::Point::polar(angle_a + Geom::rad_from_deg(90),1) +line_a.pointAt(0.5)); - Geom::Line line_perp_b(line_b.pointAt(0.5), Geom::Point::polar(angle_b + Geom::rad_from_deg(90),1) +line_b.pointAt(0.5)); - std::vector result = line_perp_a.intersect(line_perp_b); - Geom::Point handle_2(0,0); - if(result.size() > 0) { - Geom::Line line_to_handle_a(result[0],line_a.pointAt(0.66667)); - Geom::Line line_to_handle_b(result[0],line_b.pointAt(0.33334)); - std::vector handle_a_res = line_to_handle_a.intersect(line_handles); - std::vector handle_b_res = line_to_handle_b.intersect(line_handles); - if(handle_a_res.size() > 0) { - handle_2 = handle_a_res[0]; - } - if(handle_a_res.size() > 0) { - handle_1 = handle_b_res[0]; - } - } - if (i == 1) { - Geom::Line start_segment(handle_prev,handle_2); - handle_prev = start_segment.pointAt(0.5); - } - path.appendNew(handle_prev, handle_2, points.at(i)); - handle_prev = handle_1; - } - Geom::Point last = points.at(points.size()-1); - Geom::Line last_segment(last,handle_1); - path.appendNew(handle_1, last_segment.pointAt(0.5), last); - return path; - }; - -private: - BSpline(const BSpline&); - BSpline& operator=(const BSpline&); -}; - // this class is terrible class CubicBezierFit : public Interpolator { public: @@ -354,8 +302,6 @@ Interpolator::create(InterpolatorType type) { return new Geom::Interpolate::CubicBezierSmooth(); case INTERP_CENTRIPETAL_CATMULLROM: return new Geom::Interpolate::CentripetalCatmullRomInterpolator(); - case INTERP_BSPLINE: - return new Geom::Interpolate::BSpline(); default: return new Geom::Interpolate::Linear(); } diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index b2b55a08c..96f487211 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -123,8 +123,7 @@ static const Util::EnumData InterpolatorTypeData[] = { {Geom::Interpolate::INTERP_CUBICBEZIER , N_("CubicBezierFit"), "CubicBezierFit"}, {Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN , N_("CubicBezierJohan"), "CubicBezierJohan"}, {Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"}, - {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"}, - {Geom::Interpolate::INTERP_BSPLINE , N_("BSpline"), "BSpline"} + {Geom::Interpolate::INTERP_CENTRIPETAL_CATMULLROM, N_("Centripetal Catmull-Rom"), "CentripetalCatmullRom"} }; static const Util::EnumDataConverter InterpolatorTypeConverter(InterpolatorTypeData, sizeof(InterpolatorTypeData)/sizeof(*InterpolatorTypeData)); diff --git a/src/live_effects/lpe-show_handles.cpp b/src/live_effects/lpe-show_handles.cpp index 2da570537..7c298d0e7 100644 --- a/src/live_effects/lpe-show_handles.cpp +++ b/src/live_effects/lpe-show_handles.cpp @@ -12,7 +12,6 @@ #include <2geom/svg-path-parser.h> #include "helper/geom.h" #include "desktop-style.h" -#include "display/curve.h" #include "style.h" #include "svg/svg.h" @@ -28,14 +27,12 @@ LPEShowHandles::LPEShowHandles(LivePathEffectObject *lpeobject) handles(_("Show handles"), _("Show handles"), "handles", &wr, this, true), original_path(_("Show path"), _("Show path"), "original_path", &wr, this, true), show_center_node(_("Show center of node"), _("Show center of node"), "show_center_node", &wr, this, false), - original_d(_("Show original"), _("Show original"), "original_d", &wr, this, false), scale_nodes_and_handles(_("Scale nodes and handles"), _("Scale nodes and handles"), "scale_nodes_and_handles", &wr, this, 10) { registerParameter(&nodes); registerParameter(&handles); registerParameter(&original_path); registerParameter(&show_center_node); - registerParameter(&original_d); registerParameter(&scale_nodes_and_handles); scale_nodes_and_handles.param_set_range(0, 500.); scale_nodes_and_handles.param_set_increments(1, 1); @@ -83,7 +80,7 @@ void LPEShowHandles::doBeforeEffect (SPLPEItem const* lpeitem) Geom::PathVector LPEShowHandles::doEffect_path (Geom::PathVector const & path_in) { Geom::PathVector path_out; - Geom::PathVector original_pathv = pathv_to_linear_and_cubic_beziers(path_in); + Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(path_in); if(original_path) { for (unsigned int i=0; i < path_in.size(); i++) { path_out.push_back(path_in[i]); @@ -92,26 +89,10 @@ Geom::PathVector LPEShowHandles::doEffect_path (Geom::PathVector const & path_in if(!outline_path.empty()) { outline_path.clear(); } - if (original_d) { - SPCurve * shape_curve = sp_shape->getCurveBeforeLPE(); - if (shape_curve) { - Geom::PathVector original_curve = shape_curve->get_pathvector(); - if(original_path) { - for (unsigned int i=0; i < original_curve.size(); i++) { - path_out.push_back(original_curve[i]); - } - } - original_pathv.insert(original_pathv.end(), original_curve.begin(), original_curve.end()); - } - generateHelperPath(original_pathv); - shape_curve->unref(); - } else { - generateHelperPath(original_pathv); - } + generateHelperPath(original_pathv); for (unsigned int i=0; i < outline_path.size(); i++) { path_out.push_back(outline_path[i]); } - return path_out; } diff --git a/src/live_effects/lpe-show_handles.h b/src/live_effects/lpe-show_handles.h index 583be9e61..c46abd2c2 100644 --- a/src/live_effects/lpe-show_handles.h +++ b/src/live_effects/lpe-show_handles.h @@ -43,7 +43,6 @@ private: BoolParam nodes; BoolParam handles; BoolParam original_path; - BoolParam original_d; BoolParam show_center_node; ScalarParam scale_nodes_and_handles; double stroke_width; -- cgit v1.2.3