enthought-chaco2-4.8.1.orig/0000755000175000017500000000000013544357631014710 5ustar varunvarunenthought-chaco2-4.8.1.orig/CHANGES.txt0000644000175000017500000002621413544356225016524 0ustar varunvarunEnable CHANGELOG ================ Changes since Enable 4.8.1 ========================== Enhancements ------------ Fixes ----- Maintenance ----------- Enable 4.8.1 ============ Fixes ----- * PR #368: Deferral of kiva font_manager imports * PR #365: Fix a KeyError while parsing ttfFontProperty Maintenance ----------- * PR #366: Fix CI config to avoid skipping tests in matrix * PR #367: Fix CI config to avoid losing logs to nose Enable 4.8.0 ============ Enhancements ------------ * PR #302: Qt5 Support * PR #330: Add support for ttc fonts * PR #345: Add more Qt mouse button names Fixes ----- * PR #312: Ensure contiguity for memoryview arrays in points_in_polygon * PR #317: Fix rect drawing with celiagg * PR #321: Kiva PDF backend: Don't clobber a passed-in font object * PR #331: Prevent context menus in Enable Qt widgets. * PR #346: Fix TypeError when passing unicode args to agg gradient methods * PR #350: Don't fail when empty arrays are passed to points_in_polygon * PR #354: Fix typo in MANIFEST.in * PR #358: Fix paths to static files. Maintenance ----------- * PR #322: Remove `sudo: false` from Travis config * PR #343: Fix code which triggered DeprecationWarnings * PR #347: Setup Appveyor * PR #348: Update EDM version for CI script * PR #349: Update `unittest` imports * PR #352: Quick and Dirty Documentation Improvements * PR #353: Update Travis CI configuration to be compatible with Ubuntu Xenial. * PR #356: CI failures on wx, python 2.7, win expected * PR #357: Remove unnecessary Ubuntu package. Enable 4.7.2 ============ Fixes ----- * PR #310: Remove locale-dependence in Agg text rendering * PR #309: FIX: Ensure contiguous transposed arrays * PR #305: Ignore X11 fonts on macOS * PR #299: BUG: Remove use of C API not available in Python 3 Maintenance ----------- * PR #308: Update to the most recent release of fonttools Enable 4.7.1 ============ Fixes ----- * PR #295: Use uint8_t from numpy instead of stdint Enable 4.7.0 ============ This is a maintenance release, with the most significant change being an upgrade to the vendorized Agg code. This should resolve issues with hard crashes in (packages that use) Kiva. Maintenance ----------- * PR #288: Upgrade to a newer Agg version * PR #287: Improve mouse wheel support * PR #285: Add Python 3.5, 3.6 to CI * PR #284, #289, #290: Support Python 3 without 2to3 * PR #281: Use EDM for CI testing * PR #280: Clean up circular import in test Enable 4.6.1 ============ Fixes ----- * PR #257: Fix a problem encountered when installing from pip Enable 4.6.0 ============ Enhancements ------------ * PR #246: Kiva explorer demo * PR #222: New markers: 2 triangles, star, cross-plus, 2 hexagons, and pentagon * PR #209: Python 3 Support * PR #207: Viewport resizing Fixes ----- * PR #243: Make savage compatible with newer PyParsing versions. * PR #241: Fixed the trs_factor function * PR #238: points_in_polygon now returns a bool array * PR #234: allow multiple gradient stops with wx toolkit * PR #231: Be deterministic about initial state of viewport position and bounds * PRs #215 & 217: Support for Pillow 3.0 * PR #205: Fix scrolling problem with Qt native scrollbar * PR #203: numpy.rank() is deprecated Maintenance ----------- * PR #244: Remove support for Mac font suitcases. * PR #240: add quartz to MANIFEST file * PR #232: Don't assume window is MockWindow when dealing with pointer position * PR #230: Fix for build issues * PR #227: Create codecov.yml * PRs #226 & #201: Fix g++ version string parsing * PR #223: Fix SVG Tests * PR #214: Add docs and examples to the source distribution * PR #206: Containerize Travis CI Builds * PR #195: Multiple build environments * PR #177: fixes for recent swig * PR #192: Add the auto-generated enable/_version.py to .gitignore * PR #191: fix missing framework when building kiva.quartz. * PR #180: fix minor errors in sphinx build Enable 4.5.0 (March 23, 2015) ============================= Enhancements ------------ * PR #138: Optional constraints-based layout. * PR #140: Add a base class for drag and drop tools, example and test support. * PR #150: Add a very basic Image component * PR #160: Basic testing for kiva backends. * PR #168: Simple push-button and checkbox tool. * PR #167: Add tools that support Apptools Undo/Redo. Fixes ----- * PR#139 Significant code clean-up, modernization, test improvement and documentation for Kiva. * Multiple fixes for breaks to Travis-CI builds. Enable 4.4.0 (May 1, 2014) ========================== Enhancements ------------ * Added a test assistant to aid in writing unit tests for Enable/Chaco code (3cb6d22 & a5b8cb9) * Added Drag & Drop support for Qt (4196bc8) * Added a context menu tool (0c27475) Fixes ----- * PR #92: Fixed the example support code to allow Chaco demos to run on Qt * PR #94: Fixed the examples so that they would run on Qt * PR #102: Fixed a transparency drawing bug in the Qt image backend * Fixed various bugs which caused test failures in Enable and Chaco (PRs #103, #105, #110, #113) * PR #107: Fixed a memory leak in the QPainter kiva backend * PR #116: Fixed the incomplete implementation of the resize tool * PR #118: Fixed a gradient rendering bug that sometimes caused segfaults Enable 3.4.1 (March 3, 2011) ============================ Fixes ----- * Removed OnPaint method from KivaRenderPanel in savage. On Windows there were competing handlers for the paint event. The OnPaint method expected a certain order, which varied by Platform * QImage constructor args were changed to use QByteArray to match changes to PySide API changes in PySide RC1 Enable 3.4.0 (Jan 26, 2011) =========================== Enhancements ------------ * Major refactor of kiva backends to make setting the desired backend more resilient and flexible. * Added support for PySide * Qt backend no longer uses Agg internally, instead it uses QPainter. * Improved gradient support in Quartz backend * Improved cairo backend * Updated to use variation of rev 8713 of matplotlib font_manager.py Fixes ----- * Fixed cubic spline rendering in OpenGl backend * Fixed gradients using relative coordinates * Fixed object-space gradients Enable 3.3.2 (October 15, 2010) =============================== Enhancements ------------ * Context manager methods were added to the Kiva GraphicsContext class, so now, instead of this common pattern for a GraphicsContext gc: gc.save_state() try: # Do stuff with gc... except: gc.restore_state() one can do this:: with gc: # Do stuff with gc... * Stacked layout containers were added. * qt4_backend: Added Tony Yu's patch to better handling keypresses in Qt4 when modifier keys are pressed (r25644). * vtk_backend: Added John Wiggins patch which adds key bindings to EnableVTKWindow (r25796). * The Kiva backend for the Mac, implemented in ABCGI.pyx, is now processed with cython instead of pyrex. Fixes ----- * vtk_backend: Got rid of timer that was causing performance problems on the Mac by looking for the "StartEvent" on the RenderWindow to determine when we are about to do a vtk render. (r25605) * savage: Avoid the wx-specific FileInspector in Sike and use the CodeEditor directly. (r25742) * Exceptions were updated to use the new Exception classes in several places. Enable 3.3.1 (Feb 24, 2010) =============================== Enhancements ------------ * Added dimming mask to disabled buttons when using wx backend (r25405). * Added toggle_label and toggle_tooltip from Brad Buran's patch (r25414). * vtk_backend: Made _redraw call _paint to force an immediate draw. Added a request_render callable slot that will be called instead of self.control.render if set. This allows renders to be coordinated to avoid duplicate renders. (r25423) * Added option of making center section of compass clickable by setting "enable_center" to True. (r25492) * kiva agg backend: fixed minor issues causing compiler warnings (r25498) Fixes ----- * Fixed hover_tool so it imports correctly under the 'null' toolkit, as reported on mailing list (r25407). Enable 3.3.0 (Feb 24, 2010) =========================== Enhancements ------------ * Updated freetype to 2.3.12. This makes our text look prettier, and also fixes some compatibility issues with OS X 10.6. * Moved Shape from examples into enable.primitives * Improved ability to find the Qt SVG IconEngine for the SVGButtonEditor * Improved painting in Wx by as much as 30% * Added repeat and reflect gradient fill methods Fixes ----- * Fixed diamond marker to use the native Agg marker * Fixed drawing elliptical curves on OS X * Fixed scaling transforms affecting gradients * Fixed the "window" property on Enable components to recurse up their container hierarchy to return the default window associated with a component. * Viewports now correctly implement is_in() and components_at(), taking their own boundaries into account. * Removed explicit dependency on TraitsBackendWx in Enable * Fixing logic in enable.example_support, so that it no longer just uses wx if wxPython is installed, but rather looks at ETSConfig.toolkit. * Fixing some math in the computation of setting outer_x2 and outer_y2 attributes of components. One final note is that the "enable2" legacy backwards compatibility package will be removed by the next release. If you have any code that imports from "enable2" and the DeprecationWarnings haven't been sufficiently motivating thus far, please heed them and change your imports to use "enable"! Enable 3.2.0 (July 15th, 2009) ============================== enable Enhancements ----------------------------- * Added Slider and Compass widgets * Added an OverlayContainer (almost identical to the one in Chaco) * Added ImageGraphicsContextEnable class so that one can always import a Kiva Image backend-based GraphicsContextEnable * renaming marker_trait to MarkerTrait (the old name is still permitted forbackwards compatibility, but should be avoided) * Moved the scatter_markers module from Chaco to Enable, so that Enable components can use MarkerTrait * Added an experimental VTK backend for Enable, along with an example * Changed SVGButtonEditor toggle to draw a SVG under the button SVG instead of drawing a plain box * Added labels for SVGButton * Improving backbuffering performance on the Mac by creating the layer context from the window context instead of from a bitmap. * Adding a "fixed_preferred_size" trait to Components, so that relative size preferences can be expressed amongst different components in a container enable Fixes ---------------------- * Improved the backend selection to match the Traits UI backend unless ETSConfig.enable_toolkit is explicitly set * Fixed demo_main() in example_support.py so that it doesn't crash IPython * Fixed RGBAColorTrait so it can be used with the null toolkit * Changed the "sys_window" color to be the same as the Traits UI "WindowColor" constant * Fixed backend_cairo's get_text_extent() implementation to match other backends kiva Enhancements --------------------------- * Added basic gradients to Kiva kiva Fixes -------------------- * Fixed Python 2.6 datatype errors * Fixed memory leak as reported in ticket 1815 * The macport test is only run on Darwin systems * Removed deprecated calls to old numpy APIs enthought-chaco2-4.8.1.orig/TODO.txt0000644000175000017500000000037413233644505016214 0ustar varunvarun* Clean-up the failing import of enthought.freetype in kiva.trait_defs.ui.wx.kiva_font_editor. * Clean-up imports of enable (I mean NOT enable2) done in: enable2/traits/ui/wx/enable_rgba_color_editor.py * Clean-up direct imports of traitsui.wx enthought-chaco2-4.8.1.orig/image_LICENSE_CP.txt0000644000175000017500000004401413233644505020254 0ustar varunvarunLicense The Crystal Project are released under LGPL. GNU General Public License. 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: 1. The modified work must itself be a software library. 2. You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. 3. You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. 4. If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: 1. Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) . 2. Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. 3. Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. 4. If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. 5. Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: 1. Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. 2. Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. No Warranty 15. Because the library is licensed free of charge, there is no warranty for the library, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the library "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the library is with you. Should the library prove defective, you assume the cost of all necessary servicing, repair or correction. 16. In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the library as permitted above, be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the library (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the library to operate with any other software), even if such holder or other party has been advised of the possibility of such damages. enthought-chaco2-4.8.1.orig/MANIFEST.in0000644000175000017500000000071013544356225016442 0ustar varunvaruninclude CHANGES.txt include CONTRIBUTING.rst include LICENSE.txt include image_LICENSE.txt include image_LICENSE_*.txt include TODO.txt include kiva/agg/agg.i include docs/Makefile include docs/kiva/agg/notes recursive-include docs *.py *.rst *.txt *.css *.png *.ico *.doc recursive-include examples *.py *.txt *.gif *.jpg *.enaml recursive-include kiva/quartz *.pyx *.pxi *.pxd mac_context*.* recursive-include kiva/fonttools/tests/data *.txt *.ttc *.ttf enthought-chaco2-4.8.1.orig/docs/0000755000175000017500000000000013544357562015643 5ustar varunvarunenthought-chaco2-4.8.1.orig/docs/Makefile0000644000175000017500000000607213233644505017277 0ustar varunvarun# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/enable.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/enable.qhc" latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." enthought-chaco2-4.8.1.orig/docs/kiva/0000755000175000017500000000000013544357562016575 5ustar varunvarunenthought-chaco2-4.8.1.orig/docs/kiva/agg/0000755000175000017500000000000013544357562017333 5ustar varunvarunenthought-chaco2-4.8.1.orig/docs/kiva/agg/interface.txt0000755000175000017500000002720713233644505022036 0ustar varunvarunKiva Interface Quick Reference (AGG backend) ========================================================================== This document is a summary of the classes and functions available in Kiva. More specifically, it describes some of the details of the kiva.agg backend, including enumerated types and helper classes. ------------------------------------------- Primitive types ------------------------------------------- The following conventions are used to describe input and output types: color: either a 3-tuple or 4-tuple; the represented color depends on the graphics context's pixel format rect: (origin_x, origin_y, width, height) bool: an int that is 1 or 0 affine_matrix: an AffineMatrix instance representing some type of coordinate transform. See /kiva/agg/src/kiva_affine_matrix.h point_array: an array/sequence of length-2 arrays, e.g. ((x,y), (x2,y2),...) rect_array: an array/sequence of rects: ((x,y,w,h), (x2,y2,w2,h2), ...) ------------------------------------------- Supporting types ------------------------------------------- AffineMatrix ------------ (kiva_affine_matrix.h and affine_matrix.i) All of the following member functions modify the instance on which they are called: __init__(v0, v1, v2, v3, v4, v5) or __init__() reset() # sets this matrix to the identity multiply(AffineMatrix) # multiples this matrix by another invert() # sets this matrix to the inverse of itself flip_x() # mirrors around X flip_y() # mirrors around Y scale() -> float # returns the average scale of this matrix determinant() -> float # returns the determinant The following factory methods are available in the top-level "agg" namespace to create specific kinds of AffineMatrix instances: translation_matrix(float X, float Y) rotation_matrix(float angle_in_radians) scaling_matrix(float x_scale, float y_scale) skewing_matrix(float x_shear, float y_shear) FontType ------------ (kiva_font_type.h and font_type.i) __init__(name, size=12) CompiledPath ------------ see kiva_compiled_path.h in /kiva/agg/src/; interface is very similar to "Path drawing" interface of Graphics Context ------------------------------------------- Enumerations - see also /kiva/agg/src/kiva_constants.h ------------------------------------------- The following enumerations are represented by top-level constants in the "agg" namespace. They are fundamentally integers. Some of them also have dicts that map between their names and integer values line_cap: CAP_BUTT, CAP_ROUND, CAP_SQUARE line_join: JOIN_ROUND, JOIN_BEVEL, JOIN_MITER draw_mode: FILL, EOF_FILL, STROKE, FILL_STROKE, EOF_FILL_STROKE text_style: NORMAL, BOLD, ITALIC text_draw_mode: TEXT_FILL, TEXT_INVISIBLE [this is currently unused] pix_format: dicts: pix_format_string_map, pix_format_enum_map values: pix_format_gray8, pix_format_rgb555, pix_format_rgb565, pix_format_rgb24, pix_format_bgr24, pix_format_rgba32, pix_format_argb32, pix_format_abgr32, pix_format_bgra32 (NOTE: the strings in the dicts omit the "pix_format_" prefix) interpolation: dicts: interp_enum_map, interp_string_map values: nearest, bilinear, bicubic, spline16, spline36, sinc64, sinc144, sinc256, blackman64, blackman100, blackman256 marker: dicts: marker_string_map, marker_enum_map values: marker_circle, marker_cross, marker_crossed_circle, marker_dash, marker_diamond, marker_dot, marker_four_rays, marker_pixel, marker_semiellipse_down, marker_semiellipse_left, marker_x, marker_semiellipse_right, marker_semiellipse_up, marker_square, marker_triangle_down, marker_triangle_left, marker_triangle_right, marker_triangle_up (NOTE: the strings in the dicts omit the "marker_" prefix) Path_cmd and path_flags are low-level Agg path attributes. See the Agg documentation for more information about them. We just pass them through in Kiva. path_cmd: path_cmd_curve3, path_cmd_curve4, path_cmd_end_poly, path_cmd_line_to path_cmd_mask, path_cmd_move_to, path_cmd_stop path_flags: path_flags, path_flags_ccw, path_flags_close, path_flags_cw, path_flags_mask, path_flags_none ************************************************* *** Graphics Context Reference *** ************************************************* ------------------------------------------- Construction ------------------------------------------- GraphicsContextArray(size, pix_format="rgba32") # size is a tuple (width, height) Image(filename) ------------------------------------------- Graphics state ------------------------------------------- save_state() restore_state() set_stroke_color(color) get_stroke_color() -> color set_line_width(float) set_line_join(line_join) set_line_cap(line_cap) set_line_dash(array) # array is an even-lengthed tuple of floats that represents # the width of each dash and gap in the dash pattern. set_fill_color(color) get_fill_color() -> color linear_gradient(x1, y1, x2, y2, stops, spread_method, units) radial_gradient(cx, cy, r, fx, fy, stops, spread_method, units) # The gradient methods modify the current fill color set_alpha(float) get_alpha() -> float set_antialias(bool) get_antialias() -> bool set_miter_limit(float) set_flatness(float) get_image_interpolation() -> interpolation set_image_interpolation(interpolation) translate_ctm(float x, float y) rotate_ctm(float angle_in_radians) concat_ctm(AffineMatrix) scale_ctm(float x_scale, float y_scale) set_ctm(AffineMatrix) get_ctm() -> AffineMatrix ------------------------------------------- Clipping functions ------------------------------------------- clip_to_rect(rect) clip_to_rects(rect_array) clip() # clips using the current path even_odd_clip() # modifies the current clipping path using the even-odd rule to # calculate the intersection of the current path and the current # clipping path. ------------------------------------------- Path construction functions ------------------------------------------- # All coordinates below are floating-point begin_path() close_path() get_empty_path() -> CompiledPath # returns a blank CompiledPath instance add_path(CompiledPath) move_to(x, y) line_to(x, y) lines(point_array) rect(x, y, w, h) rects(rect_array) curve_to(x1, y1, x2, y2, end_x, end_y) # draws a cubic bezier curve with control points (x1,y1) and (x2,y2) # that ends at point (end_x, end_y) quad_curve_to(cp_x, cp_y, end_x, end_y) # draws a quadratic bezier curve from the current point using # control point (cp_x, cp_y) and ending at (end_x, end_y) arc(x, y, radius, start_angle, end_angle, bool cw=false) # draws a circular arc of the given radius, centered at (x,y) # with angular span as indicated. Angles are measured counter- # clockwise from the positive X axis. If "cw" is true, then # the arc is swept from the end_angle back to the start_angle # (it does not change the sense in which the angles are measured). arc_to(x1, y1, x2, y2, radius) # from the comments in kiva_graphics_context_base.h: # Sweeps a circular arc from the pen position to a point on the # line from (x1,y1) to (x2,y2). # # The arc is tangent to the line from the current pen position # to (x1,y1), and it is also tangent to the line from (x1,y1) # to (x2,y2). (x1,y1) is the imaginary intersection point of # the two lines tangent to the arc at the current point and # at (x2,y2). # # If the tangent point on the line from the current pen position # to (x1,y1) is not equal to the current pen position, a line is # drawn to it. Depending on the supplied radius, the tangent # point on the line fron (x1,y1) to (x2,y2) may or may not be # (x2,y2). In either case, the arc is drawn to the point of # tangency, which is also the new pen position. # # Consider the common case of rounding a rectangle's upper left # corner. Let "r" be the radius of rounding. Let the current # pen position be (x_left + r, y_top). Then (x2,y2) would be # (x_left, y_top - radius), and (x1,y1) would be (x_left, y_top). ------------------------------------------- Drawing functions ------------------------------------------- stroke_path() fill_path() eof_fill_path() draw_path(draw_mode=FILL_STROKE) draw_rect(rect, draw_mode=FILL_STROKE) draw_marker_at_points(point_array, int size, marker=marker_square) draw_path_at_points(point_array, CompiledPath, draw_mode) draw_image(graphics_context img, rect=None) # if rect is defined, then img is scaled and drawn into it; # otherwise, img is overlayed exactly on top of this graphics context ------------------------------------------- Text functions ------------------------------------------- set_text_drawing_mode(text_draw_mode) set_text_matrix(AffineMatrix) get_text_matrix() -> AffineMatrix set_text_position(float X, float Y) get_text_position() -> (X, Y) show_text(string) show_text_translate(string, float X, float Y) get_text_extent(string) -> (x,y,w,h) get_full_text_extent(string) -> (w,h,x,y) # deprecated; order has been changed for backwards-compatibility # with existing Enable select_font(name, size, style) set_font(FontType) get_font() -> FontType set_font_size(int) set_character_spacing() get_character_spacing() set_text_drawing_mode() show_text_at_point() ------------------------------------------- Misc functions ------------------------------------------- width() -> int height() -> int stride() -> int bottom_up() -> bool format() -> pix_format flush() # Force all pending drawing operations to be rendered immediately. # This only makes sense in window contexts, ie- the Mac Quartz backend. synchronize() # A deferred version of flush(). Also only relevant in window contexts. begin_page() end_page() clear_rect(rect) # Clears a rect. Not available in PDF context. convert_pixel_format(pix_format, bool inplace=0) save(filename, file_format=None, pil_options=None) # From the comments in graphics_context.i: # Save the GraphicsContext to a file. Output files are always # saved in RGB or RGBA format; if this GC is not in one of # these formats, it is automatically converted. # # If filename includes an extension, the image format is # inferred from it. file_format is only required if the # format can't be inferred from the filename (e.g. if you # wanted to save a PNG file as a .dat or .bin). # # pil_options is a dict of format-specific options that # are passed down to the PIL image file writer. If a writer # doesn't recognize an option, it is silently ignored. # # If the image has an alpha channel and the specified output # file format does not support alpha, the image is saved in # rgb24 format. ------------------------------------------- Functions that are currently stubbed out or not implemented ------------------------------------------- show_glyphs_at_point() enthought-chaco2-4.8.1.orig/docs/kiva/agg/antigrain_notes.doc0000644000175000017500000027600013233644505023202 0ustar varunvarun╨╧рб▒с>■  ╣╗■   ╖╕                                                                                                                                                                                                                                                                                                                                                                                                                                            ье┴E@ °┐б<bjbjГцГц "^сМсМ2а      И№№№№о6JТ1Т1Т1Т14╞1LJ┌L,2:X2X2X2X2k3k3k3YL[L[L[L[L[L[L$NRXPВL№k3g3k3k3k3L№№X2X2ФL█E█E█Ek3t №X2№X2YL█Ek3YL█E█E∙E:эJ,№№uKX22 ЁUт╧ъ┬Т1▀>K YLкL0┌L#KR┌PїD╛┌PuKJJ№№№№┌P└ZuKфk3k3█Ek3k3k3k3k3LLJJDО"│E(JJО"Anti-grain library notes. agg::rendering_buffer Before drawing anything, you must create a memory buffer to store the image you are drawing. There isn't anything fancy about the memory -- it can just be a raw memory buffer. However, agg requires you to УattachФ this buffer to a class called agg::rendering_buffer found in agg_rendering_buffer.h that it uses in all of its rendering operations. There are some decent notes in the header about the nuances of the class. Most of the time, youТll just use the attach method of the class: void attach(unsigned char* buf, unsigned width, unsigned height, int row_bytes); Allocating and deallocating buf is the users responsibility. Width and height specify the size of the image space you are drawing into. The argument row_bytes is used because in reality the row length in bytes does not obligatory correspond with the width of the image in pixels, i.e. it cannot be simply calculated as width_in_pixels * bytes_per_pixel. For example, it must be aligned to 4 bytes in Windows bitmaps. Besides, the value of row_bytes can be negative - it depends on the order of displaying the rendering buffer - from top to bottom or from bottom to top. In other words, if row_bytes > 0 the pointers to each row will start from the beginning of the buffer and increase. If it < 0, the pointers start from the end of the buffer and decrease. It gives you an additional degree of freedom. Method attach() can be called more than once. The execution time of it is very little. Example The following code illustrates how to connect an agg::rendering_buffer to a Numeric array using weave: # from Numeric import * import weave import os from glob import glob agg_path = "C:/wrk/agg2" agg_src = glob(os.path.join(agg_path,'src','*.cpp')) agg_include_dirs = [os.path.join(agg_path,'include')] agg_headers = [ '"agg_rendering_buffer.h"'] code = """ agg::rendering_buffer buf; buf.attach(ary, Nary[1], Nary[0], Nary[1]*Nary[2]); """ ary = zeros((4,4,3),typecode=UInt8) weave.inline(code,['ary'], sources = agg_src, headers = agg_headers, include_dirs = agg_include_dirs) # Note that we defined the array to have a typecode of UInt8 because anti-grain expects an unsigned char* array as the buffer. agg::renderer_xxx_yyy One of the Anti-grain renderer classes is in charge of drawing to an agg::rendering_buffer. There are a number of different rendering classes to support the various image pixel layouts possible such as rgb24, bgr24, rgba32, abgr32, etc. There are quite a view other variations supported. Renderers can also be either solid or gourmand. So, to render to a 32 bit image with red, green, blue, alpha pixels using a solid renderer, the renderer class to use is agg::renderer_bgra32_solid. Note that the layout of the memory buffer in the agg::rendering_buffer used should match that expected by the renderer class. Example # from Numeric import * import weave from agg_info import agg_build_info code = """ agg::rendering_buffer buf; width height row_bytes buf.attach(ary, Nary[1], Nary[0], Nary[1]*Nary[2]); agg::renderer_bgra32_solid rr(buf); agg::renderer_util util(buf); util.clear(agg::rgba(1.0,1.0,1.0)); """ ary = zeros((4,4,4),typecode=UInt8) weave.inline(code,['ary'], **agg_build_info) desired = ones((4,4,4),typecode=UInt8) * 255 desired[:,:,3] = 255 # set alpha plane. assert(ary == desired) # agg::path_storage Antigrain separates out the ideas of storage for the vertices in a path and the conversion of the vertices to something the УrasterizerФ can render into a rendering_buffer. The agg::path_storage class has methods such as move_to, line_to, curve3, curve4, add_path, and add_poly for building a list of commands that define a path to be drawn. These guys are sorta like Уdisplay listsФ in OpenGL in that you can build them once and save them for later execution. The following several paragraphs are extracted directly from the antigrain code comments in agg_path_storage.h. Before rendering we must collect and store the necessary number of vertices. There are different approaches that can be used such as a simple buffer in memory. But we also may want to perform different kinds of conversions, for example, affine transformations, clipping, making an outline, calculation of Minkowski sum, and so on. Many graphic libraries do that, but the sequence of these conversions is often hard coded, i.e., there's a number of settings such as set_rotate(), set_clip_box(), etc, which can be used or omitted, but anyway a particular vertex suffers all these conversions in the strictly defined order. Another approach is based on a number of functions or classes each of which performs only one kind of conversion (in fact, this is how the first approach looks inside). In this case we usually have to store intermediate results as vertex arrays or something on each step of the conversion. AGG allows you to construct any custom pipelines, but at the same time does not require the use of any intermediate storages. Not possible? Yes, it is possible with some exceptions which are not painful. A concept of rendering assumes creating a rasterizer object, then adding vertices into it, and finally render the filled polygon. The rasterizer has template method add_path which takes an abstract vertex source and "asks" it to give vertices one by one. This storage must support the interface of two methods: rewind() and vertex(). The latest method gives the rasterizer one vertex from the vertex source and returns special flag. When all vertices are given, method vertex() returns pathflag_stop. Such a concept allows you to avoid storing vertices anywhere, in case, for example, if you know the analytical representation of your figure and calculate vertices on demand. For example, we can easily write a class that produces a sine wave, but does not use any arrays. This class can be used as a source of vertices either directly or via some intermediate converters. The examples of such kind of classes you can find in file agg_curves.h. The main conclusion of it is: Any class that supports interface of two mentioned above methods can be used as a vertex source. There are two kinds of these classes - initial sources and intermediate converters. The latest require a pointer to a preceding source when being constructed. All these classes have prefix conv_. Classes path_storage, curve3, curve4 can be only initial sources. All converter classes are template ones, all initial sources are usually regular ones. Template mechanism are used because it gives us more freedom. All the vertex source class need to have is a two-method interface. These classes don't have to be derived from any particular base class, and, besides, it allows us to avoid using virtual calls which works much slower than regular calls (They make the processor pipeline to resynchronize because they are doubly indirect. BTW, pure C indirect calls, via a pointer to a function work almost as fast as direct ones, because they have only one level of indirection). Still, sometimes we have to use converters that have one common base class and their interface methods are virtual. There is such base class called pipe_conv. See agg_pipe_conv.h for details. In fact there's only wrappers that turn interface function into virtual. Every vertex source class has this wrapper. Filled Polygon Example If you render an agg::path_storage directly using a rasterizer, itТll render a filled region. The following code renders a filled sine wave. If the last point isnТt the same as the first one, it is automatically closed. # from Numeric import * import weave from agg_info import agg_build_info import windows_bmp code = """ agg::rendering_buffer buf; // width height row_bytes buf.attach(ary, Nary[1], Nary[0], Nary[1]*Nary[2]); agg::renderer_rgba32_solid ren(buf); agg::rasterizer ras; agg::renderer_util util(buf); agg::path_storage ps; util.clear(agg::rgba(1.0,1.0,1.0)); ps.remove_all(); ps.move_to(pts[0],pts[0+1]); for(int i=2; i < Npts[0]*2; i+=2) ps.line_to(pts[i],pts[i+1]); ras.add_path(ps); ren.attribute(agg::rgba(0.5,0.5,0.5,0.5)); ras.render(ren); """ M,N = 1000,1000 ary = zeros((M,N,4),typecode=UInt8) x = arange(0,2*pi,2*pi/P) y = (sin(x)+1)*M/2. pts = transpose(array((arange(len(x)),y))).copy() weave.inline(code,['ary','pts'], **agg_build_info) windows_bmp.write_bmp_24("draw_poly.bmp",ary) #  Figure  SEQ Figure \* ARABIC 1: A filled sinusoid generated by example . Line Example To render the outline of path instead of a filled polygon, you must УconvertФ the path using a agg::conv_polyline or an agg::conv_polygon class. Both classes render an outline, but the second will close the path automatically even if the end points of the path are not the same point. If you render an agg::path_storage directly using a rasterizer, itТll render a filled region. The following code renders a filled sine wave. If the last point isnТt the same as the first one, it is automatically closed. # from Numeric import * import weave from agg_info import agg_build_info import windows_bmp code = """ agg::rendering_buffer buf; // width height row_bytes buf.attach(ary, Nary[1], Nary[0], Nary[1]*Nary[2]); agg::renderer_rgba32_solid ren(buf); agg::rasterizer ras; agg::renderer_util util(buf); agg::path_storage ps; agg::conv_polyline path(ps); path.thickness(4.0); util.clear(agg::rgba(1.0,1.0,1.0)); ps.remove_all(); ps.move_to(pts[0],pts[0+1]); for(int i=2; i < Npts[0]*2; i+=2) ps.line_to(pts[i],pts[i+1]); ras.add_path(path); ren.attribute(agg::rgba(0.5,0.5,0.5,0.5)); ras.render(ren); """ M,N = 1000,1000 ary = zeros((M,N,4),typecode=UInt8) x = arange(0,2*pi,2*pi/P) y = (sin(x)+1)*M/2. pts = transpose(array((arange(len(x)),y))).copy() weave.inline(code,['ary','pts'], **agg_build_info) windows_bmp.write_bmp_24("draw_poly.bmp",ary) #  Figure  SEQ Figure \* ARABIC 1: Sinusoidal line generated by example . And the following slightly modified code will automatically closed path: # from Numeric import * import weave from agg_info import agg_build_info import windows_bmp code = """ agg::rendering_buffer buf; // width height row_bytes buf.attach(ary, Nary[1], Nary[0], Nary[1]*Nary[2]); agg::renderer_rgba32_solid ren(buf); agg::rasterizer ras; agg::renderer_util util(buf); agg::path_storage ps; agg::conv_polygon path(ps); path.thickness(4.0); util.clear(agg::rgba(1.0,1.0,1.0)); ps.remove_all(); ps.move_to(pts[0],pts[0+1]); for(int i=2; i < Npts[0]*2; i+=2) ps.line_to(pts[i],pts[i+1]); ras.add_path(path); ren.attribute(agg::rgba(0.5,0.5,0.5,0.5)); ras.render(ren); """ M,N = 1000,1000 ary = zeros((M,N,4),typecode=UInt8) x = arange(0,2*pi,2*pi/P) y = (sin(x)+1)*M/2. pts = transpose(array((arange(len(x)),y))).copy() weave.inline(code,['ary','pts'], **agg_build_info) windows_bmp.write_bmp_24("draw_poly.bmp",ary)  Figure  SEQ Figure \* ARABIC 1: Sinusoidal polygon outline generated by example . Constructing a kiva::path Notes: When testing the construction of rendering a path, it looks like about 33% of the time is in the path construction and 66% is in the actual rendering. We can therefore save 33% of the time if we can construct a path once and use it in any future re-draws. Also, I believe rendering aliased lines can cut the rendering time by at least 50%, so we have the potential to speed the rendering of lines up by a factor of 3.?? Questions: How do you turn off anti-aliasing during rendering? If we turn off anti-aliasing, will it speed up the rendering of lines? Creating paths with more than (approx) 32000 line_to calls causes a seg-fault. Should this be more graceful? ShouldnТt the path_storage destructor be virtual? I need to think about rendering to a non-contiguous array, but that should be fairly easy also by specifying the correct row_bytes size. This will be important when rendering to a sub-section of an image. They should all be enumerated. IТm not sure about the difference here. It should be discussed though. Why canТt the renderer just have a clear() method? This seems cleaner than having to generate another object to do it. Note the absence of coordinate transforms in this list, so it doesnТt support the PDF notion of having coordinate transforms impeded between path commands. We will have to add this in a kiva::path_stoarge object or something like that. 23юё) > H ^      ? K Ъ ╖ ║ ┘ ▐ у щ 2 ; U _ #STiov|ГИЛТУК_fГи╕┼╞╟╬╧╨∙ )67L№°ё№ш№т№т№т№█№штш№т№т№т№ш№ш№╫╙№т№╩№╙┴№╜╣╙╡╙╡╙╡╙╡№╣╜о█кдкдкЫдкha%*ha%*0J ha%*0Jha%* hа ch╬w$h+g╛h╬w$hЮ57h╟!]h╟!]0Jh╟!]hа c0Jh╟!]hбE hа chа c hа c0Jhа chа c0J h▒/#h▒/#h▒/#hа c=23  ? \ y Ъ Ы #КЛУй╢╖┴╫╪ёЄ···їЁ··ыыыы···ц··сссссссссgd╟!]gdЯ[╦gdа cgd▒/#gd▒/#gdа c:а<¤¤Є']ЙКХ╖с :hМ╞╧╨NOef╨╤┘┌т°····їїїїїїїїїїїЁЁЁыЁЁЁцЁссgdEjчgdЯ[╦gd▒/#gdа cgd+g╛gd╟!]LMNOef|Дйл└168=?EGHMЗИзм░╕╣║5:OГШ╧╨╤┌)*м╢╖─bcМНрс∙!78@ЇЁъцр▄╓▄╥╓▄╔▄╔▄╔▄╔└╥Ї╥└╥║│Ї╥║└╥║╥│╥плзлзгзгзУзПзПзПзЛлh1k h√'жjhаra0J<БOJQJUhB_Щh& УhEjчhЯ[╦ huhu hu0Jhuhu0Jhuh╘O0Jhu h╘O0Jh╘O h▒/#0Jh▒/# ha%*0Jha%*jhu0J<БU6°)*5WДн╓8kv{Я╠∙!8ABTUЦЧ(···їїїїїїїїїїїїїїїїЁыцс▄▄gd╙gd▒/#gdЭYgd▒/#gdа cgd& УgdEjч@ABTUЁ3:<CEKMSU]ckлм$q~ВФХЦъю56htvДаз░═Эе/7<D╢╖╬╓▀ь∙їёъёф▌┘╙┘╙┘╙┘╙┘╙┘╙┘╙┘╟┘├┐├╣├▓о├о├ококобобокоЭоФоФоФоЭоФоФh h╙0Jh h╩/Рh╙0Jh╩/Рh╙ hUdZh▒/# hUdZ0Jh1 №hUdZjhg;║0J<БU hg;║0Jhg;║ h▒/#h▒/# h▒/#0J hЭYhЭYh▒/#hu hа chEjч:()йкм н 3"4"Ы$Ь$╤%╥%щ%ъ%╚&╔&╤&ч&Ї&'+','7'Y'М'╡'▐'···········їЁЁЁыыыыццсссссgdКNgdЯ[╦gd V gdдgdЯ[╦gd╙ьS]█▄Ю к +!4!г!м!ъ!я!∙!"" """А"б"Ў"°"0%9%?%N%╤%╥%р%ш%щ%ъ%√% & &╚&╔&'*'+'╬*╧*╫*╪*┘*┌*█*▄*у*ф*·*√*№*¤* *№°№°№я№°№°№я№я№я№я№°№°№я№я№ычуы▀ч┘▀ч╥╬╩╬╩╞╬┬╩║╢░зЪзЪМЪзh !Пh╗U!CJmHnHujh !Пh╗U!CJUh !Пh╗U!CJ h !ПCJhlNjh╗U!UhЦ7╢hfzЩhКNh V hдhд hд0JhдhД╧hжI┘hЯ[╦h h╙0Jh h╙7▐' (8(o(М(Н(╕(╨( (()P)t)ж)╔)╘)┘)щ) *'*;*m*а*╬*╫*╪*┘*█*/+·························ЄщД^Дgd !П$a$gd╗U!gdКN *.+/+<+=+Ь+о+╡+╞+╟+m,~,:-;-■.P/X/`/040Ь1Э1е1ж1з1и1п1░1╞1╟1╚1╔1═1╬1╒1▌1·1√1о6п6▒6╕6ўюъцъ▌ъ╫╨ъ╫ъ╔ъ┼ъ┼ъ┼ъ┴ъ╣ъ╡мЯмЯСЯмЛмЕм╡┴}yph !Пh√!CJh√!jЦah√!U h3 ХCJ h +ИCJh !Пh3 ХCJmHnHujh !Пh3 ХCJUh !Пh3 ХCJh3 Хj )h3 ХUhfzЩh╞q: hдhYc) hYc)hYc) hYc)0JhYc)hYc)0Jh╛ЕhYc)h !Пh╗U!CJh !ПhЦ7╢CJ)/+<+=+:-;-C-Y-f-К-Э-Ю-й-╦-■-'.P.|.к.с.■.5/Q/Y/Д/Ь/╦/Ї/0·їїїЁЁЁЁЁЁЁЁЁЁЁЁЁЁЁыыЁЁЁЁЁЁgd╞q:gdYc)gdYc)gdYc)0B0t0Ч0в0з0╖0█0ї0 1;1n1Ь1е1з1и1·1√1D2E2M2c2p2Ф2з2и2│2·············Єэфэээ▀▀▀▀▀▀▀gdfzЩД^Дgd3 ХgdYc)$a$gdЭYgdYc)│2╒2313Z3Ж3┤3ы34>4Z4b4Н4е4╘4¤4%5K5}5а5л5░5└5ф5■56D6w6е6н6·····························gdfzЩн6о6░6▒6 77(7)707╓8╫8т8у89^9╬9:╧:я:8;▒;Я<а<б<·Є·щ·ф▀ф╫╫ф╥╩╩╩╩╚╚╚╚╚╞╩ & Fgd▒/#gdа c & Fgd %аgd+Pzgd▒/#Д^Дgd√!$a$gdЭYgdYc)╕6╣6╧6╨6╤6╥6╓6╫6▐6Ё6 77'7(7)7╫8с8т8^9Л9Т9╬9 9::╧:╨:я:Ё:8;9;▒;▓;а<б<ЄщЄ█Єщ╒щ╒щ╬╩╞╩┬╛║╛┬┤┬░йЯ░Я░Я░Я░Я░йjhТ9Щ0JU huhТ9ЩhТ9Щ h %а0Jh#&Ih▒/#h %аh√!h+Pz hYc)h√! h√!CJh !Пh√!CJmHnHuh !Пh√!CJjh !Пh√!CJU" 1Рh░╨/ ░р=!░"░#Ра$Ра%░ )DdШ:Ш:╚╚Ёd▓ Ё C Ё,A┴ draw_poly#"ё ┐`┐ЁАbЁG)Я(КЙё▒'г#█я╢r╗фз╚ш┐╡ї~{rк╕├╘фЎ√ЦY@шёkяL╧ШЪ▐iД╡╙у┼г╞з?Дл▌э┘вG│█╗fбGhыщ\╤З╣з>ЫCш╤e>?QЇib^ъ=&{╧·╬╝Ы·│=УБ╨#╤┌/4╛яы6ДЕ ┼|П╨├╖╗X i╤Ё=pK┼╨Ц╠B╪сbQК┼CВ╨Cї~╣(╔Є{#В╨├┤?QФfb▀М ЇэоеZёЩB╬╤lQ▓┘#cВ╨├r0^Фn№Э9Aш!┘_-*░ъ/ъ=нСв"#ЮИEшБ8Ь,*3щuДД╜чEЕЮ{б б`kби╘┬▒iAшM;Y.*╢|b\z│NЧК╩-ЭЪД▐дг: ╖tП╬ Їф;W:Bo╥iMЭ[╜#ЇцЬМ╡;13╜ ╟│EНf}╦Ж╨░√ви╒ пн"Ї┌╡Я5[s#BпYk▓и▌д7\z╜цЛ╠ЫД^з│вgб╫ч╝h╚╣╔Aшu╣Шh*ЇЙ гГ╨ыq2U4fъ─ь Ї:╛(Ї┬Ц3╜нХвQ+╛dCш╒[/╢nzz╒vЪю╝(vМBп╓╤xєбП{;бWъpб∙╬Лb┴r╜J!t^бWчcЭ┼GД╨л╥▄qЪxoДz5v╟Bщ╝(╞lCБ╨л▒NчE▒bЖzВ∙ ║┐ж#Ї╩\єЇ ■Ъ~iКz┘┬°¤W╛MGшеЫнєв1F╜\сu^цбЧщx*─╨зъА╨╦4bчE1jРzyо┬ь╝(оLB/╦╔\иб╧Э%Д^О╓ZиЭ┼ЪНеz9Ў├э╝(Ў═B/├i░ ўют¤╘0!Їс╡ЮЗ▄yQ<╖xGш├ zсnёО╨KЎ┬▌'я╜/Cя╝(^'Д>Ь`Х∙╒'єД╨Зq└6юПў╠;BF █;?╞Ў╧}A╛Ьz/м"ЇБ┤эы├╞ь6Г╨ї,Ц╬ЛтЩСBшГ╣\Н'ЇU[E"ЇБД■ьыя< Л╨┼Wш?┘Гб`o&о╨gЎLBя█b\Э┼╝йBш¤║ИшУ╕ >П╗0V╜?н'▒u^п|З╨√┘'q>ПCш╪НьУ╕ >Пsh:Bя╟HМЭ┼SГЕ╨{ў9║Oт■√<ю│╔Bш=Л`[Щ╗┘lбўl'╓╬Лb╟h!Ї▐┤Чу }╣m╢zO╢уэ╝(╢═BяE√─▌g▄#я╜є1w^#Ж б?.╓п╓╛єBя┴h▄Э┼ищBшП╣О╜єв╕6^¤aнёЗ■┬[l¤aЯтя▄M¤эhvr╚Шзf·C╬Rш╝(╬ B┐▀^╘╧╩№фйД■АИОfyШГ[·╜N&R }т─И!Ї{Lз╥yQ,1Д~╖╪~¤Хa·=&╙щ╝(V╠B┐╦EJЭЕу·]в▌(юn╢ПCшwHрmЦ▀y╖б эUjб┐2e¤Oйu^╞ б .Е╫S фuUД■ЗєЇ:/КsЖ╨╒ZH1Ї┐╥·п╛д╪yQ|1h¤з╓lЪб╧·ХО╨Jbй╗╪T б ╨К°░╡З-√ХО╨┐╗J╡s┐╥·щ■Bў+б Рь▀╨¤JGш?д№ ▌пtД■Ядб√ХО╨╗R¤¤;▀е#Ї█dК√╔уq=∙_шЮxGш╖Й╛╢Ў;/▒С}ш)╛З■з╞Н▄C▀I┐єв╪1odzr;┼▌┼юqdzr[┐▐═Ж░ф·Zбп8r¤kЭ┼WG╞бПц·иЙ#▀╨/sщ╝(.Н┘Ж╛СOшЫFО\C?Mш<Ї╟мЮЪ92 }>Я╬Лb▐╠Сgш╟9Е>qlш╚2Ї╫9u^o 9Ж╛;ЮWшу╗жО C?╦лєв╪6uфz{)╖╨Ч┌╞ОьBO°╨Ж√\;r =¤д■fO)▓ ¤ ┐╬Лт└▄СYшЩ╝Я·;oлТYш9v^ПмB_╔3ЇГGNбчЇ:╦п╝┌BVбПф┘yQМШ<Є }o.╫╨чЎМ┘Д■-╫╬Лт╠шСKш∙=¤·Уч`╔&Ї─DШу╥╔%Ї О[╗ЯГ╪╚$ЇLNg╣ПS[╚#Їl6s┐Ы-▐╔"Їг╝;/К#╙Gбg√░╠wЪ!Г╨є}Xц;═РAш┘mў7═Р|шнМЦ∙n╔N3д·╣╬Лт▄№Сxшпd^╧═iЗЮщ╬2zoI:ЇMСw8DЩдC╧ы\┼√9qСдC_╫° нЫ@╥ ╜=%ё ЫЄZ:щЖ■Eс▀}1В$║я╓~xeI5t▀н¤┬Yд║я╓~с6 ▌wk┐Є ЙЖю╗╡▀|3Дд║ў╓~ч6Т ▌{k╕1Е$zЦ'в?─iщ$·е▓ Ї┘Т\шє┬■╙╝1$╡╨w│▀Єos╗цР─B▀╫ї▀Ў═!ЙЕ>+ы┐═ЪC╥ =єє╓юу6╥ }E╘wY1Ид·╓кия▓║eI(tП╣▀├ЦR$║╟▄яуБw ¤F╤ўё└;щД■R╨ўyiI%Ї#=▀я╚,ТHш╧ф|┐gfС4Bo╧╚∙~3vx'Н╨?й∙!vx'Н╨ЯЛ∙!╬P&Й╨э8ё√OРBш#R~╪Иi$■╨╟е№░ёCуHЇб_)∙1W╞СшCw░тг╕HЇб√(оЧцС╚C╖∙k|Gфб√(о>О#Є╨}╫╟wш>КыЙПуИ:t┼ї╚╟q─║зтzфу8"▌Gq╜ў▓*ёЖю╒ЮyYХxCўВj╧ЦN┤б█+оЎО#╓╨э╫{╟iшЎКыЗ╜уИ4ЇsїЎ├Q─·[ёЎунб$╞╨OЬа┌Ч╒SIДб;A╡ONV%┬╨[c╥э╧ШУUЙ/Їw╩э╫;cItбп╖_╞Т╪B▀Ыn┐&Ў╠%СЕ╛п█■эЫK" }A╢¤[0Ч─·Еjё▐`Uшvy╚╝┴$ж╨m-3√>Uш_4;═SшkТ╠KУI<бЯ(vP'FУhBў>╦└╝┘B4б{Яep▐l!Ъ╨пї:╕k│I$бo╩upЫfУ8B▀ї>╦&v 'QД■ПZЗёПс$К╨Х<G(Eш╬gТ3[И!Ї╫R╬k╙I°б╖Цд:Ь%_е~шJЦM" ?Ї б╦&С║/╤ЗчлtВ▌Чш%ЁU:бЗюKЇ°*Э└Cў%z)|ХN╪б√╜o (!ЗюKЇr°*ЭаCў&zI╝ХN╚б{╜$▐J'р╨ч$ZО9╝nшW -╦'#J░б█╬╜4kFФPC?╤gyN╠(БЖ■MЮх∙fF 4ЇYyЦg╓Мfш╬D/╒Е!%╚╨ЭЙ^кCJИб╖g─YжЩ╢)%└╨o┤YоSJАбOJ│\+жФЁB▀│ЗT╔&ЎМ)┴Е■QЩe│гсЕnй╥=7жД·й.╦wjN ,ЇuYЦo▌ЬXш╦▓,▀▓9%м╨┐к▓ Г%м╨=■Z П┴TшнЖ╟` *ЇMV├c░Д·К$лс1X ▌кUq░*Еnў╫╩\UВ ▌юпХ▒,┴Д╛╡*╚кмnЩU ¤LП╒93л·Влє┬мFшЧjм╥g├Jб┐cХ^VB╜╡$╞*-╡L+Д■AЛ╒·`Z ЇE)Vk▐┤╥|шэq)Vk▄+l4║╫*ч6Ъ▌ЛkХ█0о4║╫кч6¤Улў╔╝╥pш/eX╜╖цХfC?ЎтZ VП ,НЖ╛п┬:ьX ▌Йk╡xe`i2t'о╒─)l4║╫jЄ═─╥`ш│м╟мЙе╣╨▀+░.ЧFЦ╞B&└║<3▓4║-'ъc√  ▌Ц5▓¤MЕюмф┘~ВЖBo9+╣F3╓ю4·Б·ъt`hi$ЇMё╒i╙╨╥DшЗsтл╙▄бйеБ╨╧╡WпSKбOJп^+жЦ·C╖Y\▌lGб█,оv╢Ог■╨▀ пnoН-uЗ╛g│╕┌нюЩ[j¤гюъўП╣ец╨╫dW┐5sK╜бoйол[ЧZC▀V]╢ .╡Ж■DtM░э3╡ЖnЫчЖ╪ЎЩ:C &╣f╪ЎЩ:C_Р\3^Ш\ъ ¤│тЪЄ┘шR[шo╫ФuгKmб;ае1Оlб╢╨╨╥ G╢PWшпх╓Ь╫fЧЪBУ[s╞╠.їД~б╢&]^j ¤й╪ЪЇ╘ЁRGшОVlЦуй%tG+6ьлщеЖ╨Gд╓м╙Kїб╖жд╓м)kwк¤ZiM╗6╛T·в╨Ъциt*▌бш═sT:ХЗ■Ng═{g~й8ЇiЩ5o╤№RmшэqЩ5o╝mАй4ЇХЕр└SiшЫ" ┴┤ж╩╨н▄├`эNебяh, ;&Ш C╖r─ж ж║╨█s ├Ь╡;╒Е~г░P▄a* }C`б╪0┬T·бХ{0ц═0Еnхkwк }E^с░vзв╨н▄CbэNEбЯл+$чЖШJB╖r╩К!жК╨н▄├bэN%б[╣╞┌Э*B╖rМ╡;Д~8!н░X╗SAшVю┴▒vз№╨н▄ГcэNщб[╣З╟┌Э╥C╖rР╡;eЗnх kwJ▌╩=D╓юФ║Х{Рм▌)7t+ў Y╗SjшЮsУ╡;еЖnх(kw╩ ▌╩=P╓юФ║Х{им▌)1t╗B╦СФ║¤▄ГeПHJ ▌╩=\╓юФ║Х{└м▌)+t+ўАY╗SRш╬P ЩsU))Ї5Еl╟0SJшЫb ┘жaжМ╨█уb ┘╕╡;eДnх8kw╩▌╩=p╙жЩсC╖rЭ╡;%Д~ад╨gЖ}ZHб│vgш╨[3B ▌L╦<3dшяt╛wцЩ!C_ФQ°═3├ЕnхkwЖ ¤ZE1╕6╨ ·╝Иb0oа&Ї╓ФИb0eэ╬0б╨P>ШhЖ}DBq1╤ zkIBqX▓vgЁ╨┐*(_Н4З■T@▒xfд8Ї1┼b╠H3hш·Й╟{3═Аб┐ЦO<^Ыi }Y>ёX6╙ ·еzbriи(Ї7тЙ╔C═@б╧К'&│ЖЪAB мЭ╕|6╒ ·║tтЄ═T3@ш/дЧжЪ■C?UNlNН5}З~&Ь╪Ьk·¤Йpbє╩X╙oш'║Й╧Й╣ж╧╨ўeЯ}sMЯб?ЧM|ЮЫk· }kU6ёY=6╪Ї·G╒─шг┴жп╨_К&F/ 6¤Д╛gхе╒=УMб_i&NW&Ы>BХLЬFM6╜З╛;!Щ8Mьmz¤Лbbї┼h╙sшУВЙ╒К╤ж╫╨н▄г5wh╢щ1Ї╜─ы╞l╙cшrЙ╫ж┘ж╖╨█уrЙ╫x█p╙SшjЙ┘Бсжз╨з┼│E├M/б╖f─│ЩЦщжЗ╨п╡╖k╙Mб╧K%n#жЫ╟CoMI%nS╓ю<·Wе─юлёц╤╨Я %v╧М7ПЖ>&Ф╪Нo ¤╜Nтў▐|єHшod┐7цЫGBЯХI№f═7З■Y%)°l└y0Їo"I┴7╬Гб┐I Юp ¤T#i81с<·╢D╥░m┬y tЗ%'┬╩<·ЦBR▒e─╣7tЗ%'├╩▄║├ТУсeю ▌a╔щpА2ўЖ■Iщ°d╞╣'tЗ%'d╥МswшО\K╔ДC╪╕;Їsuдф▄РsgшО\K╩Ж!чо╨█sтH╔ЬC╪╕+tGо%╞!l▄║#╫у6ю▌СkйqwДю╚╡ф8ДН┐CFj┬╞_б╖ЦДСЪ%kw■ ¤Bщ╣0чB уЯЯ╔"=п═╣╨ °чeYдg┘Ь ¤ў╝TEКф Ї▀ q])Z7шB НГТЇ┬а ¤WnH╘йI·/╬$С&9¤Wп$СжW&]ш?9╕!Yr·OnHЦГД■УГТх б ррЖt9╚Aш?8╕!ar·wУrHЧГД■7д╠AB ╧НRvc╪Е▐хрЖдmvбw┤╟┼Р▓q9╜├┴ Й{g┌Е■пE)д═AB WkJ iЫ▓м╨oo?(!uМ╗╨oЯ !uOН╗╨o╟ДР║1у.Їў:H▀{єЮ}шodР╛7ц=√╨geР╛єЮ{шG*╚┴СБ╧<Їo"╚┴ЩБ╧<Ї'"╚┴Яwш'╚Г═`є}_y╪7ёYЗ╛&Б<мЩ°ЬC╖¤k.lЫuшW ╚┼ХС╧8ЇQфb╘╚ч║э_єa3╪МC?7 ∙87є┘Жn√╫МlШ∙\Co╧ |╠┘ 6╫╨m ЪХCЯiш╢═К═`3 ╜5c°s2c3╪иHAя?&╫ДЮеСфхй╨│tmЇєЄAшYЄ"S^fZB╧╙┤с╧╔ву2e│См=S╢╦Ig√0бч╔Жащl*Ї<┘т;#чB╧╓оC;▓1▒+Ї|9Ж+▌c╕ДЮ)kfуJш;vTv&VПЕЮ│5 фaэVш9█Ч@ЎЕЮ╡ фсDшy{вБ<╣z▐╛Й ▀ДЮ╣#фрHш╣│╙w╛яэ-Ї|╜СA·▐={Nу╩└{бgпх|═фН╡ДО│УўуМlбgьГRўAш╪ 6y3-бs{╗(Е┤-▐ Ы┴&я@ш▄┌ 6uуmб╙a3╪дm▄ ЭЫ┴&эFшt┌ 6aЗBч &хРо╔[бєЯфРоOBч?{6ГM╓ъЮ╨∙юе RїЄVш|ўQй·(t~╪Dк╢Д╬OпСжW╖Bчз3Iдi[ш№тTi::┐Z╨DК^▄ Э_нЛ"EыBч7ЧвH╤е╨∙MkYщYn Э▀=УEz^▀ Э▀}ХEz.Д╬ZS║H═RKш№iDй╣:║FjоЕ╬_┌rH╠LKш№mZiЩ╛:█СFZД╬фРЦ╣╢╨╣ЛГТ▓q+tют ЗдЬ Э;э:╚!!╗BчnгЄH╟шн╨╣ЫГЄIш▄├Aщ°эрбє9$ухн╨╣ПГТёQш▄╦A╔╪:ўsРC"Ю▀ Э√mK$ █BчrH─й╨y╚ Ндр┼н╨yИГТЁMш<ш│HRЁYш<и5лТ°═▐ ЭЗ╜ЦI№▐ЭG╝ЧI№▐ ЭG┤╞t╗▒Ц╨y╠Sб─ю┘н╨yМC╪вўUш<╩!l▒Ыj Э╟═K%nє╖BчqaЛ▄╡╨щБC╪т6╙:╜p[╘жoЕN/┬╡б╙З░┼lо-tzу╢Иm▄ Э▐8Д-b7BзGЗaЛ╓─б╨щ╒д`b5y+tzїE0▒·"tz╢ы╢Hню Э▐╜ХLЬ▐▐ Э▐]I&NWBз╟╓юQ║є░dбsп5╤─шхн╨щЗФгЇQшЇ┼╩Q┌:¤yоЪ°<┐:¤qАrД╢ЕNЯNdЯб╙п'║Й═У╟юй╨∙╦Щpbs&t·v$Ь╪Ь Э■-('./╜еBчoы╥Й╦║╨└gщ─х│╨@kV;1Щ}№Ц Э;╝OL▐ЭБ╝OL.Е╬@Z╦ъЙ╟rKш цЩ|тё║З*tюr!Яx\Э╡╞ЇЛ▒VюBчnOЛз╜▄OбsзпК┼Wб3░╓ФВт░╘╦╩]ш▄cDBqщщv Э╗}РP>Э!X╗╟aкзХ╗╨╣╧╝Иb0▀█▌:ў╕Q оЕ╬PZ3* ▀Lo+wбsпEЕo▒╟Ы)tюєNFс{'tЖ╘╫Qш╞█BgX╙B ▌tпўRш▄ы@Hб;:C│v]╧+wбєАM)Еm│ч[)tю╖#е░эЭ┤ч┤▓╣ЮWюBч!b Yя+wбєР1ЕмўХ╗╨y╚б╡{└цЕN9м▌╢╤╟Н:▒v╪Н╨)Й╡{╕·Y╣ ЭЗн*T¤м▄Е╬├╬к~VюBчaЗК ╙D?+wбєkў@нЇuЕ╬├м▌u.tJdэж■VюBч1╓юAъoх.tcэд■VюBч1╓ю!ъsх.teэа>WюBчQ╓юъsх.teэЮ~WюBчq╓ю┴щwх.tgэЬ~WюBчq╓юбщ{х.tz`эШ╛WюBз╓юБщ{х.tz`эЦ■WюBз╓юAщх.tzaэФ■WюBз╓ю!Щых.tzbэРНnа╨щЕ¤▌r3└ :╜░┐{8Y╣ Э▐8Ы)Гм▄ЕNoм▌Г1╚╩]шЇ╞┌=н▄ЕNПм▌▒9╨э:╜┘СXvДNЕ┌╓юAo Э*mК,Гн▄ЕNпDВбSйЎ╕╩Ъ7р╩]шЇlZf═ЫЁц Э^╜УYє▐ ЭК╡gt╓┤ЩWюBзwЛBk┌таўNшЇьZhM╗:ХkM)нYS-бS╜yй5kdр['tzўAj═· tj╨Z╥ZУЦ^╣ Э~<[УЮ~чДN╛КнIBзн1╡5glЁХ╗╨щ╦3╣5чї7NшЇу╜▄Ъє^ш╘д╡м╖ж,▒r:¤y#╕ж╝ц╛ Э╛|\S> Э·,(о C▌6б╙ЯoТk╞7бSгS╔5уTш╘щЙцЪЁd╕╗&t·┤-║&l ЭZmЙо [Bз^╧UW┐╡!oЪ╨щ╫G┘╒яг╨й┘ёкюъ╢z,tъЎVxu{;ь=:}√$╝║}:╡█ЭP^╜&vЕN¤&еWп╔бoЩ╨щ▀╣Їъu.tp8з╜:═ Э&lКпNЫ├▀1б3Аё╒щ@ш4┬Qщu°Ptб3$╟-╓h╛Д&tс╕┼}(сЖ ЭA8n▒>KнnШ╨И#[jємМ√%tт╚Ц┌\ Э╞┤fXП┘2VюBg@ым╟z)╖Kш цHВї8-хv Э┘Ў╣п╩╣[Bg@√"м├╛╨i╘Цнуj0ЇfqBgH/eX╜Ч%▌,б3и+VяSI7Kш ╩╓q╒~│8б3м!Vmем{%tv#─кэЭ╞╡╟ХXнёvYўJш nQК╒Z,эV Э┴┘~вbJ╗UBgp╢ЯиV)[NЭб┘~вRп╦╗SBgЧbм╥eywJш cAН╒Y(ёF ЭaЬ╔▒:gB''rм╬Й╨ ┼Ъл▓Vц}:Cё [eоДN0╝┬VХ╥^\:%Ё [EVJ╜MBg8;Тм╞Nй╖Iш ╟ ╩╒ШiЧzЫД╬РЬа\Й∙rяТ╨╥WQVсл╨ JkYХх[nХ{ЧД╬░Ь┬VБїТoТ╨ЦS╪*pZЄM:C{е╦▓╜*√ Эб}f┘> Эрь9Енdл{B'<У╥,╫dщ╖Hш ╧I%╗:rТC╣╞█е▀"бSП┴Цjд№;$tJp!╬2]Э y ╢Le?■*t╩ЄMЮх∙V┴ :e8СgyNДNиь[Ъ╡*юП╨)Е▌`KєIш╦n░e)wўWбSоMЙЦc│Т█#t╩ёNвх╕:k-i┤ KнJnП╨)╔kСЦсu5wGшФ─ОRе8:a│гT ^UtsДNYь(UВДNрЎ|Х>┤Й╜КnО╨)═ЖPЗ╡Q╒╜:е9ъ░▐ Эр╡жФ:ЬйVUўFшФ╟WщCz]┘н:х∙,╒с|:1ЁU·P^UwgДNЙ■ы0■йю╬Эy+}╒╝Й.t╩члЇ!lVxcДNЩ╝Х>Ды oМ╨)SkLпГkUxcДNй▐vPыU▐бSкS┴ъTш─├яzYщm:х·$┘┴|:9tV·@╞ЕNLЬХ>Р∙jяК╨)Щ│╥rQэ]:%k-и╢ нjяК╨)█╢l√╖_ёM:e;^╒m┐Vў*╛)Bзt+┬э╫J╒ўDшФ╬Ы-}{Wї=:еs▐b┐ЦZU▀бS╛uщЎg╜Є["t╩w"▌■ЬЭ╜╒n?▐VGДN╬┼█ПбеЎМz{7╙:qz&▀▐=лсЖЭ*8│еGB'V╧ї█лчu▄бS ═ЇьУ╨ЙЦНfzUё╓2BзR#ю═H-╖CшTуR┬╜╣:1sДrO^╒s7ДNEоD▄Л+б╡├9?nю░Ю╗!tкb▀ч╠╫t3ДNU▐╦°qЧ5▌ бSЩ':~╠л║юЕ╨йМПуuU╫╜:Хёt▄c╞ы║Bз:ЮО{─Hm╖BшT╟╙qП╕мэVЭ y:юA╧ы╗BзB^V}╨з·юД╨й╨б╜у0sX▀Э:U▓w▄Ю╒x#ДNХОф|┐гoД╨й╘K=▀чeЭўAшTъF╨ў╣йє>ЭJ╡з}╖еvЭўAшT╦╔кўXпї6Эjmнj·.л[B'%+в╛╦J╜wAшTьZ╘w╣:Ii═к·o│-бУЦ}Y m┐цЫ tк╢k;╪┐╠э Э╘╪Ў/єu▀бS9√O№х▓ю{ tкч░Ї?м╒~ ДNї╬е¤╗sбУ ╝ о▐╟▄ЕN]<Ё■Ыї·яА╨й┴▒▐▒z,t╥┤)яЯ6╕BзЄ■щBш$кх└┼Ю4qДN-ьЁ■├бУ,▀░}7╒nт· Эz°Жэ?ыН\~бS[J¤_═[H ЭЪ∙Жнk│Щл/tjт╢оЛfо╛╨йЛ3Ф їкбЛ/tът╢вЙў╓ДN╜┌K:_j7tёЕNm╬Д~╓╘╡:╡┘Ы╚╜є╣=бУ╛ьwЙЬoь╥ Э·х·С╨╔┴h▐ЭП6wхЕNН2?Зэ║╣+/tj╘zСsч/Z═]yбSзм_K ╘рЕ:u╩∙╡ЇйvГ^ш╘ъ[╛бkЄ║ ЭZэe{┤js╦Э·Нф·HгЧ]ш╘ы4╙╬WOЕNNVЄ }е┘л.tjЦщN3═^uбS╖,OK▐ЁE:u█╔1ЇбУЩ╓l~Э╧╢╛шBзvW∙Е~╒Ї5:╡╦я9╪FЯ~: ╔nє╕│╞/╣╨й▀юx^ЭПя Э╜╬+Ї╫═_qб╙АумЎГЭ8:y╩j?╪∙.╕╨i┬iFЗ(7№:Л╨i╨F>бoДp╜ЕN#.є ¤Rшф+Ы-▐GГ╕▄Bз_s ¤л╨╔┘ZЭпЕq╡ЕNC▐х·uW[ш4дї$З╬_5¤~к╨iXP4╜сД╨iZ▒╜ф║╨i╬y·бЯЗrнЕNc╥▀SкёдДN╛д·Ч`.╡╨iNk9э╬ЧГ∙Е.tЪФ°qщЯ┬╣╥BзAi Jш║╨iT╥;?Ї ]ш4кЭЁпЇх╞ўx:бH°WzH┐╨ЕN│╥¤Х╘/tб╙░d?xъ║╨iXк╝ЗЇС╗╨i^вП╟ЕєPЬ╨ AЪO╝ЗєФ╗╨ CТ/▒є┌Ъ╨ DКяеє║╨ FВ[═ДvНЕNуZпRы<ФЭтДNHоS =Рн_ЕNX^ж╒∙╦Ёо░╨ └EZб_ю2ЩRчУ^`бВ╧ ЭЧ╛·Yшp╖щtBЯё· Э ЬLд╥∙─Й╨с>╧R ¤YРЧWшДao<Н╬╟ўДў;K#Ї│0по╨ ─сR Э/ Т─жRam %t┬У┬ык┴╜Ю*tВУ└╗-с╜═"tВє6Ў╬GГ╜┤B'▒?ф├пB'8єqЗ>юХ:9О·йЩёcбC/в~jf;р +tBєQla╢&tBvoш;!_WбФV┤█╟╜ їYбаX┐b °л5баС8CЎU:Б┘ЫЙ▒єЩ0_C:┴·'╞╨п┐иB'4н'ёu■$шOтДNИ"<╬!└#ДNшcы|1°K*t┬█чqб't┬tхУ8бУ╛╕NLя4tбЗ╦ИЮП[╜МрВ Э EtpKШG│ЭО┼╥∙Xа;╣ Э─·AЧSшj%О╬7т╕ЪB'PqьЄ>qB'Q|Щ┴WшB'h1l6Ў╢2B'зsбw>w╦╡:с┌=Ї¤h.е╨ Wыy╪Э?Пeс.tВv4rчGё\Iб▓аяё,▄ЕN╪Zkсv╛╧┬]ш.▄O▐у∙─]шД/╪=acyTFш─а5fчг1-▄ЕNЁОГ▄@n&Тg▄ЕN,vB =шгSЕNМц├ы|>╢k(tВw8Zч│Qь*#tтr╪r1l)tвє1м╨?╞wЕNZУ!u>╫7kB'{m ;■LB'R┴Ьш░№╔йB'^┴╝╟с_╨ЕN4Zat╛с_╨ЕN<┬°6}!║o╨ЕN\Оxcu.вMeДNЬxш=╢G▄ЕNД╓Ыю|=┌K'tт╤Їs31>)#tт│╗╨шq╗ё^9бУУwбШ:Й°┬ Эи|mьE╢Йп1_7бЧєжB?П·▓ Э╚|kжє│╕пЪ╨ЙLлСЭецу¤└]ш─Yz_▓E№┼Ъ╨Й╘aэЗм>ПЇ wб│▌їv■"т/╨ЕN╝ОЧыь|9▓├ДN*Nj▄Zjь$Б &tвt║TWчKQЭЪ*t╥r4UOчS▒╛Б.tФЮ[чB'▐╥kX╜/%╥╣╨Й╫iхЯ╜/'ёўsб╖нЕj;_╪JцR ЭИэ╜к▓єW1╔"tt8Z]чг╤?ў*tRQ▌╗l#▒┐╟"tR*}╗Ъ╬╖Уъ\шDяаВГ╞╗HB'zЯK?мi6Хп╧ЕNBvK▐Кb%■╫RЕNВZ█%Я╛Ъ╪_╧ЕN:.J{Jn∙"┼ы#t╥░╗XNчЛщ-█ЕNJvJxЭm*┌уRЕN.ЎЖ■е╛Ш╨CпB'YЖz╦eсC║WFшдд╜?>Ё32√эД/М╨I╦▐╙БОaЬxЪьк]ш$щd╛я/╒WчO┐(B'┴╘ЯЎї°√▄╙╘3:i┌▌ю∙Ъхэ4┐9:9h}Шюс╫·▄ЇЗЯw:99╝ЩЮyиЄЩщЫФ6С:┘j╜?╜3ЎЩ╤│ўy№.:Щ─╛u░=?·dl|╡(V╟╟ЮМ╬olхy╟ t╫ВП╝ OIENDоB`ВЧ7DdШ:Ш:░░ЁX▓ Ё C Ё4A┴ draw_sin_lineЁАbЁы6└гЕ.╫г_PNгюД{м  ╟6C*ЪnЁ┐6└гЕ.╫г_PNгюД{м  ЙPNG  IHDRшшz}$╓sRGBо╬щ├PLTE┐┐┐╤╤╤┴┴┴╧╧╧╪╪╪┬┬┬├├├┘┘┘╟╟╟╩╩╩╠╠╠╦╦╦╞╞╞▐▐▐╨╨╨┌┌┌└└└╒╒╒┼┼┼╥╥╥╚╚╚▀▀▀╬╬╬═══───╘╘╘╙╙╙╔╔╔╓╓╓╫╫╫▌▌▌▄▄▄███°°°ффф√√√цццЄЄЄтттъъъёёёЎЎЎ···¤¤¤■■■єєєьььчччрррЇЇЇїїїэээыыыщщщшшшууу№№№ўўўяяяЁЁЁ∙∙∙юююсссххх   Єв├Т5ЩIDATx┌э▌g[у║ЖaбЖ>ЇбЕШzЗ  л╢д└└░Cт╪Ц╡$=ўз}о3├Дe╜ЙbKKяС╪▌м tQ▄█НеИ╧@┐e}h Еб¤:#▌S╒сп0П Н7NЪI╥▓;9u┘√П_NM~F¤КиГа{тt·#╖╙╫)sЫ\╬єз∙оВюГУЩ┘vfч·∙ksэ┐5;├xtщТЫ∙ПШ_Ў√W[QЯ┐a■В.┌юЯП°AЦ┐}Ё1ч ├t╣Т█ЎгёЕыМЯ╔╔їB√б√-#]иz{ю]Ylf ═┼ЎВ┘9╛йГаЛt▄^№▓tЩя╟┤Ц█ЛlО$ шт$wцf{х0ўЭ┤ф╨|и╧▐qO]Ш√Ў┤╜╓*тЗ╡┌ыmцю' шТ4┌╤ЬiєуЪ3э╖Н ║П+ц^∙Qq?ё╚▄┐_ybдАаKqn╛ЮП7К№ЩЧfWLЕчl ш2$ЛfЮ╜ZЁ7ъ√Uєc/╕%В.!чU╚┼┬∙ё2J╥A╨ЭkоЩ)ЎННЯ}kЮ│н5}л Z╨ыfy·ИеЫfПцЦ▄4П┘@╨▌ц▄,c╗┤їє[ж%┼2ыaA╨:1mа╓-n6█]7эиN1 ш╬r^│Я┬Ў{IНдГа;═∙Тхyu}Й╧ttwъц│v╚·Э▓{╙OnВящ ш▄/ХУє╧д/qя╜t═щ▓r■ЩЇAЮзГаЧ,Y-є╣W√)▐*kф@╨╦═∙и╣^┌ўцЎ}?V├ВаЧ╩,C_.я|6╧╙/8 шх┘7╟-Х┌т┴мС;gфАаЧхJя?iХ√П╢Ї║ў┘ЖzЙСлФ▐№хйтрэИ5ш╧жнєQ∙ ЁС┘@є,п"@xAoЪG]З.■щC│pЖ╟щ ш╓%юt╡ъmЄР ▌6єй:э(kэхxЗ▓*Дts├}▌┘У¤8}ЎКёВnSC▀p╣tў.ї Xi╚й^╨яk╬?P╧╠┌[v▓Ба[╙╛ўъЎE╝ъ╫░┴ 9t[Ў$ь!kяЫ{cБа█qмo─Н;Я5╫ї ╣╩c▌Ж╜"n°╥¤ i ыr┤ЦA╖ 1G▓▄Hx)7ц╛жГая╬А.у╡Шу╙яE шE;╨_╨'Дм3oъ┤ХSЖz▒юї░1 U·k·:O╙A╨Л╡)ц zЫ∙Ъ^eБаЮлQIпиъhS<n╨F─═Ф█▀%v%╜$└яа'╙я}Щ╗Г╙ЇЬЇщйыA╢iH°HA `>╨э╥└G:·Зj░ш|дГа ∙¤у#Эя шб▐ro3щ─Ї°V┐~╣тlU─ЇЭшV┐~1ы`w}?шїс░DяNЯн:╠й-?шz}╪|┤нП═Al╤н D|AO╞т>ЯHпЄc╤ B·M4═▄;3√ЎшЛ╨Г╛м╞y5ц┬WY4ГЁГяbЩO-Ъ╟!№а╧┼╗XцУn╗┴D╚A▀Нx▒╠з│H╖Ї ваыНЪыС▀sN╓c9D▒▌tЦЙ╛їВn╗▒┬!╩7шz]╪HЇ═ФюG8D!▌мЇ▐жЎ█к 5═ ╘а┐░w╦0√ўй ·╗▒┐ ╤УИ+ш|Р}xdjГpГ╬W╙OцfEДmpC╨╣┘№eЯ│j╨▀▄Щ╝щ!└а'5жл_°Г@Г╬ ияЇ╢'ъАрВ╛╩#еяЇ╢9╩А╨ВnЎн╜PўO/ьaCИAЯК╕╔s'fзе#░аЫюз{Ф¤╦^╘▌ph╨oщg■ГщoCT╨їк3T¤╗║D"┤аЯF▀Є LЧ╚SъААВ>к╞Ї4E ╫Р*╩(e@8A7▀G9╡рЗ#ю[ ма▀й!=╔│╡ЪУ<Й@HAчЩqgЛЇ─EHAgXg╗tт@HA_еЕ╘яЕa┴; :\┐1SЭИПЦEPAчлшo╠═Л ъАВЮшЫ╦wT╝¤8bМў@ДЇk5Ш+<.юшдвКsF@╨╒XоRЁ╬6Uq■P°ЇЖ^╥}@┴;;╓╒б┴№║>)yВz "Щр eДt╙qВ╞╞┐zг B· '%wu╧~ДЇi:Nt╟^ЇK║+Ї`zr4и╝·6¤ТzYц°Їж>cьЬjwsо╧дуv|:╖тz3з╠╥>]╖E█б╪▌═p;~¤Тцп)p;ЮЭ[qйp;^Э[qщЬ│:>Э[qщШ█qмОГпAgU\J▄ОГ╟Ao░*.еS6л┬▀аы#╤ЧйtlVЕ╖AO╪аЪ┌G┘└╫аы^q├▄КK┼NGя8°Ї?Ъ^UkН2└┐аЫcО)t:╟ЬZ?Г~бЖnНпЭ)%ухГЮМq&p?ЇQ ╝/┬╖аыc┼*'╘9-sФ├ uАgAЯSуvГ2S0t>а·┼ЭпЬ¤тж№ zRу&r┐Їщ╥5╩ЯВ~└cс╛=╠rH< ·(ЗДЎoР]╜Ё+шtR╚тHўща╤ № ·-н╩30Э╖nй╝ ║n-│MН√╡Cг°Ї]Ю3б╤ ╝ ·"нe▓╤Нf)№║Y·ёFЙ√з═М▒╠~¤J/цмSт■╒Y8 В╬ЎМ╠6(| :K┘╜0В/AчЛfv▄▐А7A_ц╓qv<░А'Aoё08│сТ:@|╨╖Y▐Х╟G(├ЗаЫєYX░ЭЩ9BЩ;РЇ3╬g╔хЮ3[рC╨W╒8нR▐ьЇЩ-лФ▓Г~в█дш4Е╠KЯe5A 9шХ-}ў 6ш▄+.Оy~ёH 0шЫЇ$/+ 4шмч*k !4шм╨.Т┘5pC .шГЬЙ^$╜pР2@Z╨wuйSъZ}V·ь3uА░акБYгм┼W=д Їу▓X╝sB`╨═LsЧ▓╟|вгdЭ{GЕгг─=ЩдЗT╤ЇсLУ<пДда_▒╛гpf╥ uАааoи1╣IQЛEQ!,ш|°╪└4 ┬В~╦╫I hЮ aAg∙л<╩Аиа?│№╒ Ц┴BT╨яX─eEвЧ┴▐Q ·╦_эxх`U╚ ║щ■╩ЄW ╠┴кЧ╘"В>┼к╢ ╤ RВn║┐ЮSQЎ9√RВ■DўWk8═bВ>╩┘ЯЎмкт╬P╕zsEН┼k j╟╡*юJУ:└y╨К65GTy╧иЬ]O.Gйз-|1ВИаs╗╚.║ВИаЯsаU<╝ДИаы╬fSФ╙Ю-╢░┴}╨щUj[Л-lpt6оYWc ЬЭНk╓щ-l╦Ф.Г╬╞5√╠╢uА├а/к18D1эb =YWcpЯb┌їжК╝╬L╕ ·Б^═qB1э:╤O6иЬ}GН└5ji█Mvс2шжё° ╡┤эЖ╢∙pЇО)Е9чС:└Q╨лV} [Х2└M╨═^щ+Ji▀Щ*Ї{■с&шG║х_K@8 :¤╠JC√ 8 :-'╩c:эr█.ВN╦ЙЄШЎЬа A╫g%oQ╚rшЎ(╩:g%Ч╔Ьа╠bcФЇ=5Ї╞Щ╣Ч─lzг(=шKjф]P╟▓░!NВN;Дr╤тNВ~HГгr╤┤ .В>A╦┬rщw╓ ╩АrГ╬L▓l╗|WB∙Aч▐PщЖ╕√Й▓Г╬╙ЮЄ╜ё<eЭїх;aЕ╩:+2`═1J:{,\`J·Зv;`ЎSФt▌цyХЦMw·╪б (+шж═є5,Ыn√<╧▄eЭ6╧n╨Ўе]w0█аДх╙mЯG)╩ ║щIzF ╦wM▀]ФЇ+║М;B'}ФЇM╬ qЕ│qPZ╨═╟╩ tБ╔J ·5yЬI8▓e}ОZ▄сБJ ║yШ╦-О<▓Дх]/╧ЪdцюH2╔вDФt╜рzЫ·╣┬6Фt╢P╣u╠qЛ(#ш╖lКvКV(%шhsт╓╢║kФvГ^╫Н╦(Я;4¤А¤аыvF ╠▄J╘%8з░t▌аpКъ╣4EcN╪║i9▄вz.╤j╓Г╛паxNЩ├3Ўй,}ZН▒EКчЦ>kР2└^╨Яї╠¤Тт╣╒bю╗A▀SCмFэ\чр;X :zКp┴Q╢░tОшЦAN?√L`)ш╠▄Еий ▒G`)шKj|╜R:ўШ╗├b╨Щ╣K╤╨WbЧ:└J╨я╘шЪаrLиKqG`%шzц~Hх$xUЧbЙ2└F╨Ї|ёБ╩I└▄╓В~и╞╓2ЕУБ╣;l}ЩЩ╗╝ы┬R╨Щ╣KЄ└▄vВ╬gИ(╦╠▌a%шМ,Qx▀ЕХа3sЧЕы+AчDюН┬F╨Щ╣ ├;/,Э╗╝╥0wЗЕа▓цRцю(>ш╠▄┼aюО┬Г╬╠]цю(<ш╠▄bюОвГ╬╠] цю(8ш╠▄%bюОВГ╬╠]$цю(6ш╠▄EbюОBГ╬╠]&о :3wбШiб╚а3ЮДтЭ╗╗R1wGБAчЮПX╠╡P\╨yК#swЇ]fюb1wGaA┐cц.¤▌QT╨9ЙI0╬fBAAgц.g3бааsЖкhzю╛GР;шCj$╜R/йЇ▄}И2 o╨Яї▄░A╜д╥sў┘gъАЬA▀SйF╣фкй ЇFР3шzц~A╣ф║PhЪ2 _╨Яg╒8║д\r]ъ╣√ u@оа┐1sЧnЬ╣;r}ЪЩ╗tЛъ Rф · 3wёZ╠▌С7ш√jНS,┘Ї▄}Я2 G╨╒ZдX▓щ╣√╩АьA73ў┼ТэT╧▌ы╘ЩГ~оЖ╨zB▒dK╓╒e:з╚Ї?jMQ+щж╘eZг ╚ЇzEНаSj%▌Б║Lцю╚Ї[5АШ╣ЛЧ,и uKР1шkj№lQ*∙╢╘ЕZе ╚Ї{=s?аTЄы╣√=u@жа▀ис3╞╠▌╔Ш║TG╘ЩВ>зF╧6ХЄ┴О║TsФYВ~?мF╧1ХЄ┴У║T├╠▌С%шGjЁL2sўB2й.╓5u@Жаoи▒│Cб№0г.╓e@ AoОи▒єHб№Ёи.╓HУ:аяаЯйб3╧╠▌╔╝║\g╘}}SНЬQъфЛQu╣кФ¤╜╣вF╬ uЄ┼Х║\+L└╨o╨8~сНЩВ╬T╨3|╒BЖаss╟7▄<╢м.▐e@Ка/й▒rHБ№─¤д :wn}╓рЙ ╥Эg▒^л▒йВоWW]P_▒кйВ╬zi┐Щ} uъАAgФ▀╪yИTA_cO│▀жш%А▐AзKЙяшДAзяШяL┐┐#ъАоAЯгУияvшрЛ^Aoъ▐рOT╟gж'?зiб[╨п9й╧{ЬПЙЮA╫gя╬P┐щп7)~║9СєЕт°эE]─жe°=ш С4Wx╗F╫аыI_Х┌°О/`шtnуДБ[кшt╠ДБЗдшtK╦Ю╨%ш,Ю  Щ╤%шlЗЕ┘ЪtJ╨1шlp (уўа╙▓ ║}╚8e@за_rXr0LC░KъАA┐ан`8ж9Д ┐}ВF┴с╪SsВ2р A7Gо╤·?ц╢ъА ]╣╢D]B▒─!lшtО\ ╩!З░бS╨ЯЩыЕC╪╨1ш╣}█>e ш?■ў GоЕЕC╪╨!шuО\ З░бC╨o9r-0ц╢[ъ@╨ ┴Сk┴┘RЧtХ2Їяю9r-8╟║_╗О ·wGt*N2й.ъ5u ш▀lи1▒CQ┬вa█а ¤Л9╕сСвДхQ]╘z}Ї/WЇPвr╕в¤/}p├(5 MХ╦КяA77Ё╓Ь3&j°t╛╠Е╔▄zс В■Й█│Бт | :7ДКх°tn╒=9Їп фрЖ`▒ЕБа¤'7ЛГ·▀ трЖpqРA √_▄0r шЯ8╕!`ф@╨?ШГv)HШv╣║╜НГВ╢м.яe шяC▄▓Wr ш┌│╛/█абjЁLЕаk√▄6r ш┌5)G╕ЇA(CьAпW8╕!lзz'9─Ї5 ╪▀░dA]тъy╨W╒(╪в!█VЧxО2─Їц░╟T#dO· ·┼Їk5&Щ╣═t<гQ}SНБК6▌у╖Jb║щ№¤B1┬ж╗Ўп0mЛ9ш/┤НчЁDЇ56йEш69Y/юаs▐f╕хy╨9A;ў·!ъuИ6ш[ъ·пRКЁ▒,*ъа'║¤ы-е▀н║╨ыФ!╓а╖ЇVe╢;Dа>╦╓еИГN√╫h кK}A" zНЎп▒xгl╝A7э_ЯйD Юї╡~аQ¤РЎпёXR√О2Dtо}Dik╨Щ═┼─4Гх{ZМAч■LThk╨yтЪ┴╞t╓PDеE3╪HГоWE▓г)4ГН8шьsИ╚═`г :э_#rL3╪XГN/ВШШ.#4ГН1ш┤Н }├b :э_гЄB3╪8Г╬EПЛi╦Ы{T▐Щ╞EЗ╙:в3301ЁrJтB3╪╪Ш░Ф!6ўЬи¤HХа╟Зf░С┘"шQ║e┘sT╠▓gВЪ┴╞┼ld"шbkrT╠╓dВ!ЪНD┼4!шв}XL┌э├zМhСvCPВы╡з┼w$┌яъ=F4ГН╟╟ў4В%Ъ┴Fуу╬+AПkFууY*AПGe╟тsuAПR▓о. -uЯYя№N╨cеў9мRЖЁ}ю`"шq2═`яйCш╠ЮфВ-╙ЛрЪ:ДюoЧВ)Ъ┴FAў █y'шёвl L'╨GВ▒dЕf░с√z;'ш▒вlF╒Eо╛ЇШ╤ 6|╔№▀є╖zмЪ4Г ▐╙╫ЙЪ=Z4Г ▐Ў╫┘=Z7j,0wШi zC╨#Wп╨ 6lз║¤kЭа╟юПЛФ!\ж¤ы;AП▌╛5╩ояэEz╝ЮїVхuХivB╨1дF┬!eU╗¤+A╟═`C╢№╜й7AП╪ГnJ3╪@э■sLAП┘Д oФ!L{ ╝E╨cF3╪АMлЛ√J╨ё■╤ ЎД:ДшD?S╣$ш╨t3╪s╩вsui╟▀ :┤)5╓(CИ╓╘еЭ"ш0ЇjhЪ┴ш╛Є╤■Хау¤=S├сИ:ДчH]╪▒ДагmGНЗ ╩Ю9ua╖▀ :┌╒xiRЗ╨ШЎпOLW▒+ъЪ3uYчВОOU5"F)CЁЧХаGюъч[?`║Ў_t№їuЦ┬ё [/=vЯзs! ШB╨cўєБ+№╫см\В╗ЯKир┐  zЇ~,КЖ ╢╘%]}'ш°NosZз IЇж─[ВО№╪╕ яЩ6uВО кqqA┬╤йqA╟█?═┼р╜ZЗVА╧ ┤ ЕяЭЪ√t╝/}o▀vj╫O╨╤yd└W▀╖ :8╚!(╗┐ЙtpРCPЎ:▐[%шр ЗаLw|ZJ╨┴A!∙e¤A╟;9ф╟┴ ▀pРC0~┘гD╨ё╬Aсиы]╟зqРC(n~щ#B╨бщ▐CsФ┴?n ш°юIНПarЁ^s°╟┴ ▀ЩГ╬иГяоы▐M╨aМкRе ╛█TЧqцЭау7· ЗЪ┴zойnx!ш°}ИМ№6DрП¤v▌$ш°▌пУ>°C█|'ш°▌5З░yп╦-UВО╢_╠└]Тt|°mй╝╤e┘A╟ЗaєЬY╚|C╨╤UЭC╪<╫mkA╟з?┬ц╖nЫН :>qЫ▀ТnэC:>qЫ▀║6#ш°kЪC╪|╢╪н┼'A╟_·╢eЁUн[╙nВО┐╠!l ър'}ф┌ь3AGo·0ЯC╩рзWuёЖ▐ :z╗SceЩ2°i╣ыQЩ_╠!l╗╘┴G╗▌пA╟7·╢=╩рг│1ВОo║╧Г`Cъ╥╜tдr┘ї╬-фzЮэ■─Дау╗q5\Ў)ГzнБ ш°nСФ¤4и.▄"AGJf╜tЭ:°╞ьShtдФpА▓Чzю<$ш°╟(√иg/ВОpА▓Пzw"ш°G╖╛cРкw┐?ВОmsА▓V{vЁ%ш°Чщ ╬▄▌+ў║' 1AGТI5hойГOО╘%ЫL:·1гF═eЁ╔Ж║d;я¤xTгfдI№aN┬}$шшЛ9йяК:°у,┼∙Ш?щ│wлФ┴·─ы╤wВО■\йq│┬!l▐hои ЎB╨╤я└I1p ЖycюuSЕау╥L!FкпZ Уццд07O╧:·Ццq дHў8Фау R,└Ащ8t№_К%Х"хТeВО K▒IBд▄ДD╨╤AяmПb'▌╢bВОz72А жQ╚AG&ў=[AЖуФн┐::YSуgЛ2╚зЫyож°sЭ▄кё│└▄]╝dA]и[ВОМL[╤Sъ Эi┌Ыц└ ВООz6 ЗSi█Ёtt╘єшР■`ВООzцNSХG╨╤Yпу9!А>№ЎOк?I╨╤┘╛CуФA╢Ї╟┘ttfцюЧ╘A2s╚ї AG╙j]P╔Ї╠}0▌%ш°┼ЫE5╩ ЩЮ╣┐tфЄ╠▄]╕K=s&ш╚gHНгW╩ ╫Е║@╙) ,A╟oЎ╘8Ъа r╒╥╧▄ :~╡л╞╤@Г:H╒╨╫'х╠ЭауwK╠▌%{UЧg(э&ш°╒sw╔&╘х┘#ш╚═╠▌иГLfц╛K╨СЯЮ╗RЩЇ╠})їЯ&ш°ЭЮ╗/SЩЇ╠¤Оаг╠▌e_Ы╘3wВОnЦЩ╗Ku╪╫╠Эаг╫hbю.╥r_3wВОn·ЬBьХ!шшж╧╧ Фе╧Щ;AGбу %щўШагцюВпK?╧C:║bю.R▀wI :zО(цютЇ¤▄Уаг+цюї┐ Баг;цюї┐6Щаг;цюї┐bСаг;цюЄd╪?L╨╤swq2ь*$шшБ╣╗8ЎtЇ└▄]фщsў0AG/╠▌Е╔▓зРа#═╕bю.HЦ.╜0wx=·э√C╨╤swQ2u!ш░3▓`Kж■^=╤#╥ лA╨╤="╔6┐"ш░5╢`┼Dж;&╜1wЧгСэAG Ь═$╞k╢U )pок┘fюiШ}С ър^╞Щ;AG*zю■J▄╗╚╕Ща# =wпQўjъBьtX┬▄]ЖKufЯ :lR#ьВ2╕жgюCY■"AG*{╠▌%WЧсНа├ЪчY5─.йГ[нм3wВОФж╒[д n-кЛ0Эщotдєж╞╪8ep*YWaЯа├в=woQЧNї╠¤Да├жA5╩ж(ГKSъ№╔ЎW :R┌Wгl=бю$ ъЬtXeцюз╘┴Эu*uВ╗■иq╢E▄┘R`-у▀%шHыVН│1цю╬$cъ▄tXVпиБvL\9╬1s'шHoUН┤m╩р╩О* j╓┐L╨С┌НiУ╠▌I&U∙П:м╗VCэЙ:╕ёиК?|O╨a▀Ьk3Ф┴НU№Н╠Ыа#╜k5╓цЩ╗;Смит_tФа9в█ upсJХ~дI╨QЖM5┌кФ┴Ек*¤fЎ┐N╨╤З│|+╚╠Lжо:╩n·Лтu(Я~Л]╔ёK╨╤П╤\╖~С┘Ж*№hО┐O╨╤ПЧ\sСХY┬ЁH╨QТd>╧Є,duУў┴&AG_r-╕FVzЫ┴NЮ@╨╤Чз<[иРQ■НГ}╔╡)Эчn@╨╤Янь СU■ц>¤╔╤r╨оПаг?цБ7ъP&sxF╛═D}Z╠zа'▓*р([ВО>щ#║vйCy╠сЇ9╕$шш╫ДvwФб<Зкр9AGЦq╖L╩г▀Y :JЎаgТ ъPЦF▀Х:·╢Ф ▐╥+фю'AG▀Ў8*╜D┼<╧$шш█3╟-ЦиШJ¤ф╕┼Є│цШагч╖XЪВvtЇ╧ьЪф╚ЦR┤/Ша#ГUОl)Л>аe. П!ш╚рHў$eю^Вf╛Z:r ┐Ь]╞СVQЭЇ :▓╚yn╥┌(шlВО,h√\╙ц╣И╙ю:▓аэs9tЫч╔"nЖtdв█>пQ█╓TЩ╖Л°AЩш╟╗┤О│╠4Л; шp&YPCpЯ:╪еЫ┼нЄУа#Z╟Х@7Л[,ф'tdCы8√ lёA╨СQ О╨╒kqM╗:2║Sг░Flк╫ЖУа#г]}G╕EьiщЦ╧nMлq8Eь╤-' ·YY╤~┬.╙rтЬа├1┌O╪їXфQЇЩщЎгФ┴Ц╤bZNtфtн█O4йГf╧ uQ?НаC╚P─┐К}%ш╚о╨╔%■Ul_>ВОьЮК╝]Д|лУа#╗Bс√к┤ ┼=╝$ш╚aJН╞i╩`├P▒╦С:rh▒Е═│qэТаC╢░Yв7оM°є:Є` Ы╔xq╫:rуe;N ▄╕F╨С▀`QmJё▌vБ╫:Є╗-кё8╛1mєoЛ№Й╣vФ╛╣*№ ВО|68Е═Звtфs┼)lЕ│0M"ш╚з°пУ8/■╞AGNЕ▀ ╞tёП2:r2П|Y[а] Л:Єк▒ ╢XЗЦtHЧQ│ё╬I╨С╫.╦` U°ЄWВОB░ ╢PVюntфжЧ┴╬│ ╢ цyх AЗ8f}╟u(╞ЩХH∙mк▒╣AК1зКY-№зtфўH7╪┬ШюпПЩn░√╘б√vОо$ш(Аю;DК░dч0jВО\ъЮе ъР_├R% :К░мЖч"e╚oQr╔┬╧%ш(┬[▒чКD+YPЕ|#шъд╪У┬вeэ∙AG!Vн<¤НN╒╓∙┤Е8ггTьн1$ш(еК`o╫AG1╢9X5┐ik√ :Кq╩┴к╣Щ#T[ТщГU/(CбJ╨Q<}░ъ:П╥s0╤ў:D;ЩхQz>O·!· AЗl╦5AЗЗ}f╦>uHC╖ЦЩ┤CГа├В-═де[╦L┘ g:,0НfNйCoз║R В?M[▀wИЩТ╬л#ш░с╞z'Е0Ф╓зГа├╙щЬ:ЇbОJ.гєAЗ·х%╩╨╦▓*╙V AЗЧЇ}Nбм[q╢ш╛╧;Фб╗▓n┼t╪┬э╕▐╠н╕ВПq;о╖єЄЪрtX┬э╕ЮЦ╦;╓Жа├n╟їR▐н8В{X╫Cy╖т:ьсv\wў├%Ю^E╨aKУ═к]╜Х╡*Оа├*╜YuВ2№")iГ*AЗef│*╜у~б{┼ <t°OZе ЭUK=vЦа├╙;оN:йыc╬:РLк┴|G:╣+зWAG ╒h^ч(ЗТїrOЧ&ш░╚хЁH■OP7√L╨ЖU5ЮW)Cч┬╠Х°яt╪ЇR╩yC■)}кC╨aУ∙*║H~*¤цAЗU%▀\ЎDs▓ьУе :мкЧ╣s├Gе/0 ш░k┤─╜Ш▐*¤╕YВ╗LwЕKъЁ]л№л:,[в ─O3хw┘"ш░ьЦя?Ш√7х■ЫЦЩ■{╘с╦^Щ':J2е╞ї8O╪■r▓╢Аа├6│ ьЕ:|r▓ZРа├:╜о{Н2|Z+yЩ;AG9їG╪uh{╨Ь'ВОр$уeь▌2│V·- В√tcу:╝ў+NЪ`tФ0╕GшЁ■i▀═ЫAG ╢ЭLW%rї5Жаг┤Ф·ръ╞$AG╓h)їUП :╩Ё┬6├┘╘Жаг ~Л╜ {╬tФcЛC[┌√╓жЬ№╙х0{╪ото┴Щ╗.ў%ЩSг|0ю ║╪╖F╨Qкc▌▒sLO╚cВО░-Ч▐уXШj∙=! :Jwг╞yх$▐▀ ╣тЁ, ВО▓$cх .Н>om╠╒sВО╥:ш~*ЗщЖ{шъ_'ш(Нщg~ыo┐я┤┐=AGyv"▐ЦnV√я8√ч :╩╙И╕ёєХ█¤{%ZНw╤╠а█∙%zКv╤╠й├┼2e╙Gлn╞°Лo:\,C╨Q╢#w█:Ь2[zо :"С,─┘iFo╥]p∙╝БагT║ї┬Htзе╫G\╖▌ ш(Хщ4s█o}ш№иВОrЩ▀СнГmN:8Эа├%│Зы6о▀∙\я█{&шИ╔htы`═ъ╫╖пБагdНшЪ╟ЩVq ВО╕шu░C1¤┬CюZ┼t8sрx5h┘L│╝ВО╪L;:h╨}от┤ыA╨Q:╜csр2Ц▀╓Ї~u╛7ЧагtI-жн-z;╦Дєз х╗ЙшesPЄСєЧA╨Q>│╡e'О▀u╞їvВg▐tг─(Z╝ЫЕА√ю_AЗfёўT ┐щФ·E',э'шpс0Т▌кfкД═z.Ш▌кпс Ю╬ўзt╕┤(%VЩў│ пДа├ЙУсP▄9=ЭЕа├╜-!wйlt╧Са├ є▄щ-ь▀q╧}├ В╟vВя)╒У│.Иа├С]!KIь╤чзVД4▒'шpeT╞тPk╠B▀!/Жа├│▌#ру╥╧%m▌!шpжкТ░ьG║∙@ХЄj:Ь1m"Гэ№,ъЭа├б═А?╥═zU╠╦!шp'фПЇs=Ю :dў#▌|а jЧE╨сP#╪я┬>╨ :Ь┌ ЇYzS╓7tВ╖B¤H▀Ч╓■Та├йjР+▐═*w1╧╨ :Ь3╦уВ█─жЫ_VDї│&шpk4└}щf║ФUюШMlБ╡Ъ9┤mНаC╜/}>июqжS▄╢м╫D╨с╪є░ФКE╤н_Зe4Ц!шCЯq0╨▒-'#Oз шМнp~Я-ЙЗSt8'qкЫЭ╣╗(юl Вчюч┼=Н╩aTф═EВўЎДэ╔├,ъ▌ў▓:▄3+Fч┬°]цЇ6y А:╕Uщ8с79Р┘KГаCАджт1┬/2н~СЪ└}╖\щ┬+~ВОа%CB? √№5╠╠DтпA╨!┬▒╨я╢¤9{пБаC}╖z╥є╜-ўУbЯt╚`Ю?Л[P╓╜─п"s=AЗz╗ъИ╫ a═>Х╛оПаCєИMю-н▀Ш═wbнtИsняi▌°ЎкoЇл╛Ц№ :DI=▄┼fvн КЮЗt╚r9ы▀q·╚Ж┘K╤/СаCШm∙й∙┴Зў&ВaъУR█1¤┬4ДФ■mГаCЪ╧ю╟yёz :д1ЯРє╥N)№U}▐ЗAЗ8ц;п7ыуft (ёў:ф╤'ж╧zrpЛi_+э4tВ▄ы│╪&╝╕g:╣/╚юO╨!Рiтpш├+=ЇдYAЗD║╦√ЁГ№╫∙0ь╔9░эъэ▌─O▐═В]/zTtИЇц┼Mц╕ч}ъI╨!Тщ╖"№│Єy┼ЫM╡2]Vф√Эєт:AЗdтўxЫ╜є~TУаCиж~B=/╕SфЙ^√ZУ▄VЖа├z%ьЖ▄╫╖сS;В▒жDO▐п¤X√J╨!]s\Ёф▌L▄╟=Щ╕tHf&я2я╝'лm╝!шРmQь▓│Tf╤ЯJtfю╝Пь╩{azЙюД7wВ┘ZСэ[LЬJ╦гBtИv(r├кyUw>╒СаC4s╪QE╪╙ъSЩє ВЩo├ывZ╕▄п ╜s@╨с/╙MyT╥+кzx>AЗtЫ:WGr^ПyчйzVDВщюїQ╩# )/з!я╗AG╠9)нЫ·юа?Kт:╝q7 чDЗяЮмtx"Ys√╦|A_єъ╔AЗ/NЇЙ├Ъ6]ъЎ╬cВ╗at°ьXMw~м>юхtВ_ьщ)єЬу)│┘Ы:░чc¤:╝Рш╞Mпn_─л~ ■}A'шЁ╞╜Ю5╧:=хьJи∙ЎЭа├+fб╩И├rЧ#вюtД╔▒║^wї╧Ям;ЯRt─└|EtЇ╣9э═Q╬^k▀РЫqТЇd╘▀q~i.;√T5=eЦ=jG╨спч1G[VПЇ┐;ц├Aш8╒KP+Oe │O║w╘ИO═ :╝fЮeпФ╣╓И╧7▄ :<┤п'╤Уe■УУ·▀▄ў║lЮ1з╖мЧ°u∙y▌│SY:╨~╨U+mсL╜f║Sz√`На├╙дЫ=d╦%н9пЫGzлЮчЬа├?эEjCе$¤^ 10эяtВo▌/ЩЇХРЇv╬Ч№▄▒F╨с╣·D9ЯщэЬO╘}и AGxN╠▓%╦ мЫЩC═├q!%}┬jO&В╔9AЗпI7)╖x╘сю╕¤ўВt╫~ю5fнхL╦мЗ[р√9AЗ╫I7w╩V,эpy1ў√╔9AЗ┐ЪцЧКХ\n*цHяЯЯt°/1'Х,╛l-1 ък╛пЗ#ш#щэ@о№@¤~╒╥A29Я5П└ m┬▄0╖█g╧CкAЗ▀Wt*GоЛ√ЙGц6▄╩cPe"шЁ\√єw`за√f═ЭБтч╚ы~о═B·K╡╠К╗Б9 ╖▒t&94_╘+ЗI■ЯdЮк═▐tОа#╟ж Ї└R╬erЧf╦└╪qx"шA╜=}п,ц°ж▐\м┤зэбмЖ#шNrkюХ,ЬeЬu'╫ цМ▄7m'ш╚ю╘Бщ╙,√t║¤╖ ьЖVВО░$╖+э░╬ї¤U¤▓=єШєуЬа#('3цЎ√└ь\_Яъзsm&М╜чб√ЬБL_з№lNо ■Х╙А C╨ФфмЎС█╔й3°╦й╔П?^; u╓N╨d╘o╞?▓;0ё┌ъТ▐дї:ё∙'╟oВО9AGИQ┐^· Ё└Xї╢╤!├Iу╢:Ўў-]sВО0T+c<░24sw}№Po&Iєфс°·nfhхы оDPВО0╒ўЗR┌qAGDvў+▌B^▄ ty╠ ¤╕├и╚■В╓/IENDоB`В▀8DdШ:Ш:ШШЁX▓ Ё C Ё4A┴ draw_sin_polyЁАbЁ38Сu╠1ЗЙ┘n╩ОFял 8┌aЪnЁ8Сu╠1ЗЙ┘n╩ОFял ЙPNG  IHDRшшz}$╓sRGBо╬щ├PLTE┐┐┐╤╤╤┴┴┴╧╧╧╪╪╪┬┬┬├├├┘┘┘╟╟╟╩╩╩╠╠╠╦╦╦╞╞╞▐▐▐╨╨╨┌┌┌└└└╒╒╒┼┼┼╥╥╥╚╚╚▀▀▀╬╬╬═══───╘╘╘╙╙╙╔╔╔╓╓╓╫╫╫▌▌▌▄▄▄███°°°ффф√√√цццЄЄЄтттъъъёёёЎЎЎ···¤¤¤■■■єєєьььчччрррЇЇЇїїїэээыыыщщщшшшууу№№№ўўўяяяЁЁЁ∙∙∙юююсссххх   Єв├Т6сIDATx┌э▌чz█║Еaў&ў╕w[n▓ш▐{ю к6fd'О╖,Q$Aв|яп}ЮУ8ЄЛВH`╨ў;╗{¤} Їяэ╞R ─з/К▀▓╛?╪Ч┬р~ЭВюйГбс┐a=<:nЬ4Удy╥8>:∙√ Э2&@╨¤УЬ¤¤0:o$m■Hу|hья╟·Y┬░Aў+цGуЯЮ╕╕ьРрфЄbтєO╓ОИ:║G1?л}dwrък√┐ЪЪ№М·5QAў─щЇGnзoRц6╣∙ЬчOє]▌'3│н╠╬ЇЄ╫цZkvЖ;Ё шоKnч?b~╒ы_╜№И·№-єwtзэ■·ШБd∙█s■_,бAwWr╫z4╛pУё39╣Yh=t┐cДАа;к▐Ъ{,6│ Мцbk┴ь▀╘A╨Эt▄Z№▓tХя╟\.╖┘3H@╨ЭУ▄ы═ЎБ├▄w╥ТC¤PЯ╜чЮ║cZ╙Ў┌e?ь▓╡▐fюБqВюТF+Ъ3═b~\sжu┘xdаАа╗уiEяХўПЇ■¤╩3#▌ч·ї|╝Qф╧╝╥]1g[k·V ┤а╫uy·ИеЫfOzKnЪ╟l ш╒ц\Ч▒Н]┘·∙Ч┌ТbЩї░ ш:╤6Pы7Ыэоk;кF ze9п┘OaыZR#щ шХц|╔Є╝║╛─g:zuъ·Y;h¤N┘ГЎУЫр{:zЦ╩╔∙g╥Ч╕ўВ^║цtY9 Lz?╧╙A╨KЦмЦ∙▄лїoХ5r шхц|TяЕЧЎ╜╣u▀П╒░ ше╥eшы/х¤Г/·<¤ВБВ^Ю}=nй╘╢П║FюЬСВ^Цk┘>rYю?z)ы▐g_: ш%FnаЇц/╧\^АXГ■вmЭП╩ ЗПt═Л{┬ zSuVёOъ┬зГа[ЧlTўалїPoУЗl ш╢щзъtEYk-╟;tл"@xA╫юыХm09С╟щ│╫МtЫr├}фк║p%/`есNEАЁВ■Pл№їL╫▐▓У ▌Ъ╓Н╕╖j_─Ы╝Ж n╚Ба█▓ч┬▓╓╛╣wЖ║╟r#n╝ЄYs]n╚ 0Ж@╨m8Сq├W╒┐Р╦aY!Gk)t =Тх╓ЕЧrл╕Ё5╜xўz║пEПO┐gБаэ@╛аO8▓╬╝) hNF ш┼zР;`#╬,Ti╚╫ЇuЮжГаk╙Щ/ш-·5}ИqВ^xоF]zECmК┬ ·уИs3х╓wЙ]Ч^рw╨Уiя}щ▌┴iЮ▒Бах╨╔]рЗрy╨їTЦ;_┘Э╝▓Ez~z╙k╬╔Чж;Vg┘╟ВЮ[s▄Дi■─═w2/эfШ╝Гач5%╙уW_▌ УwЇЬ╩─}├▌╫'═нf┘▌ВЮK│цЁ─]шф}Вe3 шy\8=qGЇл№·╒А│w▄ ШУe34╕| ║о=[q№°╥Чє"Щ╝ГаgїюьRЩп╬хUю3д@╨│yС%ж¤╬V&¤▓DЧc╙A╨│Сo┐├оq N√J9~'▌U╫▐QмV9b=ГЗY^ъ┼MоDЮЎ/░╜w║Ў╒У #╟ЄZзU ш╜║Ъuч╝ЖюfxШВЮБ╢ЙЫўц|│·< ф@╨{wыXўnю<{╜ ш.иOzЎ й3РIОnAя┼Ць■Їъ;яе▄S╪b`Базwхaj╢╜╗6БаWKХ·6╓oю/╪Aw╞НЧw╢Ї~▄C =ЭцВЧ?uS-ыу@╨Szє┤ЫЎ╖г┘ z*╗├>нЙ√jT╢█▒_=НM┘▐эp?╚ЯЭ╚·!zwrOk╧╧к▐{┤╜J╔Т╔╩╕зOйЪыЇПAOу╚ы&g╬╖зAwБ>Zыў╖о¤╥A╨? √Б╬G:·зР?╨?>╥╣ёВъ-ў¤HчY:в·c░╖▄[°HA ▌ъ╣ю·╟│tV╝#Єаы╢╡¤Р ╜╧&6ЇЭ W╣е+▐┘ЧОиГ■2т╢╡э╤j▒}+└}ш▀5чщЗ╕Г~2^cЩ ;д!,т·вЙ└JЁ╟hў╕ Жb ║& ВS.в╕ЮБа  Ц9m}$Жo( шэ5'c╣K5┴=GЇ╝╦RТ(Ю;╜┐,¤'║▀c'Оj╧╛╨¤G╖mў╨н;GМ:─Їd┬М¤═X╩-э▓&°HG|A┐6C┐я*Цr_╩o√╩░CtAЯ6#-ЮzпЩ_wЪaЗ╪В~ q╟ё╘√Y~▀╞" ·кўГ1|╨№┬sМ;─tm yS┴╧ш№М°В.д╞г║ ЭМ╙S ▒]ЧК█у╣=i9p┬╚CDA_Мpё╖.э_dф!Юаы■╘├╪J~╚nU─Ї╜({ошn╒└фБа е█Y╢тл∙[[S╨ПфISДн╬wхЩт cС})жэ,_╔╓Ц%╞т·▒м╜М▒шзСн√E╘AЧ╒п¤qV╜▀№ъл >─Ї°V┐■u═┘кИ%ш;╤н~¤K╫┴ю0·~╨ы├aИ▐ЩЬн:╠й-?ш▓>l>┌╓╟z[tk_╨У▒╕╧'ТU■c,ЪAшA┐НжЩ{{║oП~░=ш╦fЬ┼\°!═ №а╟╗Xц╙%═у~╨чт],єI┌▀n0r╨w#^,єщ,╥-=И(ш▓Qs=Є{╬╔z,З╚"╓аkgЩш[/H█НQF╕AЧua#╤7SzсeДt]щ╜Mэ╖Mj,ЪAиAeяЦ╥¤{O╘Б}Н▌╪ ╤УИ+шП|Р}xbjГpГ╬W╙Oz│"┬6╕И!ш▄l■kЯ│j╨▀▄шВ.z0шIНщъ_|НAаAч╘WП▓ЗэЩ: ╕апЄHщ+y┬6GZ╨u▀┌+u Ї╩6ДЇйИЫ<╖г{╪8-Б]╗ЯюQЎ┐ЎвюЖЛ@Г~G?єo┤┐¤-u@PAЧTgи·W3tЙDhA?Н╛'ф iЧ╚SъААВ>j╞Ї4E ╫а)╩(e@8A╫ягЬZЁ═ў-V╨я═РЮф┘┌7═IЮD дає╠╕╜Ezт"да│ м╜]:q дап╥Bъч┬░рБЭоЯшT'тгeT╨∙*·╜yqAB╨╣╣|O┼█С╟c\B╨o╠`рqq['ж8g╘╜▀Мх! ▐▐ж)╬/╩ Г▐Р%▌╝╜cй ╢р╨хдф ъ¤ГdВ3ФB╨╡уННЇN  ДЇ[NJюшБ¤>!ш╙tЬшМ╝ шWtWшB{r4и╝·6¤Т║Yц°ЇжЬ1vN╡;9Ч3щ╕ЯГ╬н╕юЇФY┌┴┬чаK[┤К▌┘ ╖урw╨пh■Ъ╖урy╨╣Ч ╖урu╨╣Ч╬9лурs╨╣ЧО▐Оcu| :лтRтv<zГUq)Э▓Y■]ОD_ж╥i░Y▐=aГjjяe_Г.╜тЖ╣ЧКNGя8°Ї_Ъ▐Р)╓eАA╫cО)t:╟ЬZ?Г~aЖnНпЭ)%ухГЮМq&p/ф(ЗоЛЁ-шrм╪└ uNKПrxеЁ,шsf▄nPf ЖаГ╬TпШ┴├аєХ│W▄╘АAOj▄DюХЬ.]г Ё)ш<ю┘у,З╘┴│аПrHhя·┘╒ ┐ВN'Е,ОдOНfрO╨яhUЮБv▐║гЁ&ш╥ZfЫўjЗF3Ё)ш ║ ╢3╙#Ф╣├╫Г~╞∙,╣Gрj╨u':╤s{bW:\·;╤ ┴оt8tvвDvе/Q╕Ї+y▄а┤∙5и$▄ ·ЯCEYbnWГо▀,ўйlш╗gГ╬╜ттшєЛ'ъГ╛IOЄт░"ОЭї\EbН! :+┤Лд╗nйЬ z?gвIЎЎS╕Ї]щ!uJ]Л"gе╧╛P8ЇC30kФ╡8ужаЗФО╜╞╕,WN8tЭiюR╓тшw!:J┴наsяиptФВsAO&щ!U49ЬiТчХp)ш╫мя(Ьо@zеp(шfLnR╘bQT8t>|l`Ъ╟В~╟╫I hЮ ╟В╬ЄW+xФзВ■┬ЄW+X зВ~╧".+Y{OрH╨'X■j╟л┬ЭаkўWЦ┐Zал^Q8Ї)ОP╡eРn░p%ш┌¤їЬК┌░╧┘7p%ш╧t╡Ж╙ьрL╨G9√╙ЮUS▄╩АъГ▐\1cёЖВ┌qcК╗╥ди<ш EЫЪ#ж╝g╘Х]&Чг╘╙╛┴Йаs╗╚.║ВA?ч8@лxx 'В.Э═ж(з=[laCїAзWйmЧlaCїAgуЪu5╢░бЄа│q═:┘┬╢LPe╨┘╕fЯnakPTЇE3)ж]laC┼AO╓═▄зШv╜Ы"пє╒¤@VsЬPL╗Nф╔╞u@eA▀1#pНZ┌╢FУ]Ttm<~K-m╗еm>к ·+GЙФB┬yви(шCV9ЕmИ2аЪаы^щkJi▀Щ)Ї{■QM╨Пдх_K@Tt·ЩХЖЎи,ш┤Ь(Пv┌х╢'к:-'╩гэ'8AU]╬J▐вРхРЎ┐(╩:g%ЧIOPf▒1╩·Юzу╠▄Kв█З▐йJ·Тy╘▒,lF%AзB╣hёБJВ~HГгr╤┤ U}ВЦЕхТ+ыe@╣Ag&Y╢]╛+б№аsoиtГ▄¤D┘AчiO∙▐yЮЙ▓Г╬·НЄЭ░B eЭЩ`═1J:{,к└."ФЇgэоАю >ж(-ш╥цyХЦM:}ьPФtmє|D ╦&mЯчЩ╗гма╙ц╣┤}FйAЧfФ░|╥ЎyФ2аЬаkO╥3JX╛·юв╝а_╙e╝"t╥GЙA▀ф▄Ркp6J ║~м╝R┴*0ЩBiA┐с!OeОlAYAЯуАЦъЁ└%]цr@KEЮX┬АrВ.╦│&Щ╣W$ЩdQ"J ║,╕▐ж~UaЫJ :[икu╠qЛ(#шwlКонPJ╨╤цдZ█ц Xг ░Ї║4.;а|╒9ащь]┌-0sпP▓`▐ВsълAЧЕSTпJS4цДэаk╦сKкW%Zm├z╨ўхКW)=R90wЗ╡аЪ▒╡Lс▄└▄╢В╛╠╠▌\ua)ш╠▄]Є╚▄vВ╬gИSЦЩ╗├J╨YNс║ +Agцю▐X :Я Ос▐(lЭЩ╗c╕Є┬B╨╣╦ыцю░ЇC╓\║Ж╣;К:3wч0wGсAgцюцю(<ш╠▄─▄EЭЩ╗ГШ╗гра3swswtfюNbюОbГ╬╠▌I╠▌Qh╨Щ╣╗ЙўЕЭЩ╗гШiб╚а3Ю┼Э╗╗оbюОГ╬=g1╫BqAч)О│Ш╗г░ая2swswЇ{fююв┐;К :'19М│ЩPP╨Щ╣╗М│ЩPP╨9C╒i2w▀г ╚ЇA3Т▐иЧлdю>HР7ш/27lP/W╔▄}ЎЕ: g╨ў╠@кQ.w╒╠ЇNР3ш2s┐а\ю║0o╨4e@╛а┐╠ЪqtE╣▄u%sўъА\Agцю║qцю╚Їifюо[4oQ?e@ЮаЯ0sw▐%swф ·╛Dу╦m2w▀з ╚Ї~3Ж)Ц█dю■Л2 {╨uц~I▒▄v*sў:u@цаЯЫ!┤ЮP,╖%ыцm:з╚Ї_fMQ+╫MЩ╖iН2 k╨ыfЭR+╫Ш╖iА╣;▓¤╬ аfю╬K╠uGР1шkf№lQ*ўmЩ7jХ2 [╨dц~@й▄w,sўъАLA┐5├gМЩ╗Т1єVQd ·Ь=█T╩;цнЪг ╚ЇЗa3zОйФЮ═[5╠▄YВ~d╧$3w/$Уц═║б╚Ї 3vv(Фf╠Ы╡A╨{╨Ы#fь╛bU#RЭї╥~╙} uъА.AgФ▀╪yИTA_cO│▀жш%АюAзKЙяшДAзяШя┤▀▀u@╟а╧╤I╘w;tЁE╖а7е7°3╒ёЩЎфч4-t · 'їyПє1╤5шrЎю ┼ёЫЬx╜IЁs╨їD╬WКу╖Wє&о0-├╧AgИДа╣┬хГ.У╛!jу;╛Абc╨╣Нnйвc╨y0Твc╨9,9,{BЗа│x2,dFЗа│"║5щФ:аm╨┘р P╞╧AзeA0д}╚8e@╗а_qXr0┤!╪u@Ыа_╨V0╙┬ЖВ>AгрpьЩ7sВ2р A╫#╫h¤=ДэС:рAЧ#╫ЦиK(Ц8Д mГ╬СkA9ф6┤ · s╜аp┌Э#╫#З░эSВ■эўsфZX8Д mВ^ч╚╡└p┌¤О#╫гЗ░▌QВ■О\ ╬ЦyKW)A ъБ#╫Вs,¤В╪uL╨┐:вSApТIєж▐PВ■┼Ж;%,r█e шщ┴ O%,OцMб╫'A ыЪ■└Jф Зkъ@╨ РГFйIhЖx[ё5шzpЧ■рЬ1Q├╫аєe.LzыЕГ·'n╧КГЁ%ш▄*ЦGрK╨9╕!Tф@╨ ■'7Л- ¤яrpC░8╚Ба ∙/n9Ї? ┼┴ у В■ЙГ╞A¤Г▄░KA┬┤╦╗K╨[8╕!h╦цэ▌г ¤ў 7ДьНГ║xС√▓ ък╧T║╪чрЖ░qРA┐╠8XдсТГ~QЖ╪Г^ррЖ░Э╩NrИ=ш╖f,░┐)`╔ВyЛoйCфA_5г`ЛjДl█╝┼sФ!юа7З═(8ж!{ЦГшw╨o╠ Шdц4эxFв·ж3#l╥уwИ2─tэ№¤J1┬&]√WШ╢┼ЇW┌┐FАsxв·МЫ╘"tЫЬмw╨9o3▄rН<шЬаЗyИz@в ·Цy W)E°Xu╨i zG)┬wg▐шu╩k╨/eл2█"PЯeыR─Aз¤k4·═[}A" zНЎп▒xзl╝A╫Ўп/T"/Є^?RЗ(Г~H√╫x,Щ7√Ю2Dt▐√И╥ 6╓а3ЫЛЙ6Гх{ZМAч■LThk╨yтЪ┴╞t╓PDхТf░С]VE▓г)4ГН8шьsИ╚═`г :э_#rL3╪XГN/ВШhЧЪ┴╞Ї╛Yc@ Л▒"ц┼д b]МЛЪШ╦bI Кiг_№kbU╠Й ▒)Ж─иШ;b[lЙ)▒и.─Ы8ўbO╝Л}q.ю─н87тL\ЛWё$Ю┼▒8зтR\ЙЖx╗т┼8uё Ъ"^╛уЇ Л6ш╚a╓┬eЄ█u▓╪╦дз┘w_▐eЄ█u╥є╦$AЬ╝L~╗Nz6Ы,l:╔X"╕LЎ╔┼A/z┴╨KЗ^DЇrв╜─ш┼F/;z╥KС^ФЇЄд*╜dщ┼K/czA╙KЫ\уЇjз╫=╜ъ╡PпКz}╘+е^3їъй╫╤╓%UпоzЭ╒+о^{ї*м╫c╜2ы5Z'╡z┘╓ ╕^╩ївоЧw╜╨ы%_/■·1а·╤а·qбR-ТЦK з%╘bjY╡└М3°Дo/9$9/У)пТ┼^&ЗфmЯшё2┘╦UТ╦$AЗ\i█ц2ic2iq6ic2iы2╔╕ПО6Гхж╖▀zЩLNЇ(╤ 6.║СЙаGИн╔Q╤н╔=B4ЙК6!шв}XLZэ├zМhСVCPВы{OЛяH┤оъ=F4ГН╟╟ў4В%Ъ┴Fуу╬+AП╥EkFтуY*AПGe╟тsuAПR▓n▐■;ъ>]я№Ыа╟JЪ┴оRЖЁ}ю`"шq╥f░╘!t├цН> ш╤╥f░7╘!t7}mЮ zдhЕMє6я№&шёz5#`ЕMщБkОШ╖∙ЙаG,Y1CрХ:ДэяхЬа╟J&u3Ф!lгцM·M╨cЎч6 ВХ╠ў}Ю┐E╨c╒Ф/Ьп┤ч╛?'jЇh╣╥ ╓lў¤9#ЫаGы╓МВцюK╠[|K╨#Wаl╪Nе¤kЭа╟N╬U]д с╥Ўп┐ zьЎ═8иQЖp}m/B╨уї"[Х╘!T┌0ьДаc╨МДC╩кV√WВО{Ъ┴Жl∙kSoВ▒GiJ3╪@э■sLAП┘Д яФ!L{ ╝E╨cF3╪АMЫ7ўНауўG3╪ъвyжrE╨!дь9e╤╣yk╟tИ)3╓(CИ╓╠[;E╨бd54═`Ї0Ё╤■Хауўяd╠ З#ъЮ#є╞О%-;f!ш°4dF─(e■m%шС╗■~щG┤k 5A╟╧Є@8■ыЕа╟nуєt.Ду Szь╛?pЕ ┌ЬХK╨cў} №╫f┴#AП▐╖E╤Ё▀ЦyKWt|%█Ь╓)C@┘ФxG╨ёПoЧс=m3P'ш°W┐Ф!эt╝ ╙\ ▐л╡iH╨ёЄO╗P°о╤о╣/A╟яеп └с╗├vэ· :┌П °кэuЫаГГВ▓█ЎЫA9eпэ╜UВr╩t█зефТ╓?t№ц ЗА|;╕Бау r╞{Ф:~sРC8ъ▓ы°Фаг-r┼э}D:ДЇЪг ■√~pA╟W╧f| sРГўЪ├▀n ш°Jr8г╛╗∙й{7AЗ5#dИ2°n╙╝Н3┐ :~"9м╨ ╓sM9╕сХауч!2Є╙Б?^хr▌$ш°┘ПУ>°C╛Аm■&ш°┘ З░yп├-UВОЦ╠└Тt|°iй╝╤a┘A╟З[aєЬ.d╛%шши╬!lЮы┤5Йау╙/aє[з═╞Я8Д═oIзЎ!Я8Д═oВt№1═!l>[ь╘тУау9ДнF|Uы╘┤Ыау=ДнA№$Gо═╛tt'З∙R?╜Щ7oЁ7AGwўfм,S?-w<*Уау/=ДmЧ:°h╖є{G╨ёЕ┬╢G|╘e6F╨ёEчяyp╪аyы▐:R╣ъxчюzЩэ№─Даулq3\Ў)Г║нБ ш°jСФ¤╘o▐╕EВОФt╜tЭ:°Fў)\tдФpА▓Ч║ю<$ш°╟(√иk/ВОpА▓П║w"ш°Gз╛cpUў~ ┌цe мvэрK╨ё/э ╬▄▌+╥У Шаг╔д47╘┴'Gц-ЫL:z1cF═eЁ╔Жy╦v~tЇт╔МЪС&uЁЗЮД√D╨╤=йяЪ:°у,┼∙Ш▀╔┘╗CФ┴rтїшoВО▐\Ыq│┬!l▐hоШ7ьХаг╫Б3Тbр└zaюvSЕау╥LсМT_╡:■'══╕BoЮЮtЇ,═у╕"▌уPВО K▒оH╖└Йау R,йД#R.Y&ш°┐Ы$рИФЫР:┌ш╛эО╪I╖нШагНюН рmrD╨С╔C╫╓Dp├q╩╓_эмЩё│E▄'═Гf╜Qw]Ш7h:хЯ%ш°╔ЮGФ┴]╡Ї3wВОэЪq╘╫аоj╚√УrцN╨ё│%цю.{3o╧`┌?L╨ёг{цю.Ы0o╧AGn:wдn╥Щ√.AG~2w?д nТЩ√Rъ?M╨ё3Щ╗/S7╔╠¤ЮагП╠▌▌~oR╧▄ ::Yfююк├Юfю▌Fsw'-ў4s'шшд╟∙!Ь}g::щёseщqцN╨QшxBIz╜tt┬▄▌сўеЧч!1wwR╧wI :║О(цю╬щ∙╣'AGG╠▌]╘√.ВО╬Ш╗;иў╡╔Э1wwPя+ ::cююЮ √З :║`ююЬ ╗ :║`ююЬ {Н:║`ююф;╥уюaВОnШ╗;&╦ЮBВО4уК╣╗C▓t шшЖ╣╗ГяGп}:║bююФL▌@:ьМ,╪Тй┐AGWЇИЇ ▌ шшОС╔6┐"ш░5╢`┼Dж;&▌1wwG#█3ВО8Ы╔o┘V5tд└╣к╬╚6s'шHCўE6иCї2╬▄ :RС╣√eи▐E╞ї╚i╚▄╜FкW3o─AЗ%╠▌▌pe▐Ж┘В[═╗а UУЩ√`Ц┐H╨С╩swМЫ╖сЭа├ЪЧY3─оиC╡.│╬▄ :RЪ6clС2Tk╤╝ ╙Щ■&AG:яfМНSЖJ%ыцM╪'ш░шDцюЧ╘бJз2s?!ш░й▀М▓)╩Pе)є№╩ЎW :R┌7гl=б╒I╠[pN╨aХ╬▌OйCu╠0P'ш░ыЧg[Фб:[ц X╦°w :╥║3уlМ╣{eТ1є▄tXV0эШ:Tх8╟╠Эа#╜U3╥╢)CUvL∙W│■eВО╘n═HЫdю^Сd╥Ф Иа├║Зa3╘ЮйC5ЮLёЗ:ьЫ3cmЖ2Tc╞#є▀&шHя╞М╡yцюХHVLёo:J╨1ГэХ:Tс┌Ф~дI╨QЖM3┌Ж(CЖLщ7│ uВОЬх√XAf:Щ║&ш(g╕╔┼3ъP>╣─оф╕─tЇb4╫н_d╢a ?ЪуяtЇт5╫├\dеKЮ:JТ╠чYЮЕмnє>╪$шшIо╫╚J╢ьф∙=y╬│Е х▀8H╨╤У\ЫвС╤yюV╜┘╩▐аYхoюC╨╤Ы-ЗСQэ·:zгЗ╝SЗ2щс∙6tЇh1ыБЮ╚кАгl :z$GtўэRЗЄшсЇ9╕$шш╒ДvўФб<Зжр9AGЦq╖L╩#W╓CВОТ=╩L▓A╩╥(т╗AG╧ЦЄ▀BzЕ▄¤$шш┘GеЧиШчЩ={с╕┼│BЙагw¤╖XЮb╓tЇюЬуKS╨."ВО▐щоIОl)EA√В :2Xх╚Ц▓╚-s∙ AGG╥УФ╣{ Ъ∙h!ш╚5№rvGZEu╥'ш╚"ч╣!Hkга│q:▓аэs9┤═sз▌tdA█чrHЫч╔"nЖtd"mЯ╫(Гmkж╠█E№ ВОLфё.ну,╙fqХI╠▄зvI│╕їBctdCы╕H│╕┼B~AG6┤О│п└╤р╜╫┤Ла#г{3 kФ┴жZqm8 :2┌Х;┬Ч╘┴ЮKi9ёB╨Qнi3з(Г=╥rв┐аЯE╨Сэ'ь╥Цчг¤Д]OEEO╨СЩ┤Яе ╢М╙rВа#зi?╤дvшЮ Ыв~AЗ#C *Ў2J╨С]бУK№л╪╛|┘=y╗ (°V'AGvЕ>┬?ЎMiК{xI╨С├ФН╙Ф┴Ж┴bЧ#tфp╔6Ktу┌AЗ╪┬fЙl\Ы(Ёчtф┴6;Тёт6оtф╞ ╩vЬ╕qНа#┐■в┌Фтлэ7оtфwWTуq|бmєяК№Й╣vФ╛╕.№ ВО|68Е═Звtфs═)lЕ│0M"ш╚з°пУ8/■╞AGNЕ▀ ╞tёП2:r╥G╛,Г-╨оЕ┼ y╒X[мC ╦ :\ЧQ│qх$ш╚kЧe░Е*|∙+AG!X[(+w7 :rУe░є,Г-И>п╝%шpОоя╕ж┼8│▓Йа#┐M367(C1цL1З  й∙=╤ ╢0┌¤їЙа├A┌ vЯ:a▀╬╤ХРn░ГФбKvг&ш(└ХЇ,mPЗ№Ц*I╨QДe3<)C~ЛжРK~.AG▐Л=W$Z╔В)ф;AЗгNК=),Z╓Ю_tb╒╩╙▀ш ┘:ЯЦагgtФ*А╜5ЖЕагTьэ ш(╞6лц7mm AG1N9X57=BїТа├er░ъe╚увр#T :К'лоє(=}И╛G╨с┤УYечє,╤O:▄╞гЇЬф!·кеЯM╨QФечв╤╧:╫фQz.ч6[яtЖGщ╣ ┌lжK╨QШKy №H▓i╪{ИN╨Qи vеg';╤Чн¤tВОть┘щwэ╗ўnэ╟tч─N╙(╝┌эдK╨Qа9╝g╡a╖t║ж┴{F┌╬¤Ха├ Ц┐hь▌Єэ ВО"MY╜u0█,:Кdўap╕м/A ш(╘ gеg▒c{Q!AGбды┘JУ:Їж╣b{ЫAGбF╠Р=в╜92E▒║ёПагXгf╠■в ╜щ7EЫ▒·/tы└М┘YЪDЎdWЪєtx$й╤$▓W╥▓fўЯ ш(╪=ч-ЎHЧэ┘¤7: vby1gx^-6Е$ш░ЕЭ-Магhe|@ЕдФ)AG╤╩°╩Т√2┌utNo"s;.еd╝М╟Е+с▒p@ОKYx@╨Q╝_fьОRЖtЖJYJH╨Q<╬lIп.ч│▄tx(С3[ЎйC╥Zf╥■ В ╢h4УЦ┤ЦЩ▓ ╧tXаНfNйCwзRйAЗЯжня╗ ─LIч╒t╪pk╜УBJы╙A╨aГЎF:з▌шQ╔et▐"ш░BОP^в ▌,Ы2mХёtXqE▀ч╩║G╨aЛЇ}▐б ЭХu+Оа├n╟uз╖тn :<╞э╕ю╬╦kВO╨a ╖у║Z.яXВK╕╫My╖т:ьau\х▌К#ш░З█qЭ= ЧxzAЗ-M6лvЇ^╓к8Влd│ъe°AR╥UВ╦t│*╜у~ ╜т· :№'ЗДQЖЎЖJ=vЦа├эWзэ╘х╪Ж3ВО$Уf0▀SЗvю╦щG╨QВE3Ъ╫9╩бНd╜▄╙е :,╥гЮи├ ╔u│/aX5уyХ2┤/╠\Й AЗMпеЬ7фЯ╥з:6щW╤EъЁ]щ7/:м*∙ц▓'ЪУeЯ,M╨aU╜╠Э▐8*}БAЗ]г%ю┼Ї╞`щ╟═t╪е▌ои├WЧхЯXE╨a┘¤'╛Ы)┐╦AЗew,x Fя[▄Ц√otXж¤'Ўи├_{evЬ ш(╔Ф╫уRu█ ВОRiзЩ√╪~ы├╩Пк!ш(Чо°Оlls▓В╤ :кд{╕ют·Э╧e▀▐ AGLFг[лл_gк} %kD╫╨ :*╡ш│Їж[▀╨ :къG·╛kэ/ :*5фКw]хю╠3tВО╩щЄ╕р6▒Iє╦з·YtTk4└}щ║▌ХUю.╨MlБ╡Ъ9th█AЗd_·|P▌у┤S▄╢[пЙагb/├о4P,К┤~vг▒ AЗ3фМГСАОm9qЁt В'В▒╬я│хтсХsqкЫЭ▐]tюl ВО╩=╠;ў4*ЗQ'o.tTo╧▒ yшв▐=ч^AGїt┼ш\┐╦Ьl╙qoAЗюL:·B°M·▄ьеA╨сАдfт1┬/2m~СЪГ√n :\p-Д╫№AK¤$ьё╫╨ЩЙЛ┐AЗО¤n█Ыsgя5t╕AюVOz╛╖хa╥┘зn╨ч╧╬-(ыН,ёps=AЗ#d╗ъИ╫ auЮc█S :г{[╝^;ъЁ6<ВWH_Ц┘K_ хм├╜r:\б╜╨∙√·√▌\№J╨сШ#пW═шZЩ#W_AЗ3Т%ХqOW═4╫═ЛtЎ┼t╕CwД╕╖┼3Х{╖ўхt8DОb[ё▓}Ь>3pшЇTВЗэ√·Иm╘ёvX.yУGlз■╜юS╫╫їt╕D▒╣{Kы'║∙╬┘Gk╬╣С{Z╖╛╜ъ[y╒7.┐BВз$¤юb╙]k¤N╧C:▄r5ы▀qrd├ьХ╙/Са├1█юзцоMОйO║┌Ощ┌╥їoо╣їь~ЬпЧа├5· 9я┌)Е?к╧√0!шpО~чїf}▄МЇПr■ЮAЗ{ф─ЇYOn╤Ў╡оЭЖN╨сГ9Лm┬Л√q┌╔}┴¤ч■╥&З>╝╥COЪet╕H║╝?║ :З=9Ца├E╗▓╜√ЧєУw]░ыEПjВ'╜{qDУў╝яC= :Ьд¤уV м|YёfS-AЗЫо▄ Ў;ч┼#tВЧ]8┐╟[ў╬_°QMВG5х ї╝├Э"Odэk═х╢28РХ░ю╛╛ Я·█t8k╩щ╔√Нk_ :\╫wxЄоўqO&ю.╙╔╗Ыw▐УUП6▐t╕m╤┘e3║Tf╤ЯJt8Lя╝Пь║ў┬eЙюД7wВ╖]8┘╛EЫр \zTHВз:╣aU_╒╜Ou$шpЪv4р╪╙ъS7ч■╥o├ыN╡pyXwЇ╬AЗ┐┤ЫЄиKпh╚├єс:\╖)╣:rчїшХg╚│"t╕юAОRi╕Єrю}Ч шБ.РsхбusBю·│$Оа├ў}юЬш0у▌У5ВO$k╬▄■╥/шk^=Y#шЁ┼ЙЬш0ь@╙ж+iя<цp7 ВЯ╦╫Їё╩яА╒╟╜№ВN╨сЛ=Щ2╧U╓Па├ Й4nъ{лЎE╝╔k╪Ёя :AЗ7d╓<[щ)g╫Є¤бц█tВпшBХС o╚]Н8╡pЗа#Lz─ъz╜к■d╜Є)AG Ї+rE_СЫ╙▐хL╨с╡╓ ╣ЩJТЮМ·{#Оа├/═х╩>U╡з╠▓GMт:№ї2V╤Ц╒#∙w╟|8Эа#з▓uр╣ьЎYzGН°╘ Та├k·,{еф╚]О°|├Эа├C√2ЙЮ|,єЯ|ЬФs▀ы▓txFOoY/ёыЄ╦║gз▓tаїалV┌┬ЩzM╗Sz√`На├╙ды▓хТ╓Ь╫їС▐кч9'шЁOkС┌`)IР$·ж¤}АN╨снЗ%M_ Ioх|╔╧kЮлOФєЩ▐╩∙D▌ЗЪtДчDяР-YN`]g5[─tДФЇ л<Щ&ч╛&]S8nёи├▌q√╫Вt╓zю5fнх╠еоЗ[р√9AЗ╫I╫;e+Цv╕<Пш¤╛@rN╨спжр2`хЧ█=Т┼√чч■KЇдЄ╛┼┬Чн%║а╛o╚ўїpa$╜╚╒Ви?мZ║Аt УєY}VhцЖ▐nЯ=йN~{ZСTО▄ўПЇ6▄╩SPe"шЁ\ыє╖oза√f═Э╛тч╚ыaо═B·K]ъК╗╛9 ╖▒t&9╘/ъЗI■ЯдO╒fя║ G╨Мcm▌╖ФsЩ▄Хnbщ;пB!и╖жяЛ9╛й7Z╙ЎPV├t'╣╙{х} gg▌╔═В■АС╗ржэ┘¤еAэЫ>═Є╖Oз[√╫nhu!шKr╖╥ ы\╧_╒пZ3 ╛∙0?╬ :Вr2г╖▀√fчz·T?Э√°k3aь='ш▌ч ╝o·&хgsrєчпЬ\ВОа$g╡П▄NNеШ┴_MM~№ё┌Yи│vВО г~;■С▌╛Й╖╦щM.▀&> ф°m╨1'ш1ъ7KЯю║k┤╔p╥╕√єЗЦnП9AGШЖ■─╕oepц■ц°▒▐LТц╔уё═¤╠р╩▀ wxш ВВtДй╛?╪Ч┬р~Иыр:"▓╗╫?╨)ф¤{Б.П∙┐ ▒╞┼└ї╞&IENDоB`ВЬ@@ё @ Yc)NormalCJ_HaJmH sH tH Z@Z ▒/# Heading 1$дЁд<@&5БCJ KH OJQJ\Б^JaJ \@\ Я[╦ Heading 2$дЁд<@& 5Б6БCJOJQJ\Б]Б^JaJV@V Yc) Heading 3$дЁд<@&5БCJOJQJ\Б^JaJDA@Є бD Default Paragraph FontRi@є │R  Table NormalЎ4╓ l4╓aЎ (k@Ї ┴(No List6■Oвё6 а c inline codeOJQJ4■O4 а ccode Дh^ДhOJQJB'@вB uComment ReferenceCJaJ<@"< u Comment TextCJaJ@j!"@ uComment Subject5Б\БHЩ@BH u Balloon TextCJOJQJ^JaJ@"@@ ╗U!Caption дxдx5БCJ\БaJ eric jonesL З ╣ b лб4eaj    eaj    eaj    eaj    eaj    hsЖ∙esf√esf"hsЖ▀ksЖ╧я8▒Явб4'^%    23?\yЪЫ#КЛУй╢╖┴╫╪ёЄ']ЙКХ╖с :hМ╞╧╨N O e f ╨ ╤ ┘ ┌ т °  ) * 5 W Д н ╓  8 k v { Я ╠ ∙ !8ABTUЦЧ()йкмн34ЫЬ╤╥щъ╚╔╤чЇ+,7YМ╡▐ 8 o М Н ╕ ╨   (!P!t!ж!╔!╘!┘!щ! "'";"m"а"╬"╫"╪"┘"█"/#<#=#:%;%C%Y%f%К%Э%Ю%й%╦%■%'&P&|&к&с&■&5'Q'Y'Д'Ь'╦'Ї'(B(t(Ч(в(з(╖(█(ї( );)n)Ь)е)з)и)·)√)D*E*M*c*p*Ф*з*и*│*╒*+1+Z+Ж+┤+ы+,>,Z,b,Н,е,╘,¤,%-K-}-а-л-░-└-ф-■-.D.w.е.н.о.░.▒. //(/)/0/╓0╫0т0у01^1╬12╧2я283▒3Я4в4Ш0АААШ0АААШ0ААА0АААШ0ААШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0А0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0АШ0А0ААШ0АO Ш0АO Ш0АO 0АO Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ Ш0А╤ 0ААШ0АBpШ0АBШ0АBШ0АBШ0АBШ0АBШ0АBШ0АBШ0АBШ0АBШ0АBШ0АBШ0АBШ0АBШ0АB0АBШ0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥Ш0А╥0АBШ0А/# Ш0А/#pШ0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#Ш0А/#АШ0А/#Ш0А/#Ш0А/#0АААШ0А/А0АААШ 0А)/Ш 0А)/0АААШ0А╫0АШ 0А╫0Ш 0А╫0АШ 0А╫0АШ 0А╫0АШ@0АААШ@0АААШ@0АААШ@0АААШ@0АА0L4╠?\yЪйЙКХ:hМ╞╧╨N O e f ╨ т ° ) * 5 { Я ╠ !AЧ╤чЇ7;"m"а"┘":%;%C%Y%f%К%Э%Ю%й%╦%■%'&P&|&к&с&■&5'Q'Д'Ь'╦'Ї'(B(t(Ч(в(з(╖(█(ї( );)n)Ь)е)з)и)·)M*c*p*Ф*з*и*│*╒*+1+Z+Ж+┤+ы+,>,Z,b,Н,е,╘,¤,%-K-}-а-л-░-└-ф-■-.D.w.е.н.о.▒. /в4о:00ьЫT"╥Ъ@0АААо:00Ао:00Ао:00АЪ@0АААо:00АЪ@0АААЪ@0АААо:00ьЫ╗Ьо:00Ао:00Ао:0 0о:00Ао:00Ао:00Ао:00А @0ААо:00Ао:00АЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0АААо:00ьЫЬXхо:00Ао:00Ао:00Ъ@0ААЪ@0АААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0АААо:0$0ьЫфяо:0$0о:0$0Ъ0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0АААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААо:0M0о:0M0Ъ@0АА°АЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААЪ@0ААм:0t0о:0t0Ъ@0ААЪААЫ zzL@ь *╕6б<#%').Є°(▐'/+0│2н6б< "$&(*+,-а<!у"·"№"п)╞)╚)╕.╧.╤.б4  ХД  ХД  ХДЁlЁЁ,bЁ$H^:=ЕИОЧк╢╖║2;▄ыю¤U^ьїTi╛└╪рЄ∙  #'7;GHY]hoЕЬ▒▓╡╛╚╔╠*2:FNQ_fКЩеи╕∙ O d | Д л └ К У    $ Г Ш └ ╚   ( < Q R U z Г Л Х Ц Щ ° · √ ■   - 1 2 5 ? I J S { ~ П Ч Я л │ ╢ ╝ ╩ у ы (+BSU^╥▄Ё3:<CU]ck╜┬gpВФ╚╤hrvВ!+~ИЭеbl▀ьЮкъю∙09?N√ (∙ *>STWВЛУЭЮб     3 6 ? Q d h i l v З И К Ф Ю Я и ┐ ╠ ╫ с ! !!!!!!!"!#!3!=!B!C!W!c!d!f!{!И!Й!Т!н!╖!╕!╗!щ!ь!¤!"""R"X"Y"\"m"y"Б"К"Р"Ю"║"╠"Ь#о#╡#╞#m$~$Р$Ъ$k%s%{%Й%С%Ь%░%┼%╞%╔%Ї%¤%&&&&r&u&v&y&Г&Т&е&и&▒&├&╓&┌&█&▐&ш&∙&·&№&''')'0'2'<'J'`'j'k't'Л'Ш'г'н'╓'┘'┌'█'▀'р'у'ч'ю'я' ' (((#(/(I(V(W(`({(Е(Ж(Й(╖(║(╦(╙(▀(х( )&)')*);)G)O)X)^)l)И)Ъ)u*}*Е*У*Ы*ж*║*╧*╨*╙*■*+++++|++А+Г+Н+Ь+п+▓+╗+═+р+ф+х+ш+Є+,,,, ,!,2,9,;,E,S,i,s,t,},Ф,б,м,╢,▀,т,у,ф,ш,щ,ь,Ё,ў,°,----,-8-R-_-`-i-Д-О-П-Т-└-├-╘-▄-ш-ю-)./.0.3.D.P.X.a.g.u.С.г./'/Л1Т1в1е1▄1ш1ў1■1 1 12z2Г2G3O3m44в4#KShpЕИ┬╟┘L╩╤УЧйп╖╜┴┼хч№;HknЬ▒╛╔°¤:Gu|т ц ° ■  < Q h m Л Ц ─ ╔ ▌ ў - 2 ? J { ~ Я м ╠ ╙ ∙ !(lsЭеўd/6╬╒Фбръdk╤╒чэЇ°>SУЮ╠╤х d i v З Ф Я ╔ ═ ▀ т ! !;!>!_!d!{!Й!н!╕!┌!▄!щ!ь!""1"3";">"m"z"╢"╣"Ъ#Ы#C%G%Y%_%f%j%К%Р%░%┼%&&>&C&W&q&╓&█&ш&∙&+'0'<'K'`'k'Х'Щ'л'о'╥'╓'( (+(0(I(W({(Ж(и(к(╖(║(▀(ц( () ) );)H)Д)З)╪)ч)M*Q*c*i*p*t*Ф*Ъ*║*╧*++H+M+a+{+р+х+Є+,4,9,E,T,i,t,Ю,в,┤,╖,█,▀,--4-9-R-`-Д-П-▒-│-└-├-ш-я-. ...D.Q.Н.Р.╤0╒0╬12\3b3в433333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333STq~╬"╧"<#=#Й#\$■&P'X'`'1(4(Ь)Э)е) //)/═1 12╧2╨2ю2я2Я4в4ў1■1 1 12в4   eric jonesоz╒RЁГЎ*         5[dRРPt         Д╨ДШ■╞╨^Д╨`ДШ■o(.А ДаДШ■╞а^Да`ДШ■ЗhИH.В ДpДL ╞p^Дp`ДL ЗhИH.А Д@ ДШ■╞@ ^Д@ `ДШ■ЗhИH.А ДДШ■╞^Д`ДШ■ЗhИH.В ДрДL ╞р^Др`ДL ЗhИH.А Д░ДШ■╞░^Д░`ДШ■ЗhИH.А ДАДШ■╞А^ДА`ДШ■ЗhИH.В ДPДL ╞P^ДP`ДL ЗhИH.Д╨ДШ■╞╨^Д╨`ДШ■o(.А ДаДШ■╞а^Да`ДШ■ЗhИH.В ДpДL ╞p^Дp`ДL ЗhИH.А Д@ ДШ■╞@ ^Д@ `ДШ■ЗhИH.А ДДШ■╞^Д`ДШ■ЗhИH.В ДрДL ╞р^Др`ДL ЗhИH.А Д░ДШ■╞░^Д░`ДШ■ЗhИH.А ДАДШ■╞А^ДА`ДШ■ЗhИH.В ДPДL ╞P^ДP`ДL ЗhИH.оz╒R5[d                              3х2бE1k ╘Ou д V √!╗U!▒/#╬w$Хc%Yc)a%*Ю57╞q:Хw>#&IКNlN╗nRЭYUdZ╟!]аraа c+Pz╛Е +И !П╩/Р& У3 ХТ9ЩB_ЩfzЩ %а√'жQиЦ7╢g;║+g╛Я[╦Д╧╙жI┘в#уЎфEjчФ ё1 № @А 1 1PHК 1 1б4p@  Unknown            GРЗ:  Times New Roman5РАSymbol3&Р З:  Arial?5Р Зz А Courier New5&Р Зz!А Tahoma"1ИЁ╨h┼esf┼psж&^vК*ZvК*Z!Ёа┤┤ББ4dч1ч1 2ГQЁH Ё ?ф                     Qи  Anti-grain library notes eric jones eric jones  ■ рЕЯЄ∙OhлС+'│┘0ИРШ╝╚▄шЇ ( D P \hpxАфAnti-grain library notes.nti eric joneslricric Normal.dotl eric jonesl38cMicrosoft Word 10.0@┤W╡у@ц%щ┬@Fб╩ъ┬vК*■ ╒═╒Ь.УЧ+,∙о0 hpДМФЬ дм┤╝ ─ щф enthoughtnZч1н Anti-grain library notes Title  !"#$%&'()*+,-./■   123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}■   АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеж■   ийклмно■   ░▒▓│┤╡╢■   ¤   ¤   ║■   ■   ■                                                                                                                                                                                                                                                                               Root Entry         └F░Q╨ъ┬╝АData             0uЪ1Table    ~юPWordDocument    "^SummaryInformation(            зDocumentSummaryInformation8        пCompObj            j            ■                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ■       └FMicrosoft Word Document MSWordDocWord.Document.8Ї9▓qenthought-chaco2-4.8.1.orig/docs/kiva/agg/notes0000644000175000017500000001041313233644505020374 0ustar varunvarunnotes: * rename _kiva to _agg * cvs rm freetype/setup.py * build aggcore2d.py * Test graphics_state setting variables. * figure out method for a fast blit to wxPython. * figure out how we are going to (mix in) font stuff def select_font(self,face_name,size=12,style="regular",encoding=None): def set_font(self,font): def set_font_size(self,size): def set_character_spacing(self,spacing): WRAPPER DONE def set_text_drawing_mode(self, mode): WRAPPER DONE def set_text_position(self,x,y): def get_text_position(self): def set_text_matrix(self,ttm): WRAPPER DONE def get_text_matrix(self): def show_text(self,text): def device_show_text(self,text): def show_glyphs(self): def show_text_at_point(self): def show_glyphs_at_point(self): * implement these extra methods def stroke_rect(self,x,y,sx,sy): def stroke_rects(self,rects): def stroke_rect_with_width(self, x,y,sx, sy, width): def fill_rect(self,x,y,sx,sy): def fill_rects(self,rects): def clear_rect(self,x,y,sx,sy): * Should I add this one? def draw_rect(self, x,y,sx,sy, draw_mode) def draw_rects(self, rects, draw_mode) It would be very useful for drawing bar charts. Hmm. Probably a call to fill_rects followed by a draw_rects call would work here because they do not overlap. * Should we put the ptm_stack into another path if it is added with add_path? * expose the enum values. * setting the line_dash is probably more expensive than it should be because it always creates a new vector. We might work on having a way to pass in standard line dash types that have been cached. This is probably not worth the effort now. DONE * Support clipping to a rect. DONE * implement draw_path() DONE * figure why add_path doesn't appear to work correctly (I needed to fix add_path not transform the points in the passed in path_storage) DONE * why am I getting seg faults in some cases. DONE * why do rotations appear to be going the wrong direction? (The lion is just drawn upside down and this was an artifact of me flipping it) DONE 1. implement __del__ shouldn't agg declare destructors as virtual?? DONE 2. implement path additions to paths. DONE 3. Change compiled_path ptm methods to ctm. DONE 6. Clean up file structure kiva aggcore2d.py agg __init__.py compiled_path.py affine_matrix.py graphics_context_bitmap.py src compiled_path.h affine_matrix.h graphics_context_bitmap.h compiled_path_weave.py affine_matrix_weave.py graphics_context_bitmap_weave.py build_wrapper.py Notes on weave and boost: weave: 1. There are to many places that you have to edit code when making wrappers. They are: a. Actual C++ code (classes you are wrapping) b. weave wrapper function definitions c. the shadow class definitions 2. You still have to write way to much boiler plate code. We can fix some of this by refactoring the code, but without a C++ parser and at least a week of work, there isn't a real solution for this. 3. Shadow classes are nice because they allow you to insert code on the Python side of things, but they add quite a bit of call overhead. It would be nice to be able to set up methods that are bound directly to the class and work with the self pointer directly instead of the self.this pointer. This would get rid of the extra call overhead and get us back down to the call speed of boost. Allowing both approaches is nice. 4. You have to work some to make the classes you create safe as far as accepting the correct numeric array sizes etc. This could be fixed by defining an extra class that was recognized by weave that said what needed to be checked: array_check(nothing|typecode|rank|dim0...dimN|exact) 5. There needs to be an easier way to expose enumerated types through weave.enthought-chaco2-4.8.1.orig/docs/source/0000755000175000017500000000000013544357563017144 5ustar varunvarunenthought-chaco2-4.8.1.orig/docs/source/_static/0000755000175000017500000000000013544357563020572 5ustar varunvarunenthought-chaco2-4.8.1.orig/docs/source/_static/e-logo-rev.png0000644000175000017500000000751113233644505023246 0ustar varunvarunЙPNG  IHDRoi╗■ъ*sRGBо╬щ pHYs  ЪЬtIME╪УяL█IDATx┌э]ktT╒┘>√z╬\$▄m мА БЙ╚е!TDКИ jСV|_CшWpнКбh╡ вP╡T║┤ХЫ\"РБ══B╔$$Ф6aТIf╬9√√qfB╕%ЩЩ=У Э¤Г╡▓Bцьyц}▐█▐╧; v╪oД╨т┤`ВЪ!4ChЖV═v[╕ГьУ1ж2ж МА!█ЇHеGФi▌ъygЄ╫■Ў┼):QVd╗к8SГmлиsПQAМгj2рЇзТ▀~¤┘~╤▌AH3√╤q╒╒U┼ :Аў?!4[a6SRЎЧu ╟О╘№7вH'О1"б_Qqщх т!ЪМйJbBЇцw═x$I╔- Sя^QO>■РAЄO~▀╪( В ┌█HAPUЦМ)=╗Ен·¤Уг√╖ёOjjm+■Ё■Ў╟Ц даv$~░╪жц"3ж╝ёъ3╜zvi√Jnт[н*.\v█(№/EУ1U`╩▄Yc╓┐╛аэ&y3ёgж>╨=╩x$ў;GгS@╗┐]╤dМ1х┴▒ёY√№├Уoч"█╛┼ўЭ¤X▓╜╛6 █╙n8ё█═o2ж Иэ╢,c·и─▄_╝╕ф▄КU?y" "║c╤dL5HfFj┌╘╤~}╨╓╧Ў╜Ь¤Q╜]АH└ЩФщМйМ╔/дOxc╒№бГ√∙√qБ'~аl╙ХН_┤ ┼гР═eХW\╠╚|╗ёб АК&cLM╜h┴d╕╚╢пю9╢Є╒-╒Чъ $■ ╛Щ╬Ш┌│Ы9єеi╦Ч>xУ╝a┼ЇыХ6э>В╘#╣EВ ╣▀_h2жЪМ$}ю╕ьХ┐рт"чфо▀Ёa\l▀░0│╫/"ЙЇ▐СГ╥жО.*:UQy┘Хщ└Л°~`:oYfнxuї·П?∙ b)<╠Ь>╞╥Чц'ё∙вщrСYЛg─шу√╦╒╘╘╛╡сп6nллgШЪ╤АШъьe°SЎЛгяMЁїїkmЫ>╪ё▐ц¤uv" ЄSnhj Л╠МщТЗry┴_ю═№▌Ъ╩ъLMШЪ01@$Щк(▓]v┌╞П№ЄЄч·Їюю{─_ё╩{#мГРИ╝&>4╡l|юc¤ь.8~ █х┘╟rK05bj┬╘И░▐m;А1Хй▓в4*╬:╜д╬Я3y╔Kє|шС▄┬┼╦▐й║TП\й> 8ЪnЩ╡dж┘дчBэ ]╢jыз╗]8#&·[∙5╞TEUЭКlЧЭu▌#u\И/┬k■°╜┐эпkЁТ°^╟Ї6їt=Zoн `╬╙Л┐-,гR'*EP1#┬╝EQА ИD╘fsn¤lOYYY╥и!Т$·▓З{GЪ2yД╒Z~ц\p╖ї█N|ol╙ЛЮnл┘╧п¤юBu-╤\$5╢╜ї╦Ш┬TYСgЭNR^\8є┘gхF№Лї{@|П╤4┼Е┐Ь0ov2н╓Кч^╚:j)╞╘Dи"zйЗM Н°EnР╢■1]WfеПNт@№w▀ ╟Ыы┐иk █B|ПЩ▐╨╨Ёл∙c┬├┬!>║╚╫▀▄8чщ й║T'JЭй╘ЙИaZрЖРx╪шubИшOWъ╢~║╗м╠ъ;ёЗ▌╙Ўc╔∙∙%ко└╓╨dLї<╜bjЩ╡|я╫З╬Ь¤┴ы]n▐▓}ЁЁФ5olu]%}╒u!b'ь▄^f'BD╤1Мъ║№¤╦╝ў═-,>эгyn╪╕э╗вя▌╟ўмed░чNS┴щt~WX\f-ЦpO╕'е▐сЬ▄╠х,9UОйI2Ш1`м╙x─еd  ,М╗·х∙╜{E·ф═╜въRХ"идZ G╠ 4Ып ╘╘ю√·PL┐ш°qн┐й@─╘$щ#15! Gо}\.-¤2kEfVЎо=G15Qйб&нphїсю!Э9√Ce╒┼с C║vщ▄jБ(ъ# 5#вGXЄ:InбИ╚╠Hє▒е JЎZmлоПЬ┌Ю╧є╣╒U__(чhПю▌Ж' ╣┴HЫИв┴ДЙБ√┴7cк╔Hч╬║▐ь})"┤DнЄb-ж&╤`╞─рiн╔єО\eUїо▌?┼ИЛщэ*│▓ПYJ05К·╚ы D╚╦ ╣ЇлЪS[╘GabD─Ынr╛qиEз╩къ├9Ц╒пm"4L╘w┼╘tЫ╤GЛT··╪пr{бOъь▐P█┐hjыЄП?Э:}Х"ИО░Юяi пbь:/д7yAэ@айeKИ╓#$ЄtСТЩ13mjТя5╪1K ж&О^╚wЛА !ц%пPSSS√╓Ж│╫lr{sЮ^и#▄╘цw4╥DmQIи S#▀3aь@Є57Q; S#┬:─п v4yЕ┐R╗а╔+╘А┌AН&пP0j/ЪМ)й)├-°╣Пб&Р╘Z4┘S│╞.[<гcQ;X╤d┬{ЫўЭ^╛Ї▒Бё}; ╡oXAгeВ`n^щ─╘е╦Wолй╣ъ╡_╔^7$ёK■9Q)ъ#E]б&ДuАSэ╨╤╨aЙPє√[О;ягm;█Hэ√Т[є╞fQ)щгD}W"Ж#bАИ^ЩD:K Д;5:їK▓6ж>Ю╤┬┴О╒ZС2їй╣╧d^№╤!j8JЭ01║╪-┤Гj(╚TлИ!Ц05Q)"паjт╘Мх+╓▐@№рбvpг┘dдИ"в'4L╘uy гC═Й┐cч╛рбvЗй,@A1Д┤╤i_Т╡q█Ў¤Lq|s4bй╜вvGюzЖИ!в∙UктР ▌!вKБI╚ядТЛ°QDФ1E3[ў╣1кнvФI $0ж¤ЬЫь0h6Б°FМ√┬Lы╥т╨╠ЩЦАdкЬЪТ░nїu╦Ю?SScw\LўGиa╩Гcf-Nє]yч/4u:Сй c c P░е┘M1Ып8┘_h>4~┤┴h▐╜┐─f╖ Вl%а&N^Ш>Йя№?2=i╘▌CЗ─╚)╬9v▐!╦Ья·jц>Сь√▒hа¤жN'N~(a─░ШпЎф}W╒╬аx+я┌' uО0?1sLт╨ _э/>_nГH ╪!т ┘xЎ╩9╜z°qш@рbzlL╧╪ШЮ╣╟Oэ■·_╡6ЇAъc6~чt=F&ЎЩ╪╫Ю№Ьcч2Є\╢ц▒Лфr╟hВ3ч.╞ЇНЄхйУJx`╠└┐ уx^Б_ЬйЦН┐Р>С_иmqKЮkАЩj╔+-++ YЯ.z╜фїю┴wь3░TUїх+ ╢q▒с▄╣~M·Дфб\─╔_ю:pЁЫB═I╢фЪА" DЇ▀5 √цлJcпЮСД°T┼ъubdу╨!Г╕P√┼%+│~ fїеz*EP]╜6R√2;┌/uz╙] ┬т▐g,'╬Nd╘=CтДЎ^n1┐ъ8Ў┤№8ВРD,яdй╒Z}WФ/╤)~АўЯ╟О/ўж═z~ў╛у*0P]g*ЕН▌Р[{╨╧sЛ]─╟bДшеыОц76╓╟┼Ў $ЪЕ▀?╜`щ┌ї[эНШJTьDDУ╦K┬Ож t Й"█ў(╡Ь(}Єёqq▒w∙√╤ZБ°╬жO11КЖ╚fГщ№╥Z XSXk71EЫ╜~э;{т√G■bЎ╜NЄ╙#▌"kц"¤л шДr@╫4╜╦ЧmЗrN"иЎНю┴ЧщЗsrзLЫ ∙╬М┌А?эVh┐?▌▌БnРЭї▓уъ─ёw'?0l█╢пОф`b└╘ьї┤╖ F4]Р2UUЬк╥ ;lКlgLБР bЁkБx'°═█Дз&╡%QU#c*АBЁ{awЪ╫E|╚Dэ╟╢бBh╢ЭьZ▒РЦ-Дf═Ъбх┘·▀г┌/┘w┐IENDоB`Вenthought-chaco2-4.8.1.orig/docs/source/_static/default.css0000644000175000017500000003231313233644505022720 0ustar varunvarun/** * Sphinx Doc Design */ body { font-family: 'Verdana', 'Helvetica', 'Arial', sans-serif; font-size: 100%; background-color: #333333; color: #000; margin: 0; padding: 0; } /* :::: LAYOUT :::: */ div.document { background-color: #24326e; } div.documentwrapper { float: left; width: 100%; } div.bodywrapper { margin: 0 0 0 230px; } div.body { background-color: white; padding: 0 20px 30px 20px; } div.sphinxsidebarwrapper { padding: 10px 5px 0 10px; } div.sphinxsidebar { float: left; width: 230px; margin-left: -100%; font-size: 90%; } p.logo { text-align: center; } div.clearer { clear: both; } div.footer { color: #fff; width: 100%; padding: 9px 0 9px 0; text-align: center; font-size: 75%; } div.footer a { color: #fff; text-decoration: underline; } div.related { background-color: #24326e; color: #fff; width: 100%; height: 30px; line-height: 30px; font-size: 90%; } div.related h3 { display: none; } div.related ul { margin: 0; padding: 0 0 0 10px; list-style: none; } div.related li { display: inline; } div.related li.right { float: right; margin-right: 5px; } div.related a { color: white; } /* ::: TOC :::: */ div.sphinxsidebar h3 { font-family: 'Verdana', 'Helvetica', 'Arial', sans-serif; color: #acafb3; font-size: 1.4em; font-weight: normal; margin: 0; padding: 0; } div.sphinxsidebar h4 { font-family: 'Verdana', 'Helvetica', 'Arial', sans-serif; color: #acafb3; font-size: 1.3em; font-weight: normal; margin: 5px 0 0 0; padding: 0; } div.sphinxsidebar p { color: white; } div.sphinxsidebar p.topless { margin: 5px 10px 10px 10px; } div.sphinxsidebar ul { margin: 10px; padding: 0; list-style: none; color: white; } div.sphinxsidebar ul ul, div.sphinxsidebar ul.want-points { margin-left: 20px; list-style: square; } div.sphinxsidebar ul ul { margin-top: 0; margin-bottom: 0; } div.sphinxsidebar a { color: #fff; } div.sphinxsidebar form { margin-top: 10px; } div.sphinxsidebar input { border: 1px solid #9bbde2; font-family: 'Verdana', 'Helvetica', 'Arial', sans-serif; font-size: 1em; } /* :::: MODULE CLOUD :::: */ div.modulecloud { margin: -5px 10px 5px 10px; padding: 10px; line-height: 160%; border: 1px solid #666666; background-color: #dddddd; } div.modulecloud a { padding: 0 5px 0 5px; } /* :::: SEARCH :::: */ ul.search { margin: 10px 0 0 20px; padding: 0; } ul.search li { padding: 5px 0 5px 20px; background-image: url(file.png); background-repeat: no-repeat; background-position: 0 7px; } ul.search li a { font-weight: bold; } ul.search li div.context { color: #666; margin: 2px 0 0 30px; text-align: left; } ul.keywordmatches li.goodmatch a { font-weight: bold; } /* :::: COMMON FORM STYLES :::: */ div.actions { padding: 5px 10px 5px 10px; border-top: 1px solid #598ec0; border-bottom: 1px solid #598ec0; background-color: #9bbde2; } form dl { color: #333; } form dt { clear: both; float: left; min-width: 110px; margin-right: 10px; padding-top: 2px; } input#homepage { display: none; } div.error { margin: 5px 20px 0 0; padding: 5px; border: 1px solid #db7d46; font-weight: bold; } /* :::: INLINE COMMENTS :::: */ div.inlinecomments { position: absolute; right: 20px; } div.inlinecomments a.bubble { display: block; float: right; background-image: url(style/comment.png); background-repeat: no-repeat; width: 25px; height: 25px; text-align: center; padding-top: 3px; font-size: 0.9em; line-height: 14px; font-weight: bold; color: black; } div.inlinecomments a.bubble span { display: none; } div.inlinecomments a.emptybubble { background-image: url(style/nocomment.png); } div.inlinecomments a.bubble:hover { background-image: url(style/hovercomment.png); text-decoration: none; color: #598ec0; } div.inlinecomments div.comments { float: right; margin: 25px 5px 0 0; max-width: 50em; min-width: 30em; border: 1px solid #598ec0; background-color: #9bbde2; z-index: 150; } div#comments { border: 1px solid #598ec0; margin-top: 20px; } div#comments div.nocomments { padding: 10px; font-weight: bold; } div.inlinecomments div.comments h3, div#comments h3 { margin: 0; padding: 0; background-color: #598ec0; color: white; border: none; padding: 3px; } div.inlinecomments div.comments div.actions { padding: 4px; margin: 0; border-top: none; } div#comments div.comment { margin: 10px; border: 1px solid #598ec0; } div.inlinecomments div.comment h4, div.commentwindow div.comment h4, div#comments div.comment h4 { margin: 10px 0 0 0; background-color: #2eabb0; color: white; border: none; padding: 1px 4px 1px 4px; } div#comments div.comment h4 { margin: 0; } div#comments div.comment h4 a { color: #9bbde2; } div.inlinecomments div.comment div.text, div.commentwindow div.comment div.text, div#comments div.comment div.text { margin: -5px 0 -5px 0; padding: 0 10px 0 10px; } div.inlinecomments div.comment div.meta, div.commentwindow div.comment div.meta, div#comments div.comment div.meta { text-align: right; padding: 2px 10px 2px 0; font-size: 95%; color: #598ec0; border-top: 1px solid #598ec0; background-color: #9bbde2; } div.commentwindow { position: absolute; width: 500px; border: 1px solid #598ec0; background-color: #9bbde2; display: none; z-index: 130; } div.commentwindow h3 { margin: 0; background-color: #598ec0; color: white; border: none; padding: 5px; font-size: 1.5em; cursor: pointer; } div.commentwindow div.actions { margin: 10px -10px 0 -10px; padding: 4px 10px 4px 10px; color: #598ec0; } div.commentwindow div.actions input { border: 1px solid #598ec0; background-color: white; color: #073d61; cursor: pointer; } div.commentwindow div.form { padding: 0 10px 0 10px; } div.commentwindow div.form input, div.commentwindow div.form textarea { border: 1px solid #598ec0; background-color: white; color: black; } div.commentwindow div.error { margin: 10px 5px 10px 5px; background-color: #fff2b0; display: none; } div.commentwindow div.form textarea { width: 99%; } div.commentwindow div.preview { margin: 10px 0 10px 0; background-color: ##9bbde2; padding: 0 1px 1px 25px; } div.commentwindow div.preview h4 { margin: 0 0 -5px -20px; padding: 4px 0 0 4px; color: white; font-size: 1.3em; } div.commentwindow div.preview div.comment { background-color: #f2fbfd; } div.commentwindow div.preview div.comment h4 { margin: 10px 0 0 0!important; padding: 1px 4px 1px 4px!important; font-size: 1.2em; } /* :::: SUGGEST CHANGES :::: */ div#suggest-changes-box input, div#suggest-changes-box textarea { border: 1px solid #666; background-color: white; color: black; } div#suggest-changes-box textarea { width: 99%; height: 400px; } /* :::: PREVIEW :::: */ div.preview { background-image: url(style/preview.png); padding: 0 20px 20px 20px; margin-bottom: 30px; } /* :::: INDEX PAGE :::: */ table.contentstable { width: 90%; } table.contentstable p.biglink { line-height: 150%; } a.biglink { font-size: 1.3em; } span.linkdescr { font-style: italic; padding-top: 5px; font-size: 90%; } /* :::: INDEX STYLES :::: */ table.indextable td { text-align: left; vertical-align: top; } table.indextable dl, table.indextable dd { margin-top: 0; margin-bottom: 0; } table.indextable tr.pcap { height: 10px; } table.indextable tr.cap { margin-top: 10px; background-color: #dddddd; } img.toggler { margin-right: 3px; margin-top: 3px; cursor: pointer; } form.pfform { margin: 10px 0 20px 0; } /* :::: GLOBAL STYLES :::: */ .docwarning { background-color: #fff2b0; padding: 10px; margin: 0 -20px 0 -20px; border-bottom: 1px solid #db7d46; } p.subhead { font-weight: bold; margin-top: 20px; } a { color: #24326e; text-decoration: none; } a:hover { text-decoration: underline; } div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { font-family: 'Verdana', 'Helvetica', 'Arial', sans-serif; background-color: #dddddd; font-weight: normal; color: #073d61; border-bottom: 1px solid #666; margin: 20px -20px 10px -20px; padding: 3px 0 3px 10px; } div.body h1 { margin-top: 0; font-size: 200%; } div.body h2 { font-size: 160%; } div.body h3 { font-size: 140%; } div.body h4 { font-size: 120%; } div.body h5 { font-size: 110%; } div.body h6 { font-size: 100%; } a.headerlink { color: #edaa1e; font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; visibility: hidden; } h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, dt:hover > a.headerlink { visibility: visible; } a.headerlink:hover { background-color: #edaa1e; color: white; } div.body p, div.body dd, div.body li { text-align: left; line-height: 130%; } div.body p.caption { text-align: inherit; } div.body td { text-align: left; } ul.fakelist { list-style: none; margin: 10px 0 10px 20px; padding: 0; } .field-list ul { padding-left: 1em; } .first { margin-top: 0 !important; } /* "Footnotes" heading */ p.rubric { margin-top: 30px; font-weight: bold; } /* "Topics" */ div.topic { background-color: #ddd; border: 1px solid #666; padding: 0 7px 0 7px; margin: 10px 0 10px 0; } p.topic-title { font-size: 1.1em; font-weight: bold; margin-top: 10px; } /* Admonitions */ div.admonition { margin-top: 10px; margin-bottom: 10px; padding: 7px; } div.admonition dt { font-weight: bold; } div.admonition dl { margin-bottom: 0; } div.admonition p { display: inline; } div.seealso { background-color: #fff2b0; border: 1px solid #edaa1e; } div.warning { background-color: #fff2b0; border: 1px solid ##db7d46; } div.note { background-color: #eee; border: 1px solid #666; } p.admonition-title { margin: 0px 10px 5px 0px; font-weight: bold; display: inline; } p.admonition-title:after { content: ":"; } div.body p.centered { text-align: center; margin-top: 25px; } table.docutils { border: 0; } table.docutils td, table.docutils th { padding: 1px 8px 1px 0; border-top: 0; border-left: 0; border-right: 0; border-bottom: 1px solid #a9a6a2; } table.field-list td, table.field-list th { border: 0 !important; } table.footnote td, table.footnote th { border: 0 !important; } .field-list ul { margin: 0; padding-left: 1em; } .field-list p { margin: 0; } dl { margin-bottom: 15px; clear: both; } dd p { margin-top: 0px; } dd ul, dd table { margin-bottom: 10px; } dd { margin-top: 3px; margin-bottom: 10px; margin-left: 30px; } .refcount { color: #24326e; } dt:target, .highlight { background-color: #edaa1e1; } dl.glossary dt { font-weight: bold; font-size: 1.1em; } th { text-align: left; padding-right: 5px; } pre { padding: 5px; background-color: #e6f3ff; color: #333; border: 1px solid #24326e; border-left: none; border-right: none; overflow: auto; } td.linenos pre { padding: 5px 0px; border: 0; background-color: transparent; color: #aaa; } table.highlighttable { margin-left: 0.5em; } table.highlighttable td { padding: 0 0.5em 0 0.5em; } tt { background-color: #ddd; padding: 0 1px 0 1px; font-size: 0.95em; } tt.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } tt.descclassname { background-color: transparent; } tt.xref, a tt { background-color: transparent; font-weight: bold; } .footnote:target { background-color: #fff2b0 } h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { background-color: transparent; } .optional { font-size: 1.3em; } .versionmodified { font-style: italic; } form.comment { margin: 0; padding: 10px 30px 10px 30px; background-color: #ddd; } form.comment h3 { background-color: #598ec0; color: white; margin: -10px -30px 10px -30px; padding: 5px; font-size: 1.4em; } form.comment input, form.comment textarea { border: 1px solid #ddd; padding: 2px; font-family: 'Verdana', 'Helvetica', 'Arial', sans-serif; font-size: 100%; } form.comment input[type="text"] { width: 240px; } form.comment textarea { width: 100%; height: 200px; margin-bottom: 10px; } .system-message { background-color: #edaa1e; padding: 5px; border: 3px solid red; } /* :::: PRINT :::: */ @media print { div.document, div.documentwrapper, div.bodywrapper { margin: 0; width : 100%; } div.sphinxsidebar, div.related, div.footer, div#comments div.new-comment-box, #top-link { display: none; } } enthought-chaco2-4.8.1.orig/docs/source/_static/et.ico0000644000175000017500000002362613233644505021675 0ustar varunvarun(f шО00hvh▐ иF00ию( r5(H73iKD]ZZzolСИЕЮЧХдгв╡▒п┐╜╝╟┼┼╒╘╘р▀▀ььь∙∙∙ьs$j▐ьдV4{▐э╢Hж5М┌FЩg@HХЩg╬ @'ИДНюш 9Иcоьк╬х]ИsЮ╒E{▐рИcЭ@EМрИc{bFнЙQEлPkДGЦ\╪ 1╛╓о─}рФmрЁ└А└Ё№( @_-!p3%7)&[B<]VU~okКДВШФТзед┤░о╗╕╢─├├╙╥╥цххўўўэеW╜рэ╞U#X═р╪W╡$i═р█Uке$z▐рьuКЩе5{▐эХjЩЩ╡6Мюэ╢YйЩкv1Gмр╪WйЩЪw▐╫"X╬ fкЩЪЗ╬┼$╛ЪЩЪЧ╛р┤ойЩжНрГоЩШIр q╛ЩзJр Q╬ЩЧJрю▐ры[юЩзJр┌Й╬рюЩЧJр▄c4j▐ЩзJр─5{▐ЩЧJр 1FЬюЩЧJр qGнрЩзI▐ Q#W═рЩз6Ью Q$j╬ркФ#X╜ръA${рж#h═рч1I╨Q$j╬ю╚1<р s4{╔A╬ a5Sор Q}ръA\рч1Jю╓7▐┼╬Х╛р Ё  └  А■°Ё└АА└АЁА°А■А АА|└АxєАp А` А`?А`А8ААА└ААр°№   └  Ё  ° (0`W,"4(%p3%v>1IGF~QFja_~wtОЙЗЮЫЪ│пм┐╝║╘╘╘ъъъ∙∙∙э╣Ы╬рэ╔dFЫ▌р┌w╡Gм▐р▄ЖЫ╡ h╝▐ьжЛке" i╝юэ╖j║ке""!z╜юэ╚i║кк╡"""!К═р┌g║ккке""""Л╬р█Жлкккк╡"""""FЫ▌рьЦЛкккк║Ж""""""Gм▐рэзz║ккклЩ▐е""""""Hм▐╚i║ккклШ╬ У""""" i╬рыh║кккли╛р s""""" Ьр╕лккккинр c"""""!МрЫкккк╣Эр R""""!|рЫккк╣Мрщ2"""!|рЫккк{ю╪2""!|рЫккФн╟2"1МрЫккД╜╡"!МрЫклДнг5нЫккДоюр И▐ЫклДнь╠▐ЫккДоэ╕y╝юЫклДнэ╚@y═юЫккД╜┌`"!К╬рЫклДнУ"""Л═рЫккДн 2""""Gм▐рЫклД╜ s"""""Hм▐ЫккДн b"""" i╜▐ЫклДнр R""""!y═юЫккДМ▐щR""""!К═рЫклqh╝ю╪2""""Ы▐рЫкз0i╠ю╟2""""GЬ▐ЫйR"!z═р╢"""""h╬Ыr"""К╬рьr"""" ╬Х"""""FЫ▌рэ╚B""""#9▐╪3"""""GЬ▐э╩B"""""6╛╟2"""""hм╦p"""""%Эр╢""""" ht"""""#|ре"""""!"""""kр Г"""""""""""Y▐ s"""""""""8╬ b"""""""&╛ъR"""""%Эр╪2"""#|р╟2"#kр╢"Y▐й▐  Ё    └    А  ■?  °  Ё  └  А■°ЁрА└р└°└■└  └  └└  Ё└  №└  ■└■ Г└° я└Ё  └└  └А └А └А └А └р └°?└№└ └?└└Ё└Ё└└└Ё№■  А  р  °?  №       └    Ё    °?  ( f-t1!j/#i1$n3$j2&r4&s4&s5&u5&]0'`1'^2'u5'v5'v6'x6';+(X2(_2(r4(u6(w7(x7(z7(y8(z8({8(P0)s7)z8){8)|9)А:*c5,i9-A1.R4.E3/W7/u=1x?2A97>;:{F:F?>{I>mH?DBAMDB~ODJHHOMLhSOQPPPQQSRRUTTКaW\YXx_[Еc[]]]^^^b_^___dddСpghhhВmhkjijjjРrkРsmnnnrpopppsssuttwwwyyyП~{}}}УЕВЯЙГаКДЕЕЕЛИЗгНИЙЙЙЬОЙМККММКПЛЛбСНжУН░ШУФФФпЪФЧХХЫШХЬЧЦЭЩЦЧЧЧШШШЮЪШЯЫЩаЮЬЮЮЮбаЯбббвввидв╣иджжжозжззз╝пмннн┤░н╡▒о▓пп╢▓п┤▓▒║╢▓│││╡╡┤╡╡╡╜╣╡╢╢╢╣╕╢╜╣╢╜╜╝┼└╜╞┴╛┐┐┐└└└═├└┴┴┴┬┬┬╞┼├───┼┼┼╞╞╞╟╟╟╠╩╔╒╦╔╦╦╦╤╤╤╥╥╥╙╙╙╒╒╘┘╓╓╫╫╫███▌▄▄у▌▄▐▐▐▀▀▀сссуууфффцццчццчччщщщььыьььяээюююяяяЄЁяЁЁЁёёёЄЄЄЇєЄїїїЎЎЎўўў°°°∙∙∙···√··√√√№№№░Ъt@4LhОд┤┤вЛO\b$8PrФй╖╕кЦaKxМ_ *?VЯоНNdЖАcpI 0M}ДWГЕfmб╡Т:1n{|wFvн╕││╢u2!5ИyziAЛ▓▓ЮПУв┤пUSзyxj?Л▒е]GRrХк╖╕yxj>ЗжE-BYБЭ░yzk7lЧ`, %3JgРз~ВZ+DaЛШT)9hЩzC&6OoКe" [аиq. *>;'#QЫ┤лX( <С░ЬH/sм╕Й=^г┤Ё└А└Ё№( @m,6#>%D&K'O(R)P) Y+ q0!2%"`."8'#g1#4($l2%p3%q3%q4%0'&a0&r4&t5&u5&v5&e2'p4't4't5'u5'u6'v6'w6'x6'/)(r6(v6(x7(Y3)z8)v8*l6+2--m:-v;-w>1543Q93v@3lA7vC8;:9wF:><;N?<VA=?>>@??zK@AAAoJAFFF~SHbNIKKKnQKLLLrTMONNPNNБZPQQQSRRVVUdXVXWWНaWЕaX[ZZwa\d_^Йe^Нi_```КiabbbedceedhhhЛphСqh}miТpijjjlkkГplНrlЪwmoooqpopppХxqПwrsssyvuwwwyyyША{ЬБ{}}}~~ЭЕ~БББОДБЪЕБдИБЕВВГГГбМЗЙИИНКЙКККОМКХОНОООУРОбУПРРРЪСРЧУРЧФСкЧТУУУХХХЧЧХЧЦЦЫЩЧйЪЧЪЩЩЮЫЩЫЫЫЯЯЯжвЯ▒вЯббб░згддджедзедлждмиежжжзззййй░лй▓ол╖ом│пмннн┤░нооо╡▒о╢▓п░░░╖│░╕│░▓▓▓╕┤▓╣╡▓┴╡▓║╢│┤┤┤╖╡┤║╖┤╗╖┤╝╕╡╢╢╢║╖╢╕╕╢╗╕╢╜╣╢╛║╢╕╕╕┐╗╕┼╗╣║║║╗╗╗╝╝╝╛╜╜╦└╜╛╛╛┐┐┐┴┴┐├└└┬┬┬───┼──┼╞─┼┼┼╚╚╚╤╩╔╩╩╩╒╬╠═══╥╬═╧╧╧╨╨╨╤╨╨╤╤╤╘╙╙╘╘╘█╓╘╓╒╒╓╓╓┌╫╓╫╫╫┌┌┌▐▄▄▐▐▐у▀▐рррссстттцууфффщхфцццчччшшшышшщщщъъъьъъыыыэээюююяяяЁЁЁЄёЁЄЄЄєєєЇЇЇЎЇЇїїїЎЎЎўўў°°°∙°°∙∙∙·∙∙···√··√√√№№№¤¤¤Ўр╢jjЕ┐▐Ї№ы═ybO =iР╔ц°є┘ЩWВ┼a"Huа╘ь№°у├ihок▓Z!.S╣┌ё■¤э╥WХ╖бЫ▓Z% 9bМ╞тЎї▌лXx╖еЭЫЯ└aBmШ╨ъ№№щ╔ncв┤ЯЭЭкпzq2 !*Nw░┘є°▄РVЛ╖бЭЭиоИК▌·▀r-% 3]Р╪°тwt╡кЫЫб╖ОЗ╤ї╙\#%X┬єШЪ┤ЯЭб┤Ыz╝Ё■╜F' D╢яФоЭЭвкzЩы¤ўП:  E╢яУдЭбЦIгэхv- N┐ёУдЭи}I╗ё┘`')u╒ЎУдЭиБH║Ё■ЁчыЎ■╕Y─Ё■УдЭиБH║Ёї▐╛Чж╥ь№■■УдЭиБH║Ёэ═n65S|║▄єУдЭиБH║Ё№╔J' 9dН╔ц°УдЭиБH║Ё╓<%"DpЮ╒э¤УдЭиБH║ёшs0!.S╗▌єУдЭиБDЮф№█e(! ;gН╔ц°УдЭ│Ж9p░┌ё■╚Q("Guа╫э¤Уз▓СM8bМ╞тЎ∙й> .UД╟эЩнo0@mШ╬ъ№ю~1% KачХL  *Nwл╪я·я╫Т7%%?╦єчГ4%% 3XЕ┐╨╢P& +_╧їсl,$ =g^/#Aмя■╠T($ ! 1Аф№√й>  )[╤ЎЄЙ4 #C▒Ё■█k,1{ч№╩R(%+_╘Ў■Ьf┴ё■ Ё  └  А■°Ё└АА└АЁА°А■А АА|└АxєАp А` А`?А`А8ААА└ААр°№   └  Ё  ° (0`<5"=$H&/"S)m-*" -# X+ s0!b."o1"+%#h0#+%$l2$u3$p3%q3%q4%r4%+&&8)&V.&g2&r4&t4&t5&u5&.('O/'t5'u5'v5'u6'v6'q6(v7(y7(o7)}9),+*V2*g4*x9*:.,x;,/..70.C2.z=/211u=1l=2z@3666X?9:::}E:><<PB>~I>AAALAlKCГODEEEБRFIIIМUIГUJKKK`OKMMMЕZPRRR\TSЗ^TUUUА_WКaWYYYs_Zt`[`^^__^Кg_a``bbaccceeeСofhggiiillkРsknmmpppЧxptsruuuГxvxxxyyy}{yЗ}z{{{ЬВ|}}}А~}КБ~АААВВВЗДВИДВГГГбКЕЖЖЖНКЗЙЙЙгОЙРМКМЛЛСОМПППЭТПжЦСУУУХХХЪЧХйЪХЬЩЧШШШЪЩШЫЩШЪЩЩаЬЩоЮЪЭЫЫЭЬЫеЭЫЬЬЬЮЮЭаЮЭЮЮЮдаЮ░вЯебакбаггг▒жгжжжнйжоли╢лиййй▓нлммм│пм│░н┤░нооо╡▒о╢▒о╢▓п║▓░╖│░▒▒▒╜│▒╕┤▒╢╡▓╣╡▓│││║╢│╜╖│╖╢┤╕╖┤╗╖┤╡╡╡╝╕╡╜╣╢╛╣╢╛║╢╖╖╖╗╣╖└╣╖╝╗╕└╗╕╣╣╣╛╝╣┴╜╗╝╝╝┐┐┐╟┬┐└└└┬┴└┬┬┴╔┬┴┬┬┬┼┼┼╞╞╞╬╔╚╔╔╔╦╦╦╨╦╦╠╠╠╬╬╬╨╨╨╒╤╨╥╥╥╘╘╘┘╓╓╫╫╫╪╪╪┘┘┘▄┌┘▐▄█▄▄▄▐▐▐рррхутуууцффхххцццчччшччшшшщщщыъъыыыььыьььэээюююяяяЁЁЁЄёёЄЄЄєєєЇєєЇЇЇїїїЎЎЎўЎЎўўў°°°∙∙∙···√√√№№№¤¤¤∙ч╚ПО└╫э·√я╒ОV)IицЗ╝ЯЯЯкzEиь√°∙№уl~ф°З╝ЯЯЯкzEиь№Ё▄╙┌ъ°·З╝ЯЯЯкzEиьўс╜tgБ└█я·З╝ЯЯЯкzEиь√ь╧{=?bЦ╠сЇ№З╝ЯЯЯкzEиь·рЮM+$0Lqи╙ъ°З╝ЯЯЯкzEиьЁЛ9!$ 8YА┴▄я·З╝ЯЯЯкzEиьж5$CdЦ╠тЎ№З╝ЯЯЯкzEиь╪c/$0Ltн╒ы∙З╝ЯЯЯкzEиь╩W$$ :ZБ├▄Ё√З╝ЯЯЯкzEвх√йG$!CeШ╬фЎ№З╝ЯЯЯк|?А╧щўїК>$$0Ovн╒ы∙З╝ЯЯб╣o*R}└┌ю·цu7$:ZБ├▄Ё√З╝ЯлЯc5 ?aС╔▐є√╘c&!CeШ╧щ·З┐░D $*JmЮ╨хў╞N$$0RА╙ЇПп\%$ 4Rx╕╫ь∙Ў▄f,! .e╧ЎНF <]Е╟▄Ё··щ╠v=)6Рч√чu7!$EeШ╠тЇ·я┌ЦM'#(T─Ё┘c-#0Otи╨╫╜a+ !AФь√╞Q$# 8Yvh=$$6j┌°∙ЧB$ 1!!%T─єчy7!!!"AТь√╘`&$6j┌°╞Q&"%T┼є∙Ч@$AТь√шy7!$6j┌°╘`&!%S─є╞Q'$AФь√√ЧХф∙  Ё    └    А  ■?  °  Ё  └  А■°ЁрА└р└°└■└  └  └└  Ё└  №└  ■└■ Г└° я└Ё  └└  └А └А └А └А └р └°?└№└ └?└└Ё└Ё└└└Ё№■  А  р  °?  №       └    Ё    °?  enthought-chaco2-4.8.1.orig/docs/source/enable_apptools_integration.rst0000644000175000017500000002113613233644505025441 0ustar varunvarunEnable Apptools Integration =========================== Apptools (https://github.com/enthought/apptools) is a library of useful code for building GUI applications. It includes code for features like preferences, undo/redo support, and selection management. Enable doesn't require Apptools, but developers working within the apptools ecosystem may want to integrate Enable interactions with undo/redo and selections. Undo/Redo Support ----------------- The `enable.tools.apptools` package has a number of modules that provide classes for working with Apptool's Undo/Redo stack. This permits Enable tools to add Commands to the Undo/Redo stack, and provides variants of the MoveTool and ResizeTool that are undoable. In addition, a tool is provided which binds keystrokes to send undo and redo requests to the apptools UndoManager. High-Level Tools ~~~~~~~~~~~~~~~~ There are three tools that provide convenient facilities and reference implementations of interacting with the undo/redo stack. ``UndoTool`` The ``UndoTool`` binds keystrokes to undo and redo operations. The ``undo_keys`` and ``redo_keys`` attributes each take a list of ``KeySpec`` objects which should trigger the relevant operations. The default values bind undo to 'Ctrl+Z' and redo to 'Ctrl+Shift+Z'. The ``UndoTool`` must be provided with an ``IUndoManager`` that will actually perform the undo and redo operations. For example, to bind undo to 'Ctrl+Left arrow', and redo to 'Ctrl+Right arrow':: undo_tool = UndoTool( my_component, undo_manager=my_undo_manager, undo_keys=[KeySpec('Left', 'control')], redo_keys=[KeySpec('Right', 'control')] ) my_component.tools.append(undo_tool) ``MoveCommandTool`` The ``MoveCommandTool`` is a subclass of ``MoveTool`` that by default issues a ``MoveCommand`` at the end of every successful drag move. A ``MoveCommand`` stores the new and previous position of the component so that it can undo and redo the move. The ``MoveCommandTool`` needs to be provided with an ``ICommandStack`` instance that it will push commands to, but is otherwise identical to the usual ``MoveTool``. The command tool has a ``mergeable`` attribute which indicates whether subsequent move operations with the same component immediately following this one can be merged into one single move operation. Typical usage would be something like this:: move_tool = MoveCommandTool(my_component, command_stack=my_command_stack) my_component.tools.append(move_tool) Users of the tool can provide a different factory to create appropriate ``Command`` instances by setting the ``command`` trait to a callable that should expect keyword arguments ``component``, ``data`` (the new position), ``previous_position``, and ``mergeable``. ``ResizeCommandTool`` The ``ResizeCommandTool`` is a subclass of ``ResizeTool`` that issues ``ResizeCommand`` s at the end of every successful drag move. A ``ResizeCommand`` stores the new and previous position and bounds of the component so that it can undo and redo the resize. The ``ResizeCommandTool`` needs to be provided with an ``ICommandStack`` instance that it will push commands to, but is otherwise identical to the usual ``ResizeTool``. The command tool has a ``mergeable`` attribute which indicates whether subsequent resize operations with the same component immediately following this one can be merged into one single resize operation. Typical usage would be something like this:: move_tool = ResizeTool(my_component, command_stack=my_command_stack) my_component.tools.append(move_tool) Users of the tool can provide a different factory to create appropriate ``Command`` instances by setting the ``command`` trait to a callable that should expect keyword arguments ``component``, ``data`` (the new rectangle as a tuple ``(x, y, width, height)``), ``previous_rectangle``, and ``mergeable``. Command Classes ~~~~~~~~~~~~~~~ The library provides some useful ``Command`` subclasses that users may want to create specialized instances or subclass to customize the behaviour of their applications. They may also be of use to ``CommandAction`` subclasses outside of the Enable framework (such as menu items or toolbar buttons) which want to interact with Enable components. ``ResizeCommand`` This command handles changing the size of a component. The constructor expects arguments ``component``, ``new_rectangle`` and (optionally) ``previous_rectangle``, plus optional additional traits. If ``previous_rectangle`` is not provided, then the component's current rectangle is used. Instances hold references to the ``Component`` being resized in the ``component`` attribute, the new and previous rectangles of the component as tuples ``(x, y, width, height)`` in the ``data`` and ``previous_rectangle`` attributes, and whether or not subsequent resize operations on the same component should be merged together. The tool handles the logic of changing the position and bounds of the component appropriately, as well as invalidating layout and requesting redraws. It also provides a default ``name`` attribute of ``Resize `` plus the ``component_name`` (which in turn defaults to a more human-readable variant of the component's class). Instances can improve this by either supplying a full replacement for the ``name`` attribute, or for the ``component_name``. Finally, there is a ``move_command`` class method that creates a ``ResizeCommand`` that just performs a move and is suitable as the command factory of a ``MoveCommandTool``, which allows easy merging between resize and move operations, if required for the application. ``MoveCommand`` This command handles changing the position of a component. The constructor expects arguments ``component``, ``previous_position`` and (optionally) ``new_position``, plus optional additional traits. If ``new_position`` is not provided, then the component's current position is used. Instances hold references to the ``Component`` being moved in the ``component`` attribute, the new and previous positions of the component as tuples ``(x, y)`` in the ``data`` and ``previous_position`` attributes, and whether or not subsequent move operations on the same component should be merged together. The tool handles the logic of changing the position of the component appropriately, as well as invalidating layout and requesting redraws. It also provides a default ``name`` attribute of ``Move `` plus the ``component_name`` (which in turn defaults to a more human-readable variant of the component's class). Instances can improve this by either supplying a full replacement for the ``name`` attribute, or for the ``component_name``. Base Classes ~~~~~~~~~~~~ There are two simple base classes of tools that are potentially of use to authors of new tools. ``BaseUndoTool`` Tools which need to be able to trigger undo and redo actions, or otherwise interact with an undo manager (for example, to set the current command stack or clear the command history) can inherit from this class. It has an ``undo_manager`` attribute which holds a reference to an ``IUndoManager`` and provides convenience methods for ``undo`` and ``redo`` using the undo manager. ``BaseCommandTool`` Tools which need to perform undoable actions may want to inherit from this class. It provides a standard ``command_stack`` attribute which holds a reference to an ``ICommandStack``. It also has a ``command`` callable trait that can be overriden by subclasses to create an appropriate command when demanded by the UI. In addition to these simple base tools, authors of Tools or Actions that perform undoable operations on Enable or Chaco components may want to make use of the following ``Command`` subclass: ``ComponentCommand`` This class is an abstract base class for commands which act on Enable ``Components``. It provides a ``component`` attribute which holds a reference to the component that the command should be performed on, and a ``component_name`` attribute that can be used to help build the ``name`` of the ``Command`` to be used in textual representations of the command (eg. in menu item labels). The default ``component_name`` is just a more human-friendly version of the component's class name, with camel-case converted to words. Users are encouraged to override with something even more user-friendly. enthought-chaco2-4.8.1.orig/docs/source/kiva.rst0000644000175000017500000005246113544354521020627 0ustar varunvarunKiva ==== Kiva is a 2D vector drawing interface providing functionality similar to `Quartz `_, `Cairo `_, the `Qt QPainter interface `_, the 2D drawing routines of `OpenGL `_ , the HTML5 Canvas element and many other similar 2D vector drawing APIs. Rather than re-implementing everything, Kiva is a Python interface layer that sits on top of many different back-ends which are in fact provided by some of these libraries, depending on the platform, GUI toolkit, and capabilities of the system. This approach permits code to be written to the Kiva API, but produce output that could be rendered to a GUI window, an image file, a PDF file, or a number of other possible output formats without any (or at least minimal) changes to the image generation code. Kiva is the base layer of the Chaco plotting library, and is what is responsible for actually drawing pixels on the screen. Developers interested in writing code that renders new plots or other graphical features for Chaco will need to be at least passingly familiar with the Kiva drawing API. The most important Kiva backend is the Agg or "Image" backend, which is a Python extension module which wraps the C++ `Anti-grain geometry `_ drawing library into a Python extension and exposes the Kiva API. The Agg renders the vector drawing commands into a raster image which can then be saved as a standard image format (such as PNG or JPEG) or copied into a GUI window. The Agg backend should be available on any platform, and should work even if there is no GUI or windowing system available. Kiva Concepts ------------- This section gives a whirlwind tour of the concepts involved with drawing with Kiva. The Graphics Context ~~~~~~~~~~~~~~~~~~~~ The heart of the Kiva drawing API is the "graphics context", frequently abbreviated as ``gc`` in code. The graphics context holds the current drawing state (such as pen and fill colors, font state, and affine transformations to be applied to points) and provides methods for changing the state and performing drawing actions. In many common use-cases (such as writing renderers for Chaco), you will be provided a graphics context by other code, but it is straight-forward to create your own graphics context:: from kiva.image import GraphicsContext gc = GraphicsContext((400, 400)) This is an graphics context for the Agg or "image" backend which has a size of 400x400 pixels. If instead we wanted to draw into a Qt ``QPainter`` drawing context in a `QWidget` called `my_qwidget` we would use:: from kiva.qpainter import GraphicsContext gc = GraphicsContext((400, 400), parent=my_qwidget) Other Kiva backends have similar methods of creating a graphics context, and each may take somewhat different arguments to the constructor, depending on the requirements of the backend. Once you have a graphics context, you can use it to draw vector graphics. For example, the following code will draw a translucent gray line from (100, 100) to (100, 200):: gc.move_to(100, 100) gc.line_to(100, 200) gc.set_stroke_color((0.5, 0.5, 0.5, 0.5)) gc.stroke_path() For many of the backends, you can save the rendered image out as an image file using the ``save()`` method:: gc.save("my_line.png") Kiva is numpy-aware, and has a number of methods that allow you to pass numpy arrays of points to draw many things in one operation, with loops being performed in C where possible:: from numpy import empty, linspace, random # Nx2 array of points pts = empty(shape=(20, 2), dtype=float) pts[:, 0] = linspace(100, 200, 20) pts[:, 1] = random.uniform(size=20)*100 + 100 gc.lines(pts) gc.stroke_path() Coordinate Model ~~~~~~~~~~~~~~~~ Kiva uses mathematical axes direction conventions as opposed to framebuffer axes conventions. In other words, the origin is always at the *bottom* left of the screen, and the positive y axis goes *up* from bottom to top; as opposed to screen coordinates which typically have the origin at the *top* left and the positive y axis goes *down* from top to bottom. Additionally, for backends that produce raster images, the coordinates represent the *corner* of pixels, rather than the center of pixels. This has consequences when rendering thin lines. Compare the two lines in this example, for instance:: from kiva.image import GraphicsContext gc = GraphicsContext((200, 100)) gc.move_to(40, 35) gc.line_to(160, 35) gc.move_to(40, 65.5) gc.line_to(160, 65.5) gc.set_stroke_color((0.0, 0.0, 0.0)) gc.stroke_path() gc.save("pixel_coordinates.png") Notice that the line on the bottom (the first of the two lines) is fuzzier because it is drawn along the boundary of the pixels, while the other line is drawn through the center of the pixels: .. image:: kiva_images/pixel_coordinates.png The Coordinate Transform Matrix ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Kiva API allows arbitrary affine transforms to be applied to the graphics context during drawing. The API provides convenience methods for common transformations, such as rotation and scaling:: from numpy import empty, linspace, random, pi from kiva.image import GraphicsContext # Nx2 array of points pts = empty(shape=(20, 2), dtype=float) pts[:, 0] = linspace(100, 200, 20) pts[:, 1] = random.uniform(size=20)*100 + 100 gc = GraphicsContext((400, 400)) # draw a simple graph gc.move_to(100, 200) gc.line_to(100, 100) gc.line_to(200, 100) gc.set_stroke_color((0.5, 0.5, 0.5, 0.5)) gc.stroke_path() gc.lines(pts) gc.set_stroke_color((1.0, 0.0, 0.0, 0.5)) gc.stroke_path() # translate by 100 pixels in the x direction gc.translate_ctm(100, 0) # rotate by 45 degrees gc.rotate_ctm(pi/4.0) # scale by 1.5 in the x direction gc.scale_ctm(1.5, 1.0) # now draw in the transformed coordinates gc.move_to(100, 200) gc.line_to(100, 100) gc.line_to(200, 100) gc.set_stroke_color((0.5, 0.5, 0.5, 0.5)) gc.stroke_path() gc.lines(pts) gc.set_stroke_color((0.0, 0.0, 1.0, 0.5)) gc.stroke_path() gc.save('transformed_lines.png') .. image:: kiva_images/transformed_lines.png If desired, the user can also supply their own transformations directly. Paths ----- The basic drawing operations are performed by building a path out of primitive operations, and then performing stroking and/or filling operations with it. The simplest path operations are ``move_to()`` and ``line_to()`` which respectively move the current point in the path to the specified point, and add a line to the path from the current point to the specified point. In addition to the straight line commands, there are 4 arc commands for adding curves to a path: ``curve_to()`` which draws a cubic bezier curve, ``quad_curve_to()`` which draws a quadratic bezier curve, ``arc()`` which draws a circular arc based on a center and radius, and ``arc_to()`` which draws a circular arc from one point to another. Finally, the ``rect()`` method adds a rectangle to the path. In addition there are convenience methods ``lines()``, ``rects()`` and ``line_set()`` which add multiple lines or rectangles to a path, reading from appropriately shaped numpy arrays. None of these methods make any change to the visible image until the path is either stroked with ``stroke_path()`` or filled with ``fill_path()``. The way these actions are performed depends upon certain state of the graphics context. For stroking, the graphics context keeps track of the color to use with ``set_stroke_color()``, the thickness of the line with ``set_line_width()``, the way that lines are joined with ``set_line_join()`` and ``set_miter_limit()``, and the way that they are ended with ``set_line_cap()``. Lines can also be dashed using the ``set_line_dash()`` method which takes a pattern of numbers to use for lengths of on and off, and an optional ``phase`` for where to start in the pattern. Thicknesses:: from kiva.image import GraphicsContext gc = GraphicsContext((200, 100)) for i in range(5): y = 30.5 + i*10 thickness = 2.0**(i-1) gc.move_to(40, y) gc.line_to(160, y) gc.set_line_width(thickness) gc.stroke_path() gc.save('thicknesses.png') .. image:: kiva_images/thicknesses.png Joins:: from kiva.image import GraphicsContext from kiva.constants import JOIN_ROUND, JOIN_BEVEL, JOIN_MITER gc = GraphicsContext((200, 100)) gc.set_line_width(8) for i, join in enumerate([JOIN_ROUND, JOIN_BEVEL, JOIN_MITER]): y = 20 + i*20 gc.move_to(y, 80) gc.line_to(y, y) gc.line_to(160, y) gc.set_line_join(join) gc.stroke_path() gc.save('joins.png') .. image:: kiva_images/joins.png Caps:: from kiva.image import GraphicsContext from kiva.constants import CAP_ROUND, CAP_BUTT, CAP_SQUARE gc = GraphicsContext((200, 100)) gc.set_line_width(8) for i, cap in enumerate([CAP_ROUND, CAP_BUTT, CAP_SQUARE]): y = 30 + i*20 gc.move_to(40, y) gc.line_to(160, y) gc.set_line_cap(cap) gc.stroke_path() gc.save('caps.png') .. image:: kiva_images/caps.png Dashes:: from kiva.image import GraphicsContext gc = GraphicsContext((200, 100)) dashes = ([6.0, 6.0], [9.0, 3.0], [3.0, 5.0, 9.0, 5.0]) gc.set_line_width(2) for i, dash in enumerate(dashes): y = 30.5 + i*20 gc.move_to(40, y) gc.line_to(160, y) gc.set_line_dash(dash) gc.stroke_path() gc.save('dashes.png') .. image:: kiva_images/dashes.png Before filling a path, the colour of the fill is via the ``set_fill_color()`` method, and gradient fills can be done via the ``set_linear_gradient()`` and ``set_radial_gradient()`` methods. Finally, there are two different fill modes available: `even-odd fill `_ and `non-zero winding fill `_ Winding vs. Even-Odd Fill:: from numpy import pi from kiva.image import GraphicsContext from kiva.constants import FILL, EOF_FILL gc = GraphicsContext((200, 100)) gc.set_fill_color((0.0, 0.0, 0.0)) gc.move_to(50, 90) for i in range(1, 6): theta = 4*pi/5*i x = 50+40*sin(theta) y = 50+40*cos(theta) gc.line_to(x, y) gc.fill_path() gc.move_to(150, 90) for i in range(1, 6): theta = 4*pi/5*i x = 150+40*sin(theta) y = 50+40*cos(theta) gc.line_to(x, y) gc.eof_fill_path() gc.save('fill.png') .. image:: kiva_images/fill.png Text ~~~~ Text can be rendered at a point by first setting the font to use, then setting the text location using ``set_text_position()`` and then ``show_text()`` to render the text:: from kiva.fonttools import Font from kiva.image import GraphicsContext gc = GraphicsContext((200, 100)) gc.set_font(Font(size=24)) gc.set_text_position(30, 40) gc.show_text("Hello World") gc.save('text.png') .. image:: kiva_images/text.png Text defaults to being rendered filled, but can be rendered with an outline. Kiva Interface Quick Reference ============================== This document is a summary of the classes and functions available in Kiva. More specifically, it describes some of the details of the kiva.agg backend, including enumerated types and helper classes. Types ----- Primitive types ~~~~~~~~~~~~~~~ The following conventions are used to describe input and output types: color: Either a 3-tuple or 4-tuple. The represented color depends on the graphics context's pixel format. rect: (origin_x, origin_y, width, height) bool: an int that is 1 or 0 point_array: an array/sequence of length-2 arrays, e.g. ((x,y), (x2,y2),...) rect_array: an array/sequence of rects ((x,y,w,h), (x2,y2,w2,h2), ...) color_stop_array: an array/sequence of color stops ((offset,r,g,b,a), (offset2,r2,g2,b2,a2), ...) where offset is some number between 0 and 1 inclusive and the entries are sorted from lowest offset to highest. AffineMatrix ~~~~~~~~~~~~ All of the following member functions modify the instance on which they are called: __init__(v0, v1, v2, v3, v4, v5): also __init__() reset(): Sets this matrix to the identity multiply(`AffineMatrix`): multiples this matrix by another invert(): sets this matrix to the inverse of itself flip_x(): mirrors around X flip_y(): mirrors around Y The rest of the member functions return information about the matrix. scale() -> float: returns the average scale of this matrix determinant() -> float: returns the determinant The following factory methods are available in the top-level "agg" namespace to create specific kinds of :class:`AffineMatrix` instances: **translation_matrix(float x, float x)** **rotation_matrix(float angle_in_radians)** **scaling_matrix(float x_scale, float y_scale)** **skewing_matrix(float x_shear, float y_shear)** FontType ~~~~~~~~ __init__(name, size=12, family=0, style=0): constructs a :class:`FontType` instance is_loaded() -> bool: returns True if a font was actually loaded CompiledPath ~~~~~~~~~~~~ Interface is the same as the `Path functions`_ in Graphics Context. Enumerations ~~~~~~~~~~~~ The following enumerations are represented by top-level constants in the "agg" namespace. They are fundamentally integers. Some of them also have dicts that map between their names and integer values line_cap: CAP_BUTT, CAP_ROUND, CAP_SQUARE line_join: JOIN_ROUND, JOIN_BEVEL, JOIN_MITER draw_mode: FILL, EOF_FILL, STROKE, FILL_STROKE, EOF_FILL_STROKE text_style: NORMAL, BOLD, ITALIC text_draw_mode: TEXT_FILL, TEXT_INVISIBLE (currently unused) pix_format: (NOTE: the strings in the dicts omit the ``pix_format_`` prefix) dicts: pix_format_string_map, pix_format_enum_map values: pix_format_gray8, pix_format_rgb555, pix_format_rgb565, pix_format_rgb24, pix_format_bgr24, pix_format_rgba32, pix_format_argb32, pix_format_abgr32, pix_format_bgra32 interpolation: dicts: interp_enum_map, interp_string_map values: nearest, bilinear, bicubic, spline16, spline36, sinc64, sinc144, sinc256, blackman64, blackman100, blackman256 marker: (NOTE: the strings in the dicts omit the ``marker_`` prefix) dicts: marker_string_map, marker_enum_map values: marker_circle, marker_cross, marker_crossed_circle, marker_dash, marker_diamond, marker_dot, marker_four_rays, marker_pixel, marker_semiellipse_down, marker_semiellipse_left, marker_x, marker_semiellipse_right, marker_semiellipse_up, marker_square, marker_triangle_down, marker_triangle_left, marker_triangle_right, marker_triangle_up path_cmd and path_flags are low-level Agg path attributes. See the Agg documentation for more information about them. We just pass them through in Kiva. path_cmd: path_cmd_curve3, path_cmd_curve4, path_cmd_end_poly, path_cmd_line_to, path_cmd_mask, path_cmd_move_to, path_cmd_stop path_flags: path_flags, path_flags_ccw, path_flags_close, path_flags_cw, path_flags_mask, path_flags_none Graphics Context ---------------- Construction ~~~~~~~~~~~~ __init__(size, pix_format): Size is a tuple (width, height), pix_format is a string. State functions ~~~~~~~~~~~~~~~ :save_state(): :restore_state(): :set_stroke_color(color): :get_stroke_color() -> color: :set_line_width(float): :set_line_join(line_join): :set_line_cap(line_cap): :set_line_dash(array): array is an even-length tuple of floats that represents the width of each dash and gap in the dash pattern. :set_fill_color(color): :get_fill_color() -> color: :linear_gradient(x1, y1, x2, y2, color_stop_array, spread_method, units): spread_method is one of the following strings: pad, reflect, repeat. units is one of the following strings: userSpaceOnUse, objectBoundingBox. This method modifies the current fill pattern. :radial_gradient(cx, cy, r, fx, fy, color_stop_array, spread_method, units): same arguments as linear gradient. The direction of the gradient is from the focus point to the center point. :set_alpha(float): :get_alpha() -> float: :set_antialias(bool): :get_antialias() -> bool: :set_miter_limit(float): :set_flatness(float): :get_image_interpolation() -> interpolation: :set_image_interpolation(interpolation): :translate_ctm(float x, float y): :rotate_ctm(float angle_in_radians): :concat_ctm(`AffineMatrix`_): :scale_ctm(float x_scale, float y_scale): :set_ctm(`AffineMatrix`_): :get_ctm() -> `AffineMatrix`_: Clipping functions ~~~~~~~~~~~~~~~~~~ :clip_to_rect(rect): :clip_to_rects(rect_array): :clip(): clips using the current path :even_odd_clip(): modifies the current clipping path using the even-odd rule to calculate the intersection of the current path and the current clipping path. Path functions ~~~~~~~~~~~~~~ :begin_path(): :close_path(): :get_empty_path() -> `CompiledPath`_: returns a blank :class:`CompiledPath` instance :add_path(`CompiledPath`_): :move_to(x, y): :line_to(x, y): :lines(point_array): :rect(x, y, w, h): :rects(rect_array): :curve_to(x1, y1, x2, y2, end_x, end_y): draws a cubic bezier curve with control points (x1,y1) and (x2,y2) that ends at point (end_x, end_y) :quad_curve_to(cp_x, cp_y, end_x, end_y): draws a quadratic bezier curve from the current point using control point (cp_x, cp_y) and ending at (end_x, end_y) :arc(x, y, radius, start_angle, end_angle, bool cw=false): draws a circular arc of the given radius, centered at (x,y) with angular span as indicated. Angles are measured counter-clockwise from the positive X axis. If "cw" is true, then the arc is swept from the end_angle back to the start_angle (it does not change the sense in which the angles are measured). :arc_to(x1, y1, x2, y2, radius): Sweeps a circular arc from the pen position to a point on the line from (x1,y1) to (x2,y2). The arc is tangent to the line from the current pen position to (x1,y1), and it is also tangent to the line from (x1,y1) to (x2,y2). (x1,y1) is the imaginary intersection point of the two lines tangent to the arc at the current point and at (x2,y2). If the tangent point on the line from the current pen position to (x1,y1) is not equal to the current pen position, a line is drawn to it. Depending on the supplied radius, the tangent point on the line fron (x1,y1) to (x2,y2) may or may not be (x2,y2). In either case, the arc is drawn to the point of tangency, which is also the new pen position. Consider the common case of rounding a rectangle's upper left corner. Let "r" be the radius of rounding. Let the current pen position be (x_left + r, y_top). Then (x2,y2) would be (x_left, y_top - radius), and (x1,y1) would be (x_left, y_top). Drawing functions ~~~~~~~~~~~~~~~~~ :stroke_path(): :fill_path(): :eof_fill_path(): :draw_path(draw_mode=FILL_STROKE): :draw_rect(rect, draw_mode=FILL_STROKE): :draw_marker_at_points(point_array, int size, marker=marker_square): :draw_path_at_points(point_array, `CompiledPath`_, draw_mode): :draw_image(graphics_context img, rect=None): if rect is defined, then img is scaled and drawn into it. Otherwise, img is overlaid exactly on top of this graphics context Text functions ~~~~~~~~~~~~~~ :set_text_drawing_mode(text_draw_mode): :set_text_matrix(`AffineMatrix`_): :get_text_matrix() -> `AffineMatrix`_: :set_text_position(float x, float x): :get_text_position() -> (x, y): :show_text(string): :show_text_translate(string, float y, float y): :get_text_extent(string) -> (x,y,w,h): :get_full_text_extent(string) -> (w,h,x,y): deprecated. Order has been changed for backwards-compatibility with existing Enable. :select_font(name, size, style): :set_font(`FontType`_): :get_font() -> `FontType`_: :set_font_size(int): :set_character_spacing(): :get_character_spacing(): :set_text_drawing_mode(): :show_text_at_point(): Misc functions ~~~~~~~~~~~~~~ :width() -> int: :height() -> int: :stride() -> int: :bottom_up() -> bool: :format() -> pix_format: :flush(): Force all pending drawing operations to be rendered immediately. This only makes sense in window contexts, ie- the Mac Quartz backend. :synchronize(): A deferred version of flush(). Also only relevant in window contexts. :begin_page(): :end_page(): :clear_rect(rect): Clears a rect. Not available in PDF context. :convert_pixel_format(pix_format, bool inplace=0): :save(filename, file_format=None, pil_options=None): Save the GraphicsContext to a file. Output files are always saved in RGB or RGBA format; if this GC is not in one of these formats, it is automatically converted. If filename includes an extension, the image format is inferred from it. file_format is only required if the format can't be inferred from the filename (e.g. if you wanted to save a PNG file as a .dat or .bin). pil_options is a dict of format-specific options that are passed down to the PIL image file writer. If a writer doesn't recognize an option, it is silently ignored. If the image has an alpha channel and the specified output file format does not support alpha, the image is saved in rgb24 format. Functions that are currently stubbed out or not implemented ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :show_glyphs_at_point(): enthought-chaco2-4.8.1.orig/docs/source/enable_key_events.rst0000644000175000017500000001006113233644505023344 0ustar varunvarunEnable Keyboard Events ====================== Previous versions of Enable had just one keyboard event, a 'key_pressed' event. This event conflated which key(s) were physically being pressed with the text which should be generated by that keypress. All the underlying windowing/event systems have a way of distinguishing these two pieces of information, either by issuing separate events for each (Wx, Pyglet, Vtk), or by storing them as different attributes on the event object (Qt). In addition, there was no way to detect a key-up event. This is a comparatively minor use case, but potentially useful for doing things like toggling pointer states to indicate different mouse behaviour when modifiers keys are pressed. New Events ---------- key_pressed: We will keep the 'key_pressed' event. However the semantics will change so that it will keep track of the physical key being pressed rather than the text being entered. Thus pressing the 'a' key with the shift key down will result in an event with the 'character' attribute set to 'a', instead of 'A' as it would be now. The lower-case version of the character will be the canonical representation of the key, since that will cause minimal problems with existing event handlers in Enable and Chaco. The character mapping will be used as it is now to map special keys to standard strings (like right arrow generating the string 'right'). In addition, events will now be generated by pressing modifier keys by themselves (eg. pressing shift will generate an event). Most Chaco code will continue to use key_pressed as the primary event to listen to, it will just work more consistently than it did before. Some code may need to change to reflect the change in what the character attribute returns (XXX or we add a 'key' attribute and deprecate the 'character' attribute). On Wx this event will be generated by EVT_KEY_DOWN, on Qt, this event will be generated by keyPressEvent, but will access the 'key()' attribute rather than the 'text()' attribute. key_released: We will introduce a new 'key_released' event, which is essentially the mirror image of the 'key_pressed' event. On Wx this event will be generated by EVT_KEY_UP, on Qt, this event will be generated by keyReleaseEvent, but will access the 'key()' attribute rather than the 'text()' attribute. character: We will introduce a new 'character' event, which will hold the unicode characters, if any, that are generated by the key press event. It is possible that this event may also be generated by other mechanisms in the future, like pasting text. The event may hold multiple characters. This event will not be generated if the key_pressed event is handled. This is largely because this is the way that wx works, but it also makes a certain amount of sense from an interaction modelling point of view. This will never do key mapping to standard Enable names for non-printable characters: if there is no appropriate unicode representation, no event will be emitted. The handful of Enable widgets which expect actual text input will be changed to use the character event instead of the key_pressed event. On Wx this event will be generated by EVT_CHAR, on Qt, this event will be generated by keyPressEvent, but will access the 'text()' attribute rather than the 'key()' attribute. Why Three Events? ----------------- Qt's two-event model is generally nicer and cleaner, but adapting the other backends to use that model would require holding global state from EVT_KEY_DOWN (or its equivalent) to fold in to the Enable event generated from EVT_CHAR. This seems potentially fragile. The other alternative would be to try to work out from the EVT_KEY_DOWN what text would be generated, and that seems even more fragile. On the other hand, adapting Qt to a 3-event model is straightforward: on keyPressedEvent we generate a 'key_pressed' event, and if text() is non-empty, we subsequently also emit a 'character' event. enthought-chaco2-4.8.1.orig/docs/source/conf.py0000644000175000017500000001426013544354521020435 0ustar varunvarun# -*- coding: utf-8 -*- # # Enable documentation build configuration file, created by # sphinx-quickstart on Mon Jul 21 22:01:37 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable (module imports are okay, they're removed automatically). # # All configuration values have a default value; values that are commented out # serve to show the default value. import sys, os # If your extensions are in another directory, add it here. If the directory # is relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. #sys.path.append(os.path.abspath('some/directory')) # General configuration # --------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General substitutions. project = 'enable' copyright = '2008-2019, Enthought' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. d = {} execfile(os.path.join('..', '..', 'enable', '_version.py'), d) version = release = d['full_version'] # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directories, that shouldn't be searched # for source files. #exclude_dirs = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # Options for HTML output # ----------------------- # Use enthought-sphinx-theme if available try: import enthought_sphinx_theme html_theme_path = [enthought_sphinx_theme.theme_path] html_theme = "enthought" except ImportError as exc: import warnings msg = """Can't find Enthought Sphinx Theme, using default. Exception was: {} Enthought Sphinx Theme can be downloaded from https://github.com/enthought/enthought-sphinx-theme""" warnings.warn(RuntimeWarning(msg.format(exc))) # Use old defaults if enthought-sphinx-theme not available # The name of an image file (within the static path) to place at the top # of the sidebar. html_logo = os.path.join("_static", "e-logo-rev.png") # The name of an image file (within the static path) to use as favicon of # the docs. This file should be a Windows icon file (.ico) being 16x16 # or 32x32 pixels large. html_favicon = os.path.join("_static", "et.ico") # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. html_style = "default.css" # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, the reST sources are included in the HTML build as _sources/. #html_copy_source = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'Enabledoc' # Options for LaTeX output # ------------------------ # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). latex_documents = [ ('index', 'Enable.tex', 'Enable Documentation', 'Enthought', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True enthought-chaco2-4.8.1.orig/docs/source/enable_drag_and_drop.rst0000644000175000017500000000601713233644505023761 0ustar varunvarunEnable Drag and Drop Events =========================== Enable has support for objects being dropped onto components built on top of the backend's (and, in practice, PyFace's) support for drag and drop. All drag-and-drop related events have type ``DragEvent`` and provide the ``x`` and ``y`` coordinates of the event, and the object being dragged or dropped (if it is available from the backend, otherwise this will be ``None``). The system generates 3 types of drag and drop events: ``drag_over`` These events are generated when the user is moving a dragged object over the Enable window. Tools or other Interactors which want to indicate that they can accept the drag should indicate this by calling the ``set_drag_result()`` method of the Enable window indicating the type of operation that will be performed on the object (the default is a "copy", but other possibilties include "move" or "link", the full list of possibilites is found in the appropriate ``constants`` module). The value of the drag result influences the way that the operating system displays the dragged objects and cursor whil dragging. ``drag_leave`` This event is generated when the user drags objects out of the window. ``dropped_on`` This event is generated when the user releases the mouse button over the Enable window while dragging. Tools or other Interactors should handle this event to perform whatever operations need to be performed with the dropped objects. BaseDropTool ------------ As a convenience, there is a ``BaseDropTool`` class which handles most of the drag and drop interactions for you correctly. To use this, you need to subclass and override at least the ``accept_drop`` and ``handle_drop`` methods. ``accept_drop`` This method is given the position and object instance and should return ``True`` if the drop is accepted or ``False`` if it is not. ``handle_drop`` If the drop is accepted, this method is called with the position and the objects, and should perform whatever actions are required with the dropped objects. The behaviour is slightly different between the Wx and Qt backends: Qt provides a reference to the dragged objects during ``drag_over`` events, and so the ``BaseDropTool`` will call ``accept_drop`` during ``drag_over`` events to give better feedback about the state of the drag and drop operation; whereas Wx does not provide that information, so will always indicate to the operating system that a drop is possible. The type of drag result returned during ``drag_over`` events is controlled by the ``default_drag_result`` attribute. If you want more control over the response to ``drag_over`` events, then you can additionally override the ``get_drag_result`` method to return one of the drag result constants dependin on the position and (possibly) the objects being dragged. If you want cross-toolkit compatibility, you must handle the case where the ``get_drag_result`` method is called with the object being ``None``, which indicates that the object is not known yet. enthought-chaco2-4.8.1.orig/docs/source/kiva_images/0000755000175000017500000000000013544357563021423 5ustar varunvarunenthought-chaco2-4.8.1.orig/docs/source/kiva_images/thicknesses.png0000644000175000017500000000070313233644505024442 0ustar varunvarunЙPNG  IHDR╚d├Ж КIDATxЬэ▄QN├0AВ╕w{єr┤|T╚OaцVЭUь8щїz╜^└П>OЦ В@ В@ В@ В@ В@ В@ В@ В@ В@ В@ В@ ┬╫щ№ц∙|Юh}~пїV╝оыЇ°CуЧЯ%Б@Б@Б@Ш?y<зЗ└?6'YbAД∙=╚·╗:╝g}~чў ▐┼║╖ё╦╧ К@ ╠яAЬГp╥№N▓─В Б Б0 Шw¤U▐│>┐єПy╜jroуЧ▀■─A!'═▀Aр$ЫtБ Б Б єЕN╥яm¤n>РїР{│─В Б Б Б єЕыїєЮї∙ї╔-K,Б Б Б Б Б Б Б Б Б Б Б Б Б Б ▀Ц@'╩├Х5IENDоB`Вenthought-chaco2-4.8.1.orig/docs/source/kiva_images/joins.png0000644000175000017500000000075513233644505023250 0ustar varunvarunЙPNG  IHDR╚d├Ж ┤IDATxЬэ█┴Н┌P@Q;JlиБ(ГnаEjаJ ╗мв;К╠h▐x╬┘"Ysї╨╖▀·z╜^ ЁO┐╛·0Щ@ В@ В@ В@ В@ В@ В@ В@ В@ ┬янX╫5 ▀Хўщ╧уg1A В@ В@ В@ В@ В@ В@ В@ l▐∙ю>┌сsM▀╟1A В@ В@ В@ ь■=╚Ї{vf3A В@ В@ В@ В@ В@ |╗o▒ьРя╦ЇoхLБ у╣^п_}°k\ ╖█M$М1.Рe sМ dYD┬ ыkуEЇGя%ж▀sC;A`Б@Б@Б@Б@Б@ДO▀I╖CNЩ■нЮ A as З├счАС6r>Я▀p ШiєFсуёXNз╙Є|>▀u&~Р▌▀bП╟х~┐/Ч╦┼▀-vgєБ=sЛA A A A A A A с╘3ARTкє╙IENDоB`Вenthought-chaco2-4.8.1.orig/docs/source/kiva_images/fill.png0000644000175000017500000000522113233644505023045 0ustar varunvarunЙPNG  IHDR╚d├Ж XIDATxЬэЭYHTя╟Яr#├▌(-┤║╔╠Tдh▒─% *!▓Е║╩Ёв}╣JДвEoъF╝0 ГJmL\╗*kьж4ЬД▄w╘╞╞ё< Л▀o·╫╧Щу,чЬў=gЮ╝рz▐ч╝Яєї}Э9ЛВ░ЛЮu┴3ВБB"P@B AИ@!( !Д DаАДЪHgg'tuu▒.Г°-∙╨D@jjjажжЖu─┐h╔ЗN чb%''ГNзГ╧Я?│.Еm∙P}@zzz !!сў╟ы╫пg\Сwг5к_b¤9ХkeZW3Zєб·А╝|∙╥ю╟┤цC╒Kм╛╛>ИЛЛ√¤╣NзГ▐▐^X│f ├к╝-·Pї R[[√╫чИ╕фkДrh╤ЗкboНлЕuпZ╤в╒.▒FFF`їъ╒ ┬__╫ыї044QQQМ*єN┤ъC╡3HmmэВ и~ZW#Zїб┌АИM▌jЯ╓╒ИV}иrЙ511╤╤╤░╕╕hў√╛╛╛022aaa WцЭh┘З*gГ┴рPА╒jГ┴а`E▐НЦ}и2 ╬L┘jЮ╓╒ЖЦ}иnЙ533ССС`▒XD╬▀▀╞╞╞`х╩Х UцЭh▌ЗъfР···eeX,x¤·╡y7Zўб║А╕2UлuZWZўбк%╓▄▄DDD└№№╝S?ууу$se▐Й7°P╒ ╥╪╪ш┤ │┘ ННН2Vф▌xГU─Э)ZН╙║ZЁкYb═╧╧CDD╠══╣Ї{┴┴┴0>>+VмРй2я─[|иfinnvY└?ыфЦЦ*Єn╝┼Зjт╔╘м╢i] xЛU,▒, DFF┬╠╠М[┐ cccрчч'qe▐Й7∙P┼ ╥┌┌ъ╢ АщщihmmХ░"я╞Ы|и" RL╔jЪ╓y╟Ы|╕╝─jjjВ╔╔I╣ъYВ╒jЕ3g╬H▓н╩╩JЁёёСd[╬╣╣╣▓Ў┴┬╟│g╧ ""┬гэМПП├ёу╟∙ўБ.╥▀▀П╗wяFа&╥Ўь┘Гоп╦(эcя▐╜Т╒ЮЩЩ╔╜ЧВИ╕╕╕И┼┼┼шуу├№@фн∙°°`qq1...║3┤nбдП╟ПKVўгGП╕ўсV@l╝{ў╫о]╦№афе┼┼┼с√ўя=RПР█ЗNз├бб!╔ъф▐ЗGADЬЪЪ┬#GО0?8Y╖гGПт╘╘Фз├щ1r·╪▒cЗфїn▀╛Эk─Fyy92?PХnБББX^^.╒0JЖ>╩╩╩$п│┤┤ФkТ▒││УТТШ┤J╡дд$ьььФr%Ej╜╜╜Т╫°у╟о}HDD│┘МЕЕЕ╠^╣█Е p~~^ъсУй|дее╔Vcjj*╖>$И Г┴Аaaa╠dй[XX╓╫╫╦5l▓сйП╗wя╩V█Э;w╕ї![@}н[юЦЩЩЙГГГrЩмxт├d2╔VWww7╖>d т?п╤ЧФФапп/є▄▌цыыЛ%%%К╛╖!ю°HJJТ╜о═Ы7sщCЎА╪hkk├°°xц╗л->>█┌┌Ф&┼p┼Gqq▒ьї▄╛}ЫKКqzzП;╞№аw╢хччуЇЇ┤ТCд(╬·°·їль╡|∙ЄЕKК─FEE╫яЩaEEЛбaВШПMЫ6)RГ ╕qуFю|0 "bWWn┘▓Еy■█ТУУё█╖oмЖЕО|▄║uK▒n▐╝╔ЭfADЬЯЯ╟вв"цб░╡вв"U╝╖!Ў|ttt(╓┐╤hф╬╙А╪hhh└ЁЁpf┴╟ЖЖ╓├└ 6ы╫пGAыW\╖nW>╕╣&}xxbccЩЇ=44111L·цХссa8pрНFE√▌║u+466rуГЫKncbb 55Uё~╙╥╥╕С┴111а╫ыс╞Н░░░ { p¤·uЁєєу╦ы)╠F__ъt:┼ЧW:Э√√√Yя>w№щ#=={zzdылзз╙╙╙╣Ї┴═ R[[ ╚`╡ЗxЦ╖№щг╜╜ТУУб║║ZЄ~клл!99┌██АClє∙vю▄╔ьЯЇ]╗v▒▐}юpфуЇщ╙8;;ыёЎgggё╘йS▄√р" ├├├и╫ыЩDп╫у╚╚ыaрЖх|$&&в╤ht{√FгUсГЛ%V]]Э▌gl+Е PWW╟м▐X╬З╔dВММ (++s╔Ы PZZ `2ЩDОмКИ╕o▀>f│Знeee▒np┼Gnn.ООО.╗═╤╤Q╠══UЭцЩШШртTx___ЬЬЬd=╠q╟GTT╢┤┤8▄fKK FEEй╥є%Ц┴`л╒╩║ U?╦[J▄ё1:: 999pэ┌╡┐шi▒Xръ╒лРУУггг.mУмЪЧЧ╟|Ў░╡¤√ў│цxъ#-- ┐ О&У╔уk═yЁ┴ЇTgЯ▒╜Ё°1├j}Ц╖TР;░LgUUХGaВГГё╔У'┐╖WYYЙ┴┴┴mєщ╙з GД-фc)Lrш╨!╖.55╒юН║╗╗q█╢mnoўЁс├ FВ╚╟RШdnn\0ЭNЗЧ.]BЛ┼тp█┐~¤┬Л/║unW@@╬══)8|@>ь├, ╧Я?wy░ввв░╣╣┘щ>ЪЪЪ022╥х~^╝x!уЮє ∙░│А╕zєЖЬЬ╖N?┴ььlЧ·╩╧╧ЧaП∙Ж|╪ЗI@╠f│╙ ╝∙∙∙с¤√ў=║▓M╝wя·∙∙9╒gpp0Ъ═f ўШo╚ЗcШф╒лWN LBB~·ЇI▓~?~№И Nїm0$ыЧw╚ЗcШдаа`┘)((Рф┤ъ ЄєчOgЬC▒+ █┌┌ ;;МF#ддд(╒н█ддд@GGdee┴ЗXЧ#9ф├9╗`jjj VнZеDWТгц┌бц}R▓vnn^M<┬№ж ┴3ВБB"P@B AИ@!( !Д DаАДВБB"P@B AИ@!( !Д D°▄аМ╛RSIENDоB`Вenthought-chaco2-4.8.1.orig/docs/source/kiva_images/caps.png0000644000175000017500000000106013233644505023042 0ustar varunvarunЙPNG  IHDR╚d├Ж ўIDATxЬэ▄═Нт@Е╤ЄhТ0┬ з@v:РK╟р& f▌?║ЪMwХр╔√'─зvAў|>Я°╓Я┌@╦Б@ Б@ Б@ Б@ Б@ Б@ Б@ Б@ Б@ ■╓р│оыjП@Eн¤╤з Б@ Б@ Б@╨▄sР╓юГє▐lБ@ Б@ Б@ Б@ hю,╓g~г■┌Z?{gГ@ Б@ Б@ 4 дї√ф╝6Б@ Б@ Б@ Б@ Ъ d█╢2╧sЖбt]чzсkЖ2╧s┘╢нЎ█ю[▌│▒╙Аы║Цуё╪ь ╞╧ш√╛▄n╖2ОcэQ>hnГ\.q╝бm█╩їzн=╞═mР▌n'Р7╒ў}╣▀я╡╟°а╣ -i.Р╙щT{*9Я╧╡G°в╣ПXы║Ц├сPПGэQ°E╛д зq╦▓,eЪж▓▀яkП├█яўeЪж▓,KsqФ╥рБЦ4╖Aа%Б@ Б@ Б@ Б@ Б@ Б@ Б@ Б@ Б@  LиUю2 ~IENDоB`Вenthought-chaco2-4.8.1.orig/docs/source/kiva_images/transformed_lines.png0000644000175000017500000003016113233644505025636 0ustar varunvarunЙPNG  IHDRРРА┐6╠08IDATxЬэ▌iФTїЭ ёOї╛▌@Ль аИ ў}┴─Чh4jL▄Hт╠9╔,Oч╤╠Г9sцЬ93є╧─Dc6cpПВEFQPDФ}У╡ЫЖn║щ·?°ц┌╒╒╡▄√л[U╖к▀пs< ╜╘╜═ё▄O}▀▀Л╟уqPE▒oPЪАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NАрД8!@NДfы╓b▀АB"@ЪНеW_ХО/ЎЭ(б╣°bi┼ щ_ U:|╕╪w ▀ДжвB·щOэ╧ ∙Я╥Ц-E╜Э@ОЧ6o.Ў]е%П╟у┼╛ ФЧuыд'ЮРккд+пФ╬9GК┼К}WЩн\)╜№▓4iТt∙х╥╪▒┼╛# ·ф┼вE╥ю▌Rw╖4|╕4oЮTSSь╗JнгC·▀ Хю║K┌▒CZ║T9R║ь2√ 5y╤╒%=№░tЎ┘╥Ўэ╥╢m╥m╖I--┼╛│■/╢Щ7╧■▐▌-╜ўЮЇ╬;╥─Й╥еЧFє╛Бb#@Р7{ЎH┐∙Нt▀}╓_x¤uщ║ыд╙N+ЎЭї:p@·х/еФю√╡c╟lhk┼ iъTщТKдццв▄&IЄъ╜ўдў▀╖┘│GzЄI Р+п┤ж{▒=їФ4bДЕC:╥Єх╥_ *MЯ.]tQ ░"yП[h47KW_-9"=√м ▌rЛ4hPёюm█6╗╖┐ {¤ЩЎv╓·ЁCщ▀Р.╝Pjh╚√mСEА яОХz╚ЖпN>YъщС▐zK·р Сёу Oё╕Їшг╥мY╥Щg√┘╓Vk┤п]k=Ює╬УъъЄrЫ@д (И═Ыm╕шЗ?ь■Y┐^·╙Яlт┘gvкяЮ=╥cП┘║╫б┤,╫п╖9√ьш╬4Є!г╨&LРf╧ЦЮ{╬▐¤KVН▄┐ =єМ5н ев┬Ў╣ЇaЖХn╝Q║чiчNщ■╟Ъю▌▌б▌&i цтЛm┼ў▓e╜Я:T║ў^й║┌ж¤ю▌[Ш{йк яA▀╥"▌zлн#┘╕╤╓ФмZ┼Ю`( жвB║∙fЫ╗m[ячллm ╞╣чJ┐■╡нd╧╖0─3rдt╟╓╫∙ш#щg?│П==с^И ╒╘d═ЇgЮС:;{?ЛYC√╬;mG▀╫^╦яГ7т7N·■ўеып╖!нЗТ6l╚╧╡Аb"@Pp╙жIУ'█v'╔S8FПЦц╧ЧvэТ~ў╗№эъЫ╧ёЬtТн╣ЄJ[ЩФEqї╒╢W╓ъ╒¤┐╓╨`Х╚Д ╢J<UUVZАф{b,&ЭrКЕ&PnEu╡ї /ЦЎэы їК █╠Ё║ыд l((╠З},f!BгpGАаhFМ░н╙Я~:¤p╥)з╪T▀>░ьaNї-─0P╬╒мY╢═╔ыпз ЮбCнЧPY)=ЄHъК┼фЖAQ┼b6Еw▌:[╤ЭNu╡t├ v8╒гПЖ3╒ЧrCАашъыm}╚є╧Kmmщ┐╧Ыъ{╟сLїнкbvР СРjлУt╞М gкяШ1м╧rAА 2RmuТО7╒w№xўй╛│f┘Ц#l' ╕!@щ╢:╔Ї¤Ч_▐;╒ў▌wГЕ┴°ёЎ¤∙Xg "%qлУО?s╩)6Kk╒к`S}c1щм│ь─D┴ ИЬi╙д)Sд_Ї_Q ц6╒wцLщ│╧№ЗА^"iю▄Ї[ЭдуMї=√lЫъ√щз┘ж▒╤ЎхZ│╞¤^ББКA$%nuфМРX╠fs▌qЗЇЄ╦╢@1█T_ЪщАСхgлУt╞М▒уswюФ~ {й╜=¤ўЮtТm-┐cGnў 4ЬЙg▌▌v&xOП4jФmI╥╘$ ▐∙цё╕ЇфУЎ║▀№fЁЯящСЦ,▒cso╜╒╬ъHхэ╖эМєyєr╣[``!@РУO>▒№Д (┌╗∙!Cьбя¤чЕKSУ}н║┌ 5О╡CЩо╗╬╬Qwё┘g╥ /HЧ\"═Щ╙?р┌┌ь┴°й╢╓э└@CА go╛)m┌$▌}wя9З┘Ў єс├╥йзJ\`╟└·▒y│Ї╘S6,5x░█}ю▀/=ёДtтЙF55}┐╛`Б╘мYnп 4rПK№гэЪ√нoe ■О[{ёЧ┐╪├№В дЙ│{╜їЦ╔ў╛ч>D╓╒e'!ю┌%}ч;╥Ёс╜_[┐▐┬p■|╖╫Ъш╚Y,f+╚7lЁ7э╢о╬Bу'?СN;═╓{<№░ ЗeЪ1u╤E■╖:Iз║Z║ёF╞JЮъ;y▓5█wэr}` бAhЎьС~єщо╗ьls┐тq{Р/[&9"Э╛tцЩ╢[n▓CЗlяля~W;6╖√▌╛▌·7╙з█lпК k╕╖╖K╫^Ы█kВP}ЄЙm╡>╛-╥ "Ч╢l▒ ┘▒├╬■Ш=█╢{O┤nЭн∙снЪ╔E{╗mЫП█║Уюnk╪ у?kЇВ╨¤∙╧╢Aс▌w█╗z{ЎXР|■╣ЇНoHчЮk│╖OлW█,й={ sэЖщ╢█дЧ^▓ц:№!<eH sРqЇh█╖квB:у Ы╗|yaNу5╩╬ЇX░└·1╚МЁ@╘ %`щR█.=,3f╪ьвНm▒▄зЯZР8▐52]√╘Sm√РlG═dДJR╬9╟Ё╧>▐k^qЕЭ▌ёю╗╥~`│Ч~X·рГ№W#W]eM¤7▀╠яuJсБRAАФА║:;i═щ╣ч┬yчю5╢╜-╪/╕@·■ўеХ+mИщЁс▄пСщ┌╖▐j┐╧'Яфя:еИЁ@)!@J─ь┘╥╠ЩЎ░ ├lq`оъъl[Ї╫_╖═O ▄>Ё@яT╪н[н┌7╬N╠u█Їt>№╨z<єччяеАЁ@)в)!╒╒╢}y┬│╧┌.╡╣║рi╪0лD╝yMНї^о┐▐кСW^щ Ш0═ЭkU╒Т%с┐v╘(eHБЇЇДў√вЛl┼W_┘4▄w▀╡^B.+╦c1щЖь5Wмш√╡)Sд ╪ы┐°Еm╠ж╩J ├>ш{Fy╣#щO▓▌~o╝╤*Ш\?n!8eКt╔%╣┐^T(7T VQaG╝65┘║ЗGХVнr╖=dИmP°▄s╜3д╞П╖ц·╪м*╫JчЫ▀┤┘Qo╝С■{ЖЧю╣GЪ4╔Вlїъ▄+З╩Jщ;▀С▐▀╓иФ┬хИ)В╞F{W┐{╖tэ╡6Ї╘Sю;╘ЮqЖ Н¤∙╧╜Яkn╢9rD·▌ядЎЎрпы═О·°у╠чxTT╪╠░╗я╢УЯ|╥эzЙ╢k? |ъ^L)! ~╜Dу╞IЧ]fMї╬╬▄^лXФ3z EЎ╩+Ў√╗▀╡Uх╧?oл│/╜╘*А ╓п╖ї ?■q mA╓мС^}UЪ7OЪ:5°}о]kН ∙є-T▓┘╝┘z#'ЭdAY[№ЪRяyюVС╕ЎsКБЁ@╣#@Кмз╟ЖШ╞Н│-╓██э┴{фИ5╪З ЎzЛY/фжЫ·m█6щЙ'дs╧Х╬??°├°Н7мB·■ў¤Е[gзЕ╓_XГ}т─`╫єtw█lпSO╡б▓R@x` `л╚╝н═?·╚╓З46Jw▄a/=ЄHЁжЇ▄╣╢bк╡&c╟┌ЖЙl!╒▌ь^/╗╠╛ЇТ┐{кн╡КчЪklхт┼┴п)┘ п█n│ў╣LO.┬HDь▄)¤■ўv╕╙ИЎ╣▌╗э┴;bДэIхw╖┌н[н╥°╤ПlЕw▓о.Ы╡╒╓fцT▀УNgз█┘g█:┐О▒ъhя^лОFНЄ │Ю═ЫнA▀}┴+│B!<0РPБфhу╞p╝yMї─є┬╜є9м)╜eЛ┐╫7╬ф╜ЁBъ{ло╢кgЄd;Еp╫. ўY[k¤Ъ%KВ5№ьЪ^h[о,]№`м l]╚O╪Їти!<0╨ 9┌┐▀╢ЇcЧ┌Щ3mkїgЯэ}╕VW█╨╖╛eя╛Ч,ёўр╜фл0VнJ¤їX╠їsчZ&╚сQ├ЖI7▀,=¤┤tЁа ЯЛ┼lhn■| Я_¤*XxIVїМeУ вT;ИР═Шa═щ ·п`╙tо║╩┬(∙╝ЁйSmкн[нб|р@ц╫ё6\№єЯ-ф╥9¤tщо╗дЧ_╢к└яCyЄd[щ╛`AЁjай╔ж.╧Ъe├vЛ√ o╩ЄБ╥Єх┴оЫ/Д*z !xщ%kvWW█;єIУr{╜ЎvZЪ;W:э┤╛_Л╟m╖▄e╦lе°ЇщЩ_k┼ л.~ЁГЇ█СHVн,X`╒┼╝yЎ╗dП[%╨╒e;ї║L▒mo╖┘┤╔кмSOїўsЗ┘┐╤M7YШ сББМ $sц╪ўжЫl°i┼К▄ЖW2ЭЛ┘▄╗юТ▐z╦ЪсЩ┘Э{оG╢wыГ[╚H╢U[[Ў√М┼м╣Ёаmшшв▒╤■▌n╝Qzэ5 ▒CЗ▓ \SУЕ╓│╧fп╞ЄЕЁ└@GАДрДь┐гGнщ╜fН=╪rщЛдjк'}■|Ыт·╨C6МЦJ,fчх╦│ў╝ jъT{w┐cGЎ√мк▓Хъя╜Ч█╩єУN▓Р#G┌ЮZ+VdяїLЬhыBЮx"?'%fBx aЕцУOд┐№E║ў^{Ш-Zd╙po╗M:╘¤uWкзВZ╖╬оw╬96╦)╒ў}°б=Фx└·┘м[g+└п╜╓·$┘l█fM▌sПЕi.Ўэ│ЭАП▒ gь╪Ї▀Пўn¤~є═ЕYйNxf└W {Ўь╤ю▌╗s~ЭSO╡бЬ▌╗эЭ№Н7┌y┐·ХMїuХойЮh┌4k░∙еЇ█▀жЪ9╙·Щ^'∙5я╛█·KЦdТ;╓z6№г√жРЮс├н╔~■∙VБ╜°b·жb1;│¤лп,└єНЁz °ill╘╞НsСК ЫUЇю╗ЎўX╠*В[n▒w╚╦Ч╗їE╝q╜Хъщ b№УOЦ~∙K█╗*С╫пX╜┌ф∙1rдU,7┌n┴┘fJЭyж =¤tЁ5╔╝)┐ўwЎZ?√ЩнаO╖охЎ█mbAтfТa#<А╛Р╞F═Ь93ФЩ5╦▄ЙяЦ'Nь▌>фЩg▄└56┌∙йЪъЙb1┬║єN█╖ъ∙ч√^п▒╤▐н щO■w╖4╚Ў╛ко╢щ├┘▄W]e∙╫^єў·┘╘╫█=ч;╓иь▒╘╙ТЫЫmыЩg┬ЩNЭМЁ·Ё"Е"Г┘)zлWў¤|SУї*+mH╦e╓╨ш╤ЩЫъ╔▀√├┌ЯzH┌╛╜ўkSзZ├·ХW№_█;mЁМ3lУt {йwoп╧>ы яРЛqуl╥└дIvKЧЎ▀Wk╥$Ў ╗йNxй VИ╠Щ#¤їп¤ЗZ╝╛╚Yg┘╨е/Тjеz:55╥ 7╪┐П?.╜єNя╧\}╡н╗2k*│ЕГ╫_o}О5k╥o}╜ )╜·j▀Ё╩Ueе▌├№∙bй╬O9я<ыб,Z╬Ju┬HПIFИМo║Tcё^_ф╓[mi┘▓р9?MїDзЯn▄їыm╒wkлэguуН6╦*ш╔БзЬbCZo╛iл▄╙▌ И╢ ёЙ'№н) в╣┘fе]qЕЕй╖¤╜d ╞єц┘ФeпхКЁ2co эээZ╜z╡&OЮмO<1Ё╧┐ўЮm;~√эщ┐ч╨!{╕jХBMMР√│F∙╒Wў_йЮNOПU!+WZ3}┌4ыSь█gSНГNmo╖╜╣ъынўРю■Ч.╡s═Ё╙ЗГъь┤0√ш#щ╩+нСЛ┘0с#ПXяd┬ДрпKx┘QБдРk%2cЖ═t╩╘pnj▓5#╒╒┴√"ЩVкзSQ!]|▒╜s_╝╪кП /┤ы║Ї*m╓WCГ▌║╞їE┘ ▒░ЖФТ╒╓┌Ц.w▌e┴¤Ы▀╪Ф▐бCmЕ√╙O√[┘ЮИЁ№б╔ ЧJфхЧэ]∙Wd■╛x▄z&o╜eяфГьы┤z╡¤▄№∙■╧ Сь]√K/Yт┬ {ПкmnЎ Юx▄кЪe╦lhn№°■▀sьШЕ╠7╛a[лфKOПЕ╚Т%╥ь┘^+W┌в╚{юёWАHо!▓wп╜■щO¤=╕6o╢w╦AПЫї│R=ЭП>ъЭН╒╥b├Lо+╣7l░ї.W]e├H╔┤!е06Ы╠жн═~п;l%¤кU╜з#f·¤ Ж░▓p╬ji▒F▓▀s6&LРю┐▀ >¤┤ ї"AЫъЙжO╖kjЦ╦┌Н)S,АЦ.╡К&yЦXs│-к|цЩ╠█╦ЗaЁ`лЖо╜╓V▒wwKЯ~j╒I:ДтГkИ╠Щl&Р╖^дж╞▐н√y╨z+╒╫м╔╝R=ЭбCн3sжнЦў█SIхДl╤ф╬Э6╒7y▒т─ЙvИ╒В■2цb╩щ┴эd╟гG-LRн┬'<7ИO.!2uк5pГЬ║WUeC-│g[▀`├?ў╝йЮив┬╬ў▐kХ╠ёу┴_├S_o эцf ┴ф╔│g█в@o─|ло╢>╘Г┌▀¤ы╛╙К └=РАВЎDЦ.╡Зш 7┐Ц╫9ч[@Чн?с┌TO╘╤a╫йнu√∙Dя╛k┐ -╖Xїс9~▄6}<щ$щ▓╦r┐О_ё╕▌╙╞Н6╜╖▓ТЁrAА8"GО╪FАw▐i[М╒┌jыEЪЪlё_╢ї"╣4╒єсЛ/мяq∙х╢WШчЁa;s$╚ZЦ░┤╖K==qm▀Nx╣И└#жЇ╬jh░m╬.t█бv╚ыЛ╘╓·ыЛф╥T╧ЗIУlhl┼ Ы┌ь¤ ╘;ьdИ/ Д─QРЩ1├zочUx}С9s▓ўErmкч├Ёс6█kя^щш▌нxЇh;}┴В▐нHЄНЮ$~C─;ЛуЭw▄╖П┼,@n╗═╢i√эЇMш\Ыъ∙PWg├x--VIэ█gЯЯ>▌v∙}Є╔▄Ъў~@╕Р∙ Сa├lз╪_╠mЎ╤°ё6UЎ╙O3ЄФ╕¤{║╙№ нв┬*Оє╬У}╘·#ТїGклmў▐|!<АЁ !Ё"чЯo╙zУO ╩ыЛ╘╒eюЛ╠Ьi'>єLю'Жi╓,f{ЎY█╞евB·Ў╖-P▐?№ы@~ !ё"ХХvЮ╞+пф~nxUХ╜Ц╫Y┐>їў═Энж║gтDщ╛√lZэвE╜╟╥╛ёЖ┤eKx╫!<А№!@Bф'D╞Н│iлa∙Ъ╪yсЕ╘}С─ж║▀mU eшPkо╖╢┌Q╡ 6U∙йзВяаЫ сф2?!r┼6У*╒╢.╝╛╚gЯY3:yЫпй╛patЪъЮ┌Zл╩MuO,f3╓n╛┘■■я ▐┐wCx┼├vюЦn+°╫_╖}▓n╣%╫▐║╒╓X╠Ю-]tС=а_~┘V▓Ge√ўt╢l▒ln╢sц%┬(╢?2╩S║JфТKд;№7М]МgыE╓п╖3F:;г▀TўМ/¤шGr}DxQ@R$й*С/╛░ЩS>Ш¤ри\tw[х▒eЛ-тллУ~∙KщЫ▀┤щ┼Q╓╒%н\WK сHСдкD&MТ&L╚ ╛U^_ф▄smXh√Ўш7╒=UUДHе С╣sm▀кЭ;є¤Y│мY┤╚Ж╡ц╬НvSЭa+ Z┬КАфсм╒лэЇ┬(Lc╗н═╓К46┌pV{{ЇЪъД=zD \╔Х╚МЎ _╣▓0╫ў╓Л d}СЭ;г╒T'<Аh"@""1DЎь┘ныо│э┘]П└ к▓╥О▌╜р[П▓ti4Vк@t Т"▌▌╗C97иY│ьМ╔ж·│йNx╤FАDLbИLЮ╝;Ф#pГ;V·з▓? ▀ хgЕ|6Д}Hy!▓i╙FЭ{юWzї╒▄П└ jЁ`щ_■E6Lz■∙┬n NxеБYXц═╬·Є╦i2dио┐╛8ў▒jХm!2iR■пExеГ $┬╝JdЇшO╡jU[hGрu╓YДА■РИkll╘┘g╧╨╔'o╨уП╖Жvn╘@щ!@J@ccгn╕сuuэ╘┬Е√Л};б#<А╥DАФИ╞╞F=Ё└XUUе>╖T@щвЙ^b╥Э'RКа┤QБФШL╟уЦ┬(}H *ї!<АЄ@АD╚жMЫ┤i╙&_▀[к!BxхГ)aе"ДP^РW*!BxхЗ)Q┬(OHЩИjИ@∙"@JUКУжRЖ╚ю▌╥ЎэЕ╜╖┐!<АЄFАФк╖▀N∙щ~!▓cЗК▒ c^├cёbщ╪▒Ё^АдїЇHя┐ЯЎРО>!▓vн┤zuAo/яХ╟О╥С#с╛&А└РR┤sз}╠p╩╘╫!▓}{A{"╢┌┤I┌╡+№╫RК6n┤ПY▐Е766jfCГ6J СВДЗ╖u[╣юkФдyтуЬ█╞┌Z═Ф№═╬Z╕░ўP┴цЎСКО)5ЭЭ6Д5iТ┐>@eе%═Ь>={Иl▐ьЇ`.шlл╢6√╪▐Ю┐kЁЕ)5_~)Н+ тлQgз$й1╧╝N$ЧЎю №`.°T▌╓V√HАEGАФЪНе╔УеЖ╚╤г╥р┴Rkkц┼Ж▐╣л╦ўнeЭЗWБ0 (:д╘l▄(MЩ"╒╫gп@тq{╨О∙ї;ў┤!rшР}№[┼ТM╤ ╢╡I'ЮHDRJ░t#F°л@║║дК i╪░▐бе oe╗╫д╬аи+╠[[-й@Ав#@JЙ7|Л∙л@О▒а2дOАH)B─л@▓H╤╖'ik│бКО)%^АH■*РгG-hRИФ";v╪'3╚╫сqЇижЯvZqЎ╢jmХFН"@А @JEOП═└Ъ4╔■Юcт∙:Dvя╓южж┤╥зЄилSхфЄ█╕kkУЖ╖■NАЖ?АЁ еb√vй╣Y4╚■Bтill┤┼Жїї┌╜o_┐пў╢:vмw╚лРО╖▀й▒╤■г КК)Й├WRoТiх╕WБ lя▄╙l╛(IНннЪyЄ╔┌╕woЯ┘Y){лVI╦ЧЗё[s°░¤>Hй╪░бoАTUIХХЩ╖5ў*Рк*йо.¤ўo├VН#Fhfcу╫Нї┤ єъъР~йАZ[нЪТ№пГР7H)8zT┌│G?╛ячыы3?D╜ D╩<МuЁа╘╘$╒╒й▒╗√ы╞·╩Х+S╧╢кн═щ╫q╓╓f╒ФDDR ╛№╥┬гккяч27╥╜ D╩ ══Vеtt|▌X@2U GПZxХ╦▀╬щ╫└>v╠■kl┤┐g Рc╟l¤╔ЁсюrЇиt▌u╥╥е■╖#щь┤╨ёж3Дu√ЎеюHЩ+Р─■ЗdЛ jk√ бC6|хM╢щш░╫mnvР#GlV┘╕q╥╗я·√Щ╓╓▐ъC▓&~O√aEDАDY<Юy+[тї?<йЖ▒╝║зо.єбR▐┌Т┴Г-LВЮбюrU_/]vЩmЙтзqЯ8|%Yр1МeээЎаLOР DJ ^▌Унё$│╫ ┌Hў╣ко╢^╚╔'K+Vd ╣─║Зa,аиР(╦4|%ЕSБx tПЯёєMM┴З▒╖WСдK/╡aмlХDr"QБEFАDYжс+╔z]]йз├·н@R a∙щБHn}Рф√jnЦжOЧ▐~;є╧ел@аhР(╦ ЩО╢MWБ$9%a╒╓·┬Тьсt+╒}]|▒┤zuц╫JWБ0Д eЩжЁz╥їВЇ@ВaхZБ$╚аA╥мY╥▓eщ.U┬PTHФeыБH┴+Р─9~▄шЙяь ╤I6IЪ1CZ┐>¤╧ек@hвEEАDUOП=ЬЗ═№}.И╖ШЁ╨!{(W$№oРяHк`УlFVggъ╒Є^╨y╟∙zи@Ав"@въ└{`f;¤/▌T▐TъЪ{=пbInаK┴Ж░Ж ▒xР=нR aI╓╧Щ0┴Ў╔Jv°░ЕEE╥ оPTHT∙╛Т╥OхM7TФ8МХ▄@ЧВHEEя)~е╗/╔d╙ж■ЯO╒ Р┬КМЙкl3░<й*o├├TяЇУ$h╥╤╤█СВўA╥▌ЧФ╛I╒ Р┬п@\║($к№╠└ТRW ╟ОYuР|о╘7@╝}░й@др}РtCXТtтЙ6\u°p▀╧з РЪ>╦e?му╟е╡kе_№B┌▒├¤uАИЙк\*РLяЄ│U ╒╒ЎPM╒╫H▐"^ ╛$╙VEЕЭ¤╛eK▀╧з┬ЄЎ├r╞jo╖▌А √┐m%|[Ы┤}{Ё╫░oQ ╣Ї@2=дЗ щ&J╒DO<─█т▌╙╤a ╖jnN=ьФNжpУz√ зЭ╓√╣╢6ЫеХК7МХ\Iеs№╕┤pбЇщзvН;я┤╩ч¤ў√АМР(ъь┤Зuкw▌╔\+РЮЮЇяь3Hbї!ыБtw█╝ж&¤ўLЬ(╜ЁB▀╧е╗O)°v&╦Ц┘ы¤ф'}Cv╠Ы:°CXQ┤oЯ4lXъclУ╣T ннЎо╛б!uЯ$]$╣ !┬Єю+╙яхЭtШ°;еыБH┴Ж░Ўя╖│╪ч═ы {Мa .~╢Ц ЙЙ&┐¤йw%zт "?Hк║'▌Щ йдйй╖в╔&█ЁХdзО█;,Пgо@№╬─К╟еEЛд /ь?l'Y eфHщ@H∙эHЎ└ною√└╧TБx=М]╗R?Hе`Heе=─█┌▓▀kжXЙзєvv┌¤zG┘&є;Дї╤Gv¤s╧M =c╞╨H @в╚я^Or$█;¤!Cдн[ГHкИф┐Т)╪MЬ╪ Щк╔▀╓С#╥т┼╥ї╫ў_═ЮИ!@в(╚Ц╘┐ТэA=dИ═8╩4Дх╖С№ўA№ aI╥ш╤вЭЭЩ√Т┐!м╫^УN?▌"/@XP°BАDM╢s╨S ZБ45еЮ┬ыq Р0+Рк* С-[▓W ┘╢3┘┤I┌╕Q║№Єь╫mn╢Yb~Жу Qko╖ЮЖЯн╟еС┬н@№И▀ Dъ╞╩ещю╢╞∙5╫дяб$К┼мБ╧0р 1Хл>дрИў@NWБд;Х0МИ▀ёщннЩ$S}эZ╗╖SOїwMЙ>1.┤ё╓~д[╨ЧпИ▀!,╔*Б▌╗mэFж!м┌Zvъюю ╡їынў°FАDL┼┴Г■зЁz+os┴TХВg╪░╠п4@╝ЮJ╢цsР!мъj█bфЛ/2W ▐~X╔UHOПї>жLёw=╧ш╤╢ДF:Р1Х√ўчVБxG╬fZэ}┬ ╥┤iщ┐4@клнH▐E7YР!,╔· RЎ-]R cm█f┴цg;Шф╫jl┤Y`2"@"жтрA╖ё*?яЄkkеє╧O їаы@$НЇ CXТ4nЬ}L>╩6Yк╡ ы╫K'Яь ZЙ╞|!@вф°qU┤╡e?=YтЦЯЗt,╓√pN%UАtw█░P║#v│їARmЯНwПЩ IйЗ░ яРй8tH=Гз▐р0Уф!м ├Dй╘╘ЇЖ╟╛J74ЦнёЖ╓▓ЕAв·zi╬Ьь▀Ч<Д╒╓fa6vм k%"@_РйM1(╚К)┼о@клm┴_║*$м`K%qk├Ж▄Жп<РR.ЄQБщБH╓7H╖пPCX╣Ў?<--6Ы+∙╕`_#@╩E▒+){Афkл╢╓&ь█gХ╚ш╤╣┐fEEя╢&R"@╩E╛+?2|x·╔чV,fп¤сЗ╓<╧┤НK3f╪С╜R"@╩ЕWБ°y╨√QJCXТ cн^╬ЁХчм│zўу╨R.мБ]Y|%{*е4Д%┘0Vkл- PH╣ип╖@XiЧil┤i╝йОШ═чЦd+╟е№ЖА>Рr╤╨`╓C:шV&ТїRU!ёxxCkщ┤┤d▐в@шРrQ_oл░єQБ─у■z Rъщш░u"∙lHOЩ"]rI■^@?H╣Ё*П░*Р─9v╠·*~ UАф{°JТ&M▓  R.╝╩#╚yЩ$HРсзTТяXТm▌╓Ї]╛ х┬█║▄u єd╡╡v╢zOOюТя■Ав @РZ,f█─wv·яH╢йbkk▀│4 QБ(8щy├XA*И╩J█┌} ■▐╧х{ Ав @╩MШНdЧС·cвЙарРr2cЖ╟Ц░Д!,а, хd╞ ыAД┼;T*HDJ aeЗ)'SжД√NЯ!, H/╫Й╟эя aeЙAzоRWgSА█┌ья aeЙAz^АэБH}лЖ░А▓DА =╫ Dъ Ро.[ФX]ЭЯ{P4╥ #@╛╩ВЇъъ,║║loм ╝a° ([╥лн╡crkkГяtЫXБ @Y"@Р^]ЭmМш2╒╘d╒╟┴Г aeКAz▐╠+ЧИ┼дс├ен[й@А2EА =пясzHUK Ф1щхzHUKЛ┤oCX@Щ"@РЭыQ▒--ЎС (KЄЗ╩Вь\+Рс├эгk@д ╚╬5@╝эKjj┬╗СQUь@─═Ш!MЫц■єSж╪ЪeЗ Щ╒╫ч╓├Ш5Л (S▒x▄;ї┼╢i╙&э┌╡K#├<╫|О╨Ў┤abк^0Бtрkя╜└G╧╙└dБ Б Б Б Б Б Б Б Б Б Б Б Б Б Б Б п╙№▓╓:=7Ъ■┴┘°@ж/  ═ В@ В@ В@ В@ В@ В@ В@ В@ В@ В@ В@ В@ В@ В@ М╝·║о╙#pгщ√ыБ░╢ р+'Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Д7p:┬ &█?IENDоB`Вenthought-chaco2-4.8.1.orig/docs/source/kiva_images/dashes.png0000644000175000017500000000072613233644505023373 0ustar varunvarunЙPNG  IHDR╚d├Ж ЭIDATxЬэ▄▒n┬@┴8╩├Я;]Ф/ в▄3ЪйР¤8╣`urql√╛я└MЯл&Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@Б@°Z¤ў\п╫ЫЯы┌#3╓Э▒ю#ып┤M єъm█~>▀z╘▀ўП▄√Юu╫н;№ч7╣\./▌╖ю{н√▀╞я ░ТЧtБ Б Б Б Б Б Б Б0■Dс│gв═Яk~║ё' Я=m■\є╙Н▀AЮ=╗l■\є╙Н▀A`%/щA A A A A A A a№Й┬гє╦о┐╟їщ╞Я(<:у|Ї╪ц╧5?▌°d┌jє;?▌°VЄТA A A A A A A A A A A A A A ╛c aвsО╛IENDоB`Вenthought-chaco2-4.8.1.orig/docs/source/kiva_images/text.png0000644000175000017500000000430013233644505023100 0ustar varunvarunЙPNG  IHDR╚d├Ж ЗIDATxЬэ█KHяЁg╬ёи%С\дХй 3CЄ.ff┘ )Й┤Е╡иEл┬EI(ВмeЛvaAиЕеG\fZЩ ЦFPyл Jд0═█щ√[°Я∙{Є╠Ы╟{Ў|рP╬|g▐ў╝╬╙\▐I╣eYъ-g СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)№є╤4 Ъжб║║zF╦╔╜┘О╫rч%И'┤▄s╢ТТТаiNЯ>mZSRRb| жж&╙║╠╠LhЪЖ┬┬┬Ешъ?g╔BУ5<~№╪┤fъ:│║▒▒1<■░c╟О∙ыр?МYvю▄ xїъ▄╓╠$ /^╝└╧Я?a│┘░m█╢∙яш?ИY╥╙╙a│┘ "иппЯ╢■у╟ПшююFBB,  "╙ъЇmсчч╖р¤■м╕АФХХa╧Ю= В╒jEpp0rrrP[[;om сЄх╦ИППЗ▌nЗ▌nG||<о\╣ВссaПўчччЗффd@]]▌┤ї·#;;[╢l┴└└┌██MыЇK╢∙шє╘√╛ЎЎv?~ы╓нГ╒jE@@└М╛▀П?pю▄9DEE┴╦╦ БББ╚╩╩┬Э;wf┤¤ТТ%@И├сШSэрраь▀┐▀и Vл╒хч .╠xЯf╦{zz$**╩Xo▒X─b▒?GGG╦З<Свв" ╙╓Э:uJHmmн╣vэЪKН╙щФUлV йййЩ╖>ы5╞xZ,ёёёЯ?О╫ч╧Я%::┌┤mO~ Ka┼фЁс├@тттдккJЖЗЗEDд││S Нmыыыg┤Ow╦ЭNз$&& ЙИИЗ├!###2::*ЗC┬├├Аддд╚п_┐<З┌┌Z#╘▀┐wY╖i╙&▒┘l2<<,@ЄЄЄ\jZ[[Аx{{╦╨╨╨╝їyъA|р└йппЧ▒▒1╙║▀╟133SHpp░▄┐_FFF─щt╩ы╫пхт┼Л ╚;Ё┐▓┘l╞┐Jf│┴╘оЁЁpt█N~~╛█╦УАФЦЦ ▒█э╥╙╙3нН╬╬NёїїR^^ю╤8МММ█VVV╦┐~¤*ЪжIjjкИИЇўўЛжiт▓¤╒лWАдее╣,ЯkЯїq(..VЎ▀▌xUUUб∙ЄхМ╖[NЦ═=╚°°8FGGХ37o▐Ь={■■■nk▓││OЯ>Эu╦╩╩╣╣╣ Э╢><<╣╣╣А╥╥RПЎэууГн[╖p╜йппЗИ`√ЎэА╒лWcєц═шыы├╗wяМ:¤■уў╟╗є╒ч╕╕8П╛▄║u pЁрA───x╝¤r░lтp8 Уg4╙ПЩg╧Ю рыыыЎУЯЯ°Їщ╙м√╪┌┌ HKK3н╤╫щ╡Ю╨ўN И~рззз╦Ї░L}тїф╔╙o╨║╧*---■ ╜■F╦& s╤▌▌ @}8Э╬Y╖гЗ+88╪┤&$$─е╓·┴▌╥╥Вбб!У▒X,.є╞:xєц ╛|∙oooу,┤X}Vщээм_┐~^ў╗ШVD@ЇГ■┴Г< й╬D3е┌╟\ЎЯЬЬ LLLа▒▒ГГГhkkCLLМ╦#U¤ вD 3%%v╗}Q√м211░X■▐├ьяэ∙k╫оЧkЄЕlзпп╧┤F_з╫z┬╦╦╦╕ФкллCCCЬNз▌Ъ5kЙ╬╬NЇїїЧZю^/Yш>л·√√чu┐ЛiE$!!└фd!┼╟╟P┐3е▀ ╠цжp╜╤█∙= АыeЦjВp1·l&22└ф+4лРc╟ОШ<n▄╕aZ744ДЄЄЄY╖г?э╣wя▐╛};m¤√ўяqўю]└╤гGg╒Ж~Р755бжжАы ║N╚э█╖╤██ джж.IЯ═ь▐╜█h{lll┌·ОООymoA,ц3ew0OЕYYY╞LэЩ3gдггC&&&dbbB┌┌┌д╕╕XBBBd╫о]3┌з╗хNзSтууАДЖЖ╩гGПМI╖╩╩J┘░aГРдд$q:Э│з╙)БББF√СССnыz{{]&ё222Lў7Ч>╧ЇўуооппOьv╗РЬЬщъъС╔╣Чвв"х▄╓r▒bЄэ█7┘╗wя┤WM~нa▀╛}3┌з┘Єоо.┘╕qгщлQQQn'фЫ9qткллСЮЮ___cBЇ·їыhll\Р6чУ&▓@╧°ИVАs!Z СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBд└А)0 D СBдЁ▓К╖Ъ┴╪`IENDоB`Вenthought-chaco2-4.8.1.orig/docs/source/enable_concepts.rst0000644000175000017500000002744413544354521023024 0ustar varunvarunEnable Concepts =============== This document contains notes from a brain dump session by Peter Wang with Janet Swisher on March 19, 2008. It is notes rather than full explanations, which we hope to add later. Enable Component ---------------- :class:`Component` is the most important object in Enable, the center of everything. It represents a visual component. It both draws a screen object, and receives input for it (keyboard, mouse, and multitouch events). Basic traits of Component include: * :attr:`visible`: Whether it's visible * :attr:`invisible_layout`: Whether it uses space even when not visible (by default, invisible objects don't take up space in layout) Padding ~~~~~~~ Layout in Enable uses padding, similar to CSS. In Chaco, it's used for things around the edges of plot, like labels and tick marks that extend outside the main plot area. * :attr:`fill_padding`: Whether the background color fills the padding area as well as the main area of the component. * :attr:`padding_left` * :attr:`padding_right` * :attr:`padding_top` * :attr:`padding_bottom` * :attr:`padding`: Sets or gets all 4 padding size traits at once * :attr:`hpadding`: Read-only convenience property for the total amount of horizontal padding * :attr:`vpadding`: Read-only convenience property for the total amount of vertical padding * :attr:`padding_accepts_focus`: Whether the component responds to mouse events over the padding area Parent Classes ~~~~~~~~~~~~~~ :class:`Component` subclasses both :class:`CoordinateBox` (for drawing) and :class:`Interactor` (for input). :class:`CoordinateBox` has :attr:`position` and :attr:`bounds` traits, and some secondary attributes for convenience: :attr:`x`, :attr:`y`, :attr:`x2`, :attr:`y2`, :attr:`width`, :attr:`height`. :class:`Interactor` mixes in responses for event types. You can subclass one of these classes if you want only its capabilities. For example, if you want something that doesn't draw but does respond to events, subclass :class:`Interactor` (e.g., a tool). :class:`Interactor` defines common traits for screen interaction, including: * :attr:`pointer`: The cursor shape when the interactor is active * :attr:`event_state`: The object's event state, used for event dispatch Containers ~~~~~~~~~~ All components have a container. They can only have a single container. One component can't be contained by two objects. Whenever you request a component to redraw itself, it actually requests its container to redraw it, and a whole chain goes all the up to the top-level window. Top-level Window ~~~~~~~~~~~~~~~~ A component also has a reference to the top-level window. This window serves as a bridge between the OS and GUI toolkit. The :attr:`window` trait delegates all the way up the containment chain to the top-level component, which has an actual reference to the actual window. The reference to the window is useful because Chaco doesn't make calls directly to the GUI toolkit. Rather, it asks the window to do things for it, such as creating a context menu. Event Dispatch ~~~~~~~~~~~~~~ The key methods of :class:`Interactor` are :meth:`dispatch` and :meth:`\_dispatch_stateful_event`. There's a complex method resolution that occurs beween :class:`Interactor`, :class:`Component`, :class:`Container` (which is a subclass of :class:`Component`), and the Chaco-based subclasses of Enable :class:`Component` and :class:`Container`. When a component gets an event, it tries to handle it in a standard way, which is to dispatch to: 1. its active tool 2. its overlays 3. itself, so that any event handler methods on itself get called 4. its underlays 5. its listener tools That logic is in :class:`Component`, in the :meth:`\_new_dispatch` method, which is called from :meth:`Component.dispatch` (:meth:`\_old_dispatch` will be removed in 3.0). If any of these handlers sets event.handled to True, event propagation stops. If an event gets as far as the listener tools, then all of them get the event. .. note:: The notion of an active tool is not used in current code, just older client code. Experience has shown that the notion of a tool promoting itself to be the "active" tool isn't really useful, because usually the tools need to interact with each other. For newer tools, such as Pan, Zoom, or !DragZoom, when the user starts interacting with a tool, that tool calls capture_mouse() at the window level, and then all mouse events go to that tool, circumventing the entire dispatch() mechanism. The event handlers that :class:`Component` dispatches to are of the form :samp:`{event_state}{event_suffix}`, where *event_suffix* corresponds to the actual kind of event that happened, e.g., :obj:`left_down`, :obj:`left_up`, :obj:`left_dclick`, etc. Most objects default to having just a single event state, which is the "normal" event state. To make an Enable component that handled a left-click, you could subclass :class:`Component`, and implement :meth:`normal_left_down` or :meth:`normal_left_up`. The signature for handler methods is just one parameter, which is an event object that is an instance of (a subclass of) :class:`BasicEvent`. Some subclasses of :class:`BasicEvent` include :class:`MouseEvent`, :class:`DragEvent`, :class:`KeyEvent`, and :class:`BlobEvent` (for multitouch). It's fairly easy to extend this event system with new kinds of events and new suffixes (as was done for multitouch). A disadvantage is that you don't necessarily get feedback when you misspell an event handler method name in its definition. .. note:: This scheme is difficult to implement when the number of states and events gets large. There's nothing to tell you if you've forgotten to implement one of the possible combinations. If an interactor transforms an event, then it has to return the full transformation that it applies to the event. When an event comes in, it has a reference to the GUI toolkit window that the event came from. Lots of code calls methods on :obj:`event.window` to get the window to do things, such as set a tooltip or create a context menu. That is the correct thing to do, because it's possible for there to be two windows showing the same underlying component, so responses to events in a window should only happen in that window. When the user generates an event, that event propagates down the containment stack and things happen in response; a draw or update doesn't actually happen until the next :meth:`paint`. By that time, the component no longer has a reference to the event or the event's window; instead it uses its own reference to the window, :obj:`self.window`. Coordinate Systems ~~~~~~~~~~~~~~~~~~ Every component has :attr:`x` and :attr:`y` traits from :class:`CoordinateBox`. These are positions relative to the component's parent container. When a container dispatches events, or loops over its children to draw, it transforms the coordinate system, so that as far as its children are concerned, the events are relative to the lower-left corner of the parent container. Objects don't have to be bounded, but they do have to have an origin. The component is going to give coordinates to the :class:`GraphicsContext` in its own coordinate system, and the container is responsible for offsetting the GC, and setting up the transform correctly. Likewise, when a component gets an event, it expects that event to be in the coordinate system of its parent container. .. note:: This introduces some complexity in trying to handle mouse event capture. If a tool or component captures the mouse, the top-level window has no idea what the coordinate system of that object is. It has to be able to ask an event, "give me your total transformation up to this point", and then apply that transformation to all subsequent events. Programmers using Chaco or Enable don't usually have to think about this, but the interactor does have to be able to do it. Containers implement this, so if you're just writing a standard component, you don't have to worry about it. Viewports ~~~~~~~~~ A component can have a list of viewports, which are views onto the component. Currently, this is used for the canvas, and for geophysical plotting. You could use it for something like a magnifying-glass view of a portion of a component or plot without duplicating it. .. Recording timestamp: (0:23:52) Layout ~~~~~~ Containers are the sizers that do layout. Components within containers can declare that they are resizable, for example, but that doesn't matter if the container they are in doesn't do layout. The basic traits on :class:`Component` for layout are :attr:`resizable`, :attr:`aspect_ratio`, :attr:`auto_center`. For the :attr:`resizable` trait, you can specify which directions the component is resizable in. Components also have lists of overlays and underlays. You can get access to the actual bounds of the component, including its padding with the :samp:`outer_{name}` attributes. Those also take into account the thickness of any border around the component. Rendering ~~~~~~~~~ Every component can have several layers: * background * image (Chaco only, not Enable) * underlay * main layer (the actual component) * overlay These are defined by DEFAULT_DRAWING_ORDER, and stored in the :attr:`drawing_order` trait. Complexity arises when you have multiple components in a container: How do their layers affect each other? Do you want the "overlay" layer of a component to draw on top of all components? Do you want the "background" elements to be behind everything else? This is resolved by the :attr:`unified_draw` trait. If it is False (the default), the corresponding layers of all components are drawn in sequence. The container is responsible for calling the components to draw their layers in the correct sequence. If it is True, then all layers of the component are drawn in strict sequence. The point is the overall sequence at which a component with ``unified_draw==True`` is drawn is determined by its :attr:`draw_layer` trait, which by default is 'mainlayer'. For example, if you want a plot to act as an overlay, you could set ``unified_draw==True`` and ``draw_layer=='overlay'``. These values tell the container to render the component when it gets to the 'overlay' layer. Set :attr:`overlay_border` to True if you want the border to draw as part of the overlay; otherwise it draws as part of the background. By default, the border is drawn just inside the plot area; set :attr:`inset_border` to False to draw it just outside the plot area. Backbuffer ^^^^^^^^^^ A backbuffer provides the ability to render into an offscreen buffer, which is blitted on every draw, until it is invalidated. Various traits such as :attr:`use_backbuffer` and :attr:`backbuffer_padding` control the behavior of the backbuffer. A backbuffer is used for non-OpenGL backends, such as `agg` and on OS X. If :attr:`use_backbuffer` is False, a backbuffer is never used, even if a backbuffer is referenced by a component. Users typically subclass Chaco :class:`PlotComponent`, but may need features from Enable :class:`Component`. Enable Container ---------------- :class:`Container` is a subclass of Enable :class:`Component`. Containers can be nested. Containers are responsible for event dispatch, draw dispatch, and layout. Containers override a lot of Component methods, so that they behave more like containers than plain components do. .. Recording timestamp: (0:43:40) Examples -------- BasicDraw ~~~~~~~~~ Just draws a box. Subclasses :class:`Component`, and implements :meth:`\_draw_mainlayer`. Uses :class:`DemoFrame` and :func:`demo_main` boilerplate code to simplify the example code. BasicMove ~~~~~~~~~ Adds interaction. Has a more complex :meth:`\_draw_mainlayer`; defines an event handler. enthought-chaco2-4.8.1.orig/docs/source/enable_constraints_layout.rst0000644000175000017500000001724713544354521025152 0ustar varunvarunEnable Constraints Layout ========================= This document describes the constraints-based layout system that is being proposed as the new layout model going forward. Familiarity with Enaml_ and its layout system is helpful but not required. Using Constraints ----------------- :class:`ConstraintsContainer` is a :class:`Container` subclass which uses the Cassowary_ constraint solver to determine the layout of its child :class:`Component` instances. This is achieved by adding constraint variables to the :class:`Component` class which define a simple box model: * :attr:`layout_height`: The height of the component. * :attr:`layout_width`: The width of the component. * :attr:`left`: The left edge of the component. * :attr:`right`: The right edge of the component. * :attr:`top`: The top edge of the component. * :attr:`bottom`: The bottom edge of the component. * :attr:`h_center`: The vertical center line between the left and right edges * :attr:`v_center`: The horizontal center line between the top and bottom edges Additionally, there are some constraints which only exist on :class:`ConstraintsContainer`: * :attr:`contents_height`: The height of the container. * :attr:`contents_width`: The width of the container. * :attr:`contents_left`: The left edge of the container. * :attr:`contents_right`: The right edge of the container. * :attr:`contents_top`: The top edge of the container. * :attr:`contents_bottom`: The bottom edge of the container. * :attr:`contents_h_center`: The vertical center line of the container. * :attr:`contents_v_center`: The horizontal center line of the container. These variables can be used in linear inequality expressions which make up the layout constraints of a container: :: def build_hierarchy(): container = ConstraintsContainer() one = Component() two = Component() container.add(one, two) container.layout_constraints = [ one.layout_width == two.layout_width * 2.0, one.layout_height == two.layout_height, # ... and so on ... ] return container For more complicated layouts, the :attr:`layout_constraints` trait on a :class:`ConstraintsContainer` can be a :class:`callable`. The function is passed a reference to the container and should return a list of :class:`LinearContraints` objects or layout helper instances (as described below). :: def create_container(self): self.container = ConstraintsContainer() self.container.add(self.bar) self.container.layout_constraints = self.my_layout_constraints def my_layout_constraints(self, container): cns = [] if self.foo: cns.append(self.foo.layout_height <= 300) cns.append(hbox(self.foo, self.bar)) cns.append(self.bar.layout_width == 250) return cns If :attr:`layout_constraints` is callable, it will be invoked each time a component is added to the container or whenever the :attr:`layout_size_hint` trait changes on a child component. Layout Helpers -------------- In practice, it's too tedious to specify all the constraints for a rich UI layout. To aid in the generation of layouts, the layout helpers from Enaml_ are also available in Enable. The layout helpers are: :data:`spacer`: Creates space between two adjacent components. .. function:: horizontal(*components[, spacing=10]) Takes a list of components and lines them up using their left and right edges. :param components: A sequence of :class:`Component` or :class:`spacer` objects. :param spacing: How many pixels of inter-element spacing to use :type spacing: integer >= 0 .. function:: vertical(*components[, spacing=10]) Takes a list of components and lines them up using their top and bottom edges. :param components: A sequence of :class:`Component` or :class:`spacer` objects. :param spacing: How many pixels of inter-element spacing to use :type spacing: integer >= 0 .. function:: hbox(*components[, spacing=10, margins=...]) Like :func:`horizontal`, but ensures the height of components matches the container. :param components: A sequence of :class:`Component` or :class:`spacer` objects. :param spacing: How many pixels of inter-element spacing to use :type spacing: integer >= 0 :param margins: An `int`, `tuple` of ints, or :class:`Box` of ints >= 0 which indicate how many pixels of margin to add around the bounds of the box. The default is 0. .. function:: vbox(*components[, spacing=10, margins=...]) Like :func:`vertical`, but ensures the width of components matches the container. :param components: A sequence of :class:`Component` or :class:`spacer` objects. :param spacing: How many pixels of inter-element spacing to use :type spacing: integer >= 0 :param margins: An `int`, `tuple` of ints, or :class:`Box` of ints >= 0 which indicate how many pixels of margin to add around the bounds of the box. The default is 0. .. function:: align(anchor, *components[, spacing=10]) Aligns a single constraint across multiple components. :param anchor: The name of a constraint variable that exists on all of the `components`. :param components: A sequence of :class:`Component` objects. Spacers are not allowed. :param spacing: How many pixels of inter-element spacing to use :type spacing: integer >= 0 .. function:: grid(*rows[, row_align='', row_spacing=10, column_align='', column_spacing=10, margins=...]) Creates an NxM grid of components. Components may span multiple columns or rows. :param rows: A sequence of sequences of :class:`Component` objects :param row_align: The name of a constraint variable on an item. If given, it is used to add constraints on the alignment of items in a row. The constraints will only be applied to items that do not span rows. :type row_align: string :param row_spacing: Indicates how many pixels of space should be placed between rows in the grid. The default is 10. :type row_spacing: integer >= 0 :param column_align: The name of a constraint variable on an item. If given, it is used to add constraints on the alignment of items in a column. The constraints will only be applied to items that do not span columns. :type column_align: string :param column_spacing: Indicates how many pixels of space should be placed between columns in the grid. The default is 10. :type column_spacing: integer >= 0 :param margins: An `int`, `tuple` of ints, or :class:`Box` of ints >= 0 which indicate how many pixels of margin to add around the bounds of the box. The default is 0. Fine Tuning Layouts ------------------- :class:`Component` defines a :class:`Tuple` trait :attr:`layout_size_hint` which controls the minimum size of a component when it's part of a contraints layout. Additionally, :class:`Component` defines some strength traits that can be used to fine tune the behavior of a component instance during layout. They are: * :attr:`hug_height`: How strongly a component prefers the height of its size hint when it could grow. * :attr:`hug_width`: How strongly a component prefers the width of its size hint when it could grow. * :attr:`resist_height`: How strongly a component resists its height being made smaller than its size hint. * :attr:`resist_width`: How strongly a component resists its width being made smaller than its size hint. The allow values for these strengths are: `'required'`, `'strong'`, `'medium'`, and `'weak'`. .. _Cassowary: http://www.cs.washington.edu/research/constraints/cassowary/ .. _Enaml: http://docs.enthought.com/enaml/ enthought-chaco2-4.8.1.orig/docs/source/index.rst0000644000175000017500000000041213233644505020770 0ustar varunvarunEnable Documentation ==================== .. toctree:: :maxdepth: 2 enable_concepts.rst enable_constraints_layout.rst enable_key_events.rst enable_basic_tools.rst enable_drag_and_drop.rst enable_apptools_integration.rst kiva.rst * :ref:`search` enthought-chaco2-4.8.1.orig/docs/source/enable_basic_tools.rst0000644000175000017500000000505313233644505023476 0ustar varunvarunEnable Tools ============ Enable ``Tools`` are ``Interator`` subclasses that do not have to have any visual representation, and which can be dynamically added and removed from components by adding or removing them from the component's ``tools`` list. This permits developers to quickly build up complex behaviours from simple, reproducible parts without having complex inheritance hierarchies. Basic Tools ----------- Enable provides a number of basic tools for common interactions. ButtonTool ~~~~~~~~~~ The :py:class:`ButtonTool` provides basic push-button or checkbox interactions, depending on how it is configured. The primary interface it provides is a :py:attr:`clicked` event which is fired when the user clicks in the region of the underlying component, or when the :py:meth:`click` method is called. The :py:attr:`clicked` event is fired on mouse up. To get checkbox-style behaviour, set :py:attr:`togglable` to ``True`` and then every click will invert the :py:attr:`checked` trait. The toggle state can also be changed via the :py:meth:`toggle` method, which does not fire the :py:attr:`clicked` event when called. For buttons with multi-state toggles, subclasses can override the :py:meth:`toggle` method to perform more complex state changes. By default, the tool responds to clicks that are within the associated component, but subclasses can override this behaviour by replacing the :py:meth:`is_clickable` method with something else. It will commonly be the case that components or :py:class:`ButtonTool` subclasses which draw may wish to respond to user interactions by drawing themselves in a highlighted or selected mode when the mouse is down inside the button region. The :py:attr:`down` trait provides this information conveniently, so that users of the tool can change their drawing state and request redraws when it changes. DragTool ~~~~~~~~ The :py:class:`DragTool` is an abstract base class that provides basic interaction support for draging within Enable. Many other tools within Enable and Chaco use it. HoverTool ~~~~~~~~~ The :py:class:`HoverTool` is a simple tool that calls a callback when the mouse has been held steadily over the component for a period of time. MoveTool ~~~~~~~~ A :py:class:`DragTool` subclass that allows a user to move a component around its container by dragging. ResizeTool ~~~~~~~~~~ A :py:class:`DragTool` subclass that allows a user to resize a component by dragging from the edges of the component. ValueDragTool ~~~~~~~~~~~~~ A :py:class:`DragTool` subclass that allows a drag operation to set an arbitrary value. enthought-chaco2-4.8.1.orig/kiva/0000755000175000017500000000000013544357575015651 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/pdfmetrics.py0000644000175000017500000005150213421603267020350 0ustar varunvarun#------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! # # Author: Enthought, Inc. # Description: #------------------------------------------------------------------------------ #copyright ReportLab Inc. 2001 #see license.txt for license details #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/pdfbase/pdfmetrics.py?cvsroot=reportlab from __future__ import print_function # MODIFIED from reportlab's version for the sake of easier integration in Kiva -- David Ascher #$Header $ __version__=''' $Id: pdfmetrics.py,v 1.1 2002/12/03 08:06:29 da Exp $ ''' __doc__=""" This provides a database of font metric information and efines Font, Encoding and TypeFace classes aimed at end users. There are counterparts to some of these in pdfbase/pdfdoc.py, but the latter focus on constructing the right PDF objects. These classes are declarative and focus on letting the user construct and query font objects. The module maintains a registry of font objects at run time. It is independent of the canvas or any particular context. It keeps a registry of Font, TypeFace and Encoding objects. Ideally these would be pre-loaded, but due to a nasty circularity problem we trap attempts to access them and do it on first access. """ import string, os import warnings import six import six.moves as sm # XXX Kiva specific changes defaultEncoding = 'WinAnsiEncoding' # 'WinAnsi' or 'MacRoman' from . import _fontdata standardFonts = _fontdata.standardFonts standardEncodings = _fontdata.standardEncodings _dummyEncoding=' _not an encoding_ ' # XXX Kiva-specific changes _stringWidth = None _typefaces = {} _encodings = {} _fonts = {} class FontError(Exception): pass class FontNotFoundError(Exception): pass def parseAFMFile(afmFileName): """Quick and dirty - gives back a top-level dictionary with top-level items, and a 'widths' key containing a dictionary of glyph names and widths. Just enough needed for embedding. A better parser would accept options for what data you wwanted, and preserve the order.""" with open(afmFileName, 'r') as f: lines = f.readlines() if len(lines) < 1: raise ValueError('AFM file %s is empty' % afmFileName) if len(lines) == 1: #likely to be a MAC file lines = lines[0].split('\r') if len(lines) <= 1: raise ValueError('AFM file %s hasn\'t enough data' % afmFileName) topLevel = {} glyphLevel = [] #pass 1 - get the widths inMetrics = 0 # os 'TOP', or 'CHARMETRICS' for line in lines: line = line.strip() if line[0:16] == 'StartCharMetrics': inMetrics = 1 elif line[0:14] == 'EndCharMetrics': inMetrics = 0 elif inMetrics: chunks = [x.strip() for x in line.split(';')] cidChunk, widthChunk, nameChunk = chunks[0:3] # character ID l, r = cidChunk.split() assert l == 'C', 'bad line in font file %s' % line cid = int(r) # width l, r = widthChunk.split() assert l == 'WX', 'bad line in font file %s' % line width = int(r) # name l, r = nameChunk.split() assert l == 'N', 'bad line in font file %s' % line name = r glyphLevel.append((cid, width, name)) # pass 2 font info inHeader = 0 for line in lines: if line[0:16] == 'StartFontMetrics': inHeader = 1 if line[0:16] == 'StartCharMetrics': inHeader = 0 elif inHeader: if line[0:7] == 'Comment': pass try: left, right = line.split(' ',1) except: raise ValueError("Header information error in afm %s: line='%s'" % (afmFileName, line)) try: right = int(right) except: pass topLevel[left] = right return (topLevel, glyphLevel) class TypeFace: def __init__(self, name): self.name = name self.glyphNames = [] self.glyphWidths = {} self.ascent = 0 self.descent = 0 if name == 'ZapfDingbats': self.requiredEncoding = 'ZapfDingbatsEncoding' elif name == 'Symbol': self.requiredEncoding = 'SymbolEncoding' else: self.requiredEncoding = None if name in standardFonts: self.builtIn = 1 self._loadBuiltInData(name) else: self.builtIn = 0 def _loadBuiltInData(self, name): """Called for the built in 14 fonts. Gets their glyph data. We presume they never change so this can be a shared reference.""" self.glyphWidths = _fontdata.widthsByFontGlyph[name] self.glyphNames = list(self.glyphWidths.keys()) self.ascent,self.descent = _fontdata.ascent_descent[name] def findT1File(self, ext='.pfb'): possible_exts = (ext.lower(), ext.upper()) if hasattr(self,'pfbFileName'): r_basename = os.path.splitext(self.pfbFileName)[0] for e in possible_exts: if os.path.isfile(r_basename + e): return r_basename + e try: r = _fontdata.findT1File(self.name) except: afm = bruteForceSearchForAFM(self.name) if afm: if ext.lower() == '.pfb': for e in possible_exts: pfb = os.path.splitext(afm)[0] + e if os.path.isfile(pfb): r = pfb else: r = None elif ext.lower() == '.afm': r = afm else: r = None if r is None: warnings.warn("Can't find %s for face '%s'" % (ext, self.name)) return r def bruteForceSearchForAFM(faceName): """Looks in all AFM files on path for face with given name. Returns AFM file name or None. Ouch!""" import glob # XXX Kiva-specific changes T1SearchPath = [] # XXX should be modified if Kiva wants to support T1 fonts for dirname in T1SearchPath: if not os.path.isdir(dirname): continue possibles = glob.glob(dirname + os.sep + '*.[aA][fF][mM]') for possible in possibles: (topDict, glyphDict) = parseAFMFile(possible) if topDict['FontName'] == faceName: return possible return None #for faceName in standardFonts: # registerTypeFace(TypeFace(faceName)) class Encoding: """Object to help you create and refer to encodings.""" def __init__(self, name, base=None): self.name = name self.frozen = 0 if name in standardEncodings: assert base is None, "Can't have a base encoding for a standard encoding" self.baseEncodingName = name self.vector = _fontdata.encodings[name] elif base == None: # assume based on the usual one self.baseEncodingName = defaultEncoding self.vector = _fontdata.encodings[defaultEncoding] elif isinstance(base, six.string_types): baseEnc = getEncoding(base) self.baseEncodingName = baseEnc.name self.vector = baseEnc.vector[:] elif type(base) in (list, tuple): self.baseEncodingName = defaultEncoding self.vector = base[:] elif isinstance(base, Encoding): # accept a vector self.baseEncodingName = base.name self.vector = base.vector[:] def __getitem__(self, index): "Return glyph name for that code point, or None" # THIS SHOULD BE INLINED FOR SPEED return self.vector[index] def __setitem__(self, index, value): # should fail if they are frozen assert self.frozen == 0, 'Cannot modify a frozen encoding' if self.vector[index]!=value: L = list(self.vector) L[index] = value self.vector = tuple(L) def freeze(self): self.vector = tuple(self.vector) self.frozen = 1 def isEqual(self, other): return ((self.name == other.name) and (self.vector == other.vector)) def modifyRange(self, base, newNames): """Sets a group of character names starting at the code point 'base'.""" assert self.frozen == 0, 'Cannot modify a frozen encoding' idx = base for name in newNames: self.vector[idx] = name idx = idx + 1 def getDifferences(self, otherEnc): """Returns a compact list of the code points differing between two encodings This is in the Adobe format, a list of:: [[b1, name1, name2, name3], [b2, name4]] where b1...bn is the starting code point, and the glyph names following are assigned consecutive code points.""" ranges = [] curRange = None for i in sm.range(len(self.vector)): glyph = self.vector[i] if glyph==otherEnc.vector[i]: if curRange: ranges.append(curRange) curRange = [] else: if curRange: curRange.append(glyph) elif glyph: curRange = [i, glyph] if curRange: ranges.append(curRange) return ranges def makePDFObject(self): # XXX Kiva specific change raise NotImplementedError #for encName in standardEncodings: # registerEncoding(Encoding(encName)) class Font: """Represents a font (i.e., combination of face and encoding). Defines suitable machinery for single byte fonts. This is a concrete class which can handle the basic built-in fonts; not clear yet if embedded ones need a new font class or just a new typeface class (which would do the job through composition)""" def __init__(self, name, faceName, encName): self.fontName = name self.face = getTypeFace(faceName) self.encoding= getEncoding(encName) self._calcWidths() # multi byte fonts do their own stringwidth calculations. # signal this here. self._multiByte = 0 def _calcWidths(self): """Vector of widths for stringWidth function""" #synthesize on first request w = [0] * 256 gw = self.face.glyphWidths vec = self.encoding.vector for i in range(256): glyphName = vec[i] if glyphName is not None: try: width = gw[glyphName] w[i] = width except KeyError: # XXX Kiva specific change print('typeface "%s" does not have a glyph "%s", bad font!' % (self.face.name, glyphName)) self.widths = w if not _stringWidth: def stringWidth(self, text, size): """This is the "purist" approach to width. The practical one is to use the stringWidth one which may be optimized in C.""" w = 0 widths = self.widths for ch in text: w = w + widths[ord(ch)] return w * 0.001 * size def _formatWidths(self): "returns a pretty block in PDF Array format to aid inspection" text = '[' for i in range(256): text = text + ' ' + str(self.widths[i]) if i == 255: text = text + ' ]' if i % 16 == 15: text = text + '\n' return text def addObjects(self, doc): # XXX Kiva specific change raise NotImplementedError PFB_MARKER=chr(0x80) PFB_ASCII=chr(1) PFB_BINARY=chr(2) PFB_EOF=chr(3) def _pfbSegLen(p,d): '''compute a pfb style length from the first 4 bytes of string d''' return ((((ord(d[p+3])<<8)|ord(d[p+2])<<8)|ord(d[p+1]))<<8)|ord(d[p]) def _pfbCheck(p,d,m,fn): if d[p]!=PFB_MARKER or d[p+1]!=m: raise ValueError('Bad pfb file\'%s\' expected chr(%d)chr(%d) at char %d, got chr(%d)chr(%d)' % (fn,ord(PFB_MARKER),ord(m),p,ord(d[p]),ord(d[p+1]))) if m==PFB_EOF: return p = p + 2 l = _pfbSegLen(p,d) p = p + 4 if p+l>len(d): raise ValueError('Bad pfb file\'%s\' needed %d+%d bytes have only %d!' % (fn,p,l,len(d))) return p, p+l class EmbeddedType1Face(TypeFace): """A Type 1 font other than one of the basic 14. Its glyph data will be embedded in the PDF file.""" def __init__(self, afmFileName, pfbFileName): # ignore afm file for now self.afmFileName = os.path.abspath(afmFileName) self.pfbFileName = os.path.abspath(pfbFileName) self.requiredEncoding = None self._loadGlyphs(pfbFileName) self._loadMetrics(afmFileName) def _loadGlyphs(self, pfbFileName): """Loads in binary glyph data, and finds the four length measurements needed for the font descriptor.""" assert os.path.isfile(pfbFileName), 'file %s not found' % pfbFileName d = open(pfbFileName, 'rb').read() s1, l1 = _pfbCheck(0,d,PFB_ASCII,pfbFileName) s2, l2 = _pfbCheck(l1,d,PFB_BINARY,pfbFileName) s3, l3 = _pfbCheck(l2,d,PFB_ASCII,pfbFileName) _pfbCheck(l3,d,PFB_EOF,pfbFileName) self._binaryData = d[s1:l1]+d[s2:l2]+d[s3:l3] self._length = len(self._binaryData) self._length1 = l1-s1 self._length2 = l2-s2 self._length3 = l3-s3 def _loadMetrics(self, afmFileName): """Loads in and parses font metrics.""" #assert os.path.isfile(afmFileName), "AFM file %s not found" % afmFileName (topLevel, glyphData) = parseAFMFile(afmFileName) self.name = topLevel['FontName'] self.ascent = topLevel.get('Ascender', 1000) self.descent = topLevel.get('Descender', 0) self.capHeight = topLevel.get('CapHeight', 1000) self.italicAngle = topLevel.get('ItalicAngle', 0) self.stemV = topLevel.get('stemV', 0) self.xHeight = topLevel.get('XHeight', 1000) try: strBbox = topLevel['FontBBox'] self.bbox = [int(tok) for tok in strBbox.split()] except KeyError: self.bbox = [0,0,1000,1000] glyphWidths = {} for (cid, width, name) in glyphData: glyphWidths[name] = width self.glyphWidths = glyphWidths self.glyphNames = sorted(glyphWidths.keys()) # for font-specific encodings like Symbol, Dingbats, Carta we # need to make a new encoding as well.... if topLevel.get('EncodingScheme', None) == 'FontSpecific': names = [None] * 256 for (code, width, name) in glyphData: if code >=0 and code <=255: names[code] = name encName = self.name + 'Encoding' self.requiredEncoding = encName enc = Encoding(encName, names) registerEncoding(enc) def addObjects(self, doc): # XXX Kiva specific changes raise NotImplementedError def registerTypeFace(face): assert isinstance(face, TypeFace), 'Not a TypeFace: %s' % face _typefaces[face.name] = face # XXX Kiva specific changes def registerEncoding(enc): assert isinstance(enc, Encoding), 'Not an Encoding: %s' % enc if enc.name in _encodings: # already got one, complain if they are not the same if enc.isEqual(_encodings[enc.name]): enc.freeze() else: raise FontError('Encoding "%s" already registered with a different name vector!' % enc.Name) else: _encodings[enc.name] = enc enc.freeze() # have not yet dealt with immutability! def registerFont(font): "Registers a font, including setting up info for accelerated stringWidth" # FIXME: This doesn't work #assert isinstance(font, Font), 'Not a Font: %s' % font fontName = font.fontName _fonts[fontName] = font if not font._multiByte: if _stringWidth: _rl_accel.setFontInfo(fontName.lower(), _dummyEncoding, font.face.ascent, font.face.descent, font.widths) def getTypeFace(faceName): """Lazily constructs known typefaces if not found.""" try: return _typefaces[faceName] except KeyError: # not found, construct it if known if faceName in standardFonts: face = TypeFace(faceName) registerTypeFace(face) #print 'auto-constructing type face %s' % face.name return face else: #try a brute force search afm = bruteForceSearchForAFM(faceName) if afm: for e in ('.pfb', '.PFB'): pfb = os.path.splitext(afm)[0] + e if os.path.isfile(pfb): break assert os.path.isfile(pfb), 'file %s not found!' % pfb face = EmbeddedType1Face(afm, pfb) registerTypeFace(face) return face else: raise def getEncoding(encName): """Lazily constructs known encodings if not found.""" try: return _encodings[encName] except KeyError: if encName in standardEncodings: enc = Encoding(encName) registerEncoding(enc) #print 'auto-constructing encoding %s' % encName return enc else: raise def getFont(fontName): """Lazily constructs known fonts if not found. Names of the form 'face-encoding' will be built if face and encoding are known. Also if the name is just one of the standard 14, it will make up a font in the default encoding.""" try: return _fonts[fontName] except KeyError: #it might have a font-specific encoding e.g. Symbol # or Dingbats. If not, take the default. face = getTypeFace(fontName) if face.requiredEncoding: font = Font(fontName, fontName, face.requiredEncoding) else: font = Font(fontName, fontName, defaultEncoding) registerFont(font) return font def _slowStringWidth(text, fontName, fontSize): """Define this anyway so it can be tested, but whether it is used or not depends on _rl_accel""" font = getFont(fontName) return font.stringWidth(text, fontSize) #this is faster, but will need more special-casing for multi-byte fonts. #wid = getFont(fontName).widths #w = 0 #for ch in text: # w = w + wid[ord(ch)] #return 0.001 * w * fontSize # XXX Kiva specific changes stringWidth = _slowStringWidth def dumpFontData(): print('Registered Encodings:') keys = sorted(_encodings.keys()) for encName in keys: print(' ',encName) print() print('Registered Typefaces:') faces = sorted(_typefaces.keys()) for faceName in faces: print(' ', faceName) print() print('Registered Fonts:') k = sorted(_fonts.keys()) for key in k: font = _fonts[key] print(' %s (%s/%s)' % (font.fontName, font.face.name, font.encoding.name)) def test3widths(texts): # checks all 3 algorithms give same answer, note speed import time for fontName in standardFonts[0:1]: t0 = time.time() for text in texts: l1 = _stringWidth(text, fontName, 10) t1 = time.time() print('fast stringWidth took %0.4f' % (t1 - t0)) t0 = time.time() w = getFont(fontName).widths for text in texts: l2 = 0 for ch in text: l2 = l2 + w[ord(ch)] t1 = time.time() print('slow stringWidth took %0.4f' % (t1 - t0)) t0 = time.time() for text in texts: l3 = getFont(fontName).stringWidth(text, 10) t1 = time.time() print('class lookup and stringWidth took %0.4f' % (t1 - t0)) print() def testStringWidthAlgorithms(): rawdata = open('../../rlextra/rml2pdf/doc/rml_user_guide.prep').read() print('rawdata length %d' % len(rawdata)) print('test one huge string...') test3widths([rawdata]) print() words = rawdata.split() print('test %d shorter strings (average length %0.2f chars)...' % (len(words), 1.0*len(rawdata)/len(words))) test3widths(words) def test(): helv = TypeFace('Helvetica') registerTypeFace(helv) print(helv.glyphNames[0:30]) wombat = TypeFace('Wombat') print(wombat.glyphNames) registerTypeFace(wombat) dumpFontData() if __name__=='__main__': test() testStringWidthAlgorithms() enthought-chaco2-4.8.1.orig/kiva/agg/0000755000175000017500000000000013572301634016371 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg.i0000644000175000017500000000050313233644505017300 0ustar varunvarun/* -*- c++ -*- */ /* File : example.i */ %module agg #if (SWIG_VERSION > 0x010322) %feature("compactdefaultargs"); #endif // (SWIG_VERSION > 0x010322) %include "constants.i" %include "rgba.i" %include "font_type.i" %include "affine_matrix.i" %include "compiled_path.i" //%include "image.i" %include "graphics_context.i" enthought-chaco2-4.8.1.orig/kiva/agg/implementation_notes.txt0000644000175000017500000000775613233644505023407 0ustar varunvarunStroke path pipeline -------------------- The stroke_path pipeline is made up of 8 functions. (geeze...) This strange stringing-together-of-functions is due to aggs template based render pipeline. Most of the functions are templatized on their input parameter type. Depending upon the steps needed in the render pipeline, the next function is called with a different input type. For example, one of the first steps in the process checks to see if a path has curves. If it doesn't, we don't need to do curve conversion. If it does, the conversion needs to occur. Normally, this would be done with a if/then to call a separate function. But agg does curve conversion through a template mechanism agg::conv_curve that adapts the input path type into a new path type that interprets curves correctly. Here is an example snippet of code: if (!this->path.has_curves()) { this->stroke_path_dash_conversion(this->path); } else { agg::conv_curve curved_path(this->path); this->stroke_path_dash_conversion(curved_path); } So, stroke_path_dash_conversion(curved_path) is called in either case. It is just called with the input path in one case, and the input path converted to a curved path in the second. Here is how the individual functions string together. 1. stroke_path() This one is the exposed API method. It does very little besides call _stroke_path and clean up the path at the end. 2. _stroke_path() Checks to see if the path has curves in it. If needed, curve conversion is inserted into the render pipeline. Otherwise, the step is by-passed for maximum speed. Either way, stroke_path_dash_conversion() is always the next method called. 3. template stroke_path_dash_conversion(path_type& input_path) If the line is dashed, dash conversion is inserted into the pipeline. Otherwise it is not. Either way, stroke_path_choose_clipping_renderer() is always the next method called. 4. template void stroke_path_choose_clipping_renderer(path_type& input_path) This will choose between single rect clipping, multi-rect-clipping and arbitrary path clipping in the future. fix me: Currently, only multi-rect-clipping is used. 5. template void stroke_path_choose_rasterizer(path_type& input_path, renderer_type& input_renderer) Depending on settings (aliasing, joins, caps, etc.), there are multiple different rasterizers to choose from -- each with different capabilities and efficiencies. This method calls the most efficient render function possible for the required settings. 6. Finally... One of the following functions is used to actually paint the pixels to the image. template void stroke_path_outline(path_type& input_path, renderer_type& input_renderer) The most efficient is the line_width=1 and aliased. It is much faster than the others. (Together now, "How much faster is it?"). fix me: Get answer. template void stroke_path_outline_aa(path_type& input_path, renderer_type& input_renderer) The second most efficient method outline rasterizer is used if the line width <= 10, the line cap is ROUND or BUTT and the join is MITER. template void stroke_path_scanline_aa(path_type& input_path, renderer_type& renderer, scanline_type& scanline) If line width > 10, cap is SQUARE or join is ROUND or BEVEL, this method is used. enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/0000755000175000017500000000000013544357576017371 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/font_win32_tt/0000755000175000017500000000000013544357576022070 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/font_win32_tt/agg_font_win32_tt.cpp0000644000175000017500000010767413233644505026112 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include #include "agg_font_win32_tt.h" #include "agg_bitset_iterator.h" #include "agg_renderer_scanline.h" #ifdef AGG_WIN9X_COMPLIANT #define GetGlyphOutlineX GetGlyphOutline #else #define GetGlyphOutlineX GetGlyphOutlineW #endif namespace agg24 { //------------------------------------------------------------------------------ // // This code implements the AUTODIN II polynomial // The variable corresponding to the macro argument "crc" should // be an unsigned long. // Oroginal code by Spencer Garrett // // generated using the AUTODIN II polynomial // x^32 + x^26 + x^23 + x^22 + x^16 + // x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1 // //------------------------------------------------------------------------------ static const unsigned crc32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, }; //------------------------------------------------------------------------------ static unsigned calc_crc32(const unsigned char* buf, unsigned size) { unsigned crc = (unsigned)~0; const unsigned char* p; unsigned len = 0; unsigned nr = size; for (len += nr, p = buf; nr--; ++p) { crc = (crc >> 8) ^ crc32tab[(crc ^ *p) & 0xff]; } return ~crc; } //------------------------------------------------------------------------ static inline FIXED dbl_to_fx(double d) { int l; l = int(d * 65536.0); return *(FIXED*)&l; } //------------------------------------------------------------------------ static inline int dbl_to_plain_fx(double d) { return int(d * 65536.0); } //------------------------------------------------------------------------ static inline FIXED negate_fx(const FIXED& fx) { int l = -(*(int*)(&fx)); return *(FIXED*)&l; } //------------------------------------------------------------------------ static inline double fx_to_dbl(const FIXED& p) { return double(p.value) + double(p.fract) * (1.0 / 65536.0); } //------------------------------------------------------------------------ static inline int fx_to_plain_int(const FIXED& fx) { return *(int*)(&fx); } //------------------------------------------------------------------------ static inline int fx_to_int26p6(const FIXED& p) { return (int(p.value) << 6) + (int(p.fract) >> 10); } //------------------------------------------------------------------------ static inline int dbl_to_int26p6(double p) { return int(p * 64.0 + 0.5); } //------------------------------------------------------------------------ template void decompose_win32_glyph_bitmap_mono(const char* gbuf, int w, int h, int x, int y, bool flip_y, Scanline& sl, ScanlineStorage& storage) { int i; int pitch = ((w + 31) >> 5) << 2; const int8u* buf = (const int8u*)gbuf; sl.reset(x, x + w); storage.prepare(); if(flip_y) { buf += pitch * (h - 1); y += h; pitch = -pitch; } for(i = 0; i < h; i++) { sl.reset_spans(); bitset_iterator bits(buf, 0); int j; for(j = 0; j < w; j++) { if(bits.bit()) sl.add_cell(x + j, cover_full); ++bits; } buf += pitch; if(sl.num_spans()) { sl.finalize(y - i - 1); storage.render(sl); } } } //------------------------------------------------------------------------ template void decompose_win32_glyph_bitmap_gray8(const char* gbuf, int w, int h, int x, int y, bool flip_y, Rasterizer& ras, Scanline& sl, ScanlineStorage& storage) { int i, j; int pitch = ((w + 3) >> 2) << 2; const int8u* buf = (const int8u*)gbuf; sl.reset(x, x + w); storage.prepare(); if(flip_y) { buf += pitch * (h - 1); y += h; pitch = -pitch; } for(i = 0; i < h; i++) { sl.reset_spans(); const int8u* p = buf; for(j = 0; j < w; j++) { if(*p) { unsigned v = *p; if(v == 64) v = 255; else v <<= 2; sl.add_cell(x + j, ras.apply_gamma(v)); } ++p; } buf += pitch; if(sl.num_spans()) { sl.finalize(y - i - 1); storage.render(sl); } } } //------------------------------------------------------------------------ template bool decompose_win32_glyph_outline(const char* gbuf, unsigned total_size, bool flip_y, const trans_affine& mtx, PathStorage& path) { const char* cur_glyph = gbuf; const char* end_glyph = gbuf + total_size; double x, y; typedef typename PathStorage::value_type value_type; while(cur_glyph < end_glyph) { const TTPOLYGONHEADER* th = (TTPOLYGONHEADER*)cur_glyph; const char* end_poly = cur_glyph + th->cb; const char* cur_poly = cur_glyph + sizeof(TTPOLYGONHEADER); x = fx_to_dbl(th->pfxStart.x); y = fx_to_dbl(th->pfxStart.y); if(flip_y) y = -y; mtx.transform(&x, &y); path.move_to(value_type(dbl_to_int26p6(x)), value_type(dbl_to_int26p6(y))); while(cur_poly < end_poly) { const TTPOLYCURVE* pc = (const TTPOLYCURVE*)cur_poly; if (pc->wType == TT_PRIM_LINE) { int i; for (i = 0; i < pc->cpfx; i++) { x = fx_to_dbl(pc->apfx[i].x); y = fx_to_dbl(pc->apfx[i].y); if(flip_y) y = -y; mtx.transform(&x, &y); path.line_to(value_type(dbl_to_int26p6(x)), value_type(dbl_to_int26p6(y))); } } if (pc->wType == TT_PRIM_QSPLINE) { int u; for (u = 0; u < pc->cpfx - 1; u++) // Walk through points in spline { POINTFX pnt_b = pc->apfx[u]; // B is always the current point POINTFX pnt_c = pc->apfx[u+1]; if (u < pc->cpfx - 2) // If not on last spline, compute C { // midpoint (x,y) *(int*)&pnt_c.x = (*(int*)&pnt_b.x + *(int*)&pnt_c.x) / 2; *(int*)&pnt_c.y = (*(int*)&pnt_b.y + *(int*)&pnt_c.y) / 2; } double x2, y2; x = fx_to_dbl(pnt_b.x); y = fx_to_dbl(pnt_b.y); x2 = fx_to_dbl(pnt_c.x); y2 = fx_to_dbl(pnt_c.y); if(flip_y) { y = -y; y2 = -y2; } mtx.transform(&x, &y); mtx.transform(&x2, &y2); path.curve3(value_type(dbl_to_int26p6(x)), value_type(dbl_to_int26p6(y)), value_type(dbl_to_int26p6(x2)), value_type(dbl_to_int26p6(y2))); } } cur_poly += sizeof(WORD) * 2 + sizeof(POINTFX) * pc->cpfx; } cur_glyph += th->cb; } return true; } //------------------------------------------------------------------------ font_engine_win32_tt_base::~font_engine_win32_tt_base() { delete [] m_kerning_pairs; delete [] m_gbuf; delete [] m_signature; delete [] m_typeface; if(m_dc && m_old_font) ::SelectObject(m_dc, m_old_font); unsigned i; for(i = 0; i < m_num_fonts; ++i) { delete [] m_font_names[i]; ::DeleteObject(m_fonts[i]); } delete [] m_font_names; delete [] m_fonts; } //------------------------------------------------------------------------ font_engine_win32_tt_base::font_engine_win32_tt_base(bool flag32, HDC dc, unsigned max_fonts) : m_flag32(flag32), m_dc(dc), m_old_font(m_dc ? (HFONT)::GetCurrentObject(m_dc, OBJ_FONT) : 0), m_fonts(new HFONT [max_fonts]), m_num_fonts(0), m_max_fonts(max_fonts), m_font_names(new char* [max_fonts]), m_cur_font(0), m_change_stamp(0), m_typeface(new char [256-16]), m_typeface_len(256-16-1), m_signature(new char [256+256-16]), m_height(0), m_width(0), m_weight(FW_REGULAR), m_italic(false), m_char_set(DEFAULT_CHARSET), m_pitch_and_family(FF_DONTCARE), m_hinting(true), m_flip_y(false), m_font_created(false), m_resolution(0), m_glyph_rendering(glyph_ren_native_gray8), m_glyph_index(0), m_data_size(0), m_data_type(glyph_data_invalid), m_bounds(1,1,0,0), m_advance_x(0.0), m_advance_y(0.0), m_gbuf(new char [buf_size]), m_kerning_pairs(0), m_num_kerning_pairs(0), m_max_kerning_pairs(0), m_path16(), m_path32(), m_curves16(m_path16), m_curves32(m_path32), m_scanline_aa(), m_scanline_bin(), m_scanlines_aa(), m_scanlines_bin(), m_rasterizer() { m_curves16.approximation_scale(4.0); m_curves32.approximation_scale(4.0); memset(&m_matrix, 0, sizeof(m_matrix)); m_matrix.eM11.value = 1; m_matrix.eM22.value = 1; } //------------------------------------------------------------------------ int font_engine_win32_tt_base::find_font(const char* name) const { unsigned i; for(i = 0; i < m_num_fonts; ++i) { if(strcmp(name, m_font_names[i]) == 0) return i; } return -1; } //------------------------------------------------------------------------ bool font_engine_win32_tt_base::create_font(const char* typeface_, glyph_rendering ren_type) { if(m_dc) { unsigned len = strlen(typeface_); if(len > m_typeface_len) { delete [] m_signature; delete [] m_typeface; m_typeface = new char [len + 32]; m_signature = new char [len + 32 + 256]; m_typeface_len = len + 32 - 1; } strcpy(m_typeface, typeface_); int h = m_height; int w = m_width; if(m_resolution) { h = ::MulDiv(m_height, m_resolution, 72); w = ::MulDiv(m_width, m_resolution, 72); } m_glyph_rendering = ren_type; update_signature(); int idx = find_font(m_signature); if(idx >= 0) { m_cur_font = m_fonts[idx]; ::SelectObject(m_dc, m_cur_font); m_num_kerning_pairs = 0; return true; } else { m_cur_font = ::CreateFont(-h, // height of font w, // average character width 0, // angle of escapement 0, // base-line orientation angle m_weight, // font weight m_italic, // italic attribute option 0, // underline attribute option 0, // strikeout attribute option m_char_set, // character set identifier OUT_DEFAULT_PRECIS, // output precision CLIP_DEFAULT_PRECIS, // clipping precision ANTIALIASED_QUALITY, // output quality m_pitch_and_family, // pitch and family m_typeface); // typeface name if(m_cur_font) { if(m_num_fonts >= m_max_fonts) { delete [] m_font_names[0]; if(m_old_font) ::SelectObject(m_dc, m_old_font); ::DeleteObject(m_fonts[0]); memcpy(m_fonts, m_fonts + 1, (m_max_fonts - 1) * sizeof(HFONT)); memcpy(m_font_names, m_font_names + 1, (m_max_fonts - 1) * sizeof(char*)); m_num_fonts = m_max_fonts - 1; } update_signature(); m_font_names[m_num_fonts] = new char[strlen(m_signature) + 1]; strcpy(m_font_names[m_num_fonts], m_signature); m_fonts[m_num_fonts] = m_cur_font; ++m_num_fonts; ::SelectObject(m_dc, m_cur_font); m_num_kerning_pairs = 0; return true; } } } return false; } //------------------------------------------------------------------------ bool font_engine_win32_tt_base::create_font(const char* typeface_, glyph_rendering ren_type, double height_, double width_, int weight_, bool italic_, DWORD char_set_, DWORD pitch_and_family_) { height(height_); width(width_); weight(weight_); italic(italic_); char_set(char_set_); pitch_and_family(pitch_and_family_); return create_font(typeface_, ren_type); } //------------------------------------------------------------------------ void font_engine_win32_tt_base::update_signature() { m_signature[0] = 0; if(m_dc && m_cur_font) { unsigned gamma_hash = 0; if(m_glyph_rendering == glyph_ren_native_gray8 || m_glyph_rendering == glyph_ren_agg_mono || m_glyph_rendering == glyph_ren_agg_gray8) { unsigned char gamma_table[rasterizer_scanline_aa<>::aa_scale]; unsigned i; for(i = 0; i < rasterizer_scanline_aa<>::aa_scale; ++i) { gamma_table[i] = m_rasterizer.apply_gamma(i); } gamma_hash = calc_crc32(gamma_table, sizeof(gamma_table)); } sprintf(m_signature, "%s,%u,%d,%d:%dx%d,%d,%d,%d,%d,%d,%08X", m_typeface, m_char_set, int(m_glyph_rendering), m_resolution, m_height, m_width, m_weight, int(m_italic), int(m_hinting), int(m_flip_y), int(m_pitch_and_family), gamma_hash); if(m_glyph_rendering == glyph_ren_outline || m_glyph_rendering == glyph_ren_agg_mono || m_glyph_rendering == glyph_ren_agg_gray8) { double mtx[6]; char buf[100]; m_affine.store_to(mtx); sprintf(buf, ",%08X%08X%08X%08X%08X%08X", dbl_to_plain_fx(mtx[0]), dbl_to_plain_fx(mtx[1]), dbl_to_plain_fx(mtx[2]), dbl_to_plain_fx(mtx[3]), dbl_to_plain_fx(mtx[4]), dbl_to_plain_fx(mtx[5])); strcat(m_signature, buf); } ++m_change_stamp; } } //------------------------------------------------------------------------ bool font_engine_win32_tt_base::prepare_glyph(unsigned glyph_code) { if(m_dc && m_cur_font) { int format = GGO_BITMAP; switch(m_glyph_rendering) { case glyph_ren_native_gray8: format = GGO_GRAY8_BITMAP; break; case glyph_ren_outline: case glyph_ren_agg_mono: case glyph_ren_agg_gray8: format = GGO_NATIVE; break; } #ifndef GGO_UNHINTED // For compatibility with old SDKs. #define GGO_UNHINTED 0x0100 #endif if(!m_hinting) format |= GGO_UNHINTED; GLYPHMETRICS gm; int total_size = GetGlyphOutlineX(m_dc, glyph_code, format, &gm, buf_size, (void*)m_gbuf, &m_matrix); if(total_size < 0) { // GetGlyphOutline() fails when being called for // GGO_GRAY8_BITMAP and white space (stupid Microsoft). // It doesn't even initialize the glyph metrics // structure. So, we have to query the metrics // separately (basically we need gmCellIncX). int total_size = GetGlyphOutlineX(m_dc, glyph_code, GGO_METRICS, &gm, buf_size, (void*)m_gbuf, &m_matrix); if(total_size < 0) return false; gm.gmBlackBoxX = gm.gmBlackBoxY = 0; total_size = 0; } m_glyph_index = glyph_code; m_advance_x = gm.gmCellIncX; m_advance_y = -gm.gmCellIncY; switch(m_glyph_rendering) { case glyph_ren_native_mono: decompose_win32_glyph_bitmap_mono(m_gbuf, gm.gmBlackBoxX, gm.gmBlackBoxY, gm.gmptGlyphOrigin.x, m_flip_y ? -gm.gmptGlyphOrigin.y : gm.gmptGlyphOrigin.y, m_flip_y, m_scanline_bin, m_scanlines_bin); m_bounds.x1 = m_scanlines_bin.min_x(); m_bounds.y1 = m_scanlines_bin.min_y(); m_bounds.x2 = m_scanlines_bin.max_x() + 1; m_bounds.y2 = m_scanlines_bin.max_y() + 1; m_data_size = m_scanlines_bin.byte_size(); m_data_type = glyph_data_mono; return true; case glyph_ren_native_gray8: decompose_win32_glyph_bitmap_gray8(m_gbuf, gm.gmBlackBoxX, gm.gmBlackBoxY, gm.gmptGlyphOrigin.x, m_flip_y ? -gm.gmptGlyphOrigin.y : gm.gmptGlyphOrigin.y, m_flip_y, m_rasterizer, m_scanline_aa, m_scanlines_aa); m_bounds.x1 = m_scanlines_aa.min_x(); m_bounds.y1 = m_scanlines_aa.min_y(); m_bounds.x2 = m_scanlines_aa.max_x() + 1; m_bounds.y2 = m_scanlines_aa.max_y() + 1; m_data_size = m_scanlines_aa.byte_size(); m_data_type = glyph_data_gray8; return true; case glyph_ren_outline: m_affine.transform(&m_advance_x, &m_advance_y); if(m_flag32) { m_path32.remove_all(); if(decompose_win32_glyph_outline(m_gbuf, total_size, m_flip_y, m_affine, m_path32)) { rect_d bnd = m_path32.bounding_rect(); m_data_size = m_path32.byte_size(); m_data_type = glyph_data_outline; m_bounds.x1 = int(floor(bnd.x1)); m_bounds.y1 = int(floor(bnd.y1)); m_bounds.x2 = int(ceil(bnd.x2)); m_bounds.y2 = int(ceil(bnd.y2)); return true; } } else { m_path16.remove_all(); if(decompose_win32_glyph_outline(m_gbuf, total_size, m_flip_y, m_affine, m_path16)) { rect_d bnd = m_path16.bounding_rect(); m_data_size = m_path16.byte_size(); m_data_type = glyph_data_outline; m_bounds.x1 = int(floor(bnd.x1)); m_bounds.y1 = int(floor(bnd.y1)); m_bounds.x2 = int(ceil(bnd.x2)); m_bounds.y2 = int(ceil(bnd.y2)); return true; } } break; case glyph_ren_agg_mono: m_rasterizer.reset(); m_affine.transform(&m_advance_x, &m_advance_y); if(m_flag32) { m_path32.remove_all(); decompose_win32_glyph_outline(m_gbuf, total_size, m_flip_y, m_affine, m_path32); m_rasterizer.add_path(m_curves32); } else { m_path16.remove_all(); decompose_win32_glyph_outline(m_gbuf, total_size, m_flip_y, m_affine, m_path16); m_rasterizer.add_path(m_curves16); } m_scanlines_bin.prepare(); // Remove all render_scanlines(m_rasterizer, m_scanline_bin, m_scanlines_bin); m_bounds.x1 = m_scanlines_bin.min_x(); m_bounds.y1 = m_scanlines_bin.min_y(); m_bounds.x2 = m_scanlines_bin.max_x() + 1; m_bounds.y2 = m_scanlines_bin.max_y() + 1; m_data_size = m_scanlines_bin.byte_size(); m_data_type = glyph_data_mono; return true; case glyph_ren_agg_gray8: m_rasterizer.reset(); m_affine.transform(&m_advance_x, &m_advance_y); if(m_flag32) { m_path32.remove_all(); decompose_win32_glyph_outline(m_gbuf, total_size, m_flip_y, m_affine, m_path32); m_rasterizer.add_path(m_curves32); } else { m_path16.remove_all(); decompose_win32_glyph_outline(m_gbuf, total_size, m_flip_y, m_affine, m_path16); m_rasterizer.add_path(m_curves16); } m_scanlines_aa.prepare(); // Remove all render_scanlines(m_rasterizer, m_scanline_aa, m_scanlines_aa); m_bounds.x1 = m_scanlines_aa.min_x(); m_bounds.y1 = m_scanlines_aa.min_y(); m_bounds.x2 = m_scanlines_aa.max_x() + 1; m_bounds.y2 = m_scanlines_aa.max_y() + 1; m_data_size = m_scanlines_aa.byte_size(); m_data_type = glyph_data_gray8; return true; } } return false; } //------------------------------------------------------------------------ void font_engine_win32_tt_base::write_glyph_to(int8u* data) const { if(data && m_data_size) { switch(m_data_type) { case glyph_data_mono: m_scanlines_bin.serialize(data); break; case glyph_data_gray8: m_scanlines_aa.serialize(data); break; case glyph_data_outline: if(m_flag32) { m_path32.serialize(data); } else { m_path16.serialize(data); } break; } } } //------------------------------------------------------------------------ static bool pair_less(const KERNINGPAIR& v1, const KERNINGPAIR& v2) { if(v1.wFirst != v2.wFirst) return v1.wFirst < v2.wFirst; return v1.wSecond < v2.wSecond; } //------------------------------------------------------------------------ void font_engine_win32_tt_base::sort_kerning_pairs() { pod_array_adaptor pairs(m_kerning_pairs, m_num_kerning_pairs); quick_sort(pairs, pair_less); } //------------------------------------------------------------------------ void font_engine_win32_tt_base::load_kerning_pairs() { if(m_dc && m_cur_font) { if(m_kerning_pairs == 0) { m_kerning_pairs = new KERNINGPAIR [16384-16]; m_max_kerning_pairs = 16384-16; } m_num_kerning_pairs = ::GetKerningPairs(m_dc, m_max_kerning_pairs, m_kerning_pairs); if(m_num_kerning_pairs) { // Check to see if the kerning pairs are sorted and // sort them if they are not. //---------------- unsigned i; for(i = 1; i < m_num_kerning_pairs; ++i) { if(!pair_less(m_kerning_pairs[i - 1], m_kerning_pairs[i])) { sort_kerning_pairs(); break; } } } } } //------------------------------------------------------------------------ bool font_engine_win32_tt_base::add_kerning(unsigned first, unsigned second, double* x, double* y) { if(m_dc && m_cur_font) { if(m_num_kerning_pairs == 0) { load_kerning_pairs(); } int end = m_num_kerning_pairs - 1; int beg = 0; KERNINGPAIR t; t.wFirst = (WORD)first; t.wSecond = (WORD)second; while(beg <= end) { int mid = (end + beg) / 2; if(m_kerning_pairs[mid].wFirst == t.wFirst && m_kerning_pairs[mid].wSecond == t.wSecond) { double dx = m_kerning_pairs[mid].iKernAmount; double dy = 0.0; if(m_glyph_rendering == glyph_ren_outline || m_glyph_rendering == glyph_ren_agg_mono || m_glyph_rendering == glyph_ren_agg_gray8) { m_affine.transform_2x2(&dx, &dy); } *x += dx; *y += dy; return true; } else if(pair_less(t, m_kerning_pairs[mid])) { end = mid - 1; } else { beg = mid + 1; } } return false; } return false; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/font_win32_tt/Makefile.am0000644000175000017500000000077713233644505024121 0ustar varunvarun## this needs more work, and is intended to work in a unix cross ## compilation toolchain, or in something like msys if ENABLE_WIN32_TT aggincludedir = $(includedir)/agg2 agginclude_HEADERS = agg_font_win32_tt.h lib_LTLIBRARIES = libaggfontwin32tt.la libaggfontwin32tt_la_LDFLAGS = -no-undefined -version-info @AGG_LIB_VERSION@ @WINDOWS_LIBS@ ../src/libagg.la libaggfontwin32tt_la_SOURCES = agg_font_win32_tt.cpp libaggfontwin32tt_la_CXXFLAGS = -I$(top_srcdir)/include @WINDOWS_CFLAGS@ endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/font_win32_tt/agg_font_win32_tt.h0000644000175000017500000002236513233644505025550 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_FONT_WIN32_TT_INCLUDED #define AGG_FONT_WIN32_TT_INCLUDED #include #include "agg_scanline_storage_aa.h" #include "agg_scanline_storage_bin.h" #include "agg_scanline_u.h" #include "agg_scanline_bin.h" #include "agg_path_storage_integer.h" #include "agg_rasterizer_scanline_aa.h" #include "agg_conv_curve.h" #include "agg_trans_affine.h" #include "agg_font_cache_manager.h" namespace agg24 { //-----------------------------------------------font_engine_win32_tt_base class font_engine_win32_tt_base { enum { buf_size = 32768-32 }; public: //-------------------------------------------------------------------- typedef serialized_scanlines_adaptor_aa gray8_adaptor_type; typedef serialized_scanlines_adaptor_bin mono_adaptor_type; typedef scanline_storage_aa8 scanlines_aa_type; typedef scanline_storage_bin scanlines_bin_type; //-------------------------------------------------------------------- ~font_engine_win32_tt_base(); font_engine_win32_tt_base(bool flag32, HDC dc, unsigned max_fonts = 32); // Set font parameters //-------------------------------------------------------------------- void resolution(unsigned dpi) { m_resolution = unsigned(dpi); } void height(double h) { m_height = unsigned(h); } void width(double w) { m_width = unsigned(w); } void weight(int w) { m_weight = w; } void italic(bool it) { m_italic = it; } void char_set(DWORD c) { m_char_set = c; } void pitch_and_family(DWORD p){ m_pitch_and_family = p; } void flip_y(bool flip) { m_flip_y = flip; } void hinting(bool h) { m_hinting = h; } bool create_font(const char* typeface_, glyph_rendering ren_type); bool create_font(const char* typeface_, glyph_rendering ren_type, double height_, double width_=0.0, int weight_=FW_REGULAR, bool italic_=false, DWORD char_set_=ANSI_CHARSET, DWORD pitch_and_family_=FF_DONTCARE); // Set Gamma //-------------------------------------------------------------------- template void gamma(const GammaF& f) { m_rasterizer.gamma(f); } //-------------------------------------------------------------------- void transform(const agg24::trans_affine& mtx) { m_affine = mtx; } // Accessors //-------------------------------------------------------------------- unsigned resolution() const { return m_resolution; } const char* typeface() const { return m_typeface; } double height() const { return m_height; } double width() const { return m_width; } int weight() const { return m_weight; } bool italic() const { return m_italic; } DWORD char_set() const { return m_char_set; } DWORD pitch_and_family() const { return m_pitch_and_family; } bool hinting() const { return m_hinting; } bool flip_y() const { return m_flip_y; } // Interface mandatory to implement for font_cache_manager //-------------------------------------------------------------------- const char* font_signature() const { return m_signature; } int change_stamp() const { return m_change_stamp; } bool prepare_glyph(unsigned glyph_code); unsigned glyph_index() const { return m_glyph_index; } unsigned data_size() const { return m_data_size; } glyph_data_type data_type() const { return m_data_type; } const rect_i& bounds() const { return m_bounds; } double advance_x() const { return m_advance_x; } double advance_y() const { return m_advance_y; } void write_glyph_to(int8u* data) const; bool add_kerning(unsigned first, unsigned second, double* x, double* y); private: font_engine_win32_tt_base(const font_engine_win32_tt_base&); const font_engine_win32_tt_base& operator = (const font_engine_win32_tt_base&); void update_signature(); void load_kerning_pairs(); void sort_kerning_pairs(); int find_font(const char* name) const; bool m_flag32; HDC m_dc; HFONT m_old_font; HFONT* m_fonts; unsigned m_num_fonts; unsigned m_max_fonts; char** m_font_names; HFONT m_cur_font; int m_change_stamp; char* m_typeface; unsigned m_typeface_len; char* m_signature; unsigned m_height; unsigned m_width; int m_weight; bool m_italic; DWORD m_char_set; DWORD m_pitch_and_family; bool m_hinting; bool m_flip_y; bool m_font_created; unsigned m_resolution; glyph_rendering m_glyph_rendering; unsigned m_glyph_index; unsigned m_data_size; glyph_data_type m_data_type; rect_i m_bounds; double m_advance_x; double m_advance_y; MAT2 m_matrix; char* m_gbuf; KERNINGPAIR* m_kerning_pairs; unsigned m_num_kerning_pairs; unsigned m_max_kerning_pairs; trans_affine m_affine; path_storage_integer m_path16; path_storage_integer m_path32; conv_curve > m_curves16; conv_curve > m_curves32; scanline_u8 m_scanline_aa; scanline_bin m_scanline_bin; scanlines_aa_type m_scanlines_aa; scanlines_bin_type m_scanlines_bin; rasterizer_scanline_aa<> m_rasterizer; }; //------------------------------------------------font_engine_win32_tt_int16 // This class uses values of type int16 (10.6 format) for the vector cache. // The vector cache is compact, but when rendering glyphs of height // more that 200 there integer overflow can occur. // class font_engine_win32_tt_int16 : public font_engine_win32_tt_base { public: typedef serialized_integer_path_adaptor path_adaptor_type; typedef font_engine_win32_tt_base::gray8_adaptor_type gray8_adaptor_type; typedef font_engine_win32_tt_base::mono_adaptor_type mono_adaptor_type; typedef font_engine_win32_tt_base::scanlines_aa_type scanlines_aa_type; typedef font_engine_win32_tt_base::scanlines_bin_type scanlines_bin_type; font_engine_win32_tt_int16(HDC dc, unsigned max_fonts = 32) : font_engine_win32_tt_base(false, dc, max_fonts) {} }; //------------------------------------------------font_engine_win32_tt_int32 // This class uses values of type int32 (26.6 format) for the vector cache. // The vector cache is twice larger than in font_engine_win32_tt_int16, // but it allows you to render glyphs of very large sizes. // class font_engine_win32_tt_int32 : public font_engine_win32_tt_base { public: typedef serialized_integer_path_adaptor path_adaptor_type; typedef font_engine_win32_tt_base::gray8_adaptor_type gray8_adaptor_type; typedef font_engine_win32_tt_base::mono_adaptor_type mono_adaptor_type; typedef font_engine_win32_tt_base::scanlines_aa_type scanlines_aa_type; typedef font_engine_win32_tt_base::scanlines_bin_type scanlines_bin_type; font_engine_win32_tt_int32(HDC dc, unsigned max_fonts = 32) : font_engine_win32_tt_base(true, dc, max_fonts) {} }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile0000644000175000017500000000013613233644505021013 0ustar varunvarunall: lib src/libagg.a: cd src; make lib: src/libagg.a clean: cd src; make clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/libagg.m40000644000175000017500000000165513233644505021051 0ustar varunvarun# Configure paths for libagg # Kirill Smelkov 2005-10-23, based on freetype2.m4 by Marcelo Magallon # AC_CHECK_LIBAGG([MINIMUM-VERSION [, ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]]) # Test for libagg, and define LIBAGG_CFLAGS and LIBAGG_LIBS # AC_DEFUN([AC_CHECK_LIBAGG], [ # Get the cflags and libraries from pkg-config libagg ... AC_ARG_WITH([libagg], AS_HELP_STRING([--with-libagg=PREFIX], [Prefix where libagg is installed (optional)]), [libagg_prefix="$withval"], [libagg_prefix=""]) libagg_name=libagg if test "x$libagg_prefix" != "x"; then libagg_name="$libagg_prefix/lib/pkgconfig/libagg.pc" fi PKG_CHECK_MODULES([LIBAGG], "$libagg_name", success=yes, success=no) if test "x$success" = xyes; then ifelse([$2], , :, [$2]) AC_SUBST([LIBAGG_CFLAGS]) AC_SUBST([LIBAGG_LIBS]) else ifelse([$3], , :, [$3]) fi ]) # end of libagg.m4 enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.Darwin.SDL0000644000175000017500000000033613233644505023266 0ustar varunvarunAGGLIBS= -lagg -L/usr/local/lib -lSDLmain -lSDL -framework Cocoa -framework OpenGL AGGCXXFLAGS = -O3 -I/Library/Frameworks/SDL.framework/Headers -L/usr/lib CXX = g++ C = gcc #CXX = icc LIB = ar cr .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/readme0000644000175000017500000000402013233644505020527 0ustar varunvarunThe Anti-Grain Geometry Project A high quality rendering engine for C++ http://antigrain.com Anti-Grain Geometry - Version 2.4 Copyright (C) 2002-2005 Maxim Shemanarev (McSeem) Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose. --------------------------------- Use automake to build the library. If automake is not available you still can use the old make. There is a very simple Makefile that can be used. Note that if you use automake it will overwrite Makefile. --------------------------------- If building on AmigaOS 4.0 or higher type the following for instructions on what targets are available. make -f Makefile.AmigaOS To just build and install AGG into the standard AmigaOS SDK ready for use type: make -f Makefile.AmigaOS install If you just want to build one demo (e.g. lion) use: make -f Makefile.AmigaOS bin/lion If you have any questions about the AmigaOS port please contact Steven Solie (ssolie@telus.net) for help. --------------------------------- To build all examples using SDL (Mac or Linux) just type: cd /examples/sdl make Individual examples can be built with make aa_test In the same way the native Carbon examples can be built with cd /examples/macosx_carbon make In both cases the static library will be built (if it was not already) from the existing global Makefile in /src/. The Makefiles for both SDL and Carbon will also attempt to download the required .bmp files if they are not found in the system for a given example. If the files could not be fetched (wget) the user will receive a message explaining where to download the samples from (sphere.bmp, etc.) Since all programs reside in the same directory there is no need to duplicate the .bmp files for each program that needs to use them. --------------------------------- enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/libagg.pc.in0000644000175000017500000000042513233644505021532 0ustar varunvarunprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/agg2 Name: libagg Description: Anti Grain Geometry - A High Quality Rendering Engine for C++ Version: 2.3 Libs: -L${libdir} -Wl,-rpath,${exec_prefix}/lib -lagg Cflags: -I${includedir} enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/configure.in0000644000175000017500000001175313233644505021673 0ustar varunvarunAC_INIT(src/agg_arc.cpp) # give me a source file, any source file... AC_CANONICAL_TARGET AC_CONFIG_HEADERS(include/config.h) AM_INIT_AUTOMAKE(agg, 2.4.0) dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_ISC_POSIX AM_C_PROTOTYPES if test "x$U" != "x"; then AC_MSG_ERROR(Compiler not ANSI compliant) fi AM_PROG_LIBTOOL AC_PROG_INSTALL dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_ARG_ENABLE(examples, AC_HELP_STRING([--enable-examples],[Antigrain examples])) AM_CONDITIONAL(ENABLE_EXAMPLES,test x$enable_examples != xno) AC_ARG_ENABLE(ctrl, AC_HELP_STRING([--enable-ctrl],[a gui libray used in examples])) AC_ARG_ENABLE(platform, AC_HELP_STRING([--enable-platform],[portable platform layers])) if test x$enable_examples != xno ; then enable_platform="yes" fi if test x$enable_platform != xno ; then enable_ctrl="yes" fi AM_CONDITIONAL(ENABLE_CTRL,test x$enable_ctrl != xno) # used as platform library in examples: # todo, make the PREFERED_PLATFORM selectable, after the set of possible # Platforms to link the examples have been evaluated. PREFERED_PLATFORM=X11 case "$host" in *darwin* ) OSX_LIBS="-framework Carbon -framework QuickTime" OSX_CFLAGS="-I/System/Library/Frameworks/Carbon.framework/Headers -I/System/Library/Frameworks/QuickTime.framework/Headers " AC_SUBST(OSX_CFLAGS) AC_SUBST(OSX_LIBS) osx_host=yes PREFERED_PLATFORM=mac ;; dnl #### Check if we are compiling for win32 ##### *mingw*) win32_host=yes WINDOWS_LIBS=-lgdi32 WINDOWS_CFLAGS= AC_SUBST(WINDOWS_CFLAGS) AC_SUBST(WINDOWS_LIBS) PREFERED_PLATFORM=win32 ;; esac AM_CONDITIONAL(ENABLE_WIN32,[test x$win32_host = xyes -a x$enable_platform != xno ]) AM_CONDITIONAL(ENABLE_OSX,[test x$osx_host = xyes -a x$enable_platform != xno ]) dnl then enable font_win32tt AC_ARG_ENABLE(win32tt, AC_HELP_STRING([--enable-win32tt],[Win32 TrueType font support library]), enable_tt=$enable_win32tt, enable_tt=$win32_host) AM_CONDITIONAL(ENABLE_WIN32_TT, test x$enable_tt = xyes ) dnl ######### Check for FT2: ##################### ft_enabled="" PKG_CHECK_MODULES([FREETYPE], freetype2, [ft_enabled="yes"], AC_MSG_WARN([*** Freetype2 not found! Building without font library.]) ) AC_ARG_ENABLE(freetype, AC_HELP_STRING([--enable-freetype],[freetype font support library]), ft_enabled=$enable_freetype) AM_CONDITIONAL(ENABLE_FT,[test xyes = x$ft_enabled]) dnl ############################################### dnl ######### Ask for GPC: ####################### AC_ARG_ENABLE(gpc, AC_HELP_STRING([--enable-gpc],[gpc polygon clipper library]) ) AM_CONDITIONAL(ENABLE_GPC,[test xyes = x$enable_gpc]) dnl ############################################### dnl ######### Check for SDL: ##################### dnl the sdl script pollutes our global values: temp_LIBS="$LIBS" temp_CFLAGS="$CFLAGS" temp_CXXFLAGS="$CXXFLAGS" sdl_enabled="" SDL_VERSION=1.2.0 AM_PATH_SDL($SDL_VERSION, [sdl_enabled="yes"], AC_MSG_WARN([*** SDL version $SDL_VERSION not found! Omitting sdl layer.]) ) dnl ### Restore old values CFLAGS=$temp_CFLAGS CXXFLAGS=$temp_CXXFLAGS LIBS=$temp_LIBS dnl ### the sdl script already does that: dnl AC_SUBST(SDL_CFLAGS) dnl AC_SUBST(SDL_LIBS) AM_CONDITIONAL(ENABLE_SDL,[test xyes = x$sdl_enabled -a xno != x$enable_platform -a x$win32_host != xyes]) dnl ############################################### dnl ######### Checking for X11: ################## AC_PATH_X if test "$no_x" = "yes"; then AC_MSG_WARN([*** X11 not found! Omitting X11 layer.]) fi AM_CONDITIONAL(ENABLE_X11,[test x$no_x = x -a xno != x$enable_platform -a x$win32_host != xyes]) AC_SUBST(x_includes) AC_SUBST(x_libraries) dnl ############################################### dnl Settung up library version AGG_LIB_VERSION="2:4:0" dnl current-┬┤ / / dnl revision--┬┤ / dnl age---┬┤ dnl Update the version information only immediately before a public release of antigrain dnl If the library source code has changed, increment revision (c:r:a becomes c:r+1:a). dnl If any interfaces have been added, removed, or changed since the last update, dnl increment current, and set revision to 0. dnl If any interfaces have been added since the last public release, then increment age. dnl If any interfaces have been removed since the last public release, then set age to 0. AC_SUBST(AGG_LIB_VERSION) AC_SUBST(PREFERED_PLATFORM) AC_OUTPUT( Makefile libagg.pc gpc/Makefile font_freetype/Makefile font_win32_tt/Makefile src/Makefile src/ctrl/Makefile src/platform/Makefile src/platform/X11/Makefile src/platform/sdl/Makefile src/platform/mac/Makefile src/platform/win32/Makefile src/platform/BeOS/Makefile src/platform/AmigaOS/Makefile include/Makefile include/ctrl/Makefile include/util/Makefile include/platform/Makefile examples/Makefile ) enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.Linux.SDL0000644000175000017500000000020613233644505023135 0ustar varunvarunAGGLIBS= -lagg -lSDL AGGCXXFLAGS = -O3 -I/usr/include/SDL -L/usr/lib CXX = g++ C = gcc #CXX = icc LIB = ar cr .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/copying0000644000175000017500000000505513233644505020753 0ustar varunvarunThe Anti-Grain Geometry Project A high quality rendering engine for C++ http://antigrain.com Anti-Grain Geometry has dual licensing model. The Modified BSD License was first added in version v2.4 just for convenience. It is a simple, permissive non-copyleft free software license, compatible with the GNU GPL. It's well proven and recognizable. See http://www.fsf.org/licensing/licenses/index_html#ModifiedBSD for details. Note that the Modified BSD license DOES NOT restrict your rights if you choose the Anti-Grain Geometry Public License. Anti-Grain Geometry Public License ==================================================== Anti-Grain Geometry - Version 2.4 Copyright (C) 2002-2005 Maxim Shemanarev (McSeem) Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose. Modified BSD License ==================================================== Anti-Grain Geometry - Version 2.4 Copyright (C) 2002-2005 Maxim Shemanarev (McSeem) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/authors0000644000175000017500000000012713233644505020763 0ustar varunvarunAnti-Grain Geometry - Version 2.4 Copyright (C) 2002-2005 Maxim Shemanarev (McSeem) enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.IRIX640000644000175000017500000000012513233644505022342 0ustar varunvarunAGGLIBS= -lagg AGGCXXFLAGS = CXX = CC C = cc LIB = CC -ar -o .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.Darwin0000644000175000017500000000021113233644505022635 0ustar varunvarunAGGLIBS= -lagg AGGCXXFLAGS = -O3 -I/usr/X11R6/include -L/usr/X11R6/lib CXX = g++ C = gcc #CXX = icc LIB = ar cr .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.AmigaOS0000644000175000017500000002722013233644505022275 0ustar varunvarun# # Makefile for AmigaOS 4.0 # .PHONY : help all setup lib examples svg freetype clean install wget CXX = g++ CXXFLAGS = -mcrt=clib2 -O3 -Iinclude -Igpc -Ifont_freetype CXXLIBS = -Llib -lagg CC = gcc CFLAGS = -mcrt=clib2 -O3 AR = ar ARFLAGS = cr STRIP = strip -R.comment AGGLIBNAME = lib/libagg.a SVGNAME = bin/svg_test EXAMPLES =\ bin/aa_demo \ bin/aa_test \ bin/alpha_gradient \ bin/alpha_mask \ bin/alpha_mask2 \ bin/alpha_mask3 \ bin/bezier_div \ bin/bspline \ bin/circles \ bin/component_rendering \ bin/compositing \ bin/compositing2 \ bin/conv_contour \ bin/conv_dash_marker \ bin/conv_stroke \ bin/distortions \ bin/flash_rasterizer \ bin/flash_rasterizer2 \ bin/gamma_correction \ bin/gamma_ctrl \ bin/gamma_tuner \ bin/gouraud \ bin/gouraud_mesh \ bin/gpc_test \ bin/gradients \ bin/graph_test \ bin/idea \ bin/image_alpha \ bin/image_filters \ bin/image_filters2 \ bin/image_fltr_graph \ bin/image_perspective \ bin/image_resample \ bin/image_transforms \ bin/image1 \ bin/line_patterns_clip \ bin/line_patterns \ bin/lion \ bin/lion_lens \ bin/lion_outline \ bin/mol_view \ bin/multi_clip \ bin/pattern_fill \ bin/pattern_perspective \ bin/pattern_resample \ bin/perspective \ bin/polymorphic_renderer \ bin/raster_text \ bin/rasterizers \ bin/rasterizers2 \ bin/rounded_rect \ bin/scanline_boolean \ bin/scanline_boolean2 \ bin/simple_blur \ bin/trans_polar FREETYPE_EXAMPLES=\ bin/freetype_test \ bin/trans_curve1_ft \ bin/trans_curve2_ft PLATFORM_SRC=\ src/platform/AmigaOS/agg_platform_support.cpp FREETYPE_SRC=\ font_freetype/agg_font_freetype.cpp LIB_CXXSRC=\ src/agg_arc.cpp \ src/agg_arrowhead.cpp \ src/agg_bezier_arc.cpp \ src/agg_bspline.cpp \ src/agg_curves.cpp \ src/agg_embedded_raster_fonts.cpp \ src/agg_gsv_text.cpp \ src/agg_image_filters.cpp \ src/agg_line_aa_basics.cpp \ src/agg_line_profile_aa.cpp \ src/agg_rounded_rect.cpp \ src/agg_sqrt_tables.cpp \ src/agg_trans_affine.cpp \ src/agg_trans_double_path.cpp \ src/agg_trans_single_path.cpp \ src/agg_trans_warp_magnifier.cpp \ src/agg_vcgen_bspline.cpp \ src/agg_vcgen_contour.cpp \ src/agg_vcgen_dash.cpp \ src/agg_vcgen_markers_term.cpp \ src/agg_vcgen_smooth_poly1.cpp \ src/agg_vcgen_stroke.cpp \ src/agg_vpgen_clip_polygon.cpp \ src/agg_vpgen_clip_polyline.cpp \ src/agg_vpgen_segmentator.cpp \ src/ctrl/agg_bezier_ctrl.cpp \ src/ctrl/agg_cbox_ctrl.cpp \ src/ctrl/agg_gamma_ctrl.cpp \ src/ctrl/agg_gamma_spline.cpp \ src/ctrl/agg_polygon_ctrl.cpp \ src/ctrl/agg_rbox_ctrl.cpp \ src/ctrl/agg_scale_ctrl.cpp \ src/ctrl/agg_slider_ctrl.cpp \ src/ctrl/agg_spline_ctrl.cpp LIB_CSRC=\ gpc/gpc.c SVG_SRC=\ examples/svg_viewer/agg_svg_parser.cpp \ examples/svg_viewer/agg_svg_path_renderer.cpp \ examples/svg_viewer/agg_svg_path_tokenizer.cpp \ examples/svg_viewer/svg_test.cpp \ $(PLATFORM_SRC) PLATFORM_OBJ = $(PLATFORM_SRC:.cpp=.o) FREETYPE_OBJ = $(FREETYPE_SRC:.cpp=.o) LIB_OBJ = $(LIB_CXXSRC:.cpp=.o) $(LIB_CSRC:.c=.o) SVG_OBJ = $(SVG_SRC:.cpp=.o) # # Targets # help: @Echo Requirements: @Echo - AmigaOS 4.0 @Echo - SDK 51.15 @Echo - GCC 4.0.2 @Echo - clib2 1.198 @Echo - optional: libexpat.a for SVG viewer @Echo - optional: libfreetype.a for FreeType examples @Echo '""' @Echo Targets: @Echo all - build AGG library and all tests/examples @Echo lib - build AGG library only @Echo examples - build AGG library and examples @Echo svg - build AGG library and SVG viewer @Echo freetype - build AGG library and FreeType examples @Echo clean - clean all build files @Echo install - build AGG library and install into SDK @Echo wget - download and install example test files with wget all: setup lib examples svg freetype $(STRIP) $(EXAMPLES) $(SVGNAME) $(FREETYPE_EXAMPLES) setup: -@MakeDir >NIL: lib bin lib: setup $(AGGLIBNAME) examples: lib $(EXAMPLES) svg: lib $(SVGNAME) freetype: lib $(FREETYPE_EXAMPLES) clean: -@Delete >NIL: FORCE QUIET examples/#?.o -@Delete >NIL: FORCE QUIET $(PLATFORM_OBJ) $(FREETYPE_OBJ) $(LIB_OBJ) $(SVG_OBJ) -@Delete >NIL: FORCE QUIET ALL lib bin install: lib -@Copy CLONE $(AGGLIBNAME) SDK:Local/clib2/lib -@Copy CLONE ALL include/#?.h SDK:Local/clib2/include/agg -@Copy CLONE ALL gpc/#?.h SDK:Local/clib2/include/gpc $(AGGLIBNAME): $(LIB_OBJ) $(AR) $(ARFLAGS) $(AGGLIBNAME) $^ $(SVGNAME): $(SVG_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) -lexpat # # Examples binaries # bin/aa_test: examples/aa_test.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/aa_demo: examples/aa_demo.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/alpha_gradient: examples/alpha_gradient.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/alpha_mask: examples/alpha_mask.o examples/parse_lion.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/alpha_mask2: examples/alpha_mask2.o examples/parse_lion.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/alpha_mask3: examples/alpha_mask3.o examples/make_arrows.o examples/make_gb_poly.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/bezier_div: examples/bezier_div.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/bspline: examples/bspline.o examples/interactive_polygon.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/circles: examples/circles.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/component_rendering: examples/component_rendering.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/compositing: examples/compositing.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/compositing2: examples/compositing2.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/conv_contour: examples/conv_contour.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/conv_dash_marker: examples/conv_dash_marker.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/conv_stroke: examples/conv_stroke.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/distortions: examples/distortions.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/flash_rasterizer: examples/flash_rasterizer.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/flash_rasterizer2: examples/flash_rasterizer2.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/gamma_correction: examples/gamma_correction.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/gamma_ctrl: examples/gamma_ctrl.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/gamma_tuner: examples/gamma_tuner.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/gouraud: examples/gouraud.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/gouraud_mesh: examples/gouraud_mesh.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/gpc_test: examples/gpc_test.o examples/make_arrows.o examples/make_gb_poly.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/gradients: examples/gradients.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/graph_test: examples/graph_test.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/idea: examples/idea.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/image1: examples/image1.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/image_alpha: examples/image_alpha.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/image_filters: examples/image_filters.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/image_filters2: examples/image_filters2.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/image_fltr_graph: examples/image_fltr_graph.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/image_perspective: examples/image_perspective.o examples/interactive_polygon.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/image_resample: examples/image_resample.o examples/interactive_polygon.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/image_transforms: examples/image_transforms.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/line_patterns: examples/line_patterns.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/line_patterns_clip: examples/line_patterns_clip.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/lion: examples/lion.o examples/parse_lion.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/lion_lens: examples/lion_lens.o examples/parse_lion.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/lion_outline: examples/lion_outline.o examples/parse_lion.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/mol_view: examples/mol_view.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/multi_clip: examples/multi_clip.o examples/parse_lion.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/pattern_fill: examples/pattern_fill.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/pattern_perspective: examples/pattern_perspective.o examples/interactive_polygon.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/pattern_resample: examples/pattern_resample.o examples/interactive_polygon.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/perspective: examples/perspective.o examples/interactive_polygon.o examples/parse_lion.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/polymorphic_renderer: examples/polymorphic_renderer.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/rasterizers: examples/rasterizers.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/rasterizers2: examples/rasterizers2.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/raster_text: examples/raster_text.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/rounded_rect: examples/rounded_rect.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/scanline_boolean: examples/scanline_boolean.o examples/interactive_polygon.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/scanline_boolean2: examples/scanline_boolean2.o examples/make_arrows.o examples/make_gb_poly.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/simple_blur: examples/simple_blur.o examples/parse_lion.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/trans_polar: examples/trans_polar.o $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) bin/freetype_test: examples/freetype_test.o $(FREETYPE_OBJ) $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) -lfreetype -lz bin/trans_curve1_ft: examples/trans_curve1_ft.o examples/interactive_polygon.o $(FREETYPE_OBJ) $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) -lfreetype -lz bin/trans_curve2_ft: examples/trans_curve2_ft.o examples/interactive_polygon.o $(FREETYPE_OBJ) $(PLATFORM_OBJ) $(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) -lfreetype -lz # # Examples files # wget: wget http://www.antigrain.com/svg/tiger.svg move tiger.svg bin wget http://www.antigrain.com/agg.bmp move agg.bmp bin wget http://www.antigrain.com/compositing.bmp move compositing.bmp bin wget http://www.antigrain.com/spheres.bmp move spheres.bmp bin wget http://www.antigrain.com/shapes.txt move shapes.txt bin wget http://www.antigrain.com/1.sdf move 1.sdf bin wget http://www.antigrain.com/line_patterns.bmp.zip xadunfile line_patterns.bmp.zip bin overwrite delete line_patterns.bmp.zip wget http://www.antigrain.com/timesi.zip xadunfile timesi.zip bin overwrite delete timesi.zip # # Pattern Rules # %.o: %.cpp $(CXX) -c $(CXXFLAGS) $*.cpp -o $@ %.o: %.c $(CC) -c $(CFLAGS) $*.c -o $@ enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/0000755000175000017500000000000013544357602021002 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_interpolator_persp.h0000644000175000017500000003741613233644505026754 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SPAN_INTERPOLATOR_PERSP_INCLUDED #define AGG_SPAN_INTERPOLATOR_PERSP_INCLUDED #include "agg_trans_perspective.h" #include "agg_dda_line.h" namespace agg24 { //===========================================span_interpolator_persp_exact template class span_interpolator_persp_exact { public: typedef trans_perspective trans_type; typedef trans_perspective::iterator_x iterator_type; enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; //-------------------------------------------------------------------- span_interpolator_persp_exact() {} //-------------------------------------------------------------------- // Arbitrary quadrangle transformations span_interpolator_persp_exact(const double* src, const double* dst) { quad_to_quad(src, dst); } //-------------------------------------------------------------------- // Direct transformations span_interpolator_persp_exact(double x1, double y1, double x2, double y2, const double* quad) { rect_to_quad(x1, y1, x2, y2, quad); } //-------------------------------------------------------------------- // Reverse transformations span_interpolator_persp_exact(const double* quad, double x1, double y1, double x2, double y2) { quad_to_rect(quad, x1, y1, x2, y2); } //-------------------------------------------------------------------- // Set the transformations using two arbitrary quadrangles. void quad_to_quad(const double* src, const double* dst) { m_trans_dir.quad_to_quad(src, dst); m_trans_inv.quad_to_quad(dst, src); } //-------------------------------------------------------------------- // Set the direct transformations, i.e., rectangle -> quadrangle void rect_to_quad(double x1, double y1, double x2, double y2, const double* quad) { double src[8]; src[0] = src[6] = x1; src[2] = src[4] = x2; src[1] = src[3] = y1; src[5] = src[7] = y2; quad_to_quad(src, quad); } //-------------------------------------------------------------------- // Set the reverse transformations, i.e., quadrangle -> rectangle void quad_to_rect(const double* quad, double x1, double y1, double x2, double y2) { double dst[8]; dst[0] = dst[6] = x1; dst[2] = dst[4] = x2; dst[1] = dst[3] = y1; dst[5] = dst[7] = y2; quad_to_quad(quad, dst); } //-------------------------------------------------------------------- // Check if the equations were solved successfully bool is_valid() const { return m_trans_dir.is_valid(); } //---------------------------------------------------------------- void begin(double x, double y, unsigned len) { m_iterator = m_trans_dir.begin(x, y, 1.0); double xt = m_iterator.x; double yt = m_iterator.y; double dx; double dy; const double delta = 1/double(subpixel_scale); dx = xt + delta; dy = yt; m_trans_inv.transform(&dx, &dy); dx -= x; dy -= y; int sx1 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; dx = xt; dy = yt + delta; m_trans_inv.transform(&dx, &dy); dx -= x; dy -= y; int sy1 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; x += len; xt = x; yt = y; m_trans_dir.transform(&xt, &yt); dx = xt + delta; dy = yt; m_trans_inv.transform(&dx, &dy); dx -= x; dy -= y; int sx2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; dx = xt; dy = yt + delta; m_trans_inv.transform(&dx, &dy); dx -= x; dy -= y; int sy2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; m_scale_x = dda2_line_interpolator(sx1, sx2, len); m_scale_y = dda2_line_interpolator(sy1, sy2, len); } //---------------------------------------------------------------- void resynchronize(double xe, double ye, unsigned len) { // Assume x1,y1 are equal to the ones at the previous end point int sx1 = m_scale_x.y(); int sy1 = m_scale_y.y(); // Calculate transformed coordinates at x2,y2 double xt = xe; double yt = ye; m_trans_dir.transform(&xt, &yt); const double delta = 1/double(subpixel_scale); double dx; double dy; // Calculate scale by X at x2,y2 dx = xt + delta; dy = yt; m_trans_inv.transform(&dx, &dy); dx -= xe; dy -= ye; int sx2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; // Calculate scale by Y at x2,y2 dx = xt; dy = yt + delta; m_trans_inv.transform(&dx, &dy); dx -= xe; dy -= ye; int sy2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; // Initialize the interpolators m_scale_x = dda2_line_interpolator(sx1, sx2, len); m_scale_y = dda2_line_interpolator(sy1, sy2, len); } //---------------------------------------------------------------- void operator++() { ++m_iterator; ++m_scale_x; ++m_scale_y; } //---------------------------------------------------------------- void coordinates(int* x, int* y) const { *x = iround(m_iterator.x * subpixel_scale); *y = iround(m_iterator.y * subpixel_scale); } //---------------------------------------------------------------- void local_scale(int* x, int* y) { *x = m_scale_x.y(); *y = m_scale_y.y(); } //---------------------------------------------------------------- void transform(double* x, double* y) const { m_trans_dir.transform(x, y); } private: trans_type m_trans_dir; trans_type m_trans_inv; iterator_type m_iterator; dda2_line_interpolator m_scale_x; dda2_line_interpolator m_scale_y; }; //============================================span_interpolator_persp_lerp template class span_interpolator_persp_lerp { public: typedef trans_perspective trans_type; enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; //-------------------------------------------------------------------- span_interpolator_persp_lerp() {} //-------------------------------------------------------------------- // Arbitrary quadrangle transformations span_interpolator_persp_lerp(const double* src, const double* dst) { quad_to_quad(src, dst); } //-------------------------------------------------------------------- // Direct transformations span_interpolator_persp_lerp(double x1, double y1, double x2, double y2, const double* quad) { rect_to_quad(x1, y1, x2, y2, quad); } //-------------------------------------------------------------------- // Reverse transformations span_interpolator_persp_lerp(const double* quad, double x1, double y1, double x2, double y2) { quad_to_rect(quad, x1, y1, x2, y2); } //-------------------------------------------------------------------- // Set the transformations using two arbitrary quadrangles. void quad_to_quad(const double* src, const double* dst) { m_trans_dir.quad_to_quad(src, dst); m_trans_inv.quad_to_quad(dst, src); } //-------------------------------------------------------------------- // Set the direct transformations, i.e., rectangle -> quadrangle void rect_to_quad(double x1, double y1, double x2, double y2, const double* quad) { double src[8]; src[0] = src[6] = x1; src[2] = src[4] = x2; src[1] = src[3] = y1; src[5] = src[7] = y2; quad_to_quad(src, quad); } //-------------------------------------------------------------------- // Set the reverse transformations, i.e., quadrangle -> rectangle void quad_to_rect(const double* quad, double x1, double y1, double x2, double y2) { double dst[8]; dst[0] = dst[6] = x1; dst[2] = dst[4] = x2; dst[1] = dst[3] = y1; dst[5] = dst[7] = y2; quad_to_quad(quad, dst); } //-------------------------------------------------------------------- // Check if the equations were solved successfully bool is_valid() const { return m_trans_dir.is_valid(); } //---------------------------------------------------------------- void begin(double x, double y, unsigned len) { // Calculate transformed coordinates at x1,y1 double xt = x; double yt = y; m_trans_dir.transform(&xt, &yt); int x1 = iround(xt * subpixel_scale); int y1 = iround(yt * subpixel_scale); double dx; double dy; const double delta = 1/double(subpixel_scale); // Calculate scale by X at x1,y1 dx = xt + delta; dy = yt; m_trans_inv.transform(&dx, &dy); dx -= x; dy -= y; int sx1 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; // Calculate scale by Y at x1,y1 dx = xt; dy = yt + delta; m_trans_inv.transform(&dx, &dy); dx -= x; dy -= y; int sy1 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; // Calculate transformed coordinates at x2,y2 x += len; xt = x; yt = y; m_trans_dir.transform(&xt, &yt); int x2 = iround(xt * subpixel_scale); int y2 = iround(yt * subpixel_scale); // Calculate scale by X at x2,y2 dx = xt + delta; dy = yt; m_trans_inv.transform(&dx, &dy); dx -= x; dy -= y; int sx2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; // Calculate scale by Y at x2,y2 dx = xt; dy = yt + delta; m_trans_inv.transform(&dx, &dy); dx -= x; dy -= y; int sy2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; // Initialize the interpolators m_coord_x = dda2_line_interpolator(x1, x2, len); m_coord_y = dda2_line_interpolator(y1, y2, len); m_scale_x = dda2_line_interpolator(sx1, sx2, len); m_scale_y = dda2_line_interpolator(sy1, sy2, len); } //---------------------------------------------------------------- void resynchronize(double xe, double ye, unsigned len) { // Assume x1,y1 are equal to the ones at the previous end point int x1 = m_coord_x.y(); int y1 = m_coord_y.y(); int sx1 = m_scale_x.y(); int sy1 = m_scale_y.y(); // Calculate transformed coordinates at x2,y2 double xt = xe; double yt = ye; m_trans_dir.transform(&xt, &yt); int x2 = iround(xt * subpixel_scale); int y2 = iround(yt * subpixel_scale); const double delta = 1/double(subpixel_scale); double dx; double dy; // Calculate scale by X at x2,y2 dx = xt + delta; dy = yt; m_trans_inv.transform(&dx, &dy); dx -= xe; dy -= ye; int sx2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; // Calculate scale by Y at x2,y2 dx = xt; dy = yt + delta; m_trans_inv.transform(&dx, &dy); dx -= xe; dy -= ye; int sy2 = uround(subpixel_scale/sqrt(dx*dx + dy*dy)) >> subpixel_shift; // Initialize the interpolators m_coord_x = dda2_line_interpolator(x1, x2, len); m_coord_y = dda2_line_interpolator(y1, y2, len); m_scale_x = dda2_line_interpolator(sx1, sx2, len); m_scale_y = dda2_line_interpolator(sy1, sy2, len); } //---------------------------------------------------------------- void operator++() { ++m_coord_x; ++m_coord_y; ++m_scale_x; ++m_scale_y; } //---------------------------------------------------------------- void coordinates(int* x, int* y) const { *x = m_coord_x.y(); *y = m_coord_y.y(); } //---------------------------------------------------------------- void local_scale(int* x, int* y) { *x = m_scale_x.y(); *y = m_scale_y.y(); } //---------------------------------------------------------------- void transform(double* x, double* y) const { m_trans_dir.transform(x, y); } private: trans_type m_trans_dir; trans_type m_trans_inv; dda2_line_interpolator m_coord_x; dda2_line_interpolator m_coord_y; dda2_line_interpolator m_scale_x; dda2_line_interpolator m_scale_y; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_image_filter.h0000644000175000017500000002236413233644505025444 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Image transformations with filtering. Span generator base class // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_IMAGE_FILTER_INCLUDED #define AGG_SPAN_IMAGE_FILTER_INCLUDED #include "agg_basics.h" #include "agg_image_filters.h" #include "agg_span_interpolator_linear.h" namespace agg24 { //-------------------------------------------------------span_image_filter template class span_image_filter { public: typedef Source source_type; typedef Interpolator interpolator_type; //-------------------------------------------------------------------- span_image_filter() {} span_image_filter(source_type& src, interpolator_type& interpolator, image_filter_lut* filter) : m_src(&src), m_interpolator(&interpolator), m_filter(filter), m_dx_dbl(0.5), m_dy_dbl(0.5), m_dx_int(image_subpixel_scale / 2), m_dy_int(image_subpixel_scale / 2) {} void attach(source_type& v) { m_src = &v; } //-------------------------------------------------------------------- source_type& source() { return *m_src; } const source_type& source() const { return *m_src; } const image_filter_lut& filter() const { return *m_filter; } int filter_dx_int() const { return m_dx_int; } int filter_dy_int() const { return m_dy_int; } double filter_dx_dbl() const { return m_dx_dbl; } double filter_dy_dbl() const { return m_dy_dbl; } //-------------------------------------------------------------------- void interpolator(interpolator_type& v) { m_interpolator = &v; } void filter(image_filter_lut& v) { m_filter = &v; } void filter_offset(double dx, double dy) { m_dx_dbl = dx; m_dy_dbl = dy; m_dx_int = iround(dx * image_subpixel_scale); m_dy_int = iround(dy * image_subpixel_scale); } void filter_offset(double d) { filter_offset(d, d); } //-------------------------------------------------------------------- interpolator_type& interpolator() { return *m_interpolator; } //-------------------------------------------------------------------- void prepare() {} //-------------------------------------------------------------------- private: source_type* m_src; interpolator_type* m_interpolator; image_filter_lut* m_filter; double m_dx_dbl; double m_dy_dbl; unsigned m_dx_int; unsigned m_dy_int; }; //==============================================span_image_resample_affine template class span_image_resample_affine : public span_image_filter > { public: typedef Source source_type; typedef span_interpolator_linear interpolator_type; typedef span_image_filter base_type; //-------------------------------------------------------------------- span_image_resample_affine() : m_scale_limit(200.0), m_blur_x(1.0), m_blur_y(1.0) {} //-------------------------------------------------------------------- span_image_resample_affine(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, &filter), m_scale_limit(200.0), m_blur_x(1.0), m_blur_y(1.0) {} //-------------------------------------------------------------------- int scale_limit() const { return uround(m_scale_limit); } void scale_limit(int v) { m_scale_limit = v; } //-------------------------------------------------------------------- double blur_x() const { return m_blur_x; } double blur_y() const { return m_blur_y; } void blur_x(double v) { m_blur_x = v; } void blur_y(double v) { m_blur_y = v; } void blur(double v) { m_blur_x = m_blur_y = v; } //-------------------------------------------------------------------- void prepare() { double scale_x; double scale_y; base_type::interpolator().transformer().scaling_abs(&scale_x, &scale_y); if(scale_x * scale_y > m_scale_limit) { scale_x = scale_x * m_scale_limit / (scale_x * scale_y); scale_y = scale_y * m_scale_limit / (scale_x * scale_y); } if(scale_x < 1) scale_x = 1; if(scale_y < 1) scale_y = 1; if(scale_x > m_scale_limit) scale_x = m_scale_limit; if(scale_y > m_scale_limit) scale_y = m_scale_limit; scale_x *= m_blur_x; scale_y *= m_blur_y; if(scale_x < 1) scale_x = 1; if(scale_y < 1) scale_y = 1; m_rx = uround( scale_x * double(image_subpixel_scale)); m_rx_inv = uround(1.0/scale_x * double(image_subpixel_scale)); m_ry = uround( scale_y * double(image_subpixel_scale)); m_ry_inv = uround(1.0/scale_y * double(image_subpixel_scale)); } protected: int m_rx; int m_ry; int m_rx_inv; int m_ry_inv; private: double m_scale_limit; double m_blur_x; double m_blur_y; }; //=====================================================span_image_resample template class span_image_resample : public span_image_filter { public: typedef Source source_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; //-------------------------------------------------------------------- span_image_resample() : m_scale_limit(20), m_blur_x(image_subpixel_scale), m_blur_y(image_subpixel_scale) {} //-------------------------------------------------------------------- span_image_resample(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, &filter), m_scale_limit(20), m_blur_x(image_subpixel_scale), m_blur_y(image_subpixel_scale) {} //-------------------------------------------------------------------- int scale_limit() const { return m_scale_limit; } void scale_limit(int v) { m_scale_limit = v; } //-------------------------------------------------------------------- double blur_x() const { return double(m_blur_x) / double(image_subpixel_scale); } double blur_y() const { return double(m_blur_y) / double(image_subpixel_scale); } void blur_x(double v) { m_blur_x = uround(v * double(image_subpixel_scale)); } void blur_y(double v) { m_blur_y = uround(v * double(image_subpixel_scale)); } void blur(double v) { m_blur_x = m_blur_y = uround(v * double(image_subpixel_scale)); } protected: AGG_INLINE void adjust_scale(int* rx, int* ry) { if(*rx < image_subpixel_scale) *rx = image_subpixel_scale; if(*ry < image_subpixel_scale) *ry = image_subpixel_scale; if(*rx > image_subpixel_scale * m_scale_limit) { *rx = image_subpixel_scale * m_scale_limit; } if(*ry > image_subpixel_scale * m_scale_limit) { *ry = image_subpixel_scale * m_scale_limit; } *rx = (*rx * m_blur_x) >> image_subpixel_shift; *ry = (*ry * m_blur_y) >> image_subpixel_shift; if(*rx < image_subpixel_scale) *rx = image_subpixel_scale; if(*ry < image_subpixel_scale) *ry = image_subpixel_scale; } int m_scale_limit; int m_blur_x; int m_blur_y; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vpgen_segmentator.h0000644000175000017500000000351013233644505025513 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_VPGEN_SEGMENTATOR_INCLUDED #define AGG_VPGEN_SEGMENTATOR_INCLUDED #include #include "agg_basics.h" namespace agg24 { //=======================================================vpgen_segmentator // // See Implementation agg_vpgen_segmentator.cpp // class vpgen_segmentator { public: vpgen_segmentator() : m_approximation_scale(1.0) {} void approximation_scale(double s) { m_approximation_scale = s; } double approximation_scale() const { return m_approximation_scale; } static bool auto_close() { return false; } static bool auto_unclose() { return false; } void reset() { m_cmd = path_cmd_stop; } void move_to(double x, double y); void line_to(double x, double y); unsigned vertex(double* x, double* y); private: double m_approximation_scale; double m_x1; double m_y1; double m_dx; double m_dy; double m_dl; double m_ddl; unsigned m_cmd; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vertex_sequence.h0000644000175000017500000001235213233644505025175 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // vertex_sequence container and vertex_dist struct // //---------------------------------------------------------------------------- #ifndef AGG_VERTEX_SEQUENCE_INCLUDED #define AGG_VERTEX_SEQUENCE_INCLUDED #include "agg_basics.h" #include "agg_array.h" #include "agg_math.h" namespace agg24 { //----------------------------------------------------------vertex_sequence // Modified agg24::pod_bvector. The data is interpreted as a sequence // of vertices. It means that the type T must expose: // // bool T::operator() (const T& val) // // that is called every time new vertex is being added. The main purpose // of this operator is the possibility to calculate some values during // adding and to return true if the vertex fits some criteria or false if // it doesn't. In the last case the new vertex is not added. // // The simple example is filtering coinciding vertices with calculation // of the distance between the current and previous ones: // // struct vertex_dist // { // double x; // double y; // double dist; // // vertex_dist() {} // vertex_dist(double x_, double y_) : // x(x_), // y(y_), // dist(0.0) // { // } // // bool operator () (const vertex_dist& val) // { // return (dist = calc_distance(x, y, val.x, val.y)) > EPSILON; // } // }; // // Function close() calls this operator and removes the last vertex if // necessary. //------------------------------------------------------------------------ template class vertex_sequence : public pod_bvector { public: typedef pod_bvector base_type; void add(const T& val); void modify_last(const T& val); void close(bool remove_flag); }; //------------------------------------------------------------------------ template void vertex_sequence::add(const T& val) { if(base_type::size() > 1) { if(!(*this)[base_type::size() - 2]((*this)[base_type::size() - 1])) { base_type::remove_last(); } } base_type::add(val); } //------------------------------------------------------------------------ template void vertex_sequence::modify_last(const T& val) { base_type::remove_last(); add(val); } //------------------------------------------------------------------------ template void vertex_sequence::close(bool closed) { while(base_type::size() > 1) { if((*this)[base_type::size() - 2]((*this)[base_type::size() - 1])) break; T t = (*this)[base_type::size() - 1]; base_type::remove_last(); modify_last(t); } if(closed) { while(base_type::size() > 1) { if((*this)[base_type::size() - 1]((*this)[0])) break; base_type::remove_last(); } } } //-------------------------------------------------------------vertex_dist // Vertex (x, y) with the distance to the next one. The last vertex has // distance between the last and the first points if the polygon is closed // and 0.0 if it's a polyline. struct vertex_dist { double x; double y; double dist; vertex_dist() {} vertex_dist(double x_, double y_) : x(x_), y(y_), dist(0.0) { } bool operator () (const vertex_dist& val) { bool ret = (dist = calc_distance(x, y, val.x, val.y)) > vertex_dist_epsilon; if(!ret) dist = 1.0 / vertex_dist_epsilon; return ret; } }; //--------------------------------------------------------vertex_dist_cmd // Save as the above but with additional "command" value struct vertex_dist_cmd : public vertex_dist { unsigned cmd; vertex_dist_cmd() {} vertex_dist_cmd(double x_, double y_, unsigned cmd_) : vertex_dist(x_, y_), cmd(cmd_) { } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_adaptor_vcgen.h0000644000175000017500000001200713233644505025626 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CONV_ADAPTOR_VCGEN_INCLUDED #define AGG_CONV_ADAPTOR_VCGEN_INCLUDED #include "agg_basics.h" namespace agg24 { //------------------------------------------------------------null_markers struct null_markers { void remove_all() {} void add_vertex(double, double, unsigned) {} void prepare_src() {} void rewind(unsigned) {} unsigned vertex(double*, double*) { return path_cmd_stop; } }; //------------------------------------------------------conv_adaptor_vcgen template class conv_adaptor_vcgen { enum status { initial, accumulate, generate }; public: explicit conv_adaptor_vcgen(VertexSource& source) : m_source(&source), m_status(initial) {} void attach(VertexSource& source) { m_source = &source; } Generator& generator() { return m_generator; } const Generator& generator() const { return m_generator; } Markers& markers() { return m_markers; } const Markers& markers() const { return m_markers; } void rewind(unsigned path_id) { m_source->rewind(path_id); m_status = initial; } unsigned vertex(double* x, double* y); private: // Prohibit copying conv_adaptor_vcgen(const conv_adaptor_vcgen&); const conv_adaptor_vcgen& operator = (const conv_adaptor_vcgen&); VertexSource* m_source; Generator m_generator; Markers m_markers; status m_status; unsigned m_last_cmd; double m_start_x; double m_start_y; }; //------------------------------------------------------------------------ template unsigned conv_adaptor_vcgen::vertex(double* x, double* y) { unsigned cmd = path_cmd_stop; bool done = false; while(!done) { switch(m_status) { case initial: m_markers.remove_all(); m_last_cmd = m_source->vertex(&m_start_x, &m_start_y); m_status = accumulate; case accumulate: if(is_stop(m_last_cmd)) return path_cmd_stop; m_generator.remove_all(); m_generator.add_vertex(m_start_x, m_start_y, path_cmd_move_to); m_markers.add_vertex(m_start_x, m_start_y, path_cmd_move_to); for(;;) { cmd = m_source->vertex(x, y); if(is_vertex(cmd)) { m_last_cmd = cmd; if(is_move_to(cmd)) { m_start_x = *x; m_start_y = *y; break; } m_generator.add_vertex(*x, *y, cmd); m_markers.add_vertex(*x, *y, path_cmd_line_to); } else { if(is_stop(cmd)) { m_last_cmd = path_cmd_stop; break; } if(is_end_poly(cmd)) { m_generator.add_vertex(*x, *y, cmd); break; } } } m_generator.rewind(0); m_status = generate; case generate: cmd = m_generator.vertex(x, y); if(is_stop(cmd)) { m_status = accumulate; break; } done = true; break; } } return cmd; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_image_filter_rgba.h0000644000175000017500000011215413233644505026434 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_IMAGE_FILTER_RGBA_INCLUDED #define AGG_SPAN_IMAGE_FILTER_RGBA_INCLUDED #include "agg_basics.h" #include "agg_color_rgba.h" #include "agg_span_image_filter.h" namespace agg24 { //==============================================span_image_filter_rgba_nn template class span_image_filter_rgba_nn : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgba_nn() {} span_image_filter_rgba_nn(source_type& src, interpolator_type& inter) : base_type(src, inter, 0) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); do { base_type::interpolator().coordinates(&x, &y); const value_type* fg_ptr = (const value_type*) base_type::source().span(x >> image_subpixel_shift, y >> image_subpixel_shift, 1); span->r = fg_ptr[order_type::R]; span->g = fg_ptr[order_type::G]; span->b = fg_ptr[order_type::B]; span->a = fg_ptr[order_type::A]; ++span; ++base_type::interpolator(); } while(--len); } }; //=========================================span_image_filter_rgba_bilinear template class span_image_filter_rgba_bilinear : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgba_bilinear() {} span_image_filter_rgba_bilinear(source_type& src, interpolator_type& inter) : base_type(src, inter, 0) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[4]; const value_type *fg_ptr; do { int x_hr; int y_hr; base_type::interpolator().coordinates(&x_hr, &y_hr); x_hr -= base_type::filter_dx_int(); y_hr -= base_type::filter_dy_int(); int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; unsigned weight; fg[0] = fg[1] = fg[2] = fg[3] = image_subpixel_scale * image_subpixel_scale / 2; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = x_hr * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_y(); weight = (image_subpixel_scale - x_hr) * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = x_hr * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr; span->r = value_type(color_type::downshift(fg[order_type::R], image_subpixel_shift * 2)); span->g = value_type(color_type::downshift(fg[order_type::G], image_subpixel_shift * 2)); span->b = value_type(color_type::downshift(fg[order_type::B], image_subpixel_shift * 2)); span->a = value_type(color_type::downshift(fg[order_type::A], image_subpixel_shift * 2)); ++span; ++base_type::interpolator(); } while(--len); } }; //====================================span_image_filter_rgba_bilinear_clip template class span_image_filter_rgba_bilinear_clip : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgba_bilinear_clip() {} span_image_filter_rgba_bilinear_clip(source_type& src, const color_type& back_color, interpolator_type& inter) : base_type(src, inter, 0), m_back_color(back_color) {} const color_type& background_color() const { return m_back_color; } void background_color(const color_type& v) { m_back_color = v; } //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[4]; value_type back_r = m_back_color.r; value_type back_g = m_back_color.g; value_type back_b = m_back_color.b; value_type back_a = m_back_color.a; const value_type *fg_ptr; int maxx = base_type::source().width() - 1; int maxy = base_type::source().height() - 1; do { int x_hr; int y_hr; base_type::interpolator().coordinates(&x_hr, &y_hr); x_hr -= base_type::filter_dx_int(); y_hr -= base_type::filter_dy_int(); int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; unsigned weight; if(x_lr >= 0 && y_lr >= 0 && x_lr < maxx && y_lr < maxy) { fg[0] = fg[1] = fg[2] = fg[3] = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + (x_lr << 2); weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr++; weight = x_hr * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr++; ++y_lr; fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + (x_lr << 2); weight = (image_subpixel_scale - x_hr) * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr++; weight = x_hr * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr++; fg[0] = color_type::downshift(fg[0], image_subpixel_shift * 2); fg[1] = color_type::downshift(fg[1], image_subpixel_shift * 2); fg[2] = color_type::downshift(fg[2], image_subpixel_shift * 2); fg[3] = color_type::downshift(fg[3], image_subpixel_shift * 2); } else { if(x_lr < -1 || y_lr < -1 || x_lr > maxx || y_lr > maxy) { fg[order_type::R] = back_r; fg[order_type::G] = back_g; fg[order_type::B] = back_b; fg[order_type::A] = back_a; } else { fg[0] = fg[1] = fg[2] = fg[3] = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + (x_lr << 2); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr++; } else { fg[order_type::R] += back_r * weight; fg[order_type::G] += back_g * weight; fg[order_type::B] += back_b * weight; fg[order_type::A] += back_a * weight; } x_lr++; weight = x_hr * (image_subpixel_scale - y_hr); if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + (x_lr << 2); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr++; } else { fg[order_type::R] += back_r * weight; fg[order_type::G] += back_g * weight; fg[order_type::B] += back_b * weight; fg[order_type::A] += back_a * weight; } x_lr--; y_lr++; weight = (image_subpixel_scale - x_hr) * y_hr; if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + (x_lr << 2); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr++; } else { fg[order_type::R] += back_r * weight; fg[order_type::G] += back_g * weight; fg[order_type::B] += back_b * weight; fg[order_type::A] += back_a * weight; } x_lr++; weight = x_hr * y_hr; if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + (x_lr << 2); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr++; } else { fg[order_type::R] += back_r * weight; fg[order_type::G] += back_g * weight; fg[order_type::B] += back_b * weight; fg[order_type::A] += back_a * weight; } fg[0] = color_type::downshift(fg[0], image_subpixel_shift * 2); fg[1] = color_type::downshift(fg[1], image_subpixel_shift * 2); fg[2] = color_type::downshift(fg[2], image_subpixel_shift * 2); fg[3] = color_type::downshift(fg[3], image_subpixel_shift * 2); } } span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = (value_type)fg[order_type::A]; ++span; ++base_type::interpolator(); } while(--len); } private: color_type m_back_color; }; //==============================================span_image_filter_rgba_2x2 template class span_image_filter_rgba_2x2 : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgba_2x2() {} span_image_filter_rgba_2x2(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, &filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[4]; const value_type *fg_ptr; const int16* weight_array = base_type::filter().weight_array() + ((base_type::filter().diameter()/2 - 1) << image_subpixel_shift); do { int x_hr; int y_hr; base_type::interpolator().coordinates(&x_hr, &y_hr); x_hr -= base_type::filter_dx_int(); y_hr -= base_type::filter_dy_int(); int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; unsigned weight; fg[0] = fg[1] = fg[2] = fg[3] = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr + image_subpixel_scale] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = (weight_array[x_hr] * weight_array[y_hr + image_subpixel_scale] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_y(); weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = (weight_array[x_hr] * weight_array[y_hr] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr; fg[0] = color_type::downshift(fg[0], image_filter_shift); fg[1] = color_type::downshift(fg[1], image_filter_shift); fg[2] = color_type::downshift(fg[2], image_filter_shift); fg[3] = color_type::downshift(fg[3], image_filter_shift); if(fg[order_type::A] > color_type::full_value()) fg[order_type::A] = color_type::full_value(); if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A]; if(fg[order_type::G] > fg[order_type::A]) fg[order_type::G] = fg[order_type::A]; if(fg[order_type::B] > fg[order_type::A]) fg[order_type::B] = fg[order_type::A]; span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = (value_type)fg[order_type::A]; ++span; ++base_type::interpolator(); } while(--len); } }; //==================================================span_image_filter_rgba template class span_image_filter_rgba : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgba() {} span_image_filter_rgba(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, &filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[4]; const value_type *fg_ptr; unsigned diameter = base_type::filter().diameter(); int start = base_type::filter().start(); const int16* weight_array = base_type::filter().weight_array(); int x_count; int weight_y; do { base_type::interpolator().coordinates(&x, &y); x -= base_type::filter_dx_int(); y -= base_type::filter_dy_int(); int x_hr = x; int y_hr = y; int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; fg[0] = fg[1] = fg[2] = fg[3] = 0; int x_fract = x_hr & image_subpixel_mask; unsigned y_count = diameter; y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask); fg_ptr = (const value_type*)base_type::source().span(x_lr + start, y_lr + start, diameter); for(;;) { x_count = diameter; weight_y = weight_array[y_hr]; x_hr = image_subpixel_mask - x_fract; for(;;) { int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[3] += weight * *fg_ptr; if(--x_count == 0) break; x_hr += image_subpixel_scale; fg_ptr = (const value_type*)base_type::source().next_x(); } if(--y_count == 0) break; y_hr += image_subpixel_scale; fg_ptr = (const value_type*)base_type::source().next_y(); } fg[0] = color_type::downshift(fg[0], image_filter_shift); fg[1] = color_type::downshift(fg[1], image_filter_shift); fg[2] = color_type::downshift(fg[2], image_filter_shift); fg[3] = color_type::downshift(fg[3], image_filter_shift); if(fg[0] < 0) fg[0] = 0; if(fg[1] < 0) fg[1] = 0; if(fg[2] < 0) fg[2] = 0; if(fg[3] < 0) fg[3] = 0; if(fg[order_type::A] > color_type::full_value()) fg[order_type::A] = color_type::full_value(); if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A]; if(fg[order_type::G] > fg[order_type::A]) fg[order_type::G] = fg[order_type::A]; if(fg[order_type::B] > fg[order_type::A]) fg[order_type::B] = fg[order_type::A]; span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = (value_type)fg[order_type::A]; ++span; ++base_type::interpolator(); } while(--len); } }; //========================================span_image_resample_rgba_affine template class span_image_resample_rgba_affine : public span_image_resample_affine { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef span_image_resample_affine base_type; typedef typename base_type::interpolator_type interpolator_type; typedef typename color_type::value_type value_type; typedef typename color_type::long_type long_type; enum base_scale_e { downscale_shift = image_filter_shift }; //-------------------------------------------------------------------- span_image_resample_rgba_affine() {} span_image_resample_rgba_affine(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[4]; int diameter = base_type::filter().diameter(); int filter_scale = diameter << image_subpixel_shift; int radius_x = (diameter * base_type::m_rx) >> 1; int radius_y = (diameter * base_type::m_ry) >> 1; int len_x_lr = (diameter * base_type::m_rx + image_subpixel_mask) >> image_subpixel_shift; const int16* weight_array = base_type::filter().weight_array(); do { base_type::interpolator().coordinates(&x, &y); x += base_type::filter_dx_int() - radius_x; y += base_type::filter_dy_int() - radius_y; fg[0] = fg[1] = fg[2] = fg[3] = 0; int y_lr = y >> image_subpixel_shift; int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * base_type::m_ry_inv) >> image_subpixel_shift; int total_weight = 0; int x_lr = x >> image_subpixel_shift; int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * base_type::m_rx_inv) >> image_subpixel_shift; int x_hr2 = x_hr; const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); for(;;) { int weight_y = weight_array[y_hr]; x_hr = x_hr2; for(;;) { int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; fg[0] += *fg_ptr++ * weight; fg[1] += *fg_ptr++ * weight; fg[2] += *fg_ptr++ * weight; fg[3] += *fg_ptr++ * weight; total_weight += weight; x_hr += base_type::m_rx_inv; if(x_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_x(); } y_hr += base_type::m_ry_inv; if(y_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_y(); } fg[0] /= total_weight; fg[1] /= total_weight; fg[2] /= total_weight; fg[3] /= total_weight; if(fg[0] < 0) fg[0] = 0; if(fg[1] < 0) fg[1] = 0; if(fg[2] < 0) fg[2] = 0; if(fg[3] < 0) fg[3] = 0; if(fg[order_type::A] > color_type::full_value()) fg[order_type::A] = color_type::full_value(); if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A]; if(fg[order_type::G] > fg[order_type::A]) fg[order_type::G] = fg[order_type::A]; if(fg[order_type::B] > fg[order_type::A]) fg[order_type::B] = fg[order_type::A]; span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = (value_type)fg[order_type::A]; ++span; ++base_type::interpolator(); } while(--len); } }; //==============================================span_image_resample_rgba template class span_image_resample_rgba : public span_image_resample { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_resample base_type; typedef typename color_type::value_type value_type; typedef typename color_type::long_type long_type; enum base_scale_e { downscale_shift = image_filter_shift }; //-------------------------------------------------------------------- span_image_resample_rgba() {} span_image_resample_rgba(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[4]; int diameter = base_type::filter().diameter(); int filter_scale = diameter << image_subpixel_shift; const int16* weight_array = base_type::filter().weight_array(); do { int rx; int ry; int rx_inv = image_subpixel_scale; int ry_inv = image_subpixel_scale; base_type::interpolator().coordinates(&x, &y); base_type::interpolator().local_scale(&rx, &ry); base_type::adjust_scale(&rx, &ry); rx_inv = image_subpixel_scale * image_subpixel_scale / rx; ry_inv = image_subpixel_scale * image_subpixel_scale / ry; int radius_x = (diameter * rx) >> 1; int radius_y = (diameter * ry) >> 1; int len_x_lr = (diameter * rx + image_subpixel_mask) >> image_subpixel_shift; x += base_type::filter_dx_int() - radius_x; y += base_type::filter_dy_int() - radius_y; fg[0] = fg[1] = fg[2] = fg[3] = 0; int y_lr = y >> image_subpixel_shift; int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * ry_inv) >> image_subpixel_shift; int total_weight = 0; int x_lr = x >> image_subpixel_shift; int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * rx_inv) >> image_subpixel_shift; int x_hr2 = x_hr; const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); for(;;) { int weight_y = weight_array[y_hr]; x_hr = x_hr2; for(;;) { int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; fg[0] += *fg_ptr++ * weight; fg[1] += *fg_ptr++ * weight; fg[2] += *fg_ptr++ * weight; fg[3] += *fg_ptr++ * weight; total_weight += weight; x_hr += rx_inv; if(x_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_x(); } y_hr += ry_inv; if(y_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_y(); } fg[0] /= total_weight; fg[1] /= total_weight; fg[2] /= total_weight; fg[3] /= total_weight; if(fg[0] < 0) fg[0] = 0; if(fg[1] < 0) fg[1] = 0; if(fg[2] < 0) fg[2] = 0; if(fg[3] < 0) fg[3] = 0; if(fg[order_type::A] > color_type::full_value()) fg[order_type::A] = color_type::full_value(); if(fg[order_type::R] > fg[order_type::R]) fg[order_type::R] = fg[order_type::R]; if(fg[order_type::G] > fg[order_type::G]) fg[order_type::G] = fg[order_type::G]; if(fg[order_type::B] > fg[order_type::B]) fg[order_type::B] = fg[order_type::B]; span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = (value_type)fg[order_type::A]; ++span; ++base_type::interpolator(); } while(--len); } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_close_polygon.h0000644000175000017500000000721713233644505025675 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CONV_CLOSE_POLYGON_INCLUDED #define AGG_CONV_CLOSE_POLYGON_INCLUDED #include "agg_basics.h" namespace agg24 { //======================================================conv_close_polygon template class conv_close_polygon { public: explicit conv_close_polygon(VertexSource& vs) : m_source(&vs) {} void attach(VertexSource& source) { m_source = &source; } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: conv_close_polygon(const conv_close_polygon&); const conv_close_polygon& operator = (const conv_close_polygon&); VertexSource* m_source; unsigned m_cmd[2]; double m_x[2]; double m_y[2]; unsigned m_vertex; bool m_line_to; }; //------------------------------------------------------------------------ template void conv_close_polygon::rewind(unsigned path_id) { m_source->rewind(path_id); m_vertex = 2; m_line_to = false; } //------------------------------------------------------------------------ template unsigned conv_close_polygon::vertex(double* x, double* y) { unsigned cmd = path_cmd_stop; for(;;) { if(m_vertex < 2) { *x = m_x[m_vertex]; *y = m_y[m_vertex]; cmd = m_cmd[m_vertex]; ++m_vertex; break; } cmd = m_source->vertex(x, y); if(is_end_poly(cmd)) { cmd |= path_flags_close; break; } if(is_stop(cmd)) { if(m_line_to) { m_cmd[0] = path_cmd_end_poly | path_flags_close; m_cmd[1] = path_cmd_stop; m_vertex = 0; m_line_to = false; continue; } break; } if(is_move_to(cmd)) { if(m_line_to) { m_x[0] = 0.0; m_y[0] = 0.0; m_cmd[0] = path_cmd_end_poly | path_flags_close; m_x[1] = *x; m_y[1] = *y; m_cmd[1] = cmd; m_vertex = 0; m_line_to = false; continue; } break; } if(is_vertex(cmd)) { m_line_to = true; break; } } return cmd; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_converter.h0000644000175000017500000000373013233644505025020 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SPAN_CONVERTER_INCLUDED #define AGG_SPAN_CONVERTER_INCLUDED #include "agg_basics.h" namespace agg24 { //----------------------------------------------------------span_converter template class span_converter { public: typedef typename SpanGenerator::color_type color_type; span_converter(SpanGenerator& span_gen, SpanConverter& span_cnv) : m_span_gen(&span_gen), m_span_cnv(&span_cnv) {} void attach_generator(SpanGenerator& span_gen) { m_span_gen = &span_gen; } void attach_converter(SpanConverter& span_cnv) { m_span_cnv = &span_cnv; } //-------------------------------------------------------------------- void prepare() { m_span_gen->prepare(); m_span_cnv->prepare(); } //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { m_span_gen->generate(span, x, y, len); m_span_cnv->generate(span, x, y, len); } private: SpanGenerator* m_span_gen; SpanConverter* m_span_cnv; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_pixfmt_rgb.h0000644000175000017500000011435513233644505024137 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_PIXFMT_RGB_INCLUDED #define AGG_PIXFMT_RGB_INCLUDED #include #include "agg_pixfmt_base.h" #include "agg_rendering_buffer.h" namespace agg24 { //=====================================================apply_gamma_dir_rgb template class apply_gamma_dir_rgb { public: typedef typename ColorT::value_type value_type; apply_gamma_dir_rgb(const GammaLut& gamma) : m_gamma(gamma) {} AGG_INLINE void operator () (value_type* p) { p[Order::R] = m_gamma.dir(p[Order::R]); p[Order::G] = m_gamma.dir(p[Order::G]); p[Order::B] = m_gamma.dir(p[Order::B]); } private: const GammaLut& m_gamma; }; //=====================================================apply_gamma_inv_rgb template class apply_gamma_inv_rgb { public: typedef typename ColorT::value_type value_type; apply_gamma_inv_rgb(const GammaLut& gamma) : m_gamma(gamma) {} AGG_INLINE void operator () (value_type* p) { p[Order::R] = m_gamma.inv(p[Order::R]); p[Order::G] = m_gamma.inv(p[Order::G]); p[Order::B] = m_gamma.inv(p[Order::B]); } private: const GammaLut& m_gamma; }; //=========================================================blender_rgb template struct blender_rgb { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; // Blend pixels using the non-premultiplied form of Alvy-Ray Smith's // compositing function. Since the render buffer is opaque we skip the // initial premultiply and final demultiply. //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha, cover_type cover) { blend_pix(p, cr, cg, cb, color_type::mult_cover(alpha, cover)); } //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha) { p[Order::R] = color_type::lerp(p[Order::R], cr, alpha); p[Order::G] = color_type::lerp(p[Order::G], cg, alpha); p[Order::B] = color_type::lerp(p[Order::B], cb, alpha); } }; //======================================================blender_rgb_pre template struct blender_rgb_pre { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; // Blend pixels using the premultiplied form of Alvy-Ray Smith's // compositing function. //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha, cover_type cover) { blend_pix(p, color_type::mult_cover(cr, cover), color_type::mult_cover(cg, cover), color_type::mult_cover(cb, cover), color_type::mult_cover(alpha, cover)); } //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha) { p[Order::R] = color_type::prelerp(p[Order::R], cr, alpha); p[Order::G] = color_type::prelerp(p[Order::G], cg, alpha); p[Order::B] = color_type::prelerp(p[Order::B], cb, alpha); } }; //===================================================blender_rgb_gamma template class blender_rgb_gamma : public blender_base { public: typedef ColorT color_type; typedef Order order_type; typedef Gamma gamma_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- blender_rgb_gamma() : m_gamma(0) {} void gamma(const gamma_type& g) { m_gamma = &g; } //-------------------------------------------------------------------- AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha, cover_type cover) { blend_pix(p, cr, cg, cb, color_type::mult_cover(alpha, cover)); } //-------------------------------------------------------------------- AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha) { calc_type r = m_gamma->dir(p[Order::R]); calc_type g = m_gamma->dir(p[Order::G]); calc_type b = m_gamma->dir(p[Order::B]); p[Order::R] = m_gamma->inv(color_type::downscale((m_gamma->dir(cr) - r) * alpha) + r); p[Order::G] = m_gamma->inv(color_type::downscale((m_gamma->dir(cg) - g) * alpha) + g); p[Order::B] = m_gamma->inv(color_type::downscale((m_gamma->dir(cb) - b) * alpha) + b); } private: const gamma_type* m_gamma; }; //==================================================pixfmt_alpha_blend_rgb template class pixfmt_alpha_blend_rgb { public: typedef pixfmt_rgb_tag pixfmt_category; typedef RenBuf rbuf_type; typedef Blender blender_type; typedef typename rbuf_type::row_data row_data; typedef typename blender_type::color_type color_type; typedef typename blender_type::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; enum { num_components = 3, pix_step = Step, pix_offset = Offset, pix_width = sizeof(value_type) * pix_step }; struct pixel_type { value_type c[num_components]; void set(value_type r, value_type g, value_type b) { c[order_type::R] = r; c[order_type::G] = g; c[order_type::B] = b; } void set(const color_type& color) { set(color.r, color.g, color.b); } void get(value_type& r, value_type& g, value_type& b) const { r = c[order_type::R]; g = c[order_type::G]; b = c[order_type::B]; } color_type get() const { return color_type( c[order_type::R], c[order_type::G], c[order_type::B]); } pixel_type* next() { return (pixel_type*)(c + pix_step); } const pixel_type* next() const { return (const pixel_type*)(c + pix_step); } pixel_type* advance(int n) { return (pixel_type*)(c + n * pix_step); } const pixel_type* advance(int n) const { return (const pixel_type*)(c + n * pix_step); } }; private: //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, value_type r, value_type g, value_type b, value_type a, unsigned cover) { m_blender.blend_pix(p->c, r, g, b, a, cover); } //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, value_type r, value_type g, value_type b, value_type a) { m_blender.blend_pix(p->c, r, g, b, a); } //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, const color_type& c, unsigned cover) { m_blender.blend_pix(p->c, c.r, c.g, c.b, c.a, cover); } //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, const color_type& c) { m_blender.blend_pix(p->c, c.r, c.g, c.b, c.a); } //-------------------------------------------------------------------- AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover) { if (!c.is_transparent()) { if (c.is_opaque() && cover == cover_mask) { p->set(c); } else { blend_pix(p, c, cover); } } } //-------------------------------------------------------------------- AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c) { if (!c.is_transparent()) { if (c.is_opaque()) { p->set(c); } else { blend_pix(p, c); } } } public: //-------------------------------------------------------------------- explicit pixfmt_alpha_blend_rgb(rbuf_type& rb) : m_rbuf(&rb) {} void attach(rbuf_type& rb) { m_rbuf = &rb; } //-------------------------------------------------------------------- template bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) { rect_i r(x1, y1, x2, y2); if (r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) { int stride = pixf.stride(); m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); return true; } return false; } //-------------------------------------------------------------------- Blender& blender() { return m_blender; } //-------------------------------------------------------------------- AGG_INLINE unsigned width() const { return m_rbuf->width(); } AGG_INLINE unsigned height() const { return m_rbuf->height(); } AGG_INLINE int stride() const { return m_rbuf->stride(); } //-------------------------------------------------------------------- AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } //-------------------------------------------------------------------- AGG_INLINE int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step + pix_offset); } AGG_INLINE const int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step + pix_offset); } // Return pointer to pixel value, forcing row to be allocated. AGG_INLINE pixel_type* pix_value_ptr(int x, int y, unsigned len) { return (pixel_type*)(m_rbuf->row_ptr(x, y, len) + sizeof(value_type) * (x * pix_step + pix_offset)); } // Return pointer to pixel value, or null if row not allocated. AGG_INLINE const pixel_type* pix_value_ptr(int x, int y) const { int8u* p = m_rbuf->row_ptr(y); return p ? (pixel_type*)(p + sizeof(value_type) * (x * pix_step + pix_offset)) : 0; } // Get pixel pointer from raw buffer pointer. AGG_INLINE static pixel_type* pix_value_ptr(void* p) { return (pixel_type*)((value_type*)p + pix_offset); } // Get pixel pointer from raw buffer pointer. AGG_INLINE static const pixel_type* pix_value_ptr(const void* p) { return (const pixel_type*)((const value_type*)p + pix_offset); } //-------------------------------------------------------------------- AGG_INLINE static void write_plain_color(void* p, color_type c) { // RGB formats are implicitly premultiplied. c.premultiply(); pix_value_ptr(p)->set(c); } //-------------------------------------------------------------------- AGG_INLINE static color_type read_plain_color(const void* p) { return pix_value_ptr(p)->get(); } //-------------------------------------------------------------------- AGG_INLINE static void make_pix(int8u* p, const color_type& c) { ((pixel_type*)p)->set(c); } //-------------------------------------------------------------------- AGG_INLINE color_type pixel(int x, int y) const { if (const pixel_type* p = pix_value_ptr(x, y)) { return p->get(); } return color_type::no_color(); } //-------------------------------------------------------------------- AGG_INLINE void copy_pixel(int x, int y, const color_type& c) { pix_value_ptr(x, y, 1)->set(c); } //-------------------------------------------------------------------- AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) { copy_or_blend_pix(pix_value_ptr(x, y, 1), c, cover); } //-------------------------------------------------------------------- AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) { pixel_type* p = pix_value_ptr(x, y, len); do { p->set(c); p = p->next(); } while(--len); } //-------------------------------------------------------------------- AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) { do { pix_value_ptr(x, y++, 1)->set(c); } while (--len); } //-------------------------------------------------------------------- void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (!c.is_transparent()) { pixel_type* p = pix_value_ptr(x, y, len); if (c.is_opaque() && cover == cover_mask) { do { p->set(c); p = p->next(); } while (--len); } else { do { blend_pix(p, c, cover); p = p->next(); } while (--len); } } } //-------------------------------------------------------------------- void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (!c.is_transparent()) { if (c.is_opaque() && cover == cover_mask) { do { pix_value_ptr(x, y++, 1)->set(c); } while (--len); } else { do { blend_pix(pix_value_ptr(x, y++, 1), c, cover); } while (--len); } } } //-------------------------------------------------------------------- void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { if (!c.is_transparent()) { pixel_type* p = pix_value_ptr(x, y, len); do { if (c.is_opaque() && *covers == cover_mask) { p->set(c); } else { blend_pix(p, c, *covers); } p = p->next(); ++covers; } while (--len); } } //-------------------------------------------------------------------- void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { if (!c.is_transparent()) { do { pixel_type* p = pix_value_ptr(x, y++, 1); if (c.is_opaque() && *covers == cover_mask) { p->set(c); } else { blend_pix(p, c, *covers); } ++covers; } while (--len); } } //-------------------------------------------------------------------- void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) { pixel_type* p = pix_value_ptr(x, y, len); do { p->set(*colors++); p = p->next(); } while (--len); } //-------------------------------------------------------------------- void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) { do { pix_value_ptr(x, y++, 1)->set(*colors++); } while (--len); } //-------------------------------------------------------------------- void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { pixel_type* p = pix_value_ptr(x, y, len); if (covers) { do { copy_or_blend_pix(p, *colors++, *covers++); p = p->next(); } while (--len); } else { if (cover == cover_mask) { do { copy_or_blend_pix(p, *colors++); p = p->next(); } while (--len); } else { do { copy_or_blend_pix(p, *colors++, cover); p = p->next(); } while (--len); } } } //-------------------------------------------------------------------- void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { if (covers) { do { copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, *covers++); } while (--len); } else { if (cover == cover_mask) { do { copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++); } while (--len); } else { do { copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, cover); } while (--len); } } } //-------------------------------------------------------------------- template void for_each_pixel(Function f) { for (unsigned y = 0; y < height(); ++y) { row_data r = m_rbuf->row(y); if (r.ptr) { unsigned len = r.x2 - r.x1 + 1; pixel_type* p = pix_value_ptr(r.x1, y, len); do { f(p->c); p = p->next(); } while (--len); } } } //-------------------------------------------------------------------- template void apply_gamma_dir(const GammaLut& g) { for_each_pixel(apply_gamma_dir_rgb(g)); } //-------------------------------------------------------------------- template void apply_gamma_inv(const GammaLut& g) { for_each_pixel(apply_gamma_inv_rgb(g)); } //-------------------------------------------------------------------- template void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) { if (const int8u* p = from.row_ptr(ysrc)) { memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); } } //-------------------------------------------------------------------- // Blend from an RGBA surface. template void blend_from(const SrcPixelFormatRenderer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; typedef typename SrcPixelFormatRenderer::order_type src_order; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); if (cover == cover_mask) { do { value_type alpha = psrc->c[src_order::A]; if (alpha <= color_type::empty_value()) { if (alpha >= color_type::full_value()) { pdst->c[order_type::R] = psrc->c[src_order::R]; pdst->c[order_type::G] = psrc->c[src_order::G]; pdst->c[order_type::B] = psrc->c[src_order::B]; } else { blend_pix(pdst, psrc->c[src_order::R], psrc->c[src_order::G], psrc->c[src_order::B], alpha); } } psrc = psrc->next(); pdst = pdst->next(); } while(--len); } else { do { copy_or_blend_pix(pdst, psrc->get(), cover); psrc = psrc->next(); pdst = pdst->next(); } while (--len); } } } //-------------------------------------------------------------------- // Blend from single color, using grayscale surface as alpha channel. template void blend_from_color(const SrcPixelFormatRenderer& from, const color_type& color, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; typedef typename SrcPixelFormatRenderer::color_type src_color_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); do { copy_or_blend_pix(pdst, color, src_color_type::scale_cover(cover, psrc->c[0])); psrc = psrc->next(); pdst = pdst->next(); } while (--len); } } //-------------------------------------------------------------------- // Blend from color table, using grayscale surface as indexes into table. // Obviously, this only works for integer value types. template void blend_from_lut(const SrcPixelFormatRenderer& from, const color_type* color_lut, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); if (cover == cover_mask) { do { const color_type& color = color_lut[psrc->c[0]]; blend_pix(pdst, color); psrc = psrc->next(); pdst = pdst->next(); } while(--len); } else { do { copy_or_blend_pix(pdst, color_lut[psrc->c[0]], cover); psrc = psrc->next(); pdst = pdst->next(); } while(--len); } } } private: rbuf_type* m_rbuf; Blender m_blender; }; //----------------------------------------------------------------------- typedef blender_rgb blender_rgb24; typedef blender_rgb blender_bgr24; typedef blender_rgb blender_srgb24; typedef blender_rgb blender_sbgr24; typedef blender_rgb blender_rgb48; typedef blender_rgb blender_bgr48; typedef blender_rgb blender_rgb96; typedef blender_rgb blender_bgr96; typedef blender_rgb_pre blender_rgb24_pre; typedef blender_rgb_pre blender_bgr24_pre; typedef blender_rgb_pre blender_srgb24_pre; typedef blender_rgb_pre blender_sbgr24_pre; typedef blender_rgb_pre blender_rgb48_pre; typedef blender_rgb_pre blender_bgr48_pre; typedef blender_rgb_pre blender_rgb96_pre; typedef blender_rgb_pre blender_bgr96_pre; typedef pixfmt_alpha_blend_rgb pixfmt_rgb24; typedef pixfmt_alpha_blend_rgb pixfmt_bgr24; typedef pixfmt_alpha_blend_rgb pixfmt_srgb24; typedef pixfmt_alpha_blend_rgb pixfmt_sbgr24; typedef pixfmt_alpha_blend_rgb pixfmt_rgb48; typedef pixfmt_alpha_blend_rgb pixfmt_bgr48; typedef pixfmt_alpha_blend_rgb pixfmt_rgb96; typedef pixfmt_alpha_blend_rgb pixfmt_bgr96; typedef pixfmt_alpha_blend_rgb pixfmt_rgb24_pre; typedef pixfmt_alpha_blend_rgb pixfmt_bgr24_pre; typedef pixfmt_alpha_blend_rgb pixfmt_srgb24_pre; typedef pixfmt_alpha_blend_rgb pixfmt_sbgr24_pre; typedef pixfmt_alpha_blend_rgb pixfmt_rgb48_pre; typedef pixfmt_alpha_blend_rgb pixfmt_bgr48_pre; typedef pixfmt_alpha_blend_rgb pixfmt_rgb96_pre; typedef pixfmt_alpha_blend_rgb pixfmt_bgr96_pre; typedef pixfmt_alpha_blend_rgb pixfmt_rgbx32; typedef pixfmt_alpha_blend_rgb pixfmt_xrgb32; typedef pixfmt_alpha_blend_rgb pixfmt_xbgr32; typedef pixfmt_alpha_blend_rgb pixfmt_bgrx32; typedef pixfmt_alpha_blend_rgb pixfmt_srgbx32; typedef pixfmt_alpha_blend_rgb pixfmt_sxrgb32; typedef pixfmt_alpha_blend_rgb pixfmt_sxbgr32; typedef pixfmt_alpha_blend_rgb pixfmt_sbgrx32; typedef pixfmt_alpha_blend_rgb pixfmt_rgbx64; typedef pixfmt_alpha_blend_rgb pixfmt_xrgb64; typedef pixfmt_alpha_blend_rgb pixfmt_xbgr64; typedef pixfmt_alpha_blend_rgb pixfmt_bgrx64; typedef pixfmt_alpha_blend_rgb pixfmt_rgbx128; typedef pixfmt_alpha_blend_rgb pixfmt_xrgb128; typedef pixfmt_alpha_blend_rgb pixfmt_xbgr128; typedef pixfmt_alpha_blend_rgb pixfmt_bgrx128; typedef pixfmt_alpha_blend_rgb pixfmt_rgbx32_pre; typedef pixfmt_alpha_blend_rgb pixfmt_xrgb32_pre; typedef pixfmt_alpha_blend_rgb pixfmt_xbgr32_pre; typedef pixfmt_alpha_blend_rgb pixfmt_bgrx32_pre; typedef pixfmt_alpha_blend_rgb pixfmt_srgbx32_pre; typedef pixfmt_alpha_blend_rgb pixfmt_sxrgb32_pre; typedef pixfmt_alpha_blend_rgb pixfmt_sxbgr32_pre; typedef pixfmt_alpha_blend_rgb pixfmt_sbgrx32_pre; typedef pixfmt_alpha_blend_rgb pixfmt_rgbx64_pre; typedef pixfmt_alpha_blend_rgb pixfmt_xrgb64_pre; typedef pixfmt_alpha_blend_rgb pixfmt_xbgr64_pre; typedef pixfmt_alpha_blend_rgb pixfmt_bgrx64_pre; typedef pixfmt_alpha_blend_rgb pixfmt_rgbx128_pre; typedef pixfmt_alpha_blend_rgb pixfmt_xrgb128_pre; typedef pixfmt_alpha_blend_rgb pixfmt_xbgr128_pre; typedef pixfmt_alpha_blend_rgb pixfmt_bgrx128_pre; //-----------------------------------------------------pixfmt_rgb24_gamma template class pixfmt_rgb24_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer, 3> { public: pixfmt_rgb24_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb, rendering_buffer, 3>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_srgb24_gamma template class pixfmt_srgb24_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer, 3> { public: pixfmt_srgb24_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb, rendering_buffer, 3>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_bgr24_gamma template class pixfmt_bgr24_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer, 3> { public: pixfmt_bgr24_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb, rendering_buffer, 3>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_sbgr24_gamma template class pixfmt_sbgr24_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer, 3> { public: pixfmt_sbgr24_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb, rendering_buffer, 3>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_rgb48_gamma template class pixfmt_rgb48_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer, 3> { public: pixfmt_rgb48_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb, rendering_buffer, 3>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_bgr48_gamma template class pixfmt_bgr48_gamma : public pixfmt_alpha_blend_rgb, rendering_buffer, 3> { public: pixfmt_bgr48_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb, rendering_buffer, 3>(rb) { this->blender().gamma(g); } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_gradient.h0000644000175000017500000003042113233644505024603 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SPAN_GRADIENT_INCLUDED #define AGG_SPAN_GRADIENT_INCLUDED #include #include #include #include "agg_basics.h" #include "agg_math.h" #include "agg_array.h" namespace agg24 { enum gradient_subpixel_scale_e { gradient_subpixel_shift = 4, //-----gradient_subpixel_shift gradient_subpixel_scale = 1 << gradient_subpixel_shift, //-----gradient_subpixel_scale gradient_subpixel_mask = gradient_subpixel_scale - 1 //-----gradient_subpixel_mask }; //==========================================================span_gradient template class span_gradient { public: typedef Interpolator interpolator_type; typedef ColorT color_type; enum downscale_shift_e { downscale_shift = interpolator_type::subpixel_shift - gradient_subpixel_shift }; //-------------------------------------------------------------------- span_gradient() {} //-------------------------------------------------------------------- span_gradient(interpolator_type& inter, GradientF& gradient_function, ColorF& color_function, double d1, double d2) : m_interpolator(&inter), m_gradient_function(&gradient_function), m_color_function(&color_function), m_d1(iround(d1 * gradient_subpixel_scale)), m_d2(iround(d2 * gradient_subpixel_scale)) {} //-------------------------------------------------------------------- interpolator_type& interpolator() { return *m_interpolator; } const GradientF& gradient_function() const { return *m_gradient_function; } const ColorF& color_function() const { return *m_color_function; } double d1() const { return double(m_d1) / gradient_subpixel_scale; } double d2() const { return double(m_d2) / gradient_subpixel_scale; } //-------------------------------------------------------------------- void interpolator(interpolator_type& i) { m_interpolator = &i; } void gradient_function(GradientF& gf) { m_gradient_function = &gf; } void color_function(ColorF& cf) { m_color_function = &cf; } void d1(double v) { m_d1 = iround(v * gradient_subpixel_scale); } void d2(double v) { m_d2 = iround(v * gradient_subpixel_scale); } //-------------------------------------------------------------------- void prepare() {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { int dd = m_d2 - m_d1; if(dd < 1) dd = 1; m_interpolator->begin(x+0.5, y+0.5, len); do { m_interpolator->coordinates(&x, &y); int d = m_gradient_function->calculate(x >> downscale_shift, y >> downscale_shift, m_d2); d = ((d - m_d1) * (int)m_color_function->size()) / dd; if(d < 0) d = 0; if(d >= (int)m_color_function->size()) d = m_color_function->size() - 1; *span++ = (*m_color_function)[d]; ++(*m_interpolator); } while(--len); } private: interpolator_type* m_interpolator; GradientF* m_gradient_function; ColorF* m_color_function; int m_d1; int m_d2; }; //=====================================================gradient_linear_color template struct gradient_linear_color { typedef ColorT color_type; gradient_linear_color() {} gradient_linear_color(const color_type& c1, const color_type& c2, unsigned size = 256) : m_c1(c1), m_c2(c2), m_size(size) // VFALCO 4/28/09 ,m_mult(1/(double(size)-1)) // VFALCO {} unsigned size() const { return m_size; } color_type operator [] (unsigned v) const { // VFALCO 4/28/09 //return m_c1.gradient(m_c2, double(v) / double(m_size - 1)); return m_c1.gradient(m_c2, double(v) * m_mult ); // VFALCO } void colors(const color_type& c1, const color_type& c2, unsigned size = 256) { m_c1 = c1; m_c2 = c2; m_size = size; // VFALCO 4/28/09 m_mult=1/(double(size)-1); // VFALCO } color_type m_c1; color_type m_c2; unsigned m_size; // VFALCO 4/28/09 double m_mult; // VFALCO }; //==========================================================gradient_circle class gradient_circle { // Actually the same as radial. Just for compatibility public: static AGG_INLINE int calculate(int x, int y, int) { return int(fast_sqrt(x*x + y*y)); } }; //==========================================================gradient_radial class gradient_radial { public: static AGG_INLINE int calculate(int x, int y, int) { return int(fast_sqrt(x*x + y*y)); } }; //========================================================gradient_radial_d class gradient_radial_d { public: static AGG_INLINE int calculate(int x, int y, int) { return uround(sqrt(double(x)*double(x) + double(y)*double(y))); } }; //====================================================gradient_radial_focus class gradient_radial_focus { public: //--------------------------------------------------------------------- gradient_radial_focus() : m_r(100 * gradient_subpixel_scale), m_fx(0), m_fy(0) { update_values(); } //--------------------------------------------------------------------- gradient_radial_focus(double r, double fx, double fy) : m_r (iround(r * gradient_subpixel_scale)), m_fx(iround(fx * gradient_subpixel_scale)), m_fy(iround(fy * gradient_subpixel_scale)) { update_values(); } //--------------------------------------------------------------------- void init(double r, double fx, double fy) { m_r = iround(r * gradient_subpixel_scale); m_fx = iround(fx * gradient_subpixel_scale); m_fy = iround(fy * gradient_subpixel_scale); update_values(); } //--------------------------------------------------------------------- double radius() const { return double(m_r) / gradient_subpixel_scale; } double focus_x() const { return double(m_fx) / gradient_subpixel_scale; } double focus_y() const { return double(m_fy) / gradient_subpixel_scale; } //--------------------------------------------------------------------- int calculate(int x, int y, int) const { double dx = x - m_fx; double dy = y - m_fy; double d2 = dx * m_fy - dy * m_fx; double d3 = m_r2 * (dx * dx + dy * dy) - d2 * d2; return iround((dx * m_fx + dy * m_fy + sqrt(fabs(d3))) * m_mul); } private: //--------------------------------------------------------------------- void update_values() { // Calculate the invariant values. In case the focal center // lies exactly on the gradient circle the divisor degenerates // into zero. In this case we just move the focal center by // one subpixel unit possibly in the direction to the origin (0,0) // and calculate the values again. //------------------------- m_r2 = double(m_r) * double(m_r); m_fx2 = double(m_fx) * double(m_fx); m_fy2 = double(m_fy) * double(m_fy); double d = (m_r2 - (m_fx2 + m_fy2)); if(d == 0) { if(m_fx) { if(m_fx < 0) ++m_fx; else --m_fx; } if(m_fy) { if(m_fy < 0) ++m_fy; else --m_fy; } m_fx2 = double(m_fx) * double(m_fx); m_fy2 = double(m_fy) * double(m_fy); d = (m_r2 - (m_fx2 + m_fy2)); } m_mul = m_r / d; } int m_r; int m_fx; int m_fy; double m_r2; double m_fx2; double m_fy2; double m_mul; }; //==============================================================gradient_x class gradient_x { public: static int calculate(int x, int, int) { return x; } }; //==============================================================gradient_y class gradient_y { public: static int calculate(int, int y, int) { return y; } }; //========================================================gradient_diamond class gradient_diamond { public: static AGG_INLINE int calculate(int x, int y, int) { int ax = abs(x); int ay = abs(y); return ax > ay ? ax : ay; } }; //=============================================================gradient_xy class gradient_xy { public: static AGG_INLINE int calculate(int x, int y, int d) { return abs(x) * abs(y) / d; } }; //========================================================gradient_sqrt_xy class gradient_sqrt_xy { public: static AGG_INLINE int calculate(int x, int y, int) { return fast_sqrt(abs(x) * abs(y)); } }; //==========================================================gradient_conic class gradient_conic { public: static AGG_INLINE int calculate(int x, int y, int d) { return uround(fabs(atan2(double(y), double(x))) * double(d) / pi); } }; //=================================================gradient_repeat_adaptor template class gradient_repeat_adaptor { public: gradient_repeat_adaptor(const GradientF& gradient) : m_gradient(&gradient) {} AGG_INLINE int calculate(int x, int y, int d) const { int ret = m_gradient->calculate(x, y, d) % d; if(ret < 0) ret += d; return ret; } private: const GradientF* m_gradient; }; //================================================gradient_reflect_adaptor template class gradient_reflect_adaptor { public: gradient_reflect_adaptor(const GradientF& gradient) : m_gradient(&gradient) {} AGG_INLINE int calculate(int x, int y, int d) const { int d2 = d << 1; int ret = m_gradient->calculate(x, y, d) % d2; if(ret < 0) ret += d2; if(ret >= d) ret = d2 - ret; return ret; } private: const GradientF* m_gradient; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_gamma_functions.h0000644000175000017500000000711313233644505025141 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_GAMMA_FUNCTIONS_INCLUDED #define AGG_GAMMA_FUNCTIONS_INCLUDED #include #include "agg_basics.h" namespace agg24 { //===============================================================gamma_none struct gamma_none { double operator()(double x) const { return x; } }; //==============================================================gamma_power class gamma_power { public: gamma_power() : m_gamma(1.0) {} gamma_power(double g) : m_gamma(g) {} void gamma(double g) { m_gamma = g; } double gamma() const { return m_gamma; } double operator() (double x) const { return pow(x, m_gamma); } private: double m_gamma; }; //==========================================================gamma_threshold class gamma_threshold { public: gamma_threshold() : m_threshold(0.5) {} gamma_threshold(double t) : m_threshold(t) {} void threshold(double t) { m_threshold = t; } double threshold() const { return m_threshold; } double operator() (double x) const { return (x < m_threshold) ? 0.0 : 1.0; } private: double m_threshold; }; //============================================================gamma_linear class gamma_linear { public: gamma_linear() : m_start(0.0), m_end(1.0) {} gamma_linear(double s, double e) : m_start(s), m_end(e) {} void set(double s, double e) { m_start = s; m_end = e; } void start(double s) { m_start = s; } void end(double e) { m_end = e; } double start() const { return m_start; } double end() const { return m_end; } double operator() (double x) const { if(x < m_start) return 0.0; if(x > m_end) return 1.0; return (x - m_start) / (m_end - m_start); } private: double m_start; double m_end; }; //==========================================================gamma_multiply class gamma_multiply { public: gamma_multiply() : m_mul(1.0) {} gamma_multiply(double v) : m_mul(v) {} void value(double v) { m_mul = v; } double value() const { return m_mul; } double operator() (double x) const { double y = x * m_mul; if(y > 1.0) y = 1.0; return y; } private: double m_mul; }; inline double sRGB_to_linear(double x) { return (x <= 0.04045) ? (x / 12.92) : pow((x + 0.055) / (1.055), 2.4); } inline double linear_to_sRGB(double x) { return (x <= 0.0031308) ? (x * 12.92) : (1.055 * pow(x, 1 / 2.4) - 0.055); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_gouraud.h0000644000175000017500000001341513233644505024460 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SPAN_GOURAUD_INCLUDED #define AGG_SPAN_GOURAUD_INCLUDED #include "agg_basics.h" #include "agg_math.h" namespace agg24 { //============================================================span_gouraud template class span_gouraud { public: typedef ColorT color_type; struct coord_type { double x; double y; color_type color; }; //-------------------------------------------------------------------- span_gouraud() : m_vertex(0) { m_cmd[0] = path_cmd_stop; } //-------------------------------------------------------------------- span_gouraud(const color_type& c1, const color_type& c2, const color_type& c3, double x1, double y1, double x2, double y2, double x3, double y3, double d) : m_vertex(0) { colors(c1, c2, c3); triangle(x1, y1, x2, y2, x3, y3, d); } //-------------------------------------------------------------------- void colors(ColorT c1, ColorT c2, ColorT c3) { m_coord[0].color = c1; m_coord[1].color = c2; m_coord[2].color = c3; } //-------------------------------------------------------------------- // Sets the triangle and dilates it if needed. // The trick here is to calculate beveled joins in the vertices of the // triangle and render it as a 6-vertex polygon. // It's necessary to achieve numerical stability. // However, the coordinates to interpolate colors are calculated // as miter joins (calc_intersection). void triangle(double x1, double y1, double x2, double y2, double x3, double y3, double d) { m_coord[0].x = m_x[0] = x1; m_coord[0].y = m_y[0] = y1; m_coord[1].x = m_x[1] = x2; m_coord[1].y = m_y[1] = y2; m_coord[2].x = m_x[2] = x3; m_coord[2].y = m_y[2] = y3; m_cmd[0] = path_cmd_move_to; m_cmd[1] = path_cmd_line_to; m_cmd[2] = path_cmd_line_to; m_cmd[3] = path_cmd_stop; if(d != 0.0) { dilate_triangle(m_coord[0].x, m_coord[0].y, m_coord[1].x, m_coord[1].y, m_coord[2].x, m_coord[2].y, m_x, m_y, d); calc_intersection(m_x[4], m_y[4], m_x[5], m_y[5], m_x[0], m_y[0], m_x[1], m_y[1], &m_coord[0].x, &m_coord[0].y); calc_intersection(m_x[0], m_y[0], m_x[1], m_y[1], m_x[2], m_y[2], m_x[3], m_y[3], &m_coord[1].x, &m_coord[1].y); calc_intersection(m_x[2], m_y[2], m_x[3], m_y[3], m_x[4], m_y[4], m_x[5], m_y[5], &m_coord[2].x, &m_coord[2].y); m_cmd[3] = path_cmd_line_to; m_cmd[4] = path_cmd_line_to; m_cmd[5] = path_cmd_line_to; m_cmd[6] = path_cmd_stop; } } //-------------------------------------------------------------------- // Vertex Source Interface to feed the coordinates to the rasterizer void rewind(unsigned) { m_vertex = 0; } //-------------------------------------------------------------------- unsigned vertex(double* x, double* y) { *x = m_x[m_vertex]; *y = m_y[m_vertex]; return m_cmd[m_vertex++]; } protected: //-------------------------------------------------------------------- void arrange_vertices(coord_type* coord) const { coord[0] = m_coord[0]; coord[1] = m_coord[1]; coord[2] = m_coord[2]; if(m_coord[0].y > m_coord[2].y) { coord[0] = m_coord[2]; coord[2] = m_coord[0]; } coord_type tmp; if(coord[0].y > coord[1].y) { tmp = coord[1]; coord[1] = coord[0]; coord[0] = tmp; } if(coord[1].y > coord[2].y) { tmp = coord[2]; coord[2] = coord[1]; coord[1] = tmp; } } private: //-------------------------------------------------------------------- coord_type m_coord[3]; double m_x[8]; double m_y[8]; unsigned m_cmd[8]; unsigned m_vertex; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_math.h0000644000175000017500000003563513233644505022732 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // Bessel function (besj) was adapted for use in AGG library by Andy Wilk // Contact: castor.vulgaris@gmail.com //---------------------------------------------------------------------------- #ifndef AGG_MATH_INCLUDED #define AGG_MATH_INCLUDED #include #include "agg_basics.h" namespace agg24 { //------------------------------------------------------vertex_dist_epsilon // Coinciding points maximal distance (Epsilon) const double vertex_dist_epsilon = 1e-14; //-----------------------------------------------------intersection_epsilon // See calc_intersection const double intersection_epsilon = 1.0e-30; //------------------------------------------------------------cross_product AGG_INLINE double cross_product(double x1, double y1, double x2, double y2, double x, double y) { return (x - x2) * (y2 - y1) - (y - y2) * (x2 - x1); } //--------------------------------------------------------point_in_triangle AGG_INLINE bool point_in_triangle(double x1, double y1, double x2, double y2, double x3, double y3, double x, double y) { bool cp1 = cross_product(x1, y1, x2, y2, x, y) < 0.0; bool cp2 = cross_product(x2, y2, x3, y3, x, y) < 0.0; bool cp3 = cross_product(x3, y3, x1, y1, x, y) < 0.0; return cp1 == cp2 && cp2 == cp3 && cp3 == cp1; } //-----------------------------------------------------------calc_distance AGG_INLINE double calc_distance(double x1, double y1, double x2, double y2) { double dx = x2-x1; double dy = y2-y1; return sqrt(dx * dx + dy * dy); } //--------------------------------------------------------calc_sq_distance AGG_INLINE double calc_sq_distance(double x1, double y1, double x2, double y2) { double dx = x2-x1; double dy = y2-y1; return dx * dx + dy * dy; } //------------------------------------------------calc_line_point_distance AGG_INLINE double calc_line_point_distance(double x1, double y1, double x2, double y2, double x, double y) { double dx = x2-x1; double dy = y2-y1; double d = sqrt(dx * dx + dy * dy); if(d < vertex_dist_epsilon) { return calc_distance(x1, y1, x, y); } return ((x - x2) * dy - (y - y2) * dx) / d; } //-------------------------------------------------------calc_line_point_u AGG_INLINE double calc_segment_point_u(double x1, double y1, double x2, double y2, double x, double y) { double dx = x2 - x1; double dy = y2 - y1; if(dx == 0 && dy == 0) { return 0; } double pdx = x - x1; double pdy = y - y1; return (pdx * dx + pdy * dy) / (dx * dx + dy * dy); } //---------------------------------------------calc_line_point_sq_distance AGG_INLINE double calc_segment_point_sq_distance(double x1, double y1, double x2, double y2, double x, double y, double u) { if(u <= 0) { return calc_sq_distance(x, y, x1, y1); } else if(u >= 1) { return calc_sq_distance(x, y, x2, y2); } return calc_sq_distance(x, y, x1 + u * (x2 - x1), y1 + u * (y2 - y1)); } //---------------------------------------------calc_line_point_sq_distance AGG_INLINE double calc_segment_point_sq_distance(double x1, double y1, double x2, double y2, double x, double y) { return calc_segment_point_sq_distance( x1, y1, x2, y2, x, y, calc_segment_point_u(x1, y1, x2, y2, x, y)); } //-------------------------------------------------------calc_intersection AGG_INLINE bool calc_intersection(double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy, double* x, double* y) { double num = (ay-cy) * (dx-cx) - (ax-cx) * (dy-cy); double den = (bx-ax) * (dy-cy) - (by-ay) * (dx-cx); if(fabs(den) < intersection_epsilon) return false; double r = num / den; *x = ax + r * (bx-ax); *y = ay + r * (by-ay); return true; } //-----------------------------------------------------intersection_exists AGG_INLINE bool intersection_exists(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { // It's less expensive but you can't control the // boundary conditions: Less or LessEqual double dx1 = x2 - x1; double dy1 = y2 - y1; double dx2 = x4 - x3; double dy2 = y4 - y3; return ((x3 - x2) * dy1 - (y3 - y2) * dx1 < 0.0) != ((x4 - x2) * dy1 - (y4 - y2) * dx1 < 0.0) && ((x1 - x4) * dy2 - (y1 - y4) * dx2 < 0.0) != ((x2 - x4) * dy2 - (y2 - y4) * dx2 < 0.0); // It's is more expensive but more flexible // in terms of boundary conditions. //-------------------- //double den = (x2-x1) * (y4-y3) - (y2-y1) * (x4-x3); //if(fabs(den) < intersection_epsilon) return false; //double nom1 = (x4-x3) * (y1-y3) - (y4-y3) * (x1-x3); //double nom2 = (x2-x1) * (y1-y3) - (y2-y1) * (x1-x3); //double ua = nom1 / den; //double ub = nom2 / den; //return ua >= 0.0 && ua <= 1.0 && ub >= 0.0 && ub <= 1.0; } //--------------------------------------------------------calc_orthogonal AGG_INLINE void calc_orthogonal(double thickness, double x1, double y1, double x2, double y2, double* x, double* y) { double dx = x2 - x1; double dy = y2 - y1; double d = sqrt(dx*dx + dy*dy); *x = thickness * dy / d; *y = -thickness * dx / d; } //--------------------------------------------------------dilate_triangle AGG_INLINE void dilate_triangle(double x1, double y1, double x2, double y2, double x3, double y3, double *x, double* y, double d) { double dx1=0.0; double dy1=0.0; double dx2=0.0; double dy2=0.0; double dx3=0.0; double dy3=0.0; double loc = cross_product(x1, y1, x2, y2, x3, y3); if(fabs(loc) > intersection_epsilon) { if(cross_product(x1, y1, x2, y2, x3, y3) > 0.0) { d = -d; } calc_orthogonal(d, x1, y1, x2, y2, &dx1, &dy1); calc_orthogonal(d, x2, y2, x3, y3, &dx2, &dy2); calc_orthogonal(d, x3, y3, x1, y1, &dx3, &dy3); } *x++ = x1 + dx1; *y++ = y1 + dy1; *x++ = x2 + dx1; *y++ = y2 + dy1; *x++ = x2 + dx2; *y++ = y2 + dy2; *x++ = x3 + dx2; *y++ = y3 + dy2; *x++ = x3 + dx3; *y++ = y3 + dy3; *x++ = x1 + dx3; *y++ = y1 + dy3; } //------------------------------------------------------calc_triangle_area AGG_INLINE double calc_triangle_area(double x1, double y1, double x2, double y2, double x3, double y3) { return (x1*y2 - x2*y1 + x2*y3 - x3*y2 + x3*y1 - x1*y3) * 0.5; } //-------------------------------------------------------calc_polygon_area template double calc_polygon_area(const Storage& st) { unsigned i; double sum = 0.0; double x = st[0].x; double y = st[0].y; double xs = x; double ys = y; for(i = 1; i < st.size(); i++) { const typename Storage::value_type& v = st[i]; sum += x * v.y - y * v.x; x = v.x; y = v.y; } return (sum + x * ys - y * xs) * 0.5; } //------------------------------------------------------------------------ // Tables for fast sqrt extern int16u g_sqrt_table[1024]; extern int8 g_elder_bit_table[256]; //---------------------------------------------------------------fast_sqrt //Fast integer Sqrt - really fast: no cycles, divisions or multiplications #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable : 4035) //Disable warning "no return value" #endif AGG_INLINE unsigned fast_sqrt(unsigned val) { #if defined(_M_IX86) && defined(_MSC_VER) && !defined(AGG_NO_ASM) //For Ix86 family processors this assembler code is used. //The key command here is bsr - determination the number of the most //significant bit of the value. For other processors //(and maybe compilers) the pure C "#else" section is used. __asm { mov ebx, val mov edx, 11 bsr ecx, ebx sub ecx, 9 jle less_than_9_bits shr ecx, 1 adc ecx, 0 sub edx, ecx shl ecx, 1 shr ebx, cl less_than_9_bits: xor eax, eax mov ax, g_sqrt_table[ebx*2] mov ecx, edx shr eax, cl } #else //This code is actually pure C and portable to most //arcitectures including 64bit ones. unsigned t = val; int bit=0; unsigned shift = 11; //The following piece of code is just an emulation of the //Ix86 assembler command "bsr" (see above). However on old //Intels (like Intel MMX 233MHz) this code is about twice //faster (sic!) then just one "bsr". On PIII and PIV the //bsr is optimized quite well. bit = t >> 24; if(bit) { bit = g_elder_bit_table[bit] + 24; } else { bit = (t >> 16) & 0xFF; if(bit) { bit = g_elder_bit_table[bit] + 16; } else { bit = (t >> 8) & 0xFF; if(bit) { bit = g_elder_bit_table[bit] + 8; } else { bit = g_elder_bit_table[t]; } } } //This code calculates the sqrt. bit -= 9; if(bit > 0) { bit = (bit >> 1) + (bit & 1); shift -= bit; val >>= (bit << 1); } return g_sqrt_table[val] >> shift; #endif } #if defined(_MSC_VER) #pragma warning(pop) #endif //--------------------------------------------------------------------besj // Function BESJ calculates Bessel function of first kind of order n // Arguments: // n - an integer (>=0), the order // x - value at which the Bessel function is required //-------------------- // C++ Mathematical Library // Convereted from equivalent FORTRAN library // Converetd by Gareth Walker for use by course 392 computational project // All functions tested and yield the same results as the corresponding // FORTRAN versions. // // If you have any problems using these functions please report them to // M.Muldoon@UMIST.ac.uk // // Documentation available on the web // http://www.ma.umist.ac.uk/mrm/Teaching/392/libs/392.html // Version 1.0 8/98 // 29 October, 1999 //-------------------- // Adapted for use in AGG library by Andy Wilk (castor.vulgaris@gmail.com) //------------------------------------------------------------------------ inline double besj(double x, int n) { if(n < 0) { return 0; } double d = 1E-6; double b = 0; if(fabs(x) <= d) { if(n != 0) return 0; return 1; } double b1 = 0; // b1 is the value from the previous iteration // Set up a starting order for recurrence int m1 = (int)fabs(x) + 6; if(fabs(x) > 5) { m1 = (int)(fabs(1.4 * x + 60 / x)); } int m2 = (int)(n + 2 + fabs(x) / 4); if (m1 > m2) { m2 = m1; } // Apply recurrence down from curent max order for(;;) { double c3 = 0; double c2 = 1E-30; double c4 = 0; int m8 = 1; if (m2 / 2 * 2 == m2) { m8 = -1; } int imax = m2 - 2; for (int i = 1; i <= imax; i++) { double c6 = 2 * (m2 - i) * c2 / x - c3; c3 = c2; c2 = c6; if(m2 - i - 1 == n) { b = c6; } m8 = -1 * m8; if (m8 > 0) { c4 = c4 + 2 * c6; } } double c6 = 2 * c2 / x - c3; if(n == 0) { b = c6; } c4 += c6; b /= c4; if(fabs(b - b1) < d) { return b; } b1 = b; m2 += 3; } } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_gamma_lut.h0000644000175000017500000002063613233644505023742 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_GAMMA_LUT_INCLUDED #define AGG_GAMMA_LUT_INCLUDED #include #include "agg_basics.h" #include "agg_gamma_functions.h" namespace agg24 { template class gamma_lut { public: typedef gamma_lut self_type; enum gamma_scale_e { gamma_shift = GammaShift, gamma_size = 1 << gamma_shift, gamma_mask = gamma_size - 1 }; enum hi_res_scale_e { hi_res_shift = HiResShift, hi_res_size = 1 << hi_res_shift, hi_res_mask = hi_res_size - 1 }; ~gamma_lut() { pod_allocator::deallocate(m_inv_gamma, hi_res_size); pod_allocator::deallocate(m_dir_gamma, gamma_size); } gamma_lut() : m_gamma(1.0), m_dir_gamma(pod_allocator::allocate(gamma_size)), m_inv_gamma(pod_allocator::allocate(hi_res_size)) { unsigned i; for(i = 0; i < gamma_size; i++) { m_dir_gamma[i] = HiResT(i << (hi_res_shift - gamma_shift)); } for(i = 0; i < hi_res_size; i++) { m_inv_gamma[i] = LoResT(i >> (hi_res_shift - gamma_shift)); } } gamma_lut(double g) : m_gamma(1.0), m_dir_gamma(pod_allocator::allocate(gamma_size)), m_inv_gamma(pod_allocator::allocate(hi_res_size)) { gamma(g); } void gamma(double g) { m_gamma = g; unsigned i; for(i = 0; i < gamma_size; i++) { m_dir_gamma[i] = (HiResT) uround(pow(i / double(gamma_mask), m_gamma) * double(hi_res_mask)); } double inv_g = 1.0 / g; for(i = 0; i < hi_res_size; i++) { m_inv_gamma[i] = (LoResT) uround(pow(i / double(hi_res_mask), inv_g) * double(gamma_mask)); } } double gamma() const { return m_gamma; } HiResT dir(LoResT v) const { return m_dir_gamma[unsigned(v)]; } LoResT inv(HiResT v) const { return m_inv_gamma[unsigned(v)]; } private: gamma_lut(const self_type&); const self_type& operator = (const self_type&); double m_gamma; HiResT* m_dir_gamma; LoResT* m_inv_gamma; }; // // sRGB support classes // // Optimized sRGB lookup table. The direct conversion (sRGB to linear) // is a straightforward lookup. The inverse conversion (linear to sRGB) // is implemented using binary search. template class sRGB_lut_base { public: LinearType dir(int8u v) const { return m_dir_table[v]; } int8u inv(LinearType v) const { // Unrolled binary search. int8u x = 0; if (v > m_inv_table[128]) x = 128; if (v > m_inv_table[x + 64]) x += 64; if (v > m_inv_table[x + 32]) x += 32; if (v > m_inv_table[x + 16]) x += 16; if (v > m_inv_table[x + 8]) x += 8; if (v > m_inv_table[x + 4]) x += 4; if (v > m_inv_table[x + 2]) x += 2; if (v > m_inv_table[x + 1]) x += 1; return x; } protected: LinearType m_dir_table[256]; LinearType m_inv_table[256]; // Only derived classes may instantiate. sRGB_lut_base() { } }; // sRGB_lut - implements sRGB conversion for the various types. // Base template is undefined, specializations are provided below. template class sRGB_lut; template<> class sRGB_lut : public sRGB_lut_base { public: sRGB_lut() { // Generate lookup tables. m_dir_table[0] = 0; m_inv_table[0] = 0; for (unsigned i = 1; i <= 255; ++i) { // Floating-point RGB is in range [0,1]. m_dir_table[i] = float(sRGB_to_linear(i / 255.0)); m_inv_table[i] = float(sRGB_to_linear((i - 0.5) / 255.0)); } } }; template<> class sRGB_lut : public sRGB_lut_base { public: sRGB_lut() { // Generate lookup tables. m_dir_table[0] = 0; m_inv_table[0] = 0; for (unsigned i = 1; i <= 255; ++i) { // 16-bit RGB is in range [0,65535]. m_dir_table[i] = uround(65535.0 * sRGB_to_linear(i / 255.0)); m_inv_table[i] = uround(65535.0 * sRGB_to_linear((i - 0.5) / 255.0)); } } }; template<> class sRGB_lut : public sRGB_lut_base { public: sRGB_lut() { // Generate lookup tables. m_dir_table[0] = 0; m_inv_table[0] = 0; for (unsigned i = 1; i <= 255; ++i) { // 8-bit RGB is handled with simple bidirectional lookup tables. m_dir_table[i] = uround(255.0 * sRGB_to_linear(i / 255.0)); m_inv_table[i] = uround(255.0 * linear_to_sRGB(i / 255.0)); } } int8u inv(int8u v) const { // In this case, the inverse transform is a simple lookup. return m_inv_table[v]; } }; // Common base class for sRGB_conv objects. Defines an internal // sRGB_lut object so that users don't have to. template class sRGB_conv_base { public: static T rgb_from_sRGB(int8u x) { return lut.dir(x); } static int8u rgb_to_sRGB(T x) { return lut.inv(x); } private: static sRGB_lut lut; }; // Definition of sRGB_conv_base::lut. Due to the fact that this a template, // we don't need to place the definition in a cpp file. Hurrah. template sRGB_lut sRGB_conv_base::lut; // Wrapper for sRGB-linear conversion. // Base template is undefined, specializations are provided below. template class sRGB_conv; template<> class sRGB_conv : public sRGB_conv_base { public: static float alpha_from_sRGB(int8u x) { return float(x / 255.0); } static int8u alpha_to_sRGB(float x) { if (x <= 0) return 0; else if (x >= 1) return 255; else return int8u(0.5 + x * 255); } }; template<> class sRGB_conv : public sRGB_conv_base { public: static int16u alpha_from_sRGB(int8u x) { return (x << 8) | x; } static int8u alpha_to_sRGB(int16u x) { return x >> 8; } }; template<> class sRGB_conv : public sRGB_conv_base { public: static int8u alpha_from_sRGB(int8u x) { return x; } static int8u alpha_to_sRGB(int8u x) { return x; } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rasterizer_cells_aa.h0000644000175000017500000005256713233644505026021 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // // The author gratefully acknowleges the support of David Turner, // Robert Wilhelm, and Werner Lemberg - the authors of the FreeType // libray - in producing this work. See http://www.freetype.org for details. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_CELLS_AA_INCLUDED #define AGG_RASTERIZER_CELLS_AA_INCLUDED #include #include #include #include "agg_math.h" #include "agg_array.h" namespace agg24 { //-----------------------------------------------------rasterizer_cells_aa // An internal class that implements the main rasterization algorithm. // Used in the rasterizer. Should not be used direcly. template class rasterizer_cells_aa { enum cell_block_scale_e { cell_block_shift = 12, cell_block_size = 1 << cell_block_shift, cell_block_mask = cell_block_size - 1, cell_block_pool = 256 }; struct sorted_y { unsigned start; unsigned num; }; public: typedef Cell cell_type; typedef rasterizer_cells_aa self_type; ~rasterizer_cells_aa(); rasterizer_cells_aa(unsigned cell_block_limit=1024); void reset(); void style(const cell_type& style_cell); void line(int x1, int y1, int x2, int y2); int min_x() const { return m_min_x; } int min_y() const { return m_min_y; } int max_x() const { return m_max_x; } int max_y() const { return m_max_y; } void sort_cells(); unsigned total_cells() const { return m_num_cells; } unsigned scanline_num_cells(unsigned y) const { return m_sorted_y[y - m_min_y].num; } const cell_type* const* scanline_cells(unsigned y) const { return m_sorted_cells.data() + m_sorted_y[y - m_min_y].start; } bool sorted() const { return m_sorted; } private: rasterizer_cells_aa(const self_type&); const self_type& operator = (const self_type&); void set_curr_cell(int x, int y); void add_curr_cell(); void render_hline(int ey, int x1, int y1, int x2, int y2); void allocate_block(); private: unsigned m_num_blocks; unsigned m_max_blocks; unsigned m_curr_block; unsigned m_num_cells; unsigned m_cell_block_limit; cell_type** m_cells; cell_type* m_curr_cell_ptr; pod_vector m_sorted_cells; pod_vector m_sorted_y; cell_type m_curr_cell; cell_type m_style_cell; int m_min_x; int m_min_y; int m_max_x; int m_max_y; bool m_sorted; }; //------------------------------------------------------------------------ template rasterizer_cells_aa::~rasterizer_cells_aa() { if(m_num_blocks) { cell_type** ptr = m_cells + m_num_blocks - 1; while(m_num_blocks--) { pod_allocator::deallocate(*ptr, cell_block_size); ptr--; } pod_allocator::deallocate(m_cells, m_max_blocks); } } //------------------------------------------------------------------------ template rasterizer_cells_aa::rasterizer_cells_aa(unsigned cell_block_limit) : m_num_blocks(0), m_max_blocks(0), m_curr_block(0), m_num_cells(0), m_cell_block_limit(cell_block_limit), m_cells(0), m_curr_cell_ptr(0), m_sorted_cells(), m_sorted_y(), m_min_x(0x7FFFFFFF), m_min_y(0x7FFFFFFF), m_max_x(-0x7FFFFFFF), m_max_y(-0x7FFFFFFF), m_sorted(false) { m_style_cell.initial(); m_curr_cell.initial(); } //------------------------------------------------------------------------ template void rasterizer_cells_aa::reset() { m_num_cells = 0; m_curr_block = 0; m_curr_cell.initial(); m_style_cell.initial(); m_sorted = false; m_min_x = 0x7FFFFFFF; m_min_y = 0x7FFFFFFF; m_max_x = -0x7FFFFFFF; m_max_y = -0x7FFFFFFF; } //------------------------------------------------------------------------ template AGG_INLINE void rasterizer_cells_aa::add_curr_cell() { if(m_curr_cell.area | m_curr_cell.cover) { if((m_num_cells & cell_block_mask) == 0) { if(m_num_blocks >= m_cell_block_limit) { throw std::overflow_error("Exceeded cell block limit"); } allocate_block(); } *m_curr_cell_ptr++ = m_curr_cell; ++m_num_cells; } } //------------------------------------------------------------------------ template AGG_INLINE void rasterizer_cells_aa::set_curr_cell(int x, int y) { if(m_curr_cell.not_equal(x, y, m_style_cell)) { add_curr_cell(); m_curr_cell.style(m_style_cell); m_curr_cell.x = x; m_curr_cell.y = y; m_curr_cell.cover = 0; m_curr_cell.area = 0; } } //------------------------------------------------------------------------ template AGG_INLINE void rasterizer_cells_aa::render_hline(int ey, int x1, int y1, int x2, int y2) { int ex1 = x1 >> poly_subpixel_shift; int ex2 = x2 >> poly_subpixel_shift; int fx1 = x1 & poly_subpixel_mask; int fx2 = x2 & poly_subpixel_mask; int delta, p, first, dx; int incr, lift, mod, rem; //trivial case. Happens often if(y1 == y2) { set_curr_cell(ex2, ey); return; } //everything is located in a single cell. That is easy! if(ex1 == ex2) { delta = y2 - y1; m_curr_cell.cover += delta; m_curr_cell.area += (fx1 + fx2) * delta; return; } //ok, we'll have to render a run of adjacent cells on the same //hline... p = (poly_subpixel_scale - fx1) * (y2 - y1); first = poly_subpixel_scale; incr = 1; dx = x2 - x1; if(dx < 0) { p = fx1 * (y2 - y1); first = 0; incr = -1; dx = -dx; } delta = p / dx; mod = p % dx; if(mod < 0) { delta--; mod += dx; } m_curr_cell.cover += delta; m_curr_cell.area += (fx1 + first) * delta; ex1 += incr; set_curr_cell(ex1, ey); y1 += delta; if(ex1 != ex2) { p = poly_subpixel_scale * (y2 - y1 + delta); lift = p / dx; rem = p % dx; if (rem < 0) { lift--; rem += dx; } mod -= dx; while (ex1 != ex2) { delta = lift; mod += rem; if(mod >= 0) { mod -= dx; delta++; } m_curr_cell.cover += delta; m_curr_cell.area += poly_subpixel_scale * delta; y1 += delta; ex1 += incr; set_curr_cell(ex1, ey); } } delta = y2 - y1; m_curr_cell.cover += delta; m_curr_cell.area += (fx2 + poly_subpixel_scale - first) * delta; } //------------------------------------------------------------------------ template AGG_INLINE void rasterizer_cells_aa::style(const cell_type& style_cell) { m_style_cell.style(style_cell); } //------------------------------------------------------------------------ template void rasterizer_cells_aa::line(int x1, int y1, int x2, int y2) { enum dx_limit_e { dx_limit = 16384 << poly_subpixel_shift }; int dx = x2 - x1; if(dx >= dx_limit || dx <= -dx_limit) { int cx = (x1 + x2) >> 1; int cy = (y1 + y2) >> 1; line(x1, y1, cx, cy); line(cx, cy, x2, y2); } int dy = y2 - y1; int ex1 = x1 >> poly_subpixel_shift; int ex2 = x2 >> poly_subpixel_shift; int ey1 = y1 >> poly_subpixel_shift; int ey2 = y2 >> poly_subpixel_shift; int fy1 = y1 & poly_subpixel_mask; int fy2 = y2 & poly_subpixel_mask; int x_from, x_to; int p, rem, mod, lift, delta, first, incr; if(ex1 < m_min_x) m_min_x = ex1; if(ex1 > m_max_x) m_max_x = ex1; if(ey1 < m_min_y) m_min_y = ey1; if(ey1 > m_max_y) m_max_y = ey1; if(ex2 < m_min_x) m_min_x = ex2; if(ex2 > m_max_x) m_max_x = ex2; if(ey2 < m_min_y) m_min_y = ey2; if(ey2 > m_max_y) m_max_y = ey2; set_curr_cell(ex1, ey1); //everything is on a single hline if(ey1 == ey2) { render_hline(ey1, x1, fy1, x2, fy2); return; } //Vertical line - we have to calculate start and end cells, //and then - the common values of the area and coverage for //all cells of the line. We know exactly there's only one //cell, so, we don't have to call render_hline(). incr = 1; if(dx == 0) { int ex = x1 >> poly_subpixel_shift; int two_fx = (x1 - (ex << poly_subpixel_shift)) << 1; int area; first = poly_subpixel_scale; if(dy < 0) { first = 0; incr = -1; } x_from = x1; //render_hline(ey1, x_from, fy1, x_from, first); delta = first - fy1; m_curr_cell.cover += delta; m_curr_cell.area += two_fx * delta; ey1 += incr; set_curr_cell(ex, ey1); delta = first + first - poly_subpixel_scale; area = two_fx * delta; while(ey1 != ey2) { //render_hline(ey1, x_from, poly_subpixel_scale - first, x_from, first); m_curr_cell.cover = delta; m_curr_cell.area = area; ey1 += incr; set_curr_cell(ex, ey1); } //render_hline(ey1, x_from, poly_subpixel_scale - first, x_from, fy2); delta = fy2 - poly_subpixel_scale + first; m_curr_cell.cover += delta; m_curr_cell.area += two_fx * delta; return; } //ok, we have to render several hlines p = (poly_subpixel_scale - fy1) * dx; first = poly_subpixel_scale; if(dy < 0) { p = fy1 * dx; first = 0; incr = -1; dy = -dy; } delta = p / dy; mod = p % dy; if(mod < 0) { delta--; mod += dy; } x_from = x1 + delta; render_hline(ey1, x1, fy1, x_from, first); ey1 += incr; set_curr_cell(x_from >> poly_subpixel_shift, ey1); if(ey1 != ey2) { p = poly_subpixel_scale * dx; lift = p / dy; rem = p % dy; if(rem < 0) { lift--; rem += dy; } mod -= dy; while(ey1 != ey2) { delta = lift; mod += rem; if (mod >= 0) { mod -= dy; delta++; } x_to = x_from + delta; render_hline(ey1, x_from, poly_subpixel_scale - first, x_to, first); x_from = x_to; ey1 += incr; set_curr_cell(x_from >> poly_subpixel_shift, ey1); } } render_hline(ey1, x_from, poly_subpixel_scale - first, x2, fy2); } //------------------------------------------------------------------------ template void rasterizer_cells_aa::allocate_block() { if(m_curr_block >= m_num_blocks) { if(m_num_blocks >= m_max_blocks) { cell_type** new_cells = pod_allocator::allocate(m_max_blocks + cell_block_pool); if(m_cells) { memcpy(new_cells, m_cells, m_max_blocks * sizeof(cell_type*)); pod_allocator::deallocate(m_cells, m_max_blocks); } m_cells = new_cells; m_max_blocks += cell_block_pool; } m_cells[m_num_blocks++] = pod_allocator::allocate(cell_block_size); } m_curr_cell_ptr = m_cells[m_curr_block++]; } //------------------------------------------------------------------------ template static AGG_INLINE void swap_cells(T* a, T* b) { T temp = *a; *a = *b; *b = temp; } //------------------------------------------------------------------------ enum { qsort_threshold = 9 }; //------------------------------------------------------------------------ template void qsort_cells(Cell** start, unsigned num) { Cell** stack[80]; Cell*** top; Cell** limit; Cell** base; limit = start + num; base = start; top = stack; for (;;) { int len = int(limit - base); Cell** i; Cell** j; Cell** pivot; if(len > qsort_threshold) { // we use base + len/2 as the pivot pivot = base + len / 2; swap_cells(base, pivot); i = base + 1; j = limit - 1; // now ensure that *i <= *base <= *j if((*j)->x < (*i)->x) { swap_cells(i, j); } if((*base)->x < (*i)->x) { swap_cells(base, i); } if((*j)->x < (*base)->x) { swap_cells(base, j); } for(;;) { int x = (*base)->x; do i++; while( (*i)->x < x ); do j--; while( x < (*j)->x ); if(i > j) { break; } swap_cells(i, j); } swap_cells(base, j); // now, push the largest sub-array if(j - base > limit - i) { top[0] = base; top[1] = j; base = i; } else { top[0] = i; top[1] = limit; limit = j; } top += 2; } else { // the sub-array is small, perform insertion sort j = base; i = j + 1; for(; i < limit; j = i, i++) { for(; j[1]->x < (*j)->x; j--) { swap_cells(j + 1, j); if (j == base) { break; } } } if(top > stack) { top -= 2; base = top[0]; limit = top[1]; } else { break; } } } } //------------------------------------------------------------------------ template void rasterizer_cells_aa::sort_cells() { if(m_sorted) return; //Perform sort only the first time. add_curr_cell(); m_curr_cell.x = 0x7FFFFFFF; m_curr_cell.y = 0x7FFFFFFF; m_curr_cell.cover = 0; m_curr_cell.area = 0; if(m_num_cells == 0) return; // DBG: Check to see if min/max works well. //for(unsigned nc = 0; nc < m_num_cells; nc++) //{ // cell_type* cell = m_cells[nc >> cell_block_shift] + (nc & cell_block_mask); // if(cell->x < m_min_x || // cell->y < m_min_y || // cell->x > m_max_x || // cell->y > m_max_y) // { // cell = cell; // Breakpoint here // } //} // Allocate the array of cell pointers m_sorted_cells.allocate(m_num_cells, 16); // Allocate and zero the Y array m_sorted_y.allocate(m_max_y - m_min_y + 1, 16); m_sorted_y.zero(); // Create the Y-histogram (count the numbers of cells for each Y) cell_type** block_ptr = m_cells; cell_type* cell_ptr; unsigned nb = m_num_cells; unsigned i; while(nb) { cell_ptr = *block_ptr++; i = (nb > cell_block_size) ? cell_block_size : nb; nb -= i; while(i--) { m_sorted_y[cell_ptr->y - m_min_y].start++; ++cell_ptr; } } // Convert the Y-histogram into the array of starting indexes unsigned start = 0; for(i = 0; i < m_sorted_y.size(); i++) { unsigned v = m_sorted_y[i].start; m_sorted_y[i].start = start; start += v; } // Fill the cell pointer array sorted by Y block_ptr = m_cells; nb = m_num_cells; while(nb) { cell_ptr = *block_ptr++; i = (nb > cell_block_size) ? cell_block_size : nb; nb -= i; while(i--) { sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y]; m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr; ++curr_y.num; ++cell_ptr; } } // Finally arrange the X-arrays for(i = 0; i < m_sorted_y.size(); i++) { const sorted_y& curr_y = m_sorted_y[i]; if(curr_y.num) { qsort_cells(m_sorted_cells.data() + curr_y.start, curr_y.num); } } m_sorted = true; } //------------------------------------------------------scanline_hit_test class scanline_hit_test { public: scanline_hit_test(int x) : m_x(x), m_hit(false) {} void reset_spans() {} void finalize(int) {} void add_cell(int x, int) { if(m_x == x) m_hit = true; } void add_span(int x, int len, int) { if(m_x >= x && m_x < x+len) m_hit = true; } unsigned num_spans() const { return 1; } bool hit() const { return m_hit; } private: int m_x; bool m_hit; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_color_rgba.h0000644000175000017500000013137513233644505024110 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_COLOR_RGBA_INCLUDED #define AGG_COLOR_RGBA_INCLUDED #include #include "agg_basics.h" #include "agg_gamma_lut.h" namespace agg24 { // Supported component orders for RGB and RGBA pixel formats //======================================================================= struct order_rgb { enum rgb_e { R=0, G=1, B=2, N=3 }; }; struct order_bgr { enum bgr_e { B=0, G=1, R=2, N=3 }; }; struct order_rgba { enum rgba_e { R=0, G=1, B=2, A=3, N=4 }; }; struct order_argb { enum argb_e { A=0, R=1, G=2, B=3, N=4 }; }; struct order_abgr { enum abgr_e { A=0, B=1, G=2, R=3, N=4 }; }; struct order_bgra { enum bgra_e { B=0, G=1, R=2, A=3, N=4 }; }; // Colorspace tag types. struct linear {}; struct sRGB {}; //====================================================================rgba struct rgba { typedef double value_type; double r; double g; double b; double a; //-------------------------------------------------------------------- rgba() {} //-------------------------------------------------------------------- rgba(double r_, double g_, double b_, double a_=1.0) : r(r_), g(g_), b(b_), a(a_) {} //-------------------------------------------------------------------- rgba(const rgba& c, double a_) : r(c.r), g(c.g), b(c.b), a(a_) {} //-------------------------------------------------------------------- rgba& clear() { r = g = b = a = 0; return *this; } //-------------------------------------------------------------------- rgba& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- rgba& opacity(double a_) { if (a_ < 0) a = 0; else if (a_ > 1) a = 1; else a = a_; return *this; } //-------------------------------------------------------------------- double opacity() const { return a; } //-------------------------------------------------------------------- rgba& premultiply() { r *= a; g *= a; b *= a; return *this; } //-------------------------------------------------------------------- rgba& premultiply(double a_) { if (a <= 0 || a_ <= 0) { r = g = b = a = 0; } else { a_ /= a; r *= a_; g *= a_; b *= a_; a = a_; } return *this; } //-------------------------------------------------------------------- rgba& demultiply() { if (a == 0) { r = g = b = 0; } else { double a_ = 1.0 / a; r *= a_; g *= a_; b *= a_; } return *this; } //-------------------------------------------------------------------- rgba gradient(rgba c, double k) const { rgba ret; ret.r = r + (c.r - r) * k; ret.g = g + (c.g - g) * k; ret.b = b + (c.b - b) * k; ret.a = a + (c.a - a) * k; return ret; } rgba& operator+=(const rgba& c) { r += c.r; g += c.g; b += c.b; a += c.a; return *this; } rgba& operator*=(double k) { r *= k; g *= k; b *= k; a *= k; return *this; } //-------------------------------------------------------------------- static rgba no_color() { return rgba(0,0,0,0); } //-------------------------------------------------------------------- static rgba from_wavelength(double wl, double gamma = 1.0); //-------------------------------------------------------------------- explicit rgba(double wavelen, double gamma=1.0) { *this = from_wavelength(wavelen, gamma); } }; inline rgba operator+(const rgba& a, const rgba& b) { return rgba(a) += b; } inline rgba operator*(const rgba& a, double b) { return rgba(a) *= b; } //------------------------------------------------------------------------ inline rgba rgba::from_wavelength(double wl, double gamma) { rgba t(0.0, 0.0, 0.0); if (wl >= 380.0 && wl <= 440.0) { t.r = -1.0 * (wl - 440.0) / (440.0 - 380.0); t.b = 1.0; } else if (wl >= 440.0 && wl <= 490.0) { t.g = (wl - 440.0) / (490.0 - 440.0); t.b = 1.0; } else if (wl >= 490.0 && wl <= 510.0) { t.g = 1.0; t.b = -1.0 * (wl - 510.0) / (510.0 - 490.0); } else if (wl >= 510.0 && wl <= 580.0) { t.r = (wl - 510.0) / (580.0 - 510.0); t.g = 1.0; } else if (wl >= 580.0 && wl <= 645.0) { t.r = 1.0; t.g = -1.0 * (wl - 645.0) / (645.0 - 580.0); } else if (wl >= 645.0 && wl <= 780.0) { t.r = 1.0; } double s = 1.0; if (wl > 700.0) s = 0.3 + 0.7 * (780.0 - wl) / (780.0 - 700.0); else if (wl < 420.0) s = 0.3 + 0.7 * (wl - 380.0) / (420.0 - 380.0); t.r = pow(t.r * s, gamma); t.g = pow(t.g * s, gamma); t.b = pow(t.b * s, gamma); return t; } inline rgba rgba_pre(double r, double g, double b, double a) { return rgba(r, g, b, a).premultiply(); } //===================================================================rgba8 template struct rgba8T { typedef int8u value_type; typedef int32u calc_type; typedef int32 long_type; enum base_scale_e { base_shift = 8, base_scale = 1 << base_shift, base_mask = base_scale - 1, base_MSB = 1 << (base_shift - 1) }; typedef rgba8T self_type; value_type r; value_type g; value_type b; value_type a; static void convert(rgba8T& dst, const rgba8T& src) { dst.r = sRGB_conv::rgb_from_sRGB(src.r); dst.g = sRGB_conv::rgb_from_sRGB(src.g); dst.b = sRGB_conv::rgb_from_sRGB(src.b); dst.a = src.a; } static void convert(rgba8T& dst, const rgba8T& src) { dst.r = sRGB_conv::rgb_to_sRGB(src.r); dst.g = sRGB_conv::rgb_to_sRGB(src.g); dst.b = sRGB_conv::rgb_to_sRGB(src.b); dst.a = src.a; } static void convert(rgba8T& dst, const rgba& src) { dst.r = value_type(uround(src.r * base_mask)); dst.g = value_type(uround(src.g * base_mask)); dst.b = value_type(uround(src.b * base_mask)); dst.a = value_type(uround(src.a * base_mask)); } static void convert(rgba8T& dst, const rgba& src) { // Use the "float" table. dst.r = sRGB_conv::rgb_to_sRGB(float(src.r)); dst.g = sRGB_conv::rgb_to_sRGB(float(src.g)); dst.b = sRGB_conv::rgb_to_sRGB(float(src.b)); dst.a = sRGB_conv::alpha_to_sRGB(float(src.a)); } static void convert(rgba& dst, const rgba8T& src) { dst.r = src.r / 255.0; dst.g = src.g / 255.0; dst.b = src.b / 255.0; dst.a = src.a / 255.0; } static void convert(rgba& dst, const rgba8T& src) { // Use the "float" table. dst.r = sRGB_conv::rgb_from_sRGB(src.r); dst.g = sRGB_conv::rgb_from_sRGB(src.g); dst.b = sRGB_conv::rgb_from_sRGB(src.b); dst.a = sRGB_conv::alpha_from_sRGB(src.a); } //-------------------------------------------------------------------- rgba8T() {} //-------------------------------------------------------------------- rgba8T(unsigned r_, unsigned g_, unsigned b_, unsigned a_ = base_mask) : r(value_type(r_)), g(value_type(g_)), b(value_type(b_)), a(value_type(a_)) {} //-------------------------------------------------------------------- rgba8T(const rgba& c) { convert(*this, c); } //-------------------------------------------------------------------- rgba8T(const self_type& c, unsigned a_) : r(c.r), g(c.g), b(c.b), a(value_type(a_)) {} //-------------------------------------------------------------------- template rgba8T(const rgba8T& c) { convert(*this, c); } //-------------------------------------------------------------------- operator rgba() const { rgba c; convert(c, *this); return c; } //-------------------------------------------------------------------- static AGG_INLINE double to_double(value_type a) { return double(a) / base_mask; } //-------------------------------------------------------------------- static AGG_INLINE value_type from_double(double a) { return value_type(uround(a * base_mask)); } //-------------------------------------------------------------------- static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- static AGG_INLINE value_type full_value() { return base_mask; } //-------------------------------------------------------------------- AGG_INLINE bool is_transparent() const { return a == 0; } //-------------------------------------------------------------------- AGG_INLINE bool is_opaque() const { return a == base_mask; } //-------------------------------------------------------------------- static AGG_INLINE value_type invert(value_type x) { return base_mask - x; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int8u. static AGG_INLINE value_type multiply(value_type a, value_type b) { calc_type t = a * b + base_MSB; return value_type(((t >> base_shift) + t) >> base_shift); } //-------------------------------------------------------------------- static AGG_INLINE value_type demultiply(value_type a, value_type b) { if (a * b == 0) { return 0; } else if (a >= b) { return base_mask; } else return value_type((a * base_mask + (b >> 1)) / b); } //-------------------------------------------------------------------- template static AGG_INLINE T downscale(T a) { return a >> base_shift; } //-------------------------------------------------------------------- template static AGG_INLINE T downshift(T a, unsigned n) { return a >> n; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int8u. // Specifically for multiplying a color component by a cover. static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return multiply(a, b); } //-------------------------------------------------------------------- static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return multiply(b, a); } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return p + q - multiply(p, a); } //-------------------------------------------------------------------- // Interpolate p to q by a. static AGG_INLINE value_type lerp(value_type p, value_type q, value_type a) { int t = (q - p) * a + base_MSB - (p > q); return value_type(p + (((t >> base_shift) + t) >> base_shift)); } //-------------------------------------------------------------------- self_type& clear() { r = g = b = a = 0; return *this; } //-------------------------------------------------------------------- self_type& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- self_type& opacity(double a_) { if (a_ < 0) a = 0; else if (a_ > 1) a = 1; else a = (value_type)uround(a_ * double(base_mask)); return *this; } //-------------------------------------------------------------------- double opacity() const { return double(a) / double(base_mask); } //-------------------------------------------------------------------- AGG_INLINE self_type& premultiply() { if (a != base_mask) { if (a == 0) { r = g = b = 0; } else { r = multiply(r, a); g = multiply(g, a); b = multiply(b, a); } } return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type& premultiply(unsigned a_) { if (a != base_mask || a_ < base_mask) { if (a == 0 || a_ == 0) { r = g = b = a = 0; } else { calc_type r_ = (calc_type(r) * a_) / a; calc_type g_ = (calc_type(g) * a_) / a; calc_type b_ = (calc_type(b) * a_) / a; r = value_type((r_ > a_) ? a_ : r_); g = value_type((g_ > a_) ? a_ : g_); b = value_type((b_ > a_) ? a_ : b_); a = value_type(a_); } } return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type& demultiply() { if (a < base_mask) { if (a == 0) { r = g = b = 0; } else { calc_type r_ = (calc_type(r) * base_mask) / a; calc_type g_ = (calc_type(g) * base_mask) / a; calc_type b_ = (calc_type(b) * base_mask) / a; r = value_type((r_ > calc_type(base_mask)) ? calc_type(base_mask) : r_); g = value_type((g_ > calc_type(base_mask)) ? calc_type(base_mask) : g_); b = value_type((b_ > calc_type(base_mask)) ? calc_type(base_mask) : b_); } } return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type gradient(const self_type& c, double k) const { self_type ret; calc_type ik = uround(k * base_mask); ret.r = lerp(r, c.r, ik); ret.g = lerp(g, c.g, ik); ret.b = lerp(b, c.b, ik); ret.a = lerp(a, c.a, ik); return ret; } //-------------------------------------------------------------------- AGG_INLINE void add(const self_type& c, unsigned cover) { calc_type cr, cg, cb, ca; if (cover == cover_mask) { if (c.a == base_mask) { *this = c; return; } else { cr = r + c.r; cg = g + c.g; cb = b + c.b; ca = a + c.a; } } else { cr = r + mult_cover(c.r, cover); cg = g + mult_cover(c.g, cover); cb = b + mult_cover(c.b, cover); ca = a + mult_cover(c.a, cover); } r = (value_type)((cr > calc_type(base_mask)) ? calc_type(base_mask) : cr); g = (value_type)((cg > calc_type(base_mask)) ? calc_type(base_mask) : cg); b = (value_type)((cb > calc_type(base_mask)) ? calc_type(base_mask) : cb); a = (value_type)((ca > calc_type(base_mask)) ? calc_type(base_mask) : ca); } //-------------------------------------------------------------------- template AGG_INLINE void apply_gamma_dir(const GammaLUT& gamma) { r = gamma.dir(r); g = gamma.dir(g); b = gamma.dir(b); } //-------------------------------------------------------------------- template AGG_INLINE void apply_gamma_inv(const GammaLUT& gamma) { r = gamma.inv(r); g = gamma.inv(g); b = gamma.inv(b); } //-------------------------------------------------------------------- static self_type no_color() { return self_type(0,0,0,0); } //-------------------------------------------------------------------- static self_type from_wavelength(double wl, double gamma = 1.0) { return self_type(rgba::from_wavelength(wl, gamma)); } }; typedef rgba8T rgba8; typedef rgba8T srgba8; //-------------------------------------------------------------rgb8_packed inline rgba8 rgb8_packed(unsigned v) { return rgba8((v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF); } //-------------------------------------------------------------bgr8_packed inline rgba8 bgr8_packed(unsigned v) { return rgba8(v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF); } //------------------------------------------------------------argb8_packed inline rgba8 argb8_packed(unsigned v) { return rgba8((v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF, v >> 24); } //---------------------------------------------------------rgba8_gamma_dir template rgba8 rgba8_gamma_dir(rgba8 c, const GammaLUT& gamma) { return rgba8(gamma.dir(c.r), gamma.dir(c.g), gamma.dir(c.b), c.a); } //---------------------------------------------------------rgba8_gamma_inv template rgba8 rgba8_gamma_inv(rgba8 c, const GammaLUT& gamma) { return rgba8(gamma.inv(c.r), gamma.inv(c.g), gamma.inv(c.b), c.a); } //==================================================================rgba16 struct rgba16 { typedef int16u value_type; typedef int32u calc_type; typedef int64 long_type; enum base_scale_e { base_shift = 16, base_scale = 1 << base_shift, base_mask = base_scale - 1, base_MSB = 1 << (base_shift - 1) }; typedef rgba16 self_type; value_type r; value_type g; value_type b; value_type a; //-------------------------------------------------------------------- rgba16() {} //-------------------------------------------------------------------- rgba16(unsigned r_, unsigned g_, unsigned b_, unsigned a_=base_mask) : r(value_type(r_)), g(value_type(g_)), b(value_type(b_)), a(value_type(a_)) {} //-------------------------------------------------------------------- rgba16(const self_type& c, unsigned a_) : r(c.r), g(c.g), b(c.b), a(value_type(a_)) {} //-------------------------------------------------------------------- rgba16(const rgba& c) : r((value_type)uround(c.r * double(base_mask))), g((value_type)uround(c.g * double(base_mask))), b((value_type)uround(c.b * double(base_mask))), a((value_type)uround(c.a * double(base_mask))) {} //-------------------------------------------------------------------- rgba16(const rgba8& c) : r(value_type((value_type(c.r) << 8) | c.r)), g(value_type((value_type(c.g) << 8) | c.g)), b(value_type((value_type(c.b) << 8) | c.b)), a(value_type((value_type(c.a) << 8) | c.a)) {} //-------------------------------------------------------------------- rgba16(const srgba8& c) : r(sRGB_conv::rgb_from_sRGB(c.r)), g(sRGB_conv::rgb_from_sRGB(c.g)), b(sRGB_conv::rgb_from_sRGB(c.b)), a(sRGB_conv::alpha_from_sRGB(c.a)) {} //-------------------------------------------------------------------- operator rgba() const { return rgba( r / 65535.0, g / 65535.0, b / 65535.0, a / 65535.0); } //-------------------------------------------------------------------- operator rgba8() const { return rgba8(r >> 8, g >> 8, b >> 8, a >> 8); } //-------------------------------------------------------------------- operator srgba8() const { // Return (non-premultiplied) sRGB values. return srgba8( sRGB_conv::rgb_to_sRGB(r), sRGB_conv::rgb_to_sRGB(g), sRGB_conv::rgb_to_sRGB(b), sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- static AGG_INLINE double to_double(value_type a) { return double(a) / base_mask; } //-------------------------------------------------------------------- static AGG_INLINE value_type from_double(double a) { return value_type(uround(a * base_mask)); } //-------------------------------------------------------------------- static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- static AGG_INLINE value_type full_value() { return base_mask; } //-------------------------------------------------------------------- AGG_INLINE bool is_transparent() const { return a == 0; } //-------------------------------------------------------------------- AGG_INLINE bool is_opaque() const { return a == base_mask; } //-------------------------------------------------------------------- static AGG_INLINE value_type invert(value_type x) { return base_mask - x; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int16u. static AGG_INLINE value_type multiply(value_type a, value_type b) { calc_type t = a * b + base_MSB; return value_type(((t >> base_shift) + t) >> base_shift); } //-------------------------------------------------------------------- static AGG_INLINE value_type demultiply(value_type a, value_type b) { if (a * b == 0) { return 0; } else if (a >= b) { return base_mask; } else return value_type((a * base_mask + (b >> 1)) / b); } //-------------------------------------------------------------------- template static AGG_INLINE T downscale(T a) { return a >> base_shift; } //-------------------------------------------------------------------- template static AGG_INLINE T downshift(T a, unsigned n) { return a >> n; } //-------------------------------------------------------------------- // Fixed-point multiply, almost exact over int16u. // Specifically for multiplying a color component by a cover. static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return multiply(a, (b << 8) | b); } //-------------------------------------------------------------------- static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return multiply((a << 8) | a, b) >> 8; } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return p + q - multiply(p, a); } //-------------------------------------------------------------------- // Interpolate p to q by a. static AGG_INLINE value_type lerp(value_type p, value_type q, value_type a) { int t = (q - p) * a + base_MSB - (p > q); return value_type(p + (((t >> base_shift) + t) >> base_shift)); } //-------------------------------------------------------------------- self_type& clear() { r = g = b = a = 0; return *this; } //-------------------------------------------------------------------- self_type& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type& opacity(double a_) { if (a_ < 0) a = 0; if (a_ > 1) a = 1; a = value_type(uround(a_ * double(base_mask))); return *this; } //-------------------------------------------------------------------- double opacity() const { return double(a) / double(base_mask); } //-------------------------------------------------------------------- AGG_INLINE self_type& premultiply() { if (a != base_mask) { if (a == 0) { r = g = b = 0; } else { r = multiply(r, a); g = multiply(g, a); b = multiply(b, a); } } return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type& premultiply(unsigned a_) { if (a < base_mask || a_ < base_mask) { if (a == 0 || a_ == 0) { r = g = b = a = 0; } else { calc_type r_ = (calc_type(r) * a_) / a; calc_type g_ = (calc_type(g) * a_) / a; calc_type b_ = (calc_type(b) * a_) / a; r = value_type((r_ > a_) ? a_ : r_); g = value_type((g_ > a_) ? a_ : g_); b = value_type((b_ > a_) ? a_ : b_); a = value_type(a_); } } return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type& demultiply() { if (a < base_mask) { if (a == 0) { r = g = b = 0; } else { calc_type r_ = (calc_type(r) * base_mask) / a; calc_type g_ = (calc_type(g) * base_mask) / a; calc_type b_ = (calc_type(b) * base_mask) / a; r = value_type((r_ > calc_type(base_mask)) ? calc_type(base_mask) : r_); g = value_type((g_ > calc_type(base_mask)) ? calc_type(base_mask) : g_); b = value_type((b_ > calc_type(base_mask)) ? calc_type(base_mask) : b_); } } return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type gradient(const self_type& c, double k) const { self_type ret; calc_type ik = uround(k * base_mask); ret.r = lerp(r, c.r, ik); ret.g = lerp(g, c.g, ik); ret.b = lerp(b, c.b, ik); ret.a = lerp(a, c.a, ik); return ret; } //-------------------------------------------------------------------- AGG_INLINE void add(const self_type& c, unsigned cover) { calc_type cr, cg, cb, ca; if (cover == cover_mask) { if (c.a == base_mask) { *this = c; return; } else { cr = r + c.r; cg = g + c.g; cb = b + c.b; ca = a + c.a; } } else { cr = r + mult_cover(c.r, cover); cg = g + mult_cover(c.g, cover); cb = b + mult_cover(c.b, cover); ca = a + mult_cover(c.a, cover); } r = (value_type)((cr > calc_type(base_mask)) ? calc_type(base_mask) : cr); g = (value_type)((cg > calc_type(base_mask)) ? calc_type(base_mask) : cg); b = (value_type)((cb > calc_type(base_mask)) ? calc_type(base_mask) : cb); a = (value_type)((ca > calc_type(base_mask)) ? calc_type(base_mask) : ca); } //-------------------------------------------------------------------- template AGG_INLINE void apply_gamma_dir(const GammaLUT& gamma) { r = gamma.dir(r); g = gamma.dir(g); b = gamma.dir(b); } //-------------------------------------------------------------------- template AGG_INLINE void apply_gamma_inv(const GammaLUT& gamma) { r = gamma.inv(r); g = gamma.inv(g); b = gamma.inv(b); } //-------------------------------------------------------------------- static self_type no_color() { return self_type(0,0,0,0); } //-------------------------------------------------------------------- static self_type from_wavelength(double wl, double gamma = 1.0) { return self_type(rgba::from_wavelength(wl, gamma)); } }; //------------------------------------------------------rgba16_gamma_dir template rgba16 rgba16_gamma_dir(rgba16 c, const GammaLUT& gamma) { return rgba16(gamma.dir(c.r), gamma.dir(c.g), gamma.dir(c.b), c.a); } //------------------------------------------------------rgba16_gamma_inv template rgba16 rgba16_gamma_inv(rgba16 c, const GammaLUT& gamma) { return rgba16(gamma.inv(c.r), gamma.inv(c.g), gamma.inv(c.b), c.a); } //====================================================================rgba32 struct rgba32 { typedef float value_type; typedef double calc_type; typedef double long_type; typedef rgba32 self_type; value_type r; value_type g; value_type b; value_type a; //-------------------------------------------------------------------- rgba32() {} //-------------------------------------------------------------------- rgba32(value_type r_, value_type g_, value_type b_, value_type a_= 1) : r(r_), g(g_), b(b_), a(a_) {} //-------------------------------------------------------------------- rgba32(const self_type& c, float a_) : r(c.r), g(c.g), b(c.b), a(a_) {} //-------------------------------------------------------------------- rgba32(const rgba& c) : r(value_type(c.r)), g(value_type(c.g)), b(value_type(c.b)), a(value_type(c.a)) {} //-------------------------------------------------------------------- rgba32(const rgba8& c) : r(value_type(c.r / 255.0)), g(value_type(c.g / 255.0)), b(value_type(c.b / 255.0)), a(value_type(c.a / 255.0)) {} //-------------------------------------------------------------------- rgba32(const srgba8& c) : r(sRGB_conv::rgb_from_sRGB(c.r)), g(sRGB_conv::rgb_from_sRGB(c.g)), b(sRGB_conv::rgb_from_sRGB(c.b)), a(sRGB_conv::alpha_from_sRGB(c.a)) {} //-------------------------------------------------------------------- rgba32(const rgba16& c) : r(value_type(c.r / 65535.0)), g(value_type(c.g / 65535.0)), b(value_type(c.b / 65535.0)), a(value_type(c.a / 65535.0)) {} //-------------------------------------------------------------------- operator rgba() const { return rgba(r, g, b, a); } //-------------------------------------------------------------------- operator rgba8() const { return rgba8( uround(r * 255.0), uround(g * 255.0), uround(b * 255.0), uround(a * 255.0)); } //-------------------------------------------------------------------- operator srgba8() const { return srgba8( sRGB_conv::rgb_to_sRGB(r), sRGB_conv::rgb_to_sRGB(g), sRGB_conv::rgb_to_sRGB(b), sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- operator rgba16() const { return rgba8( uround(r * 65535.0), uround(g * 65535.0), uround(b * 65535.0), uround(a * 65535.0)); } //-------------------------------------------------------------------- static AGG_INLINE double to_double(value_type a) { return a; } //-------------------------------------------------------------------- static AGG_INLINE value_type from_double(double a) { return value_type(a); } //-------------------------------------------------------------------- static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- static AGG_INLINE value_type full_value() { return 1; } //-------------------------------------------------------------------- AGG_INLINE bool is_transparent() const { return a <= 0; } //-------------------------------------------------------------------- AGG_INLINE bool is_opaque() const { return a >= 1; } //-------------------------------------------------------------------- static AGG_INLINE value_type invert(value_type x) { return 1 - x; } //-------------------------------------------------------------------- static AGG_INLINE value_type multiply(value_type a, value_type b) { return value_type(a * b); } //-------------------------------------------------------------------- static AGG_INLINE value_type demultiply(value_type a, value_type b) { return (b == 0) ? 0 : value_type(a / b); } //-------------------------------------------------------------------- template static AGG_INLINE T downscale(T a) { return a; } //-------------------------------------------------------------------- template static AGG_INLINE T downshift(T a, unsigned n) { return n > 0 ? a / (1 << n) : a; } //-------------------------------------------------------------------- static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return value_type(a * b / cover_mask); } //-------------------------------------------------------------------- static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return cover_type(uround(a * b)); } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return (1 - a) * p + q; // more accurate than "p + q - p * a" } //-------------------------------------------------------------------- // Interpolate p to q by a. static AGG_INLINE value_type lerp(value_type p, value_type q, value_type a) { // The form "p + a * (q - p)" avoids a multiplication, but may produce an // inaccurate result. For example, "p + (q - p)" may not be exactly equal // to q. Therefore, stick to the basic expression, which at least produces // the correct result at either extreme. return (1 - a) * p + a * q; } //-------------------------------------------------------------------- self_type& clear() { r = g = b = a = 0; return *this; } //-------------------------------------------------------------------- self_type& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type& opacity(double a_) { if (a_ < 0) a = 0; else if (a_ > 1) a = 1; else a = value_type(a_); return *this; } //-------------------------------------------------------------------- double opacity() const { return a; } //-------------------------------------------------------------------- AGG_INLINE self_type& premultiply() { if (a < 1) { if (a <= 0) { r = g = b = 0; } else { r *= a; g *= a; b *= a; } } return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type& demultiply() { if (a < 1) { if (a <= 0) { r = g = b = 0; } else { r /= a; g /= a; b /= a; } } return *this; } //-------------------------------------------------------------------- AGG_INLINE self_type gradient(const self_type& c, double k) const { self_type ret; ret.r = value_type(r + (c.r - r) * k); ret.g = value_type(g + (c.g - g) * k); ret.b = value_type(b + (c.b - b) * k); ret.a = value_type(a + (c.a - a) * k); return ret; } //-------------------------------------------------------------------- AGG_INLINE void add(const self_type& c, unsigned cover) { if (cover == cover_mask) { if (c.is_opaque()) { *this = c; return; } else { r += c.r; g += c.g; b += c.b; a += c.a; } } else { r += mult_cover(c.r, cover); g += mult_cover(c.g, cover); b += mult_cover(c.b, cover); a += mult_cover(c.a, cover); } if (a > 1) a = 1; if (r > a) r = a; if (g > a) g = a; if (b > a) b = a; } //-------------------------------------------------------------------- template AGG_INLINE void apply_gamma_dir(const GammaLUT& gamma) { r = gamma.dir(r); g = gamma.dir(g); b = gamma.dir(b); } //-------------------------------------------------------------------- template AGG_INLINE void apply_gamma_inv(const GammaLUT& gamma) { r = gamma.inv(r); g = gamma.inv(g); b = gamma.inv(b); } //-------------------------------------------------------------------- static self_type no_color() { return self_type(0,0,0,0); } //-------------------------------------------------------------------- static self_type from_wavelength(double wl, double gamma = 1) { return self_type(rgba::from_wavelength(wl, gamma)); } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_unclose_polygon.h0000644000175000017500000000334213233644505026233 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CONV_UNCLOSE_POLYGON_INCLUDED #define AGG_CONV_UNCLOSE_POLYGON_INCLUDED #include "agg_basics.h" namespace agg24 { //====================================================conv_unclose_polygon template class conv_unclose_polygon { public: explicit conv_unclose_polygon(VertexSource& vs) : m_source(&vs) {} void attach(VertexSource& source) { m_source = &source; } void rewind(unsigned path_id) { m_source->rewind(path_id); } unsigned vertex(double* x, double* y) { unsigned cmd = m_source->vertex(x, y); if(is_end_poly(cmd)) cmd &= ~path_flags_close; return cmd; } private: conv_unclose_polygon(const conv_unclose_polygon&); const conv_unclose_polygon& operator = (const conv_unclose_polygon&); VertexSource* m_source; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vcgen_stroke.h0000644000175000017500000000714413233644505024464 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_VCGEN_STROKE_INCLUDED #define AGG_VCGEN_STROKE_INCLUDED #include "agg_math_stroke.h" namespace agg24 { //============================================================vcgen_stroke // // See Implementation agg_vcgen_stroke.cpp // Stroke generator // //------------------------------------------------------------------------ class vcgen_stroke { enum status_e { initial, ready, cap1, cap2, outline1, close_first, outline2, out_vertices, end_poly1, end_poly2, stop }; public: typedef vertex_sequence vertex_storage; typedef pod_bvector coord_storage; vcgen_stroke(); void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } void line_join(line_join_e lj) { m_stroker.line_join(lj); } void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } line_cap_e line_cap() const { return m_stroker.line_cap(); } line_join_e line_join() const { return m_stroker.line_join(); } inner_join_e inner_join() const { return m_stroker.inner_join(); } void width(double w) { m_stroker.width(w); } void miter_limit(double ml) { m_stroker.miter_limit(ml); } void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } void approximation_scale(double as) { m_stroker.approximation_scale(as); } double width() const { return m_stroker.width(); } double miter_limit() const { return m_stroker.miter_limit(); } double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } double approximation_scale() const { return m_stroker.approximation_scale(); } void shorten(double s) { m_shorten = s; } double shorten() const { return m_shorten; } // Vertex Generator Interface void remove_all(); void add_vertex(double x, double y, unsigned cmd); // Vertex Source Interface void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: vcgen_stroke(const vcgen_stroke&); const vcgen_stroke& operator = (const vcgen_stroke&); math_stroke m_stroker; vertex_storage m_src_vertices; coord_storage m_out_vertices; double m_shorten; unsigned m_closed; status_e m_status; status_e m_prev_status; unsigned m_src_vertex; unsigned m_out_vertex; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_pixfmt_gray.h0000644000175000017500000006126713233644505024332 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_PIXFMT_GRAY_INCLUDED #define AGG_PIXFMT_GRAY_INCLUDED #include #include "agg_pixfmt_base.h" #include "agg_rendering_buffer.h" namespace agg24 { //============================================================blender_gray template struct blender_gray { typedef ColorT color_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; // Blend pixels using the non-premultiplied form of Alvy-Ray Smith's // compositing function. Since the render buffer is opaque we skip the // initial premultiply and final demultiply. static AGG_INLINE void blend_pix(value_type* p, value_type cv, value_type alpha, cover_type cover) { blend_pix(p, cv, color_type::mult_cover(alpha, cover)); } static AGG_INLINE void blend_pix(value_type* p, value_type cv, value_type alpha) { *p = color_type::lerp(*p, cv, alpha); } }; //======================================================blender_gray_pre template struct blender_gray_pre { typedef ColorT color_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; // Blend pixels using the premultiplied form of Alvy-Ray Smith's // compositing function. static AGG_INLINE void blend_pix(value_type* p, value_type cv, value_type alpha, cover_type cover) { blend_pix(p, color_type::mult_cover(cv, cover), color_type::mult_cover(alpha, cover)); } static AGG_INLINE void blend_pix(value_type* p, value_type cv, value_type alpha) { *p = color_type::prelerp(*p, cv, alpha); } }; //=====================================================apply_gamma_dir_gray template class apply_gamma_dir_gray { public: typedef typename ColorT::value_type value_type; apply_gamma_dir_gray(const GammaLut& gamma) : m_gamma(gamma) {} AGG_INLINE void operator () (value_type* p) { *p = m_gamma.dir(*p); } private: const GammaLut& m_gamma; }; //=====================================================apply_gamma_inv_gray template class apply_gamma_inv_gray { public: typedef typename ColorT::value_type value_type; apply_gamma_inv_gray(const GammaLut& gamma) : m_gamma(gamma) {} AGG_INLINE void operator () (value_type* p) { *p = m_gamma.inv(*p); } private: const GammaLut& m_gamma; }; //=================================================pixfmt_alpha_blend_gray template class pixfmt_alpha_blend_gray { public: typedef pixfmt_gray_tag pixfmt_category; typedef RenBuf rbuf_type; typedef typename rbuf_type::row_data row_data; typedef Blender blender_type; typedef typename blender_type::color_type color_type; typedef int order_type; // A fake one typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; enum { num_components = 1, pix_width = sizeof(value_type) * Step, pix_step = Step, pix_offset = Offset, }; struct pixel_type { value_type c[num_components]; void set(value_type v) { c[0] = v; } void set(const color_type& color) { set(color.v); } void get(value_type& v) const { v = c[0]; } color_type get() const { return color_type(c[0]); } pixel_type* next() { return (pixel_type*)(c + pix_step); } const pixel_type* next() const { return (const pixel_type*)(c + pix_step); } pixel_type* advance(int n) { return (pixel_type*)(c + n * pix_step); } const pixel_type* advance(int n) const { return (const pixel_type*)(c + n * pix_step); } }; private: //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, value_type v, value_type a, unsigned cover) { blender_type::blend_pix(p->c, v, a, cover); } //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, value_type v, value_type a) { blender_type::blend_pix(p->c, v, a); } //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, const color_type& c, unsigned cover) { blender_type::blend_pix(p->c, c.v, c.a, cover); } //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, const color_type& c) { blender_type::blend_pix(p->c, c.v, c.a); } //-------------------------------------------------------------------- AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover) { if (!c.is_transparent()) { if (c.is_opaque() && cover == cover_mask) { p->set(c); } else { blend_pix(p, c, cover); } } } //-------------------------------------------------------------------- AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c) { if (!c.is_transparent()) { if (c.is_opaque()) { p->set(c); } else { blend_pix(p, c); } } } public: //-------------------------------------------------------------------- explicit pixfmt_alpha_blend_gray(rbuf_type& rb) : m_rbuf(&rb) {} void attach(rbuf_type& rb) { m_rbuf = &rb; } //-------------------------------------------------------------------- template bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) { rect_i r(x1, y1, x2, y2); if (r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) { int stride = pixf.stride(); m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); return true; } return false; } //-------------------------------------------------------------------- AGG_INLINE unsigned width() const { return m_rbuf->width(); } AGG_INLINE unsigned height() const { return m_rbuf->height(); } AGG_INLINE int stride() const { return m_rbuf->stride(); } //-------------------------------------------------------------------- int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } row_data row(int y) const { return m_rbuf->row(y); } //-------------------------------------------------------------------- AGG_INLINE int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step + pix_offset); } AGG_INLINE const int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step + pix_offset); } // Return pointer to pixel value, forcing row to be allocated. AGG_INLINE pixel_type* pix_value_ptr(int x, int y, unsigned len) { return (pixel_type*)(m_rbuf->row_ptr(x, y, len) + sizeof(value_type) * (x * pix_step + pix_offset)); } // Return pointer to pixel value, or null if row not allocated. AGG_INLINE const pixel_type* pix_value_ptr(int x, int y) const { int8u* p = m_rbuf->row_ptr(y); return p ? (pixel_type*)(p + sizeof(value_type) * (x * pix_step + pix_offset)) : 0; } // Get pixel pointer from raw buffer pointer. AGG_INLINE static pixel_type* pix_value_ptr(void* p) { return (pixel_type*)((value_type*)p + pix_offset); } // Get pixel pointer from raw buffer pointer. AGG_INLINE static const pixel_type* pix_value_ptr(const void* p) { return (const pixel_type*)((const value_type*)p + pix_offset); } //-------------------------------------------------------------------- AGG_INLINE static void write_plain_color(void* p, color_type c) { // Grayscale formats are implicitly premultiplied. c.premultiply(); pix_value_ptr(p)->set(c); } //-------------------------------------------------------------------- AGG_INLINE static color_type read_plain_color(const void* p) { return pix_value_ptr(p)->get(); } //-------------------------------------------------------------------- AGG_INLINE static void make_pix(int8u* p, const color_type& c) { ((pixel_type*)p)->set(c); } //-------------------------------------------------------------------- AGG_INLINE color_type pixel(int x, int y) const { if (const pixel_type* p = pix_value_ptr(x, y)) { return p->get(); } return color_type::no_color(); } //-------------------------------------------------------------------- AGG_INLINE void copy_pixel(int x, int y, const color_type& c) { pix_value_ptr(x, y, 1)->set(c); } //-------------------------------------------------------------------- AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) { copy_or_blend_pix(pix_value_ptr(x, y, 1), c, cover); } //-------------------------------------------------------------------- AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) { pixel_type* p = pix_value_ptr(x, y, len); do { p->set(c); p = p->next(); } while(--len); } //-------------------------------------------------------------------- AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) { do { pix_value_ptr(x, y++, 1)->set(c); } while (--len); } //-------------------------------------------------------------------- void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (!c.is_transparent()) { pixel_type* p = pix_value_ptr(x, y, len); if (c.is_opaque() && cover == cover_mask) { do { p->set(c); p = p->next(); } while (--len); } else { do { blend_pix(p, c, cover); p = p->next(); } while (--len); } } } //-------------------------------------------------------------------- void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (!c.is_transparent()) { if (c.is_opaque() && cover == cover_mask) { do { pix_value_ptr(x, y++, 1)->set(c); } while (--len); } else { do { blend_pix(pix_value_ptr(x, y++, 1), c, cover); } while (--len); } } } //-------------------------------------------------------------------- void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { if (!c.is_transparent()) { pixel_type* p = pix_value_ptr(x, y, len); do { if (c.is_opaque() && *covers == cover_mask) { p->set(c); } else { blend_pix(p, c, *covers); } p = p->next(); ++covers; } while (--len); } } //-------------------------------------------------------------------- void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { if (!c.is_transparent()) { do { pixel_type* p = pix_value_ptr(x, y++, 1); if (c.is_opaque() && *covers == cover_mask) { p->set(c); } else { blend_pix(p, c, *covers); } ++covers; } while (--len); } } //-------------------------------------------------------------------- void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) { pixel_type* p = pix_value_ptr(x, y, len); do { p->set(*colors++); p = p->next(); } while (--len); } //-------------------------------------------------------------------- void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) { do { pix_value_ptr(x, y++, 1)->set(*colors++); } while (--len); } //-------------------------------------------------------------------- void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { pixel_type* p = pix_value_ptr(x, y, len); if (covers) { do { copy_or_blend_pix(p, *colors++, *covers++); p = p->next(); } while (--len); } else { if (cover == cover_mask) { do { copy_or_blend_pix(p, *colors++); p = p->next(); } while (--len); } else { do { copy_or_blend_pix(p, *colors++, cover); p = p->next(); } while (--len); } } } //-------------------------------------------------------------------- void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { if (covers) { do { copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, *covers++); } while (--len); } else { if (cover == cover_mask) { do { copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++); } while (--len); } else { do { copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, cover); } while (--len); } } } //-------------------------------------------------------------------- template void for_each_pixel(Function f) { unsigned y; for (y = 0; y < height(); ++y) { row_data r = m_rbuf->row(y); if (r.ptr) { unsigned len = r.x2 - r.x1 + 1; pixel_type* p = pix_value_ptr(r.x1, y, len); do { f(p->c); p = p->next(); } while (--len); } } } //-------------------------------------------------------------------- template void apply_gamma_dir(const GammaLut& g) { for_each_pixel(apply_gamma_dir_gray(g)); } //-------------------------------------------------------------------- template void apply_gamma_inv(const GammaLut& g) { for_each_pixel(apply_gamma_inv_gray(g)); } //-------------------------------------------------------------------- template void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) { if (const int8u* p = from.row_ptr(ysrc)) { memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); } } //-------------------------------------------------------------------- // Blend from single color, using grayscale surface as alpha channel. template void blend_from_color(const SrcPixelFormatRenderer& from, const color_type& color, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; typedef typename SrcPixelFormatRenderer::color_type src_color_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); do { copy_or_blend_pix(pdst, color, src_color_type::scale_cover(cover, psrc->c[0])); psrc = psrc->next(); pdst = pdst->next(); } while (--len); } } //-------------------------------------------------------------------- // Blend from color table, using grayscale surface as indexes into table. // Obviously, this only works for integer value types. template void blend_from_lut(const SrcPixelFormatRenderer& from, const color_type* color_lut, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); do { copy_or_blend_pix(pdst, color_lut[psrc->c[0]], cover); psrc = psrc->next(); pdst = pdst->next(); } while (--len); } } private: rbuf_type* m_rbuf; }; typedef blender_gray blender_gray8; typedef blender_gray blender_sgray8; typedef blender_gray blender_gray16; typedef blender_gray blender_gray32; typedef blender_gray_pre blender_gray8_pre; typedef blender_gray_pre blender_sgray8_pre; typedef blender_gray_pre blender_gray16_pre; typedef blender_gray_pre blender_gray32_pre; typedef pixfmt_alpha_blend_gray pixfmt_gray8; typedef pixfmt_alpha_blend_gray pixfmt_sgray8; typedef pixfmt_alpha_blend_gray pixfmt_gray16; typedef pixfmt_alpha_blend_gray pixfmt_gray32; typedef pixfmt_alpha_blend_gray pixfmt_gray8_pre; typedef pixfmt_alpha_blend_gray pixfmt_sgray8_pre; typedef pixfmt_alpha_blend_gray pixfmt_gray16_pre; typedef pixfmt_alpha_blend_gray pixfmt_gray32_pre; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_renderer_outline_image.h0000644000175000017500000011022213233644505026472 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_RENDERER_OUTLINE_IMAGE_INCLUDED #define AGG_RENDERER_OUTLINE_IMAGE_INCLUDED #include "agg_array.h" #include "agg_math.h" #include "agg_line_aa_basics.h" #include "agg_dda_line.h" #include "agg_rendering_buffer.h" #include "agg_clip_liang_barsky.h" namespace agg24 { //========================================================line_image_scale template class line_image_scale { public: typedef typename Source::color_type color_type; line_image_scale(const Source& src, double height) : m_source(src), m_height(height), m_scale(src.height() / height), m_scale_inv(height / src.height()) { } double width() const { return m_source.width(); } double height() const { return m_height; } color_type pixel(int x, int y) const { if (m_scale < 1.0) { // Interpolate between nearest source pixels. double src_y = (y + 0.5) * m_scale - 0.5; int h = m_source.height() - 1; int y1 = ifloor(src_y); int y2 = y1 + 1; rgba pix1 = (y1 < 0) ? rgba::no_color() : m_source.pixel(x, y1); rgba pix2 = (y2 > h) ? rgba::no_color() : m_source.pixel(x, y2); return pix1.gradient(pix2, src_y - y1); } else { // Average source pixels between y and y+1. double src_y1 = (y + 0.5) * m_scale - 0.5; double src_y2 = src_y1 + m_scale; int h = m_source.height() - 1; int y1 = ifloor(src_y1); int y2 = ifloor(src_y2); rgba c = rgba::no_color(); if (y1 >= 0) c += rgba(m_source.pixel(x, y1)) *= y1 + 1 - src_y1; while (++y1 < y2) { if (y1 <= h) c += m_source.pixel(x, y1); } if (y2 <= h) c += rgba(m_source.pixel(x, y2)) *= src_y2 - y2; return c *= m_scale_inv; } } private: line_image_scale(const line_image_scale&); const line_image_scale& operator = (const line_image_scale&); const Source& m_source; double m_height; double m_scale; double m_scale_inv; }; //======================================================line_image_pattern template class line_image_pattern { public: typedef Filter filter_type; typedef typename filter_type::color_type color_type; //-------------------------------------------------------------------- line_image_pattern(Filter& filter) : m_filter(&filter), m_dilation(filter.dilation() + 1), m_dilation_hr(m_dilation << line_subpixel_shift), m_data(), m_width(0), m_height(0), m_width_hr(0), m_half_height_hr(0), m_offset_y_hr(0) { } // Create //-------------------------------------------------------------------- template line_image_pattern(Filter& filter, const Source& src) : m_filter(&filter), m_dilation(filter.dilation() + 1), m_dilation_hr(m_dilation << line_subpixel_shift), m_data(), m_width(0), m_height(0), m_width_hr(0), m_half_height_hr(0), m_offset_y_hr(0) { create(src); } // Create //-------------------------------------------------------------------- template void create(const Source& src) { m_height = uceil(src.height()); m_width = uceil(src.width()); m_width_hr = uround(src.width() * line_subpixel_scale); m_half_height_hr = uround(src.height() * line_subpixel_scale/2); m_offset_y_hr = m_dilation_hr + m_half_height_hr - line_subpixel_scale/2; m_half_height_hr += line_subpixel_scale/2; m_data.resize((m_width + m_dilation * 2) * (m_height + m_dilation * 2)); m_buf.attach(&m_data[0], m_width + m_dilation * 2, m_height + m_dilation * 2, m_width + m_dilation * 2); unsigned x, y; color_type* d1; color_type* d2; for(y = 0; y < m_height; y++) { d1 = m_buf.row_ptr(y + m_dilation) + m_dilation; for(x = 0; x < m_width; x++) { *d1++ = src.pixel(x, y); } } const color_type* s1; const color_type* s2; for(y = 0; y < m_dilation; y++) { //s1 = m_buf.row_ptr(m_height + m_dilation - 1) + m_dilation; //s2 = m_buf.row_ptr(m_dilation) + m_dilation; d1 = m_buf.row_ptr(m_dilation + m_height + y) + m_dilation; d2 = m_buf.row_ptr(m_dilation - y - 1) + m_dilation; for(x = 0; x < m_width; x++) { //*d1++ = color_type(*s1++, 0); //*d2++ = color_type(*s2++, 0); *d1++ = color_type::no_color(); *d2++ = color_type::no_color(); } } unsigned h = m_height + m_dilation * 2; for(y = 0; y < h; y++) { s1 = m_buf.row_ptr(y) + m_dilation; s2 = m_buf.row_ptr(y) + m_dilation + m_width; d1 = m_buf.row_ptr(y) + m_dilation + m_width; d2 = m_buf.row_ptr(y) + m_dilation; for(x = 0; x < m_dilation; x++) { *d1++ = *s1++; *--d2 = *--s2; } } } //-------------------------------------------------------------------- int pattern_width() const { return m_width_hr; } int line_width() const { return m_half_height_hr; } double width() const { return m_height; } //-------------------------------------------------------------------- void pixel(color_type* p, int x, int y) const { m_filter->pixel_high_res(m_buf.rows(), p, x % m_width_hr + m_dilation_hr, y + m_offset_y_hr); } //-------------------------------------------------------------------- const filter_type& filter() const { return *m_filter; } private: line_image_pattern(const line_image_pattern&); const line_image_pattern& operator = (const line_image_pattern&); protected: row_ptr_cache m_buf; const filter_type* m_filter; unsigned m_dilation; int m_dilation_hr; pod_array m_data; unsigned m_width; unsigned m_height; int m_width_hr; int m_half_height_hr; int m_offset_y_hr; }; //=================================================line_image_pattern_pow2 template class line_image_pattern_pow2 : public line_image_pattern { public: typedef Filter filter_type; typedef typename filter_type::color_type color_type; typedef line_image_pattern base_type; //-------------------------------------------------------------------- line_image_pattern_pow2(Filter& filter) : line_image_pattern(filter), m_mask(line_subpixel_mask) {} //-------------------------------------------------------------------- template line_image_pattern_pow2(Filter& filter, const Source& src) : line_image_pattern(filter), m_mask(line_subpixel_mask) { create(src); } //-------------------------------------------------------------------- template void create(const Source& src) { line_image_pattern::create(src); m_mask = 1; while(m_mask < base_type::m_width) { m_mask <<= 1; m_mask |= 1; } m_mask <<= line_subpixel_shift - 1; m_mask |= line_subpixel_mask; base_type::m_width_hr = m_mask + 1; } //-------------------------------------------------------------------- void pixel(color_type* p, int x, int y) const { base_type::m_filter->pixel_high_res( base_type::m_buf.rows(), p, (x & m_mask) + base_type::m_dilation_hr, y + base_type::m_offset_y_hr); } private: unsigned m_mask; }; //===================================================distance_interpolator4 class distance_interpolator4 { public: //--------------------------------------------------------------------- distance_interpolator4() {} distance_interpolator4(int x1, int y1, int x2, int y2, int sx, int sy, int ex, int ey, int len, double scale, int x, int y) : m_dx(x2 - x1), m_dy(y2 - y1), m_dx_start(line_mr(sx) - line_mr(x1)), m_dy_start(line_mr(sy) - line_mr(y1)), m_dx_end(line_mr(ex) - line_mr(x2)), m_dy_end(line_mr(ey) - line_mr(y2)), m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - double(y + line_subpixel_scale/2 - y2) * double(m_dx))), m_dist_start((line_mr(x + line_subpixel_scale/2) - line_mr(sx)) * m_dy_start - (line_mr(y + line_subpixel_scale/2) - line_mr(sy)) * m_dx_start), m_dist_end((line_mr(x + line_subpixel_scale/2) - line_mr(ex)) * m_dy_end - (line_mr(y + line_subpixel_scale/2) - line_mr(ey)) * m_dx_end), m_len(uround(len / scale)) { double d = len * scale; int dx = iround(((x2 - x1) << line_subpixel_shift) / d); int dy = iround(((y2 - y1) << line_subpixel_shift) / d); m_dx_pict = -dy; m_dy_pict = dx; m_dist_pict = ((x + line_subpixel_scale/2 - (x1 - dy)) * m_dy_pict - (y + line_subpixel_scale/2 - (y1 + dx)) * m_dx_pict) >> line_subpixel_shift; m_dx <<= line_subpixel_shift; m_dy <<= line_subpixel_shift; m_dx_start <<= line_mr_subpixel_shift; m_dy_start <<= line_mr_subpixel_shift; m_dx_end <<= line_mr_subpixel_shift; m_dy_end <<= line_mr_subpixel_shift; } //--------------------------------------------------------------------- void inc_x() { m_dist += m_dy; m_dist_start += m_dy_start; m_dist_pict += m_dy_pict; m_dist_end += m_dy_end; } //--------------------------------------------------------------------- void dec_x() { m_dist -= m_dy; m_dist_start -= m_dy_start; m_dist_pict -= m_dy_pict; m_dist_end -= m_dy_end; } //--------------------------------------------------------------------- void inc_y() { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_pict -= m_dx_pict; m_dist_end -= m_dx_end; } //--------------------------------------------------------------------- void dec_y() { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_pict += m_dx_pict; m_dist_end += m_dx_end; } //--------------------------------------------------------------------- void inc_x(int dy) { m_dist += m_dy; m_dist_start += m_dy_start; m_dist_pict += m_dy_pict; m_dist_end += m_dy_end; if(dy > 0) { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_pict -= m_dx_pict; m_dist_end -= m_dx_end; } if(dy < 0) { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_pict += m_dx_pict; m_dist_end += m_dx_end; } } //--------------------------------------------------------------------- void dec_x(int dy) { m_dist -= m_dy; m_dist_start -= m_dy_start; m_dist_pict -= m_dy_pict; m_dist_end -= m_dy_end; if(dy > 0) { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_pict -= m_dx_pict; m_dist_end -= m_dx_end; } if(dy < 0) { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_pict += m_dx_pict; m_dist_end += m_dx_end; } } //--------------------------------------------------------------------- void inc_y(int dx) { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_pict -= m_dx_pict; m_dist_end -= m_dx_end; if(dx > 0) { m_dist += m_dy; m_dist_start += m_dy_start; m_dist_pict += m_dy_pict; m_dist_end += m_dy_end; } if(dx < 0) { m_dist -= m_dy; m_dist_start -= m_dy_start; m_dist_pict -= m_dy_pict; m_dist_end -= m_dy_end; } } //--------------------------------------------------------------------- void dec_y(int dx) { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_pict += m_dx_pict; m_dist_end += m_dx_end; if(dx > 0) { m_dist += m_dy; m_dist_start += m_dy_start; m_dist_pict += m_dy_pict; m_dist_end += m_dy_end; } if(dx < 0) { m_dist -= m_dy; m_dist_start -= m_dy_start; m_dist_pict -= m_dy_pict; m_dist_end -= m_dy_end; } } //--------------------------------------------------------------------- int dist() const { return m_dist; } int dist_start() const { return m_dist_start; } int dist_pict() const { return m_dist_pict; } int dist_end() const { return m_dist_end; } //--------------------------------------------------------------------- int dx() const { return m_dx; } int dy() const { return m_dy; } int dx_start() const { return m_dx_start; } int dy_start() const { return m_dy_start; } int dx_pict() const { return m_dx_pict; } int dy_pict() const { return m_dy_pict; } int dx_end() const { return m_dx_end; } int dy_end() const { return m_dy_end; } int len() const { return m_len; } private: //--------------------------------------------------------------------- int m_dx; int m_dy; int m_dx_start; int m_dy_start; int m_dx_pict; int m_dy_pict; int m_dx_end; int m_dy_end; int m_dist; int m_dist_start; int m_dist_pict; int m_dist_end; int m_len; }; //==================================================line_interpolator_image template class line_interpolator_image { public: typedef Renderer renderer_type; typedef typename Renderer::color_type color_type; //--------------------------------------------------------------------- enum max_half_width_e { max_half_width = 64 }; //--------------------------------------------------------------------- line_interpolator_image(renderer_type& ren, const line_parameters& lp, int sx, int sy, int ex, int ey, int pattern_start, double scale_x) : m_lp(lp), m_li(lp.vertical ? line_dbl_hr(lp.x2 - lp.x1) : line_dbl_hr(lp.y2 - lp.y1), lp.vertical ? abs(lp.y2 - lp.y1) : abs(lp.x2 - lp.x1) + 1), m_di(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy, ex, ey, lp.len, scale_x, lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask), m_ren(ren), m_x(lp.x1 >> line_subpixel_shift), m_y(lp.y1 >> line_subpixel_shift), m_old_x(m_x), m_old_y(m_y), m_count((lp.vertical ? abs((lp.y2 >> line_subpixel_shift) - m_y) : abs((lp.x2 >> line_subpixel_shift) - m_x))), m_width(ren.subpixel_width()), //m_max_extent(m_width >> (line_subpixel_shift - 2)), m_max_extent((m_width + line_subpixel_scale) >> line_subpixel_shift), m_start(pattern_start + (m_max_extent + 2) * ren.pattern_width()), m_step(0) { agg24::dda2_line_interpolator li(0, lp.vertical ? (lp.dy << agg24::line_subpixel_shift) : (lp.dx << agg24::line_subpixel_shift), lp.len); unsigned i; int stop = m_width + line_subpixel_scale * 2; for(i = 0; i < max_half_width; ++i) { m_dist_pos[i] = li.y(); if(m_dist_pos[i] >= stop) break; ++li; } m_dist_pos[i] = 0x7FFF0000; int dist1_start; int dist2_start; int npix = 1; if(lp.vertical) { do { --m_li; m_y -= lp.inc; m_x = (m_lp.x1 + m_li.y()) >> line_subpixel_shift; if(lp.inc > 0) m_di.dec_y(m_x - m_old_x); else m_di.inc_y(m_x - m_old_x); m_old_x = m_x; dist1_start = dist2_start = m_di.dist_start(); int dx = 0; if(dist1_start < 0) ++npix; do { dist1_start += m_di.dy_start(); dist2_start -= m_di.dy_start(); if(dist1_start < 0) ++npix; if(dist2_start < 0) ++npix; ++dx; } while(m_dist_pos[dx] <= m_width); if(npix == 0) break; npix = 0; } while(--m_step >= -m_max_extent); } else { do { --m_li; m_x -= lp.inc; m_y = (m_lp.y1 + m_li.y()) >> line_subpixel_shift; if(lp.inc > 0) m_di.dec_x(m_y - m_old_y); else m_di.inc_x(m_y - m_old_y); m_old_y = m_y; dist1_start = dist2_start = m_di.dist_start(); int dy = 0; if(dist1_start < 0) ++npix; do { dist1_start -= m_di.dx_start(); dist2_start += m_di.dx_start(); if(dist1_start < 0) ++npix; if(dist2_start < 0) ++npix; ++dy; } while(m_dist_pos[dy] <= m_width); if(npix == 0) break; npix = 0; } while(--m_step >= -m_max_extent); } m_li.adjust_forward(); m_step -= m_max_extent; } //--------------------------------------------------------------------- bool step_hor() { ++m_li; m_x += m_lp.inc; m_y = (m_lp.y1 + m_li.y()) >> line_subpixel_shift; if(m_lp.inc > 0) m_di.inc_x(m_y - m_old_y); else m_di.dec_x(m_y - m_old_y); m_old_y = m_y; int s1 = m_di.dist() / m_lp.len; int s2 = -s1; if(m_lp.inc < 0) s1 = -s1; int dist_start; int dist_pict; int dist_end; int dy; int dist; dist_start = m_di.dist_start(); dist_pict = m_di.dist_pict() + m_start; dist_end = m_di.dist_end(); color_type* p0 = m_colors + max_half_width + 2; color_type* p1 = p0; int npix = 0; p1->clear(); if(dist_end > 0) { if(dist_start <= 0) { m_ren.pixel(p1, dist_pict, s2); } ++npix; } ++p1; dy = 1; while((dist = m_dist_pos[dy]) - s1 <= m_width) { dist_start -= m_di.dx_start(); dist_pict -= m_di.dx_pict(); dist_end -= m_di.dx_end(); p1->clear(); if(dist_end > 0 && dist_start <= 0) { if(m_lp.inc > 0) dist = -dist; m_ren.pixel(p1, dist_pict, s2 - dist); ++npix; } ++p1; ++dy; } dy = 1; dist_start = m_di.dist_start(); dist_pict = m_di.dist_pict() + m_start; dist_end = m_di.dist_end(); while((dist = m_dist_pos[dy]) + s1 <= m_width) { dist_start += m_di.dx_start(); dist_pict += m_di.dx_pict(); dist_end += m_di.dx_end(); --p0; p0->clear(); if(dist_end > 0 && dist_start <= 0) { if(m_lp.inc > 0) dist = -dist; m_ren.pixel(p0, dist_pict, s2 + dist); ++npix; } ++dy; } m_ren.blend_color_vspan(m_x, m_y - dy + 1, unsigned(p1 - p0), p0); return npix && ++m_step < m_count; } //--------------------------------------------------------------------- bool step_ver() { ++m_li; m_y += m_lp.inc; m_x = (m_lp.x1 + m_li.y()) >> line_subpixel_shift; if(m_lp.inc > 0) m_di.inc_y(m_x - m_old_x); else m_di.dec_y(m_x - m_old_x); m_old_x = m_x; int s1 = m_di.dist() / m_lp.len; int s2 = -s1; if(m_lp.inc > 0) s1 = -s1; int dist_start; int dist_pict; int dist_end; int dist; int dx; dist_start = m_di.dist_start(); dist_pict = m_di.dist_pict() + m_start; dist_end = m_di.dist_end(); color_type* p0 = m_colors + max_half_width + 2; color_type* p1 = p0; int npix = 0; p1->clear(); if(dist_end > 0) { if(dist_start <= 0) { m_ren.pixel(p1, dist_pict, s2); } ++npix; } ++p1; dx = 1; while((dist = m_dist_pos[dx]) - s1 <= m_width) { dist_start += m_di.dy_start(); dist_pict += m_di.dy_pict(); dist_end += m_di.dy_end(); p1->clear(); if(dist_end > 0 && dist_start <= 0) { if(m_lp.inc > 0) dist = -dist; m_ren.pixel(p1, dist_pict, s2 + dist); ++npix; } ++p1; ++dx; } dx = 1; dist_start = m_di.dist_start(); dist_pict = m_di.dist_pict() + m_start; dist_end = m_di.dist_end(); while((dist = m_dist_pos[dx]) + s1 <= m_width) { dist_start -= m_di.dy_start(); dist_pict -= m_di.dy_pict(); dist_end -= m_di.dy_end(); --p0; p0->clear(); if(dist_end > 0 && dist_start <= 0) { if(m_lp.inc > 0) dist = -dist; m_ren.pixel(p0, dist_pict, s2 - dist); ++npix; } ++dx; } m_ren.blend_color_hspan(m_x - dx + 1, m_y, unsigned(p1 - p0), p0); return npix && ++m_step < m_count; } //--------------------------------------------------------------------- int pattern_end() const { return m_start + m_di.len(); } //--------------------------------------------------------------------- bool vertical() const { return m_lp.vertical; } int width() const { return m_width; } int count() const { return m_count; } private: line_interpolator_image(const line_interpolator_image&); const line_interpolator_image& operator = (const line_interpolator_image&); protected: const line_parameters& m_lp; dda2_line_interpolator m_li; distance_interpolator4 m_di; renderer_type& m_ren; int m_plen; int m_x; int m_y; int m_old_x; int m_old_y; int m_count; int m_width; int m_max_extent; int m_start; int m_step; int m_dist_pos[max_half_width + 1]; color_type m_colors[max_half_width * 2 + 4]; }; //===================================================renderer_outline_image template class renderer_outline_image { public: //--------------------------------------------------------------------- typedef BaseRenderer base_ren_type; typedef renderer_outline_image self_type; typedef typename base_ren_type::color_type color_type; typedef ImagePattern pattern_type; //--------------------------------------------------------------------- renderer_outline_image(base_ren_type& ren, pattern_type& patt) : m_ren(&ren), m_pattern(&patt), m_start(0), m_scale_x(1.0), m_clip_box(0,0,0,0), m_clipping(false) {} void attach(base_ren_type& ren) { m_ren = &ren; } //--------------------------------------------------------------------- void pattern(pattern_type& p) { m_pattern = &p; } pattern_type& pattern() const { return *m_pattern; } //--------------------------------------------------------------------- void reset_clipping() { m_clipping = false; } void clip_box(double x1, double y1, double x2, double y2) { m_clip_box.x1 = line_coord_sat::conv(x1); m_clip_box.y1 = line_coord_sat::conv(y1); m_clip_box.x2 = line_coord_sat::conv(x2); m_clip_box.y2 = line_coord_sat::conv(y2); m_clipping = true; } //--------------------------------------------------------------------- void scale_x(double s) { m_scale_x = s; } double scale_x() const { return m_scale_x; } //--------------------------------------------------------------------- void start_x(double s) { m_start = iround(s * line_subpixel_scale); } double start_x() const { return double(m_start) / line_subpixel_scale; } //--------------------------------------------------------------------- int subpixel_width() const { return m_pattern->line_width(); } int pattern_width() const { return m_pattern->pattern_width(); } double width() const { return double(subpixel_width()) / line_subpixel_scale; } //------------------------------------------------------------------------- void pixel(color_type* p, int x, int y) const { m_pattern->pixel(p, x, y); } //------------------------------------------------------------------------- void blend_color_hspan(int x, int y, unsigned len, const color_type* colors) { m_ren->blend_color_hspan(x, y, len, colors, 0); } //------------------------------------------------------------------------- void blend_color_vspan(int x, int y, unsigned len, const color_type* colors) { m_ren->blend_color_vspan(x, y, len, colors, 0); } //------------------------------------------------------------------------- static bool accurate_join_only() { return true; } //------------------------------------------------------------------------- template void semidot(Cmp, int, int, int, int) { } //------------------------------------------------------------------------- void pie(int, int, int, int, int, int) { } //------------------------------------------------------------------------- void line0(const line_parameters&) { } //------------------------------------------------------------------------- void line1(const line_parameters&, int, int) { } //------------------------------------------------------------------------- void line2(const line_parameters&, int, int) { } //------------------------------------------------------------------------- void line3_no_clip(const line_parameters& lp, int sx, int sy, int ex, int ey) { if(lp.len > line_max_length) { line_parameters lp1, lp2; lp.divide(lp1, lp2); int mx = lp1.x2 + (lp1.y2 - lp1.y1); int my = lp1.y2 - (lp1.x2 - lp1.x1); line3_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1, mx, my); line3_no_clip(lp2, mx, my, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1); return; } fix_degenerate_bisectrix_start(lp, &sx, &sy); fix_degenerate_bisectrix_end(lp, &ex, &ey); line_interpolator_image li(*this, lp, sx, sy, ex, ey, m_start, m_scale_x); if(li.vertical()) { while(li.step_ver()); } else { while(li.step_hor()); } m_start += uround(lp.len / m_scale_x); } //------------------------------------------------------------------------- void line3(const line_parameters& lp, int sx, int sy, int ex, int ey) { if(m_clipping) { int x1 = lp.x1; int y1 = lp.y1; int x2 = lp.x2; int y2 = lp.y2; unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); int start = m_start; if((flags & 4) == 0) { if(flags) { line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); if(flags & 1) { m_start += uround(calc_distance(lp.x1, lp.y1, x1, y1) / m_scale_x); sx = x1 + (y2 - y1); sy = y1 - (x2 - x1); } else { while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len) { sx = (lp.x1 + sx) >> 1; sy = (lp.y1 + sy) >> 1; } } if(flags & 2) { ex = x2 + (y2 - y1); ey = y2 - (x2 - x1); } else { while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len) { ex = (lp.x2 + ex) >> 1; ey = (lp.y2 + ey) >> 1; } } line3_no_clip(lp2, sx, sy, ex, ey); } else { line3_no_clip(lp, sx, sy, ex, ey); } } m_start = start + uround(lp.len / m_scale_x); } else { line3_no_clip(lp, sx, sy, ex, ey); } } private: base_ren_type* m_ren; pattern_type* m_pattern; int m_start; double m_scale_x; rect_i m_clip_box; bool m_clipping; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_scanline_p.h0000644000175000017500000002506613233644505024111 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Class scanline_p - a general purpose scanline container with packed spans. // //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates (scanline32_p) has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_P_INCLUDED #define AGG_SCANLINE_P_INCLUDED #include "agg_array.h" namespace agg24 { //=============================================================scanline_p8 // // This is a general purpose scaline container which supports the interface // used in the rasterizer::render(). See description of scanline_u8 // for details. // //------------------------------------------------------------------------ class scanline_p8 { public: typedef scanline_p8 self_type; typedef int8u cover_type; typedef int16 coord_type; //-------------------------------------------------------------------- struct span { coord_type x; coord_type len; // If negative, it's a solid span, covers is valid const cover_type* covers; }; typedef span* iterator; typedef const span* const_iterator; scanline_p8() : m_last_x(0x7FFFFFF0), m_covers(), m_cover_ptr(0), m_spans(), m_cur_span(0) { } //-------------------------------------------------------------------- void reset(int min_x, int max_x) { unsigned max_len = max_x - min_x + 3; if(max_len > m_spans.size()) { m_spans.resize(max_len); m_covers.resize(max_len); } m_last_x = 0x7FFFFFF0; m_cover_ptr = &m_covers[0]; m_cur_span = &m_spans[0]; m_cur_span->len = 0; } //-------------------------------------------------------------------- void add_cell(int x, unsigned cover) { *m_cover_ptr = (cover_type)cover; if(x == m_last_x+1 && m_cur_span->len > 0) { m_cur_span->len++; } else { m_cur_span++; m_cur_span->covers = m_cover_ptr; m_cur_span->x = (int16)x; m_cur_span->len = 1; } m_last_x = x; m_cover_ptr++; } //-------------------------------------------------------------------- void add_cells(int x, unsigned len, const cover_type* covers) { memcpy(m_cover_ptr, covers, len * sizeof(cover_type)); if(x == m_last_x+1 && m_cur_span->len > 0) { m_cur_span->len += (int16)len; } else { m_cur_span++; m_cur_span->covers = m_cover_ptr; m_cur_span->x = (int16)x; m_cur_span->len = (int16)len; } m_cover_ptr += len; m_last_x = x + len - 1; } //-------------------------------------------------------------------- void add_span(int x, unsigned len, unsigned cover) { if(x == m_last_x+1 && m_cur_span->len < 0 && cover == *m_cur_span->covers) { m_cur_span->len -= (int16)len; } else { *m_cover_ptr = (cover_type)cover; m_cur_span++; m_cur_span->covers = m_cover_ptr++; m_cur_span->x = (int16)x; m_cur_span->len = (int16)(-int(len)); } m_last_x = x + len - 1; } //-------------------------------------------------------------------- void finalize(int y) { m_y = y; } //-------------------------------------------------------------------- void reset_spans() { m_last_x = 0x7FFFFFF0; m_cover_ptr = &m_covers[0]; m_cur_span = &m_spans[0]; m_cur_span->len = 0; } //-------------------------------------------------------------------- int y() const { return m_y; } unsigned num_spans() const { return unsigned(m_cur_span - &m_spans[0]); } const_iterator begin() const { return &m_spans[1]; } private: scanline_p8(const self_type&); const self_type& operator = (const self_type&); int m_last_x; int m_y; pod_array m_covers; cover_type* m_cover_ptr; pod_array m_spans; span* m_cur_span; }; //==========================================================scanline32_p8 class scanline32_p8 { public: typedef scanline32_p8 self_type; typedef int8u cover_type; typedef int32 coord_type; struct span { span() {} span(coord_type x_, coord_type len_, const cover_type* covers_) : x(x_), len(len_), covers(covers_) {} coord_type x; coord_type len; // If negative, it's a solid span, covers is valid const cover_type* covers; }; typedef pod_bvector span_array_type; //-------------------------------------------------------------------- class const_iterator { public: const_iterator(const span_array_type& spans) : m_spans(spans), m_span_idx(0) {} const span& operator*() const { return m_spans[m_span_idx]; } const span* operator->() const { return &m_spans[m_span_idx]; } void operator ++ () { ++m_span_idx; } private: const span_array_type& m_spans; unsigned m_span_idx; }; //-------------------------------------------------------------------- scanline32_p8() : m_max_len(0), m_last_x(0x7FFFFFF0), m_covers(), m_cover_ptr(0) { } //-------------------------------------------------------------------- void reset(int min_x, int max_x) { unsigned max_len = max_x - min_x + 3; if(max_len > m_covers.size()) { m_covers.resize(max_len); } m_last_x = 0x7FFFFFF0; m_cover_ptr = &m_covers[0]; m_spans.remove_all(); } //-------------------------------------------------------------------- void add_cell(int x, unsigned cover) { *m_cover_ptr = cover_type(cover); if(x == m_last_x+1 && m_spans.size() && m_spans.last().len > 0) { m_spans.last().len++; } else { m_spans.add(span(coord_type(x), 1, m_cover_ptr)); } m_last_x = x; m_cover_ptr++; } //-------------------------------------------------------------------- void add_cells(int x, unsigned len, const cover_type* covers) { memcpy(m_cover_ptr, covers, len * sizeof(cover_type)); if(x == m_last_x+1 && m_spans.size() && m_spans.last().len > 0) { m_spans.last().len += coord_type(len); } else { m_spans.add(span(coord_type(x), coord_type(len), m_cover_ptr)); } m_cover_ptr += len; m_last_x = x + len - 1; } //-------------------------------------------------------------------- void add_span(int x, unsigned len, unsigned cover) { if(x == m_last_x+1 && m_spans.size() && m_spans.last().len < 0 && cover == *m_spans.last().covers) { m_spans.last().len -= coord_type(len); } else { *m_cover_ptr = cover_type(cover); m_spans.add(span(coord_type(x), -coord_type(len), m_cover_ptr++)); } m_last_x = x + len - 1; } //-------------------------------------------------------------------- void finalize(int y) { m_y = y; } //-------------------------------------------------------------------- void reset_spans() { m_last_x = 0x7FFFFFF0; m_cover_ptr = &m_covers[0]; m_spans.remove_all(); } //-------------------------------------------------------------------- int y() const { return m_y; } unsigned num_spans() const { return m_spans.size(); } const_iterator begin() const { return const_iterator(m_spans); } private: scanline32_p8(const self_type&); const self_type& operator = (const self_type&); unsigned m_max_len; int m_last_x; int m_y; pod_array m_covers; cover_type* m_cover_ptr; span_array_type m_spans; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vcgen_contour.h0000644000175000017500000000673413233644505024652 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_VCGEN_CONTOUR_INCLUDED #define AGG_VCGEN_CONTOUR_INCLUDED #include "agg_math_stroke.h" namespace agg24 { //----------------------------------------------------------vcgen_contour // // See Implementation agg_vcgen_contour.cpp // class vcgen_contour { enum status_e { initial, ready, outline, out_vertices, end_poly, stop }; public: typedef vertex_sequence vertex_storage; typedef pod_bvector coord_storage; vcgen_contour(); void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } void line_join(line_join_e lj) { m_stroker.line_join(lj); } void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } line_cap_e line_cap() const { return m_stroker.line_cap(); } line_join_e line_join() const { return m_stroker.line_join(); } inner_join_e inner_join() const { return m_stroker.inner_join(); } void width(double w) { m_stroker.width(m_width = w); } void miter_limit(double ml) { m_stroker.miter_limit(ml); } void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } void approximation_scale(double as) { m_stroker.approximation_scale(as); } double width() const { return m_width; } double miter_limit() const { return m_stroker.miter_limit(); } double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } double approximation_scale() const { return m_stroker.approximation_scale(); } void auto_detect_orientation(bool v) { m_auto_detect = v; } bool auto_detect_orientation() const { return m_auto_detect; } // Generator interface void remove_all(); void add_vertex(double x, double y, unsigned cmd); // Vertex Source Interface void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: vcgen_contour(const vcgen_contour&); const vcgen_contour& operator = (const vcgen_contour&); math_stroke m_stroker; double m_width; vertex_storage m_src_vertices; coord_storage m_out_vertices; status_e m_status; unsigned m_src_vertex; unsigned m_out_vertex; unsigned m_closed; unsigned m_orientation; bool m_auto_detect; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_embedded_raster_fonts.h0000644000175000017500000000424013233644505026307 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_EMBEDDED_RASTER_FONTS_INCLUDED #define AGG_EMBEDDED_RASTER_FONTS_INCLUDED #include "agg_basics.h" namespace agg24 { extern const int8u gse4x6[]; extern const int8u gse4x8[]; extern const int8u gse5x7[]; extern const int8u gse5x9[]; extern const int8u gse6x12[]; extern const int8u gse6x9[]; extern const int8u gse7x11[]; extern const int8u gse7x11_bold[]; extern const int8u gse7x15[]; extern const int8u gse7x15_bold[]; extern const int8u gse8x16[]; extern const int8u gse8x16_bold[]; extern const int8u mcs11_prop[]; extern const int8u mcs11_prop_condensed[]; extern const int8u mcs12_prop[]; extern const int8u mcs13_prop[]; extern const int8u mcs5x10_mono[]; extern const int8u mcs5x11_mono[]; extern const int8u mcs6x10_mono[]; extern const int8u mcs6x11_mono[]; extern const int8u mcs7x12_mono_high[]; extern const int8u mcs7x12_mono_low[]; extern const int8u verdana12[]; extern const int8u verdana12_bold[]; extern const int8u verdana13[]; extern const int8u verdana13_bold[]; extern const int8u verdana14[]; extern const int8u verdana14_bold[]; extern const int8u verdana16[]; extern const int8u verdana16_bold[]; extern const int8u verdana17[]; extern const int8u verdana17_bold[]; extern const int8u verdana18[]; extern const int8u verdana18_bold[]; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_bspline.h0000644000175000017500000000327513233644505024455 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CONV_BSPLINE_INCLUDED #define AGG_CONV_BSPLINE_INCLUDED #include "agg_basics.h" #include "agg_vcgen_bspline.h" #include "agg_conv_adaptor_vcgen.h" namespace agg24 { //---------------------------------------------------------conv_bspline template struct conv_bspline : public conv_adaptor_vcgen { typedef conv_adaptor_vcgen base_type; conv_bspline(VertexSource& vs) : conv_adaptor_vcgen(vs) {} void interpolation_step(double v) { base_type::generator().interpolation_step(v); } double interpolation_step() const { return base_type::generator().interpolation_step(); } private: conv_bspline(const conv_bspline&); const conv_bspline& operator = (const conv_bspline&); }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_shorten_path.h0000644000175000017500000000406413233644505024467 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SHORTEN_PATH_INCLUDED #define AGG_SHORTEN_PATH_INCLUDED #include "agg_basics.h" #include "agg_vertex_sequence.h" namespace agg24 { //===========================================================shorten_path template void shorten_path(VertexSequence& vs, double s, unsigned closed = 0) { typedef typename VertexSequence::value_type vertex_type; if(s > 0.0 && vs.size() > 1) { double d; int n = int(vs.size() - 2); while(n) { d = vs[n].dist; if(d > s) break; vs.remove_last(); s -= d; --n; } if(vs.size() < 2) { vs.remove_all(); } else { n = vs.size() - 1; vertex_type& prev = vs[n-1]; vertex_type& last = vs[n]; d = (prev.dist - s) / prev.dist; double x = prev.x + (last.x - prev.x) * d; double y = prev.y + (last.y - prev.y) * d; last.x = x; last.y = y; if(!prev(last)) vs.remove_last(); vs.close(closed != 0); } } } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_clip_polyline.h0000644000175000017500000000504513233644505025660 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // polyline clipping converter // There an optimized Liang-Basky algorithm is used. // The algorithm doesn't optimize the degenerate edges, i.e. it will never // break a closed polyline into two or more ones, instead, there will be // degenerate edges coinciding with the respective clipping boundaries. // This is a sub-optimal solution, because that optimization would require // extra, rather expensive math while the rasterizer tolerates it quite well, // without any considerable overhead. // //---------------------------------------------------------------------------- #ifndef AGG_CONV_CLIP_polyline_INCLUDED #define AGG_CONV_CLIP_polyline_INCLUDED #include "agg_basics.h" #include "agg_conv_adaptor_vpgen.h" #include "agg_vpgen_clip_polyline.h" namespace agg24 { //=======================================================conv_clip_polyline template struct conv_clip_polyline : public conv_adaptor_vpgen { typedef conv_adaptor_vpgen base_type; conv_clip_polyline(VertexSource& vs) : conv_adaptor_vpgen(vs) {} void clip_box(double x1, double y1, double x2, double y2) { base_type::vpgen().clip_box(x1, y1, x2, y2); } double x1() const { return base_type::vpgen().x1(); } double y1() const { return base_type::vpgen().y1(); } double x2() const { return base_type::vpgen().x2(); } double y2() const { return base_type::vpgen().y2(); } private: conv_clip_polyline(const conv_clip_polyline&); const conv_clip_polyline& operator = (const conv_clip_polyline&); }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_adaptor_vpgen.h0000644000175000017500000001210013233644505025635 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CONV_ADAPTOR_VPGEN_INCLUDED #define AGG_CONV_ADAPTOR_VPGEN_INCLUDED #include "agg_basics.h" namespace agg24 { //======================================================conv_adaptor_vpgen template class conv_adaptor_vpgen { public: explicit conv_adaptor_vpgen(VertexSource& source) : m_source(&source) {} void attach(VertexSource& source) { m_source = &source; } VPGen& vpgen() { return m_vpgen; } const VPGen& vpgen() const { return m_vpgen; } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: conv_adaptor_vpgen(const conv_adaptor_vpgen&); const conv_adaptor_vpgen& operator = (const conv_adaptor_vpgen&); VertexSource* m_source; VPGen m_vpgen; double m_start_x; double m_start_y; unsigned m_poly_flags; int m_vertices; }; //------------------------------------------------------------------------ template void conv_adaptor_vpgen::rewind(unsigned path_id) { m_source->rewind(path_id); m_vpgen.reset(); m_start_x = 0; m_start_y = 0; m_poly_flags = 0; m_vertices = 0; } //------------------------------------------------------------------------ template unsigned conv_adaptor_vpgen::vertex(double* x, double* y) { unsigned cmd = path_cmd_stop; for(;;) { cmd = m_vpgen.vertex(x, y); if(!is_stop(cmd)) break; if(m_poly_flags && !m_vpgen.auto_unclose()) { *x = 0.0; *y = 0.0; cmd = m_poly_flags; m_poly_flags = 0; break; } if(m_vertices < 0) { if(m_vertices < -1) { m_vertices = 0; return path_cmd_stop; } m_vpgen.move_to(m_start_x, m_start_y); m_vertices = 1; continue; } double tx, ty; cmd = m_source->vertex(&tx, &ty); if(is_vertex(cmd)) { if(is_move_to(cmd)) { if(m_vpgen.auto_close() && m_vertices > 2) { m_vpgen.line_to(m_start_x, m_start_y); m_poly_flags = path_cmd_end_poly | path_flags_close; m_start_x = tx; m_start_y = ty; m_vertices = -1; continue; } m_vpgen.move_to(tx, ty); m_start_x = tx; m_start_y = ty; m_vertices = 1; } else { m_vpgen.line_to(tx, ty); ++m_vertices; } } else { if(is_end_poly(cmd)) { m_poly_flags = cmd; if(is_closed(cmd) || m_vpgen.auto_close()) { if(m_vpgen.auto_close()) m_poly_flags |= path_flags_close; if(m_vertices > 2) { m_vpgen.line_to(m_start_x, m_start_y); } m_vertices = 0; } } else { // path_cmd_stop if(m_vpgen.auto_close() && m_vertices > 2) { m_vpgen.line_to(m_start_x, m_start_y); m_poly_flags = path_cmd_end_poly | path_flags_close; m_vertices = -2; continue; } break; } } } return cmd; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_ellipse.h0000644000175000017500000000727513233644505023435 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class ellipse // //---------------------------------------------------------------------------- #ifndef AGG_ELLIPSE_INCLUDED #define AGG_ELLIPSE_INCLUDED #include "agg_basics.h" #include namespace agg24 { //----------------------------------------------------------------ellipse class ellipse { public: ellipse() : m_x(0.0), m_y(0.0), m_rx(1.0), m_ry(1.0), m_scale(1.0), m_num(4), m_step(0), m_cw(false) {} ellipse(double x, double y, double rx, double ry, unsigned num_steps=0, bool cw=false) : m_x(x), m_y(y), m_rx(rx), m_ry(ry), m_scale(1.0), m_num(num_steps), m_step(0), m_cw(cw) { if(m_num == 0) calc_num_steps(); } void init(double x, double y, double rx, double ry, unsigned num_steps=0, bool cw=false); void approximation_scale(double scale); void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: void calc_num_steps(); double m_x; double m_y; double m_rx; double m_ry; double m_scale; unsigned m_num; unsigned m_step; bool m_cw; }; //------------------------------------------------------------------------ inline void ellipse::init(double x, double y, double rx, double ry, unsigned num_steps, bool cw) { m_x = x; m_y = y; m_rx = rx; m_ry = ry; m_num = num_steps; m_step = 0; m_cw = cw; if(m_num == 0) calc_num_steps(); } //------------------------------------------------------------------------ inline void ellipse::approximation_scale(double scale) { m_scale = scale; calc_num_steps(); } //------------------------------------------------------------------------ inline void ellipse::calc_num_steps() { double ra = (fabs(m_rx) + fabs(m_ry)) / 2; double da = acos(ra / (ra + 0.125 / m_scale)) * 2; m_num = uround(2*pi / da); } //------------------------------------------------------------------------ inline void ellipse::rewind(unsigned) { m_step = 0; } //------------------------------------------------------------------------ inline unsigned ellipse::vertex(double* x, double* y) { if(m_step == m_num) { ++m_step; return path_cmd_end_poly | path_flags_close | path_flags_ccw; } if(m_step > m_num) return path_cmd_stop; double angle = double(m_step) / double(m_num) * 2.0 * pi; if(m_cw) angle = 2.0 * pi - angle; *x = m_x + cos(angle) * m_rx; *y = m_y + sin(angle) * m_ry; m_step++; return ((m_step == 1) ? path_cmd_move_to : path_cmd_line_to); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_contour.h0000644000175000017500000000565313233644505024514 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // conv_stroke // //---------------------------------------------------------------------------- #ifndef AGG_CONV_CONTOUR_INCLUDED #define AGG_CONV_CONTOUR_INCLUDED #include "agg_basics.h" #include "agg_vcgen_contour.h" #include "agg_conv_adaptor_vcgen.h" namespace agg24 { //-----------------------------------------------------------conv_contour template struct conv_contour : public conv_adaptor_vcgen { typedef conv_adaptor_vcgen base_type; conv_contour(VertexSource& vs) : conv_adaptor_vcgen(vs) { } void line_join(line_join_e lj) { base_type::generator().line_join(lj); } void inner_join(inner_join_e ij) { base_type::generator().inner_join(ij); } void width(double w) { base_type::generator().width(w); } void miter_limit(double ml) { base_type::generator().miter_limit(ml); } void miter_limit_theta(double t) { base_type::generator().miter_limit_theta(t); } void inner_miter_limit(double ml) { base_type::generator().inner_miter_limit(ml); } void approximation_scale(double as) { base_type::generator().approximation_scale(as); } void auto_detect_orientation(bool v) { base_type::generator().auto_detect_orientation(v); } line_join_e line_join() const { return base_type::generator().line_join(); } inner_join_e inner_join() const { return base_type::generator().inner_join(); } double width() const { return base_type::generator().width(); } double miter_limit() const { return base_type::generator().miter_limit(); } double inner_miter_limit() const { return base_type::generator().inner_miter_limit(); } double approximation_scale() const { return base_type::generator().approximation_scale(); } bool auto_detect_orientation() const { return base_type::generator().auto_detect_orientation(); } private: conv_contour(const conv_contour&); const conv_contour& operator = (const conv_contour&); }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_renderer_outline_aa.h0000644000175000017500000017752413233644505026013 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_RENDERER_OUTLINE_AA_INCLUDED #define AGG_RENDERER_OUTLINE_AA_INCLUDED #include "agg_array.h" #include "agg_math.h" #include "agg_line_aa_basics.h" #include "agg_dda_line.h" #include "agg_ellipse_bresenham.h" #include "agg_renderer_base.h" #include "agg_gamma_functions.h" #include "agg_clip_liang_barsky.h" namespace agg24 { //===================================================distance_interpolator0 class distance_interpolator0 { public: //--------------------------------------------------------------------- distance_interpolator0() {} distance_interpolator0(int x1, int y1, int x2, int y2, int x, int y) : m_dx(line_mr(x2) - line_mr(x1)), m_dy(line_mr(y2) - line_mr(y1)), m_dist((line_mr(x + line_subpixel_scale/2) - line_mr(x2)) * m_dy - (line_mr(y + line_subpixel_scale/2) - line_mr(y2)) * m_dx) { m_dx <<= line_mr_subpixel_shift; m_dy <<= line_mr_subpixel_shift; } //--------------------------------------------------------------------- void inc_x() { m_dist += m_dy; } int dist() const { return m_dist; } private: //--------------------------------------------------------------------- int m_dx; int m_dy; int m_dist; }; //==================================================distance_interpolator00 class distance_interpolator00 { public: //--------------------------------------------------------------------- distance_interpolator00() {} distance_interpolator00(int xc, int yc, int x1, int y1, int x2, int y2, int x, int y) : m_dx1(line_mr(x1) - line_mr(xc)), m_dy1(line_mr(y1) - line_mr(yc)), m_dx2(line_mr(x2) - line_mr(xc)), m_dy2(line_mr(y2) - line_mr(yc)), m_dist1((line_mr(x + line_subpixel_scale/2) - line_mr(x1)) * m_dy1 - (line_mr(y + line_subpixel_scale/2) - line_mr(y1)) * m_dx1), m_dist2((line_mr(x + line_subpixel_scale/2) - line_mr(x2)) * m_dy2 - (line_mr(y + line_subpixel_scale/2) - line_mr(y2)) * m_dx2) { m_dx1 <<= line_mr_subpixel_shift; m_dy1 <<= line_mr_subpixel_shift; m_dx2 <<= line_mr_subpixel_shift; m_dy2 <<= line_mr_subpixel_shift; } //--------------------------------------------------------------------- void inc_x() { m_dist1 += m_dy1; m_dist2 += m_dy2; } int dist1() const { return m_dist1; } int dist2() const { return m_dist2; } private: //--------------------------------------------------------------------- int m_dx1; int m_dy1; int m_dx2; int m_dy2; int m_dist1; int m_dist2; }; //===================================================distance_interpolator1 class distance_interpolator1 { public: //--------------------------------------------------------------------- distance_interpolator1() {} distance_interpolator1(int x1, int y1, int x2, int y2, int x, int y) : m_dx(x2 - x1), m_dy(y2 - y1), m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - double(y + line_subpixel_scale/2 - y2) * double(m_dx))) { m_dx <<= line_subpixel_shift; m_dy <<= line_subpixel_shift; } //--------------------------------------------------------------------- void inc_x() { m_dist += m_dy; } void dec_x() { m_dist -= m_dy; } void inc_y() { m_dist -= m_dx; } void dec_y() { m_dist += m_dx; } //--------------------------------------------------------------------- void inc_x(int dy) { m_dist += m_dy; if(dy > 0) m_dist -= m_dx; if(dy < 0) m_dist += m_dx; } //--------------------------------------------------------------------- void dec_x(int dy) { m_dist -= m_dy; if(dy > 0) m_dist -= m_dx; if(dy < 0) m_dist += m_dx; } //--------------------------------------------------------------------- void inc_y(int dx) { m_dist -= m_dx; if(dx > 0) m_dist += m_dy; if(dx < 0) m_dist -= m_dy; } void dec_y(int dx) //--------------------------------------------------------------------- { m_dist += m_dx; if(dx > 0) m_dist += m_dy; if(dx < 0) m_dist -= m_dy; } //--------------------------------------------------------------------- int dist() const { return m_dist; } int dx() const { return m_dx; } int dy() const { return m_dy; } private: //--------------------------------------------------------------------- int m_dx; int m_dy; int m_dist; }; //===================================================distance_interpolator2 class distance_interpolator2 { public: //--------------------------------------------------------------------- distance_interpolator2() {} distance_interpolator2(int x1, int y1, int x2, int y2, int sx, int sy, int x, int y) : m_dx(x2 - x1), m_dy(y2 - y1), m_dx_start(line_mr(sx) - line_mr(x1)), m_dy_start(line_mr(sy) - line_mr(y1)), m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - double(y + line_subpixel_scale/2 - y2) * double(m_dx))), m_dist_start((line_mr(x + line_subpixel_scale/2) - line_mr(sx)) * m_dy_start - (line_mr(y + line_subpixel_scale/2) - line_mr(sy)) * m_dx_start) { m_dx <<= line_subpixel_shift; m_dy <<= line_subpixel_shift; m_dx_start <<= line_mr_subpixel_shift; m_dy_start <<= line_mr_subpixel_shift; } distance_interpolator2(int x1, int y1, int x2, int y2, int ex, int ey, int x, int y, int) : m_dx(x2 - x1), m_dy(y2 - y1), m_dx_start(line_mr(ex) - line_mr(x2)), m_dy_start(line_mr(ey) - line_mr(y2)), m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - double(y + line_subpixel_scale/2 - y2) * double(m_dx))), m_dist_start((line_mr(x + line_subpixel_scale/2) - line_mr(ex)) * m_dy_start - (line_mr(y + line_subpixel_scale/2) - line_mr(ey)) * m_dx_start) { m_dx <<= line_subpixel_shift; m_dy <<= line_subpixel_shift; m_dx_start <<= line_mr_subpixel_shift; m_dy_start <<= line_mr_subpixel_shift; } //--------------------------------------------------------------------- void inc_x() { m_dist += m_dy; m_dist_start += m_dy_start; } void dec_x() { m_dist -= m_dy; m_dist_start -= m_dy_start; } void inc_y() { m_dist -= m_dx; m_dist_start -= m_dx_start; } void dec_y() { m_dist += m_dx; m_dist_start += m_dx_start; } //--------------------------------------------------------------------- void inc_x(int dy) { m_dist += m_dy; m_dist_start += m_dy_start; if(dy > 0) { m_dist -= m_dx; m_dist_start -= m_dx_start; } if(dy < 0) { m_dist += m_dx; m_dist_start += m_dx_start; } } //--------------------------------------------------------------------- void dec_x(int dy) { m_dist -= m_dy; m_dist_start -= m_dy_start; if(dy > 0) { m_dist -= m_dx; m_dist_start -= m_dx_start; } if(dy < 0) { m_dist += m_dx; m_dist_start += m_dx_start; } } //--------------------------------------------------------------------- void inc_y(int dx) { m_dist -= m_dx; m_dist_start -= m_dx_start; if(dx > 0) { m_dist += m_dy; m_dist_start += m_dy_start; } if(dx < 0) { m_dist -= m_dy; m_dist_start -= m_dy_start; } } //--------------------------------------------------------------------- void dec_y(int dx) { m_dist += m_dx; m_dist_start += m_dx_start; if(dx > 0) { m_dist += m_dy; m_dist_start += m_dy_start; } if(dx < 0) { m_dist -= m_dy; m_dist_start -= m_dy_start; } } //--------------------------------------------------------------------- int dist() const { return m_dist; } int dist_start() const { return m_dist_start; } int dist_end() const { return m_dist_start; } //--------------------------------------------------------------------- int dx() const { return m_dx; } int dy() const { return m_dy; } int dx_start() const { return m_dx_start; } int dy_start() const { return m_dy_start; } int dx_end() const { return m_dx_start; } int dy_end() const { return m_dy_start; } private: //--------------------------------------------------------------------- int m_dx; int m_dy; int m_dx_start; int m_dy_start; int m_dist; int m_dist_start; }; //===================================================distance_interpolator3 class distance_interpolator3 { public: //--------------------------------------------------------------------- distance_interpolator3() {} distance_interpolator3(int x1, int y1, int x2, int y2, int sx, int sy, int ex, int ey, int x, int y) : m_dx(x2 - x1), m_dy(y2 - y1), m_dx_start(line_mr(sx) - line_mr(x1)), m_dy_start(line_mr(sy) - line_mr(y1)), m_dx_end(line_mr(ex) - line_mr(x2)), m_dy_end(line_mr(ey) - line_mr(y2)), m_dist(iround(double(x + line_subpixel_scale/2 - x2) * double(m_dy) - double(y + line_subpixel_scale/2 - y2) * double(m_dx))), m_dist_start((line_mr(x + line_subpixel_scale/2) - line_mr(sx)) * m_dy_start - (line_mr(y + line_subpixel_scale/2) - line_mr(sy)) * m_dx_start), m_dist_end((line_mr(x + line_subpixel_scale/2) - line_mr(ex)) * m_dy_end - (line_mr(y + line_subpixel_scale/2) - line_mr(ey)) * m_dx_end) { m_dx <<= line_subpixel_shift; m_dy <<= line_subpixel_shift; m_dx_start <<= line_mr_subpixel_shift; m_dy_start <<= line_mr_subpixel_shift; m_dx_end <<= line_mr_subpixel_shift; m_dy_end <<= line_mr_subpixel_shift; } //--------------------------------------------------------------------- void inc_x() { m_dist += m_dy; m_dist_start += m_dy_start; m_dist_end += m_dy_end; } void dec_x() { m_dist -= m_dy; m_dist_start -= m_dy_start; m_dist_end -= m_dy_end; } void inc_y() { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_end -= m_dx_end; } void dec_y() { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_end += m_dx_end; } //--------------------------------------------------------------------- void inc_x(int dy) { m_dist += m_dy; m_dist_start += m_dy_start; m_dist_end += m_dy_end; if(dy > 0) { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_end -= m_dx_end; } if(dy < 0) { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_end += m_dx_end; } } //--------------------------------------------------------------------- void dec_x(int dy) { m_dist -= m_dy; m_dist_start -= m_dy_start; m_dist_end -= m_dy_end; if(dy > 0) { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_end -= m_dx_end; } if(dy < 0) { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_end += m_dx_end; } } //--------------------------------------------------------------------- void inc_y(int dx) { m_dist -= m_dx; m_dist_start -= m_dx_start; m_dist_end -= m_dx_end; if(dx > 0) { m_dist += m_dy; m_dist_start += m_dy_start; m_dist_end += m_dy_end; } if(dx < 0) { m_dist -= m_dy; m_dist_start -= m_dy_start; m_dist_end -= m_dy_end; } } //--------------------------------------------------------------------- void dec_y(int dx) { m_dist += m_dx; m_dist_start += m_dx_start; m_dist_end += m_dx_end; if(dx > 0) { m_dist += m_dy; m_dist_start += m_dy_start; m_dist_end += m_dy_end; } if(dx < 0) { m_dist -= m_dy; m_dist_start -= m_dy_start; m_dist_end -= m_dy_end; } } //--------------------------------------------------------------------- int dist() const { return m_dist; } int dist_start() const { return m_dist_start; } int dist_end() const { return m_dist_end; } //--------------------------------------------------------------------- int dx() const { return m_dx; } int dy() const { return m_dy; } int dx_start() const { return m_dx_start; } int dy_start() const { return m_dy_start; } int dx_end() const { return m_dx_end; } int dy_end() const { return m_dy_end; } private: //--------------------------------------------------------------------- int m_dx; int m_dy; int m_dx_start; int m_dy_start; int m_dx_end; int m_dy_end; int m_dist; int m_dist_start; int m_dist_end; }; //================================================line_interpolator_aa_base template class line_interpolator_aa_base { public: typedef Renderer renderer_type; typedef typename Renderer::color_type color_type; //--------------------------------------------------------------------- enum max_half_width_e { max_half_width = 64 }; //--------------------------------------------------------------------- line_interpolator_aa_base(renderer_type& ren, line_parameters& lp) : m_lp(&lp), m_li(lp.vertical ? line_dbl_hr(lp.x2 - lp.x1) : line_dbl_hr(lp.y2 - lp.y1), lp.vertical ? abs(lp.y2 - lp.y1) : abs(lp.x2 - lp.x1) + 1), m_ren(ren), m_len((lp.vertical == (lp.inc > 0)) ? -lp.len : lp.len), m_x(lp.x1 >> line_subpixel_shift), m_y(lp.y1 >> line_subpixel_shift), m_old_x(m_x), m_old_y(m_y), m_count((lp.vertical ? abs((lp.y2 >> line_subpixel_shift) - m_y) : abs((lp.x2 >> line_subpixel_shift) - m_x))), m_width(ren.subpixel_width()), //m_max_extent(m_width >> (line_subpixel_shift - 2)), m_max_extent((m_width + line_subpixel_mask) >> line_subpixel_shift), m_step(0) { agg24::dda2_line_interpolator li(0, lp.vertical ? (lp.dy << agg24::line_subpixel_shift) : (lp.dx << agg24::line_subpixel_shift), lp.len); unsigned i; int stop = m_width + line_subpixel_scale * 2; for(i = 0; i < max_half_width; ++i) { m_dist[i] = li.y(); if(m_dist[i] >= stop) break; ++li; } m_dist[i++] = 0x7FFF0000; } //--------------------------------------------------------------------- template int step_hor_base(DI& di) { ++m_li; m_x += m_lp->inc; m_y = (m_lp->y1 + m_li.y()) >> line_subpixel_shift; if(m_lp->inc > 0) di.inc_x(m_y - m_old_y); else di.dec_x(m_y - m_old_y); m_old_y = m_y; return di.dist() / m_len; } //--------------------------------------------------------------------- template int step_ver_base(DI& di) { ++m_li; m_y += m_lp->inc; m_x = (m_lp->x1 + m_li.y()) >> line_subpixel_shift; if(m_lp->inc > 0) di.inc_y(m_x - m_old_x); else di.dec_y(m_x - m_old_x); m_old_x = m_x; return di.dist() / m_len; } //--------------------------------------------------------------------- bool vertical() const { return m_lp->vertical; } int width() const { return m_width; } int count() const { return m_count; } private: line_interpolator_aa_base(const line_interpolator_aa_base&); const line_interpolator_aa_base& operator = (const line_interpolator_aa_base&); protected: line_parameters* m_lp; dda2_line_interpolator m_li; renderer_type& m_ren; int m_len; int m_x; int m_y; int m_old_x; int m_old_y; int m_count; int m_width; int m_max_extent; int m_step; int m_dist[max_half_width + 1]; cover_type m_covers[max_half_width * 2 + 4]; }; //====================================================line_interpolator_aa0 template class line_interpolator_aa0 : public line_interpolator_aa_base { public: typedef Renderer renderer_type; typedef typename Renderer::color_type color_type; typedef line_interpolator_aa_base base_type; //--------------------------------------------------------------------- line_interpolator_aa0(renderer_type& ren, line_parameters& lp) : line_interpolator_aa_base(ren, lp), m_di(lp.x1, lp.y1, lp.x2, lp.y2, lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask) { base_type::m_li.adjust_forward(); } //--------------------------------------------------------------------- bool step_hor() { int dist; int dy; int s1 = base_type::step_hor_base(m_di); cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; cover_type* p1 = p0; *p1++ = (cover_type)base_type::m_ren.cover(s1); dy = 1; while((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) { *p1++ = (cover_type)base_type::m_ren.cover(dist); ++dy; } dy = 1; while((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) { *--p0 = (cover_type)base_type::m_ren.cover(dist); ++dy; } base_type::m_ren.blend_solid_vspan(base_type::m_x, base_type::m_y - dy + 1, unsigned(p1 - p0), p0); return ++base_type::m_step < base_type::m_count; } //--------------------------------------------------------------------- bool step_ver() { int dist; int dx; int s1 = base_type::step_ver_base(m_di); cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; cover_type* p1 = p0; *p1++ = (cover_type)base_type::m_ren.cover(s1); dx = 1; while((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) { *p1++ = (cover_type)base_type::m_ren.cover(dist); ++dx; } dx = 1; while((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) { *--p0 = (cover_type)base_type::m_ren.cover(dist); ++dx; } base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, base_type::m_y, unsigned(p1 - p0), p0); return ++base_type::m_step < base_type::m_count; } private: line_interpolator_aa0(const line_interpolator_aa0&); const line_interpolator_aa0& operator = (const line_interpolator_aa0&); //--------------------------------------------------------------------- distance_interpolator1 m_di; }; //====================================================line_interpolator_aa1 template class line_interpolator_aa1 : public line_interpolator_aa_base { public: typedef Renderer renderer_type; typedef typename Renderer::color_type color_type; typedef line_interpolator_aa_base base_type; //--------------------------------------------------------------------- line_interpolator_aa1(renderer_type& ren, line_parameters& lp, int sx, int sy) : line_interpolator_aa_base(ren, lp), m_di(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy, lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask) { int dist1_start; int dist2_start; int npix = 1; if(lp.vertical) { do { --base_type::m_li; base_type::m_y -= lp.inc; base_type::m_x = (base_type::m_lp->x1 + base_type::m_li.y()) >> line_subpixel_shift; if(lp.inc > 0) m_di.dec_y(base_type::m_x - base_type::m_old_x); else m_di.inc_y(base_type::m_x - base_type::m_old_x); base_type::m_old_x = base_type::m_x; dist1_start = dist2_start = m_di.dist_start(); int dx = 0; if(dist1_start < 0) ++npix; do { dist1_start += m_di.dy_start(); dist2_start -= m_di.dy_start(); if(dist1_start < 0) ++npix; if(dist2_start < 0) ++npix; ++dx; } while(base_type::m_dist[dx] <= base_type::m_width); --base_type::m_step; if(npix == 0) break; npix = 0; } while(base_type::m_step >= -base_type::m_max_extent); } else { do { --base_type::m_li; base_type::m_x -= lp.inc; base_type::m_y = (base_type::m_lp->y1 + base_type::m_li.y()) >> line_subpixel_shift; if(lp.inc > 0) m_di.dec_x(base_type::m_y - base_type::m_old_y); else m_di.inc_x(base_type::m_y - base_type::m_old_y); base_type::m_old_y = base_type::m_y; dist1_start = dist2_start = m_di.dist_start(); int dy = 0; if(dist1_start < 0) ++npix; do { dist1_start -= m_di.dx_start(); dist2_start += m_di.dx_start(); if(dist1_start < 0) ++npix; if(dist2_start < 0) ++npix; ++dy; } while(base_type::m_dist[dy] <= base_type::m_width); --base_type::m_step; if(npix == 0) break; npix = 0; } while(base_type::m_step >= -base_type::m_max_extent); } base_type::m_li.adjust_forward(); } //--------------------------------------------------------------------- bool step_hor() { int dist_start; int dist; int dy; int s1 = base_type::step_hor_base(m_di); dist_start = m_di.dist_start(); cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; cover_type* p1 = p0; *p1 = 0; if(dist_start <= 0) { *p1 = (cover_type)base_type::m_ren.cover(s1); } ++p1; dy = 1; while((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) { dist_start -= m_di.dx_start(); *p1 = 0; if(dist_start <= 0) { *p1 = (cover_type)base_type::m_ren.cover(dist); } ++p1; ++dy; } dy = 1; dist_start = m_di.dist_start(); while((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) { dist_start += m_di.dx_start(); *--p0 = 0; if(dist_start <= 0) { *p0 = (cover_type)base_type::m_ren.cover(dist); } ++dy; } base_type::m_ren.blend_solid_vspan(base_type::m_x, base_type::m_y - dy + 1, unsigned(p1 - p0), p0); return ++base_type::m_step < base_type::m_count; } //--------------------------------------------------------------------- bool step_ver() { int dist_start; int dist; int dx; int s1 = base_type::step_ver_base(m_di); cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; cover_type* p1 = p0; dist_start = m_di.dist_start(); *p1 = 0; if(dist_start <= 0) { *p1 = (cover_type)base_type::m_ren.cover(s1); } ++p1; dx = 1; while((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) { dist_start += m_di.dy_start(); *p1 = 0; if(dist_start <= 0) { *p1 = (cover_type)base_type::m_ren.cover(dist); } ++p1; ++dx; } dx = 1; dist_start = m_di.dist_start(); while((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) { dist_start -= m_di.dy_start(); *--p0 = 0; if(dist_start <= 0) { *p0 = (cover_type)base_type::m_ren.cover(dist); } ++dx; } base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, base_type::m_y, unsigned(p1 - p0), p0); return ++base_type::m_step < base_type::m_count; } private: line_interpolator_aa1(const line_interpolator_aa1&); const line_interpolator_aa1& operator = (const line_interpolator_aa1&); //--------------------------------------------------------------------- distance_interpolator2 m_di; }; //====================================================line_interpolator_aa2 template class line_interpolator_aa2 : public line_interpolator_aa_base { public: typedef Renderer renderer_type; typedef typename Renderer::color_type color_type; typedef line_interpolator_aa_base base_type; //--------------------------------------------------------------------- line_interpolator_aa2(renderer_type& ren, line_parameters& lp, int ex, int ey) : line_interpolator_aa_base(ren, lp), m_di(lp.x1, lp.y1, lp.x2, lp.y2, ex, ey, lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask, 0) { base_type::m_li.adjust_forward(); base_type::m_step -= base_type::m_max_extent; } //--------------------------------------------------------------------- bool step_hor() { int dist_end; int dist; int dy; int s1 = base_type::step_hor_base(m_di); cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; cover_type* p1 = p0; dist_end = m_di.dist_end(); int npix = 0; *p1 = 0; if(dist_end > 0) { *p1 = (cover_type)base_type::m_ren.cover(s1); ++npix; } ++p1; dy = 1; while((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) { dist_end -= m_di.dx_end(); *p1 = 0; if(dist_end > 0) { *p1 = (cover_type)base_type::m_ren.cover(dist); ++npix; } ++p1; ++dy; } dy = 1; dist_end = m_di.dist_end(); while((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) { dist_end += m_di.dx_end(); *--p0 = 0; if(dist_end > 0) { *p0 = (cover_type)base_type::m_ren.cover(dist); ++npix; } ++dy; } base_type::m_ren.blend_solid_vspan(base_type::m_x, base_type::m_y - dy + 1, unsigned(p1 - p0), p0); return npix && ++base_type::m_step < base_type::m_count; } //--------------------------------------------------------------------- bool step_ver() { int dist_end; int dist; int dx; int s1 = base_type::step_ver_base(m_di); cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; cover_type* p1 = p0; dist_end = m_di.dist_end(); int npix = 0; *p1 = 0; if(dist_end > 0) { *p1 = (cover_type)base_type::m_ren.cover(s1); ++npix; } ++p1; dx = 1; while((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) { dist_end += m_di.dy_end(); *p1 = 0; if(dist_end > 0) { *p1 = (cover_type)base_type::m_ren.cover(dist); ++npix; } ++p1; ++dx; } dx = 1; dist_end = m_di.dist_end(); while((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) { dist_end -= m_di.dy_end(); *--p0 = 0; if(dist_end > 0) { *p0 = (cover_type)base_type::m_ren.cover(dist); ++npix; } ++dx; } base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, base_type::m_y, unsigned(p1 - p0), p0); return npix && ++base_type::m_step < base_type::m_count; } private: line_interpolator_aa2(const line_interpolator_aa2&); const line_interpolator_aa2& operator = (const line_interpolator_aa2&); //--------------------------------------------------------------------- distance_interpolator2 m_di; }; //====================================================line_interpolator_aa3 template class line_interpolator_aa3 : public line_interpolator_aa_base { public: typedef Renderer renderer_type; typedef typename Renderer::color_type color_type; typedef line_interpolator_aa_base base_type; //--------------------------------------------------------------------- line_interpolator_aa3(renderer_type& ren, line_parameters& lp, int sx, int sy, int ex, int ey) : line_interpolator_aa_base(ren, lp), m_di(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy, ex, ey, lp.x1 & ~line_subpixel_mask, lp.y1 & ~line_subpixel_mask) { int dist1_start; int dist2_start; int npix = 1; if(lp.vertical) { do { --base_type::m_li; base_type::m_y -= lp.inc; base_type::m_x = (base_type::m_lp->x1 + base_type::m_li.y()) >> line_subpixel_shift; if(lp.inc > 0) m_di.dec_y(base_type::m_x - base_type::m_old_x); else m_di.inc_y(base_type::m_x - base_type::m_old_x); base_type::m_old_x = base_type::m_x; dist1_start = dist2_start = m_di.dist_start(); int dx = 0; if(dist1_start < 0) ++npix; do { dist1_start += m_di.dy_start(); dist2_start -= m_di.dy_start(); if(dist1_start < 0) ++npix; if(dist2_start < 0) ++npix; ++dx; } while(base_type::m_dist[dx] <= base_type::m_width); if(npix == 0) break; npix = 0; } while(--base_type::m_step >= -base_type::m_max_extent); } else { do { --base_type::m_li; base_type::m_x -= lp.inc; base_type::m_y = (base_type::m_lp->y1 + base_type::m_li.y()) >> line_subpixel_shift; if(lp.inc > 0) m_di.dec_x(base_type::m_y - base_type::m_old_y); else m_di.inc_x(base_type::m_y - base_type::m_old_y); base_type::m_old_y = base_type::m_y; dist1_start = dist2_start = m_di.dist_start(); int dy = 0; if(dist1_start < 0) ++npix; do { dist1_start -= m_di.dx_start(); dist2_start += m_di.dx_start(); if(dist1_start < 0) ++npix; if(dist2_start < 0) ++npix; ++dy; } while(base_type::m_dist[dy] <= base_type::m_width); if(npix == 0) break; npix = 0; } while(--base_type::m_step >= -base_type::m_max_extent); } base_type::m_li.adjust_forward(); base_type::m_step -= base_type::m_max_extent; } //--------------------------------------------------------------------- bool step_hor() { int dist_start; int dist_end; int dist; int dy; int s1 = base_type::step_hor_base(m_di); cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; cover_type* p1 = p0; dist_start = m_di.dist_start(); dist_end = m_di.dist_end(); int npix = 0; *p1 = 0; if(dist_end > 0) { if(dist_start <= 0) { *p1 = (cover_type)base_type::m_ren.cover(s1); } ++npix; } ++p1; dy = 1; while((dist = base_type::m_dist[dy] - s1) <= base_type::m_width) { dist_start -= m_di.dx_start(); dist_end -= m_di.dx_end(); *p1 = 0; if(dist_end > 0 && dist_start <= 0) { *p1 = (cover_type)base_type::m_ren.cover(dist); ++npix; } ++p1; ++dy; } dy = 1; dist_start = m_di.dist_start(); dist_end = m_di.dist_end(); while((dist = base_type::m_dist[dy] + s1) <= base_type::m_width) { dist_start += m_di.dx_start(); dist_end += m_di.dx_end(); *--p0 = 0; if(dist_end > 0 && dist_start <= 0) { *p0 = (cover_type)base_type::m_ren.cover(dist); ++npix; } ++dy; } base_type::m_ren.blend_solid_vspan(base_type::m_x, base_type::m_y - dy + 1, unsigned(p1 - p0), p0); return npix && ++base_type::m_step < base_type::m_count; } //--------------------------------------------------------------------- bool step_ver() { int dist_start; int dist_end; int dist; int dx; int s1 = base_type::step_ver_base(m_di); cover_type* p0 = base_type::m_covers + base_type::max_half_width + 2; cover_type* p1 = p0; dist_start = m_di.dist_start(); dist_end = m_di.dist_end(); int npix = 0; *p1 = 0; if(dist_end > 0) { if(dist_start <= 0) { *p1 = (cover_type)base_type::m_ren.cover(s1); } ++npix; } ++p1; dx = 1; while((dist = base_type::m_dist[dx] - s1) <= base_type::m_width) { dist_start += m_di.dy_start(); dist_end += m_di.dy_end(); *p1 = 0; if(dist_end > 0 && dist_start <= 0) { *p1 = (cover_type)base_type::m_ren.cover(dist); ++npix; } ++p1; ++dx; } dx = 1; dist_start = m_di.dist_start(); dist_end = m_di.dist_end(); while((dist = base_type::m_dist[dx] + s1) <= base_type::m_width) { dist_start -= m_di.dy_start(); dist_end -= m_di.dy_end(); *--p0 = 0; if(dist_end > 0 && dist_start <= 0) { *p0 = (cover_type)base_type::m_ren.cover(dist); ++npix; } ++dx; } base_type::m_ren.blend_solid_hspan(base_type::m_x - dx + 1, base_type::m_y, unsigned(p1 - p0), p0); return npix && ++base_type::m_step < base_type::m_count; } private: line_interpolator_aa3(const line_interpolator_aa3&); const line_interpolator_aa3& operator = (const line_interpolator_aa3&); //--------------------------------------------------------------------- distance_interpolator3 m_di; }; //==========================================================line_profile_aa // // See Implementation agg_line_profile_aa.cpp // class line_profile_aa { public: //--------------------------------------------------------------------- typedef int8u value_type; enum subpixel_scale_e { subpixel_shift = line_subpixel_shift, subpixel_scale = 1 << subpixel_shift, subpixel_mask = subpixel_scale - 1 }; enum aa_scale_e { aa_shift = 8, aa_scale = 1 << aa_shift, aa_mask = aa_scale - 1 }; //--------------------------------------------------------------------- line_profile_aa() : m_subpixel_width(0), m_min_width(1.0), m_smoother_width(1.0) { int i; for(i = 0; i < aa_scale; i++) m_gamma[i] = (value_type)i; } //--------------------------------------------------------------------- template line_profile_aa(double w, const GammaF& gamma_function) : m_subpixel_width(0), m_min_width(1.0), m_smoother_width(1.0) { gamma(gamma_function); width(w); } //--------------------------------------------------------------------- void min_width(double w) { m_min_width = w; } void smoother_width(double w) { m_smoother_width = w; } //--------------------------------------------------------------------- template void gamma(const GammaF& gamma_function) { int i; for(i = 0; i < aa_scale; i++) { m_gamma[i] = value_type( uround(gamma_function(double(i) / aa_mask) * aa_mask)); } } void width(double w); unsigned profile_size() const { return m_profile.size(); } int subpixel_width() const { return m_subpixel_width; } //--------------------------------------------------------------------- double min_width() const { return m_min_width; } double smoother_width() const { return m_smoother_width; } //--------------------------------------------------------------------- value_type value(int dist) const { return m_profile[dist + subpixel_scale*2]; } private: line_profile_aa(const line_profile_aa&); const line_profile_aa& operator = (const line_profile_aa&); value_type* profile(double w); void set(double center_width, double smoother_width); //--------------------------------------------------------------------- pod_array m_profile; value_type m_gamma[aa_scale]; int m_subpixel_width; double m_min_width; double m_smoother_width; }; //======================================================renderer_outline_aa template class renderer_outline_aa { public: //--------------------------------------------------------------------- typedef BaseRenderer base_ren_type; typedef renderer_outline_aa self_type; typedef typename base_ren_type::color_type color_type; //--------------------------------------------------------------------- renderer_outline_aa(base_ren_type& ren, line_profile_aa& prof) : m_ren(&ren), m_profile(&prof), m_clip_box(0,0,0,0), m_clipping(false) {} void attach(base_ren_type& ren) { m_ren = &ren; } //--------------------------------------------------------------------- void color(const color_type& c) { m_color = c; } const color_type& color() const { return m_color; } //--------------------------------------------------------------------- void profile(line_profile_aa& prof) { m_profile = &prof; } line_profile_aa& profile() const { return *m_profile; } line_profile_aa& profile() { return *m_profile; } //--------------------------------------------------------------------- int subpixel_width() const { return m_profile->subpixel_width(); } //--------------------------------------------------------------------- void reset_clipping() { m_clipping = false; } void clip_box(double x1, double y1, double x2, double y2) { m_clip_box.x1 = line_coord_sat::conv(x1); m_clip_box.y1 = line_coord_sat::conv(y1); m_clip_box.x2 = line_coord_sat::conv(x2); m_clip_box.y2 = line_coord_sat::conv(y2); m_clipping = true; } //--------------------------------------------------------------------- int cover(int d) const { return m_profile->value(d); } //------------------------------------------------------------------------- void blend_solid_hspan(int x, int y, unsigned len, const cover_type* covers) { m_ren->blend_solid_hspan(x, y, len, m_color, covers); } //------------------------------------------------------------------------- void blend_solid_vspan(int x, int y, unsigned len, const cover_type* covers) { m_ren->blend_solid_vspan(x, y, len, m_color, covers); } //------------------------------------------------------------------------- static bool accurate_join_only() { return false; } //------------------------------------------------------------------------- template void semidot_hline(Cmp cmp, int xc1, int yc1, int xc2, int yc2, int x1, int y1, int x2) { cover_type covers[line_interpolator_aa_base::max_half_width * 2 + 4]; cover_type* p0 = covers; cover_type* p1 = covers; int x = x1 << line_subpixel_shift; int y = y1 << line_subpixel_shift; int w = subpixel_width(); distance_interpolator0 di(xc1, yc1, xc2, yc2, x, y); x += line_subpixel_scale/2; y += line_subpixel_scale/2; int x0 = x1; int dx = x - xc1; int dy = y - yc1; do { int d = int(fast_sqrt(dx*dx + dy*dy)); *p1 = 0; if(cmp(di.dist()) && d <= w) { *p1 = (cover_type)cover(d); } ++p1; dx += line_subpixel_scale; di.inc_x(); } while(++x1 <= x2); m_ren->blend_solid_hspan(x0, y1, unsigned(p1 - p0), color(), p0); } //------------------------------------------------------------------------- template void semidot(Cmp cmp, int xc1, int yc1, int xc2, int yc2) { if(m_clipping && clipping_flags(xc1, yc1, m_clip_box)) return; int r = ((subpixel_width() + line_subpixel_mask) >> line_subpixel_shift); if(r < 1) r = 1; ellipse_bresenham_interpolator ei(r, r); int dx = 0; int dy = -r; int dy0 = dy; int dx0 = dx; int x = xc1 >> line_subpixel_shift; int y = yc1 >> line_subpixel_shift; do { dx += ei.dx(); dy += ei.dy(); if(dy != dy0) { semidot_hline(cmp, xc1, yc1, xc2, yc2, x-dx0, y+dy0, x+dx0); semidot_hline(cmp, xc1, yc1, xc2, yc2, x-dx0, y-dy0, x+dx0); } dx0 = dx; dy0 = dy; ++ei; } while(dy < 0); semidot_hline(cmp, xc1, yc1, xc2, yc2, x-dx0, y+dy0, x+dx0); } //------------------------------------------------------------------------- void pie_hline(int xc, int yc, int xp1, int yp1, int xp2, int yp2, int xh1, int yh1, int xh2) { if(m_clipping && clipping_flags(xc, yc, m_clip_box)) return; cover_type covers[line_interpolator_aa_base::max_half_width * 2 + 4]; cover_type* p0 = covers; cover_type* p1 = covers; int x = xh1 << line_subpixel_shift; int y = yh1 << line_subpixel_shift; int w = subpixel_width(); distance_interpolator00 di(xc, yc, xp1, yp1, xp2, yp2, x, y); x += line_subpixel_scale/2; y += line_subpixel_scale/2; int xh0 = xh1; int dx = x - xc; int dy = y - yc; do { int d = int(fast_sqrt(dx*dx + dy*dy)); *p1 = 0; if(di.dist1() <= 0 && di.dist2() > 0 && d <= w) { *p1 = (cover_type)cover(d); } ++p1; dx += line_subpixel_scale; di.inc_x(); } while(++xh1 <= xh2); m_ren->blend_solid_hspan(xh0, yh1, unsigned(p1 - p0), color(), p0); } //------------------------------------------------------------------------- void pie(int xc, int yc, int x1, int y1, int x2, int y2) { int r = ((subpixel_width() + line_subpixel_mask) >> line_subpixel_shift); if(r < 1) r = 1; ellipse_bresenham_interpolator ei(r, r); int dx = 0; int dy = -r; int dy0 = dy; int dx0 = dx; int x = xc >> line_subpixel_shift; int y = yc >> line_subpixel_shift; do { dx += ei.dx(); dy += ei.dy(); if(dy != dy0) { pie_hline(xc, yc, x1, y1, x2, y2, x-dx0, y+dy0, x+dx0); pie_hline(xc, yc, x1, y1, x2, y2, x-dx0, y-dy0, x+dx0); } dx0 = dx; dy0 = dy; ++ei; } while(dy < 0); pie_hline(xc, yc, x1, y1, x2, y2, x-dx0, y+dy0, x+dx0); } //------------------------------------------------------------------------- void line0_no_clip(line_parameters& lp) { if(lp.len > line_max_length) { line_parameters lp1, lp2; lp.divide(lp1, lp2); line0_no_clip(lp1); line0_no_clip(lp2); return; } line_interpolator_aa0 li(*this, lp); if(li.count()) { if(li.vertical()) { while(li.step_ver()); } else { while(li.step_hor()); } } } //------------------------------------------------------------------------- void line0(line_parameters& lp) { if(m_clipping) { int x1 = lp.x1; int y1 = lp.y1; int x2 = lp.x2; int y2 = lp.y2; unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); if((flags & 4) == 0) { if(flags) { line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); line0_no_clip(lp2); } else { line0_no_clip(lp); } } } else { line0_no_clip(lp); } } //------------------------------------------------------------------------- void line1_no_clip(line_parameters& lp, int sx, int sy) { if(lp.len > line_max_length) { line_parameters lp1, lp2; lp.divide(lp1, lp2); line1_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1); line1_no_clip(lp2, lp1.x2 + (lp1.y2 - lp1.y1), lp1.y2 - (lp1.x2 - lp1.x1)); return; } fix_degenerate_bisectrix_start(lp, &sx, &sy); line_interpolator_aa1 li(*this, lp, sx, sy); if(li.vertical()) { while(li.step_ver()); } else { while(li.step_hor()); } } //------------------------------------------------------------------------- void line1(line_parameters& lp, int sx, int sy) { if(m_clipping) { int x1 = lp.x1; int y1 = lp.y1; int x2 = lp.x2; int y2 = lp.y2; unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); if((flags & 4) == 0) { if(flags) { line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); if(flags & 1) { sx = x1 + (y2 - y1); sy = y1 - (x2 - x1); } else { while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len) { sx = (lp.x1 + sx) >> 1; sy = (lp.y1 + sy) >> 1; } } line1_no_clip(lp2, sx, sy); } else { line1_no_clip(lp, sx, sy); } } } else { line1_no_clip(lp, sx, sy); } } //------------------------------------------------------------------------- void line2_no_clip(line_parameters& lp, int ex, int ey) { if(lp.len > line_max_length) { line_parameters lp1, lp2; lp.divide(lp1, lp2); line2_no_clip(lp1, lp1.x2 + (lp1.y2 - lp1.y1), lp1.y2 - (lp1.x2 - lp1.x1)); line2_no_clip(lp2, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1); return; } fix_degenerate_bisectrix_end(lp, &ex, &ey); line_interpolator_aa2 li(*this, lp, ex, ey); if(li.vertical()) { while(li.step_ver()); } else { while(li.step_hor()); } } //------------------------------------------------------------------------- void line2(line_parameters& lp, int ex, int ey) { if(m_clipping) { int x1 = lp.x1; int y1 = lp.y1; int x2 = lp.x2; int y2 = lp.y2; unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); if((flags & 4) == 0) { if(flags) { line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); if(flags & 2) { ex = x2 + (y2 - y1); ey = y2 - (x2 - x1); } else { while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len) { ex = (lp.x2 + ex) >> 1; ey = (lp.y2 + ey) >> 1; } } line2_no_clip(lp2, ex, ey); } else { line2_no_clip(lp, ex, ey); } } } else { line2_no_clip(lp, ex, ey); } } //------------------------------------------------------------------------- void line3_no_clip(line_parameters& lp, int sx, int sy, int ex, int ey) { if(lp.len > line_max_length) { line_parameters lp1, lp2; lp.divide(lp1, lp2); int mx = lp1.x2 + (lp1.y2 - lp1.y1); int my = lp1.y2 - (lp1.x2 - lp1.x1); line3_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1, mx, my); line3_no_clip(lp2, mx, my, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1); return; } fix_degenerate_bisectrix_start(lp, &sx, &sy); fix_degenerate_bisectrix_end(lp, &ex, &ey); line_interpolator_aa3 li(*this, lp, sx, sy, ex, ey); if(li.vertical()) { while(li.step_ver()); } else { while(li.step_hor()); } } //------------------------------------------------------------------------- void line3(line_parameters& lp, int sx, int sy, int ex, int ey) { if(m_clipping) { int x1 = lp.x1; int y1 = lp.y1; int x2 = lp.x2; int y2 = lp.y2; unsigned flags = clip_line_segment(&x1, &y1, &x2, &y2, m_clip_box); if((flags & 4) == 0) { if(flags) { line_parameters lp2(x1, y1, x2, y2, uround(calc_distance(x1, y1, x2, y2))); if(flags & 1) { sx = x1 + (y2 - y1); sy = y1 - (x2 - x1); } else { while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len) { sx = (lp.x1 + sx) >> 1; sy = (lp.y1 + sy) >> 1; } } if(flags & 2) { ex = x2 + (y2 - y1); ey = y2 - (x2 - x1); } else { while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len) { ex = (lp.x2 + ex) >> 1; ey = (lp.y2 + ey) >> 1; } } line3_no_clip(lp2, sx, sy, ex, ey); } else { line3_no_clip(lp, sx, sy, ex, ey); } } } else { line3_no_clip(lp, sx, sy, ex, ey); } } private: base_ren_type* m_ren; line_profile_aa* m_profile; color_type m_color; rect_i m_clip_box; bool m_clipping; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rasterizer_sl_clip.h0000644000175000017500000003171213233644505025670 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_SL_CLIP_INCLUDED #define AGG_RASTERIZER_SL_CLIP_INCLUDED #include "agg_clip_liang_barsky.h" namespace agg24 { //--------------------------------------------------------poly_max_coord_e enum poly_max_coord_e { poly_max_coord = (1 << 30) - 1 //----poly_max_coord }; //------------------------------------------------------------ras_conv_int struct ras_conv_int { typedef int coord_type; static AGG_INLINE int mul_div(double a, double b, double c) { return iround(a * b / c); } static int xi(int v) { return v; } static int yi(int v) { return v; } static int upscale(double v) { return iround(v * poly_subpixel_scale); } static int downscale(int v) { return v; } }; //--------------------------------------------------------ras_conv_int_sat struct ras_conv_int_sat { typedef int coord_type; static AGG_INLINE int mul_div(double a, double b, double c) { return saturation::iround(a * b / c); } static int xi(int v) { return v; } static int yi(int v) { return v; } static int upscale(double v) { return saturation::iround(v * poly_subpixel_scale); } static int downscale(int v) { return v; } }; //---------------------------------------------------------ras_conv_int_3x struct ras_conv_int_3x { typedef int coord_type; static AGG_INLINE int mul_div(double a, double b, double c) { return iround(a * b / c); } static int xi(int v) { return v * 3; } static int yi(int v) { return v; } static int upscale(double v) { return iround(v * poly_subpixel_scale); } static int downscale(int v) { return v; } }; //-----------------------------------------------------------ras_conv_dbl struct ras_conv_dbl { typedef double coord_type; static AGG_INLINE double mul_div(double a, double b, double c) { return a * b / c; } static int xi(double v) { return iround(v * poly_subpixel_scale); } static int yi(double v) { return iround(v * poly_subpixel_scale); } static double upscale(double v) { return v; } static double downscale(int v) { return v / double(poly_subpixel_scale); } }; //--------------------------------------------------------ras_conv_dbl_3x struct ras_conv_dbl_3x { typedef double coord_type; static AGG_INLINE double mul_div(double a, double b, double c) { return a * b / c; } static int xi(double v) { return iround(v * poly_subpixel_scale * 3); } static int yi(double v) { return iround(v * poly_subpixel_scale); } static double upscale(double v) { return v; } static double downscale(int v) { return v / double(poly_subpixel_scale); } }; //------------------------------------------------------rasterizer_sl_clip template class rasterizer_sl_clip { public: typedef Conv conv_type; typedef typename Conv::coord_type coord_type; typedef rect_base rect_type; //-------------------------------------------------------------------- rasterizer_sl_clip() : m_clip_box(0,0,0,0), m_x1(0), m_y1(0), m_f1(0), m_clipping(false) {} //-------------------------------------------------------------------- void reset_clipping() { m_clipping = false; } //-------------------------------------------------------------------- void clip_box(coord_type x1, coord_type y1, coord_type x2, coord_type y2) { m_clip_box = rect_type(x1, y1, x2, y2); m_clip_box.normalize(); m_clipping = true; } //-------------------------------------------------------------------- void move_to(coord_type x1, coord_type y1) { m_x1 = x1; m_y1 = y1; if(m_clipping) m_f1 = clipping_flags(x1, y1, m_clip_box); } private: //------------------------------------------------------------------------ template AGG_INLINE void line_clip_y(Rasterizer& ras, coord_type x1, coord_type y1, coord_type x2, coord_type y2, unsigned f1, unsigned f2) const { f1 &= 10; f2 &= 10; if((f1 | f2) == 0) { // Fully visible ras.line(Conv::xi(x1), Conv::yi(y1), Conv::xi(x2), Conv::yi(y2)); } else { if(f1 == f2) { // Invisible by Y return; } coord_type tx1 = x1; coord_type ty1 = y1; coord_type tx2 = x2; coord_type ty2 = y2; if(f1 & 8) // y1 < clip.y1 { tx1 = x1 + Conv::mul_div(m_clip_box.y1-y1, x2-x1, y2-y1); ty1 = m_clip_box.y1; } if(f1 & 2) // y1 > clip.y2 { tx1 = x1 + Conv::mul_div(m_clip_box.y2-y1, x2-x1, y2-y1); ty1 = m_clip_box.y2; } if(f2 & 8) // y2 < clip.y1 { tx2 = x1 + Conv::mul_div(m_clip_box.y1-y1, x2-x1, y2-y1); ty2 = m_clip_box.y1; } if(f2 & 2) // y2 > clip.y2 { tx2 = x1 + Conv::mul_div(m_clip_box.y2-y1, x2-x1, y2-y1); ty2 = m_clip_box.y2; } ras.line(Conv::xi(tx1), Conv::yi(ty1), Conv::xi(tx2), Conv::yi(ty2)); } } public: //-------------------------------------------------------------------- template void line_to(Rasterizer& ras, coord_type x2, coord_type y2) { if(m_clipping) { unsigned f2 = clipping_flags(x2, y2, m_clip_box); if((m_f1 & 10) == (f2 & 10) && (m_f1 & 10) != 0) { // Invisible by Y m_x1 = x2; m_y1 = y2; m_f1 = f2; return; } coord_type x1 = m_x1; coord_type y1 = m_y1; unsigned f1 = m_f1; coord_type y3, y4; unsigned f3, f4; switch(((f1 & 5) << 1) | (f2 & 5)) { case 0: // Visible by X line_clip_y(ras, x1, y1, x2, y2, f1, f2); break; case 1: // x2 > clip.x2 y3 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1); f3 = clipping_flags_y(y3, m_clip_box); line_clip_y(ras, x1, y1, m_clip_box.x2, y3, f1, f3); line_clip_y(ras, m_clip_box.x2, y3, m_clip_box.x2, y2, f3, f2); break; case 2: // x1 > clip.x2 y3 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1); f3 = clipping_flags_y(y3, m_clip_box); line_clip_y(ras, m_clip_box.x2, y1, m_clip_box.x2, y3, f1, f3); line_clip_y(ras, m_clip_box.x2, y3, x2, y2, f3, f2); break; case 3: // x1 > clip.x2 && x2 > clip.x2 line_clip_y(ras, m_clip_box.x2, y1, m_clip_box.x2, y2, f1, f2); break; case 4: // x2 < clip.x1 y3 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1); f3 = clipping_flags_y(y3, m_clip_box); line_clip_y(ras, x1, y1, m_clip_box.x1, y3, f1, f3); line_clip_y(ras, m_clip_box.x1, y3, m_clip_box.x1, y2, f3, f2); break; case 6: // x1 > clip.x2 && x2 < clip.x1 y3 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1); y4 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1); f3 = clipping_flags_y(y3, m_clip_box); f4 = clipping_flags_y(y4, m_clip_box); line_clip_y(ras, m_clip_box.x2, y1, m_clip_box.x2, y3, f1, f3); line_clip_y(ras, m_clip_box.x2, y3, m_clip_box.x1, y4, f3, f4); line_clip_y(ras, m_clip_box.x1, y4, m_clip_box.x1, y2, f4, f2); break; case 8: // x1 < clip.x1 y3 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1); f3 = clipping_flags_y(y3, m_clip_box); line_clip_y(ras, m_clip_box.x1, y1, m_clip_box.x1, y3, f1, f3); line_clip_y(ras, m_clip_box.x1, y3, x2, y2, f3, f2); break; case 9: // x1 < clip.x1 && x2 > clip.x2 y3 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1); y4 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1); f3 = clipping_flags_y(y3, m_clip_box); f4 = clipping_flags_y(y4, m_clip_box); line_clip_y(ras, m_clip_box.x1, y1, m_clip_box.x1, y3, f1, f3); line_clip_y(ras, m_clip_box.x1, y3, m_clip_box.x2, y4, f3, f4); line_clip_y(ras, m_clip_box.x2, y4, m_clip_box.x2, y2, f4, f2); break; case 12: // x1 < clip.x1 && x2 < clip.x1 line_clip_y(ras, m_clip_box.x1, y1, m_clip_box.x1, y2, f1, f2); break; } m_f1 = f2; } else { ras.line(Conv::xi(m_x1), Conv::yi(m_y1), Conv::xi(x2), Conv::yi(y2)); } m_x1 = x2; m_y1 = y2; } private: rect_type m_clip_box; coord_type m_x1; coord_type m_y1; unsigned m_f1; bool m_clipping; }; //---------------------------------------------------rasterizer_sl_no_clip class rasterizer_sl_no_clip { public: typedef ras_conv_int conv_type; typedef int coord_type; rasterizer_sl_no_clip() : m_x1(0), m_y1(0) {} void reset_clipping() {} void clip_box(coord_type x1, coord_type y1, coord_type x2, coord_type y2) {} void move_to(coord_type x1, coord_type y1) { m_x1 = x1; m_y1 = y1; } template void line_to(Rasterizer& ras, coord_type x2, coord_type y2) { ras.line(m_x1, m_y1, x2, y2); m_x1 = x2; m_y1 = y2; } private: int m_x1, m_y1; }; // -----rasterizer_sl_clip_int // -----rasterizer_sl_clip_int_sat // -----rasterizer_sl_clip_int_3x // -----rasterizer_sl_clip_dbl // -----rasterizer_sl_clip_dbl_3x //------------------------------------------------------------------------ typedef rasterizer_sl_clip rasterizer_sl_clip_int; typedef rasterizer_sl_clip rasterizer_sl_clip_int_sat; typedef rasterizer_sl_clip rasterizer_sl_clip_int_3x; typedef rasterizer_sl_clip rasterizer_sl_clip_dbl; typedef rasterizer_sl_clip rasterizer_sl_clip_dbl_3x; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_shorten_path.h0000644000175000017500000000337013233644505025513 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CONV_SHORTEN_PATH_INCLUDED #define AGG_CONV_SHORTEN_PATH_INCLUDED #include "agg_basics.h" #include "agg_conv_adaptor_vcgen.h" #include "agg_vcgen_vertex_sequence.h" namespace agg24 { //=======================================================conv_shorten_path template class conv_shorten_path : public conv_adaptor_vcgen { public: typedef conv_adaptor_vcgen base_type; conv_shorten_path(VertexSource& vs) : conv_adaptor_vcgen(vs) { } void shorten(double s) { base_type::generator().shorten(s); } double shorten() const { return base_type::generator().shorten(); } private: conv_shorten_path(const conv_shorten_path&); const conv_shorten_path& operator = (const conv_shorten_path&); }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rasterizer_compound_aa.h0000644000175000017500000005442013233644505026531 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.3 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // // The author gratefully acknowleges the support of David Turner, // Robert Wilhelm, and Werner Lemberg - the authors of the FreeType // libray - in producing this work. See http://www.freetype.org for details. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_COMPOUND_AA_INCLUDED #define AGG_RASTERIZER_COMPOUND_AA_INCLUDED #include "agg_rasterizer_cells_aa.h" #include "agg_rasterizer_sl_clip.h" namespace agg24 { //-----------------------------------------------------------cell_style_aa // A pixel cell. There're no constructors defined and it was done // intentionally in order to avoid extra overhead when allocating an // array of cells. struct cell_style_aa { int x; int y; int cover; int area; int16 left, right; void initial() { x = 0x7FFFFFFF; y = 0x7FFFFFFF; cover = 0; area = 0; left = -1; right = -1; } void style(const cell_style_aa& c) { left = c.left; right = c.right; } int not_equal(int ex, int ey, const cell_style_aa& c) const { return (ex - x) | (ey - y) | (left - c.left) | (right - c.right); } }; //===========================================================layer_order_e enum layer_order_e { layer_unsorted, //------layer_unsorted layer_direct, //------layer_direct layer_inverse //------layer_inverse }; //==================================================rasterizer_compound_aa template class rasterizer_compound_aa { struct style_info { unsigned start_cell; unsigned num_cells; int last_x; }; struct cell_info { int x, area, cover; }; public: typedef Clip clip_type; typedef typename Clip::conv_type conv_type; typedef typename Clip::coord_type coord_type; enum aa_scale_e { aa_shift = 8, aa_scale = 1 << aa_shift, aa_mask = aa_scale - 1, aa_scale2 = aa_scale * 2, aa_mask2 = aa_scale2 - 1 }; //-------------------------------------------------------------------- rasterizer_compound_aa(unsigned cell_block_limit=1024) : m_outline(cell_block_limit), m_clipper(), m_filling_rule(fill_non_zero), m_layer_order(layer_direct), m_styles(), // Active Styles m_ast(), // Active Style Table (unique values) m_asm(), // Active Style Mask m_cells(), m_cover_buf(), m_min_style(0x7FFFFFFF), m_max_style(-0x7FFFFFFF), m_start_x(0), m_start_y(0), m_scan_y(0x7FFFFFFF), m_sl_start(0), m_sl_len(0) {} //-------------------------------------------------------------------- void reset(); void reset_clipping(); void clip_box(double x1, double y1, double x2, double y2); void filling_rule(filling_rule_e filling_rule); void layer_order(layer_order_e order); //-------------------------------------------------------------------- void styles(int left, int right); void move_to(int x, int y); void line_to(int x, int y); void move_to_d(double x, double y); void line_to_d(double x, double y); void add_vertex(double x, double y, unsigned cmd); void edge(int x1, int y1, int x2, int y2); void edge_d(double x1, double y1, double x2, double y2); //------------------------------------------------------------------- template void add_path(VertexSource& vs, unsigned path_id=0) { double x; double y; unsigned cmd; vs.rewind(path_id); if(m_outline.sorted()) reset(); while(!is_stop(cmd = vs.vertex(&x, &y))) { add_vertex(x, y, cmd); } } //-------------------------------------------------------------------- int min_x() const { return m_outline.min_x(); } int min_y() const { return m_outline.min_y(); } int max_x() const { return m_outline.max_x(); } int max_y() const { return m_outline.max_y(); } int min_style() const { return m_min_style; } int max_style() const { return m_max_style; } //-------------------------------------------------------------------- void sort(); bool rewind_scanlines(); unsigned sweep_styles(); int scanline_start() const { return m_sl_start; } unsigned scanline_length() const { return m_sl_len; } unsigned style(unsigned style_idx) const; cover_type* allocate_cover_buffer(unsigned len); //-------------------------------------------------------------------- bool navigate_scanline(int y); bool hit_test(int tx, int ty); //-------------------------------------------------------------------- AGG_INLINE unsigned calculate_alpha(int area) const { int cover = area >> (poly_subpixel_shift*2 + 1 - aa_shift); if(cover < 0) cover = -cover; if(m_filling_rule == fill_even_odd) { cover &= aa_mask2; if(cover > aa_scale) { cover = aa_scale2 - cover; } } if(cover > aa_mask) cover = aa_mask; return cover; } //-------------------------------------------------------------------- // Sweeps one scanline with one style index. The style ID can be // determined by calling style(). template bool sweep_scanline(Scanline& sl, int style_idx) { int scan_y = m_scan_y - 1; if(scan_y > m_outline.max_y()) return false; sl.reset_spans(); if(style_idx < 0) { style_idx = 0; } else { style_idx++; } const style_info& st = m_styles[m_ast[style_idx]]; unsigned num_cells = st.num_cells; cell_info* cell = &m_cells[st.start_cell]; int cover = 0; while(num_cells--) { unsigned alpha; int x = cell->x; int area = cell->area; cover += cell->cover; ++cell; if(area) { alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area); sl.add_cell(x, alpha); x++; } if(num_cells && cell->x > x) { alpha = calculate_alpha(cover << (poly_subpixel_shift + 1)); if(alpha) { sl.add_span(x, cell->x - x, alpha); } } } if(sl.num_spans() == 0) return false; sl.finalize(scan_y); return true; } private: void add_style(int style_id); //-------------------------------------------------------------------- // Disable copying rasterizer_compound_aa(const rasterizer_compound_aa&); const rasterizer_compound_aa& operator = (const rasterizer_compound_aa&); private: rasterizer_cells_aa m_outline; clip_type m_clipper; filling_rule_e m_filling_rule; layer_order_e m_layer_order; pod_vector m_styles; // Active Styles pod_vector m_ast; // Active Style Table (unique values) pod_vector m_asm; // Active Style Mask pod_vector m_cells; pod_vector m_cover_buf; int m_min_style; int m_max_style; coord_type m_start_x; coord_type m_start_y; int m_scan_y; int m_sl_start; unsigned m_sl_len; }; //------------------------------------------------------------------------ template void rasterizer_compound_aa::reset() { m_outline.reset(); m_min_style = 0x7FFFFFFF; m_max_style = -0x7FFFFFFF; m_scan_y = 0x7FFFFFFF; m_sl_start = 0; m_sl_len = 0; } //------------------------------------------------------------------------ template void rasterizer_compound_aa::filling_rule(filling_rule_e filling_rule) { m_filling_rule = filling_rule; } //------------------------------------------------------------------------ template void rasterizer_compound_aa::layer_order(layer_order_e order) { m_layer_order = order; } //------------------------------------------------------------------------ template void rasterizer_compound_aa::clip_box(double x1, double y1, double x2, double y2) { reset(); m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), conv_type::upscale(x2), conv_type::upscale(y2)); } //------------------------------------------------------------------------ template void rasterizer_compound_aa::reset_clipping() { reset(); m_clipper.reset_clipping(); } //------------------------------------------------------------------------ template void rasterizer_compound_aa::styles(int left, int right) { cell_style_aa cell; cell.initial(); cell.left = (int16)left; cell.right = (int16)right; m_outline.style(cell); if(left >= 0 && left < m_min_style) m_min_style = left; if(left >= 0 && left > m_max_style) m_max_style = left; if(right >= 0 && right < m_min_style) m_min_style = right; if(right >= 0 && right > m_max_style) m_max_style = right; } //------------------------------------------------------------------------ template void rasterizer_compound_aa::move_to(int x, int y) { if(m_outline.sorted()) reset(); m_clipper.move_to(m_start_x = conv_type::downscale(x), m_start_y = conv_type::downscale(y)); } //------------------------------------------------------------------------ template void rasterizer_compound_aa::line_to(int x, int y) { m_clipper.line_to(m_outline, conv_type::downscale(x), conv_type::downscale(y)); } //------------------------------------------------------------------------ template void rasterizer_compound_aa::move_to_d(double x, double y) { if(m_outline.sorted()) reset(); m_clipper.move_to(m_start_x = conv_type::upscale(x), m_start_y = conv_type::upscale(y)); } //------------------------------------------------------------------------ template void rasterizer_compound_aa::line_to_d(double x, double y) { m_clipper.line_to(m_outline, conv_type::upscale(x), conv_type::upscale(y)); } //------------------------------------------------------------------------ template void rasterizer_compound_aa::add_vertex(double x, double y, unsigned cmd) { if(is_move_to(cmd)) { move_to_d(x, y); } else if(is_vertex(cmd)) { line_to_d(x, y); } else if(is_close(cmd)) { m_clipper.line_to(m_outline, m_start_x, m_start_y); } } //------------------------------------------------------------------------ template void rasterizer_compound_aa::edge(int x1, int y1, int x2, int y2) { if(m_outline.sorted()) reset(); m_clipper.move_to(conv_type::downscale(x1), conv_type::downscale(y1)); m_clipper.line_to(m_outline, conv_type::downscale(x2), conv_type::downscale(y2)); } //------------------------------------------------------------------------ template void rasterizer_compound_aa::edge_d(double x1, double y1, double x2, double y2) { if(m_outline.sorted()) reset(); m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); m_clipper.line_to(m_outline, conv_type::upscale(x2), conv_type::upscale(y2)); } //------------------------------------------------------------------------ template AGG_INLINE void rasterizer_compound_aa::sort() { m_outline.sort_cells(); } //------------------------------------------------------------------------ template AGG_INLINE bool rasterizer_compound_aa::rewind_scanlines() { m_outline.sort_cells(); if(m_outline.total_cells() == 0) { return false; } if(m_max_style < m_min_style) { return false; } m_scan_y = m_outline.min_y(); m_styles.allocate(m_max_style - m_min_style + 2, 128); return true; } //------------------------------------------------------------------------ template AGG_INLINE void rasterizer_compound_aa::add_style(int style_id) { if(style_id < 0) style_id = 0; else style_id -= m_min_style - 1; unsigned nbyte = style_id >> 3; unsigned mask = 1 << (style_id & 7); style_info* style = &m_styles[style_id]; if((m_asm[nbyte] & mask) == 0) { m_ast.add(style_id); m_asm[nbyte] |= mask; style->start_cell = 0; style->num_cells = 0; style->last_x = -0x7FFFFFFF; } ++style->start_cell; } //------------------------------------------------------------------------ // Returns the number of styles template unsigned rasterizer_compound_aa::sweep_styles() { for(;;) { if(m_scan_y > m_outline.max_y()) return 0; unsigned num_cells = m_outline.scanline_num_cells(m_scan_y); const cell_style_aa* const* cells = m_outline.scanline_cells(m_scan_y); unsigned num_styles = m_max_style - m_min_style + 2; const cell_style_aa* curr_cell; unsigned style_id; style_info* style; cell_info* cell; m_cells.allocate(num_cells * 2, 256); // Each cell can have two styles m_ast.capacity(num_styles, 64); m_asm.allocate((num_styles + 7) >> 3, 8); m_asm.zero(); if(num_cells) { // Pre-add zero (for no-fill style, that is, -1). // We need that to ensure that the "-1 style" would go first. m_asm[0] |= 1; m_ast.add(0); style = &m_styles[0]; style->start_cell = 0; style->num_cells = 0; style->last_x = -0x7FFFFFFF; m_sl_start = cells[0]->x; m_sl_len = cells[num_cells-1]->x - m_sl_start + 1; while(num_cells--) { curr_cell = *cells++; add_style(curr_cell->left); add_style(curr_cell->right); } // Convert the Y-histogram into the array of starting indexes unsigned i; unsigned start_cell = 0; for(i = 0; i < m_ast.size(); i++) { style_info& st = m_styles[m_ast[i]]; unsigned v = st.start_cell; st.start_cell = start_cell; start_cell += v; } cells = m_outline.scanline_cells(m_scan_y); num_cells = m_outline.scanline_num_cells(m_scan_y); while(num_cells--) { curr_cell = *cells++; style_id = (curr_cell->left < 0) ? 0 : curr_cell->left - m_min_style + 1; style = &m_styles[style_id]; if(curr_cell->x == style->last_x) { cell = &m_cells[style->start_cell + style->num_cells - 1]; cell->area += curr_cell->area; cell->cover += curr_cell->cover; } else { cell = &m_cells[style->start_cell + style->num_cells]; cell->x = curr_cell->x; cell->area = curr_cell->area; cell->cover = curr_cell->cover; style->last_x = curr_cell->x; style->num_cells++; } style_id = (curr_cell->right < 0) ? 0 : curr_cell->right - m_min_style + 1; style = &m_styles[style_id]; if(curr_cell->x == style->last_x) { cell = &m_cells[style->start_cell + style->num_cells - 1]; cell->area -= curr_cell->area; cell->cover -= curr_cell->cover; } else { cell = &m_cells[style->start_cell + style->num_cells]; cell->x = curr_cell->x; cell->area = -curr_cell->area; cell->cover = -curr_cell->cover; style->last_x = curr_cell->x; style->num_cells++; } } } if(m_ast.size() > 1) break; ++m_scan_y; } ++m_scan_y; if(m_layer_order != layer_unsorted) { range_adaptor > ra(m_ast, 1, m_ast.size() - 1); if(m_layer_order == layer_direct) quick_sort(ra, unsigned_greater); else quick_sort(ra, unsigned_less); } return m_ast.size() - 1; } //------------------------------------------------------------------------ // Returns style ID depending of the existing style index template AGG_INLINE unsigned rasterizer_compound_aa::style(unsigned style_idx) const { return m_ast[style_idx + 1] + m_min_style - 1; } //------------------------------------------------------------------------ template AGG_INLINE bool rasterizer_compound_aa::navigate_scanline(int y) { m_outline.sort_cells(); if(m_outline.total_cells() == 0) { return false; } if(m_max_style < m_min_style) { return false; } if(y < m_outline.min_y() || y > m_outline.max_y()) { return false; } m_scan_y = y; m_styles.allocate(m_max_style - m_min_style + 2, 128); return true; } //------------------------------------------------------------------------ template bool rasterizer_compound_aa::hit_test(int tx, int ty) { if(!navigate_scanline(ty)) { return false; } unsigned num_styles = sweep_styles(); if(num_styles <= 0) { return false; } scanline_hit_test sl(tx); sweep_scanline(sl, -1); return sl.hit(); } //------------------------------------------------------------------------ template cover_type* rasterizer_compound_aa::allocate_cover_buffer(unsigned len) { m_cover_buf.allocate(len, 256); return &m_cover_buf[0]; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_scanline_storage_bin.h0000644000175000017500000004457413233644505026153 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_STORAGE_BIN_INCLUDED #define AGG_SCANLINE_STORAGE_BIN_INCLUDED #include #include #include #include "agg_array.h" namespace agg24 { //-----------------------------------------------scanline_storage_bin class scanline_storage_bin { public: //--------------------------------------------------------------- struct span_data { int32 x; int32 len; }; //--------------------------------------------------------------- struct scanline_data { int y; unsigned num_spans; unsigned start_span; }; //--------------------------------------------------------------- class embedded_scanline { public: //----------------------------------------------------------- class const_iterator { public: const_iterator() : m_storage(0) {} const_iterator(const embedded_scanline* sl) : m_storage(sl->m_storage), m_span_idx(sl->m_scanline.start_span) { m_span = m_storage->span_by_index(m_span_idx); } const span_data& operator*() const { return m_span; } const span_data* operator->() const { return &m_span; } void operator ++ () { ++m_span_idx; m_span = m_storage->span_by_index(m_span_idx); } private: const scanline_storage_bin* m_storage; unsigned m_span_idx; span_data m_span; }; friend class const_iterator; //----------------------------------------------------------- embedded_scanline(scanline_storage_bin& storage) : m_storage(&storage) { setup(0); } //----------------------------------------------------------- void reset(int, int) {} unsigned num_spans() const { return m_scanline.num_spans; } int y() const { return m_scanline.y; } const_iterator begin() const { return const_iterator(this); } //----------------------------------------------------------- void setup(unsigned scanline_idx) { m_scanline_idx = scanline_idx; m_scanline = m_storage->scanline_by_index(m_scanline_idx); } private: scanline_storage_bin* m_storage; scanline_data m_scanline; unsigned m_scanline_idx; }; //--------------------------------------------------------------- scanline_storage_bin() : m_spans(256-2), // Block increment size m_scanlines(), m_min_x( 0x7FFFFFFF), m_min_y( 0x7FFFFFFF), m_max_x(-0x7FFFFFFF), m_max_y(-0x7FFFFFFF), m_cur_scanline(0) { m_fake_scanline.y = 0; m_fake_scanline.num_spans = 0; m_fake_scanline.start_span = 0; m_fake_span.x = 0; m_fake_span.len = 0; } // Renderer Interface //--------------------------------------------------------------- void prepare() { m_scanlines.remove_all(); m_spans.remove_all(); m_min_x = 0x7FFFFFFF; m_min_y = 0x7FFFFFFF; m_max_x = -0x7FFFFFFF; m_max_y = -0x7FFFFFFF; m_cur_scanline = 0; } //--------------------------------------------------------------- template void render(const Scanline& sl) { scanline_data sl_this; int y = sl.y(); if(y < m_min_y) m_min_y = y; if(y > m_max_y) m_max_y = y; sl_this.y = y; sl_this.num_spans = sl.num_spans(); sl_this.start_span = m_spans.size(); typename Scanline::const_iterator span_iterator = sl.begin(); unsigned num_spans = sl_this.num_spans; for(;;) { span_data sp; sp.x = span_iterator->x; sp.len = (int32)abs((int)(span_iterator->len)); m_spans.add(sp); int x1 = sp.x; int x2 = sp.x + sp.len - 1; if(x1 < m_min_x) m_min_x = x1; if(x2 > m_max_x) m_max_x = x2; if(--num_spans == 0) break; ++span_iterator; } m_scanlines.add(sl_this); } //--------------------------------------------------------------- // Iterate scanlines interface int min_x() const { return m_min_x; } int min_y() const { return m_min_y; } int max_x() const { return m_max_x; } int max_y() const { return m_max_y; } //--------------------------------------------------------------- bool rewind_scanlines() { m_cur_scanline = 0; return m_scanlines.size() > 0; } //--------------------------------------------------------------- template bool sweep_scanline(Scanline& sl) { sl.reset_spans(); for(;;) { if(m_cur_scanline >= m_scanlines.size()) return false; const scanline_data& sl_this = m_scanlines[m_cur_scanline]; unsigned num_spans = sl_this.num_spans; unsigned span_idx = sl_this.start_span; do { const span_data& sp = m_spans[span_idx++]; sl.add_span(sp.x, sp.len, cover_full); } while(--num_spans); ++m_cur_scanline; if(sl.num_spans()) { sl.finalize(sl_this.y); break; } } return true; } //--------------------------------------------------------------- // Specialization for embedded_scanline bool sweep_scanline(embedded_scanline& sl) { do { if(m_cur_scanline >= m_scanlines.size()) return false; sl.setup(m_cur_scanline); ++m_cur_scanline; } while(sl.num_spans() == 0); return true; } //--------------------------------------------------------------- unsigned byte_size() const { unsigned i; unsigned size = sizeof(int32) * 4; // min_x, min_y, max_x, max_y for(i = 0; i < m_scanlines.size(); ++i) { size += sizeof(int32) * 2 + // Y, num_spans unsigned(m_scanlines[i].num_spans) * sizeof(int32) * 2; // X, span_len } return size; } //--------------------------------------------------------------- static void write_int32(int8u* dst, int32 val) { dst[0] = ((const int8u*)&val)[0]; dst[1] = ((const int8u*)&val)[1]; dst[2] = ((const int8u*)&val)[2]; dst[3] = ((const int8u*)&val)[3]; } //--------------------------------------------------------------- void serialize(int8u* data) const { unsigned i; write_int32(data, min_x()); // min_x data += sizeof(int32); write_int32(data, min_y()); // min_y data += sizeof(int32); write_int32(data, max_x()); // max_x data += sizeof(int32); write_int32(data, max_y()); // max_y data += sizeof(int32); for(i = 0; i < m_scanlines.size(); ++i) { const scanline_data& sl_this = m_scanlines[i]; write_int32(data, sl_this.y); // Y data += sizeof(int32); write_int32(data, sl_this.num_spans); // num_spans data += sizeof(int32); unsigned num_spans = sl_this.num_spans; unsigned span_idx = sl_this.start_span; do { const span_data& sp = m_spans[span_idx++]; write_int32(data, sp.x); // X data += sizeof(int32); write_int32(data, sp.len); // len data += sizeof(int32); } while(--num_spans); } } //--------------------------------------------------------------- const scanline_data& scanline_by_index(unsigned i) const { return (i < m_scanlines.size()) ? m_scanlines[i] : m_fake_scanline; } //--------------------------------------------------------------- const span_data& span_by_index(unsigned i) const { return (i < m_spans.size()) ? m_spans[i] : m_fake_span; } private: pod_bvector m_spans; pod_bvector m_scanlines; span_data m_fake_span; scanline_data m_fake_scanline; int m_min_x; int m_min_y; int m_max_x; int m_max_y; unsigned m_cur_scanline; }; //---------------------------------------serialized_scanlines_adaptor_bin class serialized_scanlines_adaptor_bin { public: typedef bool cover_type; //-------------------------------------------------------------------- class embedded_scanline { public: //---------------------------------------------------------------- class const_iterator { public: struct span { int32 x; int32 len; }; const_iterator() : m_ptr(0) {} const_iterator(const embedded_scanline* sl) : m_ptr(sl->m_ptr), m_dx(sl->m_dx) { m_span.x = read_int32() + m_dx; m_span.len = read_int32(); } const span& operator*() const { return m_span; } const span* operator->() const { return &m_span; } void operator ++ () { m_span.x = read_int32() + m_dx; m_span.len = read_int32(); } private: int read_int32() { int32 val; ((int8u*)&val)[0] = *m_ptr++; ((int8u*)&val)[1] = *m_ptr++; ((int8u*)&val)[2] = *m_ptr++; ((int8u*)&val)[3] = *m_ptr++; return val; } const int8u* m_ptr; span m_span; int m_dx; }; friend class const_iterator; //---------------------------------------------------------------- embedded_scanline() : m_ptr(0), m_y(0), m_num_spans(0) {} //---------------------------------------------------------------- void reset(int, int) {} unsigned num_spans() const { return m_num_spans; } int y() const { return m_y; } const_iterator begin() const { return const_iterator(this); } private: //---------------------------------------------------------------- int read_int32() { int32 val; ((int8u*)&val)[0] = *m_ptr++; ((int8u*)&val)[1] = *m_ptr++; ((int8u*)&val)[2] = *m_ptr++; ((int8u*)&val)[3] = *m_ptr++; return val; } public: //---------------------------------------------------------------- void init(const int8u* ptr, int dx, int dy) { m_ptr = ptr; m_y = read_int32() + dy; m_num_spans = unsigned(read_int32()); m_dx = dx; } private: const int8u* m_ptr; int m_y; unsigned m_num_spans; int m_dx; }; public: //-------------------------------------------------------------------- serialized_scanlines_adaptor_bin() : m_data(0), m_end(0), m_ptr(0), m_dx(0), m_dy(0), m_min_x(0x7FFFFFFF), m_min_y(0x7FFFFFFF), m_max_x(-0x7FFFFFFF), m_max_y(-0x7FFFFFFF) {} //-------------------------------------------------------------------- serialized_scanlines_adaptor_bin(const int8u* data, unsigned size, double dx, double dy) : m_data(data), m_end(data + size), m_ptr(data), m_dx(iround(dx)), m_dy(iround(dy)), m_min_x(0x7FFFFFFF), m_min_y(0x7FFFFFFF), m_max_x(-0x7FFFFFFF), m_max_y(-0x7FFFFFFF) {} //-------------------------------------------------------------------- void init(const int8u* data, unsigned size, double dx, double dy) { m_data = data; m_end = data + size; m_ptr = data; m_dx = iround(dx); m_dy = iround(dy); m_min_x = 0x7FFFFFFF; m_min_y = 0x7FFFFFFF; m_max_x = -0x7FFFFFFF; m_max_y = -0x7FFFFFFF; } private: //-------------------------------------------------------------------- int read_int32() { int32 val; ((int8u*)&val)[0] = *m_ptr++; ((int8u*)&val)[1] = *m_ptr++; ((int8u*)&val)[2] = *m_ptr++; ((int8u*)&val)[3] = *m_ptr++; return val; } public: // Iterate scanlines interface //-------------------------------------------------------------------- bool rewind_scanlines() { m_ptr = m_data; if(m_ptr < m_end) { m_min_x = read_int32() + m_dx; m_min_y = read_int32() + m_dy; m_max_x = read_int32() + m_dx; m_max_y = read_int32() + m_dy; } return m_ptr < m_end; } //-------------------------------------------------------------------- int min_x() const { return m_min_x; } int min_y() const { return m_min_y; } int max_x() const { return m_max_x; } int max_y() const { return m_max_y; } //-------------------------------------------------------------------- template bool sweep_scanline(Scanline& sl) { sl.reset_spans(); for(;;) { if(m_ptr >= m_end) return false; int y = read_int32() + m_dy; unsigned num_spans = read_int32(); do { int x = read_int32() + m_dx; int len = read_int32(); if(len < 0) len = -len; sl.add_span(x, unsigned(len), cover_full); } while(--num_spans); if(sl.num_spans()) { sl.finalize(y); break; } } return true; } //-------------------------------------------------------------------- // Specialization for embedded_scanline bool sweep_scanline(embedded_scanline& sl) { do { if(m_ptr >= m_end) return false; sl.init(m_ptr, m_dx, m_dy); // Jump to the next scanline //-------------------------- read_int32(); // Y int num_spans = read_int32(); // num_spans m_ptr += num_spans * sizeof(int32) * 2; } while(sl.num_spans() == 0); return true; } private: const int8u* m_data; const int8u* m_end; const int8u* m_ptr; int m_dx; int m_dy; int m_min_x; int m_min_y; int m_max_x; int m_max_y; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rendering_buffer_dynarow.h0000644000175000017500000001206213233644505027037 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class rendering_buffer_dynarow // //---------------------------------------------------------------------------- #ifndef AGG_RENDERING_BUFFER_DYNAROW_INCLUDED #define AGG_RENDERING_BUFFER_DYNAROW_INCLUDED #include "agg_array.h" namespace agg24 { //===============================================rendering_buffer_dynarow // Rendering buffer class with dynamic allocation of the rows. // The rows are allocated as needed when requesting for span_ptr(). // The class automatically calculates min_x and max_x for each row. // Generally it's more efficient to use this class as a temporary buffer // for rendering a few lines and then to blend it with another buffer. // class rendering_buffer_dynarow { public: typedef row_info row_data; //------------------------------------------------------------------- ~rendering_buffer_dynarow() { init(0,0,0); } //------------------------------------------------------------------- rendering_buffer_dynarow() : m_rows(), m_width(0), m_height(0), m_byte_width(0) { } // Allocate and clear the buffer //-------------------------------------------------------------------- rendering_buffer_dynarow(unsigned width, unsigned height, unsigned byte_width) : m_rows(height), m_width(width), m_height(height), m_byte_width(byte_width) { memset(&m_rows[0], 0, sizeof(row_data) * height); } // Allocate and clear the buffer //-------------------------------------------------------------------- void init(unsigned width, unsigned height, unsigned byte_width) { unsigned i; for(i = 0; i < m_height; ++i) { pod_allocator::deallocate((int8u*)m_rows[i].ptr, m_byte_width); } if(width && height) { m_width = width; m_height = height; m_byte_width = byte_width; m_rows.resize(height); memset(&m_rows[0], 0, sizeof(row_data) * height); } } //-------------------------------------------------------------------- unsigned width() const { return m_width; } unsigned height() const { return m_height; } unsigned byte_width() const { return m_byte_width; } // The main function used for rendering. Returns pointer to the // pre-allocated span. Memory for the row is allocated as needed. //-------------------------------------------------------------------- int8u* row_ptr(int x, int y, unsigned len) { row_data* r = &m_rows[y]; int x2 = x + len - 1; if(r->ptr) { if(x < r->x1) { r->x1 = x; } if(x2 > r->x2) { r->x2 = x2; } } else { int8u* p = pod_allocator::allocate(m_byte_width); r->ptr = p; r->x1 = x; r->x2 = x2; memset(p, 0, m_byte_width); } return (int8u*)r->ptr; } //-------------------------------------------------------------------- const int8u* row_ptr(int y) const { return m_rows[y].ptr; } int8u* row_ptr(int y) { return row_ptr(0, y, m_width); } row_data row (int y) const { return m_rows[y]; } private: //-------------------------------------------------------------------- // Prohibit copying rendering_buffer_dynarow(const rendering_buffer_dynarow&); const rendering_buffer_dynarow& operator = (const rendering_buffer_dynarow&); private: //-------------------------------------------------------------------- pod_array m_rows; // Pointers to each row of the buffer unsigned m_width; // Width in pixels unsigned m_height; // Height in pixels unsigned m_byte_width; // Width in bytes }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vpgen_clip_polyline.h0000644000175000017500000000453313233644505026033 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_VPGEN_CLIP_POLYLINE_INCLUDED #define AGG_VPGEN_CLIP_POLYLINE_INCLUDED #include "agg_basics.h" namespace agg24 { //======================================================vpgen_clip_polyline // // See Implementation agg_vpgen_clip_polyline.cpp // class vpgen_clip_polyline { public: vpgen_clip_polyline() : m_clip_box(0, 0, 1, 1), m_x1(0), m_y1(0), m_num_vertices(0), m_vertex(0), m_move_to(false) { } void clip_box(double x1, double y1, double x2, double y2) { m_clip_box.x1 = x1; m_clip_box.y1 = y1; m_clip_box.x2 = x2; m_clip_box.y2 = y2; m_clip_box.normalize(); } double x1() const { return m_clip_box.x1; } double y1() const { return m_clip_box.y1; } double x2() const { return m_clip_box.x2; } double y2() const { return m_clip_box.y2; } static bool auto_close() { return false; } static bool auto_unclose() { return true; } void reset(); void move_to(double x, double y); void line_to(double x, double y); unsigned vertex(double* x, double* y); private: rect_d m_clip_box; double m_x1; double m_y1; double m_x[2]; double m_y[2]; unsigned m_cmd[2]; unsigned m_num_vertices; unsigned m_vertex; bool m_move_to; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vcgen_dash.h0000644000175000017500000000526213233644505024073 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Line dash generator // //---------------------------------------------------------------------------- #ifndef AGG_VCGEN_DASH_INCLUDED #define AGG_VCGEN_DASH_INCLUDED #include "agg_basics.h" #include "agg_vertex_sequence.h" namespace agg24 { //---------------------------------------------------------------vcgen_dash // // See Implementation agg_vcgen_dash.cpp // class vcgen_dash { enum max_dashes_e { max_dashes = 32 }; enum status_e { initial, ready, polyline, stop }; public: typedef vertex_sequence vertex_storage; vcgen_dash(); void remove_all_dashes(); void add_dash(double dash_len, double gap_len); void dash_start(double ds); void shorten(double s) { m_shorten = s; } double shorten() const { return m_shorten; } // Vertex Generator Interface void remove_all(); void add_vertex(double x, double y, unsigned cmd); // Vertex Source Interface void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: vcgen_dash(const vcgen_dash&); const vcgen_dash& operator = (const vcgen_dash&); void calc_dash_start(double ds); double m_dashes[max_dashes]; double m_total_dash_len; unsigned m_num_dashes; double m_dash_start; double m_shorten; double m_curr_dash_start; unsigned m_curr_dash; double m_curr_rest; const vertex_dist* m_v1; const vertex_dist* m_v2; vertex_storage m_src_vertices; unsigned m_closed; status_e m_status; unsigned m_src_vertex; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_gradient_lut.h0000644000175000017500000001664313233644505024460 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_GRADIENT_LUT_INCLUDED #define AGG_GRADIENT_LUT_INCLUDED #include "agg_array.h" #include "agg_dda_line.h" #include "agg_color_rgba.h" #include "agg_color_gray.h" namespace agg24 { //======================================================color_interpolator template struct color_interpolator { public: typedef ColorT color_type; color_interpolator(const color_type& c1, const color_type& c2, unsigned len) : m_c1(c1), m_c2(c2), m_len(len), m_count(0) {} void operator ++ () { ++m_count; } color_type color() const { return m_c1.gradient(m_c2, double(m_count) / m_len); } private: color_type m_c1; color_type m_c2; unsigned m_len; unsigned m_count; }; //======================================================================== // Fast specialization for rgba8 template<> struct color_interpolator { public: typedef rgba8 color_type; color_interpolator(const color_type& c1, const color_type& c2, unsigned len) : r(c1.r, c2.r, len), g(c1.g, c2.g, len), b(c1.b, c2.b, len), a(c1.a, c2.a, len) {} void operator ++ () { ++r; ++g; ++b; ++a; } color_type color() const { return color_type(r.y(), g.y(), b.y(), a.y()); } private: agg24::dda_line_interpolator<14> r, g, b, a; }; //======================================================================== // Fast specialization for gray8 template<> struct color_interpolator { public: typedef gray8 color_type; color_interpolator(const color_type& c1, const color_type& c2, unsigned len) : v(c1.v, c2.v, len), a(c1.a, c2.a, len) {} void operator ++ () { ++v; ++a; } color_type color() const { return color_type(v.y(), a.y()); } private: agg24::dda_line_interpolator<14> v,a; }; //============================================================gradient_lut template class gradient_lut { public: typedef ColorInterpolator interpolator_type; typedef typename interpolator_type::color_type color_type; enum { color_lut_size = ColorLutSize }; //-------------------------------------------------------------------- gradient_lut() : m_color_lut(color_lut_size) {} // Build Gradient Lut // First, call remove_all(), then add_color() at least twice, // then build_lut(). Argument "offset" in add_color must be // in range [0...1] and defines a color stop as it is described // in SVG specification, section Gradients and Patterns. // The simplest linear gradient is: // gradient_lut.add_color(0.0, start_color); // gradient_lut.add_color(1.0, end_color); //-------------------------------------------------------------------- void remove_all(); void add_color(double offset, const color_type& color); void build_lut(); // Size-index Interface. This class can be used directly as the // ColorF in span_gradient. All it needs is two access methods // size() and operator []. //-------------------------------------------------------------------- static unsigned size() { return color_lut_size; } const color_type& operator [] (unsigned i) const { return m_color_lut[i]; } private: //-------------------------------------------------------------------- struct color_point { double offset; color_type color; color_point() {} color_point(double off, const color_type& c) : offset(off), color(c) { if(offset < 0.0) offset = 0.0; if(offset > 1.0) offset = 1.0; } }; typedef agg24::pod_bvector color_profile_type; typedef agg24::pod_array color_lut_type; static bool offset_less(const color_point& a, const color_point& b) { return a.offset < b.offset; } static bool offset_equal(const color_point& a, const color_point& b) { return a.offset == b.offset; } //-------------------------------------------------------------------- color_profile_type m_color_profile; color_lut_type m_color_lut; }; //------------------------------------------------------------------------ template void gradient_lut::remove_all() { m_color_profile.remove_all(); } //------------------------------------------------------------------------ template void gradient_lut::add_color(double offset, const color_type& color) { m_color_profile.add(color_point(offset, color)); } //------------------------------------------------------------------------ template void gradient_lut::build_lut() { quick_sort(m_color_profile, offset_less); m_color_profile.cut_at(remove_duplicates(m_color_profile, offset_equal)); if(m_color_profile.size() >= 2) { unsigned i; unsigned start = uround(m_color_profile[0].offset * color_lut_size); unsigned end; color_type c = m_color_profile[0].color; for(i = 0; i < start; i++) { m_color_lut[i] = c; } for(i = 1; i < m_color_profile.size(); i++) { end = uround(m_color_profile[i].offset * color_lut_size); interpolator_type ci(m_color_profile[i-1].color, m_color_profile[i ].color, end - start + 1); while(start < end) { m_color_lut[start] = ci.color(); ++ci; ++start; } } c = m_color_profile.last().color; for(; end < m_color_lut.size(); end++) { m_color_lut[end] = c; } } } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_basics.h0000644000175000017500000004312713233644505023240 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_BASICS_INCLUDED #define AGG_BASICS_INCLUDED #include #include "agg_config.h" //---------------------------------------------------------AGG_CUSTOM_ALLOCATOR #ifdef AGG_CUSTOM_ALLOCATOR #include "agg_allocator.h" #else namespace agg24 { // The policy of all AGG containers and memory allocation strategy // in general is that no allocated data requires explicit construction. // It means that the allocator can be really simple; you can even // replace new/delete to malloc/free. The constructors and destructors // won't be called in this case, however everything will remain working. // The second argument of deallocate() is the size of the allocated // block. You can use this information if you wish. //------------------------------------------------------------pod_allocator template struct pod_allocator { static T* allocate(unsigned num) { return new T [num]; } static void deallocate(T* ptr, unsigned) { delete [] ptr; } }; // Single object allocator. It's also can be replaced with your custom // allocator. The difference is that it can only allocate a single // object and the constructor and destructor must be called. // In AGG there is no need to allocate an array of objects with // calling their constructors (only single ones). So that, if you // replace these new/delete to malloc/free make sure that the in-place // new is called and take care of calling the destructor too. //------------------------------------------------------------obj_allocator template struct obj_allocator { static T* allocate() { return new T; } static void deallocate(T* ptr) { delete ptr; } }; } #endif //-------------------------------------------------------- Default basic types // // If the compiler has different capacity of the basic types you can redefine // them via the compiler command line or by generating agg_config.h that is // empty by default. // #ifndef AGG_INT8 #define AGG_INT8 signed char #endif #ifndef AGG_INT8U #define AGG_INT8U unsigned char #endif #ifndef AGG_INT16 #define AGG_INT16 short #endif #ifndef AGG_INT16U #define AGG_INT16U unsigned short #endif #ifndef AGG_INT32 #define AGG_INT32 int #endif #ifndef AGG_INT32U #define AGG_INT32U unsigned #endif #ifndef AGG_INT64 #if defined(_MSC_VER) || defined(__BORLANDC__) #define AGG_INT64 signed __int64 #else #define AGG_INT64 signed long long #endif #endif #ifndef AGG_INT64U #if defined(_MSC_VER) || defined(__BORLANDC__) #define AGG_INT64U unsigned __int64 #else #define AGG_INT64U unsigned long long #endif #endif //------------------------------------------------ Some fixes for MS Visual C++ #if defined(_MSC_VER) #pragma warning(disable:4786) // Identifier was truncated... #endif #if defined(_MSC_VER) #define AGG_INLINE __forceinline #else #define AGG_INLINE inline #endif namespace agg24 { //------------------------------------------------------------------------- typedef AGG_INT8 int8; //----int8 typedef AGG_INT8U int8u; //----int8u typedef AGG_INT16 int16; //----int16 typedef AGG_INT16U int16u; //----int16u typedef AGG_INT32 int32; //----int32 typedef AGG_INT32U int32u; //----int32u typedef AGG_INT64 int64; //----int64 typedef AGG_INT64U int64u; //----int64u #if defined(AGG_FISTP) #pragma warning(push) #pragma warning(disable : 4035) //Disable warning "no return value" AGG_INLINE int iround(double v) //-------iround { int t; __asm fld qword ptr [v] __asm fistp dword ptr [t] __asm mov eax, dword ptr [t] } AGG_INLINE unsigned uround(double v) //-------uround { unsigned t; __asm fld qword ptr [v] __asm fistp dword ptr [t] __asm mov eax, dword ptr [t] } #pragma warning(pop) AGG_INLINE int ifloor(double v) { return int(floor(v)); } AGG_INLINE unsigned ufloor(double v) //-------ufloor { return unsigned(floor(v)); } AGG_INLINE int iceil(double v) { return int(ceil(v)); } AGG_INLINE unsigned uceil(double v) //--------uceil { return unsigned(ceil(v)); } #elif defined(AGG_QIFIST) AGG_INLINE int iround(double v) { return int(v); } AGG_INLINE int uround(double v) { return unsigned(v); } AGG_INLINE int ifloor(double v) { return int(floor(v)); } AGG_INLINE unsigned ufloor(double v) { return unsigned(floor(v)); } AGG_INLINE int iceil(double v) { return int(ceil(v)); } AGG_INLINE unsigned uceil(double v) { return unsigned(ceil(v)); } #else AGG_INLINE int iround(double v) { return int((v < 0.0) ? v - 0.5 : v + 0.5); } AGG_INLINE int uround(double v) { return unsigned(v + 0.5); } AGG_INLINE int ifloor(double v) { int i = int(v); return i - (i > v); } AGG_INLINE unsigned ufloor(double v) { return unsigned(v); } AGG_INLINE int iceil(double v) { return int(ceil(v)); } AGG_INLINE unsigned uceil(double v) { return unsigned(ceil(v)); } #endif //---------------------------------------------------------------saturation template struct saturation { AGG_INLINE static int iround(double v) { if(v < double(-Limit)) return -Limit; if(v > double( Limit)) return Limit; return agg24::iround(v); } }; //------------------------------------------------------------------mul_one template struct mul_one { AGG_INLINE static unsigned mul(unsigned a, unsigned b) { register unsigned q = a * b + (1 << (Shift-1)); return (q + (q >> Shift)) >> Shift; } }; //------------------------------------------------------------------------- typedef unsigned char cover_type; //----cover_type enum cover_scale_e { cover_shift = 8, //----cover_shift cover_size = 1 << cover_shift, //----cover_size cover_mask = cover_size - 1, //----cover_mask cover_none = 0, //----cover_none cover_full = cover_mask //----cover_full }; //----------------------------------------------------poly_subpixel_scale_e // These constants determine the subpixel accuracy, to be more precise, // the number of bits of the fractional part of the coordinates. // The possible coordinate capacity in bits can be calculated by formula: // sizeof(int) * 8 - poly_subpixel_shift, i.e, for 32-bit integers and // 8-bits fractional part the capacity is 24 bits. enum poly_subpixel_scale_e { poly_subpixel_shift = 8, //----poly_subpixel_shift poly_subpixel_scale = 1< struct rect_base { typedef T value_type; typedef rect_base self_type; T x1, y1, x2, y2; rect_base() {} rect_base(T x1_, T y1_, T x2_, T y2_) : x1(x1_), y1(y1_), x2(x2_), y2(y2_) {} void init(T x1_, T y1_, T x2_, T y2_) { x1 = x1_; y1 = y1_; x2 = x2_; y2 = y2_; } const self_type& normalize() { T t; if(x1 > x2) { t = x1; x1 = x2; x2 = t; } if(y1 > y2) { t = y1; y1 = y2; y2 = t; } return *this; } bool clip(const self_type& r) { if(x2 > r.x2) x2 = r.x2; if(y2 > r.y2) y2 = r.y2; if(x1 < r.x1) x1 = r.x1; if(y1 < r.y1) y1 = r.y1; return x1 <= x2 && y1 <= y2; } bool is_valid() const { return x1 <= x2 && y1 <= y2; } bool hit_test(T x, T y) const { return (x >= x1 && x <= x2 && y >= y1 && y <= y2); } bool overlaps(const self_type& r) const { return !(r.x1 > x2 || r.x2 < x1 || r.y1 > y2 || r.y2 < y1); } }; //-----------------------------------------------------intersect_rectangles template inline Rect intersect_rectangles(const Rect& r1, const Rect& r2) { Rect r = r1; // First process x2,y2 because the other order // results in Internal Compiler Error under // Microsoft Visual C++ .NET 2003 69462-335-0000007-18038 in // case of "Maximize Speed" optimization option. //----------------- if(r.x2 > r2.x2) r.x2 = r2.x2; if(r.y2 > r2.y2) r.y2 = r2.y2; if(r.x1 < r2.x1) r.x1 = r2.x1; if(r.y1 < r2.y1) r.y1 = r2.y1; return r; } //---------------------------------------------------------unite_rectangles template inline Rect unite_rectangles(const Rect& r1, const Rect& r2) { Rect r = r1; if(r.x2 < r2.x2) r.x2 = r2.x2; if(r.y2 < r2.y2) r.y2 = r2.y2; if(r.x1 > r2.x1) r.x1 = r2.x1; if(r.y1 > r2.y1) r.y1 = r2.y1; return r; } typedef rect_base rect_i; //----rect_i typedef rect_base rect_f; //----rect_f typedef rect_base rect_d; //----rect_d //---------------------------------------------------------path_commands_e enum path_commands_e { path_cmd_stop = 0, //----path_cmd_stop path_cmd_move_to = 1, //----path_cmd_move_to path_cmd_line_to = 2, //----path_cmd_line_to path_cmd_curve3 = 3, //----path_cmd_curve3 path_cmd_curve4 = 4, //----path_cmd_curve4 path_cmd_curveN = 5, //----path_cmd_curveN path_cmd_catrom = 6, //----path_cmd_catrom path_cmd_ubspline = 7, //----path_cmd_ubspline path_cmd_end_poly = 0x0F, //----path_cmd_end_poly path_cmd_mask = 0x0F //----path_cmd_mask }; //------------------------------------------------------------path_flags_e enum path_flags_e { path_flags_none = 0, //----path_flags_none path_flags_ccw = 0x10, //----path_flags_ccw path_flags_cw = 0x20, //----path_flags_cw path_flags_close = 0x40, //----path_flags_close path_flags_mask = 0xF0 //----path_flags_mask }; //---------------------------------------------------------------is_vertex inline bool is_vertex(unsigned c) { return c >= path_cmd_move_to && c < path_cmd_end_poly; } //--------------------------------------------------------------is_drawing inline bool is_drawing(unsigned c) { return c >= path_cmd_line_to && c < path_cmd_end_poly; } //-----------------------------------------------------------------is_stop inline bool is_stop(unsigned c) { return c == path_cmd_stop; } //--------------------------------------------------------------is_move_to inline bool is_move_to(unsigned c) { return c == path_cmd_move_to; } //--------------------------------------------------------------is_line_to inline bool is_line_to(unsigned c) { return c == path_cmd_line_to; } //----------------------------------------------------------------is_curve inline bool is_curve(unsigned c) { return c == path_cmd_curve3 || c == path_cmd_curve4; } //---------------------------------------------------------------is_curve3 inline bool is_curve3(unsigned c) { return c == path_cmd_curve3; } //---------------------------------------------------------------is_curve4 inline bool is_curve4(unsigned c) { return c == path_cmd_curve4; } //-------------------------------------------------------------is_end_poly inline bool is_end_poly(unsigned c) { return (c & path_cmd_mask) == path_cmd_end_poly; } //----------------------------------------------------------------is_close inline bool is_close(unsigned c) { return (c & ~(path_flags_cw | path_flags_ccw)) == (path_cmd_end_poly | path_flags_close); } //------------------------------------------------------------is_next_poly inline bool is_next_poly(unsigned c) { return is_stop(c) || is_move_to(c) || is_end_poly(c); } //-------------------------------------------------------------------is_cw inline bool is_cw(unsigned c) { return (c & path_flags_cw) != 0; } //------------------------------------------------------------------is_ccw inline bool is_ccw(unsigned c) { return (c & path_flags_ccw) != 0; } //-------------------------------------------------------------is_oriented inline bool is_oriented(unsigned c) { return (c & (path_flags_cw | path_flags_ccw)) != 0; } //---------------------------------------------------------------is_closed inline bool is_closed(unsigned c) { return (c & path_flags_close) != 0; } //----------------------------------------------------------get_close_flag inline unsigned get_close_flag(unsigned c) { return c & path_flags_close; } //-------------------------------------------------------clear_orientation inline unsigned clear_orientation(unsigned c) { return c & ~(path_flags_cw | path_flags_ccw); } //---------------------------------------------------------get_orientation inline unsigned get_orientation(unsigned c) { return c & (path_flags_cw | path_flags_ccw); } //---------------------------------------------------------set_orientation inline unsigned set_orientation(unsigned c, unsigned o) { return clear_orientation(c) | o; } //--------------------------------------------------------------point_base template struct point_base { typedef T value_type; T x,y; point_base() {} point_base(T x_, T y_) : x(x_), y(y_) {} }; typedef point_base point_i; //-----point_i typedef point_base point_f; //-----point_f typedef point_base point_d; //-----point_d //-------------------------------------------------------------vertex_base template struct vertex_base { typedef T value_type; T x,y; unsigned cmd; vertex_base() {} vertex_base(T x_, T y_, unsigned cmd_) : x(x_), y(y_), cmd(cmd_) {} }; typedef vertex_base vertex_i; //-----vertex_i typedef vertex_base vertex_f; //-----vertex_f typedef vertex_base vertex_d; //-----vertex_d //----------------------------------------------------------------row_info template struct row_info { int x1, x2; T* ptr; row_info() {} row_info(int x1_, int x2_, T* ptr_) : x1(x1_), x2(x2_), ptr(ptr_) {} }; //----------------------------------------------------------const_row_info template struct const_row_info { int x1, x2; const T* ptr; const_row_info() {} const_row_info(int x1_, int x2_, const T* ptr_) : x1(x1_), x2(x2_), ptr(ptr_) {} }; //------------------------------------------------------------is_equal_eps template inline bool is_equal_eps(T v1, T v2, T epsilon) { return fabs(v1 - v2) <= double(epsilon); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_scanline_u.h0000644000175000017500000004217113233644505024112 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates (scanline32_u) has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_U_INCLUDED #define AGG_SCANLINE_U_INCLUDED #include "agg_array.h" namespace agg24 { //=============================================================scanline_u8 // // Unpacked scanline container class // // This class is used to transfer data from a scanline rasterizer // to the rendering buffer. It's organized very simple. The class stores // information of horizontal spans to render it into a pixel-map buffer. // Each span has staring X, length, and an array of bytes that determine the // cover-values for each pixel. // Before using this class you should know the minimal and maximal pixel // coordinates of your scanline. The protocol of using is: // 1. reset(min_x, max_x) // 2. add_cell() / add_span() - accumulate scanline. // When forming one scanline the next X coordinate must be always greater // than the last stored one, i.e. it works only with ordered coordinates. // 3. Call finalize(y) and render the scanline. // 3. Call reset_spans() to prepare for the new scanline. // // 4. Rendering: // // Scanline provides an iterator class that allows you to extract // the spans and the cover values for each pixel. Be aware that clipping // has not been done yet, so you should perform it yourself. // Use scanline_u8::iterator to render spans: //------------------------------------------------------------------------- // // int y = sl.y(); // Y-coordinate of the scanline // // ************************************ // ...Perform vertical clipping here... // ************************************ // // scanline_u8::const_iterator span = sl.begin(); // // unsigned char* row = m_rbuf->row(y); // The address of the beginning // // of the current row // // unsigned num_spans = sl.num_spans(); // Number of spans. It's guaranteed that // // num_spans is always greater than 0. // // do // { // const scanline_u8::cover_type* covers = // span->covers; // The array of the cover values // // int num_pix = span->len; // Number of pixels of the span. // // Always greater than 0, still it's // // better to use "int" instead of // // "unsigned" because it's more // // convenient for clipping // int x = span->x; // // ************************************** // ...Perform horizontal clipping here... // ...you have x, covers, and pix_count.. // ************************************** // // unsigned char* dst = row + x; // Calculate the start address of the row. // // In this case we assume a simple // // grayscale image 1-byte per pixel. // do // { // *dst++ = *covers++; // Hypotetical rendering. // } // while(--num_pix); // // ++span; // } // while(--num_spans); // num_spans cannot be 0, so this loop is quite safe //------------------------------------------------------------------------ // // The question is: why should we accumulate the whole scanline when we // could render just separate spans when they're ready? // That's because using the scanline is generally faster. When is consists // of more than one span the conditions for the processor cash system // are better, because switching between two different areas of memory // (that can be very large) occurs less frequently. //------------------------------------------------------------------------ class scanline_u8 { public: typedef scanline_u8 self_type; typedef int8u cover_type; typedef int16 coord_type; //-------------------------------------------------------------------- struct span { coord_type x; coord_type len; cover_type* covers; }; typedef span* iterator; typedef const span* const_iterator; //-------------------------------------------------------------------- scanline_u8() : m_min_x(0), m_last_x(0x7FFFFFF0), m_cur_span(0) {} //-------------------------------------------------------------------- void reset(int min_x, int max_x) { unsigned max_len = max_x - min_x + 2; if(max_len > m_spans.size()) { m_spans.resize(max_len); m_covers.resize(max_len); } m_last_x = 0x7FFFFFF0; m_min_x = min_x; m_cur_span = &m_spans[0]; } //-------------------------------------------------------------------- void add_cell(int x, unsigned cover) { x -= m_min_x; m_covers[x] = (cover_type)cover; if(x == m_last_x+1) { m_cur_span->len++; } else { m_cur_span++; m_cur_span->x = (coord_type)(x + m_min_x); m_cur_span->len = 1; m_cur_span->covers = &m_covers[x]; } m_last_x = x; } //-------------------------------------------------------------------- void add_cells(int x, unsigned len, const cover_type* covers) { x -= m_min_x; memcpy(&m_covers[x], covers, len * sizeof(cover_type)); if(x == m_last_x+1) { m_cur_span->len += (coord_type)len; } else { m_cur_span++; m_cur_span->x = (coord_type)(x + m_min_x); m_cur_span->len = (coord_type)len; m_cur_span->covers = &m_covers[x]; } m_last_x = x + len - 1; } //-------------------------------------------------------------------- void add_span(int x, unsigned len, unsigned cover) { x -= m_min_x; memset(&m_covers[x], cover, len); if(x == m_last_x+1) { m_cur_span->len += (coord_type)len; } else { m_cur_span++; m_cur_span->x = (coord_type)(x + m_min_x); m_cur_span->len = (coord_type)len; m_cur_span->covers = &m_covers[x]; } m_last_x = x + len - 1; } //-------------------------------------------------------------------- void finalize(int y) { m_y = y; } //-------------------------------------------------------------------- void reset_spans() { m_last_x = 0x7FFFFFF0; m_cur_span = &m_spans[0]; } //-------------------------------------------------------------------- int y() const { return m_y; } unsigned num_spans() const { return unsigned(m_cur_span - &m_spans[0]); } const_iterator begin() const { return &m_spans[1]; } iterator begin() { return &m_spans[1]; } private: scanline_u8(const self_type&); const self_type& operator = (const self_type&); private: int m_min_x; int m_last_x; int m_y; pod_array m_covers; pod_array m_spans; span* m_cur_span; }; //==========================================================scanline_u8_am // // The scanline container with alpha-masking // //------------------------------------------------------------------------ template class scanline_u8_am : public scanline_u8 { public: typedef scanline_u8 base_type; typedef AlphaMask alpha_mask_type; typedef base_type::cover_type cover_type; typedef base_type::coord_type coord_type; scanline_u8_am() : base_type(), m_alpha_mask(0) {} scanline_u8_am(AlphaMask& am) : base_type(), m_alpha_mask(&am) {} //-------------------------------------------------------------------- void finalize(int span_y) { base_type::finalize(span_y); if(m_alpha_mask) { typename base_type::iterator span = base_type::begin(); unsigned count = base_type::num_spans(); do { m_alpha_mask->combine_hspan(span->x, base_type::y(), span->covers, span->len); ++span; } while(--count); } } private: AlphaMask* m_alpha_mask; }; //===========================================================scanline32_u8 class scanline32_u8 { public: typedef scanline32_u8 self_type; typedef int8u cover_type; typedef int32 coord_type; //-------------------------------------------------------------------- struct span { span() {} span(coord_type x_, coord_type len_, cover_type* covers_) : x(x_), len(len_), covers(covers_) {} coord_type x; coord_type len; cover_type* covers; }; typedef pod_bvector span_array_type; //-------------------------------------------------------------------- class const_iterator { public: const_iterator(const span_array_type& spans) : m_spans(spans), m_span_idx(0) {} const span& operator*() const { return m_spans[m_span_idx]; } const span* operator->() const { return &m_spans[m_span_idx]; } void operator ++ () { ++m_span_idx; } private: const span_array_type& m_spans; unsigned m_span_idx; }; //-------------------------------------------------------------------- class iterator { public: iterator(span_array_type& spans) : m_spans(spans), m_span_idx(0) {} span& operator*() { return m_spans[m_span_idx]; } span* operator->() { return &m_spans[m_span_idx]; } void operator ++ () { ++m_span_idx; } private: span_array_type& m_spans; unsigned m_span_idx; }; //-------------------------------------------------------------------- scanline32_u8() : m_min_x(0), m_last_x(0x7FFFFFF0), m_covers() {} //-------------------------------------------------------------------- void reset(int min_x, int max_x) { unsigned max_len = max_x - min_x + 2; if(max_len > m_covers.size()) { m_covers.resize(max_len); } m_last_x = 0x7FFFFFF0; m_min_x = min_x; m_spans.remove_all(); } //-------------------------------------------------------------------- void add_cell(int x, unsigned cover) { x -= m_min_x; m_covers[x] = cover_type(cover); if(x == m_last_x+1) { m_spans.last().len++; } else { m_spans.add(span(coord_type(x + m_min_x), 1, &m_covers[x])); } m_last_x = x; } //-------------------------------------------------------------------- void add_cells(int x, unsigned len, const cover_type* covers) { x -= m_min_x; memcpy(&m_covers[x], covers, len * sizeof(cover_type)); if(x == m_last_x+1) { m_spans.last().len += coord_type(len); } else { m_spans.add(span(coord_type(x + m_min_x), coord_type(len), &m_covers[x])); } m_last_x = x + len - 1; } //-------------------------------------------------------------------- void add_span(int x, unsigned len, unsigned cover) { x -= m_min_x; memset(&m_covers[x], cover, len); if(x == m_last_x+1) { m_spans.last().len += coord_type(len); } else { m_spans.add(span(coord_type(x + m_min_x), coord_type(len), &m_covers[x])); } m_last_x = x + len - 1; } //-------------------------------------------------------------------- void finalize(int y) { m_y = y; } //-------------------------------------------------------------------- void reset_spans() { m_last_x = 0x7FFFFFF0; m_spans.remove_all(); } //-------------------------------------------------------------------- int y() const { return m_y; } unsigned num_spans() const { return m_spans.size(); } const_iterator begin() const { return const_iterator(m_spans); } iterator begin() { return iterator(m_spans); } private: scanline32_u8(const self_type&); const self_type& operator = (const self_type&); private: int m_min_x; int m_last_x; int m_y; pod_array m_covers; span_array_type m_spans; }; //========================================================scanline32_u8_am // // The scanline container with alpha-masking // //------------------------------------------------------------------------ template class scanline32_u8_am : public scanline32_u8 { public: typedef scanline32_u8 base_type; typedef AlphaMask alpha_mask_type; typedef base_type::cover_type cover_type; typedef base_type::coord_type coord_type; scanline32_u8_am() : base_type(), m_alpha_mask(0) {} scanline32_u8_am(AlphaMask& am) : base_type(), m_alpha_mask(&am) {} //-------------------------------------------------------------------- void finalize(int span_y) { base_type::finalize(span_y); if(m_alpha_mask) { typename base_type::iterator span = base_type::begin(); unsigned count = base_type::num_spans(); do { m_alpha_mask->combine_hspan(span->x, base_type::y(), span->covers, span->len); ++span; } while(--count); } } private: AlphaMask* m_alpha_mask; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_font_cache_manager2.h0000644000175000017500000002137113233644505025636 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_FONT_CACHE_MANAGER2_INCLUDED #define AGG_FONT_CACHE_MANAGER2_INCLUDED #include #include #include #include "agg_array.h" namespace agg24 { namespace fman { //---------------------------------------------------------glyph_data_type enum glyph_data_type { glyph_data_invalid = 0, glyph_data_mono = 1, glyph_data_gray8 = 2, glyph_data_outline = 3 }; //-------------------------------------------------------------cached_glyph struct cached_glyph { void * cached_font; unsigned glyph_code; unsigned glyph_index; int8u* data; unsigned data_size; glyph_data_type data_type; rect_i bounds; double advance_x; double advance_y; }; //--------------------------------------------------------------cached_glyphs class cached_glyphs { public: enum block_size_e { block_size = 16384-16 }; //-------------------------------------------------------------------- cached_glyphs() : m_allocator(block_size) { memset(m_glyphs, 0, sizeof(m_glyphs)); } //-------------------------------------------------------------------- const cached_glyph* find_glyph(unsigned glyph_code) const { unsigned msb = (glyph_code >> 8) & 0xFF; if(m_glyphs[msb]) { return m_glyphs[msb][glyph_code & 0xFF]; } return 0; } //-------------------------------------------------------------------- cached_glyph* cache_glyph( void * cached_font, unsigned glyph_code, unsigned glyph_index, unsigned data_size, glyph_data_type data_type, const rect_i& bounds, double advance_x, double advance_y) { unsigned msb = (glyph_code >> 8) & 0xFF; if(m_glyphs[msb] == 0) { m_glyphs[msb] = (cached_glyph**)m_allocator.allocate(sizeof(cached_glyph*) * 256, sizeof(cached_glyph*)); memset(m_glyphs[msb], 0, sizeof(cached_glyph*) * 256); } unsigned lsb = glyph_code & 0xFF; if(m_glyphs[msb][lsb]) return 0; // Already exists, do not overwrite cached_glyph* glyph = (cached_glyph*)m_allocator.allocate(sizeof(cached_glyph), sizeof(double)); glyph->cached_font = cached_font; glyph->glyph_code = glyph_code; glyph->glyph_index = glyph_index; glyph->data = m_allocator.allocate(data_size); glyph->data_size = data_size; glyph->data_type = data_type; glyph->bounds = bounds; glyph->advance_x = advance_x; glyph->advance_y = advance_y; return m_glyphs[msb][lsb] = glyph; } private: block_allocator m_allocator; cached_glyph** m_glyphs[256]; }; //------------------------------------------------------------------------ enum glyph_rendering { glyph_ren_native_mono, glyph_ren_native_gray8, glyph_ren_outline, glyph_ren_agg_mono, glyph_ren_agg_gray8 }; //------------------------------------------------------font_cache_manager template class font_cache_manager { public: typedef FontEngine font_engine_type; typedef font_cache_manager self_type; typedef typename font_engine_type::path_adaptor_type path_adaptor_type; typedef typename font_engine_type::gray8_adaptor_type gray8_adaptor_type; typedef typename gray8_adaptor_type::embedded_scanline gray8_scanline_type; typedef typename font_engine_type::mono_adaptor_type mono_adaptor_type; typedef typename mono_adaptor_type::embedded_scanline mono_scanline_type; struct cached_font { cached_font( font_engine_type& engine, typename FontEngine::loaded_face *face, double height, double width, bool hinting, glyph_rendering rendering ) : m_engine( engine ) , m_face( face ) , m_height( height ) , m_width( width ) , m_hinting( hinting ) , m_rendering( rendering ) { select_face(); m_face_height=m_face->height(); m_face_width=m_face->width(); m_face_ascent=m_face->ascent(); m_face_descent=m_face->descent(); m_face_ascent_b=m_face->ascent_b(); m_face_descent_b=m_face->descent_b(); } double height() const { return m_face_height; } double width() const { return m_face_width; } double ascent() const { return m_face_ascent; } double descent() const { return m_face_descent; } double ascent_b() const { return m_face_ascent_b; } double descent_b() const { return m_face_descent_b; } bool add_kerning( const cached_glyph *first, const cached_glyph *second, double* x, double* y) { if( !first || !second ) return false; select_face(); return m_face->add_kerning( first->glyph_index, second->glyph_index, x, y ); } void select_face() { m_face->select_instance( m_height, m_width, m_hinting, m_rendering ); } const cached_glyph *get_glyph(unsigned cp) { const cached_glyph *glyph=m_glyphs.find_glyph(cp); if( glyph==0 ) { typename FontEngine::prepared_glyph prepared; select_face(); bool success=m_face->prepare_glyph(cp, &prepared); if( success ) { glyph=m_glyphs.cache_glyph( this, prepared.glyph_code, prepared.glyph_index, prepared.data_size, prepared.data_type, prepared.bounds, prepared.advance_x, prepared.advance_y ); assert( glyph!=0 ); m_face->write_glyph_to(&prepared,glyph->data); } } return glyph; } font_engine_type& m_engine; typename FontEngine::loaded_face *m_face; double m_height; double m_width; bool m_hinting; glyph_rendering m_rendering; double m_face_height; double m_face_width; double m_face_ascent; double m_face_descent; double m_face_ascent_b; double m_face_descent_b; cached_glyphs m_glyphs; }; //-------------------------------------------------------------------- font_cache_manager(font_engine_type& engine, unsigned max_fonts=32) :m_engine(engine) { } //-------------------------------------------------------------------- void init_embedded_adaptors(const cached_glyph* gl, double x, double y, double scale=1.0) { if(gl) { switch(gl->data_type) { default: return; case glyph_data_mono: m_mono_adaptor.init(gl->data, gl->data_size, x, y); break; case glyph_data_gray8: m_gray8_adaptor.init(gl->data, gl->data_size, x, y); break; case glyph_data_outline: m_path_adaptor.init(gl->data, gl->data_size, x, y, scale); break; } } } //-------------------------------------------------------------------- path_adaptor_type& path_adaptor() { return m_path_adaptor; } gray8_adaptor_type& gray8_adaptor() { return m_gray8_adaptor; } gray8_scanline_type& gray8_scanline() { return m_gray8_scanline; } mono_adaptor_type& mono_adaptor() { return m_mono_adaptor; } mono_scanline_type& mono_scanline() { return m_mono_scanline; } private: //-------------------------------------------------------------------- font_cache_manager(const self_type&); const self_type& operator = (const self_type&); font_engine_type& m_engine; path_adaptor_type m_path_adaptor; gray8_adaptor_type m_gray8_adaptor; gray8_scanline_type m_gray8_scanline; mono_adaptor_type m_mono_adaptor; mono_scanline_type m_mono_scanline; }; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_solid.h0000644000175000017500000000333513233644505024124 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // span_solid_rgba8 // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_SOLID_INCLUDED #define AGG_SPAN_SOLID_INCLUDED #include "agg_basics.h" namespace agg24 { //--------------------------------------------------------------span_solid template class span_solid { public: typedef ColorT color_type; //-------------------------------------------------------------------- void color(const color_type& c) { m_color = c; } const color_type& color() const { return m_color; } //-------------------------------------------------------------------- void prepare() {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { do { *span++ = m_color; } while(--len); } private: color_type m_color; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_image_filter_rgb.h0000644000175000017500000010721713233644505026277 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_IMAGE_FILTER_RGB_INCLUDED #define AGG_SPAN_IMAGE_FILTER_RGB_INCLUDED #include "agg_basics.h" #include "agg_color_rgba.h" #include "agg_span_image_filter.h" namespace agg24 { //===============================================span_image_filter_rgb_nn template class span_image_filter_rgb_nn : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgb_nn() {} span_image_filter_rgb_nn(source_type& src, interpolator_type& inter) : base_type(src, inter, 0) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); do { base_type::interpolator().coordinates(&x, &y); const value_type* fg_ptr = (const value_type*) base_type::source().span(x >> image_subpixel_shift, y >> image_subpixel_shift, 1); span->r = fg_ptr[order_type::R]; span->g = fg_ptr[order_type::G]; span->b = fg_ptr[order_type::B]; span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //==========================================span_image_filter_rgb_bilinear template class span_image_filter_rgb_bilinear : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgb_bilinear() {} span_image_filter_rgb_bilinear(source_type& src, interpolator_type& inter) : base_type(src, inter, 0) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[3]; const value_type *fg_ptr; do { int x_hr; int y_hr; base_type::interpolator().coordinates(&x_hr, &y_hr); x_hr -= base_type::filter_dx_int(); y_hr -= base_type::filter_dy_int(); int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; unsigned weight; fg[0] = fg[1] = fg[2] = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = x_hr * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_y(); weight = (image_subpixel_scale - x_hr) * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = x_hr * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr; span->r = color_type::downshift(fg[order_type::R], image_subpixel_shift * 2); span->g = color_type::downshift(fg[order_type::G], image_subpixel_shift * 2); span->b = color_type::downshift(fg[order_type::B], image_subpixel_shift * 2); span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //=====================================span_image_filter_rgb_bilinear_clip template class span_image_filter_rgb_bilinear_clip : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgb_bilinear_clip() {} span_image_filter_rgb_bilinear_clip(source_type& src, const color_type& back_color, interpolator_type& inter) : base_type(src, inter, 0), m_back_color(back_color) {} const color_type& background_color() const { return m_back_color; } void background_color(const color_type& v) { m_back_color = v; } //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[3]; long_type src_alpha; value_type back_r = m_back_color.r; value_type back_g = m_back_color.g; value_type back_b = m_back_color.b; value_type back_a = m_back_color.a; const value_type *fg_ptr; int maxx = base_type::source().width() - 1; int maxy = base_type::source().height() - 1; do { int x_hr; int y_hr; base_type::interpolator().coordinates(&x_hr, &y_hr); x_hr -= base_type::filter_dx_int(); y_hr -= base_type::filter_dy_int(); int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; unsigned weight; if(x_lr >= 0 && y_lr >= 0 && x_lr < maxx && y_lr < maxy) { fg[0] = fg[1] = fg[2] = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; weight = x_hr * (image_subpixel_scale - y_hr); fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; ++y_lr; fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; weight = (image_subpixel_scale - x_hr) * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; weight = x_hr * y_hr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; fg[0] = color_type::downshift(fg[0], image_subpixel_shift * 2); fg[1] = color_type::downshift(fg[1], image_subpixel_shift * 2); fg[2] = color_type::downshift(fg[2], image_subpixel_shift * 2); src_alpha = color_type::full_value(); } else { if(x_lr < -1 || y_lr < -1 || x_lr > maxx || y_lr > maxy) { fg[order_type::R] = back_r; fg[order_type::G] = back_g; fg[order_type::B] = back_b; src_alpha = back_a; } else { fg[0] = fg[1] = fg[2] = src_alpha = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; src_alpha += weight * color_type::full_value(); } else { fg[order_type::R] += back_r * weight; fg[order_type::G] += back_g * weight; fg[order_type::B] += back_b * weight; src_alpha += back_a * weight; } x_lr++; weight = x_hr * (image_subpixel_scale - y_hr); if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; src_alpha += weight * color_type::full_value(); } else { fg[order_type::R] += back_r * weight; fg[order_type::G] += back_g * weight; fg[order_type::B] += back_b * weight; src_alpha += back_a * weight; } x_lr--; y_lr++; weight = (image_subpixel_scale - x_hr) * y_hr; if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; src_alpha += weight * color_type::full_value(); } else { fg[order_type::R] += back_r * weight; fg[order_type::G] += back_g * weight; fg[order_type::B] += back_b * weight; src_alpha += back_a * weight; } x_lr++; weight = x_hr * y_hr; if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg_ptr = (const value_type*) base_type::source().row_ptr(y_lr) + x_lr + x_lr + x_lr; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr++; src_alpha += weight * color_type::full_value(); } else { fg[order_type::R] += back_r * weight; fg[order_type::G] += back_g * weight; fg[order_type::B] += back_b * weight; src_alpha += back_a * weight; } fg[0] = color_type::downshift(fg[0], image_subpixel_shift * 2); fg[1] = color_type::downshift(fg[1], image_subpixel_shift * 2); fg[2] = color_type::downshift(fg[2], image_subpixel_shift * 2); src_alpha = color_type::downshift(src_alpha, image_subpixel_shift * 2); } } span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = (value_type)src_alpha; ++span; ++base_type::interpolator(); } while(--len); } private: color_type m_back_color; }; //===============================================span_image_filter_rgb_2x2 template class span_image_filter_rgb_2x2 : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgb_2x2() {} span_image_filter_rgb_2x2(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, &filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[3]; const value_type *fg_ptr; const int16* weight_array = base_type::filter().weight_array() + ((base_type::filter().diameter()/2 - 1) << image_subpixel_shift); do { int x_hr; int y_hr; base_type::interpolator().coordinates(&x_hr, &y_hr); x_hr -= base_type::filter_dx_int(); y_hr -= base_type::filter_dy_int(); int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; unsigned weight; fg[0] = fg[1] = fg[2] = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr + image_subpixel_scale] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = (weight_array[x_hr] * weight_array[y_hr + image_subpixel_scale] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_y(); weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = (weight_array[x_hr] * weight_array[y_hr] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr; fg[0] = color_type::downshift(fg[0], image_filter_shift); fg[1] = color_type::downshift(fg[1], image_filter_shift); fg[2] = color_type::downshift(fg[2], image_filter_shift); if(fg[order_type::R] > color_type::full_value()) fg[order_type::R] = color_type::full_value(); if(fg[order_type::G] > color_type::full_value()) fg[order_type::G] = color_type::full_value(); if(fg[order_type::B] > color_type::full_value()) fg[order_type::B] = color_type::full_value(); span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //===================================================span_image_filter_rgb template class span_image_filter_rgb : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_rgb() {} span_image_filter_rgb(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, &filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[3]; const value_type *fg_ptr; unsigned diameter = base_type::filter().diameter(); int start = base_type::filter().start(); const int16* weight_array = base_type::filter().weight_array(); int x_count; int weight_y; do { base_type::interpolator().coordinates(&x, &y); x -= base_type::filter_dx_int(); y -= base_type::filter_dy_int(); int x_hr = x; int y_hr = y; int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; fg[0] = fg[1] = fg[2] = 0; int x_fract = x_hr & image_subpixel_mask; unsigned y_count = diameter; y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask); fg_ptr = (const value_type*)base_type::source().span(x_lr + start, y_lr + start, diameter); for(;;) { x_count = diameter; weight_y = weight_array[y_hr]; x_hr = image_subpixel_mask - x_fract; for(;;) { int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> image_filter_shift; fg[0] += weight * *fg_ptr++; fg[1] += weight * *fg_ptr++; fg[2] += weight * *fg_ptr; if(--x_count == 0) break; x_hr += image_subpixel_scale; fg_ptr = (const value_type*)base_type::source().next_x(); } if(--y_count == 0) break; y_hr += image_subpixel_scale; fg_ptr = (const value_type*)base_type::source().next_y(); } fg[0] = color_type::downshift(fg[0], image_filter_shift); fg[1] = color_type::downshift(fg[1], image_filter_shift); fg[2] = color_type::downshift(fg[2], image_filter_shift); if(fg[0] < 0) fg[0] = 0; if(fg[1] < 0) fg[1] = 0; if(fg[2] < 0) fg[2] = 0; if(fg[order_type::R] > color_type::full_value()) fg[order_type::R] = color_type::full_value(); if(fg[order_type::G] > color_type::full_value()) fg[order_type::G] = color_type::full_value(); if(fg[order_type::B] > color_type::full_value()) fg[order_type::B] = color_type::full_value(); span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //==========================================span_image_resample_rgb_affine template class span_image_resample_rgb_affine : public span_image_resample_affine { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef span_image_resample_affine base_type; typedef typename base_type::interpolator_type interpolator_type; typedef typename color_type::value_type value_type; typedef typename color_type::long_type long_type; enum base_scale_e { downscale_shift = image_filter_shift }; //-------------------------------------------------------------------- span_image_resample_rgb_affine() {} span_image_resample_rgb_affine(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[3]; int diameter = base_type::filter().diameter(); int filter_scale = diameter << image_subpixel_shift; int radius_x = (diameter * base_type::m_rx) >> 1; int radius_y = (diameter * base_type::m_ry) >> 1; int len_x_lr = (diameter * base_type::m_rx + image_subpixel_mask) >> image_subpixel_shift; const int16* weight_array = base_type::filter().weight_array(); do { base_type::interpolator().coordinates(&x, &y); x += base_type::filter_dx_int() - radius_x; y += base_type::filter_dy_int() - radius_y; fg[0] = fg[1] = fg[2] = 0; int y_lr = y >> image_subpixel_shift; int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * base_type::m_ry_inv) >> image_subpixel_shift; int total_weight = 0; int x_lr = x >> image_subpixel_shift; int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * base_type::m_rx_inv) >> image_subpixel_shift; int x_hr2 = x_hr; const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); for(;;) { int weight_y = weight_array[y_hr]; x_hr = x_hr2; for(;;) { int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; fg[0] += *fg_ptr++ * weight; fg[1] += *fg_ptr++ * weight; fg[2] += *fg_ptr * weight; total_weight += weight; x_hr += base_type::m_rx_inv; if(x_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_x(); } y_hr += base_type::m_ry_inv; if(y_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_y(); } fg[0] /= total_weight; fg[1] /= total_weight; fg[2] /= total_weight; if(fg[0] < 0) fg[0] = 0; if(fg[1] < 0) fg[1] = 0; if(fg[2] < 0) fg[2] = 0; if(fg[order_type::R] > color_type::full_value()) fg[order_type::R] = color_type::full_value(); if(fg[order_type::G] > color_type::full_value()) fg[order_type::G] = color_type::full_value(); if(fg[order_type::B] > color_type::full_value()) fg[order_type::B] = color_type::full_value(); span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //=================================================span_image_resample_rgb template class span_image_resample_rgb : public span_image_resample { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef Interpolator interpolator_type; typedef span_image_resample base_type; typedef typename color_type::value_type value_type; typedef typename color_type::long_type long_type; enum base_scale_e { downscale_shift = image_filter_shift }; //-------------------------------------------------------------------- span_image_resample_rgb() {} span_image_resample_rgb(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg[3]; int diameter = base_type::filter().diameter(); int filter_scale = diameter << image_subpixel_shift; const int16* weight_array = base_type::filter().weight_array(); do { int rx; int ry; int rx_inv = image_subpixel_scale; int ry_inv = image_subpixel_scale; base_type::interpolator().coordinates(&x, &y); base_type::interpolator().local_scale(&rx, &ry); base_type::adjust_scale(&rx, &ry); rx_inv = image_subpixel_scale * image_subpixel_scale / rx; ry_inv = image_subpixel_scale * image_subpixel_scale / ry; int radius_x = (diameter * rx) >> 1; int radius_y = (diameter * ry) >> 1; int len_x_lr = (diameter * rx + image_subpixel_mask) >> image_subpixel_shift; x += base_type::filter_dx_int() - radius_x; y += base_type::filter_dy_int() - radius_y; fg[0] = fg[1] = fg[2] = 0; int y_lr = y >> image_subpixel_shift; int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * ry_inv) >> image_subpixel_shift; int total_weight = 0; int x_lr = x >> image_subpixel_shift; int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * rx_inv) >> image_subpixel_shift; int x_hr2 = x_hr; const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); for(;;) { int weight_y = weight_array[y_hr]; x_hr = x_hr2; for(;;) { int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; fg[0] += *fg_ptr++ * weight; fg[1] += *fg_ptr++ * weight; fg[2] += *fg_ptr * weight; total_weight += weight; x_hr += rx_inv; if(x_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_x(); } y_hr += ry_inv; if(y_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_y(); } fg[0] /= total_weight; fg[1] /= total_weight; fg[2] /= total_weight; if(fg[0] < 0) fg[0] = 0; if(fg[1] < 0) fg[1] = 0; if(fg[2] < 0) fg[2] = 0; if(fg[order_type::R] > color_type::full_value()) fg[order_type::R] = color_type::full_value(); if(fg[order_type::G] > color_type::full_value()) fg[order_type::G] = color_type::full_value(); if(fg[order_type::B] > color_type::full_value()) fg[order_type::B] = color_type::full_value(); span->r = (value_type)fg[order_type::R]; span->g = (value_type)fg[order_type::G]; span->b = (value_type)fg[order_type::B]; span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_concat.h0000644000175000017500000000441013233644505024260 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CONV_CONCAT_INCLUDED #define AGG_CONV_CONCAT_INCLUDED #include "agg_basics.h" namespace agg24 { //=============================================================conv_concat // Concatenation of two paths. Usually used to combine lines or curves // with markers such as arrowheads template class conv_concat { public: conv_concat(VS1& source1, VS2& source2) : m_source1(&source1), m_source2(&source2), m_status(2) {} void attach1(VS1& source) { m_source1 = &source; } void attach2(VS2& source) { m_source2 = &source; } void rewind(unsigned path_id) { m_source1->rewind(path_id); m_source2->rewind(0); m_status = 0; } unsigned vertex(double* x, double* y) { unsigned cmd; if(m_status == 0) { cmd = m_source1->vertex(x, y); if(!is_stop(cmd)) return cmd; m_status = 1; } if(m_status == 1) { cmd = m_source2->vertex(x, y); if(!is_stop(cmd)) return cmd; m_status = 2; } return path_cmd_stop; } private: conv_concat(const conv_concat&); const conv_concat& operator = (const conv_concat&); VS1* m_source1; VS2* m_source2; int m_status; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_gpc.h0000644000175000017500000003070313233644505023566 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // General Polygon Clipper based on the GPC library by Alan Murta // Union, Intersection, XOR, A-B, B-A // Contact the author if you intend to use it in commercial applications! // http://www.cs.man.ac.uk/aig/staff/alan/software/ // Alan Murta (email: gpc@cs.man.ac.uk) // //---------------------------------------------------------------------------- #ifndef AGG_CONV_GPC_INCLUDED #define AGG_CONV_GPC_INCLUDED #include #include "agg_basics.h" #include "agg_array.h" extern "C" { #include "gpc.h" } namespace agg24 { enum gpc_op_e { gpc_or, gpc_and, gpc_xor, gpc_a_minus_b, gpc_b_minus_a }; //================================================================conv_gpc template class conv_gpc { enum status { status_move_to, status_line_to, status_stop }; struct contour_header_type { int num_vertices; int hole_flag; gpc_vertex* vertices; }; typedef pod_bvector vertex_array_type; typedef pod_bvector contour_header_array_type; public: typedef VSA source_a_type; typedef VSB source_b_type; typedef conv_gpc self_type; ~conv_gpc() { free_gpc_data(); } conv_gpc(source_a_type& a, source_b_type& b, gpc_op_e op = gpc_or) : m_src_a(&a), m_src_b(&b), m_status(status_move_to), m_vertex(-1), m_contour(-1), m_operation(op) { memset(&m_poly_a, 0, sizeof(m_poly_a)); memset(&m_poly_b, 0, sizeof(m_poly_b)); memset(&m_result, 0, sizeof(m_result)); } void attach1(VSA& source) { m_src_a = &source; } void attach2(VSB& source) { m_src_b = &source; } void operation(gpc_op_e v) { m_operation = v; } // Vertex Source Interface void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: conv_gpc(const conv_gpc&); const conv_gpc& operator = (const conv_gpc&); //-------------------------------------------------------------------- void free_polygon(gpc_polygon& p); void free_result(); void free_gpc_data(); void start_contour(); void add_vertex(double x, double y); void end_contour(unsigned orientation); void make_polygon(gpc_polygon& p); void start_extracting(); bool next_contour(); bool next_vertex(double* x, double* y); //-------------------------------------------------------------------- template void add(VS& src, gpc_polygon& p) { unsigned cmd; double x, y; double start_x = 0.0; double start_y = 0.0; bool line_to = false; unsigned orientation = 0; m_contour_accumulator.remove_all(); while(!is_stop(cmd = src.vertex(&x, &y))) { if(is_vertex(cmd)) { if(is_move_to(cmd)) { if(line_to) { end_contour(orientation); orientation = 0; } start_contour(); start_x = x; start_y = y; } add_vertex(x, y); line_to = true; } else { if(is_end_poly(cmd)) { orientation = get_orientation(cmd); if(line_to && is_closed(cmd)) { add_vertex(start_x, start_y); } } } } if(line_to) { end_contour(orientation); } make_polygon(p); } private: //-------------------------------------------------------------------- source_a_type* m_src_a; source_b_type* m_src_b; status m_status; int m_vertex; int m_contour; gpc_op_e m_operation; vertex_array_type m_vertex_accumulator; contour_header_array_type m_contour_accumulator; gpc_polygon m_poly_a; gpc_polygon m_poly_b; gpc_polygon m_result; }; //------------------------------------------------------------------------ template void conv_gpc::free_polygon(gpc_polygon& p) { int i; for(i = 0; i < p.num_contours; i++) { pod_allocator::deallocate(p.contour[i].vertex, p.contour[i].num_vertices); } pod_allocator::deallocate(p.contour, p.num_contours); memset(&p, 0, sizeof(gpc_polygon)); } //------------------------------------------------------------------------ template void conv_gpc::free_result() { if(m_result.contour) { gpc_free_polygon(&m_result); } memset(&m_result, 0, sizeof(m_result)); } //------------------------------------------------------------------------ template void conv_gpc::free_gpc_data() { free_polygon(m_poly_a); free_polygon(m_poly_b); free_result(); } //------------------------------------------------------------------------ template void conv_gpc::start_contour() { contour_header_type h; memset(&h, 0, sizeof(h)); m_contour_accumulator.add(h); m_vertex_accumulator.remove_all(); } //------------------------------------------------------------------------ template inline void conv_gpc::add_vertex(double x, double y) { gpc_vertex v; v.x = x; v.y = y; m_vertex_accumulator.add(v); } //------------------------------------------------------------------------ template void conv_gpc::end_contour(unsigned orientation) { if(m_contour_accumulator.size()) { if(m_vertex_accumulator.size() > 2) { contour_header_type& h = m_contour_accumulator[m_contour_accumulator.size() - 1]; h.num_vertices = m_vertex_accumulator.size(); h.hole_flag = 0; // TO DO: Clarify the "holes" //if(is_cw(orientation)) h.hole_flag = 1; h.vertices = pod_allocator::allocate(h.num_vertices); gpc_vertex* d = h.vertices; int i; for(i = 0; i < h.num_vertices; i++) { const gpc_vertex& s = m_vertex_accumulator[i]; d->x = s.x; d->y = s.y; ++d; } } else { m_vertex_accumulator.remove_last(); } } } //------------------------------------------------------------------------ template void conv_gpc::make_polygon(gpc_polygon& p) { free_polygon(p); if(m_contour_accumulator.size()) { p.num_contours = m_contour_accumulator.size(); p.hole = 0; p.contour = pod_allocator::allocate(p.num_contours); int i; gpc_vertex_list* pv = p.contour; for(i = 0; i < p.num_contours; i++) { const contour_header_type& h = m_contour_accumulator[i]; pv->num_vertices = h.num_vertices; pv->vertex = h.vertices; ++pv; } } } //------------------------------------------------------------------------ template void conv_gpc::start_extracting() { m_status = status_move_to; m_contour = -1; m_vertex = -1; } //------------------------------------------------------------------------ template bool conv_gpc::next_contour() { if(++m_contour < m_result.num_contours) { m_vertex = -1; return true; } return false; } //------------------------------------------------------------------------ template inline bool conv_gpc::next_vertex(double* x, double* y) { const gpc_vertex_list& vlist = m_result.contour[m_contour]; if(++m_vertex < vlist.num_vertices) { const gpc_vertex& v = vlist.vertex[m_vertex]; *x = v.x; *y = v.y; return true; } return false; } //------------------------------------------------------------------------ template void conv_gpc::rewind(unsigned path_id) { free_result(); m_src_a->rewind(path_id); m_src_b->rewind(path_id); add(*m_src_a, m_poly_a); add(*m_src_b, m_poly_b); switch(m_operation) { case gpc_or: gpc_polygon_clip(GPC_UNION, &m_poly_a, &m_poly_b, &m_result); break; case gpc_and: gpc_polygon_clip(GPC_INT, &m_poly_a, &m_poly_b, &m_result); break; case gpc_xor: gpc_polygon_clip(GPC_XOR, &m_poly_a, &m_poly_b, &m_result); break; case gpc_a_minus_b: gpc_polygon_clip(GPC_DIFF, &m_poly_a, &m_poly_b, &m_result); break; case gpc_b_minus_a: gpc_polygon_clip(GPC_DIFF, &m_poly_b, &m_poly_a, &m_result); break; } start_extracting(); } //------------------------------------------------------------------------ template unsigned conv_gpc::vertex(double* x, double* y) { if(m_status == status_move_to) { if(next_contour()) { if(next_vertex(x, y)) { m_status = status_line_to; return path_cmd_move_to; } m_status = status_stop; return path_cmd_end_poly | path_flags_close; } } else { if(next_vertex(x, y)) { return path_cmd_line_to; } else { m_status = status_move_to; } return path_cmd_end_poly | path_flags_close; } return path_cmd_stop; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_image_filters.h0000644000175000017500000003574213233644505024612 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Image transformation filters, // Filtering classes (image_filter_lut, image_filter), // Basic filter shape classes //---------------------------------------------------------------------------- #ifndef AGG_IMAGE_FILTERS_INCLUDED #define AGG_IMAGE_FILTERS_INCLUDED #include "agg_array.h" #include "agg_math.h" namespace agg24 { // See Implementation agg_image_filters.cpp enum image_filter_scale_e { image_filter_shift = 14, //----image_filter_shift image_filter_scale = 1 << image_filter_shift, //----image_filter_scale image_filter_mask = image_filter_scale - 1 //----image_filter_mask }; enum image_subpixel_scale_e { image_subpixel_shift = 8, //----image_subpixel_shift image_subpixel_scale = 1 << image_subpixel_shift, //----image_subpixel_scale image_subpixel_mask = image_subpixel_scale - 1 //----image_subpixel_mask }; //-----------------------------------------------------image_filter_lut class image_filter_lut { public: template void calculate(const FilterF& filter, bool normalization=true) { double r = filter.radius(); realloc_lut(r); unsigned i; unsigned pivot = diameter() << (image_subpixel_shift - 1); for(i = 0; i < pivot; i++) { double x = double(i) / double(image_subpixel_scale); double y = filter.calc_weight(x); m_weight_array[pivot + i] = m_weight_array[pivot - i] = (int16)iround(y * image_filter_scale); } unsigned end = (diameter() << image_subpixel_shift) - 1; m_weight_array[0] = m_weight_array[end]; if(normalization) { normalize(); } } image_filter_lut() : m_radius(0), m_diameter(0), m_start(0) {} template image_filter_lut(const FilterF& filter, bool normalization=true) { calculate(filter, normalization); } double radius() const { return m_radius; } unsigned diameter() const { return m_diameter; } int start() const { return m_start; } const int16* weight_array() const { return &m_weight_array[0]; } void normalize(); private: void realloc_lut(double radius); image_filter_lut(const image_filter_lut&); const image_filter_lut& operator = (const image_filter_lut&); double m_radius; unsigned m_diameter; int m_start; pod_array m_weight_array; }; //--------------------------------------------------------image_filter template class image_filter : public image_filter_lut { public: image_filter() { calculate(m_filter_function); } private: FilterF m_filter_function; }; //-----------------------------------------------image_filter_bilinear struct image_filter_bilinear { static double radius() { return 1.0; } static double calc_weight(double x) { return 1.0 - x; } }; //-----------------------------------------------image_filter_hanning struct image_filter_hanning { static double radius() { return 1.0; } static double calc_weight(double x) { return 0.5 + 0.5 * cos(pi * x); } }; //-----------------------------------------------image_filter_hamming struct image_filter_hamming { static double radius() { return 1.0; } static double calc_weight(double x) { return 0.54 + 0.46 * cos(pi * x); } }; //-----------------------------------------------image_filter_hermite struct image_filter_hermite { static double radius() { return 1.0; } static double calc_weight(double x) { return (2.0 * x - 3.0) * x * x + 1.0; } }; //------------------------------------------------image_filter_quadric struct image_filter_quadric { static double radius() { return 1.5; } static double calc_weight(double x) { double t; if(x < 0.5) return 0.75 - x * x; if(x < 1.5) {t = x - 1.5; return 0.5 * t * t;} return 0.0; } }; //------------------------------------------------image_filter_bicubic class image_filter_bicubic { static double pow3(double x) { return (x <= 0.0) ? 0.0 : x * x * x; } public: static double radius() { return 2.0; } static double calc_weight(double x) { return (1.0/6.0) * (pow3(x + 2) - 4 * pow3(x + 1) + 6 * pow3(x) - 4 * pow3(x - 1)); } }; //-------------------------------------------------image_filter_kaiser class image_filter_kaiser { double a; double i0a; double epsilon; public: image_filter_kaiser(double b = 6.33) : a(b), epsilon(1e-12) { i0a = 1.0 / bessel_i0(b); } static double radius() { return 1.0; } double calc_weight(double x) const { return bessel_i0(a * sqrt(1. - x * x)) * i0a; } private: double bessel_i0(double x) const { int i; double sum, y, t; sum = 1.; y = x * x / 4.; t = y; for(i = 2; t > epsilon; i++) { sum += t; t *= (double)y / (i * i); } return sum; } }; //----------------------------------------------image_filter_catrom struct image_filter_catrom { static double radius() { return 2.0; } static double calc_weight(double x) { if(x < 1.0) return 0.5 * (2.0 + x * x * (-5.0 + x * 3.0)); if(x < 2.0) return 0.5 * (4.0 + x * (-8.0 + x * (5.0 - x))); return 0.; } }; //---------------------------------------------image_filter_mitchell class image_filter_mitchell { double p0, p2, p3; double q0, q1, q2, q3; public: image_filter_mitchell(double b = 1.0/3.0, double c = 1.0/3.0) : p0((6.0 - 2.0 * b) / 6.0), p2((-18.0 + 12.0 * b + 6.0 * c) / 6.0), p3((12.0 - 9.0 * b - 6.0 * c) / 6.0), q0((8.0 * b + 24.0 * c) / 6.0), q1((-12.0 * b - 48.0 * c) / 6.0), q2((6.0 * b + 30.0 * c) / 6.0), q3((-b - 6.0 * c) / 6.0) {} static double radius() { return 2.0; } double calc_weight(double x) const { if(x < 1.0) return p0 + x * x * (p2 + x * p3); if(x < 2.0) return q0 + x * (q1 + x * (q2 + x * q3)); return 0.0; } }; //----------------------------------------------image_filter_spline16 struct image_filter_spline16 { static double radius() { return 2.0; } static double calc_weight(double x) { if(x < 1.0) { return ((x - 9.0/5.0 ) * x - 1.0/5.0 ) * x + 1.0; } return ((-1.0/3.0 * (x-1) + 4.0/5.0) * (x-1) - 7.0/15.0 ) * (x-1); } }; //---------------------------------------------image_filter_spline36 struct image_filter_spline36 { static double radius() { return 3.0; } static double calc_weight(double x) { if(x < 1.0) { return ((13.0/11.0 * x - 453.0/209.0) * x - 3.0/209.0) * x + 1.0; } if(x < 2.0) { return ((-6.0/11.0 * (x-1) + 270.0/209.0) * (x-1) - 156.0/ 209.0) * (x-1); } return ((1.0/11.0 * (x-2) - 45.0/209.0) * (x-2) + 26.0/209.0) * (x-2); } }; //----------------------------------------------image_filter_gaussian struct image_filter_gaussian { static double radius() { return 2.0; } static double calc_weight(double x) { return exp(-2.0 * x * x) * sqrt(2.0 / pi); } }; //------------------------------------------------image_filter_bessel struct image_filter_bessel { static double radius() { return 3.2383; } static double calc_weight(double x) { return (x == 0.0) ? pi / 4.0 : besj(pi * x, 1) / (2.0 * x); } }; //-------------------------------------------------image_filter_sinc class image_filter_sinc { public: image_filter_sinc(double r) : m_radius(r < 2.0 ? 2.0 : r) {} double radius() const { return m_radius; } double calc_weight(double x) const { if(x == 0.0) return 1.0; x *= pi; return sin(x) / x; } private: double m_radius; }; //-----------------------------------------------image_filter_lanczos class image_filter_lanczos { public: image_filter_lanczos(double r) : m_radius(r < 2.0 ? 2.0 : r) {} double radius() const { return m_radius; } double calc_weight(double x) const { if(x == 0.0) return 1.0; if(x > m_radius) return 0.0; x *= pi; double xr = x / m_radius; return (sin(x) / x) * (sin(xr) / xr); } private: double m_radius; }; //----------------------------------------------image_filter_blackman class image_filter_blackman { public: image_filter_blackman(double r) : m_radius(r < 2.0 ? 2.0 : r) {} double radius() const { return m_radius; } double calc_weight(double x) const { if(x == 0.0) return 1.0; if(x > m_radius) return 0.0; x *= pi; double xr = x / m_radius; return (sin(x) / x) * (0.42 + 0.5*cos(xr) + 0.08*cos(2*xr)); } private: double m_radius; }; //------------------------------------------------image_filter_sinc36 class image_filter_sinc36 : public image_filter_sinc { public: image_filter_sinc36() : image_filter_sinc(3.0){} }; //------------------------------------------------image_filter_sinc64 class image_filter_sinc64 : public image_filter_sinc { public: image_filter_sinc64() : image_filter_sinc(4.0){} }; //-----------------------------------------------image_filter_sinc100 class image_filter_sinc100 : public image_filter_sinc { public: image_filter_sinc100() : image_filter_sinc(5.0){} }; //-----------------------------------------------image_filter_sinc144 class image_filter_sinc144 : public image_filter_sinc { public: image_filter_sinc144() : image_filter_sinc(6.0){} }; //-----------------------------------------------image_filter_sinc196 class image_filter_sinc196 : public image_filter_sinc { public: image_filter_sinc196() : image_filter_sinc(7.0){} }; //-----------------------------------------------image_filter_sinc256 class image_filter_sinc256 : public image_filter_sinc { public: image_filter_sinc256() : image_filter_sinc(8.0){} }; //---------------------------------------------image_filter_lanczos36 class image_filter_lanczos36 : public image_filter_lanczos { public: image_filter_lanczos36() : image_filter_lanczos(3.0){} }; //---------------------------------------------image_filter_lanczos64 class image_filter_lanczos64 : public image_filter_lanczos { public: image_filter_lanczos64() : image_filter_lanczos(4.0){} }; //--------------------------------------------image_filter_lanczos100 class image_filter_lanczos100 : public image_filter_lanczos { public: image_filter_lanczos100() : image_filter_lanczos(5.0){} }; //--------------------------------------------image_filter_lanczos144 class image_filter_lanczos144 : public image_filter_lanczos { public: image_filter_lanczos144() : image_filter_lanczos(6.0){} }; //--------------------------------------------image_filter_lanczos196 class image_filter_lanczos196 : public image_filter_lanczos { public: image_filter_lanczos196() : image_filter_lanczos(7.0){} }; //--------------------------------------------image_filter_lanczos256 class image_filter_lanczos256 : public image_filter_lanczos { public: image_filter_lanczos256() : image_filter_lanczos(8.0){} }; //--------------------------------------------image_filter_blackman36 class image_filter_blackman36 : public image_filter_blackman { public: image_filter_blackman36() : image_filter_blackman(3.0){} }; //--------------------------------------------image_filter_blackman64 class image_filter_blackman64 : public image_filter_blackman { public: image_filter_blackman64() : image_filter_blackman(4.0){} }; //-------------------------------------------image_filter_blackman100 class image_filter_blackman100 : public image_filter_blackman { public: image_filter_blackman100() : image_filter_blackman(5.0){} }; //-------------------------------------------image_filter_blackman144 class image_filter_blackman144 : public image_filter_blackman { public: image_filter_blackman144() : image_filter_blackman(6.0){} }; //-------------------------------------------image_filter_blackman196 class image_filter_blackman196 : public image_filter_blackman { public: image_filter_blackman196() : image_filter_blackman(7.0){} }; //-------------------------------------------image_filter_blackman256 class image_filter_blackman256 : public image_filter_blackman { public: image_filter_blackman256() : image_filter_blackman(8.0){} }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_trans_bilinear.h0000644000175000017500000001275213233644505024770 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Bilinear 2D transformations // //---------------------------------------------------------------------------- #ifndef AGG_TRANS_BILINEAR_INCLUDED #define AGG_TRANS_BILINEAR_INCLUDED #include "agg_basics.h" #include "agg_simul_eq.h" namespace agg24 { //==========================================================trans_bilinear class trans_bilinear { public: //-------------------------------------------------------------------- trans_bilinear() : m_valid(false) {} //-------------------------------------------------------------------- // Arbitrary quadrangle transformations trans_bilinear(const double* src, const double* dst) { quad_to_quad(src, dst); } //-------------------------------------------------------------------- // Direct transformations trans_bilinear(double x1, double y1, double x2, double y2, const double* quad) { rect_to_quad(x1, y1, x2, y2, quad); } //-------------------------------------------------------------------- // Reverse transformations trans_bilinear(const double* quad, double x1, double y1, double x2, double y2) { quad_to_rect(quad, x1, y1, x2, y2); } //-------------------------------------------------------------------- // Set the transformations using two arbitrary quadrangles. void quad_to_quad(const double* src, const double* dst) { double left[4][4]; double right[4][2]; unsigned i; for(i = 0; i < 4; i++) { unsigned ix = i * 2; unsigned iy = ix + 1; left[i][0] = 1.0; left[i][1] = src[ix] * src[iy]; left[i][2] = src[ix]; left[i][3] = src[iy]; right[i][0] = dst[ix]; right[i][1] = dst[iy]; } m_valid = simul_eq<4, 2>::solve(left, right, m_mtx); } //-------------------------------------------------------------------- // Set the direct transformations, i.e., rectangle -> quadrangle void rect_to_quad(double x1, double y1, double x2, double y2, const double* quad) { double src[8]; src[0] = src[6] = x1; src[2] = src[4] = x2; src[1] = src[3] = y1; src[5] = src[7] = y2; quad_to_quad(src, quad); } //-------------------------------------------------------------------- // Set the reverse transformations, i.e., quadrangle -> rectangle void quad_to_rect(const double* quad, double x1, double y1, double x2, double y2) { double dst[8]; dst[0] = dst[6] = x1; dst[2] = dst[4] = x2; dst[1] = dst[3] = y1; dst[5] = dst[7] = y2; quad_to_quad(quad, dst); } //-------------------------------------------------------------------- // Check if the equations were solved successfully bool is_valid() const { return m_valid; } //-------------------------------------------------------------------- // Transform a point (x, y) void transform(double* x, double* y) const { double tx = *x; double ty = *y; double xy = tx * ty; *x = m_mtx[0][0] + m_mtx[1][0] * xy + m_mtx[2][0] * tx + m_mtx[3][0] * ty; *y = m_mtx[0][1] + m_mtx[1][1] * xy + m_mtx[2][1] * tx + m_mtx[3][1] * ty; } //-------------------------------------------------------------------- class iterator_x { double inc_x; double inc_y; public: double x; double y; iterator_x() {} iterator_x(double tx, double ty, double step, const double m[4][2]) : inc_x(m[1][0] * step * ty + m[2][0] * step), inc_y(m[1][1] * step * ty + m[2][1] * step), x(m[0][0] + m[1][0] * tx * ty + m[2][0] * tx + m[3][0] * ty), y(m[0][1] + m[1][1] * tx * ty + m[2][1] * tx + m[3][1] * ty) { } void operator ++ () { x += inc_x; y += inc_y; } }; iterator_x begin(double x, double y, double step) const { return iterator_x(x, y, step, m_mtx); } private: double m_mtx[4][2]; bool m_valid; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_scanline_storage_aa.h0000644000175000017500000006510013233644505025750 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_STORAGE_AA_INCLUDED #define AGG_SCANLINE_STORAGE_AA_INCLUDED #include #include #include #include "agg_array.h" namespace agg24 { //----------------------------------------------scanline_cell_storage template class scanline_cell_storage { struct extra_span { unsigned len; T* ptr; }; public: typedef T value_type; //--------------------------------------------------------------- ~scanline_cell_storage() { remove_all(); } //--------------------------------------------------------------- scanline_cell_storage() : m_cells(128-2), m_extra_storage() {} // Copying //--------------------------------------------------------------- scanline_cell_storage(const scanline_cell_storage& v) : m_cells(v.m_cells), m_extra_storage() { copy_extra_storage(v); } //--------------------------------------------------------------- const scanline_cell_storage& operator = (const scanline_cell_storage& v) { remove_all(); m_cells = v.m_cells; copy_extra_storage(v); return *this; } //--------------------------------------------------------------- void remove_all() { int i; for(i = m_extra_storage.size()-1; i >= 0; --i) { pod_allocator::deallocate(m_extra_storage[i].ptr, m_extra_storage[i].len); } m_extra_storage.remove_all(); m_cells.remove_all(); } //--------------------------------------------------------------- int add_cells(const T* cells, unsigned num_cells) { int idx = m_cells.allocate_continuous_block(num_cells); if(idx >= 0) { T* ptr = &m_cells[idx]; memcpy(ptr, cells, sizeof(T) * num_cells); return idx; } extra_span s; s.len = num_cells; s.ptr = pod_allocator::allocate(num_cells); memcpy(s.ptr, cells, sizeof(T) * num_cells); m_extra_storage.add(s); return -int(m_extra_storage.size()); } //--------------------------------------------------------------- const T* operator [] (int idx) const { if(idx >= 0) { if((unsigned)idx >= m_cells.size()) return 0; return &m_cells[(unsigned)idx]; } unsigned i = unsigned(-idx - 1); if(i >= m_extra_storage.size()) return 0; return m_extra_storage[i].ptr; } //--------------------------------------------------------------- T* operator [] (int idx) { if(idx >= 0) { if((unsigned)idx >= m_cells.size()) return 0; return &m_cells[(unsigned)idx]; } unsigned i = unsigned(-idx - 1); if(i >= m_extra_storage.size()) return 0; return m_extra_storage[i].ptr; } private: void copy_extra_storage(const scanline_cell_storage& v) { unsigned i; for(i = 0; i < v.m_extra_storage.size(); ++i) { const extra_span& src = v.m_extra_storage[i]; extra_span dst; dst.len = src.len; dst.ptr = pod_allocator::allocate(dst.len); memcpy(dst.ptr, src.ptr, dst.len * sizeof(T)); m_extra_storage.add(dst); } } pod_bvector m_cells; pod_bvector m_extra_storage; }; //-----------------------------------------------scanline_storage_aa template class scanline_storage_aa { public: typedef T cover_type; //--------------------------------------------------------------- struct span_data { int32 x; int32 len; // If negative, it's a solid span, covers is valid int covers_id; // The index of the cells in the scanline_cell_storage }; //--------------------------------------------------------------- struct scanline_data { int y; unsigned num_spans; unsigned start_span; }; //--------------------------------------------------------------- class embedded_scanline { public: //----------------------------------------------------------- class const_iterator { public: struct span { int32 x; int32 len; // If negative, it's a solid span, covers is valid const T* covers; }; const_iterator() : m_storage(0) {} const_iterator(embedded_scanline& sl) : m_storage(sl.m_storage), m_span_idx(sl.m_scanline.start_span) { init_span(); } const span& operator*() const { return m_span; } const span* operator->() const { return &m_span; } void operator ++ () { ++m_span_idx; init_span(); } private: void init_span() { const span_data& s = m_storage->span_by_index(m_span_idx); m_span.x = s.x; m_span.len = s.len; m_span.covers = m_storage->covers_by_index(s.covers_id); } scanline_storage_aa* m_storage; unsigned m_span_idx; span m_span; }; friend class const_iterator; //----------------------------------------------------------- embedded_scanline(const scanline_storage_aa& storage) : m_storage(&storage) { init(0); } //----------------------------------------------------------- void reset(int, int) {} unsigned num_spans() const { return m_scanline.num_spans; } int y() const { return m_scanline.y; } const_iterator begin() const { return const_iterator(*this); } //----------------------------------------------------------- void init(unsigned scanline_idx) { m_scanline_idx = scanline_idx; m_scanline = m_storage->scanline_by_index(m_scanline_idx); } private: const scanline_storage_aa* m_storage; scanline_data m_scanline; unsigned m_scanline_idx; }; //--------------------------------------------------------------- scanline_storage_aa() : m_covers(), m_spans(256-2), // Block increment size m_scanlines(), m_min_x( 0x7FFFFFFF), m_min_y( 0x7FFFFFFF), m_max_x(-0x7FFFFFFF), m_max_y(-0x7FFFFFFF), m_cur_scanline(0) { m_fake_scanline.y = 0; m_fake_scanline.num_spans = 0; m_fake_scanline.start_span = 0; m_fake_span.x = 0; m_fake_span.len = 0; m_fake_span.covers_id = 0; } // Renderer Interface //--------------------------------------------------------------- void prepare() { m_covers.remove_all(); m_scanlines.remove_all(); m_spans.remove_all(); m_min_x = 0x7FFFFFFF; m_min_y = 0x7FFFFFFF; m_max_x = -0x7FFFFFFF; m_max_y = -0x7FFFFFFF; m_cur_scanline = 0; } //--------------------------------------------------------------- template void render(const Scanline& sl) { scanline_data sl_this; int y = sl.y(); if(y < m_min_y) m_min_y = y; if(y > m_max_y) m_max_y = y; sl_this.y = y; sl_this.num_spans = sl.num_spans(); sl_this.start_span = m_spans.size(); typename Scanline::const_iterator span_iterator = sl.begin(); unsigned num_spans = sl_this.num_spans; for(;;) { span_data sp; sp.x = span_iterator->x; sp.len = span_iterator->len; int len = abs(int(sp.len)); sp.covers_id = m_covers.add_cells(span_iterator->covers, unsigned(len)); m_spans.add(sp); int x1 = sp.x; int x2 = sp.x + len - 1; if(x1 < m_min_x) m_min_x = x1; if(x2 > m_max_x) m_max_x = x2; if(--num_spans == 0) break; ++span_iterator; } m_scanlines.add(sl_this); } //--------------------------------------------------------------- // Iterate scanlines interface int min_x() const { return m_min_x; } int min_y() const { return m_min_y; } int max_x() const { return m_max_x; } int max_y() const { return m_max_y; } //--------------------------------------------------------------- bool rewind_scanlines() { m_cur_scanline = 0; return m_scanlines.size() > 0; } //--------------------------------------------------------------- template bool sweep_scanline(Scanline& sl) { sl.reset_spans(); for(;;) { if(m_cur_scanline >= m_scanlines.size()) return false; const scanline_data& sl_this = m_scanlines[m_cur_scanline]; unsigned num_spans = sl_this.num_spans; unsigned span_idx = sl_this.start_span; do { const span_data& sp = m_spans[span_idx++]; const T* covers = covers_by_index(sp.covers_id); if(sp.len < 0) { sl.add_span(sp.x, unsigned(-sp.len), *covers); } else { sl.add_cells(sp.x, sp.len, covers); } } while(--num_spans); ++m_cur_scanline; if(sl.num_spans()) { sl.finalize(sl_this.y); break; } } return true; } //--------------------------------------------------------------- // Specialization for embedded_scanline bool sweep_scanline(embedded_scanline& sl) { do { if(m_cur_scanline >= m_scanlines.size()) return false; sl.init(m_cur_scanline); ++m_cur_scanline; } while(sl.num_spans() == 0); return true; } //--------------------------------------------------------------- unsigned byte_size() const { unsigned i; unsigned size = sizeof(int32) * 4; // min_x, min_y, max_x, max_y for(i = 0; i < m_scanlines.size(); ++i) { size += sizeof(int32) * 3; // scanline size in bytes, Y, num_spans const scanline_data& sl_this = m_scanlines[i]; unsigned num_spans = sl_this.num_spans; unsigned span_idx = sl_this.start_span; do { const span_data& sp = m_spans[span_idx++]; size += sizeof(int32) * 2; // X, span_len if(sp.len < 0) { size += sizeof(T); // cover } else { size += sizeof(T) * unsigned(sp.len); // covers } } while(--num_spans); } return size; } //--------------------------------------------------------------- static void write_int32(int8u* dst, int32 val) { dst[0] = ((const int8u*)&val)[0]; dst[1] = ((const int8u*)&val)[1]; dst[2] = ((const int8u*)&val)[2]; dst[3] = ((const int8u*)&val)[3]; } //--------------------------------------------------------------- void serialize(int8u* data) const { unsigned i; write_int32(data, min_x()); // min_x data += sizeof(int32); write_int32(data, min_y()); // min_y data += sizeof(int32); write_int32(data, max_x()); // max_x data += sizeof(int32); write_int32(data, max_y()); // max_y data += sizeof(int32); for(i = 0; i < m_scanlines.size(); ++i) { const scanline_data& sl_this = m_scanlines[i]; int8u* size_ptr = data; data += sizeof(int32); // Reserve space for scanline size in bytes write_int32(data, sl_this.y); // Y data += sizeof(int32); write_int32(data, sl_this.num_spans); // num_spans data += sizeof(int32); unsigned num_spans = sl_this.num_spans; unsigned span_idx = sl_this.start_span; do { const span_data& sp = m_spans[span_idx++]; const T* covers = covers_by_index(sp.covers_id); write_int32(data, sp.x); // X data += sizeof(int32); write_int32(data, sp.len); // span_len data += sizeof(int32); if(sp.len < 0) { memcpy(data, covers, sizeof(T)); data += sizeof(T); } else { memcpy(data, covers, unsigned(sp.len) * sizeof(T)); data += sizeof(T) * unsigned(sp.len); } } while(--num_spans); write_int32(size_ptr, int32(unsigned(data - size_ptr))); } } //--------------------------------------------------------------- const scanline_data& scanline_by_index(unsigned i) const { return (i < m_scanlines.size()) ? m_scanlines[i] : m_fake_scanline; } //--------------------------------------------------------------- const span_data& span_by_index(unsigned i) const { return (i < m_spans.size()) ? m_spans[i] : m_fake_span; } //--------------------------------------------------------------- const T* covers_by_index(int i) const { return m_covers[i]; } private: scanline_cell_storage m_covers; pod_bvector m_spans; pod_bvector m_scanlines; span_data m_fake_span; scanline_data m_fake_scanline; int m_min_x; int m_min_y; int m_max_x; int m_max_y; unsigned m_cur_scanline; }; typedef scanline_storage_aa scanline_storage_aa8; //--------scanline_storage_aa8 typedef scanline_storage_aa scanline_storage_aa16; //--------scanline_storage_aa16 typedef scanline_storage_aa scanline_storage_aa32; //--------scanline_storage_aa32 //------------------------------------------serialized_scanlines_adaptor_aa template class serialized_scanlines_adaptor_aa { public: typedef T cover_type; //--------------------------------------------------------------------- class embedded_scanline { public: typedef T cover_type; //----------------------------------------------------------------- class const_iterator { public: struct span { int32 x; int32 len; // If negative, it's a solid span, "covers" is valid const T* covers; }; const_iterator() : m_ptr(0) {} const_iterator(const embedded_scanline* sl) : m_ptr(sl->m_ptr), m_dx(sl->m_dx) { init_span(); } const span& operator*() const { return m_span; } const span* operator->() const { return &m_span; } void operator ++ () { if(m_span.len < 0) { m_ptr += sizeof(T); } else { m_ptr += m_span.len * sizeof(T); } init_span(); } private: int read_int32() { int32 val; ((int8u*)&val)[0] = *m_ptr++; ((int8u*)&val)[1] = *m_ptr++; ((int8u*)&val)[2] = *m_ptr++; ((int8u*)&val)[3] = *m_ptr++; return val; } void init_span() { m_span.x = read_int32() + m_dx; m_span.len = read_int32(); m_span.covers = m_ptr; } const int8u* m_ptr; span m_span; int m_dx; }; friend class const_iterator; //----------------------------------------------------------------- embedded_scanline() : m_ptr(0), m_y(0), m_num_spans(0) {} //----------------------------------------------------------------- void reset(int, int) {} unsigned num_spans() const { return m_num_spans; } int y() const { return m_y; } const_iterator begin() const { return const_iterator(this); } private: //----------------------------------------------------------------- int read_int32() { int32 val; ((int8u*)&val)[0] = *m_ptr++; ((int8u*)&val)[1] = *m_ptr++; ((int8u*)&val)[2] = *m_ptr++; ((int8u*)&val)[3] = *m_ptr++; return val; } public: //----------------------------------------------------------------- void init(const int8u* ptr, int dx, int dy) { m_ptr = ptr; m_y = read_int32() + dy; m_num_spans = unsigned(read_int32()); m_dx = dx; } private: const int8u* m_ptr; int m_y; unsigned m_num_spans; int m_dx; }; public: //-------------------------------------------------------------------- serialized_scanlines_adaptor_aa() : m_data(0), m_end(0), m_ptr(0), m_dx(0), m_dy(0), m_min_x(0x7FFFFFFF), m_min_y(0x7FFFFFFF), m_max_x(-0x7FFFFFFF), m_max_y(-0x7FFFFFFF) {} //-------------------------------------------------------------------- serialized_scanlines_adaptor_aa(const int8u* data, unsigned size, double dx, double dy) : m_data(data), m_end(data + size), m_ptr(data), m_dx(iround(dx)), m_dy(iround(dy)), m_min_x(0x7FFFFFFF), m_min_y(0x7FFFFFFF), m_max_x(-0x7FFFFFFF), m_max_y(-0x7FFFFFFF) {} //-------------------------------------------------------------------- void init(const int8u* data, unsigned size, double dx, double dy) { m_data = data; m_end = data + size; m_ptr = data; m_dx = iround(dx); m_dy = iround(dy); m_min_x = 0x7FFFFFFF; m_min_y = 0x7FFFFFFF; m_max_x = -0x7FFFFFFF; m_max_y = -0x7FFFFFFF; } private: //-------------------------------------------------------------------- int read_int32() { int32 val; ((int8u*)&val)[0] = *m_ptr++; ((int8u*)&val)[1] = *m_ptr++; ((int8u*)&val)[2] = *m_ptr++; ((int8u*)&val)[3] = *m_ptr++; return val; } //-------------------------------------------------------------------- unsigned read_int32u() { int32u val; ((int8u*)&val)[0] = *m_ptr++; ((int8u*)&val)[1] = *m_ptr++; ((int8u*)&val)[2] = *m_ptr++; ((int8u*)&val)[3] = *m_ptr++; return val; } public: // Iterate scanlines interface //-------------------------------------------------------------------- bool rewind_scanlines() { m_ptr = m_data; if(m_ptr < m_end) { m_min_x = read_int32() + m_dx; m_min_y = read_int32() + m_dy; m_max_x = read_int32() + m_dx; m_max_y = read_int32() + m_dy; } return m_ptr < m_end; } //-------------------------------------------------------------------- int min_x() const { return m_min_x; } int min_y() const { return m_min_y; } int max_x() const { return m_max_x; } int max_y() const { return m_max_y; } //-------------------------------------------------------------------- template bool sweep_scanline(Scanline& sl) { sl.reset_spans(); for(;;) { if(m_ptr >= m_end) return false; read_int32(); // Skip scanline size in bytes int y = read_int32() + m_dy; unsigned num_spans = read_int32(); do { int x = read_int32() + m_dx; int len = read_int32(); if(len < 0) { sl.add_span(x, unsigned(-len), *m_ptr); m_ptr += sizeof(T); } else { sl.add_cells(x, len, m_ptr); m_ptr += len * sizeof(T); } } while(--num_spans); if(sl.num_spans()) { sl.finalize(y); break; } } return true; } //-------------------------------------------------------------------- // Specialization for embedded_scanline bool sweep_scanline(embedded_scanline& sl) { do { if(m_ptr >= m_end) return false; unsigned byte_size = read_int32u(); sl.init(m_ptr, m_dx, m_dy); m_ptr += byte_size - sizeof(int32); } while(sl.num_spans() == 0); return true; } private: const int8u* m_data; const int8u* m_end; const int8u* m_ptr; int m_dx; int m_dy; int m_min_x; int m_min_y; int m_max_x; int m_max_y; }; typedef serialized_scanlines_adaptor_aa serialized_scanlines_adaptor_aa8; //----serialized_scanlines_adaptor_aa8 typedef serialized_scanlines_adaptor_aa serialized_scanlines_adaptor_aa16; //----serialized_scanlines_adaptor_aa16 typedef serialized_scanlines_adaptor_aa serialized_scanlines_adaptor_aa32; //----serialized_scanlines_adaptor_aa32 } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_renderer_raster_text.h0000644000175000017500000002143713233644505026226 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_RENDERER_RASTER_TEXT_INCLUDED #define AGG_RENDERER_RASTER_TEXT_INCLUDED #include "agg_basics.h" namespace agg24 { //==============================================renderer_raster_htext_solid template class renderer_raster_htext_solid { public: typedef BaseRenderer ren_type; typedef GlyphGenerator glyph_gen_type; typedef typename glyph_gen_type::glyph_rect glyph_rect; typedef typename ren_type::color_type color_type; renderer_raster_htext_solid(ren_type& ren, glyph_gen_type& glyph) : m_ren(&ren), m_glyph(&glyph) {} void attach(ren_type& ren) { m_ren = &ren; } //-------------------------------------------------------------------- void color(const color_type& c) { m_color = c; } const color_type& color() const { return m_color; } //-------------------------------------------------------------------- template void render_text(double x, double y, const CharT* str, bool flip=false) { glyph_rect r; while(*str) { m_glyph->prepare(&r, x, y, *str, flip); if(r.x2 >= r.x1) { int i; if(flip) { for(i = r.y1; i <= r.y2; i++) { m_ren->blend_solid_hspan(r.x1, i, (r.x2 - r.x1 + 1), m_color, m_glyph->span(r.y2 - i)); } } else { for(i = r.y1; i <= r.y2; i++) { m_ren->blend_solid_hspan(r.x1, i, (r.x2 - r.x1 + 1), m_color, m_glyph->span(i - r.y1)); } } } x += r.dx; y += r.dy; ++str; } } private: ren_type* m_ren; glyph_gen_type* m_glyph; color_type m_color; }; //=============================================renderer_raster_vtext_solid template class renderer_raster_vtext_solid { public: typedef BaseRenderer ren_type; typedef GlyphGenerator glyph_gen_type; typedef typename glyph_gen_type::glyph_rect glyph_rect; typedef typename ren_type::color_type color_type; renderer_raster_vtext_solid(ren_type& ren, glyph_gen_type& glyph) : m_ren(&ren), m_glyph(&glyph) { } //-------------------------------------------------------------------- void color(const color_type& c) { m_color = c; } const color_type& color() const { return m_color; } //-------------------------------------------------------------------- template void render_text(double x, double y, const CharT* str, bool flip=false) { glyph_rect r; while(*str) { m_glyph->prepare(&r, x, y, *str, !flip); if(r.x2 >= r.x1) { int i; if(flip) { for(i = r.y1; i <= r.y2; i++) { m_ren->blend_solid_vspan(i, r.x1, (r.x2 - r.x1 + 1), m_color, m_glyph->span(i - r.y1)); } } else { for(i = r.y1; i <= r.y2; i++) { m_ren->blend_solid_vspan(i, r.x1, (r.x2 - r.x1 + 1), m_color, m_glyph->span(r.y2 - i)); } } } x += r.dx; y += r.dy; ++str; } } private: ren_type* m_ren; glyph_gen_type* m_glyph; color_type m_color; }; //===================================================renderer_raster_htext template class renderer_raster_htext { public: typedef ScanlineRenderer ren_type; typedef GlyphGenerator glyph_gen_type; typedef typename glyph_gen_type::glyph_rect glyph_rect; class scanline_single_span { public: typedef agg24::cover_type cover_type; //---------------------------------------------------------------- struct const_span { int x; unsigned len; const cover_type* covers; const_span() {} const_span(int x_, unsigned len_, const cover_type* covers_) : x(x_), len(len_), covers(covers_) {} }; typedef const const_span* const_iterator; //---------------------------------------------------------------- scanline_single_span(int x, int y, unsigned len, const cover_type* covers) : m_y(y), m_span(x, len, covers) {} //---------------------------------------------------------------- int y() const { return m_y; } unsigned num_spans() const { return 1; } const_iterator begin() const { return &m_span; } private: //---------------------------------------------------------------- int m_y; const_span m_span; }; //-------------------------------------------------------------------- renderer_raster_htext(ren_type& ren, glyph_gen_type& glyph) : m_ren(&ren), m_glyph(&glyph) { } //-------------------------------------------------------------------- template void render_text(double x, double y, const CharT* str, bool flip=false) { glyph_rect r; while(*str) { m_glyph->prepare(&r, x, y, *str, flip); if(r.x2 >= r.x1) { m_ren->prepare(); int i; if(flip) { for(i = r.y1; i <= r.y2; i++) { m_ren->render( scanline_single_span(r.x1, i, (r.x2 - r.x1 + 1), m_glyph->span(r.y2 - i))); } } else { for(i = r.y1; i <= r.y2; i++) { m_ren->render( scanline_single_span(r.x1, i, (r.x2 - r.x1 + 1), m_glyph->span(i - r.y1))); } } } x += r.dx; y += r.dy; ++str; } } private: ren_type* m_ren; glyph_gen_type* m_glyph; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_renderer_primitives.h0000644000175000017500000001753713233644505026063 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class renderer_primitives // //---------------------------------------------------------------------------- #ifndef AGG_RENDERER_PRIMITIVES_INCLUDED #define AGG_RENDERER_PRIMITIVES_INCLUDED #include "agg_basics.h" #include "agg_renderer_base.h" #include "agg_dda_line.h" #include "agg_ellipse_bresenham.h" namespace agg24 { //-----------------------------------------------------renderer_primitives template class renderer_primitives { public: typedef BaseRenderer base_ren_type; typedef typename base_ren_type::color_type color_type; //-------------------------------------------------------------------- explicit renderer_primitives(base_ren_type& ren) : m_ren(&ren), m_fill_color(), m_line_color(), m_curr_x(0), m_curr_y(0) {} void attach(base_ren_type& ren) { m_ren = &ren; } //-------------------------------------------------------------------- static int coord(double c) { return iround(c * line_bresenham_interpolator::subpixel_scale); } //-------------------------------------------------------------------- void fill_color(const color_type& c) { m_fill_color = c; } void line_color(const color_type& c) { m_line_color = c; } const color_type& fill_color() const { return m_fill_color; } const color_type& line_color() const { return m_line_color; } //-------------------------------------------------------------------- void rectangle(int x1, int y1, int x2, int y2) { m_ren->blend_hline(x1, y1, x2-1, m_line_color, cover_full); m_ren->blend_vline(x2, y1, y2-1, m_line_color, cover_full); m_ren->blend_hline(x1+1, y2, x2, m_line_color, cover_full); m_ren->blend_vline(x1, y1+1, y2, m_line_color, cover_full); } //-------------------------------------------------------------------- void solid_rectangle(int x1, int y1, int x2, int y2) { m_ren->blend_bar(x1, y1, x2, y2, m_fill_color, cover_full); } //-------------------------------------------------------------------- void outlined_rectangle(int x1, int y1, int x2, int y2) { rectangle(x1, y1, x2, y2); m_ren->blend_bar(x1+1, y1+1, x2-1, y2-1, m_fill_color, cover_full); } //-------------------------------------------------------------------- void ellipse(int x, int y, int rx, int ry) { ellipse_bresenham_interpolator ei(rx, ry); int dx = 0; int dy = -ry; do { dx += ei.dx(); dy += ei.dy(); m_ren->blend_pixel(x + dx, y + dy, m_line_color, cover_full); m_ren->blend_pixel(x + dx, y - dy, m_line_color, cover_full); m_ren->blend_pixel(x - dx, y - dy, m_line_color, cover_full); m_ren->blend_pixel(x - dx, y + dy, m_line_color, cover_full); ++ei; } while(dy < 0); } //-------------------------------------------------------------------- void solid_ellipse(int x, int y, int rx, int ry) { ellipse_bresenham_interpolator ei(rx, ry); int dx = 0; int dy = -ry; int dy0 = dy; int dx0 = dx; do { dx += ei.dx(); dy += ei.dy(); if(dy != dy0) { m_ren->blend_hline(x-dx0, y+dy0, x+dx0, m_fill_color, cover_full); m_ren->blend_hline(x-dx0, y-dy0, x+dx0, m_fill_color, cover_full); } dx0 = dx; dy0 = dy; ++ei; } while(dy < 0); m_ren->blend_hline(x-dx0, y+dy0, x+dx0, m_fill_color, cover_full); } //-------------------------------------------------------------------- void outlined_ellipse(int x, int y, int rx, int ry) { ellipse_bresenham_interpolator ei(rx, ry); int dx = 0; int dy = -ry; do { dx += ei.dx(); dy += ei.dy(); m_ren->blend_pixel(x + dx, y + dy, m_line_color, cover_full); m_ren->blend_pixel(x + dx, y - dy, m_line_color, cover_full); m_ren->blend_pixel(x - dx, y - dy, m_line_color, cover_full); m_ren->blend_pixel(x - dx, y + dy, m_line_color, cover_full); if(ei.dy() && dx) { m_ren->blend_hline(x-dx+1, y+dy, x+dx-1, m_fill_color, cover_full); m_ren->blend_hline(x-dx+1, y-dy, x+dx-1, m_fill_color, cover_full); } ++ei; } while(dy < 0); } //-------------------------------------------------------------------- void line(int x1, int y1, int x2, int y2, bool last=false) { line_bresenham_interpolator li(x1, y1, x2, y2); unsigned len = li.len(); if(len == 0) { if(last) { m_ren->blend_pixel(li.line_lr(x1), li.line_lr(y1), m_line_color, cover_full); } return; } if(last) ++len; if(li.is_ver()) { do { m_ren->blend_pixel(li.x2(), li.y1(), m_line_color, cover_full); li.vstep(); } while(--len); } else { do { m_ren->blend_pixel(li.x1(), li.y2(), m_line_color, cover_full); li.hstep(); } while(--len); } } //-------------------------------------------------------------------- void move_to(int x, int y) { m_curr_x = x; m_curr_y = y; } //-------------------------------------------------------------------- void line_to(int x, int y, bool last=false) { line(m_curr_x, m_curr_y, x, y, last); m_curr_x = x; m_curr_y = y; } //-------------------------------------------------------------------- const base_ren_type& ren() const { return *m_ren; } base_ren_type& ren() { return *m_ren; } //-------------------------------------------------------------------- const rendering_buffer& rbuf() const { return m_ren->rbuf(); } rendering_buffer& rbuf() { return m_ren->rbuf(); } private: base_ren_type* m_ren; color_type m_fill_color; color_type m_line_color; int m_curr_x; int m_curr_y; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_ellipse_bresenham.h0000644000175000017500000000560613233644505025455 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Simple Bresenham interpolator for ellipsees // //---------------------------------------------------------------------------- #ifndef AGG_ELLIPSE_BRESENHAM_INCLUDED #define AGG_ELLIPSE_BRESENHAM_INCLUDED #include "agg_basics.h" namespace agg24 { //------------------------------------------ellipse_bresenham_interpolator class ellipse_bresenham_interpolator { public: ellipse_bresenham_interpolator(int rx, int ry) : m_rx2(rx * rx), m_ry2(ry * ry), m_two_rx2(m_rx2 << 1), m_two_ry2(m_ry2 << 1), m_dx(0), m_dy(0), m_inc_x(0), m_inc_y(-ry * m_two_rx2), m_cur_f(0) {} int dx() const { return m_dx; } int dy() const { return m_dy; } void operator++ () { int mx, my, mxy, min_m; int fx, fy, fxy; mx = fx = m_cur_f + m_inc_x + m_ry2; if(mx < 0) mx = -mx; my = fy = m_cur_f + m_inc_y + m_rx2; if(my < 0) my = -my; mxy = fxy = m_cur_f + m_inc_x + m_ry2 + m_inc_y + m_rx2; if(mxy < 0) mxy = -mxy; min_m = mx; bool flag = true; if(min_m > my) { min_m = my; flag = false; } m_dx = m_dy = 0; if(min_m > mxy) { m_inc_x += m_two_ry2; m_inc_y += m_two_rx2; m_cur_f = fxy; m_dx = 1; m_dy = 1; return; } if(flag) { m_inc_x += m_two_ry2; m_cur_f = fx; m_dx = 1; return; } m_inc_y += m_two_rx2; m_cur_f = fy; m_dy = 1; } private: int m_rx2; int m_ry2; int m_two_rx2; int m_two_ry2; int m_dx; int m_dy; int m_inc_x; int m_inc_y; int m_cur_f; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_color_gray.h0000644000175000017500000010362113233644505024130 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- // // color types gray8, gray16 // //---------------------------------------------------------------------------- #ifndef AGG_COLOR_GRAY_INCLUDED #define AGG_COLOR_GRAY_INCLUDED #include "agg_basics.h" #include "agg_color_rgba.h" namespace agg24 { //===================================================================gray8 template struct gray8T { typedef int8u value_type; typedef int32u calc_type; typedef int32 long_type; enum base_scale_e { base_shift = 8, base_scale = 1 << base_shift, base_mask = base_scale - 1, base_MSB = 1 << (base_shift - 1) }; typedef gray8T self_type; value_type v; value_type a; static value_type luminance(const rgba& c) { // Calculate grayscale value as per ITU-R BT.709. return value_type(uround((0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b) * base_mask)); } static value_type luminance(const rgba8& c) { // Calculate grayscale value as per ITU-R BT.709. return value_type((55u * c.r + 184u * c.g + 18u * c.b) >> 8); } static void convert(gray8T& dst, const gray8T& src) { dst.v = sRGB_conv::rgb_from_sRGB(src.v); dst.a = src.a; } static void convert(gray8T& dst, const gray8T& src) { dst.v = sRGB_conv::rgb_to_sRGB(src.v); dst.a = src.a; } static void convert(gray8T& dst, const rgba8& src) { dst.v = luminance(src); dst.a = src.a; } static void convert(gray8T& dst, const srgba8& src) { // The RGB weights are only valid for linear values. convert(dst, rgba8(src)); } static void convert(gray8T& dst, const rgba8& src) { dst.v = sRGB_conv::rgb_to_sRGB(luminance(src)); dst.a = src.a; } static void convert(gray8T& dst, const srgba8& src) { // The RGB weights are only valid for linear values. convert(dst, rgba8(src)); } //-------------------------------------------------------------------- gray8T() {} //-------------------------------------------------------------------- explicit gray8T(unsigned v_, unsigned a_ = base_mask) : v(int8u(v_)), a(int8u(a_)) {} //-------------------------------------------------------------------- gray8T(const self_type& c, unsigned a_) : v(c.v), a(value_type(a_)) {} //-------------------------------------------------------------------- gray8T(const rgba& c) : v(luminance(c)), a(value_type(uround(c.a * base_mask))) {} //-------------------------------------------------------------------- template gray8T(const gray8T& c) { convert(*this, c); } //-------------------------------------------------------------------- template gray8T(const rgba8T& c) { convert(*this, c); } //-------------------------------------------------------------------- template T convert_from_sRGB() const { typename T::value_type y = sRGB_conv::rgb_from_sRGB(v); return T(y, y, y, sRGB_conv::alpha_from_sRGB(a)); } template T convert_to_sRGB() const { typename T::value_type y = sRGB_conv::rgb_to_sRGB(v); return T(y, y, y, sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- rgba8 make_rgba8(const linear&) const { return rgba8(v, v, v, a); } rgba8 make_rgba8(const sRGB&) const { return convert_from_sRGB(); } operator rgba8() const { return make_rgba8(Colorspace()); } //-------------------------------------------------------------------- srgba8 make_srgba8(const linear&) const { return convert_to_sRGB(); } srgba8 make_srgba8(const sRGB&) const { return srgba8(v, v, v, a); } operator srgba8() const { return make_rgba8(Colorspace()); } //-------------------------------------------------------------------- rgba16 make_rgba16(const linear&) const { rgba16::value_type rgb = (v << 8) | v; return rgba16(rgb, rgb, rgb, (a << 8) | a); } rgba16 make_rgba16(const sRGB&) const { return convert_from_sRGB(); } operator rgba16() const { return make_rgba16(Colorspace()); } //-------------------------------------------------------------------- rgba32 make_rgba32(const linear&) const { rgba32::value_type v32 = v / 255.0f; return rgba32(v32, v32, v32, a / 255.0f); } rgba32 make_rgba32(const sRGB&) const { return convert_from_sRGB(); } operator rgba32() const { return make_rgba32(Colorspace()); } //-------------------------------------------------------------------- static AGG_INLINE double to_double(value_type a) { return double(a) / base_mask; } //-------------------------------------------------------------------- static AGG_INLINE value_type from_double(double a) { return value_type(uround(a * base_mask)); } //-------------------------------------------------------------------- static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- static AGG_INLINE value_type full_value() { return base_mask; } //-------------------------------------------------------------------- AGG_INLINE bool is_transparent() const { return a == 0; } //-------------------------------------------------------------------- AGG_INLINE bool is_opaque() const { return a == base_mask; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int8u. static AGG_INLINE value_type multiply(value_type a, value_type b) { calc_type t = a * b + base_MSB; return value_type(((t >> base_shift) + t) >> base_shift); } //-------------------------------------------------------------------- static AGG_INLINE value_type demultiply(value_type a, value_type b) { if (a * b == 0) { return 0; } else if (a >= b) { return base_mask; } else return value_type((a * base_mask + (b >> 1)) / b); } //-------------------------------------------------------------------- template static AGG_INLINE T downscale(T a) { return a >> base_shift; } //-------------------------------------------------------------------- template static AGG_INLINE T downshift(T a, unsigned n) { return a >> n; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int8u. // Specifically for multiplying a color component by a cover. static AGG_INLINE value_type mult_cover(value_type a, value_type b) { return multiply(a, b); } //-------------------------------------------------------------------- static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return multiply(b, a); } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return p + q - multiply(p, a); } //-------------------------------------------------------------------- // Interpolate p to q by a. static AGG_INLINE value_type lerp(value_type p, value_type q, value_type a) { int t = (q - p) * a + base_MSB - (p > q); return value_type(p + (((t >> base_shift) + t) >> base_shift)); } //-------------------------------------------------------------------- self_type& clear() { v = a = 0; return *this; } //-------------------------------------------------------------------- self_type& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- self_type& opacity(double a_) { if (a_ < 0) a = 0; else if (a_ > 1) a = 1; else a = (value_type)uround(a_ * double(base_mask)); return *this; } //-------------------------------------------------------------------- double opacity() const { return double(a) / double(base_mask); } //-------------------------------------------------------------------- self_type& premultiply() { if (a < base_mask) { if (a == 0) v = 0; else v = multiply(v, a); } return *this; } //-------------------------------------------------------------------- self_type& demultiply() { if (a < base_mask) { if (a == 0) { v = 0; } else { calc_type v_ = (calc_type(v) * base_mask) / a; v = value_type((v_ > base_mask) ? (value_type)base_mask : v_); } } return *this; } //-------------------------------------------------------------------- self_type gradient(self_type c, double k) const { self_type ret; calc_type ik = uround(k * base_scale); ret.v = lerp(v, c.v, ik); ret.a = lerp(a, c.a, ik); return ret; } //-------------------------------------------------------------------- AGG_INLINE void add(const self_type& c, unsigned cover) { calc_type cv, ca; if (cover == cover_mask) { if (c.a == base_mask) { *this = c; return; } else { cv = v + c.v; ca = a + c.a; } } else { cv = v + mult_cover(c.v, cover); ca = a + mult_cover(c.a, cover); } v = (value_type)((cv > calc_type(base_mask)) ? calc_type(base_mask) : cv); a = (value_type)((ca > calc_type(base_mask)) ? calc_type(base_mask) : ca); } //-------------------------------------------------------------------- static self_type no_color() { return self_type(0,0); } }; typedef gray8T gray8; typedef gray8T sgray8; //==================================================================gray16 struct gray16 { typedef int16u value_type; typedef int32u calc_type; typedef int64 long_type; enum base_scale_e { base_shift = 16, base_scale = 1 << base_shift, base_mask = base_scale - 1, base_MSB = 1 << (base_shift - 1) }; typedef gray16 self_type; value_type v; value_type a; static value_type luminance(const rgba& c) { // Calculate grayscale value as per ITU-R BT.709. return value_type(uround((0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b) * base_mask)); } static value_type luminance(const rgba16& c) { // Calculate grayscale value as per ITU-R BT.709. return value_type((13933u * c.r + 46872u * c.g + 4732u * c.b) >> 16); } static value_type luminance(const rgba8& c) { return luminance(rgba16(c)); } static value_type luminance(const srgba8& c) { return luminance(rgba16(c)); } static value_type luminance(const rgba32& c) { return luminance(rgba(c)); } //-------------------------------------------------------------------- gray16() {} //-------------------------------------------------------------------- explicit gray16(unsigned v_, unsigned a_ = base_mask) : v(int16u(v_)), a(int16u(a_)) {} //-------------------------------------------------------------------- gray16(const self_type& c, unsigned a_) : v(c.v), a(value_type(a_)) {} //-------------------------------------------------------------------- gray16(const rgba& c) : v(luminance(c)), a((value_type)uround(c.a * double(base_mask))) {} //-------------------------------------------------------------------- gray16(const rgba8& c) : v(luminance(c)), a((value_type(c.a) << 8) | c.a) {} //-------------------------------------------------------------------- gray16(const srgba8& c) : v(luminance(c)), a((value_type(c.a) << 8) | c.a) {} //-------------------------------------------------------------------- gray16(const rgba16& c) : v(luminance(c)), a(c.a) {} //-------------------------------------------------------------------- gray16(const gray8& c) : v((value_type(c.v) << 8) | c.v), a((value_type(c.a) << 8) | c.a) {} //-------------------------------------------------------------------- gray16(const sgray8& c) : v(sRGB_conv::rgb_from_sRGB(c.v)), a(sRGB_conv::alpha_from_sRGB(c.a)) {} //-------------------------------------------------------------------- operator rgba8() const { return rgba8(v >> 8, v >> 8, v >> 8, a >> 8); } //-------------------------------------------------------------------- operator srgba8() const { value_type y = sRGB_conv::rgb_to_sRGB(v); return srgba8(y, y, y, sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- operator rgba16() const { return rgba16(v, v, v, a); } //-------------------------------------------------------------------- operator rgba32() const { rgba32::value_type v32 = v / 65535.0f; return rgba32(v32, v32, v32, a / 65535.0f); } //-------------------------------------------------------------------- operator gray8() const { return gray8(v >> 8, a >> 8); } //-------------------------------------------------------------------- operator sgray8() const { return sgray8( sRGB_conv::rgb_to_sRGB(v), sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- static AGG_INLINE double to_double(value_type a) { return double(a) / base_mask; } //-------------------------------------------------------------------- static AGG_INLINE value_type from_double(double a) { return value_type(uround(a * base_mask)); } //-------------------------------------------------------------------- static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- static AGG_INLINE value_type full_value() { return base_mask; } //-------------------------------------------------------------------- AGG_INLINE bool is_transparent() const { return a == 0; } //-------------------------------------------------------------------- AGG_INLINE bool is_opaque() const { return a == base_mask; } //-------------------------------------------------------------------- // Fixed-point multiply, exact over int16u. static AGG_INLINE value_type multiply(value_type a, value_type b) { calc_type t = a * b + base_MSB; return value_type(((t >> base_shift) + t) >> base_shift); } //-------------------------------------------------------------------- static AGG_INLINE value_type demultiply(value_type a, value_type b) { if (a * b == 0) { return 0; } else if (a >= b) { return base_mask; } else return value_type((a * base_mask + (b >> 1)) / b); } //-------------------------------------------------------------------- template static AGG_INLINE T downscale(T a) { return a >> base_shift; } //-------------------------------------------------------------------- template static AGG_INLINE T downshift(T a, unsigned n) { return a >> n; } //-------------------------------------------------------------------- // Fixed-point multiply, almost exact over int16u. // Specifically for multiplying a color component by a cover. static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return multiply(a, b << 8 | b); } //-------------------------------------------------------------------- static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return mult_cover(b, a) >> 8; } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return p + q - multiply(p, a); } //-------------------------------------------------------------------- // Interpolate p to q by a. static AGG_INLINE value_type lerp(value_type p, value_type q, value_type a) { int t = (q - p) * a + base_MSB - (p > q); return value_type(p + (((t >> base_shift) + t) >> base_shift)); } //-------------------------------------------------------------------- self_type& clear() { v = a = 0; return *this; } //-------------------------------------------------------------------- self_type& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- self_type& opacity(double a_) { if (a_ < 0) a = 0; else if(a_ > 1) a = 1; else a = (value_type)uround(a_ * double(base_mask)); return *this; } //-------------------------------------------------------------------- double opacity() const { return double(a) / double(base_mask); } //-------------------------------------------------------------------- self_type& premultiply() { if (a < base_mask) { if(a == 0) v = 0; else v = multiply(v, a); } return *this; } //-------------------------------------------------------------------- self_type& demultiply() { if (a < base_mask) { if (a == 0) { v = 0; } else { calc_type v_ = (calc_type(v) * base_mask) / a; v = value_type((v_ > base_mask) ? base_mask : v_); } } return *this; } //-------------------------------------------------------------------- self_type gradient(self_type c, double k) const { self_type ret; calc_type ik = uround(k * base_scale); ret.v = lerp(v, c.v, ik); ret.a = lerp(a, c.a, ik); return ret; } //-------------------------------------------------------------------- AGG_INLINE void add(const self_type& c, unsigned cover) { calc_type cv, ca; if (cover == cover_mask) { if (c.a == base_mask) { *this = c; return; } else { cv = v + c.v; ca = a + c.a; } } else { cv = v + mult_cover(c.v, cover); ca = a + mult_cover(c.a, cover); } v = (value_type)((cv > calc_type(base_mask)) ? calc_type(base_mask) : cv); a = (value_type)((ca > calc_type(base_mask)) ? calc_type(base_mask) : ca); } //-------------------------------------------------------------------- static self_type no_color() { return self_type(0,0); } }; //===================================================================gray32 struct gray32 { typedef float value_type; typedef double calc_type; typedef double long_type; typedef gray32 self_type; value_type v; value_type a; // Calculate grayscale value as per ITU-R BT.709. static value_type luminance(double r, double g, double b) { return value_type(0.2126 * r + 0.7152 * g + 0.0722 * b); } static value_type luminance(const rgba& c) { return luminance(c.r, c.g, c.b); } static value_type luminance(const rgba32& c) { return luminance(c.r, c.g, c.b); } static value_type luminance(const rgba8& c) { return luminance(c.r / 255.0, c.g / 255.0, c.g / 255.0); } static value_type luminance(const rgba16& c) { return luminance(c.r / 65535.0, c.g / 65535.0, c.g / 65535.0); } //-------------------------------------------------------------------- gray32() {} //-------------------------------------------------------------------- explicit gray32(value_type v_, value_type a_ = 1) : v(v_), a(a_) {} //-------------------------------------------------------------------- gray32(const self_type& c, value_type a_) : v(c.v), a(a_) {} //-------------------------------------------------------------------- gray32(const rgba& c) : v(luminance(c)), a(value_type(c.a)) {} //-------------------------------------------------------------------- gray32(const rgba8& c) : v(luminance(c)), a(value_type(c.a / 255.0)) {} //-------------------------------------------------------------------- gray32(const srgba8& c) : v(luminance(rgba32(c))), a(value_type(c.a / 255.0)) {} //-------------------------------------------------------------------- gray32(const rgba16& c) : v(luminance(c)), a(value_type(c.a / 65535.0)) {} //-------------------------------------------------------------------- gray32(const rgba32& c) : v(luminance(c)), a(value_type(c.a)) {} //-------------------------------------------------------------------- gray32(const gray8& c) : v(value_type(c.v / 255.0)), a(value_type(c.a / 255.0)) {} //-------------------------------------------------------------------- gray32(const sgray8& c) : v(sRGB_conv::rgb_from_sRGB(c.v)), a(sRGB_conv::alpha_from_sRGB(c.a)) {} //-------------------------------------------------------------------- gray32(const gray16& c) : v(value_type(c.v / 65535.0)), a(value_type(c.a / 65535.0)) {} //-------------------------------------------------------------------- operator rgba() const { return rgba(v, v, v, a); } //-------------------------------------------------------------------- operator gray8() const { return gray8(uround(v * 255.0), uround(a * 255.0)); } //-------------------------------------------------------------------- operator sgray8() const { // Return (non-premultiplied) sRGB values. return sgray8( sRGB_conv::rgb_to_sRGB(v), sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- operator gray16() const { return gray16(uround(v * 65535.0), uround(a * 65535.0)); } //-------------------------------------------------------------------- operator rgba8() const { rgba8::value_type y = uround(v * 255.0); return rgba8(y, y, y, uround(a * 255.0)); } //-------------------------------------------------------------------- operator srgba8() const { srgba8::value_type y = sRGB_conv::rgb_to_sRGB(v); return srgba8(y, y, y, sRGB_conv::alpha_to_sRGB(a)); } //-------------------------------------------------------------------- operator rgba16() const { rgba16::value_type y = uround(v * 65535.0); return rgba16(y, y, y, uround(a * 65535.0)); } //-------------------------------------------------------------------- operator rgba32() const { return rgba32(v, v, v, a); } //-------------------------------------------------------------------- static AGG_INLINE double to_double(value_type a) { return a; } //-------------------------------------------------------------------- static AGG_INLINE value_type from_double(double a) { return value_type(a); } //-------------------------------------------------------------------- static AGG_INLINE value_type empty_value() { return 0; } //-------------------------------------------------------------------- static AGG_INLINE value_type full_value() { return 1; } //-------------------------------------------------------------------- AGG_INLINE bool is_transparent() const { return a <= 0; } //-------------------------------------------------------------------- AGG_INLINE bool is_opaque() const { return a >= 1; } //-------------------------------------------------------------------- static AGG_INLINE value_type invert(value_type x) { return 1 - x; } //-------------------------------------------------------------------- static AGG_INLINE value_type multiply(value_type a, value_type b) { return value_type(a * b); } //-------------------------------------------------------------------- static AGG_INLINE value_type demultiply(value_type a, value_type b) { return (b == 0) ? 0 : value_type(a / b); } //-------------------------------------------------------------------- template static AGG_INLINE T downscale(T a) { return a; } //-------------------------------------------------------------------- template static AGG_INLINE T downshift(T a, unsigned n) { return n > 0 ? a / (1 << n) : a; } //-------------------------------------------------------------------- static AGG_INLINE value_type mult_cover(value_type a, cover_type b) { return value_type(a * b / cover_mask); } //-------------------------------------------------------------------- static AGG_INLINE cover_type scale_cover(cover_type a, value_type b) { return cover_type(uround(a * b)); } //-------------------------------------------------------------------- // Interpolate p to q by a, assuming q is premultiplied by a. static AGG_INLINE value_type prelerp(value_type p, value_type q, value_type a) { return (1 - a) * p + q; // more accurate than "p + q - p * a" } //-------------------------------------------------------------------- // Interpolate p to q by a. static AGG_INLINE value_type lerp(value_type p, value_type q, value_type a) { // The form "p + a * (q - p)" avoids a multiplication, but may produce an // inaccurate result. For example, "p + (q - p)" may not be exactly equal // to q. Therefore, stick to the basic expression, which at least produces // the correct result at either extreme. return (1 - a) * p + a * q; } //-------------------------------------------------------------------- self_type& clear() { v = a = 0; return *this; } //-------------------------------------------------------------------- self_type& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- self_type& opacity(double a_) { if (a_ < 0) a = 0; else if (a_ > 1) a = 1; else a = value_type(a_); return *this; } //-------------------------------------------------------------------- double opacity() const { return a; } //-------------------------------------------------------------------- self_type& premultiply() { if (a < 0) v = 0; else if(a < 1) v *= a; return *this; } //-------------------------------------------------------------------- self_type& demultiply() { if (a < 0) v = 0; else if (a < 1) v /= a; return *this; } //-------------------------------------------------------------------- self_type gradient(self_type c, double k) const { return self_type( value_type(v + (c.v - v) * k), value_type(a + (c.a - a) * k)); } //-------------------------------------------------------------------- static self_type no_color() { return self_type(0,0); } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_renderer_markers.h0000644000175000017500000010757313233644505025334 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class renderer_markers // //---------------------------------------------------------------------------- #ifndef AGG_RENDERER_MARKERS_INCLUDED #define AGG_RENDERER_MARKERS_INCLUDED #include "agg_basics.h" #include "agg_renderer_primitives.h" namespace agg24 { //---------------------------------------------------------------marker_e enum marker_e { marker_square, marker_diamond, marker_circle, marker_crossed_circle, marker_semiellipse_left, marker_semiellipse_right, marker_semiellipse_up, marker_semiellipse_down, marker_triangle_left, marker_triangle_right, marker_triangle_up, marker_triangle_down, marker_four_rays, marker_cross, marker_x, marker_dash, marker_dot, marker_pixel, end_of_markers }; //--------------------------------------------------------renderer_markers template class renderer_markers : public renderer_primitives { public: typedef renderer_primitives base_type; typedef BaseRenderer base_ren_type; typedef typename base_ren_type::color_type color_type; //-------------------------------------------------------------------- renderer_markers(base_ren_type& rbuf) : base_type(rbuf) {} //-------------------------------------------------------------------- bool visible(int x, int y, int r) const { rect_i rc(x-r, y-r, x+y, y+r); return rc.clip(base_type::ren().bounding_clip_box()); } //-------------------------------------------------------------------- void square(int x, int y, int r) { if(visible(x, y, r)) { if(r) base_type::outlined_rectangle(x-r, y-r, x+r, y+r); else base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } //-------------------------------------------------------------------- void diamond(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int dy = -r; int dx = 0; do { base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); if(dx) { base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full); base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full); } ++dy; ++dx; } while(dy <= 0); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void circle(int x, int y, int r) { if(visible(x, y, r)) { if(r) base_type::outlined_ellipse(x, y, r, r); else base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } //-------------------------------------------------------------------- void crossed_circle(int x, int y, int r) { if(visible(x, y, r)) { if(r) { base_type::outlined_ellipse(x, y, r, r); int r6 = r + (r >> 1); if(r <= 2) r6++; r >>= 1; base_type::ren().blend_hline(x-r6, y, x-r, base_type::line_color(), cover_full); base_type::ren().blend_hline(x+r, y, x+r6, base_type::line_color(), cover_full); base_type::ren().blend_vline(x, y-r6, y-r, base_type::line_color(), cover_full); base_type::ren().blend_vline(x, y+r, y+r6, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //------------------------------------------------------------------------ void semiellipse_left(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int r8 = r * 4 / 5; int dy = -r; int dx = 0; ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8); do { dx += ei.dx(); dy += ei.dy(); base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full); if(ei.dy() && dx) { base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); } ++ei; } while(dy < r8); base_type::ren().blend_vline(x+dy, y-dx, y+dx, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void semiellipse_right(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int r8 = r * 4 / 5; int dy = -r; int dx = 0; ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8); do { dx += ei.dx(); dy += ei.dy(); base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full); if(ei.dy() && dx) { base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); } ++ei; } while(dy < r8); base_type::ren().blend_vline(x-dy, y-dx, y+dx, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void semiellipse_up(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int r8 = r * 4 / 5; int dy = -r; int dx = 0; ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8); do { dx += ei.dx(); dy += ei.dy(); base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); if(ei.dy() && dx) { base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full); } ++ei; } while(dy < r8); base_type::ren().blend_hline(x-dx, y-dy-1, x+dx, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void semiellipse_down(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int r8 = r * 4 / 5; int dy = -r; int dx = 0; ellipse_bresenham_interpolator ei(r * 3 / 5, r+r8); do { dx += ei.dx(); dy += ei.dy(); base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); if(ei.dy() && dx) { base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full); } ++ei; } while(dy < r8); base_type::ren().blend_hline(x-dx, y+dy+1, x+dx, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void triangle_left(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int dy = -r; int dx = 0; int flip = 0; int r6 = r * 3 / 5; do { base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full); if(dx) { base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); } ++dy; dx += flip; flip ^= 1; } while(dy < r6); base_type::ren().blend_vline(x+dy, y-dx, y+dx, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void triangle_right(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int dy = -r; int dx = 0; int flip = 0; int r6 = r * 3 / 5; do { base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full); if(dx) { base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); } ++dy; dx += flip; flip ^= 1; } while(dy < r6); base_type::ren().blend_vline(x-dy, y-dx, y+dx, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void triangle_up(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int dy = -r; int dx = 0; int flip = 0; int r6 = r * 3 / 5; do { base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); if(dx) { base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full); } ++dy; dx += flip; flip ^= 1; } while(dy < r6); base_type::ren().blend_hline(x-dx, y-dy, x+dx, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void triangle_down(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int dy = -r; int dx = 0; int flip = 0; int r6 = r * 3 / 5; do { base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); if(dx) { base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full); } ++dy; dx += flip; flip ^= 1; } while(dy < r6); base_type::ren().blend_hline(x-dx, y+dy, x+dx, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void four_rays(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int dy = -r; int dx = 0; int flip = 0; int r3 = -(r / 3); do { base_type::ren().blend_pixel(x - dx, y + dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dx, y + dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dx, y - dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dx, y - dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dy, y - dx, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dy, y + dx, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dy, y - dx, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dy, y + dx, base_type::line_color(), cover_full); if(dx) { base_type::ren().blend_hline(x-dx+1, y+dy, x+dx-1, base_type::fill_color(), cover_full); base_type::ren().blend_hline(x-dx+1, y-dy, x+dx-1, base_type::fill_color(), cover_full); base_type::ren().blend_vline(x+dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); base_type::ren().blend_vline(x-dy, y-dx+1, y+dx-1, base_type::fill_color(), cover_full); } ++dy; dx += flip; flip ^= 1; } while(dy <= r3); base_type::solid_rectangle(x+r3+1, y+r3+1, x-r3-1, y-r3-1); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void cross(int x, int y, int r) { if(visible(x, y, r)) { if(r) { base_type::ren().blend_vline(x, y-r, y+r, base_type::line_color(), cover_full); base_type::ren().blend_hline(x-r, y, x+r, base_type::line_color(), cover_full); } else { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } } //-------------------------------------------------------------------- void xing(int x, int y, int r) { if(visible(x, y, r)) { if(r) { int dy = -r * 7 / 10; do { base_type::ren().blend_pixel(x + dy, y + dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dy, y + dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x + dy, y - dy, base_type::line_color(), cover_full); base_type::ren().blend_pixel(x - dy, y - dy, base_type::line_color(), cover_full); ++dy; } while(dy < 0); } base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } //-------------------------------------------------------------------- void dash(int x, int y, int r) { if(visible(x, y, r)) { if(r) base_type::ren().blend_hline(x-r, y, x+r, base_type::line_color(), cover_full); else base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } //-------------------------------------------------------------------- void dot(int x, int y, int r) { if(visible(x, y, r)) { if(r) base_type::solid_ellipse(x, y, r, r); else base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } } //-------------------------------------------------------------------- void pixel(int x, int y, int) { base_type::ren().blend_pixel(x, y, base_type::fill_color(), cover_full); } //-------------------------------------------------------------------- void marker(int x, int y, int r, marker_e type) { switch(type) { case marker_square: square(x, y, r); break; case marker_diamond: diamond(x, y, r); break; case marker_circle: circle(x, y, r); break; case marker_crossed_circle: crossed_circle(x, y, r); break; case marker_semiellipse_left: semiellipse_left(x, y, r); break; case marker_semiellipse_right: semiellipse_right(x, y, r); break; case marker_semiellipse_up: semiellipse_up(x, y, r); break; case marker_semiellipse_down: semiellipse_down(x, y, r); break; case marker_triangle_left: triangle_left(x, y, r); break; case marker_triangle_right: triangle_right(x, y, r); break; case marker_triangle_up: triangle_up(x, y, r); break; case marker_triangle_down: triangle_down(x, y, r); break; case marker_four_rays: four_rays(x, y, r); break; case marker_cross: cross(x, y, r); break; case marker_x: xing(x, y, r); break; case marker_dash: dash(x, y, r); break; case marker_dot: dot(x, y, r); break; case marker_pixel: pixel(x, y, r); break; } } //-------------------------------------------------------------------- template void markers(int n, const T* x, const T* y, T r, marker_e type) { if(n <= 0) return; if(r == 0) { do { base_type::ren().blend_pixel(int(*x), int(*y), base_type::fill_color(), cover_full); ++x; ++y; } while(--n); return; } switch(type) { case marker_square: do { square (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_diamond: do { diamond (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_circle: do { circle (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_crossed_circle: do { crossed_circle (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_semiellipse_left: do { semiellipse_left (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_semiellipse_right: do { semiellipse_right(int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_semiellipse_up: do { semiellipse_up (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_semiellipse_down: do { semiellipse_down (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_triangle_left: do { triangle_left (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_triangle_right: do { triangle_right (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_triangle_up: do { triangle_up (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_triangle_down: do { triangle_down (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_four_rays: do { four_rays (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_cross: do { cross (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_x: do { xing (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_dash: do { dash (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_dot: do { dot (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; case marker_pixel: do { pixel (int(*x), int(*y), int(r)); ++x; ++y; } while(--n); break; } } //-------------------------------------------------------------------- template void markers(int n, const T* x, const T* y, const T* r, marker_e type) { if(n <= 0) return; switch(type) { case marker_square: do { square (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_diamond: do { diamond (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_circle: do { circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_crossed_circle: do { crossed_circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_semiellipse_left: do { semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_semiellipse_right: do { semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_semiellipse_up: do { semiellipse_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_semiellipse_down: do { semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_triangle_left: do { triangle_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_triangle_right: do { triangle_right (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_triangle_up: do { triangle_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_triangle_down: do { triangle_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_four_rays: do { four_rays (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_cross: do { cross (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_x: do { xing (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_dash: do { dash (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_dot: do { dot (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; case marker_pixel: do { pixel (int(*x), int(*y), int(*r)); ++x; ++y; ++r; } while(--n); break; } } //-------------------------------------------------------------------- template void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, marker_e type) { if(n <= 0) return; switch(type) { case marker_square: do { base_type::fill_color(*fc); square (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_diamond: do { base_type::fill_color(*fc); diamond (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_circle: do { base_type::fill_color(*fc); circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_crossed_circle: do { base_type::fill_color(*fc); crossed_circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_semiellipse_left: do { base_type::fill_color(*fc); semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_semiellipse_right: do { base_type::fill_color(*fc); semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_semiellipse_up: do { base_type::fill_color(*fc); semiellipse_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_semiellipse_down: do { base_type::fill_color(*fc); semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_triangle_left: do { base_type::fill_color(*fc); triangle_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_triangle_right: do { base_type::fill_color(*fc); triangle_right (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_triangle_up: do { base_type::fill_color(*fc); triangle_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_triangle_down: do { base_type::fill_color(*fc); triangle_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_four_rays: do { base_type::fill_color(*fc); four_rays (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_cross: do { base_type::fill_color(*fc); cross (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_x: do { base_type::fill_color(*fc); xing (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_dash: do { base_type::fill_color(*fc); dash (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_dot: do { base_type::fill_color(*fc); dot (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; case marker_pixel: do { base_type::fill_color(*fc); pixel (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; } while(--n); break; } } //-------------------------------------------------------------------- template void markers(int n, const T* x, const T* y, const T* r, const color_type* fc, const color_type* lc, marker_e type) { if(n <= 0) return; switch(type) { case marker_square: do { base_type::fill_color(*fc); base_type::line_color(*lc); square (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_diamond: do { base_type::fill_color(*fc); base_type::line_color(*lc); diamond (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_circle: do { base_type::fill_color(*fc); base_type::line_color(*lc); circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_crossed_circle: do { base_type::fill_color(*fc); base_type::line_color(*lc); crossed_circle (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_semiellipse_left: do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_semiellipse_right: do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_right(int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_semiellipse_up: do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_semiellipse_down: do { base_type::fill_color(*fc); base_type::line_color(*lc); semiellipse_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_triangle_left: do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_left (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_triangle_right: do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_right (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_triangle_up: do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_up (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_triangle_down: do { base_type::fill_color(*fc); base_type::line_color(*lc); triangle_down (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_four_rays: do { base_type::fill_color(*fc); base_type::line_color(*lc); four_rays (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_cross: do { base_type::fill_color(*fc); base_type::line_color(*lc); cross (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_x: do { base_type::fill_color(*fc); base_type::line_color(*lc); xing (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_dash: do { base_type::fill_color(*fc); base_type::line_color(*lc); dash (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_dot: do { base_type::fill_color(*fc); base_type::line_color(*lc); dot (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; case marker_pixel: do { base_type::fill_color(*fc); base_type::line_color(*lc); pixel (int(*x), int(*y), int(*r)); ++x; ++y; ++r; ++fc; ++lc; } while(--n); break; } } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/0000755000175000017500000000000013544357602021746 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_bezier_ctrl.h0000644000175000017500000001453113233644505025241 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes bezier_ctrl_impl, bezier_ctrl // //---------------------------------------------------------------------------- #ifndef AGG_BEZIER_CTRL_INCLUDED #define AGG_BEZIER_CTRL_INCLUDED #include "agg_math.h" #include "agg_ellipse.h" #include "agg_trans_affine.h" #include "agg_color_rgba.h" #include "agg_conv_stroke.h" #include "agg_conv_curve.h" #include "agg_polygon_ctrl.h" namespace agg24 { //--------------------------------------------------------bezier_ctrl_impl class bezier_ctrl_impl : public ctrl { public: bezier_ctrl_impl(); void curve(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); curve4& curve(); double x1() const { return m_poly.xn(0); } double y1() const { return m_poly.yn(0); } double x2() const { return m_poly.xn(1); } double y2() const { return m_poly.yn(1); } double x3() const { return m_poly.xn(2); } double y3() const { return m_poly.yn(2); } double x4() const { return m_poly.xn(3); } double y4() const { return m_poly.yn(3); } void x1(double x) { m_poly.xn(0) = x; } void y1(double y) { m_poly.yn(0) = y; } void x2(double x) { m_poly.xn(1) = x; } void y2(double y) { m_poly.yn(1) = y; } void x3(double x) { m_poly.xn(2) = x; } void y3(double y) { m_poly.yn(2) = y; } void x4(double x) { m_poly.xn(3) = x; } void y4(double y) { m_poly.yn(3) = y; } void line_width(double w) { m_stroke.width(w); } double line_width() const { return m_stroke.width(); } void point_radius(double r) { m_poly.point_radius(r); } double point_radius() const { return m_poly.point_radius(); } virtual bool in_rect(double x, double y) const; virtual bool on_mouse_button_down(double x, double y); virtual bool on_mouse_button_up(double x, double y); virtual bool on_mouse_move(double x, double y, bool button_flag); virtual bool on_arrow_keys(bool left, bool right, bool down, bool up); // Vertex source interface unsigned num_paths() { return 7; }; void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: curve4 m_curve; ellipse m_ellipse; conv_stroke m_stroke; polygon_ctrl_impl m_poly; unsigned m_idx; }; //----------------------------------------------------------bezier_ctrl template class bezier_ctrl : public bezier_ctrl_impl { public: bezier_ctrl() : m_color(rgba(0.0, 0.0, 0.0)) { } void line_color(const ColorT& c) { m_color = c; } const ColorT& color(unsigned i) const { return m_color; } private: bezier_ctrl(const bezier_ctrl&); const bezier_ctrl& operator = (const bezier_ctrl&); ColorT m_color; }; //--------------------------------------------------------curve3_ctrl_impl class curve3_ctrl_impl : public ctrl { public: curve3_ctrl_impl(); void curve(double x1, double y1, double x2, double y2, double x3, double y3); curve3& curve(); double x1() const { return m_poly.xn(0); } double y1() const { return m_poly.yn(0); } double x2() const { return m_poly.xn(1); } double y2() const { return m_poly.yn(1); } double x3() const { return m_poly.xn(2); } double y3() const { return m_poly.yn(2); } void x1(double x) { m_poly.xn(0) = x; } void y1(double y) { m_poly.yn(0) = y; } void x2(double x) { m_poly.xn(1) = x; } void y2(double y) { m_poly.yn(1) = y; } void x3(double x) { m_poly.xn(2) = x; } void y3(double y) { m_poly.yn(2) = y; } void line_width(double w) { m_stroke.width(w); } double line_width() const { return m_stroke.width(); } void point_radius(double r) { m_poly.point_radius(r); } double point_radius() const { return m_poly.point_radius(); } virtual bool in_rect(double x, double y) const; virtual bool on_mouse_button_down(double x, double y); virtual bool on_mouse_button_up(double x, double y); virtual bool on_mouse_move(double x, double y, bool button_flag); virtual bool on_arrow_keys(bool left, bool right, bool down, bool up); // Vertex source interface unsigned num_paths() { return 6; }; void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: curve3 m_curve; ellipse m_ellipse; conv_stroke m_stroke; polygon_ctrl_impl m_poly; unsigned m_idx; }; //----------------------------------------------------------curve3_ctrl template class curve3_ctrl : public curve3_ctrl_impl { public: curve3_ctrl() : m_color(rgba(0.0, 0.0, 0.0)) { } void line_color(const ColorT& c) { m_color = c; } const ColorT& color(unsigned i) const { return m_color; } private: curve3_ctrl(const curve3_ctrl&); const curve3_ctrl& operator = (const curve3_ctrl&); ColorT m_color; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_ctrl.h0000644000175000017500000000760113233644505023701 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Function render_ctrl // //---------------------------------------------------------------------------- #ifndef AGG_CTRL_INCLUDED #define AGG_CTRL_INCLUDED #include "agg_trans_affine.h" #include "agg_renderer_scanline.h" namespace agg24 { //--------------------------------------------------------------------ctrl class ctrl { public: //-------------------------------------------------------------------- virtual ~ctrl() {} ctrl(double x1, double y1, double x2, double y2, bool flip_y) : m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2), m_flip_y(flip_y), m_mtx(0) { } //-------------------------------------------------------------------- virtual bool in_rect(double x, double y) const = 0; virtual bool on_mouse_button_down(double x, double y) = 0; virtual bool on_mouse_button_up(double x, double y) = 0; virtual bool on_mouse_move(double x, double y, bool button_flag) = 0; virtual bool on_arrow_keys(bool left, bool right, bool down, bool up) = 0; //-------------------------------------------------------------------- void transform(const trans_affine& mtx) { m_mtx = &mtx; } void no_transform() { m_mtx = 0; } //-------------------------------------------------------------------- void transform_xy(double* x, double* y) const { if(m_flip_y) *y = m_y1 + m_y2 - *y; if(m_mtx) m_mtx->transform(x, y); } //-------------------------------------------------------------------- void inverse_transform_xy(double* x, double* y) const { if(m_mtx) m_mtx->inverse_transform(x, y); if(m_flip_y) *y = m_y1 + m_y2 - *y; } //-------------------------------------------------------------------- double scale() const { return m_mtx ? m_mtx->scale() : 1.0; } private: ctrl(const ctrl&); const ctrl& operator = (const ctrl&); protected: double m_x1; double m_y1; double m_x2; double m_y2; private: bool m_flip_y; const trans_affine* m_mtx; }; //-------------------------------------------------------------------- template void render_ctrl(Rasterizer& ras, Scanline& sl, Renderer& r, Ctrl& c) { unsigned i; for(i = 0; i < c.num_paths(); i++) { ras.reset(); ras.add_path(c, i); render_scanlines_aa_solid(ras, sl, r, c.color(i)); } } //-------------------------------------------------------------------- template void render_ctrl_rs(Rasterizer& ras, Scanline& sl, Renderer& r, Ctrl& c) { unsigned i; for(i = 0; i < c.num_paths(); i++) { ras.reset(); ras.add_path(c, i); r.color(c.color(i)); render_scanlines(ras, sl, r); } } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_gamma_ctrl.h0000644000175000017500000001437013233644505025044 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class gamma_ctrl // //---------------------------------------------------------------------------- #ifndef AGG_GAMMA_CTRL_INCLUDED #define AGG_GAMMA_CTRL_INCLUDED #include "agg_basics.h" #include "agg_gamma_spline.h" #include "agg_ellipse.h" #include "agg_conv_stroke.h" #include "agg_gsv_text.h" #include "agg_trans_affine.h" #include "agg_color_rgba.h" #include "agg_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ // Class that can be used to create an interactive control to set up // gamma arrays. //------------------------------------------------------------------------ class gamma_ctrl_impl : public ctrl { public: gamma_ctrl_impl(double x1, double y1, double x2, double y2, bool flip_y=false); // Set other parameters void border_width(double t, double extra=0.0); void curve_width(double t) { m_curve_width = t; } void grid_width(double t) { m_grid_width = t; } void text_thickness(double t) { m_text_thickness = t; } void text_size(double h, double w=0.0); void point_size(double s) { m_point_size = s; } // Event handlers. Just call them if the respective events // in your system occure. The functions return true if redrawing // is required. virtual bool in_rect(double x, double y) const; virtual bool on_mouse_button_down(double x, double y); virtual bool on_mouse_button_up(double x, double y); virtual bool on_mouse_move(double x, double y, bool button_flag); virtual bool on_arrow_keys(bool left, bool right, bool down, bool up); void change_active_point(); // A copy of agg24::gamma_spline interface void values(double kx1, double ky1, double kx2, double ky2); void values(double* kx1, double* ky1, double* kx2, double* ky2) const; const unsigned char* gamma() const { return m_gamma_spline.gamma(); } double y(double x) const { return m_gamma_spline.y(x); } double operator() (double x) const { return m_gamma_spline.y(x); } const gamma_spline& get_gamma_spline() const { return m_gamma_spline; } // Vertex soutce interface unsigned num_paths() { return 7; } void rewind(unsigned idx); unsigned vertex(double* x, double* y); private: void calc_spline_box(); void calc_points(); void calc_values(); gamma_spline m_gamma_spline; double m_border_width; double m_border_extra; double m_curve_width; double m_grid_width; double m_text_thickness; double m_point_size; double m_text_height; double m_text_width; double m_xc1; double m_yc1; double m_xc2; double m_yc2; double m_xs1; double m_ys1; double m_xs2; double m_ys2; double m_xt1; double m_yt1; double m_xt2; double m_yt2; conv_stroke m_curve_poly; ellipse m_ellipse; gsv_text m_text; conv_stroke m_text_poly; unsigned m_idx; unsigned m_vertex; double m_vx[32]; double m_vy[32]; double m_xp1; double m_yp1; double m_xp2; double m_yp2; bool m_p1_active; unsigned m_mouse_point; double m_pdx; double m_pdy; }; template class gamma_ctrl : public gamma_ctrl_impl { public: gamma_ctrl(double x1, double y1, double x2, double y2, bool flip_y=false) : gamma_ctrl_impl(x1, y1, x2, y2, flip_y), m_background_color(rgba(1.0, 1.0, 0.9)), m_border_color(rgba(0.0, 0.0, 0.0)), m_curve_color(rgba(0.0, 0.0, 0.0)), m_grid_color(rgba(0.2, 0.2, 0.0)), m_inactive_pnt_color(rgba(0.0, 0.0, 0.0)), m_active_pnt_color(rgba(1.0, 0.0, 0.0)), m_text_color(rgba(0.0, 0.0, 0.0)) { m_colors[0] = &m_background_color; m_colors[1] = &m_border_color; m_colors[2] = &m_curve_color; m_colors[3] = &m_grid_color; m_colors[4] = &m_inactive_pnt_color; m_colors[5] = &m_active_pnt_color; m_colors[6] = &m_text_color; } // Set colors void background_color(const ColorT& c) { m_background_color = c; } void border_color(const ColorT& c) { m_border_color = c; } void curve_color(const ColorT& c) { m_curve_color = c; } void grid_color(const ColorT& c) { m_grid_color = c; } void inactive_pnt_color(const ColorT& c) { m_inactive_pnt_color = c; } void active_pnt_color(const ColorT& c) { m_active_pnt_color = c; } void text_color(const ColorT& c) { m_text_color = c; } const ColorT& color(unsigned i) const { return *m_colors[i]; } private: gamma_ctrl(const gamma_ctrl&); const gamma_ctrl& operator = (const gamma_ctrl&); ColorT m_background_color; ColorT m_border_color; ColorT m_curve_color; ColorT m_grid_color; ColorT m_inactive_pnt_color; ColorT m_active_pnt_color; ColorT m_text_color; ColorT* m_colors[7]; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_polygon_ctrl.h0000644000175000017500000001237013233644505025447 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes polygon_ctrl_impl, polygon_ctrl // //---------------------------------------------------------------------------- #ifndef POLYGON_CTRL_INCLUDED #define POLYGON_CTRL_INCLUDED #include "agg_array.h" #include "agg_conv_stroke.h" #include "agg_ellipse.h" #include "agg_color_rgba.h" #include "agg_ctrl.h" namespace agg24 { class simple_polygon_vertex_source { public: simple_polygon_vertex_source(const double* polygon, unsigned np, bool roundoff = false, bool close = true) : m_polygon(polygon), m_num_points(np), m_vertex(0), m_roundoff(roundoff), m_close(close) { } void close(bool f) { m_close = f; } bool close() const { return m_close; } void rewind(unsigned) { m_vertex = 0; } unsigned vertex(double* x, double* y) { if(m_vertex > m_num_points) return path_cmd_stop; if(m_vertex == m_num_points) { ++m_vertex; return path_cmd_end_poly | (m_close ? path_flags_close : 0); } *x = m_polygon[m_vertex * 2]; *y = m_polygon[m_vertex * 2 + 1]; if(m_roundoff) { *x = floor(*x) + 0.5; *y = floor(*y) + 0.5; } ++m_vertex; return (m_vertex == 1) ? path_cmd_move_to : path_cmd_line_to; } private: const double* m_polygon; unsigned m_num_points; unsigned m_vertex; bool m_roundoff; bool m_close; }; class polygon_ctrl_impl : public ctrl { public: polygon_ctrl_impl(unsigned np, double point_radius=5); unsigned num_points() const { return m_num_points; } double xn(unsigned n) const { return m_polygon[n * 2]; } double yn(unsigned n) const { return m_polygon[n * 2 + 1]; } double& xn(unsigned n) { return m_polygon[n * 2]; } double& yn(unsigned n) { return m_polygon[n * 2 + 1]; } const double* polygon() const { return &m_polygon[0]; } void line_width(double w) { m_stroke.width(w); } double line_width() const { return m_stroke.width(); } void point_radius(double r) { m_point_radius = r; } double point_radius() const { return m_point_radius; } void in_polygon_check(bool f) { m_in_polygon_check = f; } bool in_polygon_check() const { return m_in_polygon_check; } void close(bool f) { m_vs.close(f); } bool close() const { return m_vs.close(); } // Vertex source interface unsigned num_paths() { return 1; } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); virtual bool in_rect(double x, double y) const; virtual bool on_mouse_button_down(double x, double y); virtual bool on_mouse_button_up(double x, double y); virtual bool on_mouse_move(double x, double y, bool button_flag); virtual bool on_arrow_keys(bool left, bool right, bool down, bool up); private: bool check_edge(unsigned i, double x, double y) const; bool point_in_polygon(double x, double y) const; pod_array m_polygon; unsigned m_num_points; int m_node; int m_edge; simple_polygon_vertex_source m_vs; conv_stroke m_stroke; ellipse m_ellipse; double m_point_radius; unsigned m_status; double m_dx; double m_dy; bool m_in_polygon_check; }; //----------------------------------------------------------polygon_ctrl template class polygon_ctrl : public polygon_ctrl_impl { public: polygon_ctrl(unsigned np, double point_radius=5) : polygon_ctrl_impl(np, point_radius), m_color(rgba(0.0, 0.0, 0.0)) { } void line_color(const ColorT& c) { m_color = c; } const ColorT& color(unsigned i) const { return m_color; } private: polygon_ctrl(const polygon_ctrl&); const polygon_ctrl& operator = (const polygon_ctrl&); ColorT m_color; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_cbox_ctrl.h0000644000175000017500000000722713233644505024720 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes cbox_ctrl_impl, cbox_ctrl // //---------------------------------------------------------------------------- #ifndef AGG_CBOX_CTRL_INCLUDED #define AGG_CBOX_CTRL_INCLUDED #include "agg_basics.h" #include "agg_conv_stroke.h" #include "agg_gsv_text.h" #include "agg_trans_affine.h" #include "agg_color_rgba.h" #include "agg_ctrl.h" namespace agg24 { //----------------------------------------------------------cbox_ctrl_impl class cbox_ctrl_impl : public ctrl { public: cbox_ctrl_impl(double x, double y, const char* label, bool flip_y=false); void text_thickness(double t) { m_text_thickness = t; } void text_size(double h, double w=0.0); const char* label() { return m_label; } void label(const char* l); bool status() const { return m_status; } void status(bool st) { m_status = st; } virtual bool in_rect(double x, double y) const; virtual bool on_mouse_button_down(double x, double y); virtual bool on_mouse_button_up(double x, double y); virtual bool on_mouse_move(double x, double y, bool button_flag); virtual bool on_arrow_keys(bool left, bool right, bool down, bool up); // Vertex soutce interface unsigned num_paths() { return 3; }; void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: double m_text_thickness; double m_text_height; double m_text_width; char m_label[128]; bool m_status; double m_vx[32]; double m_vy[32]; gsv_text m_text; conv_stroke m_text_poly; unsigned m_idx; unsigned m_vertex; }; //----------------------------------------------------------cbox_ctrl_impl template class cbox_ctrl : public cbox_ctrl_impl { public: cbox_ctrl(double x, double y, const char* label, bool flip_y=false) : cbox_ctrl_impl(x, y, label, flip_y), m_text_color(rgba(0.0, 0.0, 0.0)), m_inactive_color(rgba(0.0, 0.0, 0.0)), m_active_color(rgba(0.4, 0.0, 0.0)) { m_colors[0] = &m_inactive_color; m_colors[1] = &m_text_color; m_colors[2] = &m_active_color; } void text_color(const ColorT& c) { m_text_color = c; } void inactive_color(const ColorT& c) { m_inactive_color = c; } void active_color(const ColorT& c) { m_active_color = c; } const ColorT& color(unsigned i) const { return *m_colors[i]; } private: cbox_ctrl(const cbox_ctrl&); const cbox_ctrl& operator = (const cbox_ctrl&); ColorT m_text_color; ColorT m_inactive_color; ColorT m_active_color; ColorT* m_colors[3]; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_spline_ctrl.h0000644000175000017500000001336713233644505025261 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes spline_ctrl_impl, spline_ctrl // //---------------------------------------------------------------------------- #ifndef AGG_SPLINE_CTRL_INCLUDED #define AGG_SPLINE_CTRL_INCLUDED #include "agg_basics.h" #include "agg_ellipse.h" #include "agg_bspline.h" #include "agg_conv_stroke.h" #include "agg_path_storage.h" #include "agg_trans_affine.h" #include "agg_color_rgba.h" #include "agg_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ // Class that can be used to create an interactive control to set up // gamma arrays. //------------------------------------------------------------------------ class spline_ctrl_impl : public ctrl { public: spline_ctrl_impl(double x1, double y1, double x2, double y2, unsigned num_pnt, bool flip_y=false); // Set other parameters void border_width(double t, double extra=0.0); void curve_width(double t) { m_curve_width = t; } void point_size(double s) { m_point_size = s; } // Event handlers. Just call them if the respective events // in your system occure. The functions return true if redrawing // is required. virtual bool in_rect(double x, double y) const; virtual bool on_mouse_button_down(double x, double y); virtual bool on_mouse_button_up(double x, double y); virtual bool on_mouse_move(double x, double y, bool button_flag); virtual bool on_arrow_keys(bool left, bool right, bool down, bool up); void active_point(int i); const double* spline() const { return m_spline_values; } const int8u* spline8() const { return m_spline_values8; } double value(double x) const; void value(unsigned idx, double y); void point(unsigned idx, double x, double y); void x(unsigned idx, double x) { m_xp[idx] = x; } void y(unsigned idx, double y) { m_yp[idx] = y; } double x(unsigned idx) const { return m_xp[idx]; } double y(unsigned idx) const { return m_yp[idx]; } void update_spline(); // Vertex soutce interface unsigned num_paths() { return 5; } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: void calc_spline_box(); void calc_curve(); double calc_xp(unsigned idx); double calc_yp(unsigned idx); void set_xp(unsigned idx, double val); void set_yp(unsigned idx, double val); unsigned m_num_pnt; double m_xp[32]; double m_yp[32]; bspline m_spline; double m_spline_values[256]; int8u m_spline_values8[256]; double m_border_width; double m_border_extra; double m_curve_width; double m_point_size; double m_xs1; double m_ys1; double m_xs2; double m_ys2; path_storage m_curve_pnt; conv_stroke m_curve_poly; ellipse m_ellipse; unsigned m_idx; unsigned m_vertex; double m_vx[32]; double m_vy[32]; int m_active_pnt; int m_move_pnt; double m_pdx; double m_pdy; const trans_affine* m_mtx; }; template class spline_ctrl : public spline_ctrl_impl { public: spline_ctrl(double x1, double y1, double x2, double y2, unsigned num_pnt, bool flip_y=false) : spline_ctrl_impl(x1, y1, x2, y2, num_pnt, flip_y), m_background_color(rgba(1.0, 1.0, 0.9)), m_border_color(rgba(0.0, 0.0, 0.0)), m_curve_color(rgba(0.0, 0.0, 0.0)), m_inactive_pnt_color(rgba(0.0, 0.0, 0.0)), m_active_pnt_color(rgba(1.0, 0.0, 0.0)) { m_colors[0] = &m_background_color; m_colors[1] = &m_border_color; m_colors[2] = &m_curve_color; m_colors[3] = &m_inactive_pnt_color; m_colors[4] = &m_active_pnt_color; } // Set colors void background_color(const ColorT& c) { m_background_color = c; } void border_color(const ColorT& c) { m_border_color = c; } void curve_color(const ColorT& c) { m_curve_color = c; } void inactive_pnt_color(const ColorT& c) { m_inactive_pnt_color = c; } void active_pnt_color(const ColorT& c) { m_active_pnt_color = c; } const ColorT& color(unsigned i) const { return *m_colors[i]; } private: spline_ctrl(const spline_ctrl&); const spline_ctrl& operator = (const spline_ctrl&); ColorT m_background_color; ColorT m_border_color; ColorT m_curve_color; ColorT m_inactive_pnt_color; ColorT m_active_pnt_color; ColorT* m_colors[5]; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/Makefile.am0000644000175000017500000000037113233644505023777 0ustar varunvarunaggincludedir = $(includedir)/agg2/ctrl agginclude_HEADERS = agg_ctrl.h agg_gamma_spline.h agg_scale_ctrl.h agg_spline_ctrl.h \ agg_cbox_ctrl.h agg_gamma_ctrl.h agg_rbox_ctrl.h agg_slider_ctrl.h \ agg_bezier_ctrl.h agg_polygon_ctrl.h enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_gamma_spline.h0000644000175000017500000000742113233644505025371 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class gamma_spline // //---------------------------------------------------------------------------- #ifndef AGG_GAMMA_SPLINE_INCLUDED #define AGG_GAMMA_SPLINE_INCLUDED #include "agg_basics.h" #include "agg_bspline.h" namespace agg24 { //------------------------------------------------------------------------ // Class-helper for calculation gamma-correction arrays. A gamma-correction // array is an array of 256 unsigned chars that determine the actual values // of Anti-Aliasing for each pixel coverage value from 0 to 255. If all the // values in the array are equal to its index, i.e. 0,1,2,3,... there's // no gamma-correction. Class agg24::polyfill allows you to use custom // gamma-correction arrays. You can calculate it using any approach, and // class gamma_spline allows you to calculate almost any reasonable shape // of the gamma-curve with using only 4 values - kx1, ky1, kx2, ky2. // // kx2 // +----------------------------------+ // | | | . | // | | | . | ky2 // | | . ------| // | | . | // | | . | // |----------------.|----------------| // | . | | // | . | | // |-------. | | // ky1 | . | | | // | . | | | // +----------------------------------+ // kx1 // // Each value can be in range [0...2]. Value 1.0 means one quarter of the // bounding rectangle. Function values() calculates the curve by these // 4 values. After calling it one can get the gamma-array with call gamma(). // Class also supports the vertex source interface, i.e rewind() and // vertex(). It's made for convinience and used in class gamma_ctrl. // Before calling rewind/vertex one must set the bounding box // box() using pixel coordinates. //------------------------------------------------------------------------ class gamma_spline { public: gamma_spline(); void values(double kx1, double ky1, double kx2, double ky2); const unsigned char* gamma() const { return m_gamma; } double y(double x) const; void values(double* kx1, double* ky1, double* kx2, double* ky2) const; void box(double x1, double y1, double x2, double y2); void rewind(unsigned); unsigned vertex(double* x, double* y); private: unsigned char m_gamma[256]; double m_x[4]; double m_y[4]; bspline m_spline; double m_x1; double m_y1; double m_x2; double m_y2; double m_cur_x; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_scale_ctrl.h0000644000175000017500000001064513233644505025052 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes scale_ctrl_impl, scale_ctrl // //---------------------------------------------------------------------------- #ifndef AGG_SCALE_CTRL_INCLUDED #define AGG_SCALE_CTRL_INCLUDED #include "agg_basics.h" #include "agg_math.h" #include "agg_ellipse.h" #include "agg_trans_affine.h" #include "agg_color_rgba.h" #include "agg_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ class scale_ctrl_impl : public ctrl { enum move_e { move_nothing, move_value1, move_value2, move_slider }; public: scale_ctrl_impl(double x1, double y1, double x2, double y2, bool flip_y=false); void border_thickness(double t, double extra=0.0); void resize(double x1, double y1, double x2, double y2); double min_delta() const { return m_min_d; } void min_delta(double d) { m_min_d = d; } double value1() const { return m_value1; } void value1(double value); double value2() const { return m_value2; } void value2(double value); void move(double d); virtual bool in_rect(double x, double y) const; virtual bool on_mouse_button_down(double x, double y); virtual bool on_mouse_button_up(double x, double y); virtual bool on_mouse_move(double x, double y, bool button_flag); virtual bool on_arrow_keys(bool left, bool right, bool down, bool up); // Vertex soutce interface unsigned num_paths() { return 5; }; void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: void calc_box(); double m_border_thickness; double m_border_extra; double m_value1; double m_value2; double m_min_d; double m_xs1; double m_ys1; double m_xs2; double m_ys2; double m_pdx; double m_pdy; move_e m_move_what; double m_vx[32]; double m_vy[32]; ellipse m_ellipse; unsigned m_idx; unsigned m_vertex; }; //------------------------------------------------------------------------ template class scale_ctrl : public scale_ctrl_impl { public: scale_ctrl(double x1, double y1, double x2, double y2, bool flip_y=false) : scale_ctrl_impl(x1, y1, x2, y2, flip_y), m_background_color(rgba(1.0, 0.9, 0.8)), m_border_color(rgba(0.0, 0.0, 0.0)), m_pointers_color(rgba(0.8, 0.0, 0.0, 0.8)), m_slider_color(rgba(0.2, 0.1, 0.0, 0.6)) { m_colors[0] = &m_background_color; m_colors[1] = &m_border_color; m_colors[2] = &m_pointers_color; m_colors[3] = &m_pointers_color; m_colors[4] = &m_slider_color; } void background_color(const ColorT& c) { m_background_color = c; } void border_color(const ColorT& c) { m_border_color = c; } void pointers_color(const ColorT& c) { m_pointers_color = c; } void slider_color(const ColorT& c) { m_slider_color = c; } const ColorT& color(unsigned i) const { return *m_colors[i]; } private: scale_ctrl(const scale_ctrl&); const scale_ctrl& operator = (const scale_ctrl&); ColorT m_background_color; ColorT m_border_color; ColorT m_pointers_color; ColorT m_slider_color; ColorT* m_colors[5]; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_rbox_ctrl.h0000644000175000017500000001105113233644505024725 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes rbox_ctrl_impl, rbox_ctrl // //---------------------------------------------------------------------------- #ifndef AGG_RBOX_CTRL_INCLUDED #define AGG_RBOX_CTRL_INCLUDED #include "agg_array.h" #include "agg_ellipse.h" #include "agg_conv_stroke.h" #include "agg_gsv_text.h" #include "agg_trans_affine.h" #include "agg_color_rgba.h" #include "agg_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ class rbox_ctrl_impl : public ctrl { public: rbox_ctrl_impl(double x1, double y1, double x2, double y2, bool flip_y=false); void border_width(double t, double extra=0.0); void text_thickness(double t) { m_text_thickness = t; } void text_size(double h, double w=0.0); void add_item(const char* text); int cur_item() const { return m_cur_item; } void cur_item(int i) { m_cur_item = i; } virtual bool in_rect(double x, double y) const; virtual bool on_mouse_button_down(double x, double y); virtual bool on_mouse_button_up(double x, double y); virtual bool on_mouse_move(double x, double y, bool button_flag); virtual bool on_arrow_keys(bool left, bool right, bool down, bool up); // Vertex soutce interface unsigned num_paths() { return 5; }; void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: void calc_rbox(); double m_border_width; double m_border_extra; double m_text_thickness; double m_text_height; double m_text_width; pod_array m_items[32]; unsigned m_num_items; int m_cur_item; double m_xs1; double m_ys1; double m_xs2; double m_ys2; double m_vx[32]; double m_vy[32]; unsigned m_draw_item; double m_dy; ellipse m_ellipse; conv_stroke m_ellipse_poly; gsv_text m_text; conv_stroke m_text_poly; unsigned m_idx; unsigned m_vertex; }; //------------------------------------------------------------------------ template class rbox_ctrl : public rbox_ctrl_impl { public: rbox_ctrl(double x1, double y1, double x2, double y2, bool flip_y=false) : rbox_ctrl_impl(x1, y1, x2, y2, flip_y), m_background_color(rgba(1.0, 1.0, 0.9)), m_border_color(rgba(0.0, 0.0, 0.0)), m_text_color(rgba(0.0, 0.0, 0.0)), m_inactive_color(rgba(0.0, 0.0, 0.0)), m_active_color(rgba(0.4, 0.0, 0.0)) { m_colors[0] = &m_background_color; m_colors[1] = &m_border_color; m_colors[2] = &m_text_color; m_colors[3] = &m_inactive_color; m_colors[4] = &m_active_color; } void background_color(const ColorT& c) { m_background_color = c; } void border_color(const ColorT& c) { m_border_color = c; } void text_color(const ColorT& c) { m_text_color = c; } void inactive_color(const ColorT& c) { m_inactive_color = c; } void active_color(const ColorT& c) { m_active_color = c; } const ColorT& color(unsigned i) const { return *m_colors[i]; } private: rbox_ctrl(const rbox_ctrl&); const rbox_ctrl& operator = (const rbox_ctrl&); ColorT m_background_color; ColorT m_border_color; ColorT m_text_color; ColorT m_inactive_color; ColorT m_active_color; ColorT* m_colors[5]; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/ctrl/agg_slider_ctrl.h0000644000175000017500000001135113233644505025240 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes slider_ctrl_impl, slider_ctrl // //---------------------------------------------------------------------------- #ifndef AGG_SLIDER_CTRL_INCLUDED #define AGG_SLIDER_CTRL_INCLUDED #include "agg_basics.h" #include "agg_math.h" #include "agg_ellipse.h" #include "agg_trans_affine.h" #include "agg_color_rgba.h" #include "agg_gsv_text.h" #include "agg_conv_stroke.h" #include "agg_path_storage.h" #include "agg_ctrl.h" namespace agg24 { //--------------------------------------------------------slider_ctrl_impl class slider_ctrl_impl : public ctrl { public: slider_ctrl_impl(double x1, double y1, double x2, double y2, bool flip_y=false); void border_width(double t, double extra=0.0); void range(double min, double max) { m_min = min; m_max = max; } void num_steps(unsigned num) { m_num_steps = num; } void label(const char* fmt); void text_thickness(double t) { m_text_thickness = t; } bool descending() const { return m_descending; } void descending(bool v) { m_descending = v; } double value() const { return m_value * (m_max - m_min) + m_min; } void value(double value); virtual bool in_rect(double x, double y) const; virtual bool on_mouse_button_down(double x, double y); virtual bool on_mouse_button_up(double x, double y); virtual bool on_mouse_move(double x, double y, bool button_flag); virtual bool on_arrow_keys(bool left, bool right, bool down, bool up); // Vertex source interface unsigned num_paths() { return 6; }; void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: void calc_box(); bool normalize_value(bool preview_value_flag); double m_border_width; double m_border_extra; double m_text_thickness; double m_value; double m_preview_value; double m_min; double m_max; unsigned m_num_steps; bool m_descending; char m_label[64]; double m_xs1; double m_ys1; double m_xs2; double m_ys2; double m_pdx; bool m_mouse_move; double m_vx[32]; double m_vy[32]; ellipse m_ellipse; unsigned m_idx; unsigned m_vertex; gsv_text m_text; conv_stroke m_text_poly; path_storage m_storage; }; //----------------------------------------------------------slider_ctrl template class slider_ctrl : public slider_ctrl_impl { public: slider_ctrl(double x1, double y1, double x2, double y2, bool flip_y=false) : slider_ctrl_impl(x1, y1, x2, y2, flip_y), m_background_color(rgba(1.0, 0.9, 0.8)), m_triangle_color(rgba(0.7, 0.6, 0.6)), m_text_color(rgba(0.0, 0.0, 0.0)), m_pointer_preview_color(rgba(0.6, 0.4, 0.4, 0.4)), m_pointer_color(rgba(0.8, 0.0, 0.0, 0.6)) { m_colors[0] = &m_background_color; m_colors[1] = &m_triangle_color; m_colors[2] = &m_text_color; m_colors[3] = &m_pointer_preview_color; m_colors[4] = &m_pointer_color; m_colors[5] = &m_text_color; } void background_color(const ColorT& c) { m_background_color = c; } void pointer_color(const ColorT& c) { m_pointer_color = c; } const ColorT& color(unsigned i) const { return *m_colors[i]; } private: slider_ctrl(const slider_ctrl&); const slider_ctrl& operator = (const slider_ctrl&); ColorT m_background_color; ColorT m_triangle_color; ColorT m_text_color; ColorT m_pointer_preview_color; ColorT m_pointer_color; ColorT* m_colors[6]; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_pixfmt_base.h0000644000175000017500000000553613233644505024277 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_PIXFMT_BASE_INCLUDED #define AGG_PIXFMT_BASE_INCLUDED #include "agg_basics.h" #include "agg_color_gray.h" #include "agg_color_rgba.h" namespace agg24 { struct pixfmt_gray_tag { }; struct pixfmt_rgb_tag { }; struct pixfmt_rgba_tag { }; //--------------------------------------------------------------blender_base template struct blender_base { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; static rgba get(value_type r, value_type g, value_type b, value_type a, cover_type cover = cover_full) { if (cover > cover_none) { rgba c( color_type::to_double(r), color_type::to_double(g), color_type::to_double(b), color_type::to_double(a)); if (cover < cover_full) { double x = double(cover) / cover_full; c.r *= x; c.g *= x; c.b *= x; c.a *= x; } return c; } else return rgba::no_color(); } static rgba get(const value_type* p, cover_type cover = cover_full) { return get( p[order_type::R], p[order_type::G], p[order_type::B], p[order_type::A], cover); } static void set(value_type* p, value_type r, value_type g, value_type b, value_type a) { p[order_type::R] = r; p[order_type::G] = g; p[order_type::B] = b; p[order_type::A] = a; } static void set(value_type* p, const rgba& c) { p[order_type::R] = color_type::from_double(c.r); p[order_type::G] = color_type::from_double(c.g); p[order_type::B] = color_type::from_double(c.b); p[order_type::A] = color_type::from_double(c.a); } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_simul_eq.h0000644000175000017500000001006613233644505023606 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Solving simultaneous equations // //---------------------------------------------------------------------------- #ifndef AGG_SIMUL_EQ_INCLUDED #define AGG_SIMUL_EQ_INCLUDED #include #include "agg_basics.h" namespace agg24 { //=============================================================swap_arrays template void swap_arrays(T* a1, T* a2, unsigned n) { unsigned i; for(i = 0; i < n; i++) { T tmp = *a1; *a1++ = *a2; *a2++ = tmp; } } //============================================================matrix_pivot template struct matrix_pivot { static int pivot(double m[Rows][Cols], unsigned row) { int k = int(row); double max_val, tmp; max_val = -1.0; unsigned i; for(i = row; i < Rows; i++) { if((tmp = fabs(m[i][row])) > max_val && tmp != 0.0) { max_val = tmp; k = i; } } if(m[k][row] == 0.0) { return -1; } if(k != int(row)) { swap_arrays(m[k], m[row], Cols); return k; } return 0; } }; //===============================================================simul_eq template struct simul_eq { static bool solve(const double left[Size][Size], const double right[Size][RightCols], double result[Size][RightCols]) { unsigned i, j, k; double a1; double tmp[Size][Size + RightCols]; for(i = 0; i < Size; i++) { for(j = 0; j < Size; j++) { tmp[i][j] = left[i][j]; } for(j = 0; j < RightCols; j++) { tmp[i][Size + j] = right[i][j]; } } for(k = 0; k < Size; k++) { if(matrix_pivot::pivot(tmp, k) < 0) { return false; // Singularity.... } a1 = tmp[k][k]; for(j = k; j < Size + RightCols; j++) { tmp[k][j] /= a1; } for(i = k + 1; i < Size; i++) { a1 = tmp[i][k]; for (j = k; j < Size + RightCols; j++) { tmp[i][j] -= a1 * tmp[k][j]; } } } for(k = 0; k < RightCols; k++) { int m; for(m = int(Size - 1); m >= 0; m--) { result[m][k] = tmp[m][Size + k]; for(j = m + 1; j < Size; j++) { result[m][k] -= tmp[m][j] * result[j][k]; } } } return true; } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vpgen_clip_polygon.h0000644000175000017500000000470313233644505025666 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_VPGEN_CLIP_POLYGON_INCLUDED #define AGG_VPGEN_CLIP_POLYGON_INCLUDED #include "agg_basics.h" namespace agg24 { //======================================================vpgen_clip_polygon // // See Implementation agg_vpgen_clip_polygon.cpp // class vpgen_clip_polygon { public: vpgen_clip_polygon() : m_clip_box(0, 0, 1, 1), m_x1(0), m_y1(0), m_clip_flags(0), m_num_vertices(0), m_vertex(0), m_cmd(path_cmd_move_to) { } void clip_box(double x1, double y1, double x2, double y2) { m_clip_box.x1 = x1; m_clip_box.y1 = y1; m_clip_box.x2 = x2; m_clip_box.y2 = y2; m_clip_box.normalize(); } double x1() const { return m_clip_box.x1; } double y1() const { return m_clip_box.y1; } double x2() const { return m_clip_box.x2; } double y2() const { return m_clip_box.y2; } static bool auto_close() { return true; } static bool auto_unclose() { return false; } void reset(); void move_to(double x, double y); void line_to(double x, double y); unsigned vertex(double* x, double* y); private: unsigned clipping_flags(double x, double y); private: rect_d m_clip_box; double m_x1; double m_y1; unsigned m_clip_flags; double m_x[4]; double m_y[4]; unsigned m_num_vertices; unsigned m_vertex; unsigned m_cmd; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_glyph_raster_bin.h0000644000175000017500000001165413233644505025327 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_GLYPH_RASTER_BIN_INCLUDED #define AGG_GLYPH_RASTER_BIN_INCLUDED #include #include "agg_basics.h" namespace agg24 { //========================================================glyph_raster_bin template class glyph_raster_bin { public: typedef ColorT color_type; //-------------------------------------------------------------------- struct glyph_rect { int x1,y1,x2,y2; double dx, dy; }; //-------------------------------------------------------------------- glyph_raster_bin(const int8u* font) : m_font(font), m_big_endian(false) { int t = 1; if(*(char*)&t == 0) m_big_endian = true; memset(m_span, 0, sizeof(m_span)); } //-------------------------------------------------------------------- const int8u* font() const { return m_font; } void font(const int8u* f) { m_font = f; } //-------------------------------------------------------------------- double height() const { return m_font[0]; } double base_line() const { return m_font[1]; } //-------------------------------------------------------------------- template double width(const CharT* str) const { unsigned start_char = m_font[2]; unsigned num_chars = m_font[3]; unsigned w = 0; while(*str) { unsigned glyph = *str; const int8u* bits = m_font + 4 + num_chars * 2 + value(m_font + 4 + (glyph - start_char) * 2); w += *bits; ++str; } return w; } //-------------------------------------------------------------------- void prepare(glyph_rect* r, double x, double y, unsigned glyph, bool flip) { unsigned start_char = m_font[2]; unsigned num_chars = m_font[3]; m_bits = m_font + 4 + num_chars * 2 + value(m_font + 4 + (glyph - start_char) * 2); m_glyph_width = *m_bits++; m_glyph_byte_width = (m_glyph_width + 7) >> 3; r->x1 = int(x); r->x2 = r->x1 + m_glyph_width - 1; if(flip) { r->y1 = int(y) - m_font[0] + m_font[1]; r->y2 = r->y1 + m_font[0] - 1; } else { r->y1 = int(y) - m_font[1] + 1; r->y2 = r->y1 + m_font[0] - 1; } r->dx = m_glyph_width; r->dy = 0; } //-------------------------------------------------------------------- const cover_type* span(unsigned i) { i = m_font[0] - i - 1; const int8u* bits = m_bits + i * m_glyph_byte_width; unsigned j; unsigned val = *bits; unsigned nb = 0; for(j = 0; j < m_glyph_width; ++j) { m_span[j] = (cover_type)((val & 0x80) ? cover_full : cover_none); val <<= 1; if(++nb >= 8) { val = *++bits; nb = 0; } } return m_span; } private: //-------------------------------------------------------------------- int16u value(const int8u* p) const { int16u v; if(m_big_endian) { *(int8u*)&v = p[1]; *((int8u*)&v + 1) = p[0]; } else { *(int8u*)&v = p[0]; *((int8u*)&v + 1) = p[1]; } return v; } //-------------------------------------------------------------------- const int8u* m_font; bool m_big_endian; cover_type m_span[32]; const int8u* m_bits; unsigned m_glyph_width; unsigned m_glyph_byte_width; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_bezier_arc.h0000644000175000017500000001346013233644505024076 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Arc generator. Produces at most 4 consecutive cubic bezier curves, i.e., // 4, 7, 10, or 13 vertices. // //---------------------------------------------------------------------------- #ifndef AGG_BEZIER_ARC_INCLUDED #define AGG_BEZIER_ARC_INCLUDED #include "agg_conv_transform.h" namespace agg24 { //----------------------------------------------------------------------- void arc_to_bezier(double cx, double cy, double rx, double ry, double start_angle, double sweep_angle, double* curve); //==============================================================bezier_arc // // See implemantaion agg_bezier_arc.cpp // class bezier_arc { public: //-------------------------------------------------------------------- bezier_arc() : m_vertex(26), m_num_vertices(0), m_cmd(path_cmd_line_to) {} bezier_arc(double x, double y, double rx, double ry, double start_angle, double sweep_angle) { init(x, y, rx, ry, start_angle, sweep_angle); } //-------------------------------------------------------------------- void init(double x, double y, double rx, double ry, double start_angle, double sweep_angle); //-------------------------------------------------------------------- void rewind(unsigned) { m_vertex = 0; } //-------------------------------------------------------------------- unsigned vertex(double* x, double* y) { if(m_vertex >= m_num_vertices) return path_cmd_stop; *x = m_vertices[m_vertex]; *y = m_vertices[m_vertex + 1]; m_vertex += 2; return (m_vertex == 2) ? path_cmd_move_to : m_cmd; } // Supplemantary functions. num_vertices() actually returns doubled // number of vertices. That is, for 1 vertex it returns 2. //-------------------------------------------------------------------- unsigned num_vertices() const { return m_num_vertices; } const double* vertices() const { return m_vertices; } double* vertices() { return m_vertices; } private: unsigned m_vertex; unsigned m_num_vertices; double m_vertices[26]; unsigned m_cmd; }; //==========================================================bezier_arc_svg // Compute an SVG-style bezier arc. // // Computes an elliptical arc from (x1, y1) to (x2, y2). The size and // orientation of the ellipse are defined by two radii (rx, ry) // and an x-axis-rotation, which indicates how the ellipse as a whole // is rotated relative to the current coordinate system. The center // (cx, cy) of the ellipse is calculated automatically to satisfy the // constraints imposed by the other parameters. // large-arc-flag and sweep-flag contribute to the automatic calculations // and help determine how the arc is drawn. class bezier_arc_svg { public: //-------------------------------------------------------------------- bezier_arc_svg() : m_arc(), m_radii_ok(false) {} bezier_arc_svg(double x1, double y1, double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double x2, double y2) : m_arc(), m_radii_ok(false) { init(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2); } //-------------------------------------------------------------------- void init(double x1, double y1, double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double x2, double y2); //-------------------------------------------------------------------- bool radii_ok() const { return m_radii_ok; } //-------------------------------------------------------------------- void rewind(unsigned) { m_arc.rewind(0); } //-------------------------------------------------------------------- unsigned vertex(double* x, double* y) { return m_arc.vertex(x, y); } // Supplemantary functions. num_vertices() actually returns doubled // number of vertices. That is, for 1 vertex it returns 2. //-------------------------------------------------------------------- unsigned num_vertices() const { return m_arc.num_vertices(); } const double* vertices() const { return m_arc.vertices(); } double* vertices() { return m_arc.vertices(); } private: bezier_arc m_arc; bool m_radii_ok; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_dash.h0000644000175000017500000000433013233644505023731 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // conv_dash // //---------------------------------------------------------------------------- #ifndef AGG_CONV_DASH_INCLUDED #define AGG_CONV_DASH_INCLUDED #include "agg_basics.h" #include "agg_vcgen_dash.h" #include "agg_conv_adaptor_vcgen.h" namespace agg24 { //---------------------------------------------------------------conv_dash template struct conv_dash : public conv_adaptor_vcgen { typedef Markers marker_type; typedef conv_adaptor_vcgen base_type; conv_dash(VertexSource& vs) : conv_adaptor_vcgen(vs) { } void remove_all_dashes() { base_type::generator().remove_all_dashes(); } void add_dash(double dash_len, double gap_len) { base_type::generator().add_dash(dash_len, gap_len); } void dash_start(double ds) { base_type::generator().dash_start(ds); } void shorten(double s) { base_type::generator().shorten(s); } double shorten() const { return base_type::generator().shorten(); } private: conv_dash(const conv_dash&); const conv_dash& operator = (const conv_dash&); }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_gouraud_rgba.h0000644000175000017500000002366513233644505025463 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_GOURAUD_RGBA_INCLUDED #define AGG_SPAN_GOURAUD_RGBA_INCLUDED #include "agg_basics.h" #include "agg_color_rgba.h" #include "agg_dda_line.h" #include "agg_span_gouraud.h" namespace agg24 { //=======================================================span_gouraud_rgba template class span_gouraud_rgba : public span_gouraud { public: typedef ColorT color_type; typedef typename ColorT::value_type value_type; typedef span_gouraud base_type; typedef typename base_type::coord_type coord_type; enum subpixel_scale_e { subpixel_shift = 4, subpixel_scale = 1 << subpixel_shift }; private: //-------------------------------------------------------------------- struct rgba_calc { void init(const coord_type& c1, const coord_type& c2) { m_x1 = c1.x - 0.5; m_y1 = c1.y - 0.5; m_dx = c2.x - c1.x; double dy = c2.y - c1.y; m_1dy = (dy < 1e-5) ? 1e5 : 1.0 / dy; m_r1 = c1.color.r; m_g1 = c1.color.g; m_b1 = c1.color.b; m_a1 = c1.color.a; m_dr = c2.color.r - m_r1; m_dg = c2.color.g - m_g1; m_db = c2.color.b - m_b1; m_da = c2.color.a - m_a1; } void calc(double y) { double k = (y - m_y1) * m_1dy; if(k < 0.0) k = 0.0; if(k > 1.0) k = 1.0; m_r = m_r1 + iround(m_dr * k); m_g = m_g1 + iround(m_dg * k); m_b = m_b1 + iround(m_db * k); m_a = m_a1 + iround(m_da * k); m_x = iround((m_x1 + m_dx * k) * subpixel_scale); } double m_x1; double m_y1; double m_dx; double m_1dy; int m_r1; int m_g1; int m_b1; int m_a1; int m_dr; int m_dg; int m_db; int m_da; int m_r; int m_g; int m_b; int m_a; int m_x; }; public: //-------------------------------------------------------------------- span_gouraud_rgba() {} span_gouraud_rgba(const color_type& c1, const color_type& c2, const color_type& c3, double x1, double y1, double x2, double y2, double x3, double y3, double d = 0) : base_type(c1, c2, c3, x1, y1, x2, y2, x3, y3, d) {} //-------------------------------------------------------------------- void prepare() { coord_type coord[3]; base_type::arrange_vertices(coord); m_y2 = int(coord[1].y); m_swap = cross_product(coord[0].x, coord[0].y, coord[2].x, coord[2].y, coord[1].x, coord[1].y) < 0.0; m_rgba1.init(coord[0], coord[2]); m_rgba2.init(coord[0], coord[1]); m_rgba3.init(coord[1], coord[2]); } //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { m_rgba1.calc(y);//(m_rgba1.m_1dy > 2) ? m_rgba1.m_y1 : y); const rgba_calc* pc1 = &m_rgba1; const rgba_calc* pc2 = &m_rgba2; if(y <= m_y2) { // Bottom part of the triangle (first subtriangle) //------------------------- m_rgba2.calc(y + m_rgba2.m_1dy); } else { // Upper part (second subtriangle) m_rgba3.calc(y - m_rgba3.m_1dy); //------------------------- pc2 = &m_rgba3; } if(m_swap) { // It means that the triangle is oriented clockwise, // so that we need to swap the controlling structures //------------------------- const rgba_calc* t = pc2; pc2 = pc1; pc1 = t; } // Get the horizontal length with subpixel accuracy // and protect it from division by zero //------------------------- int nlen = abs(pc2->m_x - pc1->m_x); if(nlen <= 0) nlen = 1; dda_line_interpolator<14> r(pc1->m_r, pc2->m_r, nlen); dda_line_interpolator<14> g(pc1->m_g, pc2->m_g, nlen); dda_line_interpolator<14> b(pc1->m_b, pc2->m_b, nlen); dda_line_interpolator<14> a(pc1->m_a, pc2->m_a, nlen); // Calculate the starting point of the gradient with subpixel // accuracy and correct (roll back) the interpolators. // This operation will also clip the beginning of the span // if necessary. //------------------------- int start = pc1->m_x - (x << subpixel_shift); r -= start; g -= start; b -= start; a -= start; nlen += start; int vr, vg, vb, va; enum lim_e { lim = color_type::base_mask }; // Beginning part of the span. Since we rolled back the // interpolators, the color values may have overflow. // So that, we render the beginning part with checking // for overflow. It lasts until "start" is positive; // typically it's 1-2 pixels, but may be more in some cases. //------------------------- while(len && start > 0) { vr = r.y(); vg = g.y(); vb = b.y(); va = a.y(); if(vr < 0) { vr = 0; }; if(vr > lim) { vr = lim; }; if(vg < 0) { vg = 0; }; if(vg > lim) { vg = lim; }; if(vb < 0) { vb = 0; }; if(vb > lim) { vb = lim; }; if(va < 0) { va = 0; }; if(va > lim) { va = lim; }; span->r = (value_type)vr; span->g = (value_type)vg; span->b = (value_type)vb; span->a = (value_type)va; r += subpixel_scale; g += subpixel_scale; b += subpixel_scale; a += subpixel_scale; nlen -= subpixel_scale; start -= subpixel_scale; ++span; --len; } // Middle part, no checking for overflow. // Actual spans can be longer than the calculated length // because of anti-aliasing, thus, the interpolators can // overflow. But while "nlen" is positive we are safe. //------------------------- while(len && nlen > 0) { span->r = (value_type)r.y(); span->g = (value_type)g.y(); span->b = (value_type)b.y(); span->a = (value_type)a.y(); r += subpixel_scale; g += subpixel_scale; b += subpixel_scale; a += subpixel_scale; nlen -= subpixel_scale; ++span; --len; } // Ending part; checking for overflow. // Typically it's 1-2 pixels, but may be more in some cases. //------------------------- while(len) { vr = r.y(); vg = g.y(); vb = b.y(); va = a.y(); if(vr < 0) { vr = 0; }; if(vr > lim) { vr = lim; }; if(vg < 0) { vg = 0; }; if(vg > lim) { vg = lim; }; if(vb < 0) { vb = 0; }; if(vb > lim) { vb = lim; }; if(va < 0) { va = 0; }; if(va > lim) { va = lim; }; span->r = (value_type)vr; span->g = (value_type)vg; span->b = (value_type)vb; span->a = (value_type)va; r += subpixel_scale; g += subpixel_scale; b += subpixel_scale; a += subpixel_scale; ++span; --len; } } private: bool m_swap; int m_y2; rgba_calc m_rgba1; rgba_calc m_rgba2; rgba_calc m_rgba3; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/platform/0000755000175000017500000000000013544357602022626 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/platform/mac/0000755000175000017500000000000013544357602023366 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/platform/mac/agg_mac_pmap.h0000644000175000017500000000532113233644505026127 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (McSeem) // Copyright (C) 2002 Hansruedi Baer (MacOS support) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com // baer@karto.baug.eth.ch //---------------------------------------------------------------------------- // // class pixel_map // //---------------------------------------------------------------------------- #ifndef AGG_MAC_PMAP_INCLUDED #define AGG_MAC_PMAP_INCLUDED #include #include namespace agg24 { enum org_e { org_mono8 = 8, org_color16 = 16, org_color24 = 24, org_color32 = 32 }; class pixel_map { public: ~pixel_map(); pixel_map(); public: void destroy(); void create(unsigned width, unsigned height, org_e org, unsigned clear_val=255); void clear(unsigned clear_val=255); bool load_from_qt(const char* filename); bool save_as_qt(const char* filename) const; void draw(WindowRef window, const Rect* device_rect=0, const Rect* bmp_rect=0) const; void draw(WindowRef window, int x, int y, double scale=1.0) const; void blend(WindowRef window, const Rect* device_rect=0, const Rect* bmp_rect=0) const; void blend(WindowRef window, int x, int y, double scale=1.0) const; unsigned char* buf(); unsigned width() const; unsigned height() const; int row_bytes() const; unsigned bpp() const { return m_bpp; } //Auxiliary static functions static unsigned calc_row_len(unsigned width, unsigned bits_per_pixel); private: pixel_map(const pixel_map&); const pixel_map& operator = (const pixel_map&); private: GWorldPtr m_pmap; unsigned char* m_buf; unsigned m_bpp; unsigned m_img_size; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/platform/agg_platform_support.h0000644000175000017500000007467013233644505027247 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class platform_support // // It's not a part of the AGG library, it's just a helper class to create // interactive demo examples. Since the examples should not be too complex // this class is provided to support some very basic interactive graphical // functionality, such as putting the rendered image to the window, simple // keyboard and mouse input, window resizing, setting the window title, // and catching the "idle" events. // // The idea is to have a single header file that does not depend on any // platform (I hate these endless #ifdef/#elif/#elif.../#endif) and a number // of different implementations depending on the concrete platform. // The most popular platforms are: // // Windows-32 API // X-Window API // SDL library (see http://www.libsdl.org/) // MacOS C/C++ API // // This file does not include any system dependent .h files such as // windows.h or X11.h, so, your demo applications do not depend on the // platform. The only file that can #include system dependend headers // is the implementation file agg_platform_support.cpp. Different // implementations are placed in different directories, such as // ~/agg/src/platform/win32 // ~/agg/src/platform/sdl // ~/agg/src/platform/X11 // and so on. // // All the system dependent stuff sits in the platform_specific // class which is forward-declared here but not defined. // The platform_support class has just a pointer to it and it's // the responsibility of the implementation to create/delete it. // This class being defined in the implementation file can have // any platform dependent stuff such as HWND, X11 Window and so on. // //---------------------------------------------------------------------------- #ifndef AGG_PLATFORM_SUPPORT_INCLUDED #define AGG_PLATFORM_SUPPORT_INCLUDED #include "agg_basics.h" #include "agg_rendering_buffer.h" #include "agg_trans_viewport.h" #include "ctrl/agg_ctrl.h" namespace agg24 { //----------------------------------------------------------window_flag_e // These are flags used in method init(). Not all of them are // applicable on different platforms, for example the win32_api // cannot use a hardware buffer (window_hw_buffer). // The implementation should simply ignore unsupported flags. enum window_flag_e { window_resize = 1, window_hw_buffer = 2, window_keep_aspect_ratio = 4, window_process_all_keys = 8 }; //-----------------------------------------------------------pix_format_e // Possible formats of the rendering buffer. Initially I thought that it's // reasonable to create the buffer and the rendering functions in // accordance with the native pixel format of the system because it // would have no overhead for pixel format conersion. // But eventually I came to a conclusion that having a possibility to // convert pixel formats on demand is a good idea. First, it was X11 where // there lots of different formats and visuals and it would be great to // render everything in, say, RGB-24 and display it automatically without // any additional efforts. The second reason is to have a possibility to // debug renderers for different pixel formats and colorspaces having only // one computer and one system. // // This stuff is not included into the basic AGG functionality because the // number of supported pixel formats (and/or colorspaces) can be great and // if one needs to add new format it would be good only to add new // rendering files without having to modify any existing ones (a general // principle of incapsulation and isolation). // // Using a particular pixel format doesn't obligatory mean the necessity // of software conversion. For example, win32 API can natively display // gray8, 15-bit RGB, 24-bit BGR, and 32-bit BGRA formats. // This list can be (and will be!) extended in future. enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_bw, // 1 bit per color B/W pix_format_gray8, // Simple 256 level grayscale pix_format_sgray8, // Simple 256 level grayscale (sRGB) pix_format_gray16, // Simple 65535 level grayscale pix_format_gray32, // Grayscale, one 32-bit float per pixel pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgbAAA, // 30 bit rgb. Depends on the byte ordering! pix_format_rgbBBA, // 32 bit rgb. Depends on the byte ordering! pix_format_bgrAAA, // 30 bit bgr. Depends on the byte ordering! pix_format_bgrABB, // 32 bit bgr. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_srgb24, // R-G-B, one byte per color component (sRGB) pix_format_bgr24, // B-G-R, one byte per color component pix_format_sbgr24, // B-G-R, native win32 BMP format (sRGB) pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_srgba32, // R-G-B-A, one byte per color component (sRGB) pix_format_argb32, // A-R-G-B, native MAC format pix_format_sargb32, // A-R-G-B, native MAC format (sRGB) pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_sabgr32, // A-B-G-R, one byte per color component (sRGB) pix_format_bgra32, // B-G-R-A, native win32 BMP format pix_format_sbgra32, // B-G-R-A, native win32 BMP format (sRGB) pix_format_rgb48, // R-G-B, 16 bits per color component pix_format_bgr48, // B-G-R, native win32 BMP format. pix_format_rgb96, // R-G-B, one 32-bit float per color component pix_format_bgr96, // B-G-R, one 32-bit float per color component pix_format_rgba64, // R-G-B-A, 16 bits byte per color component pix_format_argb64, // A-R-G-B, native MAC format pix_format_abgr64, // A-B-G-R, one byte per color component pix_format_bgra64, // B-G-R-A, native win32 BMP format pix_format_rgba128, // R-G-B-A, one 32-bit float per color component pix_format_argb128, // A-R-G-B, one 32-bit float per color component pix_format_abgr128, // A-B-G-R, one 32-bit float per color component pix_format_bgra128, // B-G-R-A, one 32-bit float per color component end_of_pix_formats }; //-------------------------------------------------------------input_flag_e // Mouse and keyboard flags. They can be different on different platforms // and the ways they are obtained are also different. But in any case // the system dependent flags should be mapped into these ones. The meaning // of that is as follows. For example, if kbd_ctrl is set it means that the // ctrl key is pressed and being held at the moment. They are also used in // the overridden methods such as on_mouse_move(), on_mouse_button_down(), // on_mouse_button_dbl_click(), on_mouse_button_up(), on_key(). // In the method on_mouse_button_up() the mouse flags have different // meaning. They mean that the respective button is being released, but // the meaning of the keyboard flags remains the same. // There's absolut minimal set of flags is used because they'll be most // probably supported on different platforms. Even the mouse_right flag // is restricted because Mac's mice have only one button, but AFAIK // it can be simulated with holding a special key on the keydoard. enum input_flag_e { mouse_left = 1, mouse_right = 2, kbd_shift = 4, kbd_ctrl = 8 }; //--------------------------------------------------------------key_code_e // Keyboard codes. There's also a restricted set of codes that are most // probably supported on different platforms. Any platform dependent codes // should be converted into these ones. There're only those codes are // defined that cannot be represented as printable ASCII-characters. // All printable ASCII-set can be used in a regular C/C++ manner: // ' ', 'A', '0' '+' and so on. // Since the class is used for creating very simple demo-applications // we don't need very rich possibilities here, just basic ones. // Actually the numeric key codes are taken from the SDL library, so, // the implementation of the SDL support does not require any mapping. enum key_code_e { // ASCII set. Should be supported everywhere key_backspace = 8, key_tab = 9, key_clear = 12, key_return = 13, key_pause = 19, key_escape = 27, // Keypad key_delete = 127, key_kp0 = 256, key_kp1 = 257, key_kp2 = 258, key_kp3 = 259, key_kp4 = 260, key_kp5 = 261, key_kp6 = 262, key_kp7 = 263, key_kp8 = 264, key_kp9 = 265, key_kp_period = 266, key_kp_divide = 267, key_kp_multiply = 268, key_kp_minus = 269, key_kp_plus = 270, key_kp_enter = 271, key_kp_equals = 272, // Arrow-keys and stuff key_up = 273, key_down = 274, key_right = 275, key_left = 276, key_insert = 277, key_home = 278, key_end = 279, key_page_up = 280, key_page_down = 281, // Functional keys. You'd better avoid using // f11...f15 in your applications if you want // the applications to be portable key_f1 = 282, key_f2 = 283, key_f3 = 284, key_f4 = 285, key_f5 = 286, key_f6 = 287, key_f7 = 288, key_f8 = 289, key_f9 = 290, key_f10 = 291, key_f11 = 292, key_f12 = 293, key_f13 = 294, key_f14 = 295, key_f15 = 296, // The possibility of using these keys is // very restricted. Actually it's guaranteed // only in win32_api and win32_sdl implementations key_numlock = 300, key_capslock = 301, key_scrollock = 302, // Phew! end_of_key_codes }; //------------------------------------------------------------------------ // A predeclaration of the platform dependent class. Since we do not // know anything here the only we can have is just a pointer to this // class as a data member. It should be created and destroyed explicitly // in the constructor/destructor of the platform_support class. // Although the pointer to platform_specific is public the application // cannot have access to its members or methods since it does not know // anything about them and it's a perfect incapsulation :-) class platform_specific; //----------------------------------------------------------ctrl_container // A helper class that contains pointers to a number of controls. // This class is used to ease the event handling with controls. // The implementation should simply call the appropriate methods // of this class when appropriate events occur. class ctrl_container { enum max_ctrl_e { max_ctrl = 64 }; public: //-------------------------------------------------------------------- ctrl_container() : m_num_ctrl(0), m_cur_ctrl(-1) {} //-------------------------------------------------------------------- void add(ctrl& c) { if(m_num_ctrl < max_ctrl) { m_ctrl[m_num_ctrl++] = &c; } } //-------------------------------------------------------------------- bool in_rect(double x, double y) { unsigned i; for(i = 0; i < m_num_ctrl; i++) { if(m_ctrl[i]->in_rect(x, y)) return true; } return false; } //-------------------------------------------------------------------- bool on_mouse_button_down(double x, double y) { unsigned i; for(i = 0; i < m_num_ctrl; i++) { if(m_ctrl[i]->on_mouse_button_down(x, y)) return true; } return false; } //-------------------------------------------------------------------- bool on_mouse_button_up(double x, double y) { unsigned i; bool flag = false; for(i = 0; i < m_num_ctrl; i++) { if(m_ctrl[i]->on_mouse_button_up(x, y)) flag = true; } return flag; } //-------------------------------------------------------------------- bool on_mouse_move(double x, double y, bool button_flag) { unsigned i; for(i = 0; i < m_num_ctrl; i++) { if(m_ctrl[i]->on_mouse_move(x, y, button_flag)) return true; } return false; } //-------------------------------------------------------------------- bool on_arrow_keys(bool left, bool right, bool down, bool up) { if(m_cur_ctrl >= 0) { return m_ctrl[m_cur_ctrl]->on_arrow_keys(left, right, down, up); } return false; } //-------------------------------------------------------------------- bool set_cur(double x, double y) { unsigned i; for(i = 0; i < m_num_ctrl; i++) { if(m_ctrl[i]->in_rect(x, y)) { if(m_cur_ctrl != int(i)) { m_cur_ctrl = i; return true; } return false; } } if(m_cur_ctrl != -1) { m_cur_ctrl = -1; return true; } return false; } private: ctrl* m_ctrl[max_ctrl]; unsigned m_num_ctrl; int m_cur_ctrl; }; //---------------------------------------------------------platform_support // This class is a base one to the apllication classes. It can be used // as follows: // // class the_application : public agg24::platform_support // { // public: // the_application(unsigned bpp, bool flip_y) : // platform_support(bpp, flip_y) // . . . // // //override stuff . . . // virtual void on_init() // { // . . . // } // // virtual void on_draw() // { // . . . // } // // virtual void on_resize(int sx, int sy) // { // . . . // } // // . . . and so on, see virtual functions // // // //any your own stuff . . . // }; // // // int agg_main(int argc, char* argv[]) // { // the_application app(pix_format_rgb24, true); // app.caption("AGG Example. Lion"); // // if(app.init(500, 400, agg24::window_resize)) // { // return app.run(); // } // return 1; // } // // The reason to have agg_main() instead of just main() is that SDL // for Windows requires including SDL.h if you define main(). Since // the demo applications cannot rely on any platform/library specific // stuff it's impossible to include SDL.h into the application files. // The demo applications are simple and their use is restricted, so, // this approach is quite reasonable. // class platform_support { public: enum max_images_e { max_images = 16 }; // format - see enum pix_format_e {}; // flip_y - true if you want to have the Y-axis flipped vertically. platform_support(pix_format_e format, bool flip_y); virtual ~platform_support(); // Setting the windows caption (title). Should be able // to be called at least before calling init(). // It's perfect if they can be called anytime. void caption(const char* cap); const char* caption() const { return m_caption; } //-------------------------------------------------------------------- // These 3 methods handle working with images. The image // formats are the simplest ones, such as .BMP in Windows or // .ppm in Linux. In the applications the names of the files // should not have any file extensions. Method load_img() can // be called before init(), so, the application could be able // to determine the initial size of the window depending on // the size of the loaded image. // The argument "idx" is the number of the image 0...max_images-1 bool load_img(unsigned idx, const char* file); bool save_img(unsigned idx, const char* file); bool create_img(unsigned idx, unsigned width=0, unsigned height=0); //-------------------------------------------------------------------- // init() and run(). See description before the class for details. // The necessity of calling init() after creation is that it's // impossible to call the overridden virtual function (on_init()) // from the constructor. On the other hand it's very useful to have // some on_init() event handler when the window is created but // not yet displayed. The rbuf_window() method (see below) is // accessible from on_init(). bool init(unsigned width, unsigned height, unsigned flags); int run(); //-------------------------------------------------------------------- // The very same parameters that were used in the constructor pix_format_e format() const { return m_format; } bool flip_y() const { return m_flip_y; } unsigned bpp() const { return m_bpp; } //-------------------------------------------------------------------- // The following provides a very simple mechanism of doing someting // in background. It's not multithreading. When wait_mode is true // the class waits for the events and it does not ever call on_idle(). // When it's false it calls on_idle() when the event queue is empty. // The mode can be changed anytime. This mechanism is satisfactory // to create very simple animations. bool wait_mode() const { return m_wait_mode; } void wait_mode(bool wait_mode) { m_wait_mode = wait_mode; } //-------------------------------------------------------------------- // These two functions control updating of the window. // force_redraw() is an analog of the Win32 InvalidateRect() function. // Being called it sets a flag (or sends a message) which results // in calling on_draw() and updating the content of the window // when the next event cycle comes. // update_window() results in just putting immediately the content // of the currently rendered buffer to the window without calling // on_draw(). void force_redraw(); void update_window(); //-------------------------------------------------------------------- // So, finally, how to draw anythig with AGG? Very simple. // rbuf_window() returns a reference to the main rendering // buffer which can be attached to any rendering class. // rbuf_img() returns a reference to the previously created // or loaded image buffer (see load_img()). The image buffers // are not displayed directly, they should be copied to or // combined somehow with the rbuf_window(). rbuf_window() is // the only buffer that can be actually displayed. rendering_buffer& rbuf_window() { return m_rbuf_window; } rendering_buffer& rbuf_img(unsigned idx) { return m_rbuf_img[idx]; } //-------------------------------------------------------------------- // Returns file extension used in the implementation for the particular // system. const char* img_ext() const; //-------------------------------------------------------------------- void copy_img_to_window(unsigned idx) { if(idx < max_images && rbuf_img(idx).buf()) { rbuf_window().copy_from(rbuf_img(idx)); } } //-------------------------------------------------------------------- void copy_window_to_img(unsigned idx) { if(idx < max_images) { create_img(idx, rbuf_window().width(), rbuf_window().height()); rbuf_img(idx).copy_from(rbuf_window()); } } //-------------------------------------------------------------------- void copy_img_to_img(unsigned idx_to, unsigned idx_from) { if(idx_from < max_images && idx_to < max_images && rbuf_img(idx_from).buf()) { create_img(idx_to, rbuf_img(idx_from).width(), rbuf_img(idx_from).height()); rbuf_img(idx_to).copy_from(rbuf_img(idx_from)); } } //-------------------------------------------------------------------- // Event handlers. They are not pure functions, so you don't have // to override them all. // In my demo applications these functions are defined inside // the the_application class (implicit inlining) which is in general // very bad practice, I mean vitual inline methods. At least it does // not make sense. // But in this case it's quite appropriate bacause we have the only // instance of the the_application class and it is in the same file // where this class is defined. virtual void on_init(); virtual void on_resize(int sx, int sy); virtual void on_idle(); virtual void on_mouse_move(int x, int y, unsigned flags); virtual void on_mouse_button_down(int x, int y, unsigned flags); virtual void on_mouse_button_up(int x, int y, unsigned flags); virtual void on_key(int x, int y, unsigned key, unsigned flags); virtual void on_ctrl_change(); virtual void on_draw(); virtual void on_post_draw(void* raw_handler); //-------------------------------------------------------------------- // Adding control elements. A control element once added will be // working and reacting to the mouse and keyboard events. Still, you // will have to render them in the on_draw() using function // render_ctrl() because platform_support doesn't know anything about // renderers you use. The controls will be also scaled automatically // if they provide a proper scaling mechanism (all the controls // included into the basic AGG package do). // If you don't need a particular control to be scaled automatically // call ctrl::no_transform() after adding. void add_ctrl(ctrl& c) { m_ctrls.add(c); c.transform(m_resize_mtx); } //-------------------------------------------------------------------- // Auxiliary functions. trans_affine_resizing() modifier sets up the resizing // matrix on the basis of the given width and height and the initial // width and height of the window. The implementation should simply // call this function every time when it catches the resizing event // passing in the new values of width and height of the window. // Nothing prevents you from "cheating" the scaling matrix if you // call this function from somewhere with wrong arguments. // trans_affine_resizing() accessor simply returns current resizing matrix // which can be used to apply additional scaling of any of your // stuff when the window is being resized. // width(), height(), initial_width(), and initial_height() must be // clear to understand with no comments :-) void trans_affine_resizing(int width, int height) { if(m_window_flags & window_keep_aspect_ratio) { //double sx = double(width) / double(m_initial_width); //double sy = double(height) / double(m_initial_height); //if(sy < sx) sx = sy; //m_resize_mtx = trans_affine_scaling(sx, sx); trans_viewport vp; vp.preserve_aspect_ratio(0.5, 0.5, aspect_ratio_meet); vp.device_viewport(0, 0, width, height); vp.world_viewport(0, 0, m_initial_width, m_initial_height); m_resize_mtx = vp.to_affine(); } else { m_resize_mtx = trans_affine_scaling( double(width) / double(m_initial_width), double(height) / double(m_initial_height)); } } trans_affine& trans_affine_resizing() { return m_resize_mtx; } const trans_affine& trans_affine_resizing() const { return m_resize_mtx; } double width() const { return m_rbuf_window.width(); } double height() const { return m_rbuf_window.height(); } double initial_width() const { return m_initial_width; } double initial_height() const { return m_initial_height; } unsigned window_flags() const { return m_window_flags; } //-------------------------------------------------------------------- // Get raw display handler depending on the system. // For win32 its an HDC, for other systems it can be a pointer to some // structure. See the implementation files for detals. // It's provided "as is", so, first you should check if it's not null. // If it's null the raw_display_handler is not supported. Also, there's // no guarantee that this function is implemented, so, in some // implementations you may have simply an unresolved symbol when linking. void* raw_display_handler(); //-------------------------------------------------------------------- // display message box or print the message to the console // (depending on implementation) void message(const char* msg); //-------------------------------------------------------------------- // Stopwatch functions. Function elapsed_time() returns time elapsed // since the latest start_timer() invocation in millisecods. // The resolutoin depends on the implementation. // In Win32 it uses QueryPerformanceFrequency() / QueryPerformanceCounter(). void start_timer(); double elapsed_time() const; //-------------------------------------------------------------------- // Get the full file name. In most cases it simply returns // file_name. As it's appropriate in many systems if you open // a file by its name without specifying the path, it tries to // open it in the current directory. The demos usually expect // all the supplementary files to be placed in the current // directory, that is usually coincides with the directory where // the executable is. However, in some systems (BeOS) it's not so. // For those kinds of systems full_file_name() can help access files // preserving commonly used policy. // So, it's a good idea to use in the demos the following: // FILE* fd = fopen(full_file_name("some.file"), "r"); // instead of // FILE* fd = fopen("some.file", "r"); const char* full_file_name(const char* file_name); public: platform_specific* m_specific; ctrl_container m_ctrls; // Sorry, I'm too tired to describe the private // data membders. See the implementations for different // platforms for details. private: platform_support(const platform_support&); const platform_support& operator = (const platform_support&); pix_format_e m_format; unsigned m_bpp; rendering_buffer m_rbuf_window; rendering_buffer m_rbuf_img[max_images]; unsigned m_window_flags; bool m_wait_mode; bool m_flip_y; char m_caption[256]; int m_initial_width; int m_initial_height; trans_affine m_resize_mtx; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/platform/win32/0000755000175000017500000000000013544357602023570 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/platform/win32/agg_win32_bmp.h0000644000175000017500000001024113233644505026351 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class pixel_map // //---------------------------------------------------------------------------- #ifndef AGG_WIN32_BMP_INCLUDED #define AGG_WIN32_BMP_INCLUDED #include #include namespace agg24 { enum org_e { org_mono8 = 8, org_color16 = 16, org_color24 = 24, org_color32 = 32, org_color48 = 48, org_color64 = 64 }; class pixel_map { public: ~pixel_map(); pixel_map(); public: void destroy(); void create(unsigned width, unsigned height, org_e org, unsigned clear_val=256); HBITMAP create_dib_section(HDC h_dc, unsigned width, unsigned height, org_e org, unsigned clear_val=256); void clear(unsigned clear_val=256); void attach_to_bmp(BITMAPINFO* bmp); BITMAPINFO* bitmap_info() { return m_bmp; } bool load_from_bmp(FILE* fd); bool save_as_bmp(FILE* fd) const; bool load_from_bmp(const char* filename); bool save_as_bmp(const char* filename) const; void draw(HDC h_dc, const RECT* device_rect=0, const RECT* bmp_rect=0) const; void draw(HDC h_dc, int x, int y, double scale=1.0) const; void blend(HDC h_dc, const RECT* device_rect=0, const RECT* bmp_rect=0) const; void blend(HDC h_dc, int x, int y, double scale=1.0) const; unsigned char* buf(); unsigned width() const; unsigned height() const; int stride() const; unsigned bpp() const { return m_bpp; } //Auxiliary static functions static unsigned calc_full_size(BITMAPINFO *bmp); static unsigned calc_header_size(BITMAPINFO *bmp); static unsigned calc_palette_size(unsigned clr_used, unsigned bits_per_pixel); static unsigned calc_palette_size(BITMAPINFO *bmp); static unsigned char* calc_img_ptr(BITMAPINFO *bmp); static BITMAPINFO* create_bitmap_info(unsigned width, unsigned height, unsigned bits_per_pixel); static void create_gray_scale_palette(BITMAPINFO *bmp); static unsigned calc_row_len(unsigned width, unsigned bits_per_pixel); private: pixel_map(const pixel_map&); const pixel_map& operator = (const pixel_map&); void create_from_bmp(BITMAPINFO *bmp); HBITMAP create_dib_section_from_args(HDC h_dc, unsigned width, unsigned height, unsigned bits_per_pixel); private: BITMAPINFO* m_bmp; unsigned char* m_buf; unsigned m_bpp; bool m_is_internal; unsigned m_img_size; unsigned m_full_size; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/platform/Makefile.am0000644000175000017500000000022613233644505024656 0ustar varunvarunEXTRA_DIST=win32/agg_win32_bmp.h \ mac/agg_mac_pmap.h myincludedir = $(includedir)/agg2/platform myinclude_HEADERS = agg_platform_support.h enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_curve.h0000644000175000017500000001532513233644505024144 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes conv_curve // //---------------------------------------------------------------------------- #ifndef AGG_CONV_CURVE_INCLUDED #define AGG_CONV_CURVE_INCLUDED #include "agg_basics.h" #include "agg_curves.h" namespace agg24 { //---------------------------------------------------------------conv_curve // Curve converter class. Any path storage can have Bezier curves defined // by their control points. There're two types of curves supported: curve3 // and curve4. Curve3 is a conic Bezier curve with 2 endpoints and 1 control // point. Curve4 has 2 control points (4 points in total) and can be used // to interpolate more complicated curves. Curve4, unlike curve3 can be used // to approximate arcs, both circular and elliptical. Curves are approximated // with straight lines and one of the approaches is just to store the whole // sequence of vertices that approximate our curve. It takes additional // memory, and at the same time the consecutive vertices can be calculated // on demand. // // Initially, path storages are not suppose to keep all the vertices of the // curves (although, nothing prevents us from doing so). Instead, path_storage // keeps only vertices, needed to calculate a curve on demand. Those vertices // are marked with special commands. So, if the path_storage contains curves // (which are not real curves yet), and we render this storage directly, // all we will see is only 2 or 3 straight line segments (for curve3 and // curve4 respectively). If we need to see real curves drawn we need to // include this class into the conversion pipeline. // // Class conv_curve recognizes commands path_cmd_curve3 and path_cmd_curve4 // and converts these vertices into a move_to/line_to sequence. //----------------------------------------------------------------------- template class conv_curve { public: typedef Curve3 curve3_type; typedef Curve4 curve4_type; typedef conv_curve self_type; explicit conv_curve(VertexSource& source) : m_source(&source), m_last_x(0.0), m_last_y(0.0) {} void attach(VertexSource& source) { m_source = &source; } void approximation_method(curve_approximation_method_e v) { m_curve3.approximation_method(v); m_curve4.approximation_method(v); } curve_approximation_method_e approximation_method() const { return m_curve4.approximation_method(); } void approximation_scale(double s) { m_curve3.approximation_scale(s); m_curve4.approximation_scale(s); } double approximation_scale() const { return m_curve4.approximation_scale(); } void angle_tolerance(double v) { m_curve3.angle_tolerance(v); m_curve4.angle_tolerance(v); } double angle_tolerance() const { return m_curve4.angle_tolerance(); } void cusp_limit(double v) { m_curve3.cusp_limit(v); m_curve4.cusp_limit(v); } double cusp_limit() const { return m_curve4.cusp_limit(); } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: conv_curve(const self_type&); const self_type& operator = (const self_type&); VertexSource* m_source; double m_last_x; double m_last_y; curve3_type m_curve3; curve4_type m_curve4; }; //------------------------------------------------------------------------ template void conv_curve::rewind(unsigned path_id) { m_source->rewind(path_id); m_last_x = 0.0; m_last_y = 0.0; m_curve3.reset(); m_curve4.reset(); } //------------------------------------------------------------------------ template unsigned conv_curve::vertex(double* x, double* y) { if(!is_stop(m_curve3.vertex(x, y))) { m_last_x = *x; m_last_y = *y; return path_cmd_line_to; } if(!is_stop(m_curve4.vertex(x, y))) { m_last_x = *x; m_last_y = *y; return path_cmd_line_to; } double ct2_x; double ct2_y; double end_x; double end_y; unsigned cmd = m_source->vertex(x, y); switch(cmd) { case path_cmd_curve3: m_source->vertex(&end_x, &end_y); m_curve3.init(m_last_x, m_last_y, *x, *y, end_x, end_y); m_curve3.vertex(x, y); // First call returns path_cmd_move_to m_curve3.vertex(x, y); // This is the first vertex of the curve cmd = path_cmd_line_to; break; case path_cmd_curve4: m_source->vertex(&ct2_x, &ct2_y); m_source->vertex(&end_x, &end_y); m_curve4.init(m_last_x, m_last_y, *x, *y, ct2_x, ct2_y, end_x, end_y); m_curve4.vertex(x, y); // First call returns path_cmd_move_to m_curve4.vertex(x, y); // This is the first vertex of the curve cmd = path_cmd_line_to; break; } m_last_x = *x; m_last_y = *y; return cmd; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_font_cache_manager.h0000644000175000017500000003534713233644505025564 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_FONT_CACHE_MANAGER_INCLUDED #define AGG_FONT_CACHE_MANAGER_INCLUDED #include #include "agg_array.h" namespace agg24 { //---------------------------------------------------------glyph_data_type enum glyph_data_type { glyph_data_invalid = 0, glyph_data_mono = 1, glyph_data_gray8 = 2, glyph_data_outline = 3 }; //-------------------------------------------------------------glyph_cache struct glyph_cache { unsigned glyph_index; int8u* data; unsigned data_size; glyph_data_type data_type; rect_i bounds; double advance_x; double advance_y; }; //--------------------------------------------------------------font_cache class font_cache { public: enum block_size_e { block_size = 16384-16 }; //-------------------------------------------------------------------- font_cache() : m_allocator(block_size), m_font_signature(0) {} //-------------------------------------------------------------------- void signature(const char* font_signature) { m_font_signature = (char*)m_allocator.allocate(strlen(font_signature) + 1); strcpy(m_font_signature, font_signature); memset(m_glyphs, 0, sizeof(m_glyphs)); } //-------------------------------------------------------------------- bool font_is(const char* font_signature) const { return strcmp(font_signature, m_font_signature) == 0; } //-------------------------------------------------------------------- const glyph_cache* find_glyph(unsigned glyph_code) const { unsigned msb = (glyph_code >> 8) & 0xFF; if(m_glyphs[msb]) { return m_glyphs[msb][glyph_code & 0xFF]; } return 0; } //-------------------------------------------------------------------- glyph_cache* cache_glyph(unsigned glyph_code, unsigned glyph_index, unsigned data_size, glyph_data_type data_type, const rect_i& bounds, double advance_x, double advance_y) { unsigned msb = (glyph_code >> 8) & 0xFF; if(m_glyphs[msb] == 0) { m_glyphs[msb] = (glyph_cache**)m_allocator.allocate(sizeof(glyph_cache*) * 256, sizeof(glyph_cache*)); memset(m_glyphs[msb], 0, sizeof(glyph_cache*) * 256); } unsigned lsb = glyph_code & 0xFF; if(m_glyphs[msb][lsb]) return 0; // Already exists, do not overwrite glyph_cache* glyph = (glyph_cache*)m_allocator.allocate(sizeof(glyph_cache), sizeof(double)); glyph->glyph_index = glyph_index; glyph->data = m_allocator.allocate(data_size); glyph->data_size = data_size; glyph->data_type = data_type; glyph->bounds = bounds; glyph->advance_x = advance_x; glyph->advance_y = advance_y; return m_glyphs[msb][lsb] = glyph; } private: block_allocator m_allocator; glyph_cache** m_glyphs[256]; char* m_font_signature; }; //---------------------------------------------------------font_cache_pool class font_cache_pool { public: //-------------------------------------------------------------------- ~font_cache_pool() { unsigned i; for(i = 0; i < m_num_fonts; ++i) { obj_allocator::deallocate(m_fonts[i]); } pod_allocator::deallocate(m_fonts, m_max_fonts); } //-------------------------------------------------------------------- font_cache_pool(unsigned max_fonts=32) : m_fonts(pod_allocator::allocate(max_fonts)), m_max_fonts(max_fonts), m_num_fonts(0), m_cur_font(0) {} //-------------------------------------------------------------------- void font(const char* font_signature, bool reset_cache = false) { int idx = find_font(font_signature); if(idx >= 0) { if(reset_cache) { obj_allocator::deallocate(m_fonts[idx]); m_fonts[idx] = obj_allocator::allocate(); m_fonts[idx]->signature(font_signature); } m_cur_font = m_fonts[idx]; } else { if(m_num_fonts >= m_max_fonts) { obj_allocator::deallocate(m_fonts[0]); memcpy(m_fonts, m_fonts + 1, (m_max_fonts - 1) * sizeof(font_cache*)); m_num_fonts = m_max_fonts - 1; } m_fonts[m_num_fonts] = obj_allocator::allocate(); m_fonts[m_num_fonts]->signature(font_signature); m_cur_font = m_fonts[m_num_fonts]; ++m_num_fonts; } } //-------------------------------------------------------------------- const font_cache* font() const { return m_cur_font; } //-------------------------------------------------------------------- const glyph_cache* find_glyph(unsigned glyph_code) const { if(m_cur_font) return m_cur_font->find_glyph(glyph_code); return 0; } //-------------------------------------------------------------------- glyph_cache* cache_glyph(unsigned glyph_code, unsigned glyph_index, unsigned data_size, glyph_data_type data_type, const rect_i& bounds, double advance_x, double advance_y) { if(m_cur_font) { return m_cur_font->cache_glyph(glyph_code, glyph_index, data_size, data_type, bounds, advance_x, advance_y); } return 0; } //-------------------------------------------------------------------- int find_font(const char* font_signature) { unsigned i; for(i = 0; i < m_num_fonts; i++) { if(m_fonts[i]->font_is(font_signature)) return int(i); } return -1; } private: font_cache** m_fonts; unsigned m_max_fonts; unsigned m_num_fonts; font_cache* m_cur_font; }; //------------------------------------------------------------------------ enum glyph_rendering { glyph_ren_native_mono, glyph_ren_native_gray8, glyph_ren_outline, glyph_ren_agg_mono, glyph_ren_agg_gray8 }; //------------------------------------------------------font_cache_manager template class font_cache_manager { public: typedef FontEngine font_engine_type; typedef font_cache_manager self_type; typedef typename font_engine_type::path_adaptor_type path_adaptor_type; typedef typename font_engine_type::gray8_adaptor_type gray8_adaptor_type; typedef typename gray8_adaptor_type::embedded_scanline gray8_scanline_type; typedef typename font_engine_type::mono_adaptor_type mono_adaptor_type; typedef typename mono_adaptor_type::embedded_scanline mono_scanline_type; //-------------------------------------------------------------------- font_cache_manager(font_engine_type& engine, unsigned max_fonts=32) : m_fonts(max_fonts), m_engine(engine), m_change_stamp(-1), m_prev_glyph(0), m_last_glyph(0) {} //-------------------------------------------------------------------- void reset_last_glyph() { m_prev_glyph = m_last_glyph = 0; } //-------------------------------------------------------------------- const glyph_cache* glyph(unsigned glyph_code) { synchronize(); const glyph_cache* gl = m_fonts.find_glyph(glyph_code); if(gl) { m_prev_glyph = m_last_glyph; return m_last_glyph = gl; } else { if(m_engine.prepare_glyph(glyph_code)) { m_prev_glyph = m_last_glyph; m_last_glyph = m_fonts.cache_glyph(glyph_code, m_engine.glyph_index(), m_engine.data_size(), m_engine.data_type(), m_engine.bounds(), m_engine.advance_x(), m_engine.advance_y()); m_engine.write_glyph_to(m_last_glyph->data); return m_last_glyph; } } return 0; } //-------------------------------------------------------------------- void init_embedded_adaptors(const glyph_cache* gl, double x, double y, double scale=1.0) { if(gl) { switch(gl->data_type) { default: return; case glyph_data_mono: m_mono_adaptor.init(gl->data, gl->data_size, x, y); break; case glyph_data_gray8: m_gray8_adaptor.init(gl->data, gl->data_size, x, y); break; case glyph_data_outline: m_path_adaptor.init(gl->data, gl->data_size, x, y, scale); break; } } } //-------------------------------------------------------------------- path_adaptor_type& path_adaptor() { return m_path_adaptor; } gray8_adaptor_type& gray8_adaptor() { return m_gray8_adaptor; } gray8_scanline_type& gray8_scanline() { return m_gray8_scanline; } mono_adaptor_type& mono_adaptor() { return m_mono_adaptor; } mono_scanline_type& mono_scanline() { return m_mono_scanline; } //-------------------------------------------------------------------- const glyph_cache* perv_glyph() const { return m_prev_glyph; } const glyph_cache* last_glyph() const { return m_last_glyph; } //-------------------------------------------------------------------- bool add_kerning(double* x, double* y) { if(m_prev_glyph && m_last_glyph) { return m_engine.add_kerning(m_prev_glyph->glyph_index, m_last_glyph->glyph_index, x, y); } return false; } //-------------------------------------------------------------------- void precache(unsigned from, unsigned to) { for(; from <= to; ++from) glyph(from); } //-------------------------------------------------------------------- void reset_cache() { m_fonts.font(m_engine.font_signature(), true); m_change_stamp = m_engine.change_stamp(); m_prev_glyph = m_last_glyph = 0; } private: //-------------------------------------------------------------------- font_cache_manager(const self_type&); const self_type& operator = (const self_type&); //-------------------------------------------------------------------- void synchronize() { if(m_change_stamp != m_engine.change_stamp()) { m_fonts.font(m_engine.font_signature()); m_change_stamp = m_engine.change_stamp(); m_prev_glyph = m_last_glyph = 0; } } font_cache_pool m_fonts; font_engine_type& m_engine; int m_change_stamp; double m_dx; double m_dy; const glyph_cache* m_prev_glyph; const glyph_cache* m_last_glyph; path_adaptor_type m_path_adaptor; gray8_adaptor_type m_gray8_adaptor; gray8_scanline_type m_gray8_scanline; mono_adaptor_type m_mono_adaptor; mono_scanline_type m_mono_scanline; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_interpolator_adaptor.h0000644000175000017500000000521613233644505027246 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SPAN_INTERPOLATOR_ADAPTOR_INCLUDED #define AGG_SPAN_INTERPOLATOR_ADAPTOR_INCLUDED #include "agg_basics.h" namespace agg24 { //===============================================span_interpolator_adaptor template class span_interpolator_adaptor : public Interpolator { public: typedef Interpolator base_type; typedef typename base_type::trans_type trans_type; typedef Distortion distortion_type; //-------------------------------------------------------------------- span_interpolator_adaptor() {} span_interpolator_adaptor(trans_type& trans, distortion_type& dist) : base_type(trans), m_distortion(&dist) { } //-------------------------------------------------------------------- span_interpolator_adaptor(trans_type& trans, distortion_type& dist, double x, double y, unsigned len) : base_type(trans, x, y, len), m_distortion(&dist) { } //-------------------------------------------------------------------- distortion_type& distortion() const { return *m_distortion; } //-------------------------------------------------------------------- void distortion(distortion_type& dist) { m_distortion = dist; } //-------------------------------------------------------------------- void coordinates(int* x, int* y) const { base_type::coordinates(x, y); m_distortion->calculate(x, y); } private: //-------------------------------------------------------------------- distortion_type* m_distortion; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_path_storage.h0000644000175000017500000014516713233644505024463 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_PATH_STORAGE_INCLUDED #define AGG_PATH_STORAGE_INCLUDED #include #include #include "agg_math.h" #include "agg_array.h" #include "agg_bezier_arc.h" namespace agg24 { //----------------------------------------------------vertex_block_storage template class vertex_block_storage { public: // Allocation parameters enum block_scale_e { block_shift = BlockShift, block_size = 1 << block_shift, block_mask = block_size - 1, block_pool = BlockPool }; typedef T value_type; typedef vertex_block_storage self_type; ~vertex_block_storage(); vertex_block_storage(); vertex_block_storage(const self_type& v); const self_type& operator = (const self_type& ps); void remove_all(); void free_all(); void add_vertex(double x, double y, unsigned cmd); void modify_vertex(unsigned idx, double x, double y); void modify_vertex(unsigned idx, double x, double y, unsigned cmd); void modify_command(unsigned idx, unsigned cmd); void swap_vertices(unsigned v1, unsigned v2); unsigned last_command() const; unsigned last_vertex(double* x, double* y) const; unsigned prev_vertex(double* x, double* y) const; double last_x() const; double last_y() const; unsigned total_vertices() const; unsigned vertex(unsigned idx, double* x, double* y) const; unsigned command(unsigned idx) const; private: void allocate_block(unsigned nb); int8u* storage_ptrs(T** xy_ptr); private: unsigned m_total_vertices; unsigned m_total_blocks; unsigned m_max_blocks; T** m_coord_blocks; int8u** m_cmd_blocks; }; //------------------------------------------------------------------------ template void vertex_block_storage::free_all() { if(m_total_blocks) { T** coord_blk = m_coord_blocks + m_total_blocks - 1; while(m_total_blocks--) { pod_allocator::deallocate( *coord_blk, block_size * 2 + block_size / (sizeof(T) / sizeof(unsigned char))); --coord_blk; } pod_allocator::deallocate(m_coord_blocks, m_max_blocks * 2); m_total_blocks = 0; m_max_blocks = 0; m_coord_blocks = 0; m_cmd_blocks = 0; m_total_vertices = 0; } } //------------------------------------------------------------------------ template vertex_block_storage::~vertex_block_storage() { free_all(); } //------------------------------------------------------------------------ template vertex_block_storage::vertex_block_storage() : m_total_vertices(0), m_total_blocks(0), m_max_blocks(0), m_coord_blocks(0), m_cmd_blocks(0) { } //------------------------------------------------------------------------ template vertex_block_storage::vertex_block_storage(const vertex_block_storage& v) : m_total_vertices(0), m_total_blocks(0), m_max_blocks(0), m_coord_blocks(0), m_cmd_blocks(0) { *this = v; } //------------------------------------------------------------------------ template const vertex_block_storage& vertex_block_storage::operator = (const vertex_block_storage& v) { remove_all(); unsigned i; for(i = 0; i < v.total_vertices(); i++) { double x, y; unsigned cmd = v.vertex(i, &x, &y); add_vertex(x, y, cmd); } return *this; } //------------------------------------------------------------------------ template inline void vertex_block_storage::remove_all() { m_total_vertices = 0; } //------------------------------------------------------------------------ template inline void vertex_block_storage::add_vertex(double x, double y, unsigned cmd) { T* coord_ptr = 0; *storage_ptrs(&coord_ptr) = (int8u)cmd; coord_ptr[0] = T(x); coord_ptr[1] = T(y); m_total_vertices++; } //------------------------------------------------------------------------ template inline void vertex_block_storage::modify_vertex(unsigned idx, double x, double y) { T* pv = m_coord_blocks[idx >> block_shift] + ((idx & block_mask) << 1); pv[0] = T(x); pv[1] = T(y); } //------------------------------------------------------------------------ template inline void vertex_block_storage::modify_vertex(unsigned idx, double x, double y, unsigned cmd) { unsigned block = idx >> block_shift; unsigned offset = idx & block_mask; T* pv = m_coord_blocks[block] + (offset << 1); pv[0] = T(x); pv[1] = T(y); m_cmd_blocks[block][offset] = (int8u)cmd; } //------------------------------------------------------------------------ template inline void vertex_block_storage::modify_command(unsigned idx, unsigned cmd) { m_cmd_blocks[idx >> block_shift][idx & block_mask] = (int8u)cmd; } //------------------------------------------------------------------------ template inline void vertex_block_storage::swap_vertices(unsigned v1, unsigned v2) { unsigned b1 = v1 >> block_shift; unsigned b2 = v2 >> block_shift; unsigned o1 = v1 & block_mask; unsigned o2 = v2 & block_mask; T* pv1 = m_coord_blocks[b1] + (o1 << 1); T* pv2 = m_coord_blocks[b2] + (o2 << 1); T val; val = pv1[0]; pv1[0] = pv2[0]; pv2[0] = val; val = pv1[1]; pv1[1] = pv2[1]; pv2[1] = val; int8u cmd = m_cmd_blocks[b1][o1]; m_cmd_blocks[b1][o1] = m_cmd_blocks[b2][o2]; m_cmd_blocks[b2][o2] = cmd; } //------------------------------------------------------------------------ template inline unsigned vertex_block_storage::last_command() const { if(m_total_vertices) return command(m_total_vertices - 1); return path_cmd_stop; } //------------------------------------------------------------------------ template inline unsigned vertex_block_storage::last_vertex(double* x, double* y) const { if(m_total_vertices) return vertex(m_total_vertices - 1, x, y); return path_cmd_stop; } //------------------------------------------------------------------------ template inline unsigned vertex_block_storage::prev_vertex(double* x, double* y) const { if(m_total_vertices > 1) return vertex(m_total_vertices - 2, x, y); return path_cmd_stop; } //------------------------------------------------------------------------ template inline double vertex_block_storage::last_x() const { if(m_total_vertices) { unsigned idx = m_total_vertices - 1; return m_coord_blocks[idx >> block_shift][(idx & block_mask) << 1]; } return 0.0; } //------------------------------------------------------------------------ template inline double vertex_block_storage::last_y() const { if(m_total_vertices) { unsigned idx = m_total_vertices - 1; return m_coord_blocks[idx >> block_shift][((idx & block_mask) << 1) + 1]; } return 0.0; } //------------------------------------------------------------------------ template inline unsigned vertex_block_storage::total_vertices() const { return m_total_vertices; } //------------------------------------------------------------------------ template inline unsigned vertex_block_storage::vertex(unsigned idx, double* x, double* y) const { unsigned nb = idx >> block_shift; const T* pv = m_coord_blocks[nb] + ((idx & block_mask) << 1); *x = pv[0]; *y = pv[1]; return m_cmd_blocks[nb][idx & block_mask]; } //------------------------------------------------------------------------ template inline unsigned vertex_block_storage::command(unsigned idx) const { return m_cmd_blocks[idx >> block_shift][idx & block_mask]; } //------------------------------------------------------------------------ template void vertex_block_storage::allocate_block(unsigned nb) { if(nb >= m_max_blocks) { T** new_coords = pod_allocator::allocate((m_max_blocks + block_pool) * 2); unsigned char** new_cmds = (unsigned char**)(new_coords + m_max_blocks + block_pool); if(m_coord_blocks) { memcpy(new_coords, m_coord_blocks, m_max_blocks * sizeof(T*)); memcpy(new_cmds, m_cmd_blocks, m_max_blocks * sizeof(unsigned char*)); pod_allocator::deallocate(m_coord_blocks, m_max_blocks * 2); } m_coord_blocks = new_coords; m_cmd_blocks = new_cmds; m_max_blocks += block_pool; } m_coord_blocks[nb] = pod_allocator::allocate(block_size * 2 + block_size / (sizeof(T) / sizeof(unsigned char))); m_cmd_blocks[nb] = (unsigned char*)(m_coord_blocks[nb] + block_size * 2); m_total_blocks++; } //------------------------------------------------------------------------ template int8u* vertex_block_storage::storage_ptrs(T** xy_ptr) { unsigned nb = m_total_vertices >> block_shift; if(nb >= m_total_blocks) { allocate_block(nb); } *xy_ptr = m_coord_blocks[nb] + ((m_total_vertices & block_mask) << 1); return m_cmd_blocks[nb] + (m_total_vertices & block_mask); } //-----------------------------------------------------poly_plain_adaptor template class poly_plain_adaptor { public: typedef T value_type; poly_plain_adaptor() : m_data(0), m_ptr(0), m_end(0), m_closed(false), m_stop(false) {} poly_plain_adaptor(const T* data, unsigned num_points, bool closed) : m_data(data), m_ptr(data), m_end(data + num_points * 2), m_closed(closed), m_stop(false) {} void init(const T* data, unsigned num_points, bool closed) { m_data = data; m_ptr = data; m_end = data + num_points * 2; m_closed = closed; m_stop = false; } void rewind(unsigned) { m_ptr = m_data; m_stop = false; } unsigned vertex(double* x, double* y) { if(m_ptr < m_end) { bool first = m_ptr == m_data; *x = *m_ptr++; *y = *m_ptr++; return first ? path_cmd_move_to : path_cmd_line_to; } *x = *y = 0.0; if(m_closed && !m_stop) { m_stop = true; return path_cmd_end_poly | path_flags_close; } return path_cmd_stop; } private: const T* m_data; const T* m_ptr; const T* m_end; bool m_closed; bool m_stop; }; //-------------------------------------------------poly_container_adaptor template class poly_container_adaptor { public: typedef typename Container::value_type vertex_type; poly_container_adaptor() : m_container(0), m_index(0), m_closed(false), m_stop(false) {} poly_container_adaptor(const Container& data, bool closed) : m_container(&data), m_index(0), m_closed(closed), m_stop(false) {} void init(const Container& data, bool closed) { m_container = &data; m_index = 0; m_closed = closed; m_stop = false; } void rewind(unsigned) { m_index = 0; m_stop = false; } unsigned vertex(double* x, double* y) { if(m_index < m_container->size()) { bool first = m_index == 0; const vertex_type& v = (*m_container)[m_index++]; *x = v.x; *y = v.y; return first ? path_cmd_move_to : path_cmd_line_to; } *x = *y = 0.0; if(m_closed && !m_stop) { m_stop = true; return path_cmd_end_poly | path_flags_close; } return path_cmd_stop; } private: const Container* m_container; unsigned m_index; bool m_closed; bool m_stop; }; //-----------------------------------------poly_container_reverse_adaptor template class poly_container_reverse_adaptor { public: typedef typename Container::value_type vertex_type; poly_container_reverse_adaptor() : m_container(0), m_index(-1), m_closed(false), m_stop(false) {} poly_container_reverse_adaptor(Container& data, bool closed) : m_container(&data), m_index(-1), m_closed(closed), m_stop(false) {} void init(Container& data, bool closed) { m_container = &data; m_index = m_container->size() - 1; m_closed = closed; m_stop = false; } void rewind(unsigned) { m_index = m_container->size() - 1; m_stop = false; } unsigned vertex(double* x, double* y) { if(m_index >= 0) { bool first = m_index == int(m_container->size() - 1); const vertex_type& v = (*m_container)[m_index--]; *x = v.x; *y = v.y; return first ? path_cmd_move_to : path_cmd_line_to; } *x = *y = 0.0; if(m_closed && !m_stop) { m_stop = true; return path_cmd_end_poly | path_flags_close; } return path_cmd_stop; } private: Container* m_container; int m_index; bool m_closed; bool m_stop; }; //--------------------------------------------------------line_adaptor class line_adaptor { public: typedef double value_type; line_adaptor() : m_line(m_coord, 2, false) {} line_adaptor(double x1, double y1, double x2, double y2) : m_line(m_coord, 2, false) { m_coord[0] = x1; m_coord[1] = y1; m_coord[2] = x2; m_coord[3] = y2; } void init(double x1, double y1, double x2, double y2) { m_coord[0] = x1; m_coord[1] = y1; m_coord[2] = x2; m_coord[3] = y2; m_line.rewind(0); } void rewind(unsigned) { m_line.rewind(0); } unsigned vertex(double* x, double* y) { return m_line.vertex(x, y); } private: double m_coord[4]; poly_plain_adaptor m_line; }; //---------------------------------------------------------------path_base // A container to store vertices with their flags. // A path consists of a number of contours separated with "move_to" // commands. The path storage can keep and maintain more than one // path. // To navigate to the beginning of a particular path, use rewind(path_id); // Where path_id is what start_new_path() returns. So, when you call // start_new_path() you need to store its return value somewhere else // to navigate to the path afterwards. // // See also: vertex_source concept //------------------------------------------------------------------------ template class path_base { public: typedef VertexContainer container_type; typedef path_base self_type; //-------------------------------------------------------------------- path_base() : m_vertices(), m_iterator(0) {} void remove_all() { m_vertices.remove_all(); m_iterator = 0; } void free_all() { m_vertices.free_all(); m_iterator = 0; } // Make path functions //-------------------------------------------------------------------- unsigned start_new_path(); void move_to(double x, double y); void move_rel(double dx, double dy); void line_to(double x, double y); void line_rel(double dx, double dy); void hline_to(double x); void hline_rel(double dx); void vline_to(double y); void vline_rel(double dy); void arc_to(double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double x, double y); void arc_rel(double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double dx, double dy); void curve3(double x_ctrl, double y_ctrl, double x_to, double y_to); void curve3_rel(double dx_ctrl, double dy_ctrl, double dx_to, double dy_to); void curve3(double x_to, double y_to); void curve3_rel(double dx_to, double dy_to); void curve4(double x_ctrl1, double y_ctrl1, double x_ctrl2, double y_ctrl2, double x_to, double y_to); void curve4_rel(double dx_ctrl1, double dy_ctrl1, double dx_ctrl2, double dy_ctrl2, double dx_to, double dy_to); void curve4(double x_ctrl2, double y_ctrl2, double x_to, double y_to); void curve4_rel(double x_ctrl2, double y_ctrl2, double x_to, double y_to); void end_poly(unsigned flags = path_flags_close); void close_polygon(unsigned flags = path_flags_none); // Accessors //-------------------------------------------------------------------- const container_type& vertices() const { return m_vertices; } container_type& vertices() { return m_vertices; } unsigned total_vertices() const; void rel_to_abs(double* x, double* y) const; unsigned last_vertex(double* x, double* y) const; unsigned prev_vertex(double* x, double* y) const; double last_x() const; double last_y() const; unsigned vertex(unsigned idx, double* x, double* y) const; unsigned command(unsigned idx) const; void modify_vertex(unsigned idx, double x, double y); void modify_vertex(unsigned idx, double x, double y, unsigned cmd); void modify_command(unsigned idx, unsigned cmd); // VertexSource interface //-------------------------------------------------------------------- void rewind(unsigned path_id); unsigned vertex(double* x, double* y); // Arrange the orientation of a polygon, all polygons in a path, // or in all paths. After calling arrange_orientations() or // arrange_orientations_all_paths(), all the polygons will have // the same orientation, i.e. path_flags_cw or path_flags_ccw //-------------------------------------------------------------------- unsigned arrange_polygon_orientation(unsigned start, path_flags_e orientation); unsigned arrange_orientations(unsigned path_id, path_flags_e orientation); void arrange_orientations_all_paths(path_flags_e orientation); void invert_polygon(unsigned start); // Flip all vertices horizontally or vertically, // between x1 and x2, or between y1 and y2 respectively //-------------------------------------------------------------------- void flip_x(double x1, double x2); void flip_y(double y1, double y2); // Concatenate path. The path is added as is. //-------------------------------------------------------------------- template void concat_path(VertexSource& vs, unsigned path_id = 0) { double x, y; unsigned cmd; vs.rewind(path_id); while(!is_stop(cmd = vs.vertex(&x, &y))) { m_vertices.add_vertex(x, y, cmd); } } //-------------------------------------------------------------------- // Join path. The path is joined with the existing one, that is, // it behaves as if the pen of a plotter was always down (drawing) template void join_path(VertexSource& vs, unsigned path_id = 0) { double x, y; unsigned cmd; vs.rewind(path_id); cmd = vs.vertex(&x, &y); if(!is_stop(cmd)) { if(is_vertex(cmd)) { double x0, y0; unsigned cmd0 = last_vertex(&x0, &y0); if(is_vertex(cmd0)) { if(calc_distance(x, y, x0, y0) > vertex_dist_epsilon) { if(is_move_to(cmd)) cmd = path_cmd_line_to; m_vertices.add_vertex(x, y, cmd); } } else { if(is_stop(cmd0)) { cmd = path_cmd_move_to; } else { if(is_move_to(cmd)) cmd = path_cmd_line_to; } m_vertices.add_vertex(x, y, cmd); } } while(!is_stop(cmd = vs.vertex(&x, &y))) { m_vertices.add_vertex(x, y, is_move_to(cmd) ? unsigned(path_cmd_line_to) : cmd); } } } // Concatenate polygon/polyline. //-------------------------------------------------------------------- template void concat_poly(const T* data, unsigned num_points, bool closed) { poly_plain_adaptor poly(data, num_points, closed); concat_path(poly); } // Join polygon/polyline continuously. //-------------------------------------------------------------------- template void join_poly(const T* data, unsigned num_points, bool closed) { poly_plain_adaptor poly(data, num_points, closed); join_path(poly); } //-------------------------------------------------------------------- void translate(double dx, double dy, unsigned path_id=0); void translate_all_paths(double dx, double dy); //-------------------------------------------------------------------- template void transform(const Trans& trans, unsigned path_id=0) { unsigned num_ver = m_vertices.total_vertices(); for(; path_id < num_ver; path_id++) { double x, y; unsigned cmd = m_vertices.vertex(path_id, &x, &y); if(is_stop(cmd)) break; if(is_vertex(cmd)) { trans.transform(&x, &y); m_vertices.modify_vertex(path_id, x, y); } } } //-------------------------------------------------------------------- template void transform_all_paths(const Trans& trans) { unsigned idx; unsigned num_ver = m_vertices.total_vertices(); for(idx = 0; idx < num_ver; idx++) { double x, y; if(is_vertex(m_vertices.vertex(idx, &x, &y))) { trans.transform(&x, &y); m_vertices.modify_vertex(idx, x, y); } } } private: unsigned perceive_polygon_orientation(unsigned start, unsigned end); void invert_polygon(unsigned start, unsigned end); VertexContainer m_vertices; unsigned m_iterator; }; //------------------------------------------------------------------------ template unsigned path_base::start_new_path() { if(!is_stop(m_vertices.last_command())) { m_vertices.add_vertex(0.0, 0.0, path_cmd_stop); } return m_vertices.total_vertices(); } //------------------------------------------------------------------------ template inline void path_base::rel_to_abs(double* x, double* y) const { if(m_vertices.total_vertices()) { double x2; double y2; if(is_vertex(m_vertices.last_vertex(&x2, &y2))) { *x += x2; *y += y2; } } } //------------------------------------------------------------------------ template inline void path_base::move_to(double x, double y) { m_vertices.add_vertex(x, y, path_cmd_move_to); } //------------------------------------------------------------------------ template inline void path_base::move_rel(double dx, double dy) { rel_to_abs(&dx, &dy); m_vertices.add_vertex(dx, dy, path_cmd_move_to); } //------------------------------------------------------------------------ template inline void path_base::line_to(double x, double y) { m_vertices.add_vertex(x, y, path_cmd_line_to); } //------------------------------------------------------------------------ template inline void path_base::line_rel(double dx, double dy) { rel_to_abs(&dx, &dy); m_vertices.add_vertex(dx, dy, path_cmd_line_to); } //------------------------------------------------------------------------ template inline void path_base::hline_to(double x) { m_vertices.add_vertex(x, last_y(), path_cmd_line_to); } //------------------------------------------------------------------------ template inline void path_base::hline_rel(double dx) { double dy = 0; rel_to_abs(&dx, &dy); m_vertices.add_vertex(dx, dy, path_cmd_line_to); } //------------------------------------------------------------------------ template inline void path_base::vline_to(double y) { m_vertices.add_vertex(last_x(), y, path_cmd_line_to); } //------------------------------------------------------------------------ template inline void path_base::vline_rel(double dy) { double dx = 0; rel_to_abs(&dx, &dy); m_vertices.add_vertex(dx, dy, path_cmd_line_to); } //------------------------------------------------------------------------ template void path_base::arc_to(double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double x, double y) { if(m_vertices.total_vertices() && is_vertex(m_vertices.last_command())) { const double epsilon = 1e-30; double x0 = 0.0; double y0 = 0.0; m_vertices.last_vertex(&x0, &y0); rx = fabs(rx); ry = fabs(ry); // Ensure radii are valid //------------------------- if(rx < epsilon || ry < epsilon) { line_to(x, y); return; } if(calc_distance(x0, y0, x, y) < epsilon) { // If the endpoints (x, y) and (x0, y0) are identical, then this // is equivalent to omitting the elliptical arc segment entirely. return; } bezier_arc_svg a(x0, y0, rx, ry, angle, large_arc_flag, sweep_flag, x, y); if(a.radii_ok()) { join_path(a); } else { line_to(x, y); } } else { move_to(x, y); } } //------------------------------------------------------------------------ template void path_base::arc_rel(double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double dx, double dy) { rel_to_abs(&dx, &dy); arc_to(rx, ry, angle, large_arc_flag, sweep_flag, dx, dy); } //------------------------------------------------------------------------ template void path_base::curve3(double x_ctrl, double y_ctrl, double x_to, double y_to) { m_vertices.add_vertex(x_ctrl, y_ctrl, path_cmd_curve3); m_vertices.add_vertex(x_to, y_to, path_cmd_curve3); } //------------------------------------------------------------------------ template void path_base::curve3_rel(double dx_ctrl, double dy_ctrl, double dx_to, double dy_to) { rel_to_abs(&dx_ctrl, &dy_ctrl); rel_to_abs(&dx_to, &dy_to); m_vertices.add_vertex(dx_ctrl, dy_ctrl, path_cmd_curve3); m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve3); } //------------------------------------------------------------------------ template void path_base::curve3(double x_to, double y_to) { double x0; double y0; if(is_vertex(m_vertices.last_vertex(&x0, &y0))) { double x_ctrl; double y_ctrl; unsigned cmd = m_vertices.prev_vertex(&x_ctrl, &y_ctrl); if(is_curve(cmd)) { x_ctrl = x0 + x0 - x_ctrl; y_ctrl = y0 + y0 - y_ctrl; } else { x_ctrl = x0; y_ctrl = y0; } curve3(x_ctrl, y_ctrl, x_to, y_to); } } //------------------------------------------------------------------------ template void path_base::curve3_rel(double dx_to, double dy_to) { rel_to_abs(&dx_to, &dy_to); curve3(dx_to, dy_to); } //------------------------------------------------------------------------ template void path_base::curve4(double x_ctrl1, double y_ctrl1, double x_ctrl2, double y_ctrl2, double x_to, double y_to) { m_vertices.add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4); m_vertices.add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4); m_vertices.add_vertex(x_to, y_to, path_cmd_curve4); } //------------------------------------------------------------------------ template void path_base::curve4_rel(double dx_ctrl1, double dy_ctrl1, double dx_ctrl2, double dy_ctrl2, double dx_to, double dy_to) { rel_to_abs(&dx_ctrl1, &dy_ctrl1); rel_to_abs(&dx_ctrl2, &dy_ctrl2); rel_to_abs(&dx_to, &dy_to); m_vertices.add_vertex(dx_ctrl1, dy_ctrl1, path_cmd_curve4); m_vertices.add_vertex(dx_ctrl2, dy_ctrl2, path_cmd_curve4); m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve4); } //------------------------------------------------------------------------ template void path_base::curve4(double x_ctrl2, double y_ctrl2, double x_to, double y_to) { double x0; double y0; if(is_vertex(last_vertex(&x0, &y0))) { double x_ctrl1; double y_ctrl1; unsigned cmd = prev_vertex(&x_ctrl1, &y_ctrl1); if(is_curve(cmd)) { x_ctrl1 = x0 + x0 - x_ctrl1; y_ctrl1 = y0 + y0 - y_ctrl1; } else { x_ctrl1 = x0; y_ctrl1 = y0; } curve4(x_ctrl1, y_ctrl1, x_ctrl2, y_ctrl2, x_to, y_to); } } //------------------------------------------------------------------------ template void path_base::curve4_rel(double dx_ctrl2, double dy_ctrl2, double dx_to, double dy_to) { rel_to_abs(&dx_ctrl2, &dy_ctrl2); rel_to_abs(&dx_to, &dy_to); curve4(dx_ctrl2, dy_ctrl2, dx_to, dy_to); } //------------------------------------------------------------------------ template inline void path_base::end_poly(unsigned flags) { if(is_vertex(m_vertices.last_command())) { m_vertices.add_vertex(0.0, 0.0, path_cmd_end_poly | flags); } } //------------------------------------------------------------------------ template inline void path_base::close_polygon(unsigned flags) { end_poly(path_flags_close | flags); } //------------------------------------------------------------------------ template inline unsigned path_base::total_vertices() const { return m_vertices.total_vertices(); } //------------------------------------------------------------------------ template inline unsigned path_base::last_vertex(double* x, double* y) const { return m_vertices.last_vertex(x, y); } //------------------------------------------------------------------------ template inline unsigned path_base::prev_vertex(double* x, double* y) const { return m_vertices.prev_vertex(x, y); } //------------------------------------------------------------------------ template inline double path_base::last_x() const { return m_vertices.last_x(); } //------------------------------------------------------------------------ template inline double path_base::last_y() const { return m_vertices.last_y(); } //------------------------------------------------------------------------ template inline unsigned path_base::vertex(unsigned idx, double* x, double* y) const { return m_vertices.vertex(idx, x, y); } //------------------------------------------------------------------------ template inline unsigned path_base::command(unsigned idx) const { return m_vertices.command(idx); } //------------------------------------------------------------------------ template void path_base::modify_vertex(unsigned idx, double x, double y) { m_vertices.modify_vertex(idx, x, y); } //------------------------------------------------------------------------ template void path_base::modify_vertex(unsigned idx, double x, double y, unsigned cmd) { m_vertices.modify_vertex(idx, x, y, cmd); } //------------------------------------------------------------------------ template void path_base::modify_command(unsigned idx, unsigned cmd) { m_vertices.modify_command(idx, cmd); } //------------------------------------------------------------------------ template inline void path_base::rewind(unsigned path_id) { m_iterator = path_id; } //------------------------------------------------------------------------ template inline unsigned path_base::vertex(double* x, double* y) { if(m_iterator >= m_vertices.total_vertices()) return path_cmd_stop; return m_vertices.vertex(m_iterator++, x, y); } //------------------------------------------------------------------------ template unsigned path_base::perceive_polygon_orientation(unsigned start, unsigned end) { // Calculate signed area (double area to be exact) //--------------------- unsigned np = end - start; double area = 0.0; unsigned i; for(i = 0; i < np; i++) { double x1, y1, x2, y2; m_vertices.vertex(start + i, &x1, &y1); m_vertices.vertex(start + (i + 1) % np, &x2, &y2); area += x1 * y2 - y1 * x2; } return (area < 0.0) ? path_flags_cw : path_flags_ccw; } //------------------------------------------------------------------------ template void path_base::invert_polygon(unsigned start, unsigned end) { unsigned i; unsigned tmp_cmd = m_vertices.command(start); --end; // Make "end" inclusive // Shift all commands to one position for(i = start; i < end; i++) { m_vertices.modify_command(i, m_vertices.command(i + 1)); } // Assign starting command to the ending command m_vertices.modify_command(end, tmp_cmd); // Reverse the polygon while(end > start) { m_vertices.swap_vertices(start++, end--); } } //------------------------------------------------------------------------ template void path_base::invert_polygon(unsigned start) { // Skip all non-vertices at the beginning while(start < m_vertices.total_vertices() && !is_vertex(m_vertices.command(start))) ++start; // Skip all insignificant move_to while(start+1 < m_vertices.total_vertices() && is_move_to(m_vertices.command(start)) && is_move_to(m_vertices.command(start+1))) ++start; // Find the last vertex unsigned end = start + 1; while(end < m_vertices.total_vertices() && !is_next_poly(m_vertices.command(end))) ++end; invert_polygon(start, end); } //------------------------------------------------------------------------ template unsigned path_base::arrange_polygon_orientation(unsigned start, path_flags_e orientation) { if(orientation == path_flags_none) return start; // Skip all non-vertices at the beginning while(start < m_vertices.total_vertices() && !is_vertex(m_vertices.command(start))) ++start; // Skip all insignificant move_to while(start+1 < m_vertices.total_vertices() && is_move_to(m_vertices.command(start)) && is_move_to(m_vertices.command(start+1))) ++start; // Find the last vertex unsigned end = start + 1; while(end < m_vertices.total_vertices() && !is_next_poly(m_vertices.command(end))) ++end; if(end - start > 2) { if(perceive_polygon_orientation(start, end) != unsigned(orientation)) { // Invert polygon, set orientation flag, and skip all end_poly invert_polygon(start, end); unsigned cmd; while(end < m_vertices.total_vertices() && is_end_poly(cmd = m_vertices.command(end))) { m_vertices.modify_command(end++, set_orientation(cmd, orientation)); } } } return end; } //------------------------------------------------------------------------ template unsigned path_base::arrange_orientations(unsigned start, path_flags_e orientation) { if(orientation != path_flags_none) { while(start < m_vertices.total_vertices()) { start = arrange_polygon_orientation(start, orientation); if(is_stop(m_vertices.command(start))) { ++start; break; } } } return start; } //------------------------------------------------------------------------ template void path_base::arrange_orientations_all_paths(path_flags_e orientation) { if(orientation != path_flags_none) { unsigned start = 0; while(start < m_vertices.total_vertices()) { start = arrange_orientations(start, orientation); } } } //------------------------------------------------------------------------ template void path_base::flip_x(double x1, double x2) { unsigned i; double x, y; for(i = 0; i < m_vertices.total_vertices(); i++) { unsigned cmd = m_vertices.vertex(i, &x, &y); if(is_vertex(cmd)) { m_vertices.modify_vertex(i, x2 - x + x1, y); } } } //------------------------------------------------------------------------ template void path_base::flip_y(double y1, double y2) { unsigned i; double x, y; for(i = 0; i < m_vertices.total_vertices(); i++) { unsigned cmd = m_vertices.vertex(i, &x, &y); if(is_vertex(cmd)) { m_vertices.modify_vertex(i, x, y2 - y + y1); } } } //------------------------------------------------------------------------ template void path_base::translate(double dx, double dy, unsigned path_id) { unsigned num_ver = m_vertices.total_vertices(); for(; path_id < num_ver; path_id++) { double x, y; unsigned cmd = m_vertices.vertex(path_id, &x, &y); if(is_stop(cmd)) break; if(is_vertex(cmd)) { x += dx; y += dy; m_vertices.modify_vertex(path_id, x, y); } } } //------------------------------------------------------------------------ template void path_base::translate_all_paths(double dx, double dy) { unsigned idx; unsigned num_ver = m_vertices.total_vertices(); for(idx = 0; idx < num_ver; idx++) { double x, y; if(is_vertex(m_vertices.vertex(idx, &x, &y))) { x += dx; y += dy; m_vertices.modify_vertex(idx, x, y); } } } //-----------------------------------------------------vertex_stl_storage template class vertex_stl_storage { public: typedef typename Container::value_type vertex_type; typedef typename vertex_type::value_type value_type; void remove_all() { m_vertices.clear(); } void free_all() { m_vertices.clear(); } void add_vertex(double x, double y, unsigned cmd) { m_vertices.push_back(vertex_type(value_type(x), value_type(y), int8u(cmd))); } void modify_vertex(unsigned idx, double x, double y) { vertex_type& v = m_vertices[idx]; v.x = value_type(x); v.y = value_type(y); } void modify_vertex(unsigned idx, double x, double y, unsigned cmd) { vertex_type& v = m_vertices[idx]; v.x = value_type(x); v.y = value_type(y); v.cmd = int8u(cmd); } void modify_command(unsigned idx, unsigned cmd) { m_vertices[idx].cmd = int8u(cmd); } void swap_vertices(unsigned v1, unsigned v2) { vertex_type t = m_vertices[v1]; m_vertices[v1] = m_vertices[v2]; m_vertices[v2] = t; } unsigned last_command() const { return m_vertices.size() ? m_vertices[m_vertices.size() - 1].cmd : path_cmd_stop; } unsigned last_vertex(double* x, double* y) const { if(m_vertices.size() == 0) { *x = *y = 0.0; return path_cmd_stop; } return vertex(m_vertices.size() - 1, x, y); } unsigned prev_vertex(double* x, double* y) const { if(m_vertices.size() < 2) { *x = *y = 0.0; return path_cmd_stop; } return vertex(m_vertices.size() - 2, x, y); } double last_x() const { return m_vertices.size() ? m_vertices[m_vertices.size() - 1].x : 0.0; } double last_y() const { return m_vertices.size() ? m_vertices[m_vertices.size() - 1].y : 0.0; } unsigned total_vertices() const { return m_vertices.size(); } unsigned vertex(unsigned idx, double* x, double* y) const { const vertex_type& v = m_vertices[idx]; *x = v.x; *y = v.y; return v.cmd; } unsigned command(unsigned idx) const { return m_vertices[idx].cmd; } private: Container m_vertices; }; //-----------------------------------------------------------path_storage typedef path_base > path_storage; // Example of declarations path_storage with pod_bvector as a container //----------------------------------------------------------------------- //typedef path_base > > path_storage; } // Example of declarations path_storage with std::vector as a container //--------------------------------------------------------------------------- //#include //namespace agg24 //{ // typedef path_base > > stl_path_storage; //} #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rounded_rect.h0000644000175000017500000000441713233644505024450 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Rounded rectangle vertex generator // //---------------------------------------------------------------------------- #ifndef AGG_ROUNDED_RECT_INCLUDED #define AGG_ROUNDED_RECT_INCLUDED #include "agg_basics.h" #include "agg_arc.h" namespace agg24 { //------------------------------------------------------------rounded_rect // // See Implemantation agg_rounded_rect.cpp // class rounded_rect { public: rounded_rect() {} rounded_rect(double x1, double y1, double x2, double y2, double r); void rect(double x1, double y1, double x2, double y2); void radius(double r); void radius(double rx, double ry); void radius(double rx_bottom, double ry_bottom, double rx_top, double ry_top); void radius(double rx1, double ry1, double rx2, double ry2, double rx3, double ry3, double rx4, double ry4); void normalize_radius(); void approximation_scale(double s) { m_arc.approximation_scale(s); } double approximation_scale() const { return m_arc.approximation_scale(); } void rewind(unsigned); unsigned vertex(double* x, double* y); private: double m_x1; double m_y1; double m_x2; double m_y2; double m_rx1; double m_ry1; double m_rx2; double m_ry2; double m_rx3; double m_ry3; double m_rx4; double m_ry4; unsigned m_status; arc m_arc; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_math_stroke.h0000644000175000017500000004517213233644505024316 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Stroke math // //---------------------------------------------------------------------------- #ifndef AGG_STROKE_MATH_INCLUDED #define AGG_STROKE_MATH_INCLUDED #include "agg_math.h" #include "agg_vertex_sequence.h" namespace agg24 { //-------------------------------------------------------------line_cap_e enum line_cap_e { butt_cap, square_cap, round_cap }; //------------------------------------------------------------line_join_e enum line_join_e { miter_join = 0, miter_join_revert = 1, round_join = 2, bevel_join = 3, miter_join_round = 4 }; //-----------------------------------------------------------inner_join_e enum inner_join_e { inner_bevel, inner_miter, inner_jag, inner_round }; //------------------------------------------------------------math_stroke template class math_stroke { public: typedef typename VertexConsumer::value_type coord_type; math_stroke(); void line_cap(line_cap_e lc) { m_line_cap = lc; } void line_join(line_join_e lj) { m_line_join = lj; } void inner_join(inner_join_e ij) { m_inner_join = ij; } line_cap_e line_cap() const { return m_line_cap; } line_join_e line_join() const { return m_line_join; } inner_join_e inner_join() const { return m_inner_join; } void width(double w); void miter_limit(double ml) { m_miter_limit = ml; } void miter_limit_theta(double t); void inner_miter_limit(double ml) { m_inner_miter_limit = ml; } void approximation_scale(double as) { m_approx_scale = as; } double width() const { return m_width * 2.0; } double miter_limit() const { return m_miter_limit; } double inner_miter_limit() const { return m_inner_miter_limit; } double approximation_scale() const { return m_approx_scale; } void calc_cap(VertexConsumer& vc, const vertex_dist& v0, const vertex_dist& v1, double len); void calc_join(VertexConsumer& vc, const vertex_dist& v0, const vertex_dist& v1, const vertex_dist& v2, double len1, double len2); private: AGG_INLINE void add_vertex(VertexConsumer& vc, double x, double y) { vc.add(coord_type(x, y)); } void calc_arc(VertexConsumer& vc, double x, double y, double dx1, double dy1, double dx2, double dy2); void calc_miter(VertexConsumer& vc, const vertex_dist& v0, const vertex_dist& v1, const vertex_dist& v2, double dx1, double dy1, double dx2, double dy2, line_join_e lj, double mlimit, double dbevel); double m_width; double m_width_abs; double m_width_eps; int m_width_sign; double m_miter_limit; double m_inner_miter_limit; double m_approx_scale; line_cap_e m_line_cap; line_join_e m_line_join; inner_join_e m_inner_join; }; //----------------------------------------------------------------------- template math_stroke::math_stroke() : m_width(0.5), m_width_abs(0.5), m_width_eps(0.5/1024.0), m_width_sign(1), m_miter_limit(4.0), m_inner_miter_limit(1.01), m_approx_scale(1.0), m_line_cap(butt_cap), m_line_join(miter_join), m_inner_join(inner_miter) { } //----------------------------------------------------------------------- template void math_stroke::width(double w) { m_width = w * 0.5; if(m_width < 0) { m_width_abs = -m_width; m_width_sign = -1; } else { m_width_abs = m_width; m_width_sign = 1; } m_width_eps = m_width / 1024.0; } //----------------------------------------------------------------------- template void math_stroke::miter_limit_theta(double t) { m_miter_limit = 1.0 / sin(t * 0.5) ; } //----------------------------------------------------------------------- template void math_stroke::calc_arc(VC& vc, double x, double y, double dx1, double dy1, double dx2, double dy2) { double a1 = atan2(dy1 * m_width_sign, dx1 * m_width_sign); double a2 = atan2(dy2 * m_width_sign, dx2 * m_width_sign); double da = a1 - a2; int i, n; da = acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2; add_vertex(vc, x + dx1, y + dy1); if(m_width_sign > 0) { if(a1 > a2) a2 += 2 * pi; n = int((a2 - a1) / da); da = (a2 - a1) / (n + 1); a1 += da; for(i = 0; i < n; i++) { add_vertex(vc, x + cos(a1) * m_width, y + sin(a1) * m_width); a1 += da; } } else { if(a1 < a2) a2 -= 2 * pi; n = int((a1 - a2) / da); da = (a1 - a2) / (n + 1); a1 -= da; for(i = 0; i < n; i++) { add_vertex(vc, x + cos(a1) * m_width, y + sin(a1) * m_width); a1 -= da; } } add_vertex(vc, x + dx2, y + dy2); } //----------------------------------------------------------------------- template void math_stroke::calc_miter(VC& vc, const vertex_dist& v0, const vertex_dist& v1, const vertex_dist& v2, double dx1, double dy1, double dx2, double dy2, line_join_e lj, double mlimit, double dbevel) { double xi = v1.x; double yi = v1.y; double di = 1; double lim = m_width_abs * mlimit; bool miter_limit_exceeded = true; // Assume the worst bool intersection_failed = true; // Assume the worst if(calc_intersection(v0.x + dx1, v0.y - dy1, v1.x + dx1, v1.y - dy1, v1.x + dx2, v1.y - dy2, v2.x + dx2, v2.y - dy2, &xi, &yi)) { // Calculation of the intersection succeeded //--------------------- di = calc_distance(v1.x, v1.y, xi, yi); if(di <= lim) { // Inside the miter limit //--------------------- add_vertex(vc, xi, yi); miter_limit_exceeded = false; } intersection_failed = false; } else { // Calculation of the intersection failed, most probably // the three points lie one straight line. // First check if v0 and v2 lie on the opposite sides of vector: // (v1.x, v1.y) -> (v1.x+dx1, v1.y-dy1), that is, the perpendicular // to the line determined by vertices v0 and v1. // This condition determines whether the next line segments continues // the previous one or goes back. //---------------- double x2 = v1.x + dx1; double y2 = v1.y - dy1; if((cross_product(v0.x, v0.y, v1.x, v1.y, x2, y2) < 0.0) == (cross_product(v1.x, v1.y, v2.x, v2.y, x2, y2) < 0.0)) { // This case means that the next segment continues // the previous one (straight line) //----------------- add_vertex(vc, v1.x + dx1, v1.y - dy1); miter_limit_exceeded = false; } } if(miter_limit_exceeded) { // Miter limit exceeded //------------------------ switch(lj) { case miter_join_revert: // For the compatibility with SVG, PDF, etc, // we use a simple bevel join instead of // "smart" bevel //------------------- add_vertex(vc, v1.x + dx1, v1.y - dy1); add_vertex(vc, v1.x + dx2, v1.y - dy2); break; case miter_join_round: calc_arc(vc, v1.x, v1.y, dx1, -dy1, dx2, -dy2); break; default: // If no miter-revert, calculate new dx1, dy1, dx2, dy2 //---------------- if(intersection_failed) { mlimit *= m_width_sign; add_vertex(vc, v1.x + dx1 + dy1 * mlimit, v1.y - dy1 + dx1 * mlimit); add_vertex(vc, v1.x + dx2 - dy2 * mlimit, v1.y - dy2 - dx2 * mlimit); } else { double x1 = v1.x + dx1; double y1 = v1.y - dy1; double x2 = v1.x + dx2; double y2 = v1.y - dy2; di = (lim - dbevel) / (di - dbevel); add_vertex(vc, x1 + (xi - x1) * di, y1 + (yi - y1) * di); add_vertex(vc, x2 + (xi - x2) * di, y2 + (yi - y2) * di); } break; } } } //--------------------------------------------------------stroke_calc_cap template void math_stroke::calc_cap(VC& vc, const vertex_dist& v0, const vertex_dist& v1, double len) { vc.remove_all(); double dx1 = (v1.y - v0.y) / len; double dy1 = (v1.x - v0.x) / len; double dx2 = 0; double dy2 = 0; dx1 *= m_width; dy1 *= m_width; if(m_line_cap != round_cap) { if(m_line_cap == square_cap) { dx2 = dy1 * m_width_sign; dy2 = dx1 * m_width_sign; } add_vertex(vc, v0.x - dx1 - dx2, v0.y + dy1 - dy2); add_vertex(vc, v0.x + dx1 - dx2, v0.y - dy1 - dy2); } else { double da = acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2; double a1; int i; int n = int(pi / da); da = pi / (n + 1); add_vertex(vc, v0.x - dx1, v0.y + dy1); if(m_width_sign > 0) { a1 = atan2(dy1, -dx1); a1 += da; for(i = 0; i < n; i++) { add_vertex(vc, v0.x + cos(a1) * m_width, v0.y + sin(a1) * m_width); a1 += da; } } else { a1 = atan2(-dy1, dx1); a1 -= da; for(i = 0; i < n; i++) { add_vertex(vc, v0.x + cos(a1) * m_width, v0.y + sin(a1) * m_width); a1 -= da; } } add_vertex(vc, v0.x + dx1, v0.y - dy1); } } //----------------------------------------------------------------------- template void math_stroke::calc_join(VC& vc, const vertex_dist& v0, const vertex_dist& v1, const vertex_dist& v2, double len1, double len2) { double dx1 = m_width * (v1.y - v0.y) / len1; double dy1 = m_width * (v1.x - v0.x) / len1; double dx2 = m_width * (v2.y - v1.y) / len2; double dy2 = m_width * (v2.x - v1.x) / len2; vc.remove_all(); double cp = cross_product(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y); if(cp != 0 && (cp > 0) == (m_width > 0)) { // Inner join //--------------- double limit = ((len1 < len2) ? len1 : len2) / m_width_abs; if(limit < m_inner_miter_limit) { limit = m_inner_miter_limit; } switch(m_inner_join) { default: // inner_bevel add_vertex(vc, v1.x + dx1, v1.y - dy1); add_vertex(vc, v1.x + dx2, v1.y - dy2); break; case inner_miter: calc_miter(vc, v0, v1, v2, dx1, dy1, dx2, dy2, miter_join_revert, limit, 0); break; case inner_jag: case inner_round: cp = (dx1-dx2) * (dx1-dx2) + (dy1-dy2) * (dy1-dy2); if(cp < len1 * len1 && cp < len2 * len2) { calc_miter(vc, v0, v1, v2, dx1, dy1, dx2, dy2, miter_join_revert, limit, 0); } else { if(m_inner_join == inner_jag) { add_vertex(vc, v1.x + dx1, v1.y - dy1); add_vertex(vc, v1.x, v1.y ); add_vertex(vc, v1.x + dx2, v1.y - dy2); } else { add_vertex(vc, v1.x + dx1, v1.y - dy1); add_vertex(vc, v1.x, v1.y ); calc_arc(vc, v1.x, v1.y, dx2, -dy2, dx1, -dy1); add_vertex(vc, v1.x, v1.y ); add_vertex(vc, v1.x + dx2, v1.y - dy2); } } break; } } else { // Outer join //--------------- // Calculate the distance between v1 and // the central point of the bevel line segment //--------------- double dx = (dx1 + dx2) / 2; double dy = (dy1 + dy2) / 2; double dbevel = sqrt(dx * dx + dy * dy); if(m_line_join == round_join || m_line_join == bevel_join) { // This is an optimization that reduces the number of points // in cases of almost collinear segments. If there's no // visible difference between bevel and miter joins we'd rather // use miter join because it adds only one point instead of two. // // Here we calculate the middle point between the bevel points // and then, the distance between v1 and this middle point. // At outer joins this distance always less than stroke width, // because it's actually the height of an isosceles triangle of // v1 and its two bevel points. If the difference between this // width and this value is small (no visible bevel) we can // add just one point. // // The constant in the expression makes the result approximately // the same as in round joins and caps. You can safely comment // out this entire "if". //------------------- if(m_approx_scale * (m_width_abs - dbevel) < m_width_eps) { if(calc_intersection(v0.x + dx1, v0.y - dy1, v1.x + dx1, v1.y - dy1, v1.x + dx2, v1.y - dy2, v2.x + dx2, v2.y - dy2, &dx, &dy)) { add_vertex(vc, dx, dy); } else { add_vertex(vc, v1.x + dx1, v1.y - dy1); } return; } } switch(m_line_join) { case miter_join: case miter_join_revert: case miter_join_round: calc_miter(vc, v0, v1, v2, dx1, dy1, dx2, dy2, m_line_join, m_miter_limit, dbevel); break; case round_join: calc_arc(vc, v1.x, v1.y, dx1, -dy1, dx2, -dy2); break; default: // Bevel join add_vertex(vc, v1.x + dx1, v1.y - dy1); add_vertex(vc, v1.x + dx2, v1.y - dy2); break; } } } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_pixfmt_rgb_packed.h0000644000175000017500000014336613233644505025452 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_PIXFMT_RGB_PACKED_INCLUDED #define AGG_PIXFMT_RGB_PACKED_INCLUDED #include #include "agg_basics.h" #include "agg_color_rgba.h" #include "agg_rendering_buffer.h" namespace agg24 { //=========================================================blender_rgb555 struct blender_rgb555 { typedef rgba8 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int16u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type rgb = *p; calc_type r = (rgb >> 7) & 0xF8; calc_type g = (rgb >> 2) & 0xF8; calc_type b = (rgb << 3) & 0xF8; *p = (pixel_type) (((((cr - r) * alpha + (r << 8)) >> 1) & 0x7C00) | ((((cg - g) * alpha + (g << 8)) >> 6) & 0x03E0) | (((cb - b) * alpha + (b << 8)) >> 11) | 0x8000); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xF8) << 7) | ((g & 0xF8) << 2) | (b >> 3) | 0x8000); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 7) & 0xF8, (p >> 2) & 0xF8, (p << 3) & 0xF8); } }; //=====================================================blender_rgb555_pre struct blender_rgb555_pre { typedef rgba8 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int16u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) { alpha = color_type::base_mask - alpha; pixel_type rgb = *p; calc_type r = (rgb >> 7) & 0xF8; calc_type g = (rgb >> 2) & 0xF8; calc_type b = (rgb << 3) & 0xF8; *p = (pixel_type) ((((r * alpha + cr * cover) >> 1) & 0x7C00) | (((g * alpha + cg * cover) >> 6) & 0x03E0) | ((b * alpha + cb * cover) >> 11) | 0x8000); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xF8) << 7) | ((g & 0xF8) << 2) | (b >> 3) | 0x8000); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 7) & 0xF8, (p >> 2) & 0xF8, (p << 3) & 0xF8); } }; //=====================================================blender_rgb555_gamma template class blender_rgb555_gamma { public: typedef rgba8 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int16u pixel_type; typedef Gamma gamma_type; blender_rgb555_gamma() : m_gamma(0) {} void gamma(const gamma_type& g) { m_gamma = &g; } AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type rgb = *p; calc_type r = m_gamma->dir((rgb >> 7) & 0xF8); calc_type g = m_gamma->dir((rgb >> 2) & 0xF8); calc_type b = m_gamma->dir((rgb << 3) & 0xF8); *p = (pixel_type) (((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 7) & 0x7C00) | ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 2) & 0x03E0) | (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3) | 0x8000); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xF8) << 7) | ((g & 0xF8) << 2) | (b >> 3) | 0x8000); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 7) & 0xF8, (p >> 2) & 0xF8, (p << 3) & 0xF8); } private: const Gamma* m_gamma; }; //=========================================================blender_rgb565 struct blender_rgb565 { typedef rgba8 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int16u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type rgb = *p; calc_type r = (rgb >> 8) & 0xF8; calc_type g = (rgb >> 3) & 0xFC; calc_type b = (rgb << 3) & 0xF8; *p = (pixel_type) (((((cr - r) * alpha + (r << 8)) ) & 0xF800) | ((((cg - g) * alpha + (g << 8)) >> 5) & 0x07E0) | (((cb - b) * alpha + (b << 8)) >> 11)); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 8) & 0xF8, (p >> 3) & 0xFC, (p << 3) & 0xF8); } }; //=====================================================blender_rgb565_pre struct blender_rgb565_pre { typedef rgba8 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int16u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) { alpha = color_type::base_mask - alpha; pixel_type rgb = *p; calc_type r = (rgb >> 8) & 0xF8; calc_type g = (rgb >> 3) & 0xFC; calc_type b = (rgb << 3) & 0xF8; *p = (pixel_type) ((((r * alpha + cr * cover) ) & 0xF800) | (((g * alpha + cg * cover) >> 5 ) & 0x07E0) | ((b * alpha + cb * cover) >> 11)); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 8) & 0xF8, (p >> 3) & 0xFC, (p << 3) & 0xF8); } }; //=====================================================blender_rgb565_gamma template class blender_rgb565_gamma { public: typedef rgba8 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int16u pixel_type; typedef Gamma gamma_type; blender_rgb565_gamma() : m_gamma(0) {} void gamma(const gamma_type& g) { m_gamma = &g; } AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type rgb = *p; calc_type r = m_gamma->dir((rgb >> 8) & 0xF8); calc_type g = m_gamma->dir((rgb >> 3) & 0xFC); calc_type b = m_gamma->dir((rgb << 3) & 0xF8); *p = (pixel_type) (((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 8)) >> 8) << 8) & 0xF800) | ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 8)) >> 8) << 3) & 0x07E0) | (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 8)) >> 8) >> 3)); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 8) & 0xF8, (p >> 3) & 0xFC, (p << 3) & 0xF8); } private: const Gamma* m_gamma; }; //=====================================================blender_rgbAAA struct blender_rgbAAA { typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type rgb = *p; calc_type r = (rgb >> 14) & 0xFFC0; calc_type g = (rgb >> 4) & 0xFFC0; calc_type b = (rgb << 6) & 0xFFC0; *p = (pixel_type) (((((cr - r) * alpha + (r << 16)) >> 2) & 0x3FF00000) | ((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) | (((cb - b) * alpha + (b << 16)) >> 22) | 0xC0000000); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (b >> 6) | 0xC0000000); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 14) & 0xFFC0, (p >> 4) & 0xFFC0, (p << 6) & 0xFFC0); } }; //==================================================blender_rgbAAA_pre struct blender_rgbAAA_pre { typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) { alpha = color_type::base_mask - alpha; cover = (cover + 1) << (color_type::base_shift - 8); pixel_type rgb = *p; calc_type r = (rgb >> 14) & 0xFFC0; calc_type g = (rgb >> 4) & 0xFFC0; calc_type b = (rgb << 6) & 0xFFC0; *p = (pixel_type) ((((r * alpha + cr * cover) >> 2) & 0x3FF00000) | (((g * alpha + cg * cover) >> 12) & 0x000FFC00) | ((b * alpha + cb * cover) >> 22) | 0xC0000000); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (b >> 6) | 0xC0000000); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 14) & 0xFFC0, (p >> 4) & 0xFFC0, (p << 6) & 0xFFC0); } }; //=================================================blender_rgbAAA_gamma template class blender_rgbAAA_gamma { public: typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; typedef Gamma gamma_type; blender_rgbAAA_gamma() : m_gamma(0) {} void gamma(const gamma_type& g) { m_gamma = &g; } AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type rgb = *p; calc_type r = m_gamma->dir((rgb >> 14) & 0xFFC0); calc_type g = m_gamma->dir((rgb >> 4) & 0xFFC0); calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0); *p = (pixel_type) (((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 14) & 0x3FF00000) | ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4 ) & 0x000FFC00) | (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6 ) | 0xC0000000); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (b >> 6) | 0xC0000000); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 14) & 0xFFC0, (p >> 4) & 0xFFC0, (p << 6) & 0xFFC0); } private: const Gamma* m_gamma; }; //=====================================================blender_bgrAAA struct blender_bgrAAA { typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type bgr = *p; calc_type b = (bgr >> 14) & 0xFFC0; calc_type g = (bgr >> 4) & 0xFFC0; calc_type r = (bgr << 6) & 0xFFC0; *p = (pixel_type) (((((cb - b) * alpha + (b << 16)) >> 2) & 0x3FF00000) | ((((cg - g) * alpha + (g << 16)) >> 12) & 0x000FFC00) | (((cr - r) * alpha + (r << 16)) >> 22) | 0xC0000000); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((b & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (r >> 6) | 0xC0000000); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p << 6) & 0xFFC0, (p >> 4) & 0xFFC0, (p >> 14) & 0xFFC0); } }; //=================================================blender_bgrAAA_pre struct blender_bgrAAA_pre { typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) { alpha = color_type::base_mask - alpha; cover = (cover + 1) << (color_type::base_shift - 8); pixel_type bgr = *p; calc_type b = (bgr >> 14) & 0xFFC0; calc_type g = (bgr >> 4) & 0xFFC0; calc_type r = (bgr << 6) & 0xFFC0; *p = (pixel_type) ((((b * alpha + cb * cover) >> 2) & 0x3FF00000) | (((g * alpha + cg * cover) >> 12) & 0x000FFC00) | ((r * alpha + cr * cover) >> 22) | 0xC0000000); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((b & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (r >> 6) | 0xC0000000); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p << 6) & 0xFFC0, (p >> 4) & 0xFFC0, (p >> 14) & 0xFFC0); } }; //=================================================blender_bgrAAA_gamma template class blender_bgrAAA_gamma { public: typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; typedef Gamma gamma_type; blender_bgrAAA_gamma() : m_gamma(0) {} void gamma(const gamma_type& g) { m_gamma = &g; } AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type bgr = *p; calc_type b = m_gamma->dir((bgr >> 14) & 0xFFC0); calc_type g = m_gamma->dir((bgr >> 4) & 0xFFC0); calc_type r = m_gamma->dir((bgr << 6) & 0xFFC0); *p = (pixel_type) (((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 14) & 0x3FF00000) | ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 4 ) & 0x000FFC00) | (m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 6 ) | 0xC0000000); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((b & 0xFFC0) << 14) | ((g & 0xFFC0) << 4) | (r >> 6) | 0xC0000000); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p << 6) & 0xFFC0, (p >> 4) & 0xFFC0, (p >> 14) & 0xFFC0); } private: const Gamma* m_gamma; }; //=====================================================blender_rgbBBA struct blender_rgbBBA { typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type rgb = *p; calc_type r = (rgb >> 16) & 0xFFE0; calc_type g = (rgb >> 5) & 0xFFE0; calc_type b = (rgb << 6) & 0xFFC0; *p = (pixel_type) (((((cr - r) * alpha + (r << 16)) ) & 0xFFE00000) | ((((cg - g) * alpha + (g << 16)) >> 11) & 0x001FFC00) | (((cb - b) * alpha + (b << 16)) >> 22)); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6)); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 16) & 0xFFE0, (p >> 5) & 0xFFE0, (p << 6) & 0xFFC0); } }; //=================================================blender_rgbBBA_pre struct blender_rgbBBA_pre { typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) { alpha = color_type::base_mask - alpha; cover = (cover + 1) << (color_type::base_shift - 8); pixel_type rgb = *p; calc_type r = (rgb >> 16) & 0xFFE0; calc_type g = (rgb >> 5) & 0xFFE0; calc_type b = (rgb << 6) & 0xFFC0; *p = (pixel_type) ((((r * alpha + cr * cover) ) & 0xFFE00000) | (((g * alpha + cg * cover) >> 11) & 0x001FFC00) | ((b * alpha + cb * cover) >> 22)); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6)); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 16) & 0xFFE0, (p >> 5) & 0xFFE0, (p << 6) & 0xFFC0); } }; //=================================================blender_rgbBBA_gamma template class blender_rgbBBA_gamma { public: typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; typedef Gamma gamma_type; blender_rgbBBA_gamma() : m_gamma(0) {} void gamma(const gamma_type& g) { m_gamma = &g; } AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type rgb = *p; calc_type r = m_gamma->dir((rgb >> 16) & 0xFFE0); calc_type g = m_gamma->dir((rgb >> 5) & 0xFFE0); calc_type b = m_gamma->dir((rgb << 6) & 0xFFC0); *p = (pixel_type) (((m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) << 16) & 0xFFE00000) | ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 5 ) & 0x001FFC00) | (m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) >> 6 )); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((r & 0xFFE0) << 16) | ((g & 0xFFE0) << 5) | (b >> 6)); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p >> 16) & 0xFFE0, (p >> 5) & 0xFFE0, (p << 6) & 0xFFC0); } private: const Gamma* m_gamma; }; //=====================================================blender_bgrABB struct blender_bgrABB { typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type bgr = *p; calc_type b = (bgr >> 16) & 0xFFC0; calc_type g = (bgr >> 6) & 0xFFE0; calc_type r = (bgr << 5) & 0xFFE0; *p = (pixel_type) (((((cb - b) * alpha + (b << 16)) ) & 0xFFC00000) | ((((cg - g) * alpha + (g << 16)) >> 10) & 0x003FF800) | (((cr - r) * alpha + (r << 16)) >> 21)); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5)); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p << 5) & 0xFFE0, (p >> 6) & 0xFFE0, (p >> 16) & 0xFFC0); } }; //=================================================blender_bgrABB_pre struct blender_bgrABB_pre { typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; static AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned cover) { alpha = color_type::base_mask - alpha; cover = (cover + 1) << (color_type::base_shift - 8); pixel_type bgr = *p; calc_type b = (bgr >> 16) & 0xFFC0; calc_type g = (bgr >> 6) & 0xFFE0; calc_type r = (bgr << 5) & 0xFFE0; *p = (pixel_type) ((((b * alpha + cb * cover) ) & 0xFFC00000) | (((g * alpha + cg * cover) >> 10) & 0x003FF800) | ((r * alpha + cr * cover) >> 21)); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5)); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p << 5) & 0xFFE0, (p >> 6) & 0xFFE0, (p >> 16) & 0xFFC0); } }; //=================================================blender_bgrABB_gamma template class blender_bgrABB_gamma { public: typedef rgba16 color_type; typedef color_type::value_type value_type; typedef color_type::calc_type calc_type; typedef int32u pixel_type; typedef Gamma gamma_type; blender_bgrABB_gamma() : m_gamma(0) {} void gamma(const gamma_type& g) { m_gamma = &g; } AGG_INLINE void blend_pix(pixel_type* p, unsigned cr, unsigned cg, unsigned cb, unsigned alpha, unsigned) { pixel_type bgr = *p; calc_type b = m_gamma->dir((bgr >> 16) & 0xFFC0); calc_type g = m_gamma->dir((bgr >> 6) & 0xFFE0); calc_type r = m_gamma->dir((bgr << 5) & 0xFFE0); *p = (pixel_type) (((m_gamma->inv(((m_gamma->dir(cb) - b) * alpha + (b << 16)) >> 16) << 16) & 0xFFC00000) | ((m_gamma->inv(((m_gamma->dir(cg) - g) * alpha + (g << 16)) >> 16) << 6 ) & 0x003FF800) | (m_gamma->inv(((m_gamma->dir(cr) - r) * alpha + (r << 16)) >> 16) >> 5 )); } static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) { return (pixel_type)(((b & 0xFFC0) << 16) | ((g & 0xFFE0) << 6) | (r >> 5)); } static AGG_INLINE color_type make_color(pixel_type p) { return color_type((p << 5) & 0xFFE0, (p >> 6) & 0xFFE0, (p >> 16) & 0xFFC0); } private: const Gamma* m_gamma; }; //===========================================pixfmt_alpha_blend_rgb_packed template class pixfmt_alpha_blend_rgb_packed { public: typedef RenBuf rbuf_type; typedef typename rbuf_type::row_data row_data; typedef Blender blender_type; typedef typename blender_type::color_type color_type; typedef typename blender_type::pixel_type pixel_type; typedef int order_type; // A fake one typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; enum base_scale_e { base_shift = color_type::base_shift, base_scale = color_type::base_scale, base_mask = color_type::base_mask, pix_width = sizeof(pixel_type), }; private: //-------------------------------------------------------------------- AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover) { if (c.a) { calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; if(alpha == base_mask) { *p = m_blender.make_pix(c.r, c.g, c.b); } else { m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); } } } public: //-------------------------------------------------------------------- explicit pixfmt_alpha_blend_rgb_packed(rbuf_type& rb) : m_rbuf(&rb) {} void attach(rbuf_type& rb) { m_rbuf = &rb; } //-------------------------------------------------------------------- template bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) { rect_i r(x1, y1, x2, y2); if(r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) { int stride = pixf.stride(); m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); return true; } return false; } Blender& blender() { return m_blender; } //-------------------------------------------------------------------- AGG_INLINE unsigned width() const { return m_rbuf->width(); } AGG_INLINE unsigned height() const { return m_rbuf->height(); } AGG_INLINE int stride() const { return m_rbuf->stride(); } //-------------------------------------------------------------------- AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } //-------------------------------------------------------------------- AGG_INLINE int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + x * pix_width; } AGG_INLINE const int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + x * pix_width; } //-------------------------------------------------------------------- AGG_INLINE void make_pix(int8u* p, const color_type& c) { *(pixel_type*)p = m_blender.make_pix(c.r, c.g, c.b); } //-------------------------------------------------------------------- AGG_INLINE color_type pixel(int x, int y) const { return m_blender.make_color(((pixel_type*)m_rbuf->row_ptr(y))[x]); } //-------------------------------------------------------------------- AGG_INLINE void copy_pixel(int x, int y, const color_type& c) { ((pixel_type*) m_rbuf->row_ptr(x, y, 1))[x] = m_blender.make_pix(c.r, c.g, c.b); } //-------------------------------------------------------------------- AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) { copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y, 1) + x, c, cover); } //-------------------------------------------------------------------- AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) { pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; pixel_type v = m_blender.make_pix(c.r, c.g, c.b); do { *p++ = v; } while(--len); } //-------------------------------------------------------------------- AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) { pixel_type v = m_blender.make_pix(c.r, c.g, c.b); do { pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x; *p = v; } while(--len); } //-------------------------------------------------------------------- void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (c.a) { pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; if(alpha == base_mask) { pixel_type v = m_blender.make_pix(c.r, c.g, c.b); do { *p++ = v; } while(--len); } else { do { m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover); ++p; } while(--len); } } } //-------------------------------------------------------------------- void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (c.a) { calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8; if(alpha == base_mask) { pixel_type v = m_blender.make_pix(c.r, c.g, c.b); do { ((pixel_type*)m_rbuf->row_ptr(x, y++, 1))[x] = v; } while(--len); } else { do { m_blender.blend_pix( (pixel_type*)m_rbuf->row_ptr(x, y++, 1), c.r, c.g, c.b, alpha, cover); } while(--len); } } } //-------------------------------------------------------------------- void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; do { copy_or_blend_pix(p, c, *covers++); ++p; } while(--len); } //-------------------------------------------------------------------- void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { do { copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x, c, *covers++); } while(--len); } //-------------------------------------------------------------------- void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) { pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; do { *p++ = m_blender.make_pix(colors->r, colors->g, colors->b); ++colors; } while(--len); } //-------------------------------------------------------------------- void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) { do { pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x; *p = m_blender.make_pix(colors->r, colors->g, colors->b); ++colors; } while(--len); } //-------------------------------------------------------------------- void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { pixel_type* p = (pixel_type*)m_rbuf->row_ptr(x, y, len) + x; do { copy_or_blend_pix(p++, *colors++, covers ? *covers++ : cover); } while(--len); } //-------------------------------------------------------------------- void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { do { copy_or_blend_pix((pixel_type*)m_rbuf->row_ptr(x, y++, 1) + x, *colors++, covers ? *covers++ : cover); } while(--len); } //-------------------------------------------------------------------- template void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) { const int8u* p = from.row_ptr(ysrc); if(p) { memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); } } //-------------------------------------------------------------------- template void blend_from(const SrcPixelFormatRenderer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::order_type src_order; const value_type* psrc = (const value_type*)from.row_ptr(ysrc); if(psrc) { psrc += xsrc * 4; pixel_type* pdst = (pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; do { value_type alpha = psrc[src_order::A]; if(alpha) { if(alpha == base_mask && cover == 255) { *pdst = m_blender.make_pix(psrc[src_order::R], psrc[src_order::G], psrc[src_order::B]); } else { m_blender.blend_pix(pdst, psrc[src_order::R], psrc[src_order::G], psrc[src_order::B], alpha, cover); } } psrc += 4; ++pdst; } while(--len); } } //-------------------------------------------------------------------- template void blend_from_color(const SrcPixelFormatRenderer& from, const color_type& color, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::value_type src_value_type; typedef typename SrcPixelFormatRenderer::color_type src_color_type; const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); if(psrc) { psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset; pixel_type* pdst = (pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; do { m_blender.blend_pix(pdst, color.r, color.g, color.b, color.a, cover); psrc += SrcPixelFormatRenderer::pix_step; ++pdst; } while(--len); } } //-------------------------------------------------------------------- template void blend_from_lut(const SrcPixelFormatRenderer& from, const color_type* color_lut, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::value_type src_value_type; const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); if(psrc) { psrc += xsrc * SrcPixelFormatRenderer::pix_step + SrcPixelFormatRenderer::pix_offset; pixel_type* pdst = (pixel_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; do { const color_type& color = color_lut[*psrc]; m_blender.blend_pix(pdst, color.r, color.g, color.b, color.a, cover); psrc += SrcPixelFormatRenderer::pix_step; ++pdst; } while(--len); } } private: rbuf_type* m_rbuf; Blender m_blender; }; typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb555; //----pixfmt_rgb555 typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb565; //----pixfmt_rgb565 typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb555_pre; //----pixfmt_rgb555_pre typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgb565_pre; //----pixfmt_rgb565_pre typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbAAA; //----pixfmt_rgbAAA typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrAAA; //----pixfmt_bgrAAA typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbBBA; //----pixfmt_rgbBBA typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrABB; //----pixfmt_bgrABB typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbAAA_pre; //----pixfmt_rgbAAA_pre typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrAAA_pre; //----pixfmt_bgrAAA_pre typedef pixfmt_alpha_blend_rgb_packed pixfmt_rgbBBA_pre; //----pixfmt_rgbBBA_pre typedef pixfmt_alpha_blend_rgb_packed pixfmt_bgrABB_pre; //----pixfmt_bgrABB_pre //-----------------------------------------------------pixfmt_rgb555_gamma template class pixfmt_rgb555_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> { public: pixfmt_rgb555_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_rgb565_gamma template class pixfmt_rgb565_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> { public: pixfmt_rgb565_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_rgbAAA_gamma template class pixfmt_rgbAAA_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> { public: pixfmt_rgbAAA_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_bgrAAA_gamma template class pixfmt_bgrAAA_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> { public: pixfmt_bgrAAA_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_rgbBBA_gamma template class pixfmt_rgbBBA_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> { public: pixfmt_rgbBBA_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { this->blender().gamma(g); } }; //-----------------------------------------------------pixfmt_bgrABB_gamma template class pixfmt_bgrABB_gamma : public pixfmt_alpha_blend_rgb_packed, rendering_buffer> { public: pixfmt_bgrABB_gamma(rendering_buffer& rb, const Gamma& g) : pixfmt_alpha_blend_rgb_packed, rendering_buffer>(rb) { this->blender().gamma(g); } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_pattern_gray.h0000644000175000017500000000646313233644505025516 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_PATTERN_GRAY_INCLUDED #define AGG_SPAN_PATTERN_GRAY_INCLUDED #include "agg_basics.h" namespace agg24 { //=======================================================span_pattern_gray template class span_pattern_gray { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; //-------------------------------------------------------------------- span_pattern_gray() {} span_pattern_gray(source_type& src, unsigned offset_x, unsigned offset_y) : m_src(&src), m_offset_x(offset_x), m_offset_y(offset_y), m_alpha(color_type::base_mask) {} //-------------------------------------------------------------------- void attach(source_type& v) { m_src = &v; } source_type& source() { return *m_src; } const source_type& source() const { return *m_src; } //-------------------------------------------------------------------- void offset_x(unsigned v) { m_offset_x = v; } void offset_y(unsigned v) { m_offset_y = v; } unsigned offset_x() const { return m_offset_x; } unsigned offset_y() const { return m_offset_y; } void alpha(value_type v) { m_alpha = v; } value_type alpha() const { return m_alpha; } //-------------------------------------------------------------------- void prepare() {} void generate(color_type* span, int x, int y, unsigned len) { x += m_offset_x; y += m_offset_y; const value_type* p = (const value_type*)m_src->span(x, y, len); do { span->v = *p; span->a = m_alpha; p = m_src->next_x(); ++span; } while(--len); } private: source_type* m_src; unsigned m_offset_x; unsigned m_offset_y; value_type m_alpha; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/util/0000755000175000017500000000000013544357602021757 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/util/agg_color_conv.h0000644000175000017500000000765413233644505025121 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Conversion from one colorspace/pixel format to another // //---------------------------------------------------------------------------- #ifndef AGG_COLOR_CONV_INCLUDED #define AGG_COLOR_CONV_INCLUDED #include #include "agg_basics.h" #include "agg_rendering_buffer.h" namespace agg24 { //--------------------------------------------------------------color_conv template void color_conv(RenBuf* dst, const RenBuf* src, CopyRow copy_row_functor) { unsigned width = src->width(); unsigned height = src->height(); if(dst->width() < width) width = dst->width(); if(dst->height() < height) height = dst->height(); if(width) { unsigned y; for(y = 0; y < height; y++) { copy_row_functor(dst->row_ptr(0, y, width), src->row_ptr(y), width); } } } //---------------------------------------------------------color_conv_row template void color_conv_row(int8u* dst, const int8u* src, unsigned width, CopyRow copy_row_functor) { copy_row_functor(dst, src, width); } //---------------------------------------------------------color_conv_same template class color_conv_same { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { memmove(dst, src, width*BPP); } }; // Generic pixel converter. template struct conv_pixel { void operator()(void* dst, const void* src) const { // Read a pixel from the source format and write it to the destination format. DstFormat::write_plain_color(dst, SrcFormat::read_plain_color(src)); } }; // Generic row converter. Uses conv_pixel to convert individual pixels. template struct conv_row { void operator()(void* dst, const void* src, unsigned width) const { conv_pixel conv; do { conv(dst, src); dst = (int8u*)dst + DstFormat::pix_width; src = (int8u*)src + SrcFormat::pix_width; } while (--width); } }; // Specialization for case where source and destination formats are identical. template struct conv_row { void operator()(void* dst, const void* src, unsigned width) const { memmove(dst, src, width * Format::pix_width); } }; // Top-level conversion function, converts one pixel format to any other. template void convert(RenBuf* dst, const RenBuf* src) { color_conv(dst, src, conv_row()); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/util/agg_color_conv_rgb16.h0000644000175000017500000002536013233644505026114 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // This part of the library has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- // // A set of functors used with color_conv(). See file agg_color_conv.h // These functors can convert images with up to 8 bits per component. // Use convertors in the following way: // // agg24::color_conv(dst, src, agg24::color_conv_XXXX_to_YYYY()); //---------------------------------------------------------------------------- #ifndef AGG_COLOR_CONV_RGB16_INCLUDED #define AGG_COLOR_CONV_RGB16_INCLUDED #include "agg_basics.h" #include "agg_color_conv.h" namespace agg24 { //-------------------------------------------------color_conv_gray16_to_gray8 class color_conv_gray16_to_gray8 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { int16u* s = (int16u*)src; do { *dst++ = *s++ >> 8; } while(--width); } }; //-----------------------------------------------------color_conv_rgb24_rgb48 template class color_conv_rgb24_rgb48 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { int16u* d = (int16u*)dst; do { *d++ = (src[I1] << 8) | src[I1]; *d++ = (src[1] << 8) | src[1] ; *d++ = (src[I3] << 8) | src[I3]; src += 3; } while(--width); } }; typedef color_conv_rgb24_rgb48<0,2> color_conv_rgb24_to_rgb48; typedef color_conv_rgb24_rgb48<0,2> color_conv_bgr24_to_bgr48; typedef color_conv_rgb24_rgb48<2,0> color_conv_rgb24_to_bgr48; typedef color_conv_rgb24_rgb48<2,0> color_conv_bgr24_to_rgb48; //-----------------------------------------------------color_conv_rgb24_rgb48 template class color_conv_rgb48_rgb24 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { const int16u* s = (const int16u*)src; do { *dst++ = s[I1] >> 8; *dst++ = s[1] >> 8; *dst++ = s[I3] >> 8; s += 3; } while(--width); } }; typedef color_conv_rgb48_rgb24<0,2> color_conv_rgb48_to_rgb24; typedef color_conv_rgb48_rgb24<0,2> color_conv_bgr48_to_bgr24; typedef color_conv_rgb48_rgb24<2,0> color_conv_rgb48_to_bgr24; typedef color_conv_rgb48_rgb24<2,0> color_conv_bgr48_to_rgb24; //----------------------------------------------color_conv_rgbAAA_rgb24 template class color_conv_rgbAAA_rgb24 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { int32u rgb = *(int32u*)src; dst[R] = int8u(rgb >> 22); dst[1] = int8u(rgb >> 12); dst[B] = int8u(rgb >> 2); src += 4; dst += 3; } while(--width); } }; typedef color_conv_rgbAAA_rgb24<0,2> color_conv_rgbAAA_to_rgb24; typedef color_conv_rgbAAA_rgb24<2,0> color_conv_rgbAAA_to_bgr24; typedef color_conv_rgbAAA_rgb24<2,0> color_conv_bgrAAA_to_rgb24; typedef color_conv_rgbAAA_rgb24<0,2> color_conv_bgrAAA_to_bgr24; //----------------------------------------------color_conv_rgbBBA_rgb24 template class color_conv_rgbBBA_rgb24 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { int32u rgb = *(int32u*)src; dst[R] = int8u(rgb >> 24); dst[1] = int8u(rgb >> 13); dst[B] = int8u(rgb >> 2); src += 4; dst += 3; } while(--width); } }; typedef color_conv_rgbBBA_rgb24<0,2> color_conv_rgbBBA_to_rgb24; typedef color_conv_rgbBBA_rgb24<2,0> color_conv_rgbBBA_to_bgr24; //----------------------------------------------color_conv_bgrABB_rgb24 template class color_conv_bgrABB_rgb24 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { int32u bgr = *(int32u*)src; dst[R] = int8u(bgr >> 3); dst[1] = int8u(bgr >> 14); dst[B] = int8u(bgr >> 24); src += 4; dst += 3; } while(--width); } }; typedef color_conv_bgrABB_rgb24<2,0> color_conv_bgrABB_to_rgb24; typedef color_conv_bgrABB_rgb24<0,2> color_conv_bgrABB_to_bgr24; //-------------------------------------------------color_conv_rgba64_rgba32 template class color_conv_rgba64_rgba32 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { *dst++ = int8u(((int16u*)src)[I1] >> 8); *dst++ = int8u(((int16u*)src)[I2] >> 8); *dst++ = int8u(((int16u*)src)[I3] >> 8); *dst++ = int8u(((int16u*)src)[I4] >> 8); src += 8; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgba64_rgba32<0,1,2,3> color_conv_rgba64_to_rgba32; //----color_conv_rgba64_to_rgba32 typedef color_conv_rgba64_rgba32<0,1,2,3> color_conv_argb64_to_argb32; //----color_conv_argb64_to_argb32 typedef color_conv_rgba64_rgba32<0,1,2,3> color_conv_bgra64_to_bgra32; //----color_conv_bgra64_to_bgra32 typedef color_conv_rgba64_rgba32<0,1,2,3> color_conv_abgr64_to_abgr32; //----color_conv_abgr64_to_abgr32 typedef color_conv_rgba64_rgba32<0,3,2,1> color_conv_argb64_to_abgr32; //----color_conv_argb64_to_abgr32 typedef color_conv_rgba64_rgba32<3,2,1,0> color_conv_argb64_to_bgra32; //----color_conv_argb64_to_bgra32 typedef color_conv_rgba64_rgba32<1,2,3,0> color_conv_argb64_to_rgba32; //----color_conv_argb64_to_rgba32 typedef color_conv_rgba64_rgba32<3,0,1,2> color_conv_bgra64_to_abgr32; //----color_conv_bgra64_to_abgr32 typedef color_conv_rgba64_rgba32<3,2,1,0> color_conv_bgra64_to_argb32; //----color_conv_bgra64_to_argb32 typedef color_conv_rgba64_rgba32<2,1,0,3> color_conv_bgra64_to_rgba32; //----color_conv_bgra64_to_rgba32 typedef color_conv_rgba64_rgba32<3,2,1,0> color_conv_rgba64_to_abgr32; //----color_conv_rgba64_to_abgr32 typedef color_conv_rgba64_rgba32<3,0,1,2> color_conv_rgba64_to_argb32; //----color_conv_rgba64_to_argb32 typedef color_conv_rgba64_rgba32<2,1,0,3> color_conv_rgba64_to_bgra32; //----color_conv_rgba64_to_bgra32 typedef color_conv_rgba64_rgba32<0,3,2,1> color_conv_abgr64_to_argb32; //----color_conv_abgr64_to_argb32 typedef color_conv_rgba64_rgba32<1,2,3,0> color_conv_abgr64_to_bgra32; //----color_conv_abgr64_to_bgra32 typedef color_conv_rgba64_rgba32<3,2,1,0> color_conv_abgr64_to_rgba32; //----color_conv_abgr64_to_rgba32 //--------------------------------------------color_conv_rgb24_rgba64 template class color_conv_rgb24_rgba64 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { int16u* d = (int16u*)dst; do { d[I1] = (src[0] << 8) | src[0]; d[I2] = (src[1] << 8) | src[1]; d[I3] = (src[2] << 8) | src[2]; d[A] = 65535; d += 4; src += 3; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgb24_rgba64<1,2,3,0> color_conv_rgb24_to_argb64; //----color_conv_rgb24_to_argb64 typedef color_conv_rgb24_rgba64<3,2,1,0> color_conv_rgb24_to_abgr64; //----color_conv_rgb24_to_abgr64 typedef color_conv_rgb24_rgba64<2,1,0,3> color_conv_rgb24_to_bgra64; //----color_conv_rgb24_to_bgra64 typedef color_conv_rgb24_rgba64<0,1,2,3> color_conv_rgb24_to_rgba64; //----color_conv_rgb24_to_rgba64 typedef color_conv_rgb24_rgba64<3,2,1,0> color_conv_bgr24_to_argb64; //----color_conv_bgr24_to_argb64 typedef color_conv_rgb24_rgba64<1,2,3,0> color_conv_bgr24_to_abgr64; //----color_conv_bgr24_to_abgr64 typedef color_conv_rgb24_rgba64<0,1,2,3> color_conv_bgr24_to_bgra64; //----color_conv_bgr24_to_bgra64 typedef color_conv_rgb24_rgba64<2,1,0,3> color_conv_bgr24_to_rgba64; //----color_conv_bgr24_to_rgba64 template class color_conv_rgb24_gray16 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { int16u* d = (int16u*)dst; do { *d++ = src[R]*77 + src[1]*150 + src[B]*29; src += 3; } while(--width); } }; typedef color_conv_rgb24_gray16<0,2> color_conv_rgb24_to_gray16; typedef color_conv_rgb24_gray16<2,0> color_conv_bgr24_to_gray16; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/util/Makefile.am0000644000175000017500000000017313233644505024010 0ustar varunvarunmyincludedir = $(includedir)/agg2/util myinclude_HEADERS = agg_color_conv.h agg_color_conv_rgb8.h agg_color_conv_rgb16.h enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/util/agg_color_conv_rgb8.h0000644000175000017500000004414713233644505026041 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // A set of functors used with color_conv(). See file agg_color_conv.h // These functors can convert images with up to 8 bits per component. // Use convertors in the following way: // // agg24::color_conv(dst, src, agg24::color_conv_XXXX_to_YYYY()); // whare XXXX and YYYY can be any of: // rgb24 // bgr24 // rgba32 // abgr32 // argb32 // bgra32 // rgb555 // rgb565 //---------------------------------------------------------------------------- #ifndef AGG_COLOR_CONV_RGB8_INCLUDED #define AGG_COLOR_CONV_RGB8_INCLUDED #include "agg_basics.h" #include "agg_color_conv.h" namespace agg24 { //-----------------------------------------------------color_conv_rgb24 class color_conv_rgb24 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { int8u tmp[3]; tmp[0] = *src++; tmp[1] = *src++; tmp[2] = *src++; *dst++ = tmp[2]; *dst++ = tmp[1]; *dst++ = tmp[0]; } while(--width); } }; typedef color_conv_rgb24 color_conv_rgb24_to_bgr24; typedef color_conv_rgb24 color_conv_bgr24_to_rgb24; typedef color_conv_same<3> color_conv_bgr24_to_bgr24; typedef color_conv_same<3> color_conv_rgb24_to_rgb24; //------------------------------------------------------color_conv_rgba32 template class color_conv_rgba32 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { int8u tmp[4]; tmp[0] = *src++; tmp[1] = *src++; tmp[2] = *src++; tmp[3] = *src++; *dst++ = tmp[I1]; *dst++ = tmp[I2]; *dst++ = tmp[I3]; *dst++ = tmp[I4]; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgba32<0,3,2,1> color_conv_argb32_to_abgr32; //----color_conv_argb32_to_abgr32 typedef color_conv_rgba32<3,2,1,0> color_conv_argb32_to_bgra32; //----color_conv_argb32_to_bgra32 typedef color_conv_rgba32<1,2,3,0> color_conv_argb32_to_rgba32; //----color_conv_argb32_to_rgba32 typedef color_conv_rgba32<3,0,1,2> color_conv_bgra32_to_abgr32; //----color_conv_bgra32_to_abgr32 typedef color_conv_rgba32<3,2,1,0> color_conv_bgra32_to_argb32; //----color_conv_bgra32_to_argb32 typedef color_conv_rgba32<2,1,0,3> color_conv_bgra32_to_rgba32; //----color_conv_bgra32_to_rgba32 typedef color_conv_rgba32<3,2,1,0> color_conv_rgba32_to_abgr32; //----color_conv_rgba32_to_abgr32 typedef color_conv_rgba32<3,0,1,2> color_conv_rgba32_to_argb32; //----color_conv_rgba32_to_argb32 typedef color_conv_rgba32<2,1,0,3> color_conv_rgba32_to_bgra32; //----color_conv_rgba32_to_bgra32 typedef color_conv_rgba32<0,3,2,1> color_conv_abgr32_to_argb32; //----color_conv_abgr32_to_argb32 typedef color_conv_rgba32<1,2,3,0> color_conv_abgr32_to_bgra32; //----color_conv_abgr32_to_bgra32 typedef color_conv_rgba32<3,2,1,0> color_conv_abgr32_to_rgba32; //----color_conv_abgr32_to_rgba32 //------------------------------------------------------------------------ typedef color_conv_same<4> color_conv_rgba32_to_rgba32; //----color_conv_rgba32_to_rgba32 typedef color_conv_same<4> color_conv_argb32_to_argb32; //----color_conv_argb32_to_argb32 typedef color_conv_same<4> color_conv_bgra32_to_bgra32; //----color_conv_bgra32_to_bgra32 typedef color_conv_same<4> color_conv_abgr32_to_abgr32; //----color_conv_abgr32_to_abgr32 //--------------------------------------------color_conv_rgb24_rgba32 template class color_conv_rgb24_rgba32 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { dst[I1] = *src++; dst[I2] = *src++; dst[I3] = *src++; dst[A] = 255; dst += 4; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgb24_rgba32<1,2,3,0> color_conv_rgb24_to_argb32; //----color_conv_rgb24_to_argb32 typedef color_conv_rgb24_rgba32<3,2,1,0> color_conv_rgb24_to_abgr32; //----color_conv_rgb24_to_abgr32 typedef color_conv_rgb24_rgba32<2,1,0,3> color_conv_rgb24_to_bgra32; //----color_conv_rgb24_to_bgra32 typedef color_conv_rgb24_rgba32<0,1,2,3> color_conv_rgb24_to_rgba32; //----color_conv_rgb24_to_rgba32 typedef color_conv_rgb24_rgba32<3,2,1,0> color_conv_bgr24_to_argb32; //----color_conv_bgr24_to_argb32 typedef color_conv_rgb24_rgba32<1,2,3,0> color_conv_bgr24_to_abgr32; //----color_conv_bgr24_to_abgr32 typedef color_conv_rgb24_rgba32<0,1,2,3> color_conv_bgr24_to_bgra32; //----color_conv_bgr24_to_bgra32 typedef color_conv_rgb24_rgba32<2,1,0,3> color_conv_bgr24_to_rgba32; //----color_conv_bgr24_to_rgba32 //-------------------------------------------------color_conv_rgba32_rgb24 template class color_conv_rgba32_rgb24 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { *dst++ = src[I1]; *dst++ = src[I2]; *dst++ = src[I3]; src += 4; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgba32_rgb24<1,2,3> color_conv_argb32_to_rgb24; //----color_conv_argb32_to_rgb24 typedef color_conv_rgba32_rgb24<3,2,1> color_conv_abgr32_to_rgb24; //----color_conv_abgr32_to_rgb24 typedef color_conv_rgba32_rgb24<2,1,0> color_conv_bgra32_to_rgb24; //----color_conv_bgra32_to_rgb24 typedef color_conv_rgba32_rgb24<0,1,2> color_conv_rgba32_to_rgb24; //----color_conv_rgba32_to_rgb24 typedef color_conv_rgba32_rgb24<3,2,1> color_conv_argb32_to_bgr24; //----color_conv_argb32_to_bgr24 typedef color_conv_rgba32_rgb24<1,2,3> color_conv_abgr32_to_bgr24; //----color_conv_abgr32_to_bgr24 typedef color_conv_rgba32_rgb24<0,1,2> color_conv_bgra32_to_bgr24; //----color_conv_bgra32_to_bgr24 typedef color_conv_rgba32_rgb24<2,1,0> color_conv_rgba32_to_bgr24; //----color_conv_rgba32_to_bgr24 //------------------------------------------------color_conv_rgb555_rgb24 template class color_conv_rgb555_rgb24 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { unsigned rgb = *(int16u*)src; dst[R] = (int8u)((rgb >> 7) & 0xF8); dst[1] = (int8u)((rgb >> 2) & 0xF8); dst[B] = (int8u)((rgb << 3) & 0xF8); src += 2; dst += 3; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgb555_rgb24<2,0> color_conv_rgb555_to_bgr24; //----color_conv_rgb555_to_bgr24 typedef color_conv_rgb555_rgb24<0,2> color_conv_rgb555_to_rgb24; //----color_conv_rgb555_to_rgb24 //-------------------------------------------------color_conv_rgb24_rgb555 template class color_conv_rgb24_rgb555 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { *(int16u*)dst = (int16u)(((unsigned(src[R]) << 7) & 0x7C00) | ((unsigned(src[1]) << 2) & 0x3E0) | ((unsigned(src[B]) >> 3))); src += 3; dst += 2; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgb24_rgb555<2,0> color_conv_bgr24_to_rgb555; //----color_conv_bgr24_to_rgb555 typedef color_conv_rgb24_rgb555<0,2> color_conv_rgb24_to_rgb555; //----color_conv_rgb24_to_rgb555 //-------------------------------------------------color_conv_rgb565_rgb24 template class color_conv_rgb565_rgb24 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { unsigned rgb = *(int16u*)src; dst[R] = (rgb >> 8) & 0xF8; dst[1] = (rgb >> 3) & 0xFC; dst[B] = (rgb << 3) & 0xF8; src += 2; dst += 3; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgb565_rgb24<2,0> color_conv_rgb565_to_bgr24; //----color_conv_rgb565_to_bgr24 typedef color_conv_rgb565_rgb24<0,2> color_conv_rgb565_to_rgb24; //----color_conv_rgb565_to_rgb24 //-------------------------------------------------color_conv_rgb24_rgb565 template class color_conv_rgb24_rgb565 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { *(int16u*)dst = (int16u)(((unsigned(src[R]) << 8) & 0xF800) | ((unsigned(src[1]) << 3) & 0x7E0) | ((unsigned(src[B]) >> 3))); src += 3; dst += 2; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgb24_rgb565<2,0> color_conv_bgr24_to_rgb565; //----color_conv_bgr24_to_rgb565 typedef color_conv_rgb24_rgb565<0,2> color_conv_rgb24_to_rgb565; //----color_conv_rgb24_to_rgb565 //-------------------------------------------------color_conv_rgb555_rgba32 template class color_conv_rgb555_rgba32 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { int rgb = *(int16*)src; dst[R] = (int8u)((rgb >> 7) & 0xF8); dst[G] = (int8u)((rgb >> 2) & 0xF8); dst[B] = (int8u)((rgb << 3) & 0xF8); dst[A] = (int8u)(rgb >> 15); src += 2; dst += 4; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgb555_rgba32<1,2,3,0> color_conv_rgb555_to_argb32; //----color_conv_rgb555_to_argb32 typedef color_conv_rgb555_rgba32<3,2,1,0> color_conv_rgb555_to_abgr32; //----color_conv_rgb555_to_abgr32 typedef color_conv_rgb555_rgba32<2,1,0,3> color_conv_rgb555_to_bgra32; //----color_conv_rgb555_to_bgra32 typedef color_conv_rgb555_rgba32<0,1,2,3> color_conv_rgb555_to_rgba32; //----color_conv_rgb555_to_rgba32 //------------------------------------------------color_conv_rgba32_rgb555 template class color_conv_rgba32_rgb555 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { *(int16u*)dst = (int16u)(((unsigned(src[R]) << 7) & 0x7C00) | ((unsigned(src[G]) << 2) & 0x3E0) | ((unsigned(src[B]) >> 3)) | ((unsigned(src[A]) << 8) & 0x8000)); src += 4; dst += 2; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgba32_rgb555<1,2,3,0> color_conv_argb32_to_rgb555; //----color_conv_argb32_to_rgb555 typedef color_conv_rgba32_rgb555<3,2,1,0> color_conv_abgr32_to_rgb555; //----color_conv_abgr32_to_rgb555 typedef color_conv_rgba32_rgb555<2,1,0,3> color_conv_bgra32_to_rgb555; //----color_conv_bgra32_to_rgb555 typedef color_conv_rgba32_rgb555<0,1,2,3> color_conv_rgba32_to_rgb555; //----color_conv_rgba32_to_rgb555 //------------------------------------------------color_conv_rgb565_rgba32 template class color_conv_rgb565_rgba32 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { int rgb = *(int16*)src; dst[R] = (rgb >> 8) & 0xF8; dst[G] = (rgb >> 3) & 0xFC; dst[B] = (rgb << 3) & 0xF8; dst[A] = 255; src += 2; dst += 4; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgb565_rgba32<1,2,3,0> color_conv_rgb565_to_argb32; //----color_conv_rgb565_to_argb32 typedef color_conv_rgb565_rgba32<3,2,1,0> color_conv_rgb565_to_abgr32; //----color_conv_rgb565_to_abgr32 typedef color_conv_rgb565_rgba32<2,1,0,3> color_conv_rgb565_to_bgra32; //----color_conv_rgb565_to_bgra32 typedef color_conv_rgb565_rgba32<0,1,2,3> color_conv_rgb565_to_rgba32; //----color_conv_rgb565_to_rgba32 //------------------------------------------------color_conv_rgba32_rgb565 template class color_conv_rgba32_rgb565 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { *(int16u*)dst = (int16u)(((unsigned(src[R]) << 8) & 0xF800) | ((unsigned(src[G]) << 3) & 0x7E0) | ((unsigned(src[B]) >> 3))); src += 4; dst += 2; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_rgba32_rgb565<1,2,3> color_conv_argb32_to_rgb565; //----color_conv_argb32_to_rgb565 typedef color_conv_rgba32_rgb565<3,2,1> color_conv_abgr32_to_rgb565; //----color_conv_abgr32_to_rgb565 typedef color_conv_rgba32_rgb565<2,1,0> color_conv_bgra32_to_rgb565; //----color_conv_bgra32_to_rgb565 typedef color_conv_rgba32_rgb565<0,1,2> color_conv_rgba32_to_rgb565; //----color_conv_rgba32_to_rgb565 //---------------------------------------------color_conv_rgb555_to_rgb565 class color_conv_rgb555_to_rgb565 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { unsigned rgb = *(int16u*)src; *(int16u*)dst = (int16u)(((rgb << 1) & 0xFFC0) | (rgb & 0x1F)); src += 2; dst += 2; } while(--width); } }; //----------------------------------------------color_conv_rgb565_to_rgb555 class color_conv_rgb565_to_rgb555 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { unsigned rgb = *(int16u*)src; *(int16u*)dst = (int16u)(((rgb >> 1) & 0x7FE0) | (rgb & 0x1F)); src += 2; dst += 2; } while(--width); } }; //------------------------------------------------------------------------ typedef color_conv_same<2> color_conv_rgb555_to_rgb555; //----color_conv_rgb555_to_rgb555 typedef color_conv_same<2> color_conv_rgb565_to_rgb565; //----color_conv_rgb565_to_rgb565 template class color_conv_rgb24_gray8 { public: void operator () (int8u* dst, const int8u* src, unsigned width) const { do { *dst++ = (src[R]*77 + src[1]*150 + src[B]*29) >> 8; src += 3; } while(--width); } }; typedef color_conv_rgb24_gray8<0,2> color_conv_rgb24_to_gray8; //----color_conv_rgb24_to_gray8 typedef color_conv_rgb24_gray8<2,0> color_conv_bgr24_to_gray8; //----color_conv_bgr24_to_gray8 } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vcgen_bspline.h0000644000175000017500000000421613233644505024606 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_VCGEN_BSPLINE_INCLUDED #define AGG_VCGEN_BSPLINE_INCLUDED #include "agg_basics.h" #include "agg_array.h" #include "agg_bspline.h" namespace agg24 { //==========================================================vcgen_bspline class vcgen_bspline { enum status_e { initial, ready, polygon, end_poly, stop }; public: typedef pod_bvector vertex_storage; vcgen_bspline(); void interpolation_step(double v) { m_interpolation_step = v; } double interpolation_step() const { return m_interpolation_step; } // Vertex Generator Interface void remove_all(); void add_vertex(double x, double y, unsigned cmd); // Vertex Source Interface void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: vcgen_bspline(const vcgen_bspline&); const vcgen_bspline& operator = (const vcgen_bspline&); vertex_storage m_src_vertices; bspline m_spline_x; bspline m_spline_y; double m_interpolation_step; unsigned m_closed; status_e m_status; unsigned m_src_vertex; double m_cur_abscissa; double m_max_abscissa; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_bounding_rect.h0000644000175000017500000000717013233644505024614 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // bounding_rect function template // //---------------------------------------------------------------------------- #ifndef AGG_BOUNDING_RECT_INCLUDED #define AGG_BOUNDING_RECT_INCLUDED #include "agg_basics.h" namespace agg24 { //-----------------------------------------------------------bounding_rect template bool bounding_rect(VertexSource& vs, GetId& gi, unsigned start, unsigned num, CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2) { unsigned i; double x; double y; bool first = true; *x1 = CoordT(1); *y1 = CoordT(1); *x2 = CoordT(0); *y2 = CoordT(0); for(i = 0; i < num; i++) { vs.rewind(gi[start + i]); unsigned cmd; while(!is_stop(cmd = vs.vertex(&x, &y))) { if(is_vertex(cmd)) { if(first) { *x1 = CoordT(x); *y1 = CoordT(y); *x2 = CoordT(x); *y2 = CoordT(y); first = false; } else { if(CoordT(x) < *x1) *x1 = CoordT(x); if(CoordT(y) < *y1) *y1 = CoordT(y); if(CoordT(x) > *x2) *x2 = CoordT(x); if(CoordT(y) > *y2) *y2 = CoordT(y); } } } } return *x1 <= *x2 && *y1 <= *y2; } //-----------------------------------------------------bounding_rect_single template bool bounding_rect_single(VertexSource& vs, unsigned path_id, CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2) { double x; double y; bool first = true; *x1 = CoordT(1); *y1 = CoordT(1); *x2 = CoordT(0); *y2 = CoordT(0); vs.rewind(path_id); unsigned cmd; while(!is_stop(cmd = vs.vertex(&x, &y))) { if(is_vertex(cmd)) { if(first) { *x1 = CoordT(x); *y1 = CoordT(y); *x2 = CoordT(x); *y2 = CoordT(y); first = false; } else { if(CoordT(x) < *x1) *x1 = CoordT(x); if(CoordT(y) < *y1) *y1 = CoordT(y); if(CoordT(x) > *x2) *x2 = CoordT(x); if(CoordT(y) > *y2) *y2 = CoordT(y); } } } return *x1 <= *x2 && *y1 <= *y2; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_scanline_boolean_algebra.h0000644000175000017500000015522613233644505026750 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_BOOLEAN_ALGEBRA_INCLUDED #define AGG_SCANLINE_BOOLEAN_ALGEBRA_INCLUDED #include #include #include "agg_basics.h" namespace agg24 { //-----------------------------------------------sbool_combine_spans_bin // Functor. // Combine two binary encoded spans, i.e., when we don't have any // anti-aliasing information, but only X and Length. The function // is compatible with any type of scanlines. //---------------- template struct sbool_combine_spans_bin { void operator () (const typename Scanline1::const_iterator&, const typename Scanline2::const_iterator&, int x, unsigned len, Scanline& sl) const { sl.add_span(x, len, cover_full); } }; //---------------------------------------------sbool_combine_spans_empty // Functor. // Combine two spans as empty ones. The functor does nothing // and is used to XOR binary spans. //---------------- template struct sbool_combine_spans_empty { void operator () (const typename Scanline1::const_iterator&, const typename Scanline2::const_iterator&, int, unsigned, Scanline&) const {} }; //--------------------------------------------------sbool_add_span_empty // Functor. // Add nothing. Used in conbine_shapes_sub //---------------- template struct sbool_add_span_empty { void operator () (const typename Scanline1::const_iterator&, int, unsigned, Scanline&) const {} }; //----------------------------------------------------sbool_add_span_bin // Functor. // Add a binary span //---------------- template struct sbool_add_span_bin { void operator () (const typename Scanline1::const_iterator&, int x, unsigned len, Scanline& sl) const { sl.add_span(x, len, cover_full); } }; //-----------------------------------------------------sbool_add_span_aa // Functor. // Add an anti-aliased span // anti-aliasing information, but only X and Length. The function // is compatible with any type of scanlines. //---------------- template struct sbool_add_span_aa { void operator () (const typename Scanline1::const_iterator& span, int x, unsigned len, Scanline& sl) const { if(span->len < 0) { sl.add_span(x, len, *span->covers); } else if(span->len > 0) { const typename Scanline1::cover_type* covers = span->covers; if(span->x < x) covers += x - span->x; sl.add_cells(x, len, covers); } } }; //----------------------------------------------sbool_intersect_spans_aa // Functor. // Intersect two spans preserving the anti-aliasing information. // The result is added to the "sl" scanline. //------------------ template struct sbool_intersect_spans_aa { enum cover_scale_e { cover_shift = CoverShift, cover_size = 1 << cover_shift, cover_mask = cover_size - 1, cover_full = cover_mask }; void operator () (const typename Scanline1::const_iterator& span1, const typename Scanline2::const_iterator& span2, int x, unsigned len, Scanline& sl) const { unsigned cover; const typename Scanline1::cover_type* covers1; const typename Scanline2::cover_type* covers2; // Calculate the operation code and choose the // proper combination algorithm. // 0 = Both spans are of AA type // 1 = span1 is solid, span2 is AA // 2 = span1 is AA, span2 is solid // 3 = Both spans are of solid type //----------------- switch((span1->len < 0) | ((span2->len < 0) << 1)) { case 0: // Both are AA spans covers1 = span1->covers; covers2 = span2->covers; if(span1->x < x) covers1 += x - span1->x; if(span2->x < x) covers2 += x - span2->x; do { cover = *covers1++ * *covers2++; sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } while(--len); break; case 1: // span1 is solid, span2 is AA covers2 = span2->covers; if(span2->x < x) covers2 += x - span2->x; if(*(span1->covers) == cover_full) { sl.add_cells(x, len, covers2); } else { do { cover = *(span1->covers) * *covers2++; sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } while(--len); } break; case 2: // span1 is AA, span2 is solid covers1 = span1->covers; if(span1->x < x) covers1 += x - span1->x; if(*(span2->covers) == cover_full) { sl.add_cells(x, len, covers1); } else { do { cover = *covers1++ * *(span2->covers); sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } while(--len); } break; case 3: // Both are solid spans cover = *(span1->covers) * *(span2->covers); sl.add_span(x, len, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); break; } } }; //--------------------------------------------------sbool_unite_spans_aa // Functor. // Unite two spans preserving the anti-aliasing information. // The result is added to the "sl" scanline. //------------------ template struct sbool_unite_spans_aa { enum cover_scale_e { cover_shift = CoverShift, cover_size = 1 << cover_shift, cover_mask = cover_size - 1, cover_full = cover_mask }; void operator () (const typename Scanline1::const_iterator& span1, const typename Scanline2::const_iterator& span2, int x, unsigned len, Scanline& sl) const { unsigned cover; const typename Scanline1::cover_type* covers1; const typename Scanline2::cover_type* covers2; // Calculate the operation code and choose the // proper combination algorithm. // 0 = Both spans are of AA type // 1 = span1 is solid, span2 is AA // 2 = span1 is AA, span2 is solid // 3 = Both spans are of solid type //----------------- switch((span1->len < 0) | ((span2->len < 0) << 1)) { case 0: // Both are AA spans covers1 = span1->covers; covers2 = span2->covers; if(span1->x < x) covers1 += x - span1->x; if(span2->x < x) covers2 += x - span2->x; do { cover = cover_mask * cover_mask - (cover_mask - *covers1++) * (cover_mask - *covers2++); sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } while(--len); break; case 1: // span1 is solid, span2 is AA covers2 = span2->covers; if(span2->x < x) covers2 += x - span2->x; if(*(span1->covers) == cover_full) { sl.add_span(x, len, cover_full); } else { do { cover = cover_mask * cover_mask - (cover_mask - *(span1->covers)) * (cover_mask - *covers2++); sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } while(--len); } break; case 2: // span1 is AA, span2 is solid covers1 = span1->covers; if(span1->x < x) covers1 += x - span1->x; if(*(span2->covers) == cover_full) { sl.add_span(x, len, cover_full); } else { do { cover = cover_mask * cover_mask - (cover_mask - *covers1++) * (cover_mask - *(span2->covers)); sl.add_cell(x++, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } while(--len); } break; case 3: // Both are solid spans cover = cover_mask * cover_mask - (cover_mask - *(span1->covers)) * (cover_mask - *(span2->covers)); sl.add_span(x, len, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); break; } } }; //---------------------------------------------sbool_xor_formula_linear template struct sbool_xor_formula_linear { enum cover_scale_e { cover_shift = CoverShift, cover_size = 1 << cover_shift, cover_mask = cover_size - 1 }; static AGG_INLINE unsigned calculate(unsigned a, unsigned b) { unsigned cover = a + b; if(cover > cover_mask) cover = cover_mask + cover_mask - cover; return cover; } }; //---------------------------------------------sbool_xor_formula_saddle template struct sbool_xor_formula_saddle { enum cover_scale_e { cover_shift = CoverShift, cover_size = 1 << cover_shift, cover_mask = cover_size - 1 }; static AGG_INLINE unsigned calculate(unsigned a, unsigned b) { unsigned k = a * b; if(k == cover_mask * cover_mask) return 0; a = (cover_mask * cover_mask - (a << cover_shift) + k) >> cover_shift; b = (cover_mask * cover_mask - (b << cover_shift) + k) >> cover_shift; return cover_mask - ((a * b) >> cover_shift); } }; //-------------------------------------------sbool_xor_formula_abs_diff struct sbool_xor_formula_abs_diff { static AGG_INLINE unsigned calculate(unsigned a, unsigned b) { return unsigned(abs(int(a) - int(b))); } }; //----------------------------------------------------sbool_xor_spans_aa // Functor. // XOR two spans preserving the anti-aliasing information. // The result is added to the "sl" scanline. //------------------ template struct sbool_xor_spans_aa { enum cover_scale_e { cover_shift = CoverShift, cover_size = 1 << cover_shift, cover_mask = cover_size - 1, cover_full = cover_mask }; void operator () (const typename Scanline1::const_iterator& span1, const typename Scanline2::const_iterator& span2, int x, unsigned len, Scanline& sl) const { unsigned cover; const typename Scanline1::cover_type* covers1; const typename Scanline2::cover_type* covers2; // Calculate the operation code and choose the // proper combination algorithm. // 0 = Both spans are of AA type // 1 = span1 is solid, span2 is AA // 2 = span1 is AA, span2 is solid // 3 = Both spans are of solid type //----------------- switch((span1->len < 0) | ((span2->len < 0) << 1)) { case 0: // Both are AA spans covers1 = span1->covers; covers2 = span2->covers; if(span1->x < x) covers1 += x - span1->x; if(span2->x < x) covers2 += x - span2->x; do { cover = XorFormula::calculate(*covers1++, *covers2++); if(cover) sl.add_cell(x, cover); ++x; } while(--len); break; case 1: // span1 is solid, span2 is AA covers2 = span2->covers; if(span2->x < x) covers2 += x - span2->x; do { cover = XorFormula::calculate(*(span1->covers), *covers2++); if(cover) sl.add_cell(x, cover); ++x; } while(--len); break; case 2: // span1 is AA, span2 is solid covers1 = span1->covers; if(span1->x < x) covers1 += x - span1->x; do { cover = XorFormula::calculate(*covers1++, *(span2->covers)); if(cover) sl.add_cell(x, cover); ++x; } while(--len); break; case 3: // Both are solid spans cover = XorFormula::calculate(*(span1->covers), *(span2->covers)); if(cover) sl.add_span(x, len, cover); break; } } }; //-----------------------------------------------sbool_subtract_spans_aa // Functor. // Unite two spans preserving the anti-aliasing information. // The result is added to the "sl" scanline. //------------------ template struct sbool_subtract_spans_aa { enum cover_scale_e { cover_shift = CoverShift, cover_size = 1 << cover_shift, cover_mask = cover_size - 1, cover_full = cover_mask }; void operator () (const typename Scanline1::const_iterator& span1, const typename Scanline2::const_iterator& span2, int x, unsigned len, Scanline& sl) const { unsigned cover; const typename Scanline1::cover_type* covers1; const typename Scanline2::cover_type* covers2; // Calculate the operation code and choose the // proper combination algorithm. // 0 = Both spans are of AA type // 1 = span1 is solid, span2 is AA // 2 = span1 is AA, span2 is solid // 3 = Both spans are of solid type //----------------- switch((span1->len < 0) | ((span2->len < 0) << 1)) { case 0: // Both are AA spans covers1 = span1->covers; covers2 = span2->covers; if(span1->x < x) covers1 += x - span1->x; if(span2->x < x) covers2 += x - span2->x; do { cover = *covers1++ * (cover_mask - *covers2++); if(cover) { sl.add_cell(x, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } ++x; } while(--len); break; case 1: // span1 is solid, span2 is AA covers2 = span2->covers; if(span2->x < x) covers2 += x - span2->x; do { cover = *(span1->covers) * (cover_mask - *covers2++); if(cover) { sl.add_cell(x, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } ++x; } while(--len); break; case 2: // span1 is AA, span2 is solid covers1 = span1->covers; if(span1->x < x) covers1 += x - span1->x; if(*(span2->covers) != cover_full) { do { cover = *covers1++ * (cover_mask - *(span2->covers)); if(cover) { sl.add_cell(x, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } ++x; } while(--len); } break; case 3: // Both are solid spans cover = *(span1->covers) * (cover_mask - *(span2->covers)); if(cover) { sl.add_span(x, len, (cover == cover_full * cover_full) ? cover_full : (cover >> cover_shift)); } break; } } }; //--------------------------------------------sbool_add_spans_and_render template void sbool_add_spans_and_render(const Scanline1& sl1, Scanline& sl, Renderer& ren, AddSpanFunctor add_span) { sl.reset_spans(); typename Scanline1::const_iterator span = sl1.begin(); unsigned num_spans = sl1.num_spans(); for(;;) { add_span(span, span->x, abs((int)span->len), sl); if(--num_spans == 0) break; ++span; } sl.finalize(sl1.y()); ren.render(sl); } //---------------------------------------------sbool_intersect_scanlines // Intersect two scanlines, "sl1" and "sl2" and generate a new "sl" one. // The combine_spans functor can be of type sbool_combine_spans_bin or // sbool_intersect_spans_aa. First is a general functor to combine // two spans without Anti-Aliasing, the second preserves the AA // information, but works slower // template void sbool_intersect_scanlines(const Scanline1& sl1, const Scanline2& sl2, Scanline& sl, CombineSpansFunctor combine_spans) { sl.reset_spans(); unsigned num1 = sl1.num_spans(); if(num1 == 0) return; unsigned num2 = sl2.num_spans(); if(num2 == 0) return; typename Scanline1::const_iterator span1 = sl1.begin(); typename Scanline2::const_iterator span2 = sl2.begin(); while(num1 && num2) { int xb1 = span1->x; int xb2 = span2->x; int xe1 = xb1 + abs((int)span1->len) - 1; int xe2 = xb2 + abs((int)span2->len) - 1; // Determine what spans we should advance in the next step // The span with the least ending X should be advanced // advance_both is just an optimization when we ending // coordinates are the same and we can advance both //-------------- bool advance_span1 = xe1 < xe2; bool advance_both = xe1 == xe2; // Find the intersection of the spans // and check if they intersect //-------------- if(xb1 < xb2) xb1 = xb2; if(xe1 > xe2) xe1 = xe2; if(xb1 <= xe1) { combine_spans(span1, span2, xb1, xe1 - xb1 + 1, sl); } // Advance the spans //-------------- if(advance_both) { --num1; --num2; if(num1) ++span1; if(num2) ++span2; } else { if(advance_span1) { --num1; if(num1) ++span1; } else { --num2; if(num2) ++span2; } } } } //------------------------------------------------sbool_intersect_shapes // Intersect the scanline shapes. Here the "Scanline Generator" // abstraction is used. ScanlineGen1 and ScanlineGen2 are // the generators, and can be of type rasterizer_scanline_aa<>. // There function requires three scanline containers that can be of // different types. // "sl1" and "sl2" are used to retrieve scanlines from the generators, // "sl" is ised as the resulting scanline to render it. // The external "sl1" and "sl2" are used only for the sake of // optimization and reusing of the scanline objects. // the function calls sbool_intersect_scanlines with CombineSpansFunctor // as the last argument. See sbool_intersect_scanlines for details. //---------- template void sbool_intersect_shapes(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren, CombineSpansFunctor combine_spans) { // Prepare the scanline generators. // If anyone of them doesn't contain // any scanlines, then return. //----------------- if(!sg1.rewind_scanlines()) return; if(!sg2.rewind_scanlines()) return; // Get the bounding boxes //---------------- rect_i r1(sg1.min_x(), sg1.min_y(), sg1.max_x(), sg1.max_y()); rect_i r2(sg2.min_x(), sg2.min_y(), sg2.max_x(), sg2.max_y()); // Calculate the intersection of the bounding // boxes and return if they don't intersect. //----------------- rect_i ir = intersect_rectangles(r1, r2); if(!ir.is_valid()) return; // Reset the scanlines and get two first ones //----------------- sl.reset(ir.x1, ir.x2); sl1.reset(sg1.min_x(), sg1.max_x()); sl2.reset(sg2.min_x(), sg2.max_x()); if(!sg1.sweep_scanline(sl1)) return; if(!sg2.sweep_scanline(sl2)) return; ren.prepare(); // The main loop // Here we synchronize the scanlines with // the same Y coordinate, ignoring all other ones. // Only scanlines having the same Y-coordinate // are to be combined. //----------------- for(;;) { while(sl1.y() < sl2.y()) { if(!sg1.sweep_scanline(sl1)) return; } while(sl2.y() < sl1.y()) { if(!sg2.sweep_scanline(sl2)) return; } if(sl1.y() == sl2.y()) { // The Y coordinates are the same. // Combine the scanlines, render if they contain any spans, // and advance both generators to the next scanlines //---------------------- sbool_intersect_scanlines(sl1, sl2, sl, combine_spans); if(sl.num_spans()) { sl.finalize(sl1.y()); ren.render(sl); } if(!sg1.sweep_scanline(sl1)) return; if(!sg2.sweep_scanline(sl2)) return; } } } //-------------------------------------------------sbool_unite_scanlines // Unite two scanlines, "sl1" and "sl2" and generate a new "sl" one. // The combine_spans functor can be of type sbool_combine_spans_bin or // sbool_intersect_spans_aa. First is a general functor to combine // two spans without Anti-Aliasing, the second preserves the AA // information, but works slower // template void sbool_unite_scanlines(const Scanline1& sl1, const Scanline2& sl2, Scanline& sl, AddSpanFunctor1 add_span1, AddSpanFunctor2 add_span2, CombineSpansFunctor combine_spans) { sl.reset_spans(); unsigned num1 = sl1.num_spans(); unsigned num2 = sl2.num_spans(); typename Scanline1::const_iterator span1;// = sl1.begin(); typename Scanline2::const_iterator span2;// = sl2.begin(); enum invalidation_e { invalid_b = 0xFFFFFFF, invalid_e = invalid_b - 1 }; // Initialize the spans as invalid //--------------- int xb1 = invalid_b; int xb2 = invalid_b; int xe1 = invalid_e; int xe2 = invalid_e; // Initialize span1 if there are spans //--------------- if(num1) { span1 = sl1.begin(); xb1 = span1->x; xe1 = xb1 + abs((int)span1->len) - 1; --num1; } // Initialize span2 if there are spans //--------------- if(num2) { span2 = sl2.begin(); xb2 = span2->x; xe2 = xb2 + abs((int)span2->len) - 1; --num2; } for(;;) { // Retrieve a new span1 if it's invalid //---------------- if(num1 && xb1 > xe1) { --num1; ++span1; xb1 = span1->x; xe1 = xb1 + abs((int)span1->len) - 1; } // Retrieve a new span2 if it's invalid //---------------- if(num2 && xb2 > xe2) { --num2; ++span2; xb2 = span2->x; xe2 = xb2 + abs((int)span2->len) - 1; } if(xb1 > xe1 && xb2 > xe2) break; // Calculate the intersection //---------------- int xb = xb1; int xe = xe1; if(xb < xb2) xb = xb2; if(xe > xe2) xe = xe2; int len = xe - xb + 1; // The length of the intersection if(len > 0) { // The spans intersect, // add the beginning of the span //---------------- if(xb1 < xb2) { add_span1(span1, xb1, xb2 - xb1, sl); xb1 = xb2; } else if(xb2 < xb1) { add_span2(span2, xb2, xb1 - xb2, sl); xb2 = xb1; } // Add the combination part of the spans //---------------- combine_spans(span1, span2, xb, len, sl); // Invalidate the fully processed span or both //---------------- if(xe1 < xe2) { // Invalidate span1 and eat // the processed part of span2 //-------------- xb1 = invalid_b; xe1 = invalid_e; xb2 += len; } else if(xe2 < xe1) { // Invalidate span2 and eat // the processed part of span1 //-------------- xb2 = invalid_b; xe2 = invalid_e; xb1 += len; } else { xb1 = invalid_b; // Invalidate both xb2 = invalid_b; xe1 = invalid_e; xe2 = invalid_e; } } else { // The spans do not intersect //-------------- if(xb1 < xb2) { // Advance span1 //--------------- if(xb1 <= xe1) { add_span1(span1, xb1, xe1 - xb1 + 1, sl); } xb1 = invalid_b; // Invalidate xe1 = invalid_e; } else { // Advance span2 //--------------- if(xb2 <= xe2) { add_span2(span2, xb2, xe2 - xb2 + 1, sl); } xb2 = invalid_b; // Invalidate xe2 = invalid_e; } } } } //----------------------------------------------------sbool_unite_shapes // Unite the scanline shapes. Here the "Scanline Generator" // abstraction is used. ScanlineGen1 and ScanlineGen2 are // the generators, and can be of type rasterizer_scanline_aa<>. // There function requires three scanline containers that can be // of different type. // "sl1" and "sl2" are used to retrieve scanlines from the generators, // "sl" is ised as the resulting scanline to render it. // The external "sl1" and "sl2" are used only for the sake of // optimization and reusing of the scanline objects. // the function calls sbool_unite_scanlines with CombineSpansFunctor // as the last argument. See sbool_unite_scanlines for details. //---------- template void sbool_unite_shapes(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren, AddSpanFunctor1 add_span1, AddSpanFunctor2 add_span2, CombineSpansFunctor combine_spans) { // Prepare the scanline generators. // If anyone of them doesn't contain // any scanlines, then return. //----------------- bool flag1 = sg1.rewind_scanlines(); bool flag2 = sg2.rewind_scanlines(); if(!flag1 && !flag2) return; // Get the bounding boxes //---------------- rect_i r1(sg1.min_x(), sg1.min_y(), sg1.max_x(), sg1.max_y()); rect_i r2(sg2.min_x(), sg2.min_y(), sg2.max_x(), sg2.max_y()); // Calculate the union of the bounding boxes //----------------- rect_i ur(1,1,0,0); if(flag1 && flag2) ur = unite_rectangles(r1, r2); else if(flag1) ur = r1; else if(flag2) ur = r2; if(!ur.is_valid()) return; ren.prepare(); // Reset the scanlines and get two first ones //----------------- sl.reset(ur.x1, ur.x2); if(flag1) { sl1.reset(sg1.min_x(), sg1.max_x()); flag1 = sg1.sweep_scanline(sl1); } if(flag2) { sl2.reset(sg2.min_x(), sg2.max_x()); flag2 = sg2.sweep_scanline(sl2); } // The main loop // Here we synchronize the scanlines with // the same Y coordinate. //----------------- while(flag1 || flag2) { if(flag1 && flag2) { if(sl1.y() == sl2.y()) { // The Y coordinates are the same. // Combine the scanlines, render if they contain any spans, // and advance both generators to the next scanlines //---------------------- sbool_unite_scanlines(sl1, sl2, sl, add_span1, add_span2, combine_spans); if(sl.num_spans()) { sl.finalize(sl1.y()); ren.render(sl); } flag1 = sg1.sweep_scanline(sl1); flag2 = sg2.sweep_scanline(sl2); } else { if(sl1.y() < sl2.y()) { sbool_add_spans_and_render(sl1, sl, ren, add_span1); flag1 = sg1.sweep_scanline(sl1); } else { sbool_add_spans_and_render(sl2, sl, ren, add_span2); flag2 = sg2.sweep_scanline(sl2); } } } else { if(flag1) { sbool_add_spans_and_render(sl1, sl, ren, add_span1); flag1 = sg1.sweep_scanline(sl1); } if(flag2) { sbool_add_spans_and_render(sl2, sl, ren, add_span2); flag2 = sg2.sweep_scanline(sl2); } } } } //-------------------------------------------------sbool_subtract_shapes // Subtract the scanline shapes, "sg1-sg2". Here the "Scanline Generator" // abstraction is used. ScanlineGen1 and ScanlineGen2 are // the generators, and can be of type rasterizer_scanline_aa<>. // There function requires three scanline containers that can be of // different types. // "sl1" and "sl2" are used to retrieve scanlines from the generators, // "sl" is ised as the resulting scanline to render it. // The external "sl1" and "sl2" are used only for the sake of // optimization and reusing of the scanline objects. // the function calls sbool_intersect_scanlines with CombineSpansFunctor // as the last argument. See combine_scanlines_sub for details. //---------- template void sbool_subtract_shapes(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren, AddSpanFunctor1 add_span1, CombineSpansFunctor combine_spans) { // Prepare the scanline generators. // Here "sg1" is master, "sg2" is slave. //----------------- if(!sg1.rewind_scanlines()) return; bool flag2 = sg2.rewind_scanlines(); // Get the bounding box //---------------- rect_i r1(sg1.min_x(), sg1.min_y(), sg1.max_x(), sg1.max_y()); // Reset the scanlines and get two first ones //----------------- sl.reset(sg1.min_x(), sg1.max_x()); sl1.reset(sg1.min_x(), sg1.max_x()); sl2.reset(sg2.min_x(), sg2.max_x()); if(!sg1.sweep_scanline(sl1)) return; if(flag2) flag2 = sg2.sweep_scanline(sl2); ren.prepare(); // A fake span2 processor sbool_add_span_empty add_span2; // The main loop // Here we synchronize the scanlines with // the same Y coordinate, ignoring all other ones. // Only scanlines having the same Y-coordinate // are to be combined. //----------------- bool flag1 = true; do { // Synchronize "slave" with "master" //----------------- while(flag2 && sl2.y() < sl1.y()) { flag2 = sg2.sweep_scanline(sl2); } if(flag2 && sl2.y() == sl1.y()) { // The Y coordinates are the same. // Combine the scanlines and render if they contain any spans. //---------------------- sbool_unite_scanlines(sl1, sl2, sl, add_span1, add_span2, combine_spans); if(sl.num_spans()) { sl.finalize(sl1.y()); ren.render(sl); } } else { sbool_add_spans_and_render(sl1, sl, ren, add_span1); } // Advance the "master" flag1 = sg1.sweep_scanline(sl1); } while(flag1); } //---------------------------------------------sbool_intersect_shapes_aa // Intersect two anti-aliased scanline shapes. // Here the "Scanline Generator" abstraction is used. // ScanlineGen1 and ScanlineGen2 are the generators, and can be of // type rasterizer_scanline_aa<>. There function requires three // scanline containers that can be of different types. // "sl1" and "sl2" are used to retrieve scanlines from the generators, // "sl" is ised as the resulting scanline to render it. // The external "sl1" and "sl2" are used only for the sake of // optimization and reusing of the scanline objects. //---------- template void sbool_intersect_shapes_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_intersect_spans_aa combine_functor; sbool_intersect_shapes(sg1, sg2, sl1, sl2, sl, ren, combine_functor); } //--------------------------------------------sbool_intersect_shapes_bin // Intersect two binary scanline shapes (without anti-aliasing). // See intersect_shapes_aa for more comments //---------- template void sbool_intersect_shapes_bin(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_combine_spans_bin combine_functor; sbool_intersect_shapes(sg1, sg2, sl1, sl2, sl, ren, combine_functor); } //-------------------------------------------------sbool_unite_shapes_aa // Unite two anti-aliased scanline shapes // See intersect_shapes_aa for more comments //---------- template void sbool_unite_shapes_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_add_span_aa add_functor1; sbool_add_span_aa add_functor2; sbool_unite_spans_aa combine_functor; sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); } //------------------------------------------------sbool_unite_shapes_bin // Unite two binary scanline shapes (without anti-aliasing). // See intersect_shapes_aa for more comments //---------- template void sbool_unite_shapes_bin(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_add_span_bin add_functor1; sbool_add_span_bin add_functor2; sbool_combine_spans_bin combine_functor; sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); } //---------------------------------------------------sbool_xor_shapes_aa // Apply eXclusive OR to two anti-aliased scanline shapes. There's // a modified "Linear" XOR used instead of classical "Saddle" one. // The reason is to have the result absolutely conststent with what // the scanline rasterizer produces. // See intersect_shapes_aa for more comments //---------- template void sbool_xor_shapes_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_add_span_aa add_functor1; sbool_add_span_aa add_functor2; sbool_xor_spans_aa > combine_functor; sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); } //------------------------------------------sbool_xor_shapes_saddle_aa // Apply eXclusive OR to two anti-aliased scanline shapes. // There's the classical "Saddle" used to calculate the // Anti-Aliasing values, that is: // a XOR b : 1-((1-a+a*b)*(1-b+a*b)) // See intersect_shapes_aa for more comments //---------- template void sbool_xor_shapes_saddle_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_add_span_aa add_functor1; sbool_add_span_aa add_functor2; sbool_xor_spans_aa > combine_functor; sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); } //--------------------------------------sbool_xor_shapes_abs_diff_aa // Apply eXclusive OR to two anti-aliased scanline shapes. // There's the absolute difference used to calculate // Anti-Aliasing values, that is: // a XOR b : abs(a-b) // See intersect_shapes_aa for more comments //---------- template void sbool_xor_shapes_abs_diff_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_add_span_aa add_functor1; sbool_add_span_aa add_functor2; sbool_xor_spans_aa combine_functor; sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); } //--------------------------------------------------sbool_xor_shapes_bin // Apply eXclusive OR to two binary scanline shapes (without anti-aliasing). // See intersect_shapes_aa for more comments //---------- template void sbool_xor_shapes_bin(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_add_span_bin add_functor1; sbool_add_span_bin add_functor2; sbool_combine_spans_empty combine_functor; sbool_unite_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor1, add_functor2, combine_functor); } //----------------------------------------------sbool_subtract_shapes_aa // Subtract shapes "sg1-sg2" with anti-aliasing // See intersect_shapes_aa for more comments //---------- template void sbool_subtract_shapes_aa(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_add_span_aa add_functor; sbool_subtract_spans_aa combine_functor; sbool_subtract_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor, combine_functor); } //---------------------------------------------sbool_subtract_shapes_bin // Subtract binary shapes "sg1-sg2" without anti-aliasing // See intersect_shapes_aa for more comments //---------- template void sbool_subtract_shapes_bin(ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { sbool_add_span_bin add_functor; sbool_combine_spans_empty combine_functor; sbool_subtract_shapes(sg1, sg2, sl1, sl2, sl, ren, add_functor, combine_functor); } //------------------------------------------------------------sbool_op_e enum sbool_op_e { sbool_or, //----sbool_or sbool_and, //----sbool_and sbool_xor, //----sbool_xor sbool_xor_saddle, //----sbool_xor_saddle sbool_xor_abs_diff, //----sbool_xor_abs_diff sbool_a_minus_b, //----sbool_a_minus_b sbool_b_minus_a //----sbool_b_minus_a }; //----------------------------------------------sbool_combine_shapes_bin template void sbool_combine_shapes_bin(sbool_op_e op, ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { switch(op) { case sbool_or : sbool_unite_shapes_bin (sg1, sg2, sl1, sl2, sl, ren); break; case sbool_and : sbool_intersect_shapes_bin(sg1, sg2, sl1, sl2, sl, ren); break; case sbool_xor : case sbool_xor_saddle : case sbool_xor_abs_diff: sbool_xor_shapes_bin (sg1, sg2, sl1, sl2, sl, ren); break; case sbool_a_minus_b : sbool_subtract_shapes_bin (sg1, sg2, sl1, sl2, sl, ren); break; case sbool_b_minus_a : sbool_subtract_shapes_bin (sg2, sg1, sl2, sl1, sl, ren); break; } } //-----------------------------------------------sbool_combine_shapes_aa template void sbool_combine_shapes_aa(sbool_op_e op, ScanlineGen1& sg1, ScanlineGen2& sg2, Scanline1& sl1, Scanline2& sl2, Scanline& sl, Renderer& ren) { switch(op) { case sbool_or : sbool_unite_shapes_aa (sg1, sg2, sl1, sl2, sl, ren); break; case sbool_and : sbool_intersect_shapes_aa (sg1, sg2, sl1, sl2, sl, ren); break; case sbool_xor : sbool_xor_shapes_aa (sg1, sg2, sl1, sl2, sl, ren); break; case sbool_xor_saddle : sbool_xor_shapes_saddle_aa (sg1, sg2, sl1, sl2, sl, ren); break; case sbool_xor_abs_diff: sbool_xor_shapes_abs_diff_aa(sg1, sg2, sl1, sl2, sl, ren); break; case sbool_a_minus_b : sbool_subtract_shapes_aa (sg1, sg2, sl1, sl2, sl, ren); break; case sbool_b_minus_a : sbool_subtract_shapes_aa (sg2, sg1, sl2, sl1, sl, ren); break; } } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_alpha_mask_u8.h0000644000175000017500000004507613233644505024515 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // scanline_u8 class // //---------------------------------------------------------------------------- #ifndef AGG_ALPHA_MASK_U8_INCLUDED #define AGG_ALPHA_MASK_U8_INCLUDED #include #include "agg_basics.h" #include "agg_rendering_buffer.h" namespace agg24 { //===================================================one_component_mask_u8 struct one_component_mask_u8 { static unsigned calculate(const int8u* p) { return *p; } }; //=====================================================rgb_to_gray_mask_u8 template struct rgb_to_gray_mask_u8 { static unsigned calculate(const int8u* p) { return (p[R]*77 + p[G]*150 + p[B]*29) >> 8; } }; //==========================================================alpha_mask_u8 template class alpha_mask_u8 { public: typedef int8u cover_type; typedef alpha_mask_u8 self_type; enum cover_scale_e { cover_shift = 8, cover_none = 0, cover_full = 255 }; alpha_mask_u8() : m_rbuf(0) {} explicit alpha_mask_u8(rendering_buffer& rbuf) : m_rbuf(&rbuf) {} void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; } MaskF& mask_function() { return m_mask_function; } const MaskF& mask_function() const { return m_mask_function; } //-------------------------------------------------------------------- cover_type pixel(int x, int y) const { if(x >= 0 && y >= 0 && x < (int)m_rbuf->width() && y < (int)m_rbuf->height()) { return (cover_type)m_mask_function.calculate( m_rbuf->row_ptr(y) + x * Step + Offset); } return 0; } //-------------------------------------------------------------------- cover_type combine_pixel(int x, int y, cover_type val) const { if(x >= 0 && y >= 0 && x < (int)m_rbuf->width() && y < (int)m_rbuf->height()) { return (cover_type)((cover_full + val * m_mask_function.calculate( m_rbuf->row_ptr(y) + x * Step + Offset)) >> cover_shift); } return 0; } //-------------------------------------------------------------------- void fill_hspan(int x, int y, cover_type* dst, int num_pix) const { int xmax = m_rbuf->width() - 1; int ymax = m_rbuf->height() - 1; int count = num_pix; cover_type* covers = dst; if(y < 0 || y > ymax) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } if(x < 0) { count += x; if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } memset(covers, 0, -x * sizeof(cover_type)); covers -= x; x = 0; } if(x + count > xmax) { int rest = x + count - xmax - 1; count -= rest; if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } memset(covers + count, 0, rest * sizeof(cover_type)); } const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { *covers++ = (cover_type)m_mask_function.calculate(mask); mask += Step; } while(--count); } //-------------------------------------------------------------------- void combine_hspan(int x, int y, cover_type* dst, int num_pix) const { int xmax = m_rbuf->width() - 1; int ymax = m_rbuf->height() - 1; int count = num_pix; cover_type* covers = dst; if(y < 0 || y > ymax) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } if(x < 0) { count += x; if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } memset(covers, 0, -x * sizeof(cover_type)); covers -= x; x = 0; } if(x + count > xmax) { int rest = x + count - xmax - 1; count -= rest; if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } memset(covers + count, 0, rest * sizeof(cover_type)); } const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { *covers = (cover_type)((cover_full + (*covers) * m_mask_function.calculate(mask)) >> cover_shift); ++covers; mask += Step; } while(--count); } //-------------------------------------------------------------------- void fill_vspan(int x, int y, cover_type* dst, int num_pix) const { int xmax = m_rbuf->width() - 1; int ymax = m_rbuf->height() - 1; int count = num_pix; cover_type* covers = dst; if(x < 0 || x > xmax) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } if(y < 0) { count += y; if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } memset(covers, 0, -y * sizeof(cover_type)); covers -= y; y = 0; } if(y + count > ymax) { int rest = y + count - ymax - 1; count -= rest; if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } memset(covers + count, 0, rest * sizeof(cover_type)); } const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { *covers++ = (cover_type)m_mask_function.calculate(mask); mask += m_rbuf->stride(); } while(--count); } //-------------------------------------------------------------------- void combine_vspan(int x, int y, cover_type* dst, int num_pix) const { int xmax = m_rbuf->width() - 1; int ymax = m_rbuf->height() - 1; int count = num_pix; cover_type* covers = dst; if(x < 0 || x > xmax) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } if(y < 0) { count += y; if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } memset(covers, 0, -y * sizeof(cover_type)); covers -= y; y = 0; } if(y + count > ymax) { int rest = y + count - ymax - 1; count -= rest; if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; } memset(covers + count, 0, rest * sizeof(cover_type)); } const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { *covers = (cover_type)((cover_full + (*covers) * m_mask_function.calculate(mask)) >> cover_shift); ++covers; mask += m_rbuf->stride(); } while(--count); } private: alpha_mask_u8(const self_type&); const self_type& operator = (const self_type&); rendering_buffer* m_rbuf; MaskF m_mask_function; }; typedef alpha_mask_u8<1, 0> alpha_mask_gray8; //----alpha_mask_gray8 typedef alpha_mask_u8<3, 0> alpha_mask_rgb24r; //----alpha_mask_rgb24r typedef alpha_mask_u8<3, 1> alpha_mask_rgb24g; //----alpha_mask_rgb24g typedef alpha_mask_u8<3, 2> alpha_mask_rgb24b; //----alpha_mask_rgb24b typedef alpha_mask_u8<3, 2> alpha_mask_bgr24r; //----alpha_mask_bgr24r typedef alpha_mask_u8<3, 1> alpha_mask_bgr24g; //----alpha_mask_bgr24g typedef alpha_mask_u8<3, 0> alpha_mask_bgr24b; //----alpha_mask_bgr24b typedef alpha_mask_u8<4, 0> alpha_mask_rgba32r; //----alpha_mask_rgba32r typedef alpha_mask_u8<4, 1> alpha_mask_rgba32g; //----alpha_mask_rgba32g typedef alpha_mask_u8<4, 2> alpha_mask_rgba32b; //----alpha_mask_rgba32b typedef alpha_mask_u8<4, 3> alpha_mask_rgba32a; //----alpha_mask_rgba32a typedef alpha_mask_u8<4, 1> alpha_mask_argb32r; //----alpha_mask_argb32r typedef alpha_mask_u8<4, 2> alpha_mask_argb32g; //----alpha_mask_argb32g typedef alpha_mask_u8<4, 3> alpha_mask_argb32b; //----alpha_mask_argb32b typedef alpha_mask_u8<4, 0> alpha_mask_argb32a; //----alpha_mask_argb32a typedef alpha_mask_u8<4, 2> alpha_mask_bgra32r; //----alpha_mask_bgra32r typedef alpha_mask_u8<4, 1> alpha_mask_bgra32g; //----alpha_mask_bgra32g typedef alpha_mask_u8<4, 0> alpha_mask_bgra32b; //----alpha_mask_bgra32b typedef alpha_mask_u8<4, 3> alpha_mask_bgra32a; //----alpha_mask_bgra32a typedef alpha_mask_u8<4, 3> alpha_mask_abgr32r; //----alpha_mask_abgr32r typedef alpha_mask_u8<4, 2> alpha_mask_abgr32g; //----alpha_mask_abgr32g typedef alpha_mask_u8<4, 1> alpha_mask_abgr32b; //----alpha_mask_abgr32b typedef alpha_mask_u8<4, 0> alpha_mask_abgr32a; //----alpha_mask_abgr32a typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_rgb24gray; //----alpha_mask_rgb24gray typedef alpha_mask_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_bgr24gray; //----alpha_mask_bgr24gray typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_rgba32gray; //----alpha_mask_rgba32gray typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2> > alpha_mask_argb32gray; //----alpha_mask_argb32gray typedef alpha_mask_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_bgra32gray; //----alpha_mask_bgra32gray typedef alpha_mask_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0> > alpha_mask_abgr32gray; //----alpha_mask_abgr32gray //==========================================================amask_no_clip_u8 template class amask_no_clip_u8 { public: typedef int8u cover_type; typedef amask_no_clip_u8 self_type; enum cover_scale_e { cover_shift = 8, cover_none = 0, cover_full = 255 }; amask_no_clip_u8() : m_rbuf(0) {} explicit amask_no_clip_u8(rendering_buffer& rbuf) : m_rbuf(&rbuf) {} void attach(rendering_buffer& rbuf) { m_rbuf = &rbuf; } MaskF& mask_function() { return m_mask_function; } const MaskF& mask_function() const { return m_mask_function; } //-------------------------------------------------------------------- cover_type pixel(int x, int y) const { return (cover_type)m_mask_function.calculate( m_rbuf->row_ptr(y) + x * Step + Offset); } //-------------------------------------------------------------------- cover_type combine_pixel(int x, int y, cover_type val) const { return (cover_type)((cover_full + val * m_mask_function.calculate( m_rbuf->row_ptr(y) + x * Step + Offset)) >> cover_shift); } //-------------------------------------------------------------------- void fill_hspan(int x, int y, cover_type* dst, int num_pix) const { const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { *dst++ = (cover_type)m_mask_function.calculate(mask); mask += Step; } while(--num_pix); } //-------------------------------------------------------------------- void combine_hspan(int x, int y, cover_type* dst, int num_pix) const { const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { *dst = (cover_type)((cover_full + (*dst) * m_mask_function.calculate(mask)) >> cover_shift); ++dst; mask += Step; } while(--num_pix); } //-------------------------------------------------------------------- void fill_vspan(int x, int y, cover_type* dst, int num_pix) const { const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { *dst++ = (cover_type)m_mask_function.calculate(mask); mask += m_rbuf->stride(); } while(--num_pix); } //-------------------------------------------------------------------- void combine_vspan(int x, int y, cover_type* dst, int num_pix) const { const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { *dst = (cover_type)((cover_full + (*dst) * m_mask_function.calculate(mask)) >> cover_shift); ++dst; mask += m_rbuf->stride(); } while(--num_pix); } private: amask_no_clip_u8(const self_type&); const self_type& operator = (const self_type&); rendering_buffer* m_rbuf; MaskF m_mask_function; }; typedef amask_no_clip_u8<1, 0> amask_no_clip_gray8; //----amask_no_clip_gray8 typedef amask_no_clip_u8<3, 0> amask_no_clip_rgb24r; //----amask_no_clip_rgb24r typedef amask_no_clip_u8<3, 1> amask_no_clip_rgb24g; //----amask_no_clip_rgb24g typedef amask_no_clip_u8<3, 2> amask_no_clip_rgb24b; //----amask_no_clip_rgb24b typedef amask_no_clip_u8<3, 2> amask_no_clip_bgr24r; //----amask_no_clip_bgr24r typedef amask_no_clip_u8<3, 1> amask_no_clip_bgr24g; //----amask_no_clip_bgr24g typedef amask_no_clip_u8<3, 0> amask_no_clip_bgr24b; //----amask_no_clip_bgr24b typedef amask_no_clip_u8<4, 0> amask_no_clip_rgba32r; //----amask_no_clip_rgba32r typedef amask_no_clip_u8<4, 1> amask_no_clip_rgba32g; //----amask_no_clip_rgba32g typedef amask_no_clip_u8<4, 2> amask_no_clip_rgba32b; //----amask_no_clip_rgba32b typedef amask_no_clip_u8<4, 3> amask_no_clip_rgba32a; //----amask_no_clip_rgba32a typedef amask_no_clip_u8<4, 1> amask_no_clip_argb32r; //----amask_no_clip_argb32r typedef amask_no_clip_u8<4, 2> amask_no_clip_argb32g; //----amask_no_clip_argb32g typedef amask_no_clip_u8<4, 3> amask_no_clip_argb32b; //----amask_no_clip_argb32b typedef amask_no_clip_u8<4, 0> amask_no_clip_argb32a; //----amask_no_clip_argb32a typedef amask_no_clip_u8<4, 2> amask_no_clip_bgra32r; //----amask_no_clip_bgra32r typedef amask_no_clip_u8<4, 1> amask_no_clip_bgra32g; //----amask_no_clip_bgra32g typedef amask_no_clip_u8<4, 0> amask_no_clip_bgra32b; //----amask_no_clip_bgra32b typedef amask_no_clip_u8<4, 3> amask_no_clip_bgra32a; //----amask_no_clip_bgra32a typedef amask_no_clip_u8<4, 3> amask_no_clip_abgr32r; //----amask_no_clip_abgr32r typedef amask_no_clip_u8<4, 2> amask_no_clip_abgr32g; //----amask_no_clip_abgr32g typedef amask_no_clip_u8<4, 1> amask_no_clip_abgr32b; //----amask_no_clip_abgr32b typedef amask_no_clip_u8<4, 0> amask_no_clip_abgr32a; //----amask_no_clip_abgr32a typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_rgb24gray; //----amask_no_clip_rgb24gray typedef amask_no_clip_u8<3, 0, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_bgr24gray; //----amask_no_clip_bgr24gray typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_rgba32gray; //----amask_no_clip_rgba32gray typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<0, 1, 2> > amask_no_clip_argb32gray; //----amask_no_clip_argb32gray typedef amask_no_clip_u8<4, 0, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_bgra32gray; //----amask_no_clip_bgra32gray typedef amask_no_clip_u8<4, 1, rgb_to_gray_mask_u8<2, 1, 0> > amask_no_clip_abgr32gray; //----amask_no_clip_abgr32gray } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_segmentator.h0000644000175000017500000000336213233644505025346 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CONV_SEGMENTATOR_INCLUDED #define AGG_CONV_SEGMENTATOR_INCLUDED #include "agg_basics.h" #include "agg_conv_adaptor_vpgen.h" #include "agg_vpgen_segmentator.h" namespace agg24 { //========================================================conv_segmentator template struct conv_segmentator : public conv_adaptor_vpgen { typedef conv_adaptor_vpgen base_type; conv_segmentator(VertexSource& vs) : conv_adaptor_vpgen(vs) {} void approximation_scale(double s) { base_type::vpgen().approximation_scale(s); } double approximation_scale() const { return base_type::vpgen().approximation_scale(); } private: conv_segmentator(const conv_segmentator&); const conv_segmentator& operator = (const conv_segmentator&); }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_pattern_filters_rgba.h0000644000175000017500000001041113233644505026162 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_PATTERN_FILTERS_RGBA8_INCLUDED #define AGG_PATTERN_FILTERS_RGBA8_INCLUDED #include "agg_basics.h" #include "agg_line_aa_basics.h" #include "agg_color_rgba.h" namespace agg24 { //=======================================================pattern_filter_nn template struct pattern_filter_nn { typedef ColorT color_type; static unsigned dilation() { return 0; } static void AGG_INLINE pixel_low_res(color_type const* const* buf, color_type* p, int x, int y) { *p = buf[y][x]; } static void AGG_INLINE pixel_high_res(color_type const* const* buf, color_type* p, int x, int y) { *p = buf[y >> line_subpixel_shift] [x >> line_subpixel_shift]; } }; typedef pattern_filter_nn pattern_filter_nn_rgba8; typedef pattern_filter_nn pattern_filter_nn_rgba16; //===========================================pattern_filter_bilinear_rgba template struct pattern_filter_bilinear_rgba { typedef ColorT color_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; static unsigned dilation() { return 1; } static AGG_INLINE void pixel_low_res(color_type const* const* buf, color_type* p, int x, int y) { *p = buf[y][x]; } static AGG_INLINE void pixel_high_res(color_type const* const* buf, color_type* p, int x, int y) { calc_type r, g, b, a; r = g = b = a = 0; calc_type weight; int x_lr = x >> line_subpixel_shift; int y_lr = y >> line_subpixel_shift; x &= line_subpixel_mask; y &= line_subpixel_mask; const color_type* ptr = buf[y_lr] + x_lr; weight = (line_subpixel_scale - x) * (line_subpixel_scale - y); r += weight * ptr->r; g += weight * ptr->g; b += weight * ptr->b; a += weight * ptr->a; ++ptr; weight = x * (line_subpixel_scale - y); r += weight * ptr->r; g += weight * ptr->g; b += weight * ptr->b; a += weight * ptr->a; ptr = buf[y_lr + 1] + x_lr; weight = (line_subpixel_scale - x) * y; r += weight * ptr->r; g += weight * ptr->g; b += weight * ptr->b; a += weight * ptr->a; ++ptr; weight = x * y; r += weight * ptr->r; g += weight * ptr->g; b += weight * ptr->b; a += weight * ptr->a; p->r = (value_type)color_type::downshift(r, line_subpixel_shift * 2); p->g = (value_type)color_type::downshift(g, line_subpixel_shift * 2); p->b = (value_type)color_type::downshift(b, line_subpixel_shift * 2); p->a = (value_type)color_type::downshift(a, line_subpixel_shift * 2); } }; typedef pattern_filter_bilinear_rgba pattern_filter_bilinear_rgba8; typedef pattern_filter_bilinear_rgba pattern_filter_bilinear_rgba16; typedef pattern_filter_bilinear_rgba pattern_filter_bilinear_rgba32; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_image_filter_gray.h0000644000175000017500000007102213233644505026461 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_IMAGE_FILTER_GRAY_INCLUDED #define AGG_SPAN_IMAGE_FILTER_GRAY_INCLUDED #include "agg_basics.h" #include "agg_color_gray.h" #include "agg_span_image_filter.h" namespace agg24 { //==============================================span_image_filter_gray_nn template class span_image_filter_gray_nn : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_gray_nn() {} span_image_filter_gray_nn(source_type& src, interpolator_type& inter) : base_type(src, inter, 0) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); do { base_type::interpolator().coordinates(&x, &y); span->v = *(const value_type*) base_type::source().span(x >> image_subpixel_shift, y >> image_subpixel_shift, 1); span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //=========================================span_image_filter_gray_bilinear template class span_image_filter_gray_bilinear : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_gray_bilinear() {} span_image_filter_gray_bilinear(source_type& src, interpolator_type& inter) : base_type(src, inter, 0) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg; const value_type *fg_ptr; do { int x_hr; int y_hr; base_type::interpolator().coordinates(&x_hr, &y_hr); x_hr -= base_type::filter_dx_int(); y_hr -= base_type::filter_dy_int(); int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; fg = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); fg += *fg_ptr * (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); fg_ptr = (const value_type*)base_type::source().next_x(); fg += *fg_ptr * x_hr * (image_subpixel_scale - y_hr); fg_ptr = (const value_type*)base_type::source().next_y(); fg += *fg_ptr * (image_subpixel_scale - x_hr) * y_hr; fg_ptr = (const value_type*)base_type::source().next_x(); fg += *fg_ptr * x_hr * y_hr; span->v = color_type::downshift(fg, image_subpixel_shift * 2); span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //====================================span_image_filter_gray_bilinear_clip template class span_image_filter_gray_bilinear_clip : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_gray_bilinear_clip() {} span_image_filter_gray_bilinear_clip(source_type& src, const color_type& back_color, interpolator_type& inter) : base_type(src, inter, 0), m_back_color(back_color) {} const color_type& background_color() const { return m_back_color; } void background_color(const color_type& v) { m_back_color = v; } //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg; long_type src_alpha; value_type back_v = m_back_color.v; value_type back_a = m_back_color.a; const value_type *fg_ptr; int maxx = base_type::source().width() - 1; int maxy = base_type::source().height() - 1; do { int x_hr; int y_hr; base_type::interpolator().coordinates(&x_hr, &y_hr); x_hr -= base_type::filter_dx_int(); y_hr -= base_type::filter_dy_int(); int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; if(x_lr >= 0 && y_lr >= 0 && x_lr < maxx && y_lr < maxy) { fg = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr; fg += *fg_ptr++ * (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); fg += *fg_ptr++ * (image_subpixel_scale - y_hr) * x_hr; ++y_lr; fg_ptr = (const value_type*)base_type::source().row_ptr(y_lr) + x_lr; fg += *fg_ptr++ * (image_subpixel_scale - x_hr) * y_hr; fg += *fg_ptr++ * x_hr * y_hr; fg = color_type::downshift(fg, image_subpixel_shift * 2); src_alpha = color_type::full_value(); } else { unsigned weight; if(x_lr < -1 || y_lr < -1 || x_lr > maxx || y_lr > maxy) { fg = back_v; src_alpha = back_a; } else { fg = src_alpha = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; weight = (image_subpixel_scale - x_hr) * (image_subpixel_scale - y_hr); if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg += weight * *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); src_alpha += weight * color_type::full_value(); } else { fg += back_v * weight; src_alpha += back_a * weight; } x_lr++; weight = x_hr * (image_subpixel_scale - y_hr); if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg += weight * *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); src_alpha += weight * color_type::full_value(); } else { fg += back_v * weight; src_alpha += back_a * weight; } x_lr--; y_lr++; weight = (image_subpixel_scale - x_hr) * y_hr; if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg += weight * *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); src_alpha += weight * color_type::full_value(); } else { fg += back_v * weight; src_alpha += back_a * weight; } x_lr++; weight = x_hr * y_hr; if(x_lr >= 0 && y_lr >= 0 && x_lr <= maxx && y_lr <= maxy) { fg += weight * *((const value_type*)base_type::source().row_ptr(y_lr) + x_lr); src_alpha += weight * color_type::full_value(); } else { fg += back_v * weight; src_alpha += back_a * weight; } fg = color_type::downshift(fg, image_subpixel_shift * 2); src_alpha = color_type::downshift(src_alpha, image_subpixel_shift * 2); } } span->v = (value_type)fg; span->a = (value_type)src_alpha; ++span; ++base_type::interpolator(); } while(--len); } private: color_type m_back_color; }; //==============================================span_image_filter_gray_2x2 template class span_image_filter_gray_2x2 : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_gray_2x2() {} span_image_filter_gray_2x2(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, &filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg; const value_type *fg_ptr; const int16* weight_array = base_type::filter().weight_array() + ((base_type::filter().diameter()/2 - 1) << image_subpixel_shift); do { int x_hr; int y_hr; base_type::interpolator().coordinates(&x_hr, &y_hr); x_hr -= base_type::filter_dx_int(); y_hr -= base_type::filter_dy_int(); int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; unsigned weight; fg = 0; x_hr &= image_subpixel_mask; y_hr &= image_subpixel_mask; fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, 2); weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr + image_subpixel_scale] + image_filter_scale / 2) >> image_filter_shift; fg += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = (weight_array[x_hr] * weight_array[y_hr + image_subpixel_scale] + image_filter_scale / 2) >> image_filter_shift; fg += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_y(); weight = (weight_array[x_hr + image_subpixel_scale] * weight_array[y_hr] + image_filter_scale / 2) >> image_filter_shift; fg += weight * *fg_ptr; fg_ptr = (const value_type*)base_type::source().next_x(); weight = (weight_array[x_hr] * weight_array[y_hr] + image_filter_scale / 2) >> image_filter_shift; fg += weight * *fg_ptr; fg >>= image_filter_shift; if(fg > color_type::full_value()) fg = color_type::full_value(); span->v = (value_type)fg; span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //==================================================span_image_filter_gray template class span_image_filter_gray : public span_image_filter { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef Interpolator interpolator_type; typedef span_image_filter base_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; //-------------------------------------------------------------------- span_image_filter_gray() {} span_image_filter_gray(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, &filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg; const value_type *fg_ptr; unsigned diameter = base_type::filter().diameter(); int start = base_type::filter().start(); const int16* weight_array = base_type::filter().weight_array(); int x_count; int weight_y; do { base_type::interpolator().coordinates(&x, &y); x -= base_type::filter_dx_int(); y -= base_type::filter_dy_int(); int x_hr = x; int y_hr = y; int x_lr = x_hr >> image_subpixel_shift; int y_lr = y_hr >> image_subpixel_shift; fg = 0; int x_fract = x_hr & image_subpixel_mask; unsigned y_count = diameter; y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask); fg_ptr = (const value_type*)base_type::source().span(x_lr + start, y_lr + start, diameter); for(;;) { x_count = diameter; weight_y = weight_array[y_hr]; x_hr = image_subpixel_mask - x_fract; for(;;) { fg += *fg_ptr * ((weight_y * weight_array[x_hr] + image_filter_scale / 2) >> image_filter_shift); if(--x_count == 0) break; x_hr += image_subpixel_scale; fg_ptr = (const value_type*)base_type::source().next_x(); } if(--y_count == 0) break; y_hr += image_subpixel_scale; fg_ptr = (const value_type*)base_type::source().next_y(); } fg = color_type::downshift(fg, image_filter_shift); if(fg < 0) fg = 0; if(fg > color_type::full_value()) fg = color_type::full_value(); span->v = (value_type)fg; span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //=========================================span_image_resample_gray_affine template class span_image_resample_gray_affine : public span_image_resample_affine { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef span_image_resample_affine base_type; typedef typename base_type::interpolator_type interpolator_type; typedef typename color_type::value_type value_type; typedef typename color_type::long_type long_type; enum base_scale_e { downscale_shift = image_filter_shift }; //-------------------------------------------------------------------- span_image_resample_gray_affine() {} span_image_resample_gray_affine(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg; int diameter = base_type::filter().diameter(); int filter_scale = diameter << image_subpixel_shift; int radius_x = (diameter * base_type::m_rx) >> 1; int radius_y = (diameter * base_type::m_ry) >> 1; int len_x_lr = (diameter * base_type::m_rx + image_subpixel_mask) >> image_subpixel_shift; const int16* weight_array = base_type::filter().weight_array(); do { base_type::interpolator().coordinates(&x, &y); x += base_type::filter_dx_int() - radius_x; y += base_type::filter_dy_int() - radius_y; fg = 0; int y_lr = y >> image_subpixel_shift; int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * base_type::m_ry_inv) >> image_subpixel_shift; int total_weight = 0; int x_lr = x >> image_subpixel_shift; int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * base_type::m_rx_inv) >> image_subpixel_shift; int x_hr2 = x_hr; const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); for(;;) { int weight_y = weight_array[y_hr]; x_hr = x_hr2; for(;;) { int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; fg += *fg_ptr * weight; total_weight += weight; x_hr += base_type::m_rx_inv; if(x_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_x(); } y_hr += base_type::m_ry_inv; if(y_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_y(); } fg /= total_weight; if(fg < 0) fg = 0; if(fg > color_type::full_value()) fg = color_type::full_value(); span->v = (value_type)fg; span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; //================================================span_image_resample_gray template class span_image_resample_gray : public span_image_resample { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef Interpolator interpolator_type; typedef span_image_resample base_type; typedef typename color_type::value_type value_type; typedef typename color_type::long_type long_type; enum base_scale_e { downscale_shift = image_filter_shift }; //-------------------------------------------------------------------- span_image_resample_gray() {} span_image_resample_gray(source_type& src, interpolator_type& inter, image_filter_lut& filter) : base_type(src, inter, filter) {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { base_type::interpolator().begin(x + base_type::filter_dx_dbl(), y + base_type::filter_dy_dbl(), len); long_type fg; int diameter = base_type::filter().diameter(); int filter_scale = diameter << image_subpixel_shift; const int16* weight_array = base_type::filter().weight_array(); do { int rx; int ry; int rx_inv = image_subpixel_scale; int ry_inv = image_subpixel_scale; base_type::interpolator().coordinates(&x, &y); base_type::interpolator().local_scale(&rx, &ry); base_type::adjust_scale(&rx, &ry); rx_inv = image_subpixel_scale * image_subpixel_scale / rx; ry_inv = image_subpixel_scale * image_subpixel_scale / ry; int radius_x = (diameter * rx) >> 1; int radius_y = (diameter * ry) >> 1; int len_x_lr = (diameter * rx + image_subpixel_mask) >> image_subpixel_shift; x += base_type::filter_dx_int() - radius_x; y += base_type::filter_dy_int() - radius_y; fg = 0; int y_lr = y >> image_subpixel_shift; int y_hr = ((image_subpixel_mask - (y & image_subpixel_mask)) * ry_inv) >> image_subpixel_shift; int total_weight = 0; int x_lr = x >> image_subpixel_shift; int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) * rx_inv) >> image_subpixel_shift; int x_hr2 = x_hr; const value_type* fg_ptr = (const value_type*)base_type::source().span(x_lr, y_lr, len_x_lr); for(;;) { int weight_y = weight_array[y_hr]; x_hr = x_hr2; for(;;) { int weight = (weight_y * weight_array[x_hr] + image_filter_scale / 2) >> downscale_shift; fg += *fg_ptr * weight; total_weight += weight; x_hr += rx_inv; if(x_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_x(); } y_hr += ry_inv; if(y_hr >= filter_scale) break; fg_ptr = (const value_type*)base_type::source().next_y(); } fg /= total_weight; if(fg < 0) fg = 0; if(fg > color_type::full_value()) fg = color_type::full_value(); span->v = (value_type)fg; span->a = color_type::full_value(); ++span; ++base_type::interpolator(); } while(--len); } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_interpolator_trans.h0000644000175000017500000000617213233644505026745 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Horizontal span interpolator for use with an arbitrary transformer // The efficiency highly depends on the operations done in the transformer // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_INTERPOLATOR_TRANS_INCLUDED #define AGG_SPAN_INTERPOLATOR_TRANS_INCLUDED #include "agg_basics.h" namespace agg24 { //=================================================span_interpolator_trans template class span_interpolator_trans { public: typedef Transformer trans_type; enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; //-------------------------------------------------------------------- span_interpolator_trans() {} span_interpolator_trans(trans_type& trans) : m_trans(&trans) {} span_interpolator_trans(trans_type& trans, double x, double y, unsigned) : m_trans(&trans) { begin(x, y, 0); } //---------------------------------------------------------------- const trans_type& transformer() const { return *m_trans; } void transformer(const trans_type& trans) { m_trans = &trans; } //---------------------------------------------------------------- void begin(double x, double y, unsigned) { m_x = x; m_y = y; m_trans->transform(&x, &y); m_ix = iround(x * subpixel_scale); m_iy = iround(y * subpixel_scale); } //---------------------------------------------------------------- void operator++() { m_x += 1.0; double x = m_x; double y = m_y; m_trans->transform(&x, &y); m_ix = iround(x * subpixel_scale); m_iy = iround(y * subpixel_scale); } //---------------------------------------------------------------- void coordinates(int* x, int* y) const { *x = m_ix; *y = m_iy; } private: trans_type* m_trans; double m_x; double m_y; int m_ix; int m_iy; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/Makefile.am0000644000175000017500000000705313233644505023037 0ustar varunvarunSUBDIRS = ctrl util platform aggincludedir = $(includedir)/agg2 agginclude_HEADERS = \ agg_alpha_mask_u8.h agg_glyph_raster_bin.h agg_span_allocator.h \ agg_arc.h agg_gsv_text.h agg_span_converter.h \ agg_array.h agg_image_accessors.h agg_span_gouraud.h \ agg_arrowhead.h agg_image_filters.h agg_span_gouraud_gray.h \ agg_basics.h agg_line_aa_basics.h agg_span_gouraud_rgba.h \ agg_bezier_arc.h agg_math.h agg_span_gradient.h \ agg_bitset_iterator.h agg_math_stroke.h agg_span_gradient_alpha.h \ agg_bounding_rect.h agg_path_length.h agg_span_image_filter.h \ agg_bspline.h agg_path_storage.h agg_span_image_filter_gray.h \ agg_clip_liang_barsky.h agg_path_storage_integer.h agg_span_image_filter_rgb.h \ agg_color_gray.h agg_pattern_filters_rgba.h agg_span_image_filter_rgba.h \ agg_color_rgba.h agg_pixfmt_amask_adaptor.h agg_span_interpolator_adaptor.h \ agg_config.h agg_pixfmt_gray.h agg_span_interpolator_linear.h \ agg_conv_adaptor_vcgen.h agg_pixfmt_rgb.h agg_span_interpolator_persp.h \ agg_conv_adaptor_vpgen.h agg_pixfmt_rgb_packed.h agg_span_interpolator_trans.h \ agg_conv_bspline.h agg_pixfmt_rgba.h agg_span_pattern_gray.h \ agg_conv_clip_polygon.h agg_rasterizer_cells_aa.h agg_span_pattern_rgb.h \ agg_conv_clip_polyline.h agg_rasterizer_compound_aa.h agg_span_pattern_rgba.h \ agg_conv_close_polygon.h agg_rasterizer_outline.h agg_span_solid.h \ agg_conv_concat.h agg_rasterizer_outline_aa.h agg_span_subdiv_adaptor.h \ agg_conv_contour.h agg_rasterizer_scanline_aa.h agg_trans_affine.h \ agg_conv_curve.h agg_rasterizer_sl_clip.h agg_trans_bilinear.h \ agg_conv_dash.h agg_renderer_base.h agg_trans_double_path.h \ agg_renderer_markers.h agg_trans_lens.h \ agg_conv_marker.h agg_renderer_mclip.h agg_trans_perspective.h \ agg_conv_marker_adaptor.h agg_renderer_outline_aa.h agg_trans_single_path.h \ agg_conv_segmentator.h agg_renderer_outline_image.h agg_trans_viewport.h \ agg_conv_shorten_path.h agg_renderer_primitives.h agg_trans_warp_magnifier.h \ agg_conv_smooth_poly1.h agg_renderer_raster_text.h agg_vcgen_bspline.h \ agg_conv_stroke.h agg_renderer_scanline.h agg_vcgen_contour.h \ agg_conv_transform.h agg_rendering_buffer.h agg_vcgen_dash.h \ agg_conv_unclose_polygon.h agg_rendering_buffer_dynarow.h agg_vcgen_markers_term.h \ agg_curves.h agg_rounded_rect.h agg_vcgen_smooth_poly1.h \ agg_scanline_bin.h agg_vcgen_stroke.h \ agg_dda_line.h agg_scanline_boolean_algebra.h agg_vcgen_vertex_sequence.h \ agg_ellipse.h agg_scanline_p.h agg_vertex_sequence.h \ agg_ellipse_bresenham.h agg_scanline_storage_aa.h agg_vpgen_clip_polygon.h \ agg_embedded_raster_fonts.h agg_scanline_storage_bin.h agg_vpgen_clip_polyline.h \ agg_font_cache_manager.h agg_scanline_u.h agg_vpgen_segmentator.h \ agg_gamma_functions.h agg_shorten_path.h \ agg_gamma_lut.h agg_simul_eq.h enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_clip_liang_barsky.h0000644000175000017500000002335113233644505025445 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Liang-Barsky clipping // //---------------------------------------------------------------------------- #ifndef AGG_CLIP_LIANG_BARSKY_INCLUDED #define AGG_CLIP_LIANG_BARSKY_INCLUDED #include "agg_basics.h" namespace agg24 { //------------------------------------------------------------------------ enum clipping_flags_e { clipping_flags_x1_clipped = 4, clipping_flags_x2_clipped = 1, clipping_flags_y1_clipped = 8, clipping_flags_y2_clipped = 2, clipping_flags_x_clipped = clipping_flags_x1_clipped | clipping_flags_x2_clipped, clipping_flags_y_clipped = clipping_flags_y1_clipped | clipping_flags_y2_clipped }; //----------------------------------------------------------clipping_flags // Determine the clipping code of the vertex according to the // Cyrus-Beck line clipping algorithm // // | | // 0110 | 0010 | 0011 // | | // -------+--------+-------- clip_box.y2 // | | // 0100 | 0000 | 0001 // | | // -------+--------+-------- clip_box.y1 // | | // 1100 | 1000 | 1001 // | | // clip_box.x1 clip_box.x2 // // template inline unsigned clipping_flags(T x, T y, const rect_base& clip_box) { return (x > clip_box.x2) | ((y > clip_box.y2) << 1) | ((x < clip_box.x1) << 2) | ((y < clip_box.y1) << 3); } //--------------------------------------------------------clipping_flags_x template inline unsigned clipping_flags_x(T x, const rect_base& clip_box) { return (x > clip_box.x2) | ((x < clip_box.x1) << 2); } //--------------------------------------------------------clipping_flags_y template inline unsigned clipping_flags_y(T y, const rect_base& clip_box) { return ((y > clip_box.y2) << 1) | ((y < clip_box.y1) << 3); } //-------------------------------------------------------clip_liang_barsky template inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, const rect_base& clip_box, T* x, T* y) { const double nearzero = 1e-30; double deltax = x2 - x1; double deltay = y2 - y1; double xin; double xout; double yin; double yout; double tinx; double tiny; double toutx; double touty; double tin1; double tin2; double tout1; unsigned np = 0; if(deltax == 0.0) { // bump off of the vertical deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; } if(deltay == 0.0) { // bump off of the horizontal deltay = (y1 > clip_box.y1) ? -nearzero : nearzero; } if(deltax > 0.0) { // points to right xin = clip_box.x1; xout = clip_box.x2; } else { xin = clip_box.x2; xout = clip_box.x1; } if(deltay > 0.0) { // points up yin = clip_box.y1; yout = clip_box.y2; } else { yin = clip_box.y2; yout = clip_box.y1; } tinx = (xin - x1) / deltax; tiny = (yin - y1) / deltay; if (tinx < tiny) { // hits x first tin1 = tinx; tin2 = tiny; } else { // hits y first tin1 = tiny; tin2 = tinx; } if(tin1 <= 1.0) { if(0.0 < tin1) { *x++ = (T)xin; *y++ = (T)yin; ++np; } if(tin2 <= 1.0) { toutx = (xout - x1) / deltax; touty = (yout - y1) / deltay; tout1 = (toutx < touty) ? toutx : touty; if(tin2 > 0.0 || tout1 > 0.0) { if(tin2 <= tout1) { if(tin2 > 0.0) { if(tinx > tiny) { *x++ = (T)xin; *y++ = (T)(y1 + tinx * deltay); } else { *x++ = (T)(x1 + tiny * deltax); *y++ = (T)yin; } ++np; } if(tout1 < 1.0) { if(toutx < touty) { *x++ = (T)xout; *y++ = (T)(y1 + toutx * deltay); } else { *x++ = (T)(x1 + touty * deltax); *y++ = (T)yout; } } else { *x++ = x2; *y++ = y2; } ++np; } else { if(tinx > tiny) { *x++ = (T)xin; *y++ = (T)yout; } else { *x++ = (T)xout; *y++ = (T)yin; } ++np; } } } } return np; } //---------------------------------------------------------------------------- template bool clip_move_point(T x1, T y1, T x2, T y2, const rect_base& clip_box, T* x, T* y, unsigned flags) { T bound; if(flags & clipping_flags_x_clipped) { if(x1 == x2) { return false; } bound = (flags & clipping_flags_x1_clipped) ? clip_box.x1 : clip_box.x2; *y = (T)(double(bound - x1) * (y2 - y1) / (x2 - x1) + y1); *x = bound; } flags = clipping_flags_y(*y, clip_box); if(flags & clipping_flags_y_clipped) { if(y1 == y2) { return false; } bound = (flags & clipping_flags_y1_clipped) ? clip_box.y1 : clip_box.y2; *x = (T)(double(bound - y1) * (x2 - x1) / (y2 - y1) + x1); *y = bound; } return true; } //-------------------------------------------------------clip_line_segment // Returns: ret >= 4 - Fully clipped // (ret & 1) != 0 - First point has been moved // (ret & 2) != 0 - Second point has been moved // template unsigned clip_line_segment(T* x1, T* y1, T* x2, T* y2, const rect_base& clip_box) { unsigned f1 = clipping_flags(*x1, *y1, clip_box); unsigned f2 = clipping_flags(*x2, *y2, clip_box); unsigned ret = 0; if((f2 | f1) == 0) { // Fully visible return 0; } if((f1 & clipping_flags_x_clipped) != 0 && (f1 & clipping_flags_x_clipped) == (f2 & clipping_flags_x_clipped)) { // Fully clipped return 4; } if((f1 & clipping_flags_y_clipped) != 0 && (f1 & clipping_flags_y_clipped) == (f2 & clipping_flags_y_clipped)) { // Fully clipped return 4; } T tx1 = *x1; T ty1 = *y1; T tx2 = *x2; T ty2 = *y2; if(f1) { if(!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x1, y1, f1)) { return 4; } if(*x1 == *x2 && *y1 == *y2) { return 4; } ret |= 1; } if(f2) { if(!clip_move_point(tx1, ty1, tx2, ty2, clip_box, x2, y2, f2)) { return 4; } if(*x1 == *x2 && *y1 == *y2) { return 4; } ret |= 2; } return ret; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rendering_buffer.h0000644000175000017500000002411113233644505025272 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class rendering_buffer // //---------------------------------------------------------------------------- #ifndef AGG_RENDERING_BUFFER_INCLUDED #define AGG_RENDERING_BUFFER_INCLUDED #include "agg_array.h" namespace agg24 { //===========================================================row_accessor template class row_accessor { public: typedef const_row_info row_data; //------------------------------------------------------------------- row_accessor() : m_buf(0), m_start(0), m_width(0), m_height(0), m_stride(0) { } //-------------------------------------------------------------------- row_accessor(T* buf, unsigned width, unsigned height, int stride) : m_buf(0), m_start(0), m_width(0), m_height(0), m_stride(0) { attach(buf, width, height, stride); } //-------------------------------------------------------------------- void attach(T* buf, unsigned width, unsigned height, int stride) { m_buf = m_start = buf; m_width = width; m_height = height; m_stride = stride; if(stride < 0) { m_start = m_buf - (AGG_INT64)(height - 1) * stride; } } //-------------------------------------------------------------------- AGG_INLINE T* buf() { return m_buf; } AGG_INLINE const T* buf() const { return m_buf; } AGG_INLINE unsigned width() const { return m_width; } AGG_INLINE unsigned height() const { return m_height; } AGG_INLINE int stride() const { return m_stride; } AGG_INLINE unsigned stride_abs() const { return (m_stride < 0) ? unsigned(-m_stride) : unsigned(m_stride); } //-------------------------------------------------------------------- AGG_INLINE T* row_ptr(int, int y, unsigned) { return m_start + y * (AGG_INT64)m_stride; } AGG_INLINE T* row_ptr(int y) { return m_start + y * (AGG_INT64)m_stride; } AGG_INLINE const T* row_ptr(int y) const { return m_start + y * (AGG_INT64)m_stride; } AGG_INLINE row_data row (int y) const { return row_data(0, m_width-1, row_ptr(y)); } //-------------------------------------------------------------------- template void copy_from(const RenBuf& src) { unsigned h = height(); if(src.height() < h) h = src.height(); unsigned l = stride_abs(); if(src.stride_abs() < l) l = src.stride_abs(); l *= sizeof(T); unsigned y; unsigned w = width(); for (y = 0; y < h; y++) { memcpy(row_ptr(0, y, w), src.row_ptr(y), l); } } //-------------------------------------------------------------------- void clear(T value) { unsigned y; unsigned w = width(); unsigned stride = stride_abs(); for(y = 0; y < height(); y++) { T* p = row_ptr(0, y, w); unsigned x; for(x = 0; x < stride; x++) { *p++ = value; } } } private: //-------------------------------------------------------------------- T* m_buf; // Pointer to renrdering buffer T* m_start; // Pointer to first pixel depending on stride unsigned m_width; // Width in pixels unsigned m_height; // Height in pixels int m_stride; // Number of bytes per row. Can be < 0 }; //==========================================================row_ptr_cache template class row_ptr_cache { public: typedef const_row_info row_data; //------------------------------------------------------------------- row_ptr_cache() : m_buf(0), m_rows(), m_width(0), m_height(0), m_stride(0) { } //-------------------------------------------------------------------- row_ptr_cache(T* buf, unsigned width, unsigned height, int stride) : m_buf(0), m_rows(), m_width(0), m_height(0), m_stride(0) { attach(buf, width, height, stride); } //-------------------------------------------------------------------- void attach(T* buf, unsigned width, unsigned height, int stride) { m_buf = buf; m_width = width; m_height = height; m_stride = stride; if(height > m_rows.size()) { m_rows.resize(height); } T* row_ptr = m_buf; if(stride < 0) { row_ptr = m_buf - (AGG_INT64)(height - 1) * stride; } T** rows = &m_rows[0]; while(height--) { *rows++ = row_ptr; row_ptr += stride; } } //-------------------------------------------------------------------- AGG_INLINE T* buf() { return m_buf; } AGG_INLINE const T* buf() const { return m_buf; } AGG_INLINE unsigned width() const { return m_width; } AGG_INLINE unsigned height() const { return m_height; } AGG_INLINE int stride() const { return m_stride; } AGG_INLINE unsigned stride_abs() const { return (m_stride < 0) ? unsigned(-m_stride) : unsigned(m_stride); } //-------------------------------------------------------------------- AGG_INLINE T* row_ptr(int, int y, unsigned) { return m_rows[y]; } AGG_INLINE T* row_ptr(int y) { return m_rows[y]; } AGG_INLINE const T* row_ptr(int y) const { return m_rows[y]; } AGG_INLINE row_data row (int y) const { return row_data(0, m_width-1, m_rows[y]); } //-------------------------------------------------------------------- T const* const* rows() const { return &m_rows[0]; } //-------------------------------------------------------------------- template void copy_from(const RenBuf& src) { unsigned h = height(); if(src.height() < h) h = src.height(); unsigned l = stride_abs(); if(src.stride_abs() < l) l = src.stride_abs(); l *= sizeof(T); unsigned y; unsigned w = width(); for (y = 0; y < h; y++) { memcpy(row_ptr(0, y, w), src.row_ptr(y), l); } } //-------------------------------------------------------------------- void clear(T value) { unsigned y; unsigned w = width(); unsigned stride = stride_abs(); for(y = 0; y < height(); y++) { T* p = row_ptr(0, y, w); unsigned x; for(x = 0; x < stride; x++) { *p++ = value; } } } private: //-------------------------------------------------------------------- T* m_buf; // Pointer to renrdering buffer pod_array m_rows; // Pointers to each row of the buffer unsigned m_width; // Width in pixels unsigned m_height; // Height in pixels int m_stride; // Number of bytes per row. Can be < 0 }; //========================================================rendering_buffer // // The definition of the main type for accessing the rows in the frame // buffer. It provides functionality to navigate to the rows in a // rectangular matrix, from top to bottom or from bottom to top depending // on stride. // // row_accessor is cheap to create/destroy, but performs one multiplication // when calling row_ptr(). // // row_ptr_cache creates an array of pointers to rows, so, the access // via row_ptr() may be faster. But it requires memory allocation // when creating. For example, on typical Intel Pentium hardware // row_ptr_cache speeds span_image_filter_rgb_nn up to 10% // // It's used only in short hand typedefs like pixfmt_rgba32 and can be // redefined in agg_config.h // In real applications you can use both, depending on your needs //------------------------------------------------------------------------ #ifdef AGG_RENDERING_BUFFER typedef AGG_RENDERING_BUFFER rendering_buffer; #else // typedef row_ptr_cache rendering_buffer; typedef row_accessor rendering_buffer; #endif } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_gradient_contour.h0000644000175000017500000001702613233644505026362 0ustar varunvarun//---------------------------------------------------------------------------- // AGG Contribution Pack - Gradients 1 (AGG CP - Gradients 1) // http://milan.marusinec.sk/aggcp // // For Anti-Grain Geometry - Version 2.4 // http://www.antigrain.org // // Contribution Created By: // Milan Marusinec alias Milano // milan@marusinec.sk // Copyright (c) 2007-2008 // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // // [History] ----------------------------------------------------------------- // // 02.02.2008-Milano: Ported from Object Pascal code of AggPas // #ifndef AGG_SPAN_GRADIENT_CONTOUR_INCLUDED #define AGG_SPAN_GRADIENT_CONTOUR_INCLUDED #include "agg_basics.h" #include "agg_trans_affine.h" #include "agg_path_storage.h" #include "agg_pixfmt_gray.h" #include "agg_conv_transform.h" #include "agg_conv_curve.h" #include "agg_bounding_rect.h" #include "agg_renderer_base.h" #include "agg_renderer_primitives.h" #include "agg_rasterizer_outline.h" #include "agg_span_gradient.h" #define infinity 1E20 namespace agg24 { //==========================================================gradient_contour class gradient_contour { private: int8u* m_buffer; int m_width; int m_height; int m_frame; double m_d1; double m_d2; public: gradient_contour() : m_buffer(NULL), m_width(0), m_height(0), m_frame(10), m_d1(0), m_d2(100) { } gradient_contour(double d1, double d2) : m_buffer(NULL), m_width(0), m_height(0), m_frame(10), m_d1(d1), m_d2(d2) { } ~gradient_contour() { if (m_buffer) { delete [] m_buffer; } } int8u* contour_create(path_storage* ps ); int contour_width() { return m_width; } int contour_height() { return m_height; } void d1(double d ) { m_d1 = d; } void d2(double d ) { m_d2 = d; } void frame(int f ) { m_frame = f; } int frame() { return m_frame; } int calculate(int x, int y, int d) const { if (m_buffer) { int px = x >> agg24::gradient_subpixel_shift; int py = y >> agg24::gradient_subpixel_shift; px %= m_width; if (px < 0) { px += m_width; } py %= m_height; if (py < 0 ) { py += m_height; } return iround(m_buffer[py * m_width + px ] * (m_d2 / 256 ) + m_d1 ) << gradient_subpixel_shift; } else { return 0; } } }; static AGG_INLINE int square(int x ) { return x * x; } // DT algorithm by: Pedro Felzenszwalb void dt(float* spanf, float* spang, float* spanr, int* spann ,int length ) { int k = 0; float s; spann[0 ] = 0; spang[0 ] = float(-infinity ); spang[1 ] = float(+infinity ); for (int q = 1; q <= length - 1; q++) { s = ((spanf[q ] + square(q ) ) - (spanf[spann[k ] ] + square(spann[k ] ) ) ) / (2 * q - 2 * spann[k ] ); while (s <= spang[k ]) { k--; s = ((spanf[q ] + square(q ) ) - (spanf[spann[k ] ] + square(spann[k ] ) ) ) / (2 * q - 2 * spann[k ] ); } k++; spann[k ] = q; spang[k ] = s; spang[k + 1 ] = float(+infinity); } k = 0; for (int q = 0; q <= length - 1; q++) { while (spang[k + 1 ] < q ) { k++; } spanr[q ] = square(q - spann[k ] ) + spanf[spann[k ] ]; } } // DT algorithm by: Pedro Felzenszwalb int8u* gradient_contour::contour_create(path_storage* ps ) { int8u* result = NULL; if (ps) { // I. Render Black And White NonAA Stroke of the Path // Path Bounding Box + Some Frame Space Around [configurable] agg24::conv_curve conv(*ps); double x1, y1, x2, y2; if (agg24::bounding_rect_single(conv ,0 ,&x1 ,&y1 ,&x2 ,&y2 )) { // Create BW Rendering Surface int width = int(ceil(x2 - x1 ) ) + m_frame * 2 + 1; int height = int(ceil(y2 - y1 ) ) + m_frame * 2 + 1; int8u* buffer = new int8u[width * height]; if (buffer) { memset(buffer ,255 ,width * height ); // Setup VG Engine & Render agg24::rendering_buffer rb; rb.attach(buffer ,width ,height ,width ); agg24::pixfmt_gray8 pf(rb); agg24::renderer_base renb(pf ); agg24::renderer_primitives > prim(renb ); agg24::rasterizer_outline > > ras(prim ); agg24::trans_affine mtx; mtx *= agg24::trans_affine_translation(-x1 + m_frame, -y1 + m_frame ); agg24::conv_transform > trans(conv ,mtx ); prim.line_color(agg24::rgba8(0 ,0 ,0 ,255 ) ); ras.add_path(trans ); // II. Distance Transform // Create Float Buffer + 0 vs infinity (1e20) assignment float* image = new float[width * height]; if (image) { for (int y = 0, l = 0; y < height; y++ ) { for (int x = 0; x < width; x++, l++ ) { if (buffer[l ] == 0) { image[l ] = 0.0; } else { image[l ] = float(infinity ); } } } // DT of 2d // SubBuff max width,height int length = width; if (height > length) { length = height; } float* spanf = new float[length]; float* spang = new float[length + 1]; float* spanr = new float[length]; int* spann = new int[length]; if ((spanf) && (spang) && (spanr) && (spann)) { // Transform along columns for (int x = 0; x < width; x++ ) { for (int y = 0; y < height; y++ ) { spanf[y] = image[y * width + x]; } // DT of 1d dt(spanf ,spang ,spanr ,spann ,height ); for (int y = 0; y < height; y++ ) { image[y * width + x] = spanr[y]; } } // Transform along rows for (int y = 0; y < height; y++ ) { for (int x = 0; x < width; x++ ) { spanf[x] = image[y * width + x]; } // DT of 1d dt(spanf ,spang ,spanr ,spann ,width ); for (int x = 0; x < width; x++ ) { image[y * width + x] = spanr[x]; } } // Take Square Roots, Min & Max float min = sqrt(image[0] ); float max = min; for (int y = 0, l = 0; y < height; y++ ) { for (int x = 0; x < width; x++, l++ ) { image[l] = sqrt(image[l]); if (min > image[l]) { min = image[l]; } if (max < image[l]) { max = image[l]; } } } // III. Convert To Grayscale if (min == max) { memset(buffer ,0 ,width * height ); } else { float scale = 255 / (max - min ); for (int y = 0, l = 0; y < height; y++ ) { for (int x = 0; x < width; x++ ,l++ ) { buffer[l] = int8u(int((image[l] - min ) * scale )); } } } // OK if (m_buffer) { delete [] m_buffer; } m_buffer = buffer; m_width = width; m_height = height; buffer = NULL; result = m_buffer; } if (spanf) { delete [] spanf; } if (spang) { delete [] spang; } if (spanr) { delete [] spanr; } if (spann) { delete [] spann; } delete [] image; } } if (buffer) { delete [] buffer; } } } return result; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_trans_perspective.h0000644000175000017500000006311113233644505025527 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Perspective 2D transformations // //---------------------------------------------------------------------------- #ifndef AGG_TRANS_PERSPECTIVE_INCLUDED #define AGG_TRANS_PERSPECTIVE_INCLUDED #include "agg_trans_affine.h" namespace agg24 { //=======================================================trans_perspective struct trans_perspective { double sx, shy, w0, shx, sy, w1, tx, ty, w2; //------------------------------------------------------- Construction // Identity matrix trans_perspective() : sx (1), shy(0), w0(0), shx(0), sy (1), w1(0), tx (0), ty (0), w2(1) {} // Custom matrix trans_perspective(double v0, double v1, double v2, double v3, double v4, double v5, double v6, double v7, double v8) : sx (v0), shy(v1), w0(v2), shx(v3), sy (v4), w1(v5), tx (v6), ty (v7), w2(v8) {} // Custom matrix from m[9] explicit trans_perspective(const double* m) : sx (m[0]), shy(m[1]), w0(m[2]), shx(m[3]), sy (m[4]), w1(m[5]), tx (m[6]), ty (m[7]), w2(m[8]) {} // From affine explicit trans_perspective(const trans_affine& a) : sx (a.sx ), shy(a.shy), w0(0), shx(a.shx), sy (a.sy ), w1(0), tx (a.tx ), ty (a.ty ), w2(1) {} // Rectangle to quadrilateral trans_perspective(double x1, double y1, double x2, double y2, const double* quad); // Quadrilateral to rectangle trans_perspective(const double* quad, double x1, double y1, double x2, double y2); // Arbitrary quadrilateral transformations trans_perspective(const double* src, const double* dst); //-------------------------------------- Quadrilateral transformations // The arguments are double[8] that are mapped to quadrilaterals: // x1,y1, x2,y2, x3,y3, x4,y4 bool quad_to_quad(const double* qs, const double* qd); bool rect_to_quad(double x1, double y1, double x2, double y2, const double* q); bool quad_to_rect(const double* q, double x1, double y1, double x2, double y2); // Map square (0,0,1,1) to the quadrilateral and vice versa bool square_to_quad(const double* q); bool quad_to_square(const double* q); //--------------------------------------------------------- Operations // Reset - load an identity matrix const trans_perspective& reset(); // Invert matrix. Returns false in degenerate case bool invert(); // Direct transformations operations const trans_perspective& translate(double x, double y); const trans_perspective& rotate(double a); const trans_perspective& scale(double s); const trans_perspective& scale(double x, double y); // Multiply the matrix by another one const trans_perspective& multiply(const trans_perspective& m); // Multiply "m" by "this" and assign the result to "this" const trans_perspective& premultiply(const trans_perspective& m); // Multiply matrix to inverse of another one const trans_perspective& multiply_inv(const trans_perspective& m); // Multiply inverse of "m" by "this" and assign the result to "this" const trans_perspective& premultiply_inv(const trans_perspective& m); // Multiply the matrix by another one const trans_perspective& multiply(const trans_affine& m); // Multiply "m" by "this" and assign the result to "this" const trans_perspective& premultiply(const trans_affine& m); // Multiply the matrix by inverse of another one const trans_perspective& multiply_inv(const trans_affine& m); // Multiply inverse of "m" by "this" and assign the result to "this" const trans_perspective& premultiply_inv(const trans_affine& m); //--------------------------------------------------------- Load/Store void store_to(double* m) const; const trans_perspective& load_from(const double* m); //---------------------------------------------------------- Operators // Multiply the matrix by another one const trans_perspective& operator *= (const trans_perspective& m) { return multiply(m); } const trans_perspective& operator *= (const trans_affine& m) { return multiply(m); } // Multiply the matrix by inverse of another one const trans_perspective& operator /= (const trans_perspective& m) { return multiply_inv(m); } const trans_perspective& operator /= (const trans_affine& m) { return multiply_inv(m); } // Multiply the matrix by another one and return // the result in a separete matrix. trans_perspective operator * (const trans_perspective& m) const { return trans_perspective(*this).multiply(m); } trans_perspective operator * (const trans_affine& m) const { return trans_perspective(*this).multiply(m); } // Multiply the matrix by inverse of another one // and return the result in a separete matrix. trans_perspective operator / (const trans_perspective& m) const { return trans_perspective(*this).multiply_inv(m); } trans_perspective operator / (const trans_affine& m) const { return trans_perspective(*this).multiply_inv(m); } // Calculate and return the inverse matrix trans_perspective operator ~ () const { trans_perspective ret = *this; ret.invert(); return ret; } // Equal operator with default epsilon bool operator == (const trans_perspective& m) const { return is_equal(m, affine_epsilon); } // Not Equal operator with default epsilon bool operator != (const trans_perspective& m) const { return !is_equal(m, affine_epsilon); } //---------------------------------------------------- Transformations // Direct transformation of x and y void transform(double* x, double* y) const; // Direct transformation of x and y, affine part only void transform_affine(double* x, double* y) const; // Direct transformation of x and y, 2x2 matrix only, no translation void transform_2x2(double* x, double* y) const; // Inverse transformation of x and y. It works slow because // it explicitly inverts the matrix on every call. For massive // operations it's better to invert() the matrix and then use // direct transformations. void inverse_transform(double* x, double* y) const; //---------------------------------------------------------- Auxiliary const trans_perspective& from_affine(const trans_affine& a); double determinant() const; double determinant_reciprocal() const; bool is_valid(double epsilon = affine_epsilon) const; bool is_identity(double epsilon = affine_epsilon) const; bool is_equal(const trans_perspective& m, double epsilon = affine_epsilon) const; // Determine the major affine parameters. Use with caution // considering possible degenerate cases. double scale() const; double rotation() const; void translation(double* dx, double* dy) const; void scaling(double* x, double* y) const; void scaling_abs(double* x, double* y) const; //-------------------------------------------------------------------- class iterator_x { double den; double den_step; double nom_x; double nom_x_step; double nom_y; double nom_y_step; public: double x; double y; iterator_x() {} iterator_x(double px, double py, double step, const trans_perspective& m) : den(px * m.w0 + py * m.w1 + m.w2), den_step(m.w0 * step), nom_x(px * m.sx + py * m.shx + m.tx), nom_x_step(step * m.sx), nom_y(px * m.shy + py * m.sy + m.ty), nom_y_step(step * m.shy), x(nom_x / den), y(nom_y / den) {} void operator ++ () { den += den_step; nom_x += nom_x_step; nom_y += nom_y_step; double d = 1.0 / den; x = nom_x * d; y = nom_y * d; } }; //-------------------------------------------------------------------- iterator_x begin(double x, double y, double step) const { return iterator_x(x, y, step, *this); } }; //------------------------------------------------------------------------ inline bool trans_perspective::square_to_quad(const double* q) { double dx = q[0] - q[2] + q[4] - q[6]; double dy = q[1] - q[3] + q[5] - q[7]; if(dx == 0.0 && dy == 0.0) { // Affine case (parallelogram) //--------------- sx = q[2] - q[0]; shy = q[3] - q[1]; w0 = 0.0; shx = q[4] - q[2]; sy = q[5] - q[3]; w1 = 0.0; tx = q[0]; ty = q[1]; w2 = 1.0; } else { double dx1 = q[2] - q[4]; double dy1 = q[3] - q[5]; double dx2 = q[6] - q[4]; double dy2 = q[7] - q[5]; double den = dx1 * dy2 - dx2 * dy1; if(den == 0.0) { // Singular case //--------------- sx = shy = w0 = shx = sy = w1 = tx = ty = w2 = 0.0; return false; } // General case //--------------- double u = (dx * dy2 - dy * dx2) / den; double v = (dy * dx1 - dx * dy1) / den; sx = q[2] - q[0] + u * q[2]; shy = q[3] - q[1] + u * q[3]; w0 = u; shx = q[6] - q[0] + v * q[6]; sy = q[7] - q[1] + v * q[7]; w1 = v; tx = q[0]; ty = q[1]; w2 = 1.0; } return true; } //------------------------------------------------------------------------ inline bool trans_perspective::invert() { double d0 = sy * w2 - w1 * ty; double d1 = w0 * ty - shy * w2; double d2 = shy * w1 - w0 * sy; double d = sx * d0 + shx * d1 + tx * d2; if(d == 0.0) { sx = shy = w0 = shx = sy = w1 = tx = ty = w2 = 0.0; return false; } d = 1.0 / d; trans_perspective a = *this; sx = d * d0; shy = d * d1; w0 = d * d2; shx = d * (a.w1 *a.tx - a.shx*a.w2); sy = d * (a.sx *a.w2 - a.w0 *a.tx); w1 = d * (a.w0 *a.shx - a.sx *a.w1); tx = d * (a.shx*a.ty - a.sy *a.tx); ty = d * (a.shy*a.tx - a.sx *a.ty); w2 = d * (a.sx *a.sy - a.shy*a.shx); return true; } //------------------------------------------------------------------------ inline bool trans_perspective::quad_to_square(const double* q) { if(!square_to_quad(q)) return false; invert(); return true; } //------------------------------------------------------------------------ inline bool trans_perspective::quad_to_quad(const double* qs, const double* qd) { trans_perspective p; if(! quad_to_square(qs)) return false; if(!p.square_to_quad(qd)) return false; multiply(p); return true; } //------------------------------------------------------------------------ inline bool trans_perspective::rect_to_quad(double x1, double y1, double x2, double y2, const double* q) { double r[8]; r[0] = r[6] = x1; r[2] = r[4] = x2; r[1] = r[3] = y1; r[5] = r[7] = y2; return quad_to_quad(r, q); } //------------------------------------------------------------------------ inline bool trans_perspective::quad_to_rect(const double* q, double x1, double y1, double x2, double y2) { double r[8]; r[0] = r[6] = x1; r[2] = r[4] = x2; r[1] = r[3] = y1; r[5] = r[7] = y2; return quad_to_quad(q, r); } //------------------------------------------------------------------------ inline trans_perspective::trans_perspective(double x1, double y1, double x2, double y2, const double* quad) { rect_to_quad(x1, y1, x2, y2, quad); } //------------------------------------------------------------------------ inline trans_perspective::trans_perspective(const double* quad, double x1, double y1, double x2, double y2) { quad_to_rect(quad, x1, y1, x2, y2); } //------------------------------------------------------------------------ inline trans_perspective::trans_perspective(const double* src, const double* dst) { quad_to_quad(src, dst); } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::reset() { sx = 1; shy = 0; w0 = 0; shx = 0; sy = 1; w1 = 0; tx = 0; ty = 0; w2 = 1; return *this; } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::multiply(const trans_perspective& a) { trans_perspective b = *this; sx = a.sx *b.sx + a.shx*b.shy + a.tx*b.w0; shx = a.sx *b.shx + a.shx*b.sy + a.tx*b.w1; tx = a.sx *b.tx + a.shx*b.ty + a.tx*b.w2; shy = a.shy*b.sx + a.sy *b.shy + a.ty*b.w0; sy = a.shy*b.shx + a.sy *b.sy + a.ty*b.w1; ty = a.shy*b.tx + a.sy *b.ty + a.ty*b.w2; w0 = a.w0 *b.sx + a.w1 *b.shy + a.w2*b.w0; w1 = a.w0 *b.shx + a.w1 *b.sy + a.w2*b.w1; w2 = a.w0 *b.tx + a.w1 *b.ty + a.w2*b.w2; return *this; } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::multiply(const trans_affine& a) { trans_perspective b = *this; sx = a.sx *b.sx + a.shx*b.shy + a.tx*b.w0; shx = a.sx *b.shx + a.shx*b.sy + a.tx*b.w1; tx = a.sx *b.tx + a.shx*b.ty + a.tx*b.w2; shy = a.shy*b.sx + a.sy *b.shy + a.ty*b.w0; sy = a.shy*b.shx + a.sy *b.sy + a.ty*b.w1; ty = a.shy*b.tx + a.sy *b.ty + a.ty*b.w2; return *this; } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::premultiply(const trans_perspective& b) { trans_perspective a = *this; sx = a.sx *b.sx + a.shx*b.shy + a.tx*b.w0; shx = a.sx *b.shx + a.shx*b.sy + a.tx*b.w1; tx = a.sx *b.tx + a.shx*b.ty + a.tx*b.w2; shy = a.shy*b.sx + a.sy *b.shy + a.ty*b.w0; sy = a.shy*b.shx + a.sy *b.sy + a.ty*b.w1; ty = a.shy*b.tx + a.sy *b.ty + a.ty*b.w2; w0 = a.w0 *b.sx + a.w1 *b.shy + a.w2*b.w0; w1 = a.w0 *b.shx + a.w1 *b.sy + a.w2*b.w1; w2 = a.w0 *b.tx + a.w1 *b.ty + a.w2*b.w2; return *this; } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::premultiply(const trans_affine& b) { trans_perspective a = *this; sx = a.sx *b.sx + a.shx*b.shy; shx = a.sx *b.shx + a.shx*b.sy; tx = a.sx *b.tx + a.shx*b.ty + a.tx; shy = a.shy*b.sx + a.sy *b.shy; sy = a.shy*b.shx + a.sy *b.sy; ty = a.shy*b.tx + a.sy *b.ty + a.ty; w0 = a.w0 *b.sx + a.w1 *b.shy; w1 = a.w0 *b.shx + a.w1 *b.sy; w2 = a.w0 *b.tx + a.w1 *b.ty + a.w2; return *this; } //------------------------------------------------------------------------ const trans_perspective& trans_perspective::multiply_inv(const trans_perspective& m) { trans_perspective t = m; t.invert(); return multiply(t); } //------------------------------------------------------------------------ const trans_perspective& trans_perspective::multiply_inv(const trans_affine& m) { trans_affine t = m; t.invert(); return multiply(t); } //------------------------------------------------------------------------ const trans_perspective& trans_perspective::premultiply_inv(const trans_perspective& m) { trans_perspective t = m; t.invert(); return *this = t.multiply(*this); } //------------------------------------------------------------------------ const trans_perspective& trans_perspective::premultiply_inv(const trans_affine& m) { trans_perspective t(m); t.invert(); return *this = t.multiply(*this); } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::translate(double x, double y) { tx += x; ty += y; return *this; } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::rotate(double a) { multiply(trans_affine_rotation(a)); return *this; } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::scale(double s) { multiply(trans_affine_scaling(s)); return *this; } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::scale(double x, double y) { multiply(trans_affine_scaling(x, y)); return *this; } //------------------------------------------------------------------------ inline void trans_perspective::transform(double* px, double* py) const { double x = *px; double y = *py; double m = 1.0 / (x*w0 + y*w1 + w2); *px = m * (x*sx + y*shx + tx); *py = m * (x*shy + y*sy + ty); } //------------------------------------------------------------------------ inline void trans_perspective::transform_affine(double* x, double* y) const { double tmp = *x; *x = tmp * sx + *y * shx + tx; *y = tmp * shy + *y * sy + ty; } //------------------------------------------------------------------------ inline void trans_perspective::transform_2x2(double* x, double* y) const { double tmp = *x; *x = tmp * sx + *y * shx; *y = tmp * shy + *y * sy; } //------------------------------------------------------------------------ inline void trans_perspective::inverse_transform(double* x, double* y) const { trans_perspective t(*this); if(t.invert()) t.transform(x, y); } //------------------------------------------------------------------------ inline void trans_perspective::store_to(double* m) const { *m++ = sx; *m++ = shy; *m++ = w0; *m++ = shx; *m++ = sy; *m++ = w1; *m++ = tx; *m++ = ty; *m++ = w2; } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::load_from(const double* m) { sx = *m++; shy = *m++; w0 = *m++; shx = *m++; sy = *m++; w1 = *m++; tx = *m++; ty = *m++; w2 = *m++; return *this; } //------------------------------------------------------------------------ inline const trans_perspective& trans_perspective::from_affine(const trans_affine& a) { sx = a.sx; shy = a.shy; w0 = 0; shx = a.shx; sy = a.sy; w1 = 0; tx = a.tx; ty = a.ty; w2 = 1; return *this; } //------------------------------------------------------------------------ inline double trans_perspective::determinant() const { return sx * (sy * w2 - ty * w1) + shx * (ty * w0 - shy * w2) + tx * (shy * w1 - sy * w0); } //------------------------------------------------------------------------ inline double trans_perspective::determinant_reciprocal() const { return 1.0 / determinant(); } //------------------------------------------------------------------------ inline bool trans_perspective::is_valid(double epsilon) const { return fabs(sx) > epsilon && fabs(sy) > epsilon && fabs(w2) > epsilon; } //------------------------------------------------------------------------ inline bool trans_perspective::is_identity(double epsilon) const { return is_equal_eps(sx, 1.0, epsilon) && is_equal_eps(shy, 0.0, epsilon) && is_equal_eps(w0, 0.0, epsilon) && is_equal_eps(shx, 0.0, epsilon) && is_equal_eps(sy, 1.0, epsilon) && is_equal_eps(w1, 0.0, epsilon) && is_equal_eps(tx, 0.0, epsilon) && is_equal_eps(ty, 0.0, epsilon) && is_equal_eps(w2, 1.0, epsilon); } //------------------------------------------------------------------------ inline bool trans_perspective::is_equal(const trans_perspective& m, double epsilon) const { return is_equal_eps(sx, m.sx, epsilon) && is_equal_eps(shy, m.shy, epsilon) && is_equal_eps(w0, m.w0, epsilon) && is_equal_eps(shx, m.shx, epsilon) && is_equal_eps(sy, m.sy, epsilon) && is_equal_eps(w1, m.w1, epsilon) && is_equal_eps(tx, m.tx, epsilon) && is_equal_eps(ty, m.ty, epsilon) && is_equal_eps(w2, m.w2, epsilon); } //------------------------------------------------------------------------ inline double trans_perspective::scale() const { double x = 0.707106781 * sx + 0.707106781 * shx; double y = 0.707106781 * shy + 0.707106781 * sy; return sqrt(x*x + y*y); } //------------------------------------------------------------------------ inline double trans_perspective::rotation() const { double x1 = 0.0; double y1 = 0.0; double x2 = 1.0; double y2 = 0.0; transform(&x1, &y1); transform(&x2, &y2); return atan2(y2-y1, x2-x1); } //------------------------------------------------------------------------ void trans_perspective::translation(double* dx, double* dy) const { *dx = tx; *dy = ty; } //------------------------------------------------------------------------ void trans_perspective::scaling(double* x, double* y) const { double x1 = 0.0; double y1 = 0.0; double x2 = 1.0; double y2 = 1.0; trans_perspective t(*this); t *= trans_affine_rotation(-rotation()); t.transform(&x1, &y1); t.transform(&x2, &y2); *x = x2 - x1; *y = y2 - y1; } //------------------------------------------------------------------------ void trans_perspective::scaling_abs(double* x, double* y) const { *x = sqrt(sx * sx + shx * shx); *y = sqrt(shy * shy + sy * sy); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_renderer_mclip.h0000644000175000017500000002754213233644505024771 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class renderer_mclip // //---------------------------------------------------------------------------- #ifndef AGG_RENDERER_MCLIP_INCLUDED #define AGG_RENDERER_MCLIP_INCLUDED #include "agg_basics.h" #include "agg_array.h" #include "agg_renderer_base.h" namespace agg24 { //----------------------------------------------------------renderer_mclip template class renderer_mclip { public: typedef PixelFormat pixfmt_type; typedef typename pixfmt_type::color_type color_type; typedef typename pixfmt_type::row_data row_data; typedef renderer_base base_ren_type; //-------------------------------------------------------------------- explicit renderer_mclip(pixfmt_type& pixf) : m_ren(pixf), m_curr_cb(0), m_bounds(m_ren.xmin(), m_ren.ymin(), m_ren.xmax(), m_ren.ymax()) {} void attach(pixfmt_type& pixf) { m_ren.attach(pixf); reset_clipping(true); } //-------------------------------------------------------------------- const pixfmt_type& ren() const { return m_ren.ren(); } pixfmt_type& ren() { return m_ren.ren(); } //-------------------------------------------------------------------- unsigned width() const { return m_ren.width(); } unsigned height() const { return m_ren.height(); } //-------------------------------------------------------------------- const rect_i& clip_box() const { return m_ren.clip_box(); } int xmin() const { return m_ren.xmin(); } int ymin() const { return m_ren.ymin(); } int xmax() const { return m_ren.xmax(); } int ymax() const { return m_ren.ymax(); } //-------------------------------------------------------------------- const rect_i& bounding_clip_box() const { return m_bounds; } int bounding_xmin() const { return m_bounds.x1; } int bounding_ymin() const { return m_bounds.y1; } int bounding_xmax() const { return m_bounds.x2; } int bounding_ymax() const { return m_bounds.y2; } //-------------------------------------------------------------------- void first_clip_box() { m_curr_cb = 0; if(m_clip.size()) { const rect_i& cb = m_clip[0]; m_ren.clip_box_naked(cb.x1, cb.y1, cb.x2, cb.y2); } } //-------------------------------------------------------------------- bool next_clip_box() { if(++m_curr_cb < m_clip.size()) { const rect_i& cb = m_clip[m_curr_cb]; m_ren.clip_box_naked(cb.x1, cb.y1, cb.x2, cb.y2); return true; } return false; } //-------------------------------------------------------------------- void reset_clipping(bool visibility) { m_ren.reset_clipping(visibility); m_clip.remove_all(); m_curr_cb = 0; m_bounds = m_ren.clip_box(); } //-------------------------------------------------------------------- void add_clip_box(int x1, int y1, int x2, int y2) { rect_i cb(x1, y1, x2, y2); cb.normalize(); if(cb.clip(rect_i(0, 0, width() - 1, height() - 1))) { m_clip.add(cb); if(cb.x1 < m_bounds.x1) m_bounds.x1 = cb.x1; if(cb.y1 < m_bounds.y1) m_bounds.y1 = cb.y1; if(cb.x2 > m_bounds.x2) m_bounds.x2 = cb.x2; if(cb.y2 > m_bounds.y2) m_bounds.y2 = cb.y2; } } //-------------------------------------------------------------------- void clear(const color_type& c) { m_ren.clear(c); } //-------------------------------------------------------------------- void copy_pixel(int x, int y, const color_type& c) { first_clip_box(); do { if(m_ren.inbox(x, y)) { m_ren.ren().copy_pixel(x, y, c); break; } } while(next_clip_box()); } //-------------------------------------------------------------------- void blend_pixel(int x, int y, const color_type& c, cover_type cover) { first_clip_box(); do { if(m_ren.inbox(x, y)) { m_ren.ren().blend_pixel(x, y, c, cover); break; } } while(next_clip_box()); } //-------------------------------------------------------------------- color_type pixel(int x, int y) const { first_clip_box(); do { if(m_ren.inbox(x, y)) { return m_ren.ren().pixel(x, y); } } while(next_clip_box()); return color_type::no_color(); } //-------------------------------------------------------------------- void copy_hline(int x1, int y, int x2, const color_type& c) { first_clip_box(); do { m_ren.copy_hline(x1, y, x2, c); } while(next_clip_box()); } //-------------------------------------------------------------------- void copy_vline(int x, int y1, int y2, const color_type& c) { first_clip_box(); do { m_ren.copy_vline(x, y1, y2, c); } while(next_clip_box()); } //-------------------------------------------------------------------- void blend_hline(int x1, int y, int x2, const color_type& c, cover_type cover) { first_clip_box(); do { m_ren.blend_hline(x1, y, x2, c, cover); } while(next_clip_box()); } //-------------------------------------------------------------------- void blend_vline(int x, int y1, int y2, const color_type& c, cover_type cover) { first_clip_box(); do { m_ren.blend_vline(x, y1, y2, c, cover); } while(next_clip_box()); } //-------------------------------------------------------------------- void copy_bar(int x1, int y1, int x2, int y2, const color_type& c) { first_clip_box(); do { m_ren.copy_bar(x1, y1, x2, y2, c); } while(next_clip_box()); } //-------------------------------------------------------------------- void blend_bar(int x1, int y1, int x2, int y2, const color_type& c, cover_type cover) { first_clip_box(); do { m_ren.blend_bar(x1, y1, x2, y2, c, cover); } while(next_clip_box()); } //-------------------------------------------------------------------- void blend_solid_hspan(int x, int y, int len, const color_type& c, const cover_type* covers) { first_clip_box(); do { m_ren.blend_solid_hspan(x, y, len, c, covers); } while(next_clip_box()); } //-------------------------------------------------------------------- void blend_solid_vspan(int x, int y, int len, const color_type& c, const cover_type* covers) { first_clip_box(); do { m_ren.blend_solid_vspan(x, y, len, c, covers); } while(next_clip_box()); } //-------------------------------------------------------------------- void copy_color_hspan(int x, int y, int len, const color_type* colors) { first_clip_box(); do { m_ren.copy_color_hspan(x, y, len, colors); } while(next_clip_box()); } //-------------------------------------------------------------------- void blend_color_hspan(int x, int y, int len, const color_type* colors, const cover_type* covers, cover_type cover = cover_full) { first_clip_box(); do { m_ren.blend_color_hspan(x, y, len, colors, covers, cover); } while(next_clip_box()); } //-------------------------------------------------------------------- void blend_color_vspan(int x, int y, int len, const color_type* colors, const cover_type* covers, cover_type cover = cover_full) { first_clip_box(); do { m_ren.blend_color_vspan(x, y, len, colors, covers, cover); } while(next_clip_box()); } //-------------------------------------------------------------------- void copy_from(const rendering_buffer& from, const rect_i* rc=0, int x_to=0, int y_to=0) { first_clip_box(); do { m_ren.copy_from(from, rc, x_to, y_to); } while(next_clip_box()); } //-------------------------------------------------------------------- template void blend_from(const SrcPixelFormatRenderer& src, const rect_i* rect_src_ptr = 0, int dx = 0, int dy = 0, cover_type cover = cover_full) { first_clip_box(); do { m_ren.blend_from(src, rect_src_ptr, dx, dy, cover); } while(next_clip_box()); } private: renderer_mclip(const renderer_mclip&); const renderer_mclip& operator = (const renderer_mclip&); base_ren_type m_ren; pod_bvector m_clip; unsigned m_curr_cb; rect_i m_bounds; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_dda_line.h0000644000175000017500000002104613233644505023527 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes dda_line_interpolator, dda2_line_interpolator // //---------------------------------------------------------------------------- #ifndef AGG_DDA_LINE_INCLUDED #define AGG_DDA_LINE_INCLUDED #include #include "agg_basics.h" namespace agg24 { //===================================================dda_line_interpolator template class dda_line_interpolator { public: //-------------------------------------------------------------------- dda_line_interpolator() {} //-------------------------------------------------------------------- dda_line_interpolator(int y1, int y2, unsigned count) : m_y(y1), m_inc(((y2 - y1) << FractionShift) / int(count)), m_dy(0) { } //-------------------------------------------------------------------- void operator ++ () { m_dy += m_inc; } //-------------------------------------------------------------------- void operator -- () { m_dy -= m_inc; } //-------------------------------------------------------------------- void operator += (unsigned n) { m_dy += m_inc * n; } //-------------------------------------------------------------------- void operator -= (unsigned n) { m_dy -= m_inc * n; } //-------------------------------------------------------------------- int y() const { return m_y + (m_dy >> (FractionShift-YShift)); } int dy() const { return m_dy; } private: int m_y; int m_inc; int m_dy; }; //=================================================dda2_line_interpolator class dda2_line_interpolator { public: typedef int save_data_type; enum save_size_e { save_size = 2 }; //-------------------------------------------------------------------- dda2_line_interpolator() {} //-------------------------------------------- Forward-adjusted line dda2_line_interpolator(int y1, int y2, int count) : m_cnt(count <= 0 ? 1 : count), m_lft((y2 - y1) / m_cnt), m_rem((y2 - y1) % m_cnt), m_mod(m_rem), m_y(y1) { if(m_mod <= 0) { m_mod += count; m_rem += count; m_lft--; } m_mod -= count; } //-------------------------------------------- Backward-adjusted line dda2_line_interpolator(int y1, int y2, int count, int) : m_cnt(count <= 0 ? 1 : count), m_lft((y2 - y1) / m_cnt), m_rem((y2 - y1) % m_cnt), m_mod(m_rem), m_y(y1) { if(m_mod <= 0) { m_mod += count; m_rem += count; m_lft--; } } //-------------------------------------------- Backward-adjusted line dda2_line_interpolator(int y, int count) : m_cnt(count <= 0 ? 1 : count), m_lft(y / m_cnt), m_rem(y % m_cnt), m_mod(m_rem), m_y(0) { if(m_mod <= 0) { m_mod += count; m_rem += count; m_lft--; } } //-------------------------------------------------------------------- void save(save_data_type* data) const { data[0] = m_mod; data[1] = m_y; } //-------------------------------------------------------------------- void load(const save_data_type* data) { m_mod = data[0]; m_y = data[1]; } //-------------------------------------------------------------------- void operator++() { m_mod += m_rem; m_y += m_lft; if(m_mod > 0) { m_mod -= m_cnt; m_y++; } } //-------------------------------------------------------------------- void operator--() { if(m_mod <= m_rem) { m_mod += m_cnt; m_y--; } m_mod -= m_rem; m_y -= m_lft; } //-------------------------------------------------------------------- void adjust_forward() { m_mod -= m_cnt; } //-------------------------------------------------------------------- void adjust_backward() { m_mod += m_cnt; } //-------------------------------------------------------------------- int mod() const { return m_mod; } int rem() const { return m_rem; } int lft() const { return m_lft; } //-------------------------------------------------------------------- int y() const { return m_y; } private: int m_cnt; int m_lft; int m_rem; int m_mod; int m_y; }; //---------------------------------------------line_bresenham_interpolator class line_bresenham_interpolator { public: enum subpixel_scale_e { subpixel_shift = 8, subpixel_scale = 1 << subpixel_shift, subpixel_mask = subpixel_scale - 1 }; //-------------------------------------------------------------------- static int line_lr(int v) { return v >> subpixel_shift; } //-------------------------------------------------------------------- line_bresenham_interpolator(int x1, int y1, int x2, int y2) : m_x1_lr(line_lr(x1)), m_y1_lr(line_lr(y1)), m_x2_lr(line_lr(x2)), m_y2_lr(line_lr(y2)), m_ver(abs(m_x2_lr - m_x1_lr) < abs(m_y2_lr - m_y1_lr)), m_len(m_ver ? abs(m_y2_lr - m_y1_lr) : abs(m_x2_lr - m_x1_lr)), m_inc(m_ver ? ((y2 > y1) ? 1 : -1) : ((x2 > x1) ? 1 : -1)), m_interpolator(m_ver ? x1 : y1, m_ver ? x2 : y2, m_len) { } //-------------------------------------------------------------------- bool is_ver() const { return m_ver; } unsigned len() const { return m_len; } int inc() const { return m_inc; } //-------------------------------------------------------------------- void hstep() { ++m_interpolator; m_x1_lr += m_inc; } //-------------------------------------------------------------------- void vstep() { ++m_interpolator; m_y1_lr += m_inc; } //-------------------------------------------------------------------- int x1() const { return m_x1_lr; } int y1() const { return m_y1_lr; } int x2() const { return line_lr(m_interpolator.y()); } int y2() const { return line_lr(m_interpolator.y()); } int x2_hr() const { return m_interpolator.y(); } int y2_hr() const { return m_interpolator.y(); } private: int m_x1_lr; int m_y1_lr; int m_x2_lr; int m_y2_lr; bool m_ver; unsigned m_len; int m_inc; dda2_line_interpolator m_interpolator; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_pattern_rgba.h0000644000175000017500000000662213233644505025464 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_PATTERN_RGBA_INCLUDED #define AGG_SPAN_PATTERN_RGBA_INCLUDED #include "agg_basics.h" namespace agg24 { //======================================================span_pattern_rgba template class span_pattern_rgba { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; //-------------------------------------------------------------------- span_pattern_rgba() {} span_pattern_rgba(source_type& src, unsigned offset_x, unsigned offset_y) : m_src(&src), m_offset_x(offset_x), m_offset_y(offset_y) {} //-------------------------------------------------------------------- void attach(source_type& v) { m_src = &v; } source_type& source() { return *m_src; } const source_type& source() const { return *m_src; } //-------------------------------------------------------------------- void offset_x(unsigned v) { m_offset_x = v; } void offset_y(unsigned v) { m_offset_y = v; } unsigned offset_x() const { return m_offset_x; } unsigned offset_y() const { return m_offset_y; } void alpha(value_type) {} value_type alpha() const { return 0; } //-------------------------------------------------------------------- void prepare() {} void generate(color_type* span, int x, int y, unsigned len) { x += m_offset_x; y += m_offset_y; const value_type* p = (const value_type*)m_src->span(x, y, len); do { span->r = p[order_type::R]; span->g = p[order_type::G]; span->b = p[order_type::B]; span->a = p[order_type::A]; p = (const value_type*)m_src->next_x(); ++span; } while(--len); } private: source_type* m_src; unsigned m_offset_x; unsigned m_offset_y; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_pattern_rgb.h0000644000175000017500000000672313233644505025325 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_PATTERN_RGB_INCLUDED #define AGG_SPAN_PATTERN_RGB_INCLUDED #include "agg_basics.h" namespace agg24 { //========================================================span_pattern_rgb template class span_pattern_rgb { public: typedef Source source_type; typedef typename source_type::color_type color_type; typedef typename source_type::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; //-------------------------------------------------------------------- span_pattern_rgb() {} span_pattern_rgb(source_type& src, unsigned offset_x, unsigned offset_y) : m_src(&src), m_offset_x(offset_x), m_offset_y(offset_y), m_alpha(color_type::base_mask) {} //-------------------------------------------------------------------- void attach(source_type& v) { m_src = &v; } source_type& source() { return *m_src; } const source_type& source() const { return *m_src; } //-------------------------------------------------------------------- void offset_x(unsigned v) { m_offset_x = v; } void offset_y(unsigned v) { m_offset_y = v; } unsigned offset_x() const { return m_offset_x; } unsigned offset_y() const { return m_offset_y; } void alpha(value_type v) { m_alpha = v; } value_type alpha() const { return m_alpha; } //-------------------------------------------------------------------- void prepare() {} void generate(color_type* span, int x, int y, unsigned len) { x += m_offset_x; y += m_offset_y; const value_type* p = (const value_type*)m_src->span(x, y, len); do { span->r = p[order_type::R]; span->g = p[order_type::G]; span->b = p[order_type::B]; span->a = m_alpha; p = m_src->next_x(); ++span; } while(--len); } private: source_type* m_src; unsigned m_offset_x; unsigned m_offset_y; value_type m_alpha; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_subdiv_adaptor.h0000644000175000017500000001154313233644505026020 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SPAN_SUBDIV_ADAPTOR_INCLUDED #define AGG_SPAN_SUBDIV_ADAPTOR_INCLUDED #include "agg_basics.h" namespace agg24 { //=================================================span_subdiv_adaptor template class span_subdiv_adaptor { public: typedef Interpolator interpolator_type; typedef typename interpolator_type::trans_type trans_type; enum sublixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; //---------------------------------------------------------------- span_subdiv_adaptor() : m_subdiv_shift(4), m_subdiv_size(1 << m_subdiv_shift), m_subdiv_mask(m_subdiv_size - 1) {} span_subdiv_adaptor(interpolator_type& interpolator, unsigned subdiv_shift = 4) : m_subdiv_shift(subdiv_shift), m_subdiv_size(1 << m_subdiv_shift), m_subdiv_mask(m_subdiv_size - 1), m_interpolator(&interpolator) {} span_subdiv_adaptor(interpolator_type& interpolator, double x, double y, unsigned len, unsigned subdiv_shift = 4) : m_subdiv_shift(subdiv_shift), m_subdiv_size(1 << m_subdiv_shift), m_subdiv_mask(m_subdiv_size - 1), m_interpolator(&interpolator) { begin(x, y, len); } //---------------------------------------------------------------- const interpolator_type& interpolator() const { return *m_interpolator; } void interpolator(interpolator_type& intr) { m_interpolator = &intr; } //---------------------------------------------------------------- const trans_type& transformer() const { return *m_interpolator->transformer(); } void transformer(const trans_type& trans) { m_interpolator->transformer(trans); } //---------------------------------------------------------------- unsigned subdiv_shift() const { return m_subdiv_shift; } void subdiv_shift(unsigned shift) { m_subdiv_shift = shift; m_subdiv_size = 1 << m_subdiv_shift; m_subdiv_mask = m_subdiv_size - 1; } //---------------------------------------------------------------- void begin(double x, double y, unsigned len) { m_pos = 1; m_src_x = iround(x * subpixel_scale) + subpixel_scale; m_src_y = y; m_len = len; if(len > m_subdiv_size) len = m_subdiv_size; m_interpolator->begin(x, y, len); } //---------------------------------------------------------------- void operator++() { ++(*m_interpolator); if(m_pos >= m_subdiv_size) { unsigned len = m_len; if(len > m_subdiv_size) len = m_subdiv_size; m_interpolator->resynchronize(double(m_src_x) / double(subpixel_scale) + len, m_src_y, len); m_pos = 0; } m_src_x += subpixel_scale; ++m_pos; --m_len; } //---------------------------------------------------------------- void coordinates(int* x, int* y) const { m_interpolator->coordinates(x, y); } //---------------------------------------------------------------- void local_scale(int* x, int* y) const { m_interpolator->local_scale(x, y); } private: unsigned m_subdiv_shift; unsigned m_subdiv_size; unsigned m_subdiv_mask; interpolator_type* m_interpolator; int m_src_x; double m_src_y; unsigned m_pos; unsigned m_len; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vcgen_markers_term.h0000644000175000017500000000403513233644505025644 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_VCGEN_MARKERS_TERM_INCLUDED #define AGG_VCGEN_MARKERS_TERM_INCLUDED #include "agg_basics.h" #include "agg_vertex_sequence.h" namespace agg24 { //======================================================vcgen_markers_term // // See Implemantation agg_vcgen_markers_term.cpp // Terminal markers generator (arrowhead/arrowtail) // //------------------------------------------------------------------------ class vcgen_markers_term { public: vcgen_markers_term() : m_curr_id(0), m_curr_idx(0) {} // Vertex Generator Interface void remove_all(); void add_vertex(double x, double y, unsigned cmd); // Vertex Source Interface void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: vcgen_markers_term(const vcgen_markers_term&); const vcgen_markers_term& operator = (const vcgen_markers_term&); struct coord_type { double x, y; coord_type() {} coord_type(double x_, double y_) : x(x_), y(y_) {} }; typedef pod_bvector coord_storage; coord_storage m_markers; unsigned m_curr_id; unsigned m_curr_idx; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_bspline.h0000644000175000017500000000523613233644505023427 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class bspline // //---------------------------------------------------------------------------- #ifndef AGG_BSPLINE_INCLUDED #define AGG_BSPLINE_INCLUDED #include "agg_array.h" namespace agg24 { //----------------------------------------------------------------bspline // A very simple class of Bi-cubic Spline interpolation. // First call init(num, x[], y[]) where num - number of source points, // x, y - arrays of X and Y values respectively. Here Y must be a function // of X. It means that all the X-coordinates must be arranged in the ascending // order. // Then call get(x) that calculates a value Y for the respective X. // The class supports extrapolation, i.e. you can call get(x) where x is // outside the given with init() X-range. Extrapolation is a simple linear // function. // // See Implementation agg_bspline.cpp //------------------------------------------------------------------------ class bspline { public: bspline(); bspline(int num); bspline(int num, const double* x, const double* y); void init(int num); void add_point(double x, double y); void prepare(); void init(int num, const double* x, const double* y); double get(double x) const; double get_stateful(double x) const; private: bspline(const bspline&); const bspline& operator = (const bspline&); static void bsearch(int n, const double *x, double x0, int *i); double extrapolation_left(double x) const; double extrapolation_right(double x) const; double interpolation(double x, int i) const; int m_max; int m_num; double* m_x; double* m_y; pod_array m_am; mutable int m_last_idx; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_marker_adaptor.h0000644000175000017500000000357013233644505026012 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CONV_MARKER_ADAPTOR_INCLUDED #define AGG_CONV_MARKER_ADAPTOR_INCLUDED #include "agg_basics.h" #include "agg_conv_adaptor_vcgen.h" #include "agg_vcgen_vertex_sequence.h" namespace agg24 { //=====================================================conv_marker_adaptor template struct conv_marker_adaptor : public conv_adaptor_vcgen { typedef Markers marker_type; typedef conv_adaptor_vcgen base_type; conv_marker_adaptor(VertexSource& vs) : conv_adaptor_vcgen(vs) { } void shorten(double s) { base_type::generator().shorten(s); } double shorten() const { return base_type::generator().shorten(); } private: conv_marker_adaptor(const conv_marker_adaptor&); const conv_marker_adaptor& operator = (const conv_marker_adaptor&); }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_gouraud_gray.h0000644000175000017500000002050713233644505025502 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SPAN_GOURAUD_GRAY_INCLUDED #define AGG_SPAN_GOURAUD_GRAY_INCLUDED #include "agg_basics.h" #include "agg_color_gray.h" #include "agg_dda_line.h" #include "agg_span_gouraud.h" namespace agg24 { //=======================================================span_gouraud_gray template class span_gouraud_gray : public span_gouraud { public: typedef ColorT color_type; typedef typename color_type::value_type value_type; typedef span_gouraud base_type; typedef typename base_type::coord_type coord_type; enum subpixel_scale_e { subpixel_shift = 4, subpixel_scale = 1 << subpixel_shift }; private: //-------------------------------------------------------------------- struct gray_calc { void init(const coord_type& c1, const coord_type& c2) { m_x1 = c1.x - 0.5; m_y1 = c1.y - 0.5; m_dx = c2.x - c1.x; double dy = c2.y - c1.y; m_1dy = (fabs(dy) < 1e-10) ? 1e10 : 1.0 / dy; m_v1 = c1.color.v; m_a1 = c1.color.a; m_dv = c2.color.v - m_v1; m_da = c2.color.a - m_a1; } void calc(double y) { double k = (y - m_y1) * m_1dy; if(k < 0.0) k = 0.0; if(k > 1.0) k = 1.0; m_v = m_v1 + iround(m_dv * k); m_a = m_a1 + iround(m_da * k); m_x = iround((m_x1 + m_dx * k) * subpixel_scale); } double m_x1; double m_y1; double m_dx; double m_1dy; int m_v1; int m_a1; int m_dv; int m_da; int m_v; int m_a; int m_x; }; public: //-------------------------------------------------------------------- span_gouraud_gray() {} span_gouraud_gray(const color_type& c1, const color_type& c2, const color_type& c3, double x1, double y1, double x2, double y2, double x3, double y3, double d = 0) : base_type(c1, c2, c3, x1, y1, x2, y2, x3, y3, d) {} //-------------------------------------------------------------------- void prepare() { coord_type coord[3]; base_type::arrange_vertices(coord); m_y2 = int(coord[1].y); m_swap = cross_product(coord[0].x, coord[0].y, coord[2].x, coord[2].y, coord[1].x, coord[1].y) < 0.0; m_c1.init(coord[0], coord[2]); m_c2.init(coord[0], coord[1]); m_c3.init(coord[1], coord[2]); } //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { m_c1.calc(y); const gray_calc* pc1 = &m_c1; const gray_calc* pc2 = &m_c2; if(y < m_y2) { // Bottom part of the triangle (first subtriangle) //------------------------- m_c2.calc(y + m_c2.m_1dy); } else { // Upper part (second subtriangle) //------------------------- m_c3.calc(y - m_c3.m_1dy); pc2 = &m_c3; } if(m_swap) { // It means that the triangle is oriented clockwise, // so that we need to swap the controlling structures //------------------------- const gray_calc* t = pc2; pc2 = pc1; pc1 = t; } // Get the horizontal length with subpixel accuracy // and protect it from division by zero //------------------------- int nlen = abs(pc2->m_x - pc1->m_x); if(nlen <= 0) nlen = 1; dda_line_interpolator<14> v(pc1->m_v, pc2->m_v, nlen); dda_line_interpolator<14> a(pc1->m_a, pc2->m_a, nlen); // Calculate the starting point of the gradient with subpixel // accuracy and correct (roll back) the interpolators. // This operation will also clip the beginning of the span // if necessary. //------------------------- int start = pc1->m_x - (x << subpixel_shift); v -= start; a -= start; nlen += start; int vv, va; enum lim_e { lim = color_type::base_mask }; // Beginning part of the span. Since we rolled back the // interpolators, the color values may have overflow. // So that, we render the beginning part with checking // for overflow. It lasts until "start" is positive; // typically it's 1-2 pixels, but may be more in some cases. //------------------------- while(len && start > 0) { vv = v.y(); va = a.y(); if(vv < 0) vv = 0; if(vv > lim) vv = lim; if(va < 0) va = 0; if(va > lim) va = lim; span->v = (value_type)vv; span->a = (value_type)va; v += subpixel_scale; a += subpixel_scale; nlen -= subpixel_scale; start -= subpixel_scale; ++span; --len; } // Middle part, no checking for overflow. // Actual spans can be longer than the calculated length // because of anti-aliasing, thus, the interpolators can // overflow. But while "nlen" is positive we are safe. //------------------------- while(len && nlen > 0) { span->v = (value_type)v.y(); span->a = (value_type)a.y(); v += subpixel_scale; a += subpixel_scale; nlen -= subpixel_scale; ++span; --len; } // Ending part; checking for overflow. // Typically it's 1-2 pixels, but may be more in some cases. //------------------------- while(len) { vv = v.y(); va = a.y(); if(vv < 0) vv = 0; if(vv > lim) vv = lim; if(va < 0) va = 0; if(va > lim) va = lim; span->v = (value_type)vv; span->a = (value_type)va; v += subpixel_scale; a += subpixel_scale; ++span; --len; } } private: bool m_swap; int m_y2; gray_calc m_c1; gray_calc m_c2; gray_calc m_c3; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vcgen_smooth_poly1.h0000644000175000017500000000513613233644505025611 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_VCGEN_SMOOTH_POLY1_INCLUDED #define AGG_VCGEN_SMOOTH_POLY1_INCLUDED #include "agg_basics.h" #include "agg_vertex_sequence.h" namespace agg24 { //======================================================vcgen_smooth_poly1 // // See Implementation agg_vcgen_smooth_poly1.cpp // Smooth polygon generator // //------------------------------------------------------------------------ class vcgen_smooth_poly1 { enum status_e { initial, ready, polygon, ctrl_b, ctrl_e, ctrl1, ctrl2, end_poly, stop }; public: typedef vertex_sequence vertex_storage; vcgen_smooth_poly1(); void smooth_value(double v) { m_smooth_value = v * 0.5; } double smooth_value() const { return m_smooth_value * 2.0; } // Vertex Generator Interface void remove_all(); void add_vertex(double x, double y, unsigned cmd); // Vertex Source Interface void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: vcgen_smooth_poly1(const vcgen_smooth_poly1&); const vcgen_smooth_poly1& operator = (const vcgen_smooth_poly1&); void calculate(const vertex_dist& v0, const vertex_dist& v1, const vertex_dist& v2, const vertex_dist& v3); vertex_storage m_src_vertices; double m_smooth_value; unsigned m_closed; status_e m_status; unsigned m_src_vertex; double m_ctrl1_x; double m_ctrl1_y; double m_ctrl2_x; double m_ctrl2_y; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_trans_single_path.h0000644000175000017500000000601113233644505025467 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_TRANS_SINGLE_PATH_INCLUDED #define AGG_TRANS_SINGLE_PATH_INCLUDED #include "agg_basics.h" #include "agg_vertex_sequence.h" namespace agg24 { // See also: agg_trans_single_path.cpp // //-------------------------------------------------------trans_single_path class trans_single_path { enum status_e { initial, making_path, ready }; public: typedef vertex_sequence vertex_storage; trans_single_path(); //-------------------------------------------------------------------- void base_length(double v) { m_base_length = v; } double base_length() const { return m_base_length; } //-------------------------------------------------------------------- void preserve_x_scale(bool f) { m_preserve_x_scale = f; } bool preserve_x_scale() const { return m_preserve_x_scale; } //-------------------------------------------------------------------- void reset(); void move_to(double x, double y); void line_to(double x, double y); void finalize_path(); //-------------------------------------------------------------------- template void add_path(VertexSource& vs, unsigned path_id=0) { double x; double y; unsigned cmd; vs.rewind(path_id); while(!is_stop(cmd = vs.vertex(&x, &y))) { if(is_move_to(cmd)) { move_to(x, y); } else { if(is_vertex(cmd)) { line_to(x, y); } } } finalize_path(); } //-------------------------------------------------------------------- double total_length() const; void transform(double *x, double *y) const; private: vertex_storage m_src_vertices; double m_base_length; double m_kindex; status_e m_status; bool m_preserve_x_scale; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_vcgen_vertex_sequence.h0000644000175000017500000000760113233644505026360 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_VCGEN_VERTEX_SEQUENCE_INCLUDED #define AGG_VCGEN_VERTEX_SEQUENCE_INCLUDED #include "agg_basics.h" #include "agg_vertex_sequence.h" #include "agg_shorten_path.h" namespace agg24 { //===================================================vcgen_vertex_sequence class vcgen_vertex_sequence { public: typedef vertex_dist_cmd vertex_type; typedef vertex_sequence vertex_storage; vcgen_vertex_sequence() : m_flags(0), m_cur_vertex(0), m_shorten(0.0), m_ready(false) { } // Vertex Generator Interface void remove_all(); void add_vertex(double x, double y, unsigned cmd); // Vertex Source Interface void rewind(unsigned path_id); unsigned vertex(double* x, double* y); void shorten(double s) { m_shorten = s; } double shorten() const { return m_shorten; } private: vcgen_vertex_sequence(const vcgen_vertex_sequence&); const vcgen_vertex_sequence& operator = (const vcgen_vertex_sequence&); vertex_storage m_src_vertices; unsigned m_flags; unsigned m_cur_vertex; double m_shorten; bool m_ready; }; //------------------------------------------------------------------------ inline void vcgen_vertex_sequence::remove_all() { m_ready = false; m_src_vertices.remove_all(); m_cur_vertex = 0; m_flags = 0; } //------------------------------------------------------------------------ inline void vcgen_vertex_sequence::add_vertex(double x, double y, unsigned cmd) { m_ready = false; if(is_move_to(cmd)) { m_src_vertices.modify_last(vertex_dist_cmd(x, y, cmd)); } else { if(is_vertex(cmd)) { m_src_vertices.add(vertex_dist_cmd(x, y, cmd)); } else { m_flags = cmd & path_flags_mask; } } } //------------------------------------------------------------------------ inline void vcgen_vertex_sequence::rewind(unsigned) { if(!m_ready) { m_src_vertices.close(is_closed(m_flags)); shorten_path(m_src_vertices, m_shorten, get_close_flag(m_flags)); } m_ready = true; m_cur_vertex = 0; } //------------------------------------------------------------------------ inline unsigned vcgen_vertex_sequence::vertex(double* x, double* y) { if(!m_ready) { rewind(0); } if(m_cur_vertex == m_src_vertices.size()) { ++m_cur_vertex; return path_cmd_end_poly | m_flags; } if(m_cur_vertex > m_src_vertices.size()) { return path_cmd_stop; } vertex_type& v = m_src_vertices[m_cur_vertex++]; *x = v.x; *y = v.y; return v.cmd; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rasterizer_scanline_aa_nogamma.h0000644000175000017500000004000713233644505030174 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // // The author gratefully acknowleges the support of David Turner, // Robert Wilhelm, and Werner Lemberg - the authors of the FreeType // libray - in producing this work. See http://www.freetype.org for details. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_SCANLINE_AA_NOGAMMA_INCLUDED #define AGG_RASTERIZER_SCANLINE_AA_NOGAMMA_INCLUDED #include "agg_rasterizer_cells_aa.h" #include "agg_rasterizer_sl_clip.h" namespace agg24 { //-----------------------------------------------------------------cell_aa // A pixel cell. There're no constructors defined and it was done // intentionally in order to avoid extra overhead when allocating an // array of cells. struct cell_aa { int x; int y; int cover; int area; void initial() { x = 0x7FFFFFFF; y = 0x7FFFFFFF; cover = 0; area = 0; } void style(const cell_aa&) {} int not_equal(int ex, int ey, const cell_aa&) const { return (ex - x) | (ey - y); } }; //==================================================rasterizer_scanline_aa_nogamma // Polygon rasterizer that is used to render filled polygons with // high-quality Anti-Aliasing. Internally, by default, the class uses // integer coordinates in format 24.8, i.e. 24 bits for integer part // and 8 bits for fractional - see poly_subpixel_shift. This class can be // used in the following way: // // 1. filling_rule(filling_rule_e ft) - optional. // // 2. gamma() - optional. // // 3. reset() // // 4. move_to(x, y) / line_to(x, y) - make the polygon. One can create // more than one contour, but each contour must consist of at least 3 // vertices, i.e. move_to(x1, y1); line_to(x2, y2); line_to(x3, y3); // is the absolute minimum of vertices that define a triangle. // The algorithm does not check either the number of vertices nor // coincidence of their coordinates, but in the worst case it just // won't draw anything. // The orger of the vertices (clockwise or counterclockwise) // is important when using the non-zero filling rule (fill_non_zero). // In this case the vertex order of all the contours must be the same // if you want your intersecting polygons to be without "holes". // You actually can use different vertices order. If the contours do not // intersect each other the order is not important anyway. If they do, // contours with the same vertex order will be rendered without "holes" // while the intersecting contours with different orders will have "holes". // // filling_rule() and gamma() can be called anytime before "sweeping". //------------------------------------------------------------------------ template class rasterizer_scanline_aa_nogamma { enum status { status_initial, status_move_to, status_line_to, status_closed }; public: typedef Clip clip_type; typedef typename Clip::conv_type conv_type; typedef typename Clip::coord_type coord_type; enum aa_scale_e { aa_shift = 8, aa_scale = 1 << aa_shift, aa_mask = aa_scale - 1, aa_scale2 = aa_scale * 2, aa_mask2 = aa_scale2 - 1 }; //-------------------------------------------------------------------- rasterizer_scanline_aa_nogamma(unsigned cell_block_limit=1024) : m_outline(cell_block_limit), m_clipper(), m_filling_rule(fill_non_zero), m_auto_close(true), m_start_x(0), m_start_y(0), m_status(status_initial) { } //-------------------------------------------------------------------- void reset(); void reset_clipping(); void clip_box(double x1, double y1, double x2, double y2); void filling_rule(filling_rule_e filling_rule); void auto_close(bool flag) { m_auto_close = flag; } //-------------------------------------------------------------------- unsigned apply_gamma(unsigned cover) const { return cover; } //-------------------------------------------------------------------- void move_to(int x, int y); void line_to(int x, int y); void move_to_d(double x, double y); void line_to_d(double x, double y); void close_polygon(); void add_vertex(double x, double y, unsigned cmd); void edge(int x1, int y1, int x2, int y2); void edge_d(double x1, double y1, double x2, double y2); //------------------------------------------------------------------- template void add_path(VertexSource& vs, unsigned path_id=0) { double x; double y; unsigned cmd; vs.rewind(path_id); if(m_outline.sorted()) reset(); while(!is_stop(cmd = vs.vertex(&x, &y))) { add_vertex(x, y, cmd); } } //-------------------------------------------------------------------- int min_x() const { return m_outline.min_x(); } int min_y() const { return m_outline.min_y(); } int max_x() const { return m_outline.max_x(); } int max_y() const { return m_outline.max_y(); } //-------------------------------------------------------------------- void sort(); bool rewind_scanlines(); bool navigate_scanline(int y); //-------------------------------------------------------------------- AGG_INLINE unsigned calculate_alpha(int area) const { int cover = area >> (poly_subpixel_shift*2 + 1 - aa_shift); if(cover < 0) cover = -cover; if(m_filling_rule == fill_even_odd) { cover &= aa_mask2; if(cover > aa_scale) { cover = aa_scale2 - cover; } } if(cover > aa_mask) cover = aa_mask; return cover; } //-------------------------------------------------------------------- template bool sweep_scanline(Scanline& sl) { for(;;) { if(m_scan_y > m_outline.max_y()) return false; sl.reset_spans(); unsigned num_cells = m_outline.scanline_num_cells(m_scan_y); const cell_aa* const* cells = m_outline.scanline_cells(m_scan_y); int cover = 0; while(num_cells) { const cell_aa* cur_cell = *cells; int x = cur_cell->x; int area = cur_cell->area; unsigned alpha; cover += cur_cell->cover; //accumulate all cells with the same X while(--num_cells) { cur_cell = *++cells; if(cur_cell->x != x) break; area += cur_cell->area; cover += cur_cell->cover; } if(area) { alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area); if(alpha) { sl.add_cell(x, alpha); } x++; } if(num_cells && cur_cell->x > x) { alpha = calculate_alpha(cover << (poly_subpixel_shift + 1)); if(alpha) { sl.add_span(x, cur_cell->x - x, alpha); } } } if(sl.num_spans()) break; ++m_scan_y; } sl.finalize(m_scan_y); ++m_scan_y; return true; } //-------------------------------------------------------------------- bool hit_test(int tx, int ty); private: //-------------------------------------------------------------------- // Disable copying rasterizer_scanline_aa_nogamma(const rasterizer_scanline_aa_nogamma&); const rasterizer_scanline_aa_nogamma& operator = (const rasterizer_scanline_aa_nogamma&); private: rasterizer_cells_aa m_outline; clip_type m_clipper; filling_rule_e m_filling_rule; bool m_auto_close; coord_type m_start_x; coord_type m_start_y; unsigned m_status; int m_scan_y; }; //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::reset() { m_outline.reset(); m_status = status_initial; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::filling_rule(filling_rule_e filling_rule) { m_filling_rule = filling_rule; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::clip_box(double x1, double y1, double x2, double y2) { reset(); m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), conv_type::upscale(x2), conv_type::upscale(y2)); } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::reset_clipping() { reset(); m_clipper.reset_clipping(); } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::close_polygon() { if(m_status == status_line_to) { m_clipper.line_to(m_outline, m_start_x, m_start_y); m_status = status_closed; } } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::move_to(int x, int y) { if(m_outline.sorted()) reset(); if(m_auto_close) close_polygon(); m_clipper.move_to(m_start_x = conv_type::downscale(x), m_start_y = conv_type::downscale(y)); m_status = status_move_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::line_to(int x, int y) { m_clipper.line_to(m_outline, conv_type::downscale(x), conv_type::downscale(y)); m_status = status_line_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::move_to_d(double x, double y) { if(m_outline.sorted()) reset(); if(m_auto_close) close_polygon(); m_clipper.move_to(m_start_x = conv_type::upscale(x), m_start_y = conv_type::upscale(y)); m_status = status_move_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::line_to_d(double x, double y) { m_clipper.line_to(m_outline, conv_type::upscale(x), conv_type::upscale(y)); m_status = status_line_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::add_vertex(double x, double y, unsigned cmd) { if(is_move_to(cmd)) { move_to_d(x, y); } else if(is_vertex(cmd)) { line_to_d(x, y); } else if(is_close(cmd)) { close_polygon(); } } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::edge(int x1, int y1, int x2, int y2) { if(m_outline.sorted()) reset(); m_clipper.move_to(conv_type::downscale(x1), conv_type::downscale(y1)); m_clipper.line_to(m_outline, conv_type::downscale(x2), conv_type::downscale(y2)); m_status = status_move_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::edge_d(double x1, double y1, double x2, double y2) { if(m_outline.sorted()) reset(); m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); m_clipper.line_to(m_outline, conv_type::upscale(x2), conv_type::upscale(y2)); m_status = status_move_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa_nogamma::sort() { if(m_auto_close) close_polygon(); m_outline.sort_cells(); } //------------------------------------------------------------------------ template AGG_INLINE bool rasterizer_scanline_aa_nogamma::rewind_scanlines() { if(m_auto_close) close_polygon(); m_outline.sort_cells(); if(m_outline.total_cells() == 0) { return false; } m_scan_y = m_outline.min_y(); return true; } //------------------------------------------------------------------------ template AGG_INLINE bool rasterizer_scanline_aa_nogamma::navigate_scanline(int y) { if(m_auto_close) close_polygon(); m_outline.sort_cells(); if(m_outline.total_cells() == 0 || y < m_outline.min_y() || y > m_outline.max_y()) { return false; } m_scan_y = y; return true; } //------------------------------------------------------------------------ template bool rasterizer_scanline_aa_nogamma::hit_test(int tx, int ty) { if(!navigate_scanline(ty)) return false; scanline_hit_test sl(tx); sweep_scanline(sl); return sl.hit(); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_curves.h0000644000175000017500000005015413233644505023301 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // Copyright (C) 2005 Tony Juricic (tonygeek@yahoo.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_CURVES_INCLUDED #define AGG_CURVES_INCLUDED #include "agg_array.h" namespace agg24 { // See Implementation agg_curves.cpp //--------------------------------------------curve_approximation_method_e enum curve_approximation_method_e { curve_inc, curve_div }; //--------------------------------------------------------------curve3_inc class curve3_inc { public: curve3_inc() : m_num_steps(0), m_step(0), m_scale(1.0) { } curve3_inc(double x1, double y1, double x2, double y2, double x3, double y3) : m_num_steps(0), m_step(0), m_scale(1.0) { init(x1, y1, x2, y2, x3, y3); } void reset() { m_num_steps = 0; m_step = -1; } void init(double x1, double y1, double x2, double y2, double x3, double y3); void approximation_method(curve_approximation_method_e) {} curve_approximation_method_e approximation_method() const { return curve_inc; } void approximation_scale(double s); double approximation_scale() const; void angle_tolerance(double) {} double angle_tolerance() const { return 0.0; } void cusp_limit(double) {} double cusp_limit() const { return 0.0; } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: int m_num_steps; int m_step; double m_scale; double m_start_x; double m_start_y; double m_end_x; double m_end_y; double m_fx; double m_fy; double m_dfx; double m_dfy; double m_ddfx; double m_ddfy; double m_saved_fx; double m_saved_fy; double m_saved_dfx; double m_saved_dfy; }; //-------------------------------------------------------------curve3_div class curve3_div { public: curve3_div() : m_approximation_scale(1.0), m_angle_tolerance(0.0), m_count(0) {} curve3_div(double x1, double y1, double x2, double y2, double x3, double y3) : m_approximation_scale(1.0), m_angle_tolerance(0.0), m_count(0) { init(x1, y1, x2, y2, x3, y3); } void reset() { m_points.remove_all(); m_count = 0; } void init(double x1, double y1, double x2, double y2, double x3, double y3); void approximation_method(curve_approximation_method_e) {} curve_approximation_method_e approximation_method() const { return curve_div; } void approximation_scale(double s) { m_approximation_scale = s; } double approximation_scale() const { return m_approximation_scale; } void angle_tolerance(double a) { m_angle_tolerance = a; } double angle_tolerance() const { return m_angle_tolerance; } void cusp_limit(double) {} double cusp_limit() const { return 0.0; } void rewind(unsigned) { m_count = 0; } unsigned vertex(double* x, double* y) { if(m_count >= m_points.size()) return path_cmd_stop; const point_d& p = m_points[m_count++]; *x = p.x; *y = p.y; return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to; } private: void bezier(double x1, double y1, double x2, double y2, double x3, double y3); void recursive_bezier(double x1, double y1, double x2, double y2, double x3, double y3, unsigned level); double m_approximation_scale; double m_distance_tolerance_square; double m_angle_tolerance; unsigned m_count; pod_bvector m_points; }; //-------------------------------------------------------------curve4_points struct curve4_points { double cp[8]; curve4_points() {} curve4_points(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { cp[0] = x1; cp[1] = y1; cp[2] = x2; cp[3] = y2; cp[4] = x3; cp[5] = y3; cp[6] = x4; cp[7] = y4; } void init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { cp[0] = x1; cp[1] = y1; cp[2] = x2; cp[3] = y2; cp[4] = x3; cp[5] = y3; cp[6] = x4; cp[7] = y4; } double operator [] (unsigned i) const { return cp[i]; } double& operator [] (unsigned i) { return cp[i]; } }; //-------------------------------------------------------------curve4_inc class curve4_inc { public: curve4_inc() : m_num_steps(0), m_step(0), m_scale(1.0) { } curve4_inc(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) : m_num_steps(0), m_step(0), m_scale(1.0) { init(x1, y1, x2, y2, x3, y3, x4, y4); } curve4_inc(const curve4_points& cp) : m_num_steps(0), m_step(0), m_scale(1.0) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } void reset() { m_num_steps = 0; m_step = -1; } void init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); void init(const curve4_points& cp) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } void approximation_method(curve_approximation_method_e) {} curve_approximation_method_e approximation_method() const { return curve_inc; } void approximation_scale(double s); double approximation_scale() const; void angle_tolerance(double) {} double angle_tolerance() const { return 0.0; } void cusp_limit(double) {} double cusp_limit() const { return 0.0; } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: int m_num_steps; int m_step; double m_scale; double m_start_x; double m_start_y; double m_end_x; double m_end_y; double m_fx; double m_fy; double m_dfx; double m_dfy; double m_ddfx; double m_ddfy; double m_dddfx; double m_dddfy; double m_saved_fx; double m_saved_fy; double m_saved_dfx; double m_saved_dfy; double m_saved_ddfx; double m_saved_ddfy; }; //-------------------------------------------------------catrom_to_bezier inline curve4_points catrom_to_bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { // Trans. matrix Catmull-Rom to Bezier // // 0 1 0 0 // -1/6 1 1/6 0 // 0 1/6 1 -1/6 // 0 0 1 0 // return curve4_points( x2, y2, (-x1 + 6*x2 + x3) / 6, (-y1 + 6*y2 + y3) / 6, ( x2 + 6*x3 - x4) / 6, ( y2 + 6*y3 - y4) / 6, x3, y3); } //----------------------------------------------------------------------- inline curve4_points catrom_to_bezier(const curve4_points& cp) { return catrom_to_bezier(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } //-----------------------------------------------------ubspline_to_bezier inline curve4_points ubspline_to_bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { // Trans. matrix Uniform BSpline to Bezier // // 1/6 4/6 1/6 0 // 0 4/6 2/6 0 // 0 2/6 4/6 0 // 0 1/6 4/6 1/6 // return curve4_points( (x1 + 4*x2 + x3) / 6, (y1 + 4*y2 + y3) / 6, (4*x2 + 2*x3) / 6, (4*y2 + 2*y3) / 6, (2*x2 + 4*x3) / 6, (2*y2 + 4*y3) / 6, (x2 + 4*x3 + x4) / 6, (y2 + 4*y3 + y4) / 6); } //----------------------------------------------------------------------- inline curve4_points ubspline_to_bezier(const curve4_points& cp) { return ubspline_to_bezier(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } //------------------------------------------------------hermite_to_bezier inline curve4_points hermite_to_bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { // Trans. matrix Hermite to Bezier // // 1 0 0 0 // 1 0 1/3 0 // 0 1 0 -1/3 // 0 1 0 0 // return curve4_points( x1, y1, (3*x1 + x3) / 3, (3*y1 + y3) / 3, (3*x2 - x4) / 3, (3*y2 - y4) / 3, x2, y2); } //----------------------------------------------------------------------- inline curve4_points hermite_to_bezier(const curve4_points& cp) { return hermite_to_bezier(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } //-------------------------------------------------------------curve4_div class curve4_div { public: curve4_div() : m_approximation_scale(1.0), m_angle_tolerance(0.0), m_cusp_limit(0.0), m_count(0) {} curve4_div(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) : m_approximation_scale(1.0), m_angle_tolerance(0.0), m_cusp_limit(0.0), m_count(0) { init(x1, y1, x2, y2, x3, y3, x4, y4); } curve4_div(const curve4_points& cp) : m_approximation_scale(1.0), m_angle_tolerance(0.0), m_count(0) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } void reset() { m_points.remove_all(); m_count = 0; } void init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); void init(const curve4_points& cp) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } void approximation_method(curve_approximation_method_e) {} curve_approximation_method_e approximation_method() const { return curve_div; } void approximation_scale(double s) { m_approximation_scale = s; } double approximation_scale() const { return m_approximation_scale; } void angle_tolerance(double a) { m_angle_tolerance = a; } double angle_tolerance() const { return m_angle_tolerance; } void cusp_limit(double v) { m_cusp_limit = (v == 0.0) ? 0.0 : pi - v; } double cusp_limit() const { return (m_cusp_limit == 0.0) ? 0.0 : pi - m_cusp_limit; } void rewind(unsigned) { m_count = 0; } unsigned vertex(double* x, double* y) { if(m_count >= m_points.size()) return path_cmd_stop; const point_d& p = m_points[m_count++]; *x = p.x; *y = p.y; return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to; } private: void bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); void recursive_bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, unsigned level); double m_approximation_scale; double m_distance_tolerance_square; double m_angle_tolerance; double m_cusp_limit; unsigned m_count; pod_bvector m_points; }; //-----------------------------------------------------------------curve3 class curve3 { public: curve3() : m_approximation_method(curve_div) {} curve3(double x1, double y1, double x2, double y2, double x3, double y3) : m_approximation_method(curve_div) { init(x1, y1, x2, y2, x3, y3); } void reset() { m_curve_inc.reset(); m_curve_div.reset(); } void init(double x1, double y1, double x2, double y2, double x3, double y3) { if(m_approximation_method == curve_inc) { m_curve_inc.init(x1, y1, x2, y2, x3, y3); } else { m_curve_div.init(x1, y1, x2, y2, x3, y3); } } void approximation_method(curve_approximation_method_e v) { m_approximation_method = v; } curve_approximation_method_e approximation_method() const { return m_approximation_method; } void approximation_scale(double s) { m_curve_inc.approximation_scale(s); m_curve_div.approximation_scale(s); } double approximation_scale() const { return m_curve_inc.approximation_scale(); } void angle_tolerance(double a) { m_curve_div.angle_tolerance(a); } double angle_tolerance() const { return m_curve_div.angle_tolerance(); } void cusp_limit(double v) { m_curve_div.cusp_limit(v); } double cusp_limit() const { return m_curve_div.cusp_limit(); } void rewind(unsigned path_id) { if(m_approximation_method == curve_inc) { m_curve_inc.rewind(path_id); } else { m_curve_div.rewind(path_id); } } unsigned vertex(double* x, double* y) { if(m_approximation_method == curve_inc) { return m_curve_inc.vertex(x, y); } return m_curve_div.vertex(x, y); } private: curve3_inc m_curve_inc; curve3_div m_curve_div; curve_approximation_method_e m_approximation_method; }; //-----------------------------------------------------------------curve4 class curve4 { public: curve4() : m_approximation_method(curve_div) {} curve4(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) : m_approximation_method(curve_div) { init(x1, y1, x2, y2, x3, y3, x4, y4); } curve4(const curve4_points& cp) : m_approximation_method(curve_div) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } void reset() { m_curve_inc.reset(); m_curve_div.reset(); } void init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { if(m_approximation_method == curve_inc) { m_curve_inc.init(x1, y1, x2, y2, x3, y3, x4, y4); } else { m_curve_div.init(x1, y1, x2, y2, x3, y3, x4, y4); } } void init(const curve4_points& cp) { init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]); } void approximation_method(curve_approximation_method_e v) { m_approximation_method = v; } curve_approximation_method_e approximation_method() const { return m_approximation_method; } void approximation_scale(double s) { m_curve_inc.approximation_scale(s); m_curve_div.approximation_scale(s); } double approximation_scale() const { return m_curve_inc.approximation_scale(); } void angle_tolerance(double v) { m_curve_div.angle_tolerance(v); } double angle_tolerance() const { return m_curve_div.angle_tolerance(); } void cusp_limit(double v) { m_curve_div.cusp_limit(v); } double cusp_limit() const { return m_curve_div.cusp_limit(); } void rewind(unsigned path_id) { if(m_approximation_method == curve_inc) { m_curve_inc.rewind(path_id); } else { m_curve_div.rewind(path_id); } } unsigned vertex(double* x, double* y) { if(m_approximation_method == curve_inc) { return m_curve_inc.vertex(x, y); } return m_curve_div.vertex(x, y); } private: curve4_inc m_curve_inc; curve4_div m_curve_div; curve_approximation_method_e m_approximation_method; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_path_storage_integer.h0000644000175000017500000002355713233644505026176 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_PATH_STORAGE_INTEGER_INCLUDED #define AGG_PATH_STORAGE_INTEGER_INCLUDED #include #include "agg_array.h" namespace agg24 { //---------------------------------------------------------vertex_integer template struct vertex_integer { enum path_cmd { cmd_move_to = 0, cmd_line_to = 1, cmd_curve3 = 2, cmd_curve4 = 3 }; enum coord_scale_e { coord_shift = CoordShift, coord_scale = 1 << coord_shift }; T x,y; vertex_integer() {} vertex_integer(T x_, T y_, unsigned flag) : x(((x_ << 1) & ~1) | (flag & 1)), y(((y_ << 1) & ~1) | (flag >> 1)) {} unsigned vertex(double* x_, double* y_, double dx=0, double dy=0, double scale=1.0) const { *x_ = dx + (double(x >> 1) / coord_scale) * scale; *y_ = dy + (double(y >> 1) / coord_scale) * scale; switch(((y & 1) << 1) | (x & 1)) { case cmd_move_to: return path_cmd_move_to; case cmd_line_to: return path_cmd_line_to; case cmd_curve3: return path_cmd_curve3; case cmd_curve4: return path_cmd_curve4; } return path_cmd_stop; } }; //---------------------------------------------------path_storage_integer template class path_storage_integer { public: typedef T value_type; typedef vertex_integer vertex_integer_type; //-------------------------------------------------------------------- path_storage_integer() : m_storage(), m_vertex_idx(0), m_closed(true) {} //-------------------------------------------------------------------- void remove_all() { m_storage.remove_all(); } //-------------------------------------------------------------------- void move_to(T x, T y) { m_storage.add(vertex_integer_type(x, y, vertex_integer_type::cmd_move_to)); } //-------------------------------------------------------------------- void line_to(T x, T y) { m_storage.add(vertex_integer_type(x, y, vertex_integer_type::cmd_line_to)); } //-------------------------------------------------------------------- void curve3(T x_ctrl, T y_ctrl, T x_to, T y_to) { m_storage.add(vertex_integer_type(x_ctrl, y_ctrl, vertex_integer_type::cmd_curve3)); m_storage.add(vertex_integer_type(x_to, y_to, vertex_integer_type::cmd_curve3)); } //-------------------------------------------------------------------- void curve4(T x_ctrl1, T y_ctrl1, T x_ctrl2, T y_ctrl2, T x_to, T y_to) { m_storage.add(vertex_integer_type(x_ctrl1, y_ctrl1, vertex_integer_type::cmd_curve4)); m_storage.add(vertex_integer_type(x_ctrl2, y_ctrl2, vertex_integer_type::cmd_curve4)); m_storage.add(vertex_integer_type(x_to, y_to, vertex_integer_type::cmd_curve4)); } //-------------------------------------------------------------------- void close_polygon() {} //-------------------------------------------------------------------- unsigned size() const { return m_storage.size(); } unsigned vertex(unsigned idx, double* x, double* y) const { return m_storage[idx].vertex(x, y); } //-------------------------------------------------------------------- unsigned byte_size() const { return m_storage.size() * sizeof(vertex_integer_type); } void serialize(int8u* ptr) const { unsigned i; for(i = 0; i < m_storage.size(); i++) { memcpy(ptr, &m_storage[i], sizeof(vertex_integer_type)); ptr += sizeof(vertex_integer_type); } } //-------------------------------------------------------------------- void rewind(unsigned) { m_vertex_idx = 0; m_closed = true; } //-------------------------------------------------------------------- unsigned vertex(double* x, double* y) { if(m_storage.size() < 2 || m_vertex_idx > m_storage.size()) { *x = 0; *y = 0; return path_cmd_stop; } if(m_vertex_idx == m_storage.size()) { *x = 0; *y = 0; ++m_vertex_idx; return path_cmd_end_poly | path_flags_close; } unsigned cmd = m_storage[m_vertex_idx].vertex(x, y); if(is_move_to(cmd) && !m_closed) { *x = 0; *y = 0; m_closed = true; return path_cmd_end_poly | path_flags_close; } m_closed = false; ++m_vertex_idx; return cmd; } //-------------------------------------------------------------------- rect_d bounding_rect() const { rect_d bounds(1e100, 1e100, -1e100, -1e100); if(m_storage.size() == 0) { bounds.x1 = bounds.y1 = bounds.x2 = bounds.y2 = 0.0; } else { unsigned i; for(i = 0; i < m_storage.size(); i++) { double x, y; m_storage[i].vertex(&x, &y); if(x < bounds.x1) bounds.x1 = x; if(y < bounds.y1) bounds.y1 = y; if(x > bounds.x2) bounds.x2 = x; if(y > bounds.y2) bounds.y2 = y; } } return bounds; } private: pod_bvector m_storage; unsigned m_vertex_idx; bool m_closed; }; //-----------------------------------------serialized_integer_path_adaptor template class serialized_integer_path_adaptor { public: typedef vertex_integer vertex_integer_type; //-------------------------------------------------------------------- serialized_integer_path_adaptor() : m_data(0), m_end(0), m_ptr(0), m_dx(0.0), m_dy(0.0), m_scale(1.0), m_vertices(0) {} //-------------------------------------------------------------------- serialized_integer_path_adaptor(const int8u* data, unsigned size, double dx, double dy) : m_data(data), m_end(data + size), m_ptr(data), m_dx(dx), m_dy(dy), m_vertices(0) {} //-------------------------------------------------------------------- void init(const int8u* data, unsigned size, double dx, double dy, double scale=1.0) { m_data = data; m_end = data + size; m_ptr = data; m_dx = dx; m_dy = dy; m_scale = scale; m_vertices = 0; } //-------------------------------------------------------------------- void rewind(unsigned) { m_ptr = m_data; m_vertices = 0; } //-------------------------------------------------------------------- unsigned vertex(double* x, double* y) { if(m_data == 0 || m_ptr > m_end) { *x = 0; *y = 0; return path_cmd_stop; } if(m_ptr == m_end) { *x = 0; *y = 0; m_ptr += sizeof(vertex_integer_type); return path_cmd_end_poly | path_flags_close; } vertex_integer_type v; memcpy(&v, m_ptr, sizeof(vertex_integer_type)); unsigned cmd = v.vertex(x, y, m_dx, m_dy, m_scale); if(is_move_to(cmd) && m_vertices > 2) { *x = 0; *y = 0; m_vertices = 0; return path_cmd_end_poly | path_flags_close; } ++m_vertices; m_ptr += sizeof(vertex_integer_type); return cmd; } private: const int8u* m_data; const int8u* m_end; const int8u* m_ptr; double m_dx; double m_dy; double m_scale; unsigned m_vertices; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_marker.h0000644000175000017500000001106413233644505024275 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // conv_marker // //---------------------------------------------------------------------------- #ifndef AGG_CONV_MARKER_INCLUDED #define AGG_CONV_MARKER_INCLUDED #include "agg_basics.h" #include "agg_trans_affine.h" namespace agg24 { //-------------------------------------------------------------conv_marker template class conv_marker { public: conv_marker(MarkerLocator& ml, MarkerShapes& ms); trans_affine& transform() { return m_transform; } const trans_affine& transform() const { return m_transform; } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: conv_marker(const conv_marker&); const conv_marker& operator = (const conv_marker&); enum status_e { initial, markers, polygon, stop }; MarkerLocator* m_marker_locator; MarkerShapes* m_marker_shapes; trans_affine m_transform; trans_affine m_mtx; status_e m_status; unsigned m_marker; unsigned m_num_markers; }; //------------------------------------------------------------------------ template conv_marker::conv_marker(MarkerLocator& ml, MarkerShapes& ms) : m_marker_locator(&ml), m_marker_shapes(&ms), m_status(initial), m_marker(0), m_num_markers(1) { } //------------------------------------------------------------------------ template void conv_marker::rewind(unsigned) { m_status = initial; m_marker = 0; m_num_markers = 1; } //------------------------------------------------------------------------ template unsigned conv_marker::vertex(double* x, double* y) { unsigned cmd = path_cmd_move_to; double x1, y1, x2, y2; while(!is_stop(cmd)) { switch(m_status) { case initial: if(m_num_markers == 0) { cmd = path_cmd_stop; break; } m_marker_locator->rewind(m_marker); ++m_marker; m_num_markers = 0; m_status = markers; case markers: if(is_stop(m_marker_locator->vertex(&x1, &y1))) { m_status = initial; break; } if(is_stop(m_marker_locator->vertex(&x2, &y2))) { m_status = initial; break; } ++m_num_markers; m_mtx = m_transform; m_mtx *= trans_affine_rotation(atan2(y2 - y1, x2 - x1)); m_mtx *= trans_affine_translation(x1, y1); m_marker_shapes->rewind(m_marker - 1); m_status = polygon; case polygon: cmd = m_marker_shapes->vertex(x, y); if(is_stop(cmd)) { cmd = path_cmd_move_to; m_status = markers; break; } m_mtx.transform(x, y); return cmd; case stop: cmd = path_cmd_stop; break; } } return cmd; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_trans_viewport.h0000644000175000017500000002326313233644505025061 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Viewport transformer - simple orthogonal conversions from world coordinates // to screen (device) ones. // //---------------------------------------------------------------------------- #ifndef AGG_TRANS_VIEWPORT_INCLUDED #define AGG_TRANS_VIEWPORT_INCLUDED #include #include "agg_trans_affine.h" namespace agg24 { enum aspect_ratio_e { aspect_ratio_stretch, aspect_ratio_meet, aspect_ratio_slice }; //----------------------------------------------------------trans_viewport class trans_viewport { public: //------------------------------------------------------------------- trans_viewport() : m_world_x1(0.0), m_world_y1(0.0), m_world_x2(1.0), m_world_y2(1.0), m_device_x1(0.0), m_device_y1(0.0), m_device_x2(1.0), m_device_y2(1.0), m_aspect(aspect_ratio_stretch), m_is_valid(true), m_align_x(0.5), m_align_y(0.5), m_wx1(0.0), m_wy1(0.0), m_wx2(1.0), m_wy2(1.0), m_dx1(0.0), m_dy1(0.0), m_kx(1.0), m_ky(1.0) {} //------------------------------------------------------------------- void preserve_aspect_ratio(double alignx, double aligny, aspect_ratio_e aspect) { m_align_x = alignx; m_align_y = aligny; m_aspect = aspect; update(); } //------------------------------------------------------------------- void device_viewport(double x1, double y1, double x2, double y2) { m_device_x1 = x1; m_device_y1 = y1; m_device_x2 = x2; m_device_y2 = y2; update(); } //------------------------------------------------------------------- void world_viewport(double x1, double y1, double x2, double y2) { m_world_x1 = x1; m_world_y1 = y1; m_world_x2 = x2; m_world_y2 = y2; update(); } //------------------------------------------------------------------- void device_viewport(double* x1, double* y1, double* x2, double* y2) const { *x1 = m_device_x1; *y1 = m_device_y1; *x2 = m_device_x2; *y2 = m_device_y2; } //------------------------------------------------------------------- void world_viewport(double* x1, double* y1, double* x2, double* y2) const { *x1 = m_world_x1; *y1 = m_world_y1; *x2 = m_world_x2; *y2 = m_world_y2; } //------------------------------------------------------------------- void world_viewport_actual(double* x1, double* y1, double* x2, double* y2) const { *x1 = m_wx1; *y1 = m_wy1; *x2 = m_wx2; *y2 = m_wy2; } //------------------------------------------------------------------- bool is_valid() const { return m_is_valid; } double align_x() const { return m_align_x; } double align_y() const { return m_align_y; } aspect_ratio_e aspect_ratio() const { return m_aspect; } //------------------------------------------------------------------- void transform(double* x, double* y) const { *x = (*x - m_wx1) * m_kx + m_dx1; *y = (*y - m_wy1) * m_ky + m_dy1; } //------------------------------------------------------------------- void transform_scale_only(double* x, double* y) const { *x *= m_kx; *y *= m_ky; } //------------------------------------------------------------------- void inverse_transform(double* x, double* y) const { *x = (*x - m_dx1) / m_kx + m_wx1; *y = (*y - m_dy1) / m_ky + m_wy1; } //------------------------------------------------------------------- void inverse_transform_scale_only(double* x, double* y) const { *x /= m_kx; *y /= m_ky; } //------------------------------------------------------------------- double device_dx() const { return m_dx1 - m_wx1 * m_kx; } double device_dy() const { return m_dy1 - m_wy1 * m_ky; } //------------------------------------------------------------------- double scale_x() const { return m_kx; } //------------------------------------------------------------------- double scale_y() const { return m_ky; } //------------------------------------------------------------------- double scale() const { return (m_kx + m_ky) * 0.5; } //------------------------------------------------------------------- trans_affine to_affine() const { trans_affine mtx = trans_affine_translation(-m_wx1, -m_wy1); mtx *= trans_affine_scaling(m_kx, m_ky); mtx *= trans_affine_translation(m_dx1, m_dy1); return mtx; } //------------------------------------------------------------------- trans_affine to_affine_scale_only() const { return trans_affine_scaling(m_kx, m_ky); } //------------------------------------------------------------------- unsigned byte_size() const { return sizeof(*this); } void serialize(int8u* ptr) const { memcpy(ptr, this, sizeof(*this)); } void deserialize(const int8u* ptr) { memcpy(this, ptr, sizeof(*this)); } private: void update(); double m_world_x1; double m_world_y1; double m_world_x2; double m_world_y2; double m_device_x1; double m_device_y1; double m_device_x2; double m_device_y2; aspect_ratio_e m_aspect; bool m_is_valid; double m_align_x; double m_align_y; double m_wx1; double m_wy1; double m_wx2; double m_wy2; double m_dx1; double m_dy1; double m_kx; double m_ky; }; //----------------------------------------------------------------------- inline void trans_viewport::update() { const double epsilon = 1e-30; if(fabs(m_world_x1 - m_world_x2) < epsilon || fabs(m_world_y1 - m_world_y2) < epsilon || fabs(m_device_x1 - m_device_x2) < epsilon || fabs(m_device_y1 - m_device_y2) < epsilon) { m_wx1 = m_world_x1; m_wy1 = m_world_y1; m_wx2 = m_world_x1 + 1.0; m_wy2 = m_world_y2 + 1.0; m_dx1 = m_device_x1; m_dy1 = m_device_y1; m_kx = 1.0; m_ky = 1.0; m_is_valid = false; return; } double world_x1 = m_world_x1; double world_y1 = m_world_y1; double world_x2 = m_world_x2; double world_y2 = m_world_y2; double device_x1 = m_device_x1; double device_y1 = m_device_y1; double device_x2 = m_device_x2; double device_y2 = m_device_y2; if(m_aspect != aspect_ratio_stretch) { double d; m_kx = (device_x2 - device_x1) / (world_x2 - world_x1); m_ky = (device_y2 - device_y1) / (world_y2 - world_y1); if((m_aspect == aspect_ratio_meet) == (m_kx < m_ky)) { d = (world_y2 - world_y1) * m_ky / m_kx; world_y1 += (world_y2 - world_y1 - d) * m_align_y; world_y2 = world_y1 + d; } else { d = (world_x2 - world_x1) * m_kx / m_ky; world_x1 += (world_x2 - world_x1 - d) * m_align_x; world_x2 = world_x1 + d; } } m_wx1 = world_x1; m_wy1 = world_y1; m_wx2 = world_x2; m_wy2 = world_y2; m_dx1 = device_x1; m_dy1 = device_y1; m_kx = (device_x2 - device_x1) / (world_x2 - world_x1); m_ky = (device_y2 - device_y1) / (world_y2 - world_y1); m_is_valid = true; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_trans_warp_magnifier.h0000644000175000017500000000343113233644505026167 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_WARP_MAGNIFIER_INCLUDED #define AGG_WARP_MAGNIFIER_INCLUDED namespace agg24 { //----------------------------------------------------trans_warp_magnifier // // See Inmplementation agg_trans_warp_magnifier.cpp // class trans_warp_magnifier { public: trans_warp_magnifier() : m_xc(0.0), m_yc(0.0), m_magn(1.0), m_radius(1.0) {} void center(double x, double y) { m_xc = x; m_yc = y; } void magnification(double m) { m_magn = m; } void radius(double r) { m_radius = r; } double xc() const { return m_xc; } double yc() const { return m_yc; } double magnification() const { return m_magn; } double radius() const { return m_radius; } void transform(double* x, double* y) const; void inverse_transform(double* x, double* y) const; private: double m_xc; double m_yc; double m_magn; double m_radius; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_arc.h0000644000175000017500000000407613233644505022541 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Arc vertex generator // //---------------------------------------------------------------------------- #ifndef AGG_ARC_INCLUDED #define AGG_ARC_INCLUDED #include #include "agg_basics.h" namespace agg24 { //=====================================================================arc // // See Implementation agg_arc.cpp // class arc { public: arc() : m_scale(1.0), m_initialized(false) {} arc(double x, double y, double rx, double ry, double a1, double a2, bool ccw=true); void init(double x, double y, double rx, double ry, double a1, double a2, bool ccw=true); void approximation_scale(double s); double approximation_scale() const { return m_scale; } void rewind(unsigned); unsigned vertex(double* x, double* y); private: void normalize(double a1, double a2, bool ccw); double m_x; double m_y; double m_rx; double m_ry; double m_angle; double m_start; double m_end; double m_scale; double m_da; bool m_ccw; bool m_initialized; unsigned m_path_cmd; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_pixfmt_rgba.h0000644000175000017500000032673413233644505024306 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for high precision colors has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_PIXFMT_RGBA_INCLUDED #define AGG_PIXFMT_RGBA_INCLUDED #include #include #include "agg_pixfmt_base.h" #include "agg_rendering_buffer.h" namespace agg24 { template inline T sd_min(T a, T b) { return (a < b) ? a : b; } template inline T sd_max(T a, T b) { return (a > b) ? a : b; } inline rgba & clip(rgba & c) { if (c.a > 1) c.a = 1; else if (c.a < 0) c.a = 0; if (c.r > c.a) c.r = c.a; else if (c.r < 0) c.r = 0; if (c.g > c.a) c.g = c.a; else if (c.g < 0) c.g = 0; if (c.b > c.a) c.b = c.a; else if (c.b < 0) c.b = 0; return c; } //=========================================================multiplier_rgba template struct multiplier_rgba { typedef ColorT color_type; typedef typename color_type::value_type value_type; //-------------------------------------------------------------------- static AGG_INLINE void premultiply(value_type* p) { value_type a = p[Order::A]; p[Order::R] = color_type::multiply(p[Order::R], a); p[Order::G] = color_type::multiply(p[Order::G], a); p[Order::B] = color_type::multiply(p[Order::B], a); } //-------------------------------------------------------------------- static AGG_INLINE void demultiply(value_type* p) { value_type a = p[Order::A]; p[Order::R] = color_type::demultiply(p[Order::R], a); p[Order::G] = color_type::demultiply(p[Order::G], a); p[Order::B] = color_type::demultiply(p[Order::B], a); } }; //=====================================================apply_gamma_dir_rgba template class apply_gamma_dir_rgba { public: typedef ColorT color_type; typedef typename color_type::value_type value_type; apply_gamma_dir_rgba(const GammaLut& gamma) : m_gamma(gamma) {} AGG_INLINE void operator () (value_type* p) { p[Order::R] = m_gamma.dir(p[Order::R]); p[Order::G] = m_gamma.dir(p[Order::G]); p[Order::B] = m_gamma.dir(p[Order::B]); } private: const GammaLut& m_gamma; }; //=====================================================apply_gamma_inv_rgba template class apply_gamma_inv_rgba { public: typedef ColorT color_type; typedef typename color_type::value_type value_type; apply_gamma_inv_rgba(const GammaLut& gamma) : m_gamma(gamma) {} AGG_INLINE void operator () (value_type* p) { p[Order::R] = m_gamma.inv(p[Order::R]); p[Order::G] = m_gamma.inv(p[Order::G]); p[Order::B] = m_gamma.inv(p[Order::B]); } private: const GammaLut& m_gamma; }; template struct conv_rgba_pre { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; //-------------------------------------------------------------------- static AGG_INLINE void set_plain_color(value_type* p, color_type c) { c.premultiply(); p[Order::R] = c.r; p[Order::G] = c.g; p[Order::B] = c.b; p[Order::A] = c.a; } //-------------------------------------------------------------------- static AGG_INLINE color_type get_plain_color(const value_type* p) { return color_type( p[Order::R], p[Order::G], p[Order::B], p[Order::A]).demultiply(); } }; template struct conv_rgba_plain { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; //-------------------------------------------------------------------- static AGG_INLINE void set_plain_color(value_type* p, color_type c) { p[Order::R] = c.r; p[Order::G] = c.g; p[Order::B] = c.b; p[Order::A] = c.a; } //-------------------------------------------------------------------- static AGG_INLINE color_type get_plain_color(const value_type* p) { return color_type( p[Order::R], p[Order::G], p[Order::B], p[Order::A]); } }; //=============================================================blender_rgba // Blends "plain" (i.e. non-premultiplied) colors into a premultiplied buffer. template struct blender_rgba : conv_rgba_pre { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; // Blend pixels using the non-premultiplied form of Alvy-Ray Smith's // compositing function. Since the render buffer is in fact premultiplied // we omit the initial premultiplication and final demultiplication. //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha, cover_type cover) { blend_pix(p, cr, cg, cb, color_type::mult_cover(alpha, cover)); } //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha) { p[Order::R] = color_type::lerp(p[Order::R], cr, alpha); p[Order::G] = color_type::lerp(p[Order::G], cg, alpha); p[Order::B] = color_type::lerp(p[Order::B], cb, alpha); p[Order::A] = color_type::prelerp(p[Order::A], alpha, alpha); } }; //========================================================blender_rgba_pre // Blends premultiplied colors into a premultiplied buffer. template struct blender_rgba_pre : conv_rgba_pre { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; // Blend pixels using the premultiplied form of Alvy-Ray Smith's // compositing function. //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha, cover_type cover) { blend_pix(p, color_type::mult_cover(cr, cover), color_type::mult_cover(cg, cover), color_type::mult_cover(cb, cover), color_type::mult_cover(alpha, cover)); } //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha) { p[Order::R] = color_type::prelerp(p[Order::R], cr, alpha); p[Order::G] = color_type::prelerp(p[Order::G], cg, alpha); p[Order::B] = color_type::prelerp(p[Order::B], cb, alpha); p[Order::A] = color_type::prelerp(p[Order::A], alpha, alpha); } }; //======================================================blender_rgba_plain // Blends "plain" (non-premultiplied) colors into a plain (non-premultiplied) buffer. template struct blender_rgba_plain : conv_rgba_plain { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; // Blend pixels using the non-premultiplied form of Alvy-Ray Smith's // compositing function. //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha, cover_type cover) { blend_pix(p, cr, cg, cb, color_type::mult_cover(alpha, cover)); } //-------------------------------------------------------------------- static AGG_INLINE void blend_pix(value_type* p, value_type cr, value_type cg, value_type cb, value_type alpha) { if (alpha > color_type::empty_value()) { calc_type a = p[Order::A]; calc_type r = color_type::multiply(p[Order::R], a); calc_type g = color_type::multiply(p[Order::G], a); calc_type b = color_type::multiply(p[Order::B], a); p[Order::R] = color_type::lerp(r, cr, alpha); p[Order::G] = color_type::lerp(g, cg, alpha); p[Order::B] = color_type::lerp(b, cb, alpha); p[Order::A] = color_type::prelerp(a, alpha, alpha); multiplier_rgba::demultiply(p); } } }; // SVG compositing operations. // For specifications, see http://www.w3.org/TR/SVGCompositing/ //=========================================================comp_op_rgba_clear template struct comp_op_rgba_clear : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = 0 // Da' = 0 static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { if (cover >= cover_full) { p[0] = p[1] = p[2] = p[3] = color_type::empty_value(); } else if (cover > cover_none) { set(p, get(p, cover_full - cover)); } } }; //===========================================================comp_op_rgba_src template struct comp_op_rgba_src : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca // Da' = Sa static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { if (cover >= cover_full) { set(p, r, g, b, a); } else { rgba s = get(r, g, b, a, cover); rgba d = get(p, cover_full - cover); d.r += s.r; d.g += s.g; d.b += s.b; d.a += s.a; set(p, d); } } }; //===========================================================comp_op_rgba_dst template struct comp_op_rgba_dst : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; // Dca' = Dca.Sa + Dca.(1 - Sa) = Dca // Da' = Da.Sa + Da.(1 - Sa) = Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { // Well, that was easy! } }; //======================================================comp_op_rgba_src_over template struct comp_op_rgba_src_over : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca + Dca.(1 - Sa) = Dca + Sca - Dca.Sa // Da' = Sa + Da - Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { #if 1 blender_rgba_pre::blend_pix(p, r, g, b, a, cover); #else rgba s = get(r, g, b, a, cover); rgba d = get(p); d.r += s.r - d.r * s.a; d.g += s.g - d.g * s.a; d.b += s.b - d.b * s.a; d.a += s.a - d.a * s.a; set(p, d); #endif } }; //======================================================comp_op_rgba_dst_over template struct comp_op_rgba_dst_over : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Dca + Sca.(1 - Da) // Da' = Sa + Da - Sa.Da = Da + Sa.(1 - Da) static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); rgba d = get(p); double d1a = 1 - d.a; d.r += s.r * d1a; d.g += s.g * d1a; d.b += s.b * d1a; d.a += s.a * d1a; set(p, d); } }; //======================================================comp_op_rgba_src_in template struct comp_op_rgba_src_in : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca.Da // Da' = Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { double da = ColorT::to_double(p[Order::A]); if (da > 0) { rgba s = get(r, g, b, a, cover); rgba d = get(p, cover_full - cover); d.r += s.r * da; d.g += s.g * da; d.b += s.b * da; d.a += s.a * da; set(p, d); } } }; //======================================================comp_op_rgba_dst_in template struct comp_op_rgba_dst_in : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Dca.Sa // Da' = Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { double sa = ColorT::to_double(a); rgba d = get(p, cover_full - cover); rgba d2 = get(p, cover); d.r += d2.r * sa; d.g += d2.g * sa; d.b += d2.b * sa; d.a += d2.a * sa; set(p, d); } }; //======================================================comp_op_rgba_src_out template struct comp_op_rgba_src_out : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca.(1 - Da) // Da' = Sa.(1 - Da) static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); rgba d = get(p, cover_full - cover); double d1a = 1 - ColorT::to_double(p[Order::A]); d.r += s.r * d1a; d.g += s.g * d1a; d.b += s.b * d1a; d.a += s.a * d1a; set(p, d); } }; //======================================================comp_op_rgba_dst_out template struct comp_op_rgba_dst_out : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Dca.(1 - Sa) // Da' = Da.(1 - Sa) static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba d = get(p, cover_full - cover); rgba dc = get(p, cover); double s1a = 1 - ColorT::to_double(a); d.r += dc.r * s1a; d.g += dc.g * s1a; d.b += dc.b * s1a; d.a += dc.a * s1a; set(p, d); } }; //=====================================================comp_op_rgba_src_atop template struct comp_op_rgba_src_atop : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca.Da + Dca.(1 - Sa) // Da' = Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); rgba d = get(p); double s1a = 1 - s.a; d.r = s.r * d.a + d.r * s1a; d.g = s.g * d.a + d.g * s1a; d.b = s.b * d.a + d.g * s1a; set(p, d); } }; //=====================================================comp_op_rgba_dst_atop template struct comp_op_rgba_dst_atop : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Dca.Sa + Sca.(1 - Da) // Da' = Sa static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba sc = get(r, g, b, a, cover); rgba dc = get(p, cover); rgba d = get(p, cover_full - cover); double sa = ColorT::to_double(a); double d1a = 1 - ColorT::to_double(p[Order::A]); d.r += dc.r * sa + sc.r * d1a; d.g += dc.g * sa + sc.g * d1a; d.b += dc.b * sa + sc.b * d1a; d.a += sc.a; set(p, d); } }; //=========================================================comp_op_rgba_xor template struct comp_op_rgba_xor : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - 2.Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); rgba d = get(p); double s1a = 1 - s.a; double d1a = 1 - ColorT::to_double(p[Order::A]); d.r = s.r * d1a + d.r * s1a; d.g = s.g * d1a + d.g * s1a; d.b = s.b * d1a + d.b * s1a; d.a = s.a + d.a - 2 * s.a * d.a; set(p, d); } }; //=========================================================comp_op_rgba_plus template struct comp_op_rgba_plus : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca + Dca // Da' = Sa + Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); d.a = sd_min(d.a + s.a, 1.0); d.r = sd_min(d.r + s.r, d.a); d.g = sd_min(d.g + s.g, d.a); d.b = sd_min(d.b + s.b, d.a); set(p, clip(d)); } } }; //========================================================comp_op_rgba_minus // Note: not included in SVG spec. template struct comp_op_rgba_minus : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Dca - Sca // Da' = 1 - (1 - Sa).(1 - Da) = Da + Sa - Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); d.a += s.a - s.a * d.a; d.r = sd_max(d.r - s.r, 0.0); d.g = sd_max(d.g - s.g, 0.0); d.b = sd_max(d.b - s.b, 0.0); set(p, clip(d)); } } }; //=====================================================comp_op_rgba_multiply template struct comp_op_rgba_multiply : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); double s1a = 1 - s.a; double d1a = 1 - d.a; d.r = s.r * d.r + s.r * d1a + d.r * s1a; d.g = s.g * d.g + s.g * d1a + d.g * s1a; d.b = s.b * d.b + s.b * d1a + d.b * s1a; d.a += s.a - s.a * d.a; set(p, clip(d)); } } }; //=====================================================comp_op_rgba_screen template struct comp_op_rgba_screen : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca + Dca - Sca.Dca // Da' = Sa + Da - Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); d.r += s.r - s.r * d.r; d.g += s.g - s.g * d.g; d.b += s.b - s.b * d.b; d.a += s.a - s.a * d.a; set(p, clip(d)); } } }; //=====================================================comp_op_rgba_overlay template struct comp_op_rgba_overlay : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // if 2.Dca <= Da // Dca' = 2.Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa) // otherwise // Dca' = Sa.Da - 2.(Da - Dca).(Sa - Sca) + Sca.(1 - Da) + Dca.(1 - Sa) // // Da' = Sa + Da - Sa.Da static AGG_INLINE double calc(double dca, double sca, double da, double sa, double sada, double d1a, double s1a) { return (2 * dca <= da) ? 2 * sca * dca + sca * d1a + dca * s1a : sada - 2 * (da - dca) * (sa - sca) + sca * d1a + dca * s1a; } static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); double d1a = 1 - d.a; double s1a = 1 - s.a; double sada = s.a * d.a; d.r = calc(d.r, s.r, d.a, s.a, sada, d1a, s1a); d.g = calc(d.g, s.g, d.a, s.a, sada, d1a, s1a); d.b = calc(d.b, s.b, d.a, s.a, sada, d1a, s1a); d.a += s.a - s.a * d.a; set(p, clip(d)); } } }; //=====================================================comp_op_rgba_darken template struct comp_op_rgba_darken : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = min(Sca.Da, Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); double d1a = 1 - d.a; double s1a = 1 - s.a; d.r = sd_min(s.r * d.a, d.r * s.a) + s.r * d1a + d.r * s1a; d.g = sd_min(s.g * d.a, d.g * s.a) + s.g * d1a + d.g * s1a; d.b = sd_min(s.b * d.a, d.b * s.a) + s.b * d1a + d.b * s1a; d.a += s.a - s.a * d.a; set(p, clip(d)); } } }; //=====================================================comp_op_rgba_lighten template struct comp_op_rgba_lighten : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = max(Sca.Da, Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); double d1a = 1 - d.a; double s1a = 1 - s.a; d.r = sd_max(s.r * d.a, d.r * s.a) + s.r * d1a + d.r * s1a; d.g = sd_max(s.g * d.a, d.g * s.a) + s.g * d1a + d.g * s1a; d.b = sd_max(s.b * d.a, d.b * s.a) + s.b * d1a + d.b * s1a; d.a += s.a - s.a * d.a; set(p, clip(d)); } } }; //=====================================================comp_op_rgba_color_dodge template struct comp_op_rgba_color_dodge : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // if Sca == Sa and Dca == 0 // Dca' = Sca.(1 - Da) + Dca.(1 - Sa) = Sca.(1 - Da) // otherwise if Sca == Sa // Dca' = Sa.Da + Sca.(1 - Da) + Dca.(1 - Sa) // otherwise if Sca < Sa // Dca' = Sa.Da.min(1, Dca/Da.Sa/(Sa - Sca)) + Sca.(1 - Da) + Dca.(1 - Sa) // // Da' = Sa + Da - Sa.Da static AGG_INLINE double calc(double dca, double sca, double da, double sa, double sada, double d1a, double s1a) { if (sca < sa) return sada * sd_min(1.0, (dca / da) * sa / (sa - sca)) + sca * d1a + dca * s1a; if (dca > 0) return sada + sca * d1a + dca * s1a; return sca * d1a; } static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); if (d.a > 0) { double sada = s.a * d.a; double s1a = 1 - s.a; double d1a = 1 - d.a; d.r = calc(d.r, s.r, d.a, s.a, sada, d1a, s1a); d.g = calc(d.g, s.g, d.a, s.a, sada, d1a, s1a); d.b = calc(d.b, s.b, d.a, s.a, sada, d1a, s1a); d.a += s.a - s.a * d.a; set(p, clip(d)); } else set(p, s); } } }; //=====================================================comp_op_rgba_color_burn template struct comp_op_rgba_color_burn : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // if Sca == 0 and Dca == Da // Dca' = Sa.Da + Dca.(1 - Sa) // otherwise if Sca == 0 // Dca' = Dca.(1 - Sa) // otherwise if Sca > 0 // Dca' = Sa.Da.(1 - min(1, (1 - Dca/Da).Sa/Sca)) + Sca.(1 - Da) + Dca.(1 - Sa) static AGG_INLINE double calc(double dca, double sca, double da, double sa, double sada, double d1a, double s1a) { if (sca > 0) return sada * (1 - sd_min(1.0, (1 - dca / da) * sa / sca)) + sca * d1a + dca * s1a; if (dca > da) return sada + dca * s1a; return dca * s1a; } static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); if (d.a > 0) { double sada = s.a * d.a; double s1a = 1 - s.a; double d1a = 1 - d.a; d.r = calc(d.r, s.r, d.a, s.a, sada, d1a, s1a); d.g = calc(d.g, s.g, d.a, s.a, sada, d1a, s1a); d.b = calc(d.b, s.b, d.a, s.a, sada, d1a, s1a); d.a += s.a - sada; set(p, clip(d)); } else set(p, s); } } }; //=====================================================comp_op_rgba_hard_light template struct comp_op_rgba_hard_light : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // if 2.Sca < Sa // Dca' = 2.Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa) // otherwise // Dca' = Sa.Da - 2.(Da - Dca).(Sa - Sca) + Sca.(1 - Da) + Dca.(1 - Sa) // // Da' = Sa + Da - Sa.Da static AGG_INLINE double calc(double dca, double sca, double da, double sa, double sada, double d1a, double s1a) { return (2 * sca < sa) ? 2 * sca * dca + sca * d1a + dca * s1a : sada - 2 * (da - dca) * (sa - sca) + sca * d1a + dca * s1a; } static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); double d1a = 1 - d.a; double s1a = 1 - s.a; double sada = s.a * d.a; d.r = calc(d.r, s.r, d.a, s.a, sada, d1a, s1a); d.g = calc(d.g, s.g, d.a, s.a, sada, d1a, s1a); d.b = calc(d.b, s.b, d.a, s.a, sada, d1a, s1a); d.a += s.a - sada; set(p, clip(d)); } } }; //=====================================================comp_op_rgba_soft_light template struct comp_op_rgba_soft_light : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // if 2.Sca <= Sa // Dca' = Dca.Sa - (Sa.Da - 2.Sca.Da).Dca.Sa.(Sa.Da - Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa) // otherwise if 2.Sca > Sa and 4.Dca <= Da // Dca' = Dca.Sa + (2.Sca.Da - Sa.Da).((((16.Dsa.Sa - 12).Dsa.Sa + 4).Dsa.Da) - Dsa.Da) + Sca.(1 - Da) + Dca.(1 - Sa) // otherwise if 2.Sca > Sa and 4.Dca > Da // Dca' = Dca.Sa + (2.Sca.Da - Sa.Da).((Dca.Sa)^0.5 - Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa) // // Da' = Sa + Da - Sa.Da static AGG_INLINE double calc(double dca, double sca, double da, double sa, double sada, double d1a, double s1a) { double dcasa = dca * sa; if (2 * sca <= sa) return dcasa - (sada - 2 * sca * da) * dcasa * (sada - dcasa) + sca * d1a + dca * s1a; if (4 * dca <= da) return dcasa + (2 * sca * da - sada) * ((((16 * dcasa - 12) * dcasa + 4) * dca * da) - dca * da) + sca * d1a + dca * s1a; return dcasa + (2 * sca * da - sada) * (sqrt(dcasa) - dcasa) + sca * d1a + dca * s1a; } static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); if (d.a > 0) { double sada = s.a * d.a; double s1a = 1 - s.a; double d1a = 1 - d.a; d.r = calc(d.r, s.r, d.a, s.a, sada, d1a, s1a); d.g = calc(d.g, s.g, d.a, s.a, sada, d1a, s1a); d.b = calc(d.b, s.b, d.a, s.a, sada, d1a, s1a); d.a += s.a - sada; set(p, clip(d)); } else set(p, s); } } }; //=====================================================comp_op_rgba_difference template struct comp_op_rgba_difference : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = Sca + Dca - 2.min(Sca.Da, Dca.Sa) // Da' = Sa + Da - Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); d.r += s.r - 2 * sd_min(s.r * d.a, d.r * s.a); d.g += s.g - 2 * sd_min(s.g * d.a, d.g * s.a); d.b += s.b - 2 * sd_min(s.b * d.a, d.b * s.a); d.a += s.a - s.a * d.a; set(p, clip(d)); } } }; //=====================================================comp_op_rgba_exclusion template struct comp_op_rgba_exclusion : blender_base { typedef ColorT color_type; typedef typename color_type::value_type value_type; using blender_base::get; using blender_base::set; // Dca' = (Sca.Da + Dca.Sa - 2.Sca.Dca) + Sca.(1 - Da) + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da static AGG_INLINE void blend_pix(value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { rgba s = get(r, g, b, a, cover); if (s.a > 0) { rgba d = get(p); double d1a = 1 - d.a; double s1a = 1 - s.a; d.r = (s.r * d.a + d.r * s.a - 2 * s.r * d.r) + s.r * d1a + d.r * s1a; d.g = (s.g * d.a + d.g * s.a - 2 * s.g * d.g) + s.g * d1a + d.g * s1a; d.b = (s.b * d.a + d.b * s.a - 2 * s.b * d.b) + s.b * d1a + d.b * s1a; d.a += s.a - s.a * d.a; set(p, clip(d)); } } }; #if 0 //=====================================================comp_op_rgba_contrast template struct comp_op_rgba_contrast { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } long_type dr = p[Order::R]; long_type dg = p[Order::G]; long_type db = p[Order::B]; int da = p[Order::A]; long_type d2a = da >> 1; unsigned s2a = sa >> 1; int r = (int)((((dr - d2a) * int((sr - s2a)*2 + base_mask)) >> base_shift) + d2a); int g = (int)((((dg - d2a) * int((sg - s2a)*2 + base_mask)) >> base_shift) + d2a); int b = (int)((((db - d2a) * int((sb - s2a)*2 + base_mask)) >> base_shift) + d2a); r = (r < 0) ? 0 : r; g = (g < 0) ? 0 : g; b = (b < 0) ? 0 : b; p[Order::R] = (value_type)((r > da) ? da : r); p[Order::G] = (value_type)((g > da) ? da : g); p[Order::B] = (value_type)((b > da) ? da : b); } }; //=====================================================comp_op_rgba_invert template struct comp_op_rgba_invert { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = (Da - Dca) * Sa + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { sa = (sa * cover + 255) >> 8; if (sa) { calc_type da = p[Order::A]; calc_type dr = ((da - p[Order::R]) * sa + base_mask) >> base_shift; calc_type dg = ((da - p[Order::G]) * sa + base_mask) >> base_shift; calc_type db = ((da - p[Order::B]) * sa + base_mask) >> base_shift; calc_type s1a = base_mask - sa; p[Order::R] = (value_type)(dr + ((p[Order::R] * s1a + base_mask) >> base_shift)); p[Order::G] = (value_type)(dg + ((p[Order::G] * s1a + base_mask) >> base_shift)); p[Order::B] = (value_type)(db + ((p[Order::B] * s1a + base_mask) >> base_shift)); p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift)); } } }; //=================================================comp_op_rgba_invert_rgb template struct comp_op_rgba_invert_rgb { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; enum base_scale_e { base_shift = color_type::base_shift, base_mask = color_type::base_mask }; // Dca' = (Da - Dca) * Sca + Dca.(1 - Sa) // Da' = Sa + Da - Sa.Da static AGG_INLINE void blend_pix(value_type* p, unsigned sr, unsigned sg, unsigned sb, unsigned sa, unsigned cover) { if (cover < 255) { sr = (sr * cover + 255) >> 8; sg = (sg * cover + 255) >> 8; sb = (sb * cover + 255) >> 8; sa = (sa * cover + 255) >> 8; } if (sa) { calc_type da = p[Order::A]; calc_type dr = ((da - p[Order::R]) * sr + base_mask) >> base_shift; calc_type dg = ((da - p[Order::G]) * sg + base_mask) >> base_shift; calc_type db = ((da - p[Order::B]) * sb + base_mask) >> base_shift; calc_type s1a = base_mask - sa; p[Order::R] = (value_type)(dr + ((p[Order::R] * s1a + base_mask) >> base_shift)); p[Order::G] = (value_type)(dg + ((p[Order::G] * s1a + base_mask) >> base_shift)); p[Order::B] = (value_type)(db + ((p[Order::B] * s1a + base_mask) >> base_shift)); p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift)); } } }; #endif //======================================================comp_op_table_rgba template struct comp_op_table_rgba { typedef typename ColorT::value_type value_type; typedef typename ColorT::calc_type calc_type; typedef void (*comp_op_func_type)(value_type* p, value_type cr, value_type cg, value_type cb, value_type ca, cover_type cover); static comp_op_func_type g_comp_op_func[]; }; //==========================================================g_comp_op_func template typename comp_op_table_rgba::comp_op_func_type comp_op_table_rgba::g_comp_op_func[] = { comp_op_rgba_clear ::blend_pix, comp_op_rgba_src ::blend_pix, comp_op_rgba_dst ::blend_pix, comp_op_rgba_src_over ::blend_pix, comp_op_rgba_dst_over ::blend_pix, comp_op_rgba_src_in ::blend_pix, comp_op_rgba_dst_in ::blend_pix, comp_op_rgba_src_out ::blend_pix, comp_op_rgba_dst_out ::blend_pix, comp_op_rgba_src_atop ::blend_pix, comp_op_rgba_dst_atop ::blend_pix, comp_op_rgba_xor ::blend_pix, comp_op_rgba_plus ::blend_pix, //comp_op_rgba_minus ::blend_pix, comp_op_rgba_multiply ::blend_pix, comp_op_rgba_screen ::blend_pix, comp_op_rgba_overlay ::blend_pix, comp_op_rgba_darken ::blend_pix, comp_op_rgba_lighten ::blend_pix, comp_op_rgba_color_dodge::blend_pix, comp_op_rgba_color_burn ::blend_pix, comp_op_rgba_hard_light ::blend_pix, comp_op_rgba_soft_light ::blend_pix, comp_op_rgba_difference ::blend_pix, comp_op_rgba_exclusion ::blend_pix, //comp_op_rgba_contrast ::blend_pix, //comp_op_rgba_invert ::blend_pix, //comp_op_rgba_invert_rgb ::blend_pix, 0 }; //==============================================================comp_op_e enum comp_op_e { comp_op_clear, //----comp_op_clear comp_op_src, //----comp_op_src comp_op_dst, //----comp_op_dst comp_op_src_over, //----comp_op_src_over comp_op_dst_over, //----comp_op_dst_over comp_op_src_in, //----comp_op_src_in comp_op_dst_in, //----comp_op_dst_in comp_op_src_out, //----comp_op_src_out comp_op_dst_out, //----comp_op_dst_out comp_op_src_atop, //----comp_op_src_atop comp_op_dst_atop, //----comp_op_dst_atop comp_op_xor, //----comp_op_xor comp_op_plus, //----comp_op_plus //comp_op_minus, //----comp_op_minus comp_op_multiply, //----comp_op_multiply comp_op_screen, //----comp_op_screen comp_op_overlay, //----comp_op_overlay comp_op_darken, //----comp_op_darken comp_op_lighten, //----comp_op_lighten comp_op_color_dodge, //----comp_op_color_dodge comp_op_color_burn, //----comp_op_color_burn comp_op_hard_light, //----comp_op_hard_light comp_op_soft_light, //----comp_op_soft_light comp_op_difference, //----comp_op_difference comp_op_exclusion, //----comp_op_exclusion //comp_op_contrast, //----comp_op_contrast //comp_op_invert, //----comp_op_invert //comp_op_invert_rgb, //----comp_op_invert_rgb end_of_comp_op_e }; //====================================================comp_op_adaptor_rgba template struct comp_op_adaptor_rgba { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { comp_op_table_rgba::g_comp_op_func[op](p, color_type::multiply(r, a), color_type::multiply(g, a), color_type::multiply(b, a), a, cover); } }; //=========================================comp_op_adaptor_clip_to_dst_rgba template struct comp_op_adaptor_clip_to_dst_rgba { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { r = color_type::multiply(r, a); g = color_type::multiply(g, a); b = color_type::multiply(b, a); value_type da = p[Order::A]; comp_op_table_rgba::g_comp_op_func[op](p, color_type::multiply(r, da), color_type::multiply(g, da), color_type::multiply(b, da), color_type::multiply(a, da), cover); } }; //================================================comp_op_adaptor_rgba_pre template struct comp_op_adaptor_rgba_pre { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { comp_op_table_rgba::g_comp_op_func[op](p, r, g, b, a, cover); } }; //=====================================comp_op_adaptor_clip_to_dst_rgba_pre template struct comp_op_adaptor_clip_to_dst_rgba_pre { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { value_type da = p[Order::A]; comp_op_table_rgba::g_comp_op_func[op](p, color_type::multiply(r, da), color_type::multiply(g, da), color_type::multiply(b, da), color_type::multiply(a, da), cover); } }; //====================================================comp_op_adaptor_rgba_plain template struct comp_op_adaptor_rgba_plain { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { multiplier_rgba::premultiply(p); comp_op_adaptor_rgba::blend_pix(op, p, r, g, b, a, cover); multiplier_rgba::demultiply(p); } }; //=========================================comp_op_adaptor_clip_to_dst_rgba_plain template struct comp_op_adaptor_clip_to_dst_rgba_plain { typedef ColorT color_type; typedef Order order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { multiplier_rgba::premultiply(p); comp_op_adaptor_clip_to_dst_rgba::blend_pix(op, p, r, g, b, a, cover); multiplier_rgba::demultiply(p); } }; //=======================================================comp_adaptor_rgba template struct comp_adaptor_rgba { typedef typename BlenderPre::color_type color_type; typedef typename BlenderPre::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { BlenderPre::blend_pix(p, color_type::multiply(r, a), color_type::multiply(g, a), color_type::multiply(b, a), a, cover); } }; //==========================================comp_adaptor_clip_to_dst_rgba template struct comp_adaptor_clip_to_dst_rgba { typedef typename BlenderPre::color_type color_type; typedef typename BlenderPre::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { r = color_type::multiply(r, a); g = color_type::multiply(g, a); b = color_type::multiply(b, a); value_type da = p[order_type::A]; BlenderPre::blend_pix(p, color_type::multiply(r, da), color_type::multiply(g, da), color_type::multiply(b, da), color_type::multiply(a, da), cover); } }; //=======================================================comp_adaptor_rgba_pre template struct comp_adaptor_rgba_pre { typedef typename BlenderPre::color_type color_type; typedef typename BlenderPre::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { BlenderPre::blend_pix(p, r, g, b, a, cover); } }; //======================================comp_adaptor_clip_to_dst_rgba_pre template struct comp_adaptor_clip_to_dst_rgba_pre { typedef typename BlenderPre::color_type color_type; typedef typename BlenderPre::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { unsigned da = p[order_type::A]; BlenderPre::blend_pix(p, color_type::multiply(r, da), color_type::multiply(g, da), color_type::multiply(b, da), color_type::multiply(a, da), cover); } }; //=======================================================comp_adaptor_rgba_plain template struct comp_adaptor_rgba_plain { typedef typename BlenderPre::color_type color_type; typedef typename BlenderPre::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { multiplier_rgba::premultiply(p); comp_adaptor_rgba::blend_pix(op, p, r, g, b, a, cover); multiplier_rgba::demultiply(p); } }; //==========================================comp_adaptor_clip_to_dst_rgba_plain template struct comp_adaptor_clip_to_dst_rgba_plain { typedef typename BlenderPre::color_type color_type; typedef typename BlenderPre::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; typedef typename color_type::long_type long_type; static AGG_INLINE void blend_pix(unsigned op, value_type* p, value_type r, value_type g, value_type b, value_type a, cover_type cover) { multiplier_rgba::premultiply(p); comp_adaptor_clip_to_dst_rgba::blend_pix(op, p, r, g, b, a, cover); multiplier_rgba::demultiply(p); } }; //=================================================pixfmt_alpha_blend_rgba template class pixfmt_alpha_blend_rgba { public: typedef pixfmt_rgba_tag pixfmt_category; typedef RenBuf rbuf_type; typedef typename rbuf_type::row_data row_data; typedef Blender blender_type; typedef typename blender_type::color_type color_type; typedef typename blender_type::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; enum { num_components = 4, pix_step = 4, pix_width = sizeof(value_type) * pix_step, }; struct pixel_type { value_type c[num_components]; void set(value_type r, value_type g, value_type b, value_type a) { c[order_type::R] = r; c[order_type::G] = g; c[order_type::B] = b; c[order_type::A] = a; } void set(const color_type& color) { set(color.r, color.g, color.b, color.a); } void get(value_type& r, value_type& g, value_type& b, value_type& a) const { r = c[order_type::R]; g = c[order_type::G]; b = c[order_type::B]; a = c[order_type::A]; } color_type get() const { return color_type( c[order_type::R], c[order_type::G], c[order_type::B], c[order_type::A]); } pixel_type* next() { return (pixel_type*)(c + pix_step); } const pixel_type* next() const { return (const pixel_type*)(c + pix_step); } pixel_type* advance(int n) { return (pixel_type*)(c + n * pix_step); } const pixel_type* advance(int n) const { return (const pixel_type*)(c + n * pix_step); } }; private: //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, const color_type& c, unsigned cover) { m_blender.blend_pix(p->c, c.r, c.g, c.b, c.a, cover); } //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, const color_type& c) { m_blender.blend_pix(p->c, c.r, c.g, c.b, c.a); } //-------------------------------------------------------------------- AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover) { if (!c.is_transparent()) { if (c.is_opaque() && cover == cover_mask) { p->set(c.r, c.g, c.b, c.a); } else { m_blender.blend_pix(p->c, c.r, c.g, c.b, c.a, cover); } } } //-------------------------------------------------------------------- AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c) { if (!c.is_transparent()) { if (c.is_opaque()) { p->set(c.r, c.g, c.b, c.a); } else { m_blender.blend_pix(p->c, c.r, c.g, c.b, c.a); } } } public: //-------------------------------------------------------------------- pixfmt_alpha_blend_rgba() : m_rbuf(0) {} explicit pixfmt_alpha_blend_rgba(rbuf_type& rb) : m_rbuf(&rb) {} void attach(rbuf_type& rb) { m_rbuf = &rb; } //-------------------------------------------------------------------- template bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) { rect_i r(x1, y1, x2, y2); if (r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) { int stride = pixf.stride(); m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); return true; } return false; } //-------------------------------------------------------------------- AGG_INLINE unsigned width() const { return m_rbuf->width(); } AGG_INLINE unsigned height() const { return m_rbuf->height(); } AGG_INLINE int stride() const { return m_rbuf->stride(); } //-------------------------------------------------------------------- AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } //-------------------------------------------------------------------- AGG_INLINE int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step); } AGG_INLINE const int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step); } // Return pointer to pixel value, forcing row to be allocated. AGG_INLINE pixel_type* pix_value_ptr(int x, int y, unsigned len) { return (pixel_type*)(m_rbuf->row_ptr(x, y, len) + sizeof(value_type) * (x * pix_step)); } // Return pointer to pixel value, or null if row not allocated. AGG_INLINE const pixel_type* pix_value_ptr(int x, int y) const { int8u* p = m_rbuf->row_ptr(y); return p ? (pixel_type*)(p + sizeof(value_type) * (x * pix_step)) : 0; } // Get pixel pointer from raw buffer pointer. AGG_INLINE static pixel_type* pix_value_ptr(void* p) { return (pixel_type*)p; } // Get pixel pointer from raw buffer pointer. AGG_INLINE static const pixel_type* pix_value_ptr(const void* p) { return (const pixel_type*)p; } //-------------------------------------------------------------------- AGG_INLINE static void write_plain_color(void* p, color_type c) { blender_type::set_plain_color(pix_value_ptr(p)->c, c); } //-------------------------------------------------------------------- AGG_INLINE static color_type read_plain_color(const void* p) { return blender_type::get_plain_color(pix_value_ptr(p)->c); } //-------------------------------------------------------------------- AGG_INLINE static void make_pix(int8u* p, const color_type& c) { ((pixel_type*)p)->set(c); } //-------------------------------------------------------------------- AGG_INLINE color_type pixel(int x, int y) const { if (const pixel_type* p = pix_value_ptr(x, y)) { return p->get(); } return color_type::no_color(); } //-------------------------------------------------------------------- AGG_INLINE void copy_pixel(int x, int y, const color_type& c) { pix_value_ptr(x, y, 1)->set(c); } //-------------------------------------------------------------------- AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) { copy_or_blend_pix(pix_value_ptr(x, y, 1), c, cover); } //-------------------------------------------------------------------- AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) { pixel_type v; v.set(c); pixel_type* p = pix_value_ptr(x, y, len); do { *p = v; p = p->next(); } while (--len); } //-------------------------------------------------------------------- AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) { pixel_type v; v.set(c); do { *pix_value_ptr(x, y++, 1) = v; } while (--len); } //-------------------------------------------------------------------- void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (!c.is_transparent()) { pixel_type* p = pix_value_ptr(x, y, len); if (c.is_opaque() && cover == cover_mask) { pixel_type v; v.set(c); do { *p = v; p = p->next(); } while (--len); } else { if (cover == cover_mask) { do { blend_pix(p, c); p = p->next(); } while (--len); } else { do { blend_pix(p, c, cover); p = p->next(); } while (--len); } } } } //-------------------------------------------------------------------- void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) { if (!c.is_transparent()) { if (c.is_opaque() && cover == cover_mask) { pixel_type v; v.set(c); do { *pix_value_ptr(x, y++, 1) = v; } while (--len); } else { if (cover == cover_mask) { do { blend_pix(pix_value_ptr(x, y++, 1), c, c.a); } while (--len); } else { do { blend_pix(pix_value_ptr(x, y++, 1), c, cover); } while (--len); } } } } //-------------------------------------------------------------------- void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { if (!c.is_transparent()) { pixel_type* p = pix_value_ptr(x, y, len); do { if (c.is_opaque() && *covers == cover_mask) { p->set(c); } else { blend_pix(p, c, *covers); } p = p->next(); ++covers; } while (--len); } } //-------------------------------------------------------------------- void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { if (!c.is_transparent()) { do { pixel_type* p = pix_value_ptr(x, y++, 1); if (c.is_opaque() && *covers == cover_mask) { p->set(c); } else { blend_pix(p, c, *covers); } ++covers; } while (--len); } } //-------------------------------------------------------------------- void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) { pixel_type* p = pix_value_ptr(x, y, len); do { p->set(*colors++); p = p->next(); } while (--len); } //-------------------------------------------------------------------- void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) { do { pix_value_ptr(x, y++, 1)->set(*colors++); } while (--len); } //-------------------------------------------------------------------- void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { pixel_type* p = pix_value_ptr(x, y, len); if (covers) { do { copy_or_blend_pix(p, *colors++, *covers++); p = p->next(); } while (--len); } else { if (cover == cover_mask) { do { copy_or_blend_pix(p, *colors++); p = p->next(); } while (--len); } else { do { copy_or_blend_pix(p, *colors++, cover); p = p->next(); } while (--len); } } } //-------------------------------------------------------------------- void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { if (covers) { do { copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, *covers++); } while (--len); } else { if (cover == cover_mask) { do { copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++); } while (--len); } else { do { copy_or_blend_pix(pix_value_ptr(x, y++, 1), *colors++, cover); } while (--len); } } } //-------------------------------------------------------------------- template void for_each_pixel(Function f) { for (unsigned y = 0; y < height(); ++y) { row_data r = m_rbuf->row(y); if (r.ptr) { unsigned len = r.x2 - r.x1 + 1; pixel_type* p = pix_value_ptr(r.x1, y, len); do { f(p->c); p = p->next(); } while (--len); } } } //-------------------------------------------------------------------- void premultiply() { for_each_pixel(multiplier_rgba::premultiply); } //-------------------------------------------------------------------- void demultiply() { for_each_pixel(multiplier_rgba::demultiply); } //-------------------------------------------------------------------- template void apply_gamma_dir(const GammaLut& g) { for_each_pixel(apply_gamma_dir_rgba(g)); } //-------------------------------------------------------------------- template void apply_gamma_inv(const GammaLut& g) { for_each_pixel(apply_gamma_inv_rgba(g)); } //-------------------------------------------------------------------- template void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) { if (const int8u* p = from.row_ptr(ysrc)) { memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); } } //-------------------------------------------------------------------- // Blend from another RGBA surface. template void blend_from(const SrcPixelFormatRenderer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); int srcinc = 1; int dstinc = 1; if (xdst > xsrc) { psrc = psrc->advance(len - 1); pdst = pdst->advance(len - 1); srcinc = -1; dstinc = -1; } if (cover == cover_mask) { do { copy_or_blend_pix(pdst, psrc->get()); psrc = psrc->advance(srcinc); pdst = pdst->advance(dstinc); } while (--len); } else { do { copy_or_blend_pix(pdst, psrc->get(), cover); psrc = psrc->advance(srcinc); pdst = pdst->advance(dstinc); } while (--len); } } } //-------------------------------------------------------------------- // Combine single color with grayscale surface and blend. template void blend_from_color(const SrcPixelFormatRenderer& from, const color_type& color, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; typedef typename SrcPixelFormatRenderer::color_type src_color_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); do { copy_or_blend_pix(pdst, color, src_color_type::scale_cover(cover, psrc->c[0])); psrc = psrc->next(); pdst = pdst->next(); } while (--len); } } //-------------------------------------------------------------------- // Blend from color table, using grayscale surface as indexes into table. // Obviously, this only works for integer value types. template void blend_from_lut(const SrcPixelFormatRenderer& from, const color_type* color_lut, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); if (cover == cover_mask) { do { copy_or_blend_pix(pdst, color_lut[psrc->c[0]]); psrc = psrc->next(); pdst = pdst->next(); } while (--len); } else { do { copy_or_blend_pix(pdst, color_lut[psrc->c[0]], cover); psrc = psrc->next(); pdst = pdst->next(); } while (--len); } } } private: rbuf_type* m_rbuf; Blender m_blender; }; //================================================pixfmt_custom_blend_rgba template class pixfmt_custom_blend_rgba { public: typedef pixfmt_rgba_tag pixfmt_category; typedef RenBuf rbuf_type; typedef typename rbuf_type::row_data row_data; typedef Blender blender_type; typedef typename blender_type::color_type color_type; typedef typename blender_type::order_type order_type; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; enum { num_components = 4, pix_step = 4, pix_width = sizeof(value_type) * pix_step, }; struct pixel_type { value_type c[num_components]; void set(value_type r, value_type g, value_type b, value_type a) { c[order_type::R] = r; c[order_type::G] = g; c[order_type::B] = b; c[order_type::A] = a; } void set(const color_type& color) { set(color.r, color.g, color.b, color.a); } void get(value_type& r, value_type& g, value_type& b, value_type& a) const { r = c[order_type::R]; g = c[order_type::G]; b = c[order_type::B]; a = c[order_type::A]; } color_type get() const { return color_type( c[order_type::R], c[order_type::G], c[order_type::B], c[order_type::A]); } pixel_type* next() { return (pixel_type*)(c + pix_step); } const pixel_type* next() const { return (const pixel_type*)(c + pix_step); } pixel_type* advance(int n) { return (pixel_type*)(c + n * pix_step); } const pixel_type* advance(int n) const { return (const pixel_type*)(c + n * pix_step); } }; private: //-------------------------------------------------------------------- AGG_INLINE void blend_pix(pixel_type* p, const color_type& c, unsigned cover = cover_full) { m_blender.blend_pix(m_comp_op, p->c, c.r, c.g, c.b, c.a, cover); } //-------------------------------------------------------------------- AGG_INLINE void copy_or_blend_pix(pixel_type* p, const color_type& c, unsigned cover = cover_full) { if (!c.is_transparent()) { if (c.is_opaque() && cover == cover_mask) { p->set(c.r, c.g, c.b, c.a); } else { blend_pix(p, c, cover); } } } public: //-------------------------------------------------------------------- pixfmt_custom_blend_rgba() : m_rbuf(0), m_comp_op(3) {} explicit pixfmt_custom_blend_rgba(rbuf_type& rb, unsigned comp_op=3) : m_rbuf(&rb), m_comp_op(comp_op) {} void attach(rbuf_type& rb) { m_rbuf = &rb; } //-------------------------------------------------------------------- template bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2) { rect_i r(x1, y1, x2, y2); if (r.clip(rect_i(0, 0, pixf.width()-1, pixf.height()-1))) { int stride = pixf.stride(); m_rbuf->attach(pixf.pix_ptr(r.x1, stride < 0 ? r.y2 : r.y1), (r.x2 - r.x1) + 1, (r.y2 - r.y1) + 1, stride); return true; } return false; } //-------------------------------------------------------------------- void comp_op(unsigned op) { m_comp_op = op; } unsigned comp_op() const { return m_comp_op; } //-------------------------------------------------------------------- AGG_INLINE unsigned width() const { return m_rbuf->width(); } AGG_INLINE unsigned height() const { return m_rbuf->height(); } AGG_INLINE int stride() const { return m_rbuf->stride(); } //-------------------------------------------------------------------- AGG_INLINE int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } AGG_INLINE const int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } AGG_INLINE row_data row(int y) const { return m_rbuf->row(y); } //-------------------------------------------------------------------- AGG_INLINE int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step); } AGG_INLINE const int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + sizeof(value_type) * (x * pix_step); } // Return pointer to pixel value, forcing row to be allocated. AGG_INLINE pixel_type* pix_value_ptr(int x, int y, unsigned len) { return (pixel_type*)(m_rbuf->row_ptr(x, y, len) + sizeof(value_type) * (x * pix_step)); } // Return pointer to pixel value, or null if row not allocated. AGG_INLINE const pixel_type* pix_value_ptr(int x, int y) const { int8u* p = m_rbuf->row_ptr(y); return p ? (pixel_type*)(p + sizeof(value_type) * (x * pix_step)) : 0; } // Get pixel pointer from raw buffer pointer. AGG_INLINE static pixel_type* pix_value_ptr(void* p) { return (pixel_type*)p; } // Get pixel pointer from raw buffer pointer. AGG_INLINE static const pixel_type* pix_value_ptr(const void* p) { return (const pixel_type*)p; } //-------------------------------------------------------------------- AGG_INLINE static void make_pix(int8u* p, const color_type& c) { ((pixel_type*)p)->set(c); } //-------------------------------------------------------------------- AGG_INLINE color_type pixel(int x, int y) const { if (const pixel_type* p = pix_value_ptr(x, y)) { return p->get(); } return color_type::no_color(); } //-------------------------------------------------------------------- AGG_INLINE void copy_pixel(int x, int y, const color_type& c) { make_pix(pix_value_ptr(x, y, 1), c); } //-------------------------------------------------------------------- AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) { blend_pix(pix_value_ptr(x, y, 1), c, cover); } //-------------------------------------------------------------------- AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) { pixel_type v; v.set(c); pixel_type* p = pix_value_ptr(x, y, len); do { *p = v; p = p->next(); } while (--len); } //-------------------------------------------------------------------- AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) { pixel_type v; v.set(c); do { *pix_value_ptr(x, y++, 1) = v; } while (--len); } //-------------------------------------------------------------------- void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) { pixel_type* p = pix_value_ptr(x, y, len); do { blend_pix(p, c, cover); p = p->next(); } while (--len); } //-------------------------------------------------------------------- void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) { do { blend_pix(pix_value_ptr(x, y++, 1), c, cover); } while (--len); } //-------------------------------------------------------------------- void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { pixel_type* p = pix_value_ptr(x, y, len); do { blend_pix(p, c, *covers++); p = p->next(); } while (--len); } //-------------------------------------------------------------------- void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { do { blend_pix(pix_value_ptr(x, y++, 1), c, *covers++); } while (--len); } //-------------------------------------------------------------------- void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) { pixel_type* p = pix_value_ptr(x, y, len); do { p->set(*colors++); p = p->next(); } while (--len); } //-------------------------------------------------------------------- void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) { do { pix_value_ptr(x, y++, 1)->set(*colors++); } while (--len); } //-------------------------------------------------------------------- void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { pixel_type* p = pix_value_ptr(x, y, len); do { blend_pix(p, *colors++, covers ? *covers++ : cover); p = p->next(); } while (--len); } //-------------------------------------------------------------------- void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { do { blend_pix(pix_value_ptr(x, y++, 1), *colors++, covers ? *covers++ : cover); } while (--len); } //-------------------------------------------------------------------- template void for_each_pixel(Function f) { unsigned y; for (y = 0; y < height(); ++y) { row_data r = m_rbuf->row(y); if (r.ptr) { unsigned len = r.x2 - r.x1 + 1; pixel_type* p = pix_value_ptr(r.x1, y, len); do { f(p->c); p = p->next(); } while (--len); } } } //-------------------------------------------------------------------- void premultiply() { for_each_pixel(multiplier_rgba::premultiply); } //-------------------------------------------------------------------- void demultiply() { for_each_pixel(multiplier_rgba::demultiply); } //-------------------------------------------------------------------- template void apply_gamma_dir(const GammaLut& g) { for_each_pixel(apply_gamma_dir_rgba(g)); } //-------------------------------------------------------------------- template void apply_gamma_inv(const GammaLut& g) { for_each_pixel(apply_gamma_inv_rgba(g)); } //-------------------------------------------------------------------- template void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) { if (const int8u* p = from.row_ptr(ysrc)) { memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); } } //-------------------------------------------------------------------- // Blend from another RGBA surface. template void blend_from(const SrcPixelFormatRenderer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); int srcinc = 1; int dstinc = 1; if (xdst > xsrc) { psrc = psrc->advance(len - 1); pdst = pdst->advance(len - 1); srcinc = -1; dstinc = -1; } do { blend_pix(pdst, psrc->get(), cover); psrc = psrc->advance(srcinc); pdst = pdst->advance(dstinc); } while (--len); } } //-------------------------------------------------------------------- // Blend from single color, using grayscale surface as alpha channel. template void blend_from_color(const SrcPixelFormatRenderer& from, const color_type& color, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; typedef typename SrcPixelFormatRenderer::color_type src_color_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); do { blend_pix(pdst, color, src_color_type::scale_cover(cover, psrc->c[0])); psrc = psrc->next(); pdst = pdst->next(); } while (--len); } } //-------------------------------------------------------------------- // Blend from color table, using grayscale surface as indexes into table. // Obviously, this only works for integer value types. template void blend_from_lut(const SrcPixelFormatRenderer& from, const color_type* color_lut, int xdst, int ydst, int xsrc, int ysrc, unsigned len, int8u cover) { typedef typename SrcPixelFormatRenderer::pixel_type src_pixel_type; if (const src_pixel_type* psrc = from.pix_value_ptr(xsrc, ysrc)) { pixel_type* pdst = pix_value_ptr(xdst, ydst, len); do { blend_pix(pdst, color_lut[psrc->c[0]], cover); psrc = psrc->next(); pdst = pdst->next(); } while (--len); } } private: rbuf_type* m_rbuf; Blender m_blender; unsigned m_comp_op; }; //----------------------------------------------------------------------- typedef blender_rgba blender_rgba32; typedef blender_rgba blender_argb32; typedef blender_rgba blender_abgr32; typedef blender_rgba blender_bgra32; typedef blender_rgba blender_srgba32; typedef blender_rgba blender_sargb32; typedef blender_rgba blender_sabgr32; typedef blender_rgba blender_sbgra32; typedef blender_rgba_pre blender_rgba32_pre; typedef blender_rgba_pre blender_argb32_pre; typedef blender_rgba_pre blender_abgr32_pre; typedef blender_rgba_pre blender_bgra32_pre; typedef blender_rgba_pre blender_srgba32_pre; typedef blender_rgba_pre blender_sargb32_pre; typedef blender_rgba_pre blender_sabgr32_pre; typedef blender_rgba_pre blender_sbgra32_pre; typedef blender_rgba_plain blender_rgba32_plain; typedef blender_rgba_plain blender_argb32_plain; typedef blender_rgba_plain blender_abgr32_plain; typedef blender_rgba_plain blender_bgra32_plain; typedef blender_rgba_plain blender_srgba32_plain; typedef blender_rgba_plain blender_sargb32_plain; typedef blender_rgba_plain blender_sabgr32_plain; typedef blender_rgba_plain blender_sbgra32_plain; typedef blender_rgba blender_rgba64; typedef blender_rgba blender_argb64; typedef blender_rgba blender_abgr64; typedef blender_rgba blender_bgra64; typedef blender_rgba_pre blender_rgba64_pre; typedef blender_rgba_pre blender_argb64_pre; typedef blender_rgba_pre blender_abgr64_pre; typedef blender_rgba_pre blender_bgra64_pre; typedef blender_rgba_plain blender_rgba64_plain; typedef blender_rgba_plain blender_argb64_plain; typedef blender_rgba_plain blender_abgr64_plain; typedef blender_rgba_plain blender_bgra64_plain; typedef blender_rgba blender_rgba128; typedef blender_rgba blender_argb128; typedef blender_rgba blender_abgr128; typedef blender_rgba blender_bgra128; typedef blender_rgba_pre blender_rgba128_pre; typedef blender_rgba_pre blender_argb128_pre; typedef blender_rgba_pre blender_abgr128_pre; typedef blender_rgba_pre blender_bgra128_pre; typedef blender_rgba_plain blender_rgba128_plain; typedef blender_rgba_plain blender_argb128_plain; typedef blender_rgba_plain blender_abgr128_plain; typedef blender_rgba_plain blender_bgra128_plain; //----------------------------------------------------------------------- typedef pixfmt_alpha_blend_rgba pixfmt_rgba32; typedef pixfmt_alpha_blend_rgba pixfmt_argb32; typedef pixfmt_alpha_blend_rgba pixfmt_abgr32; typedef pixfmt_alpha_blend_rgba pixfmt_bgra32; typedef pixfmt_alpha_blend_rgba pixfmt_srgba32; typedef pixfmt_alpha_blend_rgba pixfmt_sargb32; typedef pixfmt_alpha_blend_rgba pixfmt_sabgr32; typedef pixfmt_alpha_blend_rgba pixfmt_sbgra32; typedef pixfmt_alpha_blend_rgba pixfmt_rgba32_pre; typedef pixfmt_alpha_blend_rgba pixfmt_argb32_pre; typedef pixfmt_alpha_blend_rgba pixfmt_abgr32_pre; typedef pixfmt_alpha_blend_rgba pixfmt_bgra32_pre; typedef pixfmt_alpha_blend_rgba pixfmt_srgba32_pre; typedef pixfmt_alpha_blend_rgba pixfmt_sargb32_pre; typedef pixfmt_alpha_blend_rgba pixfmt_sabgr32_pre; typedef pixfmt_alpha_blend_rgba pixfmt_sbgra32_pre; typedef pixfmt_alpha_blend_rgba pixfmt_rgba32_plain; typedef pixfmt_alpha_blend_rgba pixfmt_argb32_plain; typedef pixfmt_alpha_blend_rgba pixfmt_abgr32_plain; typedef pixfmt_alpha_blend_rgba pixfmt_bgra32_plain; typedef pixfmt_alpha_blend_rgba pixfmt_srgba32_plain; typedef pixfmt_alpha_blend_rgba pixfmt_sargb32_plain; typedef pixfmt_alpha_blend_rgba pixfmt_sabgr32_plain; typedef pixfmt_alpha_blend_rgba pixfmt_sbgra32_plain; typedef pixfmt_alpha_blend_rgba pixfmt_rgba64; typedef pixfmt_alpha_blend_rgba pixfmt_argb64; typedef pixfmt_alpha_blend_rgba pixfmt_abgr64; typedef pixfmt_alpha_blend_rgba pixfmt_bgra64; typedef pixfmt_alpha_blend_rgba pixfmt_rgba64_pre; typedef pixfmt_alpha_blend_rgba pixfmt_argb64_pre; typedef pixfmt_alpha_blend_rgba pixfmt_abgr64_pre; typedef pixfmt_alpha_blend_rgba pixfmt_bgra64_pre; typedef pixfmt_alpha_blend_rgba pixfmt_rgba64_plain; typedef pixfmt_alpha_blend_rgba pixfmt_argb64_plain; typedef pixfmt_alpha_blend_rgba pixfmt_abgr64_plain; typedef pixfmt_alpha_blend_rgba pixfmt_bgra64_plain; typedef pixfmt_alpha_blend_rgba pixfmt_rgba128; typedef pixfmt_alpha_blend_rgba pixfmt_argb128; typedef pixfmt_alpha_blend_rgba pixfmt_abgr128; typedef pixfmt_alpha_blend_rgba pixfmt_bgra128; typedef pixfmt_alpha_blend_rgba pixfmt_rgba128_pre; typedef pixfmt_alpha_blend_rgba pixfmt_argb128_pre; typedef pixfmt_alpha_blend_rgba pixfmt_abgr128_pre; typedef pixfmt_alpha_blend_rgba pixfmt_bgra128_pre; typedef pixfmt_alpha_blend_rgba pixfmt_rgba128_plain; typedef pixfmt_alpha_blend_rgba pixfmt_argb128_plain; typedef pixfmt_alpha_blend_rgba pixfmt_abgr128_plain; typedef pixfmt_alpha_blend_rgba pixfmt_bgra128_plain; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_bitset_iterator.h0000644000175000017500000000270413233644505025173 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_BITSET_ITERATOR_INCLUDED #define AGG_BITSET_ITERATOR_INCLUDED #include "agg_basics.h" namespace agg24 { class bitset_iterator { public: bitset_iterator(const int8u* bits, unsigned offset = 0) : m_bits(bits + (offset >> 3)), m_mask(0x80 >> (offset & 7)) {} void operator ++ () { m_mask >>= 1; if(m_mask == 0) { ++m_bits; m_mask = 0x80; } } unsigned bit() const { return (*m_bits) & m_mask; } private: const int8u* m_bits; int8u m_mask; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_clip_polygon.h0000644000175000017500000000502613233644505025513 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Polygon clipping converter // There an optimized Liang-Basky algorithm is used. // The algorithm doesn't optimize the degenerate edges, i.e. it will never // break a closed polygon into two or more ones, instead, there will be // degenerate edges coinciding with the respective clipping boundaries. // This is a sub-optimal solution, because that optimization would require // extra, rather expensive math while the rasterizer tolerates it quite well, // without any considerable overhead. // //---------------------------------------------------------------------------- #ifndef AGG_CONV_CLIP_POLYGON_INCLUDED #define AGG_CONV_CLIP_POLYGON_INCLUDED #include "agg_basics.h" #include "agg_conv_adaptor_vpgen.h" #include "agg_vpgen_clip_polygon.h" namespace agg24 { //=======================================================conv_clip_polygon template struct conv_clip_polygon : public conv_adaptor_vpgen { typedef conv_adaptor_vpgen base_type; conv_clip_polygon(VertexSource& vs) : conv_adaptor_vpgen(vs) {} void clip_box(double x1, double y1, double x2, double y2) { base_type::vpgen().clip_box(x1, y1, x2, y2); } double x1() const { return base_type::vpgen().x1(); } double y1() const { return base_type::vpgen().y1(); } double x2() const { return base_type::vpgen().x2(); } double y2() const { return base_type::vpgen().y2(); } private: conv_clip_polygon(const conv_clip_polygon&); const conv_clip_polygon& operator = (const conv_clip_polygon&); }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_interpolator_linear.h0000644000175000017500000001716113233644505027070 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SPAN_INTERPOLATOR_LINEAR_INCLUDED #define AGG_SPAN_INTERPOLATOR_LINEAR_INCLUDED #include "agg_basics.h" #include "agg_dda_line.h" #include "agg_trans_affine.h" namespace agg24 { //================================================span_interpolator_linear template class span_interpolator_linear { public: typedef Transformer trans_type; enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; //-------------------------------------------------------------------- span_interpolator_linear() {} span_interpolator_linear(trans_type& trans) : m_trans(&trans) {} span_interpolator_linear(trans_type& trans, double x, double y, unsigned len) : m_trans(&trans) { begin(x, y, len); } //---------------------------------------------------------------- const trans_type& transformer() const { return *m_trans; } void transformer(trans_type& trans) { m_trans = &trans; } //---------------------------------------------------------------- void begin(double x, double y, unsigned len) { double tx; double ty; tx = x; ty = y; m_trans->transform(&tx, &ty); int x1 = iround(tx * subpixel_scale); int y1 = iround(ty * subpixel_scale); tx = x + len; ty = y; m_trans->transform(&tx, &ty); int x2 = iround(tx * subpixel_scale); int y2 = iround(ty * subpixel_scale); m_li_x = dda2_line_interpolator(x1, x2, len); m_li_y = dda2_line_interpolator(y1, y2, len); } //---------------------------------------------------------------- void resynchronize(double xe, double ye, unsigned len) { m_trans->transform(&xe, &ye); m_li_x = dda2_line_interpolator(m_li_x.y(), iround(xe * subpixel_scale), len); m_li_y = dda2_line_interpolator(m_li_y.y(), iround(ye * subpixel_scale), len); } //---------------------------------------------------------------- void operator++() { ++m_li_x; ++m_li_y; } //---------------------------------------------------------------- void coordinates(int* x, int* y) const { *x = m_li_x.y(); *y = m_li_y.y(); } private: trans_type* m_trans; dda2_line_interpolator m_li_x; dda2_line_interpolator m_li_y; }; //=====================================span_interpolator_linear_subdiv template class span_interpolator_linear_subdiv { public: typedef Transformer trans_type; enum subpixel_scale_e { subpixel_shift = SubpixelShift, subpixel_scale = 1 << subpixel_shift }; //---------------------------------------------------------------- span_interpolator_linear_subdiv() : m_subdiv_shift(4), m_subdiv_size(1 << m_subdiv_shift), m_subdiv_mask(m_subdiv_size - 1) {} span_interpolator_linear_subdiv(trans_type& trans, unsigned subdiv_shift = 4) : m_subdiv_shift(subdiv_shift), m_subdiv_size(1 << m_subdiv_shift), m_subdiv_mask(m_subdiv_size - 1), m_trans(&trans) {} span_interpolator_linear_subdiv(trans_type& trans, double x, double y, unsigned len, unsigned subdiv_shift = 4) : m_subdiv_shift(subdiv_shift), m_subdiv_size(1 << m_subdiv_shift), m_subdiv_mask(m_subdiv_size - 1), m_trans(&trans) { begin(x, y, len); } //---------------------------------------------------------------- const trans_type& transformer() const { return *m_trans; } void transformer(const trans_type& trans) { m_trans = &trans; } //---------------------------------------------------------------- unsigned subdiv_shift() const { return m_subdiv_shift; } void subdiv_shift(unsigned shift) { m_subdiv_shift = shift; m_subdiv_size = 1 << m_subdiv_shift; m_subdiv_mask = m_subdiv_size - 1; } //---------------------------------------------------------------- void begin(double x, double y, unsigned len) { double tx; double ty; m_pos = 1; m_src_x = iround(x * subpixel_scale) + subpixel_scale; m_src_y = y; m_len = len; if(len > m_subdiv_size) len = m_subdiv_size; tx = x; ty = y; m_trans->transform(&tx, &ty); int x1 = iround(tx * subpixel_scale); int y1 = iround(ty * subpixel_scale); tx = x + len; ty = y; m_trans->transform(&tx, &ty); m_li_x = dda2_line_interpolator(x1, iround(tx * subpixel_scale), len); m_li_y = dda2_line_interpolator(y1, iround(ty * subpixel_scale), len); } //---------------------------------------------------------------- void operator++() { ++m_li_x; ++m_li_y; if(m_pos >= m_subdiv_size) { unsigned len = m_len; if(len > m_subdiv_size) len = m_subdiv_size; double tx = double(m_src_x) / double(subpixel_scale) + len; double ty = m_src_y; m_trans->transform(&tx, &ty); m_li_x = dda2_line_interpolator(m_li_x.y(), iround(tx * subpixel_scale), len); m_li_y = dda2_line_interpolator(m_li_y.y(), iround(ty * subpixel_scale), len); m_pos = 0; } m_src_x += subpixel_scale; ++m_pos; --m_len; } //---------------------------------------------------------------- void coordinates(int* x, int* y) const { *x = m_li_x.y(); *y = m_li_y.y(); } private: unsigned m_subdiv_shift; unsigned m_subdiv_size; unsigned m_subdiv_mask; trans_type* m_trans; dda2_line_interpolator m_li_x; dda2_line_interpolator m_li_y; int m_src_x; double m_src_y; unsigned m_pos; unsigned m_len; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_renderer_base.h0000644000175000017500000006302113233644505024567 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class renderer_base // //---------------------------------------------------------------------------- #ifndef AGG_RENDERER_BASE_INCLUDED #define AGG_RENDERER_BASE_INCLUDED #include "agg_basics.h" #include "agg_rendering_buffer.h" namespace agg24 { //-----------------------------------------------------------renderer_base template class renderer_base { public: typedef PixelFormat pixfmt_type; typedef typename pixfmt_type::color_type color_type; typedef typename pixfmt_type::row_data row_data; //-------------------------------------------------------------------- renderer_base() : m_ren(0), m_clip_box(1, 1, 0, 0) {} explicit renderer_base(pixfmt_type& ren) : m_ren(&ren), m_clip_box(0, 0, ren.width() - 1, ren.height() - 1) {} void attach(pixfmt_type& ren) { m_ren = &ren; m_clip_box = rect_i(0, 0, ren.width() - 1, ren.height() - 1); } //-------------------------------------------------------------------- const pixfmt_type& ren() const { return *m_ren; } pixfmt_type& ren() { return *m_ren; } //-------------------------------------------------------------------- unsigned width() const { return m_ren->width(); } unsigned height() const { return m_ren->height(); } //-------------------------------------------------------------------- bool clip_box(int x1, int y1, int x2, int y2) { rect_i cb(x1, y1, x2, y2); cb.normalize(); if(cb.clip(rect_i(0, 0, width() - 1, height() - 1))) { m_clip_box = cb; return true; } m_clip_box.x1 = 1; m_clip_box.y1 = 1; m_clip_box.x2 = 0; m_clip_box.y2 = 0; return false; } //-------------------------------------------------------------------- void reset_clipping(bool visibility) { if(visibility) { m_clip_box.x1 = 0; m_clip_box.y1 = 0; m_clip_box.x2 = width() - 1; m_clip_box.y2 = height() - 1; } else { m_clip_box.x1 = 1; m_clip_box.y1 = 1; m_clip_box.x2 = 0; m_clip_box.y2 = 0; } } //-------------------------------------------------------------------- void clip_box_naked(int x1, int y1, int x2, int y2) { m_clip_box.x1 = x1; m_clip_box.y1 = y1; m_clip_box.x2 = x2; m_clip_box.y2 = y2; } //-------------------------------------------------------------------- bool inbox(int x, int y) const { return x >= m_clip_box.x1 && y >= m_clip_box.y1 && x <= m_clip_box.x2 && y <= m_clip_box.y2; } //-------------------------------------------------------------------- const rect_i& clip_box() const { return m_clip_box; } int xmin() const { return m_clip_box.x1; } int ymin() const { return m_clip_box.y1; } int xmax() const { return m_clip_box.x2; } int ymax() const { return m_clip_box.y2; } //-------------------------------------------------------------------- const rect_i& bounding_clip_box() const { return m_clip_box; } int bounding_xmin() const { return m_clip_box.x1; } int bounding_ymin() const { return m_clip_box.y1; } int bounding_xmax() const { return m_clip_box.x2; } int bounding_ymax() const { return m_clip_box.y2; } //-------------------------------------------------------------------- void clear(const color_type& c) { unsigned y; if(width()) { for(y = 0; y < height(); y++) { m_ren->copy_hline(0, y, width(), c); } } } //-------------------------------------------------------------------- void fill(const color_type& c) { unsigned y; if(width()) { for(y = 0; y < height(); y++) { m_ren->blend_hline(0, y, width(), c, cover_mask); } } } //-------------------------------------------------------------------- void copy_pixel(int x, int y, const color_type& c) { if(inbox(x, y)) { m_ren->copy_pixel(x, y, c); } } //-------------------------------------------------------------------- void blend_pixel(int x, int y, const color_type& c, cover_type cover) { if(inbox(x, y)) { m_ren->blend_pixel(x, y, c, cover); } } //-------------------------------------------------------------------- color_type pixel(int x, int y) const { return inbox(x, y) ? m_ren->pixel(x, y) : color_type::no_color(); } //-------------------------------------------------------------------- void copy_hline(int x1, int y, int x2, const color_type& c) { if(x1 > x2) { int t = x2; x2 = x1; x1 = t; } if(y > ymax()) return; if(y < ymin()) return; if(x1 > xmax()) return; if(x2 < xmin()) return; if(x1 < xmin()) x1 = xmin(); if(x2 > xmax()) x2 = xmax(); m_ren->copy_hline(x1, y, x2 - x1 + 1, c); } //-------------------------------------------------------------------- void copy_vline(int x, int y1, int y2, const color_type& c) { if(y1 > y2) { int t = y2; y2 = y1; y1 = t; } if(x > xmax()) return; if(x < xmin()) return; if(y1 > ymax()) return; if(y2 < ymin()) return; if(y1 < ymin()) y1 = ymin(); if(y2 > ymax()) y2 = ymax(); m_ren->copy_vline(x, y1, y2 - y1 + 1, c); } //-------------------------------------------------------------------- void blend_hline(int x1, int y, int x2, const color_type& c, cover_type cover) { if(x1 > x2) { int t = x2; x2 = x1; x1 = t; } if(y > ymax()) return; if(y < ymin()) return; if(x1 > xmax()) return; if(x2 < xmin()) return; if(x1 < xmin()) x1 = xmin(); if(x2 > xmax()) x2 = xmax(); m_ren->blend_hline(x1, y, x2 - x1 + 1, c, cover); } //-------------------------------------------------------------------- void blend_vline(int x, int y1, int y2, const color_type& c, cover_type cover) { if(y1 > y2) { int t = y2; y2 = y1; y1 = t; } if(x > xmax()) return; if(x < xmin()) return; if(y1 > ymax()) return; if(y2 < ymin()) return; if(y1 < ymin()) y1 = ymin(); if(y2 > ymax()) y2 = ymax(); m_ren->blend_vline(x, y1, y2 - y1 + 1, c, cover); } //-------------------------------------------------------------------- void copy_bar(int x1, int y1, int x2, int y2, const color_type& c) { rect_i rc(x1, y1, x2, y2); rc.normalize(); if(rc.clip(clip_box())) { int y; for(y = rc.y1; y <= rc.y2; y++) { m_ren->copy_hline(rc.x1, y, unsigned(rc.x2 - rc.x1 + 1), c); } } } //-------------------------------------------------------------------- void blend_bar(int x1, int y1, int x2, int y2, const color_type& c, cover_type cover) { rect_i rc(x1, y1, x2, y2); rc.normalize(); if(rc.clip(clip_box())) { int y; for(y = rc.y1; y <= rc.y2; y++) { m_ren->blend_hline(rc.x1, y, unsigned(rc.x2 - rc.x1 + 1), c, cover); } } } //-------------------------------------------------------------------- void blend_solid_hspan(int x, int y, int len, const color_type& c, const cover_type* covers) { if(y > ymax()) return; if(y < ymin()) return; if(x < xmin()) { len -= xmin() - x; if(len <= 0) return; covers += xmin() - x; x = xmin(); } if(x + len > xmax()) { len = xmax() - x + 1; if(len <= 0) return; } m_ren->blend_solid_hspan(x, y, len, c, covers); } //-------------------------------------------------------------------- void blend_solid_vspan(int x, int y, int len, const color_type& c, const cover_type* covers) { if(x > xmax()) return; if(x < xmin()) return; if(y < ymin()) { len -= ymin() - y; if(len <= 0) return; covers += ymin() - y; y = ymin(); } if(y + len > ymax()) { len = ymax() - y + 1; if(len <= 0) return; } m_ren->blend_solid_vspan(x, y, len, c, covers); } //-------------------------------------------------------------------- void copy_color_hspan(int x, int y, int len, const color_type* colors) { if(y > ymax()) return; if(y < ymin()) return; if(x < xmin()) { int d = xmin() - x; len -= d; if(len <= 0) return; colors += d; x = xmin(); } if(x + len > xmax()) { len = xmax() - x + 1; if(len <= 0) return; } m_ren->copy_color_hspan(x, y, len, colors); } //-------------------------------------------------------------------- void copy_color_vspan(int x, int y, int len, const color_type* colors) { if(x > xmax()) return; if(x < xmin()) return; if(y < ymin()) { int d = ymin() - y; len -= d; if(len <= 0) return; colors += d; y = ymin(); } if(y + len > ymax()) { len = ymax() - y + 1; if(len <= 0) return; } m_ren->copy_color_vspan(x, y, len, colors); } //-------------------------------------------------------------------- void blend_color_hspan(int x, int y, int len, const color_type* colors, const cover_type* covers, cover_type cover = agg24::cover_full) { if(y > ymax()) return; if(y < ymin()) return; if(x < xmin()) { int d = xmin() - x; len -= d; if(len <= 0) return; if(covers) covers += d; colors += d; x = xmin(); } if(x + len > xmax()) { len = xmax() - x + 1; if(len <= 0) return; } m_ren->blend_color_hspan(x, y, len, colors, covers, cover); } //-------------------------------------------------------------------- void blend_color_vspan(int x, int y, int len, const color_type* colors, const cover_type* covers, cover_type cover = agg24::cover_full) { if(x > xmax()) return; if(x < xmin()) return; if(y < ymin()) { int d = ymin() - y; len -= d; if(len <= 0) return; if(covers) covers += d; colors += d; y = ymin(); } if(y + len > ymax()) { len = ymax() - y + 1; if(len <= 0) return; } m_ren->blend_color_vspan(x, y, len, colors, covers, cover); } //-------------------------------------------------------------------- rect_i clip_rect_area(rect_i& dst, rect_i& src, int wsrc, int hsrc) const { rect_i rc(0,0,0,0); rect_i cb = clip_box(); ++cb.x2; ++cb.y2; if(src.x1 < 0) { dst.x1 -= src.x1; src.x1 = 0; } if(src.y1 < 0) { dst.y1 -= src.y1; src.y1 = 0; } if(src.x2 > wsrc) src.x2 = wsrc; if(src.y2 > hsrc) src.y2 = hsrc; if(dst.x1 < cb.x1) { src.x1 += cb.x1 - dst.x1; dst.x1 = cb.x1; } if(dst.y1 < cb.y1) { src.y1 += cb.y1 - dst.y1; dst.y1 = cb.y1; } if(dst.x2 > cb.x2) dst.x2 = cb.x2; if(dst.y2 > cb.y2) dst.y2 = cb.y2; rc.x2 = dst.x2 - dst.x1; rc.y2 = dst.y2 - dst.y1; if(rc.x2 > src.x2 - src.x1) rc.x2 = src.x2 - src.x1; if(rc.y2 > src.y2 - src.y1) rc.y2 = src.y2 - src.y1; return rc; } //-------------------------------------------------------------------- template void copy_from(const RenBuf& src, const rect_i* rect_src_ptr = 0, int dx = 0, int dy = 0) { rect_i rsrc(0, 0, src.width(), src.height()); if(rect_src_ptr) { rsrc.x1 = rect_src_ptr->x1; rsrc.y1 = rect_src_ptr->y1; rsrc.x2 = rect_src_ptr->x2 + 1; rsrc.y2 = rect_src_ptr->y2 + 1; } // Version with xdst, ydst (absolute positioning) //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); // Version with dx, dy (relative positioning) rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); if(rc.x2 > 0) { int incy = 1; if(rdst.y1 > rsrc.y1) { rsrc.y1 += rc.y2 - 1; rdst.y1 += rc.y2 - 1; incy = -1; } while(rc.y2 > 0) { m_ren->copy_from(src, rdst.x1, rdst.y1, rsrc.x1, rsrc.y1, rc.x2); rdst.y1 += incy; rsrc.y1 += incy; --rc.y2; } } } //-------------------------------------------------------------------- template void blend_from(const SrcPixelFormatRenderer& src, const rect_i* rect_src_ptr = 0, int dx = 0, int dy = 0, cover_type cover = agg24::cover_full) { rect_i rsrc(0, 0, src.width(), src.height()); if(rect_src_ptr) { rsrc.x1 = rect_src_ptr->x1; rsrc.y1 = rect_src_ptr->y1; rsrc.x2 = rect_src_ptr->x2 + 1; rsrc.y2 = rect_src_ptr->y2 + 1; } // Version with xdst, ydst (absolute positioning) //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); // Version with dx, dy (relative positioning) rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); if(rc.x2 > 0) { int incy = 1; if(rdst.y1 > rsrc.y1) { rsrc.y1 += rc.y2 - 1; rdst.y1 += rc.y2 - 1; incy = -1; } while(rc.y2 > 0) { typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1); if(rw.ptr) { int x1src = rsrc.x1; int x1dst = rdst.x1; int len = rc.x2; if(rw.x1 > x1src) { x1dst += rw.x1 - x1src; len -= rw.x1 - x1src; x1src = rw.x1; } if(len > 0) { if(x1src + len-1 > rw.x2) { len -= x1src + len - rw.x2 - 1; } if(len > 0) { m_ren->blend_from(src, x1dst, rdst.y1, x1src, rsrc.y1, len, cover); } } } rdst.y1 += incy; rsrc.y1 += incy; --rc.y2; } } } //-------------------------------------------------------------------- template void blend_from_color(const SrcPixelFormatRenderer& src, const color_type& color, const rect_i* rect_src_ptr = 0, int dx = 0, int dy = 0, cover_type cover = agg24::cover_full) { rect_i rsrc(0, 0, src.width(), src.height()); if(rect_src_ptr) { rsrc.x1 = rect_src_ptr->x1; rsrc.y1 = rect_src_ptr->y1; rsrc.x2 = rect_src_ptr->x2 + 1; rsrc.y2 = rect_src_ptr->y2 + 1; } // Version with xdst, ydst (absolute positioning) //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); // Version with dx, dy (relative positioning) rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); if(rc.x2 > 0) { int incy = 1; if(rdst.y1 > rsrc.y1) { rsrc.y1 += rc.y2 - 1; rdst.y1 += rc.y2 - 1; incy = -1; } while(rc.y2 > 0) { typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1); if(rw.ptr) { int x1src = rsrc.x1; int x1dst = rdst.x1; int len = rc.x2; if(rw.x1 > x1src) { x1dst += rw.x1 - x1src; len -= rw.x1 - x1src; x1src = rw.x1; } if(len > 0) { if(x1src + len-1 > rw.x2) { len -= x1src + len - rw.x2 - 1; } if(len > 0) { m_ren->blend_from_color(src, color, x1dst, rdst.y1, x1src, rsrc.y1, len, cover); } } } rdst.y1 += incy; rsrc.y1 += incy; --rc.y2; } } } //-------------------------------------------------------------------- template void blend_from_lut(const SrcPixelFormatRenderer& src, const color_type* color_lut, const rect_i* rect_src_ptr = 0, int dx = 0, int dy = 0, cover_type cover = agg24::cover_full) { rect_i rsrc(0, 0, src.width(), src.height()); if(rect_src_ptr) { rsrc.x1 = rect_src_ptr->x1; rsrc.y1 = rect_src_ptr->y1; rsrc.x2 = rect_src_ptr->x2 + 1; rsrc.y2 = rect_src_ptr->y2 + 1; } // Version with xdst, ydst (absolute positioning) //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1); // Version with dx, dy (relative positioning) rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy); rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height()); if(rc.x2 > 0) { int incy = 1; if(rdst.y1 > rsrc.y1) { rsrc.y1 += rc.y2 - 1; rdst.y1 += rc.y2 - 1; incy = -1; } while(rc.y2 > 0) { typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1); if(rw.ptr) { int x1src = rsrc.x1; int x1dst = rdst.x1; int len = rc.x2; if(rw.x1 > x1src) { x1dst += rw.x1 - x1src; len -= rw.x1 - x1src; x1src = rw.x1; } if(len > 0) { if(x1src + len-1 > rw.x2) { len -= x1src + len - rw.x2 - 1; } if(len > 0) { m_ren->blend_from_lut(src, color_lut, x1dst, rdst.y1, x1src, rsrc.y1, len, cover); } } } rdst.y1 += incy; rsrc.y1 += incy; --rc.y2; } } } private: pixfmt_type* m_ren; rect_i m_clip_box; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_scanline_bin.h0000644000175000017500000001751613233644505024423 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Class scanline_bin - binary scanline. // //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates (scanline32_bin) has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_SCANLINE_BIN_INCLUDED #define AGG_SCANLINE_BIN_INCLUDED #include "agg_array.h" namespace agg24 { //=============================================================scanline_bin // // This is binary scaline container which supports the interface // used in the rasterizer::render(). See description of agg_scanline_u8 // for details. // //------------------------------------------------------------------------ class scanline_bin { public: typedef int32 coord_type; struct span { int16 x; int16 len; }; typedef const span* const_iterator; //-------------------------------------------------------------------- scanline_bin() : m_last_x(0x7FFFFFF0), m_spans(), m_cur_span(0) { } //-------------------------------------------------------------------- void reset(int min_x, int max_x) { unsigned max_len = max_x - min_x + 3; if(max_len > m_spans.size()) { m_spans.resize(max_len); } m_last_x = 0x7FFFFFF0; m_cur_span = &m_spans[0]; } //-------------------------------------------------------------------- void add_cell(int x, unsigned) { if(x == m_last_x+1) { m_cur_span->len++; } else { ++m_cur_span; m_cur_span->x = (int16)x; m_cur_span->len = 1; } m_last_x = x; } //-------------------------------------------------------------------- void add_span(int x, unsigned len, unsigned) { if(x == m_last_x+1) { m_cur_span->len = (int16)(m_cur_span->len + len); } else { ++m_cur_span; m_cur_span->x = (int16)x; m_cur_span->len = (int16)len; } m_last_x = x + len - 1; } //-------------------------------------------------------------------- void add_cells(int x, unsigned len, const void*) { add_span(x, len, 0); } //-------------------------------------------------------------------- void finalize(int y) { m_y = y; } //-------------------------------------------------------------------- void reset_spans() { m_last_x = 0x7FFFFFF0; m_cur_span = &m_spans[0]; } //-------------------------------------------------------------------- int y() const { return m_y; } unsigned num_spans() const { return unsigned(m_cur_span - &m_spans[0]); } const_iterator begin() const { return &m_spans[1]; } private: scanline_bin(const scanline_bin&); const scanline_bin operator = (const scanline_bin&); int m_last_x; int m_y; pod_array m_spans; span* m_cur_span; }; //===========================================================scanline32_bin class scanline32_bin { public: typedef int32 coord_type; //-------------------------------------------------------------------- struct span { span() {} span(coord_type x_, coord_type len_) : x(x_), len(len_) {} coord_type x; coord_type len; }; typedef pod_bvector span_array_type; //-------------------------------------------------------------------- class const_iterator { public: const_iterator(const span_array_type& spans) : m_spans(spans), m_span_idx(0) {} const span& operator*() const { return m_spans[m_span_idx]; } const span* operator->() const { return &m_spans[m_span_idx]; } void operator ++ () { ++m_span_idx; } private: const span_array_type& m_spans; unsigned m_span_idx; }; //-------------------------------------------------------------------- scanline32_bin() : m_max_len(0), m_last_x(0x7FFFFFF0) {} //-------------------------------------------------------------------- void reset(int min_x, int max_x) { m_last_x = 0x7FFFFFF0; m_spans.remove_all(); } //-------------------------------------------------------------------- void add_cell(int x, unsigned) { if(x == m_last_x+1) { m_spans.last().len++; } else { m_spans.add(span(coord_type(x), 1)); } m_last_x = x; } //-------------------------------------------------------------------- void add_span(int x, unsigned len, unsigned) { if(x == m_last_x+1) { m_spans.last().len += coord_type(len); } else { m_spans.add(span(coord_type(x), coord_type(len))); } m_last_x = x + len - 1; } //-------------------------------------------------------------------- void add_cells(int x, unsigned len, const void*) { add_span(x, len, 0); } //-------------------------------------------------------------------- void finalize(int y) { m_y = y; } //-------------------------------------------------------------------- void reset_spans() { m_last_x = 0x7FFFFFF0; m_spans.remove_all(); } //-------------------------------------------------------------------- int y() const { return m_y; } unsigned num_spans() const { return m_spans.size(); } const_iterator begin() const { return const_iterator(m_spans); } private: scanline32_bin(const scanline32_bin&); const scanline32_bin operator = (const scanline32_bin&); unsigned m_max_len; int m_last_x; int m_y; span_array_type m_spans; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_trans_affine.h0000644000175000017500000004562113233644505024434 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Affine transformation classes. // //---------------------------------------------------------------------------- #ifndef AGG_TRANS_AFFINE_INCLUDED #define AGG_TRANS_AFFINE_INCLUDED #include #include "agg_basics.h" namespace agg24 { const double affine_epsilon = 1e-14; //============================================================trans_affine // // See Implementation agg_trans_affine.cpp // // Affine transformation are linear transformations in Cartesian coordinates // (strictly speaking not only in Cartesian, but for the beginning we will // think so). They are rotation, scaling, translation and skewing. // After any affine transformation a line segment remains a line segment // and it will never become a curve. // // There will be no math about matrix calculations, since it has been // described many times. Ask yourself a very simple question: // "why do we need to understand and use some matrix stuff instead of just // rotating, scaling and so on". The answers are: // // 1. Any combination of transformations can be done by only 4 multiplications // and 4 additions in floating point. // 2. One matrix transformation is equivalent to the number of consecutive // discrete transformations, i.e. the matrix "accumulates" all transformations // in the order of their settings. Suppose we have 4 transformations: // * rotate by 30 degrees, // * scale X to 2.0, // * scale Y to 1.5, // * move to (100, 100). // The result will depend on the order of these transformations, // and the advantage of matrix is that the sequence of discret calls: // rotate(30), scaleX(2.0), scaleY(1.5), move(100,100) // will have exactly the same result as the following matrix transformations: // // affine_matrix m; // m *= rotate_matrix(30); // m *= scaleX_matrix(2.0); // m *= scaleY_matrix(1.5); // m *= move_matrix(100,100); // // m.transform_my_point_at_last(x, y); // // What is the good of it? In real life we will set-up the matrix only once // and then transform many points, let alone the convenience to set any // combination of transformations. // // So, how to use it? Very easy - literally as it's shown above. Not quite, // let us write a correct example: // // agg24::trans_affine m; // m *= agg24::trans_affine_rotation(30.0 * 3.1415926 / 180.0); // m *= agg24::trans_affine_scaling(2.0, 1.5); // m *= agg24::trans_affine_translation(100.0, 100.0); // m.transform(&x, &y); // // The affine matrix is all you need to perform any linear transformation, // but all transformations have origin point (0,0). It means that we need to // use 2 translations if we want to rotate someting around (100,100): // // m *= agg24::trans_affine_translation(-100.0, -100.0); // move to (0,0) // m *= agg24::trans_affine_rotation(30.0 * 3.1415926 / 180.0); // rotate // m *= agg24::trans_affine_translation(100.0, 100.0); // move back to (100,100) //---------------------------------------------------------------------- struct trans_affine { double sx, shy, shx, sy, tx, ty; //------------------------------------------ Construction // Identity matrix trans_affine() : sx(1.0), shy(0.0), shx(0.0), sy(1.0), tx(0.0), ty(0.0) {} // Custom matrix. Usually used in derived classes trans_affine(double v0, double v1, double v2, double v3, double v4, double v5) : sx(v0), shy(v1), shx(v2), sy(v3), tx(v4), ty(v5) {} // Custom matrix from m[6] explicit trans_affine(const double* m) : sx(m[0]), shy(m[1]), shx(m[2]), sy(m[3]), tx(m[4]), ty(m[5]) {} // Rectangle to a parallelogram. trans_affine(double x1, double y1, double x2, double y2, const double* parl) { rect_to_parl(x1, y1, x2, y2, parl); } // Parallelogram to a rectangle. trans_affine(const double* parl, double x1, double y1, double x2, double y2) { parl_to_rect(parl, x1, y1, x2, y2); } // Arbitrary parallelogram transformation. trans_affine(const double* src, const double* dst) { parl_to_parl(src, dst); } //---------------------------------- Parellelogram transformations // transform a parallelogram to another one. Src and dst are // pointers to arrays of three points (double[6], x1,y1,...) that // identify three corners of the parallelograms assuming implicit // fourth point. The arguments are arrays of double[6] mapped // to x1,y1, x2,y2, x3,y3 where the coordinates are: // *-----------------* // / (x3,y3)/ // / / // /(x1,y1) (x2,y2)/ // *-----------------* const trans_affine& parl_to_parl(const double* src, const double* dst); const trans_affine& rect_to_parl(double x1, double y1, double x2, double y2, const double* parl); const trans_affine& parl_to_rect(const double* parl, double x1, double y1, double x2, double y2); //------------------------------------------ Operations // Reset - load an identity matrix const trans_affine& reset(); // Direct transformations operations const trans_affine& translate(double x, double y); const trans_affine& rotate(double a); const trans_affine& scale(double s); const trans_affine& scale(double x, double y); // Multiply matrix to another one const trans_affine& multiply(const trans_affine& m); // Multiply "m" to "this" and assign the result to "this" const trans_affine& premultiply(const trans_affine& m); // Multiply matrix to inverse of another one const trans_affine& multiply_inv(const trans_affine& m); // Multiply inverse of "m" to "this" and assign the result to "this" const trans_affine& premultiply_inv(const trans_affine& m); // Invert matrix. Do not try to invert degenerate matrices, // there's no check for validity. If you set scale to 0 and // then try to invert matrix, expect unpredictable result. const trans_affine& invert(); // Mirroring around X const trans_affine& flip_x(); // Mirroring around Y const trans_affine& flip_y(); //------------------------------------------- Load/Store // Store matrix to an array [6] of double void store_to(double* m) const { *m++ = sx; *m++ = shy; *m++ = shx; *m++ = sy; *m++ = tx; *m++ = ty; } // Load matrix from an array [6] of double const trans_affine& load_from(const double* m) { sx = *m++; shy = *m++; shx = *m++; sy = *m++; tx = *m++; ty = *m++; return *this; } //------------------------------------------- Operators // Multiply the matrix by another one const trans_affine& operator *= (const trans_affine& m) { return multiply(m); } // Multiply the matrix by inverse of another one const trans_affine& operator /= (const trans_affine& m) { return multiply_inv(m); } // Multiply the matrix by another one and return // the result in a separete matrix. trans_affine operator * (const trans_affine& m) const { return trans_affine(*this).multiply(m); } // Multiply the matrix by inverse of another one // and return the result in a separete matrix. trans_affine operator / (const trans_affine& m) const { return trans_affine(*this).multiply_inv(m); } // Calculate and return the inverse matrix trans_affine operator ~ () const { trans_affine ret = *this; return ret.invert(); } // Equal operator with default epsilon bool operator == (const trans_affine& m) const { return is_equal(m, affine_epsilon); } // Not Equal operator with default epsilon bool operator != (const trans_affine& m) const { return !is_equal(m, affine_epsilon); } //-------------------------------------------- Transformations // Direct transformation of x and y void transform(double* x, double* y) const; // Direct transformation of x and y, 2x2 matrix only, no translation void transform_2x2(double* x, double* y) const; // Inverse transformation of x and y. It works slower than the // direct transformation. For massive operations it's better to // invert() the matrix and then use direct transformations. void inverse_transform(double* x, double* y) const; //-------------------------------------------- Auxiliary // Calculate the determinant of matrix double determinant() const { return sx * sy - shy * shx; } // Calculate the reciprocal of the determinant double determinant_reciprocal() const { return 1.0 / (sx * sy - shy * shx); } // Get the average scale (by X and Y). // Basically used to calculate the approximation_scale when // decomposinting curves into line segments. double scale() const; // Check to see if the matrix is not degenerate bool is_valid(double epsilon = affine_epsilon) const; // Check to see if it's an identity matrix bool is_identity(double epsilon = affine_epsilon) const; // Check to see if two matrices are equal bool is_equal(const trans_affine& m, double epsilon = affine_epsilon) const; // Determine the major parameters. Use with caution considering // possible degenerate cases. double rotation() const; void translation(double* dx, double* dy) const; void scaling(double* x, double* y) const; void scaling_abs(double* x, double* y) const; }; //------------------------------------------------------------------------ inline void trans_affine::transform(double* x, double* y) const { register double tmp = *x; *x = tmp * sx + *y * shx + tx; *y = tmp * shy + *y * sy + ty; } //------------------------------------------------------------------------ inline void trans_affine::transform_2x2(double* x, double* y) const { register double tmp = *x; *x = tmp * sx + *y * shx; *y = tmp * shy + *y * sy; } //------------------------------------------------------------------------ inline void trans_affine::inverse_transform(double* x, double* y) const { register double d = determinant_reciprocal(); register double a = (*x - tx) * d; register double b = (*y - ty) * d; *x = a * sy - b * shx; *y = b * sx - a * shy; } //------------------------------------------------------------------------ inline double trans_affine::scale() const { double x = 0.707106781 * sx + 0.707106781 * shx; double y = 0.707106781 * shy + 0.707106781 * sy; return sqrt(x*x + y*y); } //------------------------------------------------------------------------ inline const trans_affine& trans_affine::translate(double x, double y) { tx += x; ty += y; return *this; } //------------------------------------------------------------------------ inline const trans_affine& trans_affine::rotate(double a) { double ca = cos(a); double sa = sin(a); double t0 = sx * ca - shy * sa; double t2 = shx * ca - sy * sa; double t4 = tx * ca - ty * sa; shy = sx * sa + shy * ca; sy = shx * sa + sy * ca; ty = tx * sa + ty * ca; sx = t0; shx = t2; tx = t4; return *this; } //------------------------------------------------------------------------ inline const trans_affine& trans_affine::scale(double x, double y) { double mm0 = x; // Possible hint for the optimizer double mm3 = y; sx *= mm0; shx *= mm0; tx *= mm0; shy *= mm3; sy *= mm3; ty *= mm3; return *this; } //------------------------------------------------------------------------ inline const trans_affine& trans_affine::scale(double s) { double m = s; // Possible hint for the optimizer sx *= m; shx *= m; tx *= m; shy *= m; sy *= m; ty *= m; return *this; } //------------------------------------------------------------------------ inline const trans_affine& trans_affine::premultiply(const trans_affine& m) { trans_affine t = m; return *this = t.multiply(*this); } //------------------------------------------------------------------------ inline const trans_affine& trans_affine::multiply_inv(const trans_affine& m) { trans_affine t = m; t.invert(); return multiply(t); } //------------------------------------------------------------------------ inline const trans_affine& trans_affine::premultiply_inv(const trans_affine& m) { trans_affine t = m; t.invert(); return *this = t.multiply(*this); } //------------------------------------------------------------------------ inline void trans_affine::scaling_abs(double* x, double* y) const { // Used to calculate scaling coefficients in image resampling. // When there is considerable shear this method gives us much // better estimation than just sx, sy. *x = sqrt(sx * sx + shx * shx); *y = sqrt(shy * shy + sy * sy); } //====================================================trans_affine_rotation // Rotation matrix. sin() and cos() are calculated twice for the same angle. // There's no harm because the performance of sin()/cos() is very good on all // modern processors. Besides, this operation is not going to be invoked too // often. class trans_affine_rotation : public trans_affine { public: trans_affine_rotation(double a) : trans_affine(cos(a), sin(a), -sin(a), cos(a), 0.0, 0.0) {} }; //====================================================trans_affine_scaling // Scaling matrix. x, y - scale coefficients by X and Y respectively class trans_affine_scaling : public trans_affine { public: trans_affine_scaling(double x, double y) : trans_affine(x, 0.0, 0.0, y, 0.0, 0.0) {} trans_affine_scaling(double s) : trans_affine(s, 0.0, 0.0, s, 0.0, 0.0) {} }; //================================================trans_affine_translation // Translation matrix class trans_affine_translation : public trans_affine { public: trans_affine_translation(double x, double y) : trans_affine(1.0, 0.0, 0.0, 1.0, x, y) {} }; //====================================================trans_affine_skewing // Sckewing (shear) matrix class trans_affine_skewing : public trans_affine { public: trans_affine_skewing(double x, double y) : trans_affine(1.0, tan(y), tan(x), 1.0, 0.0, 0.0) {} }; //===============================================trans_affine_line_segment // Rotate, Scale and Translate, associating 0...dist with line segment // x1,y1,x2,y2 class trans_affine_line_segment : public trans_affine { public: trans_affine_line_segment(double x1, double y1, double x2, double y2, double dist) { double dx = x2 - x1; double dy = y2 - y1; if(dist > 0.0) { multiply(trans_affine_scaling(sqrt(dx * dx + dy * dy) / dist)); } multiply(trans_affine_rotation(atan2(dy, dx))); multiply(trans_affine_translation(x1, y1)); } }; //============================================trans_affine_reflection_unit // Reflection matrix. Reflect coordinates across the line through // the origin containing the unit vector (ux, uy). // Contributed by John Horigan class trans_affine_reflection_unit : public trans_affine { public: trans_affine_reflection_unit(double ux, double uy) : trans_affine(2.0 * ux * ux - 1.0, 2.0 * ux * uy, 2.0 * ux * uy, 2.0 * uy * uy - 1.0, 0.0, 0.0) {} }; //=================================================trans_affine_reflection // Reflection matrix. Reflect coordinates across the line through // the origin at the angle a or containing the non-unit vector (x, y). // Contributed by John Horigan class trans_affine_reflection : public trans_affine_reflection_unit { public: trans_affine_reflection(double a) : trans_affine_reflection_unit(cos(a), sin(a)) {} trans_affine_reflection(double x, double y) : trans_affine_reflection_unit(x / sqrt(x * x + y * y), y / sqrt(x * x + y * y)) {} }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rasterizer_outline_aa.h0000644000175000017500000005152013233644505026362 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_OUTLINE_AA_INCLUDED #define AGG_RASTERIZER_OUTLINE_AA_INCLUDED #include "agg_basics.h" #include "agg_line_aa_basics.h" #include "agg_vertex_sequence.h" namespace agg24 { //------------------------------------------------------------------------- inline bool cmp_dist_start(int d) { return d > 0; } inline bool cmp_dist_end(int d) { return d <= 0; } //-----------------------------------------------------------line_aa_vertex // Vertex (x, y) with the distance to the next one. The last vertex has // the distance between the last and the first points struct line_aa_vertex { int x; int y; int len; line_aa_vertex() {} line_aa_vertex(int x_, int y_) : x(x_), y(y_), len(0) { } bool operator () (const line_aa_vertex& val) { double dx = val.x - x; double dy = val.y - y; return (len = uround(sqrt(dx * dx + dy * dy))) > (line_subpixel_scale + line_subpixel_scale / 2); } }; //----------------------------------------------------------outline_aa_join_e enum outline_aa_join_e { outline_no_join, //-----outline_no_join outline_miter_join, //-----outline_miter_join outline_round_join, //-----outline_round_join outline_miter_accurate_join //-----outline_accurate_join }; //=======================================================rasterizer_outline_aa template class rasterizer_outline_aa { private: //------------------------------------------------------------------------ struct draw_vars { unsigned idx; int x1, y1, x2, y2; line_parameters curr, next; int lcurr, lnext; int xb1, yb1, xb2, yb2; unsigned flags; }; void draw(draw_vars& dv, unsigned start, unsigned end); public: typedef line_aa_vertex vertex_type; typedef vertex_sequence vertex_storage_type; explicit rasterizer_outline_aa(Renderer& ren) : m_ren(&ren), m_line_join(ren.accurate_join_only() ? outline_miter_accurate_join : outline_round_join), m_round_cap(false), m_start_x(0), m_start_y(0) {} void attach(Renderer& ren) { m_ren = &ren; } //------------------------------------------------------------------------ void line_join(outline_aa_join_e join) { m_line_join = m_ren->accurate_join_only() ? outline_miter_accurate_join : join; } bool line_join() const { return m_line_join; } //------------------------------------------------------------------------ void round_cap(bool v) { m_round_cap = v; } bool round_cap() const { return m_round_cap; } //------------------------------------------------------------------------ void move_to(int x, int y) { m_src_vertices.modify_last(vertex_type(m_start_x = x, m_start_y = y)); } //------------------------------------------------------------------------ void line_to(int x, int y) { m_src_vertices.add(vertex_type(x, y)); } //------------------------------------------------------------------------ void move_to_d(double x, double y) { move_to(Coord::conv(x), Coord::conv(y)); } //------------------------------------------------------------------------ void line_to_d(double x, double y) { line_to(Coord::conv(x), Coord::conv(y)); } //------------------------------------------------------------------------ void render(bool close_polygon); //------------------------------------------------------------------------ void add_vertex(double x, double y, unsigned cmd) { if(is_move_to(cmd)) { render(false); move_to_d(x, y); } else { if(is_end_poly(cmd)) { render(is_closed(cmd)); if(is_closed(cmd)) { move_to(m_start_x, m_start_y); } } else { line_to_d(x, y); } } } //------------------------------------------------------------------------ template void add_path(VertexSource& vs, unsigned path_id=0) { double x; double y; unsigned cmd; vs.rewind(path_id); while(!is_stop(cmd = vs.vertex(&x, &y))) { add_vertex(x, y, cmd); } render(false); } //------------------------------------------------------------------------ template void render_all_paths(VertexSource& vs, const ColorStorage& colors, const PathId& path_id, unsigned num_paths) { for(unsigned i = 0; i < num_paths; i++) { m_ren->color(colors[i]); add_path(vs, path_id[i]); } } //------------------------------------------------------------------------ template void render_ctrl(Ctrl& c) { unsigned i; for(i = 0; i < c.num_paths(); i++) { m_ren->color(c.color(i)); add_path(c, i); } } private: rasterizer_outline_aa(const rasterizer_outline_aa&); const rasterizer_outline_aa& operator = (const rasterizer_outline_aa&); Renderer* m_ren; vertex_storage_type m_src_vertices; outline_aa_join_e m_line_join; bool m_round_cap; int m_start_x; int m_start_y; }; //---------------------------------------------------------------------------- template void rasterizer_outline_aa::draw(draw_vars& dv, unsigned start, unsigned end) { unsigned i; const vertex_storage_type::value_type* v; for(i = start; i < end; i++) { if(m_line_join == outline_round_join) { dv.xb1 = dv.curr.x1 + (dv.curr.y2 - dv.curr.y1); dv.yb1 = dv.curr.y1 - (dv.curr.x2 - dv.curr.x1); dv.xb2 = dv.curr.x2 + (dv.curr.y2 - dv.curr.y1); dv.yb2 = dv.curr.y2 - (dv.curr.x2 - dv.curr.x1); } switch(dv.flags) { case 0: m_ren->line3(dv.curr, dv.xb1, dv.yb1, dv.xb2, dv.yb2); break; case 1: m_ren->line2(dv.curr, dv.xb2, dv.yb2); break; case 2: m_ren->line1(dv.curr, dv.xb1, dv.yb1); break; case 3: m_ren->line0(dv.curr); break; } if(m_line_join == outline_round_join && (dv.flags & 2) == 0) { m_ren->pie(dv.curr.x2, dv.curr.y2, dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), dv.curr.y2 - (dv.curr.x2 - dv.curr.x1), dv.curr.x2 + (dv.next.y2 - dv.next.y1), dv.curr.y2 - (dv.next.x2 - dv.next.x1)); } dv.x1 = dv.x2; dv.y1 = dv.y2; dv.lcurr = dv.lnext; dv.lnext = m_src_vertices[dv.idx].len; ++dv.idx; if(dv.idx >= m_src_vertices.size()) dv.idx = 0; v = &m_src_vertices[dv.idx]; dv.x2 = v->x; dv.y2 = v->y; dv.curr = dv.next; dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); dv.xb1 = dv.xb2; dv.yb1 = dv.yb2; switch(m_line_join) { case outline_no_join: dv.flags = 3; break; case outline_miter_join: dv.flags >>= 1; dv.flags |= ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); if((dv.flags & 2) == 0) { bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); } break; case outline_round_join: dv.flags >>= 1; dv.flags |= ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); break; case outline_miter_accurate_join: dv.flags = 0; bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); break; } } } //---------------------------------------------------------------------------- template void rasterizer_outline_aa::render(bool close_polygon) { m_src_vertices.close(close_polygon); draw_vars dv; const vertex_storage_type::value_type* v; int x1; int y1; int x2; int y2; int lprev; if(close_polygon) { if(m_src_vertices.size() >= 3) { dv.idx = 2; v = &m_src_vertices[m_src_vertices.size() - 1]; x1 = v->x; y1 = v->y; lprev = v->len; v = &m_src_vertices[0]; x2 = v->x; y2 = v->y; dv.lcurr = v->len; line_parameters prev(x1, y1, x2, y2, lprev); v = &m_src_vertices[1]; dv.x1 = v->x; dv.y1 = v->y; dv.lnext = v->len; dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr); v = &m_src_vertices[dv.idx]; dv.x2 = v->x; dv.y2 = v->y; dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); dv.xb1 = 0; dv.yb1 = 0; dv.xb2 = 0; dv.yb2 = 0; switch(m_line_join) { case outline_no_join: dv.flags = 3; break; case outline_miter_join: case outline_round_join: dv.flags = (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) | ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); break; case outline_miter_accurate_join: dv.flags = 0; break; } if((dv.flags & 1) == 0 && m_line_join != outline_round_join) { bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1); } if((dv.flags & 2) == 0 && m_line_join != outline_round_join) { bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); } draw(dv, 0, m_src_vertices.size()); } } else { switch(m_src_vertices.size()) { case 0: case 1: break; case 2: { v = &m_src_vertices[0]; x1 = v->x; y1 = v->y; lprev = v->len; v = &m_src_vertices[1]; x2 = v->x; y2 = v->y; line_parameters lp(x1, y1, x2, y2, lprev); if(m_round_cap) { m_ren->semidot(cmp_dist_start, x1, y1, x1 + (y2 - y1), y1 - (x2 - x1)); } m_ren->line3(lp, x1 + (y2 - y1), y1 - (x2 - x1), x2 + (y2 - y1), y2 - (x2 - x1)); if(m_round_cap) { m_ren->semidot(cmp_dist_end, x2, y2, x2 + (y2 - y1), y2 - (x2 - x1)); } } break; case 3: { int x3, y3; int lnext; v = &m_src_vertices[0]; x1 = v->x; y1 = v->y; lprev = v->len; v = &m_src_vertices[1]; x2 = v->x; y2 = v->y; lnext = v->len; v = &m_src_vertices[2]; x3 = v->x; y3 = v->y; line_parameters lp1(x1, y1, x2, y2, lprev); line_parameters lp2(x2, y2, x3, y3, lnext); if(m_round_cap) { m_ren->semidot(cmp_dist_start, x1, y1, x1 + (y2 - y1), y1 - (x2 - x1)); } if(m_line_join == outline_round_join) { m_ren->line3(lp1, x1 + (y2 - y1), y1 - (x2 - x1), x2 + (y2 - y1), y2 - (x2 - x1)); m_ren->pie(x2, y2, x2 + (y2 - y1), y2 - (x2 - x1), x2 + (y3 - y2), y2 - (x3 - x2)); m_ren->line3(lp2, x2 + (y3 - y2), y2 - (x3 - x2), x3 + (y3 - y2), y3 - (x3 - x2)); } else { bisectrix(lp1, lp2, &dv.xb1, &dv.yb1); m_ren->line3(lp1, x1 + (y2 - y1), y1 - (x2 - x1), dv.xb1, dv.yb1); m_ren->line3(lp2, dv.xb1, dv.yb1, x3 + (y3 - y2), y3 - (x3 - x2)); } if(m_round_cap) { m_ren->semidot(cmp_dist_end, x3, y3, x3 + (y3 - y2), y3 - (x3 - x2)); } } break; default: { dv.idx = 3; v = &m_src_vertices[0]; x1 = v->x; y1 = v->y; lprev = v->len; v = &m_src_vertices[1]; x2 = v->x; y2 = v->y; dv.lcurr = v->len; line_parameters prev(x1, y1, x2, y2, lprev); v = &m_src_vertices[2]; dv.x1 = v->x; dv.y1 = v->y; dv.lnext = v->len; dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr); v = &m_src_vertices[dv.idx]; dv.x2 = v->x; dv.y2 = v->y; dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); dv.xb1 = 0; dv.yb1 = 0; dv.xb2 = 0; dv.yb2 = 0; switch(m_line_join) { case outline_no_join: dv.flags = 3; break; case outline_miter_join: case outline_round_join: dv.flags = (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) | ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); break; case outline_miter_accurate_join: dv.flags = 0; break; } if(m_round_cap) { m_ren->semidot(cmp_dist_start, x1, y1, x1 + (y2 - y1), y1 - (x2 - x1)); } if((dv.flags & 1) == 0) { if(m_line_join == outline_round_join) { m_ren->line3(prev, x1 + (y2 - y1), y1 - (x2 - x1), x2 + (y2 - y1), y2 - (x2 - x1)); m_ren->pie(prev.x2, prev.y2, x2 + (y2 - y1), y2 - (x2 - x1), dv.curr.x1 + (dv.curr.y2 - dv.curr.y1), dv.curr.y1 - (dv.curr.x2 - dv.curr.x1)); } else { bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1); m_ren->line3(prev, x1 + (y2 - y1), y1 - (x2 - x1), dv.xb1, dv.yb1); } } else { m_ren->line1(prev, x1 + (y2 - y1), y1 - (x2 - x1)); } if((dv.flags & 2) == 0 && m_line_join != outline_round_join) { bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); } draw(dv, 1, m_src_vertices.size() - 2); if((dv.flags & 1) == 0) { if(m_line_join == outline_round_join) { m_ren->line3(dv.curr, dv.curr.x1 + (dv.curr.y2 - dv.curr.y1), dv.curr.y1 - (dv.curr.x2 - dv.curr.x1), dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); } else { m_ren->line3(dv.curr, dv.xb1, dv.yb1, dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); } } else { m_ren->line2(dv.curr, dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); } if(m_round_cap) { m_ren->semidot(cmp_dist_end, dv.curr.x2, dv.curr.y2, dv.curr.x2 + (dv.curr.y2 - dv.curr.y1), dv.curr.y2 - (dv.curr.x2 - dv.curr.x1)); } } break; } } m_src_vertices.remove_all(); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_line_aa_basics.h0000644000175000017500000001541613233644505024710 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_LINE_AA_BASICS_INCLUDED #define AGG_LINE_AA_BASICS_INCLUDED #include #include "agg_basics.h" namespace agg24 { // See Implementation agg_line_aa_basics.cpp //------------------------------------------------------------------------- enum line_subpixel_scale_e { line_subpixel_shift = 8, //----line_subpixel_shift line_subpixel_scale = 1 << line_subpixel_shift, //----line_subpixel_scale line_subpixel_mask = line_subpixel_scale - 1, //----line_subpixel_mask line_max_coord = (1 << 28) - 1, //----line_max_coord line_max_length = 1 << (line_subpixel_shift + 10) //----line_max_length }; //------------------------------------------------------------------------- enum line_mr_subpixel_scale_e { line_mr_subpixel_shift = 4, //----line_mr_subpixel_shift line_mr_subpixel_scale = 1 << line_mr_subpixel_shift, //----line_mr_subpixel_scale line_mr_subpixel_mask = line_mr_subpixel_scale - 1 //----line_mr_subpixel_mask }; //------------------------------------------------------------------line_mr AGG_INLINE int line_mr(int x) { return x >> (line_subpixel_shift - line_mr_subpixel_shift); } //-------------------------------------------------------------------line_hr AGG_INLINE int line_hr(int x) { return x << (line_subpixel_shift - line_mr_subpixel_shift); } //---------------------------------------------------------------line_dbl_hr AGG_INLINE int line_dbl_hr(int x) { return x << line_subpixel_shift; } //---------------------------------------------------------------line_coord struct line_coord { AGG_INLINE static int conv(double x) { return iround(x * line_subpixel_scale); } }; //-----------------------------------------------------------line_coord_sat struct line_coord_sat { AGG_INLINE static int conv(double x) { return saturation::iround(x * line_subpixel_scale); } }; //==========================================================line_parameters struct line_parameters { //--------------------------------------------------------------------- line_parameters() {} line_parameters(int x1_, int y1_, int x2_, int y2_, int len_) : x1(x1_), y1(y1_), x2(x2_), y2(y2_), dx(abs(x2_ - x1_)), dy(abs(y2_ - y1_)), sx((x2_ > x1_) ? 1 : -1), sy((y2_ > y1_) ? 1 : -1), vertical(dy >= dx), inc(vertical ? sy : sx), len(len_), octant((sy & 4) | (sx & 2) | int(vertical)) { } //--------------------------------------------------------------------- unsigned orthogonal_quadrant() const { return s_orthogonal_quadrant[octant]; } unsigned diagonal_quadrant() const { return s_diagonal_quadrant[octant]; } //--------------------------------------------------------------------- bool same_orthogonal_quadrant(const line_parameters& lp) const { return s_orthogonal_quadrant[octant] == s_orthogonal_quadrant[lp.octant]; } //--------------------------------------------------------------------- bool same_diagonal_quadrant(const line_parameters& lp) const { return s_diagonal_quadrant[octant] == s_diagonal_quadrant[lp.octant]; } //--------------------------------------------------------------------- void divide(line_parameters& lp1, line_parameters& lp2) const { int xmid = (x1 + x2) >> 1; int ymid = (y1 + y2) >> 1; int len2 = len >> 1; lp1 = *this; lp2 = *this; lp1.x2 = xmid; lp1.y2 = ymid; lp1.len = len2; lp1.dx = abs(lp1.x2 - lp1.x1); lp1.dy = abs(lp1.y2 - lp1.y1); lp2.x1 = xmid; lp2.y1 = ymid; lp2.len = len2; lp2.dx = abs(lp2.x2 - lp2.x1); lp2.dy = abs(lp2.y2 - lp2.y1); } //--------------------------------------------------------------------- int x1, y1, x2, y2, dx, dy, sx, sy; bool vertical; int inc; int len; int octant; //--------------------------------------------------------------------- static const int8u s_orthogonal_quadrant[8]; static const int8u s_diagonal_quadrant[8]; }; // See Implementation agg_line_aa_basics.cpp //----------------------------------------------------------------bisectrix void bisectrix(const line_parameters& l1, const line_parameters& l2, int* x, int* y); //-------------------------------------------fix_degenerate_bisectrix_start void inline fix_degenerate_bisectrix_start(const line_parameters& lp, int* x, int* y) { int d = iround((double(*x - lp.x2) * double(lp.y2 - lp.y1) - double(*y - lp.y2) * double(lp.x2 - lp.x1)) / lp.len); if(d < line_subpixel_scale/2) { *x = lp.x1 + (lp.y2 - lp.y1); *y = lp.y1 - (lp.x2 - lp.x1); } } //---------------------------------------------fix_degenerate_bisectrix_end void inline fix_degenerate_bisectrix_end(const line_parameters& lp, int* x, int* y) { int d = iround((double(*x - lp.x2) * double(lp.y2 - lp.y1) - double(*y - lp.y2) * double(lp.x2 - lp.x1)) / lp.len); if(d < line_subpixel_scale/2) { *x = lp.x2 + (lp.y2 - lp.y1); *y = lp.y2 - (lp.x2 - lp.x1); } } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rasterizer_outline.h0000644000175000017500000001047013233644505025720 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_OUTLINE_INCLUDED #define AGG_RASTERIZER_OUTLINE_INCLUDED #include "agg_basics.h" namespace agg24 { //======================================================rasterizer_outline template class rasterizer_outline { public: explicit rasterizer_outline(Renderer& ren) : m_ren(&ren), m_start_x(0), m_start_y(0), m_vertices(0) {} void attach(Renderer& ren) { m_ren = &ren; } //-------------------------------------------------------------------- void move_to(int x, int y) { m_vertices = 1; m_ren->move_to(m_start_x = x, m_start_y = y); } //-------------------------------------------------------------------- void line_to(int x, int y) { ++m_vertices; m_ren->line_to(x, y); } //-------------------------------------------------------------------- void move_to_d(double x, double y) { move_to(m_ren->coord(x), m_ren->coord(y)); } //-------------------------------------------------------------------- void line_to_d(double x, double y) { line_to(m_ren->coord(x), m_ren->coord(y)); } //-------------------------------------------------------------------- void close() { if(m_vertices > 2) { line_to(m_start_x, m_start_y); } m_vertices = 0; } //-------------------------------------------------------------------- void add_vertex(double x, double y, unsigned cmd) { if(is_move_to(cmd)) { move_to_d(x, y); } else { if(is_end_poly(cmd)) { if(is_closed(cmd)) close(); } else { line_to_d(x, y); } } } //-------------------------------------------------------------------- template void add_path(VertexSource& vs, unsigned path_id=0) { double x; double y; unsigned cmd; vs.rewind(path_id); while(!is_stop(cmd = vs.vertex(&x, &y))) { add_vertex(x, y, cmd); } } //-------------------------------------------------------------------- template void render_all_paths(VertexSource& vs, const ColorStorage& colors, const PathId& path_id, unsigned num_paths) { for(unsigned i = 0; i < num_paths; i++) { m_ren->line_color(colors[i]); add_path(vs, path_id[i]); } } //-------------------------------------------------------------------- template void render_ctrl(Ctrl& c) { unsigned i; for(i = 0; i < c.num_paths(); i++) { m_ren->line_color(c.color(i)); add_path(c, i); } } private: Renderer* m_ren; int m_start_x; int m_start_y; unsigned m_vertices; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_gsv_text.h0000644000175000017500000001011413233644505023625 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Class gsv_text // //---------------------------------------------------------------------------- #ifndef AGG_GSV_TEXT_INCLUDED #define AGG_GSV_TEXT_INCLUDED #include "agg_array.h" #include "agg_conv_stroke.h" #include "agg_conv_transform.h" namespace agg24 { //---------------------------------------------------------------gsv_text // // See Implementation agg_gsv_text.cpp // class gsv_text { enum status { initial, next_char, start_glyph, glyph }; public: gsv_text(); void font(const void* font); void flip(bool flip_y) { m_flip = flip_y; } void load_font(const char* file); void size(double height, double width=0.0); void space(double space); void line_space(double line_space); void start_point(double x, double y); void text(const char* text); double text_width(); void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: // not supposed to be copied gsv_text(const gsv_text&); const gsv_text& operator = (const gsv_text&); int16u value(const int8u* p) const { int16u v; if(m_big_endian) { *(int8u*)&v = p[1]; *((int8u*)&v + 1) = p[0]; } else { *(int8u*)&v = p[0]; *((int8u*)&v + 1) = p[1]; } return v; } private: double m_x; double m_y; double m_start_x; double m_width; double m_height; double m_space; double m_line_space; char m_chr[2]; char* m_text; pod_array m_text_buf; char* m_cur_chr; const void* m_font; pod_array m_loaded_font; status m_status; bool m_big_endian; bool m_flip; int8u* m_indices; int8* m_glyphs; int8* m_bglyph; int8* m_eglyph; double m_w; double m_h; }; //--------------------------------------------------------gsv_text_outline template class gsv_text_outline { public: gsv_text_outline(gsv_text& text, Transformer& trans) : m_polyline(text), m_trans(m_polyline, trans) { } void width(double w) { m_polyline.width(w); } void transformer(const Transformer* trans) { m_trans->transformer(trans); } void rewind(unsigned path_id) { m_trans.rewind(path_id); m_polyline.line_join(round_join); m_polyline.line_cap(round_cap); } unsigned vertex(double* x, double* y) { return m_trans.vertex(x, y); } private: conv_stroke m_polyline; conv_transform, Transformer> m_trans; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_path_length.h0000644000175000017500000000366313233644505024272 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_PATH_LENGTH_INCLUDED #define AGG_PATH_LENGTH_INCLUDED #include "agg_math.h" namespace agg24 { template double path_length(VertexSource& vs, unsigned path_id = 0) { double len = 0.0; double start_x = 0.0; double start_y = 0.0; double x1 = 0.0; double y1 = 0.0; double x2 = 0.0; double y2 = 0.0; bool first = true; unsigned cmd; vs.rewind(path_id); while(!is_stop(cmd = vs.vertex(&x2, &y2))) { if(is_vertex(cmd)) { if(first || is_move_to(cmd)) { start_x = x2; start_y = y2; } else { len += calc_distance(x1, y1, x2, y2); } x1 = x2; y1 = y2; first = false; } else { if(is_close(cmd) && !first) { len += calc_distance(x1, y1, start_x, start_y); } } } return len; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_pixfmt_transposer.h0000644000175000017500000001411413233644505025555 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_PIXFMT_TRANSPOSER_INCLUDED #define AGG_PIXFMT_TRANSPOSER_INCLUDED #include "agg_basics.h" namespace agg24 { //=======================================================pixfmt_transposer template class pixfmt_transposer { public: typedef PixFmt pixfmt_type; typedef typename pixfmt_type::color_type color_type; typedef typename pixfmt_type::row_data row_data; typedef typename color_type::value_type value_type; typedef typename color_type::calc_type calc_type; //-------------------------------------------------------------------- pixfmt_transposer() : m_pixf(0) {} explicit pixfmt_transposer(pixfmt_type& pixf) : m_pixf(&pixf) {} void attach(pixfmt_type& pixf) { m_pixf = &pixf; } //-------------------------------------------------------------------- AGG_INLINE unsigned width() const { return m_pixf->height(); } AGG_INLINE unsigned height() const { return m_pixf->width(); } //-------------------------------------------------------------------- AGG_INLINE color_type pixel(int x, int y) const { return m_pixf->pixel(y, x); } //-------------------------------------------------------------------- AGG_INLINE void copy_pixel(int x, int y, const color_type& c) { m_pixf->copy_pixel(y, x, c); } //-------------------------------------------------------------------- AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover) { m_pixf->blend_pixel(y, x, c, cover); } //-------------------------------------------------------------------- AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) { m_pixf->copy_vline(y, x, len, c); } //-------------------------------------------------------------------- AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) { m_pixf->copy_hline(y, x, len, c); } //-------------------------------------------------------------------- AGG_INLINE void blend_hline(int x, int y, unsigned len, const color_type& c, int8u cover) { m_pixf->blend_vline(y, x, len, c, cover); } //-------------------------------------------------------------------- AGG_INLINE void blend_vline(int x, int y, unsigned len, const color_type& c, int8u cover) { m_pixf->blend_hline(y, x, len, c, cover); } //-------------------------------------------------------------------- AGG_INLINE void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { m_pixf->blend_solid_vspan(y, x, len, c, covers); } //-------------------------------------------------------------------- AGG_INLINE void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const int8u* covers) { m_pixf->blend_solid_hspan(y, x, len, c, covers); } //-------------------------------------------------------------------- AGG_INLINE void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) { m_pixf->copy_color_vspan(y, x, len, colors); } //-------------------------------------------------------------------- AGG_INLINE void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) { m_pixf->copy_color_hspan(y, x, len, colors); } //-------------------------------------------------------------------- AGG_INLINE void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { m_pixf->blend_color_vspan(y, x, len, colors, covers, cover); } //-------------------------------------------------------------------- AGG_INLINE void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const int8u* covers, int8u cover) { m_pixf->blend_color_hspan(y, x, len, colors, covers, cover); } private: pixfmt_type* m_pixf; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_trans_double_path.h0000644000175000017500000001034013233644505025460 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_TRANS_DOUBLE_PATH_INCLUDED #define AGG_TRANS_DOUBLE_PATH_INCLUDED #include "agg_basics.h" #include "agg_vertex_sequence.h" namespace agg24 { // See also: agg_trans_double_path.cpp // //-------------------------------------------------------trans_double_path class trans_double_path { enum status_e { initial, making_path, ready }; public: typedef vertex_sequence vertex_storage; trans_double_path(); //-------------------------------------------------------------------- void base_length(double v) { m_base_length = v; } double base_length() const { return m_base_length; } //-------------------------------------------------------------------- void base_height(double v) { m_base_height = v; } double base_height() const { return m_base_height; } //-------------------------------------------------------------------- void preserve_x_scale(bool f) { m_preserve_x_scale = f; } bool preserve_x_scale() const { return m_preserve_x_scale; } //-------------------------------------------------------------------- void reset(); void move_to1(double x, double y); void line_to1(double x, double y); void move_to2(double x, double y); void line_to2(double x, double y); void finalize_paths(); //-------------------------------------------------------------------- template void add_paths(VertexSource1& vs1, VertexSource2& vs2, unsigned path1_id=0, unsigned path2_id=0) { double x; double y; unsigned cmd; vs1.rewind(path1_id); while(!is_stop(cmd = vs1.vertex(&x, &y))) { if(is_move_to(cmd)) { move_to1(x, y); } else { if(is_vertex(cmd)) { line_to1(x, y); } } } vs2.rewind(path2_id); while(!is_stop(cmd = vs2.vertex(&x, &y))) { if(is_move_to(cmd)) { move_to2(x, y); } else { if(is_vertex(cmd)) { line_to2(x, y); } } } finalize_paths(); } //-------------------------------------------------------------------- double total_length1() const; double total_length2() const; void transform(double *x, double *y) const; private: double finalize_path(vertex_storage& vertices); void transform1(const vertex_storage& vertices, double kindex, double kx, double *x, double* y) const; vertex_storage m_src_vertices1; vertex_storage m_src_vertices2; double m_base_length; double m_base_height; double m_kindex1; double m_kindex2; status_e m_status1; status_e m_status2; bool m_preserve_x_scale; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_gradient_image.h0000644000175000017500000000712513233644505025752 0ustar varunvarun//---------------------------------------------------------------------------- // AGG Contribution Pack - Gradients 1 (AGG CP - Gradients 1) // http://milan.marusinec.sk/aggcp // // For Anti-Grain Geometry - Version 2.4 // http://www.antigrain.org // // Contribution Created By: // Milan Marusinec alias Milano // milan@marusinec.sk // Copyright (c) 2007-2008 // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // // [History] ----------------------------------------------------------------- // // 03.02.2008-Milano: Ported from Object Pascal code of AggPas // #ifndef AGG_SPAN_GRADIENT_IMAGE_INCLUDED #define AGG_SPAN_GRADIENT_IMAGE_INCLUDED #include "agg_basics.h" #include "agg_span_gradient.h" #include "agg_color_rgba.h" #include "agg_rendering_buffer.h" #include "agg_pixfmt_rgba.h" namespace agg24 { //==========================================================one_color_function template class one_color_function { public: typedef ColorT color_type; color_type m_color; one_color_function() : m_color() { } static unsigned size() { return 1; } const color_type& operator [] (unsigned i) const { return m_color; } color_type* operator [] (unsigned i) { return &m_color; } }; //==========================================================gradient_image template class gradient_image { private: //------------ fields typedef ColorT color_type; typedef agg24::pixfmt_rgba32 pixfmt_type; agg24::rgba8* m_buffer; int m_alocdx; int m_alocdy; int m_width; int m_height; color_type* m_color; one_color_function m_color_function; public: gradient_image() : m_color_function(), m_buffer(NULL), m_alocdx(0), m_alocdy(0), m_width(0), m_height(0) { m_color = m_color_function[0 ]; } ~gradient_image() { if (m_buffer) { delete [] m_buffer; } } void* image_create(int width, int height ) { void* result = NULL; if (width > m_alocdx || height > m_alocdy) { if (m_buffer) { delete [] m_buffer; } m_buffer = NULL; m_buffer = new agg24::rgba8[width * height]; if (m_buffer) { m_alocdx = width; m_alocdy = height; } else { m_alocdx = 0; m_alocdy = 0; }; }; if (m_buffer) { m_width = width; m_height = height; for (int rows = 0; rows < height; rows++) { agg24::rgba8* row = &m_buffer[rows * m_alocdx ]; memset(row ,0 ,m_width * 4 ); }; result = m_buffer; }; return result; } void* image_buffer() { return m_buffer; } int image_width() { return m_width; } int image_height() { return m_height; } int image_stride() { return m_alocdx * 4; } int calculate(int x, int y, int d) const { if (m_buffer) { int px = x >> agg24::gradient_subpixel_shift; int py = y >> agg24::gradient_subpixel_shift; px %= m_width; if (px < 0) { px += m_width; } py %= m_height; if (py < 0 ) { py += m_height; } rgba8* pixel = &m_buffer[py * m_alocdx + px ]; m_color->r = pixel->r; m_color->g = pixel->g; m_color->b = pixel->b; m_color->a = pixel->a; } else { m_color->r = 0; m_color->g = 0; m_color->b = 0; m_color->a = 0; } return 0; } const one_color_function& color_function() const { return m_color_function; } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_array.h0000644000175000017500000010512013233644505023102 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_ARRAY_INCLUDED #define AGG_ARRAY_INCLUDED #include #include #include "agg_basics.h" namespace agg24 { //-------------------------------------------------------pod_array_adaptor template class pod_array_adaptor { public: typedef T value_type; pod_array_adaptor(T* array, unsigned size) : m_array(array), m_size(size) {} unsigned size() const { return m_size; } const T& operator [] (unsigned i) const { return m_array[i]; } T& operator [] (unsigned i) { return m_array[i]; } const T& at(unsigned i) const { return m_array[i]; } T& at(unsigned i) { return m_array[i]; } T value_at(unsigned i) const { return m_array[i]; } private: T* m_array; unsigned m_size; }; //---------------------------------------------------------pod_auto_array template class pod_auto_array { public: typedef T value_type; typedef pod_auto_array self_type; pod_auto_array() {} explicit pod_auto_array(const T* c) { memcpy(m_array, c, sizeof(T) * Size); } const self_type& operator = (const T* c) { memcpy(m_array, c, sizeof(T) * Size); return *this; } static unsigned size() { return Size; } const T& operator [] (unsigned i) const { return m_array[i]; } T& operator [] (unsigned i) { return m_array[i]; } const T& at(unsigned i) const { return m_array[i]; } T& at(unsigned i) { return m_array[i]; } T value_at(unsigned i) const { return m_array[i]; } private: T m_array[Size]; }; //--------------------------------------------------------pod_auto_vector template class pod_auto_vector { public: typedef T value_type; typedef pod_auto_vector self_type; pod_auto_vector() : m_size(0) {} void remove_all() { m_size = 0; } void clear() { m_size = 0; } void add(const T& v) { m_array[m_size++] = v; } void push_back(const T& v) { m_array[m_size++] = v; } void inc_size(unsigned size) { m_size += size; } unsigned size() const { return m_size; } const T& operator [] (unsigned i) const { return m_array[i]; } T& operator [] (unsigned i) { return m_array[i]; } const T& at(unsigned i) const { return m_array[i]; } T& at(unsigned i) { return m_array[i]; } T value_at(unsigned i) const { return m_array[i]; } private: T m_array[Size]; unsigned m_size; }; //---------------------------------------------------------------pod_array template class pod_array { public: typedef T value_type; typedef pod_array self_type; ~pod_array() { pod_allocator::deallocate(m_array, m_size); } pod_array() : m_array(0), m_size(0) {} pod_array(unsigned size) : m_array(pod_allocator::allocate(size)), m_size(size) {} pod_array(const self_type& v) : m_array(pod_allocator::allocate(v.m_size)), m_size(v.m_size) { memcpy(m_array, v.m_array, sizeof(T) * m_size); } void resize(unsigned size) { if(size != m_size) { pod_allocator::deallocate(m_array, m_size); m_array = pod_allocator::allocate(m_size = size); } } const self_type& operator = (const self_type& v) { resize(v.size()); memcpy(m_array, v.m_array, sizeof(T) * m_size); return *this; } unsigned size() const { return m_size; } const T& operator [] (unsigned i) const { return m_array[i]; } T& operator [] (unsigned i) { return m_array[i]; } const T& at(unsigned i) const { return m_array[i]; } T& at(unsigned i) { return m_array[i]; } T value_at(unsigned i) const { return m_array[i]; } const T* data() const { return m_array; } T* data() { return m_array; } private: T* m_array; unsigned m_size; }; //--------------------------------------------------------------pod_vector // A simple class template to store Plain Old Data, a vector // of a fixed size. The data is continous in memory //------------------------------------------------------------------------ template class pod_vector { public: typedef T value_type; ~pod_vector() { pod_allocator::deallocate(m_array, m_capacity); } pod_vector() : m_size(0), m_capacity(0), m_array(0) {} pod_vector(unsigned cap, unsigned extra_tail=0); // Copying pod_vector(const pod_vector&); const pod_vector& operator = (const pod_vector&); // Set new capacity. All data is lost, size is set to zero. void capacity(unsigned cap, unsigned extra_tail=0); unsigned capacity() const { return m_capacity; } // Allocate n elements. All data is lost, // but elements can be accessed in range 0...size-1. void allocate(unsigned size, unsigned extra_tail=0); // Resize keeping the content. void resize(unsigned new_size); void zero() { memset(m_array, 0, sizeof(T) * m_size); } void add(const T& v) { m_array[m_size++] = v; } void push_back(const T& v) { m_array[m_size++] = v; } void insert_at(unsigned pos, const T& val); void inc_size(unsigned size) { m_size += size; } unsigned size() const { return m_size; } unsigned byte_size() const { return m_size * sizeof(T); } void serialize(int8u* ptr) const; void deserialize(const int8u* data, unsigned byte_size); const T& operator [] (unsigned i) const { return m_array[i]; } T& operator [] (unsigned i) { return m_array[i]; } const T& at(unsigned i) const { return m_array[i]; } T& at(unsigned i) { return m_array[i]; } T value_at(unsigned i) const { return m_array[i]; } const T* data() const { return m_array; } T* data() { return m_array; } void remove_all() { m_size = 0; } void clear() { m_size = 0; } void cut_at(unsigned num) { if(num < m_size) m_size = num; } private: unsigned m_size; unsigned m_capacity; T* m_array; }; //------------------------------------------------------------------------ template void pod_vector::capacity(unsigned cap, unsigned extra_tail) { m_size = 0; if(cap > m_capacity) { pod_allocator::deallocate(m_array, m_capacity); m_capacity = cap + extra_tail; m_array = m_capacity ? pod_allocator::allocate(m_capacity) : 0; } } //------------------------------------------------------------------------ template void pod_vector::allocate(unsigned size, unsigned extra_tail) { capacity(size, extra_tail); m_size = size; } //------------------------------------------------------------------------ template void pod_vector::resize(unsigned new_size) { if(new_size > m_size) { if(new_size > m_capacity) { T* data = pod_allocator::allocate(new_size); memcpy(data, m_array, m_size * sizeof(T)); pod_allocator::deallocate(m_array, m_capacity); m_array = data; } } else { m_size = new_size; } } //------------------------------------------------------------------------ template pod_vector::pod_vector(unsigned cap, unsigned extra_tail) : m_size(0), m_capacity(cap + extra_tail), m_array(pod_allocator::allocate(m_capacity)) {} //------------------------------------------------------------------------ template pod_vector::pod_vector(const pod_vector& v) : m_size(v.m_size), m_capacity(v.m_capacity), m_array(v.m_capacity ? pod_allocator::allocate(v.m_capacity) : 0) { memcpy(m_array, v.m_array, sizeof(T) * v.m_size); } //------------------------------------------------------------------------ template const pod_vector& pod_vector::operator = (const pod_vector&v) { allocate(v.m_size); if(v.m_size) memcpy(m_array, v.m_array, sizeof(T) * v.m_size); return *this; } //------------------------------------------------------------------------ template void pod_vector::serialize(int8u* ptr) const { if(m_size) memcpy(ptr, m_array, m_size * sizeof(T)); } //------------------------------------------------------------------------ template void pod_vector::deserialize(const int8u* data, unsigned byte_size) { byte_size /= sizeof(T); allocate(byte_size); if(byte_size) memcpy(m_array, data, byte_size * sizeof(T)); } //------------------------------------------------------------------------ template void pod_vector::insert_at(unsigned pos, const T& val) { if(pos >= m_size) { m_array[m_size] = val; } else { memmove(m_array + pos + 1, m_array + pos, (m_size - pos) * sizeof(T)); m_array[pos] = val; } ++m_size; } //---------------------------------------------------------------pod_bvector // A simple class template to store Plain Old Data, similar to std::deque // It doesn't reallocate memory but instead, uses blocks of data of size // of (1 << S), that is, power of two. The data is NOT contiguous in memory, // so the only valid access method is operator [] or curr(), prev(), next() // // There reallocs occure only when the pool of pointers to blocks needs // to be extended (it happens very rarely). You can control the value // of increment to reallocate the pointer buffer. See the second constructor. // By default, the incremeent value equals (1 << S), i.e., the block size. //------------------------------------------------------------------------ template class pod_bvector { public: enum block_scale_e { block_shift = S, block_size = 1 << block_shift, block_mask = block_size - 1 }; typedef T value_type; ~pod_bvector(); pod_bvector(); pod_bvector(unsigned block_ptr_inc); // Copying pod_bvector(const pod_bvector& v); const pod_bvector& operator = (const pod_bvector& v); void remove_all() { m_size = 0; } void clear() { m_size = 0; } void free_all() { free_tail(0); } void free_tail(unsigned size); void add(const T& val); void push_back(const T& val) { add(val); } void modify_last(const T& val); void remove_last(); int allocate_continuous_block(unsigned num_elements); void add_array(const T* ptr, unsigned num_elem) { while(num_elem--) { add(*ptr++); } } template void add_data(DataAccessor& data) { while(data.size()) { add(*data); ++data; } } void cut_at(unsigned size) { if(size < m_size) m_size = size; } unsigned size() const { return m_size; } const T& operator [] (unsigned i) const { return m_blocks[i >> block_shift][i & block_mask]; } T& operator [] (unsigned i) { return m_blocks[i >> block_shift][i & block_mask]; } const T& at(unsigned i) const { return m_blocks[i >> block_shift][i & block_mask]; } T& at(unsigned i) { return m_blocks[i >> block_shift][i & block_mask]; } T value_at(unsigned i) const { return m_blocks[i >> block_shift][i & block_mask]; } const T& curr(unsigned idx) const { return (*this)[idx]; } T& curr(unsigned idx) { return (*this)[idx]; } const T& prev(unsigned idx) const { return (*this)[(idx + m_size - 1) % m_size]; } T& prev(unsigned idx) { return (*this)[(idx + m_size - 1) % m_size]; } const T& next(unsigned idx) const { return (*this)[(idx + 1) % m_size]; } T& next(unsigned idx) { return (*this)[(idx + 1) % m_size]; } const T& last() const { return (*this)[m_size - 1]; } T& last() { return (*this)[m_size - 1]; } unsigned byte_size() const; void serialize(int8u* ptr) const; void deserialize(const int8u* data, unsigned byte_size); void deserialize(unsigned start, const T& empty_val, const int8u* data, unsigned byte_size); template void deserialize(ByteAccessor data) { remove_all(); unsigned elem_size = data.size() / sizeof(T); for(unsigned i = 0; i < elem_size; ++i) { int8u* ptr = (int8u*)data_ptr(); for(unsigned j = 0; j < sizeof(T); ++j) { *ptr++ = *data; ++data; } ++m_size; } } template void deserialize(unsigned start, const T& empty_val, ByteAccessor data) { while(m_size < start) { add(empty_val); } unsigned elem_size = data.size() / sizeof(T); for(unsigned i = 0; i < elem_size; ++i) { int8u* ptr; if(start + i < m_size) { ptr = (int8u*)(&((*this)[start + i])); } else { ptr = (int8u*)data_ptr(); ++m_size; } for(unsigned j = 0; j < sizeof(T); ++j) { *ptr++ = *data; ++data; } } } const T* block(unsigned nb) const { return m_blocks[nb]; } private: void allocate_block(unsigned nb); T* data_ptr(); unsigned m_size; unsigned m_num_blocks; unsigned m_max_blocks; T** m_blocks; unsigned m_block_ptr_inc; }; //------------------------------------------------------------------------ template pod_bvector::~pod_bvector() { if(m_num_blocks) { T** blk = m_blocks + m_num_blocks - 1; while(m_num_blocks--) { pod_allocator::deallocate(*blk, block_size); --blk; } } pod_allocator::deallocate(m_blocks, m_max_blocks); } //------------------------------------------------------------------------ template void pod_bvector::free_tail(unsigned size) { if(size < m_size) { unsigned nb = (size + block_mask) >> block_shift; while(m_num_blocks > nb) { pod_allocator::deallocate(m_blocks[--m_num_blocks], block_size); } if(m_num_blocks == 0) { pod_allocator::deallocate(m_blocks, m_max_blocks); m_blocks = 0; m_max_blocks = 0; } m_size = size; } } //------------------------------------------------------------------------ template pod_bvector::pod_bvector() : m_size(0), m_num_blocks(0), m_max_blocks(0), m_blocks(0), m_block_ptr_inc(block_size) { } //------------------------------------------------------------------------ template pod_bvector::pod_bvector(unsigned block_ptr_inc) : m_size(0), m_num_blocks(0), m_max_blocks(0), m_blocks(0), m_block_ptr_inc(block_ptr_inc) { } //------------------------------------------------------------------------ template pod_bvector::pod_bvector(const pod_bvector& v) : m_size(v.m_size), m_num_blocks(v.m_num_blocks), m_max_blocks(v.m_max_blocks), m_blocks(v.m_max_blocks ? pod_allocator::allocate(v.m_max_blocks) : 0), m_block_ptr_inc(v.m_block_ptr_inc) { unsigned i; for(i = 0; i < v.m_num_blocks; ++i) { m_blocks[i] = pod_allocator::allocate(block_size); memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T)); } } //------------------------------------------------------------------------ template const pod_bvector& pod_bvector::operator = (const pod_bvector& v) { unsigned i; for(i = m_num_blocks; i < v.m_num_blocks; ++i) { allocate_block(i); } for(i = 0; i < v.m_num_blocks; ++i) { memcpy(m_blocks[i], v.m_blocks[i], block_size * sizeof(T)); } m_size = v.m_size; return *this; } //------------------------------------------------------------------------ template void pod_bvector::allocate_block(unsigned nb) { if(nb >= m_max_blocks) { T** new_blocks = pod_allocator::allocate(m_max_blocks + m_block_ptr_inc); if(m_blocks) { memcpy(new_blocks, m_blocks, m_num_blocks * sizeof(T*)); pod_allocator::deallocate(m_blocks, m_max_blocks); } m_blocks = new_blocks; m_max_blocks += m_block_ptr_inc; } m_blocks[nb] = pod_allocator::allocate(block_size); m_num_blocks++; } //------------------------------------------------------------------------ template inline T* pod_bvector::data_ptr() { unsigned nb = m_size >> block_shift; if(nb >= m_num_blocks) { allocate_block(nb); } return m_blocks[nb] + (m_size & block_mask); } //------------------------------------------------------------------------ template inline void pod_bvector::add(const T& val) { *data_ptr() = val; ++m_size; } //------------------------------------------------------------------------ template inline void pod_bvector::remove_last() { if(m_size) --m_size; } //------------------------------------------------------------------------ template void pod_bvector::modify_last(const T& val) { remove_last(); add(val); } //------------------------------------------------------------------------ template int pod_bvector::allocate_continuous_block(unsigned num_elements) { if(num_elements < block_size) { data_ptr(); // Allocate initial block if necessary unsigned rest = block_size - (m_size & block_mask); unsigned index; if(num_elements <= rest) { // The rest of the block is good, we can use it //----------------- index = m_size; m_size += num_elements; return index; } // New block //--------------- m_size += rest; data_ptr(); index = m_size; m_size += num_elements; return index; } return -1; // Impossible to allocate } //------------------------------------------------------------------------ template unsigned pod_bvector::byte_size() const { return m_size * sizeof(T); } //------------------------------------------------------------------------ template void pod_bvector::serialize(int8u* ptr) const { unsigned i; for(i = 0; i < m_size; i++) { memcpy(ptr, &(*this)[i], sizeof(T)); ptr += sizeof(T); } } //------------------------------------------------------------------------ template void pod_bvector::deserialize(const int8u* data, unsigned byte_size) { remove_all(); byte_size /= sizeof(T); for(unsigned i = 0; i < byte_size; ++i) { T* ptr = data_ptr(); memcpy(ptr, data, sizeof(T)); ++m_size; data += sizeof(T); } } // Replace or add a number of elements starting from "start" position //------------------------------------------------------------------------ template void pod_bvector::deserialize(unsigned start, const T& empty_val, const int8u* data, unsigned byte_size) { while(m_size < start) { add(empty_val); } byte_size /= sizeof(T); for(unsigned i = 0; i < byte_size; ++i) { if(start + i < m_size) { memcpy(&((*this)[start + i]), data, sizeof(T)); } else { T* ptr = data_ptr(); memcpy(ptr, data, sizeof(T)); ++m_size; } data += sizeof(T); } } //---------------------------------------------------------block_allocator // Allocator for arbitrary POD data. Most usable in different cache // systems for efficient memory allocations. // Memory is allocated with blocks of fixed size ("block_size" in // the constructor). If required size exceeds the block size the allocator // creates a new block of the required size. However, the most efficient // use is when the average reqired size is much less than the block size. //------------------------------------------------------------------------ class block_allocator { struct block_type { int8u* data; unsigned size; }; public: void remove_all() { if(m_num_blocks) { block_type* blk = m_blocks + m_num_blocks - 1; while(m_num_blocks--) { pod_allocator::deallocate(blk->data, blk->size); --blk; } pod_allocator::deallocate(m_blocks, m_max_blocks); } m_num_blocks = 0; m_max_blocks = 0; m_blocks = 0; m_buf_ptr = 0; m_rest = 0; } ~block_allocator() { remove_all(); } block_allocator(unsigned block_size, unsigned block_ptr_inc=256-8) : m_block_size(block_size), m_block_ptr_inc(block_ptr_inc), m_num_blocks(0), m_max_blocks(0), m_blocks(0), m_buf_ptr(0), m_rest(0) { } int8u* allocate(unsigned size, unsigned alignment=1) { if(size == 0) return 0; if(size <= m_rest) { int8u* ptr = m_buf_ptr; if(alignment > 1) { unsigned align = (alignment - unsigned((size_t)ptr) % alignment) % alignment; size += align; ptr += align; if(size <= m_rest) { m_rest -= size; m_buf_ptr += size; return ptr; } allocate_block(size); return allocate(size - align, alignment); } m_rest -= size; m_buf_ptr += size; return ptr; } allocate_block(size + alignment - 1); return allocate(size, alignment); } private: void allocate_block(unsigned size) { if(size < m_block_size) size = m_block_size; if(m_num_blocks >= m_max_blocks) { block_type* new_blocks = pod_allocator::allocate(m_max_blocks + m_block_ptr_inc); if(m_blocks) { memcpy(new_blocks, m_blocks, m_num_blocks * sizeof(block_type)); pod_allocator::deallocate(m_blocks, m_max_blocks); } m_blocks = new_blocks; m_max_blocks += m_block_ptr_inc; } m_blocks[m_num_blocks].size = size; m_blocks[m_num_blocks].data = m_buf_ptr = pod_allocator::allocate(size); m_num_blocks++; m_rest = size; } unsigned m_block_size; unsigned m_block_ptr_inc; unsigned m_num_blocks; unsigned m_max_blocks; block_type* m_blocks; int8u* m_buf_ptr; unsigned m_rest; }; //------------------------------------------------------------------------ enum quick_sort_threshold_e { quick_sort_threshold = 9 }; //-----------------------------------------------------------swap_elements template inline void swap_elements(T& a, T& b) { T temp = a; a = b; b = temp; } //--------------------------------------------------------------quick_sort template void quick_sort(Array& arr, Less less) { if(arr.size() < 2) return; typename Array::value_type* e1; typename Array::value_type* e2; int stack[80]; int* top = stack; int limit = arr.size(); int base = 0; for(;;) { int len = limit - base; int i; int j; int pivot; if(len > quick_sort_threshold) { // we use base + len/2 as the pivot pivot = base + len / 2; swap_elements(arr[base], arr[pivot]); i = base + 1; j = limit - 1; // now ensure that *i <= *base <= *j e1 = &(arr[j]); e2 = &(arr[i]); if(less(*e1, *e2)) swap_elements(*e1, *e2); e1 = &(arr[base]); e2 = &(arr[i]); if(less(*e1, *e2)) swap_elements(*e1, *e2); e1 = &(arr[j]); e2 = &(arr[base]); if(less(*e1, *e2)) swap_elements(*e1, *e2); for(;;) { do i++; while( less(arr[i], arr[base]) ); do j--; while( less(arr[base], arr[j]) ); if( i > j ) { break; } swap_elements(arr[i], arr[j]); } swap_elements(arr[base], arr[j]); // now, push the largest sub-array if(j - base > limit - i) { top[0] = base; top[1] = j; base = i; } else { top[0] = i; top[1] = limit; limit = j; } top += 2; } else { // the sub-array is small, perform insertion sort j = base; i = j + 1; for(; i < limit; j = i, i++) { for(; less(*(e1 = &(arr[j + 1])), *(e2 = &(arr[j]))); j--) { swap_elements(*e1, *e2); if(j == base) { break; } } } if(top > stack) { top -= 2; base = top[0]; limit = top[1]; } else { break; } } } } //------------------------------------------------------remove_duplicates // Remove duplicates from a sorted array. It doesn't cut the // tail of the array, it just returns the number of remaining elements. //----------------------------------------------------------------------- template unsigned remove_duplicates(Array& arr, Equal equal) { if(arr.size() < 2) return arr.size(); unsigned i, j; for(i = 1, j = 1; i < arr.size(); i++) { typename Array::value_type& e = arr[i]; if(!equal(e, arr[i - 1])) { arr[j++] = e; } } return j; } //--------------------------------------------------------invert_container template void invert_container(Array& arr) { int i = 0; int j = arr.size() - 1; while(i < j) { swap_elements(arr[i++], arr[j--]); } } //------------------------------------------------------binary_search_pos template unsigned binary_search_pos(const Array& arr, const Value& val, Less less) { if(arr.size() == 0) return 0; unsigned beg = 0; unsigned end = arr.size() - 1; if(less(val, arr[0])) return 0; if(less(arr[end], val)) return end + 1; while(end - beg > 1) { unsigned mid = (end + beg) >> 1; if(less(val, arr[mid])) end = mid; else beg = mid; } //if(beg <= 0 && less(val, arr[0])) return 0; //if(end >= arr.size() - 1 && less(arr[end], val)) ++end; return end; } //----------------------------------------------------------range_adaptor template class range_adaptor { public: typedef typename Array::value_type value_type; range_adaptor(Array& array, unsigned start, unsigned size) : m_array(array), m_start(start), m_size(size) {} unsigned size() const { return m_size; } const value_type& operator [] (unsigned i) const { return m_array[m_start + i]; } value_type& operator [] (unsigned i) { return m_array[m_start + i]; } const value_type& at(unsigned i) const { return m_array[m_start + i]; } value_type& at(unsigned i) { return m_array[m_start + i]; } value_type value_at(unsigned i) const { return m_array[m_start + i]; } private: Array& m_array; unsigned m_start; unsigned m_size; }; //---------------------------------------------------------------int_less inline bool int_less(int a, int b) { return a < b; } //------------------------------------------------------------int_greater inline bool int_greater(int a, int b) { return a > b; } //----------------------------------------------------------unsigned_less inline bool unsigned_less(unsigned a, unsigned b) { return a < b; } //-------------------------------------------------------unsigned_greater inline bool unsigned_greater(unsigned a, unsigned b) { return a > b; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_pixfmt_amask_adaptor.h0000644000175000017500000002105513233644505026165 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_PIXFMT_AMASK_ADAPTOR_INCLUDED #define AGG_PIXFMT_AMASK_ADAPTOR_INCLUDED #include #include "agg_array.h" #include "agg_rendering_buffer.h" namespace agg24 { //==================================================pixfmt_amask_adaptor template class pixfmt_amask_adaptor { public: typedef PixFmt pixfmt_type; typedef typename pixfmt_type::color_type color_type; typedef typename pixfmt_type::row_data row_data; typedef AlphaMask amask_type; typedef typename amask_type::cover_type cover_type; private: enum span_extra_tail_e { span_extra_tail = 256 }; void realloc_span(unsigned len) { if(len > m_span.size()) { m_span.resize(len + span_extra_tail); } } void init_span(unsigned len) { realloc_span(len); memset(&m_span[0], amask_type::cover_full, len * sizeof(cover_type)); } void init_span(unsigned len, const cover_type* covers) { realloc_span(len); memcpy(&m_span[0], covers, len * sizeof(cover_type)); } public: pixfmt_amask_adaptor(pixfmt_type& pixf, amask_type& mask) : m_pixf(&pixf), m_mask(&mask), m_span() {} void attach_pixfmt(pixfmt_type& pixf) { m_pixf = &pixf; } void attach_alpha_mask(amask_type& mask) { m_mask = &mask; } //-------------------------------------------------------------------- template bool attach_pixfmt(PixFmt2& pixf, int x1, int y1, int x2, int y2) { return m_pixf->attach(pixf, x1, y1, x2, y2); } //-------------------------------------------------------------------- unsigned width() const { return m_pixf->width(); } unsigned height() const { return m_pixf->height(); } //-------------------------------------------------------------------- color_type pixel(int x, int y) { return m_pixf->pixel(x, y); } //-------------------------------------------------------------------- void copy_pixel(int x, int y, const color_type& c) { m_pixf->blend_pixel(x, y, c, m_mask->pixel(x, y)); } //-------------------------------------------------------------------- void blend_pixel(int x, int y, const color_type& c, cover_type cover) { m_pixf->blend_pixel(x, y, c, m_mask->combine_pixel(x, y, cover)); } //-------------------------------------------------------------------- void copy_hline(int x, int y, unsigned len, const color_type& c) { realloc_span(len); m_mask->fill_hspan(x, y, &m_span[0], len); m_pixf->blend_solid_hspan(x, y, len, c, &m_span[0]); } //-------------------------------------------------------------------- void blend_hline(int x, int y, unsigned len, const color_type& c, cover_type cover) { init_span(len); m_mask->combine_hspan(x, y, &m_span[0], len); m_pixf->blend_solid_hspan(x, y, len, c, &m_span[0]); } //-------------------------------------------------------------------- void copy_vline(int x, int y, unsigned len, const color_type& c) { realloc_span(len); m_mask->fill_vspan(x, y, &m_span[0], len); m_pixf->blend_solid_vspan(x, y, len, c, &m_span[0]); } //-------------------------------------------------------------------- void blend_vline(int x, int y, unsigned len, const color_type& c, cover_type cover) { init_span(len); m_mask->combine_vspan(x, y, &m_span[0], len); m_pixf->blend_solid_vspan(x, y, len, c, &m_span[0]); } //-------------------------------------------------------------------- void copy_from(const rendering_buffer& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) { m_pixf->copy_from(from, xdst, ydst, xsrc, ysrc, len); } //-------------------------------------------------------------------- void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const cover_type* covers) { init_span(len, covers); m_mask->combine_hspan(x, y, &m_span[0], len); m_pixf->blend_solid_hspan(x, y, len, c, &m_span[0]); } //-------------------------------------------------------------------- void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const cover_type* covers) { init_span(len, covers); m_mask->combine_vspan(x, y, &m_span[0], len); m_pixf->blend_solid_vspan(x, y, len, c, &m_span[0]); } //-------------------------------------------------------------------- void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) { realloc_span(len); m_mask->fill_hspan(x, y, &m_span[0], len); m_pixf->blend_color_hspan(x, y, len, colors, &m_span[0], cover_full); } //-------------------------------------------------------------------- void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) { realloc_span(len); m_mask->fill_vspan(x, y, &m_span[0], len); m_pixf->blend_color_vspan(x, y, len, colors, &m_span[0], cover_full); } //-------------------------------------------------------------------- void blend_color_hspan(int x, int y, unsigned len, const color_type* colors, const cover_type* covers, cover_type cover = cover_full) { if(covers) { init_span(len, covers); m_mask->combine_hspan(x, y, &m_span[0], len); } else { realloc_span(len); m_mask->fill_hspan(x, y, &m_span[0], len); } m_pixf->blend_color_hspan(x, y, len, colors, &m_span[0], cover); } //-------------------------------------------------------------------- void blend_color_vspan(int x, int y, unsigned len, const color_type* colors, const cover_type* covers, cover_type cover = cover_full) { if(covers) { init_span(len, covers); m_mask->combine_vspan(x, y, &m_span[0], len); } else { realloc_span(len); m_mask->fill_vspan(x, y, &m_span[0], len); } m_pixf->blend_color_vspan(x, y, len, colors, &m_span[0], cover); } private: pixfmt_type* m_pixf; const amask_type* m_mask; pod_array m_span; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_transform.h0000644000175000017500000000410213233644505025022 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class conv_transform // //---------------------------------------------------------------------------- #ifndef AGG_CONV_TRANSFORM_INCLUDED #define AGG_CONV_TRANSFORM_INCLUDED #include "agg_basics.h" #include "agg_trans_affine.h" namespace agg24 { //----------------------------------------------------------conv_transform template class conv_transform { public: conv_transform(VertexSource& source, Transformer& tr) : m_source(&source), m_trans(&tr) {} void attach(VertexSource& source) { m_source = &source; } void rewind(unsigned path_id) { m_source->rewind(path_id); } unsigned vertex(double* x, double* y) { unsigned cmd = m_source->vertex(x, y); if(is_vertex(cmd)) { m_trans->transform(x, y); } return cmd; } void transformer(Transformer& tr) { m_trans = &tr; } private: conv_transform(const conv_transform&); const conv_transform& operator = (const conv_transform&); VertexSource* m_source; Transformer* m_trans; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_renderer_scanline.h0000644000175000017500000010426613233644505025460 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_RENDERER_SCANLINE_INCLUDED #define AGG_RENDERER_SCANLINE_INCLUDED #include "agg_basics.h" #include "agg_renderer_base.h" namespace agg24 { //================================================render_scanline_aa_solid template void render_scanline_aa_solid(const Scanline& sl, BaseRenderer& ren, const ColorT& color) { int y = sl.y(); unsigned num_spans = sl.num_spans(); typename Scanline::const_iterator span = sl.begin(); for(;;) { int x = span->x; if(span->len > 0) { ren.blend_solid_hspan(x, y, (unsigned)span->len, color, span->covers); } else { ren.blend_hline(x, y, (unsigned)(x - span->len - 1), color, *(span->covers)); } if(--num_spans == 0) break; ++span; } } //===============================================render_scanlines_aa_solid template void render_scanlines_aa_solid(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, const ColorT& color) { if(ras.rewind_scanlines()) { // Explicitly convert "color" to the BaseRenderer color type. // For example, it can be called with color type "rgba", while // "rgba8" is needed. Otherwise it will be implicitly // converted in the loop many times. //---------------------- typename BaseRenderer::color_type ren_color(color); sl.reset(ras.min_x(), ras.max_x()); while(ras.sweep_scanline(sl)) { //render_scanline_aa_solid(sl, ren, ren_color); // This code is equivalent to the above call (copy/paste). // It's just a "manual" optimization for old compilers, // like Microsoft Visual C++ v6.0 //------------------------------- int y = sl.y(); unsigned num_spans = sl.num_spans(); typename Scanline::const_iterator span = sl.begin(); for(;;) { int x = span->x; if(span->len > 0) { ren.blend_solid_hspan(x, y, (unsigned)span->len, ren_color, span->covers); } else { ren.blend_hline(x, y, (unsigned)(x - span->len - 1), ren_color, *(span->covers)); } if(--num_spans == 0) break; ++span; } } } } //==============================================renderer_scanline_aa_solid template class renderer_scanline_aa_solid { public: typedef BaseRenderer base_ren_type; typedef typename base_ren_type::color_type color_type; //-------------------------------------------------------------------- renderer_scanline_aa_solid() : m_ren(0) {} explicit renderer_scanline_aa_solid(base_ren_type& ren) : m_ren(&ren) {} void attach(base_ren_type& ren) { m_ren = &ren; } //-------------------------------------------------------------------- void color(const color_type& c) { m_color = c; } const color_type& color() const { return m_color; } //-------------------------------------------------------------------- void prepare() {} //-------------------------------------------------------------------- template void render(const Scanline& sl) { render_scanline_aa_solid(sl, *m_ren, m_color); } private: base_ren_type* m_ren; color_type m_color; }; //======================================================render_scanline_aa template void render_scanline_aa(const Scanline& sl, BaseRenderer& ren, SpanAllocator& alloc, SpanGenerator& span_gen) { int y = sl.y(); unsigned num_spans = sl.num_spans(); typename Scanline::const_iterator span = sl.begin(); for(;;) { int x = span->x; int len = span->len; const typename Scanline::cover_type* covers = span->covers; if(len < 0) len = -len; typename BaseRenderer::color_type* colors = alloc.allocate(len); span_gen.generate(colors, x, y, len); ren.blend_color_hspan(x, y, len, colors, (span->len < 0) ? 0 : covers, *covers); if(--num_spans == 0) break; ++span; } } //=====================================================render_scanlines_aa template void render_scanlines_aa(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, SpanAllocator& alloc, SpanGenerator& span_gen) { if(ras.rewind_scanlines()) { sl.reset(ras.min_x(), ras.max_x()); span_gen.prepare(); while(ras.sweep_scanline(sl)) { render_scanline_aa(sl, ren, alloc, span_gen); } } } //====================================================renderer_scanline_aa template class renderer_scanline_aa { public: typedef BaseRenderer base_ren_type; typedef SpanAllocator alloc_type; typedef SpanGenerator span_gen_type; //-------------------------------------------------------------------- renderer_scanline_aa() : m_ren(0), m_alloc(0), m_span_gen(0) {} renderer_scanline_aa(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen) : m_ren(&ren), m_alloc(&alloc), m_span_gen(&span_gen) {} void attach(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen) { m_ren = &ren; m_alloc = &alloc; m_span_gen = &span_gen; } //-------------------------------------------------------------------- void prepare() { m_span_gen->prepare(); } //-------------------------------------------------------------------- template void render(const Scanline& sl) { render_scanline_aa(sl, *m_ren, *m_alloc, *m_span_gen); } private: base_ren_type* m_ren; alloc_type* m_alloc; span_gen_type* m_span_gen; }; //===============================================render_scanline_bin_solid template void render_scanline_bin_solid(const Scanline& sl, BaseRenderer& ren, const ColorT& color) { unsigned num_spans = sl.num_spans(); typename Scanline::const_iterator span = sl.begin(); for(;;) { ren.blend_hline(span->x, sl.y(), span->x - 1 + ((span->len < 0) ? -span->len : span->len), color, cover_full); if(--num_spans == 0) break; ++span; } } //==============================================render_scanlines_bin_solid template void render_scanlines_bin_solid(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, const ColorT& color) { if(ras.rewind_scanlines()) { // Explicitly convert "color" to the BaseRenderer color type. // For example, it can be called with color type "rgba", while // "rgba8" is needed. Otherwise it will be implicitly // converted in the loop many times. //---------------------- typename BaseRenderer::color_type ren_color(color); sl.reset(ras.min_x(), ras.max_x()); while(ras.sweep_scanline(sl)) { //render_scanline_bin_solid(sl, ren, ren_color); // This code is equivalent to the above call (copy/paste). // It's just a "manual" optimization for old compilers, // like Microsoft Visual C++ v6.0 //------------------------------- unsigned num_spans = sl.num_spans(); typename Scanline::const_iterator span = sl.begin(); for(;;) { ren.blend_hline(span->x, sl.y(), span->x - 1 + ((span->len < 0) ? -span->len : span->len), ren_color, cover_full); if(--num_spans == 0) break; ++span; } } } } //=============================================renderer_scanline_bin_solid template class renderer_scanline_bin_solid { public: typedef BaseRenderer base_ren_type; typedef typename base_ren_type::color_type color_type; //-------------------------------------------------------------------- renderer_scanline_bin_solid() : m_ren(0) {} explicit renderer_scanline_bin_solid(base_ren_type& ren) : m_ren(&ren) {} void attach(base_ren_type& ren) { m_ren = &ren; } //-------------------------------------------------------------------- void color(const color_type& c) { m_color = c; } const color_type& color() const { return m_color; } //-------------------------------------------------------------------- void prepare() {} //-------------------------------------------------------------------- template void render(const Scanline& sl) { render_scanline_bin_solid(sl, *m_ren, m_color); } private: base_ren_type* m_ren; color_type m_color; }; //======================================================render_scanline_bin template void render_scanline_bin(const Scanline& sl, BaseRenderer& ren, SpanAllocator& alloc, SpanGenerator& span_gen) { int y = sl.y(); unsigned num_spans = sl.num_spans(); typename Scanline::const_iterator span = sl.begin(); for(;;) { int x = span->x; int len = span->len; if(len < 0) len = -len; typename BaseRenderer::color_type* colors = alloc.allocate(len); span_gen.generate(colors, x, y, len); ren.blend_color_hspan(x, y, len, colors, 0, cover_full); if(--num_spans == 0) break; ++span; } } //=====================================================render_scanlines_bin template void render_scanlines_bin(Rasterizer& ras, Scanline& sl, BaseRenderer& ren, SpanAllocator& alloc, SpanGenerator& span_gen) { if(ras.rewind_scanlines()) { sl.reset(ras.min_x(), ras.max_x()); span_gen.prepare(); while(ras.sweep_scanline(sl)) { render_scanline_bin(sl, ren, alloc, span_gen); } } } //====================================================renderer_scanline_bin template class renderer_scanline_bin { public: typedef BaseRenderer base_ren_type; typedef SpanAllocator alloc_type; typedef SpanGenerator span_gen_type; //-------------------------------------------------------------------- renderer_scanline_bin() : m_ren(0), m_alloc(0), m_span_gen(0) {} renderer_scanline_bin(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen) : m_ren(&ren), m_alloc(&alloc), m_span_gen(&span_gen) {} void attach(base_ren_type& ren, alloc_type& alloc, span_gen_type& span_gen) { m_ren = &ren; m_alloc = &alloc; m_span_gen = &span_gen; } //-------------------------------------------------------------------- void prepare() { m_span_gen->prepare(); } //-------------------------------------------------------------------- template void render(const Scanline& sl) { render_scanline_bin(sl, *m_ren, *m_alloc, *m_span_gen); } private: base_ren_type* m_ren; alloc_type* m_alloc; span_gen_type* m_span_gen; }; //========================================================render_scanlines template void render_scanlines(Rasterizer& ras, Scanline& sl, Renderer& ren) { if(ras.rewind_scanlines()) { sl.reset(ras.min_x(), ras.max_x()); ren.prepare(); while(ras.sweep_scanline(sl)) { ren.render(sl); } } } //========================================================render_all_paths template void render_all_paths(Rasterizer& ras, Scanline& sl, Renderer& r, VertexSource& vs, const ColorStorage& as, const PathId& path_id, unsigned num_paths) { for(unsigned i = 0; i < num_paths; i++) { ras.reset(); ras.add_path(vs, path_id[i]); r.color(as[i]); render_scanlines(ras, sl, r); } } //=============================================render_scanlines_compound template void render_scanlines_compound(Rasterizer& ras, ScanlineAA& sl_aa, ScanlineBin& sl_bin, BaseRenderer& ren, SpanAllocator& alloc, StyleHandler& sh) { if(ras.rewind_scanlines()) { int min_x = ras.min_x(); int len = ras.max_x() - min_x + 2; sl_aa.reset(min_x, ras.max_x()); sl_bin.reset(min_x, ras.max_x()); typedef typename BaseRenderer::color_type color_type; color_type* color_span = alloc.allocate(len * 2); color_type* mix_buffer = color_span + len; unsigned num_spans; unsigned num_styles; unsigned style; bool solid; while((num_styles = ras.sweep_styles()) > 0) { typename ScanlineAA::const_iterator span_aa; if(num_styles == 1) { // Optimization for a single style. Happens often //------------------------- if(ras.sweep_scanline(sl_aa, 0)) { style = ras.style(0); if(sh.is_solid(style)) { // Just solid fill //----------------------- render_scanline_aa_solid(sl_aa, ren, sh.color(style)); } else { // Arbitrary span generator //----------------------- span_aa = sl_aa.begin(); num_spans = sl_aa.num_spans(); for(;;) { len = span_aa->len; sh.generate_span(color_span, span_aa->x, sl_aa.y(), len, style); ren.blend_color_hspan(span_aa->x, sl_aa.y(), span_aa->len, color_span, span_aa->covers); if(--num_spans == 0) break; ++span_aa; } } } } else { if(ras.sweep_scanline(sl_bin, -1)) { // Clear the spans of the mix_buffer //-------------------- typename ScanlineBin::const_iterator span_bin = sl_bin.begin(); num_spans = sl_bin.num_spans(); for(;;) { memset(mix_buffer + span_bin->x - min_x, 0, span_bin->len * sizeof(color_type)); if(--num_spans == 0) break; ++span_bin; } unsigned i; for(i = 0; i < num_styles; i++) { style = ras.style(i); solid = sh.is_solid(style); if(ras.sweep_scanline(sl_aa, i)) { color_type* colors; color_type* cspan; typename ScanlineAA::cover_type* covers; span_aa = sl_aa.begin(); num_spans = sl_aa.num_spans(); if(solid) { // Just solid fill //----------------------- for(;;) { color_type c = sh.color(style); len = span_aa->len; colors = mix_buffer + span_aa->x - min_x; covers = span_aa->covers; do { if(*covers == cover_full) { *colors = c; } else { colors->add(c, *covers); } ++colors; ++covers; } while(--len); if(--num_spans == 0) break; ++span_aa; } } else { // Arbitrary span generator //----------------------- for(;;) { len = span_aa->len; colors = mix_buffer + span_aa->x - min_x; cspan = color_span; sh.generate_span(cspan, span_aa->x, sl_aa.y(), len, style); covers = span_aa->covers; do { if(*covers == cover_full) { *colors = *cspan; } else { colors->add(*cspan, *covers); } ++cspan; ++colors; ++covers; } while(--len); if(--num_spans == 0) break; ++span_aa; } } } } // Emit the blended result as a color hspan //------------------------- span_bin = sl_bin.begin(); num_spans = sl_bin.num_spans(); for(;;) { ren.blend_color_hspan(span_bin->x, sl_bin.y(), span_bin->len, mix_buffer + span_bin->x - min_x, 0, cover_full); if(--num_spans == 0) break; ++span_bin; } } // if(ras.sweep_scanline(sl_bin, -1)) } // if(num_styles == 1) ... else } // while((num_styles = ras.sweep_styles()) > 0) } // if(ras.rewind_scanlines()) } //=======================================render_scanlines_compound_layered template void render_scanlines_compound_layered(Rasterizer& ras, ScanlineAA& sl_aa, BaseRenderer& ren, SpanAllocator& alloc, StyleHandler& sh) { if(ras.rewind_scanlines()) { int min_x = ras.min_x(); int len = ras.max_x() - min_x + 2; sl_aa.reset(min_x, ras.max_x()); typedef typename BaseRenderer::color_type color_type; color_type* color_span = alloc.allocate(len * 2); color_type* mix_buffer = color_span + len; cover_type* cover_buffer = ras.allocate_cover_buffer(len); unsigned num_spans; unsigned num_styles; unsigned style; bool solid; while((num_styles = ras.sweep_styles()) > 0) { typename ScanlineAA::const_iterator span_aa; if(num_styles == 1) { // Optimization for a single style. Happens often //------------------------- if(ras.sweep_scanline(sl_aa, 0)) { style = ras.style(0); if(sh.is_solid(style)) { // Just solid fill //----------------------- render_scanline_aa_solid(sl_aa, ren, sh.color(style)); } else { // Arbitrary span generator //----------------------- span_aa = sl_aa.begin(); num_spans = sl_aa.num_spans(); for(;;) { len = span_aa->len; sh.generate_span(color_span, span_aa->x, sl_aa.y(), len, style); ren.blend_color_hspan(span_aa->x, sl_aa.y(), span_aa->len, color_span, span_aa->covers); if(--num_spans == 0) break; ++span_aa; } } } } else { int sl_start = ras.scanline_start(); unsigned sl_len = ras.scanline_length(); if(sl_len) { memset(mix_buffer + sl_start - min_x, 0, sl_len * sizeof(color_type)); memset(cover_buffer + sl_start - min_x, 0, sl_len * sizeof(cover_type)); int sl_y = 0x7FFFFFFF; unsigned i; for(i = 0; i < num_styles; i++) { style = ras.style(i); solid = sh.is_solid(style); if(ras.sweep_scanline(sl_aa, i)) { unsigned cover; color_type* colors; color_type* cspan; cover_type* src_covers; cover_type* dst_covers; span_aa = sl_aa.begin(); num_spans = sl_aa.num_spans(); sl_y = sl_aa.y(); if(solid) { // Just solid fill //----------------------- for(;;) { color_type c = sh.color(style); len = span_aa->len; colors = mix_buffer + span_aa->x - min_x; src_covers = span_aa->covers; dst_covers = cover_buffer + span_aa->x - min_x; do { cover = *src_covers; if(*dst_covers + cover > cover_full) { cover = cover_full - *dst_covers; } if(cover) { colors->add(c, cover); *dst_covers += cover; } ++colors; ++src_covers; ++dst_covers; } while(--len); if(--num_spans == 0) break; ++span_aa; } } else { // Arbitrary span generator //----------------------- for(;;) { len = span_aa->len; colors = mix_buffer + span_aa->x - min_x; cspan = color_span; sh.generate_span(cspan, span_aa->x, sl_aa.y(), len, style); src_covers = span_aa->covers; dst_covers = cover_buffer + span_aa->x - min_x; do { cover = *src_covers; if(*dst_covers + cover > cover_full) { cover = cover_full - *dst_covers; } if(cover) { colors->add(*cspan, cover); *dst_covers += cover; } ++cspan; ++colors; ++src_covers; ++dst_covers; } while(--len); if(--num_spans == 0) break; ++span_aa; } } } } ren.blend_color_hspan(sl_start, sl_y, sl_len, mix_buffer + sl_start - min_x, 0, cover_full); } //if(sl_len) } //if(num_styles == 1) ... else } //while((num_styles = ras.sweep_styles()) > 0) } //if(ras.rewind_scanlines()) } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_gradient_alpha.h0000644000175000017500000001167613233644505025763 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SPAN_GRADIENT_ALPHA_INCLUDED #define AGG_SPAN_GRADIENT_ALPHA_INCLUDED #include "agg_span_gradient.h" namespace agg24 { //======================================================span_gradient_alpha template class span_gradient_alpha { public: typedef Interpolator interpolator_type; typedef ColorT color_type; typedef typename color_type::value_type alpha_type; enum downscale_shift_e { downscale_shift = interpolator_type::subpixel_shift - gradient_subpixel_shift }; //-------------------------------------------------------------------- span_gradient_alpha() {} //-------------------------------------------------------------------- span_gradient_alpha(interpolator_type& inter, GradientF& gradient_function, AlphaF& alpha_function, double d1, double d2) : m_interpolator(&inter), m_gradient_function(&gradient_function), m_alpha_function(&alpha_function), m_d1(iround(d1 * gradient_subpixel_scale)), m_d2(iround(d2 * gradient_subpixel_scale)) {} //-------------------------------------------------------------------- interpolator_type& interpolator() { return *m_interpolator; } const GradientF& gradient_function() const { return *m_gradient_function; } const AlphaF& alpha_function() const { return *m_alpha_function; } double d1() const { return double(m_d1) / gradient_subpixel_scale; } double d2() const { return double(m_d2) / gradient_subpixel_scale; } //-------------------------------------------------------------------- void interpolator(interpolator_type& i) { m_interpolator = &i; } void gradient_function(const GradientF& gf) { m_gradient_function = &gf; } void alpha_function(const AlphaF& af) { m_alpha_function = ⁡ } void d1(double v) { m_d1 = iround(v * gradient_subpixel_scale); } void d2(double v) { m_d2 = iround(v * gradient_subpixel_scale); } //-------------------------------------------------------------------- void prepare() {} //-------------------------------------------------------------------- void generate(color_type* span, int x, int y, unsigned len) { int dd = m_d2 - m_d1; if(dd < 1) dd = 1; m_interpolator->begin(x+0.5, y+0.5, len); do { m_interpolator->coordinates(&x, &y); int d = m_gradient_function->calculate(x >> downscale_shift, y >> downscale_shift, m_d2); d = ((d - m_d1) * (int)m_alpha_function->size()) / dd; if(d < 0) d = 0; if(d >= (int)m_alpha_function->size()) d = m_alpha_function->size() - 1; span->a = (*m_alpha_function)[d]; ++span; ++(*m_interpolator); } while(--len); } private: interpolator_type* m_interpolator; GradientF* m_gradient_function; AlphaF* m_alpha_function; int m_d1; int m_d2; }; //=======================================================gradient_alpha_x template struct gradient_alpha_x { typedef typename ColorT::value_type alpha_type; alpha_type operator [] (alpha_type x) const { return x; } }; //====================================================gradient_alpha_x_u8 struct gradient_alpha_x_u8 { typedef int8u alpha_type; alpha_type operator [] (alpha_type x) const { return x; } }; //==========================================gradient_alpha_one_munus_x_u8 struct gradient_alpha_one_munus_x_u8 { typedef int8u alpha_type; alpha_type operator [] (alpha_type x) const { return 255-x; } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_span_allocator.h0000644000175000017500000000350113233644505024765 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_SPAN_ALLOCATOR_INCLUDED #define AGG_SPAN_ALLOCATOR_INCLUDED #include "agg_array.h" namespace agg24 { //----------------------------------------------------------span_allocator template class span_allocator { public: typedef ColorT color_type; //-------------------------------------------------------------------- AGG_INLINE color_type* allocate(unsigned span_len) { if(span_len > m_span.size()) { // To reduce the number of reallocs we align the // span_len to 256 color elements. // Well, I just like this number and it looks reasonable. //----------------------- m_span.resize(((span_len + 255) >> 8) << 8); } return &m_span[0]; } AGG_INLINE color_type* span() { return &m_span[0]; } AGG_INLINE unsigned max_span_len() const { return m_span.size(); } private: pod_array m_span; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_smooth_poly1.h0000644000175000017500000000533513233644505025455 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Smooth polygon generator // //---------------------------------------------------------------------------- #ifndef AGG_CONV_SMOOTH_POLY1_INCLUDED #define AGG_CONV_SMOOTH_POLY1_INCLUDED #include "agg_basics.h" #include "agg_vcgen_smooth_poly1.h" #include "agg_conv_adaptor_vcgen.h" #include "agg_conv_curve.h" namespace agg24 { //-------------------------------------------------------conv_smooth_poly1 template struct conv_smooth_poly1 : public conv_adaptor_vcgen { typedef conv_adaptor_vcgen base_type; conv_smooth_poly1(VertexSource& vs) : conv_adaptor_vcgen(vs) { } void smooth_value(double v) { base_type::generator().smooth_value(v); } double smooth_value() const { return base_type::generator().smooth_value(); } private: conv_smooth_poly1(const conv_smooth_poly1&); const conv_smooth_poly1& operator = (const conv_smooth_poly1&); }; //-------------------------------------------------conv_smooth_poly1_curve template struct conv_smooth_poly1_curve : public conv_curve > { conv_smooth_poly1_curve(VertexSource& vs) : conv_curve >(m_smooth), m_smooth(vs) { } void smooth_value(double v) { m_smooth.generator().smooth_value(v); } double smooth_value() const { return m_smooth.generator().smooth_value(); } private: conv_smooth_poly1_curve(const conv_smooth_poly1_curve&); const conv_smooth_poly1_curve& operator = (const conv_smooth_poly1_curve&); conv_smooth_poly1 m_smooth; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_rasterizer_scanline_aa.h0000644000175000017500000004126413233644505026503 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // // The author gratefully acknowleges the support of David Turner, // Robert Wilhelm, and Werner Lemberg - the authors of the FreeType // libray - in producing this work. See http://www.freetype.org for details. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_SCANLINE_AA_INCLUDED #define AGG_RASTERIZER_SCANLINE_AA_INCLUDED #include "agg_rasterizer_cells_aa.h" #include "agg_rasterizer_sl_clip.h" #include "agg_rasterizer_scanline_aa_nogamma.h" #include "agg_gamma_functions.h" namespace agg24 { //==================================================rasterizer_scanline_aa // Polygon rasterizer that is used to render filled polygons with // high-quality Anti-Aliasing. Internally, by default, the class uses // integer coordinates in format 24.8, i.e. 24 bits for integer part // and 8 bits for fractional - see poly_subpixel_shift. This class can be // used in the following way: // // 1. filling_rule(filling_rule_e ft) - optional. // // 2. gamma() - optional. // // 3. reset() // // 4. move_to(x, y) / line_to(x, y) - make the polygon. One can create // more than one contour, but each contour must consist of at least 3 // vertices, i.e. move_to(x1, y1); line_to(x2, y2); line_to(x3, y3); // is the absolute minimum of vertices that define a triangle. // The algorithm does not check either the number of vertices nor // coincidence of their coordinates, but in the worst case it just // won't draw anything. // The orger of the vertices (clockwise or counterclockwise) // is important when using the non-zero filling rule (fill_non_zero). // In this case the vertex order of all the contours must be the same // if you want your intersecting polygons to be without "holes". // You actually can use different vertices order. If the contours do not // intersect each other the order is not important anyway. If they do, // contours with the same vertex order will be rendered without "holes" // while the intersecting contours with different orders will have "holes". // // filling_rule() and gamma() can be called anytime before "sweeping". //------------------------------------------------------------------------ template class rasterizer_scanline_aa { enum status { status_initial, status_move_to, status_line_to, status_closed }; public: typedef Clip clip_type; typedef typename Clip::conv_type conv_type; typedef typename Clip::coord_type coord_type; enum aa_scale_e { aa_shift = 8, aa_scale = 1 << aa_shift, aa_mask = aa_scale - 1, aa_scale2 = aa_scale * 2, aa_mask2 = aa_scale2 - 1 }; //-------------------------------------------------------------------- rasterizer_scanline_aa(unsigned cell_block_limit=1024) : m_outline(cell_block_limit), m_clipper(), m_filling_rule(fill_non_zero), m_auto_close(true), m_start_x(0), m_start_y(0), m_status(status_initial) { int i; for(i = 0; i < aa_scale; i++) m_gamma[i] = i; } //-------------------------------------------------------------------- template rasterizer_scanline_aa(const GammaF& gamma_function, unsigned cell_block_limit) : m_outline(cell_block_limit), m_clipper(m_outline), m_filling_rule(fill_non_zero), m_auto_close(true), m_start_x(0), m_start_y(0), m_status(status_initial) { gamma(gamma_function); } //-------------------------------------------------------------------- void reset(); void reset_clipping(); void clip_box(double x1, double y1, double x2, double y2); void filling_rule(filling_rule_e filling_rule); void auto_close(bool flag) { m_auto_close = flag; } //-------------------------------------------------------------------- template void gamma(const GammaF& gamma_function) { int i; for(i = 0; i < aa_scale; i++) { m_gamma[i] = uround(gamma_function(double(i) / aa_mask) * aa_mask); } } //-------------------------------------------------------------------- unsigned apply_gamma(unsigned cover) const { return m_gamma[cover]; } //-------------------------------------------------------------------- void move_to(int x, int y); void line_to(int x, int y); void move_to_d(double x, double y); void line_to_d(double x, double y); void close_polygon(); void add_vertex(double x, double y, unsigned cmd); void edge(int x1, int y1, int x2, int y2); void edge_d(double x1, double y1, double x2, double y2); //------------------------------------------------------------------- template void add_path(VertexSource& vs, unsigned path_id=0) { double x; double y; unsigned cmd; vs.rewind(path_id); if(m_outline.sorted()) reset(); while(!is_stop(cmd = vs.vertex(&x, &y))) { add_vertex(x, y, cmd); } } //-------------------------------------------------------------------- int min_x() const { return m_outline.min_x(); } int min_y() const { return m_outline.min_y(); } int max_x() const { return m_outline.max_x(); } int max_y() const { return m_outline.max_y(); } //-------------------------------------------------------------------- void sort(); bool rewind_scanlines(); bool navigate_scanline(int y); //-------------------------------------------------------------------- AGG_INLINE unsigned calculate_alpha(int area) const { int cover = area >> (poly_subpixel_shift*2 + 1 - aa_shift); if(cover < 0) cover = -cover; if(m_filling_rule == fill_even_odd) { cover &= aa_mask2; if(cover > aa_scale) { cover = aa_scale2 - cover; } } if(cover > aa_mask) cover = aa_mask; return m_gamma[cover]; } //-------------------------------------------------------------------- template bool sweep_scanline(Scanline& sl) { for(;;) { if(m_scan_y > m_outline.max_y()) return false; sl.reset_spans(); unsigned num_cells = m_outline.scanline_num_cells(m_scan_y); const cell_aa* const* cells = m_outline.scanline_cells(m_scan_y); int cover = 0; while(num_cells) { const cell_aa* cur_cell = *cells; int x = cur_cell->x; int area = cur_cell->area; unsigned alpha; cover += cur_cell->cover; //accumulate all cells with the same X while(--num_cells) { cur_cell = *++cells; if(cur_cell->x != x) break; area += cur_cell->area; cover += cur_cell->cover; } if(area) { alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area); if(alpha) { sl.add_cell(x, alpha); } x++; } if(num_cells && cur_cell->x > x) { alpha = calculate_alpha(cover << (poly_subpixel_shift + 1)); if(alpha) { sl.add_span(x, cur_cell->x - x, alpha); } } } if(sl.num_spans()) break; ++m_scan_y; } sl.finalize(m_scan_y); ++m_scan_y; return true; } //-------------------------------------------------------------------- bool hit_test(int tx, int ty); private: //-------------------------------------------------------------------- // Disable copying rasterizer_scanline_aa(const rasterizer_scanline_aa&); const rasterizer_scanline_aa& operator = (const rasterizer_scanline_aa&); private: rasterizer_cells_aa m_outline; clip_type m_clipper; int m_gamma[aa_scale]; filling_rule_e m_filling_rule; bool m_auto_close; coord_type m_start_x; coord_type m_start_y; unsigned m_status; int m_scan_y; }; //------------------------------------------------------------------------ template void rasterizer_scanline_aa::reset() { m_outline.reset(); m_status = status_initial; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::filling_rule(filling_rule_e filling_rule) { m_filling_rule = filling_rule; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::clip_box(double x1, double y1, double x2, double y2) { reset(); m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), conv_type::upscale(x2), conv_type::upscale(y2)); } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::reset_clipping() { reset(); m_clipper.reset_clipping(); } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::close_polygon() { if(m_status == status_line_to) { m_clipper.line_to(m_outline, m_start_x, m_start_y); m_status = status_closed; } } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::move_to(int x, int y) { if(m_outline.sorted()) reset(); if(m_auto_close) close_polygon(); m_clipper.move_to(m_start_x = conv_type::downscale(x), m_start_y = conv_type::downscale(y)); m_status = status_move_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::line_to(int x, int y) { m_clipper.line_to(m_outline, conv_type::downscale(x), conv_type::downscale(y)); m_status = status_line_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::move_to_d(double x, double y) { if(m_outline.sorted()) reset(); if(m_auto_close) close_polygon(); m_clipper.move_to(m_start_x = conv_type::upscale(x), m_start_y = conv_type::upscale(y)); m_status = status_move_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::line_to_d(double x, double y) { m_clipper.line_to(m_outline, conv_type::upscale(x), conv_type::upscale(y)); m_status = status_line_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::add_vertex(double x, double y, unsigned cmd) { if(is_move_to(cmd)) { move_to_d(x, y); } else if(is_vertex(cmd)) { line_to_d(x, y); } else if(is_close(cmd)) { close_polygon(); } } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::edge(int x1, int y1, int x2, int y2) { if(m_outline.sorted()) reset(); m_clipper.move_to(conv_type::downscale(x1), conv_type::downscale(y1)); m_clipper.line_to(m_outline, conv_type::downscale(x2), conv_type::downscale(y2)); m_status = status_move_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::edge_d(double x1, double y1, double x2, double y2) { if(m_outline.sorted()) reset(); m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); m_clipper.line_to(m_outline, conv_type::upscale(x2), conv_type::upscale(y2)); m_status = status_move_to; } //------------------------------------------------------------------------ template void rasterizer_scanline_aa::sort() { if(m_auto_close) close_polygon(); m_outline.sort_cells(); } //------------------------------------------------------------------------ template AGG_INLINE bool rasterizer_scanline_aa::rewind_scanlines() { if(m_auto_close) close_polygon(); m_outline.sort_cells(); if(m_outline.total_cells() == 0) { return false; } m_scan_y = m_outline.min_y(); return true; } //------------------------------------------------------------------------ template AGG_INLINE bool rasterizer_scanline_aa::navigate_scanline(int y) { if(m_auto_close) close_polygon(); m_outline.sort_cells(); if(m_outline.total_cells() == 0 || y < m_outline.min_y() || y > m_outline.max_y()) { return false; } m_scan_y = y; return true; } //------------------------------------------------------------------------ template bool rasterizer_scanline_aa::hit_test(int tx, int ty) { if(!navigate_scanline(ty)) return false; scanline_hit_test sl(tx); sweep_scanline(sl); return sl.hit(); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_blur.h0000644000175000017500000014527413233644505022746 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // The Stack Blur Algorithm was invented by Mario Klingemann, // mario@quasimondo.com and described here: // http://incubator.quasimondo.com/processing/fast_blur_deluxe.php // (search phrase "Stackblur: Fast But Goodlooking"). // The major improvement is that there's no more division table // that was very expensive to create for large blur radii. Insted, // for 8-bit per channel and radius not exceeding 254 the division is // replaced by multiplication and shift. // //---------------------------------------------------------------------------- #ifndef AGG_BLUR_INCLUDED #define AGG_BLUR_INCLUDED #include "agg_array.h" #include "agg_pixfmt_base.h" #include "agg_pixfmt_transposer.h" namespace agg24 { template struct stack_blur_tables { static int16u const g_stack_blur8_mul[255]; static int8u const g_stack_blur8_shr[255]; }; //------------------------------------------------------------------------ template int16u const stack_blur_tables::g_stack_blur8_mul[255] = { 512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512, 454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512, 482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456, 437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512, 497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328, 320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456, 446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335, 329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512, 505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405, 399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328, 324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271, 268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456, 451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388, 385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335, 332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292, 289,287,285,282,280,278,275,273,271,269,267,265,263,261,259 }; //------------------------------------------------------------------------ template int8u const stack_blur_tables::g_stack_blur8_shr[255] = { 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 }; //==============================================================stack_blur template class stack_blur { public: typedef ColorT color_type; typedef CalculatorT calculator_type; //-------------------------------------------------------------------- template void blur_x(Img& img, unsigned radius) { if(radius < 1) return; unsigned x, y, xp, i; unsigned stack_ptr; unsigned stack_start; color_type pix; color_type* stack_pix; calculator_type sum; calculator_type sum_in; calculator_type sum_out; unsigned w = img.width(); unsigned h = img.height(); unsigned wm = w - 1; unsigned div = radius * 2 + 1; unsigned div_sum = (radius + 1) * (radius + 1); unsigned mul_sum = 0; unsigned shr_sum = 0; unsigned max_val = color_type::base_mask; if(max_val <= 255 && radius < 255) { mul_sum = stack_blur_tables::g_stack_blur8_mul[radius]; shr_sum = stack_blur_tables::g_stack_blur8_shr[radius]; } m_buf.allocate(w, 128); m_stack.allocate(div, 32); for(y = 0; y < h; y++) { sum.clear(); sum_in.clear(); sum_out.clear(); pix = img.pixel(0, y); for(i = 0; i <= radius; i++) { m_stack[i] = pix; sum.add(pix, i + 1); sum_out.add(pix); } for(i = 1; i <= radius; i++) { pix = img.pixel((i > wm) ? wm : i, y); m_stack[i + radius] = pix; sum.add(pix, radius + 1 - i); sum_in.add(pix); } stack_ptr = radius; for(x = 0; x < w; x++) { if(mul_sum) sum.calc_pix(m_buf[x], mul_sum, shr_sum); else sum.calc_pix(m_buf[x], div_sum); sum.sub(sum_out); stack_start = stack_ptr + div - radius; if(stack_start >= div) stack_start -= div; stack_pix = &m_stack[stack_start]; sum_out.sub(*stack_pix); xp = x + radius + 1; if(xp > wm) xp = wm; pix = img.pixel(xp, y); *stack_pix = pix; sum_in.add(pix); sum.add(sum_in); ++stack_ptr; if(stack_ptr >= div) stack_ptr = 0; stack_pix = &m_stack[stack_ptr]; sum_out.add(*stack_pix); sum_in.sub(*stack_pix); } img.copy_color_hspan(0, y, w, &m_buf[0]); } } //-------------------------------------------------------------------- template void blur_y(Img& img, unsigned radius) { pixfmt_transposer img2(img); blur_x(img2, radius); } //-------------------------------------------------------------------- template void blur(Img& img, unsigned radius) { blur_x(img, radius); pixfmt_transposer img2(img); blur_x(img2, radius); } private: pod_vector m_buf; pod_vector m_stack; }; //====================================================stack_blur_calc_rgba template struct stack_blur_calc_rgba { typedef T value_type; value_type r,g,b,a; AGG_INLINE void clear() { r = g = b = a = 0; } template AGG_INLINE void add(const ArgT& v) { r += v.r; g += v.g; b += v.b; a += v.a; } template AGG_INLINE void add(const ArgT& v, unsigned k) { r += v.r * k; g += v.g * k; b += v.b * k; a += v.a * k; } template AGG_INLINE void sub(const ArgT& v) { r -= v.r; g -= v.g; b -= v.b; a -= v.a; } template AGG_INLINE void calc_pix(ArgT& v, unsigned div) { typedef typename ArgT::value_type value_type; v.r = value_type(r / div); v.g = value_type(g / div); v.b = value_type(b / div); v.a = value_type(a / div); } template AGG_INLINE void calc_pix(ArgT& v, unsigned mul, unsigned shr) { typedef typename ArgT::value_type value_type; v.r = value_type((r * mul) >> shr); v.g = value_type((g * mul) >> shr); v.b = value_type((b * mul) >> shr); v.a = value_type((a * mul) >> shr); } }; //=====================================================stack_blur_calc_rgb template struct stack_blur_calc_rgb { typedef T value_type; value_type r,g,b; AGG_INLINE void clear() { r = g = b = 0; } template AGG_INLINE void add(const ArgT& v) { r += v.r; g += v.g; b += v.b; } template AGG_INLINE void add(const ArgT& v, unsigned k) { r += v.r * k; g += v.g * k; b += v.b * k; } template AGG_INLINE void sub(const ArgT& v) { r -= v.r; g -= v.g; b -= v.b; } template AGG_INLINE void calc_pix(ArgT& v, unsigned div) { typedef typename ArgT::value_type value_type; v.r = value_type(r / div); v.g = value_type(g / div); v.b = value_type(b / div); } template AGG_INLINE void calc_pix(ArgT& v, unsigned mul, unsigned shr) { typedef typename ArgT::value_type value_type; v.r = value_type((r * mul) >> shr); v.g = value_type((g * mul) >> shr); v.b = value_type((b * mul) >> shr); } }; //====================================================stack_blur_calc_gray template struct stack_blur_calc_gray { typedef T value_type; value_type v; AGG_INLINE void clear() { v = 0; } template AGG_INLINE void add(const ArgT& a) { v += a.v; } template AGG_INLINE void add(const ArgT& a, unsigned k) { v += a.v * k; } template AGG_INLINE void sub(const ArgT& a) { v -= a.v; } template AGG_INLINE void calc_pix(ArgT& a, unsigned div) { typedef typename ArgT::value_type value_type; a.v = value_type(v / div); } template AGG_INLINE void calc_pix(ArgT& a, unsigned mul, unsigned shr) { typedef typename ArgT::value_type value_type; a.v = value_type((v * mul) >> shr); } }; //========================================================stack_blur_gray8 template void stack_blur_gray8(Img& img, unsigned rx, unsigned ry) { unsigned x, y, xp, yp, i; unsigned stack_ptr; unsigned stack_start; const int8u* src_pix_ptr; int8u* dst_pix_ptr; unsigned pix; unsigned stack_pix; unsigned sum; unsigned sum_in; unsigned sum_out; unsigned w = img.width(); unsigned h = img.height(); unsigned wm = w - 1; unsigned hm = h - 1; unsigned div; unsigned mul_sum; unsigned shr_sum; pod_vector stack; if(rx > 0) { if(rx > 254) rx = 254; div = rx * 2 + 1; mul_sum = stack_blur_tables::g_stack_blur8_mul[rx]; shr_sum = stack_blur_tables::g_stack_blur8_shr[rx]; stack.allocate(div); for(y = 0; y < h; y++) { sum = sum_in = sum_out = 0; src_pix_ptr = img.pix_ptr(0, y); pix = *src_pix_ptr; for(i = 0; i <= rx; i++) { stack[i] = pix; sum += pix * (i + 1); sum_out += pix; } for(i = 1; i <= rx; i++) { if(i <= wm) src_pix_ptr += Img::pix_width; pix = *src_pix_ptr; stack[i + rx] = pix; sum += pix * (rx + 1 - i); sum_in += pix; } stack_ptr = rx; xp = rx; if(xp > wm) xp = wm; src_pix_ptr = img.pix_ptr(xp, y); dst_pix_ptr = img.pix_ptr(0, y); for(x = 0; x < w; x++) { *dst_pix_ptr = (sum * mul_sum) >> shr_sum; dst_pix_ptr += Img::pix_width; sum -= sum_out; stack_start = stack_ptr + div - rx; if(stack_start >= div) stack_start -= div; sum_out -= stack[stack_start]; if(xp < wm) { src_pix_ptr += Img::pix_width; pix = *src_pix_ptr; ++xp; } stack[stack_start] = pix; sum_in += pix; sum += sum_in; ++stack_ptr; if(stack_ptr >= div) stack_ptr = 0; stack_pix = stack[stack_ptr]; sum_out += stack_pix; sum_in -= stack_pix; } } } if(ry > 0) { if(ry > 254) ry = 254; div = ry * 2 + 1; mul_sum = stack_blur_tables::g_stack_blur8_mul[ry]; shr_sum = stack_blur_tables::g_stack_blur8_shr[ry]; stack.allocate(div); int stride = img.stride(); for(x = 0; x < w; x++) { sum = sum_in = sum_out = 0; src_pix_ptr = img.pix_ptr(x, 0); pix = *src_pix_ptr; for(i = 0; i <= ry; i++) { stack[i] = pix; sum += pix * (i + 1); sum_out += pix; } for(i = 1; i <= ry; i++) { if(i <= hm) src_pix_ptr += stride; pix = *src_pix_ptr; stack[i + ry] = pix; sum += pix * (ry + 1 - i); sum_in += pix; } stack_ptr = ry; yp = ry; if(yp > hm) yp = hm; src_pix_ptr = img.pix_ptr(x, yp); dst_pix_ptr = img.pix_ptr(x, 0); for(y = 0; y < h; y++) { *dst_pix_ptr = (sum * mul_sum) >> shr_sum; dst_pix_ptr += stride; sum -= sum_out; stack_start = stack_ptr + div - ry; if(stack_start >= div) stack_start -= div; sum_out -= stack[stack_start]; if(yp < hm) { src_pix_ptr += stride; pix = *src_pix_ptr; ++yp; } stack[stack_start] = pix; sum_in += pix; sum += sum_in; ++stack_ptr; if(stack_ptr >= div) stack_ptr = 0; stack_pix = stack[stack_ptr]; sum_out += stack_pix; sum_in -= stack_pix; } } } } //========================================================stack_blur_rgb24 template void stack_blur_rgb24(Img& img, unsigned rx, unsigned ry) { typedef typename Img::color_type color_type; typedef typename Img::order_type order_type; enum order_e { R = order_type::R, G = order_type::G, B = order_type::B }; unsigned x, y, xp, yp, i; unsigned stack_ptr; unsigned stack_start; const int8u* src_pix_ptr; int8u* dst_pix_ptr; color_type* stack_pix_ptr; unsigned sum_r; unsigned sum_g; unsigned sum_b; unsigned sum_in_r; unsigned sum_in_g; unsigned sum_in_b; unsigned sum_out_r; unsigned sum_out_g; unsigned sum_out_b; unsigned w = img.width(); unsigned h = img.height(); unsigned wm = w - 1; unsigned hm = h - 1; unsigned div; unsigned mul_sum; unsigned shr_sum; pod_vector stack; if(rx > 0) { if(rx > 254) rx = 254; div = rx * 2 + 1; mul_sum = stack_blur_tables::g_stack_blur8_mul[rx]; shr_sum = stack_blur_tables::g_stack_blur8_shr[rx]; stack.allocate(div); for(y = 0; y < h; y++) { sum_r = sum_g = sum_b = sum_in_r = sum_in_g = sum_in_b = sum_out_r = sum_out_g = sum_out_b = 0; src_pix_ptr = img.pix_ptr(0, y); for(i = 0; i <= rx; i++) { stack_pix_ptr = &stack[i]; stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; sum_r += src_pix_ptr[R] * (i + 1); sum_g += src_pix_ptr[G] * (i + 1); sum_b += src_pix_ptr[B] * (i + 1); sum_out_r += src_pix_ptr[R]; sum_out_g += src_pix_ptr[G]; sum_out_b += src_pix_ptr[B]; } for(i = 1; i <= rx; i++) { if(i <= wm) src_pix_ptr += Img::pix_width; stack_pix_ptr = &stack[i + rx]; stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; sum_r += src_pix_ptr[R] * (rx + 1 - i); sum_g += src_pix_ptr[G] * (rx + 1 - i); sum_b += src_pix_ptr[B] * (rx + 1 - i); sum_in_r += src_pix_ptr[R]; sum_in_g += src_pix_ptr[G]; sum_in_b += src_pix_ptr[B]; } stack_ptr = rx; xp = rx; if(xp > wm) xp = wm; src_pix_ptr = img.pix_ptr(xp, y); dst_pix_ptr = img.pix_ptr(0, y); for(x = 0; x < w; x++) { dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; dst_pix_ptr += Img::pix_width; sum_r -= sum_out_r; sum_g -= sum_out_g; sum_b -= sum_out_b; stack_start = stack_ptr + div - rx; if(stack_start >= div) stack_start -= div; stack_pix_ptr = &stack[stack_start]; sum_out_r -= stack_pix_ptr->r; sum_out_g -= stack_pix_ptr->g; sum_out_b -= stack_pix_ptr->b; if(xp < wm) { src_pix_ptr += Img::pix_width; ++xp; } stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; sum_in_r += src_pix_ptr[R]; sum_in_g += src_pix_ptr[G]; sum_in_b += src_pix_ptr[B]; sum_r += sum_in_r; sum_g += sum_in_g; sum_b += sum_in_b; ++stack_ptr; if(stack_ptr >= div) stack_ptr = 0; stack_pix_ptr = &stack[stack_ptr]; sum_out_r += stack_pix_ptr->r; sum_out_g += stack_pix_ptr->g; sum_out_b += stack_pix_ptr->b; sum_in_r -= stack_pix_ptr->r; sum_in_g -= stack_pix_ptr->g; sum_in_b -= stack_pix_ptr->b; } } } if(ry > 0) { if(ry > 254) ry = 254; div = ry * 2 + 1; mul_sum = stack_blur_tables::g_stack_blur8_mul[ry]; shr_sum = stack_blur_tables::g_stack_blur8_shr[ry]; stack.allocate(div); int stride = img.stride(); for(x = 0; x < w; x++) { sum_r = sum_g = sum_b = sum_in_r = sum_in_g = sum_in_b = sum_out_r = sum_out_g = sum_out_b = 0; src_pix_ptr = img.pix_ptr(x, 0); for(i = 0; i <= ry; i++) { stack_pix_ptr = &stack[i]; stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; sum_r += src_pix_ptr[R] * (i + 1); sum_g += src_pix_ptr[G] * (i + 1); sum_b += src_pix_ptr[B] * (i + 1); sum_out_r += src_pix_ptr[R]; sum_out_g += src_pix_ptr[G]; sum_out_b += src_pix_ptr[B]; } for(i = 1; i <= ry; i++) { if(i <= hm) src_pix_ptr += stride; stack_pix_ptr = &stack[i + ry]; stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; sum_r += src_pix_ptr[R] * (ry + 1 - i); sum_g += src_pix_ptr[G] * (ry + 1 - i); sum_b += src_pix_ptr[B] * (ry + 1 - i); sum_in_r += src_pix_ptr[R]; sum_in_g += src_pix_ptr[G]; sum_in_b += src_pix_ptr[B]; } stack_ptr = ry; yp = ry; if(yp > hm) yp = hm; src_pix_ptr = img.pix_ptr(x, yp); dst_pix_ptr = img.pix_ptr(x, 0); for(y = 0; y < h; y++) { dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; dst_pix_ptr += stride; sum_r -= sum_out_r; sum_g -= sum_out_g; sum_b -= sum_out_b; stack_start = stack_ptr + div - ry; if(stack_start >= div) stack_start -= div; stack_pix_ptr = &stack[stack_start]; sum_out_r -= stack_pix_ptr->r; sum_out_g -= stack_pix_ptr->g; sum_out_b -= stack_pix_ptr->b; if(yp < hm) { src_pix_ptr += stride; ++yp; } stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; sum_in_r += src_pix_ptr[R]; sum_in_g += src_pix_ptr[G]; sum_in_b += src_pix_ptr[B]; sum_r += sum_in_r; sum_g += sum_in_g; sum_b += sum_in_b; ++stack_ptr; if(stack_ptr >= div) stack_ptr = 0; stack_pix_ptr = &stack[stack_ptr]; sum_out_r += stack_pix_ptr->r; sum_out_g += stack_pix_ptr->g; sum_out_b += stack_pix_ptr->b; sum_in_r -= stack_pix_ptr->r; sum_in_g -= stack_pix_ptr->g; sum_in_b -= stack_pix_ptr->b; } } } } //=======================================================stack_blur_rgba32 template void stack_blur_rgba32(Img& img, unsigned rx, unsigned ry) { typedef typename Img::color_type color_type; typedef typename Img::order_type order_type; enum order_e { R = order_type::R, G = order_type::G, B = order_type::B, A = order_type::A }; unsigned x, y, xp, yp, i; unsigned stack_ptr; unsigned stack_start; const int8u* src_pix_ptr; int8u* dst_pix_ptr; color_type* stack_pix_ptr; unsigned sum_r; unsigned sum_g; unsigned sum_b; unsigned sum_a; unsigned sum_in_r; unsigned sum_in_g; unsigned sum_in_b; unsigned sum_in_a; unsigned sum_out_r; unsigned sum_out_g; unsigned sum_out_b; unsigned sum_out_a; unsigned w = img.width(); unsigned h = img.height(); unsigned wm = w - 1; unsigned hm = h - 1; unsigned div; unsigned mul_sum; unsigned shr_sum; pod_vector stack; if(rx > 0) { if(rx > 254) rx = 254; div = rx * 2 + 1; mul_sum = stack_blur_tables::g_stack_blur8_mul[rx]; shr_sum = stack_blur_tables::g_stack_blur8_shr[rx]; stack.allocate(div); for(y = 0; y < h; y++) { sum_r = sum_g = sum_b = sum_a = sum_in_r = sum_in_g = sum_in_b = sum_in_a = sum_out_r = sum_out_g = sum_out_b = sum_out_a = 0; src_pix_ptr = img.pix_ptr(0, y); for(i = 0; i <= rx; i++) { stack_pix_ptr = &stack[i]; stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; stack_pix_ptr->a = src_pix_ptr[A]; sum_r += src_pix_ptr[R] * (i + 1); sum_g += src_pix_ptr[G] * (i + 1); sum_b += src_pix_ptr[B] * (i + 1); sum_a += src_pix_ptr[A] * (i + 1); sum_out_r += src_pix_ptr[R]; sum_out_g += src_pix_ptr[G]; sum_out_b += src_pix_ptr[B]; sum_out_a += src_pix_ptr[A]; } for(i = 1; i <= rx; i++) { if(i <= wm) src_pix_ptr += Img::pix_width; stack_pix_ptr = &stack[i + rx]; stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; stack_pix_ptr->a = src_pix_ptr[A]; sum_r += src_pix_ptr[R] * (rx + 1 - i); sum_g += src_pix_ptr[G] * (rx + 1 - i); sum_b += src_pix_ptr[B] * (rx + 1 - i); sum_a += src_pix_ptr[A] * (rx + 1 - i); sum_in_r += src_pix_ptr[R]; sum_in_g += src_pix_ptr[G]; sum_in_b += src_pix_ptr[B]; sum_in_a += src_pix_ptr[A]; } stack_ptr = rx; xp = rx; if(xp > wm) xp = wm; src_pix_ptr = img.pix_ptr(xp, y); dst_pix_ptr = img.pix_ptr(0, y); for(x = 0; x < w; x++) { dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; dst_pix_ptr[A] = (sum_a * mul_sum) >> shr_sum; dst_pix_ptr += Img::pix_width; sum_r -= sum_out_r; sum_g -= sum_out_g; sum_b -= sum_out_b; sum_a -= sum_out_a; stack_start = stack_ptr + div - rx; if(stack_start >= div) stack_start -= div; stack_pix_ptr = &stack[stack_start]; sum_out_r -= stack_pix_ptr->r; sum_out_g -= stack_pix_ptr->g; sum_out_b -= stack_pix_ptr->b; sum_out_a -= stack_pix_ptr->a; if(xp < wm) { src_pix_ptr += Img::pix_width; ++xp; } stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; stack_pix_ptr->a = src_pix_ptr[A]; sum_in_r += src_pix_ptr[R]; sum_in_g += src_pix_ptr[G]; sum_in_b += src_pix_ptr[B]; sum_in_a += src_pix_ptr[A]; sum_r += sum_in_r; sum_g += sum_in_g; sum_b += sum_in_b; sum_a += sum_in_a; ++stack_ptr; if(stack_ptr >= div) stack_ptr = 0; stack_pix_ptr = &stack[stack_ptr]; sum_out_r += stack_pix_ptr->r; sum_out_g += stack_pix_ptr->g; sum_out_b += stack_pix_ptr->b; sum_out_a += stack_pix_ptr->a; sum_in_r -= stack_pix_ptr->r; sum_in_g -= stack_pix_ptr->g; sum_in_b -= stack_pix_ptr->b; sum_in_a -= stack_pix_ptr->a; } } } if(ry > 0) { if(ry > 254) ry = 254; div = ry * 2 + 1; mul_sum = stack_blur_tables::g_stack_blur8_mul[ry]; shr_sum = stack_blur_tables::g_stack_blur8_shr[ry]; stack.allocate(div); int stride = img.stride(); for(x = 0; x < w; x++) { sum_r = sum_g = sum_b = sum_a = sum_in_r = sum_in_g = sum_in_b = sum_in_a = sum_out_r = sum_out_g = sum_out_b = sum_out_a = 0; src_pix_ptr = img.pix_ptr(x, 0); for(i = 0; i <= ry; i++) { stack_pix_ptr = &stack[i]; stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; stack_pix_ptr->a = src_pix_ptr[A]; sum_r += src_pix_ptr[R] * (i + 1); sum_g += src_pix_ptr[G] * (i + 1); sum_b += src_pix_ptr[B] * (i + 1); sum_a += src_pix_ptr[A] * (i + 1); sum_out_r += src_pix_ptr[R]; sum_out_g += src_pix_ptr[G]; sum_out_b += src_pix_ptr[B]; sum_out_a += src_pix_ptr[A]; } for(i = 1; i <= ry; i++) { if(i <= hm) src_pix_ptr += stride; stack_pix_ptr = &stack[i + ry]; stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; stack_pix_ptr->a = src_pix_ptr[A]; sum_r += src_pix_ptr[R] * (ry + 1 - i); sum_g += src_pix_ptr[G] * (ry + 1 - i); sum_b += src_pix_ptr[B] * (ry + 1 - i); sum_a += src_pix_ptr[A] * (ry + 1 - i); sum_in_r += src_pix_ptr[R]; sum_in_g += src_pix_ptr[G]; sum_in_b += src_pix_ptr[B]; sum_in_a += src_pix_ptr[A]; } stack_ptr = ry; yp = ry; if(yp > hm) yp = hm; src_pix_ptr = img.pix_ptr(x, yp); dst_pix_ptr = img.pix_ptr(x, 0); for(y = 0; y < h; y++) { dst_pix_ptr[R] = (sum_r * mul_sum) >> shr_sum; dst_pix_ptr[G] = (sum_g * mul_sum) >> shr_sum; dst_pix_ptr[B] = (sum_b * mul_sum) >> shr_sum; dst_pix_ptr[A] = (sum_a * mul_sum) >> shr_sum; dst_pix_ptr += stride; sum_r -= sum_out_r; sum_g -= sum_out_g; sum_b -= sum_out_b; sum_a -= sum_out_a; stack_start = stack_ptr + div - ry; if(stack_start >= div) stack_start -= div; stack_pix_ptr = &stack[stack_start]; sum_out_r -= stack_pix_ptr->r; sum_out_g -= stack_pix_ptr->g; sum_out_b -= stack_pix_ptr->b; sum_out_a -= stack_pix_ptr->a; if(yp < hm) { src_pix_ptr += stride; ++yp; } stack_pix_ptr->r = src_pix_ptr[R]; stack_pix_ptr->g = src_pix_ptr[G]; stack_pix_ptr->b = src_pix_ptr[B]; stack_pix_ptr->a = src_pix_ptr[A]; sum_in_r += src_pix_ptr[R]; sum_in_g += src_pix_ptr[G]; sum_in_b += src_pix_ptr[B]; sum_in_a += src_pix_ptr[A]; sum_r += sum_in_r; sum_g += sum_in_g; sum_b += sum_in_b; sum_a += sum_in_a; ++stack_ptr; if(stack_ptr >= div) stack_ptr = 0; stack_pix_ptr = &stack[stack_ptr]; sum_out_r += stack_pix_ptr->r; sum_out_g += stack_pix_ptr->g; sum_out_b += stack_pix_ptr->b; sum_out_a += stack_pix_ptr->a; sum_in_r -= stack_pix_ptr->r; sum_in_g -= stack_pix_ptr->g; sum_in_b -= stack_pix_ptr->b; sum_in_a -= stack_pix_ptr->a; } } } } //===========================================================recursive_blur template class recursive_blur { public: typedef ColorT color_type; typedef CalculatorT calculator_type; typedef typename color_type::value_type value_type; typedef typename calculator_type::value_type calc_type; //-------------------------------------------------------------------- template void blur_x(Img& img, double radius) { if(radius < 0.62) return; if(img.width() < 3) return; calc_type s = calc_type(radius * 0.5); calc_type q = calc_type((s < 2.5) ? 3.97156 - 4.14554 * sqrt(1 - 0.26891 * s) : 0.98711 * s - 0.96330); calc_type q2 = calc_type(q * q); calc_type q3 = calc_type(q2 * q); calc_type b0 = calc_type(1.0 / (1.578250 + 2.444130 * q + 1.428100 * q2 + 0.422205 * q3)); calc_type b1 = calc_type( 2.44413 * q + 2.85619 * q2 + 1.26661 * q3); calc_type b2 = calc_type(-1.42810 * q2 + -1.26661 * q3); calc_type b3 = calc_type(0.422205 * q3); calc_type b = calc_type(1 - (b1 + b2 + b3) * b0); b1 *= b0; b2 *= b0; b3 *= b0; int w = img.width(); int h = img.height(); int wm = w-1; int x, y; m_sum1.allocate(w); m_sum2.allocate(w); m_buf.allocate(w); for(y = 0; y < h; y++) { calculator_type c; c.from_pix(img.pixel(0, y)); m_sum1[0].calc(b, b1, b2, b3, c, c, c, c); c.from_pix(img.pixel(1, y)); m_sum1[1].calc(b, b1, b2, b3, c, m_sum1[0], m_sum1[0], m_sum1[0]); c.from_pix(img.pixel(2, y)); m_sum1[2].calc(b, b1, b2, b3, c, m_sum1[1], m_sum1[0], m_sum1[0]); for(x = 3; x < w; ++x) { c.from_pix(img.pixel(x, y)); m_sum1[x].calc(b, b1, b2, b3, c, m_sum1[x-1], m_sum1[x-2], m_sum1[x-3]); } m_sum2[wm ].calc(b, b1, b2, b3, m_sum1[wm ], m_sum1[wm ], m_sum1[wm], m_sum1[wm]); m_sum2[wm-1].calc(b, b1, b2, b3, m_sum1[wm-1], m_sum2[wm ], m_sum2[wm], m_sum2[wm]); m_sum2[wm-2].calc(b, b1, b2, b3, m_sum1[wm-2], m_sum2[wm-1], m_sum2[wm], m_sum2[wm]); m_sum2[wm ].to_pix(m_buf[wm ]); m_sum2[wm-1].to_pix(m_buf[wm-1]); m_sum2[wm-2].to_pix(m_buf[wm-2]); for(x = wm-3; x >= 0; --x) { m_sum2[x].calc(b, b1, b2, b3, m_sum1[x], m_sum2[x+1], m_sum2[x+2], m_sum2[x+3]); m_sum2[x].to_pix(m_buf[x]); } img.copy_color_hspan(0, y, w, &m_buf[0]); } } //-------------------------------------------------------------------- template void blur_y(Img& img, double radius) { pixfmt_transposer img2(img); blur_x(img2, radius); } //-------------------------------------------------------------------- template void blur(Img& img, double radius) { blur_x(img, radius); pixfmt_transposer img2(img); blur_x(img2, radius); } private: agg24::pod_vector m_sum1; agg24::pod_vector m_sum2; agg24::pod_vector m_buf; }; //=================================================recursive_blur_calc_rgba template struct recursive_blur_calc_rgba { typedef T value_type; typedef recursive_blur_calc_rgba self_type; value_type r,g,b,a; template AGG_INLINE void from_pix(const ColorT& c) { r = c.r; g = c.g; b = c.b; a = c.a; } AGG_INLINE void calc(value_type b1, value_type b2, value_type b3, value_type b4, const self_type& c1, const self_type& c2, const self_type& c3, const self_type& c4) { r = b1*c1.r + b2*c2.r + b3*c3.r + b4*c4.r; g = b1*c1.g + b2*c2.g + b3*c3.g + b4*c4.g; b = b1*c1.b + b2*c2.b + b3*c3.b + b4*c4.b; a = b1*c1.a + b2*c2.a + b3*c3.a + b4*c4.a; } template AGG_INLINE void to_pix(ColorT& c) const { typedef typename ColorT::value_type cv_type; c.r = cv_type(r); c.g = cv_type(g); c.b = cv_type(b); c.a = cv_type(a); } }; //=================================================recursive_blur_calc_rgb template struct recursive_blur_calc_rgb { typedef T value_type; typedef recursive_blur_calc_rgb self_type; value_type r,g,b; template AGG_INLINE void from_pix(const ColorT& c) { r = c.r; g = c.g; b = c.b; } AGG_INLINE void calc(value_type b1, value_type b2, value_type b3, value_type b4, const self_type& c1, const self_type& c2, const self_type& c3, const self_type& c4) { r = b1*c1.r + b2*c2.r + b3*c3.r + b4*c4.r; g = b1*c1.g + b2*c2.g + b3*c3.g + b4*c4.g; b = b1*c1.b + b2*c2.b + b3*c3.b + b4*c4.b; } template AGG_INLINE void to_pix(ColorT& c) const { typedef typename ColorT::value_type cv_type; c.r = cv_type(r); c.g = cv_type(g); c.b = cv_type(b); } }; //================================================recursive_blur_calc_gray template struct recursive_blur_calc_gray { typedef T value_type; typedef recursive_blur_calc_gray self_type; value_type v; template AGG_INLINE void from_pix(const ColorT& c) { v = c.v; } AGG_INLINE void calc(value_type b1, value_type b2, value_type b3, value_type b4, const self_type& c1, const self_type& c2, const self_type& c3, const self_type& c4) { v = b1*c1.v + b2*c2.v + b3*c3.v + b4*c4.v; } template AGG_INLINE void to_pix(ColorT& c) const { typedef typename ColorT::value_type cv_type; c.v = cv_type(v); } }; //================================================slight_blur // Special-purpose filter for applying a Gaussian blur with a radius small enough // that the blur only affects adjacent pixels. A Gaussian curve with a standard // deviation of r/2 is used, as per the HTML/CSS spec. At 3 standard deviations, // the contribution drops to less than 0.005, i.e. less than half a percent, // therefore the radius can be at least 1.33 before errors become significant. // This filter is useful for smoothing artifacts caused by detail rendered // at the pixel scale, e.g. single-pixel lines. Note that the filter should // only be used with premultiplied pixel formats (or those without alpha). // See the "line_thickness" example for a demonstration. template class slight_blur { public: typedef typename PixFmt::pixel_type pixel_type; typedef typename PixFmt::value_type value_type; typedef typename PixFmt::order_type order_type; slight_blur(double r = 1.33) { radius(r); } void radius(double r) { if (r > 0) { // Sample the gaussian curve at 0 and r/2 standard deviations. // At 3 standard deviations, the response is < 0.005. double pi = 3.14159; double n = 2 / r; m_g0 = 1 / sqrt(2 * pi); m_g1 = m_g0 * exp(-n * n); // Normalize. double sum = m_g0 + 2 * m_g1; m_g0 /= sum; m_g1 /= sum; } else { m_g0 = 1; m_g1 = 0; } } void blur(PixFmt& img, rect_i bounds) { // Make sure we stay within the image area. bounds.clip(rect_i(0, 0, img.width() - 1, img.height() - 1)); int w = bounds.x2 - bounds.x1 + 1; int h = bounds.y2 - bounds.y1 + 1; if (w < 3 || h < 3) return; // Allocate 3 rows of buffer space. m_buf.allocate(w * 3); // Set up row pointers pixel_type * begin = &m_buf[0]; pixel_type * r0 = begin; pixel_type * r1 = r0 + w; pixel_type * r2 = r1 + w; pixel_type * end = r2 + w; // Horizontally blur the first two input rows. calc_row(img, bounds.x1, bounds.y1, w, r0); memcpy(r1, r0, w * sizeof(pixel_type)); for (int y = 0; ; ) { // Get pointer to first pixel. pixel_type* p = img.pix_value_ptr(bounds.x1, bounds.y1 + y, bounds.x1 + w); // Horizontally blur the row below. if (y + 1 < h) { calc_row(img, bounds.x1, bounds.y1 + y + 1, w, r2); } else { memcpy(r2, r1, w * sizeof(pixel_type)); // duplicate bottom row } // Combine blurred rows into destination. for (int x = 0; x < w; ++x) { calc_pixel(*r0++, *r1++, *r2++, *p++); } if (++y >= h) break; // Wrap bottom row pointer around to top of buffer. if (r2 == end) r2 = begin; else if (r1 == end) r1 = begin; else if (r0 == end) r0 = begin; } } private: void calc_row(PixFmt& img, int x, int y, int w, pixel_type* row) { const int wm = w - 1; pixel_type* p = img.pix_value_ptr(x, y, w); pixel_type c[3]; pixel_type* p0 = c; pixel_type* p1 = c + 1; pixel_type* p2 = c + 2; pixel_type* end = c + 3; *p0 = *p1 = *p; for (int x = 0; x < wm; ++x) { *p2 = *(p = p->next()); calc_pixel(*p0++, *p1++, *p2++, *row++); if (p0 == end) p0 = c; else if (p1 == end) p1 = c; else if (p2 == end) p2 = c; } calc_pixel(*p0, *p1, *p1, *row); } void calc_pixel( pixel_type const & c1, pixel_type const & c2, pixel_type const & c3, pixel_type & x) { calc_pixel(c1, c2, c3, x, PixFmt::pixfmt_category()); } void calc_pixel( pixel_type const & c1, pixel_type const & c2, pixel_type const & c3, pixel_type & x, pixfmt_gray_tag) { x.c[0] = calc_value(c1.c[0], c2.c[0], c3.c[0]); } void calc_pixel( pixel_type const & c1, pixel_type const & c2, pixel_type const & c3, pixel_type & x, pixfmt_rgb_tag) { enum { R = order_type::R, G = order_type::G, B = order_type::B }; x.c[R] = calc_value(c1.c[R], c2.c[R], c3.c[R]); x.c[G] = calc_value(c1.c[G], c2.c[G], c3.c[G]); x.c[B] = calc_value(c1.c[B], c2.c[B], c3.c[B]); } void calc_pixel( pixel_type const & c1, pixel_type const & c2, pixel_type const & c3, pixel_type & x, pixfmt_rgba_tag) { enum { R = order_type::R, G = order_type::G, B = order_type::B, A = order_type::A }; x.c[R] = calc_value(c1.c[R], c2.c[R], c3.c[R]); x.c[G] = calc_value(c1.c[G], c2.c[G], c3.c[G]); x.c[B] = calc_value(c1.c[B], c2.c[B], c3.c[B]); x.c[A] = calc_value(c1.c[A], c2.c[A], c3.c[A]); } value_type calc_value(value_type v1, value_type v2, value_type v3) { return value_type(m_g1 * v1 + m_g0 * v2 + m_g1 * v3); } double m_g0, m_g1; pod_vector m_buf; }; // Helper functions for applying blur to a surface without having to create an intermediate object. template void apply_slight_blur(PixFmt& img, const rect_i& bounds, double r = 1) { if (r > 0) slight_blur(r).blur(img, bounds); } template void apply_slight_blur(PixFmt& img, double r = 1) { if (r > 0) slight_blur(r).blur(img, rect_i(0, 0, img.width() - 1, img.height() - 1)); } template void apply_slight_blur(renderer_base& img, const rect_i& bounds, double r = 1) { if (r > 0) slight_blur(r).blur(img.ren(), bounds); } template void apply_slight_blur(renderer_base& img, double r = 1) { if (r > 0) slight_blur(r).blur(img.ren(), img.clip_box()); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_config.h0000644000175000017500000000243313233644505023234 0ustar varunvarun#ifndef AGG_CONFIG_INCLUDED #define AGG_CONFIG_INCLUDED // This file can be used to redefine certain data types. //--------------------------------------- // 1. Default basic types such as: // // AGG_INT8 // AGG_INT8U // AGG_INT16 // AGG_INT16U // AGG_INT32 // AGG_INT32U // AGG_INT64 // AGG_INT64U // // Just replace this file with new defines if necessary. // For example, if your compiler doesn't have a 64 bit integer type // you can still use AGG if you define the follows: // // #define AGG_INT64 int // #define AGG_INT64U unsigned // // It will result in overflow in 16 bit-per-component image/pattern resampling // but it won't result any crash and the rest of the library will remain // fully functional. //--------------------------------------- // 2. Default rendering_buffer type. Can be: // // Provides faster access for massive pixel operations, // such as blur, image filtering: // #define AGG_RENDERING_BUFFER row_ptr_cache // // Provides cheaper creation and destruction (no mem allocs): // #define AGG_RENDERING_BUFFER row_accessor // // You can still use both of them simultaneously in your applications // This #define is used only for default rendering_buffer type, // in short hand typedefs like pixfmt_rgba32. #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_image_accessors.h0000644000175000017500000003246513233644505025126 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #ifndef AGG_IMAGE_ACCESSORS_INCLUDED #define AGG_IMAGE_ACCESSORS_INCLUDED #include "agg_basics.h" namespace agg24 { //-----------------------------------------------------image_accessor_clip template class image_accessor_clip { public: typedef PixFmt pixfmt_type; typedef typename pixfmt_type::color_type color_type; typedef typename pixfmt_type::order_type order_type; typedef typename pixfmt_type::value_type value_type; enum pix_width_e { pix_width = pixfmt_type::pix_width }; image_accessor_clip() {} explicit image_accessor_clip(pixfmt_type& pixf, const color_type& bk) : m_pixf(&pixf) { pixfmt_type::make_pix(m_bk_buf, bk); } void attach(pixfmt_type& pixf) { m_pixf = &pixf; } void background_color(const color_type& bk) { pixfmt_type::make_pix(m_bk_buf, bk); } private: AGG_INLINE const int8u* pixel() const { if(m_y >= 0 && m_y < (int)m_pixf->height() && m_x >= 0 && m_x < (int)m_pixf->width()) { return m_pixf->pix_ptr(m_x, m_y); } return m_bk_buf; } public: AGG_INLINE const int8u* span(int x, int y, unsigned len) { m_x = m_x0 = x; m_y = y; if(y >= 0 && y < (int)m_pixf->height() && x >= 0 && x+(int)len <= (int)m_pixf->width()) { return m_pix_ptr = m_pixf->pix_ptr(x, y); } m_pix_ptr = 0; return pixel(); } AGG_INLINE const int8u* next_x() { if(m_pix_ptr) return m_pix_ptr += pix_width; ++m_x; return pixel(); } AGG_INLINE const int8u* next_y() { ++m_y; m_x = m_x0; if(m_pix_ptr && m_y >= 0 && m_y < (int)m_pixf->height()) { return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y); } m_pix_ptr = 0; return pixel(); } private: const pixfmt_type* m_pixf; int8u m_bk_buf[pix_width]; int m_x, m_x0, m_y; const int8u* m_pix_ptr; }; //--------------------------------------------------image_accessor_no_clip template class image_accessor_no_clip { public: typedef PixFmt pixfmt_type; typedef typename pixfmt_type::color_type color_type; typedef typename pixfmt_type::order_type order_type; typedef typename pixfmt_type::value_type value_type; enum pix_width_e { pix_width = pixfmt_type::pix_width }; image_accessor_no_clip() {} explicit image_accessor_no_clip(pixfmt_type& pixf) : m_pixf(&pixf) {} void attach(pixfmt_type& pixf) { m_pixf = &pixf; } AGG_INLINE const int8u* span(int x, int y, unsigned) { m_x = x; m_y = y; return m_pix_ptr = m_pixf->pix_ptr(x, y); } AGG_INLINE const int8u* next_x() { return m_pix_ptr += pix_width; } AGG_INLINE const int8u* next_y() { ++m_y; return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y); } private: const pixfmt_type* m_pixf; int m_x, m_y; const int8u* m_pix_ptr; }; //----------------------------------------------------image_accessor_clone template class image_accessor_clone { public: typedef PixFmt pixfmt_type; typedef typename pixfmt_type::color_type color_type; typedef typename pixfmt_type::order_type order_type; typedef typename pixfmt_type::value_type value_type; enum pix_width_e { pix_width = pixfmt_type::pix_width }; image_accessor_clone() {} explicit image_accessor_clone(pixfmt_type& pixf) : m_pixf(&pixf) {} void attach(pixfmt_type& pixf) { m_pixf = &pixf; } private: AGG_INLINE const int8u* pixel() const { register int x = m_x; register int y = m_y; if(x < 0) x = 0; if(y < 0) y = 0; if(x >= (int)m_pixf->width()) x = m_pixf->width() - 1; if(y >= (int)m_pixf->height()) y = m_pixf->height() - 1; return m_pixf->pix_ptr(x, y); } public: AGG_INLINE const int8u* span(int x, int y, unsigned len) { m_x = m_x0 = x; m_y = y; if(y >= 0 && y < (int)m_pixf->height() && x >= 0 && x+len <= (int)m_pixf->width()) { return m_pix_ptr = m_pixf->pix_ptr(x, y); } m_pix_ptr = 0; return pixel(); } AGG_INLINE const int8u* next_x() { if(m_pix_ptr) return m_pix_ptr += pix_width; ++m_x; return pixel(); } AGG_INLINE const int8u* next_y() { ++m_y; m_x = m_x0; if(m_pix_ptr && m_y >= 0 && m_y < (int)m_pixf->height()) { return m_pix_ptr = m_pixf->pix_ptr(m_x, m_y); } m_pix_ptr = 0; return pixel(); } private: const pixfmt_type* m_pixf; int m_x, m_x0, m_y; const int8u* m_pix_ptr; }; //-----------------------------------------------------image_accessor_wrap template class image_accessor_wrap { public: typedef PixFmt pixfmt_type; typedef typename pixfmt_type::color_type color_type; typedef typename pixfmt_type::order_type order_type; typedef typename pixfmt_type::value_type value_type; enum pix_width_e { pix_width = pixfmt_type::pix_width }; image_accessor_wrap() {} explicit image_accessor_wrap(pixfmt_type& pixf) : m_pixf(&pixf), m_wrap_x(pixf.width()), m_wrap_y(pixf.height()) {} void attach(pixfmt_type& pixf) { m_pixf = &pixf; } AGG_INLINE const int8u* span(int x, int y, unsigned) { m_x = x; m_row_ptr = m_pixf->pix_ptr(0, m_wrap_y(y)); return m_row_ptr + m_wrap_x(x) * pix_width; } AGG_INLINE const int8u* next_x() { int x = ++m_wrap_x; return m_row_ptr + x * pix_width; } AGG_INLINE const int8u* next_y() { m_row_ptr = m_pixf->pix_ptr(0, ++m_wrap_y); return m_row_ptr + m_wrap_x(m_x) * pix_width; } private: const pixfmt_type* m_pixf; const int8u* m_row_ptr; int m_x; WrapX m_wrap_x; WrapY m_wrap_y; }; //--------------------------------------------------------wrap_mode_repeat class wrap_mode_repeat { public: wrap_mode_repeat() {} wrap_mode_repeat(unsigned size) : m_size(size), m_add(size * (0x3FFFFFFF / size)), m_value(0) {} AGG_INLINE unsigned operator() (int v) { return m_value = (unsigned(v) + m_add) % m_size; } AGG_INLINE unsigned operator++ () { ++m_value; if(m_value >= m_size) m_value = 0; return m_value; } private: unsigned m_size; unsigned m_add; unsigned m_value; }; //---------------------------------------------------wrap_mode_repeat_pow2 class wrap_mode_repeat_pow2 { public: wrap_mode_repeat_pow2() {} wrap_mode_repeat_pow2(unsigned size) : m_value(0) { m_mask = 1; while(m_mask < size) m_mask = (m_mask << 1) | 1; m_mask >>= 1; } AGG_INLINE unsigned operator() (int v) { return m_value = unsigned(v) & m_mask; } AGG_INLINE unsigned operator++ () { ++m_value; if(m_value > m_mask) m_value = 0; return m_value; } private: unsigned m_mask; unsigned m_value; }; //----------------------------------------------wrap_mode_repeat_auto_pow2 class wrap_mode_repeat_auto_pow2 { public: wrap_mode_repeat_auto_pow2() {} wrap_mode_repeat_auto_pow2(unsigned size) : m_size(size), m_add(size * (0x3FFFFFFF / size)), m_mask((m_size & (m_size-1)) ? 0 : m_size-1), m_value(0) {} AGG_INLINE unsigned operator() (int v) { if(m_mask) return m_value = unsigned(v) & m_mask; return m_value = (unsigned(v) + m_add) % m_size; } AGG_INLINE unsigned operator++ () { ++m_value; if(m_value >= m_size) m_value = 0; return m_value; } private: unsigned m_size; unsigned m_add; unsigned m_mask; unsigned m_value; }; //-------------------------------------------------------wrap_mode_reflect class wrap_mode_reflect { public: wrap_mode_reflect() {} wrap_mode_reflect(unsigned size) : m_size(size), m_size2(size * 2), m_add(m_size2 * (0x3FFFFFFF / m_size2)), m_value(0) {} AGG_INLINE unsigned operator() (int v) { m_value = (unsigned(v) + m_add) % m_size2; if(m_value >= m_size) return m_size2 - m_value - 1; return m_value; } AGG_INLINE unsigned operator++ () { ++m_value; if(m_value >= m_size2) m_value = 0; if(m_value >= m_size) return m_size2 - m_value - 1; return m_value; } private: unsigned m_size; unsigned m_size2; unsigned m_add; unsigned m_value; }; //--------------------------------------------------wrap_mode_reflect_pow2 class wrap_mode_reflect_pow2 { public: wrap_mode_reflect_pow2() {} wrap_mode_reflect_pow2(unsigned size) : m_value(0) { m_mask = 1; m_size = 1; while(m_mask < size) { m_mask = (m_mask << 1) | 1; m_size <<= 1; } } AGG_INLINE unsigned operator() (int v) { m_value = unsigned(v) & m_mask; if(m_value >= m_size) return m_mask - m_value; return m_value; } AGG_INLINE unsigned operator++ () { ++m_value; m_value &= m_mask; if(m_value >= m_size) return m_mask - m_value; return m_value; } private: unsigned m_size; unsigned m_mask; unsigned m_value; }; //---------------------------------------------wrap_mode_reflect_auto_pow2 class wrap_mode_reflect_auto_pow2 { public: wrap_mode_reflect_auto_pow2() {} wrap_mode_reflect_auto_pow2(unsigned size) : m_size(size), m_size2(size * 2), m_add(m_size2 * (0x3FFFFFFF / m_size2)), m_mask((m_size2 & (m_size2-1)) ? 0 : m_size2-1), m_value(0) {} AGG_INLINE unsigned operator() (int v) { m_value = m_mask ? unsigned(v) & m_mask : (unsigned(v) + m_add) % m_size2; if(m_value >= m_size) return m_size2 - m_value - 1; return m_value; } AGG_INLINE unsigned operator++ () { ++m_value; if(m_value >= m_size2) m_value = 0; if(m_value >= m_size) return m_size2 - m_value - 1; return m_value; } private: unsigned m_size; unsigned m_size2; unsigned m_add; unsigned m_mask; unsigned m_value; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_conv_stroke.h0000644000175000017500000000622713233644505024330 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // conv_stroke // //---------------------------------------------------------------------------- #ifndef AGG_CONV_STROKE_INCLUDED #define AGG_CONV_STROKE_INCLUDED #include "agg_basics.h" #include "agg_vcgen_stroke.h" #include "agg_conv_adaptor_vcgen.h" namespace agg24 { //-------------------------------------------------------------conv_stroke template struct conv_stroke : public conv_adaptor_vcgen { typedef Markers marker_type; typedef conv_adaptor_vcgen base_type; conv_stroke(VertexSource& vs) : conv_adaptor_vcgen(vs) { } void line_cap(line_cap_e lc) { base_type::generator().line_cap(lc); } void line_join(line_join_e lj) { base_type::generator().line_join(lj); } void inner_join(inner_join_e ij) { base_type::generator().inner_join(ij); } line_cap_e line_cap() const { return base_type::generator().line_cap(); } line_join_e line_join() const { return base_type::generator().line_join(); } inner_join_e inner_join() const { return base_type::generator().inner_join(); } void width(double w) { base_type::generator().width(w); } void miter_limit(double ml) { base_type::generator().miter_limit(ml); } void miter_limit_theta(double t) { base_type::generator().miter_limit_theta(t); } void inner_miter_limit(double ml) { base_type::generator().inner_miter_limit(ml); } void approximation_scale(double as) { base_type::generator().approximation_scale(as); } double width() const { return base_type::generator().width(); } double miter_limit() const { return base_type::generator().miter_limit(); } double inner_miter_limit() const { return base_type::generator().inner_miter_limit(); } double approximation_scale() const { return base_type::generator().approximation_scale(); } void shorten(double s) { base_type::generator().shorten(s); } double shorten() const { return base_type::generator().shorten(); } private: conv_stroke(const conv_stroke&); const conv_stroke& operator = (const conv_stroke&); }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/include/agg_arrowhead.h0000644000175000017500000000454513233644505023751 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Simple arrowhead/arrowtail generator // //---------------------------------------------------------------------------- #ifndef AGG_ARROWHEAD_INCLUDED #define AGG_ARROWHEAD_INCLUDED #include "agg_basics.h" namespace agg24 { //===============================================================arrowhead // // See implementation agg_arrowhead.cpp // class arrowhead { public: arrowhead(); void head(double d1, double d2, double d3, double d4) { m_head_d1 = d1; m_head_d2 = d2; m_head_d3 = d3; m_head_d4 = d4; m_head_flag = true; } void head() { m_head_flag = true; } void no_head() { m_head_flag = false; } void tail(double d1, double d2, double d3, double d4) { m_tail_d1 = d1; m_tail_d2 = d2; m_tail_d3 = d3; m_tail_d4 = d4; m_tail_flag = true; } void tail() { m_tail_flag = true; } void no_tail() { m_tail_flag = false; } void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: double m_head_d1; double m_head_d2; double m_head_d3; double m_head_d4; double m_tail_d1; double m_tail_d2; double m_tail_d3; double m_tail_d4; bool m_head_flag; bool m_tail_flag; double m_coord[16]; unsigned m_cmd[8]; unsigned m_curr_id; unsigned m_curr_coord; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.CYGWIN_NT-5.00000644000175000017500000000021113233644505023312 0ustar varunvarunAGGLIBS= -lagg AGGCXXFLAGS = -O3 -I/usr/X11R6/include -L/usr/X11R6/lib CXX = g++ C = gcc #CXX = icc LIB = ar cr .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.BeOS0000644000175000017500000000013013233644505022201 0ustar varunvarunAGGLIBS= -lagg AGGCXXFLAGS = -O1 CXX = g++ C = cc LIB = ar -cru .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/font_freetype/0000755000175000017500000000000013544357576022242 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/font_freetype/agg_font_freetype.h0000644000175000017500000002053713233644505026073 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // See implementation agg_font_freetype.cpp // //---------------------------------------------------------------------------- #ifndef AGG_FONT_FREETYPE_INCLUDED #define AGG_FONT_FREETYPE_INCLUDED #include #include FT_FREETYPE_H #include "agg_scanline_storage_aa.h" #include "agg_scanline_storage_bin.h" #include "agg_scanline_u.h" #include "agg_scanline_bin.h" #include "agg_path_storage_integer.h" #include "agg_rasterizer_scanline_aa.h" #include "agg_conv_curve.h" #include "agg_font_cache_manager.h" #include "agg_trans_affine.h" namespace agg24 { //-----------------------------------------------font_engine_freetype_base class font_engine_freetype_base { public: //-------------------------------------------------------------------- typedef serialized_scanlines_adaptor_aa gray8_adaptor_type; typedef serialized_scanlines_adaptor_bin mono_adaptor_type; typedef scanline_storage_aa8 scanlines_aa_type; typedef scanline_storage_bin scanlines_bin_type; //-------------------------------------------------------------------- ~font_engine_freetype_base(); font_engine_freetype_base(bool flag32, unsigned max_faces = 32); // Set font parameters //-------------------------------------------------------------------- void resolution(unsigned dpi); bool load_font(const char* font_name, unsigned face_index, glyph_rendering ren_type, const char* font_mem = 0, const long font_mem_size = 0); bool attach(const char* file_name); bool char_map(FT_Encoding map); bool height(double h); bool width(double w); void hinting(bool h); void flip_y(bool f); void transform(const trans_affine& affine); // Set Gamma //-------------------------------------------------------------------- template void gamma(const GammaF& f) { m_rasterizer.gamma(f); } // Accessors //-------------------------------------------------------------------- int last_error() const { return m_last_error; } unsigned resolution() const { return m_resolution; } const char* name() const { return m_name; } unsigned num_faces() const; FT_Encoding char_map() const { return m_char_map; } double height() const { return double(m_height) / 64.0; } double width() const { return double(m_width) / 64.0; } double ascender() const; double descender() const; bool hinting() const { return m_hinting; } bool flip_y() const { return m_flip_y; } // Interface mandatory to implement for font_cache_manager //-------------------------------------------------------------------- const char* font_signature() const { return m_signature; } int change_stamp() const { return m_change_stamp; } bool prepare_glyph(unsigned glyph_code); unsigned glyph_index() const { return m_glyph_index; } unsigned data_size() const { return m_data_size; } glyph_data_type data_type() const { return m_data_type; } const rect_i& bounds() const { return m_bounds; } double advance_x() const { return m_advance_x; } double advance_y() const { return m_advance_y; } void write_glyph_to(int8u* data) const; bool add_kerning(unsigned first, unsigned second, double* x, double* y); private: font_engine_freetype_base(const font_engine_freetype_base&); const font_engine_freetype_base& operator = (const font_engine_freetype_base&); void update_char_size(); void update_signature(); int find_face(const char* face_name) const; bool m_flag32; int m_change_stamp; int m_last_error; char* m_name; unsigned m_name_len; unsigned m_face_index; FT_Encoding m_char_map; char* m_signature; unsigned m_height; unsigned m_width; bool m_hinting; bool m_flip_y; bool m_library_initialized; FT_Library m_library; // handle to library FT_Face* m_faces; // A pool of font faces char** m_face_names; unsigned m_num_faces; unsigned m_max_faces; FT_Face m_cur_face; // handle to the current face object int m_resolution; glyph_rendering m_glyph_rendering; unsigned m_glyph_index; unsigned m_data_size; glyph_data_type m_data_type; rect_i m_bounds; double m_advance_x; double m_advance_y; trans_affine m_affine; path_storage_integer m_path16; path_storage_integer m_path32; conv_curve > m_curves16; conv_curve > m_curves32; scanline_u8 m_scanline_aa; scanline_bin m_scanline_bin; scanlines_aa_type m_scanlines_aa; scanlines_bin_type m_scanlines_bin; rasterizer_scanline_aa<> m_rasterizer; }; //------------------------------------------------font_engine_freetype_int16 // This class uses values of type int16 (10.6 format) for the vector cache. // The vector cache is compact, but when rendering glyphs of height // more that 200 there integer overflow can occur. // class font_engine_freetype_int16 : public font_engine_freetype_base { public: typedef serialized_integer_path_adaptor path_adaptor_type; typedef font_engine_freetype_base::gray8_adaptor_type gray8_adaptor_type; typedef font_engine_freetype_base::mono_adaptor_type mono_adaptor_type; typedef font_engine_freetype_base::scanlines_aa_type scanlines_aa_type; typedef font_engine_freetype_base::scanlines_bin_type scanlines_bin_type; font_engine_freetype_int16(unsigned max_faces = 32) : font_engine_freetype_base(false, max_faces) {} }; //------------------------------------------------font_engine_freetype_int32 // This class uses values of type int32 (26.6 format) for the vector cache. // The vector cache is twice larger than in font_engine_freetype_int16, // but it allows you to render glyphs of very large sizes. // class font_engine_freetype_int32 : public font_engine_freetype_base { public: typedef serialized_integer_path_adaptor path_adaptor_type; typedef font_engine_freetype_base::gray8_adaptor_type gray8_adaptor_type; typedef font_engine_freetype_base::mono_adaptor_type mono_adaptor_type; typedef font_engine_freetype_base::scanlines_aa_type scanlines_aa_type; typedef font_engine_freetype_base::scanlines_bin_type scanlines_bin_type; font_engine_freetype_int32(unsigned max_faces = 32) : font_engine_freetype_base(true, max_faces) {} }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/font_freetype/Makefile.am0000644000175000017500000000055013233644505024260 0ustar varunvarun if ENABLE_FT aggincludedir = $(includedir)/agg2 agginclude_HEADERS = agg_font_freetype.h lib_LTLIBRARIES = libaggfontfreetype.la libaggfontfreetype_la_LDFLAGS = -version-info @AGG_LIB_VERSION@ @FREETYPE_LIBS@ libaggfontfreetype_la_SOURCES = agg_font_freetype.cpp libaggfontfreetype_la_CXXFLAGS = -I$(top_srcdir)/include @FREETYPE_CFLAGS@ endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/font_freetype/agg_font_freetype.cpp0000644000175000017500000012632213233644505026425 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include #include "agg_font_freetype.h" #include "agg_bitset_iterator.h" #include "agg_renderer_scanline.h" namespace agg24 { //------------------------------------------------------------------------------ // // This code implements the AUTODIN II polynomial // The variable corresponding to the macro argument "crc" should // be an unsigned long. // Oroginal code by Spencer Garrett // // generated using the AUTODIN II polynomial // x^32 + x^26 + x^23 + x^22 + x^16 + // x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1 // //------------------------------------------------------------------------------ static const unsigned crc32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, }; //------------------------------------------------------------------------------ static unsigned calc_crc32(const unsigned char* buf, unsigned size) { unsigned crc = (unsigned)~0; const unsigned char* p; unsigned len = 0; unsigned nr = size; for (len += nr, p = buf; nr--; ++p) { crc = (crc >> 8) ^ crc32tab[(crc ^ *p) & 0xff]; } return ~crc; } //------------------------------------------------------------------------ static inline int dbl_to_plain_fx(double d) { return int(d * 65536.0); } //------------------------------------------------------------------------ static inline double int26p6_to_dbl(int p) { return double(p) / 64.0; } //------------------------------------------------------------------------ static inline int dbl_to_int26p6(double p) { return int(p * 64.0 + 0.5); } //------------------------------------------------------------------------ template bool decompose_ft_outline(const FT_Outline& outline, bool flip_y, const trans_affine& mtx, PathStorage& path) { typedef typename PathStorage::value_type value_type; FT_Vector v_last; FT_Vector v_control; FT_Vector v_start; double x1, y1, x2, y2, x3, y3; FT_Vector* point; FT_Vector* limit; char* tags; int n; // index of contour in outline int first; // index of first point in contour char tag; // current point's state first = 0; for(n = 0; n < outline.n_contours; n++) { int last; // index of last point in contour last = outline.contours[n]; limit = outline.points + last; v_start = outline.points[first]; v_last = outline.points[last]; v_control = v_start; point = outline.points + first; tags = outline.tags + first; tag = FT_CURVE_TAG(tags[0]); // A contour cannot start with a cubic control point! if(tag == FT_CURVE_TAG_CUBIC) return false; // check first point to determine origin if( tag == FT_CURVE_TAG_CONIC) { // first point is conic control. Yes, this happens. if(FT_CURVE_TAG(outline.tags[last]) == FT_CURVE_TAG_ON) { // start at last point if it is on the curve v_start = v_last; limit--; } else { // if both first and last points are conic, // start at their middle and record its position // for closure v_start.x = (v_start.x + v_last.x) / 2; v_start.y = (v_start.y + v_last.y) / 2; v_last = v_start; } point--; tags--; } x1 = int26p6_to_dbl(v_start.x); y1 = int26p6_to_dbl(v_start.y); if(flip_y) y1 = -y1; mtx.transform(&x1, &y1); path.move_to(value_type(dbl_to_int26p6(x1)), value_type(dbl_to_int26p6(y1))); while(point < limit) { point++; tags++; tag = FT_CURVE_TAG(tags[0]); switch(tag) { case FT_CURVE_TAG_ON: // emit a single line_to { x1 = int26p6_to_dbl(point->x); y1 = int26p6_to_dbl(point->y); if(flip_y) y1 = -y1; mtx.transform(&x1, &y1); path.line_to(value_type(dbl_to_int26p6(x1)), value_type(dbl_to_int26p6(y1))); //path.line_to(conv(point->x), flip_y ? -conv(point->y) : conv(point->y)); continue; } case FT_CURVE_TAG_CONIC: // consume conic arcs { v_control.x = point->x; v_control.y = point->y; Do_Conic: if(point < limit) { FT_Vector vec; FT_Vector v_middle; point++; tags++; tag = FT_CURVE_TAG(tags[0]); vec.x = point->x; vec.y = point->y; if(tag == FT_CURVE_TAG_ON) { x1 = int26p6_to_dbl(v_control.x); y1 = int26p6_to_dbl(v_control.y); x2 = int26p6_to_dbl(vec.x); y2 = int26p6_to_dbl(vec.y); if(flip_y) { y1 = -y1; y2 = -y2; } mtx.transform(&x1, &y1); mtx.transform(&x2, &y2); path.curve3(value_type(dbl_to_int26p6(x1)), value_type(dbl_to_int26p6(y1)), value_type(dbl_to_int26p6(x2)), value_type(dbl_to_int26p6(y2))); continue; } if(tag != FT_CURVE_TAG_CONIC) return false; v_middle.x = (v_control.x + vec.x) / 2; v_middle.y = (v_control.y + vec.y) / 2; x1 = int26p6_to_dbl(v_control.x); y1 = int26p6_to_dbl(v_control.y); x2 = int26p6_to_dbl(v_middle.x); y2 = int26p6_to_dbl(v_middle.y); if(flip_y) { y1 = -y1; y2 = -y2; } mtx.transform(&x1, &y1); mtx.transform(&x2, &y2); path.curve3(value_type(dbl_to_int26p6(x1)), value_type(dbl_to_int26p6(y1)), value_type(dbl_to_int26p6(x2)), value_type(dbl_to_int26p6(y2))); //path.curve3(conv(v_control.x), // flip_y ? -conv(v_control.y) : conv(v_control.y), // conv(v_middle.x), // flip_y ? -conv(v_middle.y) : conv(v_middle.y)); v_control = vec; goto Do_Conic; } x1 = int26p6_to_dbl(v_control.x); y1 = int26p6_to_dbl(v_control.y); x2 = int26p6_to_dbl(v_start.x); y2 = int26p6_to_dbl(v_start.y); if(flip_y) { y1 = -y1; y2 = -y2; } mtx.transform(&x1, &y1); mtx.transform(&x2, &y2); path.curve3(value_type(dbl_to_int26p6(x1)), value_type(dbl_to_int26p6(y1)), value_type(dbl_to_int26p6(x2)), value_type(dbl_to_int26p6(y2))); //path.curve3(conv(v_control.x), // flip_y ? -conv(v_control.y) : conv(v_control.y), // conv(v_start.x), // flip_y ? -conv(v_start.y) : conv(v_start.y)); goto Close; } default: // FT_CURVE_TAG_CUBIC { FT_Vector vec1, vec2; if(point + 1 > limit || FT_CURVE_TAG(tags[1]) != FT_CURVE_TAG_CUBIC) { return false; } vec1.x = point[0].x; vec1.y = point[0].y; vec2.x = point[1].x; vec2.y = point[1].y; point += 2; tags += 2; if(point <= limit) { FT_Vector vec; vec.x = point->x; vec.y = point->y; x1 = int26p6_to_dbl(vec1.x); y1 = int26p6_to_dbl(vec1.y); x2 = int26p6_to_dbl(vec2.x); y2 = int26p6_to_dbl(vec2.y); x3 = int26p6_to_dbl(vec.x); y3 = int26p6_to_dbl(vec.y); if(flip_y) { y1 = -y1; y2 = -y2; y3 = -y3; } mtx.transform(&x1, &y1); mtx.transform(&x2, &y2); mtx.transform(&x3, &y3); path.curve4(value_type(dbl_to_int26p6(x1)), value_type(dbl_to_int26p6(y1)), value_type(dbl_to_int26p6(x2)), value_type(dbl_to_int26p6(y2)), value_type(dbl_to_int26p6(x3)), value_type(dbl_to_int26p6(y3))); //path.curve4(conv(vec1.x), // flip_y ? -conv(vec1.y) : conv(vec1.y), // conv(vec2.x), // flip_y ? -conv(vec2.y) : conv(vec2.y), // conv(vec.x), // flip_y ? -conv(vec.y) : conv(vec.y)); continue; } x1 = int26p6_to_dbl(vec1.x); y1 = int26p6_to_dbl(vec1.y); x2 = int26p6_to_dbl(vec2.x); y2 = int26p6_to_dbl(vec2.y); x3 = int26p6_to_dbl(v_start.x); y3 = int26p6_to_dbl(v_start.y); if(flip_y) { y1 = -y1; y2 = -y2; y3 = -y3; } mtx.transform(&x1, &y1); mtx.transform(&x2, &y2); mtx.transform(&x3, &y3); path.curve4(value_type(dbl_to_int26p6(x1)), value_type(dbl_to_int26p6(y1)), value_type(dbl_to_int26p6(x2)), value_type(dbl_to_int26p6(y2)), value_type(dbl_to_int26p6(x3)), value_type(dbl_to_int26p6(y3))); //path.curve4(conv(vec1.x), // flip_y ? -conv(vec1.y) : conv(vec1.y), // conv(vec2.x), // flip_y ? -conv(vec2.y) : conv(vec2.y), // conv(v_start.x), // flip_y ? -conv(v_start.y) : conv(v_start.y)); goto Close; } } } path.close_polygon(); Close: first = last + 1; } return true; } //------------------------------------------------------------------------ template void decompose_ft_bitmap_mono(const FT_Bitmap& bitmap, int x, int y, bool flip_y, Scanline& sl, ScanlineStorage& storage) { int i; const int8u* buf = (const int8u*)bitmap.buffer; int pitch = bitmap.pitch; sl.reset(x, x + bitmap.width); storage.prepare(); if(flip_y) { buf += bitmap.pitch * (bitmap.rows - 1); y += bitmap.rows; pitch = -pitch; } for(i = 0; i < bitmap.rows; i++) { sl.reset_spans(); bitset_iterator bits(buf, 0); int j; for(j = 0; j < bitmap.width; j++) { if(bits.bit()) sl.add_cell(x + j, cover_full); ++bits; } buf += pitch; if(sl.num_spans()) { sl.finalize(y - i - 1); storage.render(sl); } } } //------------------------------------------------------------------------ template void decompose_ft_bitmap_gray8(const FT_Bitmap& bitmap, int x, int y, bool flip_y, Rasterizer& ras, Scanline& sl, ScanlineStorage& storage) { int i, j; const int8u* buf = (const int8u*)bitmap.buffer; int pitch = bitmap.pitch; sl.reset(x, x + bitmap.width); storage.prepare(); if(flip_y) { buf += bitmap.pitch * (bitmap.rows - 1); y += bitmap.rows; pitch = -pitch; } for(i = 0; i < bitmap.rows; i++) { sl.reset_spans(); const int8u* p = buf; for(j = 0; j < bitmap.width; j++) { if(*p) sl.add_cell(x + j, ras.apply_gamma(*p)); ++p; } buf += pitch; if(sl.num_spans()) { sl.finalize(y - i - 1); storage.render(sl); } } } //------------------------------------------------------------------------ font_engine_freetype_base::~font_engine_freetype_base() { unsigned i; for(i = 0; i < m_num_faces; ++i) { delete [] m_face_names[i]; FT_Done_Face(m_faces[i]); } delete [] m_face_names; delete [] m_faces; delete [] m_signature; if(m_library_initialized) FT_Done_FreeType(m_library); } //------------------------------------------------------------------------ font_engine_freetype_base::font_engine_freetype_base(bool flag32, unsigned max_faces) : m_flag32(flag32), m_change_stamp(0), m_last_error(0), m_name(0), m_name_len(256-16-1), m_face_index(0), m_char_map(FT_ENCODING_NONE), m_signature(new char [256+256-16]), m_height(0), m_width(0), m_hinting(true), m_flip_y(false), m_library_initialized(false), m_library(0), m_faces(new FT_Face [max_faces]), m_face_names(new char* [max_faces]), m_num_faces(0), m_max_faces(max_faces), m_cur_face(0), m_resolution(0), m_glyph_rendering(glyph_ren_native_gray8), m_glyph_index(0), m_data_size(0), m_data_type(glyph_data_invalid), m_bounds(1,1,0,0), m_advance_x(0.0), m_advance_y(0.0), m_path16(), m_path32(), m_curves16(m_path16), m_curves32(m_path32), m_scanline_aa(), m_scanline_bin(), m_scanlines_aa(), m_scanlines_bin(), m_rasterizer() { m_curves16.approximation_scale(4.0); m_curves32.approximation_scale(4.0); m_last_error = FT_Init_FreeType(&m_library); if(m_last_error == 0) m_library_initialized = true; } //------------------------------------------------------------------------ void font_engine_freetype_base::resolution(unsigned dpi) { m_resolution = dpi; update_char_size(); } //------------------------------------------------------------------------ int font_engine_freetype_base::find_face(const char* face_name) const { unsigned i; for(i = 0; i < m_num_faces; ++i) { if(strcmp(face_name, m_face_names[i]) == 0) return i; } return -1; } //------------------------------------------------------------------------ double font_engine_freetype_base::ascender() const { if(m_cur_face) { return m_cur_face->ascender * height() / m_cur_face->height; } return 0.0; } //------------------------------------------------------------------------ double font_engine_freetype_base::descender() const { if(m_cur_face) { return m_cur_face->descender * height() / m_cur_face->height; } return 0.0; } //------------------------------------------------------------------------ bool font_engine_freetype_base::load_font(const char* font_name, unsigned face_index, glyph_rendering ren_type, const char* font_mem, const long font_mem_size) { bool ret = false; if(m_library_initialized) { m_last_error = 0; int idx = find_face(font_name); if(idx >= 0) { m_cur_face = m_faces[idx]; m_name = m_face_names[idx]; } else { if(m_num_faces >= m_max_faces) { delete [] m_face_names[0]; FT_Done_Face(m_faces[0]); memcpy(m_faces, m_faces + 1, (m_max_faces - 1) * sizeof(FT_Face)); memcpy(m_face_names, m_face_names + 1, (m_max_faces - 1) * sizeof(char*)); m_num_faces = m_max_faces - 1; } if (font_mem && font_mem_size) { m_last_error = FT_New_Memory_Face(m_library, (const FT_Byte*)font_mem, font_mem_size, face_index, &m_faces[m_num_faces]); } else { m_last_error = FT_New_Face(m_library, font_name, face_index, &m_faces[m_num_faces]); } if(m_last_error == 0) { m_face_names[m_num_faces] = new char [strlen(font_name) + 1]; strcpy(m_face_names[m_num_faces], font_name); m_cur_face = m_faces[m_num_faces]; m_name = m_face_names[m_num_faces]; ++m_num_faces; } else { m_face_names[m_num_faces] = 0; m_cur_face = 0; m_name = 0; } } if(m_last_error == 0) { ret = true; switch(ren_type) { case glyph_ren_native_mono: m_glyph_rendering = glyph_ren_native_mono; break; case glyph_ren_native_gray8: m_glyph_rendering = glyph_ren_native_gray8; break; case glyph_ren_outline: if(FT_IS_SCALABLE(m_cur_face)) { m_glyph_rendering = glyph_ren_outline; } else { m_glyph_rendering = glyph_ren_native_gray8; } break; case glyph_ren_agg_mono: if(FT_IS_SCALABLE(m_cur_face)) { m_glyph_rendering = glyph_ren_agg_mono; } else { m_glyph_rendering = glyph_ren_native_mono; } break; case glyph_ren_agg_gray8: if(FT_IS_SCALABLE(m_cur_face)) { m_glyph_rendering = glyph_ren_agg_gray8; } else { m_glyph_rendering = glyph_ren_native_gray8; } break; } update_signature(); } } return ret; } //------------------------------------------------------------------------ bool font_engine_freetype_base::attach(const char* file_name) { if(m_cur_face) { m_last_error = FT_Attach_File(m_cur_face, file_name); return m_last_error == 0; } return false; } //------------------------------------------------------------------------ unsigned font_engine_freetype_base::num_faces() const { if(m_cur_face) { return m_cur_face->num_faces; } return 0; } //------------------------------------------------------------------------ bool font_engine_freetype_base::char_map(FT_Encoding char_map) { if(m_cur_face) { m_last_error = FT_Select_Charmap(m_cur_face, m_char_map); if(m_last_error == 0) { update_signature(); return true; } } return false; } //------------------------------------------------------------------------ bool font_engine_freetype_base::height(double h) { m_height = int(h * 64.0); if(m_cur_face) { update_char_size(); return true; } return false; } //------------------------------------------------------------------------ bool font_engine_freetype_base::width(double w) { m_width = int(w * 64.0); if(m_cur_face) { update_char_size(); return true; } return false; } //------------------------------------------------------------------------ void font_engine_freetype_base::hinting(bool h) { m_hinting = h; if(m_cur_face) { update_signature(); } } //------------------------------------------------------------------------ void font_engine_freetype_base::flip_y(bool f) { m_flip_y = f; if(m_cur_face) { update_signature(); } } //------------------------------------------------------------------------ void font_engine_freetype_base::transform(const trans_affine& affine) { m_affine = affine; if(m_cur_face) { update_signature(); } } //------------------------------------------------------------------------ void font_engine_freetype_base::update_signature() { if(m_cur_face && m_name) { unsigned name_len = strlen(m_name); if(name_len > m_name_len) { delete [] m_signature; m_signature = new char [name_len + 32 + 256]; m_name_len = name_len + 32 - 1; } unsigned gamma_hash = 0; if(m_glyph_rendering == glyph_ren_native_gray8 || m_glyph_rendering == glyph_ren_agg_mono || m_glyph_rendering == glyph_ren_agg_gray8) { unsigned char gamma_table[rasterizer_scanline_aa<>::aa_scale]; unsigned i; for(i = 0; i < rasterizer_scanline_aa<>::aa_scale; ++i) { gamma_table[i] = m_rasterizer.apply_gamma(i); } gamma_hash = calc_crc32(gamma_table, sizeof(gamma_table)); } sprintf(m_signature, "%s,%u,%d,%d,%d:%dx%d,%d,%d,%08X", m_name, m_char_map, m_face_index, int(m_glyph_rendering), m_resolution, m_height, m_width, int(m_hinting), int(m_flip_y), gamma_hash); if(m_glyph_rendering == glyph_ren_outline || m_glyph_rendering == glyph_ren_agg_mono || m_glyph_rendering == glyph_ren_agg_gray8) { double mtx[6]; char buf[100]; m_affine.store_to(mtx); sprintf(buf, ",%08X%08X%08X%08X%08X%08X", dbl_to_plain_fx(mtx[0]), dbl_to_plain_fx(mtx[1]), dbl_to_plain_fx(mtx[2]), dbl_to_plain_fx(mtx[3]), dbl_to_plain_fx(mtx[4]), dbl_to_plain_fx(mtx[5])); strcat(m_signature, buf); } ++m_change_stamp; } } //------------------------------------------------------------------------ void font_engine_freetype_base::update_char_size() { if(m_cur_face) { if(m_resolution) { FT_Set_Char_Size(m_cur_face, m_width, // char_width in 1/64th of points m_height, // char_height in 1/64th of points m_resolution, // horizontal device resolution m_resolution); // vertical device resolution } else { FT_Set_Pixel_Sizes(m_cur_face, m_width >> 6, // pixel_width m_height >> 6); // pixel_height } update_signature(); } } //------------------------------------------------------------------------ bool font_engine_freetype_base::prepare_glyph(unsigned glyph_code) { m_glyph_index = FT_Get_Char_Index(m_cur_face, glyph_code); m_last_error = FT_Load_Glyph(m_cur_face, m_glyph_index, m_hinting ? FT_LOAD_DEFAULT : FT_LOAD_NO_HINTING); // m_hinting ? FT_LOAD_FORCE_AUTOHINT : FT_LOAD_NO_HINTING); if(m_last_error == 0) { switch(m_glyph_rendering) { case glyph_ren_native_mono: m_last_error = FT_Render_Glyph(m_cur_face->glyph, FT_RENDER_MODE_MONO); if(m_last_error == 0) { decompose_ft_bitmap_mono(m_cur_face->glyph->bitmap, m_cur_face->glyph->bitmap_left, m_flip_y ? -m_cur_face->glyph->bitmap_top : m_cur_face->glyph->bitmap_top, m_flip_y, m_scanline_bin, m_scanlines_bin); m_bounds.x1 = m_scanlines_bin.min_x(); m_bounds.y1 = m_scanlines_bin.min_y(); m_bounds.x2 = m_scanlines_bin.max_x() + 1; m_bounds.y2 = m_scanlines_bin.max_y() + 1; m_data_size = m_scanlines_bin.byte_size(); m_data_type = glyph_data_mono; m_advance_x = int26p6_to_dbl(m_cur_face->glyph->advance.x); m_advance_y = int26p6_to_dbl(m_cur_face->glyph->advance.y); return true; } break; case glyph_ren_native_gray8: m_last_error = FT_Render_Glyph(m_cur_face->glyph, FT_RENDER_MODE_NORMAL); if(m_last_error == 0) { decompose_ft_bitmap_gray8(m_cur_face->glyph->bitmap, m_cur_face->glyph->bitmap_left, m_flip_y ? -m_cur_face->glyph->bitmap_top : m_cur_face->glyph->bitmap_top, m_flip_y, m_rasterizer, m_scanline_aa, m_scanlines_aa); m_bounds.x1 = m_scanlines_aa.min_x(); m_bounds.y1 = m_scanlines_aa.min_y(); m_bounds.x2 = m_scanlines_aa.max_x() + 1; m_bounds.y2 = m_scanlines_aa.max_y() + 1; m_data_size = m_scanlines_aa.byte_size(); m_data_type = glyph_data_gray8; m_advance_x = int26p6_to_dbl(m_cur_face->glyph->advance.x); m_advance_y = int26p6_to_dbl(m_cur_face->glyph->advance.y); return true; } break; case glyph_ren_outline: if(m_last_error == 0) { if(m_flag32) { m_path32.remove_all(); if(decompose_ft_outline(m_cur_face->glyph->outline, m_flip_y, m_affine, m_path32)) { rect_d bnd = m_path32.bounding_rect(); m_data_size = m_path32.byte_size(); m_data_type = glyph_data_outline; m_bounds.x1 = int(floor(bnd.x1)); m_bounds.y1 = int(floor(bnd.y1)); m_bounds.x2 = int(ceil(bnd.x2)); m_bounds.y2 = int(ceil(bnd.y2)); m_advance_x = int26p6_to_dbl(m_cur_face->glyph->advance.x); m_advance_y = int26p6_to_dbl(m_cur_face->glyph->advance.y); m_affine.transform(&m_advance_x, &m_advance_y); return true; } } else { m_path16.remove_all(); if(decompose_ft_outline(m_cur_face->glyph->outline, m_flip_y, m_affine, m_path16)) { rect_d bnd = m_path16.bounding_rect(); m_data_size = m_path16.byte_size(); m_data_type = glyph_data_outline; m_bounds.x1 = int(floor(bnd.x1)); m_bounds.y1 = int(floor(bnd.y1)); m_bounds.x2 = int(ceil(bnd.x2)); m_bounds.y2 = int(ceil(bnd.y2)); m_advance_x = int26p6_to_dbl(m_cur_face->glyph->advance.x); m_advance_y = int26p6_to_dbl(m_cur_face->glyph->advance.y); m_affine.transform(&m_advance_x, &m_advance_y); return true; } } } return false; case glyph_ren_agg_mono: if(m_last_error == 0) { m_rasterizer.reset(); if(m_flag32) { m_path32.remove_all(); decompose_ft_outline(m_cur_face->glyph->outline, m_flip_y, m_affine, m_path32); m_rasterizer.add_path(m_curves32); } else { m_path16.remove_all(); decompose_ft_outline(m_cur_face->glyph->outline, m_flip_y, m_affine, m_path16); m_rasterizer.add_path(m_curves16); } m_scanlines_bin.prepare(); // Remove all render_scanlines(m_rasterizer, m_scanline_bin, m_scanlines_bin); m_bounds.x1 = m_scanlines_bin.min_x(); m_bounds.y1 = m_scanlines_bin.min_y(); m_bounds.x2 = m_scanlines_bin.max_x() + 1; m_bounds.y2 = m_scanlines_bin.max_y() + 1; m_data_size = m_scanlines_bin.byte_size(); m_data_type = glyph_data_mono; m_advance_x = int26p6_to_dbl(m_cur_face->glyph->advance.x); m_advance_y = int26p6_to_dbl(m_cur_face->glyph->advance.y); m_affine.transform(&m_advance_x, &m_advance_y); return true; } return false; case glyph_ren_agg_gray8: if(m_last_error == 0) { m_rasterizer.reset(); if(m_flag32) { m_path32.remove_all(); decompose_ft_outline(m_cur_face->glyph->outline, m_flip_y, m_affine, m_path32); m_rasterizer.add_path(m_curves32); } else { m_path16.remove_all(); decompose_ft_outline(m_cur_face->glyph->outline, m_flip_y, m_affine, m_path16); m_rasterizer.add_path(m_curves16); } m_scanlines_aa.prepare(); // Remove all render_scanlines(m_rasterizer, m_scanline_aa, m_scanlines_aa); m_bounds.x1 = m_scanlines_aa.min_x(); m_bounds.y1 = m_scanlines_aa.min_y(); m_bounds.x2 = m_scanlines_aa.max_x() + 1; m_bounds.y2 = m_scanlines_aa.max_y() + 1; m_data_size = m_scanlines_aa.byte_size(); m_data_type = glyph_data_gray8; m_advance_x = int26p6_to_dbl(m_cur_face->glyph->advance.x); m_advance_y = int26p6_to_dbl(m_cur_face->glyph->advance.y); m_affine.transform(&m_advance_x, &m_advance_y); return true; } return false; } } return false; } //------------------------------------------------------------------------ void font_engine_freetype_base::write_glyph_to(int8u* data) const { if(data && m_data_size) { switch(m_data_type) { default: return; case glyph_data_mono: m_scanlines_bin.serialize(data); break; case glyph_data_gray8: m_scanlines_aa.serialize(data); break; case glyph_data_outline: if(m_flag32) { m_path32.serialize(data); } else { m_path16.serialize(data); } break; case glyph_data_invalid: break; } } } //------------------------------------------------------------------------ bool font_engine_freetype_base::add_kerning(unsigned first, unsigned second, double* x, double* y) { if(m_cur_face && first && second && FT_HAS_KERNING(m_cur_face)) { FT_Vector delta; FT_Get_Kerning(m_cur_face, first, second, FT_KERNING_DEFAULT, &delta); double dx = int26p6_to_dbl(delta.x); double dy = int26p6_to_dbl(delta.y); if(m_glyph_rendering == glyph_ren_outline || m_glyph_rendering == glyph_ren_agg_mono || m_glyph_rendering == glyph_ren_agg_gray8) { m_affine.transform_2x2(&dx, &dy); } *x += dx; *y += dy; return true; } return false; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.am0000644000175000017500000000115413233644505021410 0ustar varunvarunSUBDIRS = gpc src font_freetype font_win32_tt include examples pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libagg.pc EXTRA_DIST = Makefile.AmigaOS \ Makefile.in.BeOS \ Makefile.in.CYGWIN_NT-5.0 \ Makefile.in.CYGWIN_NT-5.1 \ Makefile.in.Darwin \ Makefile.in.Darwin.SDL \ Makefile.in.IRIX64 \ Makefile.in.Linux \ Makefile.in.Linux.SDL \ Makefile.in.MINGW32_NT-5.0 \ Makefile.in.MINGW32_NT-5.1 \ Makefile.in.SunOS # M4 macro file for inclusion with autoconf m4datadir = $(datadir)/aclocal m4data_DATA = libagg.m4 enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.MINGW32_NT-5.10000644000175000017500000000014313233644505023345 0ustar varunvarunAGGLIBS= -lagg AGGCXXFLAGS = -O3 CXX = g++ C = gcc #CXX = icc LIB = ar cr .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/distclean0000644000175000017500000000155013233644505021245 0ustar varunvarun#! /bin/sh find . -iname '*.[oa]' -exec \rm -f {} \; find . -iname '*.ppm' -exec \rm -f {} \; find . -iname '*~' -exec \rm -f {} \; find . -iname 'gamma.*' -exec \rm -f {} \; find . -iname Debug -exec \rm -rf {} \; find . -iname Release -exec \rm -rf {} \; find . -iname '*.exe' -exec \rm -rf {} \; find . -iname '*.lib' -exec \rm -rf {} \; find . -iname '*.dll' -exec \rm -rf {} \; find . -iname '*.obj' -exec \rm -rf {} \; find . -iname '*.aps' -exec \rm -rf {} \; find . -iname '*.clw' -exec \rm -rf {} \; find . -iname '*.ilk' -exec \rm -rf {} \; find . -iname '*.ncb' -exec \rm -rf {} \; find . -iname '*.opt' -exec \rm -rf {} \; find . -iname '*.plg' -exec \rm -rf {} \; find . -iname '*.pch' -exec \rm -rf {} \; find . -iname '*.idb' -exec \rm -rf {} \; find . -iname '*.pdb' -exec \rm -rf {} \; find . -iname '*.res' -exec \rm -rf {} \; enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.SunOS0000644000175000017500000000020413233644505022422 0ustar varunvarunAGGLIBS= -lagg AGGCXXFLAGS = -O3 -I/usr/openwin/include -L/usr/openwin/lib CXX = CC C = cc LIB = CC -xar -o .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/news0000644000175000017500000000003713233644505020252 0ustar varunvarunVisit http://antigrain.com/newsenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/autogen.sh0000644000175000017500000000055513233644505021356 0ustar varunvarun# autogen.sh # # invoke the auto* tools to create the configuration/build system # build aclocal.m4 aclocal # build config.h autoheader # build the configure script autoconf # set up libtool libtoolize --force # invoke automake automake --foreign --add-missing --ignore-deps # and finally invoke our new configure ./configure $* # end enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.MINGW32_NT-5.00000644000175000017500000000014313233644505023344 0ustar varunvarunAGGLIBS= -lagg AGGCXXFLAGS = -O3 CXX = g++ C = gcc #CXX = icc LIB = ar cr .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/ChangeLog0000644000175000017500000000003713233644505021125 0ustar varunvarunVisit http://antigrain.com/newsenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/install0000644000175000017500000000342313233644505020746 0ustar varunvarunAnti-Grain Geometry is a C++ library distributed in sources and does not require any installation procedure. The source code is platform independent and does not have any dependencies on system APIs (except for very standard C runtime library). You just take source files and include them into your project. The sources are maintained to be highly compatible with most popular C++ compilers, including poor ones, like Microsoft Visual C++ V6.0. On Unix/Linux/MacOS/BeOS/AmigaOS systems you can type "make" to build src/libagg.a There must be GNU Make utility installed. Makefiles are very simple, so that if something goes wrong you could easily fix it. There are no "include files" dependency suppoeted. Also note that there's no "make install" option either; basically the original Makefiles are needed only to build the examples. After building the library you do "cd examples/" and build the examples in a similar way. On most Linux platforms the "automake" environment should work. It's generously provided by Nikolas Zimmermann, aka WildFox, who is a key developer of KDE and KSVG. This process will replace the original Makefiles. On Windows there's no library or a DLL created at all. You just add source files into your project or create a preoject to build a LIB/DLL if you wish. The problem is that it's very tedious to maintain building environments for all possible configurations. I'm sorry for not automating it, but the compensation is that AGG compiles fine without any hidden problems, nor the neccesity to configure. All examples have building environments for Microsoft Visual C++ 6.0 (.dsp/.dsw) and they are self-sufficient. The newer versions of the studio can easily convert the projects. Also, see "readme" for more details.enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.Linux0000644000175000017500000000021113233644505022510 0ustar varunvarunAGGLIBS= -lagg AGGCXXFLAGS = -O3 -I/usr/X11R6/include -L/usr/X11R6/lib CXX = g++ C = gcc #CXX = icc LIB = ar cr .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/Makefile.in.CYGWIN_NT-5.10000644000175000017500000000021113233644505023313 0ustar varunvarunAGGLIBS= -lagg AGGCXXFLAGS = -O3 -I/usr/X11R6/include -L/usr/X11R6/lib CXX = g++ C = gcc #CXX = icc LIB = ar cr .PHONY : clean enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/0000755000175000017500000000000013544357603020147 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_arc.cpp0000644000175000017500000000626513233644505022242 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Arc vertex generator // //---------------------------------------------------------------------------- #include #include "agg_arc.h" namespace agg24 { //------------------------------------------------------------------------ arc::arc(double x, double y, double rx, double ry, double a1, double a2, bool ccw) : m_x(x), m_y(y), m_rx(rx), m_ry(ry), m_scale(1.0) { normalize(a1, a2, ccw); } //------------------------------------------------------------------------ void arc::init(double x, double y, double rx, double ry, double a1, double a2, bool ccw) { m_x = x; m_y = y; m_rx = rx; m_ry = ry; normalize(a1, a2, ccw); } //------------------------------------------------------------------------ void arc::approximation_scale(double s) { m_scale = s; if(m_initialized) { normalize(m_start, m_end, m_ccw); } } //------------------------------------------------------------------------ void arc::rewind(unsigned) { m_path_cmd = path_cmd_move_to; m_angle = m_start; } //------------------------------------------------------------------------ unsigned arc::vertex(double* x, double* y) { if(is_stop(m_path_cmd)) return path_cmd_stop; if((m_angle < m_end - m_da/4) != m_ccw) { *x = m_x + cos(m_end) * m_rx; *y = m_y + sin(m_end) * m_ry; m_path_cmd = path_cmd_stop; return path_cmd_line_to; } *x = m_x + cos(m_angle) * m_rx; *y = m_y + sin(m_angle) * m_ry; m_angle += m_da; unsigned pf = m_path_cmd; m_path_cmd = path_cmd_line_to; return pf; } //------------------------------------------------------------------------ void arc::normalize(double a1, double a2, bool ccw) { double ra = (fabs(m_rx) + fabs(m_ry)) / 2; m_da = acos(ra / (ra + 0.125 / m_scale)) * 2; if(ccw) { while(a2 < a1) a2 += pi * 2.0; } else { while(a1 < a2) a1 += pi * 2.0; m_da = -m_da; } m_ccw = ccw; m_start = a1; m_end = a2; m_initialized = true; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/Makefile0000644000175000017500000000237313233644505021607 0ustar varunvaruninclude ../Makefile.in.$(shell uname) CXXFLAGS= $(AGGCXXFLAGS) -I../include -L./ SRC_CXX=\ agg_arc.cpp \ agg_arrowhead.cpp \ agg_bezier_arc.cpp \ agg_bspline.cpp \ agg_curves.cpp \ agg_vcgen_contour.cpp \ agg_vcgen_dash.cpp \ agg_vcgen_markers_term.cpp \ agg_vcgen_smooth_poly1.cpp \ agg_vcgen_stroke.cpp \ agg_vcgen_bspline.cpp \ agg_gsv_text.cpp \ agg_image_filters.cpp \ agg_line_aa_basics.cpp \ agg_line_profile_aa.cpp \ agg_rounded_rect.cpp \ agg_sqrt_tables.cpp \ agg_embedded_raster_fonts.cpp \ agg_trans_affine.cpp \ agg_trans_warp_magnifier.cpp \ agg_trans_single_path.cpp \ agg_trans_double_path.cpp \ agg_vpgen_clip_polygon.cpp \ agg_vpgen_clip_polyline.cpp \ agg_vpgen_segmentator.cpp \ ctrl/agg_cbox_ctrl.cpp \ ctrl/agg_gamma_ctrl.cpp \ ctrl/agg_gamma_spline.cpp \ ctrl/agg_rbox_ctrl.cpp \ ctrl/agg_slider_ctrl.cpp \ ctrl/agg_spline_ctrl.cpp \ ctrl/agg_scale_ctrl.cpp \ ctrl/agg_polygon_ctrl.cpp \ ctrl/agg_bezier_ctrl.cpp SRC_C=\ ../gpc/gpc.c OBJ=$(SRC_CXX:.cpp=.o) $(SRC_C:.c=.o) all: $(OBJ) $(LIB) libagg.a $(OBJ) clean: rm -f *.o *.a ctrl/*.o ../gpc/*.o rm -rf SunWS_cache rm -rf ctrl/SunWS_cache %.o: %.cpp $(CXX) -c $(CXXFLAGS) $*.cpp -o $@ %.o: %.c $(C) -c $(CXXFLAGS) $*.c -o $@ enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_line_profile_aa.cpp0000644000175000017500000000711213233644505024575 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include "agg_renderer_outline_aa.h" namespace agg24 { //--------------------------------------------------------------------- void line_profile_aa::width(double w) { if(w < 0.0) w = 0.0; if(w < m_smoother_width) w += w; else w += m_smoother_width; w *= 0.5; w -= m_smoother_width; double s = m_smoother_width; if(w < 0.0) { s += w; w = 0.0; } set(w, s); } //--------------------------------------------------------------------- line_profile_aa::value_type* line_profile_aa::profile(double w) { m_subpixel_width = uround(w * subpixel_scale); unsigned size = m_subpixel_width + subpixel_scale * 6; if(size > m_profile.size()) { m_profile.resize(size); } return &m_profile[0]; } //--------------------------------------------------------------------- void line_profile_aa::set(double center_width, double smoother_width) { double base_val = 1.0; if(center_width == 0.0) center_width = 1.0 / subpixel_scale; if(smoother_width == 0.0) smoother_width = 1.0 / subpixel_scale; double width = center_width + smoother_width; if(width < m_min_width) { double k = width / m_min_width; base_val *= k; center_width /= k; smoother_width /= k; } value_type* ch = profile(center_width + smoother_width); unsigned subpixel_center_width = unsigned(center_width * subpixel_scale); unsigned subpixel_smoother_width = unsigned(smoother_width * subpixel_scale); value_type* ch_center = ch + subpixel_scale*2; value_type* ch_smoother = ch_center + subpixel_center_width; unsigned i; unsigned val = m_gamma[unsigned(base_val * aa_mask)]; ch = ch_center; for(i = 0; i < subpixel_center_width; i++) { *ch++ = (value_type)val; } for(i = 0; i < subpixel_smoother_width; i++) { *ch_smoother++ = m_gamma[unsigned((base_val - base_val * (double(i) / subpixel_smoother_width)) * aa_mask)]; } unsigned n_smoother = profile_size() - subpixel_smoother_width - subpixel_center_width - subpixel_scale*2; val = m_gamma[0]; for(i = 0; i < n_smoother; i++) { *ch_smoother++ = (value_type)val; } ch = ch_center; for(i = 0; i < subpixel_scale*2; i++) { *--ch = *ch_center++; } } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_vpgen_clip_polygon.cpp0000644000175000017500000000745213233644505025371 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include "agg_vpgen_clip_polygon.h" #include "agg_clip_liang_barsky.h" namespace agg24 { //------------------------------------------------------------------------ // Determine the clipping code of the vertex according to the // Cyrus-Beck line clipping algorithm // // | | // 0110 | 0010 | 0011 // | | // -------+--------+-------- clip_box.y2 // | | // 0100 | 0000 | 0001 // | | // -------+--------+-------- clip_box.y1 // | | // 1100 | 1000 | 1001 // | | // clip_box.x1 clip_box.x2 // // unsigned vpgen_clip_polygon::clipping_flags(double x, double y) { if(x < m_clip_box.x1) { if(y > m_clip_box.y2) return 6; if(y < m_clip_box.y1) return 12; return 4; } if(x > m_clip_box.x2) { if(y > m_clip_box.y2) return 3; if(y < m_clip_box.y1) return 9; return 1; } if(y > m_clip_box.y2) return 2; if(y < m_clip_box.y1) return 8; return 0; } //---------------------------------------------------------------------------- void vpgen_clip_polygon::reset() { m_vertex = 0; m_num_vertices = 0; } //---------------------------------------------------------------------------- void vpgen_clip_polygon::move_to(double x, double y) { m_vertex = 0; m_num_vertices = 0; m_clip_flags = clipping_flags(x, y); if(m_clip_flags == 0) { m_x[0] = x; m_y[0] = y; m_num_vertices = 1; } m_x1 = x; m_y1 = y; m_cmd = path_cmd_move_to; } //---------------------------------------------------------------------------- void vpgen_clip_polygon::line_to(double x, double y) { m_vertex = 0; m_num_vertices = 0; unsigned flags = clipping_flags(x, y); if(m_clip_flags == flags) { if(flags == 0) { m_x[0] = x; m_y[0] = y; m_num_vertices = 1; } } else { m_num_vertices = clip_liang_barsky(m_x1, m_y1, x, y, m_clip_box, m_x, m_y); } m_clip_flags = flags; m_x1 = x; m_y1 = y; } //---------------------------------------------------------------------------- unsigned vpgen_clip_polygon::vertex(double* x, double* y) { if(m_vertex < m_num_vertices) { *x = m_x[m_vertex]; *y = m_y[m_vertex]; ++m_vertex; unsigned cmd = m_cmd; m_cmd = path_cmd_line_to; return cmd; } return path_cmd_stop; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_trans_affine.cpp0000644000175000017500000001437313233644505024133 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Affine transformations // //---------------------------------------------------------------------------- #include "agg_trans_affine.h" namespace agg24 { //------------------------------------------------------------------------ const trans_affine& trans_affine::parl_to_parl(const double* src, const double* dst) { sx = src[2] - src[0]; shy = src[3] - src[1]; shx = src[4] - src[0]; sy = src[5] - src[1]; tx = src[0]; ty = src[1]; invert(); multiply(trans_affine(dst[2] - dst[0], dst[3] - dst[1], dst[4] - dst[0], dst[5] - dst[1], dst[0], dst[1])); return *this; } //------------------------------------------------------------------------ const trans_affine& trans_affine::rect_to_parl(double x1, double y1, double x2, double y2, const double* parl) { double src[6]; src[0] = x1; src[1] = y1; src[2] = x2; src[3] = y1; src[4] = x2; src[5] = y2; parl_to_parl(src, parl); return *this; } //------------------------------------------------------------------------ const trans_affine& trans_affine::parl_to_rect(const double* parl, double x1, double y1, double x2, double y2) { double dst[6]; dst[0] = x1; dst[1] = y1; dst[2] = x2; dst[3] = y1; dst[4] = x2; dst[5] = y2; parl_to_parl(parl, dst); return *this; } //------------------------------------------------------------------------ const trans_affine& trans_affine::multiply(const trans_affine& m) { double t0 = sx * m.sx + shy * m.shx; double t2 = shx * m.sx + sy * m.shx; double t4 = tx * m.sx + ty * m.shx + m.tx; shy = sx * m.shy + shy * m.sy; sy = shx * m.shy + sy * m.sy; ty = tx * m.shy + ty * m.sy + m.ty; sx = t0; shx = t2; tx = t4; return *this; } //------------------------------------------------------------------------ const trans_affine& trans_affine::invert() { double d = determinant_reciprocal(); double t0 = sy * d; sy = sx * d; shy = -shy * d; shx = -shx * d; double t4 = -tx * t0 - ty * shx; ty = -tx * shy - ty * sy; sx = t0; tx = t4; return *this; } //------------------------------------------------------------------------ const trans_affine& trans_affine::flip_x() { sx = -sx; shy = -shy; tx = -tx; return *this; } //------------------------------------------------------------------------ const trans_affine& trans_affine::flip_y() { shx = -shx; sy = -sy; ty = -ty; return *this; } //------------------------------------------------------------------------ const trans_affine& trans_affine::reset() { sx = sy = 1.0; shy = shx = tx = ty = 0.0; return *this; } //------------------------------------------------------------------------ bool trans_affine::is_identity(double epsilon) const { return is_equal_eps(sx, 1.0, epsilon) && is_equal_eps(shy, 0.0, epsilon) && is_equal_eps(shx, 0.0, epsilon) && is_equal_eps(sy, 1.0, epsilon) && is_equal_eps(tx, 0.0, epsilon) && is_equal_eps(ty, 0.0, epsilon); } //------------------------------------------------------------------------ bool trans_affine::is_valid(double epsilon) const { return fabs(sx) > epsilon && fabs(sy) > epsilon; } //------------------------------------------------------------------------ bool trans_affine::is_equal(const trans_affine& m, double epsilon) const { return is_equal_eps(sx, m.sx, epsilon) && is_equal_eps(shy, m.shy, epsilon) && is_equal_eps(shx, m.shx, epsilon) && is_equal_eps(sy, m.sy, epsilon) && is_equal_eps(tx, m.tx, epsilon) && is_equal_eps(ty, m.ty, epsilon); } //------------------------------------------------------------------------ double trans_affine::rotation() const { double x1 = 0.0; double y1 = 0.0; double x2 = 1.0; double y2 = 0.0; transform(&x1, &y1); transform(&x2, &y2); return atan2(y2-y1, x2-x1); } //------------------------------------------------------------------------ void trans_affine::translation(double* dx, double* dy) const { *dx = tx; *dy = ty; } //------------------------------------------------------------------------ void trans_affine::scaling(double* x, double* y) const { double x1 = 0.0; double y1 = 0.0; double x2 = 1.0; double y2 = 1.0; trans_affine t(*this); t *= trans_affine_rotation(-rotation()); t.transform(&x1, &y1); t.transform(&x2, &y2); *x = x2 - x1; *y = y2 - y1; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_image_filters.cpp0000644000175000017500000000713113233644505024300 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Filtering class image_filter_lut implemantation // //---------------------------------------------------------------------------- #include "agg_image_filters.h" namespace agg24 { //-------------------------------------------------------------------- void image_filter_lut::realloc_lut(double radius) { m_radius = radius; m_diameter = uceil(radius) * 2; m_start = -int(m_diameter / 2 - 1); unsigned size = m_diameter << image_subpixel_shift; if(size > m_weight_array.size()) { m_weight_array.resize(size); } } //-------------------------------------------------------------------- // This function normalizes integer values and corrects the rounding // errors. It doesn't do anything with the source floating point values // (m_weight_array_dbl), it corrects only integers according to the rule // of 1.0 which means that any sum of pixel weights must be equal to 1.0. // So, the filter function must produce a graph of the proper shape. //-------------------------------------------------------------------- void image_filter_lut::normalize() { unsigned i; int flip = 1; for(i = 0; i < image_subpixel_scale; i++) { for(;;) { int sum = 0; unsigned j; for(j = 0; j < m_diameter; j++) { sum += m_weight_array[j * image_subpixel_scale + i]; } if(sum == image_filter_scale) break; double k = double(image_filter_scale) / double(sum); sum = 0; for(j = 0; j < m_diameter; j++) { sum += m_weight_array[j * image_subpixel_scale + i] = iround(m_weight_array[j * image_subpixel_scale + i] * k); } sum -= image_filter_scale; int inc = (sum > 0) ? -1 : 1; for(j = 0; j < m_diameter && sum; j++) { flip ^= 1; unsigned idx = flip ? m_diameter/2 + j/2 : m_diameter/2 - j/2; int v = m_weight_array[idx * image_subpixel_scale + i]; if(v < image_filter_scale) { m_weight_array[idx * image_subpixel_scale + i] += inc; sum += inc; } } } } unsigned pivot = m_diameter << (image_subpixel_shift - 1); for(i = 0; i < pivot; i++) { m_weight_array[pivot + i] = m_weight_array[pivot - i]; } unsigned end = (diameter() << image_subpixel_shift) - 1; m_weight_array[0] = m_weight_array[end]; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/readme0000644000175000017500000000032413233644505021321 0ustar varunvarunUse automake to build the library. If automake is not available you still can use the old make. There is a very simple Makefile that can be used. Note that if you use automake it will overwrite Makefile. enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/configure.in0000644000175000017500000000040313233644505022450 0ustar varunvarunAC_INIT(src/agg_arc.cpp) # give me a source file, any source file... AM_INIT_AUTOMAKE(agg, 2.0.0) AC_PROG_LN_S AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AC_PROG_LIBTOOL AC_OUTPUT( Makefile gpc/Makefile src/Makefile src/ctrl/Makefile ) enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/copying0000644000175000017500000000070613233644505021540 0ustar varunvarunThe Anti-Grain Geometry Project A high quality rendering engine for C++ http://antigrain.com Anti-Grain Geometry - Version 2.4 Copyright (C) 2002-2005 Maxim Shemanarev (McSeem) Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose. enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/authors0000644000175000017500000000000013233644505021540 0ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/0000755000175000017500000000000013544357604021114 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/agg_gamma_spline.cpp0000644000175000017500000000722213233644505025067 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class gamma_spline // //---------------------------------------------------------------------------- #include "ctrl/agg_gamma_spline.h" namespace agg24 { //------------------------------------------------------------------------ gamma_spline::gamma_spline() : m_x1(0), m_y1(0), m_x2(10), m_y2(10), m_cur_x(0.0) { values(1.0, 1.0, 1.0, 1.0); } //------------------------------------------------------------------------ double gamma_spline::y(double x) const { if(x < 0.0) x = 0.0; if(x > 1.0) x = 1.0; double val = m_spline.get(x); if(val < 0.0) val = 0.0; if(val > 1.0) val = 1.0; return val; } //------------------------------------------------------------------------ void gamma_spline::values(double kx1, double ky1, double kx2, double ky2) { if(kx1 < 0.001) kx1 = 0.001; if(kx1 > 1.999) kx1 = 1.999; if(ky1 < 0.001) ky1 = 0.001; if(ky1 > 1.999) ky1 = 1.999; if(kx2 < 0.001) kx2 = 0.001; if(kx2 > 1.999) kx2 = 1.999; if(ky2 < 0.001) ky2 = 0.001; if(ky2 > 1.999) ky2 = 1.999; m_x[0] = 0.0; m_y[0] = 0.0; m_x[1] = kx1 * 0.25; m_y[1] = ky1 * 0.25; m_x[2] = 1.0 - kx2 * 0.25; m_y[2] = 1.0 - ky2 * 0.25; m_x[3] = 1.0; m_y[3] = 1.0; m_spline.init(4, m_x, m_y); int i; for(i = 0; i < 256; i++) { m_gamma[i] = (unsigned char)(y(double(i) / 255.0) * 255.0); } } //------------------------------------------------------------------------ void gamma_spline::values(double* kx1, double* ky1, double* kx2, double* ky2) const { *kx1 = m_x[1] * 4.0; *ky1 = m_y[1] * 4.0; *kx2 = (1.0 - m_x[2]) * 4.0; *ky2 = (1.0 - m_y[2]) * 4.0; } //------------------------------------------------------------------------ void gamma_spline::box(double x1, double y1, double x2, double y2) { m_x1 = x1; m_y1 = y1; m_x2 = x2; m_y2 = y2; } //------------------------------------------------------------------------ void gamma_spline::rewind(unsigned) { m_cur_x = 0.0; } //------------------------------------------------------------------------ unsigned gamma_spline::vertex(double* vx, double* vy) { if(m_cur_x == 0.0) { *vx = m_x1; *vy = m_y1; m_cur_x += 1.0 / (m_x2 - m_x1); return path_cmd_move_to; } if(m_cur_x > 1.0) { return path_cmd_stop; } *vx = m_x1 + m_cur_x * (m_x2 - m_x1); *vy = m_y1 + y(m_cur_x) * (m_y2 - m_y1); m_cur_x += 1.0 / (m_x2 - m_x1); return path_cmd_line_to; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/agg_cbox_ctrl.cpp0000644000175000017500000001456713233644505024424 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes rbox_ctrl_impl, rbox_ctrl // //---------------------------------------------------------------------------- #include #include "ctrl/agg_cbox_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ cbox_ctrl_impl::cbox_ctrl_impl(double x, double y, const char* l, bool flip_y) : ctrl(x, y, x + 9.0 * 1.5, y + 9.0 * 1.5, flip_y), m_text_thickness(1.5), m_text_height(9.0), m_text_width(0.0), m_status(false), m_text_poly(m_text) { label(l); } //------------------------------------------------------------------------ void cbox_ctrl_impl::text_size(double h, double w) { m_text_width = w; m_text_height = h; } //------------------------------------------------------------------------ void cbox_ctrl_impl::label(const char* l) { unsigned len = strlen(l); if(len > 127) len = 127; memcpy(m_label, l, len); m_label[len] = 0; } //------------------------------------------------------------------------ bool cbox_ctrl_impl::on_mouse_button_down(double x, double y) { inverse_transform_xy(&x, &y); if(x >= m_x1 && y >= m_y1 && x <= m_x2 && y <= m_y2) { m_status = !m_status; return true; } return false; } //------------------------------------------------------------------------ bool cbox_ctrl_impl::on_mouse_move(double, double, bool) { return false; } //------------------------------------------------------------------------ bool cbox_ctrl_impl::in_rect(double x, double y) const { inverse_transform_xy(&x, &y); return x >= m_x1 && y >= m_y1 && x <= m_x2 && y <= m_y2; } //------------------------------------------------------------------------ bool cbox_ctrl_impl::on_mouse_button_up(double, double) { return false; } //------------------------------------------------------------------------ bool cbox_ctrl_impl::on_arrow_keys(bool, bool, bool, bool) { return false; } //------------------------------------------------------------------------ void cbox_ctrl_impl::rewind(unsigned idx) { m_idx = idx; double d2; double t; switch(idx) { default: case 0: // Border m_vertex = 0; m_vx[0] = m_x1; m_vy[0] = m_y1; m_vx[1] = m_x2; m_vy[1] = m_y1; m_vx[2] = m_x2; m_vy[2] = m_y2; m_vx[3] = m_x1; m_vy[3] = m_y2; m_vx[4] = m_x1 + m_text_thickness; m_vy[4] = m_y1 + m_text_thickness; m_vx[5] = m_x1 + m_text_thickness; m_vy[5] = m_y2 - m_text_thickness; m_vx[6] = m_x2 - m_text_thickness; m_vy[6] = m_y2 - m_text_thickness; m_vx[7] = m_x2 - m_text_thickness; m_vy[7] = m_y1 + m_text_thickness; break; case 1: // Text m_text.text(m_label); m_text.start_point(m_x1 + m_text_height * 2.0, m_y1 + m_text_height / 5.0); m_text.size(m_text_height, m_text_width); m_text_poly.width(m_text_thickness); m_text_poly.line_join(round_join); m_text_poly.line_cap(round_cap); m_text_poly.rewind(0); break; case 2: // Active item m_vertex = 0; d2 = (m_y2 - m_y1) / 2.0; t = m_text_thickness * 1.5; m_vx[0] = m_x1 + m_text_thickness; m_vy[0] = m_y1 + m_text_thickness; m_vx[1] = m_x1 + d2; m_vy[1] = m_y1 + d2 - t; m_vx[2] = m_x2 - m_text_thickness; m_vy[2] = m_y1 + m_text_thickness; m_vx[3] = m_x1 + d2 + t; m_vy[3] = m_y1 + d2; m_vx[4] = m_x2 - m_text_thickness; m_vy[4] = m_y2 - m_text_thickness; m_vx[5] = m_x1 + d2; m_vy[5] = m_y1 + d2 + t; m_vx[6] = m_x1 + m_text_thickness; m_vy[6] = m_y2 - m_text_thickness; m_vx[7] = m_x1 + d2 - t; m_vy[7] = m_y1 + d2; break; } } //------------------------------------------------------------------------ unsigned cbox_ctrl_impl::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; switch(m_idx) { case 0: if(m_vertex == 0 || m_vertex == 4) cmd = path_cmd_move_to; if(m_vertex >= 8) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 1: cmd = m_text_poly.vertex(x, y); break; case 2: if(m_status) { if(m_vertex == 0) cmd = path_cmd_move_to; if(m_vertex >= 8) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; } else { cmd = path_cmd_stop; } break; default: cmd = path_cmd_stop; break; } if(!is_stop(cmd)) { transform_xy(x, y); } return cmd; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/agg_polygon_ctrl.cpp0000644000175000017500000002511113233644505025143 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes polygon_ctrl_impl // //---------------------------------------------------------------------------- #include "ctrl/agg_polygon_ctrl.h" namespace agg24 { polygon_ctrl_impl::polygon_ctrl_impl(unsigned np, double point_radius) : ctrl(0, 0, 1, 1, false), m_polygon(np * 2), m_num_points(np), m_node(-1), m_edge(-1), m_vs(&m_polygon[0], m_num_points, false), m_stroke(m_vs), m_point_radius(point_radius), m_status(0), m_dx(0.0), m_dy(0.0) { m_stroke.width(1.0); } void polygon_ctrl_impl::rewind(unsigned) { m_status = 0; m_stroke.rewind(0); } unsigned polygon_ctrl_impl::vertex(double* x, double* y) { unsigned cmd = path_cmd_stop; double r = m_point_radius; if(m_status == 0) { cmd = m_stroke.vertex(x, y); if(!is_stop(cmd)) { transform_xy(x, y); return cmd; } if(m_node >= 0 && m_node == int(m_status)) r *= 1.2; m_ellipse.init(xn(m_status), yn(m_status), r, r, 32); ++m_status; } cmd = m_ellipse.vertex(x, y); if(!is_stop(cmd)) { transform_xy(x, y); return cmd; } if(m_status >= m_num_points) return path_cmd_stop; if(m_node >= 0 && m_node == int(m_status)) r *= 1.2; m_ellipse.init(xn(m_status), yn(m_status), r, r, 32); ++m_status; cmd = m_ellipse.vertex(x, y); if(!is_stop(cmd)) { transform_xy(x, y); } return cmd; } bool polygon_ctrl_impl::check_edge(unsigned i, double x, double y) const { bool ret = false; unsigned n1 = i; unsigned n2 = (i + m_num_points - 1) % m_num_points; double x1 = xn(n1); double y1 = yn(n1); double x2 = xn(n2); double y2 = yn(n2); double dx = x2 - x1; double dy = y2 - y1; if(sqrt(dx*dx + dy*dy) > 0.0000001) { double x3 = x; double y3 = y; double x4 = x3 - dy; double y4 = y3 + dx; double den = (y4-y3) * (x2-x1) - (x4-x3) * (y2-y1); double u1 = ((x4-x3) * (y1-y3) - (y4-y3) * (x1-x3)) / den; double xi = x1 + u1 * (x2 - x1); double yi = y1 + u1 * (y2 - y1); dx = xi - x; dy = yi - y; if (u1 > 0.0 && u1 < 1.0 && sqrt(dx*dx + dy*dy) <= m_point_radius) { ret = true; } } return ret; } bool polygon_ctrl_impl::in_rect(double x, double y) const { return false; } bool polygon_ctrl_impl::on_mouse_button_down(double x, double y) { unsigned i; bool ret = false; m_node = -1; m_edge = -1; inverse_transform_xy(&x, &y); for (i = 0; i < m_num_points; i++) { if(sqrt( (x-xn(i)) * (x-xn(i)) + (y-yn(i)) * (y-yn(i)) ) < m_point_radius) { m_dx = x - xn(i); m_dy = y - yn(i); m_node = int(i); ret = true; break; } } if(!ret) { for (i = 0; i < m_num_points; i++) { if(check_edge(i, x, y)) { m_dx = x; m_dy = y; m_edge = int(i); ret = true; break; } } } if(!ret) { if(point_in_polygon(x, y)) { m_dx = x; m_dy = y; m_node = int(m_num_points); ret = true; } } return ret; } bool polygon_ctrl_impl::on_mouse_move(double x, double y, bool button_flag) { bool ret = false; double dx; double dy; inverse_transform_xy(&x, &y); if(m_node == int(m_num_points)) { dx = x - m_dx; dy = y - m_dy; unsigned i; for(i = 0; i < m_num_points; i++) { xn(i) += dx; yn(i) += dy; } m_dx = x; m_dy = y; ret = true; } else { if(m_edge >= 0) { unsigned n1 = m_edge; unsigned n2 = (n1 + m_num_points - 1) % m_num_points; dx = x - m_dx; dy = y - m_dy; xn(n1) += dx; yn(n1) += dy; xn(n2) += dx; yn(n2) += dy; m_dx = x; m_dy = y; ret = true; } else { if(m_node >= 0) { xn(m_node) = x - m_dx; yn(m_node) = y - m_dy; ret = true; } } } return ret; } bool polygon_ctrl_impl::on_mouse_button_up(double x, double y) { bool ret = (m_node >= 0) || (m_edge >= 0); m_node = -1; m_edge = -1; return ret; } bool polygon_ctrl_impl::on_arrow_keys(bool left, bool right, bool down, bool up) { return false; } //======= Crossings Multiply algorithm of InsideTest ======================== // // By Eric Haines, 3D/Eye Inc, erich@eye.com // // This version is usually somewhat faster than the original published in // Graphics Gems IV; by turning the division for testing the X axis crossing // into a tricky multiplication test this part of the test became faster, // which had the additional effect of making the test for "both to left or // both to right" a bit slower for triangles than simply computing the // intersection each time. The main increase is in triangle testing speed, // which was about 15% faster; all other polygon complexities were pretty much // the same as before. On machines where division is very expensive (not the // case on the HP 9000 series on which I tested) this test should be much // faster overall than the old code. Your mileage may (in fact, will) vary, // depending on the machine and the test data, but in general I believe this // code is both shorter and faster. This test was inspired by unpublished // Graphics Gems submitted by Joseph Samosky and Mark Haigh-Hutchinson. // Related work by Samosky is in: // // Samosky, Joseph, "SectionView: A system for interactively specifying and // visualizing sections through three-dimensional medical image data", // M.S. Thesis, Department of Electrical Engineering and Computer Science, // Massachusetts Institute of Technology, 1993. // // Shoot a test ray along +X axis. The strategy is to compare vertex Y values // to the testing point's Y and quickly discard edges which are entirely to one // side of the test ray. Note that CONVEX and WINDING code can be added as // for the CrossingsTest() code; it is left out here for clarity. // // Input 2D polygon _pgon_ with _numverts_ number of vertices and test point // _point_, returns 1 if inside, 0 if outside. bool polygon_ctrl_impl::point_in_polygon(double tx, double ty) const { if(m_num_points < 3) return false; if(!m_in_polygon_check) return false; unsigned j; int yflag0, yflag1, inside_flag; double vtx0, vty0, vtx1, vty1; vtx0 = xn(m_num_points - 1); vty0 = yn(m_num_points - 1); // get test bit for above/below X axis yflag0 = (vty0 >= ty); vtx1 = xn(0); vty1 = yn(0); inside_flag = 0; for (j = 1; j <= m_num_points; ++j) { yflag1 = (vty1 >= ty); // Check if endpoints straddle (are on opposite sides) of X axis // (i.e. the Y's differ); if so, +X ray could intersect this edge. // The old test also checked whether the endpoints are both to the // right or to the left of the test point. However, given the faster // intersection point computation used below, this test was found to // be a break-even proposition for most polygons and a loser for // triangles (where 50% or more of the edges which survive this test // will cross quadrants and so have to have the X intersection computed // anyway). I credit Joseph Samosky with inspiring me to try dropping // the "both left or both right" part of my code. if (yflag0 != yflag1) { // Check intersection of pgon segment with +X ray. // Note if >= point's X; if so, the ray hits it. // The division operation is avoided for the ">=" test by checking // the sign of the first vertex wrto the test point; idea inspired // by Joseph Samosky's and Mark Haigh-Hutchinson's different // polygon inclusion tests. if ( ((vty1-ty) * (vtx0-vtx1) >= (vtx1-tx) * (vty0-vty1)) == yflag1 ) { inside_flag ^= 1; } } // Move to the next pair of vertices, retaining info as possible. yflag0 = yflag1; vtx0 = vtx1; vty0 = vty1; unsigned k = (j >= m_num_points) ? j - m_num_points : j; vtx1 = xn(k); vty1 = yn(k); } return inside_flag != 0; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/agg_bezier_ctrl.cpp0000644000175000017500000002605713233644505024746 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes bezier_ctrl_impl, bezier_ctrl // //---------------------------------------------------------------------------- #include #include #include "ctrl/agg_bezier_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ bezier_ctrl_impl::bezier_ctrl_impl() : ctrl(0,0,1,1,false), m_stroke(m_curve), m_poly(4, 5.0), m_idx(0) { m_poly.in_polygon_check(false); m_poly.xn(0) = 100.0; m_poly.yn(0) = 0.0; m_poly.xn(1) = 100.0; m_poly.yn(1) = 50.0; m_poly.xn(2) = 50.0; m_poly.yn(2) = 100.0; m_poly.xn(3) = 0.0; m_poly.yn(3) = 100.0; } //------------------------------------------------------------------------ void bezier_ctrl_impl::curve(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { m_poly.xn(0) = x1; m_poly.yn(0) = y1; m_poly.xn(1) = x2; m_poly.yn(1) = y2; m_poly.xn(2) = x3; m_poly.yn(2) = y3; m_poly.xn(3) = x4; m_poly.yn(3) = y4; curve(); } //------------------------------------------------------------------------ curve4& bezier_ctrl_impl::curve() { m_curve.init(m_poly.xn(0), m_poly.yn(0), m_poly.xn(1), m_poly.yn(1), m_poly.xn(2), m_poly.yn(2), m_poly.xn(3), m_poly.yn(3)); return m_curve; } //------------------------------------------------------------------------ void bezier_ctrl_impl::rewind(unsigned idx) { m_idx = idx; m_curve.approximation_scale(scale()); switch(idx) { default: case 0: // Control line 1 m_curve.init(m_poly.xn(0), m_poly.yn(0), (m_poly.xn(0) + m_poly.xn(1)) * 0.5, (m_poly.yn(0) + m_poly.yn(1)) * 0.5, (m_poly.xn(0) + m_poly.xn(1)) * 0.5, (m_poly.yn(0) + m_poly.yn(1)) * 0.5, m_poly.xn(1), m_poly.yn(1)); m_stroke.rewind(0); break; case 1: // Control line 2 m_curve.init(m_poly.xn(2), m_poly.yn(2), (m_poly.xn(2) + m_poly.xn(3)) * 0.5, (m_poly.yn(2) + m_poly.yn(3)) * 0.5, (m_poly.xn(2) + m_poly.xn(3)) * 0.5, (m_poly.yn(2) + m_poly.yn(3)) * 0.5, m_poly.xn(3), m_poly.yn(3)); m_stroke.rewind(0); break; case 2: // Curve itself m_curve.init(m_poly.xn(0), m_poly.yn(0), m_poly.xn(1), m_poly.yn(1), m_poly.xn(2), m_poly.yn(2), m_poly.xn(3), m_poly.yn(3)); m_stroke.rewind(0); break; case 3: // Point 1 m_ellipse.init(m_poly.xn(0), m_poly.yn(0), point_radius(), point_radius(), 20); m_ellipse.rewind(0); break; case 4: // Point 2 m_ellipse.init(m_poly.xn(1), m_poly.yn(1), point_radius(), point_radius(), 20); m_ellipse.rewind(0); break; case 5: // Point 3 m_ellipse.init(m_poly.xn(2), m_poly.yn(2), point_radius(), point_radius(), 20); m_ellipse.rewind(0); break; case 6: // Point 4 m_ellipse.init(m_poly.xn(3), m_poly.yn(3), point_radius(), point_radius(), 20); m_ellipse.rewind(0); break; } } //------------------------------------------------------------------------ unsigned bezier_ctrl_impl::vertex(double* x, double* y) { unsigned cmd = path_cmd_stop; switch(m_idx) { case 0: case 1: case 2: cmd = m_stroke.vertex(x, y); break; case 3: case 4: case 5: case 6: case 7: cmd = m_ellipse.vertex(x, y); break; } if(!is_stop(cmd)) { transform_xy(x, y); } return cmd; } //------------------------------------------------------------------------ bool bezier_ctrl_impl::in_rect(double x, double y) const { return false; } //------------------------------------------------------------------------ bool bezier_ctrl_impl::on_mouse_button_down(double x, double y) { inverse_transform_xy(&x, &y); return m_poly.on_mouse_button_down(x, y); } //------------------------------------------------------------------------ bool bezier_ctrl_impl::on_mouse_move(double x, double y, bool button_flag) { inverse_transform_xy(&x, &y); return m_poly.on_mouse_move(x, y, button_flag); } //------------------------------------------------------------------------ bool bezier_ctrl_impl::on_mouse_button_up(double x, double y) { return m_poly.on_mouse_button_up(x, y); } //------------------------------------------------------------------------ bool bezier_ctrl_impl::on_arrow_keys(bool left, bool right, bool down, bool up) { return m_poly.on_arrow_keys(left, right, down, up); } //------------------------------------------------------------------------ curve3_ctrl_impl::curve3_ctrl_impl() : ctrl(0,0,1,1,false), m_stroke(m_curve), m_poly(3, 5.0), m_idx(0) { m_poly.in_polygon_check(false); m_poly.xn(0) = 100.0; m_poly.yn(0) = 0.0; m_poly.xn(1) = 100.0; m_poly.yn(1) = 50.0; m_poly.xn(2) = 50.0; m_poly.yn(2) = 100.0; } //------------------------------------------------------------------------ void curve3_ctrl_impl::curve(double x1, double y1, double x2, double y2, double x3, double y3) { m_poly.xn(0) = x1; m_poly.yn(0) = y1; m_poly.xn(1) = x2; m_poly.yn(1) = y2; m_poly.xn(2) = x3; m_poly.yn(2) = y3; curve(); } //------------------------------------------------------------------------ curve3& curve3_ctrl_impl::curve() { m_curve.init(m_poly.xn(0), m_poly.yn(0), m_poly.xn(1), m_poly.yn(1), m_poly.xn(2), m_poly.yn(2)); return m_curve; } //------------------------------------------------------------------------ void curve3_ctrl_impl::rewind(unsigned idx) { m_idx = idx; switch(idx) { default: case 0: // Control line m_curve.init(m_poly.xn(0), m_poly.yn(0), (m_poly.xn(0) + m_poly.xn(1)) * 0.5, (m_poly.yn(0) + m_poly.yn(1)) * 0.5, m_poly.xn(1), m_poly.yn(1)); m_stroke.rewind(0); break; case 1: // Control line 2 m_curve.init(m_poly.xn(1), m_poly.yn(1), (m_poly.xn(1) + m_poly.xn(2)) * 0.5, (m_poly.yn(1) + m_poly.yn(2)) * 0.5, m_poly.xn(2), m_poly.yn(2)); m_stroke.rewind(0); break; case 2: // Curve itself m_curve.init(m_poly.xn(0), m_poly.yn(0), m_poly.xn(1), m_poly.yn(1), m_poly.xn(2), m_poly.yn(2)); m_stroke.rewind(0); break; case 3: // Point 1 m_ellipse.init(m_poly.xn(0), m_poly.yn(0), point_radius(), point_radius(), 20); m_ellipse.rewind(0); break; case 4: // Point 2 m_ellipse.init(m_poly.xn(1), m_poly.yn(1), point_radius(), point_radius(), 20); m_ellipse.rewind(0); break; case 5: // Point 3 m_ellipse.init(m_poly.xn(2), m_poly.yn(2), point_radius(), point_radius(), 20); m_ellipse.rewind(0); break; } } //------------------------------------------------------------------------ unsigned curve3_ctrl_impl::vertex(double* x, double* y) { unsigned cmd = path_cmd_stop; switch(m_idx) { case 0: case 1: case 2: cmd = m_stroke.vertex(x, y); break; case 3: case 4: case 5: case 6: cmd = m_ellipse.vertex(x, y); break; } if(!is_stop(cmd)) { transform_xy(x, y); } return cmd; } //------------------------------------------------------------------------ bool curve3_ctrl_impl::in_rect(double x, double y) const { return false; } //------------------------------------------------------------------------ bool curve3_ctrl_impl::on_mouse_button_down(double x, double y) { inverse_transform_xy(&x, &y); return m_poly.on_mouse_button_down(x, y); } //------------------------------------------------------------------------ bool curve3_ctrl_impl::on_mouse_move(double x, double y, bool button_flag) { inverse_transform_xy(&x, &y); return m_poly.on_mouse_move(x, y, button_flag); } //------------------------------------------------------------------------ bool curve3_ctrl_impl::on_mouse_button_up(double x, double y) { return m_poly.on_mouse_button_up(x, y); } //------------------------------------------------------------------------ bool curve3_ctrl_impl::on_arrow_keys(bool left, bool right, bool down, bool up) { return m_poly.on_arrow_keys(left, right, down, up); } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/Makefile.am0000644000175000017500000000061013233644505023137 0ustar varunvarunif ENABLE_CTRL INCLUDES = -I$(top_srcdir)/include noinst_LTLIBRARIES = libaggctrl.la libaggctrl_la_LDFLAGS = -no-undefined -version-info @AGG_LIB_VERSION@ libaggctrl_la_SOURCES = agg_cbox_ctrl.cpp agg_gamma_ctrl.cpp agg_gamma_spline.cpp agg_rbox_ctrl.cpp \ agg_slider_ctrl.cpp agg_spline_ctrl.cpp agg_scale_ctrl.cpp \ agg_bezier_ctrl.cpp agg_polygon_ctrl.cpp endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/agg_spline_ctrl.cpp0000644000175000017500000002714013233644505024752 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes spline_ctrl_impl, spline_ctrl // //---------------------------------------------------------------------------- #include "ctrl/agg_spline_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ spline_ctrl_impl::spline_ctrl_impl(double x1, double y1, double x2, double y2, unsigned num_pnt, bool flip_y) : ctrl(x1, y1, x2, y2, flip_y), m_num_pnt(num_pnt), m_border_width(1.0), m_border_extra(0.0), m_curve_width(1.0), m_point_size(3.0), m_curve_poly(m_curve_pnt), m_idx(0), m_vertex(0), m_active_pnt(-1), m_move_pnt(-1), m_pdx(0.0), m_pdy(0.0) { if(m_num_pnt < 4) m_num_pnt = 4; if(m_num_pnt > 32) m_num_pnt = 32; unsigned i; for(i = 0; i < m_num_pnt; i++) { m_xp[i] = double(i) / double(m_num_pnt - 1); m_yp[i] = 0.5; } calc_spline_box(); update_spline(); } //------------------------------------------------------------------------ void spline_ctrl_impl::border_width(double t, double extra) { m_border_width = t; m_border_extra = extra; calc_spline_box(); } //------------------------------------------------------------------------ void spline_ctrl_impl::calc_spline_box() { m_xs1 = m_x1 + m_border_width; m_ys1 = m_y1 + m_border_width; m_xs2 = m_x2 - m_border_width; m_ys2 = m_y2 - m_border_width; } //------------------------------------------------------------------------ void spline_ctrl_impl::update_spline() { int i; m_spline.init(m_num_pnt, m_xp, m_yp); for(i = 0; i < 256; i++) { m_spline_values[i] = m_spline.get(double(i) / 255.0); if(m_spline_values[i] < 0.0) m_spline_values[i] = 0.0; if(m_spline_values[i] > 1.0) m_spline_values[i] = 1.0; m_spline_values8[i] = (int8u)(m_spline_values[i] * 255.0); } } //------------------------------------------------------------------------ void spline_ctrl_impl::calc_curve() { int i; m_curve_pnt.remove_all(); m_curve_pnt.move_to(m_xs1, m_ys1 + (m_ys2 - m_ys1) * m_spline_values[0]); for(i = 1; i < 256; i++) { m_curve_pnt.line_to(m_xs1 + (m_xs2 - m_xs1) * double(i) / 255.0, m_ys1 + (m_ys2 - m_ys1) * m_spline_values[i]); } } //------------------------------------------------------------------------ double spline_ctrl_impl::calc_xp(unsigned idx) { return m_xs1 + (m_xs2 - m_xs1) * m_xp[idx]; } //------------------------------------------------------------------------ double spline_ctrl_impl::calc_yp(unsigned idx) { return m_ys1 + (m_ys2 - m_ys1) * m_yp[idx]; } //------------------------------------------------------------------------ void spline_ctrl_impl::set_xp(unsigned idx, double val) { if(val < 0.0) val = 0.0; if(val > 1.0) val = 1.0; if(idx == 0) { val = 0.0; } else if(idx == m_num_pnt - 1) { val = 1.0; } else { if(val < m_xp[idx - 1] + 0.001) val = m_xp[idx - 1] + 0.001; if(val > m_xp[idx + 1] - 0.001) val = m_xp[idx + 1] - 0.001; } m_xp[idx] = val; } //------------------------------------------------------------------------ void spline_ctrl_impl::set_yp(unsigned idx, double val) { if(val < 0.0) val = 0.0; if(val > 1.0) val = 1.0; m_yp[idx] = val; } //------------------------------------------------------------------------ void spline_ctrl_impl::point(unsigned idx, double x, double y) { if(idx < m_num_pnt) { set_xp(idx, x); set_yp(idx, y); } } //------------------------------------------------------------------------ void spline_ctrl_impl::value(unsigned idx, double y) { if(idx < m_num_pnt) { set_yp(idx, y); } } //------------------------------------------------------------------------ double spline_ctrl_impl::value(double x) const { x = m_spline.get(x); if(x < 0.0) x = 0.0; if(x > 1.0) x = 1.0; return x; } //------------------------------------------------------------------------ void spline_ctrl_impl::rewind(unsigned idx) { unsigned i; m_idx = idx; switch(idx) { default: case 0: // Background m_vertex = 0; m_vx[0] = m_x1 - m_border_extra; m_vy[0] = m_y1 - m_border_extra; m_vx[1] = m_x2 + m_border_extra; m_vy[1] = m_y1 - m_border_extra; m_vx[2] = m_x2 + m_border_extra; m_vy[2] = m_y2 + m_border_extra; m_vx[3] = m_x1 - m_border_extra; m_vy[3] = m_y2 + m_border_extra; break; case 1: // Border m_vertex = 0; m_vx[0] = m_x1; m_vy[0] = m_y1; m_vx[1] = m_x2; m_vy[1] = m_y1; m_vx[2] = m_x2; m_vy[2] = m_y2; m_vx[3] = m_x1; m_vy[3] = m_y2; m_vx[4] = m_x1 + m_border_width; m_vy[4] = m_y1 + m_border_width; m_vx[5] = m_x1 + m_border_width; m_vy[5] = m_y2 - m_border_width; m_vx[6] = m_x2 - m_border_width; m_vy[6] = m_y2 - m_border_width; m_vx[7] = m_x2 - m_border_width; m_vy[7] = m_y1 + m_border_width; break; case 2: // Curve calc_curve(); m_curve_poly.width(m_curve_width); m_curve_poly.rewind(0); break; case 3: // Inactive points m_curve_pnt.remove_all(); for(i = 0; i < m_num_pnt; i++) { if(int(i) != m_active_pnt) { m_ellipse.init(calc_xp(i), calc_yp(i), m_point_size, m_point_size, 32); m_curve_pnt.concat_path(m_ellipse); } } m_curve_poly.rewind(0); break; case 4: // Active point m_curve_pnt.remove_all(); if(m_active_pnt >= 0) { m_ellipse.init(calc_xp(m_active_pnt), calc_yp(m_active_pnt), m_point_size, m_point_size, 32); m_curve_pnt.concat_path(m_ellipse); } m_curve_poly.rewind(0); break; } } //------------------------------------------------------------------------ unsigned spline_ctrl_impl::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; switch(m_idx) { case 0: if(m_vertex == 0) cmd = path_cmd_move_to; if(m_vertex >= 4) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 1: if(m_vertex == 0 || m_vertex == 4) cmd = path_cmd_move_to; if(m_vertex >= 8) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 2: cmd = m_curve_poly.vertex(x, y); break; case 3: case 4: cmd = m_curve_pnt.vertex(x, y); break; default: cmd = path_cmd_stop; break; } if(!is_stop(cmd)) { transform_xy(x, y); } return cmd; } //------------------------------------------------------------------------ void spline_ctrl_impl::active_point(int i) { m_active_pnt = i; } //------------------------------------------------------------------------ bool spline_ctrl_impl::in_rect(double x, double y) const { inverse_transform_xy(&x, &y); return x >= m_x1 && x <= m_x2 && y >= m_y1 && y <= m_y2; } //------------------------------------------------------------------------ bool spline_ctrl_impl::on_mouse_button_down(double x, double y) { inverse_transform_xy(&x, &y); unsigned i; for(i = 0; i < m_num_pnt; i++) { double xp = calc_xp(i); double yp = calc_yp(i); if(calc_distance(x, y, xp, yp) <= m_point_size + 1) { m_pdx = xp - x; m_pdy = yp - y; m_active_pnt = m_move_pnt = int(i); return true; } } return false; } //------------------------------------------------------------------------ bool spline_ctrl_impl::on_mouse_button_up(double, double) { if(m_move_pnt >= 0) { m_move_pnt = -1; return true; } return false; } //------------------------------------------------------------------------ bool spline_ctrl_impl::on_mouse_move(double x, double y, bool button_flag) { inverse_transform_xy(&x, &y); if(!button_flag) { return on_mouse_button_up(x, y); } if(m_move_pnt >= 0) { double xp = x + m_pdx; double yp = y + m_pdy; set_xp(m_move_pnt, (xp - m_xs1) / (m_xs2 - m_xs1)); set_yp(m_move_pnt, (yp - m_ys1) / (m_ys2 - m_ys1)); update_spline(); return true; } return false; } //------------------------------------------------------------------------ bool spline_ctrl_impl::on_arrow_keys(bool left, bool right, bool down, bool up) { double kx = 0.0; double ky = 0.0; bool ret = false; if(m_active_pnt >= 0) { kx = m_xp[m_active_pnt]; ky = m_yp[m_active_pnt]; if(left) { kx -= 0.001; ret = true; } if(right) { kx += 0.001; ret = true; } if(down) { ky -= 0.001; ret = true; } if(up) { ky += 0.001; ret = true; } } if(ret) { set_xp(m_active_pnt, kx); set_yp(m_active_pnt, ky); update_spline(); } return ret; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/agg_slider_ctrl.cpp0000644000175000017500000002417313233644505024745 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes slider_ctrl_impl, slider_ctrl // //---------------------------------------------------------------------------- #include #include #include "ctrl/agg_slider_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ slider_ctrl_impl::slider_ctrl_impl(double x1, double y1, double x2, double y2, bool flip_y) : ctrl(x1, y1, x2, y2, flip_y), m_border_width(1.0), m_border_extra((y2 - y1) / 2), m_text_thickness(1.0), m_pdx(0.0), m_mouse_move(false), m_value(0.5), m_preview_value(0.5), m_min(0.0), m_max(1.0), m_num_steps(0), m_descending(false), m_text_poly(m_text) { m_label[0] = 0; calc_box(); } //------------------------------------------------------------------------ void slider_ctrl_impl::calc_box() { m_xs1 = m_x1 + m_border_width; m_ys1 = m_y1 + m_border_width; m_xs2 = m_x2 - m_border_width; m_ys2 = m_y2 - m_border_width; } //------------------------------------------------------------------------ bool slider_ctrl_impl::normalize_value(bool preview_value_flag) { bool ret = true; if(m_num_steps) { int step = int(m_preview_value * m_num_steps + 0.5); ret = m_value != step / double(m_num_steps); m_value = step / double(m_num_steps); } else { m_value = m_preview_value; } if(preview_value_flag) { m_preview_value = m_value; } return ret; } //------------------------------------------------------------------------ void slider_ctrl_impl::border_width(double t, double extra) { m_border_width = t; m_border_extra = extra; calc_box(); } //------------------------------------------------------------------------ void slider_ctrl_impl::value(double value) { m_preview_value = (value - m_min) / (m_max - m_min); if(m_preview_value > 1.0) m_preview_value = 1.0; if(m_preview_value < 0.0) m_preview_value = 0.0; normalize_value(true); } //------------------------------------------------------------------------ void slider_ctrl_impl::label(const char* fmt) { m_label[0] = 0; if(fmt) { unsigned len = strlen(fmt); if(len > 63) len = 63; memcpy(m_label, fmt, len); m_label[len] = 0; } } //------------------------------------------------------------------------ void slider_ctrl_impl::rewind(unsigned idx) { m_idx = idx; switch(idx) { default: case 0: // Background m_vertex = 0; m_vx[0] = m_x1 - m_border_extra; m_vy[0] = m_y1 - m_border_extra; m_vx[1] = m_x2 + m_border_extra; m_vy[1] = m_y1 - m_border_extra; m_vx[2] = m_x2 + m_border_extra; m_vy[2] = m_y2 + m_border_extra; m_vx[3] = m_x1 - m_border_extra; m_vy[3] = m_y2 + m_border_extra; break; case 1: // Triangle m_vertex = 0; if(m_descending) { m_vx[0] = m_x1; m_vy[0] = m_y1; m_vx[1] = m_x2; m_vy[1] = m_y1; m_vx[2] = m_x1; m_vy[2] = m_y2; m_vx[3] = m_x1; m_vy[3] = m_y1; } else { m_vx[0] = m_x1; m_vy[0] = m_y1; m_vx[1] = m_x2; m_vy[1] = m_y1; m_vx[2] = m_x2; m_vy[2] = m_y2; m_vx[3] = m_x1; m_vy[3] = m_y1; } break; case 2: m_text.text(m_label); if(m_label[0]) { char buf[256]; sprintf(buf, m_label, value()); m_text.text(buf); } m_text.start_point(m_x1, m_y1); m_text.size((m_y2 - m_y1) * 1.2, m_y2 - m_y1); m_text_poly.width(m_text_thickness); m_text_poly.line_join(round_join); m_text_poly.line_cap(round_cap); m_text_poly.rewind(0); break; case 3: // pointer preview m_ellipse.init(m_xs1 + (m_xs2 - m_xs1) * m_preview_value, (m_ys1 + m_ys2) / 2.0, m_y2 - m_y1, m_y2 - m_y1, 32); break; case 4: // pointer normalize_value(false); m_ellipse.init(m_xs1 + (m_xs2 - m_xs1) * m_value, (m_ys1 + m_ys2) / 2.0, m_y2 - m_y1, m_y2 - m_y1, 32); m_ellipse.rewind(0); break; case 5: m_storage.remove_all(); if(m_num_steps) { unsigned i; double d = (m_xs2 - m_xs1) / m_num_steps; if(d > 0.004) d = 0.004; for(i = 0; i < m_num_steps + 1; i++) { double x = m_xs1 + (m_xs2 - m_xs1) * i / m_num_steps; m_storage.move_to(x, m_y1); m_storage.line_to(x - d * (m_x2 - m_x1), m_y1 - m_border_extra); m_storage.line_to(x + d * (m_x2 - m_x1), m_y1 - m_border_extra); } } } } //------------------------------------------------------------------------ unsigned slider_ctrl_impl::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; switch(m_idx) { case 0: if(m_vertex == 0) cmd = path_cmd_move_to; if(m_vertex >= 4) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 1: if(m_vertex == 0) cmd = path_cmd_move_to; if(m_vertex >= 4) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 2: cmd = m_text_poly.vertex(x, y); break; case 3: case 4: cmd = m_ellipse.vertex(x, y); break; case 5: cmd = m_storage.vertex(x, y); break; default: cmd = path_cmd_stop; break; } if(!is_stop(cmd)) { transform_xy(x, y); } return cmd; } //------------------------------------------------------------------------ bool slider_ctrl_impl::in_rect(double x, double y) const { inverse_transform_xy(&x, &y); return x >= m_x1 && x <= m_x2 && y >= m_y1 && y <= m_y2; } //------------------------------------------------------------------------ bool slider_ctrl_impl::on_mouse_button_down(double x, double y) { inverse_transform_xy(&x, &y); double xp = m_xs1 + (m_xs2 - m_xs1) * m_value; double yp = (m_ys1 + m_ys2) / 2.0; if(calc_distance(x, y, xp, yp) <= m_y2 - m_y1) { m_pdx = xp - x; m_mouse_move = true; return true; } return false; } //------------------------------------------------------------------------ bool slider_ctrl_impl::on_mouse_move(double x, double y, bool button_flag) { inverse_transform_xy(&x, &y); if(!button_flag) { on_mouse_button_up(x, y); return false; } if(m_mouse_move) { double xp = x + m_pdx; m_preview_value = (xp - m_xs1) / (m_xs2 - m_xs1); if(m_preview_value < 0.0) m_preview_value = 0.0; if(m_preview_value > 1.0) m_preview_value = 1.0; return true; } return false; } //------------------------------------------------------------------------ bool slider_ctrl_impl::on_mouse_button_up(double, double) { m_mouse_move = false; normalize_value(true); return true; } //------------------------------------------------------------------------ bool slider_ctrl_impl::on_arrow_keys(bool left, bool right, bool down, bool up) { double d = 0.005; if(m_num_steps) { d = 1.0 / m_num_steps; } if(right || up) { m_preview_value += d; if(m_preview_value > 1.0) m_preview_value = 1.0; normalize_value(true); return true; } if(left || down) { m_preview_value -= d; if(m_preview_value < 0.0) m_preview_value = 0.0; normalize_value(true); return true; } return false; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/agg_scale_ctrl.cpp0000644000175000017500000003333613233644505024553 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes scale_ctrl_impl, scale_ctrl // //---------------------------------------------------------------------------- #include "ctrl/agg_scale_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ scale_ctrl_impl::scale_ctrl_impl(double x1, double y1, double x2, double y2, bool flip_y) : ctrl(x1, y1, x2, y2, flip_y), m_border_thickness(1.0), m_border_extra((fabs(x2 - x1) > fabs(y2 - y1)) ? (y2 - y1) / 2 : (x2 - x1) / 2), m_pdx(0.0), m_pdy(0.0), m_move_what(move_nothing), m_value1(0.3), m_value2(0.7), m_min_d(0.01) { calc_box(); } //------------------------------------------------------------------------ void scale_ctrl_impl::calc_box() { m_xs1 = m_x1 + m_border_thickness; m_ys1 = m_y1 + m_border_thickness; m_xs2 = m_x2 - m_border_thickness; m_ys2 = m_y2 - m_border_thickness; } //------------------------------------------------------------------------ void scale_ctrl_impl::border_thickness(double t, double extra) { m_border_thickness = t; m_border_extra = extra; calc_box(); } //------------------------------------------------------------------------ void scale_ctrl_impl::resize(double x1, double y1, double x2, double y2) { m_x1 = x1; m_y1 = y1; m_x2 = x2; m_y2 = y2; calc_box(); m_border_extra = (fabs(x2 - x1) > fabs(y2 - y1)) ? (y2 - y1) / 2 : (x2 - x1) / 2; } //------------------------------------------------------------------------ void scale_ctrl_impl::value1(double value) { if(value < 0.0) value = 0.0; if(value > 1.0) value = 1.0; if(m_value2 - value < m_min_d) value = m_value2 - m_min_d; m_value1 = value; } //------------------------------------------------------------------------ void scale_ctrl_impl::value2(double value) { if(value < 0.0) value = 0.0; if(value > 1.0) value = 1.0; if(m_value1 + value < m_min_d) value = m_value1 + m_min_d; m_value2 = value; } //------------------------------------------------------------------------ void scale_ctrl_impl::move(double d) { m_value1 += d; m_value2 += d; if(m_value1 < 0.0) { m_value2 -= m_value1; m_value1 = 0.0; } if(m_value2 > 1.0) { m_value1 -= m_value2 - 1.0; m_value2 = 1.0; } } //------------------------------------------------------------------------ void scale_ctrl_impl::rewind(unsigned idx) { m_idx = idx; switch(idx) { default: case 0: // Background m_vertex = 0; m_vx[0] = m_x1 - m_border_extra; m_vy[0] = m_y1 - m_border_extra; m_vx[1] = m_x2 + m_border_extra; m_vy[1] = m_y1 - m_border_extra; m_vx[2] = m_x2 + m_border_extra; m_vy[2] = m_y2 + m_border_extra; m_vx[3] = m_x1 - m_border_extra; m_vy[3] = m_y2 + m_border_extra; break; case 1: // Border m_vertex = 0; m_vx[0] = m_x1; m_vy[0] = m_y1; m_vx[1] = m_x2; m_vy[1] = m_y1; m_vx[2] = m_x2; m_vy[2] = m_y2; m_vx[3] = m_x1; m_vy[3] = m_y2; m_vx[4] = m_x1 + m_border_thickness; m_vy[4] = m_y1 + m_border_thickness; m_vx[5] = m_x1 + m_border_thickness; m_vy[5] = m_y2 - m_border_thickness; m_vx[6] = m_x2 - m_border_thickness; m_vy[6] = m_y2 - m_border_thickness; m_vx[7] = m_x2 - m_border_thickness; m_vy[7] = m_y1 + m_border_thickness; break; case 2: // pointer1 if(fabs(m_x2 - m_x1) > fabs(m_y2 - m_y1)) { m_ellipse.init(m_xs1 + (m_xs2 - m_xs1) * m_value1, (m_ys1 + m_ys2) / 2.0, m_y2 - m_y1, m_y2 - m_y1, 32); } else { m_ellipse.init((m_xs1 + m_xs2) / 2.0, m_ys1 + (m_ys2 - m_ys1) * m_value1, m_x2 - m_x1, m_x2 - m_x1, 32); } m_ellipse.rewind(0); break; case 3: // pointer2 if(fabs(m_x2 - m_x1) > fabs(m_y2 - m_y1)) { m_ellipse.init(m_xs1 + (m_xs2 - m_xs1) * m_value2, (m_ys1 + m_ys2) / 2.0, m_y2 - m_y1, m_y2 - m_y1, 32); } else { m_ellipse.init((m_xs1 + m_xs2) / 2.0, m_ys1 + (m_ys2 - m_ys1) * m_value2, m_x2 - m_x1, m_x2 - m_x1, 32); } m_ellipse.rewind(0); break; case 4: // slider m_vertex = 0; if(fabs(m_x2 - m_x1) > fabs(m_y2 - m_y1)) { m_vx[0] = m_xs1 + (m_xs2 - m_xs1) * m_value1; m_vy[0] = m_y1 - m_border_extra / 2.0; m_vx[1] = m_xs1 + (m_xs2 - m_xs1) * m_value2; m_vy[1] = m_vy[0]; m_vx[2] = m_vx[1]; m_vy[2] = m_y2 + m_border_extra / 2.0; m_vx[3] = m_vx[0]; m_vy[3] = m_vy[2]; } else { m_vx[0] = m_x1 - m_border_extra / 2.0; m_vy[0] = m_ys1 + (m_ys2 - m_ys1) * m_value1; m_vx[1] = m_vx[0]; m_vy[1] = m_ys1 + (m_ys2 - m_ys1) * m_value2; m_vx[2] = m_x2 + m_border_extra / 2.0; m_vy[2] = m_vy[1]; m_vx[3] = m_vx[2]; m_vy[3] = m_vy[0]; } break; } } //------------------------------------------------------------------------ unsigned scale_ctrl_impl::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; switch(m_idx) { case 0: case 4: if(m_vertex == 0) cmd = path_cmd_move_to; if(m_vertex >= 4) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 1: if(m_vertex == 0 || m_vertex == 4) cmd = path_cmd_move_to; if(m_vertex >= 8) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 2: case 3: cmd = m_ellipse.vertex(x, y); break; default: cmd = path_cmd_stop; break; } if(!is_stop(cmd)) { transform_xy(x, y); } return cmd; } //------------------------------------------------------------------------ bool scale_ctrl_impl::in_rect(double x, double y) const { inverse_transform_xy(&x, &y); return x >= m_x1 && x <= m_x2 && y >= m_y1 && y <= m_y2; } //------------------------------------------------------------------------ bool scale_ctrl_impl::on_mouse_button_down(double x, double y) { inverse_transform_xy(&x, &y); double xp1; double xp2; double ys1; double ys2; double xp; double yp; if(fabs(m_x2 - m_x1) > fabs(m_y2 - m_y1)) { xp1 = m_xs1 + (m_xs2 - m_xs1) * m_value1; xp2 = m_xs1 + (m_xs2 - m_xs1) * m_value2; ys1 = m_y1 - m_border_extra / 2.0; ys2 = m_y2 + m_border_extra / 2.0; yp = (m_ys1 + m_ys2) / 2.0; if(x > xp1 && y > ys1 && x < xp2 && y < ys2) { m_pdx = xp1 - x; m_move_what = move_slider; return true; } //if(x < xp1 && calc_distance(x, y, xp1, yp) <= m_y2 - m_y1) if(calc_distance(x, y, xp1, yp) <= m_y2 - m_y1) { m_pdx = xp1 - x; m_move_what = move_value1; return true; } //if(x > xp2 && calc_distance(x, y, xp2, yp) <= m_y2 - m_y1) if(calc_distance(x, y, xp2, yp) <= m_y2 - m_y1) { m_pdx = xp2 - x; m_move_what = move_value2; return true; } } else { xp1 = m_x1 - m_border_extra / 2.0; xp2 = m_x2 + m_border_extra / 2.0; ys1 = m_ys1 + (m_ys2 - m_ys1) * m_value1; ys2 = m_ys1 + (m_ys2 - m_ys1) * m_value2; xp = (m_xs1 + m_xs2) / 2.0; if(x > xp1 && y > ys1 && x < xp2 && y < ys2) { m_pdy = ys1 - y; m_move_what = move_slider; return true; } //if(y < ys1 && calc_distance(x, y, xp, ys1) <= m_x2 - m_x1) if(calc_distance(x, y, xp, ys1) <= m_x2 - m_x1) { m_pdy = ys1 - y; m_move_what = move_value1; return true; } //if(y > ys2 && calc_distance(x, y, xp, ys2) <= m_x2 - m_x1) if(calc_distance(x, y, xp, ys2) <= m_x2 - m_x1) { m_pdy = ys2 - y; m_move_what = move_value2; return true; } } return false; } //------------------------------------------------------------------------ bool scale_ctrl_impl::on_mouse_move(double x, double y, bool button_flag) { inverse_transform_xy(&x, &y); if(!button_flag) { return on_mouse_button_up(x, y); } double xp = x + m_pdx; double yp = y + m_pdy; double dv; switch(m_move_what) { case move_value1: if(fabs(m_x2 - m_x1) > fabs(m_y2 - m_y1)) { m_value1 = (xp - m_xs1) / (m_xs2 - m_xs1); } else { m_value1 = (yp - m_ys1) / (m_ys2 - m_ys1); } if(m_value1 < 0.0) m_value1 = 0.0; if(m_value1 > m_value2 - m_min_d) m_value1 = m_value2 - m_min_d; return true; case move_value2: if(fabs(m_x2 - m_x1) > fabs(m_y2 - m_y1)) { m_value2 = (xp - m_xs1) / (m_xs2 - m_xs1); } else { m_value2 = (yp - m_ys1) / (m_ys2 - m_ys1); } if(m_value2 > 1.0) m_value2 = 1.0; if(m_value2 < m_value1 + m_min_d) m_value2 = m_value1 + m_min_d; return true; case move_slider: dv = m_value2 - m_value1; if(fabs(m_x2 - m_x1) > fabs(m_y2 - m_y1)) { m_value1 = (xp - m_xs1) / (m_xs2 - m_xs1); } else { m_value1 = (yp - m_ys1) / (m_ys2 - m_ys1); } m_value2 = m_value1 + dv; if(m_value1 < 0.0) { dv = m_value2 - m_value1; m_value1 = 0.0; m_value2 = m_value1 + dv; } if(m_value2 > 1.0) { dv = m_value2 - m_value1; m_value2 = 1.0; m_value1 = m_value2 - dv; } return true; } return false; } //------------------------------------------------------------------------ bool scale_ctrl_impl::on_mouse_button_up(double, double) { m_move_what = move_nothing; return false; } //------------------------------------------------------------------------ bool scale_ctrl_impl::on_arrow_keys(bool left, bool right, bool down, bool up) { /* if(right || up) { m_value += 0.005; if(m_value > 1.0) m_value = 1.0; return true; } if(left || down) { m_value -= 0.005; if(m_value < 0.0) m_value = 0.0; return true; } */ return false; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/agg_gamma_ctrl.cpp0000644000175000017500000003332413233644505024543 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class gamma_ctrl_impl // //---------------------------------------------------------------------------- #include #include "agg_math.h" #include "ctrl/agg_gamma_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ gamma_ctrl_impl::gamma_ctrl_impl(double x1, double y1, double x2, double y2, bool flip_y) : ctrl(x1, y1, x2, y2, flip_y), m_border_width(2.0), m_border_extra(0.0), m_curve_width(2.0), m_grid_width(0.2), m_text_thickness(1.5), m_point_size(5.0), m_text_height(9.0), m_text_width(0.0), m_xc1(x1), m_yc1(y1), m_xc2(x2), m_yc2(y2 - m_text_height * 2.0), m_xt1(x1), m_yt1(y2 - m_text_height * 2.0), m_xt2(x2), m_yt2(y2), m_curve_poly(m_gamma_spline), m_text_poly(m_text), m_idx(0), m_vertex(0), m_p1_active(true), m_mouse_point(0), m_pdx(0.0), m_pdy(0.0) { calc_spline_box(); } //------------------------------------------------------------------------ void gamma_ctrl_impl::calc_spline_box() { m_xs1 = m_xc1 + m_border_width; m_ys1 = m_yc1 + m_border_width; m_xs2 = m_xc2 - m_border_width; m_ys2 = m_yc2 - m_border_width * 0.5; } //------------------------------------------------------------------------ void gamma_ctrl_impl::calc_points() { double kx1, ky1, kx2, ky2; m_gamma_spline.values(&kx1, &ky1, &kx2, &ky2); m_xp1 = m_xs1 + (m_xs2 - m_xs1) * kx1 * 0.25; m_yp1 = m_ys1 + (m_ys2 - m_ys1) * ky1 * 0.25; m_xp2 = m_xs2 - (m_xs2 - m_xs1) * kx2 * 0.25; m_yp2 = m_ys2 - (m_ys2 - m_ys1) * ky2 * 0.25; } //------------------------------------------------------------------------ void gamma_ctrl_impl::calc_values() { double kx1, ky1, kx2, ky2; kx1 = (m_xp1 - m_xs1) * 4.0 / (m_xs2 - m_xs1); ky1 = (m_yp1 - m_ys1) * 4.0 / (m_ys2 - m_ys1); kx2 = (m_xs2 - m_xp2) * 4.0 / (m_xs2 - m_xs1); ky2 = (m_ys2 - m_yp2) * 4.0 / (m_ys2 - m_ys1); m_gamma_spline.values(kx1, ky1, kx2, ky2); } //------------------------------------------------------------------------ void gamma_ctrl_impl::text_size(double h, double w) { m_text_width = w; m_text_height = h; m_yc2 = m_y2 - m_text_height * 2.0; m_yt1 = m_y2 - m_text_height * 2.0; calc_spline_box(); } //------------------------------------------------------------------------ void gamma_ctrl_impl::border_width(double t, double extra) { m_border_width = t; m_border_extra = extra; calc_spline_box(); } //------------------------------------------------------------------------ void gamma_ctrl_impl::values(double kx1, double ky1, double kx2, double ky2) { m_gamma_spline.values(kx1, ky1, kx2, ky2); } //------------------------------------------------------------------------ void gamma_ctrl_impl::values(double* kx1, double* ky1, double* kx2, double* ky2) const { m_gamma_spline.values(kx1, ky1, kx2, ky2); } //------------------------------------------------------------------------ void gamma_ctrl_impl::rewind(unsigned idx) { double kx1, ky1, kx2, ky2; char tbuf[32]; m_idx = idx; switch(idx) { default: case 0: // Background m_vertex = 0; m_vx[0] = m_x1 - m_border_extra; m_vy[0] = m_y1 - m_border_extra; m_vx[1] = m_x2 + m_border_extra; m_vy[1] = m_y1 - m_border_extra; m_vx[2] = m_x2 + m_border_extra; m_vy[2] = m_y2 + m_border_extra; m_vx[3] = m_x1 - m_border_extra; m_vy[3] = m_y2 + m_border_extra; break; case 1: // Border m_vertex = 0; m_vx[0] = m_x1; m_vy[0] = m_y1; m_vx[1] = m_x2; m_vy[1] = m_y1; m_vx[2] = m_x2; m_vy[2] = m_y2; m_vx[3] = m_x1; m_vy[3] = m_y2; m_vx[4] = m_x1 + m_border_width; m_vy[4] = m_y1 + m_border_width; m_vx[5] = m_x1 + m_border_width; m_vy[5] = m_y2 - m_border_width; m_vx[6] = m_x2 - m_border_width; m_vy[6] = m_y2 - m_border_width; m_vx[7] = m_x2 - m_border_width; m_vy[7] = m_y1 + m_border_width; m_vx[8] = m_xc1 + m_border_width; m_vy[8] = m_yc2 - m_border_width * 0.5; m_vx[9] = m_xc2 - m_border_width; m_vy[9] = m_yc2 - m_border_width * 0.5; m_vx[10] = m_xc2 - m_border_width; m_vy[10] = m_yc2 + m_border_width * 0.5; m_vx[11] = m_xc1 + m_border_width; m_vy[11] = m_yc2 + m_border_width * 0.5; break; case 2: // Curve m_gamma_spline.box(m_xs1, m_ys1, m_xs2, m_ys2); m_curve_poly.width(m_curve_width); m_curve_poly.rewind(0); break; case 3: // Grid m_vertex = 0; m_vx[0] = m_xs1; m_vy[0] = (m_ys1 + m_ys2) * 0.5 - m_grid_width * 0.5; m_vx[1] = m_xs2; m_vy[1] = (m_ys1 + m_ys2) * 0.5 - m_grid_width * 0.5; m_vx[2] = m_xs2; m_vy[2] = (m_ys1 + m_ys2) * 0.5 + m_grid_width * 0.5; m_vx[3] = m_xs1; m_vy[3] = (m_ys1 + m_ys2) * 0.5 + m_grid_width * 0.5; m_vx[4] = (m_xs1 + m_xs2) * 0.5 - m_grid_width * 0.5; m_vy[4] = m_ys1; m_vx[5] = (m_xs1 + m_xs2) * 0.5 - m_grid_width * 0.5; m_vy[5] = m_ys2; m_vx[6] = (m_xs1 + m_xs2) * 0.5 + m_grid_width * 0.5; m_vy[6] = m_ys2; m_vx[7] = (m_xs1 + m_xs2) * 0.5 + m_grid_width * 0.5; m_vy[7] = m_ys1; calc_points(); m_vx[8] = m_xs1; m_vy[8] = m_yp1 - m_grid_width * 0.5; m_vx[9] = m_xp1 - m_grid_width * 0.5; m_vy[9] = m_yp1 - m_grid_width * 0.5; m_vx[10] = m_xp1 - m_grid_width * 0.5; m_vy[10] = m_ys1; m_vx[11] = m_xp1 + m_grid_width * 0.5; m_vy[11] = m_ys1; m_vx[12] = m_xp1 + m_grid_width * 0.5; m_vy[12] = m_yp1 + m_grid_width * 0.5; m_vx[13] = m_xs1; m_vy[13] = m_yp1 + m_grid_width * 0.5; m_vx[14] = m_xs2; m_vy[14] = m_yp2 + m_grid_width * 0.5; m_vx[15] = m_xp2 + m_grid_width * 0.5; m_vy[15] = m_yp2 + m_grid_width * 0.5; m_vx[16] = m_xp2 + m_grid_width * 0.5; m_vy[16] = m_ys2; m_vx[17] = m_xp2 - m_grid_width * 0.5; m_vy[17] = m_ys2; m_vx[18] = m_xp2 - m_grid_width * 0.5; m_vy[18] = m_yp2 - m_grid_width * 0.5; m_vx[19] = m_xs2; m_vy[19] = m_yp2 - m_grid_width * 0.5; break; case 4: // Point1 calc_points(); if(m_p1_active) m_ellipse.init(m_xp2, m_yp2, m_point_size, m_point_size, 32); else m_ellipse.init(m_xp1, m_yp1, m_point_size, m_point_size, 32); break; case 5: // Point2 calc_points(); if(m_p1_active) m_ellipse.init(m_xp1, m_yp1, m_point_size, m_point_size, 32); else m_ellipse.init(m_xp2, m_yp2, m_point_size, m_point_size, 32); break; case 6: // Text m_gamma_spline.values(&kx1, &ky1, &kx2, &ky2); sprintf(tbuf, "%5.3f %5.3f %5.3f %5.3f", kx1, ky1, kx2, ky2); m_text.text(tbuf); m_text.size(m_text_height, m_text_width); m_text.start_point(m_xt1 + m_border_width * 2.0, (m_yt1 + m_yt2) * 0.5 - m_text_height * 0.5); m_text_poly.width(m_text_thickness); m_text_poly.line_join(round_join); m_text_poly.line_cap(round_cap); m_text_poly.rewind(0); break; } } //------------------------------------------------------------------------ unsigned gamma_ctrl_impl::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; switch(m_idx) { case 0: if(m_vertex == 0) cmd = path_cmd_move_to; if(m_vertex >= 4) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 1: if(m_vertex == 0 || m_vertex == 4 || m_vertex == 8) cmd = path_cmd_move_to; if(m_vertex >= 12) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 2: cmd = m_curve_poly.vertex(x, y); break; case 3: if(m_vertex == 0 || m_vertex == 4 || m_vertex == 8 || m_vertex == 14) cmd = path_cmd_move_to; if(m_vertex >= 20) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 4: // Point1 case 5: // Point2 cmd = m_ellipse.vertex(x, y); break; case 6: cmd = m_text_poly.vertex(x, y); break; default: cmd = path_cmd_stop; break; } if(!is_stop(cmd)) { transform_xy(x, y); } return cmd; } //------------------------------------------------------------------------ bool gamma_ctrl_impl::on_arrow_keys(bool left, bool right, bool down, bool up) { double kx1, ky1, kx2, ky2; bool ret = false; m_gamma_spline.values(&kx1, &ky1, &kx2, &ky2); if(m_p1_active) { if(left) { kx1 -= 0.005; ret = true; } if(right) { kx1 += 0.005; ret = true; } if(down) { ky1 -= 0.005; ret = true; } if(up) { ky1 += 0.005; ret = true; } } else { if(left) { kx2 += 0.005; ret = true; } if(right) { kx2 -= 0.005; ret = true; } if(down) { ky2 += 0.005; ret = true; } if(up) { ky2 -= 0.005; ret = true; } } if(ret) { m_gamma_spline.values(kx1, ky1, kx2, ky2); } return ret; } //------------------------------------------------------------------------ void gamma_ctrl_impl::change_active_point() { m_p1_active = m_p1_active ? false : true; } //------------------------------------------------------------------------ bool gamma_ctrl_impl::in_rect(double x, double y) const { inverse_transform_xy(&x, &y); return x >= m_x1 && x <= m_x2 && y >= m_y1 && y <= m_y2; } //------------------------------------------------------------------------ bool gamma_ctrl_impl::on_mouse_button_down(double x, double y) { inverse_transform_xy(&x, &y); calc_points(); if(calc_distance(x, y, m_xp1, m_yp1) <= m_point_size + 1) { m_mouse_point = 1; m_pdx = m_xp1 - x; m_pdy = m_yp1 - y; m_p1_active = true; return true; } if(calc_distance(x, y, m_xp2, m_yp2) <= m_point_size + 1) { m_mouse_point = 2; m_pdx = m_xp2 - x; m_pdy = m_yp2 - y; m_p1_active = false; return true; } return false; } //------------------------------------------------------------------------ bool gamma_ctrl_impl::on_mouse_button_up(double, double) { if(m_mouse_point) { m_mouse_point = 0; return true; } return false; } //------------------------------------------------------------------------ bool gamma_ctrl_impl::on_mouse_move(double x, double y, bool button_flag) { inverse_transform_xy(&x, &y); if(!button_flag) { return on_mouse_button_up(x, y); } if(m_mouse_point == 1) { m_xp1 = x + m_pdx; m_yp1 = y + m_pdy; calc_values(); return true; } if(m_mouse_point == 2) { m_xp2 = x + m_pdx; m_yp2 = y + m_pdy; calc_values(); return true; } return false; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ctrl/agg_rbox_ctrl.cpp0000644000175000017500000002310113233644505024423 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // classes rbox_ctrl_impl, rbox_ctrl // //---------------------------------------------------------------------------- #include #include "ctrl/agg_rbox_ctrl.h" namespace agg24 { //------------------------------------------------------------------------ rbox_ctrl_impl::rbox_ctrl_impl(double x1, double y1, double x2, double y2, bool flip_y) : ctrl(x1, y1, x2, y2, flip_y), m_border_width(1.0), m_border_extra(0.0), m_text_thickness(1.5), m_text_height(9.0), m_text_width(0.0), m_num_items(0), m_cur_item(-1), m_ellipse_poly(m_ellipse), m_text_poly(m_text), m_idx(0), m_vertex(0) { calc_rbox(); } //------------------------------------------------------------------------ void rbox_ctrl_impl::calc_rbox() { m_xs1 = m_x1 + m_border_width; m_ys1 = m_y1 + m_border_width; m_xs2 = m_x2 - m_border_width; m_ys2 = m_y2 - m_border_width; } //------------------------------------------------------------------------ void rbox_ctrl_impl::add_item(const char* text) { if(m_num_items < 32) { m_items[m_num_items].resize(strlen(text) + 1); strcpy(&m_items[m_num_items][0], text); m_num_items++; } } //------------------------------------------------------------------------ void rbox_ctrl_impl::border_width(double t, double extra) { m_border_width = t; m_border_extra = extra; calc_rbox(); } //------------------------------------------------------------------------ void rbox_ctrl_impl::text_size(double h, double w) { m_text_width = w; m_text_height = h; } //------------------------------------------------------------------------ void rbox_ctrl_impl::rewind(unsigned idx) { m_idx = idx; m_dy = m_text_height * 2.0; m_draw_item = 0; switch(idx) { default: case 0: // Background m_vertex = 0; m_vx[0] = m_x1 - m_border_extra; m_vy[0] = m_y1 - m_border_extra; m_vx[1] = m_x2 + m_border_extra; m_vy[1] = m_y1 - m_border_extra; m_vx[2] = m_x2 + m_border_extra; m_vy[2] = m_y2 + m_border_extra; m_vx[3] = m_x1 - m_border_extra; m_vy[3] = m_y2 + m_border_extra; break; case 1: // Border m_vertex = 0; m_vx[0] = m_x1; m_vy[0] = m_y1; m_vx[1] = m_x2; m_vy[1] = m_y1; m_vx[2] = m_x2; m_vy[2] = m_y2; m_vx[3] = m_x1; m_vy[3] = m_y2; m_vx[4] = m_x1 + m_border_width; m_vy[4] = m_y1 + m_border_width; m_vx[5] = m_x1 + m_border_width; m_vy[5] = m_y2 - m_border_width; m_vx[6] = m_x2 - m_border_width; m_vy[6] = m_y2 - m_border_width; m_vx[7] = m_x2 - m_border_width; m_vy[7] = m_y1 + m_border_width; break; case 2: // Text m_text.text(&m_items[0][0]); m_text.start_point(m_xs1 + m_dy * 1.5, m_ys1 + m_dy / 2.0); m_text.size(m_text_height, m_text_width); m_text_poly.width(m_text_thickness); m_text_poly.line_join(round_join); m_text_poly.line_cap(round_cap); m_text_poly.rewind(0); break; case 3: // Inactive items m_ellipse.init(m_xs1 + m_dy / 1.3, m_ys1 + m_dy / 1.3, m_text_height / 1.5, m_text_height / 1.5, 32); m_ellipse_poly.width(m_text_thickness); m_ellipse_poly.rewind(0); break; case 4: // Active Item if(m_cur_item >= 0) { m_ellipse.init(m_xs1 + m_dy / 1.3, m_ys1 + m_dy * m_cur_item + m_dy / 1.3, m_text_height / 2.0, m_text_height / 2.0, 32); m_ellipse.rewind(0); } break; } } //------------------------------------------------------------------------ unsigned rbox_ctrl_impl::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; switch(m_idx) { case 0: if(m_vertex == 0) cmd = path_cmd_move_to; if(m_vertex >= 4) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 1: if(m_vertex == 0 || m_vertex == 4) cmd = path_cmd_move_to; if(m_vertex >= 8) cmd = path_cmd_stop; *x = m_vx[m_vertex]; *y = m_vy[m_vertex]; m_vertex++; break; case 2: cmd = m_text_poly.vertex(x, y); if(is_stop(cmd)) { m_draw_item++; if(m_draw_item >= m_num_items) { break; } else { m_text.text(&m_items[m_draw_item][0]); m_text.start_point(m_xs1 + m_dy * 1.5, m_ys1 + m_dy * (m_draw_item + 1) - m_dy / 2.0); m_text_poly.rewind(0); cmd = m_text_poly.vertex(x, y); } } break; case 3: cmd = m_ellipse_poly.vertex(x, y); if(is_stop(cmd)) { m_draw_item++; if(m_draw_item >= m_num_items) { break; } else { m_ellipse.init(m_xs1 + m_dy / 1.3, m_ys1 + m_dy * m_draw_item + m_dy / 1.3, m_text_height / 1.5, m_text_height / 1.5, 32); m_ellipse_poly.rewind(0); cmd = m_ellipse_poly.vertex(x, y); } } break; case 4: if(m_cur_item >= 0) { cmd = m_ellipse.vertex(x, y); } else { cmd = path_cmd_stop; } break; default: cmd = path_cmd_stop; break; } if(!is_stop(cmd)) { transform_xy(x, y); } return cmd; } //------------------------------------------------------------------------ bool rbox_ctrl_impl::in_rect(double x, double y) const { inverse_transform_xy(&x, &y); return x >= m_x1 && x <= m_x2 && y >= m_y1 && y <= m_y2; } //------------------------------------------------------------------------ bool rbox_ctrl_impl::on_mouse_button_down(double x, double y) { inverse_transform_xy(&x, &y); unsigned i; for(i = 0; i < m_num_items; i++) { double xp = m_xs1 + m_dy / 1.3; double yp = m_ys1 + m_dy * i + m_dy / 1.3; if(calc_distance(x, y, xp, yp) <= m_text_height / 1.5) { m_cur_item = int(i); return true; } } return false; } //------------------------------------------------------------------------ bool rbox_ctrl_impl::on_mouse_move(double, double, bool) { return false; } //------------------------------------------------------------------------ bool rbox_ctrl_impl::on_mouse_button_up(double, double) { return false; } //------------------------------------------------------------------------ bool rbox_ctrl_impl::on_arrow_keys(bool left, bool right, bool down, bool up) { if(m_cur_item >= 0) { if(up || right) { m_cur_item++; if(m_cur_item >= int(m_num_items)) { m_cur_item = 0; } return true; } if(down || left) { m_cur_item--; if(m_cur_item < 0) { m_cur_item = m_num_items - 1; } return true; } } return false; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/0000755000175000017500000000000013544357604021774 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/mac/0000755000175000017500000000000013544357604022534 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/mac/agg_platform_support.cpp0000644000175000017500000010622513233644505027476 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (McSeem) // Copyright (C) 2003 Hansruedi Baer (MacOS support) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com // baer@karto.baug.eth.ch //---------------------------------------------------------------------------- // // class platform_support // //---------------------------------------------------------------------------- // // Note: // I tried to retain the original structure for the Win32 platform as far // as possible. Currently, not all features are implemented but the examples // should work properly. // HB //---------------------------------------------------------------------------- #include #if defined(__MWERKS__) #include "console.h" #endif #include #include #include "platform/agg_platform_support.h" #include "platform/mac/agg_mac_pmap.h" #include "util/agg_color_conv_rgb8.h" namespace agg24 { pascal OSStatus DoWindowClose (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData); pascal OSStatus DoWindowDrawContent (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData); pascal OSStatus DoAppQuit (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData); pascal OSStatus DoMouseDown (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData); pascal OSStatus DoMouseUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData); pascal OSStatus DoMouseDragged (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData); pascal OSStatus DoKeyDown (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData); pascal OSStatus DoKeyUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData); pascal void DoPeriodicTask (EventLoopTimerRef theTimer, void* userData); //------------------------------------------------------------------------ class platform_specific { public: platform_specific(pix_format_e format, bool flip_y); void create_pmap(unsigned width, unsigned height, rendering_buffer* wnd); void display_pmap(WindowRef window, const rendering_buffer* src); bool load_pmap(const char* fn, unsigned idx, rendering_buffer* dst); bool save_pmap(const char* fn, unsigned idx, const rendering_buffer* src); unsigned translate(unsigned keycode); pix_format_e m_format; pix_format_e m_sys_format; bool m_flip_y; unsigned m_bpp; unsigned m_sys_bpp; WindowRef m_window; pixel_map m_pmap_window; pixel_map m_pmap_img[platform_support::max_images]; unsigned m_keymap[256]; unsigned m_last_translated_key; int m_cur_x; int m_cur_y; unsigned m_input_flags; bool m_redraw_flag; UnsignedWide m_sw_freq; UnsignedWide m_sw_start; }; //------------------------------------------------------------------------ platform_specific::platform_specific(pix_format_e format, bool flip_y) : m_format(format), m_sys_format(pix_format_undefined), m_flip_y(flip_y), m_bpp(0), m_sys_bpp(0), m_window(nil), m_last_translated_key(0), m_cur_x(0), m_cur_y(0), m_input_flags(0), m_redraw_flag(true) { memset(m_keymap, 0, sizeof(m_keymap)); //Keyboard input is not yet fully supported nor tested //m_keymap[VK_PAUSE] = key_pause; m_keymap[kClearCharCode] = key_clear; //m_keymap[VK_NUMPAD0] = key_kp0; //m_keymap[VK_NUMPAD1] = key_kp1; //m_keymap[VK_NUMPAD2] = key_kp2; //m_keymap[VK_NUMPAD3] = key_kp3; //m_keymap[VK_NUMPAD4] = key_kp4; //m_keymap[VK_NUMPAD5] = key_kp5; //m_keymap[VK_NUMPAD6] = key_kp6; //m_keymap[VK_NUMPAD7] = key_kp7; //m_keymap[VK_NUMPAD8] = key_kp8; //m_keymap[VK_NUMPAD9] = key_kp9; //m_keymap[VK_DECIMAL] = key_kp_period; //m_keymap[VK_DIVIDE] = key_kp_divide; //m_keymap[VK_MULTIPLY] = key_kp_multiply; //m_keymap[VK_SUBTRACT] = key_kp_minus; //m_keymap[VK_ADD] = key_kp_plus; m_keymap[kUpArrowCharCode] = key_up; m_keymap[kDownArrowCharCode] = key_down; m_keymap[kRightArrowCharCode] = key_right; m_keymap[kLeftArrowCharCode] = key_left; //m_keymap[VK_INSERT] = key_insert; m_keymap[kDeleteCharCode] = key_delete; m_keymap[kHomeCharCode] = key_home; m_keymap[kEndCharCode] = key_end; m_keymap[kPageUpCharCode] = key_page_up; m_keymap[kPageDownCharCode] = key_page_down; //m_keymap[VK_F1] = key_f1; //m_keymap[VK_F2] = key_f2; //m_keymap[VK_F3] = key_f3; //m_keymap[VK_F4] = key_f4; //m_keymap[VK_F5] = key_f5; //m_keymap[VK_F6] = key_f6; //m_keymap[VK_F7] = key_f7; //m_keymap[VK_F8] = key_f8; //m_keymap[VK_F9] = key_f9; //m_keymap[VK_F10] = key_f10; //m_keymap[VK_F11] = key_f11; //m_keymap[VK_F12] = key_f12; //m_keymap[VK_F13] = key_f13; //m_keymap[VK_F14] = key_f14; //m_keymap[VK_F15] = key_f15; //m_keymap[VK_NUMLOCK] = key_numlock; //m_keymap[VK_CAPITAL] = key_capslock; //m_keymap[VK_SCROLL] = key_scrollock; switch(m_format) { case pix_format_gray8: m_sys_format = pix_format_gray8; m_bpp = 8; m_sys_bpp = 8; break; case pix_format_rgb565: case pix_format_rgb555: m_sys_format = pix_format_rgb555; m_bpp = 16; m_sys_bpp = 16; break; case pix_format_rgb24: case pix_format_bgr24: m_sys_format = pix_format_rgb24; m_bpp = 24; m_sys_bpp = 24; break; case pix_format_bgra32: case pix_format_abgr32: case pix_format_argb32: case pix_format_rgba32: m_sys_format = pix_format_argb32; m_bpp = 32; m_sys_bpp = 32; break; } ::Microseconds(&m_sw_freq); ::Microseconds(&m_sw_start); } //------------------------------------------------------------------------ void platform_specific::create_pmap(unsigned width, unsigned height, rendering_buffer* wnd) { m_pmap_window.create(width, height, org_e(m_bpp)); wnd->attach(m_pmap_window.buf(), m_pmap_window.width(), m_pmap_window.height(), m_flip_y ? -m_pmap_window.row_bytes() : m_pmap_window.row_bytes()); } //------------------------------------------------------------------------ void platform_specific::display_pmap(WindowRef window, const rendering_buffer* src) { if(m_sys_format == m_format) { m_pmap_window.draw(window); } else { pixel_map pmap_tmp; pmap_tmp.create(m_pmap_window.width(), m_pmap_window.height(), org_e(m_sys_bpp)); rendering_buffer rbuf_tmp; rbuf_tmp.attach(pmap_tmp.buf(), pmap_tmp.width(), pmap_tmp.height(), m_flip_y ? -pmap_tmp.row_bytes() : pmap_tmp.row_bytes()); switch(m_format) { case pix_format_gray8: return; case pix_format_rgb565: color_conv(&rbuf_tmp, src, color_conv_rgb565_to_rgb555()); break; case pix_format_bgr24: color_conv(&rbuf_tmp, src, color_conv_bgr24_to_rgb24()); break; case pix_format_abgr32: color_conv(&rbuf_tmp, src, color_conv_abgr32_to_argb32()); break; case pix_format_bgra32: color_conv(&rbuf_tmp, src, color_conv_bgra32_to_argb32()); break; case pix_format_rgba32: color_conv(&rbuf_tmp, src, color_conv_rgba32_to_argb32()); break; } pmap_tmp.draw(window); } } //------------------------------------------------------------------------ bool platform_specific::save_pmap(const char* fn, unsigned idx, const rendering_buffer* src) { if(m_sys_format == m_format) { return m_pmap_img[idx].save_as_qt(fn); } else { pixel_map pmap_tmp; pmap_tmp.create(m_pmap_img[idx].width(), m_pmap_img[idx].height(), org_e(m_sys_bpp)); rendering_buffer rbuf_tmp; rbuf_tmp.attach(pmap_tmp.buf(), pmap_tmp.width(), pmap_tmp.height(), m_flip_y ? -pmap_tmp.row_bytes() : pmap_tmp.row_bytes()); switch(m_format) { case pix_format_gray8: return false; case pix_format_rgb565: color_conv(&rbuf_tmp, src, color_conv_rgb565_to_rgb555()); break; case pix_format_rgb24: color_conv(&rbuf_tmp, src, color_conv_rgb24_to_bgr24()); break; case pix_format_abgr32: color_conv(&rbuf_tmp, src, color_conv_abgr32_to_bgra32()); break; case pix_format_argb32: color_conv(&rbuf_tmp, src, color_conv_argb32_to_bgra32()); break; case pix_format_rgba32: color_conv(&rbuf_tmp, src, color_conv_rgba32_to_bgra32()); break; } return pmap_tmp.save_as_qt(fn); } return true; } //------------------------------------------------------------------------ bool platform_specific::load_pmap(const char* fn, unsigned idx, rendering_buffer* dst) { pixel_map pmap_tmp; if(!pmap_tmp.load_from_qt(fn)) return false; rendering_buffer rbuf_tmp; rbuf_tmp.attach(pmap_tmp.buf(), pmap_tmp.width(), pmap_tmp.height(), m_flip_y ? -pmap_tmp.row_bytes() : pmap_tmp.row_bytes()); m_pmap_img[idx].create(pmap_tmp.width(), pmap_tmp.height(), org_e(m_bpp), 0); dst->attach(m_pmap_img[idx].buf(), m_pmap_img[idx].width(), m_pmap_img[idx].height(), m_flip_y ? -m_pmap_img[idx].row_bytes() : m_pmap_img[idx].row_bytes()); switch(m_format) { case pix_format_gray8: return false; break; case pix_format_rgb555: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgb555()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_rgb24_to_rgb555()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_argb32_to_rgb555()); break; } break; case pix_format_rgb565: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgb565()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_rgb24_to_rgb565()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_argb32_to_rgb565()); break; } break; case pix_format_rgb24: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgb24()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_rgb24_to_rgb24()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_argb32_to_rgb24()); break; } break; case pix_format_bgr24: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_bgr24()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_rgb24_to_bgr24()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_argb32_to_bgr24()); break; } break; case pix_format_abgr32: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_abgr32()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_rgb24_to_abgr32()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_argb32_to_abgr32()); break; } break; case pix_format_argb32: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_argb32()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_rgb24_to_argb32()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_argb32_to_argb32()); break; } break; case pix_format_bgra32: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_bgra32()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_rgb24_to_bgra32()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_argb32_to_bgra32()); break; } break; case pix_format_rgba32: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgba32()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_rgb24_to_rgba32()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_argb32_to_rgba32()); break; } break; } return true; } //------------------------------------------------------------------------ unsigned platform_specific::translate(unsigned keycode) { return m_last_translated_key = (keycode > 255) ? 0 : m_keymap[keycode]; } //------------------------------------------------------------------------ platform_support::platform_support(pix_format_e format, bool flip_y) : m_specific(new platform_specific(format, flip_y)), m_format(format), m_bpp(m_specific->m_bpp), m_window_flags(0), m_wait_mode(true), m_flip_y(flip_y), m_initial_width(10), m_initial_height(10) { strcpy(m_caption, "Anti-Grain Geometry Application"); } //------------------------------------------------------------------------ platform_support::~platform_support() { delete m_specific; } //------------------------------------------------------------------------ void platform_support::caption(const char* cap) { strcpy(m_caption, cap); if(m_specific->m_window) { SetWindowTitleWithCFString (m_specific->m_window, CFStringCreateWithCStringNoCopy (nil, cap, kCFStringEncodingASCII, nil)); } } //------------------------------------------------------------------------ static unsigned get_key_flags(UInt32 wflags) { unsigned flags = 0; if(wflags & shiftKey) flags |= kbd_shift; if(wflags & controlKey) flags |= kbd_ctrl; return flags; } //------------------------------------------------------------------------ void platform_support::message(const char* msg) { SInt16 item; Str255 p_msg; ::CopyCStringToPascal (msg, p_msg); ::StandardAlert (kAlertPlainAlert, (const unsigned char*) "\pAGG Message", p_msg, NULL, &item); } //------------------------------------------------------------------------ void platform_support::start_timer() { ::Microseconds (&(m_specific->m_sw_start)); } //------------------------------------------------------------------------ double platform_support::elapsed_time() const { UnsignedWide stop; ::Microseconds(&stop); return double(stop.lo - m_specific->m_sw_start.lo) * 1e6 / double(m_specific->m_sw_freq.lo); } //------------------------------------------------------------------------ bool platform_support::init(unsigned width, unsigned height, unsigned flags) { if(m_specific->m_sys_format == pix_format_undefined) { return false; } m_window_flags = flags; // application EventTypeSpec eventType; EventHandlerUPP handlerUPP; eventType.eventClass = kEventClassApplication; eventType.eventKind = kEventAppQuit; handlerUPP = NewEventHandlerUPP(DoAppQuit); InstallApplicationEventHandler (handlerUPP, 1, &eventType, nil, nil); eventType.eventClass = kEventClassMouse; eventType.eventKind = kEventMouseDown; handlerUPP = NewEventHandlerUPP(DoMouseDown); InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); eventType.eventKind = kEventMouseUp; handlerUPP = NewEventHandlerUPP(DoMouseUp); InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); eventType.eventKind = kEventMouseDragged; handlerUPP = NewEventHandlerUPP(DoMouseDragged); InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); eventType.eventClass = kEventClassKeyboard; eventType.eventKind = kEventRawKeyDown; handlerUPP = NewEventHandlerUPP(DoKeyDown); InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); eventType.eventKind = kEventRawKeyUp; handlerUPP = NewEventHandlerUPP(DoKeyUp); InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); eventType.eventKind = kEventRawKeyRepeat; handlerUPP = NewEventHandlerUPP(DoKeyDown); // 'key repeat' is translated to 'key down' InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); WindowAttributes windowAttrs; Rect bounds; // window windowAttrs = kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute | kWindowStandardHandlerAttribute; SetRect (&bounds, 0, 0, width, height); OffsetRect (&bounds, 100, 100); CreateNewWindow (kDocumentWindowClass, windowAttrs, &bounds, &m_specific->m_window); if(m_specific->m_window == nil) { return false; } // I assume the text is ASCII. // Change to kCFStringEncodingMacRoman, kCFStringEncodingISOLatin1, kCFStringEncodingUTF8 or what else you need. SetWindowTitleWithCFString (m_specific->m_window, CFStringCreateWithCStringNoCopy (nil, m_caption, kCFStringEncodingASCII, nil)); eventType.eventClass = kEventClassWindow; eventType.eventKind = kEventWindowClose; handlerUPP = NewEventHandlerUPP(DoWindowClose); InstallWindowEventHandler (m_specific->m_window, handlerUPP, 1, &eventType, this, NULL); eventType.eventKind = kEventWindowDrawContent; handlerUPP = NewEventHandlerUPP(DoWindowDrawContent); InstallWindowEventHandler (m_specific->m_window, handlerUPP, 1, &eventType, this, NULL); // Periodic task // Instead of an idle function I use the Carbon event timer. // You may decide to change the wait value which is currently 50 milliseconds. EventLoopRef mainLoop; EventLoopTimerUPP timerUPP; EventLoopTimerRef theTimer; mainLoop = GetMainEventLoop(); timerUPP = NewEventLoopTimerUPP (DoPeriodicTask); InstallEventLoopTimer (mainLoop, 0, 50 * kEventDurationMillisecond, timerUPP, this, &theTimer); m_specific->create_pmap(width, height, &m_rbuf_window); m_initial_width = width; m_initial_height = height; on_init(); on_resize(width, height); m_specific->m_redraw_flag = true; ShowWindow (m_specific->m_window); SetPortWindowPort (m_specific->m_window); return true; } //------------------------------------------------------------------------ int platform_support::run() { RunApplicationEventLoop (); return true; } //------------------------------------------------------------------------ const char* platform_support::img_ext() const { return ".bmp"; } //------------------------------------------------------------------------ const char* platform_support::full_file_name(const char* file_name) { return file_name; } //------------------------------------------------------------------------ bool platform_support::load_img(unsigned idx, const char* file) { if(idx < max_images) { char fn[1024]; strcpy(fn, file); int len = strlen(fn); #if defined(__MWERKS__) if(len < 4 || stricmp(fn + len - 4, ".BMP") != 0) #else if(len < 4 || strncasecmp(fn + len - 4, ".BMP", 4) != 0) #endif { strcat(fn, ".bmp"); } return m_specific->load_pmap(fn, idx, &m_rbuf_img[idx]); } return true; } //------------------------------------------------------------------------ bool platform_support::save_img(unsigned idx, const char* file) { if(idx < max_images) { char fn[1024]; strcpy(fn, file); int len = strlen(fn); #if defined(__MWERKS__) if(len < 4 || stricmp(fn + len - 4, ".BMP") != 0) #else if(len < 4 || strncasecmp(fn + len - 4, ".BMP", 4) != 0) #endif { strcat(fn, ".bmp"); } return m_specific->save_pmap(fn, idx, &m_rbuf_img[idx]); } return true; } //------------------------------------------------------------------------ bool platform_support::create_img(unsigned idx, unsigned width, unsigned height) { if(idx < max_images) { if(width == 0) width = m_specific->m_pmap_window.width(); if(height == 0) height = m_specific->m_pmap_window.height(); m_specific->m_pmap_img[idx].create(width, height, org_e(m_specific->m_bpp)); m_rbuf_img[idx].attach(m_specific->m_pmap_img[idx].buf(), m_specific->m_pmap_img[idx].width(), m_specific->m_pmap_img[idx].height(), m_flip_y ? -m_specific->m_pmap_img[idx].row_bytes() : m_specific->m_pmap_img[idx].row_bytes()); return true; } return false; } //------------------------------------------------------------------------ void platform_support::force_redraw() { Rect bounds; m_specific->m_redraw_flag = true; // on_ctrl_change (); on_draw(); SetRect(&bounds, 0, 0, m_rbuf_window.width(), m_rbuf_window.height()); InvalWindowRect(m_specific->m_window, &bounds); } //------------------------------------------------------------------------ void platform_support::update_window() { m_specific->display_pmap(m_specific->m_window, &m_rbuf_window); } //------------------------------------------------------------------------ void platform_support::on_init() {} void platform_support::on_resize(int sx, int sy) {} void platform_support::on_idle() {} void platform_support::on_mouse_move(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_down(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_up(int x, int y, unsigned flags) {} void platform_support::on_key(int x, int y, unsigned key, unsigned flags) {} void platform_support::on_ctrl_change() {} void platform_support::on_draw() {} void platform_support::on_post_draw(void* raw_handler) {} //------------------------------------------------------------------------ pascal OSStatus DoWindowClose (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { userData; QuitApplicationEventLoop (); return CallNextEventHandler (nextHandler, theEvent); } //------------------------------------------------------------------------ pascal OSStatus DoAppQuit (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { userData; return CallNextEventHandler (nextHandler, theEvent); } //------------------------------------------------------------------------ pascal OSStatus DoMouseDown (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { Point wheresMyMouse; UInt32 modifier; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &wheresMyMouse); GlobalToLocal (&wheresMyMouse); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); platform_support * app = reinterpret_cast(userData); app->m_specific->m_cur_x = wheresMyMouse.h; if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - wheresMyMouse.v; } else { app->m_specific->m_cur_y = wheresMyMouse.v; } app->m_specific->m_input_flags = mouse_left | get_key_flags(modifier); app->m_ctrls.set_cur(app->m_specific->m_cur_x, app->m_specific->m_cur_y); if(app->m_ctrls.on_mouse_button_down(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { app->on_ctrl_change(); app->force_redraw(); } else { if(app->m_ctrls.in_rect(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { if(app->m_ctrls.set_cur(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { app->on_ctrl_change(); app->force_redraw(); } } else { app->on_mouse_button_down(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); } } return CallNextEventHandler (nextHandler, theEvent); } //------------------------------------------------------------------------ pascal OSStatus DoMouseUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { Point wheresMyMouse; UInt32 modifier; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &wheresMyMouse); GlobalToLocal (&wheresMyMouse); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); platform_support * app = reinterpret_cast(userData); app->m_specific->m_cur_x = wheresMyMouse.h; if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - wheresMyMouse.v; } else { app->m_specific->m_cur_y = wheresMyMouse.v; } app->m_specific->m_input_flags = mouse_left | get_key_flags(modifier); if(app->m_ctrls.on_mouse_button_up(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { app->on_ctrl_change(); app->force_redraw(); } app->on_mouse_button_up(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); return CallNextEventHandler (nextHandler, theEvent); } //------------------------------------------------------------------------ pascal OSStatus DoMouseDragged (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { Point wheresMyMouse; UInt32 modifier; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &wheresMyMouse); GlobalToLocal (&wheresMyMouse); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); platform_support * app = reinterpret_cast(userData); app->m_specific->m_cur_x = wheresMyMouse.h; if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - wheresMyMouse.v; } else { app->m_specific->m_cur_y = wheresMyMouse.v; } app->m_specific->m_input_flags = mouse_left | get_key_flags(modifier); if(app->m_ctrls.on_mouse_move( app->m_specific->m_cur_x, app->m_specific->m_cur_y, (app->m_specific->m_input_flags & mouse_left) != 0)) { app->on_ctrl_change(); app->force_redraw(); } else { app->on_mouse_move(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); } return CallNextEventHandler (nextHandler, theEvent); } //------------------------------------------------------------------------ pascal OSStatus DoKeyDown (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { char key_code; UInt32 modifier; GetEventParameter (theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key_code); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); platform_support * app = reinterpret_cast(userData); app->m_specific->m_last_translated_key = 0; switch(modifier) { case controlKey: app->m_specific->m_input_flags |= kbd_ctrl; break; case shiftKey: app->m_specific->m_input_flags |= kbd_shift; break; default: app->m_specific->translate(key_code); break; } if(app->m_specific->m_last_translated_key) { bool left = false; bool up = false; bool right = false; bool down = false; switch(app->m_specific->m_last_translated_key) { case key_left: left = true; break; case key_up: up = true; break; case key_right: right = true; break; case key_down: down = true; break; //On a Mac, screenshots are handled by the system. case key_f2: app->copy_window_to_img(agg24::platform_support::max_images - 1); app->save_img(agg24::platform_support::max_images - 1, "screenshot"); break; } if(app->m_ctrls.on_arrow_keys(left, right, down, up)) { app->on_ctrl_change(); app->force_redraw(); } else { app->on_key(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_last_translated_key, app->m_specific->m_input_flags); } } return CallNextEventHandler (nextHandler, theEvent); } //------------------------------------------------------------------------ pascal OSStatus DoKeyUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { char key_code; UInt32 modifier; GetEventParameter (theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key_code); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); platform_support * app = reinterpret_cast(userData); app->m_specific->m_last_translated_key = 0; switch(modifier) { case controlKey: app->m_specific->m_input_flags &= ~kbd_ctrl; break; case shiftKey: app->m_specific->m_input_flags &= ~kbd_shift; break; } return CallNextEventHandler (nextHandler, theEvent); } //------------------------------------------------------------------------ pascal OSStatus DoWindowDrawContent (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { platform_support * app = reinterpret_cast(userData); if(app) { if(app->m_specific->m_redraw_flag) { app->on_draw(); app->m_specific->m_redraw_flag = false; } app->m_specific->display_pmap(app->m_specific->m_window, &app->rbuf_window()); } return CallNextEventHandler (nextHandler, theEvent); } //------------------------------------------------------------------------ pascal void DoPeriodicTask (EventLoopTimerRef theTimer, void* userData) { platform_support * app = reinterpret_cast(userData); if(!app->wait_mode()) app->on_idle(); } } //---------------------------------------------------------------------------- int agg_main(int argc, char* argv[]); // Hm. Classic MacOS does not know command line input. // CodeWarrior provides a way to mimic command line input. // The function 'ccommand' can be used to get the command // line arguments. //---------------------------------------------------------------------------- int main(int argc, char* argv[]) { #if defined(__MWERKS__) // argc = ccommand (&argv); #endif // Check if we are launched by double-clicking under OSX // Get rid of extra argument, this will confuse the standard argument parsing // calls used in the examples to get the name of the image file to be used if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { argc = 1; } launch: return agg_main(argc, argv); }enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/mac/agg_mac_pmap.cpp0000644000175000017500000002135713233644505025635 0ustar varunvarun//---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- // Contact: mcseemagg@yahoo.com // baer@karto.baug.ethz.ch //---------------------------------------------------------------------------- // // class pixel_map // //---------------------------------------------------------------------------- #include #include #include #include #include "platform/mac/agg_mac_pmap.h" #include "agg_basics.h" namespace agg24 { //------------------------------------------------------------------------ pixel_map::~pixel_map() { destroy(); } //------------------------------------------------------------------------ pixel_map::pixel_map() : m_pmap(0), m_buf(0), m_bpp(0), m_img_size(0) { } //------------------------------------------------------------------------ void pixel_map::destroy() { delete[] m_buf; m_buf = NULL; if (m_pmap != nil) { DisposeGWorld(m_pmap); m_pmap = nil; } } //------------------------------------------------------------------------ void pixel_map::create(unsigned width, unsigned height, org_e org, unsigned clear_val) { destroy(); if(width == 0) width = 1; if(height == 0) height = 1; m_bpp = org; Rect r; int row_bytes = calc_row_len (width, m_bpp); MacSetRect(&r, 0, 0, width, height); m_buf = new unsigned char[m_img_size = row_bytes * height]; // The Quicktime version for creating GWorlds is more flexible than the classical function. QTNewGWorldFromPtr (&m_pmap, m_bpp, &r, nil, nil, 0, m_buf, row_bytes); // create_gray_scale_palette(m_pmap); I didn't care about gray scale palettes so far. if(clear_val <= 255) { memset(m_buf, clear_val, m_img_size); } } //------------------------------------------------------------------------ void pixel_map::clear(unsigned clear_val) { if(m_buf) memset(m_buf, clear_val, m_img_size); } //static //This function is just copied from the Win32 plattform support. //Is also seems to be appropriate for MacOS as well, but it is not //thouroughly tested so far. //------------------------------------------------------------------------ unsigned pixel_map::calc_row_len(unsigned width, unsigned bits_per_pixel) { unsigned n = width; unsigned k; switch(bits_per_pixel) { case 1: k = n; n = n >> 3; if(k & 7) n++; break; case 4: k = n; n = n >> 1; if(k & 3) n++; break; case 8: break; case 16: n = n << 1; break; case 24: n = (n << 1) + n; break; case 32: n = n << 2; break; default: n = 0; break; } return ((n + 3) >> 2) << 2; } //------------------------------------------------------------------------ void pixel_map::draw(WindowRef window, const Rect *device_rect, const Rect *pmap_rect) const { if(m_pmap == nil || m_buf == NULL) return; PixMapHandle pm = GetGWorldPixMap (m_pmap); CGrafPtr port = GetWindowPort (window); Rect dest_rect; // Again, I used the Quicktime version. // Good old 'CopyBits' does better interpolation when scaling // but does not support all pixel depths. MacSetRect (&dest_rect, 0, 0, this->width(), this->height()); ImageDescriptionHandle image_description; MakeImageDescriptionForPixMap (pm, &image_description); if (image_description != nil) { DecompressImage (GetPixBaseAddr (pm), image_description, GetPortPixMap (port), nil, &dest_rect, ditherCopy, nil); DisposeHandle ((Handle) image_description); } } //------------------------------------------------------------------------ void pixel_map::draw(WindowRef window, int x, int y, double scale) const { if(m_pmap == nil || m_buf == NULL) return; unsigned width = this->width() * scale; unsigned height = this->height() * scale; Rect rect; SetRect (&rect, x, y, x + width, y + height); draw(window, &rect); } //------------------------------------------------------------------------ void pixel_map::blend(WindowRef window, const Rect *device_rect, const Rect *bmp_rect) const { draw (window, device_rect, bmp_rect); // currently just mapped to drawing method } //------------------------------------------------------------------------ void pixel_map::blend(WindowRef window, int x, int y, double scale) const { draw(window, x, y, scale); // currently just mapped to drawing method } // I let Quicktime handle image import since it supports most popular // image formats such as: // *.psd, *.bmp, *.tif, *.png, *.jpg, *.gif, *.pct, *.pcx //------------------------------------------------------------------------ bool pixel_map::load_from_qt(const char *filename) { FSSpec fss; OSErr err; // get file specification to application directory err = HGetVol(nil, &fss.vRefNum, &fss.parID); if (err == noErr) { CopyCStringToPascal(filename, fss.name); GraphicsImportComponent gi; err = GetGraphicsImporterForFile (&fss, &gi); if (err == noErr) { ImageDescriptionHandle desc; GraphicsImportGetImageDescription(gi, &desc); // For simplicity, all images are currently converted to 32 bit. // create an empty pixelmap short depth = 32; create ((**desc).width, (**desc).height, (org_e)depth, 0xff); DisposeHandle ((Handle)desc); // let Quicktime draw to pixelmap GraphicsImportSetGWorld(gi, m_pmap, nil); GraphicsImportDraw(gi); // Well, this is a hack. The graphics importer sets the alpha channel of the pixelmap to 0x00 // for imported images without alpha channel but this would cause agg to draw an invisible image. // set alpha channel to 0xff unsigned char * buf = m_buf; for (unsigned int size = 0; size < m_img_size; size += 4) { *buf = 0xff; buf += 4; } } } return err == noErr; } //------------------------------------------------------------------------ bool pixel_map::save_as_qt(const char *filename) const { FSSpec fss; OSErr err; // get file specification to application directory err = HGetVol(nil, &fss.vRefNum, &fss.parID); if (err == noErr) { GraphicsExportComponent ge; CopyCStringToPascal(filename, fss.name); // I decided to use PNG as output image file type. // There are a number of other available formats. // Should I check the file suffix to choose the image file format? err = OpenADefaultComponent(GraphicsExporterComponentType, kQTFileTypePNG, &ge); if (err == noErr) { err = GraphicsExportSetInputGWorld(ge, m_pmap); if (err == noErr) { err = GraphicsExportSetOutputFile (ge, &fss); if (err == noErr) { GraphicsExportDoExport(ge, nil); } } CloseComponent(ge); } } return err == noErr; } //------------------------------------------------------------------------ unsigned char* pixel_map::buf() { return m_buf; } //------------------------------------------------------------------------ unsigned pixel_map::width() const { if(m_pmap == nil) return 0; PixMapHandle pm = GetGWorldPixMap (m_pmap); Rect bounds; GetPixBounds (pm, &bounds); return bounds.right - bounds.left; } //------------------------------------------------------------------------ unsigned pixel_map::height() const { if(m_pmap == nil) return 0; PixMapHandle pm = GetGWorldPixMap (m_pmap); Rect bounds; GetPixBounds (pm, &bounds); return bounds.bottom - bounds.top; } //------------------------------------------------------------------------ int pixel_map::row_bytes() const { if(m_pmap == nil) return 0; PixMapHandle pm = GetGWorldPixMap (m_pmap); return calc_row_len(width(), GetPixDepth(pm)); } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/mac/Makefile.am0000644000175000017500000000055413233644505024566 0ustar varunvarunif ENABLE_OSX lib_LTLIBRARIES = libaggplatformmac.la libaggplatformmac_la_LDFLAGS=-version-info @AGG_LIB_VERSION@ libaggplatformmac_la_SOURCES=agg_mac_pmap.cpp \ agg_platform_support.cpp libaggplatformmac_la_CXXFLAGS = -I$(top_srcdir)/include @OSX_CFLAGS@ libaggplatformmac_la_LIBADD = @OSX_LIBS@ $(top_builddir)/src/libagg.la endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/X11/0000755000175000017500000000000013544357604022345 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/X11/agg_platform_support.cpp0000644000175000017500000014332013233644505027304 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class platform_support. X11 version. // //---------------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include #include "agg_basics.h" #include "util/agg_color_conv_rgb8.h" #include "platform/agg_platform_support.h" namespace agg24 { //------------------------------------------------------------------------ class platform_specific { public: platform_specific(pix_format_e format, bool flip_y); ~platform_specific(); void caption(const char* capt); void put_image(const rendering_buffer* src); pix_format_e m_format; pix_format_e m_sys_format; int m_byte_order; bool m_flip_y; unsigned m_bpp; unsigned m_sys_bpp; Display* m_display; int m_screen; int m_depth; Visual* m_visual; Window m_window; GC m_gc; XImage* m_ximg_window; XSetWindowAttributes m_window_attributes; Atom m_close_atom; unsigned char* m_buf_window; unsigned char* m_buf_img[platform_support::max_images]; unsigned m_keymap[256]; bool m_update_flag; bool m_resize_flag; bool m_initialized; //bool m_wait_mode; clock_t m_sw_start; }; //------------------------------------------------------------------------ platform_specific::platform_specific(pix_format_e format, bool flip_y) : m_format(format), m_sys_format(pix_format_undefined), m_byte_order(LSBFirst), m_flip_y(flip_y), m_bpp(0), m_sys_bpp(0), m_display(0), m_screen(0), m_depth(0), m_visual(0), m_window(0), m_gc(0), m_ximg_window(0), m_close_atom(0), m_buf_window(0), m_update_flag(true), m_resize_flag(true), m_initialized(false) //m_wait_mode(true) { memset(m_buf_img, 0, sizeof(m_buf_img)); unsigned i; for(i = 0; i < 256; i++) { m_keymap[i] = i; } m_keymap[XK_Pause&0xFF] = key_pause; m_keymap[XK_Clear&0xFF] = key_clear; m_keymap[XK_KP_0&0xFF] = key_kp0; m_keymap[XK_KP_1&0xFF] = key_kp1; m_keymap[XK_KP_2&0xFF] = key_kp2; m_keymap[XK_KP_3&0xFF] = key_kp3; m_keymap[XK_KP_4&0xFF] = key_kp4; m_keymap[XK_KP_5&0xFF] = key_kp5; m_keymap[XK_KP_6&0xFF] = key_kp6; m_keymap[XK_KP_7&0xFF] = key_kp7; m_keymap[XK_KP_8&0xFF] = key_kp8; m_keymap[XK_KP_9&0xFF] = key_kp9; m_keymap[XK_KP_Insert&0xFF] = key_kp0; m_keymap[XK_KP_End&0xFF] = key_kp1; m_keymap[XK_KP_Down&0xFF] = key_kp2; m_keymap[XK_KP_Page_Down&0xFF] = key_kp3; m_keymap[XK_KP_Left&0xFF] = key_kp4; m_keymap[XK_KP_Begin&0xFF] = key_kp5; m_keymap[XK_KP_Right&0xFF] = key_kp6; m_keymap[XK_KP_Home&0xFF] = key_kp7; m_keymap[XK_KP_Up&0xFF] = key_kp8; m_keymap[XK_KP_Page_Up&0xFF] = key_kp9; m_keymap[XK_KP_Delete&0xFF] = key_kp_period; m_keymap[XK_KP_Decimal&0xFF] = key_kp_period; m_keymap[XK_KP_Divide&0xFF] = key_kp_divide; m_keymap[XK_KP_Multiply&0xFF] = key_kp_multiply; m_keymap[XK_KP_Subtract&0xFF] = key_kp_minus; m_keymap[XK_KP_Add&0xFF] = key_kp_plus; m_keymap[XK_KP_Enter&0xFF] = key_kp_enter; m_keymap[XK_KP_Equal&0xFF] = key_kp_equals; m_keymap[XK_Up&0xFF] = key_up; m_keymap[XK_Down&0xFF] = key_down; m_keymap[XK_Right&0xFF] = key_right; m_keymap[XK_Left&0xFF] = key_left; m_keymap[XK_Insert&0xFF] = key_insert; m_keymap[XK_Home&0xFF] = key_delete; m_keymap[XK_End&0xFF] = key_end; m_keymap[XK_Page_Up&0xFF] = key_page_up; m_keymap[XK_Page_Down&0xFF] = key_page_down; m_keymap[XK_F1&0xFF] = key_f1; m_keymap[XK_F2&0xFF] = key_f2; m_keymap[XK_F3&0xFF] = key_f3; m_keymap[XK_F4&0xFF] = key_f4; m_keymap[XK_F5&0xFF] = key_f5; m_keymap[XK_F6&0xFF] = key_f6; m_keymap[XK_F7&0xFF] = key_f7; m_keymap[XK_F8&0xFF] = key_f8; m_keymap[XK_F9&0xFF] = key_f9; m_keymap[XK_F10&0xFF] = key_f10; m_keymap[XK_F11&0xFF] = key_f11; m_keymap[XK_F12&0xFF] = key_f12; m_keymap[XK_F13&0xFF] = key_f13; m_keymap[XK_F14&0xFF] = key_f14; m_keymap[XK_F15&0xFF] = key_f15; m_keymap[XK_Num_Lock&0xFF] = key_numlock; m_keymap[XK_Caps_Lock&0xFF] = key_capslock; m_keymap[XK_Scroll_Lock&0xFF] = key_scrollock; switch(m_format) { default: break; case pix_format_gray8: m_bpp = 8; break; case pix_format_rgb565: case pix_format_rgb555: m_bpp = 16; break; case pix_format_rgb24: case pix_format_bgr24: m_bpp = 24; break; case pix_format_bgra32: case pix_format_abgr32: case pix_format_argb32: case pix_format_rgba32: m_bpp = 32; break; } m_sw_start = clock(); } //------------------------------------------------------------------------ platform_specific::~platform_specific() { } //------------------------------------------------------------------------ void platform_specific::caption(const char* capt) { XTextProperty tp; tp.value = (unsigned char *)capt; tp.encoding = XA_WM_NAME; tp.format = 8; tp.nitems = strlen(capt); XSetWMName(m_display, m_window, &tp); XStoreName(m_display, m_window, capt); XSetIconName(m_display, m_window, capt); XSetWMIconName(m_display, m_window, &tp); } //------------------------------------------------------------------------ void platform_specific::put_image(const rendering_buffer* src) { if(m_ximg_window == 0) return; m_ximg_window->data = (char*)m_buf_window; if(m_format == m_sys_format) { XPutImage(m_display, m_window, m_gc, m_ximg_window, 0, 0, 0, 0, src->width(), src->height()); } else { int row_len = src->width() * m_sys_bpp / 8; unsigned char* buf_tmp = new unsigned char[row_len * src->height()]; rendering_buffer rbuf_tmp; rbuf_tmp.attach(buf_tmp, src->width(), src->height(), m_flip_y ? -row_len : row_len); switch(m_sys_format) { default: break; case pix_format_rgb555: switch(m_format) { default: break; case pix_format_rgb555: color_conv(&rbuf_tmp, src, color_conv_rgb555_to_rgb555()); break; case pix_format_rgb565: color_conv(&rbuf_tmp, src, color_conv_rgb565_to_rgb555()); break; case pix_format_rgb24: color_conv(&rbuf_tmp, src, color_conv_rgb24_to_rgb555()); break; case pix_format_bgr24: color_conv(&rbuf_tmp, src, color_conv_bgr24_to_rgb555()); break; case pix_format_rgba32: color_conv(&rbuf_tmp, src, color_conv_rgba32_to_rgb555()); break; case pix_format_argb32: color_conv(&rbuf_tmp, src, color_conv_argb32_to_rgb555()); break; case pix_format_bgra32: color_conv(&rbuf_tmp, src, color_conv_bgra32_to_rgb555()); break; case pix_format_abgr32: color_conv(&rbuf_tmp, src, color_conv_abgr32_to_rgb555()); break; } break; case pix_format_rgb565: switch(m_format) { default: break; case pix_format_rgb555: color_conv(&rbuf_tmp, src, color_conv_rgb555_to_rgb565()); break; case pix_format_rgb565: color_conv(&rbuf_tmp, src, color_conv_rgb565_to_rgb565()); break; case pix_format_rgb24: color_conv(&rbuf_tmp, src, color_conv_rgb24_to_rgb565()); break; case pix_format_bgr24: color_conv(&rbuf_tmp, src, color_conv_bgr24_to_rgb565()); break; case pix_format_rgba32: color_conv(&rbuf_tmp, src, color_conv_rgba32_to_rgb565()); break; case pix_format_argb32: color_conv(&rbuf_tmp, src, color_conv_argb32_to_rgb565()); break; case pix_format_bgra32: color_conv(&rbuf_tmp, src, color_conv_bgra32_to_rgb565()); break; case pix_format_abgr32: color_conv(&rbuf_tmp, src, color_conv_abgr32_to_rgb565()); break; } break; case pix_format_rgba32: switch(m_format) { default: break; case pix_format_rgb555: color_conv(&rbuf_tmp, src, color_conv_rgb555_to_rgba32()); break; case pix_format_rgb565: color_conv(&rbuf_tmp, src, color_conv_rgb565_to_rgba32()); break; case pix_format_rgb24: color_conv(&rbuf_tmp, src, color_conv_rgb24_to_rgba32()); break; case pix_format_bgr24: color_conv(&rbuf_tmp, src, color_conv_bgr24_to_rgba32()); break; case pix_format_rgba32: color_conv(&rbuf_tmp, src, color_conv_rgba32_to_rgba32()); break; case pix_format_argb32: color_conv(&rbuf_tmp, src, color_conv_argb32_to_rgba32()); break; case pix_format_bgra32: color_conv(&rbuf_tmp, src, color_conv_bgra32_to_rgba32()); break; case pix_format_abgr32: color_conv(&rbuf_tmp, src, color_conv_abgr32_to_rgba32()); break; } break; case pix_format_abgr32: switch(m_format) { default: break; case pix_format_rgb555: color_conv(&rbuf_tmp, src, color_conv_rgb555_to_abgr32()); break; case pix_format_rgb565: color_conv(&rbuf_tmp, src, color_conv_rgb565_to_abgr32()); break; case pix_format_rgb24: color_conv(&rbuf_tmp, src, color_conv_rgb24_to_abgr32()); break; case pix_format_bgr24: color_conv(&rbuf_tmp, src, color_conv_bgr24_to_abgr32()); break; case pix_format_abgr32: color_conv(&rbuf_tmp, src, color_conv_abgr32_to_abgr32()); break; case pix_format_rgba32: color_conv(&rbuf_tmp, src, color_conv_rgba32_to_abgr32()); break; case pix_format_argb32: color_conv(&rbuf_tmp, src, color_conv_argb32_to_abgr32()); break; case pix_format_bgra32: color_conv(&rbuf_tmp, src, color_conv_bgra32_to_abgr32()); break; } break; case pix_format_argb32: switch(m_format) { default: break; case pix_format_rgb555: color_conv(&rbuf_tmp, src, color_conv_rgb555_to_argb32()); break; case pix_format_rgb565: color_conv(&rbuf_tmp, src, color_conv_rgb565_to_argb32()); break; case pix_format_rgb24: color_conv(&rbuf_tmp, src, color_conv_rgb24_to_argb32()); break; case pix_format_bgr24: color_conv(&rbuf_tmp, src, color_conv_bgr24_to_argb32()); break; case pix_format_rgba32: color_conv(&rbuf_tmp, src, color_conv_rgba32_to_argb32()); break; case pix_format_argb32: color_conv(&rbuf_tmp, src, color_conv_argb32_to_argb32()); break; case pix_format_abgr32: color_conv(&rbuf_tmp, src, color_conv_abgr32_to_argb32()); break; case pix_format_bgra32: color_conv(&rbuf_tmp, src, color_conv_bgra32_to_argb32()); break; } break; case pix_format_bgra32: switch(m_format) { default: break; case pix_format_rgb555: color_conv(&rbuf_tmp, src, color_conv_rgb555_to_bgra32()); break; case pix_format_rgb565: color_conv(&rbuf_tmp, src, color_conv_rgb565_to_bgra32()); break; case pix_format_rgb24: color_conv(&rbuf_tmp, src, color_conv_rgb24_to_bgra32()); break; case pix_format_bgr24: color_conv(&rbuf_tmp, src, color_conv_bgr24_to_bgra32()); break; case pix_format_rgba32: color_conv(&rbuf_tmp, src, color_conv_rgba32_to_bgra32()); break; case pix_format_argb32: color_conv(&rbuf_tmp, src, color_conv_argb32_to_bgra32()); break; case pix_format_abgr32: color_conv(&rbuf_tmp, src, color_conv_abgr32_to_bgra32()); break; case pix_format_bgra32: color_conv(&rbuf_tmp, src, color_conv_bgra32_to_bgra32()); break; } break; } m_ximg_window->data = (char*)buf_tmp; XPutImage(m_display, m_window, m_gc, m_ximg_window, 0, 0, 0, 0, src->width(), src->height()); delete [] buf_tmp; } } //------------------------------------------------------------------------ platform_support::platform_support(pix_format_e format, bool flip_y) : m_specific(new platform_specific(format, flip_y)), m_format(format), m_bpp(m_specific->m_bpp), m_window_flags(0), m_wait_mode(true), m_flip_y(flip_y), m_initial_width(10), m_initial_height(10) { strcpy(m_caption, "AGG Application"); } //------------------------------------------------------------------------ platform_support::~platform_support() { delete m_specific; } //------------------------------------------------------------------------ void platform_support::caption(const char* cap) { strcpy(m_caption, cap); if(m_specific->m_initialized) { m_specific->caption(cap); } } //------------------------------------------------------------------------ enum xevent_mask_e { xevent_mask = PointerMotionMask| ButtonPressMask| ButtonReleaseMask| ExposureMask| KeyPressMask| StructureNotifyMask }; //------------------------------------------------------------------------ bool platform_support::init(unsigned width, unsigned height, unsigned flags) { m_window_flags = flags; m_specific->m_display = XOpenDisplay(NULL); if(m_specific->m_display == 0) { fprintf(stderr, "Unable to open DISPLAY!\n"); return false; } m_specific->m_screen = XDefaultScreen(m_specific->m_display); m_specific->m_depth = XDefaultDepth(m_specific->m_display, m_specific->m_screen); m_specific->m_visual = XDefaultVisual(m_specific->m_display, m_specific->m_screen); unsigned long r_mask = m_specific->m_visual->red_mask; unsigned long g_mask = m_specific->m_visual->green_mask; unsigned long b_mask = m_specific->m_visual->blue_mask; //printf("depth=%d, red=%08x, green=%08x, blue=%08x\n", // m_specific->m_depth, // m_specific->m_visual->red_mask, // m_specific->m_visual->green_mask, // m_specific->m_visual->blue_mask); // // NOT COMPLETED YET! // // Try to find an appropriate Visual if the default doesn't fit. // if(m_specific->m_depth < 15 || // r_mask == 0 || g_mask == 0 || b_mask == 0) // { // // // This is an attempt to find an appropriate Visual if // // the default one doesn't match the minumum requirements // static int depth[] = { 32, 24, 16, 15 }; // int i; // for(int i = 0; i < 4; i++) // { // XVisualInfo vi; // if(XMatchVisualInfo(m_specific->m_display, // m_specific->m_screen, // depth[i], // TrueColor, // &vi)) // { // // printf("TrueColor depth=%d, red=%08x, green=%08x, blue=%08x, bits=%d\n", // // vi.depth, // // vi.visual->red_mask, // // vi.visual->green_mask, // // vi.visual->blue_mask, // // vi.bits_per_rgb); // m_specific->m_depth = vi.depth; // m_specific->m_visual = vi.visual; // r_mask = m_specific->m_visual->red_mask; // g_mask = m_specific->m_visual->green_mask; // b_mask = m_specific->m_visual->blue_mask; // break; // } // if(XMatchVisualInfo(m_specific->m_display, // m_specific->m_screen, // depth[i], // DirectColor, // &vi)) // { // // printf("DirectColor depth=%d, red=%08x, green=%08x, blue=%08x, bits=%d\n", // // vi.depth, // // vi.visual->red_mask, // // vi.visual->green_mask, // // vi.visual->blue_mask, // // vi.bits_per_rgb); // m_specific->m_depth = vi.depth; // m_specific->m_visual = vi.visual; // r_mask = m_specific->m_visual->red_mask; // g_mask = m_specific->m_visual->green_mask; // b_mask = m_specific->m_visual->blue_mask; // break; // } // } // } if(m_specific->m_depth < 15 || r_mask == 0 || g_mask == 0 || b_mask == 0) { fprintf(stderr, "There's no Visual compatible with minimal AGG requirements:\n" "At least 15-bit color depth and True- or DirectColor class.\n\n"); XCloseDisplay(m_specific->m_display); return false; } int t = 1; int hw_byte_order = LSBFirst; if(*(char*)&t == 0) hw_byte_order = MSBFirst; // Perceive SYS-format by mask switch(m_specific->m_depth) { case 15: m_specific->m_sys_bpp = 16; if(r_mask == 0x7C00 && g_mask == 0x3E0 && b_mask == 0x1F) { m_specific->m_sys_format = pix_format_rgb555; m_specific->m_byte_order = hw_byte_order; } break; case 16: m_specific->m_sys_bpp = 16; if(r_mask == 0xF800 && g_mask == 0x7E0 && b_mask == 0x1F) { m_specific->m_sys_format = pix_format_rgb565; m_specific->m_byte_order = hw_byte_order; } break; case 24: case 32: m_specific->m_sys_bpp = 32; if(g_mask == 0xFF00) { if(r_mask == 0xFF && b_mask == 0xFF0000) { switch(m_specific->m_format) { case pix_format_rgba32: m_specific->m_sys_format = pix_format_rgba32; m_specific->m_byte_order = LSBFirst; break; case pix_format_abgr32: m_specific->m_sys_format = pix_format_abgr32; m_specific->m_byte_order = MSBFirst; break; default: m_specific->m_byte_order = hw_byte_order; m_specific->m_sys_format = (hw_byte_order == LSBFirst) ? pix_format_rgba32 : pix_format_abgr32; break; } } if(r_mask == 0xFF0000 && b_mask == 0xFF) { switch(m_specific->m_format) { case pix_format_argb32: m_specific->m_sys_format = pix_format_argb32; m_specific->m_byte_order = MSBFirst; break; case pix_format_bgra32: m_specific->m_sys_format = pix_format_bgra32; m_specific->m_byte_order = LSBFirst; break; default: m_specific->m_byte_order = hw_byte_order; m_specific->m_sys_format = (hw_byte_order == MSBFirst) ? pix_format_argb32 : pix_format_bgra32; break; } } } break; } if(m_specific->m_sys_format == pix_format_undefined) { fprintf(stderr, "RGB masks are not compatible with AGG pixel formats:\n" "R=%08x, R=%08x, B=%08x\n", r_mask, g_mask, b_mask); XCloseDisplay(m_specific->m_display); return false; } memset(&m_specific->m_window_attributes, 0, sizeof(m_specific->m_window_attributes)); m_specific->m_window_attributes.border_pixel = XBlackPixel(m_specific->m_display, m_specific->m_screen); m_specific->m_window_attributes.background_pixel = XWhitePixel(m_specific->m_display, m_specific->m_screen); m_specific->m_window_attributes.override_redirect = 0; unsigned long window_mask = CWBackPixel | CWBorderPixel; m_specific->m_window = XCreateWindow(m_specific->m_display, XDefaultRootWindow(m_specific->m_display), 0, 0, width, height, 0, m_specific->m_depth, InputOutput, CopyFromParent, window_mask, &m_specific->m_window_attributes); m_specific->m_gc = XCreateGC(m_specific->m_display, m_specific->m_window, 0, 0); m_specific->m_buf_window = new unsigned char[width * height * (m_bpp / 8)]; memset(m_specific->m_buf_window, 255, width * height * (m_bpp / 8)); m_rbuf_window.attach(m_specific->m_buf_window, width, height, m_flip_y ? -width * (m_bpp / 8) : width * (m_bpp / 8)); m_specific->m_ximg_window = XCreateImage(m_specific->m_display, m_specific->m_visual, //CopyFromParent, m_specific->m_depth, ZPixmap, 0, (char*)m_specific->m_buf_window, width, height, m_specific->m_sys_bpp, width * (m_specific->m_sys_bpp / 8)); m_specific->m_ximg_window->byte_order = m_specific->m_byte_order; m_specific->caption(m_caption); m_initial_width = width; m_initial_height = height; if(!m_specific->m_initialized) { on_init(); m_specific->m_initialized = true; } trans_affine_resizing(width, height); on_resize(width, height); m_specific->m_update_flag = true; XSizeHints *hints = XAllocSizeHints(); if(hints) { if(flags & window_resize) { hints->min_width = 32; hints->min_height = 32; hints->max_width = 4096; hints->max_height = 4096; } else { hints->min_width = width; hints->min_height = height; hints->max_width = width; hints->max_height = height; } hints->flags = PMaxSize | PMinSize; XSetWMNormalHints(m_specific->m_display, m_specific->m_window, hints); XFree(hints); } XMapWindow(m_specific->m_display, m_specific->m_window); XSelectInput(m_specific->m_display, m_specific->m_window, xevent_mask); m_specific->m_close_atom = XInternAtom(m_specific->m_display, "WM_DELETE_WINDOW", false); XSetWMProtocols(m_specific->m_display, m_specific->m_window, &m_specific->m_close_atom, 1); return true; } //------------------------------------------------------------------------ void platform_support::update_window() { m_specific->put_image(&m_rbuf_window); // When m_wait_mode is true we can discard all the events // came while the image is being drawn. In this case // the X server does not accumulate mouse motion events. // When m_wait_mode is false, i.e. we have some idle drawing // we cannot afford to miss any events XSync(m_specific->m_display, m_wait_mode); } //------------------------------------------------------------------------ int platform_support::run() { XFlush(m_specific->m_display); bool quit = false; unsigned flags; int cur_x; int cur_y; while(!quit) { if(m_specific->m_update_flag) { on_draw(); update_window(); m_specific->m_update_flag = false; } if(!m_wait_mode) { if(XPending(m_specific->m_display) == 0) { on_idle(); continue; } } XEvent x_event; XNextEvent(m_specific->m_display, &x_event); // In the Idle mode discard all intermediate MotionNotify events if(!m_wait_mode && x_event.type == MotionNotify) { XEvent te = x_event; for(;;) { if(XPending(m_specific->m_display) == 0) break; XNextEvent(m_specific->m_display, &te); if(te.type != MotionNotify) break; } x_event = te; } switch(x_event.type) { case ConfigureNotify: { if(x_event.xconfigure.width != int(m_rbuf_window.width()) || x_event.xconfigure.height != int(m_rbuf_window.height())) { int width = x_event.xconfigure.width; int height = x_event.xconfigure.height; delete [] m_specific->m_buf_window; m_specific->m_ximg_window->data = 0; XDestroyImage(m_specific->m_ximg_window); m_specific->m_buf_window = new unsigned char[width * height * (m_bpp / 8)]; m_rbuf_window.attach(m_specific->m_buf_window, width, height, m_flip_y ? -width * (m_bpp / 8) : width * (m_bpp / 8)); m_specific->m_ximg_window = XCreateImage(m_specific->m_display, m_specific->m_visual, //CopyFromParent, m_specific->m_depth, ZPixmap, 0, (char*)m_specific->m_buf_window, width, height, m_specific->m_sys_bpp, width * (m_specific->m_sys_bpp / 8)); m_specific->m_ximg_window->byte_order = m_specific->m_byte_order; trans_affine_resizing(width, height); on_resize(width, height); on_draw(); update_window(); } } break; case Expose: m_specific->put_image(&m_rbuf_window); XFlush(m_specific->m_display); XSync(m_specific->m_display, false); break; case KeyPress: { KeySym key = XLookupKeysym(&x_event.xkey, 0); flags = 0; if(x_event.xkey.state & Button1Mask) flags |= mouse_left; if(x_event.xkey.state & Button3Mask) flags |= mouse_right; if(x_event.xkey.state & ShiftMask) flags |= kbd_shift; if(x_event.xkey.state & ControlMask) flags |= kbd_ctrl; bool left = false; bool up = false; bool right = false; bool down = false; switch(m_specific->m_keymap[key & 0xFF]) { case key_left: left = true; break; case key_up: up = true; break; case key_right: right = true; break; case key_down: down = true; break; case key_f2: copy_window_to_img(max_images - 1); save_img(max_images - 1, "screenshot"); break; } if(m_ctrls.on_arrow_keys(left, right, down, up)) { on_ctrl_change(); force_redraw(); } else { on_key(x_event.xkey.x, m_flip_y ? m_rbuf_window.height() - x_event.xkey.y : x_event.xkey.y, m_specific->m_keymap[key & 0xFF], flags); } } break; case ButtonPress: { flags = 0; if(x_event.xbutton.state & ShiftMask) flags |= kbd_shift; if(x_event.xbutton.state & ControlMask) flags |= kbd_ctrl; if(x_event.xbutton.button == Button1) flags |= mouse_left; if(x_event.xbutton.button == Button3) flags |= mouse_right; cur_x = x_event.xbutton.x; cur_y = m_flip_y ? m_rbuf_window.height() - x_event.xbutton.y : x_event.xbutton.y; if(flags & mouse_left) { if(m_ctrls.on_mouse_button_down(cur_x, cur_y)) { m_ctrls.set_cur(cur_x, cur_y); on_ctrl_change(); force_redraw(); } else { if(m_ctrls.in_rect(cur_x, cur_y)) { if(m_ctrls.set_cur(cur_x, cur_y)) { on_ctrl_change(); force_redraw(); } } else { on_mouse_button_down(cur_x, cur_y, flags); } } } if(flags & mouse_right) { on_mouse_button_down(cur_x, cur_y, flags); } //m_specific->m_wait_mode = m_wait_mode; //m_wait_mode = true; } break; case MotionNotify: { flags = 0; if(x_event.xmotion.state & Button1Mask) flags |= mouse_left; if(x_event.xmotion.state & Button3Mask) flags |= mouse_right; if(x_event.xmotion.state & ShiftMask) flags |= kbd_shift; if(x_event.xmotion.state & ControlMask) flags |= kbd_ctrl; cur_x = x_event.xbutton.x; cur_y = m_flip_y ? m_rbuf_window.height() - x_event.xbutton.y : x_event.xbutton.y; if(m_ctrls.on_mouse_move(cur_x, cur_y, (flags & mouse_left) != 0)) { on_ctrl_change(); force_redraw(); } else { if(!m_ctrls.in_rect(cur_x, cur_y)) { on_mouse_move(cur_x, cur_y, flags); } } } break; case ButtonRelease: { flags = 0; if(x_event.xbutton.state & ShiftMask) flags |= kbd_shift; if(x_event.xbutton.state & ControlMask) flags |= kbd_ctrl; if(x_event.xbutton.button == Button1) flags |= mouse_left; if(x_event.xbutton.button == Button3) flags |= mouse_right; cur_x = x_event.xbutton.x; cur_y = m_flip_y ? m_rbuf_window.height() - x_event.xbutton.y : x_event.xbutton.y; if(flags & mouse_left) { if(m_ctrls.on_mouse_button_up(cur_x, cur_y)) { on_ctrl_change(); force_redraw(); } } if(flags & (mouse_left | mouse_right)) { on_mouse_button_up(cur_x, cur_y, flags); } } //m_wait_mode = m_specific->m_wait_mode; break; case ClientMessage: if((x_event.xclient.format == 32) && (x_event.xclient.data.l[0] == int(m_specific->m_close_atom))) { quit = true; } break; } } unsigned i = platform_support::max_images; while(i--) { if(m_specific->m_buf_img[i]) { delete [] m_specific->m_buf_img[i]; } } delete [] m_specific->m_buf_window; m_specific->m_ximg_window->data = 0; XDestroyImage(m_specific->m_ximg_window); XFreeGC(m_specific->m_display, m_specific->m_gc); XDestroyWindow(m_specific->m_display, m_specific->m_window); XCloseDisplay(m_specific->m_display); return 0; } //------------------------------------------------------------------------ const char* platform_support::img_ext() const { return ".ppm"; } //------------------------------------------------------------------------ const char* platform_support::full_file_name(const char* file_name) { return file_name; } //------------------------------------------------------------------------ bool platform_support::load_img(unsigned idx, const char* file) { if(idx < max_images) { char buf[1024]; strcpy(buf, file); int len = strlen(buf); if(len < 4 || strcasecmp(buf + len - 4, ".ppm") != 0) { strcat(buf, ".ppm"); } FILE* fd = fopen(buf, "rb"); if(fd == 0) return false; if((len = fread(buf, 1, 1022, fd)) == 0) { fclose(fd); return false; } buf[len] = 0; if(buf[0] != 'P' && buf[1] != '6') { fclose(fd); return false; } char* ptr = buf + 2; while(*ptr && !isdigit(*ptr)) ptr++; if(*ptr == 0) { fclose(fd); return false; } unsigned width = atoi(ptr); if(width == 0 || width > 4096) { fclose(fd); return false; } while(*ptr && isdigit(*ptr)) ptr++; while(*ptr && !isdigit(*ptr)) ptr++; if(*ptr == 0) { fclose(fd); return false; } unsigned height = atoi(ptr); if(height == 0 || height > 4096) { fclose(fd); return false; } while(*ptr && isdigit(*ptr)) ptr++; while(*ptr && !isdigit(*ptr)) ptr++; if(atoi(ptr) != 255) { fclose(fd); return false; } while(*ptr && isdigit(*ptr)) ptr++; if(*ptr == 0) { fclose(fd); return false; } ptr++; fseek(fd, long(ptr - buf), SEEK_SET); create_img(idx, width, height); bool ret = true; if(m_format == pix_format_rgb24) { fread(m_specific->m_buf_img[idx], 1, width * height * 3, fd); } else { unsigned char* buf_img = new unsigned char [width * height * 3]; rendering_buffer rbuf_img; rbuf_img.attach(buf_img, width, height, m_flip_y ? -width * 3 : width * 3); fread(buf_img, 1, width * height * 3, fd); switch(m_format) { case pix_format_rgb555: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_rgb555()); break; case pix_format_rgb565: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_rgb565()); break; case pix_format_bgr24: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_bgr24()); break; case pix_format_rgba32: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_rgba32()); break; case pix_format_argb32: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_argb32()); break; case pix_format_bgra32: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_bgra32()); break; case pix_format_abgr32: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_abgr32()); break; default: ret = false; } delete [] buf_img; } fclose(fd); return ret; } return false; } //------------------------------------------------------------------------ bool platform_support::save_img(unsigned idx, const char* file) { if(idx < max_images && rbuf_img(idx).buf()) { char buf[1024]; strcpy(buf, file); int len = strlen(buf); if(len < 4 || strcasecmp(buf + len - 4, ".ppm") != 0) { strcat(buf, ".ppm"); } FILE* fd = fopen(buf, "wb"); if(fd == 0) return false; unsigned w = rbuf_img(idx).width(); unsigned h = rbuf_img(idx).height(); fprintf(fd, "P6\n%d %d\n255\n", w, h); unsigned y; unsigned char* tmp_buf = new unsigned char [w * 3]; for(y = 0; y < rbuf_img(idx).height(); y++) { const unsigned char* src = rbuf_img(idx).row_ptr(m_flip_y ? h - 1 - y : y); switch(m_format) { default: break; case pix_format_rgb555: color_conv_row(tmp_buf, src, w, color_conv_rgb555_to_rgb24()); break; case pix_format_rgb565: color_conv_row(tmp_buf, src, w, color_conv_rgb565_to_rgb24()); break; case pix_format_bgr24: color_conv_row(tmp_buf, src, w, color_conv_bgr24_to_rgb24()); break; case pix_format_rgb24: color_conv_row(tmp_buf, src, w, color_conv_rgb24_to_rgb24()); break; case pix_format_rgba32: color_conv_row(tmp_buf, src, w, color_conv_rgba32_to_rgb24()); break; case pix_format_argb32: color_conv_row(tmp_buf, src, w, color_conv_argb32_to_rgb24()); break; case pix_format_bgra32: color_conv_row(tmp_buf, src, w, color_conv_bgra32_to_rgb24()); break; case pix_format_abgr32: color_conv_row(tmp_buf, src, w, color_conv_abgr32_to_rgb24()); break; } fwrite(tmp_buf, 1, w * 3, fd); } delete [] tmp_buf; fclose(fd); return true; } return false; } //------------------------------------------------------------------------ bool platform_support::create_img(unsigned idx, unsigned width, unsigned height) { if(idx < max_images) { if(width == 0) width = rbuf_window().width(); if(height == 0) height = rbuf_window().height(); delete [] m_specific->m_buf_img[idx]; m_specific->m_buf_img[idx] = new unsigned char[width * height * (m_bpp / 8)]; m_rbuf_img[idx].attach(m_specific->m_buf_img[idx], width, height, m_flip_y ? -width * (m_bpp / 8) : width * (m_bpp / 8)); return true; } return false; } //------------------------------------------------------------------------ void platform_support::force_redraw() { m_specific->m_update_flag = true; } //------------------------------------------------------------------------ void platform_support::message(const char* msg) { fprintf(stderr, "%s\n", msg); } //------------------------------------------------------------------------ void platform_support::start_timer() { m_specific->m_sw_start = clock(); } //------------------------------------------------------------------------ double platform_support::elapsed_time() const { clock_t stop = clock(); return double(stop - m_specific->m_sw_start) * 1000.0 / CLOCKS_PER_SEC; } //------------------------------------------------------------------------ void platform_support::on_init() {} void platform_support::on_resize(int sx, int sy) {} void platform_support::on_idle() {} void platform_support::on_mouse_move(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_down(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_up(int x, int y, unsigned flags) {} void platform_support::on_key(int x, int y, unsigned key, unsigned flags) {} void platform_support::on_ctrl_change() {} void platform_support::on_draw() {} void platform_support::on_post_draw(void* raw_handler) {} } int agg_main(int argc, char* argv[]); int main(int argc, char* argv[]) { return agg_main(argc, argv); } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/X11/Makefile.am0000644000175000017500000000046613233644505024401 0ustar varunvarunif ENABLE_X11 lib_LTLIBRARIES = libaggplatformX11.la libaggplatformX11_la_LDFLAGS = -version-info @AGG_LIB_VERSION@ -L@x_libraries@ libaggplatformX11_la_SOURCES = agg_platform_support.cpp libaggplatformX11_la_CXXFLAGS = -I$(top_srcdir)/include @x_includes@ libaggplatformX11_la_LIBADD = -lX11 endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/win32/0000755000175000017500000000000013544357604022736 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/win32/agg_platform_support.cpp0000644000175000017500000013711613233644505027703 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class platform_support // //---------------------------------------------------------------------------- #include #include #include "platform/agg_platform_support.h" #include "platform/win32/agg_win32_bmp.h" #include "util/agg_color_conv_rgb8.h" #include "util/agg_color_conv_rgb16.h" namespace agg24 { //------------------------------------------------------------------------ HINSTANCE g_windows_instance = 0; int g_windows_cmd_show = 0; //------------------------------------------------------------------------ class platform_specific { public: platform_specific(pix_format_e format, bool flip_y); void create_pmap(unsigned width, unsigned height, rendering_buffer* wnd); void display_pmap(HDC dc, const rendering_buffer* src); bool load_pmap(const char* fn, unsigned idx, rendering_buffer* dst); bool save_pmap(const char* fn, unsigned idx, const rendering_buffer* src); unsigned translate(unsigned keycode); pix_format_e m_format; pix_format_e m_sys_format; bool m_flip_y; unsigned m_bpp; unsigned m_sys_bpp; HWND m_hwnd; pixel_map m_pmap_window; pixel_map m_pmap_img[platform_support::max_images]; unsigned m_keymap[256]; unsigned m_last_translated_key; int m_cur_x; int m_cur_y; unsigned m_input_flags; bool m_redraw_flag; HDC m_current_dc; LARGE_INTEGER m_sw_freq; LARGE_INTEGER m_sw_start; }; //------------------------------------------------------------------------ platform_specific::platform_specific(pix_format_e format, bool flip_y) : m_format(format), m_sys_format(pix_format_undefined), m_flip_y(flip_y), m_bpp(0), m_sys_bpp(0), m_hwnd(0), m_last_translated_key(0), m_cur_x(0), m_cur_y(0), m_input_flags(0), m_redraw_flag(true), m_current_dc(0) { memset(m_keymap, 0, sizeof(m_keymap)); m_keymap[VK_PAUSE] = key_pause; m_keymap[VK_CLEAR] = key_clear; m_keymap[VK_NUMPAD0] = key_kp0; m_keymap[VK_NUMPAD1] = key_kp1; m_keymap[VK_NUMPAD2] = key_kp2; m_keymap[VK_NUMPAD3] = key_kp3; m_keymap[VK_NUMPAD4] = key_kp4; m_keymap[VK_NUMPAD5] = key_kp5; m_keymap[VK_NUMPAD6] = key_kp6; m_keymap[VK_NUMPAD7] = key_kp7; m_keymap[VK_NUMPAD8] = key_kp8; m_keymap[VK_NUMPAD9] = key_kp9; m_keymap[VK_DECIMAL] = key_kp_period; m_keymap[VK_DIVIDE] = key_kp_divide; m_keymap[VK_MULTIPLY] = key_kp_multiply; m_keymap[VK_SUBTRACT] = key_kp_minus; m_keymap[VK_ADD] = key_kp_plus; m_keymap[VK_UP] = key_up; m_keymap[VK_DOWN] = key_down; m_keymap[VK_RIGHT] = key_right; m_keymap[VK_LEFT] = key_left; m_keymap[VK_INSERT] = key_insert; m_keymap[VK_DELETE] = key_delete; m_keymap[VK_HOME] = key_home; m_keymap[VK_END] = key_end; m_keymap[VK_PRIOR] = key_page_up; m_keymap[VK_NEXT] = key_page_down; m_keymap[VK_F1] = key_f1; m_keymap[VK_F2] = key_f2; m_keymap[VK_F3] = key_f3; m_keymap[VK_F4] = key_f4; m_keymap[VK_F5] = key_f5; m_keymap[VK_F6] = key_f6; m_keymap[VK_F7] = key_f7; m_keymap[VK_F8] = key_f8; m_keymap[VK_F9] = key_f9; m_keymap[VK_F10] = key_f10; m_keymap[VK_F11] = key_f11; m_keymap[VK_F12] = key_f12; m_keymap[VK_F13] = key_f13; m_keymap[VK_F14] = key_f14; m_keymap[VK_F15] = key_f15; m_keymap[VK_NUMLOCK] = key_numlock; m_keymap[VK_CAPITAL] = key_capslock; m_keymap[VK_SCROLL] = key_scrollock; switch(m_format) { case pix_format_bw: m_sys_format = pix_format_bw; m_bpp = 1; m_sys_bpp = 1; break; case pix_format_gray8: m_sys_format = pix_format_gray8; m_bpp = 8; m_sys_bpp = 8; break; case pix_format_gray16: m_sys_format = pix_format_gray8; m_bpp = 16; m_sys_bpp = 8; break; case pix_format_rgb565: case pix_format_rgb555: m_sys_format = pix_format_rgb555; m_bpp = 16; m_sys_bpp = 16; break; case pix_format_rgbAAA: case pix_format_bgrAAA: case pix_format_rgbBBA: case pix_format_bgrABB: m_sys_format = pix_format_bgr24; m_bpp = 32; m_sys_bpp = 24; break; case pix_format_rgb24: case pix_format_bgr24: m_sys_format = pix_format_bgr24; m_bpp = 24; m_sys_bpp = 24; break; case pix_format_rgb48: case pix_format_bgr48: m_sys_format = pix_format_bgr24; m_bpp = 48; m_sys_bpp = 24; break; case pix_format_bgra32: case pix_format_abgr32: case pix_format_argb32: case pix_format_rgba32: m_sys_format = pix_format_bgra32; m_bpp = 32; m_sys_bpp = 32; break; case pix_format_bgra64: case pix_format_abgr64: case pix_format_argb64: case pix_format_rgba64: m_sys_format = pix_format_bgra32; m_bpp = 64; m_sys_bpp = 32; break; } ::QueryPerformanceFrequency(&m_sw_freq); ::QueryPerformanceCounter(&m_sw_start); } //------------------------------------------------------------------------ void platform_specific::create_pmap(unsigned width, unsigned height, rendering_buffer* wnd) { m_pmap_window.create(width, height, org_e(m_bpp)); wnd->attach(m_pmap_window.buf(), m_pmap_window.width(), m_pmap_window.height(), m_flip_y ? m_pmap_window.stride() : -m_pmap_window.stride()); } //------------------------------------------------------------------------ static void convert_pmap(rendering_buffer* dst, const rendering_buffer* src, pix_format_e format) { switch(format) { case pix_format_gray8: break; case pix_format_gray16: color_conv(dst, src, color_conv_gray16_to_gray8()); break; case pix_format_rgb565: color_conv(dst, src, color_conv_rgb565_to_rgb555()); break; case pix_format_rgbAAA: color_conv(dst, src, color_conv_rgbAAA_to_bgr24()); break; case pix_format_bgrAAA: color_conv(dst, src, color_conv_bgrAAA_to_bgr24()); break; case pix_format_rgbBBA: color_conv(dst, src, color_conv_rgbBBA_to_bgr24()); break; case pix_format_bgrABB: color_conv(dst, src, color_conv_bgrABB_to_bgr24()); break; case pix_format_rgb24: color_conv(dst, src, color_conv_rgb24_to_bgr24()); break; case pix_format_rgb48: color_conv(dst, src, color_conv_rgb48_to_bgr24()); break; case pix_format_bgr48: color_conv(dst, src, color_conv_bgr48_to_bgr24()); break; case pix_format_abgr32: color_conv(dst, src, color_conv_abgr32_to_bgra32()); break; case pix_format_argb32: color_conv(dst, src, color_conv_argb32_to_bgra32()); break; case pix_format_rgba32: color_conv(dst, src, color_conv_rgba32_to_bgra32()); break; case pix_format_bgra64: color_conv(dst, src, color_conv_bgra64_to_bgra32()); break; case pix_format_abgr64: color_conv(dst, src, color_conv_abgr64_to_bgra32()); break; case pix_format_argb64: color_conv(dst, src, color_conv_argb64_to_bgra32()); break; case pix_format_rgba64: color_conv(dst, src, color_conv_rgba64_to_bgra32()); break; } } //------------------------------------------------------------------------ void platform_specific::display_pmap(HDC dc, const rendering_buffer* src) { if(m_sys_format == m_format) { m_pmap_window.draw(dc); } else { pixel_map pmap_tmp; pmap_tmp.create(m_pmap_window.width(), m_pmap_window.height(), org_e(m_sys_bpp)); rendering_buffer rbuf_tmp; rbuf_tmp.attach(pmap_tmp.buf(), pmap_tmp.width(), pmap_tmp.height(), m_flip_y ? pmap_tmp.stride() : -pmap_tmp.stride()); convert_pmap(&rbuf_tmp, src, m_format); pmap_tmp.draw(dc); } } //------------------------------------------------------------------------ bool platform_specific::save_pmap(const char* fn, unsigned idx, const rendering_buffer* src) { if(m_sys_format == m_format) { return m_pmap_img[idx].save_as_bmp(fn); } pixel_map pmap_tmp; pmap_tmp.create(m_pmap_img[idx].width(), m_pmap_img[idx].height(), org_e(m_sys_bpp)); rendering_buffer rbuf_tmp; rbuf_tmp.attach(pmap_tmp.buf(), pmap_tmp.width(), pmap_tmp.height(), m_flip_y ? pmap_tmp.stride() : -pmap_tmp.stride()); convert_pmap(&rbuf_tmp, src, m_format); return pmap_tmp.save_as_bmp(fn); } //------------------------------------------------------------------------ bool platform_specific::load_pmap(const char* fn, unsigned idx, rendering_buffer* dst) { pixel_map pmap_tmp; if(!pmap_tmp.load_from_bmp(fn)) return false; rendering_buffer rbuf_tmp; rbuf_tmp.attach(pmap_tmp.buf(), pmap_tmp.width(), pmap_tmp.height(), m_flip_y ? pmap_tmp.stride() : -pmap_tmp.stride()); m_pmap_img[idx].create(pmap_tmp.width(), pmap_tmp.height(), org_e(m_bpp), 0); dst->attach(m_pmap_img[idx].buf(), m_pmap_img[idx].width(), m_pmap_img[idx].height(), m_flip_y ? m_pmap_img[idx].stride() : -m_pmap_img[idx].stride()); switch(m_format) { case pix_format_gray8: switch(pmap_tmp.bpp()) { //case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_gray8()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_gray8()); break; //case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_gray8()); break; } break; case pix_format_gray16: switch(pmap_tmp.bpp()) { //case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_gray16()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_gray16()); break; //case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_gray16()); break; } break; case pix_format_rgb555: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgb555()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_rgb555()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgb555()); break; } break; case pix_format_rgb565: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgb565()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_rgb565()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgb565()); break; } break; case pix_format_rgb24: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgb24()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_rgb24()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgb24()); break; } break; case pix_format_bgr24: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_bgr24()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_bgr24()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_bgr24()); break; } break; case pix_format_rgb48: switch(pmap_tmp.bpp()) { //case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgb48()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_rgb48()); break; //case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgb48()); break; } break; case pix_format_bgr48: switch(pmap_tmp.bpp()) { //case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_bgr48()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_bgr48()); break; //case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_bgr48()); break; } break; case pix_format_abgr32: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_abgr32()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_abgr32()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_abgr32()); break; } break; case pix_format_argb32: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_argb32()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_argb32()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_argb32()); break; } break; case pix_format_bgra32: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_bgra32()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_bgra32()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_bgra32()); break; } break; case pix_format_rgba32: switch(pmap_tmp.bpp()) { case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgba32()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_rgba32()); break; case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgba32()); break; } break; case pix_format_abgr64: switch(pmap_tmp.bpp()) { //case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_abgr64()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_abgr64()); break; //case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_abgr64()); break; } break; case pix_format_argb64: switch(pmap_tmp.bpp()) { //case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_argb64()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_argb64()); break; //case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_argb64()); break; } break; case pix_format_bgra64: switch(pmap_tmp.bpp()) { //case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_bgra64()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_bgra64()); break; //case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_bgra64()); break; } break; case pix_format_rgba64: switch(pmap_tmp.bpp()) { //case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgba64()); break; case 24: color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_rgba64()); break; //case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgba64()); break; } break; } return true; } //------------------------------------------------------------------------ unsigned platform_specific::translate(unsigned keycode) { return m_last_translated_key = (keycode > 255) ? 0 : m_keymap[keycode]; } //------------------------------------------------------------------------ platform_support::platform_support(pix_format_e format, bool flip_y) : m_specific(new platform_specific(format, flip_y)), m_format(format), m_bpp(m_specific->m_bpp), m_window_flags(0), m_wait_mode(true), m_flip_y(flip_y), m_initial_width(10), m_initial_height(10) { strcpy(m_caption, "Anti-Grain Geometry Application"); } //------------------------------------------------------------------------ platform_support::~platform_support() { delete m_specific; } //------------------------------------------------------------------------ void platform_support::caption(const char* cap) { strcpy(m_caption, cap); if(m_specific->m_hwnd) { SetWindowText(m_specific->m_hwnd, m_caption); } } //------------------------------------------------------------------------ void platform_support::start_timer() { ::QueryPerformanceCounter(&(m_specific->m_sw_start)); } //------------------------------------------------------------------------ double platform_support::elapsed_time() const { LARGE_INTEGER stop; ::QueryPerformanceCounter(&stop); return double(stop.QuadPart - m_specific->m_sw_start.QuadPart) * 1000.0 / double(m_specific->m_sw_freq.QuadPart); } //------------------------------------------------------------------------ static unsigned get_key_flags(int wflags) { unsigned flags = 0; if(wflags & MK_LBUTTON) flags |= mouse_left; if(wflags & MK_RBUTTON) flags |= mouse_right; if(wflags & MK_SHIFT) flags |= kbd_shift; if(wflags & MK_CONTROL) flags |= kbd_ctrl; return flags; } void* platform_support::raw_display_handler() { return m_specific->m_current_dc; } //------------------------------------------------------------------------ LRESULT CALLBACK window_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HDC paintDC; void* user_data = reinterpret_cast(::GetWindowLong(hWnd, GWL_USERDATA)); platform_support* app = 0; if(user_data) { app = reinterpret_cast(user_data); } if(app == 0) { if(msg == WM_DESTROY) { ::PostQuitMessage(0); return 0; } return ::DefWindowProc(hWnd, msg, wParam, lParam); } HDC dc = ::GetDC(app->m_specific->m_hwnd); app->m_specific->m_current_dc = dc; LRESULT ret = 0; switch(msg) { //-------------------------------------------------------------------- case WM_CREATE: break; //-------------------------------------------------------------------- case WM_SIZE: app->m_specific->create_pmap(LOWORD(lParam), HIWORD(lParam), &app->rbuf_window()); app->trans_affine_resizing(LOWORD(lParam), HIWORD(lParam)); app->on_resize(LOWORD(lParam), HIWORD(lParam)); app->force_redraw(); break; //-------------------------------------------------------------------- case WM_ERASEBKGND: break; //-------------------------------------------------------------------- case WM_LBUTTONDOWN: ::SetCapture(app->m_specific->m_hwnd); app->m_specific->m_cur_x = int16(LOWORD(lParam)); if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - int16(HIWORD(lParam)); } else { app->m_specific->m_cur_y = int16(HIWORD(lParam)); } app->m_specific->m_input_flags = mouse_left | get_key_flags(wParam); app->m_ctrls.set_cur(app->m_specific->m_cur_x, app->m_specific->m_cur_y); if(app->m_ctrls.on_mouse_button_down(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { app->on_ctrl_change(); app->force_redraw(); } else { if(app->m_ctrls.in_rect(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { if(app->m_ctrls.set_cur(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { app->on_ctrl_change(); app->force_redraw(); } } else { app->on_mouse_button_down(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); } } /* if(!app->wait_mode()) { app->on_idle(); } */ break; //-------------------------------------------------------------------- case WM_LBUTTONUP: ::ReleaseCapture(); app->m_specific->m_cur_x = int16(LOWORD(lParam)); if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - int16(HIWORD(lParam)); } else { app->m_specific->m_cur_y = int16(HIWORD(lParam)); } app->m_specific->m_input_flags = mouse_left | get_key_flags(wParam); if(app->m_ctrls.on_mouse_button_up(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { app->on_ctrl_change(); app->force_redraw(); } app->on_mouse_button_up(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); /* if(!app->wait_mode()) { app->on_idle(); } */ break; //-------------------------------------------------------------------- case WM_RBUTTONDOWN: ::SetCapture(app->m_specific->m_hwnd); app->m_specific->m_cur_x = int16(LOWORD(lParam)); if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - int16(HIWORD(lParam)); } else { app->m_specific->m_cur_y = int16(HIWORD(lParam)); } app->m_specific->m_input_flags = mouse_right | get_key_flags(wParam); app->on_mouse_button_down(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); /* if(!app->wait_mode()) { app->on_idle(); } */ break; //-------------------------------------------------------------------- case WM_RBUTTONUP: ::ReleaseCapture(); app->m_specific->m_cur_x = int16(LOWORD(lParam)); if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - int16(HIWORD(lParam)); } else { app->m_specific->m_cur_y = int16(HIWORD(lParam)); } app->m_specific->m_input_flags = mouse_right | get_key_flags(wParam); app->on_mouse_button_up(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); /* if(!app->wait_mode()) { app->on_idle(); } */ break; //-------------------------------------------------------------------- case WM_MOUSEMOVE: app->m_specific->m_cur_x = int16(LOWORD(lParam)); if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - int16(HIWORD(lParam)); } else { app->m_specific->m_cur_y = int16(HIWORD(lParam)); } app->m_specific->m_input_flags = get_key_flags(wParam); if(app->m_ctrls.on_mouse_move( app->m_specific->m_cur_x, app->m_specific->m_cur_y, (app->m_specific->m_input_flags & mouse_left) != 0)) { app->on_ctrl_change(); app->force_redraw(); } else { if(!app->m_ctrls.in_rect(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { app->on_mouse_move(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); } } /* if(!app->wait_mode()) { app->on_idle(); } */ break; //-------------------------------------------------------------------- case WM_SYSKEYDOWN: case WM_KEYDOWN: app->m_specific->m_last_translated_key = 0; switch(wParam) { case VK_CONTROL: app->m_specific->m_input_flags |= kbd_ctrl; break; case VK_SHIFT: app->m_specific->m_input_flags |= kbd_shift; break; default: app->m_specific->translate(wParam); break; } if(app->m_specific->m_last_translated_key) { bool left = false; bool up = false; bool right = false; bool down = false; switch(app->m_specific->m_last_translated_key) { case key_left: left = true; break; case key_up: up = true; break; case key_right: right = true; break; case key_down: down = true; break; case key_f2: app->copy_window_to_img(agg24::platform_support::max_images - 1); app->save_img(agg24::platform_support::max_images - 1, "screenshot"); break; } if(app->window_flags() & window_process_all_keys) { app->on_key(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_last_translated_key, app->m_specific->m_input_flags); } else { if(app->m_ctrls.on_arrow_keys(left, right, down, up)) { app->on_ctrl_change(); app->force_redraw(); } else { app->on_key(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_last_translated_key, app->m_specific->m_input_flags); } } } /* if(!app->wait_mode()) { app->on_idle(); } */ break; //-------------------------------------------------------------------- case WM_SYSKEYUP: case WM_KEYUP: app->m_specific->m_last_translated_key = 0; switch(wParam) { case VK_CONTROL: app->m_specific->m_input_flags &= ~kbd_ctrl; break; case VK_SHIFT: app->m_specific->m_input_flags &= ~kbd_shift; break; } break; //-------------------------------------------------------------------- case WM_CHAR: case WM_SYSCHAR: if(app->m_specific->m_last_translated_key == 0) { app->on_key(app->m_specific->m_cur_x, app->m_specific->m_cur_y, wParam, app->m_specific->m_input_flags); } break; //-------------------------------------------------------------------- case WM_PAINT: paintDC = ::BeginPaint(hWnd, &ps); app->m_specific->m_current_dc = paintDC; if(app->m_specific->m_redraw_flag) { app->on_draw(); app->m_specific->m_redraw_flag = false; } app->m_specific->display_pmap(paintDC, &app->rbuf_window()); app->on_post_draw(paintDC); app->m_specific->m_current_dc = 0; ::EndPaint(hWnd, &ps); break; //-------------------------------------------------------------------- case WM_COMMAND: break; //-------------------------------------------------------------------- case WM_DESTROY: ::PostQuitMessage(0); break; //-------------------------------------------------------------------- default: ret = ::DefWindowProc(hWnd, msg, wParam, lParam); break; } app->m_specific->m_current_dc = 0; ::ReleaseDC(app->m_specific->m_hwnd, dc); return ret; } //------------------------------------------------------------------------ void platform_support::message(const char* msg) { ::MessageBox(m_specific->m_hwnd, msg, "AGG Message", MB_OK); } //------------------------------------------------------------------------ bool platform_support::init(unsigned width, unsigned height, unsigned flags) { if(m_specific->m_sys_format == pix_format_undefined) { return false; } m_window_flags = flags; int wflags = CS_OWNDC | CS_VREDRAW | CS_HREDRAW; WNDCLASS wc; wc.lpszClassName = "AGGAppClass"; wc.lpfnWndProc = window_proc; wc.style = wflags; wc.hInstance = g_windows_instance; wc.hIcon = LoadIcon(0, IDI_APPLICATION); wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName = "AGGAppMenu"; wc.cbClsExtra = 0; wc.cbWndExtra = 0; ::RegisterClass(&wc); wflags = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; if(m_window_flags & window_resize) { wflags |= WS_THICKFRAME | WS_MAXIMIZEBOX; } m_specific->m_hwnd = ::CreateWindow("AGGAppClass", m_caption, wflags, 100, 100, width, height, 0, 0, g_windows_instance, 0); if(m_specific->m_hwnd == 0) { return false; } RECT rct; ::GetClientRect(m_specific->m_hwnd, &rct); ::MoveWindow(m_specific->m_hwnd, // handle to window 100, // horizontal position 100, // vertical position width + (width - (rct.right - rct.left)), height + (height - (rct.bottom - rct.top)), FALSE); ::SetWindowLong(m_specific->m_hwnd, GWL_USERDATA, (LONG)this); m_specific->create_pmap(width, height, &m_rbuf_window); m_initial_width = width; m_initial_height = height; on_init(); m_specific->m_redraw_flag = true; ::ShowWindow(m_specific->m_hwnd, g_windows_cmd_show); return true; } //------------------------------------------------------------------------ int platform_support::run() { MSG msg; for(;;) { if(m_wait_mode) { if(!::GetMessage(&msg, 0, 0, 0)) { break; } ::TranslateMessage(&msg); ::DispatchMessage(&msg); } else { if(::PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { ::TranslateMessage(&msg); if(msg.message == WM_QUIT) { break; } ::DispatchMessage(&msg); } else { on_idle(); } } } return (int)msg.wParam; } //------------------------------------------------------------------------ const char* platform_support::img_ext() const { return ".bmp"; } //------------------------------------------------------------------------ const char* platform_support::full_file_name(const char* file_name) { return file_name; } //------------------------------------------------------------------------ bool platform_support::load_img(unsigned idx, const char* file) { if(idx < max_images) { char fn[1024]; strcpy(fn, file); int len = strlen(fn); if(len < 4 || stricmp(fn + len - 4, ".BMP") != 0) { strcat(fn, ".bmp"); } return m_specific->load_pmap(fn, idx, &m_rbuf_img[idx]); } return true; } //------------------------------------------------------------------------ bool platform_support::save_img(unsigned idx, const char* file) { if(idx < max_images) { char fn[1024]; strcpy(fn, file); int len = strlen(fn); if(len < 4 || stricmp(fn + len - 4, ".BMP") != 0) { strcat(fn, ".bmp"); } return m_specific->save_pmap(fn, idx, &m_rbuf_img[idx]); } return true; } //------------------------------------------------------------------------ bool platform_support::create_img(unsigned idx, unsigned width, unsigned height) { if(idx < max_images) { if(width == 0) width = m_specific->m_pmap_window.width(); if(height == 0) height = m_specific->m_pmap_window.height(); m_specific->m_pmap_img[idx].create(width, height, org_e(m_specific->m_bpp)); m_rbuf_img[idx].attach(m_specific->m_pmap_img[idx].buf(), m_specific->m_pmap_img[idx].width(), m_specific->m_pmap_img[idx].height(), m_flip_y ? m_specific->m_pmap_img[idx].stride() : -m_specific->m_pmap_img[idx].stride()); return true; } return false; } //------------------------------------------------------------------------ void platform_support::force_redraw() { m_specific->m_redraw_flag = true; ::InvalidateRect(m_specific->m_hwnd, 0, FALSE); } //------------------------------------------------------------------------ void platform_support::update_window() { HDC dc = ::GetDC(m_specific->m_hwnd); m_specific->display_pmap(dc, &m_rbuf_window); ::ReleaseDC(m_specific->m_hwnd, dc); } //------------------------------------------------------------------------ void platform_support::on_init() {} void platform_support::on_resize(int sx, int sy) {} void platform_support::on_idle() {} void platform_support::on_mouse_move(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_down(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_up(int x, int y, unsigned flags) {} void platform_support::on_key(int x, int y, unsigned key, unsigned flags) {} void platform_support::on_ctrl_change() {} void platform_support::on_draw() {} void platform_support::on_post_draw(void* raw_handler) {} } namespace agg24 { // That's ridiculous. I have to parse the command line by myself // because Windows doesn't provide a method of getting the command // line arguments in a form of argc, argv. Of course, there's // CommandLineToArgv() but first, it returns Unicode that I don't // need to deal with, but most of all, it's not compatible with Win98. //----------------------------------------------------------------------- class tokenizer { public: enum sep_flag { single, multiple, whole_str }; struct token { const char* ptr; unsigned len; }; public: tokenizer(const char* sep, const char* trim=0, const char* quote="\"", char mask_chr='\\', sep_flag sf=multiple); void set_str(const char* str); token next_token(); private: int check_chr(const char *str, char chr); private: const char* m_src_string; int m_start; const char* m_sep; const char* m_trim; const char* m_quote; char m_mask_chr; unsigned m_sep_len; sep_flag m_sep_flag; }; //----------------------------------------------------------------------- inline void tokenizer::set_str(const char* str) { m_src_string = str; m_start = 0; } //----------------------------------------------------------------------- inline int tokenizer::check_chr(const char *str, char chr) { return int(strchr(str, chr)); } //----------------------------------------------------------------------- tokenizer::tokenizer(const char* sep, const char* trim, const char* quote, char mask_chr, sep_flag sf) : m_src_string(0), m_start(0), m_sep(sep), m_trim(trim), m_quote(quote), m_mask_chr(mask_chr), m_sep_len(sep ? strlen(sep) : 0), m_sep_flag(sep ? sf : single) { } //----------------------------------------------------------------------- tokenizer::token tokenizer::next_token() { unsigned count = 0; char quote_chr = 0; token tok; tok.ptr = 0; tok.len = 0; if(m_src_string == 0 || m_start == -1) return tok; register const char *pstr = m_src_string + m_start; if(*pstr == 0) { m_start = -1; return tok; } int sep_len = 1; if(m_sep_flag == whole_str) sep_len = m_sep_len; if(m_sep_flag == multiple) { //Pass all the separator symbols at the begin of the string while(*pstr && check_chr(m_sep, *pstr)) { ++pstr; ++m_start; } } if(*pstr == 0) { m_start = -1; return tok; } for(count = 0;; ++count) { char c = *pstr; int found = 0; //We are outside of qotation: find one of separator symbols if(quote_chr == 0) { if(sep_len == 1) { found = check_chr(m_sep, c); } else { found = strncmp(m_sep, pstr, m_sep_len) == 0; } } ++pstr; if(c == 0 || found) { if(m_trim) { while(count && check_chr(m_trim, m_src_string[m_start])) { ++m_start; --count; } while(count && check_chr(m_trim, m_src_string[m_start + count - 1])) { --count; } } tok.ptr = m_src_string + m_start; tok.len = count; //Next time it will be the next separator character //But we must check, whether it is NOT the end of the string. m_start += count; if(c) { m_start += sep_len; if(m_sep_flag == multiple) { //Pass all the separator symbols //after the end of the string while(check_chr(m_sep, m_src_string[m_start])) { ++m_start; } } } break; } //Switch quote. If it is not a quote yet, try to check any of //quote symbols. Otherwise quote must be finished with quote_symb if(quote_chr == 0) { if(check_chr(m_quote, c)) { quote_chr = c; continue; } } else { //We are inside quote: pass all the mask symbols if(m_mask_chr && c == m_mask_chr) { if(*pstr) { ++count; ++pstr; } continue; } if(c == quote_chr) { quote_chr = 0; continue; } } } return tok; } } //---------------------------------------------------------------------------- int agg_main(int argc, char* argv[]); //---------------------------------------------------------------------------- int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { agg24::g_windows_instance = hInstance; agg24::g_windows_cmd_show = nCmdShow; char* argv_str = new char [strlen(lpszCmdLine) + 3]; char* argv_ptr = argv_str; char* argv[64]; memset(argv, 0, sizeof(argv)); agg24::tokenizer cmd_line(" ", "\"' ", "\"'", '\\', agg24::tokenizer::multiple); cmd_line.set_str(lpszCmdLine); int argc = 0; argv[argc++] = argv_ptr; *argv_ptr++ = 0; while(argc < 64) { agg24::tokenizer::token tok = cmd_line.next_token(); if(tok.ptr == 0) break; if(tok.len) { memcpy(argv_ptr, tok.ptr, tok.len); argv[argc++] = argv_ptr; argv_ptr += tok.len; *argv_ptr++ = 0; } } int ret = agg_main(argc, argv); delete [] argv_str; return ret; } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/win32/agg_win32_bmp.cpp0000644000175000017500000004622113233644505026057 0ustar varunvarun//---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- // Contact: mcseemagg@yahoo.com //---------------------------------------------------------------------------- // // class pixel_map // //---------------------------------------------------------------------------- #include "platform/win32/agg_win32_bmp.h" #include "agg_basics.h" namespace agg24 { //------------------------------------------------------------------------ pixel_map::~pixel_map() { destroy(); } //------------------------------------------------------------------------ pixel_map::pixel_map() : m_bmp(0), m_buf(0), m_bpp(0), m_is_internal(false), m_img_size(0), m_full_size(0) { } //------------------------------------------------------------------------ void pixel_map::destroy() { if(m_bmp && m_is_internal) delete [] (unsigned char*)m_bmp; m_bmp = 0; m_is_internal = false; m_buf = 0; } //------------------------------------------------------------------------ void pixel_map::create(unsigned width, unsigned height, org_e org, unsigned clear_val) { destroy(); if(width == 0) width = 1; if(height == 0) height = 1; m_bpp = org; create_from_bmp(create_bitmap_info(width, height, m_bpp)); create_gray_scale_palette(m_bmp); m_is_internal = true; if(clear_val <= 255) { memset(m_buf, clear_val, m_img_size); } } //------------------------------------------------------------------------ HBITMAP pixel_map::create_dib_section(HDC h_dc, unsigned width, unsigned height, org_e org, unsigned clear_val) { destroy(); if(width == 0) width = 1; if(height == 0) height = 1; m_bpp = org; HBITMAP h_bitmap = create_dib_section_from_args(h_dc, width, height, m_bpp); create_gray_scale_palette(m_bmp); m_is_internal = true; if(clear_val <= 255) { memset(m_buf, clear_val, m_img_size); } return h_bitmap; } //------------------------------------------------------------------------ void pixel_map::clear(unsigned clear_val) { if(m_buf) memset(m_buf, clear_val, m_img_size); } //------------------------------------------------------------------------ void pixel_map::attach_to_bmp(BITMAPINFO *bmp) { if(bmp) { destroy(); create_from_bmp(bmp); m_is_internal = false; } } //static //------------------------------------------------------------------------ unsigned pixel_map::calc_full_size(BITMAPINFO *bmp) { if(bmp == 0) return 0; return sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * calc_palette_size(bmp) + bmp->bmiHeader.biSizeImage; } //static //------------------------------------------------------------------------ unsigned pixel_map::calc_header_size(BITMAPINFO *bmp) { if(bmp == 0) return 0; return sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * calc_palette_size(bmp); } //static //------------------------------------------------------------------------ unsigned pixel_map::calc_palette_size(unsigned clr_used, unsigned bits_per_pixel) { int palette_size = 0; if(bits_per_pixel <= 8) { palette_size = clr_used; if(palette_size == 0) { palette_size = 1 << bits_per_pixel; } } return palette_size; } //static //------------------------------------------------------------------------ unsigned pixel_map::calc_palette_size(BITMAPINFO *bmp) { if(bmp == 0) return 0; return calc_palette_size(bmp->bmiHeader.biClrUsed, bmp->bmiHeader.biBitCount); } //static //------------------------------------------------------------------------ unsigned char * pixel_map::calc_img_ptr(BITMAPINFO *bmp) { if(bmp == 0) return 0; return ((unsigned char*)bmp) + calc_header_size(bmp); } //static //------------------------------------------------------------------------ BITMAPINFO* pixel_map::create_bitmap_info(unsigned width, unsigned height, unsigned bits_per_pixel) { unsigned line_len = calc_row_len(width, bits_per_pixel); unsigned img_size = line_len * height; unsigned rgb_size = calc_palette_size(0, bits_per_pixel) * sizeof(RGBQUAD); unsigned full_size = sizeof(BITMAPINFOHEADER) + rgb_size + img_size; BITMAPINFO *bmp = (BITMAPINFO *) new unsigned char[full_size]; bmp->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp->bmiHeader.biWidth = width; bmp->bmiHeader.biHeight = height; bmp->bmiHeader.biPlanes = 1; bmp->bmiHeader.biBitCount = (unsigned short)bits_per_pixel; bmp->bmiHeader.biCompression = 0; bmp->bmiHeader.biSizeImage = img_size; bmp->bmiHeader.biXPelsPerMeter = 0; bmp->bmiHeader.biYPelsPerMeter = 0; bmp->bmiHeader.biClrUsed = 0; bmp->bmiHeader.biClrImportant = 0; return bmp; } //static //------------------------------------------------------------------------ void pixel_map::create_gray_scale_palette(BITMAPINFO *bmp) { if(bmp == 0) return; unsigned rgb_size = calc_palette_size(bmp); RGBQUAD *rgb = (RGBQUAD*)(((unsigned char*)bmp) + sizeof(BITMAPINFOHEADER)); unsigned brightness; unsigned i; for(i = 0; i < rgb_size; i++) { brightness = (255 * i) / (rgb_size - 1); rgb->rgbBlue = rgb->rgbGreen = rgb->rgbRed = (unsigned char)brightness; rgb->rgbReserved = 0; rgb++; } } //static //------------------------------------------------------------------------ unsigned pixel_map::calc_row_len(unsigned width, unsigned bits_per_pixel) { unsigned n = width; unsigned k; switch(bits_per_pixel) { case 1: k = n; n = n >> 3; if(k & 7) n++; break; case 4: k = n; n = n >> 1; if(k & 3) n++; break; case 8: break; case 16: n *= 2; break; case 24: n *= 3; break; case 32: n *= 4; break; case 48: n *= 6; break; case 64: n *= 8; break; default: n = 0; break; } return ((n + 3) >> 2) << 2; } //------------------------------------------------------------------------ void pixel_map::draw(HDC h_dc, const RECT *device_rect, const RECT *bmp_rect) const { if(m_bmp == 0 || m_buf == 0) return; unsigned bmp_x = 0; unsigned bmp_y = 0; unsigned bmp_width = m_bmp->bmiHeader.biWidth; unsigned bmp_height = m_bmp->bmiHeader.biHeight; unsigned dvc_x = 0; unsigned dvc_y = 0; unsigned dvc_width = m_bmp->bmiHeader.biWidth; unsigned dvc_height = m_bmp->bmiHeader.biHeight; if(bmp_rect) { bmp_x = bmp_rect->left; bmp_y = bmp_rect->top; bmp_width = bmp_rect->right - bmp_rect->left; bmp_height = bmp_rect->bottom - bmp_rect->top; } dvc_x = bmp_x; dvc_y = bmp_y; dvc_width = bmp_width; dvc_height = bmp_height; if(device_rect) { dvc_x = device_rect->left; dvc_y = device_rect->top; dvc_width = device_rect->right - device_rect->left; dvc_height = device_rect->bottom - device_rect->top; } if(dvc_width != bmp_width || dvc_height != bmp_height) { ::SetStretchBltMode(h_dc, COLORONCOLOR); ::StretchDIBits( h_dc, // handle of device context dvc_x, // x-coordinate of upper-left corner of source rect. dvc_y, // y-coordinate of upper-left corner of source rect. dvc_width, // width of source rectangle dvc_height, // height of source rectangle bmp_x, bmp_y, // x, y -coordinates of upper-left corner of dest. rect. bmp_width, // width of destination rectangle bmp_height, // height of destination rectangle m_buf, // address of bitmap bits m_bmp, // address of bitmap data DIB_RGB_COLORS, // usage SRCCOPY // raster operation code ); } else { ::SetDIBitsToDevice( h_dc, // handle to device context dvc_x, // x-coordinate of upper-left corner of dvc_y, // y-coordinate of upper-left corner of dvc_width, // source rectangle width dvc_height, // source rectangle height bmp_x, // x-coordinate of lower-left corner of bmp_y, // y-coordinate of lower-left corner of 0, // first scan line in array bmp_height, // number of scan lines m_buf, // address of array with DIB bits m_bmp, // address of structure with bitmap info. DIB_RGB_COLORS // RGB or palette indexes ); } } //------------------------------------------------------------------------ void pixel_map::draw(HDC h_dc, int x, int y, double scale) const { if(m_bmp == 0 || m_buf == 0) return; unsigned width = unsigned(m_bmp->bmiHeader.biWidth * scale); unsigned height = unsigned(m_bmp->bmiHeader.biHeight * scale); RECT rect; rect.left = x; rect.top = y; rect.right = x + width; rect.bottom = y + height; draw(h_dc, &rect); } //------------------------------------------------------------------------ void pixel_map::blend(HDC h_dc, const RECT *device_rect, const RECT *bmp_rect) const { #if !defined(AGG_BMP_ALPHA_BLEND) draw(h_dc, device_rect, bmp_rect); return; #else if(m_bpp != 32) { draw(h_dc, device_rect, bmp_rect); return; } if(m_bmp == 0 || m_buf == 0) return; unsigned bmp_x = 0; unsigned bmp_y = 0; unsigned bmp_width = m_bmp->bmiHeader.biWidth; unsigned bmp_height = m_bmp->bmiHeader.biHeight; unsigned dvc_x = 0; unsigned dvc_y = 0; unsigned dvc_width = m_bmp->bmiHeader.biWidth; unsigned dvc_height = m_bmp->bmiHeader.biHeight; if(bmp_rect) { bmp_x = bmp_rect->left; bmp_y = bmp_rect->top; bmp_width = bmp_rect->right - bmp_rect->left; bmp_height = bmp_rect->bottom - bmp_rect->top; } dvc_x = bmp_x; dvc_y = bmp_y; dvc_width = bmp_width; dvc_height = bmp_height; if(device_rect) { dvc_x = device_rect->left; dvc_y = device_rect->top; dvc_width = device_rect->right - device_rect->left; dvc_height = device_rect->bottom - device_rect->top; } HDC mem_dc = ::CreateCompatibleDC(h_dc); void* buf = 0; HBITMAP bmp = ::CreateDIBSection( mem_dc, m_bmp, DIB_RGB_COLORS, &buf, 0, 0 ); memcpy(buf, m_buf, m_bmp->bmiHeader.biSizeImage); HBITMAP temp = (HBITMAP)::SelectObject(mem_dc, bmp); BLENDFUNCTION blend; blend.BlendOp = AC_SRC_OVER; blend.BlendFlags = 0; #if defined(AC_SRC_ALPHA) blend.AlphaFormat = AC_SRC_ALPHA; //#elif defined(AC_SRC_NO_PREMULT_ALPHA) // blend.AlphaFormat = AC_SRC_NO_PREMULT_ALPHA; #else #error "No appropriate constant for alpha format. Check version of wingdi.h, There must be AC_SRC_ALPHA or AC_SRC_NO_PREMULT_ALPHA" #endif blend.SourceConstantAlpha = 255; ::AlphaBlend( h_dc, dvc_x, dvc_y, dvc_width, dvc_height, mem_dc, bmp_x, bmp_y, bmp_width, bmp_height, blend ); ::SelectObject(mem_dc, temp); ::DeleteObject(bmp); ::DeleteObject(mem_dc); #endif //defined(AGG_BMP_ALPHA_BLEND) } //------------------------------------------------------------------------ void pixel_map::blend(HDC h_dc, int x, int y, double scale) const { if(m_bmp == 0 || m_buf == 0) return; unsigned width = unsigned(m_bmp->bmiHeader.biWidth * scale); unsigned height = unsigned(m_bmp->bmiHeader.biHeight * scale); RECT rect; rect.left = x; rect.top = y; rect.right = x + width; rect.bottom = y + height; blend(h_dc, &rect); } //------------------------------------------------------------------------ bool pixel_map::load_from_bmp(FILE *fd) { BITMAPFILEHEADER bmf; BITMAPINFO *bmi = 0; unsigned bmp_size; fread(&bmf, sizeof(bmf), 1, fd); if(bmf.bfType != 0x4D42) goto bmperr; bmp_size = bmf.bfSize - sizeof(BITMAPFILEHEADER); bmi = (BITMAPINFO*) new unsigned char [bmp_size]; if(fread(bmi, 1, bmp_size, fd) != bmp_size) goto bmperr; destroy(); m_bpp = bmi->bmiHeader.biBitCount; create_from_bmp(bmi); m_is_internal = 1; return true; bmperr: if(bmi) delete [] (unsigned char*) bmi; return false; } //------------------------------------------------------------------------ bool pixel_map::load_from_bmp(const char *filename) { FILE *fd = fopen(filename, "rb"); bool ret = false; if(fd) { ret = load_from_bmp(fd); fclose(fd); } return ret; } //------------------------------------------------------------------------ bool pixel_map::save_as_bmp(FILE *fd) const { if(m_bmp == 0) return 0; BITMAPFILEHEADER bmf; bmf.bfType = 0x4D42; bmf.bfOffBits = calc_header_size(m_bmp) + sizeof(bmf); bmf.bfSize = bmf.bfOffBits + m_img_size; bmf.bfReserved1 = 0; bmf.bfReserved2 = 0; fwrite(&bmf, sizeof(bmf), 1, fd); fwrite(m_bmp, m_full_size, 1, fd); return true; } //------------------------------------------------------------------------ bool pixel_map::save_as_bmp(const char *filename) const { FILE *fd = fopen(filename, "wb"); bool ret = false; if(fd) { ret = save_as_bmp(fd); fclose(fd); } return ret; } //------------------------------------------------------------------------ unsigned char* pixel_map::buf() { return m_buf; } //------------------------------------------------------------------------ unsigned pixel_map::width() const { return m_bmp->bmiHeader.biWidth; } //------------------------------------------------------------------------ unsigned pixel_map::height() const { return m_bmp->bmiHeader.biHeight; } //------------------------------------------------------------------------ int pixel_map::stride() const { return calc_row_len(m_bmp->bmiHeader.biWidth, m_bmp->bmiHeader.biBitCount); } //private //------------------------------------------------------------------------ void pixel_map::create_from_bmp(BITMAPINFO *bmp) { if(bmp) { m_img_size = calc_row_len(bmp->bmiHeader.biWidth, bmp->bmiHeader.biBitCount) * bmp->bmiHeader.biHeight; m_full_size = calc_full_size(bmp); m_bmp = bmp; m_buf = calc_img_ptr(bmp); } } //private //------------------------------------------------------------------------ HBITMAP pixel_map::create_dib_section_from_args(HDC h_dc, unsigned width, unsigned height, unsigned bits_per_pixel) { unsigned line_len = calc_row_len(width, bits_per_pixel); unsigned img_size = line_len * height; unsigned rgb_size = calc_palette_size(0, bits_per_pixel) * sizeof(RGBQUAD); unsigned full_size = sizeof(BITMAPINFOHEADER) + rgb_size; BITMAPINFO *bmp = (BITMAPINFO *) new unsigned char[full_size]; bmp->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp->bmiHeader.biWidth = width; bmp->bmiHeader.biHeight = height; bmp->bmiHeader.biPlanes = 1; bmp->bmiHeader.biBitCount = (unsigned short)bits_per_pixel; bmp->bmiHeader.biCompression = 0; bmp->bmiHeader.biSizeImage = img_size; bmp->bmiHeader.biXPelsPerMeter = 0; bmp->bmiHeader.biYPelsPerMeter = 0; bmp->bmiHeader.biClrUsed = 0; bmp->bmiHeader.biClrImportant = 0; void* img_ptr = 0; HBITMAP h_bitmap = ::CreateDIBSection(h_dc, bmp, DIB_RGB_COLORS, &img_ptr, NULL, 0); if(img_ptr) { m_img_size = calc_row_len(width, bits_per_pixel) * height; m_full_size = 0; m_bmp = bmp; m_buf = (unsigned char *) img_ptr; } return h_bitmap; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/win32/Makefile.am0000644000175000017500000000061213233644505024763 0ustar varunvarun if ENABLE_WIN32 lib_LTLIBRARIES = libaggplatformwin32.la libaggplatformwin32_la_LDFLAGS = -version-info @AGG_LIB_VERSION@ libaggplatformwin32_la_SOURCES = agg_platform_support.cpp \ agg_win32_bmp.cpp libaggplatformwin32_la_CXXFLAGS = -I$(top_srcdir)/include @WINDOWS_CFLAGS@ libaggplatformwin32_la_LIBADD = @WINDOWS_LIBS@ $(top_builddir)/src/libagg.la endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/AmigaOS/0000755000175000017500000000000013544357604023254 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/AmigaOS/agg_platform_support.cpp0000644000175000017500000006150513233644505030217 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class platform_support // //---------------------------------------------------------------------------- #include "platform/agg_platform_support.h" #include "util/agg_color_conv_rgb8.h" #include #include #include #include #include #include #include #include #include #include #include #include #include Library* DataTypesBase = 0; Library* GraphicsBase = 0; Library* IntuitionBase = 0; Library* KeymapBase = 0; Library* P96Base = 0; DataTypesIFace* IDataTypes = 0; GraphicsIFace* IGraphics = 0; IntuitionIFace* IIntuition = 0; KeymapIFace* IKeymap = 0; P96IFace* IP96 = 0; Class* RequesterClass = 0; Class* WindowClass = 0; namespace agg24 { void handle_idcmp(Hook* hook, APTR win, IntuiMessage* msg); //------------------------------------------------------------------------ class platform_specific { public: platform_specific(platform_support& support, pix_format_e format, bool flip_y); ~platform_specific(); bool handle_input(); bool load_img(const char* file, unsigned idx, rendering_buffer* rbuf); bool create_img(unsigned idx, rendering_buffer* rbuf, unsigned width, unsigned height); bool make_bitmap(); public: platform_support& m_support; RGBFTYPE m_ftype; pix_format_e m_format; unsigned m_bpp; BitMap* m_bitmap; bool m_flip_y; uint16 m_width; uint16 m_height; APTR m_window_obj; Window* m_window; Hook* m_idcmp_hook; unsigned m_input_flags; bool m_dragging; double m_start_time; uint16 m_last_key; BitMap* m_img_bitmaps[platform_support::max_images]; }; //------------------------------------------------------------------------ platform_specific::platform_specific(platform_support& support, pix_format_e format, bool flip_y) : m_support(support), m_ftype(RGBFB_NONE), m_format(format), m_bpp(0), m_bitmap(0), m_flip_y(flip_y), m_width(0), m_height(0), m_window_obj(0), m_window(0), m_idcmp_hook(0), m_input_flags(0), m_dragging(false), m_start_time(0.0), m_last_key(0) { switch ( format ) { case pix_format_gray8: // Not supported. break; case pix_format_rgb555: m_ftype = RGBFB_R5G5B5; m_bpp = 15; break; case pix_format_rgb565: m_ftype = RGBFB_R5G6B5; m_bpp = 16; break; case pix_format_rgb24: m_ftype = RGBFB_R8G8B8; m_bpp = 24; break; case pix_format_bgr24: m_ftype = RGBFB_B8G8R8; m_bpp = 24; break; case pix_format_bgra32: m_ftype = RGBFB_B8G8R8A8; m_bpp = 32; break; case pix_format_abgr32: m_ftype = RGBFB_A8B8G8R8; m_bpp = 32; break; case pix_format_argb32: m_ftype = RGBFB_A8R8G8B8; m_bpp = 32; break; case pix_format_rgba32: m_ftype = RGBFB_R8G8B8A8; m_bpp = 32; break; } for ( unsigned i = 0; i < platform_support::max_images; ++i ) { m_img_bitmaps[i] = 0; } } //------------------------------------------------------------------------ platform_specific::~platform_specific() { IIntuition->DisposeObject(m_window_obj); IP96->p96FreeBitMap(m_bitmap); for ( unsigned i = 0; i < platform_support::max_images; ++i ) { IP96->p96FreeBitMap(m_img_bitmaps[i]); } if ( m_idcmp_hook != 0 ) { IExec->FreeSysObject(ASOT_HOOK, m_idcmp_hook); } } //------------------------------------------------------------------------ bool platform_specific::handle_input() { int16 code = 0; uint32 result = 0; Object* obj = reinterpret_cast(m_window_obj); while ( (result = IIntuition->IDoMethod(obj, WM_HANDLEINPUT, &code)) != WMHI_LASTMSG ) { switch ( result & WMHI_CLASSMASK ) { case WMHI_CLOSEWINDOW: return true; break; case WMHI_INTUITICK: if ( !m_support.wait_mode() ) { m_support.on_idle(); } break; case WMHI_NEWSIZE: if ( make_bitmap() ) { m_support.trans_affine_resizing(m_width, m_height); m_support.on_resize(m_width, m_height); m_support.force_redraw(); } break; } } return false; } //------------------------------------------------------------------------ bool platform_specific::load_img(const char* file, unsigned idx, rendering_buffer* rbuf) { if ( m_img_bitmaps[idx] != 0 ) { IP96->p96FreeBitMap(m_img_bitmaps[idx]); m_img_bitmaps[idx] = 0; } bool result = false; Object* picture = IDataTypes->NewDTObject(const_cast(file), DTA_GroupID, GID_PICTURE, PDTA_DestMode, PMODE_V43, PDTA_Remap, FALSE, TAG_END); if ( picture != 0 ) { gpLayout layout; layout.MethodID = DTM_PROCLAYOUT; layout.gpl_GInfo = 0; layout.gpl_Initial = 1; ULONG loaded = IDataTypes->DoDTMethodA(picture, 0, 0, reinterpret_cast(&layout)); if ( loaded != 0 ) { BitMap* src_bitmap = 0; IDataTypes->GetDTAttrs(picture, PDTA_ClassBitMap, &src_bitmap, TAG_END); bool supported = false; RGBFTYPE ftype = static_cast(IP96->p96GetBitMapAttr( src_bitmap, P96BMA_RGBFORMAT)); switch ( ftype ) { case RGBFB_R8G8B8: supported = true; break; default: m_support.message("File uses unsupported graphics mode."); break; } if ( supported ) { uint16 width = IP96->p96GetBitMapAttr(src_bitmap, P96BMA_WIDTH); uint16 height = IP96->p96GetBitMapAttr(src_bitmap, P96BMA_HEIGHT); m_img_bitmaps[idx] = IP96->p96AllocBitMap(width, height, m_bpp, BMF_USERPRIVATE, 0, m_ftype); if ( m_img_bitmaps[idx] != 0 ) { int8u* buf = reinterpret_cast( IP96->p96GetBitMapAttr(m_img_bitmaps[idx], P96BMA_MEMORY)); int bpr = IP96->p96GetBitMapAttr(m_img_bitmaps[idx], P96BMA_BYTESPERROW); int stride = (m_flip_y) ? -bpr : bpr; rbuf->attach(buf, width, height, stride); // P96 sets the alpha to zero so it can't be used to // color convert true color modes. if ( m_bpp == 32 ) { RenderInfo ri; int32 lock = IP96->p96LockBitMap(src_bitmap, reinterpret_cast(&ri), sizeof(RenderInfo)); rendering_buffer rbuf_src; rbuf_src.attach( reinterpret_cast(ri.Memory), width, height, (m_flip_y) ? -ri.BytesPerRow : ri.BytesPerRow); switch ( m_format ) { case pix_format_bgra32: color_conv(rbuf, &rbuf_src, color_conv_rgb24_to_bgra32()); break; case pix_format_abgr32: color_conv(rbuf, &rbuf_src, color_conv_rgb24_to_abgr32()); break; case pix_format_argb32: color_conv(rbuf, &rbuf_src, color_conv_rgb24_to_argb32()); break; case pix_format_rgba32: color_conv(rbuf, &rbuf_src, color_conv_rgb24_to_rgba32()); break; } IP96->p96UnlockBitMap(src_bitmap, lock); } else { IGraphics->BltBitMap(src_bitmap, 0, 0, m_img_bitmaps[idx], 0, 0, width, height, ABC|ABNC, 0xFF, 0); } result = true; } } } } IGraphics->WaitBlit(); IDataTypes->DisposeDTObject(picture); return result; } //------------------------------------------------------------------------ bool platform_specific::create_img(unsigned idx, rendering_buffer* rbuf, unsigned width, unsigned height) { if ( m_img_bitmaps[idx] != 0 ) { IP96->p96FreeBitMap(m_img_bitmaps[idx]); m_img_bitmaps[idx] = 0; } m_img_bitmaps[idx] = IP96->p96AllocBitMap(width, height, m_bpp, BMF_USERPRIVATE, m_bitmap, m_ftype); if ( m_img_bitmaps[idx] != 0 ) { int8u* buf = reinterpret_cast( IP96->p96GetBitMapAttr(m_img_bitmaps[idx], P96BMA_MEMORY)); int bpr = IP96->p96GetBitMapAttr(m_img_bitmaps[idx], P96BMA_BYTESPERROW); int stride = (m_flip_y) ? -bpr : bpr; rbuf->attach(buf, width, height, stride); return true; } return false; } //------------------------------------------------------------------------ bool platform_specific::make_bitmap() { uint32 width = 0; uint32 height = 0; IIntuition->GetWindowAttrs(m_window, WA_InnerWidth, &width, WA_InnerHeight, &height, TAG_END); BitMap* bm = IP96->p96AllocBitMap(width, height, m_bpp, BMF_USERPRIVATE|BMF_CLEAR, 0, m_ftype); if ( bm == 0 ) { return false; } int8u* buf = reinterpret_cast( IP96->p96GetBitMapAttr(bm, P96BMA_MEMORY)); int bpr = IP96->p96GetBitMapAttr(bm, P96BMA_BYTESPERROW); int stride = (m_flip_y) ? -bpr : bpr; m_support.rbuf_window().attach(buf, width, height, stride); if ( m_bitmap != 0 ) { IP96->p96FreeBitMap(m_bitmap); m_bitmap = 0; } m_bitmap = bm; m_width = width; m_height = height; return true; } //------------------------------------------------------------------------ platform_support::platform_support(pix_format_e format, bool flip_y) : m_specific(new platform_specific(*this, format, flip_y)), m_format(format), m_bpp(m_specific->m_bpp), m_window_flags(0), m_wait_mode(true), m_flip_y(flip_y), m_initial_width(10), m_initial_height(10) { std::strncpy(m_caption, "Anti-Grain Geometry", 256); } //------------------------------------------------------------------------ platform_support::~platform_support() { delete m_specific; } //------------------------------------------------------------------------ void platform_support::caption(const char* cap) { std::strncpy(m_caption, cap, 256); if ( m_specific->m_window != 0 ) { const char* ignore = reinterpret_cast(-1); IIntuition->SetWindowAttr(m_specific->m_window, WA_Title, m_caption, sizeof(char*)); } } //------------------------------------------------------------------------ void platform_support::start_timer() { timeval tv; gettimeofday(&tv, 0); m_specific->m_start_time = tv.tv_secs + tv.tv_micro/1e6; } //------------------------------------------------------------------------ double platform_support::elapsed_time() const { timeval tv; gettimeofday(&tv, 0); double end_time = tv.tv_secs + tv.tv_micro/1e6; double elasped_seconds = end_time - m_specific->m_start_time; double elasped_millis = elasped_seconds*1e3; return elasped_millis; } //------------------------------------------------------------------------ void* platform_support::raw_display_handler() { return 0; // Not available. } //------------------------------------------------------------------------ void platform_support::message(const char* msg) { APTR req = IIntuition->NewObject(RequesterClass, 0, REQ_TitleText, "Anti-Grain Geometry", REQ_Image, REQIMAGE_INFO, REQ_BodyText, msg, REQ_GadgetText, "_Ok", TAG_END); if ( req == 0 ) { IDOS->Printf("Message: %s\n", msg); return; } orRequest reqmsg; reqmsg.MethodID = RM_OPENREQ; reqmsg.or_Attrs = 0; reqmsg.or_Window = m_specific->m_window; reqmsg.or_Screen = 0; IIntuition->IDoMethodA(reinterpret_cast(req), reinterpret_cast(&reqmsg)); IIntuition->DisposeObject(req); } //------------------------------------------------------------------------ bool platform_support::init(unsigned width, unsigned height, unsigned flags) { if( m_specific->m_ftype == RGBFB_NONE ) { message("Unsupported mode requested."); return false; } m_window_flags = flags; m_specific->m_idcmp_hook = reinterpret_cast( IExec->AllocSysObjectTags(ASOT_HOOK, ASOHOOK_Entry, handle_idcmp, ASOHOOK_Data, this, TAG_END)); if ( m_specific->m_idcmp_hook == 0 ) { return false; } m_specific->m_window_obj = IIntuition->NewObject(WindowClass, 0, WA_Title, m_caption, WA_AutoAdjustDClip, TRUE, WA_InnerWidth, width, WA_InnerHeight, height, WA_Activate, TRUE, WA_SmartRefresh, TRUE, WA_NoCareRefresh, TRUE, WA_CloseGadget, TRUE, WA_DepthGadget, TRUE, WA_SizeGadget, (flags & agg24::window_resize) ? TRUE : FALSE, WA_DragBar, TRUE, WA_AutoAdjust, TRUE, WA_ReportMouse, TRUE, WA_RMBTrap, TRUE, WA_MouseQueue, 1, WA_IDCMP, IDCMP_NEWSIZE | IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_RAWKEY | IDCMP_INTUITICKS, WINDOW_IDCMPHook, m_specific->m_idcmp_hook, WINDOW_IDCMPHookBits, IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_RAWKEY, TAG_END); if ( m_specific->m_window_obj == 0 ) { return false; } Object* obj = reinterpret_cast(m_specific->m_window_obj); m_specific->m_window = reinterpret_cast(IIntuition->IDoMethod(obj, WM_OPEN)); if ( m_specific->m_window == 0 ) { return false; } RGBFTYPE ftype = static_cast(IP96->p96GetBitMapAttr( m_specific->m_window->RPort->BitMap, P96BMA_RGBFORMAT)); switch ( ftype ) { case RGBFB_A8R8G8B8: case RGBFB_B8G8R8A8: case RGBFB_R5G6B5PC: break; default: message("Unsupported screen mode.\n"); return false; } if ( !m_specific->make_bitmap() ) { return false; } m_initial_width = width; m_initial_height = height; on_init(); on_resize(width, height); force_redraw(); return true; } //------------------------------------------------------------------------ int platform_support::run() { uint32 window_mask = 0; IIntuition->GetAttr(WINDOW_SigMask, m_specific->m_window_obj, &window_mask); uint32 wait_mask = window_mask | SIGBREAKF_CTRL_C; bool done = false; while ( !done ) { uint32 sig_mask = IExec->Wait(wait_mask); if ( sig_mask & SIGBREAKF_CTRL_C ) { done = true; } else { done = m_specific->handle_input(); } } return 0; } //------------------------------------------------------------------------ const char* platform_support::img_ext() const { return ".bmp"; } //------------------------------------------------------------------------ const char* platform_support::full_file_name(const char* file_name) { return file_name; } //------------------------------------------------------------------------ bool platform_support::load_img(unsigned idx, const char* file) { if ( idx < max_images ) { static char fn[1024]; std::strncpy(fn, file, 1024); int len = std::strlen(fn); if ( len < 4 || std::strcmp(fn + len - 4, ".bmp") != 0 ) { std::strncat(fn, ".bmp", 1024); } return m_specific->load_img(fn, idx, &m_rbuf_img[idx]); } return false; } //------------------------------------------------------------------------ bool platform_support::save_img(unsigned idx, const char* file) { message("Not supported"); return false; } //------------------------------------------------------------------------ bool platform_support::create_img(unsigned idx, unsigned width, unsigned height) { if ( idx < max_images ) { if ( width == 0 ) { width = m_specific->m_width; } if ( height == 0 ) { height = m_specific->m_height; } return m_specific->create_img(idx, &m_rbuf_img[idx], width, height); } return false; } //------------------------------------------------------------------------ void platform_support::force_redraw() { on_draw(); update_window(); } //------------------------------------------------------------------------ void platform_support::update_window() { // Note this function does automatic color conversion. IGraphics->BltBitMapRastPort(m_specific->m_bitmap, 0, 0, m_specific->m_window->RPort, m_specific->m_window->BorderLeft, m_specific->m_window->BorderTop, m_specific->m_width, m_specific->m_height, ABC|ABNC); } //------------------------------------------------------------------------ void platform_support::on_init() {} void platform_support::on_resize(int sx, int sy) {} void platform_support::on_idle() {} void platform_support::on_mouse_move(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_down(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_up(int x, int y, unsigned flags) {} void platform_support::on_key(int x, int y, unsigned key, unsigned flags) {} void platform_support::on_ctrl_change() {} void platform_support::on_draw() {} void platform_support::on_post_draw(void* raw_handler) {} //------------------------------------------------------------------------ void handle_idcmp(Hook* hook, APTR obj, IntuiMessage* msg) { platform_support* app = reinterpret_cast(hook->h_Data); Window* window = app->m_specific->m_window; int16 x = msg->MouseX - window->BorderLeft; int16 y = 0; if ( app->flip_y() ) { y = window->Height - window->BorderBottom - msg->MouseY; } else { y = msg->MouseY - window->BorderTop; } switch ( msg->Class ) { case IDCMP_MOUSEBUTTONS: if ( msg->Code & IECODE_UP_PREFIX ) { if ( msg->Code == SELECTUP ) { app->m_specific->m_input_flags = mouse_left; app->m_specific->m_dragging = false; } else if ( msg->Code == MENUUP ) { app->m_specific->m_input_flags = mouse_right; app->m_specific->m_dragging = false; } else { return; } if ( app->m_ctrls.on_mouse_button_up(x, y) ) { app->on_ctrl_change(); app->force_redraw(); } app->on_mouse_button_up(x, y, app->m_specific->m_input_flags); } else { if ( msg->Code == SELECTDOWN ) { app->m_specific->m_input_flags = mouse_left; app->m_specific->m_dragging = true; } else if ( msg->Code == MENUDOWN ) { app->m_specific->m_input_flags = mouse_right; app->m_specific->m_dragging = true; } else { return; } app->m_ctrls.set_cur(x, y); if ( app->m_ctrls.on_mouse_button_down(x, y) ) { app->on_ctrl_change(); app->force_redraw(); } else { if ( app->m_ctrls.in_rect(x, y) ) { if ( app->m_ctrls.set_cur(x, y) ) { app->on_ctrl_change(); app->force_redraw(); } } else { app->on_mouse_button_down(x, y, app->m_specific->m_input_flags); } } } break; case IDCMP_MOUSEMOVE: if ( app->m_specific->m_dragging ) { if ( app->m_ctrls.on_mouse_move(x, y, app->m_specific->m_input_flags & mouse_left) != 0 ) { app->on_ctrl_change(); app->force_redraw(); } else { if ( !app->m_ctrls.in_rect(x, y) ) { app->on_mouse_move(x, y, app->m_specific->m_input_flags); } } } break; case IDCMP_RAWKEY: { static InputEvent ie = { 0 }; ie.ie_Class = IECLASS_RAWKEY; ie.ie_Code = msg->Code; ie.ie_Qualifier = msg->Qualifier; static const unsigned BUF_SIZE = 16; static char key_buf[BUF_SIZE]; int16 num_chars = IKeymap->MapRawKey(&ie, key_buf, BUF_SIZE, 0); uint32 code = 0x00000000; switch ( num_chars ) { case 1: code = key_buf[0]; break; case 2: code = key_buf[0]<<8 | key_buf[1]; break; case 3: code = key_buf[0]<<16 | key_buf[1]<<8 | key_buf[2]; break; } uint16 key_code = 0; if ( num_chars == 1 ) { if ( code >= IECODE_ASCII_FIRST && code <= IECODE_ASCII_LAST ) { key_code = code; } } if ( key_code == 0 ) { switch ( code ) { case 0x00000008: key_code = key_backspace; break; case 0x00000009: key_code = key_tab; break; case 0x0000000D: key_code = key_return; break; case 0x0000001B: key_code = key_escape; break; case 0x0000007F: key_code = key_delete; break; case 0x00009B41: case 0x00009B54: key_code = key_up; break; case 0x00009B42: case 0x00009B53: key_code = key_down; break; case 0x00009B43: case 0x009B2040: key_code = key_right; break; case 0x00009B44: case 0x009B2041: key_code = key_left; break; case 0x009B307E: key_code = key_f1; break; case 0x009B317E: key_code = key_f2; break; case 0x009B327E: key_code = key_f3; break; case 0x009B337E: key_code = key_f4; break; case 0x009B347E: key_code = key_f5; break; case 0x009B357E: key_code = key_f6; break; case 0x009B367E: key_code = key_f7; break; case 0x009B377E: key_code = key_f8; break; case 0x009B387E: key_code = key_f9; break; case 0x009B397E: key_code = key_f10; break; case 0x009B3F7E: key_code = key_scrollock; break; } } if ( ie.ie_Code & IECODE_UP_PREFIX ) { if ( app->m_specific->m_last_key != 0 ) { bool left = (key_code == key_left) ? true : false; bool right = (key_code == key_right) ? true : false; bool down = (key_code == key_down) ? true : false; bool up = (key_code == key_up) ? true : false; if ( app->m_ctrls.on_arrow_keys(left, right, down, up) ) { app->on_ctrl_change(); app->force_redraw(); } else { app->on_key(x, y, app->m_specific->m_last_key, 0); } app->m_specific->m_last_key = 0; } } else { app->m_specific->m_last_key = key_code; } break; } default: break; } } } //---------------------------------------------------------------------------- int agg_main(int argc, char* argv[]); bool open_libs(); void close_libs(); //---------------------------------------------------------------------------- bool open_libs() { DataTypesBase = IExec->OpenLibrary("datatypes.library", 51); GraphicsBase = IExec->OpenLibrary("graphics.library", 51); IntuitionBase = IExec->OpenLibrary("intuition.library", 51); KeymapBase = IExec->OpenLibrary("keymap.library", 51); P96Base = IExec->OpenLibrary("Picasso96API.library", 2); IDataTypes = reinterpret_cast( IExec->GetInterface(DataTypesBase, "main", 1, 0)); IGraphics = reinterpret_cast( IExec->GetInterface(GraphicsBase, "main", 1, 0)); IIntuition = reinterpret_cast( IExec->GetInterface(IntuitionBase, "main", 1, 0)); IKeymap = reinterpret_cast( IExec->GetInterface(KeymapBase, "main", 1, 0)); IP96 = reinterpret_cast( IExec->GetInterface(P96Base, "main", 1, 0)); if ( IDataTypes == 0 || IGraphics == 0 || IIntuition == 0 || IKeymap == 0 || IP96 == 0 ) { close_libs(); return false; } else { return true; } } //---------------------------------------------------------------------------- void close_libs() { IExec->DropInterface(reinterpret_cast(IP96)); IExec->DropInterface(reinterpret_cast(IKeymap)); IExec->DropInterface(reinterpret_cast(IIntuition)); IExec->DropInterface(reinterpret_cast(IGraphics)); IExec->DropInterface(reinterpret_cast(IDataTypes)); IExec->CloseLibrary(P96Base); IExec->CloseLibrary(KeymapBase); IExec->CloseLibrary(IntuitionBase); IExec->CloseLibrary(GraphicsBase); IExec->CloseLibrary(DataTypesBase); } //---------------------------------------------------------------------------- int main(int argc, char* argv[]) { if ( !open_libs() ) { IDOS->Printf("Can't open libraries.\n"); return -1; } ClassLibrary* requester = IIntuition->OpenClass("requester.class", 51, &RequesterClass); ClassLibrary* window = IIntuition->OpenClass("window.class", 51, &WindowClass); if ( requester == 0 || window == 0 ) { IDOS->Printf("Can't open classes.\n"); IIntuition->CloseClass(requester); IIntuition->CloseClass(window); close_libs(); return -1; } int rc = agg_main(argc, argv); IIntuition->CloseClass(window); IIntuition->CloseClass(requester); close_libs(); return rc; } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/AmigaOS/Makefile.am0000644000175000017500000000004513233644505025301 0ustar varunvarunEXTRA_DIST=agg_platform_support.cpp enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/Makefile.am0000644000175000017500000000005213233644505024017 0ustar varunvarunSUBDIRS = X11 sdl win32 AmigaOS BeOS mac enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/sdl/0000755000175000017500000000000013544357604022556 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/sdl/agg_platform_support.cpp0000644000175000017500000005564613233644505027532 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class platform_support. SDL version. // //---------------------------------------------------------------------------- #include #include "platform/agg_platform_support.h" #include "SDL.h" #include "SDL_byteorder.h" namespace agg24 { //------------------------------------------------------------------------ class platform_specific { public: platform_specific(pix_format_e format, bool flip_y); ~platform_specific(); pix_format_e m_format; pix_format_e m_sys_format; bool m_flip_y; unsigned m_bpp; unsigned m_sys_bpp; unsigned m_rmask; unsigned m_gmask; unsigned m_bmask; unsigned m_amask; bool m_update_flag; bool m_resize_flag; bool m_initialized; SDL_Surface* m_surf_screen; SDL_Surface* m_surf_window; SDL_Surface* m_surf_img[platform_support::max_images]; int m_cur_x; int m_cur_y; int m_sw_start; }; //------------------------------------------------------------------------ platform_specific::platform_specific(pix_format_e format, bool flip_y) : m_format(format), m_sys_format(pix_format_undefined), m_flip_y(flip_y), m_bpp(0), m_sys_bpp(0), m_update_flag(true), m_resize_flag(true), m_initialized(false), m_surf_screen(0), m_surf_window(0), m_cur_x(0), m_cur_y(0) { memset(m_surf_img, 0, sizeof(m_surf_img)); switch(m_format) { case pix_format_gray8: m_bpp = 8; break; case pix_format_rgb565: m_rmask = 0xF800; m_gmask = 0x7E0; m_bmask = 0x1F; m_amask = 0; m_bpp = 16; break; case pix_format_rgb555: m_rmask = 0x7C00; m_gmask = 0x3E0; m_bmask = 0x1F; m_amask = 0; m_bpp = 16; break; #if SDL_BYTEORDER == SDL_LIL_ENDIAN case pix_format_rgb24: m_rmask = 0xFF; m_gmask = 0xFF00; m_bmask = 0xFF0000; m_amask = 0; m_bpp = 24; break; case pix_format_bgr24: m_rmask = 0xFF0000; m_gmask = 0xFF00; m_bmask = 0xFF; m_amask = 0; m_bpp = 24; break; case pix_format_bgra32: m_rmask = 0xFF0000; m_gmask = 0xFF00; m_bmask = 0xFF; m_amask = 0xFF000000; m_bpp = 32; break; case pix_format_abgr32: m_rmask = 0xFF000000; m_gmask = 0xFF0000; m_bmask = 0xFF00; m_amask = 0xFF; m_bpp = 32; break; case pix_format_argb32: m_rmask = 0xFF00; m_gmask = 0xFF0000; m_bmask = 0xFF000000; m_amask = 0xFF; m_bpp = 32; break; case pix_format_rgba32: m_rmask = 0xFF; m_gmask = 0xFF00; m_bmask = 0xFF0000; m_amask = 0xFF000000; m_bpp = 32; break; #else //SDL_BIG_ENDIAN (PPC) case pix_format_rgb24: m_rmask = 0xFF0000; m_gmask = 0xFF00; m_bmask = 0xFF; m_amask = 0; m_bpp = 24; break; case pix_format_bgr24: m_rmask = 0xFF; m_gmask = 0xFF00; m_bmask = 0xFF0000; m_amask = 0; m_bpp = 24; break; case pix_format_bgra32: m_rmask = 0xFF00; m_gmask = 0xFF0000; m_bmask = 0xFF000000; m_amask = 0xFF; m_bpp = 32; break; case pix_format_abgr32: m_rmask = 0xFF; m_gmask = 0xFF00; m_bmask = 0xFF0000; m_amask = 0xFF000000; m_bpp = 32; break; case pix_format_argb32: m_rmask = 0xFF0000; m_gmask = 0xFF00; m_bmask = 0xFF; m_amask = 0xFF000000; m_bpp = 32; break; case pix_format_rgba32: m_rmask = 0xFF000000; m_gmask = 0xFF0000; m_bmask = 0xFF00; m_amask = 0xFF; m_bpp = 32; break; #endif } } //------------------------------------------------------------------------ platform_specific::~platform_specific() { int i; for(i = platform_support::max_images - 1; i >= 0; --i) { if(m_surf_img[i]) SDL_FreeSurface(m_surf_img[i]); } if(m_surf_window) SDL_FreeSurface(m_surf_window); if(m_surf_screen) SDL_FreeSurface(m_surf_screen); } //------------------------------------------------------------------------ platform_support::platform_support(pix_format_e format, bool flip_y) : m_specific(new platform_specific(format, flip_y)), m_format(format), m_bpp(m_specific->m_bpp), m_window_flags(0), m_wait_mode(true), m_flip_y(flip_y) { SDL_Init(SDL_INIT_VIDEO); strcpy(m_caption, "Anti-Grain Geometry Application"); } //------------------------------------------------------------------------ platform_support::~platform_support() { delete m_specific; } //------------------------------------------------------------------------ void platform_support::caption(const char* cap) { strcpy(m_caption, cap); if(m_specific->m_initialized) { SDL_WM_SetCaption(cap, 0); } } //------------------------------------------------------------------------ bool platform_support::init(unsigned width, unsigned height, unsigned flags) { m_window_flags = flags; unsigned wflags = SDL_SWSURFACE; if(m_window_flags & window_hw_buffer) { wflags = SDL_HWSURFACE; } if(m_window_flags & window_resize) { wflags |= SDL_RESIZABLE; } if(m_specific->m_surf_screen) SDL_FreeSurface(m_specific->m_surf_screen); m_specific->m_surf_screen = SDL_SetVideoMode(width, height, m_bpp, wflags); if(m_specific->m_surf_screen == 0) { fprintf(stderr, "Unable to set %dx%d %d bpp video: %s\n", width, height, m_bpp, ::SDL_GetError()); return false; } SDL_WM_SetCaption(m_caption, 0); if(m_specific->m_surf_window) SDL_FreeSurface(m_specific->m_surf_window); m_specific->m_surf_window = SDL_CreateRGBSurface(SDL_HWSURFACE, m_specific->m_surf_screen->w, m_specific->m_surf_screen->h, m_specific->m_surf_screen->format->BitsPerPixel, m_specific->m_rmask, m_specific->m_gmask, m_specific->m_bmask, m_specific->m_amask); if(m_specific->m_surf_window == 0) { fprintf(stderr, "Unable to create image buffer %dx%d %d bpp: %s\n", width, height, m_bpp, SDL_GetError()); return false; } m_rbuf_window.attach((unsigned char*)m_specific->m_surf_window->pixels, m_specific->m_surf_window->w, m_specific->m_surf_window->h, m_flip_y ? -m_specific->m_surf_window->pitch : m_specific->m_surf_window->pitch); if(!m_specific->m_initialized) { m_initial_width = width; m_initial_height = height; on_init(); m_specific->m_initialized = true; } on_resize(m_rbuf_window.width(), m_rbuf_window.height()); m_specific->m_update_flag = true; return true; } //------------------------------------------------------------------------ void platform_support::update_window() { SDL_BlitSurface(m_specific->m_surf_window, 0, m_specific->m_surf_screen, 0); SDL_UpdateRect(m_specific->m_surf_screen, 0, 0, 0, 0); } //------------------------------------------------------------------------ int platform_support::run() { SDL_Event event; bool ev_flag = false; for(;;) { if(m_specific->m_update_flag) { on_draw(); update_window(); m_specific->m_update_flag = false; } ev_flag = false; if(m_wait_mode) { SDL_WaitEvent(&event); ev_flag = true; } else { if(SDL_PollEvent(&event)) { ev_flag = true; } else { on_idle(); } } if(ev_flag) { if(event.type == SDL_QUIT) { break; } int y; unsigned flags = 0; switch (event.type) { case SDL_VIDEORESIZE: if(!init(event.resize.w, event.resize.h, m_window_flags)) return false; on_resize(m_rbuf_window.width(), m_rbuf_window.height()); trans_affine_resizing(event.resize.w, event.resize.h); m_specific->m_update_flag = true; break; case SDL_KEYDOWN: { flags = 0; if(event.key.keysym.mod & KMOD_SHIFT) flags |= kbd_shift; if(event.key.keysym.mod & KMOD_CTRL) flags |= kbd_ctrl; bool left = false; bool up = false; bool right = false; bool down = false; switch(event.key.keysym.sym) { case key_left: left = true; break; case key_up: up = true; break; case key_right: right = true; break; case key_down: down = true; break; } if(m_ctrls.on_arrow_keys(left, right, down, up)) { on_ctrl_change(); force_redraw(); } else { on_key(m_specific->m_cur_x, m_specific->m_cur_y, event.key.keysym.sym, flags); } } break; case SDL_MOUSEMOTION: y = m_flip_y ? m_rbuf_window.height() - event.motion.y : event.motion.y; m_specific->m_cur_x = event.motion.x; m_specific->m_cur_y = y; flags = 0; if(event.motion.state & SDL_BUTTON_LMASK) flags |= mouse_left; if(event.motion.state & SDL_BUTTON_RMASK) flags |= mouse_right; if(m_ctrls.on_mouse_move(m_specific->m_cur_x, m_specific->m_cur_y, (flags & mouse_left) != 0)) { on_ctrl_change(); force_redraw(); } else { on_mouse_move(m_specific->m_cur_x, m_specific->m_cur_y, flags); } SDL_Event eventtrash; while (SDL_PeepEvents(&eventtrash, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION))!=0){;} break; case SDL_MOUSEBUTTONDOWN: y = m_flip_y ? m_rbuf_window.height() - event.button.y : event.button.y; m_specific->m_cur_x = event.button.x; m_specific->m_cur_y = y; flags = 0; switch(event.button.button) { case SDL_BUTTON_LEFT: { flags = mouse_left; if(m_ctrls.on_mouse_button_down(m_specific->m_cur_x, m_specific->m_cur_y)) { m_ctrls.set_cur(m_specific->m_cur_x, m_specific->m_cur_y); on_ctrl_change(); force_redraw(); } else { if(m_ctrls.in_rect(m_specific->m_cur_x, m_specific->m_cur_y)) { if(m_ctrls.set_cur(m_specific->m_cur_x, m_specific->m_cur_y)) { on_ctrl_change(); force_redraw(); } } else { on_mouse_button_down(m_specific->m_cur_x, m_specific->m_cur_y, flags); } } } break; case SDL_BUTTON_RIGHT: flags = mouse_right; on_mouse_button_down(m_specific->m_cur_x, m_specific->m_cur_y, flags); break; } //switch(event.button.button) break; case SDL_MOUSEBUTTONUP: y = m_flip_y ? m_rbuf_window.height() - event.button.y : event.button.y; m_specific->m_cur_x = event.button.x; m_specific->m_cur_y = y; flags = 0; if(m_ctrls.on_mouse_button_up(m_specific->m_cur_x, m_specific->m_cur_y)) { on_ctrl_change(); force_redraw(); } on_mouse_button_up(m_specific->m_cur_x, m_specific->m_cur_y, flags); break; } } } return 0; } //------------------------------------------------------------------------ const char* platform_support::img_ext() const { return ".bmp"; } //------------------------------------------------------------------------ const char* platform_support::full_file_name(const char* file_name) { return file_name; } //------------------------------------------------------------------------ bool platform_support::load_img(unsigned idx, const char* file) { if(idx < max_images) { if(m_specific->m_surf_img[idx]) SDL_FreeSurface(m_specific->m_surf_img[idx]); char fn[1024]; strcpy(fn, file); int len = strlen(fn); if(len < 4 || strcmp(fn + len - 4, ".bmp") != 0) { strcat(fn, ".bmp"); } SDL_Surface* tmp_surf = SDL_LoadBMP(fn); if (tmp_surf == 0) { fprintf(stderr, "Couldn't load %s: %s\n", fn, SDL_GetError()); return false; } SDL_PixelFormat format; format.palette = 0; format.BitsPerPixel = m_bpp; format.BytesPerPixel = m_bpp >> 8; format.Rmask = m_specific->m_rmask; format.Gmask = m_specific->m_gmask; format.Bmask = m_specific->m_bmask; format.Amask = m_specific->m_amask; format.Rshift = 0; format.Gshift = 0; format.Bshift = 0; format.Ashift = 0; format.Rloss = 0; format.Gloss = 0; format.Bloss = 0; format.Aloss = 0; format.colorkey = 0; format.alpha = 0; m_specific->m_surf_img[idx] = SDL_ConvertSurface(tmp_surf, &format, SDL_SWSURFACE); SDL_FreeSurface(tmp_surf); if(m_specific->m_surf_img[idx] == 0) return false; m_rbuf_img[idx].attach((unsigned char*)m_specific->m_surf_img[idx]->pixels, m_specific->m_surf_img[idx]->w, m_specific->m_surf_img[idx]->h, m_flip_y ? -m_specific->m_surf_img[idx]->pitch : m_specific->m_surf_img[idx]->pitch); return true; } return false; } //------------------------------------------------------------------------ bool platform_support::save_img(unsigned idx, const char* file) { if(idx < max_images && m_specific->m_surf_img[idx]) { char fn[1024]; strcpy(fn, file); int len = strlen(fn); if(len < 4 || strcmp(fn + len - 4, ".bmp") != 0) { strcat(fn, ".bmp"); } return SDL_SaveBMP(m_specific->m_surf_img[idx], fn) == 0; } return false; } //------------------------------------------------------------------------ bool platform_support::create_img(unsigned idx, unsigned width, unsigned height) { if(idx < max_images) { if(m_specific->m_surf_img[idx]) SDL_FreeSurface(m_specific->m_surf_img[idx]); m_specific->m_surf_img[idx] = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, m_specific->m_surf_screen->format->BitsPerPixel, m_specific->m_rmask, m_specific->m_gmask, m_specific->m_bmask, m_specific->m_amask); if(m_specific->m_surf_img[idx] == 0) { fprintf(stderr, "Couldn't create image: %s\n", SDL_GetError()); return false; } m_rbuf_img[idx].attach((unsigned char*)m_specific->m_surf_img[idx]->pixels, m_specific->m_surf_img[idx]->w, m_specific->m_surf_img[idx]->h, m_flip_y ? -m_specific->m_surf_img[idx]->pitch : m_specific->m_surf_img[idx]->pitch); return true; } return false; } //------------------------------------------------------------------------ void platform_support::start_timer() { m_specific->m_sw_start = SDL_GetTicks(); } //------------------------------------------------------------------------ double platform_support::elapsed_time() const { int stop = SDL_GetTicks(); return double(stop - m_specific->m_sw_start); } //------------------------------------------------------------------------ void platform_support::message(const char* msg) { fprintf(stderr, "%s\n", msg); } //------------------------------------------------------------------------ void platform_support::force_redraw() { m_specific->m_update_flag = true; } //------------------------------------------------------------------------ void platform_support::on_init() {} void platform_support::on_resize(int sx, int sy) {} void platform_support::on_idle() {} void platform_support::on_mouse_move(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_down(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_up(int x, int y, unsigned flags) {} void platform_support::on_key(int x, int y, unsigned key, unsigned flags) {} void platform_support::on_ctrl_change() {} void platform_support::on_draw() {} void platform_support::on_post_draw(void* raw_handler) {} } int agg_main(int argc, char* argv[]); int main(int argc, char* argv[]) { return agg_main(argc, argv); } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/sdl/Makefile.am0000644000175000017500000000045513233644505024610 0ustar varunvarunif ENABLE_SDL lib_LTLIBRARIES = libaggplatformsdl.la libaggplatformsdl_la_LDFLAGS = -version-info @AGG_LIB_VERSION@ libaggplatformsdl_la_SOURCES = agg_platform_support.cpp libaggplatformsdl_la_CXXFLAGS = -I$(top_srcdir)/include @SDL_CFLAGS@ libaggplatformsdl_la_LIBADD = @SDL_LIBS@ endif enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/BeOS/0000755000175000017500000000000013544357604022564 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/BeOS/agg_platform_support.cpp0000644000175000017500000010260713233644505027526 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: superstippi@gmx.de //---------------------------------------------------------------------------- // // class platform_support // //---------------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include #include #include #include #include #include "platform/agg_platform_support.h" #include "util/agg_color_conv_rgb8.h" class AGGView : public BView { public: AGGView(BRect frame, agg24::platform_support* agg, agg24::pix_format_e format, bool flipY) : BView(frame, "AGG View", B_FOLLOW_ALL, B_FRAME_EVENTS | B_WILL_DRAW), fAGG(agg), fFormat(format), fMouseButtons(0), fFlipY(flipY), fRedraw(true), fPulse(NULL), fLastPulse(0), fEnableTicks(true) { SetViewColor(B_TRANSPARENT_32_BIT); frame.OffsetTo(0.0, 0.0); fBitmap = new BBitmap(frame, 0, B_RGBA32); if (fBitmap->IsValid()) { fAGG->rbuf_window().attach((uint8*)fBitmap->Bits(), fBitmap->Bounds().IntegerWidth() + 1, fBitmap->Bounds().IntegerHeight() + 1, fFlipY ? -fBitmap->BytesPerRow() : fBitmap->BytesPerRow()); } else { delete fBitmap; fBitmap = NULL; } } virtual ~AGGView() { delete fBitmap; delete fPulse; } virtual void AttachedToWindow() { BMessage message('tick'); BMessenger target(this, Looper()); delete fPulse; // BScreen screen; // TODO: calc screen retrace fPulse = new BMessageRunner(target, &message, 40000); // make sure we call this once fAGG->on_resize(Bounds().IntegerWidth() + 1, Bounds().IntegerHeight() + 1); MakeFocus(); } virtual void DetachedFromWindow() { delete fPulse; fPulse = NULL; } virtual void MessageReceived(BMessage* message) { bigtime_t now = system_time(); switch (message->what) { case 'tick': // drop messages that have piled up if (/*now - fLastPulse > 30000*/fEnableTicks) { fLastPulse = now; if (!fAGG->wait_mode()) fAGG->on_idle(); Window()->PostMessage('entk', this); fEnableTicks = false; } else { // fprintf(stderr, "dropping tick message (%lld)\n", now - fLastPulse); } break; case 'entk': fEnableTicks = true; if (now - fLastPulse > 30000) { fLastPulse = now; if (!fAGG->wait_mode()) fAGG->on_idle(); } break; default: BView::MessageReceived(message); break; } } virtual void Draw(BRect updateRect) { if (fBitmap) { if (fRedraw) { fAGG->on_draw(); fRedraw = false; } if (fFormat == agg24::pix_format_bgra32) { DrawBitmap(fBitmap, updateRect, updateRect); } else { BBitmap* bitmap = new BBitmap(fBitmap->Bounds(), 0, B_RGBA32); agg24::rendering_buffer rbuf_src; rbuf_src.attach((uint8*)fBitmap->Bits(), fBitmap->Bounds().IntegerWidth() + 1, fBitmap->Bounds().IntegerHeight() + 1, fFlipY ? -fBitmap->BytesPerRow() : fBitmap->BytesPerRow()); agg24::rendering_buffer rbuf_dst; rbuf_dst.attach((uint8*)bitmap->Bits(), bitmap->Bounds().IntegerWidth() + 1, bitmap->Bounds().IntegerHeight() + 1, fFlipY ? -bitmap->BytesPerRow() : bitmap->BytesPerRow()); switch(fFormat) { case agg24::pix_format_rgb555: agg24::color_conv(&rbuf_dst, &rbuf_src, agg24::color_conv_rgb555_to_bgra32()); break; case agg24::pix_format_rgb565: agg24::color_conv(&rbuf_dst, &rbuf_src, agg24::color_conv_rgb565_to_bgra32()); break; case agg24::pix_format_rgb24: agg24::color_conv(&rbuf_dst, &rbuf_src, agg24::color_conv_rgb24_to_bgra32()); break; case agg24::pix_format_bgr24: agg24::color_conv(&rbuf_dst, &rbuf_src, agg24::color_conv_bgr24_to_bgra32()); break; case agg24::pix_format_rgba32: agg24::color_conv(&rbuf_dst, &rbuf_src, agg24::color_conv_rgba32_to_bgra32()); break; case agg24::pix_format_argb32: agg24::color_conv(&rbuf_dst, &rbuf_src, agg24::color_conv_argb32_to_bgra32()); break; case agg24::pix_format_abgr32: agg24::color_conv(&rbuf_dst, &rbuf_src, agg24::color_conv_abgr32_to_bgra32()); break; case agg24::pix_format_bgra32: agg24::color_conv(&rbuf_dst, &rbuf_src, agg24::color_conv_bgra32_to_bgra32()); break; } DrawBitmap(bitmap, updateRect, updateRect); delete bitmap; } } else { FillRect(updateRect); } } virtual void FrameResized(float width, float height) { BRect r(0.0, 0.0, width, height); BBitmap* bitmap = new BBitmap(r, 0, B_RGBA32); if (bitmap->IsValid()) { delete fBitmap; fBitmap = bitmap; fAGG->rbuf_window().attach((uint8*)fBitmap->Bits(), fBitmap->Bounds().IntegerWidth() + 1, fBitmap->Bounds().IntegerHeight() + 1, fFlipY ? -fBitmap->BytesPerRow() : fBitmap->BytesPerRow()); fAGG->trans_affine_resizing((int)width + 1, (int)height + 1); // pass the event on to AGG fAGG->on_resize((int)width + 1, (int)height + 1); fRedraw = true; Invalidate(); } else delete bitmap; } virtual void KeyDown(const char* bytes, int32 numBytes) { if (bytes && numBytes > 0) { fLastKeyDown = bytes[0]; bool left = false; bool up = false; bool right = false; bool down = false; switch (fLastKeyDown) { case B_LEFT_ARROW: left = true; break; case B_UP_ARROW: up = true; break; case B_RIGHT_ARROW: right = true; break; case B_DOWN_ARROW: down = true; break; } /* case key_f2: fAGG->copy_window_to_img(agg24::platform_support::max_images - 1); fAGG->save_img(agg24::platform_support::max_images - 1, "screenshot"); break; }*/ if (fAGG->m_ctrls.on_arrow_keys(left, right, down, up)) { fAGG->on_ctrl_change(); fAGG->force_redraw(); } else { fAGG->on_key(fMouseX, fMouseY, fLastKeyDown, GetKeyFlags()); } // fAGG->on_key(fMouseX, fMouseY, fLastKeyDown, GetKeyFlags()); } } virtual void MouseDown(BPoint where) { BMessage* currentMessage = Window()->CurrentMessage(); if (currentMessage) { if (currentMessage->FindInt32("buttons", (int32*)&fMouseButtons) < B_OK) fMouseButtons = B_PRIMARY_MOUSE_BUTTON; } else fMouseButtons = B_PRIMARY_MOUSE_BUTTON; fMouseX = (int)where.x; fMouseY = fFlipY ? (int)(Bounds().Height() - where.y) : (int)where.y; // pass the event on to AGG if (fMouseButtons == B_PRIMARY_MOUSE_BUTTON) { // left mouse button -> see if to handle in controls fAGG->m_ctrls.set_cur(fMouseX, fMouseY); if (fAGG->m_ctrls.on_mouse_button_down(fMouseX, fMouseY)) { fAGG->on_ctrl_change(); fAGG->force_redraw(); } else { if (fAGG->m_ctrls.in_rect(fMouseX, fMouseY)) { if (fAGG->m_ctrls.set_cur(fMouseX, fMouseY)) { fAGG->on_ctrl_change(); fAGG->force_redraw(); } } else { fAGG->on_mouse_button_down(fMouseX, fMouseY, GetKeyFlags()); } } } else if (fMouseButtons & B_SECONDARY_MOUSE_BUTTON) { // right mouse button -> simple fAGG->on_mouse_button_down(fMouseX, fMouseY, GetKeyFlags()); } SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); } virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMesage) { // workarround missed mouse up events // (if we react too slowly, app_server might have dropped events) BMessage* currentMessage = Window()->CurrentMessage(); int32 buttons = 0; if (currentMessage->FindInt32("buttons", &buttons) < B_OK) { buttons = 0; } if (!buttons) MouseUp(where); fMouseX = (int)where.x; fMouseY = fFlipY ? (int)(Bounds().Height() - where.y) : (int)where.y; // pass the event on to AGG if (fAGG->m_ctrls.on_mouse_move(fMouseX, fMouseY, (GetKeyFlags() & agg24::mouse_left) != 0)) { fAGG->on_ctrl_change(); fAGG->force_redraw(); } else { if (!fAGG->m_ctrls.in_rect(fMouseX, fMouseY)) { fAGG->on_mouse_move(fMouseX, fMouseY, GetKeyFlags()); } } } virtual void MouseUp(BPoint where) { fMouseX = (int)where.x; fMouseY = fFlipY ? (int)(Bounds().Height() - where.y) : (int)where.y; // pass the event on to AGG if (fMouseButtons == B_PRIMARY_MOUSE_BUTTON) { fMouseButtons = 0; if (fAGG->m_ctrls.on_mouse_button_up(fMouseX, fMouseY)) { fAGG->on_ctrl_change(); fAGG->force_redraw(); } fAGG->on_mouse_button_up(fMouseX, fMouseY, GetKeyFlags()); } else if (fMouseButtons == B_SECONDARY_MOUSE_BUTTON) { fMouseButtons = 0; fAGG->on_mouse_button_up(fMouseX, fMouseY, GetKeyFlags()); } } BBitmap* Bitmap() const { return fBitmap; } uint8 LastKeyDown() const { return fLastKeyDown; } uint32 MouseButtons() { uint32 buttons = 0; if (LockLooper()) { buttons = fMouseButtons; UnlockLooper(); } return buttons; } void Update() { // trigger display update if (LockLooper()) { Invalidate(); UnlockLooper(); } } void ForceRedraw() { // force a redraw (fRedraw = true;) // and trigger display update if (LockLooper()) { fRedraw = true; Invalidate(); UnlockLooper(); } } unsigned GetKeyFlags() { uint32 buttons = fMouseButtons; uint32 mods = modifiers(); unsigned flags = 0; if (buttons & B_PRIMARY_MOUSE_BUTTON) flags |= agg24::mouse_left; if (buttons & B_SECONDARY_MOUSE_BUTTON) flags |= agg24::mouse_right; if (mods & B_SHIFT_KEY) flags |= agg24::kbd_shift; if (mods & B_COMMAND_KEY) flags |= agg24::kbd_ctrl; return flags; } private: BBitmap* fBitmap; uint8 fLastKeyDown; agg24::platform_support* fAGG; agg24::pix_format_e fFormat; uint32 fMouseButtons; int32 fMouseX; int32 fMouseY; bool fFlipY; bool fRedraw; BMessageRunner* fPulse; bigtime_t fLastPulse; bool fEnableTicks; }; class AGGWindow : public BWindow { public: AGGWindow() : BWindow(BRect(-50.0, -50.0, -10.0, -10.0), "AGG Application", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS) { } virtual bool QuitRequested() { be_app->PostMessage(B_QUIT_REQUESTED); return true; } bool Init(BRect frame, agg24::platform_support* agg, agg24::pix_format_e format, bool flipY, uint32 flags) { MoveTo(frame.LeftTop()); ResizeTo(frame.Width(), frame.Height()); SetFlags(flags); frame.OffsetTo(0.0, 0.0); fView = new AGGView(frame, agg, format, flipY); AddChild(fView); return fView->Bitmap() != NULL; } AGGView* View() const { return fView; } private: AGGView* fView; }; class AGGApplication : public BApplication { public: AGGApplication() : BApplication("application/x-vnd.AGG-AGG") { fWindow = new AGGWindow(); } virtual void ReadyToRun() { if (fWindow) { fWindow->Show(); } } virtual bool Init(agg24::platform_support* agg, int width, int height, agg24::pix_format_e format, bool flipY, uint32 flags) { // ignore flip_y for now BRect r(50.0, 50.0, 50.0 + width - 1.0, 50.0 + height - 1.0); uint32 windowFlags = B_ASYNCHRONOUS_CONTROLS; if (!(flags & agg24::window_resize)) windowFlags |= B_NOT_RESIZABLE; return fWindow->Init(r, agg, format, flipY, windowFlags);; } AGGWindow* Window() const { return fWindow; } private: AGGWindow* fWindow; }; namespace agg24 { class platform_specific { public: platform_specific(agg24::platform_support* agg, agg24::pix_format_e format, bool flip_y) : fAGG(agg), fApp(NULL), fFormat(format), fFlipY(flip_y), fTimerStart(system_time()) { memset(fImages, 0, sizeof(fImages)); fApp = new AGGApplication(); fAppPath[0] = 0; // figure out where we're running from app_info info; status_t ret = fApp->GetAppInfo(&info); if (ret >= B_OK) { BPath path(&info.ref); ret = path.InitCheck(); if (ret >= B_OK) { ret = path.GetParent(&path); if (ret >= B_OK) { sprintf(fAppPath, "%s", path.Path()); } else { fprintf(stderr, "getting app parent folder failed: %s\n", strerror(ret)); } } else { fprintf(stderr, "making app path failed: %s\n", strerror(ret)); } } else { fprintf(stderr, "GetAppInfo() failed: %s\n", strerror(ret)); } } ~platform_specific() { for (int32 i = 0; i < agg24::platform_support::max_images; i++) delete fImages[i]; delete fApp; } bool Init(int width, int height, unsigned flags) { return fApp->Init(fAGG, width, height, fFormat, fFlipY, flags); } int Run() { status_t ret = B_NO_INIT; if (fApp) { fApp->Run(); ret = B_OK; } return ret; } void SetTitle(const char* title) { if (fApp && fApp->Window() && fApp->Window()->Lock()) { fApp->Window()->SetTitle(title); fApp->Window()->Unlock(); } } void StartTimer() { fTimerStart = system_time(); } double ElapsedTime() const { return (system_time() - fTimerStart) / 1000.0; } void ForceRedraw() { fApp->Window()->View()->ForceRedraw(); } void UpdateWindow() { fApp->Window()->View()->Update(); } agg24::platform_support* fAGG; AGGApplication* fApp; agg24::pix_format_e fFormat; bool fFlipY; bigtime_t fTimerStart; BBitmap* fImages[agg24::platform_support::max_images]; char fAppPath[B_PATH_NAME_LENGTH]; char fFilePath[B_PATH_NAME_LENGTH]; }; //------------------------------------------------------------------------ platform_support::platform_support(pix_format_e format, bool flip_y) : m_specific(new platform_specific(this, format, flip_y)), m_format(format), m_bpp(32/*m_specific->m_bpp*/), m_window_flags(0), m_wait_mode(true), m_flip_y(flip_y), m_initial_width(10), m_initial_height(10) { strcpy(m_caption, "Anti-Grain Geometry Application"); } //------------------------------------------------------------------------ platform_support::~platform_support() { delete m_specific; } //------------------------------------------------------------------------ void platform_support::caption(const char* cap) { strcpy(m_caption, cap); m_specific->SetTitle(cap); } //------------------------------------------------------------------------ void platform_support::start_timer() { m_specific->StartTimer(); } //------------------------------------------------------------------------ double platform_support::elapsed_time() const { return m_specific->ElapsedTime(); } //------------------------------------------------------------------------ void* platform_support::raw_display_handler() { return NULL;//m_specific->m_current_dc; } //------------------------------------------------------------------------ void platform_support::message(const char* msg) { BAlert* alert = new BAlert("AGG Message", msg, "Ok"); alert->Go(/*NULL*/); } //------------------------------------------------------------------------ bool platform_support::init(unsigned width, unsigned height, unsigned flags) { bool success = m_specific->Init(width, height, flags); m_window_flags = flags; // m_specific->create_pmap(width, height, &m_rbuf_window); m_initial_width = width; m_initial_height = height; on_init(); // m_specific->m_redraw_flag = true; return true; } //------------------------------------------------------------------------ int platform_support::run() { return m_specific->Run(); } //------------------------------------------------------------------------ const char* platform_support::img_ext() const { return ".ppm"; } const char* platform_support::full_file_name(const char* file_name) { sprintf(m_specific->fFilePath, "%s/%s", m_specific->fAppPath, file_name); return m_specific->fFilePath; } //------------------------------------------------------------------------ bool platform_support::load_img(unsigned idx, const char* file) { if (idx < max_images) { char path[B_PATH_NAME_LENGTH]; sprintf(path, "%s/%s%s", m_specific->fAppPath, file, img_ext()); BBitmap* transBitmap = BTranslationUtils::GetBitmap(path); if (transBitmap && transBitmap->IsValid()) { if(transBitmap->ColorSpace() != B_RGB32 && transBitmap->ColorSpace() != B_RGBA32) { // ups we got a smart ass Translator making our live harder delete transBitmap; return false; } color_space format = B_RGB24; switch (m_format) { case pix_format_gray8: format = B_GRAY8; break; case pix_format_rgb555: format = B_RGB15; break; case pix_format_rgb565: format = B_RGB16; break; case pix_format_rgb24: format = B_RGB24_BIG; break; case pix_format_bgr24: format = B_RGB24; break; case pix_format_abgr32: case pix_format_argb32: case pix_format_bgra32: format = B_RGB32; break; case pix_format_rgba32: format = B_RGB32_BIG; break; } BBitmap* bitmap = new BBitmap(transBitmap->Bounds(), 0, format); if (!bitmap || !bitmap->IsValid()) { fprintf(stderr, "failed to allocate temporary bitmap!\n"); delete transBitmap; delete bitmap; return false; } delete m_specific->fImages[idx]; rendering_buffer rbuf_tmp; rbuf_tmp.attach((uint8*)transBitmap->Bits(), transBitmap->Bounds().IntegerWidth() + 1, transBitmap->Bounds().IntegerHeight() + 1, m_flip_y ? -transBitmap->BytesPerRow() : transBitmap->BytesPerRow()); m_specific->fImages[idx] = bitmap; m_rbuf_img[idx].attach((uint8*)bitmap->Bits(), bitmap->Bounds().IntegerWidth() + 1, bitmap->Bounds().IntegerHeight() + 1, m_flip_y ? -bitmap->BytesPerRow() : bitmap->BytesPerRow()); rendering_buffer* dst = &m_rbuf_img[idx]; switch(m_format) { case pix_format_gray8: return false; // color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_gray8()); break; break; case pix_format_rgb555: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgb555()); break; break; case pix_format_rgb565: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgb565()); break; break; case pix_format_rgb24: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgb24()); break; break; case pix_format_bgr24: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_bgr24()); break; break; case pix_format_abgr32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_abgr32()); break; break; case pix_format_argb32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_argb32()); break; break; case pix_format_bgra32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_bgra32()); break; break; case pix_format_rgba32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgba32()); break; break; } delete transBitmap; return true; } else { fprintf(stderr, "failed to load bitmap: '%s'\n", full_file_name(file)); } } return false; } //------------------------------------------------------------------------ bool platform_support::save_img(unsigned idx, const char* file) { // TODO: implement using BTranslatorRoster and friends return false; } //------------------------------------------------------------------------ bool platform_support::create_img(unsigned idx, unsigned width, unsigned height) { if(idx < max_images) { if(width == 0) width = m_specific->fApp->Window()->View()->Bitmap()->Bounds().IntegerWidth() + 1; if(height == 0) height = m_specific->fApp->Window()->View()->Bitmap()->Bounds().IntegerHeight() + 1; BBitmap* bitmap = new BBitmap(BRect(0.0, 0.0, width - 1, height - 1), 0, B_RGBA32);; if (bitmap && bitmap->IsValid()) { delete m_specific->fImages[idx]; m_specific->fImages[idx] = bitmap; m_rbuf_img[idx].attach((uint8*)bitmap->Bits(), width, height, m_flip_y ? -bitmap->BytesPerRow() : bitmap->BytesPerRow()); return true; } else { delete bitmap; } } return false; } //------------------------------------------------------------------------ void platform_support::force_redraw() { m_specific->ForceRedraw(); } //------------------------------------------------------------------------ void platform_support::update_window() { m_specific->UpdateWindow(); } //------------------------------------------------------------------------ void platform_support::on_init() {} void platform_support::on_resize(int sx, int sy) {} void platform_support::on_idle() {} void platform_support::on_mouse_move(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_down(int x, int y, unsigned flags) {} void platform_support::on_mouse_button_up(int x, int y, unsigned flags) {} void platform_support::on_key(int x, int y, unsigned key, unsigned flags) {} void platform_support::on_ctrl_change() {} void platform_support::on_draw() {} void platform_support::on_post_draw(void* raw_handler) {} } //---------------------------------------------------------------------------- int agg_main(int argc, char* argv[]); int main(int argc, char* argv[]) { return agg_main(argc, argv); } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/platform/BeOS/Makefile.am0000644000175000017500000000004513233644505024611 0ustar varunvarunEXTRA_DIST=agg_platform_support.cpp enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_vcgen_dash.cpp0000644000175000017500000001621613233644505023573 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Line dash generator // //---------------------------------------------------------------------------- #include #include "agg_vcgen_dash.h" #include "agg_shorten_path.h" namespace agg24 { //------------------------------------------------------------------------ vcgen_dash::vcgen_dash() : m_total_dash_len(0.0), m_num_dashes(0), m_dash_start(0.0), m_shorten(0.0), m_curr_dash_start(0.0), m_curr_dash(0), m_src_vertices(), m_closed(0), m_status(initial), m_src_vertex(0) { } //------------------------------------------------------------------------ void vcgen_dash::remove_all_dashes() { m_total_dash_len = 0.0; m_num_dashes = 0; m_curr_dash_start = 0.0; m_curr_dash = 0; } //------------------------------------------------------------------------ void vcgen_dash::add_dash(double dash_len, double gap_len) { if(m_num_dashes < max_dashes) { m_total_dash_len += dash_len + gap_len; m_dashes[m_num_dashes++] = dash_len; m_dashes[m_num_dashes++] = gap_len; } } //------------------------------------------------------------------------ void vcgen_dash::dash_start(double ds) { m_dash_start = ds; calc_dash_start(fabs(ds)); } //------------------------------------------------------------------------ void vcgen_dash::calc_dash_start(double ds) { m_curr_dash = 0; m_curr_dash_start = 0.0; while(ds > 0.0) { if(ds > m_dashes[m_curr_dash]) { ds -= m_dashes[m_curr_dash]; ++m_curr_dash; m_curr_dash_start = 0.0; if(m_curr_dash >= m_num_dashes) m_curr_dash = 0; } else { m_curr_dash_start = ds; ds = 0.0; } } } //------------------------------------------------------------------------ void vcgen_dash::remove_all() { m_status = initial; m_src_vertices.remove_all(); m_closed = 0; } //------------------------------------------------------------------------ void vcgen_dash::add_vertex(double x, double y, unsigned cmd) { m_status = initial; if(is_move_to(cmd)) { m_src_vertices.modify_last(vertex_dist(x, y)); } else { if(is_vertex(cmd)) { m_src_vertices.add(vertex_dist(x, y)); } else { m_closed = get_close_flag(cmd); } } } //------------------------------------------------------------------------ void vcgen_dash::rewind(unsigned) { if(m_status == initial) { m_src_vertices.close(m_closed != 0); shorten_path(m_src_vertices, m_shorten, m_closed); } m_status = ready; m_src_vertex = 0; } //------------------------------------------------------------------------ unsigned vcgen_dash::vertex(double* x, double* y) { unsigned cmd = path_cmd_move_to; while(!is_stop(cmd)) { switch(m_status) { case initial: rewind(0); case ready: if(m_num_dashes < 2 || m_src_vertices.size() < 2) { cmd = path_cmd_stop; break; } m_status = polyline; m_src_vertex = 1; m_v1 = &m_src_vertices[0]; m_v2 = &m_src_vertices[1]; m_curr_rest = m_v1->dist; *x = m_v1->x; *y = m_v1->y; if(m_dash_start >= 0.0) calc_dash_start(m_dash_start); return path_cmd_move_to; case polyline: { double dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start; unsigned cmd = (m_curr_dash & 1) ? path_cmd_move_to : path_cmd_line_to; if(m_curr_rest > dash_rest) { m_curr_rest -= dash_rest; ++m_curr_dash; if(m_curr_dash >= m_num_dashes) m_curr_dash = 0; m_curr_dash_start = 0.0; *x = m_v2->x - (m_v2->x - m_v1->x) * m_curr_rest / m_v1->dist; *y = m_v2->y - (m_v2->y - m_v1->y) * m_curr_rest / m_v1->dist; } else { m_curr_dash_start += m_curr_rest; *x = m_v2->x; *y = m_v2->y; ++m_src_vertex; m_v1 = m_v2; m_curr_rest = m_v1->dist; if(m_closed) { if(m_src_vertex > m_src_vertices.size()) { m_status = stop; } else { m_v2 = &m_src_vertices [ (m_src_vertex >= m_src_vertices.size()) ? 0 : m_src_vertex ]; } } else { if(m_src_vertex >= m_src_vertices.size()) { m_status = stop; } else { m_v2 = &m_src_vertices[m_src_vertex]; } } } return cmd; } break; case stop: cmd = path_cmd_stop; break; } } return path_cmd_stop; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_line_aa_basics.cpp0000644000175000017500000000610213233644505024377 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include #include "agg_line_aa_basics.h" namespace agg24 { //------------------------------------------------------------------------- // The number of the octant is determined as a 3-bit value as follows: // bit 0 = vertical flag // bit 1 = sx < 0 // bit 2 = sy < 0 // // [N] shows the number of the orthogonal quadrant // shows the number of the diagonal quadrant // <1> // [1] | [0] // . (3)011 | 001(1) . // . | . // . | . // . | . // (2)010 .|. 000(0) // <2> ----------.+.----------- <0> // (6)110 . | . 100(4) // . | . // . | . // . | . // (7)111 | 101(5) // [2] | [3] // <3> // 0,1,2,3,4,5,6,7 const int8u line_parameters::s_orthogonal_quadrant[8] = { 0,0,1,1,3,3,2,2 }; const int8u line_parameters::s_diagonal_quadrant[8] = { 0,1,2,1,0,3,2,3 }; //------------------------------------------------------------------------- void bisectrix(const line_parameters& l1, const line_parameters& l2, int* x, int* y) { double k = double(l2.len) / double(l1.len); double tx = l2.x2 - (l2.x1 - l1.x1) * k; double ty = l2.y2 - (l2.y1 - l1.y1) * k; //All bisectrices must be on the right of the line //If the next point is on the left (l1 => l2.2) //then the bisectix should be rotated by 180 degrees. if(double(l2.x2 - l2.x1) * double(l2.y1 - l1.y1) < double(l2.y2 - l2.y1) * double(l2.x1 - l1.x1) + 100.0) { tx -= (tx - l2.x1) * 2.0; ty -= (ty - l2.y1) * 2.0; } // Check if the bisectrix is too short double dx = tx - l2.x1; double dy = ty - l2.y1; if((int)sqrt(dx * dx + dy * dy) < line_subpixel_scale) { *x = (l2.x1 + l2.x1 + (l2.y1 - l1.y1) + (l2.y2 - l2.y1)) >> 1; *y = (l2.y1 + l2.y1 - (l2.x1 - l1.x1) - (l2.x2 - l2.x1)) >> 1; return; } *x = iround(tx); *y = iround(ty); } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_trans_single_path.cpp0000644000175000017500000001516413233644505025177 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include "agg_math.h" #include "agg_vertex_sequence.h" #include "agg_trans_single_path.h" namespace agg24 { //------------------------------------------------------------------------ trans_single_path::trans_single_path() : m_base_length(0.0), m_kindex(0.0), m_status(initial), m_preserve_x_scale(true) { } //------------------------------------------------------------------------ void trans_single_path::reset() { m_src_vertices.remove_all(); m_kindex = 0.0; m_status = initial; } //------------------------------------------------------------------------ void trans_single_path::move_to(double x, double y) { if(m_status == initial) { m_src_vertices.modify_last(vertex_dist(x, y)); m_status = making_path; } else { line_to(x, y); } } //------------------------------------------------------------------------ void trans_single_path::line_to(double x, double y) { if(m_status == making_path) { m_src_vertices.add(vertex_dist(x, y)); } } //------------------------------------------------------------------------ void trans_single_path::finalize_path() { if(m_status == making_path && m_src_vertices.size() > 1) { unsigned i; double dist; double d; m_src_vertices.close(false); if(m_src_vertices.size() > 2) { if(m_src_vertices[m_src_vertices.size() - 2].dist * 10.0 < m_src_vertices[m_src_vertices.size() - 3].dist) { d = m_src_vertices[m_src_vertices.size() - 3].dist + m_src_vertices[m_src_vertices.size() - 2].dist; m_src_vertices[m_src_vertices.size() - 2] = m_src_vertices[m_src_vertices.size() - 1]; m_src_vertices.remove_last(); m_src_vertices[m_src_vertices.size() - 2].dist = d; } } dist = 0.0; for(i = 0; i < m_src_vertices.size(); i++) { vertex_dist& v = m_src_vertices[i]; double d = v.dist; v.dist = dist; dist += d; } m_kindex = (m_src_vertices.size() - 1) / dist; m_status = ready; } } //------------------------------------------------------------------------ double trans_single_path::total_length() const { if(m_base_length >= 1e-10) return m_base_length; return (m_status == ready) ? m_src_vertices[m_src_vertices.size() - 1].dist : 0.0; } //------------------------------------------------------------------------ void trans_single_path::transform(double *x, double *y) const { if(m_status == ready) { if(m_base_length > 1e-10) { *x *= m_src_vertices[m_src_vertices.size() - 1].dist / m_base_length; } double x1 = 0.0; double y1 = 0.0; double dx = 1.0; double dy = 1.0; double d = 0.0; double dd = 1.0; if(*x < 0.0) { // Extrapolation on the left //-------------------------- x1 = m_src_vertices[0].x; y1 = m_src_vertices[0].y; dx = m_src_vertices[1].x - x1; dy = m_src_vertices[1].y - y1; dd = m_src_vertices[1].dist - m_src_vertices[0].dist; d = *x; } else if(*x > m_src_vertices[m_src_vertices.size() - 1].dist) { // Extrapolation on the right //-------------------------- unsigned i = m_src_vertices.size() - 2; unsigned j = m_src_vertices.size() - 1; x1 = m_src_vertices[j].x; y1 = m_src_vertices[j].y; dx = x1 - m_src_vertices[i].x; dy = y1 - m_src_vertices[i].y; dd = m_src_vertices[j].dist - m_src_vertices[i].dist; d = *x - m_src_vertices[j].dist; } else { // Interpolation //-------------------------- unsigned i = 0; unsigned j = m_src_vertices.size() - 1; if(m_preserve_x_scale) { unsigned k; for(i = 0; (j - i) > 1; ) { if(*x < m_src_vertices[k = (i + j) >> 1].dist) { j = k; } else { i = k; } } d = m_src_vertices[i].dist; dd = m_src_vertices[j].dist - d; d = *x - d; } else { i = unsigned(*x * m_kindex); j = i + 1; dd = m_src_vertices[j].dist - m_src_vertices[i].dist; d = ((*x * m_kindex) - i) * dd; } x1 = m_src_vertices[i].x; y1 = m_src_vertices[i].y; dx = m_src_vertices[j].x - x1; dy = m_src_vertices[j].y - y1; } double x2 = x1 + dx * d / dd; double y2 = y1 + dy * d / dd; *x = x2 - *y * dy / dd; *y = y2 + *y * dx / dd; } } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/Makefile.am0000644000175000017500000000241313233644505022176 0ustar varunvarunSUBDIRS = ctrl . platform INCLUDES = -I$(top_srcdir)/include lib_LTLIBRARIES = libagg.la libagg_la_LDFLAGS = -no-undefined -version-info @AGG_LIB_VERSION@ libagg_la_SOURCES = agg_arc.cpp \ agg_arrowhead.cpp \ agg_bezier_arc.cpp \ agg_bspline.cpp \ agg_curves.cpp \ agg_embedded_raster_fonts.cpp \ agg_gsv_text.cpp \ agg_image_filters.cpp \ agg_line_aa_basics.cpp \ agg_line_profile_aa.cpp \ agg_rounded_rect.cpp \ agg_sqrt_tables.cpp \ agg_trans_affine.cpp \ agg_trans_double_path.cpp \ agg_trans_single_path.cpp \ agg_trans_warp_magnifier.cpp \ agg_vcgen_bspline.cpp \ agg_vcgen_contour.cpp \ agg_vcgen_dash.cpp \ agg_vcgen_markers_term.cpp \ agg_vcgen_smooth_poly1.cpp \ agg_vcgen_stroke.cpp \ agg_vpgen_clip_polygon.cpp \ agg_vpgen_clip_polyline.cpp \ agg_vpgen_segmentator.cpp if ENABLE_GPC GPCLD=$(top_builddir)/gpc/libagggpc.la else GPCLD= endif if ENABLE_CTRL CTRLLD=$(top_builddir)/src/ctrl/libaggctrl.la else CTRLLD= endif libagg_la_LIBADD = $(GPCLD) $(CTRLLD) enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_bezier_arc.cpp0000644000175000017500000002132113233644505023570 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Arc generator. Produces at most 4 consecutive cubic bezier curves, i.e., // 4, 7, 10, or 13 vertices. // //---------------------------------------------------------------------------- #include #include "agg_bezier_arc.h" namespace agg24 { // This epsilon is used to prevent us from adding degenerate curves // (converging to a single point). // The value isn't very critical. Function arc_to_bezier() has a limit // of the sweep_angle. If fabs(sweep_angle) exceeds pi/2 the curve // becomes inaccurate. But slight exceeding is quite appropriate. //-------------------------------------------------bezier_arc_angle_epsilon const double bezier_arc_angle_epsilon = 0.01; //------------------------------------------------------------arc_to_bezier void arc_to_bezier(double cx, double cy, double rx, double ry, double start_angle, double sweep_angle, double* curve) { double x0 = cos(sweep_angle / 2.0); double y0 = sin(sweep_angle / 2.0); double tx = (1.0 - x0) * 4.0 / 3.0; double ty = y0 - tx * x0 / y0; double px[4]; double py[4]; px[0] = x0; py[0] = -y0; px[1] = x0 + tx; py[1] = -ty; px[2] = x0 + tx; py[2] = ty; px[3] = x0; py[3] = y0; double sn = sin(start_angle + sweep_angle / 2.0); double cs = cos(start_angle + sweep_angle / 2.0); unsigned i; for(i = 0; i < 4; i++) { curve[i * 2] = cx + rx * (px[i] * cs - py[i] * sn); curve[i * 2 + 1] = cy + ry * (px[i] * sn + py[i] * cs); } } //------------------------------------------------------------------------ void bezier_arc::init(double x, double y, double rx, double ry, double start_angle, double sweep_angle) { start_angle = fmod(start_angle, 2.0 * pi); if(sweep_angle >= 2.0 * pi) sweep_angle = 2.0 * pi; if(sweep_angle <= -2.0 * pi) sweep_angle = -2.0 * pi; if(fabs(sweep_angle) < 1e-10) { m_num_vertices = 4; m_cmd = path_cmd_line_to; m_vertices[0] = x + rx * cos(start_angle); m_vertices[1] = y + ry * sin(start_angle); m_vertices[2] = x + rx * cos(start_angle + sweep_angle); m_vertices[3] = y + ry * sin(start_angle + sweep_angle); return; } double total_sweep = 0.0; double local_sweep = 0.0; double prev_sweep; m_num_vertices = 2; m_cmd = path_cmd_curve4; bool done = false; do { if(sweep_angle < 0.0) { prev_sweep = total_sweep; local_sweep = -pi * 0.5; total_sweep -= pi * 0.5; if(total_sweep <= sweep_angle + bezier_arc_angle_epsilon) { local_sweep = sweep_angle - prev_sweep; done = true; } } else { prev_sweep = total_sweep; local_sweep = pi * 0.5; total_sweep += pi * 0.5; if(total_sweep >= sweep_angle - bezier_arc_angle_epsilon) { local_sweep = sweep_angle - prev_sweep; done = true; } } arc_to_bezier(x, y, rx, ry, start_angle, local_sweep, m_vertices + m_num_vertices - 2); m_num_vertices += 6; start_angle += local_sweep; } while(!done && m_num_vertices < 26); } //-------------------------------------------------------------------- void bezier_arc_svg::init(double x0, double y0, double rx, double ry, double angle, bool large_arc_flag, bool sweep_flag, double x2, double y2) { m_radii_ok = true; if(rx < 0.0) rx = -rx; if(ry < 0.0) ry = -rx; // Calculate the middle point between // the current and the final points //------------------------ double dx2 = (x0 - x2) / 2.0; double dy2 = (y0 - y2) / 2.0; double cos_a = cos(angle); double sin_a = sin(angle); // Calculate (x1, y1) //------------------------ double x1 = cos_a * dx2 + sin_a * dy2; double y1 = -sin_a * dx2 + cos_a * dy2; // Ensure radii are large enough //------------------------ double prx = rx * rx; double pry = ry * ry; double px1 = x1 * x1; double py1 = y1 * y1; // Check that radii are large enough //------------------------ double radii_check = px1/prx + py1/pry; if(radii_check > 1.0) { rx = sqrt(radii_check) * rx; ry = sqrt(radii_check) * ry; prx = rx * rx; pry = ry * ry; if(radii_check > 10.0) m_radii_ok = false; } // Calculate (cx1, cy1) //------------------------ double sign = (large_arc_flag == sweep_flag) ? -1.0 : 1.0; double sq = (prx*pry - prx*py1 - pry*px1) / (prx*py1 + pry*px1); double coef = sign * sqrt((sq < 0) ? 0 : sq); double cx1 = coef * ((rx * y1) / ry); double cy1 = coef * -((ry * x1) / rx); // // Calculate (cx, cy) from (cx1, cy1) //------------------------ double sx2 = (x0 + x2) / 2.0; double sy2 = (y0 + y2) / 2.0; double cx = sx2 + (cos_a * cx1 - sin_a * cy1); double cy = sy2 + (sin_a * cx1 + cos_a * cy1); // Calculate the start_angle (angle1) and the sweep_angle (dangle) //------------------------ double ux = (x1 - cx1) / rx; double uy = (y1 - cy1) / ry; double vx = (-x1 - cx1) / rx; double vy = (-y1 - cy1) / ry; double p, n; // Calculate the angle start //------------------------ n = sqrt(ux*ux + uy*uy); p = ux; // (1 * ux) + (0 * uy) sign = (uy < 0) ? -1.0 : 1.0; double v = p / n; if(v < -1.0) v = -1.0; if(v > 1.0) v = 1.0; double start_angle = sign * acos(v); // Calculate the sweep angle //------------------------ n = sqrt((ux*ux + uy*uy) * (vx*vx + vy*vy)); p = ux * vx + uy * vy; sign = (ux * vy - uy * vx < 0) ? -1.0 : 1.0; v = p / n; if(v < -1.0) v = -1.0; if(v > 1.0) v = 1.0; double sweep_angle = sign * acos(v); if(!sweep_flag && sweep_angle > 0) { sweep_angle -= pi * 2.0; } else if (sweep_flag && sweep_angle < 0) { sweep_angle += pi * 2.0; } // We can now build and transform the resulting arc //------------------------ m_arc.init(0.0, 0.0, rx, ry, start_angle, sweep_angle); trans_affine mtx = trans_affine_rotation(angle); mtx *= trans_affine_translation(cx, cy); for(unsigned i = 2; i < m_arc.num_vertices()-2; i += 2) { mtx.transform(m_arc.vertices() + i, m_arc.vertices() + i + 1); } // We must make sure that the starting and ending points // exactly coincide with the initial (x0,y0) and (x2,y2) m_arc.vertices()[0] = x0; m_arc.vertices()[1] = y0; if(m_arc.num_vertices() > 2) { m_arc.vertices()[m_arc.num_vertices() - 2] = x2; m_arc.vertices()[m_arc.num_vertices() - 1] = y2; } } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_trans_warp_magnifier.cpp0000644000175000017500000000427713233644505025677 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include #include "agg_trans_warp_magnifier.h" namespace agg24 { //------------------------------------------------------------------------ void trans_warp_magnifier::transform(double* x, double* y) const { double dx = *x - m_xc; double dy = *y - m_yc; double r = sqrt(dx * dx + dy * dy); if(r < m_radius) { *x = m_xc + dx * m_magn; *y = m_yc + dy * m_magn; return; } double m = (r + m_radius * (m_magn - 1.0)) / r; *x = m_xc + dx * m; *y = m_yc + dy * m; } //------------------------------------------------------------------------ void trans_warp_magnifier::inverse_transform(double* x, double* y) const { // New version by Andrew Skalkin //----------------- double dx = *x - m_xc; double dy = *y - m_yc; double r = sqrt(dx * dx + dy * dy); if(r < m_radius * m_magn) { *x = m_xc + dx / m_magn; *y = m_yc + dy / m_magn; } else { double rnew = r - m_radius * (m_magn - 1.0); *x = m_xc + rnew * dx / r; *y = m_yc + rnew * dy / r; } // Old version //----------------- //trans_warp_magnifier t(*this); //t.magnification(1.0 / m_magn); //t.radius(m_radius * m_magn); //t.transform(x, y); } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_vpgen_segmentator.cpp0000644000175000017500000000374213233644505025221 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include #include "agg_vpgen_segmentator.h" namespace agg24 { void vpgen_segmentator::move_to(double x, double y) { m_x1 = x; m_y1 = y; m_dx = 0.0; m_dy = 0.0; m_dl = 2.0; m_ddl = 2.0; m_cmd = path_cmd_move_to; } void vpgen_segmentator::line_to(double x, double y) { m_x1 += m_dx; m_y1 += m_dy; m_dx = x - m_x1; m_dy = y - m_y1; double len = sqrt(m_dx * m_dx + m_dy * m_dy) * m_approximation_scale; if(len < 1e-30) len = 1e-30; m_ddl = 1.0 / len; m_dl = (m_cmd == path_cmd_move_to) ? 0.0 : m_ddl; if(m_cmd == path_cmd_stop) m_cmd = path_cmd_line_to; } unsigned vpgen_segmentator::vertex(double* x, double* y) { if(m_cmd == path_cmd_stop) return path_cmd_stop; unsigned cmd = m_cmd; m_cmd = path_cmd_line_to; if(m_dl >= 1.0 - m_ddl) { m_dl = 1.0; m_cmd = path_cmd_stop; *x = m_x1 + m_dx; *y = m_y1 + m_dy; return cmd; } *x = m_x1 + m_dx * m_dl; *y = m_y1 + m_dy * m_dl; m_dl += m_ddl; return cmd; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_embedded_raster_fonts.cpp0000644000175000017500000142631413233644505026021 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include "agg_embedded_raster_fonts.h" namespace agg24 { const int8u gse4x6[] = { 6, 0, 32, 128-32, 0x00,0x00,0x07,0x00,0x0e,0x00,0x15,0x00,0x1c,0x00,0x23,0x00,0x2a,0x00,0x31,0x00,0x38,0x00, 0x3f,0x00,0x46,0x00,0x4d,0x00,0x54,0x00,0x5b,0x00,0x62,0x00,0x69,0x00,0x70,0x00,0x77,0x00, 0x7e,0x00,0x85,0x00,0x8c,0x00,0x93,0x00,0x9a,0x00,0xa1,0x00,0xa8,0x00,0xaf,0x00,0xb6,0x00, 0xbd,0x00,0xc4,0x00,0xcb,0x00,0xd2,0x00,0xd9,0x00,0xe0,0x00,0xe7,0x00,0xee,0x00,0xf5,0x00, 0xfc,0x00,0x03,0x01,0x0a,0x01,0x11,0x01,0x18,0x01,0x1f,0x01,0x26,0x01,0x2d,0x01,0x34,0x01, 0x3b,0x01,0x42,0x01,0x49,0x01,0x50,0x01,0x57,0x01,0x5e,0x01,0x65,0x01,0x6c,0x01,0x73,0x01, 0x7a,0x01,0x81,0x01,0x88,0x01,0x8f,0x01,0x96,0x01,0x9d,0x01,0xa4,0x01,0xab,0x01,0xb2,0x01, 0xb9,0x01,0xc0,0x01,0xc7,0x01,0xce,0x01,0xd5,0x01,0xdc,0x01,0xe3,0x01,0xea,0x01,0xf1,0x01, 0xf8,0x01,0xff,0x01,0x06,0x02,0x0d,0x02,0x14,0x02,0x1b,0x02,0x22,0x02,0x29,0x02,0x30,0x02, 0x37,0x02,0x3e,0x02,0x45,0x02,0x4c,0x02,0x53,0x02,0x5a,0x02,0x61,0x02,0x68,0x02,0x6f,0x02, 0x76,0x02,0x7d,0x02,0x84,0x02,0x8b,0x02,0x92,0x02,0x99,0x02, 4, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x21 '!' 0x40,0x40,0x40,0x00,0x40,0x00, 4, // 0x22 '"' 0xa0,0xa0,0x00,0x00,0x00,0x00, 4, // 0x23 '#' 0x60,0xf0,0x60,0xf0,0x60,0x00, 4, // 0x24 '$' 0x40,0x60,0xc0,0x60,0xc0,0x40, 4, // 0x25 '%' 0xa0,0x20,0x40,0x80,0xa0,0x00, 4, // 0x26 '&' 0xe0,0xa0,0x50,0xa0,0xd0,0x00, 4, // 0x27 ''' 0x40,0x40,0x00,0x00,0x00,0x00, 4, // 0x28 '(' 0x20,0x40,0x40,0x40,0x20,0x00, 4, // 0x29 ')' 0x40,0x20,0x20,0x20,0x40,0x00, 4, // 0x2a '*' 0xa0,0x40,0xe0,0x40,0xa0,0x00, 4, // 0x2b '+' 0x40,0x40,0xe0,0x40,0x40,0x00, 4, // 0x2c ',' 0x00,0x00,0x00,0x40,0x40,0x80, 4, // 0x2d '-' 0x00,0x00,0xe0,0x00,0x00,0x00, 4, // 0x2e '.' 0x00,0x00,0x00,0x00,0x40,0x00, 4, // 0x2f '/' 0x10,0x20,0x20,0x40,0x40,0x80, 4, // 0x30 '0' 0xe0,0xa0,0xa0,0xa0,0xe0,0x00, 4, // 0x31 '1' 0x40,0xc0,0x40,0x40,0xe0,0x00, 4, // 0x32 '2' 0xe0,0xa0,0x20,0x40,0xe0,0x00, 4, // 0x33 '3' 0xe0,0x20,0x40,0x20,0xe0,0x00, 4, // 0x34 '4' 0xa0,0xa0,0xe0,0x20,0x20,0x00, 4, // 0x35 '5' 0xe0,0x80,0xc0,0x20,0xc0,0x00, 4, // 0x36 '6' 0x40,0x80,0xe0,0xa0,0xe0,0x00, 4, // 0x37 '7' 0xe0,0xa0,0x20,0x40,0x40,0x00, 4, // 0x38 '8' 0xe0,0xa0,0x40,0xa0,0xe0,0x00, 4, // 0x39 '9' 0xe0,0xa0,0xe0,0x20,0xc0,0x00, 4, // 0x3a ':' 0x00,0x40,0x00,0x40,0x00,0x00, 4, // 0x3b ';' 0x00,0x40,0x00,0x40,0x40,0x80, 4, // 0x3c '<' 0x20,0x40,0x80,0x40,0x20,0x00, 4, // 0x3d '=' 0x00,0xe0,0x00,0xe0,0x00,0x00, 4, // 0x3e '>' 0x80,0x40,0x20,0x40,0x80,0x00, 4, // 0x3f '?' 0xc0,0x20,0x40,0x00,0x40,0x00, 4, // 0x40 '@' 0x40,0xa0,0xe0,0xe0,0x80,0x60, 4, // 0x41 'A' 0x40,0xa0,0xe0,0xa0,0xa0,0x00, 4, // 0x42 'B' 0xc0,0xa0,0xc0,0xa0,0xc0,0x00, 4, // 0x43 'C' 0x60,0x80,0x80,0x80,0x60,0x00, 4, // 0x44 'D' 0xc0,0xa0,0xa0,0xa0,0xc0,0x00, 4, // 0x45 'E' 0xe0,0x80,0xc0,0x80,0xe0,0x00, 4, // 0x46 'F' 0xe0,0x80,0xc0,0x80,0x80,0x00, 4, // 0x47 'G' 0x60,0x80,0xa0,0xa0,0x40,0x00, 4, // 0x48 'H' 0xa0,0xa0,0xe0,0xa0,0xa0,0x00, 4, // 0x49 'I' 0xe0,0x40,0x40,0x40,0xe0,0x00, 4, // 0x4a 'J' 0x20,0x20,0x20,0x20,0xa0,0x40, 4, // 0x4b 'K' 0xa0,0xa0,0xc0,0xc0,0xa0,0x00, 4, // 0x4c 'L' 0x80,0x80,0x80,0x80,0xe0,0x00, 4, // 0x4d 'M' 0xa0,0xe0,0xa0,0xa0,0xa0,0x00, 4, // 0x4e 'N' 0x90,0xd0,0xb0,0x90,0x90,0x00, 4, // 0x4f 'O' 0x40,0xa0,0xa0,0xa0,0x40,0x00, 4, // 0x50 'P' 0xc0,0xa0,0xa0,0xc0,0x80,0x00, 4, // 0x51 'Q' 0x40,0xa0,0xa0,0xa0,0x60,0x00, 4, // 0x52 'R' 0xc0,0xa0,0xa0,0xc0,0xa0,0x00, 4, // 0x53 'S' 0x60,0x80,0x40,0x20,0xc0,0x00, 4, // 0x54 'T' 0xe0,0x40,0x40,0x40,0x40,0x00, 4, // 0x55 'U' 0xa0,0xa0,0xa0,0xa0,0xe0,0x00, 4, // 0x56 'V' 0xa0,0xa0,0xa0,0xa0,0x40,0x00, 4, // 0x57 'W' 0xa0,0xa0,0xa0,0xe0,0xa0,0x00, 4, // 0x58 'X' 0xa0,0xa0,0x40,0xa0,0xa0,0x00, 4, // 0x59 'Y' 0xa0,0xa0,0x40,0x40,0x40,0x00, 4, // 0x5a 'Z' 0xe0,0x20,0x40,0x80,0xe0,0x00, 4, // 0x5b '[' 0xc0,0x80,0x80,0x80,0xc0,0x00, 4, // 0x5c '\' 0x80,0x40,0x40,0x20,0x20,0x10, 4, // 0x5d ']' 0xc0,0x40,0x40,0x40,0xc0,0x00, 4, // 0x5e '^' 0x40,0xa0,0x00,0x00,0x00,0x00, 4, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0xf0, 4, // 0x60 '`' 0x40,0x20,0x00,0x00,0x00,0x00, 4, // 0x61 'a' 0x00,0x60,0xa0,0xa0,0x70,0x00, 4, // 0x62 'b' 0x80,0x80,0xc0,0xa0,0xc0,0x00, 4, // 0x63 'c' 0x00,0x60,0x80,0x80,0x60,0x00, 4, // 0x64 'd' 0x20,0x20,0x60,0xa0,0x60,0x00, 4, // 0x65 'e' 0x00,0x40,0xe0,0x80,0x60,0x00, 4, // 0x66 'f' 0x20,0x40,0xe0,0x40,0x40,0x00, 4, // 0x67 'g' 0x00,0x60,0xa0,0x60,0x20,0xc0, 4, // 0x68 'h' 0x80,0x80,0xc0,0xa0,0xa0,0x00, 4, // 0x69 'i' 0x40,0x00,0xc0,0x40,0xe0,0x00, 4, // 0x6a 'j' 0x40,0x00,0xc0,0x40,0x40,0x80, 4, // 0x6b 'k' 0x80,0x80,0xa0,0xc0,0xa0,0x00, 4, // 0x6c 'l' 0xc0,0x40,0x40,0x40,0xe0,0x00, 4, // 0x6d 'm' 0x00,0xa0,0xf0,0xf0,0x90,0x00, 4, // 0x6e 'n' 0x00,0xc0,0xa0,0xa0,0xa0,0x00, 4, // 0x6f 'o' 0x00,0x40,0xa0,0xa0,0x40,0x00, 4, // 0x70 'p' 0x00,0xc0,0xa0,0xc0,0x80,0x80, 4, // 0x71 'q' 0x00,0x60,0xa0,0x60,0x20,0x20, 4, // 0x72 'r' 0x00,0xa0,0x50,0x40,0x40,0x00, 4, // 0x73 's' 0x00,0x60,0xc0,0x20,0xc0,0x00, 4, // 0x74 't' 0x40,0x40,0xe0,0x40,0x60,0x00, 4, // 0x75 'u' 0x00,0xa0,0xa0,0xa0,0x60,0x00, 4, // 0x76 'v' 0x00,0xa0,0xa0,0xa0,0x40,0x00, 4, // 0x77 'w' 0x00,0xa0,0xa0,0xe0,0xa0,0x00, 4, // 0x78 'x' 0x00,0xa0,0x40,0xa0,0xa0,0x00, 4, // 0x79 'y' 0x00,0xa0,0xa0,0x60,0x20,0xc0, 4, // 0x7a 'z' 0x00,0xe0,0x40,0x80,0xe0,0x00, 4, // 0x7b '{' 0x30,0x20,0xc0,0x20,0x30,0x00, 4, // 0x7c '|' 0x40,0x40,0x00,0x40,0x40,0x40, 4, // 0x7d '}' 0xc0,0x40,0x30,0x40,0xc0,0x00, 4, // 0x7e '~' 0x50,0xa0,0x00,0x00,0x00,0x00, 4, // 0x7f '' 0x00,0x60,0x90,0xf0,0x00,0x00, 0 }; const int8u gse4x8[] = { 8, 0, 32, 128-32, 0x00,0x00,0x09,0x00,0x12,0x00,0x1b,0x00,0x24,0x00,0x2d,0x00,0x36,0x00,0x3f,0x00,0x48,0x00, 0x51,0x00,0x5a,0x00,0x63,0x00,0x6c,0x00,0x75,0x00,0x7e,0x00,0x87,0x00,0x90,0x00,0x99,0x00, 0xa2,0x00,0xab,0x00,0xb4,0x00,0xbd,0x00,0xc6,0x00,0xcf,0x00,0xd8,0x00,0xe1,0x00,0xea,0x00, 0xf3,0x00,0xfc,0x00,0x05,0x01,0x0e,0x01,0x17,0x01,0x20,0x01,0x29,0x01,0x32,0x01,0x3b,0x01, 0x44,0x01,0x4d,0x01,0x56,0x01,0x5f,0x01,0x68,0x01,0x71,0x01,0x7a,0x01,0x83,0x01,0x8c,0x01, 0x95,0x01,0x9e,0x01,0xa7,0x01,0xb0,0x01,0xb9,0x01,0xc2,0x01,0xcb,0x01,0xd4,0x01,0xdd,0x01, 0xe6,0x01,0xef,0x01,0xf8,0x01,0x01,0x02,0x0a,0x02,0x13,0x02,0x1c,0x02,0x25,0x02,0x2e,0x02, 0x37,0x02,0x40,0x02,0x49,0x02,0x52,0x02,0x5b,0x02,0x64,0x02,0x6d,0x02,0x76,0x02,0x7f,0x02, 0x88,0x02,0x91,0x02,0x9a,0x02,0xa3,0x02,0xac,0x02,0xb5,0x02,0xbe,0x02,0xc7,0x02,0xd0,0x02, 0xd9,0x02,0xe2,0x02,0xeb,0x02,0xf4,0x02,0xfd,0x02,0x06,0x03,0x0f,0x03,0x18,0x03,0x21,0x03, 0x2a,0x03,0x33,0x03,0x3c,0x03,0x45,0x03,0x4e,0x03,0x57,0x03, 4, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x21 '!' 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x00, 4, // 0x22 '"' 0x00,0xa0,0xa0,0x00,0x00,0x00,0x00,0x00, 4, // 0x23 '#' 0x60,0x60,0xf0,0x60,0x60,0xf0,0x60,0x60, 4, // 0x24 '$' 0x40,0x60,0xc0,0xc0,0x60,0x60,0xc0,0x40, 4, // 0x25 '%' 0x00,0xa0,0x20,0x40,0x40,0x80,0xa0,0x00, 4, // 0x26 '&' 0x00,0x40,0xa0,0xa0,0x40,0xb0,0xa0,0x70, 4, // 0x27 ''' 0x00,0x40,0x40,0x00,0x00,0x00,0x00,0x00, 4, // 0x28 '(' 0x20,0x40,0x80,0x80,0x80,0x80,0x40,0x20, 4, // 0x29 ')' 0x80,0x40,0x20,0x20,0x20,0x20,0x40,0x80, 4, // 0x2a '*' 0x00,0xa0,0x40,0xe0,0x40,0xa0,0x00,0x00, 4, // 0x2b '+' 0x00,0x40,0x40,0xe0,0x40,0x40,0x00,0x00, 4, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80, 4, // 0x2d '-' 0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00, 4, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, 4, // 0x2f '/' 0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80, 4, // 0x30 '0' 0x00,0xe0,0xa0,0xa0,0xa0,0xa0,0xe0,0x00, 4, // 0x31 '1' 0x00,0x40,0xc0,0x40,0x40,0x40,0xe0,0x00, 4, // 0x32 '2' 0x00,0xe0,0xa0,0x20,0x40,0x80,0xe0,0x00, 4, // 0x33 '3' 0x00,0xe0,0x20,0x40,0x20,0x20,0xe0,0x00, 4, // 0x34 '4' 0x00,0x60,0xa0,0xa0,0xf0,0x20,0x20,0x00, 4, // 0x35 '5' 0x00,0xe0,0x80,0xc0,0x20,0x20,0xc0,0x00, 4, // 0x36 '6' 0x00,0x40,0x80,0xe0,0xa0,0xa0,0xe0,0x00, 4, // 0x37 '7' 0x00,0xe0,0xa0,0x20,0x40,0x40,0x40,0x00, 4, // 0x38 '8' 0x00,0xe0,0xa0,0x40,0xa0,0xa0,0xe0,0x00, 4, // 0x39 '9' 0x00,0xe0,0xa0,0xe0,0x20,0x20,0x40,0x00, 4, // 0x3a ':' 0x00,0x00,0x40,0x00,0x00,0x40,0x00,0x00, 4, // 0x3b ';' 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x80, 4, // 0x3c '<' 0x00,0x20,0x40,0x80,0x40,0x20,0x00,0x00, 4, // 0x3d '=' 0x00,0x00,0xe0,0x00,0xe0,0x00,0x00,0x00, 4, // 0x3e '>' 0x00,0x80,0x40,0x20,0x40,0x80,0x00,0x00, 4, // 0x3f '?' 0x00,0x40,0xa0,0x20,0x40,0x00,0x40,0x00, 4, // 0x40 '@' 0x00,0x40,0xa0,0xe0,0xe0,0x80,0x60,0x00, 4, // 0x41 'A' 0x00,0x40,0xa0,0xa0,0xe0,0xa0,0xa0,0x00, 4, // 0x42 'B' 0x00,0xc0,0xa0,0xc0,0xa0,0xa0,0xc0,0x00, 4, // 0x43 'C' 0x00,0x40,0xa0,0x80,0x80,0xa0,0x40,0x00, 4, // 0x44 'D' 0x00,0xc0,0xa0,0xa0,0xa0,0xa0,0xc0,0x00, 4, // 0x45 'E' 0x00,0xe0,0x80,0xc0,0x80,0x80,0xe0,0x00, 4, // 0x46 'F' 0x00,0xe0,0x80,0xc0,0x80,0x80,0x80,0x00, 4, // 0x47 'G' 0x00,0x60,0x80,0xa0,0xa0,0xa0,0x40,0x00, 4, // 0x48 'H' 0x00,0xa0,0xa0,0xe0,0xa0,0xa0,0xa0,0x00, 4, // 0x49 'I' 0x00,0xe0,0x40,0x40,0x40,0x40,0xe0,0x00, 4, // 0x4a 'J' 0x00,0x20,0x20,0x20,0x20,0xa0,0x40,0x00, 4, // 0x4b 'K' 0x00,0xa0,0xa0,0xc0,0xc0,0xa0,0xa0,0x00, 4, // 0x4c 'L' 0x00,0x80,0x80,0x80,0x80,0x80,0xe0,0x00, 4, // 0x4d 'M' 0x00,0xa0,0xe0,0xa0,0xa0,0xa0,0xa0,0x00, 4, // 0x4e 'N' 0x00,0x90,0x90,0xd0,0xb0,0x90,0x90,0x00, 4, // 0x4f 'O' 0x00,0x40,0xa0,0xa0,0xa0,0xa0,0x40,0x00, 4, // 0x50 'P' 0x00,0xc0,0xa0,0xa0,0xc0,0x80,0x80,0x00, 4, // 0x51 'Q' 0x00,0x40,0xa0,0xa0,0xa0,0xa0,0x60,0x00, 4, // 0x52 'R' 0x00,0xc0,0xa0,0xa0,0xc0,0xc0,0xa0,0x00, 4, // 0x53 'S' 0x00,0x60,0x80,0x40,0x20,0x20,0xc0,0x00, 4, // 0x54 'T' 0x00,0xe0,0x40,0x40,0x40,0x40,0x40,0x00, 4, // 0x55 'U' 0x00,0xa0,0xa0,0xa0,0xa0,0xa0,0x40,0x00, 4, // 0x56 'V' 0x00,0xa0,0xa0,0xa0,0xa0,0x40,0x40,0x00, 4, // 0x57 'W' 0x00,0xa0,0xa0,0xa0,0xa0,0xe0,0xa0,0x00, 4, // 0x58 'X' 0x00,0xa0,0xa0,0x40,0xa0,0xa0,0xa0,0x00, 4, // 0x59 'Y' 0x00,0xa0,0xa0,0x40,0x40,0x40,0x40,0x00, 4, // 0x5a 'Z' 0x00,0xe0,0x20,0x40,0x40,0x80,0xe0,0x00, 4, // 0x5b '[' 0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0xc0, 4, // 0x5c '\' 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10, 4, // 0x5d ']' 0xc0,0x40,0x40,0x40,0x40,0x40,0x40,0xc0, 4, // 0x5e '^' 0x00,0x40,0xa0,0x00,0x00,0x00,0x00,0x00, 4, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0, 4, // 0x60 '`' 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00, 4, // 0x61 'a' 0x00,0x00,0x60,0xa0,0xa0,0xa0,0x70,0x00, 4, // 0x62 'b' 0x00,0x80,0x80,0xc0,0xa0,0xa0,0xc0,0x00, 4, // 0x63 'c' 0x00,0x00,0x40,0xa0,0x80,0xa0,0x40,0x00, 4, // 0x64 'd' 0x00,0x20,0x20,0x60,0xa0,0xa0,0x60,0x00, 4, // 0x65 'e' 0x00,0x00,0x40,0xa0,0xe0,0x80,0x60,0x00, 4, // 0x66 'f' 0x00,0x20,0x40,0x40,0xe0,0x40,0x40,0x00, 4, // 0x67 'g' 0x00,0x00,0x60,0xa0,0xa0,0x60,0x20,0xc0, 4, // 0x68 'h' 0x00,0x80,0x80,0xc0,0xa0,0xa0,0xa0,0x00, 4, // 0x69 'i' 0x00,0x40,0x00,0xc0,0x40,0x40,0xe0,0x00, 4, // 0x6a 'j' 0x00,0x40,0x00,0xc0,0x40,0x40,0x40,0x80, 4, // 0x6b 'k' 0x00,0x80,0x80,0xa0,0xc0,0xc0,0xa0,0x00, 4, // 0x6c 'l' 0x00,0xc0,0x40,0x40,0x40,0x40,0xe0,0x00, 4, // 0x6d 'm' 0x00,0x00,0xa0,0xf0,0xf0,0xf0,0x90,0x00, 4, // 0x6e 'n' 0x00,0x00,0xc0,0xa0,0xa0,0xa0,0xa0,0x00, 4, // 0x6f 'o' 0x00,0x00,0x40,0xa0,0xa0,0xa0,0x40,0x00, 4, // 0x70 'p' 0x00,0x00,0xc0,0xa0,0xa0,0xc0,0x80,0x80, 4, // 0x71 'q' 0x00,0x00,0x60,0xa0,0xa0,0x60,0x20,0x20, 4, // 0x72 'r' 0x00,0x00,0xa0,0x50,0x40,0x40,0x40,0x00, 4, // 0x73 's' 0x00,0x00,0x60,0x80,0x40,0x20,0xc0,0x00, 4, // 0x74 't' 0x00,0x40,0x40,0xe0,0x40,0x40,0x20,0x00, 4, // 0x75 'u' 0x00,0x00,0xa0,0xa0,0xa0,0xa0,0x60,0x00, 4, // 0x76 'v' 0x00,0x00,0xa0,0xa0,0xa0,0x40,0x40,0x00, 4, // 0x77 'w' 0x00,0x00,0xa0,0xa0,0xa0,0xe0,0xa0,0x00, 4, // 0x78 'x' 0x00,0x00,0xa0,0xa0,0x40,0xa0,0xa0,0x00, 4, // 0x79 'y' 0x00,0x00,0xa0,0xa0,0xa0,0x60,0x20,0xc0, 4, // 0x7a 'z' 0x00,0x00,0xe0,0x20,0x40,0x80,0xe0,0x00, 4, // 0x7b '{' 0x10,0x20,0x20,0xc0,0x20,0x20,0x10,0x00, 4, // 0x7c '|' 0x00,0x40,0x40,0x40,0x00,0x40,0x40,0x40, 4, // 0x7d '}' 0x80,0x40,0x40,0x30,0x40,0x40,0x80,0x00, 4, // 0x7e '~' 0x00,0x50,0xa0,0x00,0x00,0x00,0x00,0x00, 4, // 0x7f '' 0x00,0x00,0x00,0x60,0x90,0xf0,0x00,0x00, 0 }; const int8u gse5x7[] = { 7, 0, 32, 128-32, 0x00,0x00,0x08,0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x38,0x00,0x40,0x00, 0x48,0x00,0x50,0x00,0x58,0x00,0x60,0x00,0x68,0x00,0x70,0x00,0x78,0x00,0x80,0x00,0x88,0x00, 0x90,0x00,0x98,0x00,0xa0,0x00,0xa8,0x00,0xb0,0x00,0xb8,0x00,0xc0,0x00,0xc8,0x00,0xd0,0x00, 0xd8,0x00,0xe0,0x00,0xe8,0x00,0xf0,0x00,0xf8,0x00,0x00,0x01,0x08,0x01,0x10,0x01,0x18,0x01, 0x20,0x01,0x28,0x01,0x30,0x01,0x38,0x01,0x40,0x01,0x48,0x01,0x50,0x01,0x58,0x01,0x60,0x01, 0x68,0x01,0x70,0x01,0x78,0x01,0x80,0x01,0x88,0x01,0x90,0x01,0x98,0x01,0xa0,0x01,0xa8,0x01, 0xb0,0x01,0xb8,0x01,0xc0,0x01,0xc8,0x01,0xd0,0x01,0xd8,0x01,0xe0,0x01,0xe8,0x01,0xf0,0x01, 0xf8,0x01,0x00,0x02,0x08,0x02,0x10,0x02,0x18,0x02,0x20,0x02,0x28,0x02,0x30,0x02,0x38,0x02, 0x40,0x02,0x48,0x02,0x50,0x02,0x58,0x02,0x60,0x02,0x68,0x02,0x70,0x02,0x78,0x02,0x80,0x02, 0x88,0x02,0x90,0x02,0x98,0x02,0xa0,0x02,0xa8,0x02,0xb0,0x02,0xb8,0x02,0xc0,0x02,0xc8,0x02, 0xd0,0x02,0xd8,0x02,0xe0,0x02,0xe8,0x02,0xf0,0x02,0xf8,0x02, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x21 '!' 0x00,0x20,0x20,0x20,0x00,0x20,0x00, 5, // 0x22 '"' 0x00,0x50,0x50,0x00,0x00,0x00,0x00, 5, // 0x23 '#' 0x00,0x50,0xf8,0x50,0xf8,0x50,0x00, 5, // 0x24 '$' 0x20,0x78,0xa0,0x70,0x28,0xf0,0x20, 5, // 0x25 '%' 0x00,0x88,0x10,0x20,0x40,0x88,0x00, 5, // 0x26 '&' 0x00,0x40,0xa0,0x68,0x90,0x68,0x00, 5, // 0x27 ''' 0x00,0x20,0x20,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x10,0x20,0x40,0x40,0x40,0x20,0x10, 5, // 0x29 ')' 0x80,0x40,0x20,0x20,0x20,0x40,0x80, 5, // 0x2a '*' 0x00,0x20,0xa8,0x70,0xa8,0x20,0x00, 5, // 0x2b '+' 0x00,0x20,0x20,0xf8,0x20,0x20,0x00, 5, // 0x2c ',' 0x00,0x00,0x00,0x00,0x20,0x20,0x40, 5, // 0x2d '-' 0x00,0x00,0x00,0xf0,0x00,0x00,0x00, 5, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x40,0x00, 5, // 0x2f '/' 0x00,0x08,0x10,0x20,0x40,0x80,0x00, 5, // 0x30 '0' 0x00,0x60,0x90,0x90,0x90,0x60,0x00, 5, // 0x31 '1' 0x00,0x20,0x60,0x20,0x20,0x70,0x00, 5, // 0x32 '2' 0x00,0x60,0x90,0x20,0x40,0xf0,0x00, 5, // 0x33 '3' 0x00,0xf0,0x20,0x60,0x10,0xe0,0x00, 5, // 0x34 '4' 0x00,0x30,0x50,0x90,0xf0,0x10,0x00, 5, // 0x35 '5' 0x00,0xf0,0x80,0xe0,0x10,0xe0,0x00, 5, // 0x36 '6' 0x00,0x60,0x80,0xe0,0x90,0x60,0x00, 5, // 0x37 '7' 0x00,0xf0,0x90,0x20,0x40,0x40,0x00, 5, // 0x38 '8' 0x00,0x60,0x90,0x60,0x90,0x60,0x00, 5, // 0x39 '9' 0x00,0x60,0x90,0x70,0x10,0x60,0x00, 5, // 0x3a ':' 0x00,0x00,0x20,0x00,0x20,0x00,0x00, 5, // 0x3b ';' 0x00,0x00,0x20,0x00,0x20,0x20,0x40, 5, // 0x3c '<' 0x00,0x10,0x20,0x40,0x20,0x10,0x00, 5, // 0x3d '=' 0x00,0x00,0xf0,0x00,0xf0,0x00,0x00, 5, // 0x3e '>' 0x00,0x80,0x40,0x20,0x40,0x80,0x00, 5, // 0x3f '?' 0x00,0x60,0x90,0x20,0x00,0x20,0x00, 5, // 0x40 '@' 0x00,0x60,0x90,0xb0,0x80,0x70,0x00, 5, // 0x41 'A' 0x00,0x60,0x90,0xf0,0x90,0x90,0x00, 5, // 0x42 'B' 0x00,0xe0,0x90,0xe0,0x90,0xe0,0x00, 5, // 0x43 'C' 0x00,0x60,0x90,0x80,0x90,0x60,0x00, 5, // 0x44 'D' 0x00,0xe0,0x90,0x90,0x90,0xe0,0x00, 5, // 0x45 'E' 0x00,0xf0,0x80,0xe0,0x80,0xf0,0x00, 5, // 0x46 'F' 0x00,0xf0,0x80,0xe0,0x80,0x80,0x00, 5, // 0x47 'G' 0x00,0x70,0x80,0xb0,0x90,0x60,0x00, 5, // 0x48 'H' 0x00,0x90,0x90,0xf0,0x90,0x90,0x00, 5, // 0x49 'I' 0x00,0x70,0x20,0x20,0x20,0x70,0x00, 5, // 0x4a 'J' 0x00,0x70,0x20,0x20,0xa0,0x40,0x00, 5, // 0x4b 'K' 0x00,0x90,0xa0,0xc0,0xa0,0x90,0x00, 5, // 0x4c 'L' 0x00,0x80,0x80,0x80,0x80,0xf0,0x00, 5, // 0x4d 'M' 0x00,0x90,0xf0,0x90,0x90,0x90,0x00, 5, // 0x4e 'N' 0x00,0x90,0xd0,0xb0,0x90,0x90,0x00, 5, // 0x4f 'O' 0x00,0x60,0x90,0x90,0x90,0x60,0x00, 5, // 0x50 'P' 0x00,0xe0,0x90,0xe0,0x80,0x80,0x00, 5, // 0x51 'Q' 0x00,0x60,0x90,0x90,0xa0,0x50,0x00, 5, // 0x52 'R' 0x00,0xe0,0x90,0xe0,0xa0,0x90,0x00, 5, // 0x53 'S' 0x00,0x70,0x80,0x60,0x10,0xe0,0x00, 5, // 0x54 'T' 0x00,0x70,0x20,0x20,0x20,0x20,0x00, 5, // 0x55 'U' 0x00,0x90,0x90,0x90,0x90,0x60,0x00, 5, // 0x56 'V' 0x00,0x50,0x50,0x50,0x20,0x20,0x00, 5, // 0x57 'W' 0x00,0x90,0x90,0x90,0xf0,0x90,0x00, 5, // 0x58 'X' 0x00,0x90,0x90,0x60,0x90,0x90,0x00, 5, // 0x59 'Y' 0x00,0x50,0x50,0x20,0x20,0x20,0x00, 5, // 0x5a 'Z' 0x00,0xf0,0x10,0x20,0x40,0xf0,0x00, 5, // 0x5b '[' 0x70,0x40,0x40,0x40,0x40,0x40,0x70, 5, // 0x5c '\' 0x00,0x80,0x40,0x20,0x10,0x08,0x00, 5, // 0x5d ']' 0xe0,0x20,0x20,0x20,0x20,0x20,0xe0, 5, // 0x5e '^' 0x00,0x20,0x50,0x00,0x00,0x00,0x00, 5, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0xf8,0x00, 5, // 0x60 '`' 0x00,0x40,0x20,0x00,0x00,0x00,0x00, 5, // 0x61 'a' 0x00,0x00,0x60,0xa0,0xa0,0x50,0x00, 5, // 0x62 'b' 0x00,0x80,0x80,0xe0,0x90,0xe0,0x00, 5, // 0x63 'c' 0x00,0x00,0x70,0x80,0x80,0x70,0x00, 5, // 0x64 'd' 0x00,0x10,0x10,0x70,0x90,0x70,0x00, 5, // 0x65 'e' 0x00,0x00,0x60,0xf0,0x80,0x70,0x00, 5, // 0x66 'f' 0x00,0x30,0x40,0xe0,0x40,0x40,0x00, 5, // 0x67 'g' 0x00,0x00,0x70,0x90,0x70,0x10,0x60, 5, // 0x68 'h' 0x00,0x80,0x80,0xe0,0x90,0x90,0x00, 5, // 0x69 'i' 0x20,0x00,0x60,0x20,0x20,0x70,0x00, 5, // 0x6a 'j' 0x20,0x00,0x60,0x20,0x20,0xa0,0x40, 5, // 0x6b 'k' 0x80,0x80,0x90,0xa0,0xe0,0x90,0x00, 5, // 0x6c 'l' 0x00,0x60,0x20,0x20,0x20,0x70,0x00, 5, // 0x6d 'm' 0x00,0x00,0xa0,0xf0,0xf0,0x90,0x00, 5, // 0x6e 'n' 0x00,0x00,0xa0,0xd0,0x90,0x90,0x00, 5, // 0x6f 'o' 0x00,0x00,0x60,0x90,0x90,0x60,0x00, 5, // 0x70 'p' 0x00,0x00,0xe0,0x90,0xe0,0x80,0x80, 5, // 0x71 'q' 0x00,0x00,0x70,0x90,0x70,0x10,0x10, 5, // 0x72 'r' 0x00,0x00,0xe0,0x90,0x80,0x80,0x00, 5, // 0x73 's' 0x00,0x00,0x70,0xe0,0x10,0xe0,0x00, 5, // 0x74 't' 0x40,0x40,0xe0,0x40,0x40,0x70,0x00, 5, // 0x75 'u' 0x00,0x00,0x90,0x90,0x90,0x70,0x00, 5, // 0x76 'v' 0x00,0x00,0x50,0x50,0x50,0x20,0x00, 5, // 0x77 'w' 0x00,0x00,0x90,0x90,0xf0,0x90,0x00, 5, // 0x78 'x' 0x00,0x00,0x90,0x60,0x60,0x90,0x00, 5, // 0x79 'y' 0x00,0x00,0x90,0x90,0x70,0x10,0x60, 5, // 0x7a 'z' 0x00,0x00,0xf0,0x20,0x40,0xf0,0x00, 5, // 0x7b '{' 0x10,0x20,0x20,0xc0,0x20,0x20,0x10, 5, // 0x7c '|' 0x20,0x20,0x20,0x00,0x20,0x20,0x20, 5, // 0x7d '}' 0x40,0x20,0x20,0x18,0x20,0x20,0x40, 5, // 0x7e '~' 0x00,0x40,0xa8,0x10,0x00,0x00,0x00, 5, // 0x7f '' 0x00,0x00,0x20,0x50,0x88,0xf8,0x00, 0 }; const int8u gse5x9[] = { 9, 0, 32, 128-32, 0x00,0x00,0x0a,0x00,0x14,0x00,0x1e,0x00,0x28,0x00,0x32,0x00,0x3c,0x00,0x46,0x00,0x50,0x00, 0x5a,0x00,0x64,0x00,0x6e,0x00,0x78,0x00,0x82,0x00,0x8c,0x00,0x96,0x00,0xa0,0x00,0xaa,0x00, 0xb4,0x00,0xbe,0x00,0xc8,0x00,0xd2,0x00,0xdc,0x00,0xe6,0x00,0xf0,0x00,0xfa,0x00,0x04,0x01, 0x0e,0x01,0x18,0x01,0x22,0x01,0x2c,0x01,0x36,0x01,0x40,0x01,0x4a,0x01,0x54,0x01,0x5e,0x01, 0x68,0x01,0x72,0x01,0x7c,0x01,0x86,0x01,0x90,0x01,0x9a,0x01,0xa4,0x01,0xae,0x01,0xb8,0x01, 0xc2,0x01,0xcc,0x01,0xd6,0x01,0xe0,0x01,0xea,0x01,0xf4,0x01,0xfe,0x01,0x08,0x02,0x12,0x02, 0x1c,0x02,0x26,0x02,0x30,0x02,0x3a,0x02,0x44,0x02,0x4e,0x02,0x58,0x02,0x62,0x02,0x6c,0x02, 0x76,0x02,0x80,0x02,0x8a,0x02,0x94,0x02,0x9e,0x02,0xa8,0x02,0xb2,0x02,0xbc,0x02,0xc6,0x02, 0xd0,0x02,0xda,0x02,0xe4,0x02,0xee,0x02,0xf8,0x02,0x02,0x03,0x0c,0x03,0x16,0x03,0x20,0x03, 0x2a,0x03,0x34,0x03,0x3e,0x03,0x48,0x03,0x52,0x03,0x5c,0x03,0x66,0x03,0x70,0x03,0x7a,0x03, 0x84,0x03,0x8e,0x03,0x98,0x03,0xa2,0x03,0xac,0x03,0xb6,0x03, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x21 '!' 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, 5, // 0x22 '"' 0x00,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x23 '#' 0x00,0x50,0x50,0xf8,0x50,0xf8,0x50,0x50,0x00, 5, // 0x24 '$' 0x00,0x20,0x78,0xa0,0x70,0x28,0xf0,0x20,0x00, 5, // 0x25 '%' 0x00,0xc8,0xc8,0x10,0x20,0x40,0x98,0x98,0x00, 5, // 0x26 '&' 0x00,0x40,0xa0,0xa0,0x40,0xa8,0x90,0x68,0x00, 5, // 0x27 ''' 0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10, 5, // 0x29 ')' 0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x80, 5, // 0x2a '*' 0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00, 5, // 0x2b '+' 0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, 5, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40, 5, // 0x2d '-' 0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00, 5, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, 5, // 0x2f '/' 0x00,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80, 5, // 0x30 '0' 0x00,0x60,0x90,0xb0,0xd0,0x90,0x90,0x60,0x00, 5, // 0x31 '1' 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00, 5, // 0x32 '2' 0x00,0x60,0x90,0x10,0x20,0x40,0x80,0xf0,0x00, 5, // 0x33 '3' 0x00,0xf0,0x10,0x20,0x60,0x10,0x90,0x60,0x00, 5, // 0x34 '4' 0x00,0x30,0x50,0x90,0x90,0xf8,0x10,0x10,0x00, 5, // 0x35 '5' 0x00,0xf0,0x80,0xe0,0x10,0x10,0x10,0xe0,0x00, 5, // 0x36 '6' 0x00,0x60,0x80,0xe0,0x90,0x90,0x90,0x60,0x00, 5, // 0x37 '7' 0x00,0xf0,0x90,0x10,0x20,0x40,0x40,0x40,0x00, 5, // 0x38 '8' 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x60,0x00, 5, // 0x39 '9' 0x00,0x60,0x90,0x90,0x70,0x10,0x90,0x60,0x00, 5, // 0x3a ':' 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00, 5, // 0x3b ';' 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40, 5, // 0x3c '<' 0x00,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00, 5, // 0x3d '=' 0x00,0x00,0x00,0xf0,0x00,0xf0,0x00,0x00,0x00, 5, // 0x3e '>' 0x00,0x80,0x40,0x20,0x10,0x20,0x40,0x80,0x00, 5, // 0x3f '?' 0x00,0x60,0x90,0x10,0x20,0x20,0x00,0x20,0x00, 5, // 0x40 '@' 0x00,0x60,0x90,0xb0,0xb0,0xb0,0x80,0x70,0x00, 5, // 0x41 'A' 0x00,0x60,0x90,0x90,0xf0,0x90,0x90,0x90,0x00, 5, // 0x42 'B' 0x00,0xe0,0x90,0x90,0xe0,0x90,0x90,0xe0,0x00, 5, // 0x43 'C' 0x00,0x60,0x90,0x80,0x80,0x80,0x90,0x60,0x00, 5, // 0x44 'D' 0x00,0xe0,0x90,0x90,0x90,0x90,0x90,0xe0,0x00, 5, // 0x45 'E' 0x00,0xf0,0x80,0x80,0xe0,0x80,0x80,0xf0,0x00, 5, // 0x46 'F' 0x00,0xf0,0x80,0x80,0xe0,0x80,0x80,0x80,0x00, 5, // 0x47 'G' 0x00,0x60,0x90,0x80,0xb0,0x90,0x90,0x60,0x00, 5, // 0x48 'H' 0x00,0x90,0x90,0x90,0xf0,0x90,0x90,0x90,0x00, 5, // 0x49 'I' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00, 5, // 0x4a 'J' 0x00,0x70,0x20,0x20,0x20,0x20,0xa0,0x40,0x00, 5, // 0x4b 'K' 0x00,0x90,0x90,0xa0,0xc0,0xa0,0x90,0x90,0x00, 5, // 0x4c 'L' 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xf0,0x00, 5, // 0x4d 'M' 0x00,0x90,0xf0,0x90,0x90,0x90,0x90,0x90,0x00, 5, // 0x4e 'N' 0x00,0x90,0x90,0xd0,0xb0,0x90,0x90,0x90,0x00, 5, // 0x4f 'O' 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00, 5, // 0x50 'P' 0x00,0xe0,0x90,0x90,0xe0,0x80,0x80,0x80,0x00, 5, // 0x51 'Q' 0x00,0x60,0x90,0x90,0x90,0x90,0xa0,0x50,0x00, 5, // 0x52 'R' 0x00,0xe0,0x90,0x90,0xe0,0xa0,0x90,0x90,0x00, 5, // 0x53 'S' 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x00, 5, // 0x54 'T' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x00, 5, // 0x55 'U' 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, 5, // 0x56 'V' 0x00,0x50,0x50,0x50,0x50,0x50,0x20,0x20,0x00, 5, // 0x57 'W' 0x00,0x90,0x90,0x90,0x90,0x90,0xf0,0x90,0x00, 5, // 0x58 'X' 0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, 5, // 0x59 'Y' 0x00,0x50,0x50,0x50,0x20,0x20,0x20,0x20,0x00, 5, // 0x5a 'Z' 0x00,0xf0,0x10,0x10,0x20,0x40,0x80,0xf0,0x00, 5, // 0x5b '[' 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, 5, // 0x5c '\' 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x00, 5, // 0x5d ']' 0xe0,0x20,0x20,0x20,0x20,0x20,0x20,0xe0,0x00, 5, // 0x5e '^' 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00, 5, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00, 5, // 0x60 '`' 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x61 'a' 0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00, 5, // 0x62 'b' 0x00,0x80,0x80,0xe0,0x90,0x90,0x90,0xe0,0x00, 5, // 0x63 'c' 0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, 5, // 0x64 'd' 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x70,0x00, 5, // 0x65 'e' 0x00,0x00,0x60,0x90,0xf0,0x80,0x80,0x70,0x00, 5, // 0x66 'f' 0x00,0x30,0x40,0x40,0xe0,0x40,0x40,0x40,0x00, 5, // 0x67 'g' 0x00,0x00,0x70,0x90,0x90,0x70,0x10,0x90,0x60, 5, // 0x68 'h' 0x00,0x80,0x80,0xe0,0x90,0x90,0x90,0x90,0x00, 5, // 0x69 'i' 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00, 5, // 0x6a 'j' 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0xa0,0x40, 5, // 0x6b 'k' 0x00,0x80,0x80,0x90,0xa0,0xc0,0xa0,0x90,0x00, 5, // 0x6c 'l' 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, 5, // 0x6d 'm' 0x00,0x00,0xa0,0xf0,0xf0,0xf0,0x90,0x90,0x00, 5, // 0x6e 'n' 0x00,0x00,0xa0,0xd0,0x90,0x90,0x90,0x90,0x00, 5, // 0x6f 'o' 0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, 5, // 0x70 'p' 0x00,0x00,0xe0,0x90,0x90,0x90,0xe0,0x80,0x80, 5, // 0x71 'q' 0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x10, 5, // 0x72 'r' 0x00,0x00,0xe0,0x90,0x80,0x80,0x80,0x80,0x00, 5, // 0x73 's' 0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00, 5, // 0x74 't' 0x00,0x40,0x40,0xe0,0x40,0x40,0x50,0x20,0x00, 5, // 0x75 'u' 0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00, 5, // 0x76 'v' 0x00,0x00,0x50,0x50,0x50,0x50,0x20,0x20,0x00, 5, // 0x77 'w' 0x00,0x00,0x90,0x90,0x90,0x90,0xf0,0x90,0x00, 5, // 0x78 'x' 0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00, 5, // 0x79 'y' 0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0xe0, 5, // 0x7a 'z' 0x00,0x00,0xf0,0x10,0x20,0x40,0x80,0xf0,0x00, 5, // 0x7b '{' 0x10,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x10, 5, // 0x7c '|' 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00, 5, // 0x7d '}' 0x80,0x40,0x40,0x40,0x30,0x40,0x40,0x40,0x80, 5, // 0x7e '~' 0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00, 5, // 0x7f '' 0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00, 0 }; const int8u gse6x12[] = { 12, 0, 32, 128-32, 0x00,0x00,0x0d,0x00,0x1a,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4e,0x00,0x5b,0x00,0x68,0x00, 0x75,0x00,0x82,0x00,0x8f,0x00,0x9c,0x00,0xa9,0x00,0xb6,0x00,0xc3,0x00,0xd0,0x00,0xdd,0x00, 0xea,0x00,0xf7,0x00,0x04,0x01,0x11,0x01,0x1e,0x01,0x2b,0x01,0x38,0x01,0x45,0x01,0x52,0x01, 0x5f,0x01,0x6c,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xa0,0x01,0xad,0x01,0xba,0x01,0xc7,0x01, 0xd4,0x01,0xe1,0x01,0xee,0x01,0xfb,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2f,0x02,0x3c,0x02, 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7d,0x02,0x8a,0x02,0x97,0x02,0xa4,0x02,0xb1,0x02, 0xbe,0x02,0xcb,0x02,0xd8,0x02,0xe5,0x02,0xf2,0x02,0xff,0x02,0x0c,0x03,0x19,0x03,0x26,0x03, 0x33,0x03,0x40,0x03,0x4d,0x03,0x5a,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8e,0x03,0x9b,0x03, 0xa8,0x03,0xb5,0x03,0xc2,0x03,0xcf,0x03,0xdc,0x03,0xe9,0x03,0xf6,0x03,0x03,0x04,0x10,0x04, 0x1d,0x04,0x2a,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5e,0x04,0x6b,0x04,0x78,0x04,0x85,0x04, 0x92,0x04,0x9f,0x04,0xac,0x04,0xb9,0x04,0xc6,0x04,0xd3,0x04, 6, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x21 '!' 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, 6, // 0x22 '"' 0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x23 '#' 0x00,0x50,0x50,0xf8,0x50,0x50,0x50,0xf8,0x50,0x50,0x00,0x00, 6, // 0x24 '$' 0x00,0x20,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x20,0x00,0x00, 6, // 0x25 '%' 0x00,0xc8,0xd8,0x10,0x30,0x20,0x60,0x40,0xd8,0x98,0x00,0x00, 6, // 0x26 '&' 0x00,0x60,0x90,0x90,0x90,0x60,0xa8,0x90,0x90,0x68,0x00,0x00, 6, // 0x27 ''' 0x00,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x28 '(' 0x00,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10,0x00,0x00, 6, // 0x29 ')' 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00,0x00, 6, // 0x2a '*' 0x00,0x00,0x00,0x50,0x20,0xf8,0x20,0x50,0x00,0x00,0x00,0x00, 6, // 0x2b '+' 0x00,0x00,0x20,0x20,0x20,0xf8,0x20,0x20,0x20,0x00,0x00,0x00, 6, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, 6, // 0x2d '-' 0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00, 6, // 0x2f '/' 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00, 6, // 0x30 '0' 0x00,0x70,0x88,0x88,0x98,0xa8,0xc8,0x88,0x88,0x70,0x00,0x00, 6, // 0x31 '1' 0x00,0x20,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 6, // 0x32 '2' 0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x00, 6, // 0x33 '3' 0x00,0xf8,0x10,0x20,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00, 6, // 0x34 '4' 0x00,0x10,0x20,0x40,0x90,0x90,0xf8,0x10,0x10,0x10,0x00,0x00, 6, // 0x35 '5' 0x00,0xf8,0x80,0x80,0xf0,0x08,0x08,0x08,0x88,0x70,0x00,0x00, 6, // 0x36 '6' 0x00,0x70,0x88,0x80,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0x00, 6, // 0x37 '7' 0x00,0xf8,0x88,0x08,0x08,0x10,0x20,0x20,0x20,0x20,0x00,0x00, 6, // 0x38 '8' 0x00,0x70,0x88,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00, 6, // 0x39 '9' 0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x08,0x88,0x70,0x00,0x00, 6, // 0x3a ':' 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x00,0x00,0x00, 6, // 0x3b ';' 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40, 6, // 0x3c '<' 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00,0x00, 6, // 0x3d '=' 0x00,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00,0x00,0x00, 6, // 0x3e '>' 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00,0x00, 6, // 0x3f '?' 0x00,0x70,0x88,0x88,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00, 6, // 0x40 '@' 0x00,0x70,0x88,0x88,0xb8,0xb8,0xb0,0x80,0x88,0x70,0x00,0x00, 6, // 0x41 'A' 0x00,0x20,0x50,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x00, 6, // 0x42 'B' 0x00,0xf0,0x88,0x88,0x88,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00, 6, // 0x43 'C' 0x00,0x70,0x88,0x88,0x80,0x80,0x80,0x88,0x88,0x70,0x00,0x00, 6, // 0x44 'D' 0x00,0xe0,0x90,0x88,0x88,0x88,0x88,0x88,0x90,0xe0,0x00,0x00, 6, // 0x45 'E' 0x00,0xf8,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0xf8,0x00,0x00, 6, // 0x46 'F' 0x00,0xf8,0x80,0x80,0x80,0xf0,0x80,0x80,0x80,0x80,0x00,0x00, 6, // 0x47 'G' 0x00,0x70,0x88,0x80,0x80,0xb8,0x88,0x88,0x88,0x70,0x00,0x00, 6, // 0x48 'H' 0x00,0x88,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x88,0x00,0x00, 6, // 0x49 'I' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 6, // 0x4a 'J' 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00,0x00, 6, // 0x4b 'K' 0x00,0x88,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x88,0x00,0x00, 6, // 0x4c 'L' 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x00, 6, // 0x4d 'M' 0x00,0x88,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x88,0x00,0x00, 6, // 0x4e 'N' 0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x88,0x00,0x00, 6, // 0x4f 'O' 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, 6, // 0x50 'P' 0x00,0xf0,0x88,0x88,0x88,0xf0,0x80,0x80,0x80,0x80,0x00,0x00, 6, // 0x51 'Q' 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0xa8,0x90,0x68,0x00,0x00, 6, // 0x52 'R' 0x00,0xf0,0x88,0x88,0x88,0x88,0xf0,0xa0,0x90,0x88,0x00,0x00, 6, // 0x53 'S' 0x00,0x70,0x88,0x80,0x80,0x70,0x08,0x08,0x88,0x70,0x00,0x00, 6, // 0x54 'T' 0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, 6, // 0x55 'U' 0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, 6, // 0x56 'V' 0x00,0x88,0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00,0x00, 6, // 0x57 'W' 0x00,0x88,0x88,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00,0x00, 6, // 0x58 'X' 0x00,0x88,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x88,0x00,0x00, 6, // 0x59 'Y' 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x20,0x00,0x00, 6, // 0x5a 'Z' 0x00,0xf8,0x08,0x08,0x10,0x20,0x40,0x80,0x80,0xf8,0x00,0x00, 6, // 0x5b '[' 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, 6, // 0x5c '\' 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00,0x00, 6, // 0x5d ']' 0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, 6, // 0x5e '^' 0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00, 6, // 0x60 '`' 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x61 'a' 0x00,0x00,0x00,0x70,0x88,0x08,0x78,0x88,0x88,0x78,0x00,0x00, 6, // 0x62 'b' 0x00,0x80,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0xf0,0x00,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00,0x00, 6, // 0x64 'd' 0x00,0x08,0x08,0x08,0x78,0x88,0x88,0x88,0x88,0x78,0x00,0x00, 6, // 0x65 'e' 0x00,0x00,0x00,0x70,0x88,0x88,0xf8,0x80,0x80,0x78,0x00,0x00, 6, // 0x66 'f' 0x00,0x18,0x20,0x20,0xf8,0x20,0x20,0x20,0x20,0x20,0x00,0x00, 6, // 0x67 'g' 0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x08,0xf0, 6, // 0x68 'h' 0x00,0x80,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x88,0x00,0x00, 6, // 0x69 'i' 0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 6, // 0x6a 'j' 0x00,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x90,0x60, 6, // 0x6b 'k' 0x00,0x80,0x80,0x80,0x88,0x90,0xa0,0xd0,0x88,0x88,0x00,0x00, 6, // 0x6c 'l' 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 6, // 0x6d 'm' 0x00,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0x00,0x00, 6, // 0x6e 'n' 0x00,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x88,0x88,0x00,0x00, 6, // 0x6f 'o' 0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, 6, // 0x70 'p' 0x00,0x00,0x00,0xf0,0x88,0x88,0x88,0x88,0xf0,0x80,0x80,0x80, 6, // 0x71 'q' 0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x88,0x78,0x08,0x08,0x08, 6, // 0x72 'r' 0x00,0x00,0x00,0xb0,0xc8,0x88,0x80,0x80,0x80,0x80,0x00,0x00, 6, // 0x73 's' 0x00,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00,0x00, 6, // 0x74 't' 0x00,0x40,0x40,0x40,0xe0,0x40,0x40,0x40,0x48,0x30,0x00,0x00, 6, // 0x75 'u' 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x78,0x00,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00,0x00, 6, // 0x77 'w' 0x00,0x00,0x00,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00,0x00, 6, // 0x78 'x' 0x00,0x00,0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00,0x00, 6, // 0x79 'y' 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x78,0x08,0x10,0xe0, 6, // 0x7a 'z' 0x00,0x00,0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x00, 6, // 0x7b '{' 0x18,0x20,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x20,0x18,0x00, 6, // 0x7c '|' 0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00,0x00, 6, // 0x7d '}' 0xc0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xc0,0x00, 6, // 0x7e '~' 0x00,0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x7f '' 0x00,0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00,0x00,0x00, 0 }; const int8u gse6x9[] = { 9, 0, 32, 128-32, 0x00,0x00,0x0a,0x00,0x14,0x00,0x1e,0x00,0x28,0x00,0x32,0x00,0x3c,0x00,0x46,0x00,0x50,0x00, 0x5a,0x00,0x64,0x00,0x6e,0x00,0x78,0x00,0x82,0x00,0x8c,0x00,0x96,0x00,0xa0,0x00,0xaa,0x00, 0xb4,0x00,0xbe,0x00,0xc8,0x00,0xd2,0x00,0xdc,0x00,0xe6,0x00,0xf0,0x00,0xfa,0x00,0x04,0x01, 0x0e,0x01,0x18,0x01,0x22,0x01,0x2c,0x01,0x36,0x01,0x40,0x01,0x4a,0x01,0x54,0x01,0x5e,0x01, 0x68,0x01,0x72,0x01,0x7c,0x01,0x86,0x01,0x90,0x01,0x9a,0x01,0xa4,0x01,0xae,0x01,0xb8,0x01, 0xc2,0x01,0xcc,0x01,0xd6,0x01,0xe0,0x01,0xea,0x01,0xf4,0x01,0xfe,0x01,0x08,0x02,0x12,0x02, 0x1c,0x02,0x26,0x02,0x30,0x02,0x3a,0x02,0x44,0x02,0x4e,0x02,0x58,0x02,0x62,0x02,0x6c,0x02, 0x76,0x02,0x80,0x02,0x8a,0x02,0x94,0x02,0x9e,0x02,0xa8,0x02,0xb2,0x02,0xbc,0x02,0xc6,0x02, 0xd0,0x02,0xda,0x02,0xe4,0x02,0xee,0x02,0xf8,0x02,0x02,0x03,0x0c,0x03,0x16,0x03,0x20,0x03, 0x2a,0x03,0x34,0x03,0x3e,0x03,0x48,0x03,0x52,0x03,0x5c,0x03,0x66,0x03,0x70,0x03,0x7a,0x03, 0x84,0x03,0x8e,0x03,0x98,0x03,0xa2,0x03,0xac,0x03,0xb6,0x03, 6, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x21 '!' 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, 6, // 0x22 '"' 0x00,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x23 '#' 0x00,0x50,0x50,0xf8,0x50,0xf8,0x50,0x50,0x00, 6, // 0x24 '$' 0x00,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x00, 6, // 0x25 '%' 0x00,0xc8,0xc8,0x10,0x20,0x40,0x98,0x98,0x00, 6, // 0x26 '&' 0x00,0x60,0x90,0x90,0x60,0xa8,0x90,0x68,0x00, 6, // 0x27 ''' 0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x28 '(' 0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10, 6, // 0x29 ')' 0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40, 6, // 0x2a '*' 0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00, 6, // 0x2b '+' 0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00, 6, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40, 6, // 0x2d '-' 0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00, 6, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, 6, // 0x2f '/' 0x00,0x08,0x08,0x10,0x20,0x40,0x80,0x80,0x00, 6, // 0x30 '0' 0x00,0x70,0x88,0x98,0xa8,0xc8,0x88,0x70,0x00, 6, // 0x31 '1' 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00, 6, // 0x32 '2' 0x00,0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00, 6, // 0x33 '3' 0x00,0xf8,0x10,0x20,0x70,0x08,0x88,0x70,0x00, 6, // 0x34 '4' 0x00,0x10,0x20,0x40,0x90,0xf8,0x10,0x10,0x00, 6, // 0x35 '5' 0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00, 6, // 0x36 '6' 0x00,0x70,0x88,0x80,0xf0,0x88,0x88,0x70,0x00, 6, // 0x37 '7' 0x00,0xf8,0x08,0x08,0x10,0x20,0x40,0x40,0x00, 6, // 0x38 '8' 0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00, 6, // 0x39 '9' 0x00,0x70,0x88,0x88,0x78,0x08,0x88,0x70,0x00, 6, // 0x3a ':' 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00, 6, // 0x3b ';' 0x00,0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40, 6, // 0x3c '<' 0x00,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x00, 6, // 0x3d '=' 0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00, 6, // 0x3e '>' 0x00,0x80,0x40,0x20,0x10,0x20,0x40,0x80,0x00, 6, // 0x3f '?' 0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00, 6, // 0x40 '@' 0x00,0x70,0x88,0x88,0xb8,0xb8,0x80,0x70,0x00, 6, // 0x41 'A' 0x00,0x20,0x50,0x88,0x88,0xf8,0x88,0x88,0x00, 6, // 0x42 'B' 0x00,0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00, 6, // 0x43 'C' 0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00, 6, // 0x44 'D' 0x00,0xe0,0x90,0x88,0x88,0x88,0x90,0xe0,0x00, 6, // 0x45 'E' 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00, 6, // 0x46 'F' 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00, 6, // 0x47 'G' 0x00,0x70,0x88,0x80,0xb8,0x88,0x88,0x70,0x00, 6, // 0x48 'H' 0x00,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00, 6, // 0x49 'I' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00, 6, // 0x4a 'J' 0x00,0x38,0x10,0x10,0x10,0x10,0x90,0x60,0x00, 6, // 0x4b 'K' 0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00, 6, // 0x4c 'L' 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00, 6, // 0x4d 'M' 0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00, 6, // 0x4e 'N' 0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x00, 6, // 0x4f 'O' 0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00, 6, // 0x50 'P' 0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00, 6, // 0x51 'Q' 0x00,0x70,0x88,0x88,0x88,0xa8,0x90,0x68,0x00, 6, // 0x52 'R' 0x00,0xf0,0x88,0x88,0x88,0xf0,0x90,0x88,0x00, 6, // 0x53 'S' 0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00, 6, // 0x54 'T' 0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00, 6, // 0x55 'U' 0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00, 6, // 0x56 'V' 0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00, 6, // 0x57 'W' 0x00,0x88,0x88,0x88,0xa8,0xa8,0xd8,0x88,0x00, 6, // 0x58 'X' 0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00, 6, // 0x59 'Y' 0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00, 6, // 0x5a 'Z' 0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00, 6, // 0x5b '[' 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, 6, // 0x5c '\' 0x00,0x80,0x80,0x40,0x20,0x10,0x08,0x08,0x00, 6, // 0x5d ']' 0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, 6, // 0x5e '^' 0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00, 6, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00, 6, // 0x60 '`' 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x61 'a' 0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00, 6, // 0x62 'b' 0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x70,0x88,0x80,0x88,0x70,0x00, 6, // 0x64 'd' 0x00,0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00, 6, // 0x65 'e' 0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00, 6, // 0x66 'f' 0x00,0x18,0x20,0x20,0xf8,0x20,0x20,0x20,0x00, 6, // 0x67 'g' 0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70, 6, // 0x68 'h' 0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00, 6, // 0x69 'i' 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00, 6, // 0x6a 'j' 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x90,0x60, 6, // 0x6b 'k' 0x00,0x00,0x80,0x88,0x90,0xa0,0xd0,0x88,0x00, 6, // 0x6c 'l' 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, 6, // 0x6d 'm' 0x00,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0x00, 6, // 0x6e 'n' 0x00,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00, 6, // 0x6f 'o' 0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00, 6, // 0x70 'p' 0x00,0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80, 6, // 0x71 'q' 0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08, 6, // 0x72 'r' 0x00,0x00,0x00,0xb8,0xc0,0x80,0x80,0x80,0x00, 6, // 0x73 's' 0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00, 6, // 0x74 't' 0x00,0x40,0x40,0xe0,0x40,0x40,0x48,0x30,0x00, 6, // 0x75 'u' 0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x78,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00, 6, // 0x77 'w' 0x00,0x00,0x00,0x88,0x88,0xa8,0xd8,0x88,0x00, 6, // 0x78 'x' 0x00,0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00, 6, // 0x79 'y' 0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70, 6, // 0x7a 'z' 0x00,0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00, 6, // 0x7b '{' 0x18,0x20,0x20,0x20,0xc0,0x20,0x20,0x20,0x18, 6, // 0x7c '|' 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00, 6, // 0x7d '}' 0xc0,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0xc0, 6, // 0x7e '~' 0x00,0x40,0xa8,0x10,0x00,0x00,0x00,0x00,0x00, 6, // 0x7f '' 0x00,0x00,0x00,0x20,0x50,0x88,0xf8,0x00,0x00, 0 }; const int8u gse7x11[] = { 11, 0, 32, 128-32, 0x00,0x00,0x0c,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3c,0x00,0x48,0x00,0x54,0x00,0x60,0x00, 0x6c,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9c,0x00,0xa8,0x00,0xb4,0x00,0xc0,0x00,0xcc,0x00, 0xd8,0x00,0xe4,0x00,0xf0,0x00,0xfc,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2c,0x01,0x38,0x01, 0x44,0x01,0x50,0x01,0x5c,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8c,0x01,0x98,0x01,0xa4,0x01, 0xb0,0x01,0xbc,0x01,0xc8,0x01,0xd4,0x01,0xe0,0x01,0xec,0x01,0xf8,0x01,0x04,0x02,0x10,0x02, 0x1c,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4c,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7c,0x02, 0x88,0x02,0x94,0x02,0xa0,0x02,0xac,0x02,0xb8,0x02,0xc4,0x02,0xd0,0x02,0xdc,0x02,0xe8,0x02, 0xf4,0x02,0x00,0x03,0x0c,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3c,0x03,0x48,0x03,0x54,0x03, 0x60,0x03,0x6c,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9c,0x03,0xa8,0x03,0xb4,0x03,0xc0,0x03, 0xcc,0x03,0xd8,0x03,0xe4,0x03,0xf0,0x03,0xfc,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2c,0x04, 0x38,0x04,0x44,0x04,0x50,0x04,0x5c,0x04,0x68,0x04,0x74,0x04, 7, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x21 '!' 0x00,0x10,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x00,0x00, 7, // 0x22 '"' 0x00,0x00,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x23 '#' 0x00,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x00,0x00, 7, // 0x24 '$' 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, 7, // 0x25 '%' 0x00,0x00,0x42,0xa4,0x48,0x10,0x24,0x4a,0x84,0x00,0x00, 7, // 0x26 '&' 0x00,0x30,0x48,0x48,0x30,0x60,0x94,0x98,0x6c,0x00,0x00, 7, // 0x27 ''' 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x28 '(' 0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x08,0x04,0x00,0x00, 7, // 0x29 ')' 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x20,0x40,0x00,0x00, 7, // 0x2a '*' 0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00, 7, // 0x2b '+' 0x00,0x00,0x00,0x10,0x10,0x7c,0x10,0x10,0x00,0x00,0x00, 7, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60, 7, // 0x2d '-' 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00, 7, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, 7, // 0x2f '/' 0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, 7, // 0x30 '0' 0x00,0x38,0x44,0x4c,0x54,0x64,0x44,0x44,0x38,0x00,0x00, 7, // 0x31 '1' 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00, 7, // 0x32 '2' 0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x44,0x7c,0x00,0x00, 7, // 0x33 '3' 0x00,0x7c,0x48,0x10,0x38,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x34 '4' 0x00,0x08,0x10,0x20,0x48,0x48,0x7c,0x08,0x1c,0x00,0x00, 7, // 0x35 '5' 0x00,0x7c,0x40,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x36 '6' 0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x37 '7' 0x00,0x7c,0x44,0x04,0x08,0x10,0x10,0x10,0x10,0x00,0x00, 7, // 0x38 '8' 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x39 '9' 0x00,0x38,0x44,0x44,0x44,0x3c,0x04,0x08,0x30,0x00,0x00, 7, // 0x3a ':' 0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x00,0x00, 7, // 0x3b ';' 0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x30,0x30,0x60,0x00, 7, // 0x3c '<' 0x00,0x00,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00,0x00, 7, // 0x3d '=' 0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00, 7, // 0x3e '>' 0x00,0x00,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x00, 7, // 0x3f '?' 0x00,0x70,0x88,0x88,0x10,0x20,0x20,0x00,0x20,0x00,0x00, 7, // 0x40 '@' 0x00,0x30,0x48,0x04,0x34,0x54,0x54,0x54,0x28,0x00,0x00, 7, // 0x41 'A' 0x00,0x10,0x28,0x44,0x44,0x7c,0x44,0x44,0x44,0x00,0x00, 7, // 0x42 'B' 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, 7, // 0x43 'C' 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, 7, // 0x44 'D' 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, 7, // 0x45 'E' 0x00,0x7c,0x40,0x40,0x70,0x40,0x40,0x40,0x7c,0x00,0x00, 7, // 0x46 'F' 0x00,0x7c,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x00,0x00, 7, // 0x47 'G' 0x00,0x38,0x44,0x40,0x40,0x5c,0x44,0x44,0x38,0x00,0x00, 7, // 0x48 'H' 0x00,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x49 'I' 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 7, // 0x4a 'J' 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x48,0x30,0x00,0x00, 7, // 0x4b 'K' 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x00,0x00, 7, // 0x4c 'L' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7c,0x00,0x00, 7, // 0x4d 'M' 0x00,0x44,0x6c,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x4e 'N' 0x00,0x44,0x44,0x64,0x54,0x4c,0x44,0x44,0x44,0x00,0x00, 7, // 0x4f 'O' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x50 'P' 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, 7, // 0x51 'Q' 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, 7, // 0x52 'R' 0x00,0x78,0x44,0x44,0x44,0x78,0x50,0x48,0x44,0x00,0x00, 7, // 0x53 'S' 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00, 7, // 0x54 'T' 0x00,0x7c,0x54,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 7, // 0x55 'U' 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x56 'V' 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, 7, // 0x57 'W' 0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00, 7, // 0x58 'X' 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, 7, // 0x59 'Y' 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x38,0x00,0x00, 7, // 0x5a 'Z' 0x00,0x7c,0x04,0x08,0x10,0x20,0x40,0x44,0x7c,0x00,0x00, 7, // 0x5b '[' 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00,0x00, 7, // 0x5c '\' 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00,0x00, 7, // 0x5d ']' 0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00, 7, // 0x5e '^' 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00, 7, // 0x60 '`' 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x61 'a' 0x00,0x00,0x00,0x38,0x04,0x3c,0x44,0x44,0x3c,0x00,0x00, 7, // 0x62 'b' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, 7, // 0x63 'c' 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, 7, // 0x64 'd' 0x00,0x04,0x04,0x3c,0x44,0x44,0x44,0x44,0x3c,0x00,0x00, 7, // 0x65 'e' 0x00,0x00,0x00,0x38,0x44,0x7c,0x40,0x44,0x38,0x00,0x00, 7, // 0x66 'f' 0x00,0x18,0x24,0x20,0x70,0x20,0x20,0x20,0x70,0x00,0x00, 7, // 0x67 'g' 0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x3c,0x04,0x44,0x38, 7, // 0x68 'h' 0x00,0x40,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0x00,0x00, 7, // 0x69 'i' 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 7, // 0x6a 'j' 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x48,0x30,0x00, 7, // 0x6b 'k' 0x00,0x40,0x40,0x44,0x48,0x50,0x68,0x44,0x44,0x00,0x00, 7, // 0x6c 'l' 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 7, // 0x6d 'm' 0x00,0x00,0x00,0xa8,0x54,0x54,0x54,0x54,0x54,0x00,0x00, 7, // 0x6e 'n' 0x00,0x00,0x00,0xb8,0x44,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x6f 'o' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x70 'p' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, 7, // 0x71 'q' 0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x44,0x3c,0x04,0x04, 7, // 0x72 'r' 0x00,0x00,0x00,0x58,0x64,0x44,0x40,0x40,0x40,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x3c,0x40,0x38,0x04,0x04,0x78,0x00,0x00, 7, // 0x74 't' 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x24,0x18,0x00,0x00, 7, // 0x75 'u' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00, 7, // 0x76 'v' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x00,0x00, 7, // 0x77 'w' 0x00,0x00,0x00,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0x44,0x44,0x44,0x3c,0x04,0x08,0x30,0x00, 7, // 0x7a 'z' 0x00,0x00,0x00,0x7c,0x08,0x10,0x20,0x44,0x7c,0x00,0x00, 7, // 0x7b '{' 0x00,0x0c,0x10,0x10,0x10,0x60,0x10,0x10,0x0c,0x00,0x00, 7, // 0x7c '|' 0x00,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00,0x00, 7, // 0x7d '}' 0x00,0x60,0x10,0x10,0x10,0x0c,0x10,0x10,0x60,0x00,0x00, 7, // 0x7e '~' 0x00,0x00,0x64,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x7f '' 0x00,0x00,0x00,0x10,0x28,0x44,0x44,0x7c,0x00,0x00,0x00, 0 }; const int8u gse7x11_bold[] = { 11, 0, 32, 128-32, 0x00,0x00,0x0c,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3c,0x00,0x48,0x00,0x54,0x00,0x60,0x00, 0x6c,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9c,0x00,0xa8,0x00,0xb4,0x00,0xc0,0x00,0xcc,0x00, 0xd8,0x00,0xe4,0x00,0xf0,0x00,0xfc,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2c,0x01,0x38,0x01, 0x44,0x01,0x50,0x01,0x5c,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8c,0x01,0x98,0x01,0xa4,0x01, 0xb0,0x01,0xbc,0x01,0xc8,0x01,0xd4,0x01,0xe0,0x01,0xec,0x01,0xf8,0x01,0x04,0x02,0x10,0x02, 0x1c,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4c,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7c,0x02, 0x88,0x02,0x94,0x02,0xa0,0x02,0xac,0x02,0xb8,0x02,0xc4,0x02,0xd0,0x02,0xdc,0x02,0xe8,0x02, 0xf4,0x02,0x00,0x03,0x0c,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3c,0x03,0x48,0x03,0x54,0x03, 0x60,0x03,0x6c,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9c,0x03,0xa8,0x03,0xb4,0x03,0xc0,0x03, 0xcc,0x03,0xd8,0x03,0xe4,0x03,0xf0,0x03,0xfc,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2c,0x04, 0x38,0x04,0x44,0x04,0x50,0x04,0x5c,0x04,0x68,0x04,0x74,0x04, 7, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x21 '!' 0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00, 7, // 0x22 '"' 0x00,0x6c,0x6c,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x23 '#' 0x00,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x00,0x00, 7, // 0x24 '$' 0x30,0x30,0x78,0xcc,0xc0,0x78,0x0c,0xcc,0x78,0x30,0x30, 7, // 0x25 '%' 0x00,0x00,0xc4,0x0c,0x18,0x30,0x60,0xc0,0x8c,0x00,0x00, 7, // 0x26 '&' 0x00,0x30,0x58,0x58,0x30,0x74,0xdc,0xd8,0x6c,0x00,0x00, 7, // 0x27 ''' 0x00,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x28 '(' 0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x18,0x0c,0x00,0x00, 7, // 0x29 ')' 0x00,0xc0,0x60,0x30,0x30,0x30,0x30,0x60,0xc0,0x00,0x00, 7, // 0x2a '*' 0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00, 7, // 0x2b '+' 0x00,0x00,0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,0x00, 7, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00, 7, // 0x2d '-' 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00, 7, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, 7, // 0x2f '/' 0x00,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0x00,0x00, 7, // 0x30 '0' 0x00,0x78,0xcc,0xcc,0xdc,0xec,0xcc,0xcc,0x78,0x00,0x00, 7, // 0x31 '1' 0x00,0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0xfc,0x00,0x00, 7, // 0x32 '2' 0x00,0x78,0xcc,0xcc,0x18,0x30,0x60,0xcc,0xfc,0x00,0x00, 7, // 0x33 '3' 0x00,0xfc,0x98,0x30,0x78,0x0c,0x0c,0xcc,0x78,0x00,0x00, 7, // 0x34 '4' 0x00,0x18,0x30,0x68,0xd8,0xd8,0xfc,0x18,0x3c,0x00,0x00, 7, // 0x35 '5' 0x00,0xfc,0xc0,0xc0,0xf8,0x0c,0x0c,0xcc,0x78,0x00,0x00, 7, // 0x36 '6' 0x00,0x38,0x60,0xc0,0xf8,0xcc,0xcc,0xcc,0x78,0x00,0x00, 7, // 0x37 '7' 0x00,0xfc,0x8c,0x0c,0x18,0x30,0x30,0x30,0x30,0x00,0x00, 7, // 0x38 '8' 0x00,0x78,0xcc,0xcc,0x78,0xcc,0xcc,0xcc,0x78,0x00,0x00, 7, // 0x39 '9' 0x00,0x78,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0x70,0x00,0x00, 7, // 0x3a ':' 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00, 7, // 0x3b ';' 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x60,0x00, 7, // 0x3c '<' 0x00,0x00,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,0x00, 7, // 0x3d '=' 0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00, 7, // 0x3e '>' 0x00,0x00,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0x00,0x00, 7, // 0x3f '?' 0x00,0x78,0xcc,0xcc,0x18,0x30,0x30,0x00,0x30,0x00,0x00, 7, // 0x40 '@' 0x00,0x70,0x88,0x04,0x74,0xb4,0xb4,0xb4,0x68,0x00,0x00, 7, // 0x41 'A' 0x00,0x30,0x78,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0x00,0x00, 7, // 0x42 'B' 0x00,0xf8,0xcc,0xcc,0xf8,0xcc,0xcc,0xcc,0xf8,0x00,0x00, 7, // 0x43 'C' 0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xc0,0xcc,0x78,0x00,0x00, 7, // 0x44 'D' 0x00,0xf0,0xd8,0xcc,0xcc,0xcc,0xcc,0xd8,0xf0,0x00,0x00, 7, // 0x45 'E' 0x00,0xfc,0xc4,0xd0,0xf0,0xd0,0xc0,0xc4,0xfc,0x00,0x00, 7, // 0x46 'F' 0x00,0xfc,0xc4,0xd0,0xf0,0xd0,0xc0,0xc0,0xc0,0x00,0x00, 7, // 0x47 'G' 0x00,0x78,0xcc,0xc0,0xc0,0xdc,0xcc,0xcc,0x78,0x00,0x00, 7, // 0x48 'H' 0x00,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0x00,0x00, 7, // 0x49 'I' 0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, 7, // 0x4a 'J' 0x00,0x3c,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00,0x00, 7, // 0x4b 'K' 0x00,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0xcc,0xcc,0x00,0x00, 7, // 0x4c 'L' 0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc4,0xfc,0x00,0x00, 7, // 0x4d 'M' 0x00,0x84,0xcc,0xfc,0xb4,0xcc,0xcc,0xcc,0xcc,0x00,0x00, 7, // 0x4e 'N' 0x00,0xcc,0xcc,0xec,0xfc,0xdc,0xcc,0xcc,0xcc,0x00,0x00, 7, // 0x4f 'O' 0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, 7, // 0x50 'P' 0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0x00,0x00, 7, // 0x51 'Q' 0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xdc,0x78,0x18,0x0c,0x00, 7, // 0x52 'R' 0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xd8,0xcc,0xcc,0x00,0x00, 7, // 0x53 'S' 0x00,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x00,0x00, 7, // 0x54 'T' 0x00,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00, 7, // 0x55 'U' 0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, 7, // 0x56 'V' 0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00, 7, // 0x57 'W' 0x00,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00, 7, // 0x58 'X' 0x00,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0x00,0x00, 7, // 0x59 'Y' 0x00,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x78,0x00,0x00, 7, // 0x5a 'Z' 0x00,0xfc,0x8c,0x18,0x30,0x60,0xc0,0xc4,0xfc,0x00,0x00, 7, // 0x5b '[' 0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00, 7, // 0x5c '\' 0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x00,0x00, 7, // 0x5d ']' 0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00, 7, // 0x5e '^' 0x00,0x10,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00, 7, // 0x60 '`' 0x00,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x61 'a' 0x00,0x00,0x00,0x70,0x18,0x78,0xd8,0xd8,0x6c,0x00,0x00, 7, // 0x62 'b' 0x00,0x60,0x60,0x60,0x78,0x6c,0x6c,0x6c,0x78,0x00,0x00, 7, // 0x63 'c' 0x00,0x00,0x00,0x78,0xcc,0xc0,0xc0,0xcc,0x78,0x00,0x00, 7, // 0x64 'd' 0x00,0x18,0x18,0x18,0x78,0xd8,0xd8,0xd8,0x6c,0x00,0x00, 7, // 0x65 'e' 0x00,0x00,0x00,0x78,0xcc,0xfc,0xc0,0xcc,0x78,0x00,0x00, 7, // 0x66 'f' 0x00,0x18,0x34,0x30,0x78,0x30,0x30,0x30,0x78,0x00,0x00, 7, // 0x67 'g' 0x00,0x00,0x00,0x6c,0xd8,0xd8,0xd8,0x78,0x18,0xd8,0x70, 7, // 0x68 'h' 0x00,0xc0,0xc0,0xd8,0xec,0xcc,0xcc,0xcc,0xcc,0x00,0x00, 7, // 0x69 'i' 0x00,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x78,0x00,0x00, 7, // 0x6a 'j' 0x00,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x6c,0x6c,0x38, 7, // 0x6b 'k' 0x00,0xc0,0xc0,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0x00,0x00, 7, // 0x6c 'l' 0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, 7, // 0x6d 'm' 0x00,0x00,0x00,0xe8,0xfc,0xd4,0xd4,0xc4,0xc4,0x00,0x00, 7, // 0x6e 'n' 0x00,0x00,0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00, 7, // 0x6f 'o' 0x00,0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00, 7, // 0x70 'p' 0x00,0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0, 7, // 0x71 'q' 0x00,0x00,0x00,0x7c,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x0c, 7, // 0x72 'r' 0x00,0x00,0x00,0xd8,0xec,0xcc,0xc0,0xc0,0xc0,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x78,0xcc,0x60,0x18,0xcc,0x78,0x00,0x00, 7, // 0x74 't' 0x00,0x20,0x60,0x60,0xf0,0x60,0x60,0x68,0x30,0x00,0x00, 7, // 0x75 'u' 0x00,0x00,0x00,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00, 7, // 0x76 'v' 0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00, 7, // 0x77 'w' 0x00,0x00,0x00,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0xcc,0x78,0x30,0x78,0xcc,0xcc,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0xf0, 7, // 0x7a 'z' 0x00,0x00,0x00,0xfc,0x98,0x30,0x60,0xc4,0xfc,0x00,0x00, 7, // 0x7b '{' 0x1c,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x1c,0x00,0x00, 7, // 0x7c '|' 0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x30,0x30,0x00,0x00, 7, // 0x7d '}' 0xe0,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0xe0,0x00,0x00, 7, // 0x7e '~' 0x00,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x7f '' 0x00,0x00,0x00,0x30,0x78,0xcc,0xcc,0xfc,0x00,0x00,0x00, 0 }; const int8u gse7x15[] = { 15, 0, 32, 128-32, 0x00,0x00,0x10,0x00,0x20,0x00,0x30,0x00,0x40,0x00,0x50,0x00,0x60,0x00,0x70,0x00,0x80,0x00, 0x90,0x00,0xa0,0x00,0xb0,0x00,0xc0,0x00,0xd0,0x00,0xe0,0x00,0xf0,0x00,0x00,0x01,0x10,0x01, 0x20,0x01,0x30,0x01,0x40,0x01,0x50,0x01,0x60,0x01,0x70,0x01,0x80,0x01,0x90,0x01,0xa0,0x01, 0xb0,0x01,0xc0,0x01,0xd0,0x01,0xe0,0x01,0xf0,0x01,0x00,0x02,0x10,0x02,0x20,0x02,0x30,0x02, 0x40,0x02,0x50,0x02,0x60,0x02,0x70,0x02,0x80,0x02,0x90,0x02,0xa0,0x02,0xb0,0x02,0xc0,0x02, 0xd0,0x02,0xe0,0x02,0xf0,0x02,0x00,0x03,0x10,0x03,0x20,0x03,0x30,0x03,0x40,0x03,0x50,0x03, 0x60,0x03,0x70,0x03,0x80,0x03,0x90,0x03,0xa0,0x03,0xb0,0x03,0xc0,0x03,0xd0,0x03,0xe0,0x03, 0xf0,0x03,0x00,0x04,0x10,0x04,0x20,0x04,0x30,0x04,0x40,0x04,0x50,0x04,0x60,0x04,0x70,0x04, 0x80,0x04,0x90,0x04,0xa0,0x04,0xb0,0x04,0xc0,0x04,0xd0,0x04,0xe0,0x04,0xf0,0x04,0x00,0x05, 0x10,0x05,0x20,0x05,0x30,0x05,0x40,0x05,0x50,0x05,0x60,0x05,0x70,0x05,0x80,0x05,0x90,0x05, 0xa0,0x05,0xb0,0x05,0xc0,0x05,0xd0,0x05,0xe0,0x05,0xf0,0x05, 7, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x21 '!' 0x00,0x00,0x10,0x38,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, 7, // 0x22 '"' 0x00,0x00,0x24,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x23 '#' 0x00,0x00,0x48,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x48,0x00,0x00,0x00, 7, // 0x24 '$' 0x00,0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x54,0x38,0x10,0x00,0x00,0x00, 7, // 0x25 '%' 0x00,0x00,0x44,0x44,0x08,0x08,0x10,0x10,0x20,0x20,0x44,0x44,0x00,0x00,0x00, 7, // 0x26 '&' 0x00,0x00,0x00,0x30,0x48,0x48,0x30,0x60,0x94,0x98,0x90,0x6c,0x00,0x00,0x00, 7, // 0x27 ''' 0x00,0x00,0x20,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x28 '(' 0x00,0x04,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x08,0x04,0x00,0x00,0x00, 7, // 0x29 ')' 0x00,0x40,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x20,0x40,0x00,0x00,0x00, 7, // 0x2a '*' 0x00,0x00,0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00,0x00,0x00, 7, // 0x2b '+' 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x00,0x00,0x00,0x00, 7, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, 7, // 0x2d '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, 7, // 0x2f '/' 0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00,0x00, 7, // 0x30 '0' 0x00,0x00,0x38,0x44,0x44,0x4c,0x54,0x64,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x31 '1' 0x00,0x00,0x10,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00,0x00, 7, // 0x32 '2' 0x00,0x00,0x38,0x44,0x44,0x04,0x08,0x10,0x20,0x40,0x44,0x7c,0x00,0x00,0x00, 7, // 0x33 '3' 0x00,0x00,0x7c,0x44,0x08,0x10,0x38,0x04,0x04,0x04,0x44,0x38,0x00,0x00,0x00, 7, // 0x34 '4' 0x00,0x00,0x08,0x10,0x20,0x40,0x48,0x48,0x7c,0x08,0x08,0x1c,0x00,0x00,0x00, 7, // 0x35 '5' 0x00,0x00,0x7c,0x40,0x40,0x40,0x78,0x04,0x04,0x04,0x44,0x38,0x00,0x00,0x00, 7, // 0x36 '6' 0x00,0x00,0x18,0x20,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x37 '7' 0x00,0x00,0x7c,0x44,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x00,0x00,0x00, 7, // 0x38 '8' 0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x39 '9' 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x08,0x30,0x00,0x00,0x00, 7, // 0x3a ':' 0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00, 7, // 0x3b ';' 0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00, 7, // 0x3c '<' 0x00,0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00,0x00, 7, // 0x3d '=' 0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x3e '>' 0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00, 7, // 0x3f '?' 0x00,0x00,0x78,0x84,0x84,0x84,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00,0x00, 7, // 0x40 '@' 0x00,0x00,0x00,0x30,0x48,0x04,0x34,0x54,0x54,0x54,0x54,0x28,0x00,0x00,0x00, 7, // 0x41 'A' 0x00,0x00,0x10,0x28,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x42 'B' 0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, 7, // 0x43 'C' 0x00,0x00,0x38,0x44,0x44,0x40,0x40,0x40,0x40,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x44 'D' 0x00,0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, 7, // 0x45 'E' 0x00,0x00,0x7c,0x40,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, 7, // 0x46 'F' 0x00,0x00,0x7c,0x40,0x40,0x40,0x70,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 7, // 0x47 'G' 0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x5c,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x48 'H' 0x00,0x00,0x44,0x44,0x44,0x44,0x7c,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x49 'I' 0x00,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, 7, // 0x4a 'J' 0x00,0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, 7, // 0x4b 'K' 0x00,0x00,0x44,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x4c 'L' 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, 7, // 0x4d 'M' 0x00,0x00,0x44,0x6c,0x54,0x54,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x4e 'N' 0x00,0x00,0x44,0x44,0x44,0x64,0x54,0x4c,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x4f 'O' 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x50 'P' 0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 7, // 0x51 'Q' 0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, 7, // 0x52 'R' 0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x50,0x48,0x44,0x44,0x00,0x00,0x00, 7, // 0x53 'S' 0x00,0x00,0x38,0x44,0x44,0x40,0x38,0x04,0x04,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x54 'T' 0x00,0x00,0x7c,0x54,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, 7, // 0x55 'U' 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x56 'V' 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, 7, // 0x57 'W' 0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00,0x00, 7, // 0x58 'X' 0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x59 'Y' 0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, 7, // 0x5a 'Z' 0x00,0x00,0x7c,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x40,0x7c,0x00,0x00,0x00, 7, // 0x5b '[' 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00,0x00, 7, // 0x5c '\' 0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00,0x00,0x00, 7, // 0x5d ']' 0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00,0x00, 7, // 0x5e '^' 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00, 7, // 0x60 '`' 0x00,0x20,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x61 'a' 0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x3c,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, 7, // 0x62 'b' 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, 7, // 0x63 'c' 0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, 7, // 0x64 'd' 0x00,0x00,0x04,0x04,0x04,0x3c,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, 7, // 0x65 'e' 0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x7c,0x40,0x40,0x44,0x38,0x00,0x00,0x00, 7, // 0x66 'f' 0x00,0x00,0x18,0x24,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, 7, // 0x67 'g' 0x00,0x00,0x00,0x00,0x3a,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x44,0x38,0x00, 7, // 0x68 'h' 0x00,0x00,0x40,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x69 'i' 0x00,0x00,0x10,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, 7, // 0x6a 'j' 0x00,0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00, 7, // 0x6b 'k' 0x00,0x00,0x40,0x40,0x44,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, 7, // 0x6c 'l' 0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, 7, // 0x6d 'm' 0x00,0x00,0x00,0x00,0xa8,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x00,0x00,0x00, 7, // 0x6e 'n' 0x00,0x00,0x00,0x00,0xb8,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x6f 'o' 0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x70 'p' 0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00, 7, // 0x71 'q' 0x00,0x00,0x00,0x00,0x3c,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x04,0x00, 7, // 0x72 'r' 0x00,0x00,0x00,0x00,0x58,0x64,0x44,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x74 't' 0x00,0x00,0x20,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x24,0x18,0x00,0x00,0x00, 7, // 0x75 'u' 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x3a,0x00,0x00,0x00, 7, // 0x76 'v' 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, 7, // 0x77 'w' 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x6c,0x44,0x00,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x08,0x70,0x00, 7, // 0x7a 'z' 0x00,0x00,0x00,0x00,0x7c,0x04,0x08,0x10,0x20,0x40,0x40,0x7c,0x00,0x00,0x00, 7, // 0x7b '{' 0x00,0x0c,0x10,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x0c,0x00,0x00, 7, // 0x7c '|' 0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x00, 7, // 0x7d '}' 0x00,0x60,0x10,0x10,0x10,0x10,0x10,0x0c,0x10,0x10,0x10,0x10,0x60,0x00,0x00, 7, // 0x7e '~' 0x00,0x00,0x64,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x7f '' 0x00,0x00,0x00,0x00,0x00,0x10,0x28,0x44,0x44,0x7c,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u gse7x15_bold[] = { 15, 0, 32, 128-32, 0x00,0x00,0x10,0x00,0x20,0x00,0x30,0x00,0x40,0x00,0x50,0x00,0x60,0x00,0x70,0x00,0x80,0x00, 0x90,0x00,0xa0,0x00,0xb0,0x00,0xc0,0x00,0xd0,0x00,0xe0,0x00,0xf0,0x00,0x00,0x01,0x10,0x01, 0x20,0x01,0x30,0x01,0x40,0x01,0x50,0x01,0x60,0x01,0x70,0x01,0x80,0x01,0x90,0x01,0xa0,0x01, 0xb0,0x01,0xc0,0x01,0xd0,0x01,0xe0,0x01,0xf0,0x01,0x00,0x02,0x10,0x02,0x20,0x02,0x30,0x02, 0x40,0x02,0x50,0x02,0x60,0x02,0x70,0x02,0x80,0x02,0x90,0x02,0xa0,0x02,0xb0,0x02,0xc0,0x02, 0xd0,0x02,0xe0,0x02,0xf0,0x02,0x00,0x03,0x10,0x03,0x20,0x03,0x30,0x03,0x40,0x03,0x50,0x03, 0x60,0x03,0x70,0x03,0x80,0x03,0x90,0x03,0xa0,0x03,0xb0,0x03,0xc0,0x03,0xd0,0x03,0xe0,0x03, 0xf0,0x03,0x00,0x04,0x10,0x04,0x20,0x04,0x30,0x04,0x40,0x04,0x50,0x04,0x60,0x04,0x70,0x04, 0x80,0x04,0x90,0x04,0xa0,0x04,0xb0,0x04,0xc0,0x04,0xd0,0x04,0xe0,0x04,0xf0,0x04,0x00,0x05, 0x10,0x05,0x20,0x05,0x30,0x05,0x40,0x05,0x50,0x05,0x60,0x05,0x70,0x05,0x80,0x05,0x90,0x05, 0xa0,0x05,0xb0,0x05,0xc0,0x05,0xd0,0x05,0xe0,0x05,0xf0,0x05, 7, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x21 '!' 0x00,0x00,0x00,0x30,0x78,0x78,0x78,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, 7, // 0x22 '"' 0x00,0x00,0x6c,0x6c,0x6c,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x23 '#' 0x00,0x00,0x48,0x48,0x48,0xfc,0x48,0x48,0xfc,0x48,0x48,0x48,0x00,0x00,0x00, 7, // 0x24 '$' 0x00,0x30,0x30,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x30,0x30,0x00,0x00, 7, // 0x25 '%' 0x00,0x00,0x00,0x64,0x6c,0x08,0x18,0x10,0x30,0x20,0x6c,0x4c,0x00,0x00,0x00, 7, // 0x26 '&' 0x00,0x00,0x00,0x30,0x58,0x58,0x30,0x74,0xdc,0xd8,0xd8,0x6c,0x00,0x00,0x00, 7, // 0x27 ''' 0x00,0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x28 '(' 0x00,0x0c,0x18,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x18,0x0c,0x00,0x00,0x00, 7, // 0x29 ')' 0x00,0xc0,0x60,0x30,0x18,0x18,0x18,0x18,0x18,0x30,0x60,0xc0,0x00,0x00,0x00, 7, // 0x2a '*' 0x00,0x00,0x00,0x00,0x00,0x20,0xa8,0x70,0xa8,0x20,0x00,0x00,0x00,0x00,0x00, 7, // 0x2b '+' 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,0x00,0x00,0x00, 7, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, 7, // 0x2d '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, 7, // 0x2f '/' 0x00,0x00,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0xc0,0xc0,0x00,0x00,0x00, 7, // 0x30 '0' 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xdc,0xec,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, 7, // 0x31 '1' 0x00,0x00,0x30,0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0x30,0xfc,0x00,0x00,0x00, 7, // 0x32 '2' 0x00,0x00,0x78,0xcc,0xcc,0x0c,0x18,0x30,0x60,0xc0,0xcc,0xfc,0x00,0x00,0x00, 7, // 0x33 '3' 0x00,0x00,0xfc,0x8c,0x18,0x30,0x78,0x0c,0x0c,0x0c,0xcc,0x78,0x00,0x00,0x00, 7, // 0x34 '4' 0x00,0x00,0x18,0x30,0x60,0xc8,0xd8,0xd8,0xfc,0x18,0x18,0x3c,0x00,0x00,0x00, 7, // 0x35 '5' 0x00,0x00,0xfc,0xc0,0xc0,0xc0,0xf8,0x0c,0x0c,0x0c,0xcc,0x78,0x00,0x00,0x00, 7, // 0x36 '6' 0x00,0x00,0x38,0x60,0xc0,0xc0,0xf8,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, 7, // 0x37 '7' 0x00,0x00,0xfc,0x8c,0x0c,0x0c,0x18,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00, 7, // 0x38 '8' 0x00,0x00,0x78,0xcc,0xcc,0xcc,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, 7, // 0x39 '9' 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x18,0x70,0x00,0x00,0x00, 7, // 0x3a ':' 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00, 7, // 0x3b ';' 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x00, 7, // 0x3c '<' 0x00,0x00,0x00,0x0c,0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x0c,0x00,0x00,0x00, 7, // 0x3d '=' 0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x3e '>' 0x00,0x00,0x00,0xc0,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0xc0,0x00,0x00,0x00, 7, // 0x3f '?' 0x00,0x00,0x78,0xcc,0xcc,0x18,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, 7, // 0x40 '@' 0x00,0x00,0x00,0x70,0x88,0x04,0x74,0xb4,0xb4,0xb4,0xb4,0x68,0x00,0x00,0x00, 7, // 0x41 'A' 0x00,0x00,0x30,0x78,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x42 'B' 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0x00,0x00,0x00, 7, // 0x43 'C' 0x00,0x00,0x78,0xcc,0xc4,0xc0,0xc0,0xc0,0xc0,0xc4,0xcc,0x78,0x00,0x00,0x00, 7, // 0x44 'D' 0x00,0x00,0xf0,0xd8,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xd8,0xf0,0x00,0x00,0x00, 7, // 0x45 'E' 0x00,0x00,0xfc,0xc4,0xc0,0xd0,0xf0,0xd0,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, 7, // 0x46 'F' 0x00,0x00,0xfc,0xc4,0xc0,0xd0,0xf0,0xd0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, 7, // 0x47 'G' 0x00,0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xdc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, 7, // 0x48 'H' 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x49 'I' 0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, 7, // 0x4a 'J' 0x00,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00,0x00,0x00, 7, // 0x4b 'K' 0x00,0x00,0xcc,0xcc,0xd8,0xd8,0xf0,0xd8,0xd8,0xcc,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x4c 'L' 0x00,0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, 7, // 0x4d 'M' 0x00,0x00,0x84,0xcc,0xfc,0xb4,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x4e 'N' 0x00,0x00,0xcc,0xcc,0xcc,0xec,0xfc,0xdc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x4f 'O' 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, 7, // 0x50 'P' 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, 7, // 0x51 'Q' 0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xdc,0x78,0x18,0x0c,0x00,0x00, 7, // 0x52 'R' 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xf8,0xd8,0xcc,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x53 'S' 0x00,0x00,0x78,0xcc,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0xcc,0x78,0x00,0x00,0x00, 7, // 0x54 'T' 0x00,0x00,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, 7, // 0x55 'U' 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, 7, // 0x56 'V' 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00,0x00, 7, // 0x57 'W' 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00,0x00, 7, // 0x58 'X' 0x00,0x00,0xcc,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x59 'Y' 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, 7, // 0x5a 'Z' 0x00,0x00,0xfc,0x8c,0x0c,0x18,0x30,0x60,0xc0,0xc0,0xc4,0xfc,0x00,0x00,0x00, 7, // 0x5b '[' 0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00, 7, // 0x5c '\' 0x00,0x00,0xc0,0xc0,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x00,0x00,0x00, 7, // 0x5d ']' 0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00, 7, // 0x5e '^' 0x00,0x10,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x00,0x00,0x00, 7, // 0x60 '`' 0x00,0x30,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x61 'a' 0x00,0x00,0x00,0x00,0x70,0xd8,0x18,0x78,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, 7, // 0x62 'b' 0x00,0x00,0x60,0x60,0x60,0x78,0x6c,0x6c,0x6c,0x6c,0x6c,0x78,0x00,0x00,0x00, 7, // 0x63 'c' 0x00,0x00,0x00,0x00,0x78,0xcc,0xc0,0xc0,0xc0,0xc0,0xcc,0x78,0x00,0x00,0x00, 7, // 0x64 'd' 0x00,0x00,0x18,0x18,0x18,0x78,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, 7, // 0x65 'e' 0x00,0x00,0x00,0x00,0x78,0xcc,0xcc,0xfc,0xc0,0xc0,0xcc,0x78,0x00,0x00,0x00, 7, // 0x66 'f' 0x00,0x00,0x30,0x68,0x60,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00, 7, // 0x67 'g' 0x00,0x00,0x00,0x00,0x6c,0xd8,0xd8,0xd8,0xd8,0xd8,0x78,0x18,0xd8,0x70,0x00, 7, // 0x68 'h' 0x00,0x00,0xc0,0xc0,0xc0,0xd8,0xec,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x69 'i' 0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, 7, // 0x6a 'j' 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,0x00, 7, // 0x6b 'k' 0x00,0x00,0xc0,0xc0,0xcc,0xcc,0xcc,0xd8,0xf0,0xd8,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x6c 'l' 0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, 7, // 0x6d 'm' 0x00,0x00,0x00,0x00,0xe8,0xfc,0xd4,0xd4,0xd4,0xc4,0xc4,0xc4,0x00,0x00,0x00, 7, // 0x6e 'n' 0x00,0x00,0x00,0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00, 7, // 0x6f 'o' 0x00,0x00,0x00,0x00,0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00, 7, // 0x70 'p' 0x00,0x00,0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0xcc,0xf8,0xc0,0xc0,0xc0,0x00, 7, // 0x71 'q' 0x00,0x00,0x00,0x00,0x7c,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x0c,0x00, 7, // 0x72 'r' 0x00,0x00,0x00,0x00,0xd8,0xec,0xcc,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x00,0x78,0xcc,0xe0,0x70,0x38,0x1c,0xcc,0x78,0x00,0x00,0x00, 7, // 0x74 't' 0x00,0x00,0x20,0x60,0x60,0xf0,0x60,0x60,0x60,0x60,0x6c,0x38,0x00,0x00,0x00, 7, // 0x75 'u' 0x00,0x00,0x00,0x00,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0x6c,0x00,0x00,0x00, 7, // 0x76 'v' 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00,0x00,0x00, 7, // 0x77 'w' 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xb4,0xfc,0xcc,0x84,0x00,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x00,0xcc,0xcc,0x78,0x30,0x78,0xcc,0xcc,0xcc,0x00,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x18,0xf0,0x00, 7, // 0x7a 'z' 0x00,0x00,0x00,0x00,0xfc,0x8c,0x18,0x30,0x60,0xc0,0xc4,0xfc,0x00,0x00,0x00, 7, // 0x7b '{' 0x00,0x1c,0x30,0x30,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x30,0x1c,0x00,0x00, 7, // 0x7c '|' 0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x00,0x00, 7, // 0x7d '}' 0x00,0xe0,0x30,0x30,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0x30,0xe0,0x00,0x00, 7, // 0x7e '~' 0x00,0x00,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x7f '' 0x00,0x00,0x00,0x00,0x00,0x30,0x78,0xcc,0xcc,0xfc,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u gse8x16[] = { 16, 0, 32, 128-32, 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x44,0x00,0x55,0x00,0x66,0x00,0x77,0x00,0x88,0x00, 0x99,0x00,0xaa,0x00,0xbb,0x00,0xcc,0x00,0xdd,0x00,0xee,0x00,0xff,0x00,0x10,0x01,0x21,0x01, 0x32,0x01,0x43,0x01,0x54,0x01,0x65,0x01,0x76,0x01,0x87,0x01,0x98,0x01,0xa9,0x01,0xba,0x01, 0xcb,0x01,0xdc,0x01,0xed,0x01,0xfe,0x01,0x0f,0x02,0x20,0x02,0x31,0x02,0x42,0x02,0x53,0x02, 0x64,0x02,0x75,0x02,0x86,0x02,0x97,0x02,0xa8,0x02,0xb9,0x02,0xca,0x02,0xdb,0x02,0xec,0x02, 0xfd,0x02,0x0e,0x03,0x1f,0x03,0x30,0x03,0x41,0x03,0x52,0x03,0x63,0x03,0x74,0x03,0x85,0x03, 0x96,0x03,0xa7,0x03,0xb8,0x03,0xc9,0x03,0xda,0x03,0xeb,0x03,0xfc,0x03,0x0d,0x04,0x1e,0x04, 0x2f,0x04,0x40,0x04,0x51,0x04,0x62,0x04,0x73,0x04,0x84,0x04,0x95,0x04,0xa6,0x04,0xb7,0x04, 0xc8,0x04,0xd9,0x04,0xea,0x04,0xfb,0x04,0x0c,0x05,0x1d,0x05,0x2e,0x05,0x3f,0x05,0x50,0x05, 0x61,0x05,0x72,0x05,0x83,0x05,0x94,0x05,0xa5,0x05,0xb6,0x05,0xc7,0x05,0xd8,0x05,0xe9,0x05, 0xfa,0x05,0x0b,0x06,0x1c,0x06,0x2d,0x06,0x3e,0x06,0x4f,0x06, 8, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x21 '!' 0x00,0x00,0x10,0x38,0x38,0x38,0x38,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00,0x00, 8, // 0x22 '"' 0x00,0x24,0x24,0x24,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x23 '#' 0x00,0x00,0x24,0x24,0x24,0x7e,0x24,0x24,0x7e,0x24,0x24,0x24,0x00,0x00,0x00,0x00, 8, // 0x24 '$' 0x00,0x14,0x14,0x3e,0x55,0x54,0x54,0x3e,0x15,0x15,0x55,0x3e,0x14,0x14,0x00,0x00, 8, // 0x25 '%' 0x00,0x00,0x32,0x56,0x6c,0x04,0x08,0x08,0x10,0x13,0x25,0x26,0x00,0x00,0x00,0x00, 8, // 0x26 '&' 0x00,0x00,0x18,0x24,0x24,0x24,0x18,0x28,0x45,0x46,0x44,0x3b,0x00,0x00,0x00,0x00, 8, // 0x27 ''' 0x00,0x00,0x08,0x08,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x28 '(' 0x00,0x04,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x04,0x00,0x00,0x00, 8, // 0x29 ')' 0x00,0x10,0x08,0x04,0x04,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x10,0x00,0x00,0x00, 8, // 0x2a '*' 0x00,0x00,0x00,0x00,0x66,0x24,0x18,0xff,0x18,0x24,0x66,0x00,0x00,0x00,0x00,0x00, 8, // 0x2b '+' 0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7f,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00, 8, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x20,0x00, 8, // 0x2d '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, 8, // 0x2f '/' 0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00,0x00, 8, // 0x30 '0' 0x00,0x00,0x3c,0x42,0x42,0x46,0x4a,0x52,0x62,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x31 '1' 0x00,0x00,0x08,0x08,0x18,0x38,0x08,0x08,0x08,0x08,0x08,0x3e,0x00,0x00,0x00,0x00, 8, // 0x32 '2' 0x00,0x00,0x3c,0x42,0x42,0x02,0x04,0x08,0x10,0x20,0x42,0x7e,0x00,0x00,0x00,0x00, 8, // 0x33 '3' 0x00,0x00,0x7e,0x42,0x04,0x08,0x1c,0x02,0x02,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x34 '4' 0x00,0x00,0x04,0x08,0x10,0x24,0x44,0x44,0x7e,0x04,0x04,0x0e,0x00,0x00,0x00,0x00, 8, // 0x35 '5' 0x00,0x00,0x7e,0x42,0x40,0x40,0x7c,0x02,0x02,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x36 '6' 0x00,0x00,0x1c,0x20,0x40,0x40,0x7c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x37 '7' 0x00,0x00,0x7e,0x42,0x42,0x02,0x04,0x08,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00, 8, // 0x38 '8' 0x00,0x00,0x3c,0x42,0x42,0x42,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x39 '9' 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3e,0x02,0x02,0x04,0x38,0x00,0x00,0x00,0x00, 8, // 0x3a ':' 0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x3b ';' 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x40,0x00, 8, // 0x3c '<' 0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x02,0x00,0x00,0x00,0x00, 8, // 0x3d '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x3e '>' 0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x00,0x00,0x00,0x00, 8, // 0x3f '?' 0x00,0x00,0x3c,0x42,0x42,0x42,0x04,0x08,0x08,0x00,0x08,0x08,0x00,0x00,0x00,0x00, 8, // 0x40 '@' 0x00,0x00,0x3c,0x42,0x01,0x39,0x49,0x49,0x49,0x49,0x49,0x36,0x00,0x00,0x00,0x00, 8, // 0x41 'A' 0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, 8, // 0x42 'B' 0x00,0x00,0x7c,0x22,0x22,0x22,0x3c,0x22,0x22,0x22,0x22,0x7c,0x00,0x00,0x00,0x00, 8, // 0x43 'C' 0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x40,0x40,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x44 'D' 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x7c,0x00,0x00,0x00,0x00, 8, // 0x45 'E' 0x00,0x00,0x7e,0x22,0x20,0x28,0x38,0x28,0x20,0x20,0x22,0x7e,0x00,0x00,0x00,0x00, 8, // 0x46 'F' 0x00,0x00,0x7e,0x22,0x20,0x28,0x38,0x28,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, 8, // 0x47 'G' 0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x4e,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x48 'H' 0x00,0x00,0x42,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, 8, // 0x49 'I' 0x00,0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, 8, // 0x4a 'J' 0x00,0x00,0x0e,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x44,0x38,0x00,0x00,0x00,0x00, 8, // 0x4b 'K' 0x00,0x00,0x62,0x22,0x24,0x28,0x30,0x28,0x24,0x22,0x22,0x62,0x00,0x00,0x00,0x00, 8, // 0x4c 'L' 0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x7e,0x00,0x00,0x00,0x00, 8, // 0x4d 'M' 0x00,0x00,0x41,0x63,0x55,0x49,0x41,0x41,0x41,0x41,0x41,0x41,0x00,0x00,0x00,0x00, 8, // 0x4e 'N' 0x00,0x00,0x42,0x42,0x62,0x52,0x4a,0x46,0x42,0x42,0x42,0x42,0x00,0x00,0x00,0x00, 8, // 0x4f 'O' 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x50 'P' 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x3c,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, 8, // 0x51 'Q' 0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x4a,0x44,0x3a,0x02,0x00,0x00,0x00, 8, // 0x52 'R' 0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x3c,0x28,0x24,0x22,0x62,0x00,0x00,0x00,0x00, 8, // 0x53 'S' 0x00,0x00,0x3c,0x42,0x42,0x40,0x30,0x0c,0x02,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x54 'T' 0x00,0x00,0x7f,0x49,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, 8, // 0x55 'U' 0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x56 'V' 0x00,0x00,0x41,0x41,0x41,0x41,0x22,0x22,0x14,0x14,0x08,0x08,0x00,0x00,0x00,0x00, 8, // 0x57 'W' 0x00,0x00,0x41,0x41,0x41,0x41,0x41,0x49,0x49,0x55,0x63,0x41,0x00,0x00,0x00,0x00, 8, // 0x58 'X' 0x00,0x00,0x42,0x42,0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x42,0x00,0x00,0x00,0x00, 8, // 0x59 'Y' 0x00,0x00,0x22,0x22,0x22,0x22,0x14,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, 8, // 0x5a 'Z' 0x00,0x00,0x7e,0x42,0x02,0x04,0x08,0x10,0x20,0x40,0x42,0x7e,0x00,0x00,0x00,0x00, 8, // 0x5b '[' 0x00,0x1e,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1e,0x00,0x00,0x00, 8, // 0x5c '\' 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00,0x00,0x00, 8, // 0x5d ']' 0x00,0x3c,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x3c,0x00,0x00,0x00, 8, // 0x5e '^' 0x00,0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00, 8, // 0x60 '`' 0x00,0x00,0x08,0x08,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x3c,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, 8, // 0x62 'b' 0x00,0x00,0x60,0x20,0x20,0x38,0x24,0x22,0x22,0x22,0x22,0x3c,0x00,0x00,0x00,0x00, 8, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x40,0x40,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x64 'd' 0x00,0x00,0x0c,0x04,0x04,0x1c,0x24,0x44,0x44,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, 8, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x7e,0x40,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x66 'f' 0x00,0x00,0x0c,0x12,0x10,0x10,0x38,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, 8, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x3e,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x44,0x38,0x00, 8, // 0x68 'h' 0x00,0x00,0x60,0x20,0x20,0x2c,0x32,0x22,0x22,0x22,0x22,0x62,0x00,0x00,0x00,0x00, 8, // 0x69 'i' 0x00,0x00,0x08,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, 8, // 0x6a 'j' 0x00,0x00,0x04,0x04,0x00,0x0c,0x04,0x04,0x04,0x04,0x04,0x44,0x44,0x38,0x00,0x00, 8, // 0x6b 'k' 0x00,0x00,0x60,0x20,0x20,0x22,0x24,0x28,0x38,0x24,0x22,0x62,0x00,0x00,0x00,0x00, 8, // 0x6c 'l' 0x00,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1c,0x00,0x00,0x00,0x00, 8, // 0x6d 'm' 0x00,0x00,0x00,0x00,0x00,0x76,0x49,0x49,0x49,0x49,0x41,0x41,0x00,0x00,0x00,0x00, 8, // 0x6e 'n' 0x00,0x00,0x00,0x00,0x00,0x5c,0x22,0x22,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00, 8, // 0x6f 'o' 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x7c,0x22,0x22,0x22,0x22,0x22,0x3c,0x20,0x20,0x70,0x00, 8, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x3e,0x44,0x44,0x44,0x44,0x44,0x3c,0x04,0x04,0x0e,0x00, 8, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x7c,0x22,0x22,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, 8, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x3c,0x02,0x42,0x3c,0x00,0x00,0x00,0x00, 8, // 0x74 't' 0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x12,0x0c,0x00,0x00,0x00,0x00, 8, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3e,0x00,0x00,0x00,0x00, 8, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x41,0x41,0x22,0x14,0x08,0x00,0x00,0x00,0x00, 8, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x41,0x41,0x41,0x49,0x49,0x55,0x22,0x00,0x00,0x00,0x00, 8, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x00,0x00,0x00,0x00, 8, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e,0x02,0x04,0x78,0x00, 8, // 0x7a 'z' 0x00,0x00,0x00,0x00,0x00,0x7e,0x44,0x08,0x10,0x20,0x42,0x7e,0x00,0x00,0x00,0x00, 8, // 0x7b '{' 0x00,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x08,0x08,0x08,0x08,0x08,0x06,0x00,0x00, 8, // 0x7c '|' 0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00, 8, // 0x7d '}' 0x00,0x30,0x08,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x00,0x00, 8, // 0x7e '~' 0x00,0x00,0x39,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x7f '' 0x00,0x00,0x00,0x00,0x00,0x08,0x14,0x22,0x41,0x41,0x7f,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u gse8x16_bold[] = { 16, 0, 32, 128-32, 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x44,0x00,0x55,0x00,0x66,0x00,0x77,0x00,0x88,0x00, 0x99,0x00,0xaa,0x00,0xbb,0x00,0xcc,0x00,0xdd,0x00,0xee,0x00,0xff,0x00,0x10,0x01,0x21,0x01, 0x32,0x01,0x43,0x01,0x54,0x01,0x65,0x01,0x76,0x01,0x87,0x01,0x98,0x01,0xa9,0x01,0xba,0x01, 0xcb,0x01,0xdc,0x01,0xed,0x01,0xfe,0x01,0x0f,0x02,0x20,0x02,0x31,0x02,0x42,0x02,0x53,0x02, 0x64,0x02,0x75,0x02,0x86,0x02,0x97,0x02,0xa8,0x02,0xb9,0x02,0xca,0x02,0xdb,0x02,0xec,0x02, 0xfd,0x02,0x0e,0x03,0x1f,0x03,0x30,0x03,0x41,0x03,0x52,0x03,0x63,0x03,0x74,0x03,0x85,0x03, 0x96,0x03,0xa7,0x03,0xb8,0x03,0xc9,0x03,0xda,0x03,0xeb,0x03,0xfc,0x03,0x0d,0x04,0x1e,0x04, 0x2f,0x04,0x40,0x04,0x51,0x04,0x62,0x04,0x73,0x04,0x84,0x04,0x95,0x04,0xa6,0x04,0xb7,0x04, 0xc8,0x04,0xd9,0x04,0xea,0x04,0xfb,0x04,0x0c,0x05,0x1d,0x05,0x2e,0x05,0x3f,0x05,0x50,0x05, 0x61,0x05,0x72,0x05,0x83,0x05,0x94,0x05,0xa5,0x05,0xb6,0x05,0xc7,0x05,0xd8,0x05,0xe9,0x05, 0xfa,0x05,0x0b,0x06,0x1c,0x06,0x2d,0x06,0x3e,0x06,0x4f,0x06, 8, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x21 '!' 0x00,0x00,0x18,0x3c,0x3c,0x3c,0x3c,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, 8, // 0x22 '"' 0x00,0x66,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x23 '#' 0x00,0x00,0x66,0x66,0x66,0xff,0x66,0x66,0xff,0x66,0x66,0x66,0x00,0x00,0x00,0x00, 8, // 0x24 '$' 0x00,0x08,0x08,0x3e,0x6b,0x6b,0x68,0x3e,0x0b,0x6b,0x6b,0x3e,0x08,0x08,0x00,0x00, 8, // 0x25 '%' 0x00,0x00,0x66,0xbe,0xcc,0x0c,0x18,0x18,0x30,0x33,0x65,0x66,0x00,0x00,0x00,0x00, 8, // 0x26 '&' 0x00,0x00,0x1c,0x36,0x36,0x36,0x1c,0x3b,0x6e,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, 8, // 0x27 ''' 0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x28 '(' 0x00,0x06,0x0c,0x18,0x18,0x30,0x30,0x30,0x30,0x18,0x18,0x0c,0x06,0x00,0x00,0x00, 8, // 0x29 ')' 0x00,0x30,0x18,0x0c,0x0c,0x06,0x06,0x06,0x06,0x0c,0x0c,0x18,0x30,0x00,0x00,0x00, 8, // 0x2a '*' 0x00,0x00,0x00,0x00,0x66,0x24,0x18,0xff,0x18,0x24,0x66,0x00,0x00,0x00,0x00,0x00, 8, // 0x2b '+' 0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00, 8, // 0x2c ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x20,0x00, 8, // 0x2d '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x2e '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, 8, // 0x2f '/' 0x00,0x03,0x03,0x06,0x06,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60,0x00,0x00,0x00, 8, // 0x30 '0' 0x00,0x00,0x3e,0x63,0x63,0x67,0x6b,0x73,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x31 '1' 0x00,0x00,0x0c,0x0c,0x1c,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3f,0x00,0x00,0x00,0x00, 8, // 0x32 '2' 0x00,0x00,0x3e,0x63,0x63,0x03,0x06,0x0c,0x18,0x30,0x61,0x7f,0x00,0x00,0x00,0x00, 8, // 0x33 '3' 0x00,0x00,0x7f,0x43,0x06,0x0c,0x1e,0x03,0x03,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x34 '4' 0x00,0x00,0x06,0x0c,0x18,0x32,0x66,0x66,0x7f,0x06,0x06,0x0f,0x00,0x00,0x00,0x00, 8, // 0x35 '5' 0x00,0x00,0x7f,0x61,0x60,0x60,0x7e,0x03,0x03,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x36 '6' 0x00,0x00,0x1e,0x30,0x60,0x60,0x7e,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x37 '7' 0x00,0x00,0x7f,0x63,0x63,0x03,0x06,0x0c,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, 8, // 0x38 '8' 0x00,0x00,0x3e,0x63,0x63,0x63,0x3e,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x39 '9' 0x00,0x00,0x3e,0x63,0x63,0x63,0x63,0x3f,0x03,0x03,0x06,0x3c,0x00,0x00,0x00,0x00, 8, // 0x3a ':' 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, 8, // 0x3b ';' 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x60,0x40,0x00, 8, // 0x3c '<' 0x00,0x00,0x00,0x06,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x06,0x00,0x00,0x00,0x00, 8, // 0x3d '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x3e '>' 0x00,0x00,0x00,0x30,0x18,0x0c,0x06,0x03,0x06,0x0c,0x18,0x30,0x00,0x00,0x00,0x00, 8, // 0x3f '?' 0x00,0x00,0x3e,0x63,0x63,0x63,0x06,0x0c,0x0c,0x00,0x0c,0x0c,0x00,0x00,0x00,0x00, 8, // 0x40 '@' 0x00,0x00,0x7c,0x86,0x03,0x73,0xdb,0xdb,0xdb,0xdb,0xdb,0x6e,0x00,0x00,0x00,0x00, 8, // 0x41 'A' 0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x63,0x7f,0x63,0x63,0x63,0x00,0x00,0x00,0x00, 8, // 0x42 'B' 0x00,0x00,0x7e,0x33,0x33,0x33,0x3e,0x33,0x33,0x33,0x33,0x7e,0x00,0x00,0x00,0x00, 8, // 0x43 'C' 0x00,0x00,0x1e,0x33,0x61,0x60,0x60,0x60,0x60,0x61,0x33,0x1e,0x00,0x00,0x00,0x00, 8, // 0x44 'D' 0x00,0x00,0x7c,0x36,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x7c,0x00,0x00,0x00,0x00, 8, // 0x45 'E' 0x00,0x00,0x7f,0x33,0x31,0x34,0x3c,0x34,0x30,0x31,0x33,0x7f,0x00,0x00,0x00,0x00, 8, // 0x46 'F' 0x00,0x00,0x7f,0x33,0x31,0x34,0x3c,0x34,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, 8, // 0x47 'G' 0x00,0x00,0x1f,0x33,0x61,0x60,0x60,0x6f,0x63,0x63,0x33,0x1e,0x00,0x00,0x00,0x00, 8, // 0x48 'H' 0x00,0x00,0x63,0x63,0x63,0x63,0x7f,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, 8, // 0x49 'I' 0x00,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, 8, // 0x4a 'J' 0x00,0x00,0x0f,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,0x00,0x00,0x00, 8, // 0x4b 'K' 0x00,0x00,0x73,0x33,0x36,0x36,0x3c,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, 8, // 0x4c 'L' 0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x33,0x7f,0x00,0x00,0x00,0x00, 8, // 0x4d 'M' 0x00,0x00,0x63,0x63,0x77,0x77,0x7f,0x6b,0x6b,0x63,0x63,0x63,0x00,0x00,0x00,0x00, 8, // 0x4e 'N' 0x00,0x00,0x63,0x63,0x73,0x7b,0x6f,0x67,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00, 8, // 0x4f 'O' 0x00,0x00,0x1c,0x36,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1c,0x00,0x00,0x00,0x00, 8, // 0x50 'P' 0x00,0x00,0x7e,0x33,0x33,0x33,0x33,0x3e,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, 8, // 0x51 'Q' 0x00,0x00,0x1c,0x36,0x63,0x63,0x63,0x63,0x63,0x6f,0x36,0x1e,0x03,0x00,0x00,0x00, 8, // 0x52 'R' 0x00,0x00,0x7e,0x33,0x33,0x33,0x33,0x3e,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00, 8, // 0x53 'S' 0x00,0x00,0x3e,0x63,0x63,0x30,0x18,0x0c,0x06,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x54 'T' 0x00,0x00,0x3f,0x3f,0x2d,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, 8, // 0x55 'U' 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x56 'V' 0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1c,0x08,0x00,0x00,0x00,0x00, 8, // 0x57 'W' 0x00,0x00,0x63,0x63,0x63,0x6b,0x6b,0x7f,0x77,0x77,0x63,0x63,0x00,0x00,0x00,0x00, 8, // 0x58 'X' 0x00,0x00,0x63,0x63,0x63,0x36,0x1c,0x1c,0x36,0x63,0x63,0x63,0x00,0x00,0x00,0x00, 8, // 0x59 'Y' 0x00,0x00,0x33,0x33,0x33,0x33,0x1e,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, 8, // 0x5a 'Z' 0x00,0x00,0x7f,0x63,0x43,0x06,0x0c,0x18,0x30,0x61,0x63,0x7f,0x00,0x00,0x00,0x00, 8, // 0x5b '[' 0x00,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00, 8, // 0x5c '\' 0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x06,0x06,0x03,0x03,0x00,0x00,0x00, 8, // 0x5d ']' 0x00,0x7c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x7c,0x00,0x00,0x00, 8, // 0x5e '^' 0x00,0x00,0x08,0x1c,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x5f '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00, 8, // 0x60 '`' 0x00,0x00,0x18,0x18,0x18,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x06,0x3e,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, 8, // 0x62 'b' 0x00,0x00,0x70,0x30,0x30,0x3c,0x36,0x33,0x33,0x33,0x33,0x3e,0x00,0x00,0x00,0x00, 8, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x60,0x60,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x64 'd' 0x00,0x00,0x0e,0x06,0x06,0x1e,0x36,0x66,0x66,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, 8, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x7f,0x60,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x66 'f' 0x00,0x00,0x0e,0x1b,0x1b,0x18,0x3c,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00, 8, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x3b,0x66,0x66,0x66,0x66,0x66,0x3e,0x06,0x66,0x3c,0x00, 8, // 0x68 'h' 0x00,0x00,0x70,0x30,0x30,0x36,0x3b,0x33,0x33,0x33,0x33,0x73,0x00,0x00,0x00,0x00, 8, // 0x69 'i' 0x00,0x00,0x0c,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, 8, // 0x6a 'j' 0x00,0x00,0x06,0x06,0x00,0x0e,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,0x00, 8, // 0x6b 'k' 0x00,0x00,0x70,0x30,0x30,0x33,0x33,0x36,0x3c,0x36,0x33,0x73,0x00,0x00,0x00,0x00, 8, // 0x6c 'l' 0x00,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00, 8, // 0x6d 'm' 0x00,0x00,0x00,0x00,0x00,0x76,0x7f,0x6b,0x6b,0x6b,0x63,0x63,0x00,0x00,0x00,0x00, 8, // 0x6e 'n' 0x00,0x00,0x00,0x00,0x00,0x6e,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00, 8, // 0x6f 'o' 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x6e,0x33,0x33,0x33,0x33,0x33,0x3e,0x30,0x30,0x78,0x00, 8, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x3b,0x66,0x66,0x66,0x66,0x66,0x3e,0x06,0x06,0x0f,0x00, 8, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x33,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00, 8, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x3e,0x63,0x60,0x3e,0x03,0x63,0x3e,0x00,0x00,0x00,0x00, 8, // 0x74 't' 0x00,0x00,0x08,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x1b,0x0e,0x00,0x00,0x00,0x00, 8, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3b,0x00,0x00,0x00,0x00, 8, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x36,0x1c,0x08,0x00,0x00,0x00,0x00, 8, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x6b,0x6b,0x7f,0x36,0x36,0x00,0x00,0x00,0x00, 8, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x36,0x1c,0x36,0x63,0x63,0x00,0x00,0x00,0x00, 8, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x3f,0x03,0x06,0x7c,0x00, 8, // 0x7a 'z' 0x00,0x00,0x00,0x00,0x00,0x7f,0x63,0x06,0x0c,0x18,0x31,0x7f,0x00,0x00,0x00,0x00, 8, // 0x7b '{' 0x00,0x03,0x04,0x0c,0x0c,0x0c,0x08,0x30,0x08,0x0c,0x0c,0x0c,0x04,0x03,0x00,0x00, 8, // 0x7c '|' 0x00,0x00,0x0c,0x0c,0x0c,0x0c,0x0c,0x00,0x0c,0x0c,0x0c,0x0c,0x0c,0x00,0x00,0x00, 8, // 0x7d '}' 0x00,0x60,0x10,0x18,0x18,0x18,0x08,0x06,0x08,0x18,0x18,0x18,0x10,0x60,0x00,0x00, 8, // 0x7e '~' 0x00,0x00,0x3b,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x7f '' 0x00,0x00,0x00,0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x7f,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u mcs11_prop[] = { 11, 2, 32, 128-32, 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x21 '!' 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, 4, // 0x22 '"' 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x23 '#' 0x00,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x00, 6, // 0x24 '$' 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10, 6, // 0x25 '%' 0x00,0x00,0x68,0xA8,0xD0,0x10,0x20,0x2C,0x54,0x58,0x00, 6, // 0x26 '&' 0x00,0x20,0x50,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00, 3, // 0x27 ''' 0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x28 '(' 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, 5, // 0x29 ')' 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, 6, // 0x2A '*' 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00,0x00, 6, // 0x2B '+' 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, 4, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, 6, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, 4, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00, 7, // 0x2F '/' 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40, 6, // 0x30 '0' 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00, 4, // 0x31 '1' 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, 6, // 0x32 '2' 0x00,0x38,0x44,0x44,0x04,0x08,0x10,0x20,0x40,0x7C,0x00, 6, // 0x33 '3' 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00, 6, // 0x34 '4' 0x00,0x08,0x18,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00, 6, // 0x35 '5' 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00, 6, // 0x36 '6' 0x00,0x38,0x44,0x40,0x40,0x78,0x44,0x44,0x44,0x38,0x00, 6, // 0x37 '7' 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00, 6, // 0x38 '8' 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00, 6, // 0x39 '9' 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00, 4, // 0x3A ':' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00, 4, // 0x3B ';' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xC0, 6, // 0x3C '<' 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, 6, // 0x3D '=' 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, 6, // 0x3E '>' 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, 6, // 0x3F '?' 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00, 6, // 0x40 '@' 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00, 6, // 0x41 'A' 0x00,0x38,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00, 6, // 0x42 'B' 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00, 6, // 0x43 'C' 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00, 6, // 0x44 'D' 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00, 6, // 0x45 'E' 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00, 6, // 0x46 'F' 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00, 6, // 0x47 'G' 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00, 6, // 0x48 'H' 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00, 4, // 0x49 'I' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, 6, // 0x4A 'J' 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x30,0x00, 6, // 0x4B 'K' 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00, 6, // 0x4C 'L' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00, 8, // 0x4D 'M' 0x00,0x41,0x63,0x55,0x49,0x49,0x41,0x41,0x41,0x41,0x00, 7, // 0x4E 'N' 0x00,0x42,0x42,0x62,0x52,0x4A,0x46,0x42,0x42,0x42,0x00, 6, // 0x4F 'O' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00, 6, // 0x50 'P' 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x40,0x00, 6, // 0x51 'Q' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00, 6, // 0x52 'R' 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x44,0x00, 6, // 0x53 'S' 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00, 6, // 0x54 'T' 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, 6, // 0x55 'U' 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00, 6, // 0x56 'V' 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00, 8, // 0x57 'W' 0x00,0x41,0x41,0x41,0x41,0x49,0x49,0x49,0x55,0x22,0x00, 6, // 0x58 'X' 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00, 6, // 0x59 'Y' 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00, 6, // 0x5A 'Z' 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00, 5, // 0x5B '[' 0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30, 7, // 0x5C '\' 0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, 4, // 0x5D ']' 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, 6, // 0x5E '^' 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00, 4, // 0x60 '`' 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x61 'a' 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00, 6, // 0x62 'b' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00, 6, // 0x64 'd' 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00, 6, // 0x65 'e' 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00, 4, // 0x66 'f' 0x00,0x10,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x00, 6, // 0x67 'g' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, 6, // 0x68 'h' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00, 2, // 0x69 'i' 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, 3, // 0x6A 'j' 0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, 5, // 0x6B 'k' 0x00,0x40,0x40,0x48,0x50,0x60,0x60,0x50,0x48,0x48,0x00, 2, // 0x6C 'l' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, 8, // 0x6D 'm' 0x00,0x00,0x00,0x76,0x49,0x49,0x49,0x49,0x41,0x41,0x00, 6, // 0x6E 'n' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00, 6, // 0x6F 'o' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00, 6, // 0x70 'p' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, 6, // 0x71 'q' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, 6, // 0x72 'r' 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x20,0x00, 6, // 0x73 's' 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00, 5, // 0x74 't' 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x28,0x10,0x00, 6, // 0x75 'u' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00, 8, // 0x77 'w' 0x00,0x00,0x00,0x41,0x41,0x41,0x41,0x49,0x49,0x36,0x00, 6, // 0x78 'x' 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00, 6, // 0x79 'y' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, 6, // 0x7A 'z' 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00, 5, // 0x7B '{' 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18, 3, // 0x7C '|' 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x40,0x40,0x40,0x00, 5, // 0x7D '}' 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0, 6, // 0x7E '~' 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x7F '' 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00, 0 }; const int8u mcs11_prop_condensed[] = { 11, 2, 32, 128-32, 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, 3, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 3, // 0x21 '!' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x40,0x00, 4, // 0x22 '"' 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x23 '#' 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50,0x00, 5, // 0x24 '$' 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20,0x00, 5, // 0x25 '%' 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90,0x00, 5, // 0x26 '&' 0x00,0x40,0xA0,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68,0x00, 5, // 0x27 ''' 0x00,0x00,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, 4, // 0x29 ')' 0x80,0x40,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, 5, // 0x2A '*' 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00,0x00, 5, // 0x2B '+' 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00, 4, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, 5, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00, 4, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00, 6, // 0x2F '/' 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, 5, // 0x30 '0' 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, 3, // 0x31 '1' 0x00,0x40,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, 5, // 0x32 '2' 0x00,0x60,0x90,0x90,0x10,0x10,0x20,0x40,0x80,0xF0,0x00, 5, // 0x33 '3' 0x00,0x60,0x90,0x10,0x10,0x60,0x10,0x10,0x90,0x60,0x00, 5, // 0x34 '4' 0x00,0x10,0x30,0x30,0x50,0x50,0x90,0xF0,0x10,0x10,0x00, 5, // 0x35 '5' 0x00,0xF0,0x80,0x80,0xE0,0x90,0x10,0x10,0x90,0x60,0x00, 5, // 0x36 '6' 0x00,0x60,0x90,0x80,0x80,0xE0,0x90,0x90,0x90,0x60,0x00, 5, // 0x37 '7' 0x00,0xF0,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00, 5, // 0x38 '8' 0x00,0x60,0x90,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, 5, // 0x39 '9' 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x10,0x90,0x60,0x00, 4, // 0x3A ':' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00, 4, // 0x3B ';' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xC0, 6, // 0x3C '<' 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00, 5, // 0x3D '=' 0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00, 6, // 0x3E '>' 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00, 5, // 0x3F '?' 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00,0x00, 5, // 0x40 '@' 0x00,0x60,0x90,0x90,0xB0,0xB0,0xB0,0x80,0x80,0x70,0x00, 5, // 0x41 'A' 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, 5, // 0x42 'B' 0x00,0xE0,0x90,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00, 5, // 0x43 'C' 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x80,0x90,0x60,0x00, 5, // 0x44 'D' 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, 5, // 0x45 'E' 0x00,0xF0,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0xF0,0x00, 5, // 0x46 'F' 0x00,0xF0,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0x80,0x00, 5, // 0x47 'G' 0x00,0x70,0x80,0x80,0x80,0xB0,0x90,0x90,0x90,0x60,0x00, 5, // 0x48 'H' 0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, 4, // 0x49 'I' 0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xE0,0x00, 5, // 0x4A 'J' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0xA0,0xA0,0x40,0x00, 5, // 0x4B 'K' 0x00,0x90,0x90,0xA0,0xA0,0xC0,0xA0,0xA0,0x90,0x90,0x00, 5, // 0x4C 'L' 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00, 6, // 0x4D 'M' 0x00,0x88,0xD8,0xA8,0xA8,0xA8,0x88,0x88,0x88,0x88,0x00, 5, // 0x4E 'N' 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x90,0x00, 5, // 0x4F 'O' 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, 5, // 0x50 'P' 0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00, 5, // 0x51 'Q' 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30, 5, // 0x52 'R' 0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00, 5, // 0x53 'S' 0x00,0x60,0x90,0x80,0x80,0x60,0x10,0x10,0x90,0x60,0x00, 6, // 0x54 'T' 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, 5, // 0x55 'U' 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, 6, // 0x56 'V' 0x00,0x88,0x88,0x88,0x88,0x50,0x50,0x50,0x20,0x20,0x00, 6, // 0x57 'W' 0x00,0x88,0x88,0x88,0xA8,0xA8,0xA8,0xA8,0xA8,0x50,0x00, 5, // 0x58 'X' 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x90,0x00, 6, // 0x59 'Y' 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x20,0x00, 5, // 0x5A 'Z' 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0xF0,0x00, 4, // 0x5B '[' 0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60,0x00, 6, // 0x5C '\' 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, 4, // 0x5D ']' 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60,0x00, 5, // 0x5E '^' 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, 5, // 0x60 '`' 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x61 'a' 0x00,0x00,0x00,0x60,0x90,0x10,0x70,0x90,0x90,0x70,0x00, 5, // 0x62 'b' 0x00,0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00, 5, // 0x63 'c' 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x80,0x90,0x60,0x00, 5, // 0x64 'd' 0x00,0x10,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00, 5, // 0x65 'e' 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x90,0x60,0x00, 4, // 0x66 'f' 0x00,0x20,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00, 5, // 0x67 'g' 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x90,0x60, 5, // 0x68 'h' 0x00,0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, 2, // 0x69 'i' 0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, 4, // 0x6A 'j' 0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, 5, // 0x6B 'k' 0x00,0x80,0x80,0x90,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00, 2, // 0x6C 'l' 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, 6, // 0x6D 'm' 0x00,0x00,0x00,0xD0,0xA8,0xA8,0xA8,0x88,0x88,0x88,0x00, 5, // 0x6E 'n' 0x00,0x00,0x00,0xA0,0xD0,0x90,0x90,0x90,0x90,0x90,0x00, 5, // 0x6F 'o' 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00, 5, // 0x70 'p' 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80, 5, // 0x71 'q' 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0x10, 6, // 0x72 'r' 0x00,0x00,0x00,0xB8,0x48,0x40,0x40,0x40,0x40,0x40,0x00, 5, // 0x73 's' 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x10,0x90,0x60,0x00, 4, // 0x74 't' 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x20,0x00, 5, // 0x75 'u' 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x70,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x00, 6, // 0x77 'w' 0x00,0x00,0x00,0x88,0x88,0x88,0xA8,0xA8,0xA8,0x50,0x00, 5, // 0x78 'x' 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, 5, // 0x79 'y' 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0x20,0xC0, 5, // 0x7A 'z' 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x80,0xF0,0x00, 5, // 0x7B '{' 0x30,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, 3, // 0x7C '|' 0x00,0x40,0x40,0x40,0x40,0x00,0x40,0x40,0x40,0x40,0x00, 5, // 0x7D '}' 0xC0,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, 5, // 0x7E '~' 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x7F '' 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00,0x00, 0 }; const int8u mcs12_prop[] = { 12, 3, 32, 128-32, 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, 0x49,0x02,0x62,0x02,0x6F,0x02,0x7C,0x02,0x89,0x02,0x96,0x02,0xA3,0x02,0xB0,0x02,0xBD,0x02, 0xCA,0x02,0xD7,0x02,0xF0,0x02,0xFD,0x02,0x0A,0x03,0x17,0x03,0x24,0x03,0x31,0x03,0x3E,0x03, 0x4B,0x03,0x58,0x03,0x65,0x03,0x72,0x03,0x7F,0x03,0x8C,0x03,0x99,0x03,0xA6,0x03,0xB3,0x03, 0xC0,0x03,0xCD,0x03,0xDA,0x03,0xE7,0x03,0xF4,0x03,0x01,0x04,0x1A,0x04,0x27,0x04,0x34,0x04, 0x41,0x04,0x4E,0x04,0x5B,0x04,0x68,0x04,0x75,0x04,0x82,0x04,0x8F,0x04,0xA8,0x04,0xB5,0x04, 0xC2,0x04,0xCF,0x04,0xDC,0x04,0xE9,0x04,0xF6,0x04,0x03,0x05, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x21 '!' 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, 4, // 0x22 '"' 0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x23 '#' 0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x00, 6, // 0x24 '$' 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, 7, // 0x25 '%' 0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, 7, // 0x26 '&' 0x00,0x30,0x48,0x48,0x48,0x30,0x4A,0x4A,0x44,0x3A,0x00,0x00, 3, // 0x27 ''' 0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x00, 5, // 0x29 ')' 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x00, 6, // 0x2A '*' 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, 6, // 0x2B '+' 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, 4, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x40,0x80, 6, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, 4, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, 7, // 0x2F '/' 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, 7, // 0x30 '0' 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00, 4, // 0x31 '1' 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, 7, // 0x32 '2' 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, 7, // 0x33 '3' 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, 6, // 0x34 '4' 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00, 7, // 0x35 '5' 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x36 '6' 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x37 '7' 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00, 7, // 0x38 '8' 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x39 '9' 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, 4, // 0x3A ':' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00, 4, // 0x3B ';' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x40,0x80, 6, // 0x3C '<' 0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, 6, // 0x3D '=' 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, 6, // 0x3E '>' 0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, 6, // 0x3F '?' 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, 7, // 0x40 '@' 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, 7, // 0x41 'A' 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x42 'B' 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, 6, // 0x43 'C' 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, 7, // 0x44 'D' 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, 6, // 0x45 'E' 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, 6, // 0x46 'F' 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, 7, // 0x47 'G' 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00, 7, // 0x48 'H' 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, 5, // 0x49 'I' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 6, // 0x4A 'J' 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, 6, // 0x4B 'K' 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00, 6, // 0x4C 'L' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, 9, // 0x4D 'M' 0x00,0x00,0x41,0x00,0x63,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, 7, // 0x4E 'N' 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00, 7, // 0x4F 'O' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x50 'P' 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, 7, // 0x51 'Q' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, 7, // 0x52 'R' 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, 7, // 0x53 'S' 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, 6, // 0x54 'T' 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 7, // 0x55 'U' 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x56 'V' 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, 9, // 0x57 'W' 0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x22,0x00,0x00,0x00,0x00,0x00, 7, // 0x58 'X' 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, 7, // 0x59 'Y' 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, 6, // 0x5A 'Z' 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, 4, // 0x5B '[' 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00, 7, // 0x5C '\' 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, 4, // 0x5D ']' 0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x00, 6, // 0x5E '^' 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, 4, // 0x60 '`' 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x61 'a' 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, 7, // 0x62 'b' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, 7, // 0x64 'd' 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, 7, // 0x65 'e' 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, 4, // 0x66 'f' 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 7, // 0x67 'g' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, 7, // 0x68 'h' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00, 3, // 0x69 'i' 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 5, // 0x6A 'j' 0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60, 6, // 0x6B 'k' 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, 3, // 0x6C 'l' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 9, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, 7, // 0x6E 'n' 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x6F 'o' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x70 'p' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40, 7, // 0x71 'q' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, 6, // 0x72 'r' 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, 5, // 0x74 't' 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00, 7, // 0x75 'u' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, 9, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x36,0x00,0x00,0x00,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, 6, // 0x7A 'z' 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, 5, // 0x7B '{' 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, 3, // 0x7C '|' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, 5, // 0x7D '}' 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0,0x00, 7, // 0x7E '~' 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x7F '' 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u mcs13_prop[] = { 13, 4, 32, 128-32, 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x38,0x00,0x46,0x00,0x54,0x00,0x62,0x00,0x70,0x00, 0x7E,0x00,0x8C,0x00,0x9A,0x00,0xA8,0x00,0xB6,0x00,0xC4,0x00,0xD2,0x00,0xE0,0x00,0xEE,0x00, 0xFC,0x00,0x0A,0x01,0x18,0x01,0x26,0x01,0x34,0x01,0x42,0x01,0x50,0x01,0x5E,0x01,0x6C,0x01, 0x7A,0x01,0x88,0x01,0x96,0x01,0xA4,0x01,0xB2,0x01,0xC0,0x01,0xCE,0x01,0xDC,0x01,0xEA,0x01, 0xF8,0x01,0x06,0x02,0x14,0x02,0x22,0x02,0x30,0x02,0x3E,0x02,0x4C,0x02,0x5A,0x02,0x68,0x02, 0x76,0x02,0x91,0x02,0x9F,0x02,0xAD,0x02,0xBB,0x02,0xC9,0x02,0xD7,0x02,0xE5,0x02,0xF3,0x02, 0x01,0x03,0x0F,0x03,0x2A,0x03,0x38,0x03,0x46,0x03,0x54,0x03,0x62,0x03,0x70,0x03,0x7E,0x03, 0x8C,0x03,0x9A,0x03,0xA8,0x03,0xB6,0x03,0xC4,0x03,0xD2,0x03,0xE0,0x03,0xEE,0x03,0xFC,0x03, 0x0A,0x04,0x18,0x04,0x26,0x04,0x34,0x04,0x42,0x04,0x50,0x04,0x6B,0x04,0x79,0x04,0x87,0x04, 0x95,0x04,0xA3,0x04,0xB1,0x04,0xBF,0x04,0xCD,0x04,0xDB,0x04,0xE9,0x04,0x04,0x05,0x12,0x05, 0x20,0x05,0x2E,0x05,0x3C,0x05,0x4A,0x05,0x58,0x05,0x66,0x05, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x21 '!' 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, 4, // 0x22 '"' 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x23 '#' 0x00,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x28,0x00, 6, // 0x24 '$' 0x00,0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, 7, // 0x25 '%' 0x00,0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, 7, // 0x26 '&' 0x00,0x30,0x48,0x48,0x48,0x30,0x4A,0x4A,0x44,0x3A,0x00,0x00,0x00, 3, // 0x27 ''' 0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x00,0x00, 5, // 0x29 ')' 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x00,0x00, 6, // 0x2A '*' 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00,0x00, 6, // 0x2B '+' 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x00, 4, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0x40,0x80, 6, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00, 7, // 0x2F '/' 0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, 7, // 0x30 '0' 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00,0x00, 4, // 0x31 '1' 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, 7, // 0x32 '2' 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, 7, // 0x33 '3' 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, 6, // 0x34 '4' 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00,0x00, 7, // 0x35 '5' 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00,0x00, 7, // 0x36 '6' 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 6, // 0x37 '7' 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00,0x00, 7, // 0x38 '8' 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x39 '9' 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00,0x00, 4, // 0x3A ':' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00, 4, // 0x3B ';' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x20,0x40,0x80, 6, // 0x3C '<' 0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, 6, // 0x3D '=' 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, 6, // 0x3E '>' 0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, 6, // 0x3F '?' 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00,0x00, 7, // 0x40 '@' 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00,0x00, 7, // 0x41 'A' 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x42 'B' 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00,0x00, 6, // 0x43 'C' 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, 7, // 0x44 'D' 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, 6, // 0x45 'E' 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, 6, // 0x46 'F' 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 7, // 0x47 'G' 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, 7, // 0x48 'H' 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 5, // 0x49 'I' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, 6, // 0x4A 'J' 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, 6, // 0x4B 'K' 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00,0x00, 6, // 0x4C 'L' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, 9, // 0x4D 'M' 0x00,0x00,0x41,0x00,0x63,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x4E 'N' 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00,0x00, 7, // 0x4F 'O' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x50 'P' 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00,0x00, 7, // 0x51 'Q' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, 7, // 0x52 'R' 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00,0x00, 7, // 0x53 'S' 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, 6, // 0x54 'T' 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, 7, // 0x55 'U' 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 6, // 0x56 'V' 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00,0x00, 9, // 0x57 'W' 0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x58 'X' 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x59 'Y' 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00,0x00, 6, // 0x5A 'Z' 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00,0x00, 4, // 0x5B '[' 0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00,0x00, 7, // 0x5C '\' 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00,0x00, 4, // 0x5D ']' 0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xE0,0x00,0x00, 6, // 0x5E '^' 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00, 4, // 0x60 '`' 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x61 'a' 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, 7, // 0x62 'b' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, 7, // 0x64 'd' 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, 7, // 0x65 'e' 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00,0x00, 4, // 0x66 'f' 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 7, // 0x67 'g' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, 7, // 0x68 'h' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 3, // 0x69 'i' 0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 5, // 0x6A 'j' 0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00, 6, // 0x6B 'k' 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, 3, // 0x6C 'l' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 9, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x6E 'n' 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x6F 'o' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x70 'p' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40, 7, // 0x71 'q' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04,0x04, 6, // 0x72 'r' 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00,0x00, 5, // 0x74 't' 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00,0x00, 7, // 0x75 'u' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, 9, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, 6, // 0x7A 'z' 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, 5, // 0x7B '{' 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00,0x00, 3, // 0x7C '|' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 5, // 0x7D '}' 0xC0,0x20,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x20,0xC0,0x00,0x00, 7, // 0x7E '~' 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x7F '' 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u mcs5x10_mono[] = { 10, 2, 32, 128-32, 0x00,0x00,0x0B,0x00,0x16,0x00,0x21,0x00,0x2C,0x00,0x37,0x00,0x42,0x00,0x4D,0x00,0x58,0x00, 0x63,0x00,0x6E,0x00,0x79,0x00,0x84,0x00,0x8F,0x00,0x9A,0x00,0xA5,0x00,0xB0,0x00,0xBB,0x00, 0xC6,0x00,0xD1,0x00,0xDC,0x00,0xE7,0x00,0xF2,0x00,0xFD,0x00,0x08,0x01,0x13,0x01,0x1E,0x01, 0x29,0x01,0x34,0x01,0x3F,0x01,0x4A,0x01,0x55,0x01,0x60,0x01,0x6B,0x01,0x76,0x01,0x81,0x01, 0x8C,0x01,0x97,0x01,0xA2,0x01,0xAD,0x01,0xB8,0x01,0xC3,0x01,0xCE,0x01,0xD9,0x01,0xE4,0x01, 0xEF,0x01,0xFA,0x01,0x05,0x02,0x10,0x02,0x1B,0x02,0x26,0x02,0x31,0x02,0x3C,0x02,0x47,0x02, 0x52,0x02,0x5D,0x02,0x68,0x02,0x73,0x02,0x7E,0x02,0x89,0x02,0x94,0x02,0x9F,0x02,0xAA,0x02, 0xB5,0x02,0xC0,0x02,0xCB,0x02,0xD6,0x02,0xE1,0x02,0xEC,0x02,0xF7,0x02,0x02,0x03,0x0D,0x03, 0x18,0x03,0x23,0x03,0x2E,0x03,0x39,0x03,0x44,0x03,0x4F,0x03,0x5A,0x03,0x65,0x03,0x70,0x03, 0x7B,0x03,0x86,0x03,0x91,0x03,0x9C,0x03,0xA7,0x03,0xB2,0x03,0xBD,0x03,0xC8,0x03,0xD3,0x03, 0xDE,0x03,0xE9,0x03,0xF4,0x03,0xFF,0x03,0x0A,0x04,0x15,0x04, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x21 '!' 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00, 5, // 0x22 '"' 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x23 '#' 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50, 5, // 0x24 '$' 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20, 5, // 0x25 '%' 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90, 5, // 0x26 '&' 0x00,0x40,0xA0,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68, 5, // 0x27 ''' 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x20,0x20,0x10, 5, // 0x29 ')' 0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x20,0x20,0x40, 5, // 0x2A '*' 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00, 5, // 0x2B '+' 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00, 5, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0, 5, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00, 5, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00, 5, // 0x2F '/' 0x00,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x00, 5, // 0x30 '0' 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, 5, // 0x31 '1' 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00, 5, // 0x32 '2' 0x00,0x60,0x90,0x90,0x10,0x20,0x40,0x80,0xF0,0x00, 5, // 0x33 '3' 0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00, 5, // 0x34 '4' 0x00,0x10,0x30,0x50,0x50,0x90,0xF0,0x10,0x10,0x00, 5, // 0x35 '5' 0x00,0xF0,0x80,0x80,0xE0,0x10,0x10,0x90,0x60,0x00, 5, // 0x36 '6' 0x00,0x60,0x80,0x80,0xE0,0x90,0x90,0x90,0x60,0x00, 5, // 0x37 '7' 0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00, 5, // 0x38 '8' 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00, 5, // 0x39 '9' 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x10,0x60,0x00, 5, // 0x3A ':' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00, 5, // 0x3B ';' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0xC0, 5, // 0x3C '<' 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08, 5, // 0x3D '=' 0x00,0x00,0x00,0x00,0xF0,0x00,0xF0,0x00,0x00,0x00, 5, // 0x3E '>' 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80, 5, // 0x3F '?' 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00, 5, // 0x40 '@' 0x00,0x60,0x90,0x90,0xB0,0xB0,0x80,0x80,0x70,0x00, 5, // 0x41 'A' 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00, 5, // 0x42 'B' 0x00,0xE0,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00, 5, // 0x43 'C' 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x90,0x60,0x00, 5, // 0x44 'D' 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00, 5, // 0x45 'E' 0x00,0xF0,0x80,0x80,0xF0,0x80,0x80,0x80,0xF0,0x00, 5, // 0x46 'F' 0x00,0xF0,0x80,0x80,0xF0,0x80,0x80,0x80,0x80,0x00, 5, // 0x47 'G' 0x00,0x60,0x90,0x80,0x80,0xB0,0x90,0x90,0x60,0x00, 5, // 0x48 'H' 0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00, 5, // 0x49 'I' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, 5, // 0x4A 'J' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0xA0,0x40,0x00, 5, // 0x4B 'K' 0x00,0x90,0xA0,0xA0,0xC0,0xC0,0xA0,0xA0,0x90,0x00, 5, // 0x4C 'L' 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00, 5, // 0x4D 'M' 0x00,0x90,0x90,0xF0,0xF0,0x90,0x90,0x90,0x90,0x00, 5, // 0x4E 'N' 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x00, 5, // 0x4F 'O' 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, 5, // 0x50 'P' 0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00, 5, // 0x51 'Q' 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30, 5, // 0x52 'R' 0x00,0xE0,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00, 5, // 0x53 'S' 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x90,0x60,0x00, 5, // 0x54 'T' 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, 5, // 0x55 'U' 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00, 5, // 0x56 'V' 0x00,0x90,0x90,0x90,0x50,0x50,0x50,0x20,0x20,0x00, 5, // 0x57 'W' 0x00,0x90,0x90,0x90,0x90,0x90,0xF0,0xF0,0x90,0x00, 5, // 0x58 'X' 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00, 5, // 0x59 'Y' 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00, 5, // 0x5A 'Z' 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0xF0,0x00, 5, // 0x5B '[' 0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, 5, // 0x5C '\' 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08, 5, // 0x5D ']' 0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, 5, // 0x5E '^' 0x00,0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, 5, // 0x60 '`' 0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x61 'a' 0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00, 5, // 0x62 'b' 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00, 5, // 0x63 'c' 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00, 5, // 0x64 'd' 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00, 5, // 0x65 'e' 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x70,0x00, 5, // 0x66 'f' 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00, 5, // 0x67 'g' 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0xE0, 5, // 0x68 'h' 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, 5, // 0x69 'i' 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00, 5, // 0x6A 'j' 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0xC0, 5, // 0x6B 'k' 0x00,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00, 5, // 0x6C 'l' 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00, 5, // 0x6D 'm' 0x00,0x00,0x00,0x90,0xF0,0x90,0x90,0x90,0x90,0x00, 5, // 0x6E 'n' 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x00, 5, // 0x6F 'o' 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00, 5, // 0x70 'p' 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80, 5, // 0x71 'q' 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x10, 5, // 0x72 'r' 0x00,0x00,0x00,0xB0,0x50,0x40,0x40,0x40,0xE0,0x00, 5, // 0x73 's' 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00, 5, // 0x74 't' 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x50,0x20,0x00, 5, // 0x75 'u' 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00, 5, // 0x76 'v' 0x00,0x00,0x00,0x90,0x90,0x50,0x50,0x20,0x20,0x00, 5, // 0x77 'w' 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x00, 5, // 0x78 'x' 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00, 5, // 0x79 'y' 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, 5, // 0x7A 'z' 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,0x00, 5, // 0x7B '{' 0x30,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, 5, // 0x7C '|' 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 5, // 0x7D '}' 0xC0,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, 5, // 0x7E '~' 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x7F '' 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00, 0 }; const int8u mcs5x11_mono[] = { 11, 3, 32, 128-32, 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x21 '!' 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, 5, // 0x22 '"' 0x00,0x50,0x50,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x23 '#' 0x00,0x50,0x50,0xF8,0x50,0x50,0x50,0xF8,0x50,0x50,0x00, 5, // 0x24 '$' 0x00,0x40,0x60,0x90,0x80,0x60,0x10,0x90,0x60,0x20,0x00, 5, // 0x25 '%' 0x00,0x00,0x90,0x90,0x20,0x20,0x40,0x40,0x90,0x90,0x00, 5, // 0x26 '&' 0x00,0x40,0xA0,0xA0,0x40,0xA8,0x90,0x90,0x68,0x00,0x00, 5, // 0x27 ''' 0x00,0x20,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x20,0x20,0x10, 5, // 0x29 ')' 0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x20,0x20,0x40, 5, // 0x2A '*' 0x00,0x00,0x90,0x60,0xF0,0x60,0x90,0x00,0x00,0x00,0x00, 5, // 0x2B '+' 0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00, 5, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x40,0x80, 5, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00, 5, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, 5, // 0x2F '/' 0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, 5, // 0x30 '0' 0x00,0x70,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, 5, // 0x31 '1' 0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 5, // 0x32 '2' 0x00,0x60,0x90,0x90,0x10,0x20,0x40,0x80,0xF0,0x00,0x00, 5, // 0x33 '3' 0x00,0x60,0x90,0x10,0x60,0x10,0x10,0x90,0x60,0x00,0x00, 5, // 0x34 '4' 0x00,0x10,0x30,0x50,0x50,0x90,0xF8,0x10,0x10,0x00,0x00, 5, // 0x35 '5' 0x00,0xF0,0x80,0xE0,0x90,0x10,0x10,0x90,0x60,0x00,0x00, 5, // 0x36 '6' 0x00,0x60,0x90,0x80,0xE0,0x90,0x90,0x90,0x60,0x00,0x00, 5, // 0x37 '7' 0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x00,0x00, 5, // 0x38 '8' 0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x90,0x60,0x00,0x00, 5, // 0x39 '9' 0x00,0x60,0x90,0x90,0x90,0x70,0x10,0x90,0x60,0x00,0x00, 5, // 0x3A ':' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00, 5, // 0x3B ';' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x40,0x80, 5, // 0x3C '<' 0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00, 5, // 0x3D '=' 0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00, 5, // 0x3E '>' 0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00, 5, // 0x3F '?' 0x00,0x60,0x90,0x10,0x10,0x20,0x40,0x00,0x40,0x00,0x00, 5, // 0x40 '@' 0x00,0x60,0x90,0x90,0xB0,0xB0,0x80,0x80,0x70,0x00,0x00, 5, // 0x41 'A' 0x00,0x60,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x00,0x00, 5, // 0x42 'B' 0x00,0xE0,0x90,0x90,0xE0,0x90,0x90,0x90,0xE0,0x00,0x00, 5, // 0x43 'C' 0x00,0x60,0x90,0x80,0x80,0x80,0x80,0x90,0x60,0x00,0x00, 5, // 0x44 'D' 0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, 5, // 0x45 'E' 0x00,0xF0,0x80,0x80,0xE0,0x80,0x80,0x80,0xF0,0x00,0x00, 5, // 0x46 'F' 0x00,0xF0,0x80,0x80,0xE0,0x80,0x80,0x80,0x80,0x00,0x00, 5, // 0x47 'G' 0x00,0x60,0x90,0x80,0x80,0xB0,0x90,0x90,0x60,0x00,0x00, 5, // 0x48 'H' 0x00,0x90,0x90,0x90,0xF0,0x90,0x90,0x90,0x90,0x00,0x00, 5, // 0x49 'I' 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 5, // 0x4A 'J' 0x00,0x70,0x20,0x20,0x20,0x20,0xA0,0xA0,0x40,0x00,0x00, 5, // 0x4B 'K' 0x00,0x90,0xA0,0xA0,0xC0,0xA0,0xA0,0x90,0x90,0x00,0x00, 5, // 0x4C 'L' 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00,0x00, 5, // 0x4D 'M' 0x00,0x90,0xF0,0xF0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, 5, // 0x4E 'N' 0x00,0x90,0x90,0xD0,0xD0,0xB0,0xB0,0x90,0x90,0x00,0x00, 5, // 0x4F 'O' 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00,0x00, 5, // 0x50 'P' 0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80,0x80,0x00,0x00, 5, // 0x51 'Q' 0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x30,0x00, 5, // 0x52 'R' 0x00,0xE0,0x90,0x90,0x90,0xE0,0xA0,0x90,0x90,0x00,0x00, 5, // 0x53 'S' 0x00,0x60,0x90,0x80,0x60,0x10,0x90,0x90,0x60,0x00,0x00, 5, // 0x54 'T' 0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00, 5, // 0x55 'U' 0x00,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x00,0x00, 5, // 0x56 'V' 0x00,0x90,0x90,0x90,0x50,0x50,0x50,0x20,0x20,0x00,0x00, 5, // 0x57 'W' 0x00,0x90,0x90,0x90,0x90,0x90,0xF0,0xF0,0x90,0x00,0x00, 5, // 0x58 'X' 0x00,0x90,0x90,0x90,0x60,0x60,0x90,0x90,0x90,0x00,0x00, 5, // 0x59 'Y' 0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00,0x00, 5, // 0x5A 'Z' 0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0xF0,0x00,0x00, 5, // 0x5B '[' 0x00,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, 5, // 0x5C '\' 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, 5, // 0x5D ']' 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, 5, // 0x5E '^' 0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00, 5, // 0x60 '`' 0x00,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x61 'a' 0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x90,0x70,0x00,0x00, 5, // 0x62 'b' 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0xE0,0x00,0x00, 5, // 0x63 'c' 0x00,0x00,0x00,0x60,0x90,0x80,0x80,0x90,0x60,0x00,0x00, 5, // 0x64 'd' 0x00,0x10,0x10,0x70,0x90,0x90,0x90,0x90,0x70,0x00,0x00, 5, // 0x65 'e' 0x00,0x00,0x00,0x60,0x90,0x90,0xF0,0x80,0x70,0x00,0x00, 5, // 0x66 'f' 0x00,0x30,0x40,0xE0,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 5, // 0x67 'g' 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, 5, // 0x68 'h' 0x00,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, 5, // 0x69 'i' 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 5, // 0x6A 'j' 0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, 5, // 0x6B 'k' 0x00,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x90,0x00,0x00, 5, // 0x6C 'l' 0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 5, // 0x6D 'm' 0x00,0x00,0x00,0x90,0xF0,0x90,0x90,0x90,0x90,0x00,0x00, 5, // 0x6E 'n' 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0x90,0x00,0x00, 5, // 0x6F 'o' 0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x90,0x60,0x00,0x00, 5, // 0x70 'p' 0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0xE0,0x80,0x80, 5, // 0x71 'q' 0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x90,0x70,0x10,0x10, 5, // 0x72 'r' 0x00,0x00,0x00,0xA0,0x50,0x40,0x40,0x40,0xE0,0x00,0x00, 5, // 0x73 's' 0x00,0x00,0x00,0x60,0x90,0x40,0x20,0x90,0x60,0x00,0x00, 5, // 0x74 't' 0x00,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x30,0x00,0x00, 5, // 0x75 'u' 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x00,0x00, 5, // 0x76 'v' 0x00,0x00,0x00,0x90,0x90,0x50,0x50,0x20,0x20,0x00,0x00, 5, // 0x77 'w' 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0xF0,0x90,0x00,0x00, 5, // 0x78 'x' 0x00,0x00,0x00,0x90,0x90,0x60,0x60,0x90,0x90,0x00,0x00, 5, // 0x79 'y' 0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x90,0x70,0x10,0xE0, 5, // 0x7A 'z' 0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0xF0,0x00,0x00, 5, // 0x7B '{' 0x30,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x40,0x30, 5, // 0x7C '|' 0x00,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x00, 5, // 0x7D '}' 0xC0,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0xC0, 5, // 0x7E '~' 0x00,0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x7F '' 0x00,0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00,0x00,0x00, 0 }; const int8u mcs6x10_mono[] = { 10, 3, 32, 128-32, 0x00,0x00,0x0B,0x00,0x16,0x00,0x21,0x00,0x2C,0x00,0x37,0x00,0x42,0x00,0x4D,0x00,0x58,0x00, 0x63,0x00,0x6E,0x00,0x79,0x00,0x84,0x00,0x8F,0x00,0x9A,0x00,0xA5,0x00,0xB0,0x00,0xBB,0x00, 0xC6,0x00,0xD1,0x00,0xDC,0x00,0xE7,0x00,0xF2,0x00,0xFD,0x00,0x08,0x01,0x13,0x01,0x1E,0x01, 0x29,0x01,0x34,0x01,0x3F,0x01,0x4A,0x01,0x55,0x01,0x60,0x01,0x6B,0x01,0x76,0x01,0x81,0x01, 0x8C,0x01,0x97,0x01,0xA2,0x01,0xAD,0x01,0xB8,0x01,0xC3,0x01,0xCE,0x01,0xD9,0x01,0xE4,0x01, 0xEF,0x01,0xFA,0x01,0x05,0x02,0x10,0x02,0x1B,0x02,0x26,0x02,0x31,0x02,0x3C,0x02,0x47,0x02, 0x52,0x02,0x5D,0x02,0x68,0x02,0x73,0x02,0x7E,0x02,0x89,0x02,0x94,0x02,0x9F,0x02,0xAA,0x02, 0xB5,0x02,0xC0,0x02,0xCB,0x02,0xD6,0x02,0xE1,0x02,0xEC,0x02,0xF7,0x02,0x02,0x03,0x0D,0x03, 0x18,0x03,0x23,0x03,0x2E,0x03,0x39,0x03,0x44,0x03,0x4F,0x03,0x5A,0x03,0x65,0x03,0x70,0x03, 0x7B,0x03,0x86,0x03,0x91,0x03,0x9C,0x03,0xA7,0x03,0xB2,0x03,0xBD,0x03,0xC8,0x03,0xD3,0x03, 0xDE,0x03,0xE9,0x03,0xF4,0x03,0xFF,0x03,0x0A,0x04,0x15,0x04, 6, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x21 '!' 0x00,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, 6, // 0x22 '"' 0x00,0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x23 '#' 0x00,0x28,0x28,0x7C,0x28,0x28,0x7C,0x28,0x28,0x00, 6, // 0x24 '$' 0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, 6, // 0x25 '%' 0x00,0x08,0xC8,0xD0,0x10,0x20,0x2C,0x4C,0x40,0x00, 6, // 0x26 '&' 0x00,0x20,0x50,0x50,0x24,0x54,0x48,0x34,0x00,0x00, 6, // 0x27 ''' 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x28 '(' 0x08,0x10,0x10,0x20,0x20,0x20,0x10,0x10,0x08,0x00, 6, // 0x29 ')' 0x20,0x10,0x10,0x08,0x08,0x08,0x10,0x10,0x20,0x00, 6, // 0x2A '*' 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00, 6, // 0x2B '+' 0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, 6, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, 6, // 0x2D '-' 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, 6, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, 6, // 0x2F '/' 0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, 6, // 0x30 '0' 0x00,0x38,0x44,0x4C,0x54,0x64,0x44,0x38,0x00,0x00, 6, // 0x31 '1' 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 6, // 0x32 '2' 0x00,0x38,0x44,0x04,0x18,0x20,0x40,0x7C,0x00,0x00, 6, // 0x33 '3' 0x00,0x38,0x44,0x04,0x38,0x04,0x44,0x38,0x00,0x00, 6, // 0x34 '4' 0x00,0x08,0x18,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, 6, // 0x35 '5' 0x00,0x7C,0x40,0x40,0x78,0x04,0x44,0x38,0x00,0x00, 6, // 0x36 '6' 0x00,0x38,0x40,0x40,0x78,0x44,0x44,0x38,0x00,0x00, 6, // 0x37 '7' 0x00,0x7C,0x04,0x08,0x10,0x20,0x20,0x20,0x00,0x00, 6, // 0x38 '8' 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x38,0x00,0x00, 6, // 0x39 '9' 0x00,0x38,0x44,0x44,0x3C,0x04,0x04,0x38,0x00,0x00, 6, // 0x3A ':' 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00, 6, // 0x3B ';' 0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40, 6, // 0x3C '<' 0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, 6, // 0x3D '=' 0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, 6, // 0x3E '>' 0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, 6, // 0x3F '?' 0x00,0x38,0x44,0x04,0x18,0x10,0x00,0x10,0x00,0x00, 6, // 0x40 '@' 0x00,0x38,0x44,0x5C,0x54,0x5C,0x40,0x38,0x00,0x00, 6, // 0x41 'A' 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x00,0x00, 6, // 0x42 'B' 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x78,0x00,0x00, 6, // 0x43 'C' 0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, 6, // 0x44 'D' 0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, 6, // 0x45 'E' 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x00,0x00, 6, // 0x46 'F' 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x00,0x00, 6, // 0x47 'G' 0x00,0x38,0x44,0x40,0x4C,0x44,0x44,0x3C,0x00,0x00, 6, // 0x48 'H' 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00, 6, // 0x49 'I' 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 6, // 0x4A 'J' 0x00,0x1C,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, 6, // 0x4B 'K' 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, 6, // 0x4C 'L' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, 6, // 0x4D 'M' 0x00,0x44,0x6C,0x54,0x54,0x44,0x44,0x44,0x00,0x00, 6, // 0x4E 'N' 0x00,0x44,0x44,0x64,0x54,0x4C,0x44,0x44,0x00,0x00, 6, // 0x4F 'O' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x50 'P' 0x00,0x78,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, 6, // 0x51 'Q' 0x00,0x38,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, 6, // 0x52 'R' 0x00,0x78,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, 6, // 0x53 'S' 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, 6, // 0x54 'T' 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 6, // 0x55 'U' 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x56 'V' 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x10,0x00,0x00, 6, // 0x57 'W' 0x00,0x44,0x44,0x54,0x54,0x54,0x54,0x28,0x00,0x00, 6, // 0x58 'X' 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, 6, // 0x59 'Y' 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x00,0x00, 6, // 0x5A 'Z' 0x00,0x78,0x08,0x10,0x20,0x40,0x40,0x78,0x00,0x00, 6, // 0x5B '[' 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, 6, // 0x5C '\' 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, 6, // 0x5D ']' 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, 6, // 0x5E '^' 0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, 6, // 0x60 '`' 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x61 'a' 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x3C,0x00,0x00, 6, // 0x62 'b' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x78,0x00,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x3C,0x00,0x00, 6, // 0x64 'd' 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, 6, // 0x65 'e' 0x00,0x00,0x00,0x38,0x44,0x78,0x40,0x3C,0x00,0x00, 6, // 0x66 'f' 0x00,0x0C,0x10,0x10,0x38,0x10,0x10,0x10,0x00,0x00, 6, // 0x67 'g' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x38, 6, // 0x68 'h' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x00,0x00, 6, // 0x69 'i' 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x38,0x00,0x00, 6, // 0x6A 'j' 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x48,0x30, 6, // 0x6B 'k' 0x00,0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00,0x00, 6, // 0x6C 'l' 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 6, // 0x6D 'm' 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x00,0x00, 6, // 0x6E 'n' 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x00,0x00, 6, // 0x6F 'o' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x70 'p' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40, 6, // 0x71 'q' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x3C,0x04,0x04, 6, // 0x72 'r' 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x70,0x00,0x00, 6, // 0x73 's' 0x00,0x00,0x00,0x38,0x40,0x38,0x04,0x78,0x00,0x00, 6, // 0x74 't' 0x00,0x10,0x10,0x38,0x10,0x10,0x14,0x08,0x00,0x00, 6, // 0x75 'u' 0x00,0x00,0x00,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x00,0x00, 6, // 0x77 'w' 0x00,0x00,0x00,0x44,0x44,0x54,0x7C,0x28,0x00,0x00, 6, // 0x78 'x' 0x00,0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00,0x00, 6, // 0x79 'y' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x3C,0x04,0x38, 6, // 0x7A 'z' 0x00,0x00,0x00,0x78,0x08,0x30,0x40,0x78,0x00,0x00, 6, // 0x7B '{' 0x18,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x18,0x00, 6, // 0x7C '|' 0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x00, 6, // 0x7D '}' 0x60,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x60,0x00, 6, // 0x7E '~' 0x00,0x48,0xA8,0x90,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x7F '' 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00, 0 }; const int8u mcs6x11_mono[] = { 11, 3, 32, 128-32, 0x00,0x00,0x0C,0x00,0x18,0x00,0x24,0x00,0x30,0x00,0x3C,0x00,0x48,0x00,0x54,0x00,0x60,0x00, 0x6C,0x00,0x78,0x00,0x84,0x00,0x90,0x00,0x9C,0x00,0xA8,0x00,0xB4,0x00,0xC0,0x00,0xCC,0x00, 0xD8,0x00,0xE4,0x00,0xF0,0x00,0xFC,0x00,0x08,0x01,0x14,0x01,0x20,0x01,0x2C,0x01,0x38,0x01, 0x44,0x01,0x50,0x01,0x5C,0x01,0x68,0x01,0x74,0x01,0x80,0x01,0x8C,0x01,0x98,0x01,0xA4,0x01, 0xB0,0x01,0xBC,0x01,0xC8,0x01,0xD4,0x01,0xE0,0x01,0xEC,0x01,0xF8,0x01,0x04,0x02,0x10,0x02, 0x1C,0x02,0x28,0x02,0x34,0x02,0x40,0x02,0x4C,0x02,0x58,0x02,0x64,0x02,0x70,0x02,0x7C,0x02, 0x88,0x02,0x94,0x02,0xA0,0x02,0xAC,0x02,0xB8,0x02,0xC4,0x02,0xD0,0x02,0xDC,0x02,0xE8,0x02, 0xF4,0x02,0x00,0x03,0x0C,0x03,0x18,0x03,0x24,0x03,0x30,0x03,0x3C,0x03,0x48,0x03,0x54,0x03, 0x60,0x03,0x6C,0x03,0x78,0x03,0x84,0x03,0x90,0x03,0x9C,0x03,0xA8,0x03,0xB4,0x03,0xC0,0x03, 0xCC,0x03,0xD8,0x03,0xE4,0x03,0xF0,0x03,0xFC,0x03,0x08,0x04,0x14,0x04,0x20,0x04,0x2C,0x04, 0x38,0x04,0x44,0x04,0x50,0x04,0x5C,0x04,0x68,0x04,0x74,0x04, 6, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x21 '!' 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, 6, // 0x22 '"' 0x00,0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x23 '#' 0x00,0x28,0x28,0x7C,0x28,0x28,0x7C,0x28,0x28,0x00,0x00, 6, // 0x24 '$' 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00, 6, // 0x25 '%' 0x00,0x68,0xA8,0xD0,0x10,0x20,0x2C,0x54,0x58,0x00,0x00, 6, // 0x26 '&' 0x00,0x20,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00, 6, // 0x27 ''' 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x28 '(' 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, 6, // 0x29 ')' 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, 6, // 0x2A '*' 0x00,0x00,0x28,0x7C,0x38,0x7C,0x28,0x00,0x00,0x00,0x00, 6, // 0x2B '+' 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, 6, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, 6, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, 6, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, 6, // 0x2F '/' 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00, 6, // 0x30 '0' 0x00,0x38,0x44,0x44,0x54,0x54,0x44,0x44,0x38,0x00,0x00, 6, // 0x31 '1' 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 6, // 0x32 '2' 0x00,0x38,0x44,0x44,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, 6, // 0x33 '3' 0x00,0x38,0x44,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, 6, // 0x34 '4' 0x00,0x08,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, 6, // 0x35 '5' 0x00,0x7C,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, 6, // 0x36 '6' 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x37 '7' 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00, 6, // 0x38 '8' 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x39 '9' 0x00,0x38,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, 6, // 0x3A ':' 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00, 6, // 0x3B ';' 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40, 6, // 0x3C '<' 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00, 6, // 0x3D '=' 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00, 6, // 0x3E '>' 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00, 6, // 0x3F '?' 0x00,0x38,0x44,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, 6, // 0x40 '@' 0x00,0x38,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, 6, // 0x41 'A' 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00, 6, // 0x42 'B' 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, 6, // 0x43 'C' 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, 6, // 0x44 'D' 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, 6, // 0x45 'E' 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, 6, // 0x46 'F' 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, 6, // 0x47 'G' 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x4C,0x34,0x00,0x00, 6, // 0x48 'H' 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, 6, // 0x49 'I' 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 6, // 0x4A 'J' 0x00,0x1C,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, 6, // 0x4B 'K' 0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x44,0x00,0x00, 6, // 0x4C 'L' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, 6, // 0x4D 'M' 0x00,0x44,0x6C,0x54,0x54,0x54,0x44,0x44,0x44,0x00,0x00, 6, // 0x4E 'N' 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x00,0x00, 6, // 0x4F 'O' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x50 'P' 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, 6, // 0x51 'Q' 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, 6, // 0x52 'R' 0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, 6, // 0x53 'S' 0x00,0x38,0x44,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, 6, // 0x54 'T' 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 6, // 0x55 'U' 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x56 'V' 0x00,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, 6, // 0x57 'W' 0x00,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x28,0x00,0x00, 6, // 0x58 'X' 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, 6, // 0x59 'Y' 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, 6, // 0x5A 'Z' 0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, 6, // 0x5B '[' 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, 6, // 0x5C '\' 0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, 6, // 0x5D ']' 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, 6, // 0x5E '^' 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, 6, // 0x60 '`' 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x61 'a' 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00, 6, // 0x62 'b' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, 6, // 0x64 'd' 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, 6, // 0x65 'e' 0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, 6, // 0x66 'f' 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 6, // 0x67 'g' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, 6, // 0x68 'h' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, 6, // 0x69 'i' 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 6, // 0x6A 'j' 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x50,0x20, 6, // 0x6B 'k' 0x00,0x40,0x40,0x4C,0x50,0x60,0x50,0x48,0x44,0x00,0x00, 6, // 0x6C 'l' 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 6, // 0x6D 'm' 0x00,0x00,0x00,0x68,0x54,0x54,0x54,0x44,0x44,0x00,0x00, 6, // 0x6E 'n' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, 6, // 0x6F 'o' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 6, // 0x70 'p' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, 6, // 0x71 'q' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, 6, // 0x72 'r' 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x70,0x00,0x00, 6, // 0x73 's' 0x00,0x00,0x00,0x38,0x44,0x30,0x08,0x44,0x38,0x00,0x00, 6, // 0x74 't' 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x18,0x00,0x00, 6, // 0x75 'u' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, 6, // 0x77 'w' 0x00,0x00,0x00,0x44,0x44,0x44,0x54,0x7C,0x28,0x00,0x00, 6, // 0x78 'x' 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, 6, // 0x79 'y' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, 6, // 0x7A 'z' 0x00,0x00,0x00,0x7C,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, 6, // 0x7B '{' 0x18,0x20,0x20,0x20,0xC0,0xC0,0x20,0x20,0x20,0x18,0x00, 6, // 0x7C '|' 0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x00, 6, // 0x7D '}' 0x60,0x10,0x10,0x10,0x0C,0x0C,0x10,0x10,0x10,0x60,0x00, 6, // 0x7E '~' 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x7F '' 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00, 0 }; const int8u mcs7x12_mono_high[] = { 12, 3, 32, 128-32, 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7D,0x02,0x8A,0x02,0x97,0x02,0xA4,0x02,0xB1,0x02, 0xBE,0x02,0xCB,0x02,0xD8,0x02,0xE5,0x02,0xF2,0x02,0xFF,0x02,0x0C,0x03,0x19,0x03,0x26,0x03, 0x33,0x03,0x40,0x03,0x4D,0x03,0x5A,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8E,0x03,0x9B,0x03, 0xA8,0x03,0xB5,0x03,0xC2,0x03,0xCF,0x03,0xDC,0x03,0xE9,0x03,0xF6,0x03,0x03,0x04,0x10,0x04, 0x1D,0x04,0x2A,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5E,0x04,0x6B,0x04,0x78,0x04,0x85,0x04, 0x92,0x04,0x9F,0x04,0xAC,0x04,0xB9,0x04,0xC6,0x04,0xD3,0x04, 7, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x21 '!' 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, 7, // 0x22 '"' 0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x23 '#' 0x24,0x24,0x24,0x7E,0x24,0x24,0x24,0x7E,0x24,0x24,0x24,0x00, 7, // 0x24 '$' 0x10,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x10,0x00, 7, // 0x25 '%' 0x32,0x54,0x64,0x08,0x08,0x10,0x10,0x26,0x2A,0x4C,0x00,0x00, 7, // 0x26 '&' 0x00,0x20,0x50,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00, 7, // 0x27 ''' 0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x28 '(' 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, 7, // 0x29 ')' 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, 7, // 0x2A '*' 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, 7, // 0x2B '+' 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, 7, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40, 7, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, 7, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, 7, // 0x2F '/' 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, 7, // 0x30 '0' 0x00,0x38,0x44,0x44,0x54,0x54,0x54,0x44,0x44,0x38,0x00,0x00, 7, // 0x31 '1' 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 7, // 0x32 '2' 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, 7, // 0x33 '3' 0x00,0x38,0x44,0x04,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x34 '4' 0x00,0x08,0x18,0x28,0x28,0x48,0x48,0x7C,0x08,0x08,0x00,0x00, 7, // 0x35 '5' 0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x36 '6' 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x37 '7' 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x00,0x00, 7, // 0x38 '8' 0x00,0x38,0x44,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x39 '9' 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x3A ':' 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00, 7, // 0x3B ';' 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x20,0x40, 7, // 0x3C '<' 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, 7, // 0x3D '=' 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, 7, // 0x3E '>' 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, 7, // 0x3F '?' 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, 7, // 0x40 '@' 0x00,0x38,0x44,0x44,0x5C,0x54,0x54,0x4C,0x40,0x38,0x00,0x00, 7, // 0x41 'A' 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x42 'B' 0x00,0x78,0x44,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00, 7, // 0x43 'C' 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00, 7, // 0x44 'D' 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00, 7, // 0x45 'E' 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00, 7, // 0x46 'F' 0x00,0x7C,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, 7, // 0x47 'G' 0x00,0x38,0x44,0x40,0x40,0x5C,0x44,0x44,0x4C,0x34,0x00,0x00, 7, // 0x48 'H' 0x00,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x49 'I' 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 7, // 0x4A 'J' 0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00, 7, // 0x4B 'K' 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x44,0x00,0x00, 7, // 0x4C 'L' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, 7, // 0x4D 'M' 0x00,0x44,0x6C,0x6C,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x4E 'N' 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x44,0x00,0x00, 7, // 0x4F 'O' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x50 'P' 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, 7, // 0x51 'Q' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00, 7, // 0x52 'R' 0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00, 7, // 0x53 'S' 0x00,0x38,0x44,0x40,0x40,0x38,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x54 'T' 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 7, // 0x55 'U' 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x56 'V' 0x00,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, 7, // 0x57 'W' 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00, 7, // 0x58 'X' 0x00,0x44,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00, 7, // 0x59 'Y' 0x00,0x44,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00, 7, // 0x5A 'Z' 0x00,0x7C,0x04,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00, 7, // 0x5B '[' 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, 7, // 0x5C '\' 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, 7, // 0x5D ']' 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, 7, // 0x5E '^' 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00, 7, // 0x60 '`' 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x61 'a' 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x44,0x3C,0x00,0x00, 7, // 0x62 'b' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x00,0x00, 7, // 0x63 'c' 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, 7, // 0x64 'd' 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, 7, // 0x65 'e' 0x00,0x00,0x00,0x38,0x44,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, 7, // 0x66 'f' 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 7, // 0x67 'g' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x78, 7, // 0x68 'h' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x69 'i' 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 7, // 0x6A 'j' 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x48,0x30, 7, // 0x6B 'k' 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, 7, // 0x6C 'l' 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 7, // 0x6D 'm' 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x6E 'n' 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x6F 'o' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x70 'p' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x78,0x40,0x40, 7, // 0x71 'q' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, 7, // 0x72 'r' 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, 7, // 0x74 't' 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x20,0x24,0x18,0x00,0x00, 7, // 0x75 'u' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00, 7, // 0x76 'v' 0x00,0x00,0x00,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, 7, // 0x77 'w' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x08,0x70, 7, // 0x7A 'z' 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, 7, // 0x7B '{' 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, 7, // 0x7C '|' 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, 7, // 0x7D '}' 0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60,0x00, 7, // 0x7E '~' 0x00,0x60,0x92,0x92,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x7F '' 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u mcs7x12_mono_low[] = { 12, 4, 32, 128-32, 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x4E,0x00,0x5B,0x00,0x68,0x00, 0x75,0x00,0x82,0x00,0x8F,0x00,0x9C,0x00,0xA9,0x00,0xB6,0x00,0xC3,0x00,0xD0,0x00,0xDD,0x00, 0xEA,0x00,0xF7,0x00,0x04,0x01,0x11,0x01,0x1E,0x01,0x2B,0x01,0x38,0x01,0x45,0x01,0x52,0x01, 0x5F,0x01,0x6C,0x01,0x79,0x01,0x86,0x01,0x93,0x01,0xA0,0x01,0xAD,0x01,0xBA,0x01,0xC7,0x01, 0xD4,0x01,0xE1,0x01,0xEE,0x01,0xFB,0x01,0x08,0x02,0x15,0x02,0x22,0x02,0x2F,0x02,0x3C,0x02, 0x49,0x02,0x56,0x02,0x63,0x02,0x70,0x02,0x7D,0x02,0x8A,0x02,0x97,0x02,0xA4,0x02,0xB1,0x02, 0xBE,0x02,0xCB,0x02,0xD8,0x02,0xE5,0x02,0xF2,0x02,0xFF,0x02,0x0C,0x03,0x19,0x03,0x26,0x03, 0x33,0x03,0x40,0x03,0x4D,0x03,0x5A,0x03,0x67,0x03,0x74,0x03,0x81,0x03,0x8E,0x03,0x9B,0x03, 0xA8,0x03,0xB5,0x03,0xC2,0x03,0xCF,0x03,0xDC,0x03,0xE9,0x03,0xF6,0x03,0x03,0x04,0x10,0x04, 0x1D,0x04,0x2A,0x04,0x37,0x04,0x44,0x04,0x51,0x04,0x5E,0x04,0x6B,0x04,0x78,0x04,0x85,0x04, 0x92,0x04,0x9F,0x04,0xAC,0x04,0xB9,0x04,0xC6,0x04,0xD3,0x04, 7, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x21 '!' 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x00, 7, // 0x22 '"' 0x28,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x23 '#' 0x00,0x28,0x28,0x7C,0x28,0x28,0x28,0x7C,0x28,0x28,0x00,0x00, 7, // 0x24 '$' 0x00,0x10,0x38,0x54,0x50,0x38,0x14,0x54,0x38,0x10,0x00,0x00, 7, // 0x25 '%' 0x34,0x54,0x68,0x08,0x10,0x10,0x20,0x2C,0x54,0x58,0x00,0x00, 7, // 0x26 '&' 0x00,0x20,0x50,0x50,0x20,0x54,0x54,0x48,0x34,0x00,0x00,0x00, 7, // 0x27 ''' 0x00,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x28 '(' 0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x00, 7, // 0x29 ')' 0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, 7, // 0x2A '*' 0x00,0x00,0x10,0x54,0x38,0x7C,0x38,0x54,0x10,0x00,0x00,0x00, 7, // 0x2B '+' 0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00,0x00, 7, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40,0x00, 7, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, 7, // 0x2F '/' 0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,0x00, 7, // 0x30 '0' 0x00,0x38,0x44,0x44,0x54,0x54,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x31 '1' 0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, 7, // 0x32 '2' 0x00,0x38,0x44,0x44,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, 7, // 0x33 '3' 0x00,0x38,0x44,0x04,0x38,0x04,0x04,0x44,0x38,0x00,0x00,0x00, 7, // 0x34 '4' 0x00,0x08,0x18,0x28,0x28,0x48,0x7C,0x08,0x08,0x00,0x00,0x00, 7, // 0x35 '5' 0x00,0x7C,0x40,0x78,0x44,0x04,0x04,0x44,0x38,0x00,0x00,0x00, 7, // 0x36 '6' 0x00,0x38,0x44,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x37 '7' 0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00,0x00, 7, // 0x38 '8' 0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x39 '9' 0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x44,0x38,0x00,0x00,0x00, 7, // 0x3A ':' 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00, 7, // 0x3B ';' 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x20,0x40,0x00, 7, // 0x3C '<' 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, 7, // 0x3D '=' 0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00, 7, // 0x3E '>' 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, 7, // 0x3F '?' 0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, 7, // 0x40 '@' 0x00,0x38,0x44,0x44,0x5C,0x54,0x4C,0x40,0x38,0x00,0x00,0x00, 7, // 0x41 'A' 0x00,0x38,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x42 'B' 0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x44,0x78,0x00,0x00,0x00, 7, // 0x43 'C' 0x00,0x38,0x44,0x40,0x40,0x40,0x40,0x44,0x38,0x00,0x00,0x00, 7, // 0x44 'D' 0x00,0x70,0x48,0x44,0x44,0x44,0x44,0x48,0x70,0x00,0x00,0x00, 7, // 0x45 'E' 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, 7, // 0x46 'F' 0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 7, // 0x47 'G' 0x00,0x38,0x44,0x40,0x40,0x4C,0x44,0x4C,0x34,0x00,0x00,0x00, 7, // 0x48 'H' 0x00,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x49 'I' 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, 7, // 0x4A 'J' 0x00,0x1C,0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00,0x00,0x00, 7, // 0x4B 'K' 0x00,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x00,0x00,0x00, 7, // 0x4C 'L' 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00,0x00, 7, // 0x4D 'M' 0x00,0x44,0x6C,0x54,0x54,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x4E 'N' 0x00,0x44,0x64,0x64,0x54,0x54,0x4C,0x4C,0x44,0x00,0x00,0x00, 7, // 0x4F 'O' 0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x50 'P' 0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00,0x00, 7, // 0x51 'Q' 0x00,0x38,0x44,0x44,0x44,0x44,0x54,0x48,0x34,0x00,0x00,0x00, 7, // 0x52 'R' 0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x44,0x00,0x00,0x00, 7, // 0x53 'S' 0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x54 'T' 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, 7, // 0x55 'U' 0x00,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x56 'V' 0x00,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00,0x00, 7, // 0x57 'W' 0x00,0x44,0x44,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00,0x00, 7, // 0x58 'X' 0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x59 'Y' 0x00,0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x00,0x00,0x00, 7, // 0x5A 'Z' 0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x40,0x7C,0x00,0x00,0x00, 7, // 0x5B '[' 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, 7, // 0x5C '\' 0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, 7, // 0x5D ']' 0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, 7, // 0x5E '^' 0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00, 7, // 0x60 '`' 0x00,0x20,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x61 'a' 0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00,0x00, 7, // 0x62 'b' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00,0x00, 7, // 0x63 'c' 0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00,0x00, 7, // 0x64 'd' 0x00,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00,0x00, 7, // 0x65 'e' 0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00,0x00, 7, // 0x66 'f' 0x00,0x0C,0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00, 7, // 0x67 'g' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x44,0x38, 7, // 0x68 'h' 0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x69 'i' 0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, 7, // 0x6A 'j' 0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08,0x08,0x48,0x48,0x30, 7, // 0x6B 'k' 0x00,0x40,0x40,0x4C,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, 7, // 0x6C 'l' 0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, 7, // 0x6D 'm' 0x00,0x00,0x00,0x68,0x54,0x54,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x6E 'n' 0x00,0x00,0x00,0x58,0x64,0x44,0x44,0x44,0x44,0x00,0x00,0x00, 7, // 0x6F 'o' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00,0x00, 7, // 0x70 'p' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40,0x40, 7, // 0x71 'q' 0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04,0x04, 7, // 0x72 'r' 0x00,0x00,0x00,0x58,0x24,0x20,0x20,0x20,0x70,0x00,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x38,0x44,0x30,0x08,0x44,0x38,0x00,0x00,0x00, 7, // 0x74 't' 0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x24,0x18,0x00,0x00,0x00, 7, // 0x75 'u' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x4C,0x34,0x00,0x00,0x00, 7, // 0x76 'v' 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00,0x00, 7, // 0x77 'w' 0x00,0x00,0x00,0x44,0x44,0x44,0x54,0x54,0x28,0x00,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x08,0x70, 7, // 0x7A 'z' 0x00,0x00,0x00,0x7C,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, 7, // 0x7B '{' 0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x20,0x18,0x00, 7, // 0x7C '|' 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, 7, // 0x7D '}' 0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60,0x00, 7, // 0x7E '~' 0x00,0x24,0x54,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x7F '' 0x00,0x10,0x38,0x6C,0x44,0x44,0x7C,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u verdana12[] = { 12, 3, 32, 128-32, 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x5A,0x00,0x67,0x00,0x74,0x00, 0x81,0x00,0x8E,0x00,0x9B,0x00,0xA8,0x00,0xB5,0x00,0xC2,0x00,0xCF,0x00,0xDC,0x00,0xE9,0x00, 0xF6,0x00,0x03,0x01,0x10,0x01,0x1D,0x01,0x2A,0x01,0x37,0x01,0x44,0x01,0x51,0x01,0x5E,0x01, 0x6B,0x01,0x78,0x01,0x85,0x01,0x92,0x01,0x9F,0x01,0xAC,0x01,0xC5,0x01,0xD2,0x01,0xDF,0x01, 0xEC,0x01,0xF9,0x01,0x06,0x02,0x13,0x02,0x20,0x02,0x2D,0x02,0x3A,0x02,0x47,0x02,0x54,0x02, 0x61,0x02,0x7A,0x02,0x87,0x02,0xA0,0x02,0xAD,0x02,0xC6,0x02,0xD3,0x02,0xE0,0x02,0xED,0x02, 0xFA,0x02,0x07,0x03,0x20,0x03,0x2D,0x03,0x3A,0x03,0x47,0x03,0x54,0x03,0x61,0x03,0x6E,0x03, 0x7B,0x03,0x88,0x03,0x95,0x03,0xA2,0x03,0xAF,0x03,0xBC,0x03,0xC9,0x03,0xD6,0x03,0xE3,0x03, 0xF0,0x03,0xFD,0x03,0x0A,0x04,0x17,0x04,0x24,0x04,0x31,0x04,0x4A,0x04,0x57,0x04,0x64,0x04, 0x71,0x04,0x7E,0x04,0x8B,0x04,0x98,0x04,0xA5,0x04,0xB2,0x04,0xBF,0x04,0xCC,0x04,0xD9,0x04, 0xE6,0x04,0xF3,0x04,0x00,0x05,0x0D,0x05,0x1A,0x05,0x27,0x05, 3, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x21 '!' 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, 5, // 0x22 '"' 0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x23 '#' 0x00,0x00,0x00,0x00,0x28,0x7C,0x28,0x7C,0x28,0x00,0x00,0x00, 7, // 0x24 '$' 0x00,0x00,0x10,0x10,0x3C,0x50,0x30,0x18,0x14,0x78,0x10,0x10, 11, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x4A,0x00,0x4A,0x00,0x35,0x80,0x0A,0x40,0x0A,0x40,0x11,0x80,0x00,0x00,0x00,0x00, 7, // 0x26 '&' 0x00,0x00,0x00,0x30,0x48,0x48,0x32,0x4A,0x44,0x3A,0x00,0x00, 3, // 0x27 ''' 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x28 '(' 0x00,0x00,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x10, 4, // 0x29 ')' 0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x80, 7, // 0x2A '*' 0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x2B '+' 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, 3, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80,0x00, 5, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00, 3, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x00, 4, // 0x2F '/' 0x00,0x00,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x80,0x00, 7, // 0x30 '0' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x31 '1' 0x00,0x00,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00,0x00, 7, // 0x32 '2' 0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x7C,0x00,0x00, 7, // 0x33 '3' 0x00,0x00,0x00,0x38,0x44,0x04,0x18,0x04,0x44,0x38,0x00,0x00, 7, // 0x34 '4' 0x00,0x00,0x00,0x08,0x18,0x28,0x48,0x7C,0x08,0x08,0x00,0x00, 7, // 0x35 '5' 0x00,0x00,0x00,0x7C,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x36 '6' 0x00,0x00,0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x38,0x00,0x00, 7, // 0x37 '7' 0x00,0x00,0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x10,0x00,0x00, 7, // 0x38 '8' 0x00,0x00,0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x38,0x00,0x00, 7, // 0x39 '9' 0x00,0x00,0x00,0x38,0x44,0x44,0x3C,0x04,0x08,0x30,0x00,0x00, 4, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x40,0x40,0x00,0x00, 4, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x40,0x40,0x80,0x00, 7, // 0x3C '<' 0x00,0x00,0x00,0x00,0x04,0x18,0x60,0x18,0x04,0x00,0x00,0x00, 7, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x7C,0x00,0x00,0x00,0x00, 7, // 0x3E '>' 0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x30,0x40,0x00,0x00,0x00, 6, // 0x3F '?' 0x00,0x00,0x00,0x70,0x08,0x08,0x10,0x20,0x00,0x20,0x00,0x00, 10, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x4E,0x80,0x52,0x80,0x52,0x80,0x4D,0x00,0x20,0x00,0x1F,0x00,0x00,0x00, 8, // 0x41 'A' 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x7E,0x42,0x42,0x00,0x00, 7, // 0x42 'B' 0x00,0x00,0x00,0x70,0x48,0x48,0x78,0x44,0x44,0x78,0x00,0x00, 8, // 0x43 'C' 0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00, 8, // 0x44 'D' 0x00,0x00,0x00,0x78,0x44,0x42,0x42,0x42,0x44,0x78,0x00,0x00, 7, // 0x45 'E' 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x00,0x00, 6, // 0x46 'F' 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x00,0x00, 8, // 0x47 'G' 0x00,0x00,0x00,0x1C,0x22,0x40,0x4E,0x42,0x22,0x1C,0x00,0x00, 8, // 0x48 'H' 0x00,0x00,0x00,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x00,0x00, 5, // 0x49 'I' 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 5, // 0x4A 'J' 0x00,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, 7, // 0x4B 'K' 0x00,0x00,0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, 6, // 0x4C 'L' 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, 9, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x55,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x00,0x00,0x00,0x00, 8, // 0x4E 'N' 0x00,0x00,0x00,0x42,0x62,0x52,0x4A,0x46,0x42,0x42,0x00,0x00, 9, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, 7, // 0x50 'P' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x00,0x00, 9, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x04,0x00,0x03,0x00, 7, // 0x52 'R' 0x00,0x00,0x00,0x78,0x44,0x44,0x78,0x50,0x48,0x44,0x00,0x00, 7, // 0x53 'S' 0x00,0x00,0x00,0x38,0x44,0x40,0x38,0x04,0x44,0x38,0x00,0x00, 7, // 0x54 'T' 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 8, // 0x55 'U' 0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, 8, // 0x56 'V' 0x00,0x00,0x00,0x42,0x42,0x42,0x24,0x24,0x18,0x18,0x00,0x00, 9, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x55,0x00,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00, 7, // 0x58 'X' 0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, 7, // 0x59 'Y' 0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x00,0x00, 7, // 0x5A 'Z' 0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, 4, // 0x5B '[' 0x00,0x00,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x60, 4, // 0x5C '\' 0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x00, 4, // 0x5D ']' 0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60, 7, // 0x5E '^' 0x00,0x00,0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, 6, // 0x60 '`' 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x30,0x08,0x38,0x48,0x38,0x00,0x00, 6, // 0x62 'b' 0x00,0x00,0x40,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x00,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x40,0x40,0x38,0x00,0x00, 6, // 0x64 'd' 0x00,0x00,0x08,0x08,0x08,0x38,0x48,0x48,0x48,0x38,0x00,0x00, 6, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x78,0x40,0x38,0x00,0x00, 4, // 0x66 'f' 0x00,0x00,0x30,0x40,0x40,0xE0,0x40,0x40,0x40,0x40,0x00,0x00, 6, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x30, 6, // 0x68 'h' 0x00,0x00,0x40,0x40,0x40,0x70,0x48,0x48,0x48,0x48,0x00,0x00, 3, // 0x69 'i' 0x00,0x00,0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 3, // 0x6A 'j' 0x00,0x00,0x00,0x40,0x00,0xC0,0x40,0x40,0x40,0x40,0x40,0x80, 6, // 0x6B 'k' 0x00,0x00,0x40,0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00,0x00, 3, // 0x6C 'l' 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 9, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x49,0x00,0x00,0x00,0x00,0x00, 6, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x70,0x48,0x48,0x48,0x48,0x00,0x00, 6, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00, 6, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x70,0x48,0x48,0x48,0x70,0x40,0x40, 6, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x08, 4, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x50,0x60,0x40,0x40,0x40,0x00,0x00, 6, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x30,0x08,0x70,0x00,0x00, 4, // 0x74 't' 0x00,0x00,0x00,0x00,0x40,0xF0,0x40,0x40,0x40,0x30,0x00,0x00, 6, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x38,0x00,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x30,0x30,0x00,0x00, 7, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x44,0x54,0x54,0x28,0x28,0x00,0x00, 6, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00,0x00, 6, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x48,0x30,0x10,0x20,0x20, 5, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x70,0x10,0x20,0x40,0x70,0x00,0x00, 6, // 0x7B '{' 0x00,0x00,0x18,0x20,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0x18, 5, // 0x7C '|' 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 6, // 0x7D '}' 0x00,0x00,0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x60, 7, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x58,0x00,0x00,0x00,0x00, 9, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u verdana12_bold[] = { 12, 3, 32, 128-32, 0x00,0x00,0x0D,0x00,0x1A,0x00,0x27,0x00,0x34,0x00,0x41,0x00,0x5A,0x00,0x67,0x00,0x74,0x00, 0x81,0x00,0x8E,0x00,0x9B,0x00,0xA8,0x00,0xB5,0x00,0xC2,0x00,0xCF,0x00,0xDC,0x00,0xE9,0x00, 0xF6,0x00,0x03,0x01,0x10,0x01,0x1D,0x01,0x2A,0x01,0x37,0x01,0x44,0x01,0x51,0x01,0x5E,0x01, 0x6B,0x01,0x78,0x01,0x85,0x01,0x92,0x01,0x9F,0x01,0xAC,0x01,0xC5,0x01,0xD2,0x01,0xDF,0x01, 0xEC,0x01,0xF9,0x01,0x06,0x02,0x13,0x02,0x20,0x02,0x2D,0x02,0x3A,0x02,0x47,0x02,0x54,0x02, 0x61,0x02,0x6E,0x02,0x7B,0x02,0x88,0x02,0x95,0x02,0xA2,0x02,0xAF,0x02,0xBC,0x02,0xC9,0x02, 0xD6,0x02,0xE3,0x02,0xFC,0x02,0x09,0x03,0x16,0x03,0x23,0x03,0x30,0x03,0x3D,0x03,0x4A,0x03, 0x57,0x03,0x64,0x03,0x71,0x03,0x7E,0x03,0x8B,0x03,0x98,0x03,0xA5,0x03,0xB2,0x03,0xBF,0x03, 0xCC,0x03,0xD9,0x03,0xE6,0x03,0xF3,0x03,0x00,0x04,0x0D,0x04,0x26,0x04,0x33,0x04,0x40,0x04, 0x4D,0x04,0x5A,0x04,0x67,0x04,0x74,0x04,0x81,0x04,0x8E,0x04,0x9B,0x04,0xB4,0x04,0xC1,0x04, 0xCE,0x04,0xDB,0x04,0xE8,0x04,0xF5,0x04,0x02,0x05,0x0F,0x05, 3, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x21 '!' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x00,0x00, 5, // 0x22 '"' 0x00,0x00,0xD8,0xD8,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x23 '#' 0x00,0x00,0x00,0x14,0x14,0x7E,0x28,0xFC,0x50,0x50,0x00,0x00, 6, // 0x24 '$' 0x00,0x00,0x20,0x20,0x70,0xE8,0xE0,0x38,0xB8,0x70,0x20,0x20, 11, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x00,0x94,0x00,0x94,0x00,0x69,0x80,0x0A,0x40,0x0A,0x40,0x11,0x80,0x00,0x00,0x00,0x00, 8, // 0x26 '&' 0x00,0x00,0x00,0x70,0xD8,0xD8,0x76,0xDC,0xCC,0x76,0x00,0x00, 3, // 0x27 ''' 0x00,0x00,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x00,0x00,0x30,0x60,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x60,0x30, 5, // 0x29 ')' 0x00,0x00,0xC0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xC0, 6, // 0x2A '*' 0x00,0x00,0x20,0xA8,0x70,0xA8,0x20,0x00,0x00,0x00,0x00,0x00, 8, // 0x2B '+' 0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00,0x00, 3, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x80,0x00, 4, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00, 3, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00,0x00, 6, // 0x2F '/' 0x00,0x00,0x08,0x08,0x10,0x10,0x20,0x40,0x40,0x80,0x80,0x00, 6, // 0x30 '0' 0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00, 6, // 0x31 '1' 0x00,0x00,0x00,0x30,0x70,0x30,0x30,0x30,0x30,0x78,0x00,0x00, 6, // 0x32 '2' 0x00,0x00,0x00,0x70,0x98,0x18,0x30,0x60,0xC0,0xF8,0x00,0x00, 6, // 0x33 '3' 0x00,0x00,0x00,0x70,0x98,0x18,0x70,0x18,0x98,0x70,0x00,0x00, 6, // 0x34 '4' 0x00,0x00,0x00,0x18,0x38,0x58,0x98,0xFC,0x18,0x18,0x00,0x00, 6, // 0x35 '5' 0x00,0x00,0x00,0xF8,0xC0,0xF0,0x18,0x18,0x98,0x70,0x00,0x00, 6, // 0x36 '6' 0x00,0x00,0x00,0x70,0xC0,0xF0,0xD8,0xD8,0xD8,0x70,0x00,0x00, 6, // 0x37 '7' 0x00,0x00,0x00,0xF8,0x18,0x30,0x30,0x60,0x60,0xC0,0x00,0x00, 6, // 0x38 '8' 0x00,0x00,0x00,0x70,0xD8,0xD8,0x70,0xD8,0xD8,0x70,0x00,0x00, 6, // 0x39 '9' 0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0x78,0x18,0x70,0x00,0x00, 4, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x00,0x00, 4, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x40,0x00, 8, // 0x3C '<' 0x00,0x00,0x00,0x00,0x04,0x18,0x60,0x60,0x18,0x04,0x00,0x00, 8, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x7C,0x00,0x00,0x00,0x00, 8, // 0x3E '>' 0x00,0x00,0x00,0x00,0x40,0x30,0x0C,0x0C,0x30,0x40,0x00,0x00, 6, // 0x3F '?' 0x00,0x00,0x00,0xF0,0x18,0x18,0x30,0x60,0x00,0x60,0x00,0x00, 9, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x42,0x00,0x9D,0x00,0xA5,0x00,0xA5,0x00,0x9E,0x00,0x40,0x00,0x3C,0x00,0x00,0x00, 8, // 0x41 'A' 0x00,0x00,0x00,0x38,0x38,0x6C,0x6C,0x7C,0xC6,0xC6,0x00,0x00, 7, // 0x42 'B' 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xF8,0xCC,0xCC,0xF8,0x00,0x00, 6, // 0x43 'C' 0x00,0x00,0x00,0x70,0xC8,0xC0,0xC0,0xC0,0xC8,0x70,0x00,0x00, 7, // 0x44 'D' 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xCC,0xCC,0xF8,0x00,0x00, 6, // 0x45 'E' 0x00,0x00,0x00,0xF8,0xC0,0xC0,0xF8,0xC0,0xC0,0xF8,0x00,0x00, 6, // 0x46 'F' 0x00,0x00,0x00,0xF8,0xC0,0xC0,0xF8,0xC0,0xC0,0xC0,0x00,0x00, 7, // 0x47 'G' 0x00,0x00,0x00,0x78,0xC4,0xC0,0xC0,0xDC,0xCC,0x7C,0x00,0x00, 7, // 0x48 'H' 0x00,0x00,0x00,0xCC,0xCC,0xCC,0xFC,0xCC,0xCC,0xCC,0x00,0x00, 5, // 0x49 'I' 0x00,0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00,0x00, 5, // 0x4A 'J' 0x00,0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0xE0,0x00,0x00, 7, // 0x4B 'K' 0x00,0x00,0x00,0xCC,0xD8,0xF0,0xE0,0xF0,0xD8,0xCC,0x00,0x00, 6, // 0x4C 'L' 0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xF8,0x00,0x00, 8, // 0x4D 'M' 0x00,0x00,0x00,0x82,0xC6,0xEE,0xB6,0xB6,0x86,0x86,0x00,0x00, 7, // 0x4E 'N' 0x00,0x00,0x00,0x84,0xC4,0xE4,0xB4,0x9C,0x8C,0x84,0x00,0x00, 8, // 0x4F 'O' 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00, 7, // 0x50 'P' 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xF8,0xC0,0xC0,0x00,0x00, 8, // 0x51 'Q' 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x18,0x0E, 7, // 0x52 'R' 0x00,0x00,0x00,0xF8,0xCC,0xCC,0xF8,0xD8,0xCC,0xC6,0x00,0x00, 6, // 0x53 'S' 0x00,0x00,0x00,0x70,0xC8,0xC0,0x70,0x18,0x98,0x70,0x00,0x00, 6, // 0x54 'T' 0x00,0x00,0x00,0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00, 7, // 0x55 'U' 0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00, 7, // 0x56 'V' 0x00,0x00,0x00,0xCC,0xCC,0x78,0x78,0x78,0x30,0x30,0x00,0x00, 11, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0xC0,0xCC,0xC0,0x6D,0x80,0x6D,0x80,0x73,0x80,0x33,0x00,0x33,0x00,0x00,0x00,0x00,0x00, 7, // 0x58 'X' 0x00,0x00,0x00,0xCC,0xCC,0x78,0x30,0x78,0xCC,0xCC,0x00,0x00, 7, // 0x59 'Y' 0x00,0x00,0x00,0xCC,0xCC,0x78,0x30,0x30,0x30,0x30,0x00,0x00, 6, // 0x5A 'Z' 0x00,0x00,0x00,0xF8,0x18,0x30,0x60,0xC0,0xC0,0xF8,0x00,0x00, 5, // 0x5B '[' 0x00,0x00,0x70,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x70, 6, // 0x5C '\' 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x10,0x08,0x08,0x00, 5, // 0x5D ']' 0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x70, 8, // 0x5E '^' 0x00,0x00,0x00,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, 6, // 0x60 '`' 0x00,0x00,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x70,0x18,0x78,0xD8,0x78,0x00,0x00, 6, // 0x62 'b' 0x00,0x00,0xC0,0xC0,0xC0,0xF0,0xD8,0xD8,0xD8,0xF0,0x00,0x00, 5, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0xC0,0xC0,0x70,0x00,0x00, 6, // 0x64 'd' 0x00,0x00,0x18,0x18,0x18,0x78,0xD8,0xD8,0xD8,0x78,0x00,0x00, 6, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x70,0xD8,0xF8,0xC0,0x78,0x00,0x00, 5, // 0x66 'f' 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x00,0x00, 6, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x78,0xD8,0xD8,0xD8,0x78,0x18,0x70, 6, // 0x68 'h' 0x00,0x00,0xC0,0xC0,0xC0,0xF0,0xD8,0xD8,0xD8,0xD8,0x00,0x00, 3, // 0x69 'i' 0x00,0x00,0x00,0xC0,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00, 4, // 0x6A 'j' 0x00,0x00,0x00,0x60,0x00,0xE0,0x60,0x60,0x60,0x60,0x60,0xC0, 6, // 0x6B 'k' 0x00,0x00,0xC0,0xC0,0xC0,0xD8,0xD8,0xF0,0xD8,0xD8,0x00,0x00, 3, // 0x6C 'l' 0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00, 9, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF6,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0x00,0x00,0x00,0x00, 6, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0xF0,0xD8,0xD8,0xD8,0xD8,0x00,0x00, 6, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x70,0xD8,0xD8,0xD8,0x70,0x00,0x00, 6, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0xF0,0xD8,0xD8,0xD8,0xF0,0xC0,0xC0, 6, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x78,0xD8,0xD8,0xD8,0x78,0x18,0x18, 4, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0xD0,0xE0,0xC0,0xC0,0xC0,0x00,0x00, 5, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x70,0xC0,0xF0,0x30,0xE0,0x00,0x00, 5, // 0x74 't' 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x38,0x00,0x00, 6, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0xD8,0x78,0x00,0x00, 6, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0x70,0x70,0x00,0x00, 9, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDB,0x00,0xDB,0x00,0xDB,0x00,0x66,0x00,0x66,0x00,0x00,0x00,0x00,0x00, 6, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0x70,0xD8,0xD8,0x00,0x00, 6, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0xD8,0xD8,0xD8,0x70,0x70,0x30,0x60, 5, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0xF0,0x30,0x60,0xC0,0xF0,0x00,0x00, 6, // 0x7B '{' 0x00,0x00,0x18,0x30,0x30,0x30,0xE0,0x30,0x30,0x30,0x30,0x18, 5, // 0x7C '|' 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 6, // 0x7D '}' 0x00,0x00,0xC0,0x60,0x60,0x60,0x38,0x60,0x60,0x60,0x60,0xC0, 8, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x62,0x92,0x8C,0x00,0x00,0x00, 9, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u verdana13[] = { 13, 3, 32, 128-32, 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x45,0x00,0x53,0x00,0x6E,0x00,0x7C,0x00,0x8A,0x00, 0x98,0x00,0xA6,0x00,0xB4,0x00,0xCF,0x00,0xDD,0x00,0xEB,0x00,0xF9,0x00,0x07,0x01,0x15,0x01, 0x23,0x01,0x31,0x01,0x3F,0x01,0x4D,0x01,0x5B,0x01,0x69,0x01,0x77,0x01,0x85,0x01,0x93,0x01, 0xA1,0x01,0xAF,0x01,0xCA,0x01,0xE5,0x01,0x00,0x02,0x0E,0x02,0x29,0x02,0x37,0x02,0x45,0x02, 0x60,0x02,0x7B,0x02,0x89,0x02,0x97,0x02,0xB2,0x02,0xC0,0x02,0xCE,0x02,0xDC,0x02,0xEA,0x02, 0xF8,0x02,0x13,0x03,0x21,0x03,0x3C,0x03,0x4A,0x03,0x65,0x03,0x73,0x03,0x81,0x03,0x8F,0x03, 0x9D,0x03,0xAB,0x03,0xC6,0x03,0xD4,0x03,0xE2,0x03,0xF0,0x03,0xFE,0x03,0x0C,0x04,0x1A,0x04, 0x35,0x04,0x43,0x04,0x51,0x04,0x5F,0x04,0x6D,0x04,0x7B,0x04,0x89,0x04,0x97,0x04,0xA5,0x04, 0xB3,0x04,0xC1,0x04,0xCF,0x04,0xDD,0x04,0xEB,0x04,0xF9,0x04,0x14,0x05,0x22,0x05,0x30,0x05, 0x3E,0x05,0x4C,0x05,0x5A,0x05,0x68,0x05,0x76,0x05,0x84,0x05,0x92,0x05,0xAD,0x05,0xBB,0x05, 0xC9,0x05,0xD7,0x05,0xE5,0x05,0xF3,0x05,0x01,0x06,0x1C,0x06, 4, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x21 '!' 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, 5, // 0x22 '"' 0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x0A,0x00,0x3F,0x00,0x14,0x00,0x14,0x00,0x7E,0x00,0x28,0x00,0x28,0x00,0x00,0x00,0x00,0x00, 7, // 0x24 '$' 0x00,0x00,0x10,0x10,0x3C,0x50,0x50,0x38,0x14,0x14,0x78,0x10,0x10, 12, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x4A,0x00,0x32,0x00,0x04,0xC0,0x05,0x20,0x09,0x20,0x08,0xC0,0x00,0x00,0x00,0x00, 8, // 0x26 '&' 0x00,0x00,0x00,0x30,0x48,0x48,0x32,0x4A,0x44,0x46,0x39,0x00,0x00, 3, // 0x27 ''' 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x00,0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, 5, // 0x29 ')' 0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, 7, // 0x2A '*' 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, 4, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, 5, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00, 4, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00, 5, // 0x2F '/' 0x00,0x00,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, 7, // 0x30 '0' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x31 '1' 0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00, 7, // 0x32 '2' 0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, 7, // 0x33 '3' 0x00,0x00,0x00,0x38,0x44,0x04,0x18,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x34 '4' 0x00,0x00,0x00,0x08,0x18,0x28,0x48,0x88,0xFC,0x08,0x08,0x00,0x00, 7, // 0x35 '5' 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x04,0x04,0x44,0x38,0x00,0x00, 7, // 0x36 '6' 0x00,0x00,0x00,0x18,0x20,0x40,0x78,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x37 '7' 0x00,0x00,0x00,0x7C,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x00,0x00, 7, // 0x38 '8' 0x00,0x00,0x00,0x38,0x44,0x44,0x38,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x39 '9' 0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x3C,0x04,0x08,0x30,0x00,0x00, 5, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x00,0x00, 5, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x20,0x20,0x20,0x40, 9, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x3F '?' 0x00,0x00,0x00,0x70,0x08,0x08,0x10,0x20,0x20,0x00,0x20,0x00,0x00, 10, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x4E,0x80,0x52,0x80,0x52,0x80,0x52,0x80,0x4D,0x00,0x20,0x00,0x1E,0x00,0x00,0x00, 8, // 0x41 'A' 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x24,0x7E,0x42,0x42,0x00,0x00, 8, // 0x42 'B' 0x00,0x00,0x00,0x78,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00, 9, // 0x43 'C' 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, 9, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, 7, // 0x45 'E' 0x00,0x00,0x00,0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C,0x00,0x00, 6, // 0x46 'F' 0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x00,0x00, 9, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, 8, // 0x48 'H' 0x00,0x00,0x00,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0x00,0x00, 5, // 0x49 'I' 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 5, // 0x4A 'J' 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, 8, // 0x4B 'K' 0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x70,0x48,0x44,0x42,0x00,0x00, 6, // 0x4C 'L' 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x00,0x00, 9, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x55,0x00,0x55,0x00,0x49,0x00,0x49,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, 8, // 0x4E 'N' 0x00,0x00,0x00,0x62,0x62,0x52,0x52,0x4A,0x4A,0x46,0x46,0x00,0x00, 9, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, 7, // 0x50 'P' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0x00,0x00, 9, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x04,0x00,0x03,0x00, 8, // 0x52 'R' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x78,0x48,0x44,0x42,0x00,0x00, 8, // 0x53 'S' 0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00, 7, // 0x54 'T' 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 8, // 0x55 'U' 0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, 8, // 0x56 'V' 0x00,0x00,0x00,0x42,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x00,0x00, 11, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00, 8, // 0x58 'X' 0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x18,0x24,0x42,0x42,0x00,0x00, 7, // 0x59 'Y' 0x00,0x00,0x00,0x82,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 8, // 0x5A 'Z' 0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E,0x00,0x00, 5, // 0x5B '[' 0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, 5, // 0x5C '\' 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x00, 5, // 0x5D ']' 0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, 9, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE, 7, // 0x60 '`' 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x38,0x04,0x3C,0x44,0x44,0x3C,0x00,0x00, 7, // 0x62 'b' 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x44,0x38,0x00,0x00, 7, // 0x64 'd' 0x00,0x00,0x04,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, 7, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00, 4, // 0x66 'f' 0x00,0x00,0x30,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 7, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x38, 7, // 0x68 'h' 0x00,0x00,0x40,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, 3, // 0x69 'i' 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 4, // 0x6A 'j' 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, 7, // 0x6B 'k' 0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x70,0x48,0x44,0x00,0x00, 3, // 0x6C 'l' 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 11, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B,0x80,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00, 7, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x44,0x00,0x00, 7, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00, 7, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x78,0x40,0x40, 7, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x04, 5, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x00,0x00, 6, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x60,0x18,0x08,0x70,0x00,0x00, 4, // 0x74 't' 0x00,0x00,0x00,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x30,0x00,0x00, 7, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x3C,0x00,0x00, 7, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x10,0x00,0x00, 9, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x49,0x00,0x49,0x00,0x55,0x00,0x55,0x00,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x44,0x28,0x10,0x10,0x28,0x44,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x20, 6, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x78,0x08,0x10,0x20,0x40,0x78,0x00,0x00, 7, // 0x7B '{' 0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x0C, 5, // 0x7C '|' 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 7, // 0x7D '}' 0x00,0x00,0x60,0x10,0x10,0x10,0x10,0x0C,0x10,0x10,0x10,0x10,0x60, 9, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x00,0x00,0x00,0x00, 0 }; const int8u verdana13_bold[] = { 13, 3, 32, 128-32, 0x00,0x00,0x0E,0x00,0x1C,0x00,0x2A,0x00,0x45,0x00,0x53,0x00,0x6E,0x00,0x89,0x00,0x97,0x00, 0xA5,0x00,0xB3,0x00,0xC1,0x00,0xDC,0x00,0xEA,0x00,0xF8,0x00,0x06,0x01,0x14,0x01,0x22,0x01, 0x30,0x01,0x3E,0x01,0x4C,0x01,0x5A,0x01,0x68,0x01,0x76,0x01,0x84,0x01,0x92,0x01,0xA0,0x01, 0xAE,0x01,0xBC,0x01,0xD7,0x01,0xF2,0x01,0x0D,0x02,0x1B,0x02,0x36,0x02,0x51,0x02,0x5F,0x02, 0x6D,0x02,0x88,0x02,0x96,0x02,0xA4,0x02,0xBF,0x02,0xDA,0x02,0xE8,0x02,0xF6,0x02,0x04,0x03, 0x12,0x03,0x2D,0x03,0x48,0x03,0x63,0x03,0x71,0x03,0x8C,0x03,0x9A,0x03,0xA8,0x03,0xB6,0x03, 0xD1,0x03,0xDF,0x03,0xFA,0x03,0x08,0x04,0x16,0x04,0x24,0x04,0x32,0x04,0x40,0x04,0x4E,0x04, 0x69,0x04,0x77,0x04,0x85,0x04,0x93,0x04,0xA1,0x04,0xAF,0x04,0xBD,0x04,0xCB,0x04,0xD9,0x04, 0xE7,0x04,0xF5,0x04,0x03,0x05,0x11,0x05,0x1F,0x05,0x2D,0x05,0x48,0x05,0x56,0x05,0x64,0x05, 0x72,0x05,0x80,0x05,0x8E,0x05,0x9C,0x05,0xAA,0x05,0xB8,0x05,0xC6,0x05,0xE1,0x05,0xEF,0x05, 0xFD,0x05,0x0B,0x06,0x19,0x06,0x27,0x06,0x35,0x06,0x50,0x06, 4, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x21 '!' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x00,0x00, 7, // 0x22 '"' 0x00,0x00,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x0A,0x00,0x3F,0x00,0x14,0x00,0x14,0x00,0x7E,0x00,0x28,0x00,0x28,0x00,0x00,0x00,0x00,0x00, 8, // 0x24 '$' 0x00,0x00,0x08,0x08,0x3C,0x6A,0x68,0x3C,0x16,0x56,0x3C,0x10,0x10, 14, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x80,0x6C,0x80,0x6D,0x00,0x6D,0x70,0x3A,0xD8,0x02,0xD8,0x04,0xD8,0x04,0x70,0x00,0x00,0x00,0x00, 10, // 0x26 '&' 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x6C,0x00,0x6C,0x00,0x39,0x80,0x6D,0x00,0x66,0x00,0x63,0x00,0x3D,0x80,0x00,0x00,0x00,0x00, 4, // 0x27 ''' 0x00,0x00,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x28 '(' 0x00,0x00,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18, 6, // 0x29 ')' 0x00,0x00,0x60,0x30,0x30,0x18,0x18,0x18,0x18,0x18,0x30,0x30,0x60, 8, // 0x2A '*' 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, 4, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x40, 6, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00, 4, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, 8, // 0x2F '/' 0x00,0x00,0x06,0x06,0x0C,0x0C,0x18,0x18,0x18,0x30,0x30,0x60,0x60, 8, // 0x30 '0' 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, 8, // 0x31 '1' 0x00,0x00,0x00,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00, 8, // 0x32 '2' 0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00, 8, // 0x33 '3' 0x00,0x00,0x00,0x3C,0x66,0x06,0x1C,0x06,0x06,0x66,0x3C,0x00,0x00, 8, // 0x34 '4' 0x00,0x00,0x00,0x04,0x0C,0x1C,0x2C,0x4C,0x7E,0x0C,0x0C,0x00,0x00, 8, // 0x35 '5' 0x00,0x00,0x00,0x3E,0x30,0x30,0x3C,0x06,0x06,0x66,0x3C,0x00,0x00, 8, // 0x36 '6' 0x00,0x00,0x00,0x1C,0x30,0x60,0x7C,0x66,0x66,0x66,0x3C,0x00,0x00, 8, // 0x37 '7' 0x00,0x00,0x00,0x7E,0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x00,0x00, 8, // 0x38 '8' 0x00,0x00,0x00,0x3C,0x66,0x66,0x3C,0x66,0x66,0x66,0x3C,0x00,0x00, 8, // 0x39 '9' 0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x3E,0x06,0x0C,0x38,0x00,0x00, 4, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00, 4, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x40, 9, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00, 9, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00, 7, // 0x3F '?' 0x00,0x00,0x00,0x38,0x4C,0x0C,0x18,0x30,0x30,0x00,0x30,0x00,0x00, 11, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x20,0x40,0x4F,0x40,0x5B,0x40,0x5B,0x40,0x5B,0x40,0x4F,0x80,0x20,0x00,0x1F,0x00,0x00,0x00, 9, // 0x41 'A' 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, 8, // 0x42 'B' 0x00,0x00,0x00,0x7C,0x66,0x66,0x7C,0x66,0x66,0x66,0x7C,0x00,0x00, 8, // 0x43 'C' 0x00,0x00,0x00,0x3C,0x62,0x60,0x60,0x60,0x60,0x62,0x3C,0x00,0x00, 9, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x66,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x66,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, 8, // 0x45 'E' 0x00,0x00,0x00,0x7E,0x60,0x60,0x7E,0x60,0x60,0x60,0x7E,0x00,0x00, 8, // 0x46 'F' 0x00,0x00,0x00,0x7E,0x60,0x60,0x7E,0x60,0x60,0x60,0x60,0x00,0x00, 9, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x60,0x00,0x67,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, 9, // 0x48 'H' 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, 6, // 0x49 'I' 0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, 6, // 0x4A 'J' 0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0xF0,0x00,0x00, 8, // 0x4B 'K' 0x00,0x00,0x00,0x66,0x6C,0x78,0x70,0x70,0x78,0x6C,0x66,0x00,0x00, 7, // 0x4C 'L' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0x00, 10, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x71,0x80,0x7B,0x80,0x5D,0x80,0x49,0x80,0x41,0x80,0x41,0x80,0x41,0x80,0x00,0x00,0x00,0x00, 9, // 0x4E 'N' 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x61,0x00,0x71,0x00,0x59,0x00,0x4D,0x00,0x47,0x00,0x43,0x00,0x41,0x00,0x00,0x00,0x00,0x00, 9, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, 8, // 0x50 'P' 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x00,0x00, 9, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x0C,0x00,0x07,0x00, 8, // 0x52 'R' 0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x6C,0x66,0x63,0x00,0x00, 8, // 0x53 'S' 0x00,0x00,0x00,0x3C,0x62,0x60,0x7C,0x3E,0x06,0x46,0x3C,0x00,0x00, 8, // 0x54 'T' 0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00, 9, // 0x55 'U' 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, 8, // 0x56 'V' 0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x18,0x00,0x00, 12, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x36,0xC0,0x3F,0xC0,0x39,0xC0,0x19,0x80,0x19,0x80,0x00,0x00,0x00,0x00, 8, // 0x58 'X' 0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x18,0x3C,0x66,0x66,0x00,0x00, 8, // 0x59 'Y' 0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x18,0x18,0x18,0x18,0x00,0x00, 8, // 0x5A 'Z' 0x00,0x00,0x00,0x7E,0x06,0x0E,0x1C,0x38,0x70,0x60,0x7E,0x00,0x00, 6, // 0x5B '[' 0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78, 8, // 0x5C '\' 0x00,0x00,0x60,0x60,0x30,0x30,0x18,0x18,0x18,0x0C,0x0C,0x06,0x06, 6, // 0x5D ']' 0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78, 10, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 8, // 0x60 '`' 0x00,0x00,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3E,0x00,0x00, 8, // 0x62 'b' 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00, 7, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x60,0x60,0x60,0x3C,0x00,0x00, 8, // 0x64 'd' 0x00,0x00,0x06,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, 8, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x7E,0x60,0x62,0x3C,0x00,0x00, 5, // 0x66 'f' 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x00,0x00, 8, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x3E,0x06,0x3C, 8, // 0x68 'h' 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00, 4, // 0x69 'i' 0x00,0x00,0x00,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, 5, // 0x6A 'j' 0x00,0x00,0x00,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, 8, // 0x6B 'k' 0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x00,0x00, 4, // 0x6C 'l' 0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, 12, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7D,0xC0,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x00,0x00,0x00,0x00, 8, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00, 8, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, 8, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x7C,0x60,0x60, 8, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x3E,0x06,0x06, 6, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x78,0x3C,0x0C,0x78,0x00,0x00, 5, // 0x74 't' 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x38,0x00,0x00, 8, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, 8, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x18,0x00,0x00, 10, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6D,0x80,0x6D,0x80,0x6D,0x80,0x6D,0x80,0x33,0x00,0x33,0x00,0x00,0x00,0x00,0x00, 8, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x66,0x66,0x00,0x00, 8, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x3C,0x18,0x18,0x30,0x30, 7, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x7C,0x0C,0x18,0x30,0x60,0x7C,0x00,0x00, 8, // 0x7B '{' 0x00,0x00,0x0E,0x18,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E, 6, // 0x7C '|' 0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, 8, // 0x7D '}' 0x00,0x00,0x70,0x18,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70, 9, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x49,0x00,0x49,0x00,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x00,0x00,0x00,0x00, 0 }; const int8u verdana14[] = { 14, 3, 32, 128-32, 0x00,0x00,0x0F,0x00,0x1E,0x00,0x2D,0x00,0x4A,0x00,0x59,0x00,0x76,0x00,0x93,0x00,0xA2,0x00, 0xB1,0x00,0xC0,0x00,0xCF,0x00,0xEC,0x00,0xFB,0x00,0x0A,0x01,0x19,0x01,0x28,0x01,0x37,0x01, 0x46,0x01,0x55,0x01,0x64,0x01,0x73,0x01,0x82,0x01,0x91,0x01,0xA0,0x01,0xAF,0x01,0xBE,0x01, 0xCD,0x01,0xDC,0x01,0xF9,0x01,0x16,0x02,0x33,0x02,0x42,0x02,0x5F,0x02,0x6E,0x02,0x7D,0x02, 0x9A,0x02,0xB7,0x02,0xC6,0x02,0xD5,0x02,0xF2,0x02,0x0F,0x03,0x1E,0x03,0x2D,0x03,0x3C,0x03, 0x4B,0x03,0x68,0x03,0x85,0x03,0xA2,0x03,0xB1,0x03,0xCE,0x03,0xDD,0x03,0xEC,0x03,0xFB,0x03, 0x18,0x04,0x27,0x04,0x44,0x04,0x53,0x04,0x62,0x04,0x71,0x04,0x80,0x04,0x8F,0x04,0x9E,0x04, 0xBB,0x04,0xCA,0x04,0xD9,0x04,0xE8,0x04,0xF7,0x04,0x06,0x05,0x15,0x05,0x24,0x05,0x33,0x05, 0x42,0x05,0x51,0x05,0x60,0x05,0x6F,0x05,0x7E,0x05,0x8D,0x05,0xAA,0x05,0xB9,0x05,0xC8,0x05, 0xD7,0x05,0xE6,0x05,0xF5,0x05,0x04,0x06,0x13,0x06,0x22,0x06,0x31,0x06,0x4E,0x06,0x5D,0x06, 0x6C,0x06,0x7B,0x06,0x8A,0x06,0x99,0x06,0xA8,0x06,0xC5,0x06, 4, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x21 '!' 0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, 6, // 0x22 '"' 0x00,0x00,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x12,0x00,0x3F,0x80,0x12,0x00,0x12,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00, 8, // 0x24 '$' 0x00,0x00,0x10,0x10,0x3E,0x50,0x50,0x30,0x1C,0x12,0x12,0x7C,0x10,0x10, 13, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x49,0x00,0x49,0x00,0x4A,0x00,0x32,0x60,0x02,0x90,0x04,0x90,0x04,0x90,0x08,0x60,0x00,0x00,0x00,0x00, 10, // 0x26 '&' 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x39,0x00,0x45,0x00,0x42,0x00,0x43,0x00,0x3C,0x80,0x00,0x00,0x00,0x00, 3, // 0x27 ''' 0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x28 '(' 0x00,0x00,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10, 5, // 0x29 ')' 0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40, 8, // 0x2A '*' 0x00,0x00,0x10,0x54,0x38,0x54,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00, 4, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40, 5, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00, 4, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00, 5, // 0x2F '/' 0x00,0x00,0x08,0x08,0x10,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x40,0x80, 8, // 0x30 '0' 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, 8, // 0x31 '1' 0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00, 8, // 0x32 '2' 0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x7E,0x00,0x00, 8, // 0x33 '3' 0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x1C,0x02,0x02,0x42,0x3C,0x00,0x00, 8, // 0x34 '4' 0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x44,0x7F,0x04,0x04,0x04,0x00,0x00, 8, // 0x35 '5' 0x00,0x00,0x00,0x7E,0x40,0x40,0x7C,0x02,0x02,0x02,0x42,0x3C,0x00,0x00, 8, // 0x36 '6' 0x00,0x00,0x00,0x1C,0x20,0x40,0x7C,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, 8, // 0x37 '7' 0x00,0x00,0x00,0x7E,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x00,0x00, 8, // 0x38 '8' 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C,0x00,0x00, 8, // 0x39 '9' 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x3E,0x02,0x04,0x38,0x00,0x00, 5, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x00,0x00, 5, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40, 9, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00, 9, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00, 7, // 0x3F '?' 0x00,0x00,0x00,0x38,0x44,0x04,0x04,0x08,0x10,0x10,0x00,0x10,0x00,0x00, 12, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x27,0x40,0x49,0x20,0x49,0x20,0x49,0x20,0x49,0x20,0x27,0xC0,0x30,0x00,0x0F,0x00,0x00,0x00, 8, // 0x41 'A' 0x00,0x00,0x00,0x18,0x18,0x24,0x24,0x42,0x42,0x7E,0x81,0x81,0x00,0x00, 8, // 0x42 'B' 0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00, 9, // 0x43 'C' 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, 9, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00, 8, // 0x45 'E' 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x7E,0x00,0x00, 7, // 0x46 'F' 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x00,0x00, 9, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x41,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, 9, // 0x48 'H' 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00, 5, // 0x49 'I' 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, 5, // 0x4A 'J' 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00, 8, // 0x4B 'K' 0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00, 7, // 0x4C 'L' 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7E,0x00,0x00, 10, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x52,0x80,0x52,0x80,0x52,0x80,0x4C,0x80,0x4C,0x80,0x40,0x80,0x40,0x80,0x00,0x00,0x00,0x00, 9, // 0x4E 'N' 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x00,0x61,0x00,0x51,0x00,0x51,0x00,0x49,0x00,0x45,0x00,0x45,0x00,0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00, 10, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, 8, // 0x50 'P' 0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x00,0x00, 10, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x02,0x00,0x01,0x80, 8, // 0x52 'R' 0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x7C,0x48,0x44,0x42,0x41,0x00,0x00, 8, // 0x53 'S' 0x00,0x00,0x00,0x3C,0x42,0x40,0x40,0x3C,0x02,0x02,0x42,0x3C,0x00,0x00, 7, // 0x54 'T' 0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 9, // 0x55 'U' 0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, 8, // 0x56 'V' 0x00,0x00,0x00,0x81,0x81,0x42,0x42,0x42,0x24,0x24,0x18,0x18,0x00,0x00, 13, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x45,0x10,0x45,0x10,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00, 8, // 0x58 'X' 0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x18,0x18,0x24,0x42,0x42,0x00,0x00, 7, // 0x59 'Y' 0x00,0x00,0x00,0x82,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10,0x00,0x00, 8, // 0x5A 'Z' 0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x10,0x20,0x40,0x7E,0x00,0x00, 5, // 0x5B '[' 0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70, 5, // 0x5C '\' 0x00,0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08, 5, // 0x5D ']' 0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70, 10, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 8, // 0x60 '`' 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x3E,0x42,0x42,0x3E,0x00,0x00, 8, // 0x62 'b' 0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x00,0x00, 6, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x40,0x40,0x44,0x38,0x00,0x00, 8, // 0x64 'd' 0x00,0x00,0x02,0x02,0x02,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00, 8, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x7E,0x40,0x42,0x3C,0x00,0x00, 4, // 0x66 'f' 0x00,0x00,0x30,0x40,0x40,0xF0,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 8, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x3C, 8, // 0x68 'h' 0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00, 3, // 0x69 'i' 0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 4, // 0x6A 'j' 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, 7, // 0x6B 'k' 0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00, 3, // 0x6C 'l' 0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 11, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B,0x80,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00, 8, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00, 8, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00, 8, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x40,0x40, 8, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02, 5, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x40,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x3C,0x40,0x40,0x38,0x04,0x04,0x78,0x00,0x00, 5, // 0x74 't' 0x00,0x00,0x00,0x40,0x40,0xF8,0x40,0x40,0x40,0x40,0x40,0x38,0x00,0x00, 8, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00, 7, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00, 11, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00, 7, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x20, 7, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00, 8, // 0x7B '{' 0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x10,0x0C, 5, // 0x7C '|' 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 8, // 0x7D '}' 0x00,0x00,0x30,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30, 10, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x4C,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x00,0x00,0x00,0x00, 0 }; const int8u verdana14_bold[] = { 14, 3, 32, 128-32, 0x00,0x00,0x0F,0x00,0x1E,0x00,0x2D,0x00,0x4A,0x00,0x67,0x00,0x84,0x00,0xA1,0x00,0xB0,0x00, 0xBF,0x00,0xCE,0x00,0xEB,0x00,0x08,0x01,0x17,0x01,0x26,0x01,0x35,0x01,0x44,0x01,0x61,0x01, 0x7E,0x01,0x9B,0x01,0xB8,0x01,0xD5,0x01,0xF2,0x01,0x0F,0x02,0x2C,0x02,0x49,0x02,0x66,0x02, 0x75,0x02,0x84,0x02,0xA1,0x02,0xBE,0x02,0xDB,0x02,0xEA,0x02,0x07,0x03,0x24,0x03,0x41,0x03, 0x5E,0x03,0x7B,0x03,0x8A,0x03,0x99,0x03,0xB6,0x03,0xD3,0x03,0xE2,0x03,0xF1,0x03,0x0E,0x04, 0x1D,0x04,0x3A,0x04,0x57,0x04,0x74,0x04,0x91,0x04,0xAE,0x04,0xCB,0x04,0xE8,0x04,0xF7,0x04, 0x14,0x05,0x31,0x05,0x4E,0x05,0x6B,0x05,0x88,0x05,0x97,0x05,0xA6,0x05,0xB5,0x05,0xC4,0x05, 0xE1,0x05,0xFE,0x05,0x1B,0x06,0x2A,0x06,0x39,0x06,0x48,0x06,0x57,0x06,0x66,0x06,0x75,0x06, 0x84,0x06,0x93,0x06,0xA2,0x06,0xB1,0x06,0xC0,0x06,0xCF,0x06,0xEC,0x06,0xFB,0x06,0x0A,0x07, 0x19,0x07,0x28,0x07,0x37,0x07,0x46,0x07,0x55,0x07,0x64,0x07,0x73,0x07,0x90,0x07,0x9F,0x07, 0xAE,0x07,0xBD,0x07,0xDA,0x07,0xE9,0x07,0x06,0x08,0x23,0x08, 4, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x21 '!' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x60,0x60,0x00,0x00, 7, // 0x22 '"' 0x00,0x00,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x3F,0x80,0x12,0x00,0x7F,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00, 9, // 0x24 '$' 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x69,0x00,0x68,0x00,0x7E,0x00,0x3F,0x00,0x0B,0x00,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00, 15, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x6C,0x40,0x6C,0x80,0x6C,0xB8,0x6D,0x6C,0x3A,0x6C,0x02,0x6C,0x04,0x6C,0x04,0x38,0x00,0x00,0x00,0x00, 10, // 0x26 '&' 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x6C,0x00,0x6C,0x00,0x6C,0x00,0x39,0x80,0x6D,0x00,0x66,0x00,0x63,0x00,0x3D,0x80,0x00,0x00,0x00,0x00, 4, // 0x27 ''' 0x00,0x00,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x28 '(' 0x00,0x00,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18, 7, // 0x29 ')' 0x00,0x00,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x30, 9, // 0x2A '*' 0x00,0x00,0x00,0x00,0x08,0x00,0x2A,0x00,0x1C,0x00,0x1C,0x00,0x2A,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x40, 6, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00, 8, // 0x2F '/' 0x00,0x00,0x06,0x06,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x30,0x30,0x60,0x60, 9, // 0x30 '0' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, 9, // 0x31 '1' 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, 9, // 0x32 '2' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, 9, // 0x33 '3' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x1E,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, 9, // 0x34 '4' 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0E,0x00,0x16,0x00,0x16,0x00,0x26,0x00,0x46,0x00,0x7F,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00, 9, // 0x35 '5' 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, 9, // 0x36 '6' 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x30,0x00,0x60,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, 9, // 0x37 '7' 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x00,0x00,0x00,0x00, 9, // 0x38 '8' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, 9, // 0x39 '9' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x03,0x00,0x06,0x00,0x3C,0x00,0x00,0x00,0x00,0x00, 5, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x00,0x00, 5, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x60,0x60,0x60,0x40, 10, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x00,0x00,0x00,0x00, 10, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x00,0x00,0x00,0x00, 7, // 0x3F '?' 0x00,0x00,0x00,0x38,0x4C,0x0C,0x18,0x30,0x30,0x00,0x30,0x30,0x00,0x00, 12, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x2F,0x40,0x5B,0x20,0x5B,0x20,0x5B,0x20,0x5B,0x20,0x2F,0xC0,0x30,0x00,0x0F,0x00,0x00,0x00, 9, // 0x41 'A' 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x7F,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, 9, // 0x42 'B' 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x66,0x00,0x66,0x00,0x66,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00, 9, // 0x43 'C' 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x31,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x31,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, 10, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00, 8, // 0x45 'E' 0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7E,0x60,0x60,0x60,0x7E,0x00,0x00, 8, // 0x46 'F' 0x00,0x00,0x00,0x7E,0x60,0x60,0x60,0x7E,0x60,0x60,0x60,0x60,0x00,0x00, 10, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x30,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x67,0x80,0x61,0x80,0x31,0x80,0x1F,0x80,0x00,0x00,0x00,0x00, 10, // 0x48 'H' 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00, 6, // 0x49 'I' 0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00, 7, // 0x4A 'J' 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xF8,0x00,0x00, 9, // 0x4B 'K' 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x70,0x00,0x78,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x00,0x00,0x00,0x00, 8, // 0x4C 'L' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0x00,0x00, 11, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x71,0xC0,0x71,0xC0,0x5A,0xC0,0x5A,0xC0,0x4C,0xC0,0x4C,0xC0,0x40,0xC0,0x40,0xC0,0x00,0x00,0x00,0x00, 10, // 0x4E 'N' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x70,0x80,0x58,0x80,0x58,0x80,0x4C,0x80,0x46,0x80,0x46,0x80,0x43,0x80,0x41,0x80,0x00,0x00,0x00,0x00, 11, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00, 9, // 0x50 'P' 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00, 11, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x06,0x00,0x03,0xC0, 9, // 0x52 'R' 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00, 9, // 0x53 'S' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x70,0x00,0x3E,0x00,0x07,0x00,0x03,0x00,0x43,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, 8, // 0x54 'T' 0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00, 10, // 0x55 'U' 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00, 9, // 0x56 'V' 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00, 14, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00, 9, // 0x58 'X' 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00, 10, // 0x59 'Y' 0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00, 8, // 0x5A 'Z' 0x00,0x00,0x00,0x7E,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x7E,0x00,0x00, 6, // 0x5B '[' 0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78, 8, // 0x5C '\' 0x00,0x00,0x60,0x60,0x30,0x30,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x06,0x06, 6, // 0x5D ']' 0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78, 10, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80, 9, // 0x60 '`' 0x00,0x00,0x00,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x66,0x3E,0x00,0x00, 8, // 0x62 'b' 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x00,0x00, 7, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x3C,0x62,0x60,0x60,0x60,0x62,0x3C,0x00,0x00, 8, // 0x64 'd' 0x00,0x00,0x06,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, 8, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x7E,0x60,0x62,0x3C,0x00,0x00, 5, // 0x66 'f' 0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, 8, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x3C, 8, // 0x68 'h' 0x00,0x00,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00, 4, // 0x69 'i' 0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, 5, // 0x6A 'j' 0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, 8, // 0x6B 'k' 0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x63,0x00,0x00, 4, // 0x6C 'l' 0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00, 12, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xC0,0x77,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x66,0x60,0x00,0x00,0x00,0x00, 8, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00, 8, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00, 8, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60, 8, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x06, 6, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x60,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x3C,0x60,0x60,0x38,0x0C,0x0C,0x78,0x00,0x00, 5, // 0x74 't' 0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x38,0x00,0x00, 8, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00, 8, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x00,0x00, 12, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x69,0x60,0x39,0xC0,0x30,0xC0,0x30,0xC0,0x00,0x00,0x00,0x00, 8, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x3C,0x66,0x66,0x00,0x00, 8, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x3C,0x3C,0x18,0x18,0x30, 7, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x7C,0x0C,0x18,0x38,0x30,0x60,0x7C,0x00,0x00, 9, // 0x7B '{' 0x00,0x00,0x00,0x00,0x0E,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0E,0x00, 6, // 0x7C '|' 0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, 9, // 0x7D '}' 0x00,0x00,0x00,0x00,0x38,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x38,0x00, 10, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x48,0x80,0x44,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x00,0x00,0x00,0x00, 0 }; const int8u verdana16[] = { 16, 4, 32, 128-32, 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x54,0x00,0x65,0x00,0x86,0x00,0xA7,0x00,0xB8,0x00, 0xC9,0x00,0xDA,0x00,0xFB,0x00,0x1C,0x01,0x2D,0x01,0x3E,0x01,0x4F,0x01,0x60,0x01,0x71,0x01, 0x82,0x01,0x93,0x01,0xA4,0x01,0xB5,0x01,0xC6,0x01,0xD7,0x01,0xE8,0x01,0xF9,0x01,0x0A,0x02, 0x1B,0x02,0x2C,0x02,0x4D,0x02,0x6E,0x02,0x8F,0x02,0xA0,0x02,0xC1,0x02,0xE2,0x02,0xF3,0x02, 0x14,0x03,0x35,0x03,0x46,0x03,0x57,0x03,0x78,0x03,0x99,0x03,0xAA,0x03,0xBB,0x03,0xCC,0x03, 0xDD,0x03,0xFE,0x03,0x1F,0x04,0x40,0x04,0x51,0x04,0x72,0x04,0x93,0x04,0xB4,0x04,0xD5,0x04, 0xF6,0x04,0x17,0x05,0x38,0x05,0x59,0x05,0x7A,0x05,0x9B,0x05,0xAC,0x05,0xBD,0x05,0xCE,0x05, 0xEF,0x05,0x00,0x06,0x11,0x06,0x22,0x06,0x33,0x06,0x44,0x06,0x55,0x06,0x66,0x06,0x77,0x06, 0x88,0x06,0x99,0x06,0xAA,0x06,0xBB,0x06,0xCC,0x06,0xDD,0x06,0xFE,0x06,0x0F,0x07,0x20,0x07, 0x31,0x07,0x42,0x07,0x53,0x07,0x64,0x07,0x75,0x07,0x86,0x07,0x97,0x07,0xB8,0x07,0xC9,0x07, 0xDA,0x07,0xEB,0x07,0xFC,0x07,0x0D,0x08,0x1E,0x08,0x3F,0x08, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x21 '!' 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, 5, // 0x22 '"' 0x00,0x00,0x00,0x50,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x12,0x00,0x12,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x24 '$' 0x00,0x00,0x00,0x10,0x10,0x3E,0x50,0x50,0x30,0x1C,0x12,0x12,0x7C,0x10,0x10,0x00, 13, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x80,0x45,0x00,0x45,0x00,0x3A,0xE0,0x05,0x10,0x05,0x10,0x09,0x10,0x10,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x26 '&' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x38,0x80,0x45,0x00,0x42,0x00,0x46,0x00,0x39,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 3, // 0x27 ''' 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x28 '(' 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, 6, // 0x29 ')' 0x00,0x00,0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, 9, // 0x2A '*' 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, 7, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, 6, // 0x2F '/' 0x00,0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00, 8, // 0x30 '0' 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, 8, // 0x31 '1' 0x00,0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,0x00, 8, // 0x32 '2' 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x7E,0x00,0x00,0x00, 8, // 0x33 '3' 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x1C,0x02,0x02,0x42,0x3C,0x00,0x00,0x00, 8, // 0x34 '4' 0x00,0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x44,0x7F,0x04,0x04,0x04,0x00,0x00,0x00, 8, // 0x35 '5' 0x00,0x00,0x00,0x00,0x3E,0x20,0x20,0x20,0x3C,0x02,0x02,0x42,0x3C,0x00,0x00,0x00, 8, // 0x36 '6' 0x00,0x00,0x00,0x00,0x1C,0x20,0x40,0x7C,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, 8, // 0x37 '7' 0x00,0x00,0x00,0x00,0x7E,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x00,0x00,0x00, 8, // 0x38 '8' 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, 8, // 0x39 '9' 0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x3E,0x02,0x04,0x38,0x00,0x00,0x00, 6, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, 6, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, 9, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x00,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x3F '?' 0x00,0x00,0x00,0x00,0x38,0x44,0x04,0x08,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, 13, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x10,0x40,0x27,0xA0,0x48,0x90,0x48,0x90,0x48,0x90,0x48,0x90,0x48,0x90,0x27,0xE0,0x10,0x00,0x0F,0x80,0x00,0x00, 9, // 0x41 'A' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x14,0x00,0x22,0x00,0x22,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x42 'B' 0x00,0x00,0x00,0x00,0x78,0x44,0x44,0x44,0x7C,0x42,0x42,0x42,0x7C,0x00,0x00,0x00, 9, // 0x43 'C' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x45 'E' 0x00,0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x7E,0x00,0x00,0x00, 8, // 0x46 'F' 0x00,0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 9, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x47,0x00,0x41,0x00,0x21,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x48 'H' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7F,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x49 'I' 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, 6, // 0x4A 'J' 0x00,0x00,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x00, 8, // 0x4B 'K' 0x00,0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x42,0x00,0x00,0x00, 7, // 0x4C 'L' 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7E,0x00,0x00,0x00, 11, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x51,0x40,0x51,0x40,0x4A,0x40,0x4A,0x40,0x44,0x40,0x44,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x4E 'N' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x00,0x61,0x00,0x51,0x00,0x51,0x00,0x49,0x00,0x45,0x00,0x45,0x00,0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x50 'P' 0x00,0x00,0x00,0x00,0x7C,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x00,0x00,0x00, 10, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x02,0x00,0x01,0x80,0x00,0x00, 9, // 0x52 'R' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x78,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x53 'S' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x40,0x00,0x40,0x00,0x3E,0x00,0x01,0x00,0x01,0x00,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x54 'T' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x55 'U' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x56 'V' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x45,0x10,0x45,0x10,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x58 'X' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x59 'Y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x5A 'Z' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5B '[' 0x00,0x00,0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, 6, // 0x5C '\' 0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x00, 6, // 0x5D ']' 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, 11, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00, 8, // 0x60 '`' 0x00,0x00,0x00,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x02,0x02,0x3E,0x42,0x42,0x3E,0x00,0x00,0x00, 8, // 0x62 'b' 0x00,0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x00,0x00,0x00, 8, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x40,0x40,0x42,0x3C,0x00,0x00,0x00, 8, // 0x64 'd' 0x00,0x00,0x00,0x02,0x02,0x02,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, 8, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x7E,0x40,0x42,0x3C,0x00,0x00,0x00, 6, // 0x66 'f' 0x00,0x00,0x00,0x1C,0x20,0x20,0x78,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, 8, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x3C, 8, // 0x68 'h' 0x00,0x00,0x00,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00, 3, // 0x69 'i' 0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 4, // 0x6A 'j' 0x00,0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0, 7, // 0x6B 'k' 0x00,0x00,0x00,0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x00,0x00,0x00, 3, // 0x6C 'l' 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 11, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x80,0x66,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x44,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x42,0x00,0x00,0x00, 8, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,0x00, 8, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x62,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40, 8, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x02, 5, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 7, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x40,0x40,0x38,0x04,0x04,0x78,0x00,0x00,0x00, 6, // 0x74 't' 0x00,0x00,0x00,0x00,0x20,0x20,0x78,0x20,0x20,0x20,0x20,0x20,0x18,0x00,0x00,0x00, 8, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, 8, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x00,0x00,0x00, 11, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x28,0x10,0x28,0x44,0x44,0x00,0x00,0x00, 8, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x10,0x10,0x20, 7, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x04,0x08,0x10,0x20,0x40,0x7C,0x00,0x00,0x00, 8, // 0x7B '{' 0x00,0x00,0x00,0x0C,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x10,0x0C,0x00, 7, // 0x7C '|' 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00, 8, // 0x7D '}' 0x00,0x00,0x00,0x30,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x08,0x30,0x00, 11, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x80,0x4C,0x80,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u verdana16_bold[] = { 16, 4, 32, 128-32, 0x00,0x00,0x11,0x00,0x22,0x00,0x33,0x00,0x54,0x00,0x75,0x00,0xA6,0x00,0xC7,0x00,0xD8,0x00, 0xE9,0x00,0xFA,0x00,0x1B,0x01,0x3C,0x01,0x4D,0x01,0x5E,0x01,0x6F,0x01,0x90,0x01,0xB1,0x01, 0xD2,0x01,0xF3,0x01,0x14,0x02,0x35,0x02,0x56,0x02,0x77,0x02,0x98,0x02,0xB9,0x02,0xDA,0x02, 0xEB,0x02,0xFC,0x02,0x1D,0x03,0x3E,0x03,0x5F,0x03,0x70,0x03,0x91,0x03,0xB2,0x03,0xD3,0x03, 0xF4,0x03,0x15,0x04,0x36,0x04,0x57,0x04,0x78,0x04,0x99,0x04,0xAA,0x04,0xBB,0x04,0xDC,0x04, 0xED,0x04,0x0E,0x05,0x2F,0x05,0x50,0x05,0x71,0x05,0x92,0x05,0xB3,0x05,0xD4,0x05,0xE5,0x05, 0x06,0x06,0x27,0x06,0x48,0x06,0x69,0x06,0x8A,0x06,0xAB,0x06,0xBC,0x06,0xDD,0x06,0xEE,0x06, 0x0F,0x07,0x30,0x07,0x51,0x07,0x72,0x07,0x93,0x07,0xA4,0x07,0xC5,0x07,0xE6,0x07,0xF7,0x07, 0x18,0x08,0x39,0x08,0x4A,0x08,0x5B,0x08,0x6C,0x08,0x7D,0x08,0x9E,0x08,0xBF,0x08,0xE0,0x08, 0x01,0x09,0x22,0x09,0x33,0x09,0x44,0x09,0x55,0x09,0x76,0x09,0x97,0x09,0xB8,0x09,0xD9,0x09, 0xFA,0x09,0x0B,0x0A,0x2C,0x0A,0x3D,0x0A,0x5E,0x0A,0x7F,0x0A, 4, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x21 '!' 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, 7, // 0x22 '"' 0x00,0x00,0x00,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x09,0x00,0x3F,0x80,0x3F,0x80,0x12,0x00,0x7F,0x00,0x7F,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x24 '$' 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x69,0x00,0x68,0x00,0x78,0x00,0x3E,0x00,0x0F,0x00,0x0B,0x00,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, 17, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x20,0x00,0x66,0x20,0x00,0x66,0x40,0x00,0x66,0x5E,0x00,0x66,0xB3,0x00,0x3D,0x33,0x00,0x01,0x33,0x00,0x02,0x33,0x00,0x02,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x26 '&' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x66,0x00,0x66,0x00,0x66,0xC0,0x3C,0xC0,0x66,0x80,0x63,0x00,0x63,0x80,0x3C,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x27 ''' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x28 '(' 0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C, 7, // 0x29 ')' 0x00,0x00,0x00,0x60,0x30,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x60, 9, // 0x2A '*' 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0xC0,0xC0, 7, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, 9, // 0x2F '/' 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, 9, // 0x30 '0' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x31 '1' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x32 '2' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x33 '3' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x03,0x00,0x0E,0x00,0x03,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x34 '4' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0E,0x00,0x16,0x00,0x26,0x00,0x46,0x00,0x7F,0x80,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x35 '5' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x36 '6' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x30,0x00,0x60,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x37 '7' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x38 '8' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x39 '9' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x03,0x00,0x06,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, 5, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x38,0x30,0x30,0x60,0x60, 11, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x40,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x3F '?' 0x00,0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00, 13, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0x60,0x27,0xA0,0x4D,0x90,0x4D,0x90,0x4D,0x90,0x4D,0x90,0x27,0xE0,0x30,0x00,0x0F,0x80,0x00,0x00,0x00,0x00, 10, // 0x41 'A' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x1E,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x7F,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x42 'B' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x43 'C' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x61,0x80,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x45 'E' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x46 'F' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x60,0x00,0x63,0x80,0x61,0x80,0x31,0x80,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x48 'H' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x7F,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x49 'I' 0x00,0x00,0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00, 7, // 0x4A 'J' 0x00,0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xF8,0x00,0x00,0x00, 9, // 0x4B 'K' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x78,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x4C 'L' 0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0x00,0x00,0x00, 12, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xE0,0x70,0xE0,0x59,0x60,0x59,0x60,0x4E,0x60,0x4E,0x60,0x44,0x60,0x44,0x60,0x40,0x60,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x4E 'N' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x80,0x70,0x80,0x58,0x80,0x58,0x80,0x4C,0x80,0x46,0x80,0x46,0x80,0x43,0x80,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x50 'P' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x03,0x00,0x01,0xC0,0x00,0x00, 9, // 0x52 'R' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x6C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x53 'S' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x70,0x00,0x3E,0x00,0x07,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x54 'T' 0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00, 10, // 0x55 'U' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x56 'V' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 14, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x58 'X' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x59 'Y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x5A 'Z' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5B '[' 0x00,0x00,0x00,0x78,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x78,0x00, 9, // 0x5C '\' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x00,0x00, 6, // 0x5D ']' 0x00,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x00, 10, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x00,0x00, 9, // 0x60 '`' 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x62 'b' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x60,0x60,0x60,0x63,0x3E,0x00,0x00,0x00, 9, // 0x64 'd' 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x7F,0x00,0x60,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x66 'f' 0x00,0x00,0x00,0x38,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 9, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x03,0x00,0x03,0x00,0x3E,0x00, 9, // 0x68 'h' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x69 'i' 0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 5, // 0x6A 'j' 0x00,0x00,0x00,0x30,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xE0, 8, // 0x6B 'k' 0x00,0x00,0x00,0x60,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0x63,0x00,0x00,0x00, 4, // 0x6C 'l' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 14, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x70,0x73,0x98,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, 9, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x03,0x00,0x03,0x00,0x03,0x00, 6, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x7C,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 8, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x60,0x70,0x3C,0x0E,0x06,0x7C,0x00,0x00,0x00, 6, // 0x74 't' 0x00,0x00,0x00,0x00,0x60,0x60,0xF8,0x60,0x60,0x60,0x60,0x60,0x38,0x00,0x00,0x00, 9, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x67,0x00,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,0x66,0x60,0x66,0x60,0x69,0x60,0x39,0xC0,0x30,0xC0,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, 8, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00,0x00, 9, // 0x7B '{' 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x00,0x00,0x00, 8, // 0x7C '|' 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00, 9, // 0x7D '}' 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x07,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x70,0x00,0x00,0x00, 11, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x40,0x44,0x40,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF0,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u verdana17[] = { 17, 4, 32, 128-32, 0x00,0x00,0x12,0x00,0x24,0x00,0x36,0x00,0x59,0x00,0x7C,0x00,0x9F,0x00,0xC2,0x00,0xD4,0x00, 0xE6,0x00,0xF8,0x00,0x1B,0x01,0x3E,0x01,0x50,0x01,0x62,0x01,0x74,0x01,0x86,0x01,0xA9,0x01, 0xCC,0x01,0xEF,0x01,0x12,0x02,0x35,0x02,0x58,0x02,0x7B,0x02,0x9E,0x02,0xC1,0x02,0xE4,0x02, 0xF6,0x02,0x08,0x03,0x2B,0x03,0x4E,0x03,0x71,0x03,0x83,0x03,0xA6,0x03,0xC9,0x03,0xEC,0x03, 0x0F,0x04,0x32,0x04,0x55,0x04,0x67,0x04,0x8A,0x04,0xAD,0x04,0xBF,0x04,0xD1,0x04,0xF4,0x04, 0x06,0x05,0x29,0x05,0x4C,0x05,0x6F,0x05,0x81,0x05,0xA4,0x05,0xC7,0x05,0xEA,0x05,0x0D,0x06, 0x30,0x06,0x53,0x06,0x76,0x06,0x99,0x06,0xBC,0x06,0xDF,0x06,0xF1,0x06,0x03,0x07,0x15,0x07, 0x38,0x07,0x5B,0x07,0x7E,0x07,0x90,0x07,0xB3,0x07,0xC5,0x07,0xE8,0x07,0xFA,0x07,0x0C,0x08, 0x2F,0x08,0x52,0x08,0x64,0x08,0x76,0x08,0x88,0x08,0x9A,0x08,0xBD,0x08,0xE0,0x08,0x03,0x09, 0x26,0x09,0x49,0x09,0x5B,0x09,0x6D,0x09,0x7F,0x09,0xA2,0x09,0xB4,0x09,0xD7,0x09,0xFA,0x09, 0x0C,0x0A,0x1E,0x0A,0x41,0x0A,0x53,0x0A,0x76,0x0A,0x99,0x0A, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x21 '!' 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, 6, // 0x22 '"' 0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x04,0x80,0x09,0x00,0x3F,0xC0,0x09,0x00,0x12,0x00,0x7F,0x80,0x12,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x24 '$' 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x49,0x00,0x48,0x00,0x48,0x00,0x3E,0x00,0x09,0x00,0x09,0x00,0x49,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, 15, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x20,0x44,0x40,0x44,0x80,0x44,0x80,0x45,0x38,0x39,0x44,0x02,0x44,0x04,0x44,0x04,0x44,0x08,0x38,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x26 '&' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x38,0x80,0x44,0x80,0x42,0x80,0x41,0x00,0x22,0x80,0x1C,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x27 ''' 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x28 '(' 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, 6, // 0x29 ')' 0x00,0x00,0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, 9, // 0x2A '*' 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7F,0xC0,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, 7, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, 6, // 0x2F '/' 0x00,0x00,0x00,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x00, 9, // 0x30 '0' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x31 '1' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x38,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x32 '2' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x0C,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x33 '3' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x01,0x00,0x02,0x00,0x1C,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x34 '4' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x06,0x00,0x0A,0x00,0x12,0x00,0x22,0x00,0x42,0x00,0x7F,0x80,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x35 '5' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7C,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x42,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x36 '6' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x30,0x00,0x20,0x00,0x40,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x37 '7' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x38 '8' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x3E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x39 '9' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x21,0x00,0x1F,0x00,0x01,0x00,0x02,0x00,0x06,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, 6, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x00, 11, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x06,0x00,0x18,0x00,0x60,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x3F '?' 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x0C,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, 14, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x18,0x20,0x20,0x10,0x27,0xC8,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, 10, // 0x41 'A' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x21,0x00,0x7F,0x80,0x40,0x80,0x80,0x40,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x42 'B' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x43 'C' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0x80,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x30,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x80,0x40,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x41,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x45 'E' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x46 'F' 0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 11, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x00,0x40,0x00,0x43,0xC0,0x40,0x40,0x20,0x40,0x30,0x40,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x48 'H' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7F,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x49 'I' 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, 6, // 0x4A 'J' 0x00,0x00,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x00, 10, // 0x4B 'K' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x4C 'L' 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00,0x00, 11, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x51,0x40,0x51,0x40,0x4A,0x40,0x4A,0x40,0x44,0x40,0x44,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x4E 'N' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x80,0x60,0x80,0x50,0x80,0x48,0x80,0x48,0x80,0x44,0x80,0x44,0x80,0x42,0x80,0x41,0x80,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x31,0x80,0x20,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x31,0x80,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x50 'P' 0x00,0x00,0x00,0x00,0x7C,0x42,0x41,0x41,0x42,0x7C,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 11, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x31,0x80,0x20,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x31,0x80,0x0E,0x00,0x02,0x00,0x02,0x00,0x01,0xC0, 10, // 0x52 'R' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x44,0x00,0x78,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x53 'S' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x40,0x00,0x40,0x00,0x38,0x00,0x07,0x00,0x00,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x54 'T' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x55 'U' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x56 'V' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x80,0x40,0x40,0x80,0x40,0x80,0x21,0x00,0x21,0x00,0x21,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 15, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x04,0x41,0x04,0x22,0x88,0x22,0x88,0x22,0x88,0x14,0x50,0x14,0x50,0x14,0x50,0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x58 'X' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x21,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x59 'Y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x5A 'Z' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x5B '[' 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3C, 6, // 0x5C '\' 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x08,0x04,0x00, 6, // 0x5D ']' 0x00,0x00,0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78, 11, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x00,0x00, 9, // 0x60 '`' 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x02,0x3E,0x42,0x42,0x46,0x3A,0x00,0x00,0x00, 9, // 0x62 'b' 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x40,0x22,0x1C,0x00,0x00,0x00, 9, // 0x64 'd' 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x42,0x7E,0x40,0x40,0x22,0x1C,0x00,0x00,0x00, 6, // 0x66 'f' 0x00,0x00,0x00,0x1C,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, 9, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x22,0x00,0x1C,0x00, 9, // 0x68 'h' 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 3, // 0x69 'i' 0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 5, // 0x6A 'j' 0x00,0x00,0x00,0x00,0x10,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0, 8, // 0x6B 'k' 0x00,0x00,0x00,0x40,0x40,0x40,0x42,0x44,0x48,0x50,0x70,0x48,0x44,0x42,0x00,0x00,0x00, 3, // 0x6C 'l' 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 13, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0xE0,0x63,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x40,0x00,0x40,0x00,0x40,0x00, 9, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x01,0x00,0x01,0x00, 6, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 8, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00,0x00, 6, // 0x74 't' 0x00,0x00,0x00,0x00,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x1C,0x00,0x00,0x00, 9, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x18,0x00,0x00,0x00, 11, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x40,0x44,0x40,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x2A,0x80,0x11,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x18,0x10,0x10,0x20, 8, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E,0x00,0x00,0x00, 9, // 0x7B '{' 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x60,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x07,0x00, 6, // 0x7C '|' 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, 9, // 0x7D '}' 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x03,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x70,0x00, 11, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x44,0x40,0x44,0x40,0x43,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 14, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u verdana17_bold[] = { 17, 4, 32, 128-32, 0x00,0x00,0x12,0x00,0x24,0x00,0x36,0x00,0x59,0x00,0x7C,0x00,0xB0,0x00,0xD3,0x00,0xE5,0x00, 0xF7,0x00,0x09,0x01,0x2C,0x01,0x4F,0x01,0x61,0x01,0x73,0x01,0x85,0x01,0xA8,0x01,0xCB,0x01, 0xEE,0x01,0x11,0x02,0x34,0x02,0x57,0x02,0x7A,0x02,0x9D,0x02,0xC0,0x02,0xE3,0x02,0x06,0x03, 0x18,0x03,0x2A,0x03,0x4D,0x03,0x70,0x03,0x93,0x03,0xB6,0x03,0xD9,0x03,0xFC,0x03,0x1F,0x04, 0x42,0x04,0x65,0x04,0x88,0x04,0xAB,0x04,0xCE,0x04,0xF1,0x04,0x03,0x05,0x15,0x05,0x38,0x05, 0x5B,0x05,0x7E,0x05,0xA1,0x05,0xC4,0x05,0xE7,0x05,0x0A,0x06,0x2D,0x06,0x50,0x06,0x73,0x06, 0x96,0x06,0xB9,0x06,0xDC,0x06,0xFF,0x06,0x22,0x07,0x45,0x07,0x57,0x07,0x7A,0x07,0x8C,0x07, 0xAF,0x07,0xD2,0x07,0xF5,0x07,0x18,0x08,0x3B,0x08,0x4D,0x08,0x70,0x08,0x93,0x08,0xA5,0x08, 0xC8,0x08,0xEB,0x08,0xFD,0x08,0x0F,0x09,0x32,0x09,0x44,0x09,0x67,0x09,0x8A,0x09,0xAD,0x09, 0xD0,0x09,0xF3,0x09,0x05,0x0A,0x17,0x0A,0x29,0x0A,0x4C,0x0A,0x6F,0x0A,0x92,0x0A,0xB5,0x0A, 0xD8,0x0A,0xEA,0x0A,0x0D,0x0B,0x1F,0x0B,0x42,0x0B,0x65,0x0B, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x21 '!' 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, 8, // 0x22 '"' 0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x3F,0xE0,0x3F,0xE0,0x08,0x80,0x11,0x00,0x7F,0xC0,0x7F,0xC0,0x22,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x24 '$' 0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1F,0x00,0x34,0x80,0x64,0x00,0x74,0x00,0x3C,0x00,0x0F,0x00,0x0B,0x80,0x09,0x80,0x4B,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x00,0x00, 18, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x08,0x00,0x66,0x10,0x00,0x66,0x20,0x00,0x66,0x2F,0x00,0x66,0x59,0x80,0x66,0x99,0x80,0x3D,0x19,0x80,0x01,0x19,0x80,0x02,0x19,0x80,0x04,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x26 '&' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x36,0x00,0x1C,0x60,0x36,0x60,0x63,0x60,0x61,0xC0,0x31,0xC0,0x1F,0x60,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x27 ''' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x28 '(' 0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C, 8, // 0x29 ')' 0x00,0x00,0x00,0x30,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x30, 10, // 0x2A '*' 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x7F,0xC0,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0xC0,0xC0,0x00, 7, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, 10, // 0x2F '/' 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, 10, // 0x30 '0' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x31 '1' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x3C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x32 '2' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x33 '3' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x01,0x80,0x0F,0x00,0x03,0x00,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x34 '4' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x07,0x00,0x0B,0x00,0x13,0x00,0x23,0x00,0x43,0x00,0x7F,0xC0,0x03,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x35 '5' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x30,0x00,0x30,0x00,0x3E,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x36 '6' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x38,0x00,0x30,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x37 '7' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x38 '8' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x39 '9' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x03,0x00,0x07,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, 6, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x38,0x30,0x30,0x60,0x60,0x00, 12, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x40,0x01,0x80,0x06,0x00,0x18,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x3F '?' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 14, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x18,0x20,0x20,0x10,0x27,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, 11, // 0x41 'A' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x1B,0x00,0x31,0x80,0x3F,0x80,0x31,0x80,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x42 'B' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x43 'C' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x61,0x80,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x61,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x45 'E' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x46 'F' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x63,0xC0,0x60,0xC0,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x48 'H' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x7F,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x49 'I' 0x00,0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00, 8, // 0x4A 'J' 0x00,0x00,0x00,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0xF8,0x00,0x00,0x00, 11, // 0x4B 'K' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7C,0x00,0x76,0x00,0x63,0x00,0x61,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x4C 'L' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x70,0x70,0x70,0x70,0xF0,0x58,0xB0,0x59,0xB0,0x4D,0x30,0x4F,0x30,0x46,0x30,0x46,0x30,0x40,0x30,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x4E 'N' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x40,0x70,0x40,0x58,0x40,0x4C,0x40,0x4C,0x40,0x46,0x40,0x43,0x40,0x43,0x40,0x41,0xC0,0x40,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x50 'P' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x63,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x30,0xC0,0x0F,0x80,0x03,0x00,0x03,0x00,0x01,0xE0, 11, // 0x52 'R' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x63,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x53 'S' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x61,0x80,0x60,0x00,0x3E,0x00,0x1F,0x00,0x01,0x80,0x61,0x80,0x63,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x54 'T' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x55 'U' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x56 'V' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x31,0x80,0x31,0x80,0x1B,0x00,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 16, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x86,0x61,0x86,0x63,0xC6,0x32,0x4C,0x36,0x6C,0x36,0x6C,0x34,0x2C,0x1C,0x38,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x58 'X' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x31,0x80,0x31,0x80,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x59 'Y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x5A 'Z' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x5B '[' 0x00,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3E, 10, // 0x5C '\' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0x00, 8, // 0x5D ']' 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x7C, 12, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xC0,0x00,0x00, 10, // 0x60 '`' 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x03,0x00,0x03,0x00,0x3F,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x62 'b' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x33,0x60,0x60,0x60,0x60,0x33,0x1E,0x00,0x00,0x00, 10, // 0x64 'd' 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x63,0x00,0x7F,0x00,0x60,0x00,0x60,0x00,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x66 'f' 0x00,0x00,0x00,0x1C,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, 10, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x03,0x00,0x3E,0x00, 10, // 0x68 'h' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x69 'i' 0x00,0x00,0x00,0x60,0x60,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 6, // 0x6A 'j' 0x00,0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF0, 9, // 0x6B 'k' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x63,0x00,0x66,0x00,0x6C,0x00,0x78,0x00,0x7C,0x00,0x66,0x00,0x63,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x6C 'l' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 14, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x70,0x73,0x98,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x63,0x18,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, 10, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x01,0x80,0x01,0x80, 7, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x7E,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 8, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x62,0x60,0x7C,0x3E,0x06,0x46,0x3C,0x00,0x00,0x00, 6, // 0x74 't' 0x00,0x00,0x00,0x00,0x60,0x60,0xFC,0x60,0x60,0x60,0x60,0x60,0x60,0x3C,0x00,0x00,0x00, 10, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 14, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x33,0x30,0x37,0xB0,0x34,0xB0,0x1C,0xE0,0x1C,0xE0,0x0C,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x36,0x00,0x63,0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x00,0x63,0x00,0x63,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x1C,0x00,0x1C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, 8, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x18,0x30,0x60,0x7E,0x00,0x00,0x00, 10, // 0x7B '{' 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x80, 8, // 0x7C '|' 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, 10, // 0x7D '}' 0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x03,0x80,0x06,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x78,0x00, 12, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x24,0x20,0x46,0x20,0x42,0x40,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 14, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u verdana18[] = { 18, 4, 32, 128-32, 0x00,0x00,0x13,0x00,0x26,0x00,0x39,0x00,0x5E,0x00,0x83,0x00,0xA8,0x00,0xCD,0x00,0xE0,0x00, 0xF3,0x00,0x06,0x01,0x2B,0x01,0x50,0x01,0x63,0x01,0x76,0x01,0x89,0x01,0x9C,0x01,0xC1,0x01, 0xE6,0x01,0x0B,0x02,0x30,0x02,0x55,0x02,0x7A,0x02,0x9F,0x02,0xC4,0x02,0xE9,0x02,0x0E,0x03, 0x21,0x03,0x34,0x03,0x59,0x03,0x7E,0x03,0xA3,0x03,0xB6,0x03,0xDB,0x03,0x00,0x04,0x25,0x04, 0x4A,0x04,0x6F,0x04,0x94,0x04,0xB9,0x04,0xDE,0x04,0x03,0x05,0x16,0x05,0x29,0x05,0x4E,0x05, 0x61,0x05,0x86,0x05,0xAB,0x05,0xD0,0x05,0xF5,0x05,0x1A,0x06,0x3F,0x06,0x64,0x06,0x89,0x06, 0xAE,0x06,0xD3,0x06,0xF8,0x06,0x1D,0x07,0x42,0x07,0x67,0x07,0x7A,0x07,0x8D,0x07,0xA0,0x07, 0xC5,0x07,0xEA,0x07,0x0F,0x08,0x34,0x08,0x59,0x08,0x6C,0x08,0x91,0x08,0xB6,0x08,0xC9,0x08, 0xEE,0x08,0x13,0x09,0x26,0x09,0x39,0x09,0x5E,0x09,0x71,0x09,0x96,0x09,0xBB,0x09,0xE0,0x09, 0x05,0x0A,0x2A,0x0A,0x3D,0x0A,0x50,0x0A,0x63,0x0A,0x88,0x0A,0xAD,0x0A,0xD2,0x0A,0xF7,0x0A, 0x1C,0x0B,0x41,0x0B,0x66,0x0B,0x79,0x0B,0x9E,0x0B,0xC3,0x0B, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x21 '!' 0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00, 7, // 0x22 '"' 0x00,0x00,0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x04,0x80,0x09,0x00,0x3F,0xC0,0x09,0x00,0x11,0x00,0x12,0x00,0x7F,0x80,0x12,0x00,0x24,0x00,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x24 '$' 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x49,0x00,0x48,0x00,0x48,0x00,0x38,0x00,0x0E,0x00,0x09,0x00,0x09,0x00,0x49,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x08,0x00, 16, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x20,0x44,0x40,0x44,0x40,0x44,0x80,0x44,0x80,0x38,0x9C,0x01,0x22,0x01,0x22,0x02,0x22,0x02,0x22,0x04,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x26 '&' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x21,0x00,0x21,0x00,0x1E,0x40,0x24,0x40,0x42,0x40,0x41,0x40,0x40,0x80,0x21,0x40,0x1E,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x27 ''' 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x28 '(' 0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08, 7, // 0x29 ')' 0x00,0x00,0x00,0x20,0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20, 10, // 0x2A '*' 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x49,0x00,0x2A,0x00,0x1C,0x00,0x2A,0x00,0x49,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x3F,0xE0,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x40,0x40, 7, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,0x00, 7, // 0x2F '/' 0x00,0x00,0x00,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x00, 10, // 0x30 '0' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x31 '1' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1C,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x32 '2' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x41,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x0C,0x00,0x30,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x33 '3' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x40,0x80,0x00,0x80,0x01,0x00,0x0E,0x00,0x01,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x34 '4' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x05,0x00,0x09,0x00,0x11,0x00,0x21,0x00,0x41,0x00,0x7F,0xC0,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x35 '5' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x20,0x00,0x20,0x00,0x20,0x00,0x3E,0x00,0x01,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x41,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x36 '6' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x37 '7' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x38 '8' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x39 '9' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x20,0x80,0x1F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00, 7, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x20,0x20, 12, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x3F '?' 0x00,0x00,0x00,0x00,0x3C,0x42,0x02,0x02,0x04,0x08,0x10,0x10,0x00,0x10,0x10,0x00,0x00,0x00, 15, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0x60,0x20,0x10,0x23,0xD0,0x44,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x44,0x48,0x23,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, 10, // 0x41 'A' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x40,0x80,0x7F,0x80,0x40,0x80,0x80,0x40,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x42 'B' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x43 'C' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x40,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x80,0x40,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x41,0x80,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x45 'E' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x46 'F' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x30,0x60,0x20,0x20,0x40,0x00,0x40,0x00,0x41,0xE0,0x40,0x20,0x40,0x20,0x20,0x20,0x30,0x20,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x48 'H' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x49 'I' 0x00,0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00, 7, // 0x4A 'J' 0x00,0x00,0x00,0x00,0x3C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0xF0,0x00,0x00,0x00, 10, // 0x4B 'K' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x41,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x4C 'L' 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00,0x00, 13, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x50,0x50,0x50,0x50,0x48,0x90,0x48,0x90,0x45,0x10,0x45,0x10,0x42,0x10,0x42,0x10,0x40,0x10,0x40,0x10,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x4E 'N' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x60,0x40,0x50,0x40,0x48,0x40,0x48,0x40,0x44,0x40,0x42,0x40,0x42,0x40,0x41,0x40,0x40,0xC0,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x20,0x40,0x30,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x50 'P' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x41,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x41,0x00,0x7E,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x30,0xC0,0x20,0x40,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x20,0x40,0x30,0xC0,0x0F,0x00,0x01,0x00,0x01,0x00,0x00,0xE0, 10, // 0x52 'R' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x53 'S' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x20,0x80,0x40,0x00,0x40,0x00,0x20,0x00,0x1E,0x00,0x01,0x00,0x00,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x54 'T' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x55 'U' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x56 'V' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x80,0x40,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x21,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 15, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x04,0x41,0x04,0x22,0x88,0x22,0x88,0x22,0x88,0x12,0x90,0x14,0x50,0x14,0x50,0x14,0x50,0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x58 'X' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x21,0x00,0x21,0x00,0x12,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x12,0x00,0x21,0x00,0x21,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x59 'Y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x41,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x5A 'Z' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x5B '[' 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3C, 7, // 0x5C '\' 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x00, 7, // 0x5D ']' 0x00,0x00,0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78, 12, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x09,0x00,0x10,0x80,0x20,0x40,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xC0,0x00,0x00, 10, // 0x60 '`' 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x01,0x00,0x3F,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x62 'b' 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x21,0x40,0x40,0x40,0x40,0x21,0x1E,0x00,0x00,0x00, 9, // 0x64 'd' 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x22,0x00,0x41,0x00,0x7F,0x00,0x40,0x00,0x40,0x00,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x66 'f' 0x00,0x00,0x00,0x1C,0x20,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00, 9, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x22,0x00,0x1C,0x00, 9, // 0x68 'h' 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 3, // 0x69 'i' 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 5, // 0x6A 'j' 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xE0, 9, // 0x6B 'k' 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x42,0x00,0x44,0x00,0x48,0x00,0x50,0x00,0x68,0x00,0x44,0x00,0x42,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 3, // 0x6C 'l' 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 15, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2E,0x70,0x31,0x88,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x61,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x21,0x00,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x21,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x00,0x62,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x7C,0x00,0x40,0x00,0x40,0x00,0x40,0x00, 9, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x21,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x23,0x00,0x1D,0x00,0x01,0x00,0x01,0x00,0x01,0x00, 6, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x00, 8, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x40,0x30,0x0C,0x02,0x42,0x3C,0x00,0x00,0x00, 6, // 0x74 't' 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x7C,0x20,0x20,0x20,0x20,0x20,0x20,0x1C,0x00,0x00,0x00, 9, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x43,0x00,0x3D,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x10,0x42,0x10,0x25,0x20,0x25,0x20,0x28,0xA0,0x28,0xA0,0x10,0x40,0x10,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x22,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x14,0x00,0x22,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x41,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00, 9, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x7B '{' 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x60,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x07,0x00, 7, // 0x7C '|' 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, 10, // 0x7D '}' 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x02,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x38,0x00, 12, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x24,0x20,0x42,0x40,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 15, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 0 }; const int8u verdana18_bold[] = { 18, 4, 32, 128-32, 0x00,0x00,0x13,0x00,0x26,0x00,0x4B,0x00,0x70,0x00,0x95,0x00,0xCC,0x00,0xF1,0x00,0x04,0x01, 0x17,0x01,0x2A,0x01,0x4F,0x01,0x74,0x01,0x87,0x01,0x9A,0x01,0xAD,0x01,0xD2,0x01,0xF7,0x01, 0x1C,0x02,0x41,0x02,0x66,0x02,0x8B,0x02,0xB0,0x02,0xD5,0x02,0xFA,0x02,0x1F,0x03,0x44,0x03, 0x57,0x03,0x6A,0x03,0x8F,0x03,0xB4,0x03,0xD9,0x03,0xFE,0x03,0x23,0x04,0x48,0x04,0x6D,0x04, 0x92,0x04,0xB7,0x04,0xDC,0x04,0x01,0x05,0x26,0x05,0x4B,0x05,0x5E,0x05,0x71,0x05,0x96,0x05, 0xBB,0x05,0xE0,0x05,0x05,0x06,0x2A,0x06,0x4F,0x06,0x74,0x06,0x99,0x06,0xBE,0x06,0xE3,0x06, 0x08,0x07,0x2D,0x07,0x52,0x07,0x77,0x07,0x9C,0x07,0xC1,0x07,0xD4,0x07,0xF9,0x07,0x0C,0x08, 0x31,0x08,0x56,0x08,0x7B,0x08,0xA0,0x08,0xC5,0x08,0xD8,0x08,0xFD,0x08,0x22,0x09,0x35,0x09, 0x5A,0x09,0x7F,0x09,0x92,0x09,0xA5,0x09,0xCA,0x09,0xDD,0x09,0x02,0x0A,0x27,0x0A,0x4C,0x0A, 0x71,0x0A,0x96,0x0A,0xA9,0x0A,0xCE,0x0A,0xE1,0x0A,0x06,0x0B,0x2B,0x0B,0x50,0x0B,0x75,0x0B, 0x9A,0x0B,0xBF,0x0B,0xE4,0x0B,0xF7,0x0B,0x1C,0x0C,0x41,0x0C, 5, // 0x20 ' ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x21 '!' 0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00, 9, // 0x22 '"' 0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x23 '#' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x20,0x04,0x20,0x08,0x40,0x3F,0xF0,0x3F,0xF0,0x08,0x40,0x10,0x80,0x7F,0xE0,0x7F,0xE0,0x21,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x24 '$' 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x1F,0x80,0x34,0xC0,0x64,0xC0,0x64,0x00,0x3C,0x00,0x07,0x80,0x04,0xC0,0x64,0xC0,0x65,0x80,0x3F,0x00,0x04,0x00,0x04,0x00,0x00,0x00, 19, // 0x25 '%' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x08,0x00,0x63,0x10,0x00,0x63,0x10,0x00,0x63,0x20,0x00,0x63,0x2F,0x80,0x63,0x58,0xC0,0x3E,0x98,0xC0,0x00,0x98,0xC0,0x01,0x18,0xC0,0x01,0x18,0xC0,0x02,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x26 '&' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x60,0x36,0x60,0x63,0x60,0x61,0xC0,0x60,0xC0,0x30,0xE0,0x1F,0x30,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x27 ''' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x28 '(' 0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x18,0x0C,0x06, 8, // 0x29 ')' 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x30,0x60, 11, // 0x2A '*' 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x24,0x80,0x15,0x00,0x0E,0x00,0x15,0x00,0x24,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x2B '+' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x3F,0xE0,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2C ',' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x60,0x60,0x60,0xC0,0xC0, 7, // 0x2D '-' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5, // 0x2E '.' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, 10, // 0x2F '/' 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x30,0x00,0x60,0x00,0x60,0x00,0x00,0x00, 11, // 0x30 '0' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x31 '1' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x1E,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x32 '2' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x60,0xC0,0x00,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x33 '3' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x61,0x80,0x60,0xC0,0x00,0xC0,0x01,0x80,0x0F,0x00,0x01,0x80,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x34 '4' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x03,0x80,0x05,0x80,0x09,0x80,0x11,0x80,0x21,0x80,0x41,0x80,0x7F,0xE0,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x35 '5' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xC0,0x30,0x00,0x30,0x00,0x30,0x00,0x3F,0x00,0x01,0x80,0x00,0xC0,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x36 '6' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x18,0x00,0x30,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x37 '7' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0xC0,0x01,0x80,0x01,0x80,0x03,0x00,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x38 '8' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x39 '9' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x31,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0xC0,0x1E,0xC0,0x00,0xC0,0x01,0x80,0x03,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x3A ':' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x00, 6, // 0x3B ';' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x00,0x00,0x38,0x30,0x30,0x30,0x60,0x60, 13, // 0x3C '<' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0xC0,0x03,0x00,0x0C,0x00,0x30,0x00,0x30,0x00,0x0C,0x00,0x03,0x00,0x00,0xC0,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x3D '=' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x3E '>' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x60,0x00,0x60,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, // 0x3F '?' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x63,0x00,0x03,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 14, // 0x40 '@' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x18,0x60,0x20,0x10,0x27,0xD0,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x4C,0xC8,0x27,0xF0,0x20,0x00,0x18,0x00,0x07,0xC0,0x00,0x00, 12, // 0x41 'A' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0F,0x00,0x0F,0x00,0x19,0x80,0x19,0x80,0x30,0xC0,0x3F,0xC0,0x30,0xC0,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x42 'B' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x43 'C' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xC0,0x30,0xC0,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x30,0xC0,0x38,0xC0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x44 'D' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0xC0,0x60,0xC0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xC0,0x61,0xC0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x45 'E' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x46 'F' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x47 'G' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x38,0x60,0x30,0x60,0x60,0x00,0x60,0x00,0x63,0xE0,0x60,0x60,0x60,0x60,0x30,0x60,0x38,0x60,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x48 'H' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0xE0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x49 'I' 0x00,0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00, 8, // 0x4A 'J' 0x00,0x00,0x00,0x00,0x3E,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x0C,0xF8,0x00,0x00,0x00, 12, // 0x4B 'K' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0xC0,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7E,0x00,0x73,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x4C 'L' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 14, // 0x4D 'M' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x38,0x70,0x38,0x70,0x78,0x58,0x58,0x58,0xD8,0x4C,0x98,0x4D,0x98,0x47,0x18,0x47,0x18,0x42,0x18,0x40,0x18,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x4E 'N' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x20,0x70,0x20,0x58,0x20,0x4C,0x20,0x4C,0x20,0x46,0x20,0x43,0x20,0x43,0x20,0x41,0xA0,0x40,0xE0,0x40,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x4F 'O' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xE0,0x30,0x60,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x30,0x60,0x38,0xE0,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x50 'P' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13, // 0x51 'Q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x38,0xE0,0x30,0x60,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x60,0x30,0x30,0x60,0x38,0xE0,0x0F,0x80,0x03,0x00,0x03,0x80,0x01,0xF0, 12, // 0x52 'R' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x61,0x80,0x7F,0x00,0x61,0x80,0x60,0xC0,0x60,0x60,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x53 'S' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x30,0xC0,0x60,0xC0,0x60,0x00,0x7C,0x00,0x3F,0x80,0x03,0xC0,0x00,0xC0,0x60,0xC0,0x61,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x54 'T' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12, // 0x55 'U' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x30,0xC0,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x56 'V' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xC0,0x60,0xC0,0x31,0x80,0x31,0x80,0x31,0x80,0x1B,0x00,0x1B,0x00,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 16, // 0x57 'W' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x86,0x61,0x86,0x63,0xC6,0x33,0xCC,0x32,0x4C,0x32,0x4C,0x1E,0x78,0x1C,0x38,0x1C,0x38,0x0C,0x30,0x0C,0x30,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x58 'X' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x31,0x80,0x31,0x80,0x1B,0x00,0x0E,0x00,0x0E,0x00,0x0E,0x00,0x1B,0x00,0x31,0x80,0x31,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x59 'Y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x5A 'Z' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x01,0x80,0x03,0x00,0x06,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x5B '[' 0x00,0x00,0x00,0x3E,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3E, 10, // 0x5C '\' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0x00,0x00, 8, // 0x5D ']' 0x00,0x00,0x00,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x7C, 13, // 0x5E '^' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0F,0x00,0x19,0x80,0x30,0xC0,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x5F '_' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xE0,0x00,0x00, 11, // 0x60 '`' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x61 'a' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x01,0x80,0x01,0x80,0x3F,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x62 'b' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8, // 0x63 'c' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x33,0x60,0x60,0x60,0x60,0x33,0x1E,0x00,0x00,0x00, 10, // 0x64 'd' 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x65 'e' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x7F,0x80,0x60,0x00,0x60,0x00,0x31,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6, // 0x66 'f' 0x00,0x00,0x00,0x1C,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00, 10, // 0x67 'g' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x03,0x00,0x3E,0x00, 10, // 0x68 'h' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x69 'i' 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 6, // 0x6A 'j' 0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF0, 10, // 0x6B 'k' 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x61,0x80,0x63,0x00,0x66,0x00,0x6C,0x00,0x7E,0x00,0x73,0x00,0x61,0x80,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 4, // 0x6C 'l' 0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 16, // 0x6D 'm' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x3C,0x71,0xC6,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x61,0x86,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x6E 'n' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6F,0x00,0x71,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x6F 'o' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x33,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x70 'p' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x00,0x73,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x00,0x7E,0x00,0x60,0x00,0x60,0x00,0x60,0x00, 10, // 0x71 'q' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x31,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x33,0x80,0x1D,0x80,0x01,0x80,0x01,0x80,0x01,0x80, 7, // 0x72 'r' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x7E,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00, 9, // 0x73 's' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x61,0x00,0x60,0x00,0x7E,0x00,0x3F,0x00,0x03,0x00,0x43,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 7, // 0x74 't' 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x7E,0x30,0x30,0x30,0x30,0x30,0x30,0x1E,0x00,0x00,0x00, 10, // 0x75 'u' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x61,0x80,0x63,0x80,0x3D,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x76 'v' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 14, // 0x77 'w' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x18,0x63,0x18,0x63,0x18,0x37,0xB0,0x34,0xB0,0x3C,0xF0,0x18,0x60,0x18,0x60,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x78 'x' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x33,0x00,0x33,0x00,0x61,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 10, // 0x79 'y' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0x80,0x61,0x80,0x33,0x00,0x33,0x00,0x33,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x18,0x00, 9, // 0x7A 'z' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, // 0x7B '{' 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x18,0x00,0x70,0x00,0x18,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x07,0x80, 8, // 0x7C '|' 0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, 11, // 0x7D '}' 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x01,0xC0,0x03,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x3C,0x00, 13, // 0x7E '~' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x10,0x24,0x10,0x42,0x10,0x41,0x20,0x40,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 15, // 0x7F '' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 0 }; } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_rounded_rect.cpp0000644000175000017500000001236613233644505024151 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Rounded rectangle vertex generator // //---------------------------------------------------------------------------- #include #include "agg_rounded_rect.h" namespace agg24 { //------------------------------------------------------------------------ rounded_rect::rounded_rect(double x1, double y1, double x2, double y2, double r) : m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2), m_rx1(r), m_ry1(r), m_rx2(r), m_ry2(r), m_rx3(r), m_ry3(r), m_rx4(r), m_ry4(r) { if(x1 > x2) { m_x1 = x2; m_x2 = x1; } if(y1 > y2) { m_y1 = y2; m_y2 = y1; } } //-------------------------------------------------------------------- void rounded_rect::rect(double x1, double y1, double x2, double y2) { m_x1 = x1; m_y1 = y1; m_x2 = x2; m_y2 = y2; if(x1 > x2) { m_x1 = x2; m_x2 = x1; } if(y1 > y2) { m_y1 = y2; m_y2 = y1; } } //-------------------------------------------------------------------- void rounded_rect::radius(double r) { m_rx1 = m_ry1 = m_rx2 = m_ry2 = m_rx3 = m_ry3 = m_rx4 = m_ry4 = r; } //-------------------------------------------------------------------- void rounded_rect::radius(double rx, double ry) { m_rx1 = m_rx2 = m_rx3 = m_rx4 = rx; m_ry1 = m_ry2 = m_ry3 = m_ry4 = ry; } //-------------------------------------------------------------------- void rounded_rect::radius(double rx_bottom, double ry_bottom, double rx_top, double ry_top) { m_rx1 = m_rx2 = rx_bottom; m_rx3 = m_rx4 = rx_top; m_ry1 = m_ry2 = ry_bottom; m_ry3 = m_ry4 = ry_top; } //-------------------------------------------------------------------- void rounded_rect::radius(double rx1, double ry1, double rx2, double ry2, double rx3, double ry3, double rx4, double ry4) { m_rx1 = rx1; m_ry1 = ry1; m_rx2 = rx2; m_ry2 = ry2; m_rx3 = rx3; m_ry3 = ry3; m_rx4 = rx4; m_ry4 = ry4; } //-------------------------------------------------------------------- void rounded_rect::normalize_radius() { double dx = fabs(m_y2 - m_y1); double dy = fabs(m_x2 - m_x1); double k = 1.0; double t; t = dx / (m_rx1 + m_rx2); if(t < k) k = t; t = dx / (m_rx3 + m_rx4); if(t < k) k = t; t = dy / (m_ry1 + m_ry2); if(t < k) k = t; t = dy / (m_ry3 + m_ry4); if(t < k) k = t; if(k < 1.0) { m_rx1 *= k; m_ry1 *= k; m_rx2 *= k; m_ry2 *= k; m_rx3 *= k; m_ry3 *= k; m_rx4 *= k; m_ry4 *= k; } } //-------------------------------------------------------------------- void rounded_rect::rewind(unsigned) { m_status = 0; } //-------------------------------------------------------------------- unsigned rounded_rect::vertex(double* x, double* y) { unsigned cmd = path_cmd_stop; switch(m_status) { case 0: m_arc.init(m_x1 + m_rx1, m_y1 + m_ry1, m_rx1, m_ry1, pi, pi+pi*0.5); m_arc.rewind(0); m_status++; case 1: cmd = m_arc.vertex(x, y); if(is_stop(cmd)) m_status++; else return cmd; case 2: m_arc.init(m_x2 - m_rx2, m_y1 + m_ry2, m_rx2, m_ry2, pi+pi*0.5, 0.0); m_arc.rewind(0); m_status++; case 3: cmd = m_arc.vertex(x, y); if(is_stop(cmd)) m_status++; else return path_cmd_line_to; case 4: m_arc.init(m_x2 - m_rx3, m_y2 - m_ry3, m_rx3, m_ry3, 0.0, pi*0.5); m_arc.rewind(0); m_status++; case 5: cmd = m_arc.vertex(x, y); if(is_stop(cmd)) m_status++; else return path_cmd_line_to; case 6: m_arc.init(m_x1 + m_rx4, m_y2 - m_ry4, m_rx4, m_ry4, pi*0.5, pi); m_arc.rewind(0); m_status++; case 7: cmd = m_arc.vertex(x, y); if(is_stop(cmd)) m_status++; else return path_cmd_line_to; case 8: cmd = path_cmd_end_poly | path_flags_close | path_flags_ccw; m_status++; break; } return cmd; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_sqrt_tables.cpp0000644000175000017500000002055613233644505024017 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // static tables for fast integer sqrt // //---------------------------------------------------------------------------- #include "agg_basics.h" namespace agg24 { int16u g_sqrt_table[1024] = //----------g_sqrt_table { 0, 2048,2896,3547,4096,4579,5017,5418,5793,6144,6476,6792,7094,7384,7663,7932,8192,8444, 8689,8927,9159,9385,9606,9822,10033,10240,10443,10642,10837,11029,11217,11403,11585, 11765,11942,12116,12288,12457,12625,12790,12953,13114,13273,13430,13585,13738,13890, 14040,14189,14336,14482,14626,14768,14910,15050,15188,15326,15462,15597,15731,15864, 15995,16126,16255,16384,16512,16638,16764,16888,17012,17135,17257,17378,17498,17618, 17736,17854,17971,18087,18203,18318,18432,18545,18658,18770,18882,18992,19102,19212, 19321,19429,19537,19644,19750,19856,19961,20066,20170,20274,20377,20480,20582,20684, 20785,20886,20986,21085,21185,21283,21382,21480,21577,21674,21771,21867,21962,22058, 22153,22247,22341,22435,22528,22621,22713,22806,22897,22989,23080,23170,23261,23351, 23440,23530,23619,23707,23796,23884,23971,24059,24146,24232,24319,24405,24491,24576, 24661,24746,24831,24915,24999,25083,25166,25249,25332,25415,25497,25580,25661,25743, 25824,25905,25986,26067,26147,26227,26307,26387,26466,26545,26624,26703,26781,26859, 26937,27015,27092,27170,27247,27324,27400,27477,27553,27629,27705,27780,27856,27931, 28006,28081,28155,28230,28304,28378,28452,28525,28599,28672,28745,28818,28891,28963, 29035,29108,29180,29251,29323,29394,29466,29537,29608,29678,29749,29819,29890,29960, 30030,30099,30169,30238,30308,30377,30446,30515,30583,30652,30720,30788,30856,30924, 30992,31059,31127,31194,31261,31328,31395,31462,31529,31595,31661,31727,31794,31859, 31925,31991,32056,32122,32187,32252,32317,32382,32446,32511,32575,32640,32704,32768, 32832,32896,32959,33023,33086,33150,33213,33276,33339,33402,33465,33527,33590,33652, 33714,33776,33839,33900,33962,34024,34086,34147,34208,34270,34331,34392,34453,34514, 34574,34635,34695,34756,34816,34876,34936,34996,35056,35116,35176,35235,35295,35354, 35413,35472,35531,35590,35649,35708,35767,35825,35884,35942,36001,36059,36117,36175, 36233,36291,36348,36406,36464,36521,36578,36636,36693,36750,36807,36864,36921,36978, 37034,37091,37147,37204,37260,37316,37372,37429,37485,37540,37596,37652,37708,37763, 37819,37874,37929,37985,38040,38095,38150,38205,38260,38315,38369,38424,38478,38533, 38587,38642,38696,38750,38804,38858,38912,38966,39020,39073,39127,39181,39234,39287, 39341,39394,39447,39500,39553,39606,39659,39712,39765,39818,39870,39923,39975,40028, 40080,40132,40185,40237,40289,40341,40393,40445,40497,40548,40600,40652,40703,40755, 40806,40857,40909,40960,41011,41062,41113,41164,41215,41266,41317,41368,41418,41469, 41519,41570,41620,41671,41721,41771,41821,41871,41922,41972,42021,42071,42121,42171, 42221,42270,42320,42369,42419,42468,42518,42567,42616,42665,42714,42763,42813,42861, 42910,42959,43008,43057,43105,43154,43203,43251,43300,43348,43396,43445,43493,43541, 43589,43637,43685,43733,43781,43829,43877,43925,43972,44020,44068,44115,44163,44210, 44258,44305,44352,44400,44447,44494,44541,44588,44635,44682,44729,44776,44823,44869, 44916,44963,45009,45056,45103,45149,45195,45242,45288,45334,45381,45427,45473,45519, 45565,45611,45657,45703,45749,45795,45840,45886,45932,45977,46023,46069,46114,46160, 46205,46250,46296,46341,46386,46431,46477,46522,46567,46612,46657,46702,46746,46791, 46836,46881,46926,46970,47015,47059,47104,47149,47193,47237,47282,47326,47370,47415, 47459,47503,47547,47591,47635,47679,47723,47767,47811,47855,47899,47942,47986,48030, 48074,48117,48161,48204,48248,48291,48335,48378,48421,48465,48508,48551,48594,48637, 48680,48723,48766,48809,48852,48895,48938,48981,49024,49067,49109,49152,49195,49237, 49280,49322,49365,49407,49450,49492,49535,49577,49619,49661,49704,49746,49788,49830, 49872,49914,49956,49998,50040,50082,50124,50166,50207,50249,50291,50332,50374,50416, 50457,50499,50540,50582,50623,50665,50706,50747,50789,50830,50871,50912,50954,50995, 51036,51077,51118,51159,51200,51241,51282,51323,51364,51404,51445,51486,51527,51567, 51608,51649,51689,51730,51770,51811,51851,51892,51932,51972,52013,52053,52093,52134, 52174,52214,52254,52294,52334,52374,52414,52454,52494,52534,52574,52614,52654,52694, 52734,52773,52813,52853,52892,52932,52972,53011,53051,53090,53130,53169,53209,53248, 53287,53327,53366,53405,53445,53484,53523,53562,53601,53640,53679,53719,53758,53797, 53836,53874,53913,53952,53991,54030,54069,54108,54146,54185,54224,54262,54301,54340, 54378,54417,54455,54494,54532,54571,54609,54647,54686,54724,54762,54801,54839,54877, 54915,54954,54992,55030,55068,55106,55144,55182,55220,55258,55296,55334,55372,55410, 55447,55485,55523,55561,55599,55636,55674,55712,55749,55787,55824,55862,55900,55937, 55975,56012,56049,56087,56124,56162,56199,56236,56273,56311,56348,56385,56422,56459, 56497,56534,56571,56608,56645,56682,56719,56756,56793,56830,56867,56903,56940,56977, 57014,57051,57087,57124,57161,57198,57234,57271,57307,57344,57381,57417,57454,57490, 57527,57563,57599,57636,57672,57709,57745,57781,57817,57854,57890,57926,57962,57999, 58035,58071,58107,58143,58179,58215,58251,58287,58323,58359,58395,58431,58467,58503, 58538,58574,58610,58646,58682,58717,58753,58789,58824,58860,58896,58931,58967,59002, 59038,59073,59109,59144,59180,59215,59251,59286,59321,59357,59392,59427,59463,59498, 59533,59568,59603,59639,59674,59709,59744,59779,59814,59849,59884,59919,59954,59989, 60024,60059,60094,60129,60164,60199,60233,60268,60303,60338,60373,60407,60442,60477, 60511,60546,60581,60615,60650,60684,60719,60753,60788,60822,60857,60891,60926,60960, 60995,61029,61063,61098,61132,61166,61201,61235,61269,61303,61338,61372,61406,61440, 61474,61508,61542,61576,61610,61644,61678,61712,61746,61780,61814,61848,61882,61916, 61950,61984,62018,62051,62085,62119,62153,62186,62220,62254,62287,62321,62355,62388, 62422,62456,62489,62523,62556,62590,62623,62657,62690,62724,62757,62790,62824,62857, 62891,62924,62957,62991,63024,63057,63090,63124,63157,63190,63223,63256,63289,63323, 63356,63389,63422,63455,63488,63521,63554,63587,63620,63653,63686,63719,63752,63785, 63817,63850,63883,63916,63949,63982,64014,64047,64080,64113,64145,64178,64211,64243, 64276,64309,64341,64374,64406,64439,64471,64504,64536,64569,64601,64634,64666,64699, 64731,64763,64796,64828,64861,64893,64925,64957,64990,65022,65054,65086,65119,65151, 65183,65215,65247,65279,65312,65344,65376,65408,65440,65472,65504 }; int8 g_elder_bit_table[256] = //---------g_elder_bit_table { 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 }; } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_vcgen_markers_term.cpp0000644000175000017500000000651513233644505025350 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Terminal markers generator (arrowhead/arrowtail) // //---------------------------------------------------------------------------- #include "agg_vcgen_markers_term.h" namespace agg24 { //------------------------------------------------------------------------ void vcgen_markers_term::remove_all() { m_markers.remove_all(); } //------------------------------------------------------------------------ void vcgen_markers_term::add_vertex(double x, double y, unsigned cmd) { if(is_move_to(cmd)) { if(m_markers.size() & 1) { // Initial state, the first coordinate was added. // If two of more calls of start_vertex() occures // we just modify the last one. m_markers.modify_last(coord_type(x, y)); } else { m_markers.add(coord_type(x, y)); } } else { if(is_vertex(cmd)) { if(m_markers.size() & 1) { // Initial state, the first coordinate was added. // Add three more points, 0,1,1,0 m_markers.add(coord_type(x, y)); m_markers.add(m_markers[m_markers.size() - 1]); m_markers.add(m_markers[m_markers.size() - 3]); } else { if(m_markers.size()) { // Replace two last points: 0,1,1,0 -> 0,1,2,1 m_markers[m_markers.size() - 1] = m_markers[m_markers.size() - 2]; m_markers[m_markers.size() - 2] = coord_type(x, y); } } } } } //------------------------------------------------------------------------ void vcgen_markers_term::rewind(unsigned path_id) { m_curr_id = path_id * 2; m_curr_idx = m_curr_id; } //------------------------------------------------------------------------ unsigned vcgen_markers_term::vertex(double* x, double* y) { if(m_curr_id > 2 || m_curr_idx >= m_markers.size()) { return path_cmd_stop; } const coord_type& c = m_markers[m_curr_idx]; *x = c.x; *y = c.y; if(m_curr_idx & 1) { m_curr_idx += 3; return path_cmd_line_to; } ++m_curr_idx; return path_cmd_move_to; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_vpgen_clip_polyline.cpp0000644000175000017500000000474213233644505025534 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include "agg_vpgen_clip_polyline.h" #include "agg_clip_liang_barsky.h" namespace agg24 { //---------------------------------------------------------------------------- void vpgen_clip_polyline::reset() { m_vertex = 0; m_num_vertices = 0; m_move_to = false; } //---------------------------------------------------------------------------- void vpgen_clip_polyline::move_to(double x, double y) { m_vertex = 0; m_num_vertices = 0; m_x1 = x; m_y1 = y; m_move_to = true; } //---------------------------------------------------------------------------- void vpgen_clip_polyline::line_to(double x, double y) { double x2 = x; double y2 = y; unsigned flags = clip_line_segment(&m_x1, &m_y1, &x2, &y2, m_clip_box); m_vertex = 0; m_num_vertices = 0; if((flags & 4) == 0) { if((flags & 1) != 0 || m_move_to) { m_x[0] = m_x1; m_y[0] = m_y1; m_cmd[0] = path_cmd_move_to; m_num_vertices = 1; } m_x[m_num_vertices] = x2; m_y[m_num_vertices] = y2; m_cmd[m_num_vertices++] = path_cmd_line_to; m_move_to = (flags & 2) != 0; } m_x1 = x; m_y1 = y; } //---------------------------------------------------------------------------- unsigned vpgen_clip_polyline::vertex(double* x, double* y) { if(m_vertex < m_num_vertices) { *x = m_x[m_vertex]; *y = m_y[m_vertex]; return m_cmd[m_vertex++]; } return path_cmd_stop; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/news0000644000175000017500000000000013233644505021027 0ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/autogen.sh0000644000175000017500000000047213233644505022143 0ustar varunvarun# autogen.sh # # invoke the auto* tools to create the configureation system # build aclocal.m4 aclocal # build the configure script autoconf # set up libtool libtoolize --force # invoke automake automake --foreign --add-missing # and finally invoke our new configure ./configure $* # end enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/ChangeLog0000644000175000017500000000000013233644505021702 0ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_bspline.cpp0000644000175000017500000001774113233644505023132 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // class bspline // //---------------------------------------------------------------------------- #include "agg_bspline.h" namespace agg24 { //------------------------------------------------------------------------ bspline::bspline() : m_max(0), m_num(0), m_x(0), m_y(0), m_last_idx(-1) { } //------------------------------------------------------------------------ bspline::bspline(int num) : m_max(0), m_num(0), m_x(0), m_y(0), m_last_idx(-1) { init(num); } //------------------------------------------------------------------------ bspline::bspline(int num, const double* x, const double* y) : m_max(0), m_num(0), m_x(0), m_y(0), m_last_idx(-1) { init(num, x, y); } //------------------------------------------------------------------------ void bspline::init(int max) { if(max > 2 && max > m_max) { m_am.resize(max * 3); m_max = max; m_x = &m_am[m_max]; m_y = &m_am[m_max * 2]; } m_num = 0; m_last_idx = -1; } //------------------------------------------------------------------------ void bspline::add_point(double x, double y) { if(m_num < m_max) { m_x[m_num] = x; m_y[m_num] = y; ++m_num; } } //------------------------------------------------------------------------ void bspline::prepare() { if(m_num > 2) { int i, k, n1; double* temp; double* r; double* s; double h, p, d, f, e; for(k = 0; k < m_num; k++) { m_am[k] = 0.0; } n1 = 3 * m_num; pod_array al(n1); temp = &al[0]; for(k = 0; k < n1; k++) { temp[k] = 0.0; } r = temp + m_num; s = temp + m_num * 2; n1 = m_num - 1; d = m_x[1] - m_x[0]; e = (m_y[1] - m_y[0]) / d; for(k = 1; k < n1; k++) { h = d; d = m_x[k + 1] - m_x[k]; f = e; e = (m_y[k + 1] - m_y[k]) / d; al[k] = d / (d + h); r[k] = 1.0 - al[k]; s[k] = 6.0 * (e - f) / (h + d); } for(k = 1; k < n1; k++) { p = 1.0 / (r[k] * al[k - 1] + 2.0); al[k] *= -p; s[k] = (s[k] - r[k] * s[k - 1]) * p; } m_am[n1] = 0.0; al[n1 - 1] = s[n1 - 1]; m_am[n1 - 1] = al[n1 - 1]; for(k = n1 - 2, i = 0; i < m_num - 2; i++, k--) { al[k] = al[k] * al[k + 1] + s[k]; m_am[k] = al[k]; } } m_last_idx = -1; } //------------------------------------------------------------------------ void bspline::init(int num, const double* x, const double* y) { if(num > 2) { init(num); int i; for(i = 0; i < num; i++) { add_point(*x++, *y++); } prepare(); } m_last_idx = -1; } //------------------------------------------------------------------------ void bspline::bsearch(int n, const double *x, double x0, int *i) { int j = n - 1; int k; for(*i = 0; (j - *i) > 1; ) { if(x0 < x[k = (*i + j) >> 1]) j = k; else *i = k; } } //------------------------------------------------------------------------ double bspline::interpolation(double x, int i) const { int j = i + 1; double d = m_x[i] - m_x[j]; double h = x - m_x[j]; double r = m_x[i] - x; double p = d * d / 6.0; return (m_am[j] * r * r * r + m_am[i] * h * h * h) / 6.0 / d + ((m_y[j] - m_am[j] * p) * r + (m_y[i] - m_am[i] * p) * h) / d; } //------------------------------------------------------------------------ double bspline::extrapolation_left(double x) const { double d = m_x[1] - m_x[0]; return (-d * m_am[1] / 6 + (m_y[1] - m_y[0]) / d) * (x - m_x[0]) + m_y[0]; } //------------------------------------------------------------------------ double bspline::extrapolation_right(double x) const { double d = m_x[m_num - 1] - m_x[m_num - 2]; return (d * m_am[m_num - 2] / 6 + (m_y[m_num - 1] - m_y[m_num - 2]) / d) * (x - m_x[m_num - 1]) + m_y[m_num - 1]; } //------------------------------------------------------------------------ double bspline::get(double x) const { if(m_num > 2) { int i; // Extrapolation on the left if(x < m_x[0]) return extrapolation_left(x); // Extrapolation on the right if(x >= m_x[m_num - 1]) return extrapolation_right(x); // Interpolation bsearch(m_num, m_x, x, &i); return interpolation(x, i); } return 0.0; } //------------------------------------------------------------------------ double bspline::get_stateful(double x) const { if(m_num > 2) { // Extrapolation on the left if(x < m_x[0]) return extrapolation_left(x); // Extrapolation on the right if(x >= m_x[m_num - 1]) return extrapolation_right(x); if(m_last_idx >= 0) { // Check if x is not in current range if(x < m_x[m_last_idx] || x > m_x[m_last_idx + 1]) { // Check if x between next points (most probably) if(m_last_idx < m_num - 2 && x >= m_x[m_last_idx + 1] && x <= m_x[m_last_idx + 2]) { ++m_last_idx; } else if(m_last_idx > 0 && x >= m_x[m_last_idx - 1] && x <= m_x[m_last_idx]) { // x is between pevious points --m_last_idx; } else { // Else perform full search bsearch(m_num, m_x, x, &m_last_idx); } } return interpolation(x, m_last_idx); } else { // Interpolation bsearch(m_num, m_x, x, &m_last_idx); return interpolation(x, m_last_idx); } } return 0.0; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/install0000644000175000017500000000000013233644505021521 0ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_arrowhead.cpp0000644000175000017500000000726213233644505023447 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Simple arrowhead/arrowtail generator // //---------------------------------------------------------------------------- #include "agg_arrowhead.h" namespace agg24 { //------------------------------------------------------------------------ arrowhead::arrowhead() : m_head_d1(1.0), m_head_d2(1.0), m_head_d3(1.0), m_head_d4(0.0), m_tail_d1(1.0), m_tail_d2(1.0), m_tail_d3(1.0), m_tail_d4(0.0), m_head_flag(false), m_tail_flag(false), m_curr_id(0), m_curr_coord(0) { } //------------------------------------------------------------------------ void arrowhead::rewind(unsigned path_id) { m_curr_id = path_id; m_curr_coord = 0; if(path_id == 0) { if(!m_tail_flag) { m_cmd[0] = path_cmd_stop; return; } m_coord[0] = m_tail_d1; m_coord[1] = 0.0; m_coord[2] = m_tail_d1 - m_tail_d4; m_coord[3] = m_tail_d3; m_coord[4] = -m_tail_d2 - m_tail_d4; m_coord[5] = m_tail_d3; m_coord[6] = -m_tail_d2; m_coord[7] = 0.0; m_coord[8] = -m_tail_d2 - m_tail_d4; m_coord[9] = -m_tail_d3; m_coord[10] = m_tail_d1 - m_tail_d4; m_coord[11] = -m_tail_d3; m_cmd[0] = path_cmd_move_to; m_cmd[1] = path_cmd_line_to; m_cmd[2] = path_cmd_line_to; m_cmd[3] = path_cmd_line_to; m_cmd[4] = path_cmd_line_to; m_cmd[5] = path_cmd_line_to; m_cmd[7] = path_cmd_end_poly | path_flags_close | path_flags_ccw; m_cmd[6] = path_cmd_stop; return; } if(path_id == 1) { if(!m_head_flag) { m_cmd[0] = path_cmd_stop; return; } m_coord[0] = -m_head_d1; m_coord[1] = 0.0; m_coord[2] = m_head_d2 + m_head_d4; m_coord[3] = -m_head_d3; m_coord[4] = m_head_d2; m_coord[5] = 0.0; m_coord[6] = m_head_d2 + m_head_d4; m_coord[7] = m_head_d3; m_cmd[0] = path_cmd_move_to; m_cmd[1] = path_cmd_line_to; m_cmd[2] = path_cmd_line_to; m_cmd[3] = path_cmd_line_to; m_cmd[4] = path_cmd_end_poly | path_flags_close | path_flags_ccw; m_cmd[5] = path_cmd_stop; return; } } //------------------------------------------------------------------------ unsigned arrowhead::vertex(double* x, double* y) { if(m_curr_id < 2) { unsigned curr_idx = m_curr_coord * 2; *x = m_coord[curr_idx]; *y = m_coord[curr_idx + 1]; return m_cmd[m_curr_coord++]; } return path_cmd_stop; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_gsv_text.cpp0000644000175000017500000010160613233644505023333 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Class gsv_text // //---------------------------------------------------------------------------- #include #include #include "agg_gsv_text.h" #include "agg_bounding_rect.h" namespace agg24 { int8u gsv_default_font[] = { 0x40,0x00,0x6c,0x0f,0x15,0x00,0x0e,0x00,0xf9,0xff, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x0d,0x0a,0x0d,0x0a,0x46,0x6f,0x6e,0x74,0x20,0x28, 0x63,0x29,0x20,0x4d,0x69,0x63,0x72,0x6f,0x50,0x72, 0x6f,0x66,0x20,0x32,0x37,0x20,0x53,0x65,0x70,0x74, 0x65,0x6d,0x62,0x2e,0x31,0x39,0x38,0x39,0x00,0x0d, 0x0a,0x0d,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x12,0x00,0x34,0x00,0x46,0x00,0x94,0x00, 0xd0,0x00,0x2e,0x01,0x3e,0x01,0x64,0x01,0x8a,0x01, 0x98,0x01,0xa2,0x01,0xb4,0x01,0xba,0x01,0xc6,0x01, 0xcc,0x01,0xf0,0x01,0xfa,0x01,0x18,0x02,0x38,0x02, 0x44,0x02,0x68,0x02,0x98,0x02,0xa2,0x02,0xde,0x02, 0x0e,0x03,0x24,0x03,0x40,0x03,0x48,0x03,0x52,0x03, 0x5a,0x03,0x82,0x03,0xec,0x03,0xfa,0x03,0x26,0x04, 0x4c,0x04,0x6a,0x04,0x7c,0x04,0x8a,0x04,0xb6,0x04, 0xc4,0x04,0xca,0x04,0xe0,0x04,0xee,0x04,0xf8,0x04, 0x0a,0x05,0x18,0x05,0x44,0x05,0x5e,0x05,0x8e,0x05, 0xac,0x05,0xd6,0x05,0xe0,0x05,0xf6,0x05,0x00,0x06, 0x12,0x06,0x1c,0x06,0x28,0x06,0x36,0x06,0x48,0x06, 0x4e,0x06,0x60,0x06,0x6e,0x06,0x74,0x06,0x84,0x06, 0xa6,0x06,0xc8,0x06,0xe6,0x06,0x08,0x07,0x2c,0x07, 0x3c,0x07,0x68,0x07,0x7c,0x07,0x8c,0x07,0xa2,0x07, 0xb0,0x07,0xb6,0x07,0xd8,0x07,0xec,0x07,0x10,0x08, 0x32,0x08,0x54,0x08,0x64,0x08,0x88,0x08,0x98,0x08, 0xac,0x08,0xb6,0x08,0xc8,0x08,0xd2,0x08,0xe4,0x08, 0xf2,0x08,0x3e,0x09,0x48,0x09,0x94,0x09,0xc2,0x09, 0xc4,0x09,0xd0,0x09,0xe2,0x09,0x04,0x0a,0x0e,0x0a, 0x26,0x0a,0x34,0x0a,0x4a,0x0a,0x66,0x0a,0x70,0x0a, 0x7e,0x0a,0x8e,0x0a,0x9a,0x0a,0xa6,0x0a,0xb4,0x0a, 0xd8,0x0a,0xe2,0x0a,0xf6,0x0a,0x18,0x0b,0x22,0x0b, 0x32,0x0b,0x56,0x0b,0x60,0x0b,0x6e,0x0b,0x7c,0x0b, 0x8a,0x0b,0x9c,0x0b,0x9e,0x0b,0xb2,0x0b,0xc2,0x0b, 0xd8,0x0b,0xf4,0x0b,0x08,0x0c,0x30,0x0c,0x56,0x0c, 0x72,0x0c,0x90,0x0c,0xb2,0x0c,0xce,0x0c,0xe2,0x0c, 0xfe,0x0c,0x10,0x0d,0x26,0x0d,0x36,0x0d,0x42,0x0d, 0x4e,0x0d,0x5c,0x0d,0x78,0x0d,0x8c,0x0d,0x8e,0x0d, 0x90,0x0d,0x92,0x0d,0x94,0x0d,0x96,0x0d,0x98,0x0d, 0x9a,0x0d,0x9c,0x0d,0x9e,0x0d,0xa0,0x0d,0xa2,0x0d, 0xa4,0x0d,0xa6,0x0d,0xa8,0x0d,0xaa,0x0d,0xac,0x0d, 0xae,0x0d,0xb0,0x0d,0xb2,0x0d,0xb4,0x0d,0xb6,0x0d, 0xb8,0x0d,0xba,0x0d,0xbc,0x0d,0xbe,0x0d,0xc0,0x0d, 0xc2,0x0d,0xc4,0x0d,0xc6,0x0d,0xc8,0x0d,0xca,0x0d, 0xcc,0x0d,0xce,0x0d,0xd0,0x0d,0xd2,0x0d,0xd4,0x0d, 0xd6,0x0d,0xd8,0x0d,0xda,0x0d,0xdc,0x0d,0xde,0x0d, 0xe0,0x0d,0xe2,0x0d,0xe4,0x0d,0xe6,0x0d,0xe8,0x0d, 0xea,0x0d,0xec,0x0d,0x0c,0x0e,0x26,0x0e,0x48,0x0e, 0x64,0x0e,0x88,0x0e,0x92,0x0e,0xa6,0x0e,0xb4,0x0e, 0xd0,0x0e,0xee,0x0e,0x02,0x0f,0x16,0x0f,0x26,0x0f, 0x3c,0x0f,0x58,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f, 0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x6c,0x0f,0x10,0x80, 0x05,0x95,0x00,0x72,0x00,0xfb,0xff,0x7f,0x01,0x7f, 0x01,0x01,0xff,0x01,0x05,0xfe,0x05,0x95,0xff,0x7f, 0x00,0x7a,0x01,0x86,0xff,0x7a,0x01,0x87,0x01,0x7f, 0xfe,0x7a,0x0a,0x87,0xff,0x7f,0x00,0x7a,0x01,0x86, 0xff,0x7a,0x01,0x87,0x01,0x7f,0xfe,0x7a,0x05,0xf2, 0x0b,0x95,0xf9,0x64,0x0d,0x9c,0xf9,0x64,0xfa,0x91, 0x0e,0x00,0xf1,0xfa,0x0e,0x00,0x04,0xfc,0x08,0x99, 0x00,0x63,0x04,0x9d,0x00,0x63,0x04,0x96,0xff,0x7f, 0x01,0x7f,0x01,0x01,0x00,0x01,0xfe,0x02,0xfd,0x01, 0xfc,0x00,0xfd,0x7f,0xfe,0x7e,0x00,0x7e,0x01,0x7e, 0x01,0x7f,0x02,0x7f,0x06,0x7e,0x02,0x7f,0x02,0x7e, 0xf2,0x89,0x02,0x7e,0x02,0x7f,0x06,0x7e,0x02,0x7f, 0x01,0x7f,0x01,0x7e,0x00,0x7c,0xfe,0x7e,0xfd,0x7f, 0xfc,0x00,0xfd,0x01,0xfe,0x02,0x00,0x01,0x01,0x01, 0x01,0x7f,0xff,0x7f,0x10,0xfd,0x15,0x95,0xee,0x6b, 0x05,0x95,0x02,0x7e,0x00,0x7e,0xff,0x7e,0xfe,0x7f, 0xfe,0x00,0xfe,0x02,0x00,0x02,0x01,0x02,0x02,0x01, 0x02,0x00,0x02,0x7f,0x03,0x7f,0x03,0x00,0x03,0x01, 0x02,0x01,0xfc,0xf2,0xfe,0x7f,0xff,0x7e,0x00,0x7e, 0x02,0x7e,0x02,0x00,0x02,0x01,0x01,0x02,0x00,0x02, 0xfe,0x02,0xfe,0x00,0x07,0xf9,0x15,0x8d,0xff,0x7f, 0x01,0x7f,0x01,0x01,0x00,0x01,0xff,0x01,0xff,0x00, 0xff,0x7f,0xff,0x7e,0xfe,0x7b,0xfe,0x7d,0xfe,0x7e, 0xfe,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x02,0x00,0x03, 0x01,0x02,0x06,0x04,0x02,0x02,0x01,0x02,0x00,0x02, 0xff,0x02,0xfe,0x01,0xfe,0x7f,0xff,0x7e,0x00,0x7e, 0x01,0x7d,0x02,0x7d,0x05,0x79,0x02,0x7e,0x03,0x7f, 0x01,0x00,0x01,0x01,0x00,0x01,0xf1,0xfe,0xfe,0x01, 0xff,0x02,0x00,0x03,0x01,0x02,0x02,0x02,0x00,0x86, 0x01,0x7e,0x08,0x75,0x02,0x7e,0x02,0x7f,0x05,0x80, 0x05,0x93,0xff,0x01,0x01,0x01,0x01,0x7f,0x00,0x7e, 0xff,0x7e,0xff,0x7f,0x06,0xf1,0x0b,0x99,0xfe,0x7e, 0xfe,0x7d,0xfe,0x7c,0xff,0x7b,0x00,0x7c,0x01,0x7b, 0x02,0x7c,0x02,0x7d,0x02,0x7e,0xfe,0x9e,0xfe,0x7c, 0xff,0x7d,0xff,0x7b,0x00,0x7c,0x01,0x7b,0x01,0x7d, 0x02,0x7c,0x05,0x85,0x03,0x99,0x02,0x7e,0x02,0x7d, 0x02,0x7c,0x01,0x7b,0x00,0x7c,0xff,0x7b,0xfe,0x7c, 0xfe,0x7d,0xfe,0x7e,0x02,0x9e,0x02,0x7c,0x01,0x7d, 0x01,0x7b,0x00,0x7c,0xff,0x7b,0xff,0x7d,0xfe,0x7c, 0x09,0x85,0x08,0x95,0x00,0x74,0xfb,0x89,0x0a,0x7a, 0x00,0x86,0xf6,0x7a,0x0d,0xf4,0x0d,0x92,0x00,0x6e, 0xf7,0x89,0x12,0x00,0x04,0xf7,0x06,0x81,0xff,0x7f, 0xff,0x01,0x01,0x01,0x01,0x7f,0x00,0x7e,0xff,0x7e, 0xff,0x7f,0x06,0x84,0x04,0x89,0x12,0x00,0x04,0xf7, 0x05,0x82,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, 0x05,0xfe,0x00,0xfd,0x0e,0x18,0x00,0xeb,0x09,0x95, 0xfd,0x7f,0xfe,0x7d,0xff,0x7b,0x00,0x7d,0x01,0x7b, 0x02,0x7d,0x03,0x7f,0x02,0x00,0x03,0x01,0x02,0x03, 0x01,0x05,0x00,0x03,0xff,0x05,0xfe,0x03,0xfd,0x01, 0xfe,0x00,0x0b,0xeb,0x06,0x91,0x02,0x01,0x03,0x03, 0x00,0x6b,0x09,0x80,0x04,0x90,0x00,0x01,0x01,0x02, 0x01,0x01,0x02,0x01,0x04,0x00,0x02,0x7f,0x01,0x7f, 0x01,0x7e,0x00,0x7e,0xff,0x7e,0xfe,0x7d,0xf6,0x76, 0x0e,0x00,0x03,0x80,0x05,0x95,0x0b,0x00,0xfa,0x78, 0x03,0x00,0x02,0x7f,0x01,0x7f,0x01,0x7d,0x00,0x7e, 0xff,0x7d,0xfe,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01, 0xff,0x01,0xff,0x02,0x11,0xfc,0x0d,0x95,0xf6,0x72, 0x0f,0x00,0xfb,0x8e,0x00,0x6b,0x07,0x80,0x0f,0x95, 0xf6,0x00,0xff,0x77,0x01,0x01,0x03,0x01,0x03,0x00, 0x03,0x7f,0x02,0x7e,0x01,0x7d,0x00,0x7e,0xff,0x7d, 0xfe,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x01, 0xff,0x02,0x11,0xfc,0x10,0x92,0xff,0x02,0xfd,0x01, 0xfe,0x00,0xfd,0x7f,0xfe,0x7d,0xff,0x7b,0x00,0x7b, 0x01,0x7c,0x02,0x7e,0x03,0x7f,0x01,0x00,0x03,0x01, 0x02,0x02,0x01,0x03,0x00,0x01,0xff,0x03,0xfe,0x02, 0xfd,0x01,0xff,0x00,0xfd,0x7f,0xfe,0x7e,0xff,0x7d, 0x10,0xf9,0x11,0x95,0xf6,0x6b,0xfc,0x95,0x0e,0x00, 0x03,0xeb,0x08,0x95,0xfd,0x7f,0xff,0x7e,0x00,0x7e, 0x01,0x7e,0x02,0x7f,0x04,0x7f,0x03,0x7f,0x02,0x7e, 0x01,0x7e,0x00,0x7d,0xff,0x7e,0xff,0x7f,0xfd,0x7f, 0xfc,0x00,0xfd,0x01,0xff,0x01,0xff,0x02,0x00,0x03, 0x01,0x02,0x02,0x02,0x03,0x01,0x04,0x01,0x02,0x01, 0x01,0x02,0x00,0x02,0xff,0x02,0xfd,0x01,0xfc,0x00, 0x0c,0xeb,0x10,0x8e,0xff,0x7d,0xfe,0x7e,0xfd,0x7f, 0xff,0x00,0xfd,0x01,0xfe,0x02,0xff,0x03,0x00,0x01, 0x01,0x03,0x02,0x02,0x03,0x01,0x01,0x00,0x03,0x7f, 0x02,0x7e,0x01,0x7c,0x00,0x7b,0xff,0x7b,0xfe,0x7d, 0xfd,0x7f,0xfe,0x00,0xfd,0x01,0xff,0x02,0x10,0xfd, 0x05,0x8e,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, 0x00,0xf4,0xff,0x7f,0x01,0x7f,0x01,0x01,0xff,0x01, 0x05,0xfe,0x05,0x8e,0xff,0x7f,0x01,0x7f,0x01,0x01, 0xff,0x01,0x01,0xf3,0xff,0x7f,0xff,0x01,0x01,0x01, 0x01,0x7f,0x00,0x7e,0xff,0x7e,0xff,0x7f,0x06,0x84, 0x14,0x92,0xf0,0x77,0x10,0x77,0x04,0x80,0x04,0x8c, 0x12,0x00,0xee,0xfa,0x12,0x00,0x04,0xfa,0x04,0x92, 0x10,0x77,0xf0,0x77,0x14,0x80,0x03,0x90,0x00,0x01, 0x01,0x02,0x01,0x01,0x02,0x01,0x04,0x00,0x02,0x7f, 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f, 0xfc,0x7e,0x00,0x7d,0x00,0xfb,0xff,0x7f,0x01,0x7f, 0x01,0x01,0xff,0x01,0x09,0xfe,0x12,0x8d,0xff,0x02, 0xfe,0x01,0xfd,0x00,0xfe,0x7f,0xff,0x7f,0xff,0x7d, 0x00,0x7d,0x01,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, 0x01,0x02,0xfb,0x88,0xfe,0x7e,0xff,0x7d,0x00,0x7d, 0x01,0x7e,0x01,0x7f,0x07,0x8b,0xff,0x78,0x00,0x7e, 0x02,0x7f,0x02,0x00,0x02,0x02,0x01,0x03,0x00,0x02, 0xff,0x03,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfd,0x01, 0xfd,0x00,0xfd,0x7f,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, 0xff,0x7d,0x00,0x7d,0x01,0x7d,0x01,0x7e,0x02,0x7e, 0x02,0x7f,0x03,0x7f,0x03,0x00,0x03,0x01,0x02,0x01, 0x01,0x01,0xfe,0x8d,0xff,0x78,0x00,0x7e,0x01,0x7f, 0x08,0xfb,0x09,0x95,0xf8,0x6b,0x08,0x95,0x08,0x6b, 0xf3,0x87,0x0a,0x00,0x04,0xf9,0x04,0x95,0x00,0x6b, 0x00,0x95,0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e, 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x80, 0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e,0x00,0x7d, 0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x00,0x11,0x80, 0x12,0x90,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfc,0x00, 0xfe,0x7f,0xfe,0x7e,0xff,0x7e,0xff,0x7d,0x00,0x7b, 0x01,0x7d,0x01,0x7e,0x02,0x7e,0x02,0x7f,0x04,0x00, 0x02,0x01,0x02,0x02,0x01,0x02,0x03,0xfb,0x04,0x95, 0x00,0x6b,0x00,0x95,0x07,0x00,0x03,0x7f,0x02,0x7e, 0x01,0x7e,0x01,0x7d,0x00,0x7b,0xff,0x7d,0xff,0x7e, 0xfe,0x7e,0xfd,0x7f,0xf9,0x00,0x11,0x80,0x04,0x95, 0x00,0x6b,0x00,0x95,0x0d,0x00,0xf3,0xf6,0x08,0x00, 0xf8,0xf5,0x0d,0x00,0x02,0x80,0x04,0x95,0x00,0x6b, 0x00,0x95,0x0d,0x00,0xf3,0xf6,0x08,0x00,0x06,0xf5, 0x12,0x90,0xff,0x02,0xfe,0x02,0xfe,0x01,0xfc,0x00, 0xfe,0x7f,0xfe,0x7e,0xff,0x7e,0xff,0x7d,0x00,0x7b, 0x01,0x7d,0x01,0x7e,0x02,0x7e,0x02,0x7f,0x04,0x00, 0x02,0x01,0x02,0x02,0x01,0x02,0x00,0x03,0xfb,0x80, 0x05,0x00,0x03,0xf8,0x04,0x95,0x00,0x6b,0x0e,0x95, 0x00,0x6b,0xf2,0x8b,0x0e,0x00,0x04,0xf5,0x04,0x95, 0x00,0x6b,0x04,0x80,0x0c,0x95,0x00,0x70,0xff,0x7d, 0xff,0x7f,0xfe,0x7f,0xfe,0x00,0xfe,0x01,0xff,0x01, 0xff,0x03,0x00,0x02,0x0e,0xf9,0x04,0x95,0x00,0x6b, 0x0e,0x95,0xf2,0x72,0x05,0x85,0x09,0x74,0x03,0x80, 0x04,0x95,0x00,0x6b,0x00,0x80,0x0c,0x00,0x01,0x80, 0x04,0x95,0x00,0x6b,0x00,0x95,0x08,0x6b,0x08,0x95, 0xf8,0x6b,0x08,0x95,0x00,0x6b,0x04,0x80,0x04,0x95, 0x00,0x6b,0x00,0x95,0x0e,0x6b,0x00,0x95,0x00,0x6b, 0x04,0x80,0x09,0x95,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, 0xff,0x7d,0x00,0x7b,0x01,0x7d,0x01,0x7e,0x02,0x7e, 0x02,0x7f,0x04,0x00,0x02,0x01,0x02,0x02,0x01,0x02, 0x01,0x03,0x00,0x05,0xff,0x03,0xff,0x02,0xfe,0x02, 0xfe,0x01,0xfc,0x00,0x0d,0xeb,0x04,0x95,0x00,0x6b, 0x00,0x95,0x09,0x00,0x03,0x7f,0x01,0x7f,0x01,0x7e, 0x00,0x7d,0xff,0x7e,0xff,0x7f,0xfd,0x7f,0xf7,0x00, 0x11,0xf6,0x09,0x95,0xfe,0x7f,0xfe,0x7e,0xff,0x7e, 0xff,0x7d,0x00,0x7b,0x01,0x7d,0x01,0x7e,0x02,0x7e, 0x02,0x7f,0x04,0x00,0x02,0x01,0x02,0x02,0x01,0x02, 0x01,0x03,0x00,0x05,0xff,0x03,0xff,0x02,0xfe,0x02, 0xfe,0x01,0xfc,0x00,0x03,0xef,0x06,0x7a,0x04,0x82, 0x04,0x95,0x00,0x6b,0x00,0x95,0x09,0x00,0x03,0x7f, 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f, 0xfd,0x7f,0xf7,0x00,0x07,0x80,0x07,0x75,0x03,0x80, 0x11,0x92,0xfe,0x02,0xfd,0x01,0xfc,0x00,0xfd,0x7f, 0xfe,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x02,0x7f, 0x06,0x7e,0x02,0x7f,0x01,0x7f,0x01,0x7e,0x00,0x7d, 0xfe,0x7e,0xfd,0x7f,0xfc,0x00,0xfd,0x01,0xfe,0x02, 0x11,0xfd,0x08,0x95,0x00,0x6b,0xf9,0x95,0x0e,0x00, 0x01,0xeb,0x04,0x95,0x00,0x71,0x01,0x7d,0x02,0x7e, 0x03,0x7f,0x02,0x00,0x03,0x01,0x02,0x02,0x01,0x03, 0x00,0x0f,0x04,0xeb,0x01,0x95,0x08,0x6b,0x08,0x95, 0xf8,0x6b,0x09,0x80,0x02,0x95,0x05,0x6b,0x05,0x95, 0xfb,0x6b,0x05,0x95,0x05,0x6b,0x05,0x95,0xfb,0x6b, 0x07,0x80,0x03,0x95,0x0e,0x6b,0x00,0x95,0xf2,0x6b, 0x11,0x80,0x01,0x95,0x08,0x76,0x00,0x75,0x08,0x95, 0xf8,0x76,0x09,0xf5,0x11,0x95,0xf2,0x6b,0x00,0x95, 0x0e,0x00,0xf2,0xeb,0x0e,0x00,0x03,0x80,0x03,0x93, 0x00,0x6c,0x01,0x94,0x00,0x6c,0xff,0x94,0x05,0x00, 0xfb,0xec,0x05,0x00,0x02,0x81,0x00,0x95,0x0e,0x68, 0x00,0x83,0x06,0x93,0x00,0x6c,0x01,0x94,0x00,0x6c, 0xfb,0x94,0x05,0x00,0xfb,0xec,0x05,0x00,0x03,0x81, 0x03,0x87,0x08,0x05,0x08,0x7b,0xf0,0x80,0x08,0x04, 0x08,0x7c,0x03,0xf9,0x01,0x80,0x10,0x00,0x01,0x80, 0x06,0x95,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7f, 0x01,0x01,0xff,0x01,0x05,0xef,0x0f,0x8e,0x00,0x72, 0x00,0x8b,0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f, 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd, 0x04,0x95,0x00,0x6b,0x00,0x8b,0x02,0x02,0x02,0x01, 0x03,0x00,0x02,0x7f,0x02,0x7e,0x01,0x7d,0x00,0x7e, 0xff,0x7d,0xfe,0x7e,0xfe,0x7f,0xfd,0x00,0xfe,0x01, 0xfe,0x02,0x0f,0xfd,0x0f,0x8b,0xfe,0x02,0xfe,0x01, 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, 0x02,0x02,0x03,0xfd,0x0f,0x95,0x00,0x6b,0x00,0x8b, 0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f,0xfe,0x7e, 0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e,0x02,0x7f, 0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd,0x03,0x88, 0x0c,0x00,0x00,0x02,0xff,0x02,0xff,0x01,0xfe,0x01, 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, 0x02,0x02,0x03,0xfd,0x0a,0x95,0xfe,0x00,0xfe,0x7f, 0xff,0x7d,0x00,0x6f,0xfd,0x8e,0x07,0x00,0x03,0xf2, 0x0f,0x8e,0x00,0x70,0xff,0x7d,0xff,0x7f,0xfe,0x7f, 0xfd,0x00,0xfe,0x01,0x09,0x91,0xfe,0x02,0xfe,0x01, 0xfd,0x00,0xfe,0x7f,0xfe,0x7e,0xff,0x7d,0x00,0x7e, 0x01,0x7d,0x02,0x7e,0x02,0x7f,0x03,0x00,0x02,0x01, 0x02,0x02,0x04,0xfd,0x04,0x95,0x00,0x6b,0x00,0x8a, 0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f,0x01,0x7d, 0x00,0x76,0x04,0x80,0x03,0x95,0x01,0x7f,0x01,0x01, 0xff,0x01,0xff,0x7f,0x01,0xf9,0x00,0x72,0x04,0x80, 0x05,0x95,0x01,0x7f,0x01,0x01,0xff,0x01,0xff,0x7f, 0x01,0xf9,0x00,0x6f,0xff,0x7d,0xfe,0x7f,0xfe,0x00, 0x09,0x87,0x04,0x95,0x00,0x6b,0x0a,0x8e,0xf6,0x76, 0x04,0x84,0x07,0x78,0x02,0x80,0x04,0x95,0x00,0x6b, 0x04,0x80,0x04,0x8e,0x00,0x72,0x00,0x8a,0x03,0x03, 0x02,0x01,0x03,0x00,0x02,0x7f,0x01,0x7d,0x00,0x76, 0x00,0x8a,0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f, 0x01,0x7d,0x00,0x76,0x04,0x80,0x04,0x8e,0x00,0x72, 0x00,0x8a,0x03,0x03,0x02,0x01,0x03,0x00,0x02,0x7f, 0x01,0x7d,0x00,0x76,0x04,0x80,0x08,0x8e,0xfe,0x7f, 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x01,0x03, 0x00,0x02,0xff,0x03,0xfe,0x02,0xfe,0x01,0xfd,0x00, 0x0b,0xf2,0x04,0x8e,0x00,0x6b,0x00,0x92,0x02,0x02, 0x02,0x01,0x03,0x00,0x02,0x7f,0x02,0x7e,0x01,0x7d, 0x00,0x7e,0xff,0x7d,0xfe,0x7e,0xfe,0x7f,0xfd,0x00, 0xfe,0x01,0xfe,0x02,0x0f,0xfd,0x0f,0x8e,0x00,0x6b, 0x00,0x92,0xfe,0x02,0xfe,0x01,0xfd,0x00,0xfe,0x7f, 0xfe,0x7e,0xff,0x7d,0x00,0x7e,0x01,0x7d,0x02,0x7e, 0x02,0x7f,0x03,0x00,0x02,0x01,0x02,0x02,0x04,0xfd, 0x04,0x8e,0x00,0x72,0x00,0x88,0x01,0x03,0x02,0x02, 0x02,0x01,0x03,0x00,0x01,0xf2,0x0e,0x8b,0xff,0x02, 0xfd,0x01,0xfd,0x00,0xfd,0x7f,0xff,0x7e,0x01,0x7e, 0x02,0x7f,0x05,0x7f,0x02,0x7f,0x01,0x7e,0x00,0x7f, 0xff,0x7e,0xfd,0x7f,0xfd,0x00,0xfd,0x01,0xff,0x02, 0x0e,0xfd,0x05,0x95,0x00,0x6f,0x01,0x7d,0x02,0x7f, 0x02,0x00,0xf8,0x8e,0x07,0x00,0x03,0xf2,0x04,0x8e, 0x00,0x76,0x01,0x7d,0x02,0x7f,0x03,0x00,0x02,0x01, 0x03,0x03,0x00,0x8a,0x00,0x72,0x04,0x80,0x02,0x8e, 0x06,0x72,0x06,0x8e,0xfa,0x72,0x08,0x80,0x03,0x8e, 0x04,0x72,0x04,0x8e,0xfc,0x72,0x04,0x8e,0x04,0x72, 0x04,0x8e,0xfc,0x72,0x07,0x80,0x03,0x8e,0x0b,0x72, 0x00,0x8e,0xf5,0x72,0x0e,0x80,0x02,0x8e,0x06,0x72, 0x06,0x8e,0xfa,0x72,0xfe,0x7c,0xfe,0x7e,0xfe,0x7f, 0xff,0x00,0x0f,0x87,0x0e,0x8e,0xf5,0x72,0x00,0x8e, 0x0b,0x00,0xf5,0xf2,0x0b,0x00,0x03,0x80,0x09,0x99, 0xfe,0x7f,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e, 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xfe,0x7e,0x01,0x8e, 0xff,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x01,0x7e, 0x00,0x7e,0xff,0x7e,0xfc,0x7e,0x04,0x7e,0x01,0x7e, 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xff,0x7e,0x00,0x7e, 0x01,0x7e,0xff,0x8e,0x02,0x7e,0x00,0x7e,0xff,0x7e, 0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f, 0x02,0x7f,0x05,0x87,0x04,0x95,0x00,0x77,0x00,0xfd, 0x00,0x77,0x04,0x80,0x05,0x99,0x02,0x7f,0x01,0x7f, 0x01,0x7e,0x00,0x7e,0xff,0x7e,0xff,0x7f,0xff,0x7e, 0x00,0x7e,0x02,0x7e,0xff,0x8e,0x01,0x7e,0x00,0x7e, 0xff,0x7e,0xff,0x7f,0xff,0x7e,0x00,0x7e,0x01,0x7e, 0x04,0x7e,0xfc,0x7e,0xff,0x7e,0x00,0x7e,0x01,0x7e, 0x01,0x7f,0x01,0x7e,0x00,0x7e,0xff,0x7e,0x01,0x8e, 0xfe,0x7e,0x00,0x7e,0x01,0x7e,0x01,0x7f,0x01,0x7e, 0x00,0x7e,0xff,0x7e,0xff,0x7f,0xfe,0x7f,0x09,0x87, 0x03,0x86,0x00,0x02,0x01,0x03,0x02,0x01,0x02,0x00, 0x02,0x7f,0x04,0x7d,0x02,0x7f,0x02,0x00,0x02,0x01, 0x01,0x02,0xee,0xfe,0x01,0x02,0x02,0x01,0x02,0x00, 0x02,0x7f,0x04,0x7d,0x02,0x7f,0x02,0x00,0x02,0x01, 0x01,0x03,0x00,0x02,0x03,0xf4,0x10,0x80,0x03,0x80, 0x07,0x15,0x08,0x6b,0xfe,0x85,0xf5,0x00,0x10,0xfb, 0x0d,0x95,0xf6,0x00,0x00,0x6b,0x0a,0x00,0x02,0x02, 0x00,0x08,0xfe,0x02,0xf6,0x00,0x0e,0xf4,0x03,0x80, 0x00,0x15,0x0a,0x00,0x02,0x7e,0x00,0x7e,0x00,0x7d, 0x00,0x7e,0xfe,0x7f,0xf6,0x00,0x0a,0x80,0x02,0x7e, 0x01,0x7e,0x00,0x7d,0xff,0x7d,0xfe,0x7f,0xf6,0x00, 0x10,0x80,0x03,0x80,0x00,0x15,0x0c,0x00,0xff,0x7e, 0x03,0xed,0x03,0xfd,0x00,0x03,0x02,0x00,0x00,0x12, 0x02,0x03,0x0a,0x00,0x00,0x6b,0x02,0x00,0x00,0x7d, 0xfe,0x83,0xf4,0x00,0x11,0x80,0x0f,0x80,0xf4,0x00, 0x00,0x15,0x0c,0x00,0xff,0xf6,0xf5,0x00,0x0f,0xf5, 0x04,0x95,0x07,0x76,0x00,0x0a,0x07,0x80,0xf9,0x76, 0x00,0x75,0xf8,0x80,0x07,0x0c,0x09,0xf4,0xf9,0x0c, 0x09,0xf4,0x03,0x92,0x02,0x03,0x07,0x00,0x03,0x7d, 0x00,0x7b,0xfc,0x7e,0x04,0x7d,0x00,0x7a,0xfd,0x7e, 0xf9,0x00,0xfe,0x02,0x06,0x89,0x02,0x00,0x06,0xf5, 0x03,0x95,0x00,0x6b,0x0c,0x15,0x00,0x6b,0x02,0x80, 0x03,0x95,0x00,0x6b,0x0c,0x15,0x00,0x6b,0xf8,0x96, 0x03,0x00,0x07,0xea,0x03,0x80,0x00,0x15,0x0c,0x80, 0xf7,0x76,0xfd,0x00,0x03,0x80,0x0a,0x75,0x03,0x80, 0x03,0x80,0x07,0x13,0x02,0x02,0x03,0x00,0x00,0x6b, 0x02,0x80,0x03,0x80,0x00,0x15,0x09,0x6b,0x09,0x15, 0x00,0x6b,0x03,0x80,0x03,0x80,0x00,0x15,0x00,0xf6, 0x0d,0x00,0x00,0x8a,0x00,0x6b,0x03,0x80,0x07,0x80, 0xfd,0x00,0xff,0x03,0x00,0x04,0x00,0x07,0x00,0x04, 0x01,0x02,0x03,0x01,0x06,0x00,0x03,0x7f,0x01,0x7e, 0x01,0x7c,0x00,0x79,0xff,0x7c,0xff,0x7d,0xfd,0x00, 0xfa,0x00,0x0e,0x80,0x03,0x80,0x00,0x15,0x0c,0x00, 0x00,0x6b,0x02,0x80,0x03,0x80,0x00,0x15,0x0a,0x00, 0x02,0x7f,0x01,0x7d,0x00,0x7b,0xff,0x7e,0xfe,0x7f, 0xf6,0x00,0x10,0xf7,0x11,0x8f,0xff,0x03,0xff,0x02, 0xfe,0x01,0xfa,0x00,0xfd,0x7f,0xff,0x7e,0x00,0x7c, 0x00,0x79,0x00,0x7b,0x01,0x7e,0x03,0x00,0x06,0x00, 0x02,0x00,0x01,0x03,0x01,0x02,0x03,0xfb,0x03,0x95, 0x0c,0x00,0xfa,0x80,0x00,0x6b,0x09,0x80,0x03,0x95, 0x00,0x77,0x06,0x7a,0x06,0x06,0x00,0x09,0xfa,0xf1, 0xfa,0x7a,0x0e,0x80,0x03,0x87,0x00,0x0b,0x02,0x02, 0x03,0x00,0x02,0x7e,0x01,0x02,0x04,0x00,0x02,0x7e, 0x00,0x75,0xfe,0x7e,0xfc,0x00,0xff,0x01,0xfe,0x7f, 0xfd,0x00,0xfe,0x02,0x07,0x8e,0x00,0x6b,0x09,0x80, 0x03,0x80,0x0e,0x15,0xf2,0x80,0x0e,0x6b,0x03,0x80, 0x03,0x95,0x00,0x6b,0x0e,0x00,0x00,0x7d,0xfe,0x98, 0x00,0x6b,0x05,0x80,0x03,0x95,0x00,0x75,0x02,0x7d, 0x0a,0x00,0x00,0x8e,0x00,0x6b,0x02,0x80,0x03,0x95, 0x00,0x6b,0x10,0x00,0x00,0x15,0xf8,0x80,0x00,0x6b, 0x0a,0x80,0x03,0x95,0x00,0x6b,0x10,0x00,0x00,0x15, 0xf8,0x80,0x00,0x6b,0x0a,0x00,0x00,0x7d,0x02,0x83, 0x10,0x80,0x03,0x95,0x00,0x6b,0x09,0x00,0x03,0x02, 0x00,0x08,0xfd,0x02,0xf7,0x00,0x0e,0x89,0x00,0x6b, 0x03,0x80,0x03,0x95,0x00,0x6b,0x09,0x00,0x03,0x02, 0x00,0x08,0xfd,0x02,0xf7,0x00,0x0e,0xf4,0x03,0x92, 0x02,0x03,0x07,0x00,0x03,0x7d,0x00,0x70,0xfd,0x7e, 0xf9,0x00,0xfe,0x02,0x03,0x89,0x09,0x00,0x02,0xf5, 0x03,0x80,0x00,0x15,0x00,0xf5,0x07,0x00,0x00,0x08, 0x02,0x03,0x06,0x00,0x02,0x7d,0x00,0x70,0xfe,0x7e, 0xfa,0x00,0xfe,0x02,0x00,0x08,0x0c,0xf6,0x0f,0x80, 0x00,0x15,0xf6,0x00,0xfe,0x7d,0x00,0x79,0x02,0x7e, 0x0a,0x00,0xf4,0xf7,0x07,0x09,0x07,0xf7,0x03,0x8c, 0x01,0x02,0x01,0x01,0x05,0x00,0x02,0x7f,0x01,0x7e, 0x00,0x74,0x00,0x86,0xff,0x01,0xfe,0x01,0xfb,0x00, 0xff,0x7f,0xff,0x7f,0x00,0x7c,0x01,0x7e,0x01,0x00, 0x05,0x00,0x02,0x00,0x01,0x02,0x03,0xfe,0x04,0x8e, 0x02,0x01,0x04,0x00,0x02,0x7f,0x01,0x7e,0x00,0x77, 0xff,0x7e,0xfe,0x7f,0xfc,0x00,0xfe,0x01,0xff,0x02, 0x00,0x09,0x01,0x02,0x02,0x02,0x03,0x01,0x02,0x01, 0x01,0x01,0x01,0x02,0x02,0xeb,0x03,0x80,0x00,0x15, 0x03,0x00,0x02,0x7e,0x00,0x7b,0xfe,0x7e,0xfd,0x00, 0x03,0x80,0x04,0x00,0x03,0x7e,0x00,0x78,0xfd,0x7e, 0xf9,0x00,0x0c,0x80,0x03,0x8c,0x02,0x02,0x02,0x01, 0x03,0x00,0x02,0x7f,0x01,0x7d,0xfe,0x7e,0xf9,0x7d, 0xff,0x7e,0x00,0x7d,0x03,0x7f,0x02,0x00,0x03,0x01, 0x02,0x01,0x02,0xfe,0x0d,0x8c,0xff,0x02,0xfe,0x01, 0xfc,0x00,0xfe,0x7f,0xff,0x7e,0x00,0x77,0x01,0x7e, 0x02,0x7f,0x04,0x00,0x02,0x01,0x01,0x02,0x00,0x0f, 0xff,0x02,0xfe,0x01,0xf9,0x00,0x0c,0xeb,0x03,0x88, 0x0a,0x00,0x00,0x02,0x00,0x03,0xfe,0x02,0xfa,0x00, 0xff,0x7e,0xff,0x7d,0x00,0x7b,0x01,0x7c,0x01,0x7f, 0x06,0x00,0x02,0x02,0x03,0xfe,0x03,0x8f,0x06,0x77, 0x06,0x09,0xfa,0x80,0x00,0x71,0xff,0x87,0xfb,0x79, 0x07,0x87,0x05,0x79,0x02,0x80,0x03,0x8d,0x02,0x02, 0x06,0x00,0x02,0x7e,0x00,0x7d,0xfc,0x7d,0x04,0x7e, 0x00,0x7d,0xfe,0x7e,0xfa,0x00,0xfe,0x02,0x04,0x85, 0x02,0x00,0x06,0xf9,0x03,0x8f,0x00,0x73,0x01,0x7e, 0x07,0x00,0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e, 0x03,0x80,0x03,0x8f,0x00,0x73,0x01,0x7e,0x07,0x00, 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0xf8,0x90, 0x03,0x00,0x08,0xf0,0x03,0x80,0x00,0x15,0x00,0xf3, 0x02,0x00,0x06,0x07,0xfa,0xf9,0x07,0x78,0x03,0x80, 0x03,0x80,0x04,0x0c,0x02,0x03,0x04,0x00,0x00,0x71, 0x02,0x80,0x03,0x80,0x00,0x0f,0x06,0x77,0x06,0x09, 0x00,0x71,0x02,0x80,0x03,0x80,0x00,0x0f,0x0a,0xf1, 0x00,0x0f,0xf6,0xf8,0x0a,0x00,0x02,0xf9,0x05,0x80, 0xff,0x01,0xff,0x04,0x00,0x05,0x01,0x03,0x01,0x02, 0x06,0x00,0x02,0x7e,0x00,0x7d,0x00,0x7b,0x00,0x7c, 0xfe,0x7f,0xfa,0x00,0x0b,0x80,0x03,0x80,0x00,0x0f, 0x00,0xfb,0x01,0x03,0x01,0x02,0x05,0x00,0x02,0x7e, 0x01,0x7d,0x00,0x76,0x03,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80, 0x10,0x80,0x0a,0x8f,0x02,0x7f,0x01,0x7e,0x00,0x76, 0xff,0x7f,0xfe,0x7f,0xfb,0x00,0xff,0x01,0xff,0x01, 0x00,0x0a,0x01,0x02,0x01,0x01,0x05,0x00,0xf9,0x80, 0x00,0x6b,0x0c,0x86,0x0d,0x8a,0xff,0x03,0xfe,0x02, 0xfb,0x00,0xff,0x7e,0xff,0x7d,0x00,0x7b,0x01,0x7c, 0x01,0x7f,0x05,0x00,0x02,0x01,0x01,0x03,0x03,0xfc, 0x03,0x80,0x00,0x0f,0x00,0xfb,0x01,0x03,0x01,0x02, 0x04,0x00,0x01,0x7e,0x01,0x7d,0x00,0x76,0x00,0x8a, 0x01,0x03,0x02,0x02,0x03,0x00,0x02,0x7e,0x01,0x7d, 0x00,0x76,0x03,0x80,0x03,0x8f,0x00,0x74,0x01,0x7e, 0x02,0x7f,0x04,0x00,0x02,0x01,0x01,0x01,0x00,0x8d, 0x00,0x6e,0xff,0x7e,0xfe,0x7f,0xfb,0x00,0xfe,0x01, 0x0c,0x85,0x03,0x8d,0x01,0x02,0x03,0x00,0x02,0x7e, 0x01,0x02,0x03,0x00,0x02,0x7e,0x00,0x74,0xfe,0x7f, 0xfd,0x00,0xff,0x01,0xfe,0x7f,0xfd,0x00,0xff,0x01, 0x00,0x0c,0x06,0x82,0x00,0x6b,0x08,0x86,0x03,0x80, 0x0a,0x0f,0xf6,0x80,0x0a,0x71,0x03,0x80,0x03,0x8f, 0x00,0x73,0x01,0x7e,0x07,0x00,0x02,0x02,0x00,0x0d, 0x00,0xf3,0x01,0x7e,0x00,0x7e,0x03,0x82,0x03,0x8f, 0x00,0x79,0x02,0x7e,0x08,0x00,0x00,0x89,0x00,0x71, 0x02,0x80,0x03,0x8f,0x00,0x73,0x01,0x7e,0x03,0x00, 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x00, 0x02,0x02,0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x80, 0x03,0x8f,0x00,0x73,0x01,0x7e,0x03,0x00,0x02,0x02, 0x00,0x0d,0x00,0xf3,0x01,0x7e,0x03,0x00,0x02,0x02, 0x00,0x0d,0x00,0xf3,0x01,0x7e,0x00,0x7e,0x03,0x82, 0x03,0x8d,0x00,0x02,0x02,0x00,0x00,0x71,0x08,0x00, 0x02,0x02,0x00,0x06,0xfe,0x02,0xf8,0x00,0x0c,0xf6, 0x03,0x8f,0x00,0x71,0x07,0x00,0x02,0x02,0x00,0x06, 0xfe,0x02,0xf9,0x00,0x0c,0x85,0x00,0x71,0x02,0x80, 0x03,0x8f,0x00,0x71,0x07,0x00,0x03,0x02,0x00,0x06, 0xfd,0x02,0xf9,0x00,0x0c,0xf6,0x03,0x8d,0x02,0x02, 0x06,0x00,0x02,0x7e,0x00,0x75,0xfe,0x7e,0xfa,0x00, 0xfe,0x02,0x04,0x85,0x06,0x00,0x02,0xf9,0x03,0x80, 0x00,0x0f,0x00,0xf8,0x04,0x00,0x00,0x06,0x02,0x02, 0x04,0x00,0x02,0x7e,0x00,0x75,0xfe,0x7e,0xfc,0x00, 0xfe,0x02,0x00,0x05,0x0a,0xf9,0x0d,0x80,0x00,0x0f, 0xf7,0x00,0xff,0x7e,0x00,0x7b,0x01,0x7e,0x09,0x00, 0xf6,0xfa,0x04,0x06,0x08,0xfa }; //------------------------------------------------------------------------- gsv_text::gsv_text() : m_x(0.0), m_y(0.0), m_start_x(0.0), m_width(10.0), m_height(0.0), m_space(0.0), m_line_space(0.0), m_text(m_chr), m_text_buf(), m_cur_chr(m_chr), m_font(gsv_default_font), m_loaded_font(), m_status(initial), m_big_endian(false), m_flip(false) { m_chr[0] = m_chr[1] = 0; int t = 1; if(*(char*)&t == 0) m_big_endian = true; } //------------------------------------------------------------------------- void gsv_text::font(const void* font) { m_font = font; if(m_font == 0) m_font = &m_loaded_font[0]; } //------------------------------------------------------------------------- void gsv_text::size(double height, double width) { m_height = height; m_width = width; } //------------------------------------------------------------------------- void gsv_text::space(double space) { m_space = space; } //------------------------------------------------------------------------- void gsv_text::line_space(double line_space) { m_line_space = line_space; } //------------------------------------------------------------------------- void gsv_text::start_point(double x, double y) { m_x = m_start_x = x; m_y = y; //if(m_flip) m_y += m_height; } //------------------------------------------------------------------------- void gsv_text::load_font(const char* file) { m_loaded_font.resize(0); FILE* fd = fopen(file, "rb"); if(fd) { unsigned len; fseek(fd, 0l, SEEK_END); len = ftell(fd); fseek(fd, 0l, SEEK_SET); if(len > 0) { m_loaded_font.resize(len); fread(&m_loaded_font[0], 1, len, fd); m_font = &m_loaded_font[0]; } fclose(fd); } } //------------------------------------------------------------------------- void gsv_text::text(const char* text) { if(text == 0) { m_chr[0] = 0; m_text = m_chr; return; } unsigned new_size = strlen(text) + 1; if(new_size > m_text_buf.size()) { m_text_buf.resize(new_size); } memcpy(&m_text_buf[0], text, new_size); m_text = &m_text_buf[0]; } //------------------------------------------------------------------------- void gsv_text::rewind(unsigned) { m_status = initial; if(m_font == 0) return; m_indices = (int8u*)m_font; double base_height = value(m_indices + 4); m_indices += value(m_indices); m_glyphs = (int8*)(m_indices + 257*2); m_h = m_height / base_height; m_w = (m_width == 0.0) ? m_h : m_width / base_height; if(m_flip) m_h = -m_h; m_cur_chr = m_text; } //------------------------------------------------------------------------- unsigned gsv_text::vertex(double* x, double* y) { unsigned idx; int8 yc, yf; int dx, dy; bool quit = false; while(!quit) { switch(m_status) { case initial: if(m_font == 0) { quit = true; break; } m_status = next_char; case next_char: if(*m_cur_chr == 0) { quit = true; break; } idx = (*m_cur_chr++) & 0xFF; if(idx == '\n') { m_x = m_start_x; m_y -= m_flip ? -m_height - m_line_space : m_height + m_line_space; break; } idx <<= 1; m_bglyph = m_glyphs + value(m_indices + idx); m_eglyph = m_glyphs + value(m_indices + idx + 2); m_status = start_glyph; case start_glyph: *x = m_x; *y = m_y; m_status = glyph; return path_cmd_move_to; case glyph: if(m_bglyph >= m_eglyph) { m_status = next_char; m_x += m_space; break; } dx = int(*m_bglyph++); yf = (yc = *m_bglyph++) & 0x80; yc <<= 1; yc >>= 1; dy = int(yc); m_x += double(dx) * m_w; m_y += double(dy) * m_h; *x = m_x; *y = m_y; return yf ? path_cmd_move_to : path_cmd_line_to; } } return path_cmd_stop; } //------------------------------------------------------------------------- double gsv_text::text_width() { double x1, y1, x2, y2; bounding_rect_single(*this, 0, &x1, &y1, &x2, &y2); return x2 - x1; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_trans_double_path.cpp0000644000175000017500000002032613233644505025164 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include "agg_math.h" #include "agg_trans_double_path.h" namespace agg24 { //------------------------------------------------------------------------ trans_double_path::trans_double_path() : m_kindex1(0.0), m_kindex2(0.0), m_base_length(0.0), m_base_height(1.0), m_status1(initial), m_status2(initial), m_preserve_x_scale(true) { } //------------------------------------------------------------------------ void trans_double_path::reset() { m_src_vertices1.remove_all(); m_src_vertices2.remove_all(); m_kindex1 = 0.0; m_kindex1 = 0.0; m_status1 = initial; m_status2 = initial; } //------------------------------------------------------------------------ void trans_double_path::move_to1(double x, double y) { if(m_status1 == initial) { m_src_vertices1.modify_last(vertex_dist(x, y)); m_status1 = making_path; } else { line_to1(x, y); } } //------------------------------------------------------------------------ void trans_double_path::line_to1(double x, double y) { if(m_status1 == making_path) { m_src_vertices1.add(vertex_dist(x, y)); } } //------------------------------------------------------------------------ void trans_double_path::move_to2(double x, double y) { if(m_status2 == initial) { m_src_vertices2.modify_last(vertex_dist(x, y)); m_status2 = making_path; } else { line_to2(x, y); } } //------------------------------------------------------------------------ void trans_double_path::line_to2(double x, double y) { if(m_status2 == making_path) { m_src_vertices2.add(vertex_dist(x, y)); } } //------------------------------------------------------------------------ double trans_double_path::finalize_path(vertex_storage& vertices) { unsigned i; double dist; double d; vertices.close(false); if(vertices.size() > 2) { if(vertices[vertices.size() - 2].dist * 10.0 < vertices[vertices.size() - 3].dist) { d = vertices[vertices.size() - 3].dist + vertices[vertices.size() - 2].dist; vertices[vertices.size() - 2] = vertices[vertices.size() - 1]; vertices.remove_last(); vertices[vertices.size() - 2].dist = d; } } dist = 0; for(i = 0; i < vertices.size(); i++) { vertex_dist& v = vertices[i]; d = v.dist; v.dist = dist; dist += d; } return (vertices.size() - 1) / dist; } //------------------------------------------------------------------------ void trans_double_path::finalize_paths() { if(m_status1 == making_path && m_src_vertices1.size() > 1 && m_status2 == making_path && m_src_vertices2.size() > 1) { m_kindex1 = finalize_path(m_src_vertices1); m_kindex2 = finalize_path(m_src_vertices2); m_status1 = ready; m_status2 = ready; } } //------------------------------------------------------------------------ double trans_double_path::total_length1() const { if(m_base_length >= 1e-10) return m_base_length; return (m_status1 == ready) ? m_src_vertices1[m_src_vertices1.size() - 1].dist : 0.0; } //------------------------------------------------------------------------ double trans_double_path::total_length2() const { if(m_base_length >= 1e-10) return m_base_length; return (m_status2 == ready) ? m_src_vertices2[m_src_vertices2.size() - 1].dist : 0.0; } //------------------------------------------------------------------------ void trans_double_path::transform1(const vertex_storage& vertices, double kindex, double kx, double *x, double* y) const { double x1 = 0.0; double y1 = 0.0; double dx = 1.0; double dy = 1.0; double d = 0.0; double dd = 1.0; *x *= kx; if(*x < 0.0) { // Extrapolation on the left //-------------------------- x1 = vertices[0].x; y1 = vertices[0].y; dx = vertices[1].x - x1; dy = vertices[1].y - y1; dd = vertices[1].dist - vertices[0].dist; d = *x; } else if(*x > vertices[vertices.size() - 1].dist) { // Extrapolation on the right //-------------------------- unsigned i = vertices.size() - 2; unsigned j = vertices.size() - 1; x1 = vertices[j].x; y1 = vertices[j].y; dx = x1 - vertices[i].x; dy = y1 - vertices[i].y; dd = vertices[j].dist - vertices[i].dist; d = *x - vertices[j].dist; } else { // Interpolation //-------------------------- unsigned i = 0; unsigned j = vertices.size() - 1; if(m_preserve_x_scale) { unsigned k; for(i = 0; (j - i) > 1; ) { if(*x < vertices[k = (i + j) >> 1].dist) { j = k; } else { i = k; } } d = vertices[i].dist; dd = vertices[j].dist - d; d = *x - d; } else { i = unsigned(*x * kindex); j = i + 1; dd = vertices[j].dist - vertices[i].dist; d = ((*x * kindex) - i) * dd; } x1 = vertices[i].x; y1 = vertices[i].y; dx = vertices[j].x - x1; dy = vertices[j].y - y1; } *x = x1 + dx * d / dd; *y = y1 + dy * d / dd; } //------------------------------------------------------------------------ void trans_double_path::transform(double *x, double *y) const { if(m_status1 == ready && m_status2 == ready) { if(m_base_length > 1e-10) { *x *= m_src_vertices1[m_src_vertices1.size() - 1].dist / m_base_length; } double x1 = *x; double y1 = *y; double x2 = *x; double y2 = *y; double dd = m_src_vertices2[m_src_vertices2.size() - 1].dist / m_src_vertices1[m_src_vertices1.size() - 1].dist; transform1(m_src_vertices1, m_kindex1, 1.0, &x1, &y1); transform1(m_src_vertices2, m_kindex2, dd, &x2, &y2); *x = x1 + *y * (x2 - x1) / m_base_height; *y = y1 + *y * (y2 - y1) / m_base_height; } } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_vcgen_stroke.cpp0000644000175000017500000001601013233644505024153 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Stroke generator // //---------------------------------------------------------------------------- #include #include "agg_vcgen_stroke.h" #include "agg_shorten_path.h" namespace agg24 { //------------------------------------------------------------------------ vcgen_stroke::vcgen_stroke() : m_stroker(), m_src_vertices(), m_out_vertices(), m_shorten(0.0), m_closed(0), m_status(initial), m_src_vertex(0), m_out_vertex(0) { } //------------------------------------------------------------------------ void vcgen_stroke::remove_all() { m_src_vertices.remove_all(); m_closed = 0; m_status = initial; } //------------------------------------------------------------------------ void vcgen_stroke::add_vertex(double x, double y, unsigned cmd) { m_status = initial; if(is_move_to(cmd)) { m_src_vertices.modify_last(vertex_dist(x, y)); } else { if(is_vertex(cmd)) { m_src_vertices.add(vertex_dist(x, y)); } else { m_closed = get_close_flag(cmd); } } } //------------------------------------------------------------------------ void vcgen_stroke::rewind(unsigned) { if(m_status == initial) { m_src_vertices.close(m_closed != 0); shorten_path(m_src_vertices, m_shorten, m_closed); if(m_src_vertices.size() < 3) m_closed = 0; } m_status = ready; m_src_vertex = 0; m_out_vertex = 0; } //------------------------------------------------------------------------ unsigned vcgen_stroke::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; while(!is_stop(cmd)) { switch(m_status) { case initial: rewind(0); case ready: if(m_src_vertices.size() < 2 + unsigned(m_closed != 0)) { cmd = path_cmd_stop; break; } m_status = m_closed ? outline1 : cap1; cmd = path_cmd_move_to; m_src_vertex = 0; m_out_vertex = 0; break; case cap1: m_stroker.calc_cap(m_out_vertices, m_src_vertices[0], m_src_vertices[1], m_src_vertices[0].dist); m_src_vertex = 1; m_prev_status = outline1; m_status = out_vertices; m_out_vertex = 0; break; case cap2: m_stroker.calc_cap(m_out_vertices, m_src_vertices[m_src_vertices.size() - 1], m_src_vertices[m_src_vertices.size() - 2], m_src_vertices[m_src_vertices.size() - 2].dist); m_prev_status = outline2; m_status = out_vertices; m_out_vertex = 0; break; case outline1: if(m_closed) { if(m_src_vertex >= m_src_vertices.size()) { m_prev_status = close_first; m_status = end_poly1; break; } } else { if(m_src_vertex >= m_src_vertices.size() - 1) { m_status = cap2; break; } } m_stroker.calc_join(m_out_vertices, m_src_vertices.prev(m_src_vertex), m_src_vertices.curr(m_src_vertex), m_src_vertices.next(m_src_vertex), m_src_vertices.prev(m_src_vertex).dist, m_src_vertices.curr(m_src_vertex).dist); ++m_src_vertex; m_prev_status = m_status; m_status = out_vertices; m_out_vertex = 0; break; case close_first: m_status = outline2; cmd = path_cmd_move_to; case outline2: if(m_src_vertex <= unsigned(m_closed == 0)) { m_status = end_poly2; m_prev_status = stop; break; } --m_src_vertex; m_stroker.calc_join(m_out_vertices, m_src_vertices.next(m_src_vertex), m_src_vertices.curr(m_src_vertex), m_src_vertices.prev(m_src_vertex), m_src_vertices.curr(m_src_vertex).dist, m_src_vertices.prev(m_src_vertex).dist); m_prev_status = m_status; m_status = out_vertices; m_out_vertex = 0; break; case out_vertices: if(m_out_vertex >= m_out_vertices.size()) { m_status = m_prev_status; } else { const point_d& c = m_out_vertices[m_out_vertex++]; *x = c.x; *y = c.y; return cmd; } break; case end_poly1: m_status = m_prev_status; return path_cmd_end_poly | path_flags_close | path_flags_ccw; case end_poly2: m_status = m_prev_status; return path_cmd_end_poly | path_flags_close | path_flags_cw; case stop: cmd = path_cmd_stop; break; } } return cmd; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_vcgen_smooth_poly1.cpp0000644000175000017500000001610313233644505025304 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Smooth polygon generator // //---------------------------------------------------------------------------- #include "agg_vcgen_smooth_poly1.h" namespace agg24 { //------------------------------------------------------------------------ vcgen_smooth_poly1::vcgen_smooth_poly1() : m_src_vertices(), m_smooth_value(0.5), m_closed(0), m_status(initial), m_src_vertex(0) { } //------------------------------------------------------------------------ void vcgen_smooth_poly1::remove_all() { m_src_vertices.remove_all(); m_closed = 0; m_status = initial; } //------------------------------------------------------------------------ void vcgen_smooth_poly1::add_vertex(double x, double y, unsigned cmd) { m_status = initial; if(is_move_to(cmd)) { m_src_vertices.modify_last(vertex_dist(x, y)); } else { if(is_vertex(cmd)) { m_src_vertices.add(vertex_dist(x, y)); } else { m_closed = get_close_flag(cmd); } } } //------------------------------------------------------------------------ void vcgen_smooth_poly1::rewind(unsigned) { if(m_status == initial) { m_src_vertices.close(m_closed != 0); } m_status = ready; m_src_vertex = 0; } //------------------------------------------------------------------------ void vcgen_smooth_poly1::calculate(const vertex_dist& v0, const vertex_dist& v1, const vertex_dist& v2, const vertex_dist& v3) { double k1 = v0.dist / (v0.dist + v1.dist); double k2 = v1.dist / (v1.dist + v2.dist); double xm1 = v0.x + (v2.x - v0.x) * k1; double ym1 = v0.y + (v2.y - v0.y) * k1; double xm2 = v1.x + (v3.x - v1.x) * k2; double ym2 = v1.y + (v3.y - v1.y) * k2; m_ctrl1_x = v1.x + m_smooth_value * (v2.x - xm1); m_ctrl1_y = v1.y + m_smooth_value * (v2.y - ym1); m_ctrl2_x = v2.x + m_smooth_value * (v1.x - xm2); m_ctrl2_y = v2.y + m_smooth_value * (v1.y - ym2); } //------------------------------------------------------------------------ unsigned vcgen_smooth_poly1::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; while(!is_stop(cmd)) { switch(m_status) { case initial: rewind(0); case ready: if(m_src_vertices.size() < 2) { cmd = path_cmd_stop; break; } if(m_src_vertices.size() == 2) { *x = m_src_vertices[m_src_vertex].x; *y = m_src_vertices[m_src_vertex].y; m_src_vertex++; if(m_src_vertex == 1) return path_cmd_move_to; if(m_src_vertex == 2) return path_cmd_line_to; cmd = path_cmd_stop; break; } cmd = path_cmd_move_to; m_status = polygon; m_src_vertex = 0; case polygon: if(m_closed) { if(m_src_vertex >= m_src_vertices.size()) { *x = m_src_vertices[0].x; *y = m_src_vertices[0].y; m_status = end_poly; return path_cmd_curve4; } } else { if(m_src_vertex >= m_src_vertices.size() - 1) { *x = m_src_vertices[m_src_vertices.size() - 1].x; *y = m_src_vertices[m_src_vertices.size() - 1].y; m_status = end_poly; return path_cmd_curve3; } } calculate(m_src_vertices.prev(m_src_vertex), m_src_vertices.curr(m_src_vertex), m_src_vertices.next(m_src_vertex), m_src_vertices.next(m_src_vertex + 1)); *x = m_src_vertices[m_src_vertex].x; *y = m_src_vertices[m_src_vertex].y; m_src_vertex++; if(m_closed) { m_status = ctrl1; return ((m_src_vertex == 1) ? path_cmd_move_to : path_cmd_curve4); } else { if(m_src_vertex == 1) { m_status = ctrl_b; return path_cmd_move_to; } if(m_src_vertex >= m_src_vertices.size() - 1) { m_status = ctrl_e; return path_cmd_curve3; } m_status = ctrl1; return path_cmd_curve4; } break; case ctrl_b: *x = m_ctrl2_x; *y = m_ctrl2_y; m_status = polygon; return path_cmd_curve3; case ctrl_e: *x = m_ctrl1_x; *y = m_ctrl1_y; m_status = polygon; return path_cmd_curve3; case ctrl1: *x = m_ctrl1_x; *y = m_ctrl1_y; m_status = ctrl2; return path_cmd_curve4; case ctrl2: *x = m_ctrl2_x; *y = m_ctrl2_y; m_status = polygon; return path_cmd_curve4; case end_poly: m_status = stop; return path_cmd_end_poly | m_closed; case stop: return path_cmd_stop; } } return cmd; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_vcgen_contour.cpp0000644000175000017500000001224713233644505024345 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Contour generator // //---------------------------------------------------------------------------- #include #include "agg_vcgen_contour.h" namespace agg24 { //------------------------------------------------------------------------ vcgen_contour::vcgen_contour() : m_stroker(), m_width(1), m_src_vertices(), m_out_vertices(), m_status(initial), m_src_vertex(0), m_closed(0), m_orientation(0), m_auto_detect(false) { } //------------------------------------------------------------------------ void vcgen_contour::remove_all() { m_src_vertices.remove_all(); m_closed = 0; m_orientation = 0; m_status = initial; } //------------------------------------------------------------------------ void vcgen_contour::add_vertex(double x, double y, unsigned cmd) { m_status = initial; if(is_move_to(cmd)) { m_src_vertices.modify_last(vertex_dist(x, y)); } else { if(is_vertex(cmd)) { m_src_vertices.add(vertex_dist(x, y)); } else { if(is_end_poly(cmd)) { m_closed = get_close_flag(cmd); if(m_orientation == path_flags_none) { m_orientation = get_orientation(cmd); } } } } } //------------------------------------------------------------------------ void vcgen_contour::rewind(unsigned) { if(m_status == initial) { m_src_vertices.close(true); if(m_auto_detect) { if(!is_oriented(m_orientation)) { m_orientation = (calc_polygon_area(m_src_vertices) > 0.0) ? path_flags_ccw : path_flags_cw; } } if(is_oriented(m_orientation)) { m_stroker.width(is_ccw(m_orientation) ? m_width : -m_width); } } m_status = ready; m_src_vertex = 0; } //------------------------------------------------------------------------ unsigned vcgen_contour::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; while(!is_stop(cmd)) { switch(m_status) { case initial: rewind(0); case ready: if(m_src_vertices.size() < 2 + unsigned(m_closed != 0)) { cmd = path_cmd_stop; break; } m_status = outline; cmd = path_cmd_move_to; m_src_vertex = 0; m_out_vertex = 0; case outline: if(m_src_vertex >= m_src_vertices.size()) { m_status = end_poly; break; } m_stroker.calc_join(m_out_vertices, m_src_vertices.prev(m_src_vertex), m_src_vertices.curr(m_src_vertex), m_src_vertices.next(m_src_vertex), m_src_vertices.prev(m_src_vertex).dist, m_src_vertices.curr(m_src_vertex).dist); ++m_src_vertex; m_status = out_vertices; m_out_vertex = 0; case out_vertices: if(m_out_vertex >= m_out_vertices.size()) { m_status = outline; } else { const point_d& c = m_out_vertices[m_out_vertex++]; *x = c.x; *y = c.y; return cmd; } break; case end_poly: if(!m_closed) return path_cmd_stop; m_status = stop; return path_cmd_end_poly | path_flags_close | path_flags_ccw; case stop: return path_cmd_stop; } } return cmd; } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_curves.cpp0000644000175000017500000004740013233644505023000 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include #include "agg_curves.h" #include "agg_math.h" namespace agg24 { //------------------------------------------------------------------------ const double curve_distance_epsilon = 1e-30; const double curve_collinearity_epsilon = 1e-30; const double curve_angle_tolerance_epsilon = 0.01; enum curve_recursion_limit_e { curve_recursion_limit = 32 }; //------------------------------------------------------------------------ void curve3_inc::approximation_scale(double s) { m_scale = s; } //------------------------------------------------------------------------ double curve3_inc::approximation_scale() const { return m_scale; } //------------------------------------------------------------------------ void curve3_inc::init(double x1, double y1, double x2, double y2, double x3, double y3) { m_start_x = x1; m_start_y = y1; m_end_x = x3; m_end_y = y3; double dx1 = x2 - x1; double dy1 = y2 - y1; double dx2 = x3 - x2; double dy2 = y3 - y2; double len = sqrt(dx1 * dx1 + dy1 * dy1) + sqrt(dx2 * dx2 + dy2 * dy2); m_num_steps = uround(len * 0.25 * m_scale); if(m_num_steps < 4) { m_num_steps = 4; } double subdivide_step = 1.0 / m_num_steps; double subdivide_step2 = subdivide_step * subdivide_step; double tmpx = (x1 - x2 * 2.0 + x3) * subdivide_step2; double tmpy = (y1 - y2 * 2.0 + y3) * subdivide_step2; m_saved_fx = m_fx = x1; m_saved_fy = m_fy = y1; m_saved_dfx = m_dfx = tmpx + (x2 - x1) * (2.0 * subdivide_step); m_saved_dfy = m_dfy = tmpy + (y2 - y1) * (2.0 * subdivide_step); m_ddfx = tmpx * 2.0; m_ddfy = tmpy * 2.0; m_step = m_num_steps; } //------------------------------------------------------------------------ void curve3_inc::rewind(unsigned) { if(m_num_steps == 0) { m_step = -1; return; } m_step = m_num_steps; m_fx = m_saved_fx; m_fy = m_saved_fy; m_dfx = m_saved_dfx; m_dfy = m_saved_dfy; } //------------------------------------------------------------------------ unsigned curve3_inc::vertex(double* x, double* y) { if(m_step < 0) return path_cmd_stop; if(m_step == m_num_steps) { *x = m_start_x; *y = m_start_y; --m_step; return path_cmd_move_to; } if(m_step == 0) { *x = m_end_x; *y = m_end_y; --m_step; return path_cmd_line_to; } m_fx += m_dfx; m_fy += m_dfy; m_dfx += m_ddfx; m_dfy += m_ddfy; *x = m_fx; *y = m_fy; --m_step; return path_cmd_line_to; } //------------------------------------------------------------------------ void curve3_div::init(double x1, double y1, double x2, double y2, double x3, double y3) { m_points.remove_all(); m_distance_tolerance_square = 0.5 / m_approximation_scale; m_distance_tolerance_square *= m_distance_tolerance_square; bezier(x1, y1, x2, y2, x3, y3); m_count = 0; } //------------------------------------------------------------------------ void curve3_div::recursive_bezier(double x1, double y1, double x2, double y2, double x3, double y3, unsigned level) { if(level > curve_recursion_limit) { return; } // Calculate all the mid-points of the line segments //---------------------- double x12 = (x1 + x2) / 2; double y12 = (y1 + y2) / 2; double x23 = (x2 + x3) / 2; double y23 = (y2 + y3) / 2; double x123 = (x12 + x23) / 2; double y123 = (y12 + y23) / 2; double dx = x3-x1; double dy = y3-y1; double d = fabs(((x2 - x3) * dy - (y2 - y3) * dx)); double da; if(d > curve_collinearity_epsilon) { // Regular case //----------------- if(d * d <= m_distance_tolerance_square * (dx*dx + dy*dy)) { // If the curvature doesn't exceed the distance_tolerance value // we tend to finish subdivisions. //---------------------- if(m_angle_tolerance < curve_angle_tolerance_epsilon) { m_points.add(point_d(x123, y123)); return; } // Angle & Cusp Condition //---------------------- da = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1)); if(da >= pi) da = 2*pi - da; if(da < m_angle_tolerance) { // Finally we can stop the recursion //---------------------- m_points.add(point_d(x123, y123)); return; } } } else { // Collinear case //------------------ da = dx*dx + dy*dy; if(da == 0) { d = calc_sq_distance(x1, y1, x2, y2); } else { d = ((x2 - x1)*dx + (y2 - y1)*dy) / da; if(d > 0 && d < 1) { // Simple collinear case, 1---2---3 // We can leave just two endpoints return; } if(d <= 0) d = calc_sq_distance(x2, y2, x1, y1); else if(d >= 1) d = calc_sq_distance(x2, y2, x3, y3); else d = calc_sq_distance(x2, y2, x1 + d*dx, y1 + d*dy); } if(d < m_distance_tolerance_square) { m_points.add(point_d(x2, y2)); return; } } // Continue subdivision //---------------------- recursive_bezier(x1, y1, x12, y12, x123, y123, level + 1); recursive_bezier(x123, y123, x23, y23, x3, y3, level + 1); } //------------------------------------------------------------------------ void curve3_div::bezier(double x1, double y1, double x2, double y2, double x3, double y3) { m_points.add(point_d(x1, y1)); recursive_bezier(x1, y1, x2, y2, x3, y3, 0); m_points.add(point_d(x3, y3)); } //------------------------------------------------------------------------ void curve4_inc::approximation_scale(double s) { m_scale = s; } //------------------------------------------------------------------------ double curve4_inc::approximation_scale() const { return m_scale; } #if defined(_MSC_VER) && _MSC_VER <= 1200 //------------------------------------------------------------------------ static double MSC60_fix_ICE(double v) { return v; } #endif //------------------------------------------------------------------------ void curve4_inc::init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { m_start_x = x1; m_start_y = y1; m_end_x = x4; m_end_y = y4; double dx1 = x2 - x1; double dy1 = y2 - y1; double dx2 = x3 - x2; double dy2 = y3 - y2; double dx3 = x4 - x3; double dy3 = y4 - y3; double len = (sqrt(dx1 * dx1 + dy1 * dy1) + sqrt(dx2 * dx2 + dy2 * dy2) + sqrt(dx3 * dx3 + dy3 * dy3)) * 0.25 * m_scale; #if defined(_MSC_VER) && _MSC_VER <= 1200 m_num_steps = uround(MSC60_fix_ICE(len)); #else m_num_steps = uround(len); #endif if(m_num_steps < 4) { m_num_steps = 4; } double subdivide_step = 1.0 / m_num_steps; double subdivide_step2 = subdivide_step * subdivide_step; double subdivide_step3 = subdivide_step * subdivide_step * subdivide_step; double pre1 = 3.0 * subdivide_step; double pre2 = 3.0 * subdivide_step2; double pre4 = 6.0 * subdivide_step2; double pre5 = 6.0 * subdivide_step3; double tmp1x = x1 - x2 * 2.0 + x3; double tmp1y = y1 - y2 * 2.0 + y3; double tmp2x = (x2 - x3) * 3.0 - x1 + x4; double tmp2y = (y2 - y3) * 3.0 - y1 + y4; m_saved_fx = m_fx = x1; m_saved_fy = m_fy = y1; m_saved_dfx = m_dfx = (x2 - x1) * pre1 + tmp1x * pre2 + tmp2x * subdivide_step3; m_saved_dfy = m_dfy = (y2 - y1) * pre1 + tmp1y * pre2 + tmp2y * subdivide_step3; m_saved_ddfx = m_ddfx = tmp1x * pre4 + tmp2x * pre5; m_saved_ddfy = m_ddfy = tmp1y * pre4 + tmp2y * pre5; m_dddfx = tmp2x * pre5; m_dddfy = tmp2y * pre5; m_step = m_num_steps; } //------------------------------------------------------------------------ void curve4_inc::rewind(unsigned) { if(m_num_steps == 0) { m_step = -1; return; } m_step = m_num_steps; m_fx = m_saved_fx; m_fy = m_saved_fy; m_dfx = m_saved_dfx; m_dfy = m_saved_dfy; m_ddfx = m_saved_ddfx; m_ddfy = m_saved_ddfy; } //------------------------------------------------------------------------ unsigned curve4_inc::vertex(double* x, double* y) { if(m_step < 0) return path_cmd_stop; if(m_step == m_num_steps) { *x = m_start_x; *y = m_start_y; --m_step; return path_cmd_move_to; } if(m_step == 0) { *x = m_end_x; *y = m_end_y; --m_step; return path_cmd_line_to; } m_fx += m_dfx; m_fy += m_dfy; m_dfx += m_ddfx; m_dfy += m_ddfy; m_ddfx += m_dddfx; m_ddfy += m_dddfy; *x = m_fx; *y = m_fy; --m_step; return path_cmd_line_to; } //------------------------------------------------------------------------ void curve4_div::init(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { m_points.remove_all(); m_distance_tolerance_square = 0.5 / m_approximation_scale; m_distance_tolerance_square *= m_distance_tolerance_square; bezier(x1, y1, x2, y2, x3, y3, x4, y4); m_count = 0; } //------------------------------------------------------------------------ void curve4_div::recursive_bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, unsigned level) { if(level > curve_recursion_limit) { return; } // Calculate all the mid-points of the line segments //---------------------- double x12 = (x1 + x2) / 2; double y12 = (y1 + y2) / 2; double x23 = (x2 + x3) / 2; double y23 = (y2 + y3) / 2; double x34 = (x3 + x4) / 2; double y34 = (y3 + y4) / 2; double x123 = (x12 + x23) / 2; double y123 = (y12 + y23) / 2; double x234 = (x23 + x34) / 2; double y234 = (y23 + y34) / 2; double x1234 = (x123 + x234) / 2; double y1234 = (y123 + y234) / 2; // Try to approximate the full cubic curve by a single straight line //------------------ double dx = x4-x1; double dy = y4-y1; double d2 = fabs(((x2 - x4) * dy - (y2 - y4) * dx)); double d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx)); double da1, da2, k; switch((int(d2 > curve_collinearity_epsilon) << 1) + int(d3 > curve_collinearity_epsilon)) { case 0: // All collinear OR p1==p4 //---------------------- k = dx*dx + dy*dy; if(k == 0) { d2 = calc_sq_distance(x1, y1, x2, y2); d3 = calc_sq_distance(x4, y4, x3, y3); } else { k = 1 / k; da1 = x2 - x1; da2 = y2 - y1; d2 = k * (da1*dx + da2*dy); da1 = x3 - x1; da2 = y3 - y1; d3 = k * (da1*dx + da2*dy); if(d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1) { // Simple collinear case, 1---2---3---4 // We can leave just two endpoints return; } if(d2 <= 0) d2 = calc_sq_distance(x2, y2, x1, y1); else if(d2 >= 1) d2 = calc_sq_distance(x2, y2, x4, y4); else d2 = calc_sq_distance(x2, y2, x1 + d2*dx, y1 + d2*dy); if(d3 <= 0) d3 = calc_sq_distance(x3, y3, x1, y1); else if(d3 >= 1) d3 = calc_sq_distance(x3, y3, x4, y4); else d3 = calc_sq_distance(x3, y3, x1 + d3*dx, y1 + d3*dy); } if(d2 > d3) { if(d2 < m_distance_tolerance_square) { m_points.add(point_d(x2, y2)); return; } } else { if(d3 < m_distance_tolerance_square) { m_points.add(point_d(x3, y3)); return; } } break; case 1: // p1,p2,p4 are collinear, p3 is significant //---------------------- if(d3 * d3 <= m_distance_tolerance_square * (dx*dx + dy*dy)) { if(m_angle_tolerance < curve_angle_tolerance_epsilon) { m_points.add(point_d(x23, y23)); return; } // Angle Condition //---------------------- da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2)); if(da1 >= pi) da1 = 2*pi - da1; if(da1 < m_angle_tolerance) { m_points.add(point_d(x2, y2)); m_points.add(point_d(x3, y3)); return; } if(m_cusp_limit != 0.0) { if(da1 > m_cusp_limit) { m_points.add(point_d(x3, y3)); return; } } } break; case 2: // p1,p3,p4 are collinear, p2 is significant //---------------------- if(d2 * d2 <= m_distance_tolerance_square * (dx*dx + dy*dy)) { if(m_angle_tolerance < curve_angle_tolerance_epsilon) { m_points.add(point_d(x23, y23)); return; } // Angle Condition //---------------------- da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1)); if(da1 >= pi) da1 = 2*pi - da1; if(da1 < m_angle_tolerance) { m_points.add(point_d(x2, y2)); m_points.add(point_d(x3, y3)); return; } if(m_cusp_limit != 0.0) { if(da1 > m_cusp_limit) { m_points.add(point_d(x2, y2)); return; } } } break; case 3: // Regular case //----------------- if((d2 + d3)*(d2 + d3) <= m_distance_tolerance_square * (dx*dx + dy*dy)) { // If the curvature doesn't exceed the distance_tolerance value // we tend to finish subdivisions. //---------------------- if(m_angle_tolerance < curve_angle_tolerance_epsilon) { m_points.add(point_d(x23, y23)); return; } // Angle & Cusp Condition //---------------------- k = atan2(y3 - y2, x3 - x2); da1 = fabs(k - atan2(y2 - y1, x2 - x1)); da2 = fabs(atan2(y4 - y3, x4 - x3) - k); if(da1 >= pi) da1 = 2*pi - da1; if(da2 >= pi) da2 = 2*pi - da2; if(da1 + da2 < m_angle_tolerance) { // Finally we can stop the recursion //---------------------- m_points.add(point_d(x23, y23)); return; } if(m_cusp_limit != 0.0) { if(da1 > m_cusp_limit) { m_points.add(point_d(x2, y2)); return; } if(da2 > m_cusp_limit) { m_points.add(point_d(x3, y3)); return; } } } break; } // Continue subdivision //---------------------- recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1); recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1); } //------------------------------------------------------------------------ void curve4_div::bezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { m_points.add(point_d(x1, y1)); recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, 0); m_points.add(point_d(x4, y4)); } } enthought-chaco2-4.8.1.orig/kiva/agg/agg-24/src/agg_vcgen_bspline.cpp0000644000175000017500000001527413233644505024313 0ustar varunvarun//---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- #include "agg_vcgen_bspline.h" namespace agg24 { //------------------------------------------------------------------------ vcgen_bspline::vcgen_bspline() : m_src_vertices(), m_spline_x(), m_spline_y(), m_interpolation_step(1.0/50.0), m_closed(0), m_status(initial), m_src_vertex(0) { } //------------------------------------------------------------------------ void vcgen_bspline::remove_all() { m_src_vertices.remove_all(); m_closed = 0; m_status = initial; m_src_vertex = 0; } //------------------------------------------------------------------------ void vcgen_bspline::add_vertex(double x, double y, unsigned cmd) { m_status = initial; if(is_move_to(cmd)) { m_src_vertices.modify_last(point_d(x, y)); } else { if(is_vertex(cmd)) { m_src_vertices.add(point_d(x, y)); } else { m_closed = get_close_flag(cmd); } } } //------------------------------------------------------------------------ void vcgen_bspline::rewind(unsigned) { m_cur_abscissa = 0.0; m_max_abscissa = 0.0; m_src_vertex = 0; if(m_status == initial && m_src_vertices.size() > 2) { if(m_closed) { m_spline_x.init(m_src_vertices.size() + 8); m_spline_y.init(m_src_vertices.size() + 8); m_spline_x.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).x); m_spline_y.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).y); m_spline_x.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].x); m_spline_y.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].y); m_spline_x.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].x); m_spline_y.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].y); m_spline_x.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].x); m_spline_y.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].y); } else { m_spline_x.init(m_src_vertices.size()); m_spline_y.init(m_src_vertices.size()); } unsigned i; for(i = 0; i < m_src_vertices.size(); i++) { double x = m_closed ? i + 4 : i; m_spline_x.add_point(x, m_src_vertices[i].x); m_spline_y.add_point(x, m_src_vertices[i].y); } m_cur_abscissa = 0.0; m_max_abscissa = m_src_vertices.size() - 1; if(m_closed) { m_cur_abscissa = 4.0; m_max_abscissa += 5.0; m_spline_x.add_point(m_src_vertices.size() + 4, m_src_vertices[0].x); m_spline_y.add_point(m_src_vertices.size() + 4, m_src_vertices[0].y); m_spline_x.add_point(m_src_vertices.size() + 5, m_src_vertices[1].x); m_spline_y.add_point(m_src_vertices.size() + 5, m_src_vertices[1].y); m_spline_x.add_point(m_src_vertices.size() + 6, m_src_vertices[2].x); m_spline_y.add_point(m_src_vertices.size() + 6, m_src_vertices[2].y); m_spline_x.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).x); m_spline_y.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).y); } m_spline_x.prepare(); m_spline_y.prepare(); } m_status = ready; } //------------------------------------------------------------------------ unsigned vcgen_bspline::vertex(double* x, double* y) { unsigned cmd = path_cmd_line_to; while(!is_stop(cmd)) { switch(m_status) { case initial: rewind(0); case ready: if(m_src_vertices.size() < 2) { cmd = path_cmd_stop; break; } if(m_src_vertices.size() == 2) { *x = m_src_vertices[m_src_vertex].x; *y = m_src_vertices[m_src_vertex].y; m_src_vertex++; if(m_src_vertex == 1) return path_cmd_move_to; if(m_src_vertex == 2) return path_cmd_line_to; cmd = path_cmd_stop; break; } cmd = path_cmd_move_to; m_status = polygon; m_src_vertex = 0; case polygon: if(m_cur_abscissa >= m_max_abscissa) { if(m_closed) { m_status = end_poly; break; } else { *x = m_src_vertices[m_src_vertices.size() - 1].x; *y = m_src_vertices[m_src_vertices.size() - 1].y; m_status = end_poly; return path_cmd_line_to; } } *x = m_spline_x.get_stateful(m_cur_abscissa); *y = m_spline_y.get_stateful(m_cur_abscissa); m_src_vertex++; m_cur_abscissa += m_interpolation_step; return (m_src_vertex == 1) ? path_cmd_move_to : path_cmd_line_to; case end_poly: m_status = stop; return path_cmd_end_poly | m_closed; case stop: return path_cmd_stop; } } return cmd; } } enthought-chaco2-4.8.1.orig/kiva/agg/__init__.py0000644000175000017500000000451513421603267020507 0ustar varunvarunfrom .agg import * pix_format_string_map = {} pix_format_string_map["gray8"] = pix_format_gray8 pix_format_string_map["rgb555"] = pix_format_rgb555 pix_format_string_map["rgb565"] = pix_format_rgb565 pix_format_string_map["rgb24"] = pix_format_rgb24 pix_format_string_map["bgr24"] = pix_format_bgr24 pix_format_string_map["rgba32"] = pix_format_rgba32 pix_format_string_map["argb32"] = pix_format_argb32 pix_format_string_map["abgr32"] = pix_format_abgr32 pix_format_string_map["bgra32"] = pix_format_bgra32 default_pix_format = "bgra32" import types try: # Define a system-dependent GraphicsContext if there is a PixelMap # class defined for the system (i.e. if plat_support was built) from .plat_support import PixelMap class GraphicsContextSystem(GraphicsContextArray): def __init__(self, size, pix_format=default_pix_format, interpolation="nearest", bottom_up=True): assert isinstance(size, tuple), repr(size) width,height = size pixel_map = PixelMap( width, height, pix_format_string_map[pix_format], 255, bool(bottom_up) ).set_bmp_array() GraphicsContextArray.__init__(self, pixel_map.bmp_array, pix_format, interpolation, bottom_up) self.pixel_map = pixel_map except ImportError as ex: # warn to stderr containing the exception. The warning should # be an ImportWarning, but that is python 2.5+ specific import warnings warnings.warn("Error initializing Agg: %s" % ex, Warning, 2) GraphicsContextSystem = None def points_in_polygon(pts, poly_pts, use_winding=False): """Keep this function around for old code, but warn anyone who calls it. """ import inspect import warnings from kiva.api import points_in_polygon as new_points_in_polygon msg = 'points_in_polygon() has moved to kiva.api' frame = inspect.currentframe().f_back warnings.warn_explicit(msg, category=DeprecationWarning, filename=inspect.getfile(frame.f_code), lineno=frame.f_lineno) new_points_in_polygon(pts, poly_pts, use_winding=use_winding) enthought-chaco2-4.8.1.orig/kiva/agg/setup.py0000644000175000017500000002251113477706655020124 0ustar varunvarun#!/usr/bin/env python import sys import os import re import platform freetype2_sources =['autofit/autofit.c', 'base/ftbase.c','base/ftsystem.c','base/ftinit.c', 'base/ftglyph.c','base/ftmm.c','base/ftbdf.c', 'base/ftbbox.c','base/ftdebug.c','base/ftxf86.c', 'base/fttype1.c', 'bdf/bdf.c', 'cff/cff.c', 'cid/type1cid.c', 'lzw/ftlzw.c', 'pcf/pcf.c','pfr/pfr.c', 'psaux/psaux.c', 'pshinter/pshinter.c', 'psnames/psnames.c', 'raster/raster.c', 'sfnt/sfnt.c', 'smooth/smooth.c', 'truetype/truetype.c', 'type1/type1.c', 'type42/type42.c', 'winfonts/winfnt.c', 'gzip/ftgzip.c', 'base/ftmac.c', ] freetype2_dirs = [ 'autofit', 'base', 'bdf', 'cache', 'cff', 'cid', 'gxvalid', 'gzip', 'lzw', 'otvalid', 'pcf', 'pfr', 'psaux', 'pshinter', 'psnames', 'raster', 'sfnt', 'smooth', 'tools', 'truetype', 'type1', 'type42', 'winfonts', 'gzip' ] def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import dict_append, get_info agg_dir = 'agg-24' agg_lib = 'agg24_src' config = Configuration('agg', parent_package,top_path) numerix_info = get_info('numerix') if ('NUMPY', None) in numerix_info.get('define_macros',[]): dict_append(numerix_info, define_macros = [('PY_ARRAY_TYPES_PREFIX','NUMPY_CXX'), ('OWN_DIMENSIONS','0'), ('OWN_STRIDES','0')]) #------------------------------------------------------------------------- # Configure the Agg backend to use on each platform #------------------------------------------------------------------------- if sys.platform=='win32': plat = 'win32' elif sys.platform == 'darwin': plat = 'gl' else: #plat = 'gtk1' # use with gtk1, it's fast plat = 'x11' # use with gtk2, it's slow but reliable #plat = 'gdkpixbuf2' #------------------------------------------------------------------------- # Add the freetype library (agg 2.4 links against this) #------------------------------------------------------------------------- prefix = config.paths('freetype2/src')[0] freetype_lib = 'freetype2_src' def get_ft2_sources(name_info, build_dir): (lib_name, build_info) = name_info sources = [prefix + "/" + s for s in freetype2_sources] if sys.platform=='darwin': return sources[:] return sources[:-1] ft2_incl_dirs = ['freetype2/src/' + s for s in freetype2_dirs] \ + ['freetype2/include', 'freetype2/src'] ft2_incl_dirs = config.paths(*ft2_incl_dirs) if sys.platform == 'darwin' and '64bit' not in platform.architecture(): ft2_incl_dirs.append("/Developer/Headers/FlatCarbon") config.add_library(freetype_lib, sources = [get_ft2_sources], include_dirs = ft2_incl_dirs, # This macro was introduced in Freetype 2.2; if it is # not defined, then the ftheader.h file (one of the # primary headers) won't pull in any additional internal # Freetype headers, and the library will mysteriously # fail to build. macros = [("FT2_BUILD_LIBRARY", None)], depends = ['freetype2'], ) #------------------------------------------------------------------------- # Add the Agg sources #------------------------------------------------------------------------- agg_include_dirs = [agg_dir+'/include',agg_dir+'/font_freetype'] + \ ft2_incl_dirs agg_sources = [agg_dir+'/src/*.cpp', agg_dir+'/font_freetype/*.cpp'] config.add_library(agg_lib, agg_sources, include_dirs = agg_include_dirs, depends = [agg_dir]) #------------------------------------------------------------------------- # Add the Kiva sources #------------------------------------------------------------------------- if sys.platform == 'darwin': define_macros = [('__DARWIN__', None)] macros = [('__DARWIN__', None)] else: define_macros = [] macros = [] kiva_include_dirs = ['src'] + agg_include_dirs config.add_library('kiva_src', ['src/kiva_*.cpp', 'src/gl_graphics_context.cpp'], include_dirs = kiva_include_dirs, # Use "macros" instead of "define_macros" because the # latter is only used for extensions, and not clibs macros = macros, ) # MSVC6.0: uncomment to handle template parameters: #extra_compile_args = ['/Zm1000'] extra_compile_args = [] # XXX: test whether numpy has weakref support #------------------------------------------------------------------------- # Build the extension itself #------------------------------------------------------------------------- # Check for g++ < 4.0 on 64-bit Linux use_32bit_workaround = False if sys.platform == 'linux2' and '64bit' in platform.architecture(): f = os.popen("g++ --version") line0 = f.readline() f.close() m = re.match(r'.+?\s([3-5])\.\d+', line0) if m is not None and int(m.group(1)) < 4: use_32bit_workaround = True # Enable workaround of agg bug on 64-bit machines with g++ < 4.0 if use_32bit_workaround: define_macros.append(("ALWAYS_32BIT_WORKAROUND", 1)) # Options to make OS X link OpenGL if '64bit' not in platform.architecture(): darwin_frameworks = ['Carbon', 'ApplicationServices', 'OpenGL'] else: darwin_frameworks = ['ApplicationServices', 'OpenGL'] darwin_extra_link_args = [] for framework in darwin_frameworks: darwin_extra_link_args.extend(['-framework', framework]) darwin_opengl_opts = dict( include_dirs = [ '/System/Library/Frameworks/%s.framework/Versions/A/Headers' % x for x in darwin_frameworks], define_macros = [('__DARWIN__',None)], extra_link_args = darwin_extra_link_args ) build_info = {} kiva_lib = 'kiva_src' build_libraries = [kiva_lib, agg_lib, freetype_lib] if sys.platform == "win32": build_libraries += ["opengl32", "glu32"] elif sys.platform == "darwin": dict_append(build_info, **darwin_opengl_opts) else: # This should work for most linuxes (linuces?) build_libraries += ["GL", "GLU"] dict_append(build_info, sources = ['agg.i'], include_dirs = kiva_include_dirs, libraries = build_libraries, depends = ['src/*.[ih]'], extra_compile_args = extra_compile_args, extra_link_args = [], define_macros=define_macros, ) dict_append(build_info, **numerix_info) config.add_extension('_agg', **build_info) sources = [os.path.join('src',plat,'plat_support.i'), os.path.join('src',plat,'agg_bmp.cpp'), ] if plat != 'gl': sources.append(os.path.join('src',plat,'agg_platform_specific.cpp')) plat_info = {} dict_append(plat_info, libraries = [agg_lib], include_dirs = kiva_include_dirs, extra_compile_args = extra_compile_args, depends = ['src']) dict_append(plat_info, **numerix_info) if plat=='win32': dict_append(plat_info, libraries = ['gdi32','user32']) elif plat in ['x11','gtk1']: # Make sure we raise an error if the information is not found. # Frequently, the 64-bit libraries are not in a known location and need # manual configuration. From experience, this is usually not detected by # the builder if we do not raise an exception. x11_info = get_info('x11', notfound_action=2) dict_append(plat_info, **x11_info) elif plat=='gdkpixbuf2': #gdk_pixbuf_xlib_2 = get_info('gdk_pixbuf_xlib_2',notfound_action=1) #dict_append(plat_info,**gdk_pixbuf_xlib_2) gtk_info = get_info('gtk+-2.0') dict_append(plat_info, **gtk_info) #x11_info = get_info('x11',notfound_action=1) #dict_append(plat_info,**x11_info) elif plat == 'gl': if sys.platform == 'darwin': dict_append(plat_info, **darwin_opengl_opts) else: msg = "OpenGL build support only on MacOSX right now." raise NotImplementedError(msg) config.add_extension('_plat_support', sources, **plat_info ) config.add_data_dir('tests') config.add_data_files('*.txt', '*.bat') return config enthought-chaco2-4.8.1.orig/kiva/agg/build.bat0000644000175000017500000000036013233644505020160 0ustar varunvarunrmdir /s /q build\temp.win32-2.4\Release rmdir /s /q build\temp.win32-2.4\src del build\temp.win32-2.4\*.a del *.pyd del agg.py del agg_wrap.cpp python setup.py build_src build_clib --compiler=mingw32 build_ext --inplace --compiler=mingw32 enthought-chaco2-4.8.1.orig/kiva/agg/README_Agg.txt0000644000175000017500000000103713233644505020647 0ustar varunvarunThe folder agg24 contains a copy of the Agg-2.4 library. This code has been adapted from the Matplotlib version of Agg. The original code is subject to the Anti-Grain Geometry Public License. Modifications by the Matplotlib development team are subject to the Matplotlib license. Modifications made as part of the Enable project are subject to the 3-clause BSD license. Copies of these licenses can be found in the LICENSES directory. See https://github.com/enthought/enable/pull/288 for more information about the provenance of this code. enthought-chaco2-4.8.1.orig/kiva/agg/tests/0000755000175000017500000000000013544357630017541 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/tests/font_loading_test.py0000644000175000017500000000163613421603267023615 0ustar varunvarunfrom __future__ import print_function from string import ascii_lowercase, ascii_uppercase import os import time from kiva.image import font_metrics_provider as FMP from kiva.fonttools import Font counts = (500,) strings = ("hello", ) # ascii_lowercase + ascii_uppercase) fonts = ( ("arial", 12), ) # ("times", 16), ("courier", 10) ) def test(): allmetrics = [] for count in counts: start = time.time() for i in range(count): metrics = FMP() for face, size in fonts: metrics.set_font(Font(face, size)) for s in strings: dims = metrics.get_text_extent(s) allmetrics.append(metrics) end = time.time() print("finished count=%d" % count) print(" total time:", end - start) print(" time/set_font:", (end-start) / float(count * len(fonts))) if __name__ == "__main__": test() enthought-chaco2-4.8.1.orig/kiva/agg/tests/test_graphics_context_system.py0000644000175000017500000000176413421603267026124 0ustar varunvarunimport unittest from kiva.agg import GraphicsContextSystem class GraphicsContextSystemTestCase(unittest.TestCase): def test_creation(self): """ Simply create and destroy multiple objects. This silly test crashed when we transitioned from Numeric 23.1 to 23.8. That problem is fixed now. """ for i in range(10): gc = GraphicsContextSystem((100,100), "rgba32") del gc #---------------------------------------------------------------------------- # test setup code. #---------------------------------------------------------------------------- def check_suite(level=1): suites = [] if level > 0: suites.append( unittest.makeSuite(GraphicsContextSystemTestCase,'test_') ) total_suite = unittest.TestSuite(suites) return total_suite def test(level=10): all_tests = check_suite(level) runner = unittest.TextTestRunner() runner.run(all_tests) return runner if __name__ == "__main__": test() enthought-chaco2-4.8.1.orig/kiva/agg/tests/clip_to_rect_test_case.py0000644000175000017500000002741213421603267024613 0ustar varunvarun""" Needed Tests clip_to_rect() tests -------------------- DONE *. clip_to_rect is inclusive on lower end and exclusive on upper end. DONE *. clip_to_rect behaves intelligently under scaled ctm. DONE *. clip_to_rect intersects input rect with the existing clipping rect. DONE *. current rectangular clipping path is saved/restored to the stack when save_state/restore_state are called. DONE *. clip_to_rect clears current path. DONE *. clip_to_rect raises NotImplementedError under a rotated ctm. clip_to_rects() tests --------------------- DONE *. Test that clip_to_rects raises not implemented, or whatever. """ import unittest from numpy import array, transpose import nose from kiva.agg import GraphicsContextArray import kiva from .test_utils import Utils class ClipToRectTestCase(unittest.TestCase, Utils): #------------------------------------------------------------------------ # Simple Clipping to a single rectangle. #------------------------------------------------------------------------ def clip_to_rect_helper(self, desired, scale, clip_rects): """ desired -- 2D array with a single channels expected byte pattern. scale -- used in scale_ctm() to change the ctm. clip_args -- passed in as *clip_args to clip_to_rect. """ shp = tuple(transpose(desired.shape)) gc = GraphicsContextArray(shp, pix_format="rgb24") gc.scale_ctm(scale, scale) # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) if isinstance(clip_rects, tuple): gc.clip_to_rect(*clip_rects) else: for rect in clip_rects: gc.clip_to_rect(*rect) gc.rect(0, 0, 4, 4) # These settings allow the fastest path. gc.set_fill_color((0.0, 0.0, 0.0)) # black gc.fill_path() # test a single color channel actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) def test_clip_to_rect_simple(self): desired = array([[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]]) clip_rect = (1, 1, 2, 2) self.clip_to_rect_helper(desired, 1, clip_rect) def test_clip_to_rect_simple2(self): desired = array([[255, 255, 255, 255], [255, 255, 255, 255], [255, 0, 255, 255], [255, 255, 255, 255]]) clip_rect = (1, 1, 1, 1) self.clip_to_rect_helper(desired, 1, clip_rect) def test_clip_to_rect_negative(self): desired = array([[255, 255, 255, 255], [ 0, 0, 0, 255], [ 0, 0, 0, 255], [ 0, 0, 0, 255]]) clip_rect = (-1, -1, 4, 4) self.clip_to_rect_helper(desired, 1, clip_rect) def test_clip_to_rect_simple3(self): desired = array([[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]]) clip_rect = (1, 1, 2.49, 2.49) self.clip_to_rect_helper(desired, 1, clip_rect) def test_clip_to_rect_simple4(self): desired = array([[255, 0, 0, 0], [255, 0, 0, 0], [255, 0, 0, 0], [255, 255, 255, 255]]) clip_rect = (1, 1, 2.5, 2.5) self.clip_to_rect_helper(desired, 1, clip_rect) def test_clip_to_rect_simple5(self): # This tests clipping with a larger rectangle desired = array([[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]]) clip_rects = [(1, 1, 2, 2), (0, 0, 4, 4)] self.clip_to_rect_helper(desired, 1, clip_rects) def test_empty_clip_region(self): # This tests when the clipping region is clipped down to nothing. desired = array([[255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]]) clip_rects = [(1,1,4,4), (3,3,1,1), (1,1,1,1)] self.clip_to_rect_helper(desired, 1, clip_rects) def test_clip_to_rect_scaled(self): desired = array([[255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 0, 0, 0, 0, 255, 255], [255, 255, 0, 0, 0, 0, 255, 255], [255, 255, 0, 0, 0, 0, 255, 255], [255, 255, 0, 0, 0, 0, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255]]) clip_rect = (1, 1, 2, 2) self.clip_to_rect_helper(desired, 2.0, clip_rect) def test_clip_to_rect_scaled2(self): desired = array([[255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 0, 0, 0, 0, 0, 255], [255, 255, 0, 0, 0, 0, 0, 255], [255, 255, 0, 0, 0, 0, 0, 255], [255, 255, 0, 0, 0, 0, 0, 255], [255, 255, 0, 0, 0, 0, 0, 255], [255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255]]) clip_rect = (1, 1, 2.25, 2.25) self.clip_to_rect_helper(desired, 2.0, clip_rect) def test_save_restore_clip_state(self): desired1 = array([[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]]) desired2 = array([[255, 0, 0, 0], [255, 0, 0, 0], [255, 0, 0, 0], [255, 255, 255, 255]]) gc = GraphicsContextArray((4,4), pix_format="rgb24") gc.clear((1.0, 1.0, 1.0)) gc.set_fill_color((0.0, 0.0, 0.0)) gc.clip_to_rect(1, 1, 3, 3) gc.save_state() gc.clip_to_rect(1, 1, 2, 2) gc.rect(0, 0, 4, 4) gc.fill_path() actual1 = gc.bmp_array[:,:,0] self.assertRavelEqual(desired1, actual1) gc.restore_state() gc.rect(0, 0, 4, 4) gc.fill_path() actual2 = gc.bmp_array[:,:,0] self.assertRavelEqual(desired2, actual2) def test_clip_to_rect_rotated(self): # FIXME: test skipped # This test raises an exception currently because the # underlying library doesn't handle clipping to a rotated # rectangle. For now, we catch the the case with an # exception, so that people can't screw up. In the future, # we should actually support this functionality. raise nose.SkipTest gc = GraphicsContextArray((1,1), pix_format="rgb24") gc.rotate_ctm(1.0) self.assertRaises(NotImplementedError, gc.clip_to_rect, 0, 0, 1, 1) #------------------------------------------------------------------------ # Successive Clipping of multiple rectangles. #------------------------------------------------------------------------ def successive_clip_helper(self, desired, scale, clip_rect1, clip_rect2): """ desired -- 2D array with a single channels expected byte pattern. scale -- used in scale_ctm() to change the ctm. clip_rect1 -- 1st clipping path. clip_rect2 -- 2nd clipping path. """ shp = tuple(transpose(desired.shape)) gc = GraphicsContextArray(shp, pix_format="rgb24") gc.scale_ctm(scale, scale) # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) gc.clip_to_rect(*clip_rect1) gc.clip_to_rect(*clip_rect2) gc.rect(0, 0, 4, 4) # These settings allow the fastest path. gc. set_fill_color((0.0, 0.0, 0.0)) # black gc.fill_path() # test a single color channel actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) def test_clip_successive_rects(self): desired = array([[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]]) clip_rect1 = (1, 1, 20, 20) clip_rect2 = (0, 0, 3, 3) self.successive_clip_helper(desired, 1.0, clip_rect1, clip_rect2) def test_clip_successive_rects2(self): desired = array([[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]]) clip_rect1 = (1, 1, 20, 20) clip_rect2 = (-1, -1, 4, 4) self.successive_clip_helper(desired, 1.0, clip_rect1, clip_rect2) #------------------------------------------------------------------------ # Save/Restore clipping path. #------------------------------------------------------------------------ def test_save_restore_clip_path(self): desired = array([[255, 255, 255, 255], [255, 0, 0, 255], [255, 0, 0, 255], [255, 255, 255, 255]]) # this is the clipping path we hope to see. clip_rect1 = (1, 1, 2, 2) # this will be a second path that will push/pop that should # never be seen. clip_rect2 = (1, 1, 1, 1) shp = tuple(transpose(desired.shape)) gc = GraphicsContextArray(shp, pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) gc.clip_to_rect(*clip_rect1) # push and then pop a path that shouldn't affect the drawing gc.save_state() gc.clip_to_rect(*clip_rect2) gc.restore_state() gc.rect(0, 0, 4, 4) # These settings allow the fastest path. gc. set_fill_color((0.0, 0.0, 0.0)) # black gc.fill_path() # test a single color channel actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) def test_reset_path(self): """ clip_to_rect() should clear the current path. This is to maintain compatibility with the version of kiva that sits on top of Apple's Quartz engine. """ desired = array([[255, 255, 0, 0], [255, 255, 0, 0], [255, 255, 0, 0], [255, 255, 0, 0]]) shp = tuple(transpose(desired.shape)) gc = GraphicsContextArray(shp, pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) gc.rect(0, 0, 2, 4) gc.clip_to_rect(0, 0, 4, 4) gc.rect(2, 0, 2, 4) # These settings allow the fastest path. gc. set_fill_color((0.0, 0.0, 0.0)) # black gc.fill_path() # test a single color channel actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) class ClipToRectsTestCase(unittest.TestCase): def test_not_implemented(self): """ fix me: Currently not implemented, so we just ensure that any call to it throws an exception. """ gc = GraphicsContextArray((1,1), pix_format="rgb24") gc.rotate_ctm(1.0) #self.failUnlessRaises(NotImplementedError, gc.clip_to_rects, [[0, 0, 1, 1]]) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/agg/tests/graphics_context_test_case.py0000644000175000017500000003230213421603267025503 0ustar varunvarunfrom __future__ import with_statement import unittest from numpy import all, allclose, array, dtype, pi, ones from kiva import agg from kiva.fonttools import Font class GraphicsContextArrayTestCase(unittest.TestCase): def test_init(self): gc = agg.GraphicsContextArray((100,100)) def test_init_bmp_equal_to_clear_bmp(self): gc = agg.GraphicsContextArray((5,5)) gc2 = agg.GraphicsContextArray((5,5)) gc2.clear() self.assertTrue((gc.bmp_array == gc2.bmp_array).all()) def test_init_with_bmp_doesnt_clear(self): a = ones((5,5,4), dtype('uint8')) gc = agg.GraphicsContextArray(a, pix_format='rgba32') self.assertTrue((gc.bmp_array == a).all()) def test_save_restore_state(self): gc = agg.GraphicsContextArray((100,100)) gc.save_state() gc.restore_state() def test_save_restore_state_for_ctm(self): gc = agg.GraphicsContextArray((100,100)) m0 = agg.translation_matrix(10.0,10.0) gc.set_ctm(m0) gc.save_state() m1 = agg.translation_matrix(5.0,5.0) gc.set_ctm(m1) m2 = gc.get_ctm() self.assertEqual(tuple(m1), m2) gc.restore_state() m3 = gc.get_ctm() self.assertEqual(tuple(m0), m3) # !! Need some tests of other graphics state information on # !! save/restore state def test_save_restore_state_for_ttm(self): # The interesting thing here is that we are verifying # that the text transform matrix (TTM) is *not* saved # with the graphics state. gc = agg.GraphicsContextArray((100,100)) m0 = agg.translation_matrix(10.0,10.0) gc.set_text_matrix(m0) gc.save_state() gc.set_text_matrix(agg.translation_matrix(5.0,5.0)) gc.restore_state() m1 = gc.get_text_matrix() self.assertNotEqual(m1, m0) # !! Need some tests of other graphics state information on # !! save/restore state def test_context_manager(self): gc = agg.GraphicsContextArray((100,100)) # Set some values. gc.set_stroke_color((1,0,0,1)) gc.set_antialias(0) gc.set_alpha(0.25) with gc: # Change the values in the current context. gc.set_stroke_color((0,0,1,1)) self.assertTrue(all(gc.get_stroke_color() == (0,0,1,1))) gc.set_antialias(1) self.assertEqual(gc.get_antialias(), 1) gc.set_alpha(0.75) self.assertEqual(gc.get_alpha(), 0.75) # Verify that we are back to the previous settings. self.assertTrue(all(gc.get_stroke_color() == (1,0,0,1))) self.assertEqual(gc.get_antialias(), 0) self.assertEqual(gc.get_alpha(), 0.25) def test_context_manager_nested(self): gc = agg.GraphicsContextArray((100,100)) # Set some values. gc.set_stroke_color((1,0,0,1)) gc.set_antialias(0) gc.set_alpha(0.25) with gc: # Change the values in the current context. gc.set_stroke_color((0,0,1,1)) self.assertTrue(all(gc.get_stroke_color() == (0,0,1,1))) gc.set_antialias(1) self.assertEqual(gc.get_antialias(), 1) gc.set_alpha(0.75) self.assertEqual(gc.get_alpha(), 0.75) with gc: # Change the values in the current context. gc.set_stroke_color((1,0,1,1)) self.assertTrue(all(gc.get_stroke_color() == (1,0,1,1))) gc.set_antialias(0) self.assertEqual(gc.get_antialias(), 0) gc.set_alpha(1.0) self.assertEqual(gc.get_alpha(), 1.0) # Verify that we are back to the previous settings. self.assertTrue(all(gc.get_stroke_color() == (0,0,1,1))) self.assertEqual(gc.get_antialias(), 1) self.assertEqual(gc.get_alpha(), 0.75) # Verify that we are back to the previous settings. self.assertTrue(all(gc.get_stroke_color() == (1,0,0,1))) self.assertEqual(gc.get_antialias(), 0) self.assertEqual(gc.get_alpha(), 0.25) def test_translate_ctm(self): gc = agg.GraphicsContextArray((100, 100)) gc.translate_ctm(2.0, 2.0) actual = gc.get_ctm() desired = agg.translation_matrix(2.0, 2.0) self.assertEqual(actual, tuple(desired)) def test_scale_ctm(self): gc = agg.GraphicsContextArray((100,100)) gc.scale_ctm(2.0,2.0) actual = gc.get_ctm() desired = agg.scaling_matrix(2.0,2.0) self.assertEqual(actual, tuple(desired)) def test_rotate_ctm(self): gc = agg.GraphicsContextArray((100,100)) gc.rotate_ctm(pi/4.) actual = gc.get_ctm() desired = agg.rotation_matrix(pi/4.) self.assertEqual(actual, tuple(desired)) def test_concat_ctm(self): gc = agg.GraphicsContextArray((100,100)) gc.translate_ctm(2.0,2.0) m0 = agg.scaling_matrix(2.0,2.0) gc.concat_ctm(m0) actual = gc.get_ctm() m0.multiply(agg.translation_matrix(2.0,2.0)) desired = m0 self.assertEqual(actual, tuple(desired)) def test_begin_path(self): gc = agg.GraphicsContextArray((100,100)) gc.move_to(1.0,1.0) gc.begin_path() path = gc._get_path() pt, flag = path._vertex() # !! should get this value from the agg enum value desired = 0 self.assertEqual(flag, desired) def test_move_to(self): gc = agg.GraphicsContextArray((100, 100)) gc.move_to(1.0, 1.0) path = gc._get_path() actual, flag = path._vertex() desired = array((1.0, 1.0)) self.assertTrue(allclose(actual, desired)) def test_move_to1(self): gc = agg.GraphicsContextArray((100, 100)) gc.translate_ctm(1.0, 1.0) gc.move_to(1.0, 1.0) path = gc._get_path() actual, flag = path._vertex() desired = array((2.0, 2.0)) self.assertTrue(allclose(actual, desired)) def test_quad_curve_to(self): gc = agg.GraphicsContextArray((100, 100)) ctrl = 1.0, 1.0 to = 2.0, 2.0 gc.quad_curve_to(ctrl[0], ctrl[1], to[0], to[1]) path = gc._get_path() actual_ctrl, flag = path._vertex() self.assertEqual(actual_ctrl, ctrl) self.assertEqual(flag, 3) actual_to, flag = path._vertex() self.assertEqual(actual_to, to) self.assertEqual(flag, 3) def test_curve_to(self): gc = agg.GraphicsContextArray((100, 100)) ctrl1 = 1.0, 1.0 ctrl2 = 2.0, 2.0 to = 3.0, 3.0 gc.curve_to(ctrl1[0], ctrl1[1], ctrl2[0], ctrl2[1], to[0], to[1]) path = gc._get_path() actual_ctrl1, flag = path._vertex() self.assertEqual(actual_ctrl1, ctrl1) self.assertEqual(flag, 4) actual_ctrl2, flag = path._vertex() self.assertEqual(actual_ctrl2, ctrl2) self.assertEqual(flag, 4) actual_to, flag = path._vertex() self.assertEqual(actual_to, to) self.assertEqual(flag, 4) def test_add_path(self): path1 = agg.CompiledPath() path1.move_to(1.0,1.0) path1.translate_ctm(1.0,1.0) path1.line_to(2.0,2.0) #actually (3.0,3.0) path1.scale_ctm(2.0,2.0) path1.line_to(2.0,2.0) # actually (5.0,5.0) gc = agg.GraphicsContextArray((100,100)) gc.move_to(1.0,1.0) gc.translate_ctm(1.0,1.0) gc.line_to(2.0,2.0) #actually (3.0,3.0) sub_path = agg.CompiledPath() sub_path.scale_ctm(2.0,2.0) sub_path.line_to(2.0,2.0) gc.add_path(sub_path) path2 = gc._get_path() desired = path1._vertices() actual = path2._vertices() self.assertTrue(allclose(actual, desired)) desired = path1.get_ctm() actual = path2.get_ctm() self.assertEqual(actual, desired) def base_lines(self, lines): gc = agg.GraphicsContextArray((100, 100)) gc.move_to(1.0,1.0) gc.line_to(2.0,2.0) #actually (3.0,3.0) gc.lines(lines) actual = gc._get_path()._vertices() desired = array(((1.0,1.0,agg.path_cmd_move_to, agg.path_flags_none), (2.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (3.0,3.0,agg.path_cmd_move_to, agg.path_flags_none), (4.0,4.0,agg.path_cmd_line_to, agg.path_flags_none), (0.0,0.0,agg.path_cmd_stop, agg.path_flags_none),)) #print 'desired:', desired #print 'actual:', actual self.assertTrue(allclose(actual,desired)) def test_lines_array(self): lines = array(((3.0,3.0), (4.0,4.0))) self.base_lines(lines) def test_lines_list(self): lines = [[3.0,3.0], [4.0,4.0]] self.base_lines(lines) def base_rects(self,rects): gc = agg.GraphicsContextArray((100, 100)) gc.rects(rects) actual = gc._get_path()._vertices() desired = array(((1.0,1.0,agg.path_cmd_move_to, agg.path_flags_none), (1.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (2.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (2.0,1.0,agg.path_cmd_line_to, agg.path_flags_none), (0.0,0.0,agg.path_cmd_end_poly, agg.path_flags_close), (2.0,2.0,agg.path_cmd_move_to, agg.path_flags_none), (2.0,3.0,agg.path_cmd_line_to, agg.path_flags_none), (3.0,3.0,agg.path_cmd_line_to, agg.path_flags_none), (3.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (0.0,0.0,agg.path_cmd_end_poly, agg.path_flags_close), (0.0,0.0,agg.path_cmd_stop, agg.path_flags_none),)) self.assertTrue(allclose(actual,desired)) def test_rects_array(self): rects = array(((1.0,1.0,1.0,1.0), (2.0,2.0,1.0,1.0))) self.base_rects(rects) def test_rects_list(self): rects = [[1.0,1.0,1.0,1.0], [2.0,2.0,1.0,1.0]] self.base_rects(rects) def test_rect(self): gc = agg.GraphicsContextArray((100,100)) gc.rect(1.0,1.0,1.0,1.0) actual = gc._get_path()._vertices() desired = array(((1.0,1.0,agg.path_cmd_move_to, agg.path_flags_none), (1.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (2.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (2.0,1.0,agg.path_cmd_line_to, agg.path_flags_none), (0.0,0.0,agg.path_cmd_end_poly, agg.path_flags_close), (0.0,0.0,agg.path_cmd_stop, agg.path_flags_none),)) self.assertTrue(allclose(actual,desired)) def test_clip_to_rect(self): gc = agg.GraphicsContextArray((10,10)) gc.move_to(0,0) gc.line_to(10,10) gc.clip_to_rect(5,5,5,5) gc.stroke_path() #print 'clipping on' #print gc.bmp_array[:,:,0] # make sure nothing was drawn in the corner self.assertEqual(gc.bmp_array[-1,0,0], 255) def test_stroke_path(self): gc = agg.GraphicsContextArray((5,5)) gc.move_to(0,0) gc.line_to(5,5) gc.stroke_path() #print #print "stroke lower-left to upper-right:" #print gc.bmp_array[:,:,0] # assert the lower left and upper corner are the same, # and have something drawn in them. self.assertEqual(gc.bmp_array[-1,0,0], gc.bmp_array[0,-1,0]) self.assertNotEqual(gc.bmp_array[-1,0,0], 255) def test_set_get_text_position(self): #print 'testing text position' gc = agg.GraphicsContextArray((5,5)) gc.set_text_position(1,1) actual = gc.get_text_position() desired = (1,1) self.assertTrue(allclose(actual,desired)) def test_get_set_font(self): gc = agg.GraphicsContextArray((5,5)) font1 = Font('modern') gc.set_font(font1) font3 = gc.get_font() self.assertEqual(font1.face_name, font3.name) self.assertEqual(font1.size, font3.size) self.assertEqual(font1.family, font3.family) self.assertEqual(font1.style, font3.style) self.assertEqual(font1.encoding, font3.encoding) def test_set_line_dash_none(self): gc = agg.GraphicsContextArray((5,5)) gc.set_line_dash(None) # !! need to add an accessor to test result def test_set_line_dash_list(self): gc = agg.GraphicsContextArray((5,5)) gc.set_line_dash([2,3]) # !! need to add an accessor to test result def test_set_line_dash_2d_list(self): gc = agg.GraphicsContextArray((5,5)) try: gc.set_line_dash([[2,3],[2,3]]) except TypeError: pass def test_set_text_matrix_ndarray(self): """ Test that gc.set_text_matrix accepts 3x3 ndarrays. """ gc = agg.GraphicsContextArray((5, 5)) m = array([[1.0, 2.0, 0.0], [3.0, 4.0, 0.0], [5.0, 6.0, 1.0]]) gc.set_text_matrix(m) m2 = gc.get_text_matrix() self.assertEqual(m2, agg.AffineMatrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/agg/tests/__init__.py0000644000175000017500000000000013233644505021633 0ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/tests/compiled_path_test_case.py0000644000175000017500000002156613421603267024761 0ustar varunvarunimport unittest from numpy import array, alltrue, ravel, pi from kiva import agg from .test_utils import Utils # UNCOMMENT THIS TO SEE THE IMPORT ISSUES FROM TICKET # https://svn.enthought.com/enthought/ticket/537 (agg causes python crash during unit tests) # #import sys #module_names = [ name for name in sys.modules.keys() if name.find('agg') >= 0] #module_names.sort() #for name in module_names: # print name, sys.modules[name] class TestCompiledPath(unittest.TestCase, Utils): def test_init(self): path = agg.CompiledPath() def test_save_restore_ctm0(self): path = agg.CompiledPath() path.save_ctm(); path.restore_ctm(); def test_save_restore_ctm1(self): path = agg.CompiledPath() m0 = agg.translation_matrix(10.0,10.0) path.set_ctm(m0) path.save_ctm() m1 = agg.translation_matrix(5.0,5.0) path.set_ctm(m1) m2 = path.get_ctm() self.assertRavelEqual(m1, m2) path.restore_ctm() m3 = path.get_ctm() self.assertRavelEqual(m0, m3) def test_translate_ctm(self): path = agg.CompiledPath() path.translate_ctm(2.0,2.0) actual = path.get_ctm() desired = agg.translation_matrix(2.0,2.0) self.assertRavelEqual(actual, desired) def test_scale_ctm(self): path = agg.CompiledPath() path.scale_ctm(2.0,2.0) actual = path.get_ctm() desired = agg.scaling_matrix(2.0,2.0) self.assertRavelEqual(actual, desired) def test_rotate_ctm(self): angle = pi/4. path = agg.CompiledPath() path.rotate_ctm(angle) actual = path.get_ctm() desired = agg.rotation_matrix(angle) self.assertRavelEqual(actual, desired) def test_concat_ctm(self): path = agg.CompiledPath() path.translate_ctm(2.0,2.0) m0 = agg.scaling_matrix(2.0,2.0) path.concat_ctm(m0) actual = path.get_ctm() # wrapper not working #m0 *= agg.translation_matrix(2.0,2.0) m0.multiply(agg.translation_matrix(2.0,2.0)) desired = m0 des = desired.asarray() act = actual.asarray() self.assertRavelEqual(actual, desired) def test_vertex(self): # !! should get this value from the agg enum value path = agg.CompiledPath() path.move_to(1.0,1.0) actual,actual_flag = path._vertex() desired = array((1.0,1.0)) desired_flag = 1 self.assertRavelEqual(actual,desired) self.assertRavelEqual(actual_flag,desired_flag) #check for end flag actual,actual_flag = path._vertex() desired_flag = 0 self.assertRavelEqual(actual_flag,desired_flag) def test_vertices(self): # !! should get this value from the agg enum value path = agg.CompiledPath() path.move_to(1.0,1.0) desired = array(((1.0,1.0,1.0,0.0), (0.0,0.0,0.0,0.0))) actual = path._vertices() self.assertRavelEqual(actual,desired) def test_rewind(self): # !! should get this value from the agg enum value path = agg.CompiledPath() path.move_to(1.0,1.0) actual,actual_flag = path._vertex() actual,actual_flag = path._vertex() path._rewind() actual,actual_flag = path._vertex() desired = array((1.0,1.0)) desired_flag = 1 self.assertRavelEqual(actual,desired) self.assertRavelEqual(actual_flag,desired_flag) def test_begin_path(self): path = agg.CompiledPath() path.move_to(1.0,1.0) path.begin_path() pt, flag = path._vertex() # !! should get this value from the agg enum value desired = 0 self.assertRavelEqual(flag,desired) def test_move_to(self): path = agg.CompiledPath() path.move_to(1.0,1.0) actual,flag = path._vertex() desired = array((1.0,1.0)) self.assertRavelEqual(actual,desired) def test_move_to1(self): """ Test that transforms are affecting move_to commands """ path = agg.CompiledPath() path.translate_ctm(1.0,1.0) path.move_to(1.0,1.0) actual,flag = path._vertex() desired = array((2.0,2.0)) self.assertRavelEqual(actual,desired) def test_quad_curve_to(self): path = agg.CompiledPath() ctrl = 1.0,1.0 to = 2.0,2.0 path.quad_curve_to(ctrl[0],ctrl[1],to[0],to[1]) actual_ctrl, flag = path._vertex() self.assertRavelEqual(actual_ctrl, ctrl) assert(flag == 3) actual_to, flag = path._vertex() assert(actual_to == to) assert(flag == 3) def test_curve_to(self): path = agg.CompiledPath() ctrl1 = 1.0,1.0 ctrl2 = 2.0,2.0 to = 3.0,3.0 path.curve_to(ctrl1[0],ctrl1[1],ctrl2[0],ctrl2[1],to[0],to[1]) actual_ctrl1, flag = path._vertex() assert(actual_ctrl1 == ctrl1) assert(flag == 4) actual_ctrl2, flag = path._vertex() assert(actual_ctrl2 == ctrl2) assert(flag == 4) actual_to, flag = path._vertex() assert(actual_to == to) assert(flag == 4) def test_add_path(self): path1 = agg.CompiledPath() path1.move_to(1.0,1.0) path1.translate_ctm(1.0,1.0) path1.line_to(2.0,2.0) #actually (3.0,3.0) path1.scale_ctm(2.0,2.0) path1.line_to(2.0,2.0) # actually (5.0,5.0) path2 = agg.CompiledPath() path2.move_to(1.0,1.0) path2.translate_ctm(1.0,1.0) path2.line_to(2.0,2.0) #actually (3.0,3.0) sub_path = agg.CompiledPath() sub_path.scale_ctm(2.0,2.0) sub_path.line_to(2.0,2.0) path2.add_path(sub_path) desired = path1._vertices() actual = path2._vertices() self.assertRavelEqual(actual, desired) desired = path1.get_ctm() actual = path2.get_ctm() self.assertRavelEqual(actual, desired) def base_helper_lines(self,lines): path = agg.CompiledPath() path.move_to(1.0,1.0) path.line_to(2.0,2.0) #actually (3.0,3.0) path.lines(lines) actual = path._vertices() desired = array(((1.0,1.0,agg.path_cmd_move_to, agg.path_flags_none), (2.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (3.0,3.0,agg.path_cmd_move_to, agg.path_flags_none), (4.0,4.0,agg.path_cmd_line_to, agg.path_flags_none), (0.0,0.0,agg.path_cmd_stop, agg.path_flags_none),)) #print 'desired:', desired #print 'actual:', actual self.assertRavelEqual(actual, desired) def test_lines_array(self): lines = array(((3.0,3.0), (4.0,4.0))) self.base_helper_lines(lines) def test_lines_list(self): lines = [[3.0,3.0], [4.0,4.0]] self.base_helper_lines(lines) def test_rect(self): path = agg.CompiledPath() path.rect(1.0,1.0,1.0,1.0) actual = path._vertices() desired = array(((1.0,1.0,agg.path_cmd_move_to, agg.path_flags_none), (1.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (2.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (2.0,1.0,agg.path_cmd_line_to, agg.path_flags_none), (0.0,0.0,agg.path_cmd_end_poly, agg.path_flags_close), (0.0,0.0,agg.path_cmd_stop, agg.path_flags_none),)) self.assertRavelEqual(actual, desired) def base_helper_rects(self,rects): path = agg.CompiledPath() path.rects(rects) actual = path._vertices() desired = array(((1.0,1.0,agg.path_cmd_move_to, agg.path_flags_none), (1.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (2.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (2.0,1.0,agg.path_cmd_line_to, agg.path_flags_none), (0.0,0.0,agg.path_cmd_end_poly, agg.path_flags_close), (2.0,2.0,agg.path_cmd_move_to, agg.path_flags_none), (2.0,3.0,agg.path_cmd_line_to, agg.path_flags_none), (3.0,3.0,agg.path_cmd_line_to, agg.path_flags_none), (3.0,2.0,agg.path_cmd_line_to, agg.path_flags_none), (0.0,0.0,agg.path_cmd_end_poly, agg.path_flags_close), (0.0,0.0,agg.path_cmd_stop, agg.path_flags_none),)) self.assertRavelEqual(actual, desired) def test_rects_array(self): rects = array(((1.0,1.0,1.0,1.0), (2.0,2.0,1.0,1.0))) self.base_helper_rects(rects) def test_rects_list(self): rects = [[1.0,1.0,1.0,1.0], [2.0,2.0,1.0,1.0]] self.base_helper_rects(rects) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/agg/tests/unicode_font_test_case.py0000644000175000017500000000100313421603267024605 0ustar varunvarunimport unittest import six from kiva.agg import AggFontType, GraphicsContextArray from kiva.fonttools import Font class UnicodeTest(unittest.TestCase): def test_show_text_at_point(self): gc = GraphicsContextArray((100,100)) gc.set_font(Font()) gc.show_text_at_point(six.text_type('asdf'), 5,5) def test_agg_font_type(self): f1 = AggFontType(u"Arial") f2 = AggFontType(b"Arial") self.assertEqual(f1, f2) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/agg/tests/join_stroke_path_test_case.py0000644000175000017500000001575013421603267025511 0ustar varunvarun""" Needed Tests Joins DONE 1. Each version same for all paths through aliased code. DONE 2. Each version same for all paths through antialiased code. Dashed Lines *. Should be tested for all versions of aliasing and all versions of join, cap. Clipping 1. Test that clip_to_rect is inclusive on lower end and exclusive on upper end. 2. Test that clip_to_rect behaves intelligently under ctm transforms. Note: There are numerous comments in code that refer to implementation details (outline, outline_aa, scanline_aa, etc.) from the C++ code. These are largely to help keep track of what paths have been tested. """ import unittest from numpy import array, alltrue, ravel from kiva.agg import GraphicsContextArray import kiva from .test_utils import Utils class JoinStrokePathTestCase(unittest.TestCase, Utils): def helper(self, antialias, width, line_cap, line_join, size=(10,10)): gc = GraphicsContextArray(size, pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(1, 3) gc.line_to(7, 3) gc.line_to(7, 9) # Settings allow the faster outline path through C++ code gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(antialias) gc.set_line_width(width) gc.set_line_cap(line_cap) gc.set_line_join(line_join) gc.stroke_path() return gc def _test_alias_miter(self): """ fix me: This is producing aliased output. I am not sure what this array should look like exactly, so we just force it to fail right now and print out the results. """ antialias = False width = 3 line_cap = kiva.CAP_BUTT line_join = kiva.JOIN_MITER gc = self.helper(antialias, width, line_cap, line_join) actual = gc.bmp_array[:,:,0] assert 0, "join=miter, width=3, antialias=False\n%s" % actual #assert_arrays_equal(actual, desired) def _test_alias_bevel(self): """ fix me: This is producing a line width of 4 instead of 3. I am not sure what this array should look like exactly, so we just force it to fail right now and print out the results. """ antialias = False width = 3 line_cap = kiva.CAP_BUTT line_join = kiva.JOIN_BEVEL gc = self.helper(antialias, width, line_cap, line_join) actual = gc.bmp_array[:,:,0] assert 0, "join=bevel, width=3, antialias=False\n%s" % actual #assert_arrays_equal(actual, desired) def _test_alias_round(self): """ fix me: This is producing a line width of 4 instead of 3. Also, the corner doesn't look so round. I have checked that the scanline_aa renderer is setting the stroked_path.line_join() value to agg::round_join. I am not sure what this array should look like exactly, so we just force it to fail right now and print out the results. """ antialias = False width = 3 line_cap = kiva.CAP_BUTT line_join = kiva.JOIN_ROUND gc = self.helper(antialias, width, line_cap, line_join) actual = gc.bmp_array[:,:,0] assert 0, "join=round, width=3, antialias=False\n%s" % actual #assert_arrays_equal(actual, desired) def test_antialias_miter(self): """ fix me: How to make this pass on OS X and agg... """ antialias = True width = 3 line_cap = kiva.CAP_BUTT line_join = kiva.JOIN_MITER gc = self.helper(antialias, width, line_cap, line_join) actual = gc.bmp_array[:,:,0] desired = array([[255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 127, 127, 127, 127, 63, 0, 0, 127, 255], [255, 0, 0, 0, 0, 0, 0, 0, 127, 255], [255, 0, 0, 0, 0, 0, 0, 0, 127, 255], [255, 127, 127, 127, 127, 127, 127, 127, 191, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255]]) self.assertRavelEqual(actual, desired) def test_antialias_bevel(self): antialias = True width = 3 line_cap = kiva.CAP_BUTT line_join = kiva.JOIN_BEVEL gc = self.helper(antialias, width, line_cap, line_join) actual = gc.bmp_array[:,:,0] desired = array([[255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 127, 127, 127, 127, 63, 0, 0, 127, 255], [255, 0, 0, 0, 0, 0, 0, 0, 127, 255], [255, 0, 0, 0, 0, 0, 0, 31, 223, 255], [255, 127, 127, 127, 127, 127, 127, 223, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255]]) self.assertRavelEqual(actual, desired) def test_antialias_round(self): """ fix me: How to make this test work for multiple renderers? """ antialias = True width = 3 line_cap = kiva.CAP_BUTT line_join = kiva.JOIN_ROUND gc = self.helper(antialias, width, line_cap, line_join) actual = gc.bmp_array[:,:,0] desired = array([[255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 255, 255, 255, 255, 127, 0, 0, 127, 255], [255, 127, 127, 127, 127, 63, 0, 0, 127, 255], [255, 0, 0, 0, 0, 0, 0, 0, 127, 255], [255, 0, 0, 0, 0, 0, 0, 0, 180, 255], [255, 127, 127, 127, 127, 127, 127, 179, 253, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255]]) self.assertRavelEqual(actual, desired) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/agg/tests/test_save.py0000644000175000017500000000246213421603267022106 0ustar varunvarunimport os import unittest from numpy import allclose, ravel import nose from kiva import agg # FIXME: # These tests are broken, and Peter promised to fix it at some point. class Test_Save(unittest.TestCase): format_output_map = { "rgb24": [255,255,255,255,255,255,255,0,0,255,0,0], "bgr24": [255,255,255,255,255,255,0,0,255,0,0,255], "rgba32": [255,255,255,255,255,255,255,255,255,0,0,255,255,0,0,255], "bgra32": [255,255,255,255,255,255,255,255,0,0,255,255,0,0,255,255] } def test_rgb24_format(self): self.do_check_format('rgb24') def test_bgr24_format(self): self.do_check_format('bgr24') def test_rgba32_format(self): self.do_check_format('rgba32') def test_bgra32_format(self): self.do_check_format('bgra32') def do_check_format(self,fmt): # FIXME: raise nose.SkipTest gc = agg.GraphicsContextArray((2,2), fmt) gc.set_stroke_color((1.0,0.0,0.0)) gc.move_to(0.0, 0.5) gc.line_to(2.0, 0.5) gc.stroke_path() gc.save(fmt + ".png") img = agg.Image(fmt + ".png") os.unlink(fmt + ".png") self.assertEqual(list(ravel(img.bmp_array)), self.format_output_map[fmt]) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/agg/tests/gcmemtest.py0000755000175000017500000000204613421603267022102 0ustar varunvarun""" Test for memory leak in the wx image backend. """ import unittest, sys import gc as garbagecollector from kiva.image import GraphicsContext, GraphicsContextSystem from etsdevtools.debug.memusage import get_mem_usage class test_agg(unittest.TestCase): def check_agg_mem_leak(self): pre = get_mem_usage() gc = GraphicsContext((500,500)) del gc garbagecollector.collect() post = get_mem_usage() assert (pre == post) def check_wx_mem_leak(self): pre = get_mem_usage() gc = GraphicsContextSystem((500,500)) del gc garbagecollector.collect() post = get_mem_usage() assert (pre == post) def test_suite(level=1): suites = [] if level > 0: suites.append( unittest.makeSuite(test_agg,'check_') ) total_suite = unittest.TestSuite(suites) return total_suite def test(level=10): all_tests = test_suite(level) runner = unittest.TextTestRunner() runner.run(all_tests) return runner if __name__ == "__main__": test() enthought-chaco2-4.8.1.orig/kiva/agg/tests/stroke_path_test_case.py0000644000175000017500000004325613421603267024474 0ustar varunvarun""" Tasks ----- DONE *. Change all rect classes to use a sequence instead of 4 separate args *. Implement a clear_rect that takes a rect argument and a color. *. Rename the clear() method to ?erase()? so that clear can stick with the clear_rect semantics. *. Implement arc. *. Implement a clear_rects that takes a rect list and a color. *. Implement clipping to multiple rectangles. Needed Tests ------------ Coordinate system offset. DONE 1. Test that aliased line at zero puts full energy in last row of buffer. DONE 2. Test that antialiased line at zero puts half energy in last row of buffer. Aliased DONE 1. For simple line, test all paths through rendering pipeline. Antialiased DONE 1. For simple line, test all paths through rendering pipeline. Caps DONE 1. Each version same for all paths through aliased code. 2. Each version same for all paths through antialiased code. Joins (in join_stroke_path_test_case.py) DONE 1. Each version same for all paths through aliased code. DONE 2. Each version same for all paths through antialiased code. Dashed Lines *. Should be tested for all versions of aliasing and all versions of join, cap. Curved Lines DONE *. curve_to Note: There are numerous comments in code that refer to implementation details (outline, outline_aa, scanline_aa, etc.) from the C++ code. These are largely to help keep track of what paths have been tested. """ import unittest from numpy import array, alltrue, ravel from kiva.agg import GraphicsContextArray import kiva from .test_utils import Utils class StrokePathTestCase(unittest.TestCase, Utils): def test_alias_width_one(self): """ The fastest path through the stroke path code is for aliased path with width=1. It is reasonably safe here not to worry with testing all the CAP/JOIN combinations because they are all rendered the same for this case. It is handled by the agg::rasterizer_outline and the agg::renderer_primitives classes in C++. Energy for an aliased horizontal line of width=1 falls within a single line of pixels. With y=0 for this line, the engine should paint a single row of zeros along the bottom edge of the bmp array. """ gc = GraphicsContextArray((3, 2), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(0, 0) gc.line_to(3, 0) # These settings allow the fastest path. gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(False) gc.set_line_width(1) gc.stroke_path() # test a single color channel. desired = array(((255,255,255), ( 0, 0, 0))) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(actual, desired) def test_alias_width_two_outline_aa(self): """ When width>1, alias text is drawn using a couple of different paths through the underlying C++ code. This test the faster of the two which uses the agg::rasterizer_outline_aa C++ code. It is only used when 2<=width<=10, and cap is ROUND or BUTT, and join is MITER The C++ classes used in the underlying C++ code for this is agg::rasterizer_outline_aa and agg::renderer_outline_aa """ gc = GraphicsContextArray((3, 2), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(0, 0) gc.line_to(3, 0) # Settings allow the 2nd fastest path. gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(False) gc.set_line_width(2) gc.set_line_cap(kiva.CAP_ROUND) gc.set_line_join(kiva.JOIN_MITER) gc.stroke_path() # test a single color channel. desired = array(((255, 255, 255), ( 0, 0, 0))) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(actual, desired) def test_alias_width_two_scanline_aa(self): """ When width > 1, alias text is drawn using a couple of different paths through the underlying C++ code. This test the slower of the two which uses the agg::rasterizer_scanline_aa C++ code. We've set the line join to bevel to trigger this path. """ gc = GraphicsContextArray((3, 2), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(0, 0) gc.line_to(3, 0) # Settings allow the 2nd fastest path. gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(False) gc.set_line_width(2) gc.set_line_cap(kiva.CAP_ROUND) gc.set_line_join(kiva.JOIN_BEVEL) gc.stroke_path() # test a single color channel. desired = array(((255, 255, 255), ( 0, 0, 0))) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(actual, desired) ######################################################################### # Cap Tests ######################################################################### def cap_equality_helper(self, antialias, width, line_cap, line_join, size=(6,6)): gc = GraphicsContextArray(size, pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(2, 3) gc.line_to(4, 3) # Settings allow the faster outline path through C++ code gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(antialias) gc.set_line_width(width) gc.set_line_cap(line_cap) gc.set_line_join(line_join) gc.stroke_path() return gc def test_alias_cap_round(self): """ Round caps should extend beyond the end of the line. We don't really test the shape here. To do this, a test of a wider line would be needed. fix me: This is rendering antialiased end points currently. """ gc = GraphicsContextArray((6,6), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(2, 3) gc.line_to(4, 3) # Set up line gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(False) gc.set_line_width(2) gc.set_line_cap(kiva.CAP_ROUND) gc.set_line_join(kiva.JOIN_MITER) gc.stroke_path() desired = array(((255, 255, 255, 255, 255, 255), (255, 255, 255, 255, 255, 255), (255, 0, 0, 0, 0, 255), (255, 0, 0, 0, 0, 255), (255, 255, 255, 255, 255, 255), (255, 255, 255, 255, 255, 255))) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) def test_alias_cap_round_equality(self): """ There are two paths that can generate aliased round capped lines. This tests that they generate equivalent results fix me: This test fails because the two rendering paths render the end caps differently. """ antialias = False width = 2 cap = kiva.CAP_ROUND # join=miter allows the faster outline path through C++ code. gc1 = self.cap_equality_helper(antialias, width, cap, kiva.JOIN_MITER) # join=bevel forces the scanline path through C++ code. gc2 = self.cap_equality_helper(antialias, width, cap, kiva.JOIN_BEVEL) # Instead of testing against a known desired value, we are simply # testing for equality... self.assertRavelEqual(gc1.bmp_array[:,:,0], gc2.bmp_array[:,:,0]) def test_alias_cap_square(self): """ Round caps should extend beyond the end of the line. by half the width of the line. fix me: This is rendering antialiased end points currently. """ gc = GraphicsContextArray((6,6), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(2, 3) gc.line_to(4, 3) # Set up line gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(False) gc.set_line_width(2) gc.set_line_cap(kiva.CAP_SQUARE) gc.set_line_join(kiva.JOIN_MITER) gc.stroke_path() desired = array(((255, 255, 255, 255, 255, 255), (255, 255, 255, 255, 255, 255), (255, 255, 0, 0, 255, 255), (255, 255, 0, 0, 255, 255), (255, 255, 255, 255, 255, 255), (255, 255, 255, 255, 255, 255))) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) def test_alias_cap_square(self): """ Square caps should extend beyond the end of the line. by half the width of the line. """ gc = GraphicsContextArray((6,6), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(2, 3) gc.line_to(4, 3) # Set up line gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(False) gc.set_line_width(2) gc.set_line_cap(kiva.CAP_SQUARE) gc.set_line_join(kiva.JOIN_MITER) gc.stroke_path() desired = array(((255, 255, 255, 255, 255, 255), (255, 255, 255, 255, 255, 255), (255, 0, 0, 0, 0, 255), (255, 0, 0, 0, 0, 255), (255, 255, 255, 255, 255, 255), (255, 255, 255, 255, 255, 255))) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) def test_alias_cap_butt_equality(self): """ There are two paths that can generate aliased butt capped lines. This tests that they generate equivalent results """ antialias = False width = 2 cap = kiva.CAP_BUTT # join=miter allows the faster outline path through C++ code. gc1 = self.cap_equality_helper(antialias, width, cap, kiva.JOIN_MITER) # join=bevel forces the scanline path through C++ code. gc2 = self.cap_equality_helper(antialias, width, cap, kiva.JOIN_BEVEL) # Instead of testing against a known desired value, we are simply # testing for equality... self.assertRavelEqual(gc1.bmp_array, gc2.bmp_array) def test_alias_cap_square(self): """ Square caps should extend beyond the end of the line. by half the width of the line. """ gc = GraphicsContextArray((6,6), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(2, 3) gc.line_to(4, 3) # Set up line gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(False) gc.set_line_width(2) gc.set_line_cap(kiva.CAP_SQUARE) gc.set_line_join(kiva.JOIN_MITER) gc.stroke_path() desired = array(((255, 255, 255, 255, 255, 255), (255, 255, 255, 255, 255, 255), (255, 0, 0, 0, 0, 255), (255, 0, 0, 0, 0, 255), (255, 255, 255, 255, 255, 255), (255, 255, 255, 255, 255, 255))) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) def test_alias_cap_square_equality(self): """ There are two paths that can generate aliased square capped lines. This tests that they generate equivalent results. """ antialias = False width = 2 cap = kiva.CAP_SQUARE # join=miter allows the faster outline path through C++ code. gc1 = self.cap_equality_helper(antialias, width, cap, kiva.JOIN_MITER) # join=bevel forces the scanline path through C++ code. gc2 = self.cap_equality_helper(antialias, width, cap, kiva.JOIN_BEVEL) # Instead of testing against a known desired value, we are simply # testing for equality... self.assertRavelEqual(gc1.bmp_array, gc2.bmp_array) def test_antialias_width_one(self): """ An anti-aliased horizontal line of width=1 has its energy centered between the bottom row of pixels and the next lower row of pixels (which is off the page). It dumps half its energy in each, so we end up with a single line of 127,127,127 pixel values in the last row of pixels. This particular set of flags is handled by the (fast) agg::rasterizer_outline_aa path through the C++ code. """ gc = GraphicsContextArray((3, 2), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(0, 0) gc.line_to(3, 0) # Set up stroke gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(True) gc.set_line_width(1) gc.set_line_cap(kiva.CAP_BUTT) gc.set_line_join(kiva.JOIN_MITER) gc.stroke_path() # test a single color channel. desired = array(((255, 255, 255), (127, 127, 127))) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) def test_antialias_width_slower_path(self): """ An anti-aliased horizontal line of width=1 has its energy centered between the bottom row of pixels and the next lower row of pixels (which is off the page). It dumps half its energy in each, so we end up with a single line of 127,127,127 pixel values in the last row of pixels. This particular set of flags is handled by the agg::rasterizer_scanline_aa path through the C++ code. """ gc = GraphicsContextArray((3, 2), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer gc.move_to(0, 0) gc.line_to(3, 0) # Set up stroke gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(True) gc.set_line_width(1) gc.set_line_cap(kiva.CAP_BUTT) gc.set_line_join(kiva.JOIN_BEVEL) gc.stroke_path() # test a single color channel. desired = array(((255, 255, 255), (127, 127, 127))) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) def test_curve_to(self): """ curve_to conv_curve happens early in the agg rendering pipeline, so it isn't neccessary to test every combination of antialias, line_cap, line_join, etc. If it works for one, we should be in good shape for the others (until the implementation is changed of course...) """ gc = GraphicsContextArray((10, 10), pix_format="rgb24") # clear background to white values (255, 255, 255) gc.clear((1.0, 1.0, 1.0)) # single horizontal line across bottom of buffer x0, y0 = 1.0, 5.0 x1, y1 = 4.0, 9.0 x2, y2 = 6.0, 1.0 x3, y3 = 9.0, 5.0 gc.move_to(x0, y0) gc.curve_to(x1, y1, x2, y2, x3, y3) # Set up stroke gc. set_stroke_color((0.0, 0.0, 0.0)) # black gc.set_antialias(True) gc.set_line_width(1) gc.set_line_cap(kiva.CAP_BUTT) gc.set_line_join(kiva.JOIN_MITER) gc.stroke_path() gc. set_stroke_color((0.0, 1.0, 1.0)) gc.move_to(x0, y0) gc.line_to(x1, y1) gc.move_to(x2, y2) gc.line_to(x3, y3) gc.stroke_path() # test a single color channel. # note: This is a "screen capture" from running this # test. It looks right, but hasn't been check closely. desired = array([[255, 255, 255, 230, 255, 255, 255, 255, 255, 255], [255, 255, 231, 25, 212, 255, 255, 255, 255, 255], [255, 252, 65, 128, 255, 255, 255, 255, 255, 255], [255, 103, 26, 143, 229, 255, 255, 255, 255, 255], [180, 2, 118, 96, 23, 189, 255, 255, 205, 255], [255, 206, 255, 255, 189, 23, 97, 119, 2, 180], [255, 255, 255, 255, 255, 229, 142, 25, 103, 255], [255, 255, 255, 255, 255, 255, 127, 66, 252, 255], [255, 255, 255, 255, 255, 212, 26, 231, 255, 255], [255, 255, 255, 255, 255, 255, 231, 255, 255, 255]]) actual = gc.bmp_array[:,:,0] self.assertRavelEqual(desired, actual) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/agg/tests/test_utils.py0000644000175000017500000000026013421603267022302 0ustar varunvarunfrom numpy import alltrue, ravel class Utils(object): def assertRavelEqual(self, x, y): self.assertTrue(alltrue(ravel(x) == ravel(y)), "\n%s\n !=\n%s" % (x, y)) enthought-chaco2-4.8.1.orig/kiva/agg/tests/affine_matrix_test_case.py0000644000175000017500000001042613421603267024756 0ustar varunvarunfrom math import pi import unittest from numpy import array, allclose, ones, alltrue from kiva import agg class AffineMatrixTestCase(unittest.TestCase): def test_init(self): m = agg.AffineMatrix() def test_init_from_array(self): a = ones(6,'d') m = agg.AffineMatrix(a) desired = ones(6,'d') result = m.asarray() assert(alltrue(result == desired)) def test_init_from_array1(self): a = ones(6,'D') try: m = agg.AffineMatrix(a) except NotImplementedError: pass # can't init from complex value. def test_init_from_array2(self): a = ones(7,'d') try: m = agg.AffineMatrix(a) except ValueError: pass # can't init from array that isn't 6 element. def test_init_from_array3(self): a = ones((2,3),'d') try: m = agg.AffineMatrix(a) except ValueError: pass # can't init from array that isn't 1d. def test_imul(self): a = agg.AffineMatrix((2.0,0,0,2.0,0,0)) a *= a actual = a desired = agg.AffineMatrix((4.0,0,0,4.0,0,0)) assert(alltrue(desired==actual)) def test_asarray(self): m = agg.AffineMatrix() result = m.asarray() desired = array((1.0,0.0,0.0,1.0,0.0,0.0)) assert(alltrue(result == desired)) def _test_zero_arg_transform(self,method, orig, desired): m = agg.AffineMatrix(orig) method(m) result = m.asarray() assert(alltrue(result == desired)) def test_flip_x(self): method = agg.AffineMatrix.flip_x orig = array((1.0,2.0,3.0,1.0,4.0,5.0)) desired = array([-1.,-2.,3.,1.,-4.,5.]) self._test_zero_arg_transform(method,orig,desired) def test_flip_y(self): method = agg.AffineMatrix.flip_y orig = array((1.0,2.0,3.0,1.0,4.0,5.0)) desired = array([ 1.,2.,-3.,-1.,4.,-5.]) self._test_zero_arg_transform(method,orig,desired) def test_reset(self): method = agg.AffineMatrix.reset orig = array((1.0,2.0,3.0,1.0,4.0,5.0)) desired = array([ 1.,0.,0.,1.,0.,0.]) self._test_zero_arg_transform(method,orig,desired) def test_multiply(self): orig = array((1.0,2.0,3.0,1.0,4.0,5.0)) desired = array([ 7.,4.,6.,7.,23.,18.]) m = agg.AffineMatrix(orig) other = agg.AffineMatrix(orig) m.multiply(other) result = m.asarray() assert(alltrue(result == desired)) def test_determinant(self): orig = array((1.0,2.0,3.0,1.0,4.0,5.0)) desired = -5.0 m = agg.AffineMatrix(orig) result = m.determinant() assert(alltrue(result == desired)) def test_invert(self): orig = agg.AffineMatrix((1.0,2.0,3.0,1.0,4.0,5.0)) orig.invert() actual = orig.asarray() desired = array([-0.2,0.4,0.6,-0.2,-2.2,-0.6]) assert(allclose(desired,actual)) def test_rotation_matrix(self): val = agg.rotation_matrix(pi/2.) desired = array([ 0.0,1.0,-1.0,0.0,0.0,0.0]) actual = val.asarray() assert(allclose(desired,actual)) def test_translation_matrix(self): val = agg.translation_matrix(2.0,3.0) desired = array([ 1.0,0.0,0.0,1.0,2.0,3.0]) actual = val.asarray() assert(allclose(desired,actual)) def test_scaling_matrix(self): val = agg.scaling_matrix(4.0,4.0) desired = array([ 4.0,0.0,0.0,4.0,0.0,0.0]) actual = val.asarray() assert(allclose(desired,actual)) def test_skewing_matrix(self): val = agg.skewing_matrix(pi/4.,pi/4.) desired = array([ 1.0,1.0,1.0,1.0,0.0,0.0]) actual = val.asarray() assert(allclose(desired,actual)) #---------------------------------------------------------------------------- # test setup code. #---------------------------------------------------------------------------- def test_suite(level=1): suites = [] if level > 0: suites.append( unittest.makeSuite(AffineMatrixTestCase,'test_') ) total_suite = unittest.TestSuite(suites) return total_suite def test(level=10): all_tests = test_suite(level) runner = unittest.TextTestRunner() runner.run(all_tests) return runner if __name__ == "__main__": test() enthought-chaco2-4.8.1.orig/kiva/agg/tests/rgba_test_case.py0000644000175000017500000000316313421603267023055 0ustar varunvarunimport unittest from numpy import array, ones from kiva import agg from .test_utils import Utils class RgbaTestCase(unittest.TestCase, Utils): def test_init(self): m = agg.Rgba() def test_init1(self): m = agg.Rgba(.5,.5,.5) desired = array((.5,.5,.5,1.0)) self.assertRavelEqual(m.asarray(),desired) def test_init_from_array1(self): a = ones(3,'d') * .8 m = agg.Rgba(a) desired = ones(4,'d') * .8 desired[3] = 1.0 result = m.asarray() self.assertRavelEqual(result, desired) def test_init_from_array2(self): a = ones(4,'d') * .8 m = agg.Rgba(a) desired = ones(4,'d') * .8 result = m.asarray() self.assertRavelEqual(result, desired) def test_init_from_array3(self): a = ones(5,'d') try: m = agg.Rgba(a) except ValueError: pass # can't init from array that isn't 6 element. def test_init_from_array4(self): a = ones((2,3),'d') try: m = agg.Rgba(a) except ValueError: pass # can't init from array that isn't 1d. def test_gradient(self): first = agg.Rgba(0.,0.,0.,0.) second = agg.Rgba(1.,1.,1.,1.) actual = first.gradient(second,.5).asarray() desired = array((.5,.5,.5,.5)) self.assertRavelEqual(actual, desired) def test_pre(self): first = agg.Rgba(1.0,1.0,1.0,0.5) actual = first.premultiply().asarray() desired = array((.5,.5,.5,.5)) self.assertRavelEqual(actual, desired) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/agg/todo.txt0000644000175000017500000000762213233644505020107 0ustar varunvarun Constructor ----------- DONE *. GraphicsContextArray constructor should call the clear() method after construction if it allocates the underlying Numeric array. If the array is passed in, clear() should not be called. clear(), clear_rect(), clear_rects() ------------------------------------ *. Implement a clear_rect that takes a rect argument. Users can either specify an optional alpha value or a full color to be used when clearing the rectangle. If the color is RGB, then alpha is assumed to be 1.0. The default will clear the rect to white with an alpha value of 1 (i.e. (1,1,1,1)). The CTM is used to transform the input rects. Currently, the method will fail if their is any rotation to the ctm. *. Implement a clear_rects that takes a rect list. Otherwise, it behaves identically to clear_rect. *. The clear() method behaves identically to clear_rect, accept you don't need to pass in a rectangle. Instead to ?erase()? so that clear can stick with the clear_rect semantics. path creation methods --------------------- *. Implement arc and arc_to. path rendering -------------- *. Fix fill_path() to handle all the features currently handled in the stroke_path() pipeline. *. Fix draw_image() to handle all the features currently handled in the stroke_path() pipeline. Text ---- *. Implement show_text() natively in agg. Allow switch between native/freetype on "the fly". *. Implement a measure_text() method in the kiva interface that returns the height, width, and vertical and horizontal letting for a string. This is returned in user coordinates. Do we also have need to return the device coordinates boudning box for the text? Clipping -------- *. Implement clipping renderer in agg that can work with Dave's non-overlapping rectangles calculated in Python code). *. Re-implement algorithm for calculating non-overlapping rectangles down into kiva-agg C++ code. *. API call to get access to the list of rectangles. Or, and API to test whether a rectangle overlaps the list of rectangles. Dave needs this for high level clipping (to determine if a widget needs repainting). *. Build algorithm to create optimal non-overlapping rectangles set to use for rendering. Code Reorganization ------------------- *. Reorganize code base so that: a. Library is usable from C++ b. Python interface files are separated out of C++ code. c. Organize C++ code so that it is easier to work with. Group related methods together and try and work around having the graphics_context stuff spread out across 4 files (.h, .cpp files for graphics_context and graphics_context_base) *. Make an enthought branch with enable and kiva so that we can port the enable to kiva. Work on Dependent Libraries --------------------------- *. Port enable to new kiva backend. *. Port chaco to use compiled paths wherever possible. Other Features -------------- *. Draft Mode flag Not sure if we need this, but it might be nice to set this flag and ask kiva to use the fastest possible underlying paths at the expense of accuracy. This might be worth while for scroll or drag operations. *. Patterns -- repeated images *. Transparency layers *. Gradients *. Shadows *. Color spaces *. Mask arraays *. Arbitrary clip paths *. SVG reader/renderer. This would allow us to use SVG objects saved out of Graphics programs instead of bitmaps for our buttons/controls/etc. *. SSE optimizations. *. OpenGL optimizations. enthought-chaco2-4.8.1.orig/kiva/agg/src/0000755000175000017500000000000013544357627017174 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/src/font_type.i0000644000175000017500000000447213233644505021351 0ustar varunvarun%{ #include "kiva_font_type.h" %} %include "agg_std_string.i" namespace kiva { %rename(AggFontType) font_type; class font_type { public: %mutable; int size; std::string name; int family; int style; int encoding; std::string filename; // constructor font_type(std::string _name="Arial", int _size=12, int _family=0, int _style=0, int _encoding=0, bool validate=true); int change_filename(std::string _filename); bool is_loaded(); }; } %extend kiva::font_type { char *__repr__() { static char tmp[1024]; // Write out elements of trans_affine in a,b,c,d,tx,ty order // !! We should work to make output formatting conform to // !! whatever it Numeric does (which needs to be cleaned up also). sprintf(tmp,"Font(%s,%d,%d,%d,%d)", self->name.c_str(), self->family, self->size, self->style, self->encoding); return tmp; } int __eq__(kiva::font_type& other) { return (self->name == other.name && self->family == other.family && self->size == other.size && self->style == other.style && self->encoding == other.encoding); } } %pythoncode %{ def unicode_safe_init(self, _name="Arial", _size=12, _family=0, _style=0, _encoding=0, validate=True): ### HACK: C++ stuff expects a string (not unicode) for the face_name, so fix ### if needed. ### Only for python < 3 if '' == b'': if isinstance(_name, unicode): _name = _name.encode("latin1") else: if isinstance(_name, bytes): _name = _name.decode() obj = _agg.new_AggFontType(_name, _size, _family, _style, _encoding, validate) _swig_setattr(self, AggFontType, "this", obj) _swig_setattr(self, AggFontType, "thisown", 1) # This is a crappy way of overriding the constructor AggFontType.__init__ = unicode_safe_init %} enthought-chaco2-4.8.1.orig/kiva/agg/src/agg_typemaps.i0000644000175000017500000002710313477706655022035 0ustar varunvarun// -------------------------------------------------------------------------- // Generic typemap to handle enumerated types. // // Both agg and kiva have quite a few enumerated types. SWIG will wrap // functions that use these as arguments to require a pointer to an // enumerated type object. This isn't very convenient. It is much nicer // to just pass an integer. this generic converter can be used in to // allow this. // // To apply it to a type, for example agg24::marker_e, do the following // // %apply(kiva_enum_typemap) { agg24::marker_e } // // Now any function that expects a marker_e will accept integer values as // input. // -------------------------------------------------------------------------- %include "numeric.i" %typemap(in) kiva_enum_typemap type { int temp = PyInt_AsLong($input); if (PyErr_Occurred()) SWIG_fail; $1 = $1_ltype(temp); } // -------------------------------------------------------------------------- // Typemaps for (double x, double y) points // // For: * // // This is useful for places where ints may be passed in and need to // be converted. Python 2.6 requires this // -------------------------------------------------------------------------- %typemap(in) double x, double y { if (PyNumber_Check($input)) { $1 = static_cast(PyFloat_AsDouble($input)); } else { SWIG_exception(SWIG_TypeError, "Expected argument $argnum of type '$1_type'"); } } // -------------------------------------------------------------------------- // Typemaps for (double* pts, int Npts) used in lines() // // For: compiled_path and graphics_context // // This typemap takes any Nx2 input (nested sequences or an Nx2 array). If // the input has the wrong shape or can't be converted to a double, an // exception is raised. It is more efficient if the input passed in is a // contiguous array, so if you're calling lines(pts) a lot of times, make // pts an array. // // -------------------------------------------------------------------------- %typemap(in) (double* point_array, int point_count) (PyArrayObject* ary=NULL, int is_new_object) { ary = obj_to_array_contiguous_allow_conversion($input, PyArray_DOUBLE, is_new_object); int size[2] = {-1,2}; if (!ary || !require_dimensions(ary,2) || !require_size(ary,size,2)) { goto fail; } $1 = (double*) ary->data; $2 = ary->dimensions[0]; } %typemap(freearg) (double* point_array, int point_count) { if (is_new_object$argnum) { Py_XDECREF(ary$argnum); } } // -------------------------------------------------------------------------- // Typemaps for (unsigned char* results, int Nresults) // // For: points_in_polygon // // This typemap takes any N input. // // -------------------------------------------------------------------------- %typemap(in) (unsigned char* results, int Nresults) (PyArrayObject* ary=NULL, int is_new_object) { ary = obj_to_array_contiguous_allow_conversion($input, PyArray_BOOL, is_new_object); int size[1] = {-1}; if (!ary || !require_dimensions(ary,1) || !require_size(ary,size,1)) { goto fail; } $1 = (unsigned char*) ary->data; $2 = ary->dimensions[0]; } %typemap(freearg) (unsigned char* results, int Nresults) { if (is_new_object$argnum) { Py_XDECREF(ary$argnum); } } /* Typemaps for rects(double* all_rects, int Nrects) For: compiled_path and graphics_context This typemap takes any Nx4 input (nested sequences or an Nx4 array). If the input has the wrong shape or can't be converted to a double, an exception is raised. It is more efficient if the input passed in is a contiguous array, so if you're calling rects(all_rects) a lot of times, make all_rects an array. */ %typemap(in) (double* rect_array, int rect_count) (PyArrayObject* ary=NULL, int is_new_object) { ary = obj_to_array_contiguous_allow_conversion($input, PyArray_DOUBLE, is_new_object); int size[2] = {-1,4}; if (!ary || !require_dimensions(ary,2) || !require_size(ary,size,2)) { goto fail; } $1 = (double*) ary->data; $2 = ary->dimensions[0]; } %typemap(freearg) (double* rect_array, int rect_count) { if (is_new_object$argnum) { Py_XDECREF(ary$argnum); } } // -------------------------------------------------------------------------- // // vertex() returns ( pt, cmd) where pt is a tuple (x,y) // // This tells SWIG to treat an double * argument with name 'x' as // an output value. We'll append the value to the current result which // is guaranteed to be a List object by SWIG. // -------------------------------------------------------------------------- %typemap(in,numinputs=0) (double *vertex_x, double* vertex_y)(double temp1, double temp2) { temp1 = 0; $1 = &temp1; temp2 = 0; $2 = &temp2; } %typemap(argout) (double *vertex_x, double* vertex_y) { PyObject *px = PyFloat_FromDouble(*$1); PyObject *py = PyFloat_FromDouble(*$2); PyObject *pt = PyTuple_New(2); PyTuple_SetItem(pt,0,px); PyTuple_SetItem(pt,1,py); PyObject *return_val = PyTuple_New(2); PyTuple_SetItem(return_val,0,pt); // result is what was returned from vertex PyTuple_SetItem(return_val,1,$result); //Py_DECREF($result); $result = return_val; } // -------------------------------------------------------------------------- // map to output arguments into a 2-tuple // -------------------------------------------------------------------------- %typemap(in,numinputs=0) (double *pt_x, double* pt_y)(double temp1, double temp2) { temp1 = 0; $1 = &temp1; temp2 = 0; $2 = &temp2; } %typemap(argout) (double *pt_x, double *pt_y) { PyObject *px = PyFloat_FromDouble(*$1); PyObject *py = PyFloat_FromDouble(*$2); PyObject *pt = PyTuple_New(2); PyTuple_SetItem(pt,0,px); PyTuple_SetItem(pt,1,py); //Py_DECREF($result); $result = pt; } // -------------------------------------------------------------------------- // map an 6 element double* output into a Numeric array. // -------------------------------------------------------------------------- %typemap(in, numinputs=0) double *array6 (double temp[6]) { $1 = temp; } %typemap(argout) double *array6 { // Append output value $1 to $result npy_intp dims = 6; PyArrayObject* ary_obj = (PyArrayObject*) PyArray_SimpleNew(1,&dims,PyArray_DOUBLE); if( ary_obj == NULL ) return NULL; double* data = (double*)ary_obj->data; for (int i=0; i < 6;i++) data[i] = $1[i]; Py_DECREF($result); $result = PyArray_Return(ary_obj); } // -------------------------------------------------------------------------- // Typemaps for graphics_context.set_line_dash() // // For: // // This typemap takes None or any N element input (sequence or array). If // the input is None, it passes a 2 element array of zeros to in as the // pattern. If the input is a sequence and isn't 1D or can't be converted // to a double, an exception is raised. // -------------------------------------------------------------------------- %typemap(in) (double* dash_pattern, int n) (PyArrayObject* ary=NULL, int is_new_object, double temp[2]) { is_new_object = 0; if ($input == Py_None) { temp[0] = 0.0; temp[1] = 0.0; $1 = temp; $2 = 2; } else { ary = obj_to_array_contiguous_allow_conversion($input, PyArray_DOUBLE, is_new_object); if (!ary || !require_dimensions(ary,1)) { goto fail; } $1 = (double*) ary->data; $2 = ary->dimensions[0]; } } %typemap(freearg) (double* dash_pattern, int n) { if (is_new_object$argnum) { Py_XDECREF(ary$argnum); } } // -------------------------------------------------------------------------- // Image typemaps // // Currently, this requires a contiguous array. It should be fixed to // allow arrays that are only contiguous along the last two dimensions. // This is because the windows bitmap format requires that each row of // pixels (scan line) is word aligned (16 bit boundaries). As a result, rgb // images compatible with this format potentially // need a pad byte at the end of each scanline. // -------------------------------------------------------------------------- %typemap(in) (unsigned char *image_data=NULL, int width, int height, int stride) { PyArrayObject* ary = obj_to_array_no_conversion($input, PyArray_UBYTE); int dimensions[2] = {2,3}; // !! No longer requiring contiguity because some bitmaps are padded at the // !! end (i.e. Windows). We should probably special case that one though, // !! and re-instate the contiguous policy... // if (!ary || // !require_dimensions(ary,dimensions,2) || // !require_contiguous(ary)) if (!ary || !require_dimensions(ary,dimensions,2)) { goto fail; } $1 = (unsigned char*) ary->data; // notice reversed orders... $2 = ary->dimensions[1]; $3 = ary->dimensions[0]; $4 = ary->strides[0]; } // -------------------------------------------------------------------------- // Some functions create new objects and return these to python. By // default, SWIG sets these objects as "unowned" by the shadow class // created to represent them in python. The result is that these objects // are not freed when the shadow object calls its __del__ method. Here // the thisown flag is set to 1 so that the object will be destroyed on // destruction. // -------------------------------------------------------------------------- %typemap(out) owned_pointer { $result = SWIG_NewPointerObj((void *) $1, $1_descriptor, 1); } //--------------------------------------------------------------------- // Gradient support //--------------------------------------------------------------------- %typemap(in) std::vector (PyArrayObject* ary=NULL, int is_new_object) { PyArrayObject* ary = obj_to_array_no_conversion($input, PyArray_DOUBLE); if (ary == NULL) { goto fail; } std::vector stops; for (int i = 0; i < ary->dimensions[0]; i++) { // the stop is offset, red, green, blue, alpha double* data = (double*)(ary->data); agg24::rgba8 color(data[5*i+1]*255, data[5*i+2]*255, data[5*i+3]*255, data[5*i+4]*255); stops.push_back(kiva::gradient_stop(data[5*i], color)); } $1 = stops; } %typemap(in) const char* gradient_arg (PyObject *utfstr=NULL) { if (PyBytes_Check($input)) { $1 = (char *)PyBytes_AsString($input); } #if PY_VERSION_HEX >= 0x03030000 else if (PyUnicode_Check($input)) { $1 = (char *)PyUnicode_AsUTF8($input); } #elif PY_VERSION_HEX < 0x03000000 else if (PyUnicode_Check($input)) { utfstr = PyUnicode_AsUTF8String($input); $1 = (char *)PyString_AsString(utfstr); } #endif else { PyErr_SetString(PyExc_TypeError, "not a string"); return NULL; } } %typemap(freearg) const char* gradient_arg { if (utfstr$argnum) { Py_DECREF(utfstr$argnum); } } enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_gradient.h0000644000175000017500000002503713233644505022150 0ustar varunvarun#ifndef KIVA_GRADIENT_H #define KIVA_GRADIENT_H #include #include #include #include "agg_pixfmt_rgb.h" #include "agg_rasterizer_scanline_aa.h" #include "agg_renderer_scanline.h" #include "agg_scanline_u.h" #include "agg_span_gradient.h" #include "agg_span_allocator.h" #include "agg_span_interpolator_linear.h" #include "agg_renderer_mclip.h" #include "kiva_affine_helpers.h" #include "kiva_constants.h" namespace kiva { class gradient_stop { public: double offset; agg24::rgba8 color; gradient_stop(double offset, agg24::rgba8& color) : offset(offset), color(color) { } }; class gradient { public: typedef std::pair point; std::vector points; std::vector stops; gradient_type_e gradient_type; gradient_spread_e spread_method; gradient_units_e units; private: agg24::trans_affine affine_mtx; public: gradient(gradient_type_e gradient_type); gradient(gradient_type_e gradient_type, std::vector points, std::vector stops, const char* spread_method, const char* units="userSpaceOnUse"); ~gradient(); template void apply(pixfmt_type pixfmt, agg24::rasterizer_scanline_aa<>* ras, agg24::renderer_mclip* rbase) { if (this->gradient_type == kiva::grad_linear) { if (this->points[0].first == this->points[1].first) { agg24::gradient_y grad_func; // apply the proper fill adapter based on the spread method if (this->spread_method == kiva::reflect) { agg24::gradient_reflect_adaptor adaptor(grad_func); this->_apply(pixfmt, ras, rbase, adaptor); } else if (this->spread_method == kiva::repeat) { agg24::gradient_repeat_adaptor adaptor(grad_func); this->_apply(pixfmt, ras, rbase, adaptor); } else { this->_apply(pixfmt, ras, rbase, grad_func); } } else if (this->points[0].second == this->points[1].second) { agg24::gradient_x grad_func; // apply the proper fill adapter based on the spread method if (this->spread_method == kiva::reflect) { agg24::gradient_reflect_adaptor adaptor(grad_func); this->_apply(pixfmt, ras, rbase, adaptor); } else if (this->spread_method == kiva::repeat) { agg24::gradient_repeat_adaptor adaptor(grad_func); this->_apply(pixfmt, ras, rbase, adaptor); } else { this->_apply(pixfmt, ras, rbase, grad_func); } } else { agg24::gradient_x grad_func; // apply the proper fill adapter based on the spread method if (this->spread_method == kiva::reflect) { agg24::gradient_reflect_adaptor adaptor(grad_func); this->_apply(pixfmt, ras, rbase, adaptor); } else if (this->spread_method == kiva::repeat) { agg24::gradient_repeat_adaptor adaptor(grad_func); this->_apply(pixfmt, ras, rbase, adaptor); } else { this->_apply(pixfmt, ras, rbase, grad_func); } } } else { agg24::gradient_radial_focus grad_func(points[1].first, points[2].first - points[0].first, points[2].second - points[0].second); if (this->spread_method == kiva::reflect) { agg24::gradient_reflect_adaptor adaptor(grad_func); this->_apply(pixfmt, ras, rbase, adaptor); } else if (this->spread_method == kiva::repeat) { agg24::gradient_repeat_adaptor adaptor(grad_func); this->_apply(pixfmt, ras, rbase, adaptor); } else { this->_apply(pixfmt, ras, rbase, grad_func); } } } void set_ctm(const agg24::trans_affine& mtx) { this->affine_mtx = mtx; } protected: template void _apply(pixfmt_type pixfmt, agg24::rasterizer_scanline_aa<>* ras, agg24::renderer_mclip* rbase, gradient_func_type gradient_func) { typedef agg24::renderer_mclip renderer_base_type; typedef agg24::span_interpolator_linear<> interpolator_type; typedef agg24::span_allocator span_allocator_type; typedef agg24::pod_auto_array color_array_type; typedef agg24::span_gradient span_gradient_type; typedef agg24::renderer_scanline_aa renderer_gradient_type; agg24::trans_affine gradient_mtx; // Affine transformer interpolator_type span_interpolator(gradient_mtx); // Span interpolator span_allocator_type span_allocator; // Span Allocator color_array_type color_array; // Gradient colors agg24::scanline_u8 scanline; double dx = points[1].first - points[0].first; double dy = points[1].second - points[0].second; double d1 = 0, d2 = 0; if ((this->gradient_type == kiva::grad_radial) && (this->points.size() >2)) { // length is the radius d2 = points[1].first; } else if (this->gradient_type == kiva::grad_linear) { // length is the distance between the two points d2 = sqrt(dx * dx + dy * dy); if (points[0].first == points[1].first) { // gradient_y. handle flips gradient_mtx *= agg24::trans_affine_rotation(atan2(0.0, dy)); } else if (points[0].second == points[1].second) { // gradient_x. handle flips gradient_mtx *= agg24::trans_affine_rotation(atan2(0.0, dx)); } else { // general case: arbitrary rotation gradient_mtx *= agg24::trans_affine_rotation(atan2(dy, dx)); } } gradient_mtx *= agg24::trans_affine_translation(points[0].first, points[0].second); if (this->units == kiva::user_space) { gradient_mtx *= this->affine_mtx; } gradient_mtx.invert(); //std::cout << "drawing with affine matrix " << gradient_mtx.m0 // << ", " << gradient_mtx.m1 // << ", " << gradient_mtx.m2 // << ", " << gradient_mtx.m3 // << ", " << gradient_mtx.m4 // << ", " << gradient_mtx.m5 << std::endl; span_gradient_type span_gradient(span_interpolator, gradient_func, color_array, d1, d2); renderer_gradient_type grad_renderer(*rbase, span_allocator, span_gradient); this->fill_color_array(color_array); agg24::render_scanlines(*ras, scanline, grad_renderer); } template void fill_color_array(Array& array) { // The agg24::rgb::gradient function is not documented, so here's // my guess at what it does: the first argument is obvious, // since we are constructing a gradient from one color to another. // The 2nd argument is a float, which must be between 0 and 1, and // represents the ratio of the first color to the second color. // Hence, it should always go from 0->1. In a multi-stop scenario // we will loop through the stops, for each pair the gradient call // will go from 0% to 100% of the 2nd color. // I hope that makes sense. std::vector::iterator stop_it = this->stops.begin(); double offset = 0.0; unsigned int i = 0; unsigned int const array_size = array.size(); for (; stop_it+1 != this->stops.end(); stop_it++) { std::vector::iterator next_it = stop_it+1; double offset_range = next_it->offset - stop_it->offset; while ( (offset <= next_it->offset) && (i < array_size)) { array[i++] = stop_it->color.gradient(next_it->color, (offset-stop_it->offset)/offset_range); offset = i/double(array_size-1); } } } }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_rect.cpp0000755000175000017500000002541713233644505021650 0ustar varunvarun#include "kiva_rect.h" #include #include #include #include namespace kiva { rect_type disjoint_intersect(const rect_type &a, const rect_type &b) { double xl = max(a.x, b.x); double yb = max(a.y, b.y); double xr = min(a.x2(), b.x2()); double yt = min(a.y2(), b.y2()); if ((xr >= xl) && (yt >= yb)) { return rect_type(xl, yb, xr-xl, yt-yb); } else { return rect_type(xl, yb, -1, -1); } } rect_list_type disjoint_intersect(const rect_list_type &rects) { if (rects.size() < 2) { return rects; } rect_list_type result_list; result_list.push_back(rects[0]); for (unsigned int i=1; i= 0) && (result_rect.h >= 0)) { result_list.push_back(result_rect); } } return result_list; } rect_list_type disjoint_union(const rect_type &a, const rect_type &b) { rect_list_type rlist; rlist.push_back(a); return disjoint_union(rlist, b); } rect_list_type disjoint_union(const rect_list_type &rects) { if (rects.size() < 2) { return rects; } rect_list_type rlist; rlist.push_back(rects[0]); for (unsigned int i=1; ix; double yb1 = cur_todo->y; double xr1 = cur_todo->x2(); double yt1 = cur_todo->y2(); double xl2, yb2, xr2, yt2; unsigned int orig_count = 0; while (orig_count < original_list.size()) { rect_type *cur_orig = &original_list[orig_count]; xl2 = cur_orig->x; yb2 = cur_orig->y; xr2 = cur_orig->x2(); yt2 = cur_orig->y2(); // Test for non-overlapping if ((xl1 >= xr2) || (xr1 <= xl2) || (yb1 >= yt2) || (yt1 <= yb2)) { orig_count++; continue; } // Test for new rect being wholly contained in an existing one bool x1inx2 = ((xl1 >= xl2) && (xr1 <= xr2)); bool y1iny2 = ((yb1 >= yb2) && (yt1 <= yt2)); if (x1inx2 && y1iny2) { use_leftover = false; break; } // Test for existing rect being wholly contained in new rect bool x2inx1 = ((xl2 >= xl1) && (xr2 <= xr1)); bool y2iny1 = ((yb2 >= yb1) && (yt2 <= yt1)); if (x2inx1 && y2iny1) { // Erase the existing rectangle from the original_list // and set the iterator to the next one. original_list.erase(original_list.begin() + orig_count); continue; } // Test for rect 1 being within rect 2 along the x-axis: if (x1inx2) { if (yb1 < yb2) { if (yt1 > yt2) { todo.push_back(rect_type(xl1, yt2, xr1-xl1, yt1-yt2)); } yt1 = yb2; } else { yb1 = yt2; } orig_count++; continue; } // Test for rect 2 being within rect 1 along the x-axis: if (x2inx1) { if (yb2 < yb1) { if (yt2 > yt1) { original_list.insert(original_list.begin() + orig_count, rect_type(xl2, yt1, xr2-xl2, yt2-yt1)); orig_count++; } original_list[orig_count] = rect_type(xl2, yb2, xr2-xl2, yb1-yb2); } else { original_list[orig_count] = rect_type(xl2, yt1, xr2-xl2, yt2-yt1); } orig_count++; continue; } // Test for rect 1 being within rect 2 along the y-axis: if (y1iny2) { if (xl1 < xl2) { if (xr1 > xr2) { todo.push_back(rect_type(xr2, yb1, xr1-xr2, yt1-yb1)); } xr1 = xl2; } else { xl1 = xr2; } orig_count++; continue; } // Test for rect 2 being within rect 1 along the y-axis: if (y2iny1) { if (xl2 < xl1) { if (xr2 > xr1) { original_list.insert(original_list.begin() + orig_count, rect_type(xr1, yb2, xr2-xr1, yt2-yb2)); orig_count++; } original_list[orig_count] = rect_type(xl2, yb2, xl1-xl2, yt2-yb2); } else { original_list[orig_count] = rect_type(xr1, yb2, xr2-xr1, yt2-yb2); } orig_count++; continue; } // Handle a 'corner' overlap of rect 1 and rect 2: double xl, yb, xr, yt; if (xl1 < xl2) { xl = xl1; xr = xl2; } else { xl = xr2; xr = xr1; } if (yb1 < yb2) { yb = yb2; yt = yt1; yt1 = yb2; } else { yb = yb1; yt = yt2; yb1 = yt2; } todo.push_back(rect_type(xl, yb, xr-xl, yt-yb)); orig_count++; } if (use_leftover) { additional_rects.push_back(rect_type(xl1, yb1, xr1-xl1, yt1-yb1)); } todo_count++; } for (rect_list_type::iterator it = additional_rects.begin(); it != additional_rects.end(); it++) { original_list.push_back(*it); } return original_list; } bool rect_list_contains(rect_list_type &l, rect_type &r) { return (std::find(l.begin(), l.end(), r) != l.end()); } // Test code // // There are 17 types of rectangle-rectangle intersection: // 1. no intersections // 2. new rect is contained by old rect // 3. new rect surrounds old rect // 4-7. new rect overlaps one of the four corners // 8-11. new rect overlaps (but doesn't span) one of the edges // 12-15. new rect contains one of the existing edges // 16-17. new rect overlaps (but doesn't span) two opposite edges // case 1 void test_disjoint_outside() { rect_list_type cliprects; rect_type rect1(20,20,40,40); rect_type rect2(70,20,40,40); cliprects = disjoint_union(rect1, rect2); assert(cliprects.size() == 2); assert(rect_list_contains(cliprects, rect1)); assert(rect_list_contains(cliprects, rect2)); } // cases 2 and 3 void test_disjoint_2_3() { rect_list_type cliprects; rect_type bigrect(10,10,80,80); rect_type smallrect(15,15,50,10); // case 2 cliprects = disjoint_union(bigrect, smallrect); if ((cliprects.size() != 1) || (cliprects[0] != bigrect)) { printf("Error in test_disjoint_2_3(): case 2.\n"); } // case 3 cliprects = disjoint_union(smallrect, bigrect); if ((cliprects.size() != 1) || (cliprects[0] != bigrect)) { printf("Error in test_disjoint_2_3(): case 3.\n"); } } // cases 4-7 void test_disjoint_corner() { bool all_pass = false; rect_list_type cliprects; rect_type mainrect(40,40,20,20); rect_type ul(35,55,10,10); rect_type ur(55,55,10,10); rect_type ll(35,35,10,10); rect_type lr(55,35,10,10); // upper left cliprects = disjoint_union(mainrect, ul); rect_type ul_1(35, 55, 5, 5); rect_type ul_2(35, 60, 10, 5); all_pass = (cliprects.size() == 3) && rect_list_contains(cliprects, ul_1) && \ rect_list_contains(cliprects, ul_2) && rect_list_contains(cliprects, mainrect); if (!all_pass) { printf("Error in test_disjoint_corner()i: upper left\n"); } // lower left cliprects = disjoint_union(mainrect, ll); rect_type ll_1(35, 35, 10, 5); rect_type ll_2(35, 40, 5, 5); all_pass = (cliprects.size() == 3) && rect_list_contains(cliprects, ll_1) && \ rect_list_contains(cliprects, ll_2) && rect_list_contains(cliprects, mainrect); if (!all_pass) { printf("Error in test_disjoint_corner()i: upper left\n"); } // upper right cliprects = disjoint_union(mainrect, ur); rect_type ur_1(55, 60, 10, 5); rect_type ur_2(60, 55, 5, 5); all_pass = (cliprects.size() == 3) && rect_list_contains(cliprects, ur_1) && \ rect_list_contains(cliprects, ur_2) && rect_list_contains(cliprects, mainrect); if (!all_pass) { printf("Error in test_disjoint_corner()i: upper right\n"); } // lower right cliprects = disjoint_union(mainrect, lr); rect_type lr_1(55, 35, 10, 5); rect_type lr_2(60, 40, 5, 5); all_pass = (cliprects.size() == 3) && rect_list_contains(cliprects, lr_1) && \ rect_list_contains(cliprects, lr_2) && rect_list_contains(cliprects, mainrect); if (!all_pass) { printf("Error in test_disjoint_corner()i: lower right\n"); } } // cases 8-11 void test_disjoint_edge_overlap() { return; //rect_list_type cliprects; //rect_type mainrect(40,40,20,20); } void test_disjoint_union() { test_disjoint_outside(); test_disjoint_2_3(); test_disjoint_corner(); } } // end namespace kiva enthought-chaco2-4.8.1.orig/kiva/agg/src/utf8/0000755000175000017500000000000013544357627020062 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/src/utf8/core.h0000644000175000017500000002471113477706655021174 0ustar varunvarun// Copyright 2006 Nemanja Trifunovic /* Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 #define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 #include namespace utf8 { // The typedefs for 8-bit, 16-bit and 32-bit unsigned integers // You may need to change them to match your system. // These typedefs have the same names as ones from cstdint, or boost/cstdint typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; // Helper code - not intended to be directly called by the library users. May be changed at any time namespace internal { // Unicode constants // Leading (high) surrogates: 0xd800 - 0xdbff // Trailing (low) surrogates: 0xdc00 - 0xdfff const uint16_t LEAD_SURROGATE_MIN = 0xd800u; const uint16_t LEAD_SURROGATE_MAX = 0xdbffu; const uint16_t TRAIL_SURROGATE_MIN = 0xdc00u; const uint16_t TRAIL_SURROGATE_MAX = 0xdfffu; const uint16_t LEAD_OFFSET = LEAD_SURROGATE_MIN - (0x10000 >> 10); const uint32_t SURROGATE_OFFSET = 0x10000u - (LEAD_SURROGATE_MIN << 10) - TRAIL_SURROGATE_MIN; // Maximum valid value for a Unicode code point const uint32_t CODE_POINT_MAX = 0x0010ffffu; template inline uint8_t mask8(octet_type oc) { return static_cast(0xff & oc); } template inline uint16_t mask16(u16_type oc) { return static_cast(0xffff & oc); } template inline bool is_trail(octet_type oc) { return ((utf8::internal::mask8(oc) >> 6) == 0x2); } template inline bool is_lead_surrogate(u16 cp) { return (cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX); } template inline bool is_trail_surrogate(u16 cp) { return (cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX); } template inline bool is_surrogate(u16 cp) { return (cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX); } template inline bool is_code_point_valid(u32 cp) { return (cp <= CODE_POINT_MAX && !utf8::internal::is_surrogate(cp)); } template inline typename std::iterator_traits::difference_type sequence_length(octet_iterator lead_it) { uint8_t lead = utf8::internal::mask8(*lead_it); if (lead < 0x80) return 1; else if ((lead >> 5) == 0x6) return 2; else if ((lead >> 4) == 0xe) return 3; else if ((lead >> 3) == 0x1e) return 4; else return 0; } template inline bool is_overlong_sequence(uint32_t cp, octet_difference_type length) { if (cp < 0x80) { if (length != 1) return true; } else if (cp < 0x800) { if (length != 2) return true; } else if (cp < 0x10000) { if (length != 3) return true; } return false; } enum utf_error {UTF8_OK, NOT_ENOUGH_ROOM, INVALID_LEAD, INCOMPLETE_SEQUENCE, OVERLONG_SEQUENCE, INVALID_CODE_POINT}; /// Helper for get_sequence_x template utf_error increase_safely(octet_iterator& it, octet_iterator end) { if (++it == end) return NOT_ENOUGH_ROOM; if (!utf8::internal::is_trail(*it)) return INCOMPLETE_SEQUENCE; return UTF8_OK; } #define UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(IT, END) {utf_error ret = increase_safely(IT, END); if (ret != UTF8_OK) return ret;} /// get_sequence_x functions decode utf-8 sequences of the length x template utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t& code_point) { if (it == end) return NOT_ENOUGH_ROOM; code_point = utf8::internal::mask8(*it); return UTF8_OK; } template utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t& code_point) { if (it == end) return NOT_ENOUGH_ROOM; code_point = utf8::internal::mask8(*it); UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) code_point = ((code_point << 6) & 0x7ff) + ((*it) & 0x3f); return UTF8_OK; } template utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t& code_point) { if (it == end) return NOT_ENOUGH_ROOM; code_point = utf8::internal::mask8(*it); UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) code_point = ((code_point << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff); UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) code_point += (*it) & 0x3f; return UTF8_OK; } template utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t& code_point) { if (it == end) return NOT_ENOUGH_ROOM; code_point = utf8::internal::mask8(*it); UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) code_point = ((code_point << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff); UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) code_point += (utf8::internal::mask8(*it) << 6) & 0xfff; UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) code_point += (*it) & 0x3f; return UTF8_OK; } #undef UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR template utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t& code_point) { // Save the original value of it so we can go back in case of failure // Of course, it does not make much sense with i.e. stream iterators octet_iterator original_it = it; uint32_t cp = 0; // Determine the sequence length based on the lead octet typedef typename std::iterator_traits::difference_type octet_difference_type; const octet_difference_type length = utf8::internal::sequence_length(it); // Get trail octets and calculate the code point utf_error err = UTF8_OK; switch (length) { case 0: return INVALID_LEAD; case 1: err = utf8::internal::get_sequence_1(it, end, cp); break; case 2: err = utf8::internal::get_sequence_2(it, end, cp); break; case 3: err = utf8::internal::get_sequence_3(it, end, cp); break; case 4: err = utf8::internal::get_sequence_4(it, end, cp); break; } if (err == UTF8_OK) { // Decoding succeeded. Now, security checks... if (utf8::internal::is_code_point_valid(cp)) { if (!utf8::internal::is_overlong_sequence(cp, length)){ // Passed! Return here. code_point = cp; ++it; return UTF8_OK; } else err = OVERLONG_SEQUENCE; } else err = INVALID_CODE_POINT; } // Failure branch - restore the original value of the iterator it = original_it; return err; } template inline utf_error validate_next(octet_iterator& it, octet_iterator end) { uint32_t ignored; return utf8::internal::validate_next(it, end, ignored); } } // namespace internal /// The library API - functions intended to be called by the users // Byte order mark const uint8_t bom[] = {0xef, 0xbb, 0xbf}; template octet_iterator find_invalid(octet_iterator start, octet_iterator end) { octet_iterator result = start; while (result != end) { utf8::internal::utf_error err_code = utf8::internal::validate_next(result, end); if (err_code != internal::UTF8_OK) return result; } return result; } template inline bool is_valid(octet_iterator start, octet_iterator end) { return (utf8::find_invalid(start, end) == end); } template inline bool starts_with_bom (octet_iterator it, octet_iterator end) { return ( ((it != end) && (utf8::internal::mask8(*it++)) == bom[0]) && ((it != end) && (utf8::internal::mask8(*it++)) == bom[1]) && ((it != end) && (utf8::internal::mask8(*it)) == bom[2]) ); } //Deprecated in release 2.3 template inline bool is_bom (octet_iterator it) { return ( (utf8::internal::mask8(*it++)) == bom[0] && (utf8::internal::mask8(*it++)) == bom[1] && (utf8::internal::mask8(*it)) == bom[2] ); } } // namespace utf8 #endif // header guard enthought-chaco2-4.8.1.orig/kiva/agg/src/utf8/unchecked.h0000644000175000017500000002131313477706655022170 0ustar varunvarun// Copyright 2006 Nemanja Trifunovic /* Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 #define UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 #include "core.h" namespace utf8 { namespace unchecked { template octet_iterator append(uint32_t cp, octet_iterator result) { if (cp < 0x80) // one octet *(result++) = static_cast(cp); else if (cp < 0x800) { // two octets *(result++) = static_cast((cp >> 6) | 0xc0); *(result++) = static_cast((cp & 0x3f) | 0x80); } else if (cp < 0x10000) { // three octets *(result++) = static_cast((cp >> 12) | 0xe0); *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); *(result++) = static_cast((cp & 0x3f) | 0x80); } else { // four octets *(result++) = static_cast((cp >> 18) | 0xf0); *(result++) = static_cast(((cp >> 12) & 0x3f)| 0x80); *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); *(result++) = static_cast((cp & 0x3f) | 0x80); } return result; } template uint32_t next(octet_iterator& it) { uint32_t cp = utf8::internal::mask8(*it); typename std::iterator_traits::difference_type length = utf8::internal::sequence_length(it); switch (length) { case 1: break; case 2: it++; cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f); break; case 3: ++it; cp = ((cp << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff); ++it; cp += (*it) & 0x3f; break; case 4: ++it; cp = ((cp << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff); ++it; cp += (utf8::internal::mask8(*it) << 6) & 0xfff; ++it; cp += (*it) & 0x3f; break; } ++it; return cp; } template uint32_t peek_next(octet_iterator it) { return utf8::unchecked::next(it); } template uint32_t prior(octet_iterator& it) { while (utf8::internal::is_trail(*(--it))) ; octet_iterator temp = it; return utf8::unchecked::next(temp); } // Deprecated in versions that include prior, but only for the sake of consistency (see utf8::previous) template inline uint32_t previous(octet_iterator& it) { return utf8::unchecked::prior(it); } template void advance (octet_iterator& it, distance_type n) { for (distance_type i = 0; i < n; ++i) utf8::unchecked::next(it); } template typename std::iterator_traits::difference_type distance (octet_iterator first, octet_iterator last) { typename std::iterator_traits::difference_type dist; for (dist = 0; first < last; ++dist) utf8::unchecked::next(first); return dist; } template octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) { while (start != end) { uint32_t cp = utf8::internal::mask16(*start++); // Take care of surrogate pairs first if (utf8::internal::is_lead_surrogate(cp)) { uint32_t trail_surrogate = utf8::internal::mask16(*start++); cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; } result = utf8::unchecked::append(cp, result); } return result; } template u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result) { while (start < end) { uint32_t cp = utf8::unchecked::next(start); if (cp > 0xffff) { //make a surrogate pair *result++ = static_cast((cp >> 10) + internal::LEAD_OFFSET); *result++ = static_cast((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN); } else *result++ = static_cast(cp); } return result; } template octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result) { while (start != end) result = utf8::unchecked::append(*(start++), result); return result; } template u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result) { while (start < end) (*result++) = utf8::unchecked::next(start); return result; } // The iterator class template class iterator : public std::iterator { octet_iterator it; public: iterator () {} explicit iterator (const octet_iterator& octet_it): it(octet_it) {} // the default "big three" are OK octet_iterator base () const { return it; } uint32_t operator * () const { octet_iterator temp = it; return utf8::unchecked::next(temp); } bool operator == (const iterator& rhs) const { return (it == rhs.it); } bool operator != (const iterator& rhs) const { return !(operator == (rhs)); } iterator& operator ++ () { ::std::advance(it, utf8::internal::sequence_length(it)); return *this; } iterator operator ++ (int) { iterator temp = *this; ::std::advance(it, utf8::internal::sequence_length(it)); return temp; } iterator& operator -- () { utf8::unchecked::prior(it); return *this; } iterator operator -- (int) { iterator temp = *this; utf8::unchecked::prior(it); return temp; } }; // class iterator } // namespace utf8::unchecked } // namespace utf8 #endif // header guard enthought-chaco2-4.8.1.orig/kiva/agg/src/utf8/checked.h0000644000175000017500000002761413477706655021637 0ustar varunvarun// Copyright 2006 Nemanja Trifunovic /* Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 #define UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 #include "core.h" #include namespace utf8 { // Base for the exceptions that may be thrown from the library class exception : public ::std::exception { }; // Exceptions that may be thrown from the library functions. class invalid_code_point : public exception { uint32_t cp; public: invalid_code_point(uint32_t cp) : cp(cp) {} virtual const char* what() const throw() { return "Invalid code point"; } uint32_t code_point() const {return cp;} }; class invalid_utf8 : public exception { uint8_t u8; public: invalid_utf8 (uint8_t u) : u8(u) {} virtual const char* what() const throw() { return "Invalid UTF-8"; } uint8_t utf8_octet() const {return u8;} }; class invalid_utf16 : public exception { uint16_t u16; public: invalid_utf16 (uint16_t u) : u16(u) {} virtual const char* what() const throw() { return "Invalid UTF-16"; } uint16_t utf16_word() const {return u16;} }; class not_enough_room : public exception { public: virtual const char* what() const throw() { return "Not enough space"; } }; /// The library API - functions intended to be called by the users template octet_iterator append(uint32_t cp, octet_iterator result) { if (!utf8::internal::is_code_point_valid(cp)) throw invalid_code_point(cp); if (cp < 0x80) // one octet *(result++) = static_cast(cp); else if (cp < 0x800) { // two octets *(result++) = static_cast((cp >> 6) | 0xc0); *(result++) = static_cast((cp & 0x3f) | 0x80); } else if (cp < 0x10000) { // three octets *(result++) = static_cast((cp >> 12) | 0xe0); *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); *(result++) = static_cast((cp & 0x3f) | 0x80); } else { // four octets *(result++) = static_cast((cp >> 18) | 0xf0); *(result++) = static_cast(((cp >> 12) & 0x3f) | 0x80); *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); *(result++) = static_cast((cp & 0x3f) | 0x80); } return result; } template output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement) { while (start != end) { octet_iterator sequence_start = start; internal::utf_error err_code = utf8::internal::validate_next(start, end); switch (err_code) { case internal::UTF8_OK : for (octet_iterator it = sequence_start; it != start; ++it) *out++ = *it; break; case internal::NOT_ENOUGH_ROOM: throw not_enough_room(); case internal::INVALID_LEAD: out = utf8::append (replacement, out); ++start; break; case internal::INCOMPLETE_SEQUENCE: case internal::OVERLONG_SEQUENCE: case internal::INVALID_CODE_POINT: out = utf8::append (replacement, out); ++start; // just one replacement mark for the sequence while (start != end && utf8::internal::is_trail(*start)) ++start; break; } } return out; } template inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out) { static const uint32_t replacement_marker = utf8::internal::mask16(0xfffd); return utf8::replace_invalid(start, end, out, replacement_marker); } template uint32_t next(octet_iterator& it, octet_iterator end) { uint32_t cp = 0; internal::utf_error err_code = utf8::internal::validate_next(it, end, cp); switch (err_code) { case internal::UTF8_OK : break; case internal::NOT_ENOUGH_ROOM : throw not_enough_room(); case internal::INVALID_LEAD : case internal::INCOMPLETE_SEQUENCE : case internal::OVERLONG_SEQUENCE : throw invalid_utf8(*it); case internal::INVALID_CODE_POINT : throw invalid_code_point(cp); } return cp; } template uint32_t peek_next(octet_iterator it, octet_iterator end) { return utf8::next(it, end); } template uint32_t prior(octet_iterator& it, octet_iterator start) { // can't do much if it == start if (it == start) throw not_enough_room(); octet_iterator end = it; // Go back until we hit either a lead octet or start while (utf8::internal::is_trail(*(--it))) if (it == start) throw invalid_utf8(*it); // error - no lead byte in the sequence return utf8::peek_next(it, end); } /// Deprecated in versions that include "prior" template uint32_t previous(octet_iterator& it, octet_iterator pass_start) { octet_iterator end = it; while (utf8::internal::is_trail(*(--it))) if (it == pass_start) throw invalid_utf8(*it); // error - no lead byte in the sequence octet_iterator temp = it; return utf8::next(temp, end); } template void advance (octet_iterator& it, distance_type n, octet_iterator end) { for (distance_type i = 0; i < n; ++i) utf8::next(it, end); } template typename std::iterator_traits::difference_type distance (octet_iterator first, octet_iterator last) { typename std::iterator_traits::difference_type dist; for (dist = 0; first < last; ++dist) utf8::next(first, last); return dist; } template octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) { while (start != end) { uint32_t cp = utf8::internal::mask16(*start++); // Take care of surrogate pairs first if (utf8::internal::is_lead_surrogate(cp)) { if (start != end) { uint32_t trail_surrogate = utf8::internal::mask16(*start++); if (utf8::internal::is_trail_surrogate(trail_surrogate)) cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; else throw invalid_utf16(static_cast(trail_surrogate)); } else throw invalid_utf16(static_cast(cp)); } // Lone trail surrogate else if (utf8::internal::is_trail_surrogate(cp)) throw invalid_utf16(static_cast(cp)); result = utf8::append(cp, result); } return result; } template u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result) { while (start != end) { uint32_t cp = utf8::next(start, end); if (cp > 0xffff) { //make a surrogate pair *result++ = static_cast((cp >> 10) + internal::LEAD_OFFSET); *result++ = static_cast((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN); } else *result++ = static_cast(cp); } return result; } template octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result) { while (start != end) result = utf8::append(*(start++), result); return result; } template u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result) { while (start != end) (*result++) = utf8::next(start, end); return result; } // The iterator class template class iterator : public std::iterator { octet_iterator it; octet_iterator range_start; octet_iterator range_end; public: iterator () {} explicit iterator (const octet_iterator& octet_it, const octet_iterator& range_start, const octet_iterator& range_end) : it(octet_it), range_start(range_start), range_end(range_end) { if (it < range_start || it > range_end) throw std::out_of_range("Invalid utf-8 iterator position"); } // the default "big three" are OK octet_iterator base () const { return it; } uint32_t operator * () const { octet_iterator temp = it; return utf8::next(temp, range_end); } bool operator == (const iterator& rhs) const { if (range_start != rhs.range_start || range_end != rhs.range_end) throw std::logic_error("Comparing utf-8 iterators defined with different ranges"); return (it == rhs.it); } bool operator != (const iterator& rhs) const { return !(operator == (rhs)); } iterator& operator ++ () { utf8::next(it, range_end); return *this; } iterator operator ++ (int) { iterator temp = *this; utf8::next(it, range_end); return temp; } iterator& operator -- () { utf8::prior(it, range_start); return *this; } iterator operator -- (int) { iterator temp = *this; utf8::prior(it, range_start); return temp; } }; // class iterator } // namespace utf8 #endif //header guard enthought-chaco2-4.8.1.orig/kiva/agg/src/swig_questions.txt0000644000175000017500000001475313233644505023017 0ustar varunvarun1. Shouldn't the std_string.i have typemaps for std::string* in them? Currently, public members of a class with type std::string are not converted automatically by SWIG. // file: std_string_ex.py %module foo %include "std_string.i" %{ class foo { public: std::string bar; foo() { bar = "bar"; } }; %} class foo { public: std::string bar; }; C:\wrk\chaco_all\kiva\agg\src>swig -c++ -python -shadow std_string_ex.py C:\wrk\chaco_all\kiva\agg\src>g++ -shared -Ic:/Python22/include std_string_ex_wrap.cxx -Lc:/Python22/libs -lpython22 -o _foo.dll C:\wrk\chaco_all\kiva\agg\src>python Enthought Edition 1.0a1 based on Python 2.2.3 (#42, Jun 4 2003, 10:33:42) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import foo >>> q = foo.foo() >>> q.bar '_b8498c00_p_std__string' Adding the following typemaps to the file fixes this issue: %typemap(python,in) std::string * { if (PyString_Check ($input)) { $1 = new std::string((char *)PyString_AsString($input)); } else { PyErr_SetString (PyExc_TypeError, "not a String"); return NULL; } } %typemap(python,out) std::string * { $result = PyString_FromString((const char *)$1->c_str()); } %typemap (python, freearg) std::string * { if ($1) { delete $1; } } C:\wrk\chaco_all\kiva\agg\src>swig -c++ -python -shadow std_string_ex.py C:\wrk\chaco_all\kiva\agg\src>g++ -shared -Ic:/Python22/include std_string_ex_wrap.cxx -Lc:/Python22/libs -lpython22 -o _foo.dll C:\wrk\chaco_all\kiva\agg\src>python Enthought Edition 1.0a1 based on Python 2.2.3 (#42, Jun 4 2003, 10:33:42) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import foo >>> q = foo.foo() >>> q.bar 'bar' Is there a downside to adding these? Perhaps they should be declared as memberin and memberout ?? 2. How do you add a new constructor to a class? I would like to modify a class that takes foo(double, double, double, double, double, double) so that it can be initialized through a Numeric array with 6 elements. I haven't gotten very far. I tried doing the following: // file: affine_matrix.i %{ #include "Numeric/arrayobject.h" #include "agg_affine_matrix.h" agg::affine_matrix* new_affine_matrix(double ary[6]) { agg::affine_matrix* result = new agg::affine_matrix(ary[0], ary[1], ary[2], ary[3], ary[4], ary[5]); return result; } } %} %typemap(in) (double ary[6]) { // !! cheap and cheerful -- add checks later PyArrayObject* ary = (PyArrayObject*) $input; $1 = (double*) ary->data; } %include "agg_affine_matrix.h" %extend agg::affine_matrix { // constructors from array affine_matrix(double ary[6]); // also tried // agg::affine_matrix(double ary[6]); } Unfortunately, the constructor wasn't added into the logic for overloaded constructor searches in the generated code. Where am I going wrong here? My temporary fix has been to create a helper function and use it when I want to create an affine_matrix abject from an array: %{ #include "Numeric/arrayobject.h" #include "agg_affine_matrix.h" agg::affine_matrix* affine_from_array(double ary[6]) { return new agg::affine_matrix(ary[0], ary[1], ary[2], ary[3], ary[4], ary[5]); } %} // constructors from sequences %typemap(python,in) (double ary[6]) { // !! cheap and cheerful -- add checks later PyArrayObject* ary = (PyArrayObject*) $input; $1 = (double*) ary->data; } %include "agg_affine_matrix.h" agg::affine_matrix* affine_from_array(double ary[6]); Not elegant, but it works: C:\wrk\chaco_all\kiva\agg\src>python Enthought Edition 1.0a1 based on Python 2.2.3 (#42, Jun 4 2003, 10:33:42) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from Numeric import * >>> import agg >>> agg.affine_from_array >>> agg.affine_from_array(array((1,2,3,4,5,6.))) affine_matrix(1,2,3,4,5,6) 3. The following is an improved typemap for sequence->array conversion found in 19.5.5 of the SWIG manual as it handles coersion of values that can be converted to floats. // Map a Python sequence into any sized C double array // This handles arrays and sequences with non-float values correctly. %typemap(in) double[ANY](double temp[$1_dim0]) { int i; if (!PySequence_Check($input)) { PyErr_SetString(PyExc_TypeError,"Expecting a sequence"); return NULL; } if (PyObject_Length($input) != $1_dim0) { PyErr_SetString(PyExc_ValueError,"Expecting a sequence with $1_dim0 elements"); return NULL; } for (i =0; i < $1_dim0; i++) { PyObject *o = PySequence_GetItem($input,i); if (PyFloat_Check(o)) { temp[i] = PyFloat_AsDouble(o); } else { PyObject* converted = PyNumber_Float(o); if (!converted) { PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats"); return NULL; } temp[i] = PyFloat_AsDouble(converted); Py_DECREF(converted); } else } $1 = &temp[0]; } 3. Something is broken on my const affine_matrix& operator *=(const affine_matrix& other) { } wrappers. It appears that whenever affine_matrix& is returned, the this and thisown pointers are getting goofed up because affine_matrix destructors are being called (and therefore clobbering memory) at times when they shouldn't... 4. Immutable data members should emit an error when the user tries to set them. Currently they are silent... enthought-chaco2-4.8.1.orig/kiva/agg/src/constants.i0000644000175000017500000001205013233644505021345 0ustar varunvarun///////////////////////////////////////////////////////////////////////////// // // 1) Wraps constants and enumerated types commonly used in agg and kiva. // 2) Provides typemaps to accpet integer inputs for enumerated types. // 3) Provides python dictionaries to map back and forth between enumerated // types and more descriptive strings that can be used in python. // // A number of constants (and some functions and types) are defined in // agg_basics.h and kiva_constants.h. // // agg_renderer_markers.h is used for rendering simple shapes at multiple // data points. It is useful for generating scatter plots in simple cases. // This wrapper is used to pick up the enumerated types for markers such // as marker_square, marker_circle, etc. The only classes in the header are // template definitions so they are all ignored by swig. // // ///////////////////////////////////////////////////////////////////////////// %{ #include "agg_basics.h" #include "kiva_constants.h" #include "agg_renderer_markers.h" %} %include "agg_basics.h" %include "kiva_constants.h" %include "agg_renderer_markers.h" %{ inline unsigned path_cmd(unsigned c) { return c & agg24::path_cmd_mask; } inline unsigned path_flags(unsigned c) { return c & agg24::path_flags_mask; } %} %include "agg_typemaps.i" %apply(kiva_enum_typemap) { agg24::path_flags_e }; %apply(kiva_enum_typemap) { agg24::marker_e }; %apply(kiva_enum_typemap) { kiva::draw_mode_e mode, kiva::text_draw_mode_e, kiva::line_join_e, kiva::line_cap_e, kiva::blend_mode_e }; %apply(kiva_enum_typemap) { kiva::pix_format_e, kiva::interpolation_e }; %apply(kiva_enum_typemap) { kiva::blend_mode_e mode}; unsigned path_cmd(unsigned c); unsigned path_flags(unsigned c); %pythoncode %{ #---------------------------------------------------------------------------- # # map strings values to the marker enumerated values and back with: # marker_string_map[string] = enum # marker_enum_map[enum] = string # #---------------------------------------------------------------------------- kiva_marker_to_agg = {} kiva_marker_to_agg[1] = marker_square kiva_marker_to_agg[2] = marker_diamond kiva_marker_to_agg[3] = marker_circle kiva_marker_to_agg[4] = marker_crossed_circle kiva_marker_to_agg[5] = marker_x kiva_marker_to_agg[6] = marker_triangle_up kiva_marker_to_agg[7] = marker_triangle_down kiva_marker_to_agg[8] = marker_cross # "plus" sign; Agg calls this "cross" kiva_marker_to_agg[9] = marker_dot kiva_marker_to_agg[10] = marker_pixel #---------------------------------------------------------------------------- # # Map strings values to the pix_format enumerated values and back with: # pix_format_string_map[string] = enum # pix_format_enum_map[enum] = string # #---------------------------------------------------------------------------- pix_format_string_map = {} pix_format_string_map["gray8"] = pix_format_gray8 pix_format_string_map["rgb555"] = pix_format_rgb555 pix_format_string_map["rgb565"] = pix_format_rgb565 pix_format_string_map["rgb24"] = pix_format_rgb24 pix_format_string_map["bgr24"] = pix_format_bgr24 pix_format_string_map["rgba32"] = pix_format_rgba32 pix_format_string_map["argb32"] = pix_format_argb32 pix_format_string_map["abgr32"] = pix_format_abgr32 pix_format_string_map["bgra32"] = pix_format_bgra32 pix_format_enum_map = {} for key,value in pix_format_string_map.items(): pix_format_enum_map[value] = key #---------------------------------------------------------------------------- # Map a pix format string value to the number of bytes per pixel #---------------------------------------------------------------------------- pix_format_bytes = {} pix_format_bytes["gray8"] = 1 pix_format_bytes["rgb555"] = 2 pix_format_bytes["rgb565"] = 2 pix_format_bytes["rgb24"] = 3 pix_format_bytes["bgr24"] = 3 pix_format_bytes["rgba32"] = 4 pix_format_bytes["argb32"] = 4 pix_format_bytes["abgr32"] = 4 pix_format_bytes["bgra32"] = 4 pix_format_bits = {} pix_format_bits["gray8"] = 8 pix_format_bits["rgb555"] = 15 pix_format_bits["rgb565"] = 16 pix_format_bits["rgb24"] = 24 pix_format_bits["bgr24"] = 24 pix_format_bits["rgba32"] = 32 pix_format_bits["argb32"] = 32 pix_format_bits["abgr32"] = 32 pix_format_bits["bgra32"] = 32 #---------------------------------------------------------------------------- # # Map strings values to the interpolation enumerated values and back with: # interp_string_map[string] = enum # interp_enum_map[enum] = string # #---------------------------------------------------------------------------- interp_string_map = {} interp_string_map["nearest"] = nearest interp_string_map["bilinear"] = bilinear interp_string_map["bicubic"] = bicubic interp_string_map["spline16"] = spline16 interp_string_map["spline36"] = spline36 interp_string_map["sinc64"] = sinc64 interp_string_map["sinc144"] = sinc144 interp_string_map["sinc256"] = sinc256 interp_string_map["blackman64"] = blackman64 interp_string_map["blackman100"] = blackman100 interp_string_map["blackman256"] = blackman256 interp_enum_map = {} for key,value in interp_string_map.items(): interp_enum_map[value] = key %} enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_graphics_context_base.h0000644000175000017500000003237413233644505024713 0ustar varunvarun#ifndef KIVA_GRAPHICS_CONTEXT_BASE_H #define KIVA_GRAPHICS_CONTEXT_BASE_H #define KIVA_USE_FREETYPE #ifdef KIVA_USE_FREETYPE #include "agg_font_freetype.h" #endif #ifdef KIVA_USE_WIN32 #include "agg_font_win32_tt.h" #endif #include #include #include "agg_basics.h" #include "agg_color_rgba.h" #include "agg_rendering_buffer.h" #include "agg_renderer_markers.h" #include "kiva_constants.h" #include "kiva_pix_format.h" #include "kiva_rect.h" #include "kiva_graphics_state.h" #include "kiva_affine_helpers.h" // text includes #include "agg_glyph_raster_bin.h" #include "agg_renderer_scanline.h" #include "agg_renderer_raster_text.h" #include "agg_embedded_raster_fonts.h" #include "agg_font_cache_manager.h" namespace kiva { #ifdef KIVA_USE_FREETYPE typedef agg24::font_engine_freetype_int32 font_engine_type; #endif #ifdef KIVA_USE_WIN32 typedef agg24::font_engine_win32_tt_int32 font_engine_type; #endif typedef agg24::font_cache_manager font_manager_type; font_engine_type* GlobalFontEngine(); font_manager_type* GlobalFontManager(); void cleanup_font_threading_primitives(); class graphics_context_base { public: // The current path. This also includes the ctm. kiva::compiled_path path; // The text matrix is *not* part of the graphics state. agg24::trans_affine text_matrix; kiva::graphics_state state; std::stack state_stack; agg24::rendering_buffer buf; // fix me: Not sure this should be here, but, putting it here completely // unifies images and graphics contexts. // (TODO-PZW: revisit this) kiva::interpolation_e _image_interpolation; // text handling. graphics_context_base(unsigned char *data, int width, int height, int stride, kiva::interpolation_e interp); virtual ~graphics_context_base(); int width(); int height(); int stride(); int bottom_up(); virtual kiva::pix_format_e format() = 0; agg24::rendering_buffer& rendering_buffer(); kiva::interpolation_e get_image_interpolation(); void set_image_interpolation(interpolation_e interpolation); //--------------------------------------------------------------- // set graphics_state values //--------------------------------------------------------------- void set_stroke_color(agg24::rgba& value); agg24::rgba& get_stroke_color(); // TODO-PZW: do we need corresponding get() functions for // all of the following? void set_line_width(double value); void set_line_join(line_join_e value); void set_line_cap(line_cap_e value); void set_line_dash(double* pattern, int n, double phase=0); // fix me: Blend mode is *barely* supported and // probably abused (my copy setting). void set_blend_mode(blend_mode_e value); kiva::blend_mode_e get_blend_mode(); void set_fill_color(agg24::rgba& value); // need get method for freetype renderer. // should I return a reference?? agg24::rgba& get_fill_color(); // need get method for freetype renderer. // fix me: Is the get method still needed? void set_alpha(double value); double get_alpha(); // need get method for freetype renderer. // fix me: Is the get method still needed? void set_antialias(int value); int get_antialias(); // TODO-PZW: get() functions needed? void set_miter_limit(double value); void set_flatness(double value); //--------------------------------------------------------------- // text and font functions //--------------------------------------------------------------- // Text drawing information needs to have get/set methods void set_text_position(double tx, double ty); void get_text_position(double* tx, double* ty); void set_text_matrix(agg24::trans_affine& value); agg24::trans_affine get_text_matrix(); void set_character_spacing(double value); double get_character_spacing(); void set_text_drawing_mode(text_draw_mode_e value); // The following methods all return true if successful and false // otherwise. bool set_font(kiva::font_type& font); bool is_font_initialized(); bool set_font_size(int size); virtual bool show_text(char *text)=0; bool show_text_at_point(char *text, double tx, double ty); // This will always return a font_type object. The font's // is_loaded() method should be checked to see if the font is valid. kiva::font_type& get_font(); // Returns a rectangle representing the bounds of the text string. // The rectangle is measured in the transformed space of the text // itself, and its origin is not necessarily 0,0 (for fonts with // overhanging glyphs). // is_font_initialized() should be checked to make sure the font // has been properly loaded and initialized. kiva::rect_type get_text_extent(char *text); bool get_text_bbox_as_rect(char *text); //--------------------------------------------------------------- // save/restore graphics state //--------------------------------------------------------------- void save_state(); virtual void restore_state() = 0; //--------------------------------------------------------------- // coordinate transform matrix transforms //--------------------------------------------------------------- void translate_ctm(double x, double y); void rotate_ctm(double angle); void scale_ctm(double sx, double sy); void concat_ctm(agg24::trans_affine& m); void set_ctm(agg24::trans_affine& m); agg24::trans_affine get_ctm(); void get_freetype_text_matrix(double* out); //--------------------------------------------------------------- // Sending drawing data to a device //--------------------------------------------------------------- void flush(); void synchronize(); //--------------------------------------------------------------- // Page Definitions //--------------------------------------------------------------- void begin_page(); void end_page(); //--------------------------------------------------------------- // Path operations //--------------------------------------------------------------- void begin_path(); void move_to(double x, double y); void line_to( double x, double y); void curve_to(double cpx1, double cpy1, double cpx2, double cpy2, double x, double y); void quad_curve_to(double cpx, double cpy, double x, double y); // arc() and arc_to() draw circular segments. When the arc // is added to the current path, it may become an elliptical // arc depending on the CTM. // Draws a circular segment centered at the point (x,y) with the // given radius. void arc(double x, double y, double radius, double start_angle, double end_angle, bool cw=false); // Sweeps a circular arc from the pen position to a point on the // line from (x1,y1) to (x2,y2). // The arc is tangent to the line from the current pen position // to (x1,y1), and it is also tangent to the line from (x1,y1) // to (x2,y2). (x1,y1) is the imaginary intersection point of // the two lines tangent to the arc at the current point and // at (x2,y2). // If the tangent point on the line from the current pen position // to (x1,y1) is not equal to the current pen position, a line is // drawn to it. Depending on the supplied radius, the tangent // point on the line fron (x1,y1) to (x2,y2) may or may not be // (x2,y2). In either case, the arc is drawn to the point of // tangency, which is also the new pen position. // // Consider the common case of rounding a rectangle's upper left // corner. Let "r" be the radius of rounding. Let the current // pen position be (x_left + r, y_top). Then (x2,y2) would be // (x_left, y_top - radius), and (x1,y1) would be (x_left, y_top). void arc_to(double x1, double y1, double x2, double y2, double radius); void close_path(); void add_path(kiva::compiled_path& other_path); compiled_path _get_path(); kiva::rect_type _get_path_bounds(); void lines(double* pts, int Npts); void line_set(double* start, int Nstart, double* end, int Nend); void rect(double x, double y, double sx, double sy); void rect(kiva::rect_type &rect); void rects(double* all_rects, int Nrects); void rects(kiva::rect_list_type &rectlist); agg24::path_storage boundary_path(agg24::trans_affine& affine_mtx); //--------------------------------------------------------------- // Clipping path manipulation //--------------------------------------------------------------- virtual void clip() = 0; virtual void even_odd_clip() = 0; virtual void clip_to_rect(double x, double y, double sx, double sy) = 0; virtual void clip_to_rect(kiva::rect_type &rect) = 0; virtual void clip_to_rects(double* new_rects, int Nrects) = 0; virtual void clip_to_rects(kiva::rect_list_type &rects) = 0; virtual void clear_clip_path() = 0; // The following two are meant for debugging purposes, and are not part // of the formal interface for GraphicsContexts. virtual int get_num_clip_regions() = 0; virtual kiva::rect_type get_clip_region(unsigned int i) = 0; //--------------------------------------------------------------- // Painting paths (drawing and filling contours) //--------------------------------------------------------------- virtual void clear(agg24::rgba value=agg24::rgba(1,1,1,1)) = 0; //virtual void clear(double alpha) = 0; virtual void fill_path() = 0; virtual void eof_fill_path() = 0; virtual void stroke_path() = 0; virtual void _stroke_path() = 0; virtual void draw_path(draw_mode_e mode=FILL_STROKE) = 0; virtual void draw_rect(double rect[4], draw_mode_e mode=FILL_STROKE) = 0; // Draw a marker at all the points in the list. This is a // very fast function that only works in special cases. // The succeeds if the line_width != 0.0 or 1.0, the line_join // is set to JOIN_MITER (!! NOT CURRENTLY ENFORCED), and the // ctm only has translational components. // // Typically this is called before trying the more general // draw_path_at_points() command. It is typically 5-10 times // faster. // // Returns: int // 0 on failure // 1 on success virtual int draw_marker_at_points(double* pts,int Npts,int size, agg24::marker_e type=agg24::marker_square) = 0; virtual void draw_path_at_points(double* pts,int Npts, kiva::compiled_path& marker, draw_mode_e mode) = 0; //--------------------------------------------------------------- // Image handling //--------------------------------------------------------------- // Draws an image into the rectangle specified as (x, y, width, height); // The image is scaled and/or stretched to fit inside the rectangle area // specified. virtual int draw_image(kiva::graphics_context_base* img, double rect[4], bool force_copy=false) = 0; int draw_image(kiva::graphics_context_base* img); // fix me: This is a temporary fix to help with speed issues in draw image. // WE SHOULD GET RID OF IT AND SUPPORT DRAWING MODES. //virtual int copy_image(kiva::graphics_context_base* img, int tx, int ty); //--------------------------------------------------------------------- // Gradient support //--------------------------------------------------------------------- // // // virtual void linear_gradient(double x1, double y1, double x2, double y2, std::vector stops, const char* spread_method, const char* units="userSpaceOnUse"); // // // virtual void radial_gradient(double cx, double cy, double r, double fx, double fy, std::vector stops, const char* spread_method, const char* units="userSpaceOnUse"); protected: // Grabs and configure the font engine with the settings on our current // state's font object. void _grab_font_manager(); void _release_font_manager(); bool _is_font_initialized; }; } #endif /* KIVA_GRAPHICS_CONTEXT_BASE_H */ enthought-chaco2-4.8.1.orig/kiva/agg/src/utf8.h0000644000175000017500000000302313477706655020235 0ustar varunvarun// Copyright 2006 Nemanja Trifunovic /* Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 #define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 #include "utf8/checked.h" #include "utf8/unchecked.h" #endif // header guard enthought-chaco2-4.8.1.orig/kiva/agg/src/tst_convert.py0000644000175000017500000000021513421603267022102 0ustar varunvarunfrom __future__ import print_function import agg q=agg.Image((10,10),pix_format="rgb24") q.convert_pixel_format("rgba32") print(q.format()) enthought-chaco2-4.8.1.orig/kiva/agg/src/gl_graphics_context.h0000644000175000017500000001337013233644505023364 0ustar varunvarun#ifndef KIVA_GL_GRAPHICS_CONTEXT_H #define KIVA_GL_GRAPHICS_CONTEXT_H #ifdef _MSC_VER #pragma warning(disable:4786) #endif #ifdef __DARWIN__ #include #include #else #ifdef _MSC_VER #include #endif #include #include // The following mechanism is necessary in order to use MultiDrawElements // on Windows with mingw. // 11/24/2010: glMultiDrawElements is not being used right now in the GL // backend, so comment this out for the time being, especially since it // causes build problems with 64-bit mingw. //#ifdef __MINGW32__ // #define GL_GLEXT_PROTOTYPES 1 // #include // #define MULTI_DRAW_ELEMENTS glMultiDrawElementsEXT //#endif #endif #include "agg_basics.h" #include "kiva_compiled_path.h" #include "kiva_graphics_context_base.h" #include "kiva_pix_format.h" namespace kiva { // This function pointer is used by various draw_marker functions class gl_graphics_context; typedef void(gl_graphics_context::* PathDefinitionFunc)(int); class gl_graphics_context : public graphics_context_base { public: gl_graphics_context(int width, int height, kiva::pix_format_e format=kiva::pix_format_rgb24); ~gl_graphics_context(); //--------------------------------------------------------------- // GL-specific methods //--------------------------------------------------------------- void gl_init(); void gl_cleanup(); void begin_page(); void gl_render_path(kiva::compiled_path *path, bool polygon=false, bool fill=false); void gl_render_points(double** points, bool polygon, bool fill, kiva::draw_mode_e mode = FILL); //--------------------------------------------------------------- // GraphicsContextBase interface //--------------------------------------------------------------- kiva::pix_format_e format(); void save_state(); void restore_state(); //--------------------------------------------------------------- // Clipping path manipulation //--------------------------------------------------------------- void clip(); void even_odd_clip(); void clip_to_rect(double x, double y, double sx, double sy); void clip_to_rect(kiva::rect_type &rect); void clip_to_rects(double* new_rects, int Nrects); void clip_to_rects(kiva::rect_list_type &rects); kiva::rect_type transform_clip_rectangle(const kiva::rect_type &rect); void clear_clip_path(); int get_num_clip_regions(); kiva::rect_type get_clip_region(unsigned int i); //--------------------------------------------------------------- // Painting paths (drawing and filling contours) //--------------------------------------------------------------- void clear(agg24::rgba value=agg24::rgba(1,1,1,1)); void fill_path(); void eof_fill_path(); void stroke_path(); // empty function; for some reason this is abstract in the base class inline void _stroke_path() { } void draw_path(draw_mode_e mode=FILL_STROKE); void draw_rect(double rect[4], draw_mode_e mode=FILL_STROKE); int draw_marker_at_points(double* pts,int Npts,int size, agg24::marker_e type=agg24::marker_square); void draw_path_at_points(double* pts,int Npts, kiva::compiled_path& marker, draw_mode_e mode); inline bool show_text(char *text) { return false; } void draw_glyphs(kiva::graphics_context_base* img, double tx, double ty); int draw_image(kiva::graphics_context_base* img, double rect[4], bool force_copy=false); int draw_image(kiva::graphics_context_base* img); protected: void draw_display_list_at_pts(GLuint list, double *pts, int Npts, kiva::draw_mode_e mode, double x0, double y0); void draw_display_list_at_pts(GLuint fill_list, GLuint stroke_list, double *pts, int Npts, kiva::draw_mode_e mode, double x0, double y0); // Given a path function, returns two OpenGL display lists representing // the list to fill and the list to stroke. The caller is responsible // for calling glDeleteLists on the two. // Only the list name of the first list (fill list) will be returned; // the stroke list can be accessed by just adding 1. GLuint make_marker_lists(kiva::PathDefinitionFunc path_func, kiva::draw_mode_e mode, int size); void circle_path_func(int size); void triangle_up_func(int size); void triangle_down_func(int size); void draw_square(double *pts, int Npts, int size, kiva::draw_mode_e mode, double x0, double y0); void draw_diamond(double *pts, int Npts, int size, kiva::draw_mode_e mode, double x0, double y0); void draw_crossed_circle(double *pts, int Npts, int size, kiva::draw_mode_e mode, double x0, double y0); void draw_x_marker(double *pts, int Npts, int size, kiva::draw_mode_e mode, double x0, double y0); void draw_cross(double *pts, int Npts, int size, kiva::draw_mode_e mode, double x0, double y0); void draw_dot(double *pts, int Npts, int size, kiva::draw_mode_e mode, double x0, double y0); void draw_pixel(double *pts, int Npts, int size, kiva::draw_mode_e mode, double x0, double y0); private: int m_width; int m_height; bool m_gl_initialized; kiva::pix_format_e m_pixfmt; }; } #endif /* KIVA_GL_GRAPHICS_CONTEXT_H */ enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_graphics_context.h0000644000175000017500000016501513477706655023737 0ustar varunvarun#ifndef KIVA_GRAPHICS_CONTEXT_H #define KIVA_GRAPHICS_CONTEXT_H #ifdef _MSC_VER // Turn off MSDEV warning about truncated long identifiers #pragma warning(disable:4786) #endif #include #include #include #include #include #include "utf8.h" #include "agg_trans_affine.h" #include "agg_path_storage.h" #include "agg_conv_stroke.h" #include "agg_conv_dash.h" #include "agg_conv_curve.h" #include "agg_conv_clip_polygon.h" #include "agg_conv_clip_polyline.h" #include "agg_span_allocator.h" #include "agg_span_converter.h" #include "kiva_image_filters.h" #include "agg_scanline_u.h" #include "agg_scanline_bin.h" #include "agg_scanline_p.h" #include "agg_renderer_mclip.h" #include "agg_renderer_scanline.h" #include "agg_renderer_outline_aa.h" #include "agg_renderer_primitives.h" #include "agg_rasterizer_outline.h" #include "agg_rasterizer_outline_aa.h" #include "agg_rasterizer_scanline_aa.h" #include "agg_span_gradient.h" #include "kiva_image_filters.h" #include "kiva_dash_type.h" #include "kiva_compiled_path.h" #include "kiva_font_type.h" #include "kiva_pix_format.h" #include "kiva_exceptions.h" #include "kiva_graphics_context_base.h" #include "kiva_alpha_gamma.h" #include "kiva_gradient.h" namespace kiva { template class graphics_context : public graphics_context_base { // agg_pixfmt has low level rendering commands (hspan, etc.) // This really should be a template parameter //typedef agg24::pixfmt_bgra32 agg_pixfmt; public: agg_pixfmt renderer_pixfmt; private: // The next level of renderer adds clipping to the low level // pixfmt object (renderer). This is what attaches to a // rendering buffer. // The multi-clip renderer uses the single clip inside it, // so there is no need to define both and do our own switching. //typedef agg24::renderer_base renderer_base_type; typedef agg24::renderer_mclip renderer_base_type; renderer_base_type renderer; public: //--------------------------------------------------------------- // constructor //--------------------------------------------------------------- graphics_context(unsigned char *data, int width, int height, int stride, kiva::interpolation_e interp=nearest); ~graphics_context() { } // TODO: write copy constructor kiva::pix_format_e format(); void restore_state(); //--------------------------------------------------------------- // Clipping path manipulation //--------------------------------------------------------------- // Clips to the current path. If the current path is empty, // does nothing. void clip(); void even_odd_clip(); // clip_to_rect() expects an array of doubles (x1,y1,x2,y2); // clip_to_rects() expects a repeated array of these. void clip_to_rect(double x, double y, double sx, double sy); void clip_to_rect(kiva::rect_type &rect); // Computes the (possibly disjoint) union of the input rectangles // and clips to them. NOTE that this is not the same thing as // simply calling clip_to_rect() on each rectangle separately! void clip_to_rects(double* new_rects, int Nrects); void clip_to_rects(kiva::rect_list_type &rects); void clear_clip_path(); int get_num_clip_regions(); kiva::rect_type get_clip_region(unsigned int i); //--------------------------------------------------------------- // Painting paths (drawing and filling contours) //--------------------------------------------------------------- void clear(agg24::rgba value=agg24::rgba(1,1,1,1)); void clear(double alpha); void draw_path(draw_mode_e mode=FILL_STROKE); void draw_rect(double rect[4], draw_mode_e mode=FILL_STROKE); int draw_marker_at_points(double* pts,int Npts,int size, agg24::marker_e type=agg24::marker_square); void draw_path_at_points(double* pts,int Npts, kiva::compiled_path& marker, draw_mode_e mode); //--------------------------------------------------------------- // Text handling //--------------------------------------------------------------- bool show_text(char *text); //--------------------------------------------------------------- // Image handling //--------------------------------------------------------------- void draw_glyphs(kiva::graphics_context_base* img, double tx, double ty); int draw_image(kiva::graphics_context_base* img, double rect[4], bool force_copy=false); private: int blend_image(kiva::graphics_context_base* img, int tx, int ty); int copy_image(kiva::graphics_context_base* img, int tx, int ty); int transform_image(kiva::graphics_context_base* img, agg24::trans_affine& img_mtx); private: // Transforms a clipping rectangle into device coordinates. kiva::rect_type transform_clip_rectangle(const kiva::rect_type &rect); public: //-------------------------------------------------------------------- // Stroke Path Pipeline. // // See implementation_notes.txt for details. //-------------------------------------------------------------------- void stroke_path() { this->_stroke_path(); this->path.remove_all(); } private: void _stroke_path() { // 1. Choose whether to do a curve conversion or not. // 2. Pick whether the line is dashed. // short circuit for transparent or 0 width lines if (this->state.line_color.a == 0 || this->state.line_width == 0.0) return; if (!this->path.has_curves()) { this->stroke_path_dash_conversion(this->path); } else { agg24::conv_curve curved_path(this->path); this->stroke_path_dash_conversion(curved_path); } } private: template void stroke_path_dash_conversion(path_type& input_path) { if (this->state.line_dash.is_solid()) { this->stroke_path_choose_clipping_renderer(input_path); } else { agg24::conv_dash dashed_path(input_path); std::vector &pattern = this->state.line_dash.pattern; // pattern always has even length for(unsigned int i = 0; i < pattern.size(); i+=2) { dashed_path.add_dash(pattern[i], pattern[i+1]); } dashed_path.dash_start(this->state.line_dash.phase); this->stroke_path_choose_clipping_renderer(dashed_path); } } private: template void stroke_path_choose_clipping_renderer(path_type& input_path) { agg24::conv_clip_polyline clipped(input_path); // fix me: We can do this more intelligently based on the current clip path. // fix me: What coordinates should this be in? I think in user space instead // of device space. This looks wrong... clipped.clip_box(0,0, this->buf.width(), this->buf.height()); // fix me: We should be doing a vector clip of the path as well. // where is this step? // fix me: pick the renderer type (clipping, etc.) if(1) { this->stroke_path_choose_rasterizer(clipped, this->renderer); } else { // fix me: pick the renderer type (clipping, etc.) } } private: template void stroke_path_choose_rasterizer(path_type& input_path, renderer_type& input_renderer) { if (!this->state.should_antialias) { if ( this->state.line_width <= 1.0) { // ignore cap and join type here. this->stroke_path_outline(input_path, input_renderer); } // 2005-04-01: the AGG outline_aa rasterizer has a bug in it; // Go with the slower scanline_aa rasterizer until it's fixed // in AGG. // else if ( this->state.line_width <=10.0 && // (this->state.line_cap == CAP_ROUND || // this->state.line_cap == CAP_BUTT) && // this->state.line_join == JOIN_MITER) // { // // fix me: how to force this to be aliased??? // this->stroke_path_outline_aa(input_path, input_renderer); // } else { // fix me: This appears to be anti-aliased still. typedef agg24::renderer_scanline_bin_solid renderer_bin_type; renderer_bin_type renderer(input_renderer); agg24::scanline_bin scanline; this->stroke_path_scanline_aa(input_path, renderer, scanline); } } else // anti-aliased { // if ( (this->state.line_cap == CAP_ROUND || this->state.line_cap == CAP_BUTT) && // this->state.line_join == JOIN_MITER) // { // this->stroke_path_outline_aa(input_path, input_renderer); // } // else // { typedef agg24::renderer_scanline_aa_solid renderer_aa_type; renderer_aa_type renderer(input_renderer); agg24::scanline_u8 scanline; this->stroke_path_scanline_aa(input_path, renderer, scanline); // } } } private: template void stroke_path_outline(path_type& input_path, renderer_type& input_renderer) { typedef agg24::renderer_primitives primitives_renderer_type; typedef agg24::rasterizer_outline rasterizer_type; primitives_renderer_type primitives_renderer(input_renderer); // set line color -- multiply by alpha if it is set. agg24::rgba color; color = this->state.line_color; color.a *= this->state.alpha; primitives_renderer.line_color(color); rasterizer_type rasterizer(primitives_renderer); rasterizer.add_path(input_path); } private: template void stroke_path_outline_aa(path_type& input_path, renderer_type& input_renderer) { // fix me: How do you render aliased lines with this? // rasterizer_outline_aa algorithm only works for // CAP_ROUND or CAP_BUTT. It also only works for JOIN_MITER typedef agg24::renderer_outline_aa outline_renderer_type; typedef agg24::rasterizer_outline_aa rasterizer_type; // fix me: scale width by ctm agg24::line_profile_aa profile(this->state.line_width, agg24::gamma_none()); outline_renderer_type renderer(input_renderer, profile); // set line color -- multiply by alpha if it is set. agg24::rgba color; color = this->state.line_color; color.a *= this->state.alpha; renderer.color(color); rasterizer_type rasterizer(renderer); if (this->state.line_cap == CAP_ROUND) { rasterizer.round_cap(true); } else if (this->state.line_cap == CAP_BUTT) { //default behavior } // fix me: not sure about the setting for this... rasterizer.accurate_join(true); rasterizer.add_path(input_path); } private: template void stroke_path_scanline_aa(path_type& input_path, renderer_type& renderer, scanline_type& scanline) { agg24::rasterizer_scanline_aa<> rasterizer; agg24::conv_stroke stroked_path(input_path); // fix me: scale width by ctm stroked_path.width(this->state.line_width); // handle line cap agg24::line_cap_e cap = agg24::butt_cap; if (this->state.line_cap == CAP_ROUND) { cap = agg24::round_cap; } else if (this->state.line_cap == CAP_BUTT) { cap = agg24::butt_cap; } else if (this->state.line_cap == CAP_SQUARE) { cap = agg24::square_cap; } stroked_path.line_cap(cap); // handle join agg24::line_join_e join = agg24::miter_join; if (this->state.line_join == JOIN_MITER) { join = agg24::miter_join; } else if (this->state.line_join == JOIN_ROUND) { join = agg24::round_join; } else if (this->state.line_join == JOIN_BEVEL) { join = agg24::bevel_join; } stroked_path.line_join(join); // set line color -- multiply by alpha if it is set. agg24::rgba color; color = this->state.line_color; color.a *= this->state.alpha; renderer.color(color); // render rasterizer.add_path(stroked_path); agg24::render_scanlines(rasterizer, scanline, renderer); } //-------------------------------------------------------------------- // Fill Path Pipeline. // // See implementation_notes.txt for details. //-------------------------------------------------------------------- public: void fill_path() { this->_fill_path(agg24::fill_non_zero); this->path.remove_all(); } public: void eof_fill_path() { this->_fill_path(agg24::fill_even_odd); this->path.remove_all(); } private: void _fill_path(agg24::filling_rule_e rule) { // 1. Choose whether to do a curve conversion or not. // 2. Pick whether the line is dashed. // short circuit for transparent if (this->state.fill_color.a == 0) return; if (!this->path.has_curves()) { this->fill_path_clip_conversion(this->path, rule); } else { agg24::conv_curve curved_path(this->path); this->fill_path_clip_conversion(curved_path, rule); } } //--------------------------------------------------------------------- // Gradient support //--------------------------------------------------------------------- void linear_gradient(double x1, double y1, double x2, double y2, std::vector stops, const char* spread_method, const char* units="userSpaceOnUse") { typedef std::pair point_type; std::vector stops_list; std::vector points; if (strcmp(units, "objectBoundingBox") == 0) { // Transform from relative coordinates kiva::rect_type const clip_rect = _get_path_bounds(); x1 = clip_rect.x + x1 * clip_rect.w; x2 = clip_rect.x + x2 * clip_rect.w; y1 = clip_rect.y + y1 * clip_rect.h; y2 = clip_rect.y + y2 * clip_rect.h; } points.push_back(point_type(x1, y1)); points.push_back(point_type(x2, y2)); this->state.gradient_fill = gradient(kiva::grad_linear, points, stops, spread_method, units); this->state.gradient_fill.set_ctm(this->get_ctm()); } void radial_gradient(double cx, double cy, double r, double fx, double fy, std::vector stops, const char* spread_method, const char* units="userSpaceOnUse") { typedef std::pair point_type; std::vector points; if (strcmp(units, "objectBoundingBox") == 0) { // Transform from relative coordinates kiva::rect_type const clip_rect = _get_path_bounds(); r = r * clip_rect.w; cx = clip_rect.x + cx * clip_rect.w; fx = clip_rect.x + fx * clip_rect.w; cy = clip_rect.y + cy * clip_rect.h; fy = clip_rect.y + fy * clip_rect.h; } points.push_back(point_type(cx, cy)); points.push_back(point_type(r, 0)); points.push_back(point_type(fx, fy)); this->state.gradient_fill = gradient(kiva::grad_radial, points, stops, spread_method, units); this->state.gradient_fill.set_ctm(this->get_ctm()); } private: template void fill_path_clip_conversion(path_type& input_path, agg24::filling_rule_e rule) { // !! non-clipped version is about 8% faster or so for lion if it // !! is entirely on the screen. It is slower, however, when // !! things are rendered off screen. Perhaps we should add a // !! compiled_path method for asking path what its bounding box // !! is and call this if it is all within the screen. //rasterizer.add_path(this->path); agg24::conv_clip_polygon clipped(input_path); clipped.clip_box(0,0, this->buf.width(), this->buf.height()); // fix me: We can do this more intelligently based on the current clip path. // fix me: What coordinates should this be in? I think in user space instead // of device space. This looks wrong... agg24::rasterizer_scanline_aa<> rasterizer; rasterizer.filling_rule(rule); rasterizer.add_path(clipped); if (this->state.gradient_fill.gradient_type == kiva::grad_none) { agg24::scanline_u8 scanline; // fix me: we need to select the renderer in another method. agg24::renderer_scanline_aa_solid< renderer_base_type > aa_renderer(this->renderer); // set fill color -- multiply by alpha if it is set. agg24::rgba color; color = this->state.fill_color; color.a *= this->state.alpha; aa_renderer.color(color); // draw the filled path to the buffer agg24::render_scanlines(rasterizer, scanline, aa_renderer); } else { this->state.gradient_fill.apply(this->renderer_pixfmt, &rasterizer, &this->renderer); } } //--------------------------------------------------------------- // Handle drawing filled rect quickly in some cases. //--------------------------------------------------------------- private: int _draw_rect_simple(double rect[4], draw_mode_e mode=FILL_STROKE); //--------------------------------------------------------------- // Draw_image pipeline //--------------------------------------------------------------- private: template void transform_image_interpolate(kiva::graphics_context& img, agg24::trans_affine& img_mtx) { agg24::path_storage img_outline = img.boundary_path(img_mtx); other_format src_pix(img.rendering_buffer()); agg24::trans_affine inv_img_mtx = img_mtx; inv_img_mtx.invert(); agg24::span_interpolator_linear<> interpolator(inv_img_mtx); agg24::rgba back_color = agg24::rgba(1,1,1,0); agg24::span_allocator span_alloc; // 1. Switch on filter type. switch (img.get_image_interpolation()) { case nearest: { typedef typename kiva::image_filters::nearest_type span_gen_type; typedef typename kiva::image_filters::source_type source_type; source_type source(src_pix, back_color); span_gen_type span_generator(source, interpolator); this->transform_image_final(img_outline, span_generator); break; } case bilinear: { typedef typename kiva::image_filters::bilinear_type span_gen_type; typedef typename kiva::image_filters::source_type source_type; source_type source(src_pix, back_color); span_gen_type span_generator(source, interpolator); this->transform_image_final(img_outline, span_generator); break; } case bicubic: case spline16: case spline36: case sinc64: case sinc144: case sinc256: case blackman64: case blackman100: case blackman256: { agg24::image_filter_lut filter; switch (img.get_image_interpolation()) { case bicubic: filter.calculate(agg24::image_filter_bicubic()); break; case spline16: filter.calculate(agg24::image_filter_spline16()); break; case spline36: filter.calculate(agg24::image_filter_spline36()); break; case sinc64: filter.calculate(agg24::image_filter_sinc64()); break; case sinc144: filter.calculate(agg24::image_filter_sinc144()); break; case sinc256: filter.calculate(agg24::image_filter_sinc256()); break; case blackman64: filter.calculate(agg24::image_filter_blackman64()); break; case blackman100: filter.calculate(agg24::image_filter_blackman100()); break; case blackman256: filter.calculate(agg24::image_filter_blackman256()); break; case nearest: case bilinear: break; } typedef typename kiva::image_filters::general_type span_gen_type; typedef typename kiva::image_filters::source_type source_type; source_type source(src_pix, back_color); span_gen_type span_generator(source, interpolator, filter); this->transform_image_final(img_outline, span_generator); break; } } } private: template void transform_image_final(agg24::path_storage& img_outline, span_gen_type span_generator) { typedef agg24::span_allocator span_alloc_type; span_alloc_type span_allocator; agg24::scanline_u8 scanline; agg24::rasterizer_scanline_aa<> rasterizer; if (this->state.alpha != 1.0) { rasterizer.gamma(alpha_gamma(this->state.alpha, 1.0)); } // fix me: This isn't handling clipping. [ Test. I think it should now] rasterizer.add_path(img_outline); agg24::render_scanlines_aa(rasterizer, scanline, this->renderer, span_allocator, span_generator); } }; template graphics_context::graphics_context(unsigned char *data, int width, int height, int stride, kiva::interpolation_e interp): graphics_context_base(data,width,height,stride,interp), renderer_pixfmt(buf), //renderer_single_clip(renderer_pixfmt), renderer(renderer_pixfmt) { // Required to set the clipping area of the renderer to the size of the buf. this->clear_clip_path(); } template kiva::pix_format_e graphics_context::format() { // The following dummy parameter is needed to pass in to agg_pix_to_kiva // because MSVC++ 6.0 doesn't properly handle template function // specialization (see notes in kiva_pix_format.h). agg_pixfmt *msvc6_dummy = NULL; return kiva::agg_pix_to_kiva(msvc6_dummy); } //--------------------------------------------------------------- // Restore state //--------------------------------------------------------------- template void graphics_context::restore_state() { if (this->state_stack.size() == 0) { return; } this->state = this->state_stack.top(); this->state_stack.pop(); this->path.restore_ctm(); // clear clippings paths and make renderer visible if (this->state.use_rect_clipping()) { if (this->state.device_space_clip_rects.size() > 0) { this->renderer.reset_clipping(true); // add all the clipping rectangles in sequence std::vector::iterator it; for (it = this->state.device_space_clip_rects.begin(); it < this->state.device_space_clip_rects.end(); it++) { this->renderer.add_clip_box(int(it->x), int(it->y), int(it->x2()), int(it->y2())); } } else { this->renderer.reset_clipping(false); } } else { this->renderer.reset_clipping(true); this->state.clipping_path = this->path; } } //--------------------------------------------------------------- // Clipping path manipulation //--------------------------------------------------------------- template void graphics_context::clip() { // this->state.clipping_path = this->path; agg24::scanline_p8 scanline; agg24::renderer_scanline_aa_solid< renderer_base_type > aa_renderer(this->renderer); agg24::rgba transparent = this->state.fill_color; transparent.a = 0; aa_renderer.color(transparent); this->stroke_path_scanline_aa(this->state.clipping_path, aa_renderer, scanline); } template void graphics_context::even_odd_clip() { throw kiva::even_odd_clip_error; } template kiva::rect_type graphics_context::transform_clip_rectangle(const kiva::rect_type &rect) { // This only works if the ctm doesn't have any rotation. // otherwise, we need to use a clipping path. Test for this. agg24::trans_affine tmp(this->path.get_ctm()); if ( !only_scale_and_translation(tmp)) { throw kiva::ctm_rotation_error; } double x = rect.x; double y = rect.y; double x2 = rect.x2(); double y2 = rect.y2(); this->path.get_ctm().transform(&x, &y); this->path.get_ctm().transform(&x2, &y2); // fix me: How should we round here? // maybe we should lrint, but I don't think it is portable. See // here: http://www.cs.unc.edu/~sud/tips/Programming_Tips.html x = int(floor(x+0.5)); y = int(floor(y+0.5)); // subtract 1 to account for agg (inclusive) vs. kiva (exclusive) clipping x2 = int(floor(x2+0.5))-1; y2 = int(floor(y2+0.5))-1; //x2 = int(floor(x2+0.5)); //y2 = int(floor(y2+0.5)); return kiva::rect_type(x, y, x2-x, y2-y); } template void graphics_context::clip_to_rect(double x, double y, double sx, double sy) { kiva::rect_type tmp(x, y, sx, sy); this->clip_to_rect(tmp); } template void graphics_context::clip_to_rect(kiva::rect_type &rect) { // Intersect the input rectangle with the current clipping path. // // 2/3/2005 Robert Kern noted that the Mac version forces a clear // of the path when calling clip_to_rect. We'll do the same to // lessen the potential for inconsistencies. this->path.remove_all(); if (this->state.use_rect_clipping()) { kiva::rect_type device_rect(transform_clip_rectangle(rect)); // optimize for case when there is only one existing rectangle if (this->state.device_space_clip_rects.size() == 1) { kiva::rect_type old(this->state.device_space_clip_rects.back()); this->state.device_space_clip_rects.pop_back(); kiva::rect_type newrect(kiva::disjoint_intersect(old, device_rect)); if ((newrect.w < 0) || (newrect.h < 0)) { // new clip rectangle doesn't intersect anything, so we push on // an empty rect as the new clipping region. this->renderer.reset_clipping(false); this->state.device_space_clip_rects.push_back(kiva::rect_type(0, 0, -1, -1)); } else { this->renderer.reset_clipping(true); this->renderer.add_clip_box(int(newrect.x), int(newrect.y), int(newrect.x2()), int(newrect.y2())); this->state.device_space_clip_rects.push_back(newrect); } } else { // we need to compute the intersection of the new rectangle with // the current set of clip rectangles. we assume that the existing // clip_rects are a disjoint set. this->state.device_space_clip_rects = kiva::disjoint_intersect( this->state.device_space_clip_rects, device_rect); if (this->state.device_space_clip_rects.size() == 0) { this->renderer.reset_clipping(false); this->state.device_space_clip_rects.push_back(kiva::rect_type(0, 0, -1, -1)); } else { this->renderer.reset_clipping(true); for (unsigned int i=0; istate.device_space_clip_rects.size(); i++) { kiva::rect_type *tmp = &this->state.device_space_clip_rects[i]; this->renderer.add_clip_box(int(tmp->x), int(tmp->y), int(tmp->x2()), int(tmp->y2())); } } } } else { // We don't support non-rect clipping. throw clipping_path_unsupported; } } template void graphics_context::clip_to_rects(kiva::rect_list_type &rects) { // calculate the disjoint union of the input rectangles kiva::rect_list_type new_rects = disjoint_union(rects); if (this->state.use_rect_clipping()) { // tranform and clip each new rectangle against the current clip_rects kiva::rect_list_type result_rects; for (kiva::rect_iterator it = new_rects.begin(); it != new_rects.end(); it++) { kiva::rect_type device_rect(transform_clip_rectangle(*it)); kiva::rect_list_type new_result_rects( kiva::disjoint_intersect(this->state.device_space_clip_rects, device_rect)); for (kiva::rect_iterator tmp_iter = new_result_rects.begin(); tmp_iter != new_result_rects.end(); tmp_iter++) { result_rects.push_back(*tmp_iter); } } if (result_rects.size() == 0) { // All areas are clipped out. this->state.device_space_clip_rects.clear(); this->state.device_space_clip_rects.push_back(kiva::rect_type(0, 0, -1, -1)); this->renderer.reset_clipping(false); } else { // Reset the renderer's clipping and add each new clip rectangle this->renderer.reset_clipping(true); for (kiva::rect_iterator it2 = result_rects.begin(); it2 != result_rects.end(); it2++) { this->renderer.add_clip_box(int(it2->x), int(it2->y), int(it2->x2()), int(it2->y2())); } this->state.device_space_clip_rects = result_rects; } } else { // We don't support non-rect clipping. throw clipping_path_unsupported; } } template void graphics_context::clip_to_rects(double* new_rects, int Nrects) { kiva::rect_list_type rectlist; for (int rectNum=0; rectNum < Nrects; rectNum++) { int ndx = rectNum*4; rectlist.push_back(kiva::rect_type(new_rects[ndx], new_rects[ndx+1], new_rects[ndx+2], new_rects[ndx+3])); } clip_to_rects(rectlist); } template void graphics_context::clear_clip_path() { // clear the existing clipping paths this->state.clipping_path.remove_all(); this->state.device_space_clip_rects.clear(); // set everything visible again. this->renderer.reset_clipping(1); // store the new clipping rectangle back into the first // rectangle of the graphics state clipping rects. this->state.device_space_clip_rects.push_back(this->renderer.clip_box()); } template int graphics_context::get_num_clip_regions() { return this->state.device_space_clip_rects.size(); } template kiva::rect_type graphics_context::get_clip_region(unsigned int i) { if (i >= this->state.device_space_clip_rects.size()) { return kiva::rect_type(); } else { return this->state.device_space_clip_rects[i]; } } //--------------------------------------------------------------- // Painting paths (drawing and filling contours) //--------------------------------------------------------------- template void graphics_context::clear(agg24::rgba value) { this->renderer.clear(value); } /* template void graphics_context::clear(double value) { this->renderer_single_clip.clear(value); } */ template void graphics_context::draw_path(draw_mode_e mode) { switch(mode) { case FILL: this->_fill_path(agg24::fill_non_zero); break; case EOF_FILL: this->_fill_path(agg24::fill_even_odd); break; case STROKE: this->_stroke_path(); break; case FILL_STROKE: this->_fill_path(agg24::fill_non_zero); this->_stroke_path(); break; case EOF_FILL_STROKE: this->_fill_path(agg24::fill_even_odd); this->_stroke_path(); break; } this->path.remove_all(); } template void graphics_context::draw_rect(double rect[4], draw_mode_e mode) { // Try a fast renderer first. int fast_worked = this->_draw_rect_simple(rect, mode); if (!fast_worked) { double x = rect[0]; double y = rect[1]; double sx = rect[2]; double sy = rect[3]; this->begin_path(); this->move_to(x, y); this->line_to(x+sx, y); this->line_to(x+sx, y+sy); this->line_to(x, y+sy); this->close_path(); this->draw_path(mode); } else { //printf("simple worked!\n"); } this->path.remove_all(); } template int graphics_context::_draw_rect_simple(double rect[4], draw_mode_e mode) { /* function requires that antialiasing is false and ctm doesn't have any rotation. */ //printf("trying _simple\n"); int success = 0; agg24::trans_affine ctm = this->get_ctm(); if ( !this->state.should_antialias && only_scale_and_translation(ctm) && (this->state.line_width == 1.0 || this->state.line_width == 0.0)) // fix me: should test for join style //&& this->state.line_join == JOIN_MITER ) { agg24::renderer_primitives renderer(this->renderer); renderer.fill_color(this->get_fill_color()); // use transparency to indicate a 0 width line agg24::rgba line_color = this->get_stroke_color(); line_color.a *= this->state.line_width; renderer.line_color(line_color); double temp[6]; ctm.store_to(temp); double scale_x = temp[0]; double scale_y = temp[3]; double tx = temp[4]; double ty = temp[5]; //printf("rect: %d, %d %d, %d\n", rect[0], rect[1], rect[2], rect[3]); //printf("trans, scale: %d, %d %d, %d\n", tx, ty, scale_x, scale_y); // fix me: need to handle rounding here... int x1 = int(rect[0]*scale_x + tx); int y1 = int(rect[1]*scale_y + ty); int x2 = int((rect[0]+rect[2])*scale_x + tx); int y2 = int((rect[1]+rect[3])*scale_y + ty); if (mode == FILL_STROKE || mode == EOF_FILL_STROKE) { //printf("fill stroke: %d, %d %d, %d\n", x1, y1, x2, y2); renderer.outlined_rectangle(x1, y1, x2, y2); // This isn't right, but it should be faster. Interestingly, // it didn't seem to be. //this->renderer.copy_bar(x1, y1, x2, y2, this->get_fill_color()); success = 1; } else if (mode == STROKE ) { //printf("stroke: %d, %d %d, %d\n", x1, y1, x2, y2); renderer.rectangle(x1, y1, x2, y2); success = 1; } else if (mode == FILL || mode == EOF_FILL ) { //printf("fill: %d, %d %d, %d\n", x1, y1, x2, y2); renderer.solid_rectangle(x1, y1, x2, y2); success = 1; } } return success; } template int graphics_context::draw_marker_at_points(double* pts,int Npts,int size, agg24::marker_e type) { int success = 0; agg24::trans_affine ctm = this->get_ctm(); if ( only_translation(ctm) && (this->state.line_width == 1.0 || this->state.line_width == 0.0)) //&& this->state.line_join == JOIN_MITER ) { // TODO-PZW: fix this!! agg24::renderer_markers< renderer_base_type > m(this->renderer); m.fill_color(this->get_fill_color()); // use transparency to indicate an 0 width line agg24::rgba line_color = this->get_stroke_color(); line_color.a *= this->state.line_width; m.line_color(line_color); double tx, ty; get_translation(ctm, &tx, &ty); for(int i = 0; i < Npts*2; i+=2) { m.marker((int)(pts[i]+tx), int(pts[i+1]+ty), size, type); } success = 1; } return success; } template void graphics_context::draw_path_at_points(double* pts,int Npts, kiva::compiled_path& marker, draw_mode_e mode) { // This routine draws a path (i.e. marker) at multiple points // on the screen. It is used heavily when rendering scatter // plots. // // The routine has been special cased to handle the filling // markers without outlining them when the ctm doesn't have // rotation, scaling, or skew. // // fastest path // (1) We're only using FILL mode. // (2) ctm is identity matrix // fast path // (1) We're only using FILL mode. // (2) ctm just has translational components (tx,ty) // normal path // Everything else. // !! This path commented out. We don't have any cases // !! currently where draw_marker_at_points won't work, // !! so we provide fast and slow without taking the time // !! to update the inbetween route. // no outline if (0) //(!(mode & STROKE) || state.line_color.a == 0.0) { /* // set fill color -- multiply by alpha if it is set. agg24::rgba color; color = this->state.fill_color; color.a *= this->state.alpha; this->renderer.attribute(color); agg24::trans_affine ctm = this->get_ctm(); // set the rasterizer filling rule if (mode & FILL) this->rasterizer.filling_rule(agg24::fill_non_zero); else if (mode & EOF_FILL) this->rasterizer.filling_rule(agg24::fill_even_odd); // fastest path if (is_identity(ctm)) { for(int i = 0; i < Npts*2; i+=2) { const double x = pts[i]; const double y = pts[i+1]; this->rasterizer.add_path(marker,x,y); this->rasterizer.render(renderer); } } // 2nd fastest path else if (only_translation(ctm)) { double temp[6]; this->get_ctm().store_to(temp); double tx = temp[4]; double ty = temp[5]; for(int i = 0; i < Npts*2; i+=2) { const double x = pts[i] + tx; const double y = pts[i+1] + ty; this->rasterizer.add_path(marker,x,y); this->rasterizer.render(renderer); } } */ } // outlined draw mode or // complicated ctm (rotation,scaling, or skew) else { this->begin_path(); for(int i = 0; i < Npts*2; i+=2) { const double x = pts[i]; const double y = pts[i+1]; // This is faster than saving the entire state. this->path.save_ctm(); this->translate_ctm(x,y); this->add_path(marker); this->draw_path(mode); this->path.restore_ctm(); } } } template bool graphics_context::show_text(char*text) { typedef agg24::glyph_raster_bin GlyphGeneratorType; typedef agg24::renderer_scanline_aa_solid ScanlineRendererType; //GlyphGeneratorType glyphGen(0); ScanlineRendererType scanlineRenderer(this->renderer); const agg24::glyph_cache *glyph = NULL; // Explicitly decode UTF8 bytes to 32-bit codepoints to feed into the // font API. size_t text_length = strlen(text); utf8::iterator p(text, text, text+text_length); utf8::iterator p_end(text+text_length, text, text+text_length); bool retval = true; // Check to make sure the font's loaded. if (!this->is_font_initialized()) { return false; } this->_grab_font_manager(); font_engine_type *font_engine = kiva::GlobalFontEngine(); font_manager_type *font_manager = kiva::GlobalFontManager(); // Concatenate the CTM with the text matrix to get the full transform for the // font engine. agg24::trans_affine full_text_xform(this->text_matrix * this->path.get_ctm()); // the AGG freetype transform is a per character transform. We need to remove the // offset part of the transform to prevent that offset from occuring between each // character. We'll handle the intial offset ourselves. double start_x, start_y; double text_xform_array[6]; full_text_xform.store_to(text_xform_array); // Pull the translation values out of the matrix as our starting offset and // then replace them with zeros for use in the font engine. start_x = text_xform_array[4]; start_y = text_xform_array[5]; text_xform_array[4] = 0.0; text_xform_array[5] = 0.0; full_text_xform.load_from(text_xform_array); font_engine->transform(full_text_xform); if (this->state.text_drawing_mode == kiva::TEXT_FILL) { scanlineRenderer.color(this->state.fill_color); } else if ((this->state.text_drawing_mode == kiva::TEXT_STROKE) || (this->state.text_drawing_mode == kiva::TEXT_FILL_STROKE)) { scanlineRenderer.color(this->state.line_color); } double advance_x = 0.0; double advance_y = 0.0; for (; p!=p_end; ++p) { double x = start_x + advance_x; double y = start_y + advance_y; glyph = font_manager->glyph(*p); if (glyph == NULL) { retval = false; break; } font_manager->add_kerning(&x, &y); font_manager->init_embedded_adaptors(glyph, x, y); if (this->state.text_drawing_mode != kiva::TEXT_INVISIBLE) { agg24::render_scanlines(font_manager->gray8_adaptor(), font_manager->gray8_scanline(), scanlineRenderer); } advance_x += glyph->advance_x; advance_y += glyph->advance_y; } agg24::trans_affine null_xform = agg24::trans_affine_translation(0., 0.); font_engine->transform(null_xform); this->_release_font_manager(); agg24::trans_affine trans = agg24::trans_affine_translation(advance_x, advance_y); this->text_matrix.multiply(trans); return retval; } template int graphics_context::draw_image(kiva::graphics_context_base* img, double rect[4], bool force_copy) { int success = 0; // We have to scale first and then translate; otherwise, Agg will cause // the translation to be scaled as well. double sx = rect[2]/img->width(); double sy = rect[3]/img->height(); agg24::trans_affine img_mtx = agg24::trans_affine_scaling(sx,sy); img_mtx *= agg24::trans_affine_translation(rect[0],rect[1]); img_mtx *= this->path.get_ctm(); double tx, ty; get_translation(img_mtx, &tx, &ty); //success = transform_image(img, img_mtx); // The following section attempts to use a fast method for blending in // cases where the full interpolation methods aren't needed. // When there isn't any scaling or rotation, try a fast method for // copy or blending the pixels. They will fail if pixel formats differ... // If the user is forcing us to respect the blend_copy mode regardless // of the CTM, then we make it so. // fix me: Not testing whether tx, ty are (nearly) integer values. // We should. if (only_translation(img_mtx) || force_copy) { if (this->state.blend_mode == kiva::blend_copy) { success = this->copy_image(img, (int) tx, (int) ty); } else { success = this->blend_image(img, (int)tx, (int)ty); } } if (!success) { // looks like the fast approach didn't work -- there is some // transform to the matrix so we'll use an interpolation scheme. // We're just starting blend_mode support. From here down, we // only support normal. if (!(this->state.blend_mode == kiva::blend_normal)) { success = 0; return success; } success = transform_image(img, img_mtx); } return success; } template int graphics_context::copy_image(kiva::graphics_context_base* img, int tx, int ty) { // This function is only valid if only_translation(ctm) == True and // image is not to be scaled. int success = 0; // Copy only works if images have the same format. // fix me: This restriction should be fixed. // fix me: We are ignoring that tx and ty are double. test that // we are close. Otherwise, we need to use interpolation. if (img->format() != this->format()) { //doesn't meet requirements printf("copy_image() on this gc requires format %d, got %d.", this->format(), img->format()); success = 0; } else { agg24::rect_i r(0, 0, img->width(), img->height()); this->renderer.copy_from(img->buf, &r, tx, ty); success = 1; } return success; } template int graphics_context::blend_image(kiva::graphics_context_base* img, int tx, int ty) { // This function is only valid if only_translation(ctm) == True and // image is not to be scaled. // Note: I thought I needed to negate the tx,ty in here, but it doesn't // turn out to be true. int success = 0; unsigned int alpha = unsigned(this->state.alpha*255); // Check that format match. I think the formats // actually only have to have the same number of channels, // so this test is to restrictive. // fix me: lighten up this format restrictions. // fix me: We are ignoring that tx and ty are double. test that // we are close. Otherwise, we need to use interpolation. if (img->format() != this->format()) { //doesn't meet requirements success = 0; } else { agg24::rect_i r(0, 0, img->width(), img->height()); switch (img->format()) { // fix me: agg 2.4 doesn't work for blending rgb values into other buffers. // I think this should be fixed, but I also think it would take // some major agg hackery. case kiva::pix_format_rgb24: case kiva::pix_format_bgr24: success = 0; break; //case kiva::pix_format_rgb24: //{ // typedef kiva::graphics_context pix_format_type; // this->renderer.blend_from(static_cast(img)->renderer_pixfmt, // &r, tx, ty, alpha); // success = 1; // break; //} // //case kiva::pix_format_bgr24: //{ // typedef kiva::graphics_context pix_format_type; // this->renderer.blend_from(static_cast(img)->renderer_pixfmt, // &r, tx, ty, alpha); // success = 1; // break; //} case kiva::pix_format_rgba32: { typedef kiva::graphics_context pix_format_type; this->renderer.blend_from(static_cast(img)->renderer_pixfmt, &r, tx, ty, alpha); success = 1; break; } case kiva::pix_format_argb32: { typedef kiva::graphics_context pix_format_type; this->renderer.blend_from(static_cast(img)->renderer_pixfmt, &r, tx, ty, alpha); success = 1; break; } case kiva::pix_format_abgr32: { typedef kiva::graphics_context pix_format_type; this->renderer.blend_from(static_cast(img)->renderer_pixfmt, &r, tx, ty, alpha); success = 1; break; } case kiva::pix_format_bgra32: { typedef kiva::graphics_context pix_format_type; this->renderer.blend_from(static_cast(img)->renderer_pixfmt, &r, tx, ty, alpha); success = 1; break; } case kiva::pix_format_undefined: case kiva::pix_format_gray8: case kiva::pix_format_rgb555: case kiva::pix_format_rgb565: case kiva::end_of_pix_formats: default: { // format not valid. success = 0; } } } return success; } template int graphics_context::transform_image(kiva::graphics_context_base* img, agg24::trans_affine& img_mtx) { int success = 0; switch (img->format()) { case kiva::pix_format_rgb24: { typedef kiva::graphics_context gc_type; this->transform_image_interpolate(*(static_cast(img)), img_mtx); success = 1; break; } case kiva::pix_format_bgr24: { typedef kiva::graphics_context gc_type; this->transform_image_interpolate(*(static_cast(img)), img_mtx); success = 1; break; } case kiva::pix_format_rgba32: { typedef kiva::graphics_context gc_type; this->transform_image_interpolate(*(static_cast(img)), img_mtx); success = 1; break; } case kiva::pix_format_argb32: { typedef kiva::graphics_context gc_type; this->transform_image_interpolate(*(static_cast(img)),img_mtx); success = 1; break; } case kiva::pix_format_abgr32: { typedef kiva::graphics_context gc_type; this->transform_image_interpolate(*(static_cast(img)),img_mtx); success = 1; break; } case kiva::pix_format_bgra32: { typedef kiva::graphics_context gc_type; this->transform_image_interpolate(*(static_cast(img)),img_mtx); success = 1; break; } case kiva::pix_format_undefined: case kiva::pix_format_gray8: case kiva::pix_format_rgb555: case kiva::pix_format_rgb565: case kiva::end_of_pix_formats: default: { // format not valid. success = 0; } } return success; } typedef graphics_context graphics_context_rgb24; typedef graphics_context graphics_context_bgr24; typedef graphics_context graphics_context_bgra32; typedef graphics_context graphics_context_rgba32; typedef graphics_context graphics_context_argb32; typedef graphics_context graphics_context_abgr32; } // namespace kiva #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/numeric_ext.i0000644000175000017500000000616213233644505021662 0ustar varunvarun%include "numeric.i" %{ #ifndef NUMPY #include "Numeric/arrayobject.h" /* This is the basic array allocation function. */ PyObject *PyArray_FromDimsAndStridesAndDataAndDescr(int nd, int *d, int* st, PyArray_Descr *descr, char *data) { PyArrayObject *self; int i,sd; int *dimensions, *strides; int flags= CONTIGUOUS | OWN_DIMENSIONS | OWN_STRIDES; //static int calls = 0; //calls++; //printf("allocs: %d\n;", calls); dimensions = strides = NULL; if (nd < 0) { PyErr_SetString(PyExc_ValueError, "number of dimensions must be >= 0"); return NULL; } if (nd > 0) { if ((dimensions = (int *)malloc(nd*sizeof(int))) == NULL) { PyErr_SetString(PyExc_MemoryError, "can't allocate memory for array"); goto fail; } if ((strides = (int *)malloc(nd*sizeof(int))) == NULL) { PyErr_SetString(PyExc_MemoryError, "can't allocate memory for array"); goto fail; } memmove(dimensions, d, sizeof(int)*nd); memmove(strides, st, sizeof(int)*nd); } // This test for continguity sd = descr->elsize; for(i=nd-1;i>=0;i--) { if (strides[i] <= 0) { PyErr_SetString(PyExc_ValueError, "strides must be positive"); goto fail; } if (dimensions[i] <= 0) { /* only allow positive dimensions in this function */ PyErr_SetString(PyExc_ValueError, "dimensions must be positive"); goto fail; } if (strides[i] != sd) { flags &= !CONTIGUOUS; } /* This may waste some space, but it seems to be (unsuprisingly) unhealthy to allow strides that are longer than sd. */ sd *= dimensions[i] ? dimensions[i] : 1; } /* Make sure we're alligned on ints. */ sd += sizeof(int) - sd%sizeof(int); if (data == NULL) { if ((data = (char *)malloc(sd)) == NULL) { PyErr_SetString(PyExc_MemoryError, "can't allocate memory for array"); goto fail; } flags |= OWN_DATA; } if((self = PyObject_NEW(PyArrayObject, &PyArray_Type)) == NULL) goto fail; if (flags & OWN_DATA) memset(data, 0, sd); self->data=data; self->dimensions = dimensions; self->strides = strides; self->nd=nd; self->descr=descr; self->base = (PyObject *)NULL; self->flags = flags; /* Numeric versions prior to 23.3 do not have the weakreflist field. By default we include it. You must explicitly define: NUMERIC_DOES_NOT_HAVE_WEAKREF */ #ifndef NUMERIC_DOES_NOT_HAVE_WEAKREF self->weakreflist = (PyObject *)NULL; #endif return (PyObject*)self; fail: if (flags & OWN_DATA) free(data); if (dimensions != NULL) free(dimensions); if (strides != NULL) free(strides); return NULL; } #endif %}enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_dash_type.h0000644000175000017500000000227213233644505022327 0ustar varunvarun#ifndef DASH_TYPE_H #define DASH_TYPE_H #include namespace kiva { //----------------------------------------------------------------------- // line dash type //----------------------------------------------------------------------- class dash_type { public: double phase; std::vector pattern; // constructor dash_type(): phase(0),pattern(2,0) { } // this forces even length of pattern dash_type(double _phase, double* _pattern, int n): phase(_phase), pattern(n%2 ? n+1 : n) { for(int i = 0; i < n; i++) pattern[i] = _pattern[i]; // for odd length patterns, use the first entry as the // last gap size. (this is arbitrary) if (n%2) pattern[n] = _pattern[0]; } ~dash_type() { } bool is_solid() { return (pattern.size() == 2 && pattern[0] == 0.); } // TODO-PZW: define a copy constructor }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_graphics_state.h0000644000175000017500000000651313233644505023351 0ustar varunvarun#ifndef GRAPHICS_STATE_H #define GRAPHICS_STATE_H #include #include "agg_trans_affine.h" #include "kiva_constants.h" #include "kiva_font_type.h" #include "kiva_dash_type.h" #include "kiva_compiled_path.h" #include "kiva_gradient.h" #include namespace kiva { //----------------------------------------------------------------------- // graphics_state class //----------------------------------------------------------------------- class graphics_state { public: // line attributes agg24::rgba line_color; double line_width; kiva::line_cap_e line_cap; kiva::line_join_e line_join; kiva::dash_type line_dash; // other attributes kiva::blend_mode_e blend_mode; kiva::font_type font; agg24::rgba fill_color; gradient gradient_fill; double alpha; // clipping path // In general, we need a path to store the clipping region. // However, in most cases, the clipping region can be represented // by a list of rectangles. The graphics state can support one or // the other, but not both. By default, device_space_clip_rects is // used; but as soon as a non-rectangular clip path is added to // the graphics state or the rectangular region is rotated, then // it becomes an arbitrary clipping path. // // device_space_clip_rects always contains at least one rectangle. // In the event that everything is clipped out, the clip rectangle // will have dimensions (0,0). // // The function use_rect_clipping is used to determine whether or // not to use device_space_clip_rects. 'true' means to use it, 'false' // means ot use clipping_path; kiva::compiled_path clipping_path; std::vector device_space_clip_rects; inline bool use_rect_clipping(); double current_point[2]; // !! not sure about this. int should_antialias; double miter_limit; double flatness; // !! not sure about this type. double character_spacing; //!! not sure about this type. kiva::text_draw_mode_e text_drawing_mode; // double rendering_intent; // !! I know this type is wrong... graphics_state(): line_color(agg24::rgba(0.0,0.0,0.0)),line_width(1.0), line_cap(kiva::CAP_BUTT), line_join(kiva::JOIN_MITER), blend_mode(kiva::blend_normal), font(kiva::font_type("")), fill_color(agg24::rgba(0.0,0.0,0.0)), gradient_fill(kiva::grad_none), alpha(1.0), should_antialias(1), text_drawing_mode(kiva::TEXT_FILL) { } ~graphics_state() { } inline bool is_singleclip() { return (device_space_clip_rects.size() <= 1 ? true : false); } }; inline bool graphics_state::use_rect_clipping() { if (clipping_path.total_vertices() > 0) { std::cout << "clipping path has vertices" << std::endl; return false; } return true; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/gl/0000755000175000017500000000000013544357627017576 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/src/gl/plat_support.i0000644000175000017500000000713313233644505022475 0ustar varunvarun// -*- c++ -*- // OpenGL support for AGG // Author: Robert Kern // I've consolidated agg_platform_specific and agg_bmp in the process of // understanding the code. // plat_support defines a function resize_gl(width, height) which should be called // every time the window gets resized. All OpenGL initialization and glViewport // calls need to be done by the widget toolkit. // Currently, OpenGL support is only tested with wxWidgets 2.5.1.5 on MacOS X // version 10.3 %module plat_support %include numeric.i %{ #include "gl/agg_bmp.h" namespace agg24 { PyObject* pixel_map_as_unowned_array(agg24::pixel_map& pix_map) { npy_intp dims[3]; npy_intp rows = pix_map.height(); npy_intp cols = pix_map.width(); npy_intp depth = pix_map.bpp() / 8; dims[0] = rows; dims[1] = cols; dims[2] = depth; return PyArray_SimpleNewFromData(3,dims,NPY_UINT8,(void*)pix_map.buf()); } void resize_gl(unsigned width, unsigned height) { GLint viewport[4]; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, (GLfloat)width, 0.0, (GLfloat)height); glPixelZoom(1.0, -1.0); glGetIntegerv(GL_VIEWPORT, viewport); glRasterPos2d(0.0, ((double)height*height)/viewport[3]); } } %} // More permissive unsigned typemap that converts any numeric type to an // unsigned value. It is cleared at the end of this file. %typemap(in) unsigned { PyObject* obj = PyNumber_Long($input); if (PyErr_Occurred()) SWIG_fail; $1 = (unsigned) PyLong_AsLong(obj); if (PyErr_Occurred()) SWIG_fail; } namespace agg24 { enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_gray8, // Simple 256 level grayscale pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_bgr24, // B-G-R, native win32 BMP format. pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_argb32, // A-R-G-B, native MAC format pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_bgra32, // B-G-R-A, native win32 BMP format end_of_pix_formats }; %name(PixelMap) class pixel_map { public: ~pixel_map(); pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up); public: %feature("shadow") draw(int x, int y, double scale) %{ def draw(self, x=0, y=0, scale=1.0): # fix me: brittle becuase we are hard coding # module and class name. Done cause SWIG 1.3.24 does # some funky overloading stuff in it that breaks keyword # arguments. result = _plat_support.PixelMap_draw(self, x, y, scale) return result %} void draw(int x, int y, double scale); PyObject* convert_to_argb32string() const; %pythoncode %{ def set_bmp_array(self): self.bmp_array = pixel_map_as_unowned_array(self) return self def draw_to_glcanvas(self, x, y): self.draw(x, y) %} }; PyObject* pixel_map_as_unowned_array(pixel_map& pix_map); void resize_gl(unsigned width, unsigned height); } // clear the "permissive" unsigned typemap we are using. %typemap(in) unsigned; enthought-chaco2-4.8.1.orig/kiva/agg/src/gl/agg_bmp.cpp0000644000175000017500000001611213233644505021664 0ustar varunvarun#include #include #include "gl/agg_bmp.h" //#include "gl/agg_platform_specific.h" #include "agg_pixfmt_rgba.h" #include "agg_color_rgba.h" #include "bytesobject.h" #if 0 #define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); #define DEBUG_MTH2(STR,ARG1,ARG2) fprintf(stderr, STR "\n",(ARG1),(ARG2)); #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) fprintf(stderr, STR "\n",(ARG1),(ARG2),(ARG3),(ARG4),(ARG5)); #else #define DEBUG_MTH(NAME) #define DEBUG_MTH2(STR,ARG1,ARG2) #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) #endif namespace agg24 { //------------------------------------------------------------------------ pixel_map::pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up): m_buf(NULL), m_buf2(NULL), m_format(format) // m_specific(new platform_specific(format, bottom_up)) { DEBUG_MTH5("pixel_map::pixel_map(%d,%d,%d,%d,%d)",width,height,format,clear_val,bottom_up); init_platform(format, bottom_up); create(width, height, clear_val); } //------------------------------------------------------------------------ void pixel_map::init_platform(pix_format_e format, bool bottom_up) { switch(m_format) { case pix_format_gray8: m_sys_format = pix_format_gray8; m_bpp = 8; m_sys_bpp = 8; m_gl_format = GL_LUMINANCE; m_gl_pixel_type = GL_UNSIGNED_BYTE; break; case pix_format_rgb555: case pix_format_rgb565: m_sys_format = pix_format_rgb565; m_bpp = 16; m_sys_bpp = 16; m_gl_format = GL_RGB; m_gl_pixel_type = GL_UNSIGNED_SHORT_5_6_5; break; case pix_format_rgb24: m_sys_format = pix_format_rgb24; m_bpp = 24; m_sys_bpp = 24; m_gl_format = GL_RGB; m_gl_pixel_type = GL_UNSIGNED_BYTE; break; case pix_format_bgr24: m_sys_format = pix_format_bgr24; m_bpp = 24; m_sys_bpp = 24; m_gl_format = GL_BGR; m_gl_pixel_type = GL_UNSIGNED_BYTE; break; case pix_format_bgra32: case pix_format_abgr32: m_sys_format = pix_format_bgra32; m_bpp = 32; m_sys_bpp = 32; m_gl_format = GL_BGRA; m_gl_pixel_type = GL_UNSIGNED_BYTE; break; case pix_format_argb32: case pix_format_rgba32: m_sys_format = pix_format_rgba32; m_bpp = 32; m_sys_bpp = 32; m_gl_format = GL_RGBA; m_gl_pixel_type = GL_UNSIGNED_BYTE; break; case pix_format_undefined: case end_of_pix_formats: ; } } //------------------------------------------------------------------------ unsigned pixel_map::calc_row_len(unsigned width, unsigned bits_per_pixel) { unsigned n = width; unsigned k; switch(bits_per_pixel) { case 1: k = n; n = n >> 3; if(k & 7) n++; break; case 4: k = n; n = n >> 1; if(k & 3) n++; break; case 8: break; case 16: n = n << 1; break; case 24: n = (n << 1) + n; break; case 32: n = n << 2; break; default: n = 0; break; } return ((n + 3) >> 2) << 2; } //------------------------------------------------------------------------ pixel_map::~pixel_map() { DEBUG_MTH("pixel_map::~pixel_map"); destroy(); } //------------------------------------------------------------------------ void pixel_map::destroy() { if (m_buf) { delete [] (unsigned char*)m_buf; } m_buf = NULL; if (m_buf2) { delete [] (unsigned char*)m_buf2; } m_buf2 = NULL; } //------------------------------------------------------------------------ void pixel_map::create(unsigned width, unsigned height, unsigned clear_val) { destroy(); if(width == 0) width = 1; if(height == 0) height = 1; unsigned row_len = calc_row_len(width, m_bpp); unsigned img_size = row_len * height; m_buf = new unsigned char[img_size]; if(clear_val <= 255) { memset(m_buf, clear_val, img_size); } m_rbuf_window.attach(m_buf, width, height, row_len); if (m_format != m_sys_format) { row_len = calc_row_len(width, m_sys_bpp); img_size = row_len*height; m_buf2 = new unsigned char[img_size]; if (clear_val <= 255) { memset(m_buf2, clear_val, img_size); } m_rbuf_window2.attach(m_buf2, width, height, row_len); } } //------------------------------------------------------------------------ void pixel_map::draw(int x, int y, double scale) { DEBUG_MTH("pixel_map::draw"); if(m_buf == 0) return; // m_specific->display_pmap(&m_rbuf_window); if (m_sys_format == m_format) { glDrawPixels(width(), height(), m_gl_format, m_gl_pixel_type, m_buf); } else { switch(m_format) { case pix_format_abgr32: color_conv(&m_rbuf_window2, &m_rbuf_window, color_conv_abgr32_to_bgra32()); break; case pix_format_argb32: color_conv(&m_rbuf_window2, &m_rbuf_window, color_conv_argb32_to_bgra32()); break; case pix_format_rgb555: color_conv(&m_rbuf_window2, &m_rbuf_window, color_conv_rgb555_to_rgb565()); break; // case pix_format_rgb565: // case pix_format_rgb24: // case pix_format_bgr24: // case pix_format_rgba32: // case pix_format_bgra32: // case pix_format_gray8: case end_of_pix_formats: case pix_format_undefined: ; } glDrawPixels(width(), height(), m_gl_format, m_gl_pixel_type, m_buf2); } } pix_format_e pixel_map::get_pix_format() const { return m_format; } unsigned char* pixel_map::buf() { return m_buf; } unsigned char* pixel_map::buf2() { return m_buf2; } unsigned pixel_map::width() const { return m_rbuf_window.width(); } unsigned pixel_map::height() const { return m_rbuf_window.height(); } int pixel_map::stride() { return calc_row_len(width(), m_bpp); } // Convert to a Python string containing 32 bit ARGB values. PyObject* pixel_map::convert_to_argb32string() const { unsigned w = width(); unsigned h = height(); PyObject *str = PyBytes_FromStringAndSize(NULL, w * h * 4); if (str == NULL) return NULL; unsigned *data = (unsigned *)PyBytes_AS_STRING(str); pix_format_e format = get_pix_format(); switch (format) { case pix_format_bgra32: { pixfmt_bgra32 r((rendering_buffer &)m_rbuf_window); for (unsigned j = 0; j < h; ++j) for (unsigned i = 0; i < w; ++i) { rgba8 c = r.pixel(i, h - j - 1); *data++ = (((unsigned char)c.a) << 24) | (((unsigned char)c.r) << 16) | (((unsigned char)c.g) << 8) | ((unsigned char)c.b); } } break; default: Py_DECREF(str); PyErr_Format(PyExc_ValueError, "pix_format %d not handled", format); return NULL; } return str; } } enthought-chaco2-4.8.1.orig/kiva/agg/src/gl/agg_bmp.h0000644000175000017500000000461413233644505021335 0ustar varunvarun// -*- c++ -*- #ifndef AGG_GL_BMP_INCLUDED #define AGG_GL_BMP_INCLUDED #include "Python.h" #include "agg_basics.h" #include "agg_rendering_buffer.h" #include "util/agg_color_conv_rgb8.h" #ifdef __DARWIN__ #include #include #else #include #include #endif namespace agg24 { enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_gray8, // Simple 256 level grayscale pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_bgr24, // B-G-R, native win32 BMP format. pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_argb32, // A-R-G-B, native MAC format pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_bgra32, // B-G-R-A, native win32 BMP format end_of_pix_formats }; class pixel_map { public: pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up); ~pixel_map(); void draw(int x=0, int y=0, double scale=1.0); void init_platform(pix_format_e format, bool bottom_up); unsigned calc_row_len(unsigned width, unsigned bits_per_pixel); pix_format_e get_pix_format() const; unsigned char* buf(); unsigned char* buf2(); unsigned width() const; unsigned height() const; int stride(); unsigned bpp() const { return m_bpp; } rendering_buffer& rbuf() { return m_rbuf_window; } rendering_buffer& rbuf2() { return m_rbuf_window2; } PyObject* convert_to_argb32string() const; pix_format_e m_format; pix_format_e m_sys_format; private: void destroy(); void create(unsigned width, unsigned height, unsigned clear_val=256); unsigned char* m_buf; unsigned char* m_buf2; rendering_buffer m_rbuf_window; rendering_buffer m_rbuf_window2; unsigned m_bpp; unsigned m_sys_bpp; GLenum m_gl_format; GLenum m_gl_pixel_type; // public: // platform_specific* m_specific; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/win32/0000755000175000017500000000000013544357627020136 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/src/win32/agg_platform_specific.cpp0000644000175000017500000002267413233644505025151 0ustar varunvarun #include #include #include #include "agg_basics.h" #include "util/agg_color_conv_rgb8.h" #include "win32/agg_platform_specific.h" #include "win32/agg_bmp.h" #if 0 #define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); #define DEBUG_MTH2(STR,ARG1,ARG2) fprintf(stderr, STR "\n",(ARG1),(ARG2)); #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) fprintf(stderr, STR "\n",(ARG1),(ARG2),(ARG3),(ARG4),(ARG5)); #else #define DEBUG_MTH(NAME) #define DEBUG_MTH2(STR,ARG1,ARG2) #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) #endif namespace agg24 { dib_display::dib_display() { } dib_display::~dib_display() { } BImage* dib_display::create_image(const rendering_buffer* rbuf, unsigned bits_per_pixel) { DEBUG_MTH("dib_display::create_image"); unsigned width = rbuf->width(); unsigned height = rbuf->height(); unsigned line_len = platform_specific::calc_row_len(width, bits_per_pixel); unsigned img_size = line_len * height; unsigned rgb_size = calc_palette_size(0, bits_per_pixel) * sizeof(RGBQUAD); unsigned full_size = sizeof(BITMAPINFOHEADER) + rgb_size;// + img_size; BITMAPINFO *bmp = (BITMAPINFO *) new unsigned char[full_size]; bmp->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp->bmiHeader.biWidth = width; bmp->bmiHeader.biHeight = -height; bmp->bmiHeader.biPlanes = 1; bmp->bmiHeader.biBitCount = (unsigned short)bits_per_pixel; bmp->bmiHeader.biCompression = 0; bmp->bmiHeader.biSizeImage = img_size; bmp->bmiHeader.biXPelsPerMeter = 0; bmp->bmiHeader.biYPelsPerMeter = 0; bmp->bmiHeader.biClrUsed = 0; bmp->bmiHeader.biClrImportant = 0; RGBQUAD *rgb = (RGBQUAD*)(((unsigned char*)bmp) + sizeof(BITMAPINFOHEADER)); unsigned brightness; unsigned i; for(i = 0; i < rgb_size; i++) { brightness = (255 * i) / (rgb_size - 1); rgb->rgbBlue = rgb->rgbGreen = rgb->rgbRed = (unsigned char)brightness; rgb->rgbReserved = 0; rgb++; } BImage* image = new BImage; image->bmp = bmp; image->data = (unsigned char*)rbuf->buf(); return image; } void dib_display::destroy_image(BImage* image) { if (image != NULL) { delete [] (unsigned char*)(image->bmp); delete [] (unsigned char*)(image->data); // using XDestroyImage behavior. delete image; } } unsigned dib_display::calc_header_size(BITMAPINFO *bmp) { if (bmp == NULL) { return 0; } else { return sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * calc_palette_size(bmp); } } unsigned dib_display::calc_palette_size(BITMAPINFO *bmp) { if (bmp == 0) { return 0; } else { return calc_palette_size(bmp->bmiHeader.biClrUsed, bmp->bmiHeader.biBitCount); } } unsigned dib_display::calc_palette_size(unsigned clr_used, unsigned bits_per_pixel) { int palette_size = 0; if(bits_per_pixel <= 8) { palette_size = clr_used; if(palette_size == 0) { palette_size = 1 << bits_per_pixel; } } return palette_size; } bool dib_display::put_image(HDC dc, BImage *image, int draw_x, int draw_y, int draw_width, int draw_height) { DEBUG_MTH("dib_display::put_image"); // If specified, only do a partial blit of the image int dest_x, dest_y, src_x, src_y, src_width, src_height; if (draw_x != -1 && draw_y != -1 && draw_width != -1 && draw_height != -1) { src_x = draw_x; src_y = draw_y; dest_y = -image->bmp->bmiHeader.biHeight - draw_y - draw_height; dest_x = draw_x; src_width = draw_width; src_height = draw_height; } else { src_x = 0; src_y = 0; dest_x = 0; dest_y = 0; src_width = image->bmp->bmiHeader.biWidth; src_height = -image->bmp->bmiHeader.biHeight; } ::SetDIBitsToDevice( dc, // handle to device context dest_x, // x-coordinate of upper-left corner of dest dest_y, // y-coordinate of upper-left corner of dest src_width, // source rectangle width src_height, // source rectangle height src_x, // x-coordinate of lower-left corner of source src_y, // y-coordinate of lower-left corner of source 0, // first scan line in array -image->bmp->bmiHeader.biHeight, // number of scan lines image->data, // address of array with DIB bits image->bmp, // address of structure with bitmap info. DIB_RGB_COLORS // RGB or palette indexes ); return true; } dib_display platform_specific::dib; //------------------------------------------------------------------------ platform_specific::platform_specific(pix_format_e format, bool flip_y) : m_bpp(0), m_flip_y(flip_y), m_bimage(0), m_format(format), m_sys_format(pix_format_undefined), m_sys_bpp(0) { switch(m_format) { case pix_format_gray8: m_sys_format = pix_format_gray8; m_bpp = 8; m_sys_bpp = 8; break; case pix_format_rgb565: case pix_format_rgb555: m_sys_format = pix_format_rgb555; m_bpp = 16; m_sys_bpp = 16; break; case pix_format_rgb24: case pix_format_bgr24: m_sys_format = pix_format_bgr24; m_bpp = 24; m_sys_bpp = 24; break; case pix_format_bgra32: case pix_format_abgr32: case pix_format_argb32: case pix_format_rgba32: m_sys_format = pix_format_bgra32; m_bpp = 32; m_sys_bpp = 32; break; case pix_format_undefined: case end_of_pix_formats: ; } } void platform_specific::destroy() { DEBUG_MTH("platform_specific::destroy"); if (m_bimage != NULL) { dib.destroy_image(m_bimage); m_bimage = 0; } } //------------------------------------------------------------------------ void platform_specific::display_pmap(HDC dc, const rendering_buffer* rbuf, int draw_x, int draw_y, int draw_width, int draw_height) { if(m_sys_format == m_format) { if (m_bimage == 0) { m_bimage = dib.create_image(rbuf, m_bpp); } dib.put_image(dc, m_bimage, draw_x, draw_y, draw_width, draw_height); return; } // Optimization hint: make pmap_tmp as a private class member and reused it when possible. pixel_map pmap_tmp(rbuf->width(), rbuf->height(), m_sys_format, 256, m_flip_y); rendering_buffer* rbuf2 = &pmap_tmp.rbuf(); switch(m_format) { case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_rgb555()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_bgr24()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_bgra32()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_bgra32()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_bgra32()); break; case pix_format_gray8: case end_of_pix_formats: case pix_format_undefined: ; } // This will ultimately call back to us, going to the top if branch since // the pix_format is compatible. pmap_tmp.draw(dc, draw_x, draw_y, draw_width, draw_height); } //------------------------------------------------------------------------ unsigned platform_specific::calc_row_len(unsigned width, unsigned bits_per_pixel) { unsigned n = width; unsigned k; switch(bits_per_pixel) { case 1: k = n; n = n >> 3; if(k & 7) n++; break; case 4: k = n; n = n >> 1; if(k & 3) n++; break; case 8: break; case 16: n = n << 1; break; case 24: n = (n << 1) + n; break; case 32: n = n << 2; break; default: n = 0; break; } return ((n + 3) >> 2) << 2; } } enthought-chaco2-4.8.1.orig/kiva/agg/src/win32/wx_agg_debug/0000755000175000017500000000000013544357627022560 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/src/win32/wx_agg_debug/wx_agg_debug.dsp0000755000175000017500000001043513233644505025705 0ustar varunvarun# Microsoft Developer Studio Project File - Name="wx_agg" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=wx_agg - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "wx_agg_debug.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "wx_agg_debug.mak" CFG="wx_agg - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "wx_agg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "wx_agg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "wx_agg - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WX_AGG_EXPORTS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WX_AGG_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 !ELSEIF "$(CFG)" == "wx_agg - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WX_AGG_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../" /I "c:/python23/include" /I "../../../agg2/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WX_AGG_EXPORTS" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 c:\python23\libs\python23.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../../_plat_support.pyd" /pdbtype:sept !ENDIF # Begin Target # Name "wx_agg - Win32 Release" # Name "wx_agg - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\agg_bmp.cpp # End Source File # Begin Source File SOURCE=..\agg_platform_specific.cpp # End Source File # Begin Source File SOURCE=..\plat_support_wrap.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=..\agg_bmp.h # End Source File # Begin Source File SOURCE=..\agg_platform_specific.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project enthought-chaco2-4.8.1.orig/kiva/agg/src/win32/wx_agg_debug/wx_agg_debug.dsw0000755000175000017500000000100613233644505025706 0ustar varunvarunMicrosoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "wx_agg_debug"=.\wx_agg_debug.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### enthought-chaco2-4.8.1.orig/kiva/agg/src/win32/plat_support.i0000644000175000017500000000740213233644505023034 0ustar varunvarun// -*- c++ -*- %module plat_support %include numeric.i %{ #include "win32/agg_bmp.h" namespace agg24 { PyObject* pixel_map_as_unowned_array(agg24::pixel_map& pix_map) { npy_intp dims[3]; npy_intp rows = pix_map.height(); npy_intp cols = pix_map.width(); npy_intp depth = pix_map.bpp() / 8; dims[0] = rows; dims[1] = cols; dims[2] = depth; return PyArray_SimpleNewFromData(3,dims,NPY_UINT8,(void*)pix_map.buf()); } } %} %typemap(in) HDC { %#if SIZEOF_SIZE_T == 8 $1 = ($1_ltype) PyLong_AsLongLong($input); %#else $1 = ($1_ltype) PyLong_AsLong($input); %#endif if (PyErr_Occurred()) SWIG_fail; } %typemap(out) HDC { %#if SIZEOF_SIZE_T == 8 $result = PyLong_FromLongLong((long long) $1); %#else $result = PyLong_FromLong((long) $1); %#endif if (PyErr_Occurred()) SWIG_fail; } %apply HDC { HWND }; // More permissive unsigned typemap that converts any numeric type to an // unsigned value. It is cleared at the end of this file. %typemap(in) unsigned { %#if PY_VERSION_HEX < 0x03000000 PyObject* obj = PyNumber_Int($input); %#else PyObject* obj = PyNumber_Long($input); %#endif if (PyErr_Occurred()) SWIG_fail; $1 = (unsigned) PyLong_AsLong(obj); if (PyErr_Occurred()) SWIG_fail; } namespace agg24 { enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_gray8, // Simple 256 level grayscale pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_bgr24, // B-G-R, native win32 BMP format. pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_argb32, // A-R-G-B, native MAC format pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_bgra32, // B-G-R-A, native win32 BMP format end_of_pix_formats }; %rename(PixelMap) pixel_map; class pixel_map { public: ~pixel_map(); pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up); public: %feature("shadow") draw(HDC h_dc, int x, int y, double scale) const %{ def draw(self, h_dc, x=0, y=0, width=0, height=0): # fix me: brittle becuase we are hard coding # module and class name. Done cause SWIG 1.3.24 does # some funky overloading stuff in it that breaks keyword # arguments. result = _plat_support.PixelMap_draw(self, h_dc, x, y, width, height) return result %} void draw(HDC h_dc, int x, int y, int width, int height) const; PyObject* convert_to_argb32string() const; %pythoncode %{ def set_bmp_array(self): self.bmp_array = pixel_map_as_unowned_array(self) return self def draw_to_tkwindow(self, window, x, y): window_id = window._tk_widget.winfo_id() hdc = GetDC(window_id) self.draw(hdc, x, y) ReleaseDC(window_id, hdc) return def draw_to_wxwindow(self, window, x, y, width=-1, height=-1): window_dc = getattr(window,'_dc',None) if window_dc is None: window_dc = wx.PaintDC(window) self.draw(window_dc.GetHDC(), x, y, width, height) return %} }; PyObject* pixel_map_as_unowned_array(pixel_map& pix_map); } HDC GetDC(HWND hWnd); int ReleaseDC(HWND hWnd, HDC hDC); // clear the "permissive" unsigned typemap we are using. %typemap(in) unsigned; enthought-chaco2-4.8.1.orig/kiva/agg/src/win32/agg_platform_specific.h0000644000175000017500000000504113233644505024603 0ustar varunvarun// -*- c++ -*- #ifndef AGG_WIN32_SPECIFIC_INCLUDED #define AGG_WIN32_SPECIFIC_INCLUDED #include #include "agg_basics.h" #include "agg_rendering_buffer.h" namespace agg24 { enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_gray8, // Simple 256 level grayscale pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_bgr24, // B-G-R, native win32 BMP format. pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_argb32, // A-R-G-B, native MAC format pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_bgra32, // B-G-R-A, native win32 BMP format end_of_pix_formats }; typedef struct { BITMAPINFO* bmp; unsigned char* data; } BImage; class dib_display { public: dib_display(); ~dib_display(); bool put_image(HDC dc, BImage* image, int draw_x=-1, int draw_y=-1, int draw_width=-1, int draw_height=-1); BImage* create_image(const rendering_buffer* rbuf, unsigned bits_per_pixel); void destroy_image(BImage* image); private: static unsigned calc_header_size(BITMAPINFO *bmp); static unsigned calc_palette_size(BITMAPINFO *bmp); static unsigned calc_palette_size(unsigned clr_used, unsigned bits_per_pixel); }; class platform_specific { static dib_display dib; public: platform_specific(pix_format_e format, bool flip_y); ~platform_specific() {} void display_pmap(HDC dc, const rendering_buffer* src, int draw_x=-1, int draw_y=-1, int draw_width=-1, int draw_height=-1); void destroy(); static unsigned calc_row_len(unsigned width, unsigned bits_per_pixel); unsigned m_bpp; bool m_flip_y; BImage* m_bimage; pix_format_e m_format; private: pix_format_e m_sys_format; unsigned m_sys_bpp; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/win32/agg_bmp.cpp0000644000175000017500000001035613233644505022230 0ustar varunvarun#include #include #include "win32/agg_bmp.h" #include "win32/agg_platform_specific.h" #include "agg_pixfmt_rgba.h" #include "agg_color_rgba.h" #include "bytesobject.h" #if 0 #define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); #define DEBUG_MTH2(STR,ARG1,ARG2) fprintf(stderr, STR "\n",(ARG1),(ARG2)); #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) fprintf(stderr, STR "\n",(ARG1),(ARG2),(ARG3),(ARG4),(ARG5)); #else #define DEBUG_MTH(NAME) #define DEBUG_MTH2(STR,ARG1,ARG2) #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) #endif namespace agg24 { //------------------------------------------------------------------------ pixel_map::pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up): m_buf(NULL), m_specific(new platform_specific(format, bottom_up)) { DEBUG_MTH5("pixel_map::pixel_map(%d,%d,%d,%d,%d)",width,height,format,clear_val,bottom_up); m_bpp = m_specific->m_bpp; create(width, height, clear_val); } //------------------------------------------------------------------------ pixel_map::~pixel_map() { DEBUG_MTH("pixel_map::~pixel_map"); destroy(); delete m_specific; } //------------------------------------------------------------------------ void pixel_map::destroy() { DEBUG_MTH("pixel_map::destroy()"); if (m_specific->m_bimage != NULL) { DEBUG_MTH("pixel_map::destroy() m_bimage != NULL"); m_specific->destroy(); m_buf = NULL; } if (m_buf != NULL) { delete[] m_buf; m_buf = NULL; } } //------------------------------------------------------------------------ void pixel_map::create(unsigned width, unsigned height, unsigned clear_val) { destroy(); if(width == 0) width = 1; if(height == 0) height = 1; unsigned row_len = platform_specific::calc_row_len(width, m_bpp); unsigned img_size = row_len * height; m_buf = new unsigned char[img_size]; if(clear_val <= 255) { memset(m_buf, clear_val, img_size); } m_rbuf_window.attach(m_buf, width, height, (m_specific->m_flip_y ? -row_len : row_len)); } //------------------------------------------------------------------------ void pixel_map::draw(HDC dc, int draw_x, int draw_y, int draw_width, int draw_height) const { DEBUG_MTH("pixel_map::draw"); if (m_buf != NULL) { m_specific->display_pmap(dc, &m_rbuf_window, draw_x, draw_y, draw_width, draw_height); } } pix_format_e pixel_map::get_pix_format() const { return m_specific->m_format; } unsigned char* pixel_map::buf() { return m_buf; } unsigned pixel_map::width() const { return m_rbuf_window.width(); } unsigned pixel_map::height() const { return m_rbuf_window.height(); } int pixel_map::stride() const { return platform_specific::calc_row_len(width(), m_bpp); } // Convert to a Python string containing 32 bit ARGB values. PyObject* pixel_map::convert_to_argb32string() const { unsigned w = width(); unsigned h = height(); PyObject *str = PyBytes_FromStringAndSize(NULL, w * h * 4); if (str == NULL) return NULL; unsigned *data = (unsigned *)PyBytes_AS_STRING(str); pix_format_e format = get_pix_format(); switch (format) { case pix_format_bgra32: { pixfmt_bgra32 r((rendering_buffer &)m_rbuf_window); for (unsigned j = 0; j < h; ++j) for (unsigned i = 0; i < w; ++i) { rgba8 c = r.pixel(i, h - j - 1); *data++ = (((unsigned char)c.a) << 24) | (((unsigned char)c.r) << 16) | (((unsigned char)c.g) << 8) | ((unsigned char)c.b); } } break; default: Py_DECREF(str); PyErr_Format(PyExc_ValueError, "pix_format %d not handled", format); return NULL; } return str; } } enthought-chaco2-4.8.1.orig/kiva/agg/src/win32/agg_bmp.h0000644000175000017500000000244313233644505021673 0ustar varunvarun// -*- c++ -*- #ifndef AGG_WIN32_BMP_INCLUDED #define AGG_WIN32_BMP_INCLUDED #include "Python.h" #include "win32/agg_platform_specific.h" namespace agg24 { class pixel_map { public: pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up); ~pixel_map(); void draw(HDC h_dc, int draw_x=-1, int draw_y=-1, int draw_width=-1, int draw_height=-1) const; pix_format_e get_pix_format() const; unsigned char* buf(); unsigned width() const; unsigned height() const; int stride() const; unsigned bpp() const { return m_bpp; } rendering_buffer& rbuf() { return m_rbuf_window; } platform_specific* m_specific; PyObject* convert_to_argb32string() const; private: void destroy(); void create(unsigned width, unsigned height, unsigned clear_val=256); unsigned char* m_buf; unsigned m_bpp; rendering_buffer m_rbuf_window; public: }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_rect.h0000755000175000017500000000711713233644505021312 0ustar varunvarun#ifndef RECT_H #define RECT_H #include "agg_basics.h" #include "kiva_basics.h" #include namespace kiva { //----------------------------------------------------------------------- // graphics_state class //----------------------------------------------------------------------- class rect_type { public: // constructors inline rect_type(): x(0), y(0), w(-1), h(-1) { } inline rect_type(double newx, double newy, double neww, double newh): x(newx), y(newy), w(neww), h(newh) { } inline rect_type(agg24::rect_i r) { *this = r; } inline rect_type(agg24::rect_d r) { *this = r; } // conversion from agg24::rect inline rect_type& operator=(agg24::rect_i &r) { x = int(r.x1); y = int(r.y1); w = int(r.x2 - r.x1); h = int(r.y2 - r.y1); return *this; } inline rect_type& operator=(agg24::rect_d &r) { x = r.x1; y = r.y1; w = r.x2 - r.x1; h = r.y2 - r.y1; return *this; } inline bool operator==(rect_type& other) { return ((x == other.x) && (y == other.y) && (w == other.w) && (h == other.h)); } inline bool operator!=(rect_type& other) { return !(*this == other); } // conversion to agg24::rect inline operator agg24::rect_i() const { return agg24::rect_i(int(x), int(y), int(w), int(h)); } inline operator agg24::rect_d() const { return agg24::rect_d(x, y, w, h); } // conversion to double[4] inline double operator[](unsigned int ndx) const { switch (ndx) { case 0: return x; case 1: return y; case 2: return w; case 3: return h; } } // comparison inline bool operator==(const rect_type &b) const { return ((this->x == b.x) && (this->y == b.y) && (this->w == b.w) && (this->h == b.h)); } // utility functions: inline double x2() const { return x+w; } inline double y2() const { return y+h; } double x, y, w, h; }; typedef std::vector rect_list_type; typedef rect_list_type::iterator rect_iterator; // This returns the rectangle representing the overlapping area between // rectangles a and b. If they do not overlap, the returned rectangle // will have width and height -1. // // (We use -1 instead of 0 because Agg will accept clip rectangles of // size 0.) rect_type disjoint_intersect(const rect_type &a, const rect_type &b); // Returns a list of rectangles resulting from the intersection of the // input list of rectangles. If there are no intersection regions, // returns an empty list. rect_list_type disjoint_intersect(const rect_list_type &rects); // Intersects a single rectangle against a list of existing, non- // intersecting rectangles, and returns a list of the intersection regions. // If there are no intersection regions, returns an empty list. rect_list_type disjoint_intersect(const rect_list_type &original_list, const rect_type &new_rect); rect_list_type disjoint_union(const rect_type &a, const rect_type &b); rect_list_type disjoint_union(const rect_list_type &rects); rect_list_type disjoint_union(rect_list_type original_list, const rect_type &new_rect); void test_disjoint_union(); } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/numeric.i0000644000175000017500000002562013233644505021002 0ustar varunvarun/* -*- c -*- */ /* Set the input argument to point to a temporary variable */ /* Here are the typemap helper functions for numeric arrays: PyArrayObject* obj_to_array_no_conversion(PyObject* input, int typecode) PyArrayObject* obj_to_array_allow_conversion(PyObject* input, int typecode, int& is_new_object) PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input, int typecode, int& is_new_object) PyArrayObject* make_contiguous(PyArrayObject* ary, int& is_new_object, int min_dims = 0, int max_dims = 0) int require_contiguous(PyArrayObject* ary) int require_last_dimensions_contiguous(PyArrayObject* ary, int dim_count) int require_dimensions(PyArrayObject* ary, int exact_dimensions) int require_dimensions(PyArrayObject* ary, int* exact_dimensions, int n) int require_size(PyArrayObject* ary, int* size, int n) */ %{ #ifdef NUMPY #include "numpy/arrayobject.h" # ifndef PyArray_SBYTE # include "numpy/oldnumeric.h" # include "numpy/old_defines.h" # endif #else #include "Numeric/arrayobject.h" #define PyArray_UBYTELTR 'b' #endif #include #define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a)) #define array_type(a) (int)(((PyArrayObject *)a)->descr->type_num) #define array_dimensions(a) (((PyArrayObject *)a)->nd) #define array_size(a,i) (((PyArrayObject *)a)->dimensions[i]) #define array_is_contiguous(a) (PyArray_ISCONTIGUOUS(ary)) std::string pytype_string(PyObject* py_obj) { if(py_obj == NULL) return "C NULL value"; if(PyCallable_Check(py_obj)) return "callable"; if(PyString_Check(py_obj)) return "string"; if(PyInt_Check(py_obj)) return "int"; if(PyFloat_Check(py_obj)) return "float"; if(PyDict_Check(py_obj)) return "dict"; if(PyList_Check(py_obj)) return "list"; if(PyTuple_Check(py_obj)) return "tuple"; /*if(PyFile_Check(py_obj)) return "file";*/ if(PyModule_Check(py_obj)) return "module"; //should probably do more intergation (and thinking) on these. /*if(PyCallable_Check(py_obj) && PyInstance_Check(py_obj)) return "callable"; if(PyInstance_Check(py_obj)) return "instance";*/ if(PyCallable_Check(py_obj)) return "callable"; return "unkown type"; } std::string typecode_string(int typecode) { std::string type_names[20] = {"char","unsigned byte","byte", "short", "unsigned short", "int", "unsigned int", "long", "float", "double", "complex float", "complex double", "object","ntype", "unkown"}; return type_names[typecode]; } int type_match(int actual_type, int desired_type) { int match; // Make sure input has correct numeric type. Allow character and byte to // match also allow int and long to match. if ( actual_type != desired_type && !(desired_type == PyArray_CHAR && actual_type == PyArray_SBYTE) && !(desired_type == PyArray_SBYTE && actual_type == PyArray_CHAR) && !(desired_type == PyArray_INT && actual_type == PyArray_LONG) && !(desired_type == PyArray_LONG && actual_type == PyArray_INT)) { match = 0; } else { match = 1; } return match; } PyArrayObject* obj_to_array_no_conversion(PyObject* input, int typecode) { PyArrayObject* ary = NULL; if (is_array(input) && array_type(input) == typecode) { ary = (PyArrayObject*) input; } else if is_array(input) { char msg[255] = "Array of type '%s' required. Array of type '%s' given"; std::string desired_type = typecode_string(typecode); std::string actual_type = typecode_string(array_type(input)); PyErr_Format(PyExc_TypeError, msg, desired_type.c_str(), actual_type.c_str()); ary = NULL; } else { char msg[255] = "Array of type '%s' required. A %s was given"; std::string desired_type = typecode_string(typecode); std::string actual_type = pytype_string(input); PyErr_Format(PyExc_TypeError, msg, desired_type.c_str(), actual_type.c_str()); ary = NULL; } return ary; } PyArrayObject* obj_to_array_allow_conversion(PyObject* input, int typecode, int& is_new_object) { // Convert object to a Numeric array with the given typecode. // // Return: // On Success, return a valid PyArrayObject* with the correct type. // On failure, return NULL. A python error will have been set. PyArrayObject* ary = NULL; if (is_array(input) && type_match(array_type(input),typecode)) { ary = (PyArrayObject*) input; is_new_object = 0; } else { PyObject* py_obj = PyArray_FromObject(input, typecode, 0, 0); // If NULL, PyArray_FromObject will have set python error value. ary = (PyArrayObject*) py_obj; is_new_object = 1; } return ary; } PyArrayObject* make_contiguous(PyArrayObject* ary, int& is_new_object, int min_dims = 0, int max_dims = 0) { PyArrayObject* result; if (array_is_contiguous(ary)) { result = ary; is_new_object = 0; } else { result = (PyArrayObject*) PyArray_ContiguousFromObject( (PyObject*)ary, array_type(ary), min_dims, max_dims); is_new_object = 1; } return result; } PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input, int typecode, int& is_new_object) { int is_new1 = 0; int is_new2 = 0; PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, is_new1); if (ary1) { PyArrayObject* ary2 = make_contiguous(ary1, is_new2); if ( is_new1 && is_new2) { Py_DECREF(ary1); } ary1 = ary2; } is_new_object = is_new1 || is_new2; return ary1; } int require_contiguous(PyArrayObject* ary) { // Test whether a python object is contiguous. // // Return: // 1 if array is contiguous. // Otherwise, return 0 and set python exception. int contiguous = 1; if (!array_is_contiguous(ary)) { char msg[255] = "Array must be contiguous. A discontiguous array was given"; PyErr_SetString(PyExc_TypeError, msg); contiguous = 0; } return contiguous; } // Useful for allowing images with discontiguous first dimension. // This sort of array is used for arrays mapped to Windows bitmaps. /* int require_last_dimensions_contiguous(PyArrayObject* ary, int dim_count) { int contiguous = 1; if (array_is_contiguous(ary)) { char msg[255] = "Array must be contiguous. A discontiguous array was given"; PyErr_SetString(PyExc_TypeError, msg); contiguous = 0; } return contiguous; } */ int require_dimensions(PyArrayObject* ary, int exact_dimensions) { int success = 1; if (array_dimensions(ary) != exact_dimensions) { char msg[255] = "Array must be have %d dimensions. Given array has %d dimensions"; PyErr_Format(PyExc_TypeError, msg, exact_dimensions, array_dimensions(ary)); success = 0; } return success; } int require_dimensions(PyArrayObject* ary, int* exact_dimensions, int n) { int success = 0; int i; for (i = 0; i < n && !success; i++) { if (array_dimensions(ary) == exact_dimensions[i]) { success = 1; } } if (!success) { char dims_str[255] = ""; char s[255]; for (int i = 0; i < n-1; i++) { sprintf(s, "%d, ", exact_dimensions[i]); strcat(dims_str,s); } sprintf(s, " or %d", exact_dimensions[n-1]); strcat(dims_str,s); char msg[255] = "Array must be have %s dimensions. Given array has %d dimensions"; PyErr_Format(PyExc_TypeError, msg, dims_str, array_dimensions(ary)); } return success; } int require_size(PyArrayObject* ary, int* size, int n) { int i; int success = 1; for(i=0; i < n;i++) { if (size[i] != -1 && size[i] != array_size(ary,i)) { success = 0; } } if (!success) { int len; char desired_dims[255] = "["; char s[255]; for (i = 0; i < n; i++) { if (size[i] == -1) { sprintf(s, "*,"); } else { sprintf(s, "%d,", size[i]); } strcat(desired_dims,s); } len = strlen(desired_dims); desired_dims[len-1] = ']'; char actual_dims[255] = "["; for (i = 0; i < n; i++) { sprintf(s, "%d,", (int)array_size(ary,i)); strcat(actual_dims,s); } len = strlen(actual_dims); actual_dims[len-1] = ']'; char msg[255] = "Array must be have shape of %s. Given array has shape of %s"; PyErr_Format(PyExc_TypeError, msg, desired_dims, actual_dims); } return success; } %} %pythoncode %{ from numpy import ndarray def is_array(obj): return type(obj) is ndarray def is_correct_type(obj, numeric_type): return is_array(obj) and (obj.dtype == numeric_type) def numpy_check(obj, typecode, exact_size = [], must_be_contiguous = 1, allow_coersion = 0): if is_correct_type(obj, typecode): ary = obj elif allow_coersion: ary = asarray(obj,typecode) else: raise TypeError("input is not an array or the array has the wrong type") if must_be_contiguous and not ary.flags["CONTIGUOUS"]: if allow_coersion: ary = ary.copy() else: raise TypeError("input array must be contiguous") # check number of dimensions required_dims = len(exact_size) if required_dims and required_dims != len(ary.shape): raise ValueError("The input array does not have the correct shape") # check exact shape of each dimension cnt = 0 for desired,actual in zip(exact_size,ary.shape): if desired != -1 and desired != actual: raise ValueError("The %d dimensions of the array has the wrong shape" % (cnt)) cnt += 1 return ary %} %init %{ Py_Initialize(); import_array(); #ifdef NUMPY PyImport_ImportModule("numpy"); #else PyImport_ImportModule("Numeric"); #endif %} enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_image_filters.h0000644000175000017500000001010013233644505023146 0ustar varunvarun#ifndef KIVA_IMAGE_FILTERS_H #define KIVA_IMAGE_FILTERS_H #include "agg_pixfmt_rgb.h" #include "agg_pixfmt_rgba.h" #include "agg_span_image_filter_rgba.h" #include "agg_span_image_filter_rgb.h" #include "agg_image_accessors.h" #include "agg_span_interpolator_linear.h" namespace kiva { typedef agg24::span_interpolator_linear<> interpolator_type; template class image_filters { }; template<> class image_filters { public: typedef agg24::image_accessor_clip source_type; typedef agg24::span_image_filter_rgba_nn nearest_type; typedef agg24::span_image_filter_rgba_bilinear bilinear_type; typedef agg24::span_image_filter_rgba general_type; }; template<> class image_filters { public: typedef agg24::image_accessor_clip source_type; typedef agg24::span_image_filter_rgba_nn nearest_type; typedef agg24::span_image_filter_rgba_bilinear bilinear_type; typedef agg24::span_image_filter_rgba general_type; }; template<> class image_filters { public: typedef agg24::image_accessor_clip source_type; typedef agg24::span_image_filter_rgba_nn nearest_type; typedef agg24::span_image_filter_rgba_bilinear bilinear_type; typedef agg24::span_image_filter_rgba general_type; }; template<> class image_filters { public: typedef agg24::image_accessor_clip source_type; typedef agg24::span_image_filter_rgba_nn nearest_type; typedef agg24::span_image_filter_rgba_bilinear bilinear_type; typedef agg24::span_image_filter_rgba general_type; }; template<> class image_filters { public: typedef agg24::image_accessor_clip source_type; typedef agg24::span_image_filter_rgb_nn nearest_type; typedef agg24::span_image_filter_rgb_bilinear bilinear_type; typedef agg24::span_image_filter_rgb general_type; }; template<> class image_filters { public: typedef agg24::image_accessor_clip source_type; typedef agg24::span_image_filter_rgb_nn nearest_type; typedef agg24::span_image_filter_rgb_bilinear bilinear_type; typedef agg24::span_image_filter_rgb general_type; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/gl_graphics_context.cpp0000644000175000017500000010246513233644505023723 0ustar varunvarun // #ifndef MULTI_DRAW_ELEMENTS // #define MULTI_DRAW_ELEMENTS glMultiDrawElements // #endif #include #include "kiva_affine_helpers.h" #include "kiva_exceptions.h" #include "kiva_rect.h" #include "gl_graphics_context.h" using namespace kiva; #ifndef CALLBACK #define CALLBACK #endif #ifndef M_PI #define M_PI 3.1415926535 #endif #define EXPAND_COLOR(c) c->r, c->g, c->b, (c->a * this->state.alpha) // This should be just double, but as long as we're using C++... typedef agg24::path_storage::container_type::value_type VertexType; struct PointType { VertexType x,y,z; }; typedef std::vector PointListType; static void _submit_path_points(PointListType const & points, bool polygon, bool fill); static void CALLBACK _combine_callback(GLdouble coords[3], GLdouble *vert_data[4], GLfloat weight[4], GLdouble **dataOut); static void CALLBACK _vertex_callback(GLvoid *vertex); gl_graphics_context::gl_graphics_context(int width, int height, kiva::pix_format_e format) : graphics_context_base(NULL, width, height, 1, kiva::nearest) , m_width(width) , m_height(height) , m_gl_initialized(false) , m_pixfmt(format) { } gl_graphics_context::~gl_graphics_context() { if (m_gl_initialized) { this->gl_cleanup(); } } void gl_graphics_context::gl_init() { glViewport(0, 0, m_width, m_height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, m_width, 0, m_height, 1, -1); glMatrixMode(GL_MODELVIEW); //glPushMatrix(); glLoadIdentity(); // Use scissors to implement clipping glEnable(GL_SCISSOR_TEST); // Need to set up blending for antialiasing glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); glHint(GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE); // Clear the clip region // This is important. Since GL maintains a persistent, global context // across the application, we may very well inherit the scissor mask // from a clip_to_rect() call on a previous GC. clip_to_rect(0, 0, m_width, m_height); } void gl_graphics_context::gl_cleanup() { //glMatrixMode(GL_MODELVIEW); //glPopMatrix(); } kiva::pix_format_e gl_graphics_context::format() { return m_pixfmt; } void gl_graphics_context::save_state() { graphics_context_base::save_state(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); } void gl_graphics_context::restore_state() { if (this->state_stack.size() == 0) { return; } this->state = this->state_stack.top(); this->state_stack.pop(); this->path.restore_ctm(); // Restore the clip state: // Compute the intersection of all the rects and use those as // the clip box if (this->state.use_rect_clipping()) { if (this->state.device_space_clip_rects.size() > 0) { kiva::rect_list_type rects = disjoint_intersect(this->state.device_space_clip_rects); // XXX: Right now we don't support disjoint clip rects. To implement // this, we would probably want to use a mask or stencil, or just // re-render with each clip rect set as the scissor. // XXX: figure out better way to round out the floating-point // dimensions for kiva_rect than just casting to int(). kiva::rect_iterator it = rects.begin(); glScissor(int(it->x), int(it->y), int(it->w), int(it->h)); } } else { throw clipping_path_unsupported; } // Restore the transformation matrices glMatrixMode(GL_MODELVIEW); glPopMatrix(); } void gl_graphics_context::begin_page() { glClearColor( 1.f, 1.f, 1.f, 0.f ); glClear( GL_COLOR_BUFFER_BIT ); } void gl_graphics_context::clip() { throw kiva::not_implemented_error; } void gl_graphics_context::even_odd_clip() { throw kiva::not_implemented_error; } void gl_graphics_context::clip_to_rect(double x, double y, double sx, double sy) { kiva::rect_type tmp(x, y, sx, sy); clip_to_rect(tmp); } void gl_graphics_context::clip_to_rect(kiva::rect_type &rect) { this->path.remove_all(); if (!this->state.use_rect_clipping()) { throw clipping_path_unsupported; } kiva::rect_type device_rect(transform_clip_rectangle(rect)); if (this->state.device_space_clip_rects.size() == 1) { kiva::rect_type old(this->state.device_space_clip_rects.back()); this->state.device_space_clip_rects.pop_back(); kiva::rect_type newrect(kiva::disjoint_intersect(old, device_rect)); if ((newrect.w < 0) || (newrect.h < 0)) { // new clip rectangle doesn't intersect anything, so we push on // an empty rect as the new clipping region. glScissor(0,0,0,0); //printf("NULL intersection area in clip_to_rect\n"); this->state.device_space_clip_rects.push_back(kiva::rect_type(0, 0, -1, -1)); } else { glScissor(int(newrect.x), int(newrect.y), int(newrect.w), int(newrect.h)); this->state.device_space_clip_rects.push_back(newrect); } } else { // we need to compute the intersection of the new rectangle with // the current set of clip rectangles. we assume that the existing // clip_rects are a disjoint set. this->state.device_space_clip_rects = kiva::disjoint_intersect( this->state.device_space_clip_rects, device_rect); if (this->state.device_space_clip_rects.size() == 0) { glScissor(0,0,0,0); //printf("NULL intersection area in clip_to_rect\n"); this->state.device_space_clip_rects.push_back(kiva::rect_type(0, 0, -1, -1)); } else { kiva::rect_list_type rects = disjoint_intersect(this->state.device_space_clip_rects); // XXX: Right now we don't support disjoint clip rects. // (same problem as in restore_state()) kiva::rect_iterator it = rects.begin(); glScissor(int(it->x), int(it->y), int(it->w), int(it->h)); if (rects.size() > 1) { //printf("Warning: more than 1 clip rect in clip_to_rect()\n"); } } } } void gl_graphics_context::clip_to_rects(double* new_rects, int Nrects) { printf("Clip to rects() unsupported\n"); } void gl_graphics_context::clip_to_rects(kiva::rect_list_type &rects) { printf("Clip to rects() unsupported\n"); } void gl_graphics_context::clear_clip_path() { // clear the existing clipping paths this->state.clipping_path.remove_all(); this->state.device_space_clip_rects.clear(); // set everything visible again. glScissor(0, 0, m_width, m_height); // store the new clipping rectangle back into the first // rectangle of the graphics state clipping rects. this->state.device_space_clip_rects.push_back(kiva::rect_type(0, 0, m_width, m_height)); } // XXX: This is cut and paste from graphics_context.h; refactor into base // class. kiva::rect_type gl_graphics_context::transform_clip_rectangle(const kiva::rect_type &rect) { // This only works if the ctm doesn't have any rotation. // otherwise, we need to use a clipping path. Test for this. agg24::trans_affine tmp(this->path.get_ctm()); if ( !only_scale_and_translation(tmp)) { throw kiva::ctm_rotation_error; } double x = rect.x; double y = rect.y; double x2 = rect.x2(); double y2 = rect.y2(); this->path.get_ctm().transform(&x, &y); this->path.get_ctm().transform(&x2, &y2); // fix me: How should we round here? // maybe we should lrint, but I don't think it is portable. See // here: http://www.cs.unc.edu/~sud/tips/Programming_Tips.html x = int(floor(x+0.5)); y = int(floor(y+0.5)); // subtract 1 to account for agg (inclusive) vs. kiva (exclusive) clipping x2 = int(floor(x2+0.5))-1; y2 = int(floor(y2+0.5))-1; //x2 = int(floor(x2+0.5)); //y2 = int(floor(y2+0.5)); return kiva::rect_type(x, y, x2-x, y2-y); } int gl_graphics_context::get_num_clip_regions() { return this->state.device_space_clip_rects.size(); } kiva::rect_type gl_graphics_context::get_clip_region(unsigned int i) { throw kiva::not_implemented_error; } void gl_graphics_context::clear(agg24::rgba value) { glClearColor(float(value.r), float(value.g), float(value.b), float(value.a)); glClear(GL_COLOR_BUFFER_BIT); } void gl_graphics_context::fill_path() { draw_path(FILL); } void gl_graphics_context::eof_fill_path() { draw_path(EOF_FILL); } void gl_graphics_context::stroke_path() { draw_path(STROKE); } void gl_graphics_context::gl_render_path(kiva::compiled_path *path, bool polygon, bool fill) { if ((path == NULL) || (path->total_vertices() == 0)) return; unsigned command = 0; PointListType pointList; // Set the matrix mode so we support move_to commands glMatrixMode(GL_MODELVIEW); // Records the last move_to command position so that when // we finally encounter the first line_to, we can use this // vertex as the starting vertex. bool first_vertex_drawn = false; PointType v0 = {0.f, 0.f, 0.f}; PointType v = {0.f, 0.f, 0.f}; PointType vv = {0.f, 0.f, 0.f}; VertexType c1x, c1y, ccx, ccy, c2x, c2y, c3x, c3y; VertexType t, t2, t3, u, u2, u3; unsigned int j; unsigned int _Npoints = 100; // make space for points pointList.reserve(path->total_vertices()); for (unsigned int i=0; i < path->total_vertices(); i++) { command = path->vertex(i, &v.x, &v.y); switch (command & agg24::path_cmd_mask) { case agg24::path_cmd_line_to: if (!first_vertex_drawn) { pointList.push_back(v0); first_vertex_drawn = true; } pointList.push_back(v); break; case agg24::path_cmd_end_poly: // We shouldn't need to do anything because if this is a closed path // //if (command & agg24::path_flags_close) // glVertex2f(x0, y0); break; case agg24::path_cmd_curve3: // FIXME: refactor! if (!first_vertex_drawn) { pointList.push_back(v0); first_vertex_drawn = true; } path->vertex(i+1, &ccx, &ccy); path->vertex(i+2, &c3x, &c3y); i += 2; c1x = (v.x + ccx + ccx) / 3.0; c1y = (v.y + ccy + ccy) / 3.0; c2x = (c3x + ccx + ccx) / 3.0; c2y = (c3y + ccy + ccy) / 3.0; for (j=1; j<=_Npoints; j++) { t = ((VertexType)j) / _Npoints; t2 = t*t; t3 = t2*t; u = 1 - t; u2 = u*u; u3 = u2*u; vv.x = v.x * u3 + 3*(c1x*t*u2 + c2x*t2*u) + c3x*t3; vv.y = v.y * u3 + 3*(c1y*t*u2 + c2y*t2*u) + c3y*t3; pointList.push_back(vv); } break; case agg24::path_cmd_curve4: if (!first_vertex_drawn) { pointList.push_back(v0); first_vertex_drawn = true; } // The current point is implicitly the first control point v0 = pointList.back(); c1x = v.x; c1y = v.y; v.x = v0.x; v.y = v0.y; path->vertex(i+1, &c2x, &c2y); path->vertex(i+2, &c3x, &c3y); i += 2; for (j=1; j<=_Npoints; j++) { t = ((VertexType)j) / _Npoints; t2 = t*t; t3 = t2*t; u = 1 - t; u2 = u*u; u3 = u2*u; vv.x = v.x * u3 + 3*(c1x*t*u2 + c2x*t2*u) + c3x*t3; vv.y = v.y * u3 + 3*(c1y*t*u2 + c2y*t2*u) + c3y*t3; pointList.push_back(vv); } break; // The following commands are ignored. case agg24::path_cmd_move_to: if (!pointList.empty()) { // do a full glBegin/glEnd sequence for the points in the buffer _submit_path_points(pointList, polygon, fill); // flush pointList.clear(); } v0.x = v.x; v0.y = v.y; first_vertex_drawn = false; break; case agg24::path_cmd_ubspline: break; // XXX: This case number is already used?? //case agg24::path_cmd_mask: // break; // Unsupported // XXX: We need to have better error handling/reporting from the C++ // layer up to the Python layer. case agg24::path_cmd_catrom: case agg24::path_cmd_curveN: break; } } // submit the points if (!pointList.empty()) _submit_path_points(pointList, polygon, fill); } void gl_graphics_context::gl_render_points(double** points, bool polygon, bool fill, kiva::draw_mode_e mode) { } void gl_graphics_context::draw_path(draw_mode_e mode) { // XXX: This is a direct transcription from basecore2d. The algorithm // and approach can probably be improved tremendously for OpenGL. agg24::rgba *line_color = &this->state.line_color; agg24::rgba *fill_color = &this->state.fill_color; // CNP if (this->state.should_antialias) { glEnable(GL_LINE_SMOOTH); glEnable(GL_POLYGON_SMOOTH); } else { glDisable(GL_LINE_SMOOTH); glDisable(GL_POLYGON_SMOOTH); } // Check to see if we have closed polygons typedef agg24::path_storage::container_type::value_type VertexType; unsigned numvertices = this->path.total_vertices(); bool polygon = false; if (numvertices > 1) { // Get the first vertex VertexType x0, y0, xf, yf; this->path.vertex(0, &x0, &y0); // Go backwards from the last vertex until we find an actual line_to // or curve3 or curve4 comand. for (int i=numvertices-1; i>0; i--) { unsigned cmd = this->path.vertex(i, &xf, &yf); if (((cmd & agg24::path_cmd_mask) == agg24::path_cmd_curve3) || ((cmd & agg24::path_cmd_mask) == agg24::path_cmd_curve4) || ((cmd & agg24::path_cmd_mask) == agg24::path_cmd_line_to)) { if ((x0 == xf) && (y0 == yf)) polygon = true; break; } if ((cmd & agg24::path_cmd_mask) == agg24::path_cmd_end_poly) { polygon = true; break; } } } // Fill the path, if necessary if (mode != STROKE) { // device_update_fill_state //glColor4f(fill_color->r, fill_color->g, fill_color->b, fill_color->a); glColor4f(EXPAND_COLOR(fill_color)); // call gl_render_path() gl_render_path(&this->path, true, true); } // Stroke the path, if necessary if (mode != FILL) { // CNP // device_update_line_state //glColor4f(line_color->r, line_color->g, line_color->b, line_color->a); glColor4f(EXPAND_COLOR(line_color)); glLineWidth(this->state.line_width); if (this->state.line_dash.is_solid()) { glDisable(GL_LINE_STIPPLE); } else { glDisable(GL_LINE_STIPPLE); } gl_render_path(&this->path, polygon, false); } this->path.remove_all(); } void gl_graphics_context::draw_rect(double rect[4], draw_mode_e mode) { agg24::rgba *line_color = &this->state.line_color; agg24::rgba *fill_color = &this->state.fill_color; // CNP if (this->state.should_antialias) { glEnable(GL_LINE_SMOOTH); glEnable(GL_POLYGON_SMOOTH); } else { glDisable(GL_LINE_SMOOTH); glDisable(GL_POLYGON_SMOOTH); } this->path.get_ctm().translation(rect, rect+1); // Fill the rect first if (mode != STROKE) { glColor4f(EXPAND_COLOR(fill_color)); glRectf(rect[0], rect[1], rect[0]+rect[2], rect[1]+rect[3]); } // Stroke the path if (mode != FILL) { // CNP glColor4f(EXPAND_COLOR(line_color)); glLineWidth(this->state.line_width); if (this->state.line_dash.is_solid()) { glDisable(GL_LINE_STIPPLE); } else { glDisable(GL_LINE_STIPPLE); } glBegin(GL_LINE_LOOP); glVertex2f(rect[0], rect[1]); glVertex2f(rect[0], rect[1] + rect[3]); glVertex2f(rect[0] + rect[2], rect[1] + rect[3]); glVertex2f(rect[0] + rect[2], rect[1]); glEnd(); } this->path.remove_all(); } int gl_graphics_context::draw_marker_at_points(double *pts, int Npts, int size, agg24::marker_e type) { agg24::rgba *line_color = &this->state.line_color; agg24::rgba *fill_color = &this->state.fill_color; bool do_fill = (fill_color->a != 0); bool do_stroke = ((line_color->a != 0) && (this->state.line_width > 0.0)); if (do_stroke) glLineWidth(this->state.line_width); // Get the current origin double x0=0.0, y0=0.0; this->path.get_ctm().translation(&x0, &y0); kiva::draw_mode_e draw_mode = FILL; if (do_fill & !do_stroke) draw_mode = FILL; else if (do_stroke & !do_fill) draw_mode = STROKE; else if (do_fill & do_stroke) draw_mode = FILL_STROKE; GLuint fill_list, stroke_list; bool list_created = false; switch (type) { // Simple paths that only need to be stroked case agg24::marker_x: draw_x_marker(pts, Npts, size, draw_mode, x0, y0); break; case agg24::marker_cross: draw_cross(pts, Npts, size, draw_mode, x0, y0); break; case agg24::marker_dot: draw_dot(pts, Npts, size, draw_mode, x0, y0); break; case agg24::marker_pixel: draw_pixel(pts, Npts, size, draw_mode, x0, y0); break; // Paths that need to be filled and stroked // There are experimental approaches taken for drawing squares and // diamonds, so they are in their own block here. There's no reason // why they cannot be treated in the same way as the circle and // triangle markers. case agg24::marker_square: draw_square(pts, Npts, size, draw_mode, x0, y0); break; case agg24::marker_diamond: draw_diamond(pts, Npts, size, draw_mode, x0, y0); break; case agg24::marker_crossed_circle: draw_crossed_circle(pts, Npts, size, draw_mode, x0, y0); break; case agg24::marker_circle: fill_list = make_marker_lists(&kiva::gl_graphics_context::circle_path_func, draw_mode, size); list_created = true; // Fall through to next case case agg24::marker_triangle_up: if (!list_created) { fill_list = make_marker_lists(&kiva::gl_graphics_context::triangle_up_func, draw_mode, size); list_created = true; } // Fall through to next case case agg24::marker_triangle_down: if (!list_created) { fill_list = make_marker_lists(&kiva::gl_graphics_context::triangle_down_func, draw_mode, size); list_created = true; } stroke_list = fill_list + 1; draw_display_list_at_pts(fill_list, stroke_list, pts, Npts, draw_mode, x0, y0); glDeleteLists(fill_list, 2); break; default: return 0; } // Indicate success return 1; } void gl_graphics_context::draw_path_at_points(double *pts, int Npts, kiva::compiled_path &marker, draw_mode_e mode) { return; } void gl_graphics_context::draw_glyphs(kiva::graphics_context_base* img, double tx, double ty) { } int gl_graphics_context::draw_image(kiva::graphics_context_base* img, double rect[4], bool force_copy) { return 0; } int gl_graphics_context::draw_image(kiva::graphics_context_base* img) { return 0; } //--------------------------------------------------------------------------- // Marker drawing methods //--------------------------------------------------------------------------- void gl_graphics_context::draw_display_list_at_pts(GLuint list, double *pts, int Npts, kiva::draw_mode_e mode, double x0, double y0) { draw_display_list_at_pts(list, list, pts, Npts, mode, x0, y0); } void gl_graphics_context::draw_display_list_at_pts(GLuint fill_list, GLuint stroke_list, double *pts, int Npts, kiva::draw_mode_e mode, double x0, double y0) { agg24::rgba *colors[2] = { &this->state.fill_color, &this->state.line_color }; GLuint lists[2] = { fill_list, stroke_list }; float x = 0.f, y = 0.f; for (int pass=0; pass < 2; pass++) { if (((pass == 0) && ((mode == FILL) || (mode == FILL_STROKE))) || ((pass == 1) && ((mode == STROKE) || (mode == FILL_STROKE)))) { glColor4f(EXPAND_COLOR(colors[pass])); for (int i=0; i < Npts; i++) { x = pts[i*2] + x0; y = pts[i*2 + 1] + y0; glTranslatef(x, y, 0.0); glCallList(lists[pass]); glTranslatef(-x, -y, 0.0); } } } #if 0 if ((mode == FILL) || (mode == FILL_STROKE)) { glColor4f(EXPAND_COLOR(fill_color)); for (int i=0; i < Npts; i++) { x = pts[i*2] + x0; y = pts[i*2 + 1] + y0; glTranslatef(x, y, 0.0); glCallList(stroke_list); glTranslatef(-x, -y, 0.0); } } if ((mode == STROKE) || (mode == FILL_STROKE)) { glColor4f(EXPAND_COLOR(line_color)); for (int i=0; i < Npts; i++) { x = pts[i*2] + x0; y = pts[i*2 + 1] + y0; glTranslatef(x, y, 0.0); glCallList(fill_list); glTranslatef(-x, -y, 0.0); } } #endif } GLuint gl_graphics_context::make_marker_lists(PathDefinitionFunc path_func, kiva::draw_mode_e mode, int size) { GLuint fill_list = glGenLists(2); GLuint stroke_list = fill_list + 1; for (int dummy=0; dummy < 2; dummy++) { if (dummy == 0) { glNewList(fill_list, GL_COMPILE); glBegin(GL_POLYGON); } else { glNewList(stroke_list, GL_COMPILE); glBegin(GL_LINE_LOOP); } ((this)->*(path_func))(size); glEnd(); glEndList(); } return fill_list; } void gl_graphics_context::draw_square(double *pts, int Npts, int size, kiva::draw_mode_e mode, double x0, double y0) { agg24::rgba *line_color = &this->state.line_color; agg24::rgba *fill_color = &this->state.fill_color; // We build up a VertexArray of the vertices of all the squares. // We then use glDrawElements with GL_QUADS or GL_LINE_LOOP to fill // and stroke the markers. // The vertex array contains all the vertices in all the rects. // The convention is that each rect's vertices are stored // clockwise, starting with the lower-left vertex. GLdouble *vertices = new GLdouble[Npts*4*2]; glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_DOUBLE, 0, vertices); for (int i=0; istate.line_color; agg24::rgba *fill_color = &this->state.fill_color; // Each marker consists of four vertices in this order: left, top, right, bottom. GLdouble *vertices = new GLdouble[Npts * 4 * 2]; glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_DOUBLE, 0, vertices); float s = size / 2.0; for (int i=0; istate.line_color; glColor4f(EXPAND_COLOR(line_color)); glBegin(GL_POINTS); for (int i=0; i < Npts; i++) { glVertex2f(pts[i*2] + x0, pts[i*2+1] + y0); } glEnd(); } void _submit_path_points(PointListType const & points, bool polygon, bool fill) { // Uncomment this when we turn the glPolygonMode calls back on (below) //glPushAttrib(GL_POLYGON_BIT); if (polygon) { if (fill) { #if defined(_MSC_VER) || defined(__MINGW32__) typedef void (__stdcall*cbFunc)(void); #else typedef void (*cbFunc)(); #endif GLUtesselator* pTess = gluNewTess(); gluTessCallback(pTess, GLU_TESS_VERTEX, (cbFunc)&_vertex_callback); gluTessCallback(pTess, GLU_TESS_BEGIN, (cbFunc)&glBegin); gluTessCallback(pTess, GLU_TESS_END, (cbFunc)&glEnd); gluTessCallback(pTess, GLU_TESS_COMBINE, (cbFunc)&_combine_callback); gluTessBeginPolygon(pTess, NULL); gluTessBeginContour(pTess); // XXX: For some reason setting the polygon mode breaks pyglet's // font rendering. It doesn't really have an effect on any of // Kiva's rendering right now, so it's commented out for now. //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); for (int i=0; i < points.size(); ++i) { VertexType * pV = (VertexType *)&points[i]; gluTessVertex(pTess, (GLdouble*)pV, (GLvoid*)pV); } gluTessEndContour(pTess); gluTessEndPolygon(pTess); gluDeleteTess(pTess); } else { glBegin(GL_LINE_LOOP); //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); for (int i=0; i < points.size(); ++i) glVertex2dv((VertexType *)&points[i]); glEnd(); } } else { glBegin(GL_LINE_STRIP); for (int i=0; i < points.size(); ++i) glVertex2dv((VertexType *)&points[i]); glEnd(); } //glPopAttrib(); } void CALLBACK _combine_callback(GLdouble coords[3], GLdouble *vert_data[4], GLfloat weight[4], GLdouble **dataOut) { GLdouble *vertex = (GLdouble *)malloc(3 * sizeof(GLdouble)); vertex[0] = coords[0]; vertex[1] = coords[1]; vertex[2] = coords[2]; *dataOut = vertex; } void CALLBACK _vertex_callback(GLvoid *vertex) { GLdouble *ptr = (GLdouble *)vertex; glVertex3dv(ptr); } enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_compiled_path.cpp0000644000175000017500000002072113233644505023511 0ustar varunvarun#include "agg_bezier_arc.h" #include "kiva_compiled_path.h" #include "kiva_basics.h" #include #include using namespace kiva; void compiled_path::remove_all() { //agg24::path_storage::remove_all(); // fix me: call to base:: to appease VC++6.0 this->base::remove_all(); this->_has_curves = false; //ptm = agg24::trans_affine(); } void compiled_path::begin_path() { this->remove_all(); } void compiled_path::close_path() { this->close_polygon(); } void compiled_path::move_to(double x, double y) { this->ptm.transform(&x, &y); // fix me: call to base:: to appease VC++6.0 this->base::move_to(x,y); } void compiled_path::line_to(double x, double y) { this->ptm.transform(&x, &y); // fix me: call to base:: to appease VC++6.0 this->base::line_to(x,y); } void compiled_path::quad_curve_to(double x_ctrl, double y_ctrl, double x_to, double y_to) { this->ptm.transform(&x_ctrl, &y_ctrl); this->ptm.transform(&x_to, &y_to); // fix me: call to base:: to appease VC++6.0 this->base::curve3(x_ctrl,y_ctrl,x_to,y_to); this->_has_curves = true; } void compiled_path::curve_to(double x_ctrl1, double y_ctrl1, double x_ctrl2, double y_ctrl2, double x_to, double y_to) { this->ptm.transform(&x_ctrl1, &y_ctrl1); this->ptm.transform(&x_ctrl2, &y_ctrl2); this->ptm.transform(&x_to, &y_to); // fix me: call to base:: to appease VC++6.0 this->base::curve4(x_ctrl1,y_ctrl1, x_ctrl2,y_ctrl2, x_to,y_to); this->_has_curves = true; } void compiled_path::arc(double x, double y, double radius, double start_angle, double end_angle, bool cw) { // Rather than try to transform the center and scale the axes correctly, // we'll just create an untransformed agg curve, grab its Bezier control // points, transform them, and manually add them to the path. double sweep_angle = end_angle - start_angle; if (cw) { sweep_angle = -(2*agg24::pi - sweep_angle); } agg24::bezier_arc aggarc(x, y, radius, radius, start_angle, sweep_angle); // Now manually transform each vertex and add it. For some reason, trying // to transform aggarc in place and then using this->base::add_path() // causes an access violation if cw=true (but works fine if cw=false). int numverts = aggarc.num_vertices(); container_type& vertices = this->vertices(); double vx, vy; unsigned int cmd; aggarc.rewind(0); for (int i = 0; i <= numverts/2; i++) { cmd = aggarc.vertex(&vx, &vy); if (!agg24::is_stop(cmd)) { this->ptm.transform(&vx, &vy); vertices.add_vertex(vx, vy, cmd); } } this->_has_curves = true; } void compiled_path::arc_to(double x1, double y1, double x2, double y2, double radius) { // We have to do some work above and beyond what Agg offers. The Agg // arc_to() happily creates rotated elliptical arcs, but to match the // DisplayPDF spec, we need to compute the correct tangent points on // the tangent lines defined by (cur_x,cur_y), (x1,y1), and (x2,y2) such // that a circular arc of the given radius will be created. // The general approach is to transform the coordinates of the three // points so that x1,y1 is at the origin, x0,y0 is to the right of x1,y1, // and y0==y1. This should be just a translation followed by a rotation. // We then compute the relative position of the circle's center as well // as the start angle and then inverse transform these back. (The angular // sweep of the arc is unchanged.) double x0=0, y0=0; this->last_vertex(&x0, &y0); this->ptm.inverse_transform(&x0, &y0); // Calculate the offset and rotation so that x1,y1, is at the origin (0,0), // and x0, y0 sites on the positive x axis (right side of x1,y1). agg24::trans_affine_translation xform(-x1, -y1); double xform_angle = -atan2(y0-y1, x0-x1); if (!kiva::almost_equal(fmod(xform_angle, 2*agg24::pi), 0.0)) { xform *= agg24::trans_affine_rotation(xform_angle); } // Transform and rotate the points. xform.transform(&x0, &y0); xform.transform(&x1, &y1); xform.transform(&x2, &y2); assert(kiva::almost_equal(y1, 0.0)); assert(kiva::almost_equal(x1, 0.0)); double cx, cy; // location of circle's center double center_angle = atan2(y2, x2) / 2; bool sweep_flag = (center_angle >= 0) ? false : true; double hypotenuse = fabs(radius / sin(center_angle)); cx = hypotenuse * cos(center_angle); cy = hypotenuse * sin(center_angle); // determine if we need to draw a line to the first tangent point // from the current pen position. if (!kiva::almost_equal(x0, cx)) { x0 = cx; xform.inverse_transform(&x0, &y0); this->line_to(x0, y0); } else { xform.inverse_transform(&x0, &y0); } // determine the second tangent point double point2_scale = cx / sqrt(x2*x2 + y2*y2); x2 *= point2_scale; y2 *= point2_scale; xform.inverse_transform(&x2, &y2); agg24::bezier_arc_svg aggarc(x0, y0, radius, radius, 0.0, false, sweep_flag, x2, y2); int numverts = aggarc.num_vertices(); double *vertices = aggarc.vertices(); double *v = NULL; for (int i = 0; i <= numverts/2; i++) { v = vertices + i*2; this->ptm.transform(v, v+1); } // I believe join_path is equivalent to the old add_path() with solid_path=true this->join_path(aggarc, 0); // This is the alternative call. //this->concat_path(aggarc, 0); this->_has_curves = true; } void compiled_path::add_path(compiled_path& other_path) { container_type& vertices = this->vertices(); double x=0.0; double y=0.0; unsigned cmd; other_path.rewind(0); cmd = other_path.vertex(&x, &y); while(!agg24::is_stop(cmd)) { this->_has_curves |= agg24::is_curve(cmd); this->ptm.transform(&x,&y); vertices.add_vertex(x, y, cmd); cmd = other_path.vertex(&x, &y); } this->concat_ctm(other_path.ptm); } //{ // agg24::conv_transform trans(p,ptm); // agg24::path_storage::add_path(trans); // concat_ctm(p.ptm); //} void compiled_path::lines(double* pts, int Npts) { this->move_to(pts[0],pts[1]); for(int i=2; i < Npts*2; i+=2) this->line_to(pts[i],pts[i+1]); } void compiled_path::line_set(double* start, int Nstart, double* end, int Nend) { int num_pts = (Nstart > Nend) ? Nend : Nstart; for (int i=0; i < num_pts*2; i += 2) { this->move_to(start[i], start[i+1]); this->line_to(end[i], end[i+1]); } } void compiled_path::rect(double x, double y, double sx, double sy) { this->move_to(x, y); this->line_to(x, y+sy); this->line_to(x+sx, y+sy); this->line_to(x+sx, y); this->close_path(); } void compiled_path::rect(kiva::rect_type &r) { this->rect(r.x, r.y, r.w, r.h); } void compiled_path::rects(double* all_rects, int Nrects) { double *tmp; for(int i = 0; i < Nrects*4; i+=4) { tmp = &all_rects[i]; this->rect(tmp[0], tmp[1], tmp[2], tmp[3]); } } void compiled_path::rects(kiva::rect_list_type &rectlist) { for (kiva::rect_list_type::iterator it=rectlist.begin(); it != rectlist.end(); it++) { this->rect(it->x, it->y, it->w, it->h); } } void compiled_path::_transform_ctm(agg24::trans_affine& m) { this->ptm.premultiply(m); } void compiled_path::translate_ctm(double x, double y) { agg24::trans_affine_translation m(x,y); this->_transform_ctm(m); } void compiled_path::rotate_ctm(double angle) { agg24::trans_affine_rotation m(angle); this->_transform_ctm(m); } void compiled_path::scale_ctm(double sx, double sy) { agg24::trans_affine_scaling m(sx,sy); this->_transform_ctm(m); } void compiled_path::concat_ctm(agg24::trans_affine& m) { agg24::trans_affine m_copy(m); this->_transform_ctm(m_copy); } void compiled_path::set_ctm(agg24::trans_affine& m) { this->ptm = agg24::trans_affine(m); } agg24::trans_affine compiled_path::get_ctm() { return this->ptm; } void compiled_path::save_ctm() { this->ptm_stack.push(this->ptm); } void compiled_path::restore_ctm() { // !! need to check what error should be on empty stack. if ( !this->ptm_stack.empty()) { this->ptm = this->ptm_stack.top(); this->ptm_stack.pop(); } } enthought-chaco2-4.8.1.orig/kiva/agg/src/gl_test/0000755000175000017500000000000013544357627020635 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/src/gl_test/gl_test.cpp0000644000175000017500000000334113233644505022770 0ustar varunvarun #include "Lesson2.h" #include "gl_graphics_context.h" using namespace kiva; #define WIDTH 640 #define HEIGHT 480 int OrigDrawGLScene(GLvoid) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0 glBegin(GL_TRIANGLES); // Drawing Using Triangles glVertex3f( 0.0f, 1.0f, 0.0f); // Top glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glEnd(); // Finished Drawing The Triangle glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units glBegin(GL_QUADS); // Draw A Quad glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glEnd(); // Done Drawing The Quad return TRUE; // Keep Going } int KivaDrawGLScene(GLvoid) { gl_graphics_context gc(WIDTH, HEIGHT); gc.gl_init(); // XXX: Verify antialiasing from python //gc.set_antialias(1); gc.set_fill_color(agg24::rgba(1.0, 0.0, 0.0)); gc.set_stroke_color(agg24::rgba(0.0, 1.0, 0.0)); gc.set_line_width(1.0); gc.move_to(100.0, 100.0); gc.line_to(100.0, 200.0); gc.line_to(200.0, 200.0); gc.close_path(); gc.draw_path(FILL_STROKE); gc.begin_path(); gc.line_to(50, 50); gc.line_to(75, 75); gc.line_to(275, 75); gc.line_to(275, 50); gc.close_path(); gc.draw_path(FILL_STROKE); return TRUE; } int DrawGLScene(GLvoid) { //return OrigDrawGLScene(); return KivaDrawGLScene(); }enthought-chaco2-4.8.1.orig/kiva/agg/src/gl_test/gl_test.vcproj0000644000175000017500000000732213233644505023514 0ustar varunvarun enthought-chaco2-4.8.1.orig/kiva/agg/src/gl_test/Lesson2.cpp0000644000175000017500000003671013233644505022662 0ustar varunvarun/* Modified Lesson2.cpp from NeHe tutorials * * This has been modified in the following ways: * WinMain has been renamed to DefaultWinMain * DrawGLScene has been renamed to DefaultDrawGLScene * * -- pzw */ /* * This Code Was Created By Jeff Molofee 2000 * A HUGE Thanks To Fredric Echols For Cleaning Up * And Optimizing The Base Code, Making It More Flexible! * If You've Found This Code Useful, Please Let Me Know. * Visit My Site At nehe.gamedev.net */ #include "Lesson2.h" HDC hDC=NULL; // Private GDI Device Context HGLRC hRC=NULL; // Permanent Rendering Context HWND hWnd=NULL; // Holds Our Window Handle HINSTANCE hInstance; // Holds The Instance Of The Application bool keys[256]; // Array Used For The Keyboard Routine bool active=TRUE; // Window Active Flag Set To TRUE By Default bool fullscreen=FALSE; // Fullscreen Flag Set To Fullscreen Mode By Default LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration For WndProc GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window { if (height==0) // Prevent A Divide By Zero By { height=1; // Making Height Equal One } glViewport(0,0,width,height); // Reset The Current Viewport glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix // Calculate The Aspect Ratio Of The Window //gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); glOrtho(0, width, 0, height, 1, -1); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix } int InitGL(GLvoid) // All Setup For OpenGL Goes Here { glShadeModel(GL_SMOOTH); // Enable Smooth Shading glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background glClearDepth(1.0f); // Depth Buffer Setup //glEnable(GL_DEPTH_TEST); // Enables Depth Testing //glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations return TRUE; // Initialization Went OK } int DefaultDrawGLScene(GLvoid) // Here's Where We Do All The Drawing { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0 glBegin(GL_TRIANGLES); // Drawing Using Triangles glVertex3f( 0.0f, 1.0f, 0.0f); // Top glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glEnd(); // Finished Drawing The Triangle glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units glBegin(GL_QUADS); // Draw A Quad glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glEnd(); // Done Drawing The Quad return TRUE; // Keep Going } GLvoid KillGLWindow(GLvoid) // Properly Kill The Window { if (fullscreen) // Are We In Fullscreen Mode? { ChangeDisplaySettings(NULL,0); // If So Switch Back To The Desktop ShowCursor(TRUE); // Show Mouse Pointer } if (hRC) // Do We Have A Rendering Context? { if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts? { MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC? { MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } hRC=NULL; // Set RC To NULL } if (hDC && !ReleaseDC(hWnd,hDC)) // Are We Able To Release The DC { MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hDC=NULL; // Set DC To NULL } if (hWnd && !DestroyWindow(hWnd)) // Are We Able To Destroy The Window? { MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hWnd=NULL; // Set hWnd To NULL } if (!UnregisterClass("OpenGL",hInstance)) // Are We Able To Unregister Class { MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hInstance=NULL; // Set hInstance To NULL } } /* This Code Creates Our OpenGL Window. Parameters Are: * * title - Title To Appear At The Top Of The Window * * width - Width Of The GL Window Or Fullscreen Mode * * height - Height Of The GL Window Or Fullscreen Mode * * bits - Number Of Bits To Use For Color (8/16/24/32) * * fullscreenflag - Use Fullscreen Mode (TRUE) Or Windowed Mode (FALSE) */ BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag) { GLuint PixelFormat; // Holds The Results After Searching For A Match WNDCLASS wc; // Windows Class Structure DWORD dwExStyle; // Window Extended Style DWORD dwStyle; // Window Style RECT WindowRect; // Grabs Rectangle Upper Left / Lower Right Values WindowRect.left=(long)0; // Set Left Value To 0 WindowRect.right=(long)width; // Set Right Value To Requested Width WindowRect.top=(long)0; // Set Top Value To 0 WindowRect.bottom=(long)height; // Set Bottom Value To Requested Height fullscreen=fullscreenflag; // Set The Global Fullscreen Flag hInstance = GetModuleHandle(NULL); // Grab An Instance For Our Window wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Size, And Own DC For Window. wc.lpfnWndProc = (WNDPROC) WndProc; // WndProc Handles Messages wc.cbClsExtra = 0; // No Extra Window Data wc.cbWndExtra = 0; // No Extra Window Data wc.hInstance = hInstance; // Set The Instance wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); // Load The Default Icon wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load The Arrow Pointer wc.hbrBackground = NULL; // No Background Required For GL wc.lpszMenuName = NULL; // We Don't Want A Menu wc.lpszClassName = "OpenGL"; // Set The Class Name if (!RegisterClass(&wc)) // Attempt To Register The Window Class { MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (fullscreen) // Attempt Fullscreen Mode? { DEVMODE dmScreenSettings; // Device Mode memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared dmScreenSettings.dmSize=sizeof(dmScreenSettings); // Size Of The Devmode Structure dmScreenSettings.dmPelsWidth = width; // Selected Screen Width dmScreenSettings.dmPelsHeight = height; // Selected Screen Height dmScreenSettings.dmBitsPerPel = bits; // Selected Bits Per Pixel dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; // Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar. if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) { // If The Mode Fails, Offer Two Options. Quit Or Use Windowed Mode. if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES) { fullscreen=FALSE; // Windowed Mode Selected. Fullscreen = FALSE } else { // Pop Up A Message Box Letting User Know The Program Is Closing. MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP); return FALSE; // Return FALSE } } } if (fullscreen) // Are We Still In Fullscreen Mode? { dwExStyle=WS_EX_APPWINDOW; // Window Extended Style dwStyle=WS_POPUP; // Windows Style ShowCursor(FALSE); // Hide Mouse Pointer } else { dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; // Window Extended Style dwStyle=WS_OVERLAPPEDWINDOW; // Windows Style } AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); // Adjust Window To True Requested Size // Create The Window if (!(hWnd=CreateWindowEx( dwExStyle, // Extended Style For The Window "OpenGL", // Class Name title, // Window Title dwStyle | // Defined Window Style WS_CLIPSIBLINGS | // Required Window Style WS_CLIPCHILDREN, // Required Window Style 0, 0, // Window Position WindowRect.right-WindowRect.left, // Calculate Window Width WindowRect.bottom-WindowRect.top, // Calculate Window Height NULL, // No Parent Window NULL, // No Menu hInstance, // Instance NULL))) // Dont Pass Anything To WM_CREATE { KillGLWindow(); // Reset The Display MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } static PIXELFORMATDESCRIPTOR pfd= // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format bits, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 16, // 16Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; if (!(hDC=GetDC(hWnd))) // Did We Get A Device Context? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) // Did Windows Find A Matching Pixel Format? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if(!SetPixelFormat(hDC,PixelFormat,&pfd)) // Are We Able To Set The Pixel Format? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (!(hRC=wglCreateContext(hDC))) // Are We Able To Get A Rendering Context? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if(!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } ShowWindow(hWnd,SW_SHOW); // Show The Window SetForegroundWindow(hWnd); // Slightly Higher Priority SetFocus(hWnd); // Sets Keyboard Focus To The Window ReSizeGLScene(width, height); // Set Up Our Perspective GL Screen if (!InitGL()) // Initialize Our Newly Created GL Window { KillGLWindow(); // Reset The Display MessageBox(NULL,"Initialization Failed.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } return TRUE; // Success } LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window UINT uMsg, // Message For This Window WPARAM wParam, // Additional Message Information LPARAM lParam) // Additional Message Information { switch (uMsg) // Check For Windows Messages { case WM_ACTIVATE: // Watch For Window Activate Message { if (!HIWORD(wParam)) // Check Minimization State { active=TRUE; // Program Is Active } else { active=FALSE; // Program Is No Longer Active } return 0; // Return To The Message Loop } case WM_SYSCOMMAND: { switch (wParam) { case SC_SCREENSAVE: case SC_MONITORPOWER: return 0; } break; } case WM_CLOSE: // Did We Receive A Close Message? { PostQuitMessage(0); // Send A Quit Message return 0; // Jump Back } case WM_KEYDOWN: // Is A Key Being Held Down? { keys[wParam] = TRUE; // If So, Mark It As TRUE return 0; // Jump Back } case WM_KEYUP: // Has A Key Been Released? { keys[wParam] = FALSE; // If So, Mark It As FALSE return 0; // Jump Back } case WM_SIZE: // Resize The OpenGL Window { ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); // LoWord=Width, HiWord=Height return 0; // Jump Back } } // Pass All Unhandled Messages To DefWindowProc return DefWindowProc(hWnd,uMsg,wParam,lParam); } int WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State { MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop // Ask The User Which Screen Mode They Prefer //if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) //{ // fullscreen=FALSE; // Windowed Mode //} // Create Our OpenGL Window if (!CreateGLWindow("NeHe's First Polygon Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active? Was There A Quit Received? { done=TRUE; // ESC or DrawGLScene Signalled A Quit } else // Not Time To Quit, Update Screen { SwapBuffers(hDC); // Swap Buffers (Double Buffering) } if (keys[VK_F1]) // Is F1 Being Pressed? { keys[VK_F1]=FALSE; // If So Make Key FALSE KillGLWindow(); // Kill Our Current Window fullscreen=!fullscreen; // Toggle Fullscreen / Windowed Mode // Recreate Our OpenGL Window if (!CreateGLWindow("NeHe's First Polygon Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } } } } // Shutdown KillGLWindow(); // Kill The Window return (msg.wParam); // Exit The Program } enthought-chaco2-4.8.1.orig/kiva/agg/src/gl_test/Lesson2.h0000644000175000017500000000135013233644505022317 0ustar varunvarun#ifndef LESSON2_H #define LESSON2_H #include // Header File For Windows #include // Header File For The OpenGL32 Library #include // Header File For The GLu32 Library #include // Implement your own version of this function int DrawGLScene(GLvoid); // Functions implemented in Lesson2.cpp GLvoid ReSizeGLScene(GLsizei width, GLsizei height); int InitGL(GLvoid); GLvoid KillGLWindow(GLvoid); BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag); int DefaultDrawGLScene(GLvoid); int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow); #endif /* LESSON2_H */ enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_exceptions.h0000644000175000017500000000041213233644505022522 0ustar varunvarun#ifndef KIVA_EXCEPTIONS_H #define KIVA_EXCEPTIONS_H namespace kiva { // exception codes used in graphics_context enum { not_implemented_error = 0, ctm_rotation_error, bad_clip_state_error, even_odd_clip_error, clipping_path_unsupported }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/agg_std_string.i0000644000175000017500000000135413233644505022334 0ustar varunvarun%include "std_string.i" // These typemaps are needed to handle member access to font_type.name // and friends. They really should by part of std_string.i, shouldn't // they? #ifdef SWIGPYTHON %typemap(in) std::string * { if (PyBytes_Check ($input)) { $1 = new std::string((char *)PyBytes_AsString($input)); } #if PY_VERSION_HEX >= 0x03030000 else if (PyUnicode_Check($input)) { $1 = new std::string((char *)PyUnicode_AsUTF8($input)); } #endif else { PyErr_SetString (PyExc_TypeError, "not a String"); return NULL; } } %typemap(out) std::string * { $result = SWIG_Python_str_FromChar((const char *)$1->c_str()); } %typemap(freearg) std::string * { if ($1) { delete $1; } } #endif /* SWIGPYTHON */ enthought-chaco2-4.8.1.orig/kiva/agg/src/x11/0000755000175000017500000000000013544357627017605 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/src/x11/agg_platform_specific.cpp0000644000175000017500000003136013233644505024610 0ustar varunvarun#include #include #include #include #include #include "x11/agg_platform_specific.h" #include "util/agg_color_conv_rgb8.h" #include "x11/agg_bmp.h" //#define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); #define DEBUG_MTH(NAME) typedef struct { short x1, x2, y1, y2; } Box, BOX, BoxRec, *BoxPtr; typedef struct { short x, y, width, height; }RECTANGLE, RectangleRec, *RectanglePtr; typedef struct _XRegion { long size; long numRects; BOX *rects; BOX extents; } REGION; namespace agg24 { x11_display::x11_display(): m_screen(0), m_depth(0), m_visual(0), m_dc(0), m_gc(0), m_sys_bpp(0) { DEBUG_MTH("x11_display::x11_display"); } x11_display::~x11_display() { DEBUG_MTH("x11_display::~x11_display"); close(); } bool x11_display::open(const char* display_name) { DEBUG_MTH("x11_display::open"); if (m_display != 0) { fprintf(stderr, "X11 display is opened already\n"); return false; } //printf("Opened X11 display: %s\n", display_name); m_display = XOpenDisplay(display_name); if (m_display == 0) { fprintf(stderr, "Unable to open DISPLAY=%s!\n",display_name); return false; } m_screen = DefaultScreen(m_display); m_depth = DefaultDepth(m_display, m_screen); m_visual = DefaultVisual(m_display, m_screen); switch(m_depth) { case 15: case 16: m_sys_bpp = 16; break; case 24: case 32: m_sys_bpp = 32; break; default: fprintf(stderr, "Unexpected X11 display depth=%d!\n",m_depth); } return true; } void x11_display::close() { DEBUG_MTH("x11_display::close"); if (m_display != 0) { if (m_gc != 0) XFreeGC(m_display, m_gc); XCloseDisplay(m_display); } m_display = 0; m_screen = 0; m_depth = 0; m_visual = 0; m_dc = 0; m_gc = 0; } bool x11_display::put_image(Window dc, XImage* image) { DEBUG_MTH("x11_display::put_image"); if (m_dc != dc) { if (m_gc) XFreeGC(m_display, m_gc); m_dc = dc; //m_gc = DefaultGC(m_display, m_screen); m_gc = XCreateGC(m_display, m_dc, 0, 0); } // Region r = XCreateRegion(); // r->numRects = 1; // r->size = 1; // r->rects = &r->extents; // r->extents.x1 = 0; // r->extents.x2 = image->width; // r->extents.y1 = 0; // r->extents.y2 = image->height; //XSetClipMask( m_display, m_gc, None ); //XSetClipOrigin(m_display, m_gc, 0, 0); XPutImage(m_display, dc, m_gc, image, 0, 0, 0, 0, image->width, image->height ); // XSetRegion(m_display,m_gc,r); //XDestroyRegion(r); //XMapWindow(m_display, dc); //XSync(m_display, false); return true; } XImage* x11_display::create_image(const rendering_buffer* rbuf) { DEBUG_MTH("x11_display::create_image"); unsigned width = rbuf->width(); unsigned height = rbuf->height(); return XCreateImage(m_display, m_visual, //CopyFromParent, m_depth, ZPixmap, 0, (char*)(rbuf->buf()), width, height, m_sys_bpp, width * (m_sys_bpp / 8)); } void x11_display::destroy_image(XImage* ximg) { DEBUG_MTH("x11_display::destroy_image"); if (ximg != 0) XDestroyImage(ximg); /* XDestroyImage function frees both the image structure and the data pointed to by the image structure. */ } //------------------------------------------------------------------------ platform_specific::platform_specific(pix_format_e format, bool flip_y) : m_bpp(0), m_flip_y(flip_y), m_ximage(0), m_format(format), m_sys_bpp(0), m_sys_format(pix_format_undefined) { DEBUG_MTH("platform_specific::platform_specific"); init(); } platform_specific::~platform_specific() { DEBUG_MTH("platform_specific::~platform_specific"); } x11_display platform_specific::x11; bool platform_specific::init() { DEBUG_MTH("platform_specific::init"); if (x11.m_display == 0 && !x11.open()) { fprintf(stderr, "No X11 display available!\n"); return false; } unsigned long r_mask = x11.m_visual->red_mask; unsigned long g_mask = x11.m_visual->green_mask; unsigned long b_mask = x11.m_visual->blue_mask; if(x11.m_depth < 15 || r_mask == 0 || g_mask == 0 || b_mask == 0) { fprintf(stderr, "There's no Visual compatible with minimal AGG requirements:\n" "At least 15-bit color depth and True- or DirectColor class.\n\n" ); return false; } switch(m_format) { case pix_format_gray8: m_bpp = 8; break; case pix_format_rgb565: case pix_format_rgb555: m_bpp = 16; break; case pix_format_rgb24: case pix_format_bgr24: m_bpp = 24; break; case pix_format_bgra32: case pix_format_abgr32: case pix_format_argb32: case pix_format_rgba32: m_bpp = 32; break; case pix_format_undefined: case end_of_pix_formats: ; } // // Calculate m_sys_format, m_byte_order, m_sys_bpp: // int t = 1; int hw_byte_order = LSBFirst; if(*(char*)&t == 0) hw_byte_order = MSBFirst; switch(x11.m_depth) { case 15: m_sys_bpp = 16; if(r_mask == 0x7C00 && g_mask == 0x3E0 && b_mask == 0x1F) { m_sys_format = pix_format_rgb555; m_byte_order = hw_byte_order; } break; case 16: m_sys_bpp = 16; if(r_mask == 0xF800 && g_mask == 0x7E0 && b_mask == 0x1F) { m_sys_format = pix_format_rgb565; m_byte_order = hw_byte_order; } break; case 24: case 32: m_sys_bpp = 32; if(g_mask == 0xFF00) { if(r_mask == 0xFF && b_mask == 0xFF0000) { switch(m_format) { case pix_format_rgba32: m_sys_format = pix_format_rgba32; m_byte_order = LSBFirst; break; case pix_format_abgr32: m_sys_format = pix_format_abgr32; m_byte_order = MSBFirst; break; default: m_byte_order = hw_byte_order; m_sys_format = (hw_byte_order == LSBFirst) ? pix_format_rgba32 : pix_format_abgr32; break; } } if(r_mask == 0xFF0000 && b_mask == 0xFF) { switch(m_format) { case pix_format_argb32: m_sys_format = pix_format_argb32; m_byte_order = MSBFirst; break; case pix_format_bgra32: m_sys_format = pix_format_bgra32; m_byte_order = LSBFirst; break; default: m_byte_order = hw_byte_order; m_sys_format = (hw_byte_order == MSBFirst) ? pix_format_argb32 : pix_format_bgra32; break; } } } break; } if(m_sys_format == pix_format_undefined) { fprintf(stderr, "RGB masks are not compatible with AGG pixel formats:\n" "R=%08x, G=%08x, B=%08x\n", (unsigned int)r_mask, (unsigned int)g_mask, (unsigned int)b_mask); return false; } return true; } #define UNHANDLED_PIX_FORMATS \ case end_of_pix_formats: ; \ case pix_format_gray8: ; \ case pix_format_undefined: ; void platform_specific::destroy() { DEBUG_MTH("platform_specific::destroy"); if (m_ximage != 0) { x11.destroy_image(m_ximage); m_ximage = 0; } } void platform_specific::display_pmap(Window dc, const rendering_buffer* rbuf) { DEBUG_MTH("platform_specific::display_map"); if (m_format == m_sys_format) { if (m_ximage == 0) { m_ximage = x11.create_image(rbuf); m_ximage->byte_order = m_byte_order; } x11.put_image(dc, m_ximage); return; } // Optimization hint: make pmap_tmp as a private class member and reused it when possible. pixel_map pmap_tmp(rbuf->width(), rbuf->height(), m_sys_format, 256, m_flip_y); rendering_buffer* rbuf2 = &pmap_tmp.rbuf(); switch(m_sys_format) { case pix_format_rgb555: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_rgb555()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_rgb555()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_rgb555()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_rgb555()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_rgb555()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_rgb555()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_rgb555()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_rgb555()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_rgb565: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_rgb565()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_rgb565()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_rgb565()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_rgb565()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_rgb565()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_rgb565()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_rgb565()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_rgb565()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_rgba32: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_rgba32()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_rgba32()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_rgba32()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_rgba32()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_rgba32()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_rgba32()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_rgba32()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_rgba32()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_abgr32: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_abgr32()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_abgr32()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_abgr32()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_abgr32()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_abgr32()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_abgr32()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_abgr32()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_abgr32()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_argb32: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_argb32()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_argb32()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_argb32()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_argb32()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_argb32()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_argb32()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_argb32()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_argb32()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_bgra32: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_bgra32()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_bgra32()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_bgra32()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_bgra32()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_bgra32()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_bgra32()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_bgra32()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_bgra32()); break; UNHANDLED_PIX_FORMATS; } break; UNHANDLED_PIX_FORMATS; } pmap_tmp.draw(dc); } unsigned platform_specific::calc_row_len(unsigned width, unsigned bits_per_pixel) { return width * (bits_per_pixel / 8); } } enthought-chaco2-4.8.1.orig/kiva/agg/src/x11/plat_support.i0000644000175000017500000000667513233644505022516 0ustar varunvarun// -*- c++ -*- %module plat_support %include numeric.i %{ #include "x11/agg_bmp.h" namespace agg24 { PyObject* pixel_map_as_unowned_array(agg24::pixel_map& pix_map) { npy_intp dims[3]; npy_intp rows = pix_map.height(); npy_intp cols = pix_map.width(); npy_intp depth = pix_map.bpp() / 8; dims[0] = rows; dims[1] = cols; dims[2] = depth; return PyArray_SimpleNewFromData(3,dims,NPY_UINT8,(void*)pix_map.buf()); } } %} %typemap(in)(Window) { $1 = (Window) PyInt_AsLong($input); } // More permissive unsigned typemap that converts any numeric type to an // unsigned value. It is cleared at the end of this file. %typemap(in) unsigned { PyObject* obj = PyNumber_Long($input); if (PyErr_Occurred()) SWIG_fail; $1 = (unsigned) PyLong_AsLong(obj); if (PyErr_Occurred()) SWIG_fail; } namespace agg24 { enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_gray8, // Simple 256 level grayscale pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_bgr24, // B-G-R, native win32 BMP format. pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_argb32, // A-R-G-B, native MAC format pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_bgra32, // B-G-R-A, native win32 BMP format end_of_pix_formats }; %rename(PixelMap) pixel_map; class pixel_map { public: ~pixel_map(); pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up); public: %feature("shadow") draw(Window h_dc, int x, int y, double scale) const %{ def draw(self, h_dc, x=0, y=0, scale=1.0): # fix me: brittle becuase we are hard coding # module and class name. Done cause SWIG 1.3.24 does # some funky overloading stuff in it that breaks keyword # arguments. result = _plat_support.PixelMap_draw(self, h_dc, x, y, scale) return result %} void draw(Window h_dc, int x, int y, double scale) const; PyObject* convert_to_rgbarray() const; PyObject* convert_to_argb32string() const; %pythoncode %{ def set_bmp_array(self): self.bmp_array = pixel_map_as_unowned_array(self) return self def draw_to_tkwindow(self, window, x, y): window_id = window._tk_widget.winfo_id() self.draw(window_id, x, y) return def draw_to_wxwindow(self, window, x, y): import wx window_dc = getattr(window,'_dc',None) if window_dc is None: window_dc = wx.PaintDC(window) arr = self.convert_to_rgbarray() sz = arr.shape[:2] image = wx.EmptyImage(*sz) image.SetDataBuffer(arr.data) bmp = wx.BitmapFromImage(image, depth=-1) window_dc.BeginDrawing() window_dc.DrawBitmap(bmp,x,y) window_dc.EndDrawing() return %} }; } PyObject* pixel_map_as_unowned_array(agg24::pixel_map& pix_map); // clear the "permissive" unsigned typemap we are using. %typemap(in) unsigned; enthought-chaco2-4.8.1.orig/kiva/agg/src/x11/agg_platform_specific.h0000644000175000017500000000446213233644505024260 0ustar varunvarun// -*- c++ -*- #ifndef AGG_X11_SPECIFIC_INCLUDED #define AGG_X11_SPECIFIC_INCLUDED #include #include "agg_basics.h" #include "agg_rendering_buffer.h" namespace agg24 { enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_gray8, // Simple 256 level grayscale pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_bgr24, // B-G-R, native win32 BMP format. pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_argb32, // A-R-G-B, native MAC format pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_bgra32, // B-G-R-A, native win32 BMP format end_of_pix_formats }; class x11_display { public: x11_display(); ~x11_display(); bool open(const char* display_name = NULL); void close(); bool put_image(Window dc, XImage* image); XImage* create_image(const rendering_buffer* rbuf); void destroy_image(XImage* ximg); public: Display* m_display; int m_screen; int m_depth; Visual* m_visual; Window m_dc; GC m_gc; unsigned m_sys_bpp; }; //------------------------------------------------------------------------ class platform_specific { static x11_display x11; public: platform_specific(pix_format_e format, bool flip_y); ~platform_specific(); void display_pmap(Window dc, const rendering_buffer* src); void destroy(); static unsigned calc_row_len(unsigned width, unsigned bits_per_pixel); private: bool init(); public: unsigned m_bpp; // init() bool m_flip_y; // platform_specific() XImage* m_ximage; // display_pmap() pix_format_e m_format; // platform_specific() private: int m_byte_order; // init() unsigned m_sys_bpp; // init() pix_format_e m_sys_format; // init() }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/x11/agg_bmp.cpp0000644000175000017500000001416613233644505021702 0ustar varunvarun#include #include #include #include "x11/agg_bmp.h" #include "x11/agg_platform_specific.h" /* #include */ #include "agg_pixfmt_rgb.h" #include "agg_pixfmt_rgba.h" #include "agg_color_rgba.h" #include "bytesobject.h" #ifdef NUMPY #include "numpy/arrayobject.h" # ifndef PyArray_SBYTE # include "numpy/noprefix.h" # include "numpy/oldnumeric.h" # include "numpy/old_defines.h" # endif #else #include "Numeric/arrayobject.h" #define PyArray_UBYTELTR 'b' #endif #if 0 #define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); #define DEBUG_MTH2(STR,ARG1,ARG2) fprintf(stderr, STR "\n",(ARG1),(ARG2)); #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) fprintf(stderr, STR "\n",(ARG1),(ARG2),(ARG3),(ARG4),(ARG5)); #else #define DEBUG_MTH(NAME) #define DEBUG_MTH2(STR,ARG1,ARG2) #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) #endif namespace agg24 { //------------------------------------------------------------------------ pixel_map::pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up): m_bmp(0), m_buf(0), m_specific(new platform_specific(format, bottom_up)) { DEBUG_MTH5("pixel_map::pixel_map(%d,%d,%d,%d,%d)",width,height,format,clear_val,bottom_up); m_bpp = m_specific->m_bpp; create(width, height, clear_val); } //------------------------------------------------------------------------ pixel_map::~pixel_map() { DEBUG_MTH("pixel_map::~pixel_map"); destroy(); delete m_specific; } //------------------------------------------------------------------------ void pixel_map::destroy() { if (m_specific->m_ximage != 0) { m_specific->destroy(); } else if(m_bmp) { delete [] (unsigned char*)m_bmp; } m_bmp = 0; m_buf = 0; } //------------------------------------------------------------------------ void pixel_map::create(unsigned width, unsigned height, unsigned clear_val) { destroy(); if(width == 0) width = 1; if(height == 0) height = 1; unsigned row_len = platform_specific::calc_row_len(width, m_bpp); unsigned img_size = row_len * height; m_bmp = (Pixmap*) new unsigned char[img_size]; m_buf = (unsigned char*)m_bmp; if(clear_val <= 255) { memset(m_buf, clear_val, img_size); } m_rbuf_window.attach(m_buf, width, height, (m_specific->m_flip_y ? -row_len : row_len)); } //------------------------------------------------------------------------ void pixel_map::draw(Window dc, int x, int y, double scale) const { DEBUG_MTH("pixel_map::draw"); if(m_bmp == 0 || m_buf == 0) return; m_specific->display_pmap(dc, &m_rbuf_window); } pix_format_e pixel_map::get_pix_format() const { return m_specific->m_format; } unsigned char* pixel_map::buf() { return m_buf; } unsigned pixel_map::width() const { return m_rbuf_window.width(); } unsigned pixel_map::height() const { return m_rbuf_window.height(); } unsigned pixel_map::stride() const { return platform_specific::calc_row_len(width(),m_bpp); } PyObject* pixel_map::convert_to_rgbarray() const { unsigned w = width(); unsigned h = height(); pix_format_e format = get_pix_format(); rgba8 c; unsigned i,j; npy_intp dims[3]; PyObject* arr = NULL; char* data = NULL; dims[0] = w; dims[1] = h; dims[2] = 3; import_array(); arr = PyArray_SimpleNew(3,dims,PyArray_BYTE); if (arr==NULL) return NULL; data = ((PyArrayObject *)arr)->data; switch (format) { case pix_format_bgra32: { pixfmt_bgra32 r((rendering_buffer&)m_rbuf_window); for (j=0;jGetData(); pix_format_e format = get_pix_format(); rgba8 c; unsigned i,j; switch (format) { case pix_format_bgra32: #ifdef WX_RELEASE_2_5 image->SetAlpha(); printf("image->HasAlpha()=%d\n",image->HasAlpha()); #endif { pixel_formats_rgba32 r((rendering_buffer&)m_rbuf_window); for (j=0;jSetAlpha((int)i,(int)j,(unsigned char)c.a); #endif } } break; default: fprintf(stderr,"pix_format %d not handled!\n",format); } return image; } #endif } enthought-chaco2-4.8.1.orig/kiva/agg/src/x11/agg_bmp.h0000644000175000017500000000245413233644505021344 0ustar varunvarun// -*- c++ -*- #ifndef AGG_X11_BMP_INCLUDED #define AGG_X11_BMP_INCLUDED #include "Python.h" #include "x11/agg_platform_specific.h" #ifdef WX_INFO #include #endif namespace agg24 { class pixel_map { public: ~pixel_map(); pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up); void draw(Window h_dc, int x=0, int y=0, double scale=1.0) const; pix_format_e get_pix_format() const; public: unsigned char* buf(); unsigned width() const; unsigned height() const; unsigned stride() const; unsigned bpp() const { return m_bpp; } rendering_buffer& rbuf() { return m_rbuf_window; } PyObject* convert_to_rgbarray() const; PyObject* convert_to_argb32string() const; #ifdef WX_INFO wxImage* convert_to_wximage() const; #endif private: void destroy(); void create(unsigned width, unsigned height, unsigned clear_val=256); private: Pixmap* m_bmp; unsigned char* m_buf; // -> m_bmp unsigned m_bpp; // calculated from format rendering_buffer m_rbuf_window; public: platform_specific* m_specific; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/sequence_to_array.i0000644000175000017500000000175513233644505023053 0ustar varunvarun// Map a Python sequence into any sized C double array // This handles arrays and sequences with non-float values correctly. // !! Optimize for array conversion?? #ifdef SWIGPYTHON %typemap(in) double[ANY](double temp[$1_dim0]) { int i; if (!PySequence_Check($input)) { PyErr_SetString(PyExc_TypeError,"Expecting a sequence"); return NULL; } if (PyObject_Length($input) != $1_dim0) { PyErr_SetString(PyExc_ValueError,"Expecting a sequence with $1_dim0 elements"); return NULL; } for (i =0; i < $1_dim0; i++) { PyObject *o = PySequence_GetItem($input,i); if (PyFloat_Check(o)) { temp[i] = PyFloat_AsDouble(o); } else { PyObject* converted = PyNumber_Float(o); if (!converted) { PyErr_SetString(PyExc_TypeError,"Expecting a sequence of floats"); return NULL; } temp[i] = PyFloat_AsDouble(converted); Py_DECREF(converted); } } $1 = &temp[0]; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_basics.h0000755000175000017500000000666613233644505021631 0ustar varunvarun#ifndef KIVA_BASICS_H #define KIVA_BASICS_H #include "kiva_constants.h" namespace kiva { #ifdef _MSC_VER #if _MSC_VER => 1300 typedef signed __int64 INT64, *PINT64; #else #ifndef INT64 #define INT64 __int64 #endif #endif #endif #ifdef __GNUC__ typedef long long INT64; #endif #ifdef max #undef max #endif #ifdef min #undef min #endif inline double max(double a, double b) { if (a>b) return a; else return b; } inline double min(double a, double b) { if (a=0) { if (y>=0) return 1; else return 4; } else { if (y>=0) return 2; else return 3; } } // Determines whether or not two floating point numbers are // essentially equal. This uses an aspect of the IEEE floating- // point spec described in // http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm // The code for both functions are from this same page. // // The basic idea is to cast the floats to ints and look at then // number of floating point numbers between them. This take advantage // of the fact that the IEEE representation puts the mantissa on the right, // meaning that incrementing an int representation of a float yields the // next representable float. The two's complement stuff is to ensure // that comparisons across the 0 boundary work. // For floating point, a maxUlps (ULP=units in last place) is roughly // equivalent to a precision of 1/8,000,000 to 1/16,000,000 inline bool almost_equal(float A, float B, int maxUlps = 100) { if (A==B) return true; // Make sure maxUlps is non-negative and small enough that the // default NAN won't compare as equal to anything. //assert(maxUlps > 0 && maxUlps < 4 * 1024 * 1024); int aInt = *(int*)&A; // Make aInt lexicographically ordered as a twos-complement int if (aInt < 0) aInt = 0x80000000 - aInt; // Make bInt lexicographically ordered as a twos-complement int int bInt = *(int*)&B; if (bInt < 0) bInt = 0x80000000 - bInt; int intDiff = aInt - bInt; if (intDiff < 0) intDiff = -intDiff; if (intDiff <= maxUlps) return true; return false; } // For double, a maxUlps (ULP=units in last place) is roughly // equivalent to a precision of 1/4e15 to 1/8e15. inline bool almost_equal(double A, double B, int maxUlps = 10000) { // Make sure maxUlps is non-negative and small enough that the // default NAN won't compare as equal to anything. //assert(maxUlps > 0 && maxUlps < 4 * 1024 * 1024); if (A==B) return true; INT64 aInt = *(INT64*)&A; // Make aInt lexicographically ordered as a twos-complement int if (aInt < 0) aInt = 0x80000000 - aInt; // Make bInt lexicographically ordered as a twos-complement int INT64 bInt = *(INT64*)&B; if (bInt < 0) bInt = 0x80000000 - bInt; INT64 intDiff = aInt - bInt; if (intDiff < 0) intDiff = -intDiff; if (intDiff <= maxUlps) return true; return false; } } #endif /* KIVA_BASICS_H */ enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_affine_helpers.cpp0000644000175000017500000000264113233644505023654 0ustar varunvarun#include "kiva_affine_helpers.h" #include #define f_eq(a,b) (fabs((a)-(b)) < epsilon) namespace kiva { bool is_identity(agg24::trans_affine& mat, double epsilon) { double temp[6]; mat.store_to(temp); return (f_eq(temp[0], 1.0) && f_eq(temp[1], 0.0) && f_eq(temp[2], 0.0) && f_eq(temp[3], 1.0) && f_eq(temp[4], 0.0) && f_eq(temp[5], 0.0)); // return (temp[0] == 1.0 && temp[1] == 0.0 && // temp[2] == 0.0 && temp[3] == 1.0 && // temp[4] == 0.0 && temp[5] == 0.0); } bool only_translation(agg24::trans_affine& mat, double epsilon) { double temp[6]; mat.store_to(temp); return (f_eq(temp[0], 1.0) && f_eq(temp[1], 0.0) && f_eq(temp[2], 0.0) && f_eq(temp[3], 1.0)); } bool only_scale_and_translation(agg24::trans_affine& mat, double epsilon) { double temp[6]; mat.store_to(temp); return (f_eq(temp[1], 0.0) && f_eq(temp[2], 0.0)); } void get_translation(agg24::trans_affine& m, double* tx, double* ty) { double temp[6]; m.store_to(temp); *tx = temp[4]; *ty = temp[5]; } void get_scale(agg24::trans_affine& m, double* dx, double* dy) { { double temp[6]; m.store_to(temp); *dx = temp[0]; *dy = temp[3]; } } } enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva.dsp0000644000175000017500000004723313233644505020634 0ustar varunvarun# Microsoft Developer Studio Project File - Name="kiva" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=kiva - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "kiva.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "kiva.mak" CFG="kiva - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "kiva - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "kiva - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "kiva - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "..\agg2\include" /I "..\agg2\font_freetype" /I "..\freetype2\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 ..\freetype2\objs\ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 !ELSEIF "$(CFG)" == "kiva - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /G6 /MD /W3 /Gm /GX /ZI /Od /I "..\agg2\include" /I "..\agg2\font_win32_tt" /I "..\agg2\font_freetype" /I "..\..\..\freetype\freetype2\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /Zm1000 /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 ..\build\temp.win32-2.3\freetype2_src.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target # Name "kiva - Win32 Release" # Name "kiva - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\kiva_affine_helpers.cpp # End Source File # Begin Source File SOURCE=.\kiva_affine_helpers.h # End Source File # Begin Source File SOURCE=.\kiva_affine_matrix.h # End Source File # Begin Source File SOURCE=.\kiva_basics.h # End Source File # Begin Source File SOURCE=.\kiva_compiled_path.cpp # End Source File # Begin Source File SOURCE=.\kiva_compiled_path.h # End Source File # Begin Source File SOURCE=.\kiva_constants.h # End Source File # Begin Source File SOURCE=.\kiva_dash_type.h # End Source File # Begin Source File SOURCE=.\kiva_font_type.cpp # End Source File # Begin Source File SOURCE=.\kiva_font_type.h # End Source File # Begin Source File SOURCE=.\kiva_graphics_context.h # End Source File # Begin Source File SOURCE=.\kiva_graphics_context_base.cpp # End Source File # Begin Source File SOURCE=.\kiva_graphics_context_base.h # End Source File # Begin Source File SOURCE=.\kiva_graphics_state.h # End Source File # Begin Source File SOURCE=.\kiva_image_filters.h # End Source File # Begin Source File SOURCE=.\kiva_pix_format.h # End Source File # Begin Source File SOURCE=.\kiva_rect.cpp # End Source File # Begin Source File SOURCE=.\kiva_rect.h # End Source File # Begin Source File SOURCE=.\kiva_span_conv_alpha.cpp # End Source File # Begin Source File SOURCE=.\kiva_span_conv_alpha.h # End Source File # Begin Source File SOURCE=.\kiva_text_image.h # End Source File # End Group # Begin Group "SWIG wrappers" # PROP Default_Filter ".i" # Begin Source File SOURCE=.\affine_matrix.i # End Source File # Begin Source File SOURCE=.\agg_std_string.i # End Source File # Begin Source File SOURCE=.\agg_typemaps.i # End Source File # Begin Source File SOURCE=..\build\src\agg_wrap.cpp # PROP Exclude_From_Build 1 # End Source File # Begin Source File SOURCE=.\compiled_path.i # End Source File # Begin Source File SOURCE=.\constants.i # End Source File # Begin Source File SOURCE=.\font_type.i # End Source File # Begin Source File SOURCE=.\graphics_context.i # End Source File # Begin Source File SOURCE=.\numeric.i # End Source File # Begin Source File SOURCE=.\numeric_ext.i # End Source File # Begin Source File SOURCE=.\rect.i # End Source File # Begin Source File SOURCE=.\rgba.i # End Source File # Begin Source File SOURCE=.\rgba_array.i # End Source File # Begin Source File SOURCE=.\sequence_to_array.i # End Source File # End Group # Begin Group "Python files" # PROP Default_Filter "" # Begin Source File SOURCE=.\chaco_ex.py # End Source File # Begin Source File SOURCE=.\code_tst.py # End Source File # Begin Source File SOURCE=.\examples.py # End Source File # Begin Source File SOURCE=.\setup_swig_agg.py # End Source File # Begin Source File SOURCE=.\tst_convert.py # End Source File # Begin Source File SOURCE=.\win32_tst.py # End Source File # End Group # Begin Group "Test files" # PROP Default_Filter "" # Begin Source File SOURCE=.\dummy.cpp # End Source File # End Group # Begin Group "agg sources" # PROP Default_Filter "" # Begin Source File SOURCE=..\agg2\src\agg_arc.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_arrowhead.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_bezier_arc.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_bspline.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_curves.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_embedded_raster_fonts.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_gsv_text.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_image_filters.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_line_aa_basics.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_line_profile_aa.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_path_storage.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_rasterizer_scanline_aa.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_rounded_rect.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_sqrt_tables.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_trans_affine.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_trans_double_path.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_trans_single_path.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_trans_warp_magnifier.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_vcgen_bspline.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_vcgen_contour.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_vcgen_dash.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_vcgen_markers_term.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_vcgen_smooth_poly1.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_vcgen_stroke.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_vpgen_clip_polygon.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_vpgen_clip_polyline.cpp # End Source File # Begin Source File SOURCE=..\agg2\src\agg_vpgen_segmentator.cpp # End Source File # End Group # Begin Group "agg freetype" # PROP Default_Filter "" # Begin Source File SOURCE=..\agg2\font_freetype\agg_font_freetype.cpp # End Source File # Begin Source File SOURCE=..\agg2\font_freetype\agg_font_freetype.h # End Source File # End Group # Begin Group "agg_headers" # PROP Default_Filter "" # Begin Source File SOURCE=..\agg2\include\agg_alpha_mask_u8.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_arc.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_array.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_arrowhead.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_basics.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_bezier_arc.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_bitset_iterator.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_bounding_rect.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_bspline.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_clip_liang_barsky.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_color_rgba.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_color_rgba8.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_adaptor_vcgen.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_adaptor_vpgen.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_bspline.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_clip_polygon.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_clip_polyline.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_close_polygon.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_concat.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_contour.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_curve.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_dash.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_gpc.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_marker.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_marker_adaptor.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_segmentator.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_shorten_path.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_smooth_poly1.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_stroke.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_transform.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_conv_unclose_polygon.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_curves.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_dda_line.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_ellipse.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_ellipse_bresenham.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_embedded_raster_fonts.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_font_cache_manager.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_gamma_functions.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_gamma_lut.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_glyph_raster_bin.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_gray8.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_gsv_text.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_image_filters.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_line_aa_basics.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_math.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_math_stroke.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_path_storage.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_path_storage_integer.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pattern_filters_rgba8.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_amask_adaptor.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_crb_rgba32.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_crb_rgba32_pre.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_gray8.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_rgb24.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_rgb24_gamma.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_rgb24_pre.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_rgb555.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_rgb565.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_rgba32.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_rgba32_plain.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_pixfmt_rgba32_pre.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_rasterizer_outline.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_rasterizer_outline_aa.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_rasterizer_scanline_aa.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_render_scanlines.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_renderer_base.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_renderer_markers.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_renderer_mclip.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_renderer_outline_aa.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_renderer_outline_image.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_renderer_primitives.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_renderer_raster_text.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_renderer_scanline.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_rendering_buffer.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_rendering_buffer_dynarow.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_rounded_rect.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_scanline_bin.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_scanline_boolean_algebra.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_scanline_p.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_scanline_storage_aa.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_scanline_storage_bin.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_scanline_u.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_shorten_path.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_simul_eq.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_allocator.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_converter.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_generator.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_gouraud.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_gouraud_gray8.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_gouraud_rgba8.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_gouraud_rgba8_gamma.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_gradient.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_gradient_alpha.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_image_filter.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_image_filter_rgb24.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_image_filter_rgb24_gamma.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_image_filter_rgba32.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_interpolator_adaptor.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_interpolator_linear.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_interpolator_trans.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_pattern.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_pattern_filter_rgba32.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_pattern_rgb24.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_pattern_rgba32.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_span_solid.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_trans_affine.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_trans_bilinear.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_trans_double_path.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_trans_perspective.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_trans_single_path.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_trans_viewport.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_trans_warp_magnifier.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vcgen_bspline.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vcgen_contour.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vcgen_dash.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vcgen_markers_term.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vcgen_smooth_poly1.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vcgen_stroke.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vcgen_vertex_sequence.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vertex_iterator.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vertex_sequence.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vpgen_clip_polygon.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vpgen_clip_polyline.h # End Source File # Begin Source File SOURCE=..\agg2\include\agg_vpgen_segmentator.h # End Source File # End Group # Begin Source File SOURCE=.\readme.txt # End Source File # Begin Source File SOURCE=.\swig_questions.txt # End Source File # Begin Source File SOURCE=.\todo.txt # End Source File # End Target # End Project enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva.sln0000644000175000017500000000257413233644505020641 0ustar varunvarunMicrosoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiva", "kiva.vcproj", "{4B72DC63-F35B-45EE-B100-A50A2C79A432}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gl_test", "gl_test\gl_test.vcproj", "{FB096497-AD67-49E8-9C91-790B5C59B5F8}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {4B72DC63-F35B-45EE-B100-A50A2C79A432}.Debug.ActiveCfg = Debug|Win32 {4B72DC63-F35B-45EE-B100-A50A2C79A432}.Debug.Build.0 = Debug|Win32 {4B72DC63-F35B-45EE-B100-A50A2C79A432}.Release.ActiveCfg = Release|Win32 {4B72DC63-F35B-45EE-B100-A50A2C79A432}.Release.Build.0 = Release|Win32 {FB096497-AD67-49E8-9C91-790B5C59B5F8}.Debug.ActiveCfg = Debug|Win32 {FB096497-AD67-49E8-9C91-790B5C59B5F8}.Debug.Build.0 = Debug|Win32 {FB096497-AD67-49E8-9C91-790B5C59B5F8}.Release.ActiveCfg = Release|Win32 {FB096497-AD67-49E8-9C91-790B5C59B5F8}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_pix_format.h0000644000175000017500000000620713233644505022521 0ustar varunvarun///////////////////////////////////////////////////////////////////////////// // // This set of templatized functions return a kiva::pix_format_e value based // on the agg pixel format template parameter. The function is called from // the graphics_context.format() method. // ///////////////////////////////////////////////////////////////////////////// #ifndef KIVA_PIX_FORMAT_H #define KIVA_PIX_FORMAT_H #include "agg_pixfmt_gray.h" #include "agg_pixfmt_rgb.h" #include "agg_pixfmt_rgba.h" #include "kiva_constants.h" namespace kiva { // Templatized conversion function to turn Agg pixel formats // into the right kiva pixfmt enumeration instance. // The default function returns "undefined", and the template // is specialized for each of the actual Agg pixel formats. template kiva::pix_format_e agg_pix_to_kiva(void *dummy=NULL) { return kiva::pix_format_undefined; } // Specializations follow. // The dummy pointer argument is needed because MSVC++ 6.0 doesn't properly // support specialization of template functions. When it generates code for // template functions, the mangled name of an instance of a function template // only includes the function parameter types (and not the template arguments). // The linker then discards the seemingly duplicate function definitions, // and all calls to agg_pix_to_kiva() end up in an arbitrary one of the // following specializations (usually the first). The obvious workaround is // to add optional function parameters corresponding to the template parameter. // // Furthermore, when calling these functions, MSVC will complain about // ambiguous overloading, so you have to create a dummy pointer and pass it // in. Normally, you would be able to do this: // // template void Foo() // { // do_something( agg_pix_to_kiva() ); // } // // But with MSVC, you have to do this: // // template void Foo() // { // agg_pix_fmt *dummy = NULL; // do_something( agg_pix_to_kiva(dummy) ); // } // // inline kiva::pix_format_e agg_pix_to_kiva(agg24::pixfmt_gray8 *msvc6_dummy = NULL) { return kiva::pix_format_gray8; } inline kiva::pix_format_e agg_pix_to_kiva(agg24::pixfmt_rgb24 *msvc6_dummy = NULL) { return kiva::pix_format_rgb24; } inline kiva::pix_format_e agg_pix_to_kiva(agg24::pixfmt_bgr24 *msvc6_dummy = NULL) { return kiva::pix_format_bgr24; } inline kiva::pix_format_e agg_pix_to_kiva(agg24::pixfmt_bgra32 *msvc6_dummy = NULL) { return kiva::pix_format_bgra32; } inline kiva::pix_format_e agg_pix_to_kiva(agg24::pixfmt_rgba32 *msvc6_dummy = NULL) { return kiva::pix_format_rgba32; } inline kiva::pix_format_e agg_pix_to_kiva(agg24::pixfmt_argb32 *msvc6_dummy = NULL) { return kiva::pix_format_argb32; } inline kiva::pix_format_e agg_pix_to_kiva(agg24::pixfmt_abgr32 *msvc6_dummy = NULL) { return kiva::pix_format_abgr32; } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/gtk1/0000755000175000017500000000000013544357627020042 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/agg/src/gtk1/agg_platform_specific.cpp0000644000175000017500000003036713233644505025053 0ustar varunvarun#include #include #include #include #include #include "gtk1/agg_platform_specific.h" #include "util/agg_color_conv_rgb8.h" #include "gtk1/agg_bmp.h" //#define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); #define DEBUG_MTH(NAME) typedef struct { short x1, x2, y1, y2; } Box, BOX, BoxRec, *BoxPtr; typedef struct { short x, y, width, height; }RECTANGLE, RectangleRec, *RectanglePtr; typedef struct _XRegion { long size; long numRects; BOX *rects; BOX extents; } REGION; namespace agg24 { x11_display::x11_display(): m_screen(0), m_depth(0), m_visual(0), m_dc(0), m_gc(0), m_sys_bpp(0) { DEBUG_MTH("x11_display::x11_display"); } x11_display::~x11_display() { DEBUG_MTH("x11_display::~x11_display"); close(); } bool x11_display::open(const char* display_name) { DEBUG_MTH("x11_display::open"); if (m_display != 0) { fprintf(stderr, "X11 display is opened already\n"); return false; } //printf("Opened X11 display: %s\n", display_name); m_display = XOpenDisplay(display_name); if (m_display == 0) { fprintf(stderr, "Unable to open DISPLAY=%s!\n",display_name); return false; } m_screen = DefaultScreen(m_display); m_depth = DefaultDepth(m_display, m_screen); m_visual = DefaultVisual(m_display, m_screen); switch(m_depth) { case 15: case 16: m_sys_bpp = 16; break; case 24: case 32: m_sys_bpp = 32; break; default: fprintf(stderr, "Unexpected X11 display depth=%d!\n",m_depth); } return true; } void x11_display::close() { DEBUG_MTH("x11_display::close"); if (m_display != 0) { if (m_gc != 0) XFreeGC(m_display, m_gc); XCloseDisplay(m_display); } m_display = 0; m_screen = 0; m_depth = 0; m_visual = 0; m_dc = 0; m_gc = 0; } bool x11_display::put_image(Window dc, XImage* image) { DEBUG_MTH("x11_display::put_image"); if (m_dc != dc) { if (m_gc) XFreeGC(m_display, m_gc); m_dc = dc; //m_gc = DefaultGC(m_display, m_screen); m_gc = XCreateGC(m_display, m_dc, 0, 0); } XPutImage(m_display, dc, m_gc, image, 0, 0, 0, 0, image->width, image->height ); return true; } XImage* x11_display::create_image(const rendering_buffer* rbuf) { DEBUG_MTH("x11_display::create_image"); unsigned width = rbuf->width(); unsigned height = rbuf->height(); return XCreateImage(m_display, m_visual, //CopyFromParent, m_depth, ZPixmap, 0, (char*)(rbuf->buf()), width, height, m_sys_bpp, width * (m_sys_bpp / 8)); } void x11_display::destroy_image(XImage* ximg) { DEBUG_MTH("x11_display::destroy_image"); if (ximg != 0) XDestroyImage(ximg); /* XDestroyImage function frees both the image structure and the data pointed to by the image structure. */ } //------------------------------------------------------------------------ platform_specific::platform_specific(pix_format_e format, bool flip_y) : m_format(format), m_flip_y(flip_y), m_bpp(0), m_sys_bpp(0), m_sys_format(pix_format_undefined), m_ximage(0) { DEBUG_MTH("platform_specific::platform_specific"); init(); } platform_specific::~platform_specific() { DEBUG_MTH("platform_specific::~platform_specific"); } x11_display platform_specific::x11; bool platform_specific::init() { DEBUG_MTH("platform_specific::init"); if (x11.m_display == 0 && !x11.open()) { fprintf(stderr, "No X11 display available!\n"); return false; } unsigned long r_mask = x11.m_visual->red_mask; unsigned long g_mask = x11.m_visual->green_mask; unsigned long b_mask = x11.m_visual->blue_mask; if(x11.m_depth < 15 || r_mask == 0 || g_mask == 0 || b_mask == 0) { fprintf(stderr, "There's no Visual compatible with minimal AGG requirements:\n" "At least 15-bit color depth and True- or DirectColor class.\n\n" ); return false; } switch(m_format) { case pix_format_gray8: m_bpp = 8; break; case pix_format_rgb565: case pix_format_rgb555: m_bpp = 16; break; case pix_format_rgb24: case pix_format_bgr24: m_bpp = 24; break; case pix_format_bgra32: case pix_format_abgr32: case pix_format_argb32: case pix_format_rgba32: m_bpp = 32; break; case pix_format_undefined: case end_of_pix_formats: ; } // // Calculate m_sys_format, m_byte_order, m_sys_bpp: // int t = 1; int hw_byte_order = LSBFirst; if(*(char*)&t == 0) hw_byte_order = MSBFirst; switch(x11.m_depth) { case 15: m_sys_bpp = 16; if(r_mask == 0x7C00 && g_mask == 0x3E0 && b_mask == 0x1F) { m_sys_format = pix_format_rgb555; m_byte_order = hw_byte_order; } break; case 16: m_sys_bpp = 16; if(r_mask == 0xF800 && g_mask == 0x7E0 && b_mask == 0x1F) { m_sys_format = pix_format_rgb565; m_byte_order = hw_byte_order; } break; case 24: case 32: m_sys_bpp = 32; if(g_mask == 0xFF00) { if(r_mask == 0xFF && b_mask == 0xFF0000) { switch(m_format) { case pix_format_rgba32: m_sys_format = pix_format_rgba32; m_byte_order = LSBFirst; break; case pix_format_abgr32: m_sys_format = pix_format_abgr32; m_byte_order = MSBFirst; break; default: m_byte_order = hw_byte_order; m_sys_format = (hw_byte_order == LSBFirst) ? pix_format_rgba32 : pix_format_abgr32; break; } } if(r_mask == 0xFF0000 && b_mask == 0xFF) { switch(m_format) { case pix_format_argb32: m_sys_format = pix_format_argb32; m_byte_order = MSBFirst; break; case pix_format_bgra32: m_sys_format = pix_format_bgra32; m_byte_order = LSBFirst; break; default: m_byte_order = hw_byte_order; m_sys_format = (hw_byte_order == MSBFirst) ? pix_format_argb32 : pix_format_bgra32; break; } } } break; } if(m_sys_format == pix_format_undefined) { fprintf(stderr, "RGB masks are not compatible with AGG pixel formats:\n" "R=%08x, G=%08x, B=%08x\n", r_mask, g_mask, b_mask); return false; } return true; } #define UNHANDLED_PIX_FORMATS \ case end_of_pix_formats: ; \ case pix_format_gray8: ; \ case pix_format_undefined: ; void platform_specific::destroy() { DEBUG_MTH("platform_specific::destroy"); if (m_ximage != 0) { x11.destroy_image(m_ximage); m_ximage = 0; } } void platform_specific::display_pmap(Window dc, const rendering_buffer* rbuf) { DEBUG_MTH("platform_specific::display_map"); if (m_format == m_sys_format) { if (m_ximage == 0) { m_ximage = x11.create_image(rbuf); m_ximage->byte_order = m_byte_order; } x11.put_image(dc, m_ximage); return; } // Optimization hint: make pmap_tmp as a private class member and reused it when possible. pixel_map pmap_tmp(rbuf->width(), rbuf->height(), m_sys_format, 256, m_flip_y); rendering_buffer* rbuf2 = &pmap_tmp.rbuf(); switch(m_sys_format) { case pix_format_rgb555: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_rgb555()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_rgb555()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_rgb555()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_rgb555()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_rgb555()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_rgb555()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_rgb555()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_rgb555()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_rgb565: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_rgb565()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_rgb565()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_rgb565()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_rgb565()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_rgb565()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_rgb565()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_rgb565()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_rgb565()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_rgba32: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_rgba32()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_rgba32()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_rgba32()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_rgba32()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_rgba32()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_rgba32()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_rgba32()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_rgba32()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_abgr32: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_abgr32()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_abgr32()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_abgr32()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_abgr32()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_abgr32()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_abgr32()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_abgr32()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_abgr32()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_argb32: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_argb32()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_argb32()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_argb32()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_argb32()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_argb32()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_argb32()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_argb32()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_argb32()); break; UNHANDLED_PIX_FORMATS; } break; case pix_format_bgra32: switch(m_format) { case pix_format_rgb555: color_conv(rbuf2, rbuf, color_conv_rgb555_to_bgra32()); break; case pix_format_rgb565: color_conv(rbuf2, rbuf, color_conv_rgb565_to_bgra32()); break; case pix_format_rgb24: color_conv(rbuf2, rbuf, color_conv_rgb24_to_bgra32()); break; case pix_format_bgr24: color_conv(rbuf2, rbuf, color_conv_bgr24_to_bgra32()); break; case pix_format_rgba32: color_conv(rbuf2, rbuf, color_conv_rgba32_to_bgra32()); break; case pix_format_argb32: color_conv(rbuf2, rbuf, color_conv_argb32_to_bgra32()); break; case pix_format_abgr32: color_conv(rbuf2, rbuf, color_conv_abgr32_to_bgra32()); break; case pix_format_bgra32: color_conv(rbuf2, rbuf, color_conv_bgra32_to_bgra32()); break; UNHANDLED_PIX_FORMATS; } break; UNHANDLED_PIX_FORMATS; } pmap_tmp.draw(dc); } unsigned platform_specific::calc_row_len(unsigned width, unsigned bits_per_pixel) { return width * (bits_per_pixel / 8); } } enthought-chaco2-4.8.1.orig/kiva/agg/src/gtk1/plat_support.i0000644000175000017500000000625013233644505022740 0ustar varunvarun// -*- c++ -*- %module plat_support %include numeric.i %{ #include "gtk1/agg_bmp.h" namespace agg24 { PyObject* pixel_map_as_unowned_array(agg24::pixel_map& pix_map) { npy_intp dims[3]; npy_intp rows = pix_map.height(); npy_intp cols = pix_map.width(); npy_intp depth = pix_map.bpp() / 8; dims[0] = rows; dims[1] = cols; dims[2] = depth; return PyArray_SimpleNewFromData(3,dims,NPY_UINT8,(void*)pix_map.buf()); } } %} %typemap(in)(Window) { $1 = (Window) PyInt_AsLong($input); } // More permissive unsigned typemap that converts any numeric type to an // unsigned value. It is cleared at the end of this file. %typemap(in) unsigned { PyObject* obj = PyNumber_Int($input); if (PyErr_Occurred()) SWIG_fail; $1 = (unsigned) PyLong_AsLong(obj); if (PyErr_Occurred()) SWIG_fail; } namespace agg24 { enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_gray8, // Simple 256 level grayscale pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_bgr24, // B-G-R, native win32 BMP format. pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_argb32, // A-R-G-B, native MAC format pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_bgra32, // B-G-R-A, native win32 BMP format end_of_pix_formats }; %name(PixelMap) class pixel_map { public: ~pixel_map(); pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up); public: // Should really fix this using a typecheck typemap. Read the // "typemaps and overloading" section of the SWIG docs. %feature("shadow") draw(Window h_dc, int x, int y, double scale) const %{ def draw(self, h_dc, x=0, y=0, scale=1.0): # fix me: brittle becuase we are hard coding # module and class name. Done cause SWIG 1.3.24 does # some funky overloading stuff in it that breaks keyword # arguments. result = _plat_support.PixelMap_draw(self, h_dc, x, y, scale) return result %} void draw(Window h_dc, int x, int y, double scale) const; PyObject* convert_to_rgbarray() const; %pythoncode %{ def set_bmp_array(self): self.bmp_array = pixel_map_as_unowned_array(self) return self def draw_to_tkwindow(self, window, x, y): window_id = window._tk_widget.winfo_id() self.draw(window_id, x, y) return def draw_to_wxwindow(self, window, x, y): window_id = window.GetHandle() self.draw(window_id, x, y) return %} }; } PyObject* pixel_map_as_unowned_array(agg24::pixel_map& pix_map); // clear the "permissive" unsigned typemap we are using. %typemap(in) unsigned; enthought-chaco2-4.8.1.orig/kiva/agg/src/gtk1/agg_platform_specific.h0000644000175000017500000000446413233644505024517 0ustar varunvarun// -*- c++ -*- #ifndef AGG_GTK1_SPECIFIC_INCLUDED #define AGG_GTK1_SPECIFIC_INCLUDED #include #include "agg_basics.h" #include "agg_rendering_buffer.h" namespace agg24 { enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_gray8, // Simple 256 level grayscale pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_bgr24, // B-G-R, native win32 BMP format. pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_argb32, // A-R-G-B, native MAC format pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_bgra32, // B-G-R-A, native win32 BMP format end_of_pix_formats }; class x11_display { public: x11_display(); ~x11_display(); bool open(const char* display_name = NULL); void close(); bool put_image(Window dc, XImage* image); XImage* create_image(const rendering_buffer* rbuf); void destroy_image(XImage* ximg); public: Display* m_display; int m_screen; int m_depth; Visual* m_visual; Window m_dc; GC m_gc; unsigned m_sys_bpp; }; //------------------------------------------------------------------------ class platform_specific { static x11_display x11; public: platform_specific(pix_format_e format, bool flip_y); ~platform_specific(); void display_pmap(Window dc, const rendering_buffer* src); void destroy(); static unsigned calc_row_len(unsigned width, unsigned bits_per_pixel); private: bool init(); public: unsigned m_bpp; // init() bool m_flip_y; // platform_specific() XImage* m_ximage; // display_pmap() pix_format_e m_format; // platform_specific() private: int m_byte_order; // init() unsigned m_sys_bpp; // init() pix_format_e m_sys_format; // init() }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/gtk1/agg_bmp.cpp0000644000175000017500000000756613233644505022145 0ustar varunvarun #include #include #include #include "gtk1/agg_bmp.h" #include "gtk1/agg_platform_specific.h" //#include #include "agg_pixfmt_rgba.h" #include "agg_color_rgba.h" #ifdef NUMPY #include "numpy/arrayobject.h" # ifndef PyArray_SBYTE # include "numpy/noprefix.h" # include "numpy/oldnumeric.h" # include "numpy/old_defines.h" # endif #else #include "Numeric/arrayobject.h" #define PyArray_UBYTELTR 'b' #endif #if 0 #define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); #define DEBUG_MTH2(STR,ARG1,ARG2) fprintf(stderr, STR "\n",(ARG1),(ARG2)); #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) fprintf(stderr, STR "\n",(ARG1),(ARG2),(ARG3),(ARG4),(ARG5)); #else #define DEBUG_MTH(NAME) #define DEBUG_MTH2(STR,ARG1,ARG2) #define DEBUG_MTH5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) #endif namespace agg24 { //------------------------------------------------------------------------ pixel_map::pixel_map(unsigned width, unsigned height, pix_format_e format, unsigned clear_val, bool bottom_up): m_bmp(0), m_buf(0), m_specific(new platform_specific(format, bottom_up)) { DEBUG_MTH5("pixel_map::pixel_map(%d,%d,%d,%d,%d)",width,height,format,clear_val,bottom_up); m_bpp = m_specific->m_bpp; create(width, height, clear_val); } //------------------------------------------------------------------------ pixel_map::~pixel_map() { DEBUG_MTH("pixel_map::~pixel_map"); destroy(); delete m_specific; } //------------------------------------------------------------------------ void pixel_map::destroy() { if (m_specific->m_ximage != 0) { m_specific->destroy(); } else if(m_bmp) { delete [] (unsigned char*)m_bmp; } m_bmp = 0; m_buf = 0; } //------------------------------------------------------------------------ void pixel_map::create(unsigned width, unsigned height, unsigned clear_val) { destroy(); if(width == 0) width = 1; if(height == 0) height = 1; unsigned row_len = platform_specific::calc_row_len(width, m_bpp); unsigned img_size = row_len * height; m_bmp = (Pixmap*) new unsigned char[img_size]; m_buf = (unsigned char*)m_bmp; if(clear_val <= 255) { memset(m_buf, clear_val, img_size); } m_rbuf_window.attach(m_buf, width, height, (m_specific->m_flip_y ? -row_len : row_len)); } //------------------------------------------------------------------------ void pixel_map::draw(Window dc, int x, int y, double scale) const { DEBUG_MTH("pixel_map::draw"); if(m_bmp == 0 || m_buf == 0) return; m_specific->display_pmap(dc, &m_rbuf_window); } pix_format_e pixel_map::get_pix_format() const { return m_specific->m_format; } unsigned char* pixel_map::buf() { return m_buf; } unsigned pixel_map::width() const { return m_rbuf_window.width(); } unsigned pixel_map::height() const { return m_rbuf_window.height(); } unsigned pixel_map::stride() const { return platform_specific::calc_row_len(width(),m_bpp); } PyObject* pixel_map::convert_to_rgbarray() const { unsigned w = width(); unsigned h = height(); pix_format_e format = get_pix_format(); rgba8 c; unsigned i,j; npy_intp dims[3]; PyObject* arr = NULL; char* data = NULL; dims[0] = w; dims[1] = h; dims[2] = 3; import_array(); arr = PyArray_SimpleNew(3, dims, PyArray_BYTE); if (arr==NULL) return NULL; data = ((PyArrayObject *)arr)->data; switch (format) { case pix_format_bgra32: { pixfmt_bgra32 r((rendering_buffer&)m_rbuf_window); for (j=0;j m_bmp unsigned m_bpp; // calculated from format rendering_buffer m_rbuf_window; public: platform_specific* m_specific; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/affine_matrix.i0000644000175000017500000001537713233644505022164 0ustar varunvarun/* -*- c -*- */ /* AffineMatrix class wrapper 1. C++ class 'trans_affine' is renamed to python '_AffineMatrix' 2. All methods accept 'transform' and 'inverse_transform' are wrapped. 3. __repr__ and __str__ methods are added to print out an _AffineMatrix object as: "AffineMatrix(a,b,c,d,tx,ty)" 4. A subclass called 'AffineMatrix' is derived from '_AffineMatrix' using a %pythoncode directive. This is so that __init__ can be overloadeded to convert a sequence into the appropriate argument convention for the _AffineMatrix constructor. 5. Classes such as trans_affine_rotation were converted to factory functions so that they return an trans_affine class instead of having a new class type (such as RotationMatrix). Notes: !! 1. !! (4) is a hack to get around the fact that I couldn't !! figure out how to get the overloaded constructor for trans_affine !! to accept a Numeric array as input -- even if I added a function !! new_AffineMatrix(double ary[6]); and then put the !! trans_affine(double ary[6]) signature in the class interface. It !! appears that SWIG is a little overzealous in its type checking !! in the constructor call, only allowing double* pointers through !! instead of allowing any sequence through. This is the correct !! default behavior, but I couldn't figure out how to overload it with !! my own test. !! !! 2. !! The C++ operator *= is definitely broken -- probably not setting the !! thisown property correctly on returned pointers. It is currently !! set to return void so that it can't cause any mischief, but it also !! breaks its functionality. !! FIX: I have just created this function in Python and call the !! C++ multiply() method. */ %include "numeric.i" %include "sequence_to_array.i" %{ #ifdef NUMPY #include "numpy/arrayobject.h" #else #include "Numeric/arrayobject.h" #endif #include "agg_trans_affine.h" // These factories mimic the functionality of like-named classes in agg. // Making them functions that return trans_affine types leads to a cleaner // and easier to maintain Python interface. agg24::trans_affine* trans_affine_rotation(double a) { return new agg24::trans_affine(cos(a), sin(a), -sin(a), cos(a), 0.0, 0.0); } agg24::trans_affine* trans_affine_scaling(double sx, double sy) { return new agg24::trans_affine(sx, 0.0, 0.0, sy, 0.0, 0.0); } agg24::trans_affine* trans_affine_translation(double tx, double ty) { return new agg24::trans_affine(1.0, 0.0, 0.0, 1.0, tx, ty); } agg24::trans_affine* trans_affine_skewing(double sx, double sy) { return new agg24::trans_affine(1.0, tan(sy), tan(sx), 1.0, 0.0, 0.0); } %} %newobject trans_affine_rotation; %rename(rotation_matrix) trans_affine_rotation(double); agg24::trans_affine* trans_affine_rotation(double a); %newobject trans_affine_scaling; %rename(scaling_matrix) trans_affine_scaling(double, double); agg24::trans_affine* trans_affine_scaling(double sx, double sy); %newobject trans_affine_translation; %rename(translation_matrix) trans_affine_translation(double, double); agg24::trans_affine* trans_affine_translation(double tx, double ty); %newobject trans_affine_skewing; %rename(skewing_matrix) trans_affine_skewing(double, double); agg24::trans_affine* trans_affine_skewing(double sx, double sy); %include "agg_typemaps.i" %apply (double* array6) {(double* out)}; // used by __getitem__ %typemap(check) (int affine_index) { if ($1 < 0 || $1 > 5) { PyErr_Format(PyExc_IndexError, "affine matrices are indexed 0 to 5. Received %d", $1); return NULL; } } %apply owned_pointer { agg24::trans_affine* }; namespace agg24 { %rename(_AffineMatrix) trans_affine; %rename(asarray) trans_affine::store_to(double*) const; class trans_affine { public: trans_affine(); trans_affine(const trans_affine& m); trans_affine(double v0, double v1, double v2, double v3, double v4, double v5); trans_affine operator ~ () const; // I added this to trans_affine -- it really isn't there. // trans_affine operator *(const trans_affine& m); // Returning trans_affine& causes problems, so these are all // changed to void. //const trans_affine& operator *= (const trans_affine& m); //const trans_affine& reset(); // const trans_affine& multiply(const trans_affine& m); // const trans_affine& invert(); // const trans_affine& flip_x(); // const trans_affine& flip_y(); //void operator *= (const trans_affine& m); void reset(); void multiply(const trans_affine& m); void invert(); void flip_x(); void flip_y(); double scale() const; double determinant() const; void store_to(double* out) const; //const trans_affine& load_from(double ary[6]); void load_from(double ary[6]); // !! omitted //void transform(double* x, double* y) const; //void inverse_transform(double* x, double* y) const; }; }; %pythoncode %{ def is_sequence(arg): try: len(arg) return 1 except: return 0 # AffineMatrix sub-class to get around problems with adding # a AffineMatrix constructor that accepts a Numeric array # as input. class AffineMatrix(_AffineMatrix): def __init__(self,*args): if len(args) == 1 and is_sequence(args[0]): args = tuple(args[0]) if len(args) != 6: raise ValueError("array argument must be 1x6") _AffineMatrix.__init__(self,*args) def __imul__(self,other): """ inplace multiply We don't use the C++ version of this because it ends up deleting the object out from under itself. """ self.multiply(other) return self %} %extend agg24::trans_affine { char *__repr__() { // Write out elements of trans_affine in a,b,c,d,tx,ty order // !! We should work to make output formatting conform to // !! whatever it Numeric does (which needs to be cleaned up also). static char tmp[1024]; double m[6]; self->store_to(m); sprintf(tmp,"AffineMatrix(%g,%g,%g,%g,%g,%g)", m[0], m[1], m[2], m[3], m[4], m[5]); return tmp; } double __getitem__(int affine_index) { double ary[6]; self->store_to(ary); return ary[affine_index]; } int __eq__(agg24::trans_affine& other) { double ary1[6], ary2[6]; self->store_to(ary1); other.store_to(ary2); int eq = 1; for (int i = 0; i < 6; i++) eq &= (ary1[i] == ary2[i]); return eq; } } enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_font_type.h0000644000175000017500000000267713233644505022367 0ustar varunvarun#ifndef FONT_TYPE_H #define FONT_TYPE_H #include #ifdef _MSC_VER // Turn off MSDEV warning about truncated long identifiers #pragma warning(disable:4786) #endif namespace kiva { class font_type { public: std::string name; std::string filename; int size; int family; int style; int encoding; // Constructors // Creates a font object. By default, searches the hardcoded // font paths for a file named like the face name; to override // this, set validate=false. font_type(std::string _name="Arial", int _size=12, int _family=0, int _style=0, int _encoding=0, bool validate=true); font_type(const font_type &font); font_type &operator=(const font_type& font); int change_filename(std::string _filename); // Is the font loaded properly? inline bool is_loaded() const { return _is_loaded; } private: bool _is_loaded; }; inline bool operator==(font_type &a, font_type &b) { return (a.size == b.size) && (a.name == b.name) && (a.style == b.style) && (a.encoding == b.encoding) && (a.family == b.family); } } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/graphics_context.i0000644000175000017500000012040613477706655022721 0ustar varunvarun//--------------------------------------------------------------------------- // // Wrapper for graphics_context_base->GraphicsContextArray // A derived class called GraphicsContextArray is in the %pythoncode and // overrides a large number of functions to handle type conversions in // python instead of having to write them in C/C++. // // Todo: // *. Fix dash_type constructor overload for accepting a pattern // !! Should we reverse the order of _pattern and phase and // !! default the phase to be 0?? (I think so...) // *. use properties to replace set/get methods. //--------------------------------------------------------------------------- // typemaps for many enumerated types used in graphics_contexts %include "constants.i" // Language independent exception handler %include exception.i // handle kiva::rect declarations %include "rect.i" //%apply kiva::rect_type {kiva::rect_type}; %include "agg_typemaps.i" %apply (double* point_array, int point_count) {(double* pts, int Npts)}; %apply (double* point_array, int point_count) {(double* start, int Nstart)}; %apply (double* point_array, int point_count) {(double* end, int Nend)}; %apply (double* rect_array, int rect_count) {(double* rects, int Nrects)}; %apply (double* pt_x, double* pt_y) {(double* tx, double* ty)}; %apply (double* array6) {(double* out)}; %apply (double* dash_pattern, int n) { (double* pattern, int n)}; %apply (unsigned char *image_data, int width, int height, int stride) { (unsigned char *data, int width, int height, int stride) }; %apply (owned_pointer) { kiva::graphics_context* }; %apply (const char* gradient_arg) {(const char* spread_method)}; %apply (const char* gradient_arg) {(const char* units)}; // map string input into standard string and back %include "agg_std_string.i" // typemaps for double ary[] %include "sequence_to_array.i" %include "rgba_array.i" %apply rgba_as_array {agg24::rgba&}; %{ agg24::rgba _clear_color = agg24::rgba(1,1,1,1); %} %include "numeric_ext.i" %typemap(out) PyObject* { $result = $1; } %{ #include "kiva_graphics_context.h" #include "kiva_gradient.h" #ifdef ALWAYS_32BIT_WORKAROUND bool ALWAYS_32BIT_WORKAROUND_FLAG = true; #else bool ALWAYS_32BIT_WORKAROUND_FLAG = false; #endif // hack to get around SWIGs typechecking for overloaded constructors kiva::graphics_context_base* graphics_context_from_array( unsigned char *data, int width, int height, int stride, kiva::pix_format_e format, kiva::interpolation_e interpolation=kiva::nearest, int bottom_up = 1) { if (bottom_up) { stride *= -1; } switch (format) { case kiva::pix_format_rgb24: { return (kiva::graphics_context_base*) new kiva::graphics_context_rgb24(data,width,height,stride,interpolation); } case kiva::pix_format_bgr24: { return (kiva::graphics_context_base*) new kiva::graphics_context_bgr24(data,width,height,stride,interpolation); } case kiva::pix_format_rgba32: { return (kiva::graphics_context_base*) new kiva::graphics_context_rgba32(data,width,height,stride,interpolation); } case kiva::pix_format_bgra32: { return (kiva::graphics_context_base*) new kiva::graphics_context_bgra32(data,width,height,stride,interpolation); } case kiva::pix_format_argb32: { return (kiva::graphics_context_base*) new kiva::graphics_context_argb32(data,width,height,stride,interpolation); } case kiva::pix_format_abgr32: { return (kiva::graphics_context_base*) new kiva::graphics_context_abgr32(data,width,height,stride,interpolation); } case kiva::pix_format_gray8: { //return (kiva::graphics_context_base*) // new kiva::graphics_context_gray8(data,width,height,stride,interpolation); return (kiva::graphics_context_base*) NULL; } case kiva::pix_format_rgb555: case kiva::pix_format_rgb565: case kiva::end_of_pix_formats: default: { // format not valid. return (kiva::graphics_context_base*) NULL; } } } int destroy_graphics_context(kiva::graphics_context_base* gc) { switch (gc->format()) { case kiva::pix_format_rgb24: { delete (kiva::graphics_context_rgb24*) gc; break; } case kiva::pix_format_bgr24: { delete (kiva::graphics_context_bgr24*) gc; break; } case kiva::pix_format_rgba32: { delete (kiva::graphics_context_rgba32*) gc; break; } case kiva::pix_format_argb32: { delete (kiva::graphics_context_argb32*) gc; break; } case kiva::pix_format_abgr32: { delete (kiva::graphics_context_abgr32*) gc; break; } case kiva::pix_format_bgra32: { delete (kiva::graphics_context_bgra32*) gc; break; } case kiva::pix_format_gray8: { // we don't handle this format at the moment. return 1; //delete (kiva::graphics_context_gray8*) gc; //break; } case kiva::pix_format_rgb555: case kiva::pix_format_rgb565: case kiva::end_of_pix_formats: default: { // format not valid. return 1; } } return 0; } void graphics_context_multiply_alpha(double alpha, unsigned char *data, int width, int height, int stride) { for (int i=3;i stops, const char* spread_method, const char* units="userSpaceOnUse"); void radial_gradient(double cx, double cy, double r, double fx, double fy, std::vector stops, const char* spread_method, const char* units="userSpaceOnUse"); }; } %pythoncode %{ pil_format_map = {} pil_format_map["RGB"] = "rgb24" pil_format_map["RGBA"] = "rgba32" pil_depth_map = {} pil_depth_map["RGB"] = 3 pil_depth_map["RGBA"] = 4 class Image(GraphicsContextArray): """ Image is a GraphicsContextArray sub-class created from an image file. """ def __init__(self, file, interpolation="nearest", bottom_up=1): """ Create an Image object (GraphicsContextArray) from a file. Parameters ---------- file can be either a file name or an open file object interpolation specifies the type of filter used when putting the image into another GraphicsContextArray """ # read the file using PIL from PIL import Image as PilImage from kiva.compat import piltostring pil_img = PilImage.open(file) # Convert image to a numeric array if (pil_img.mode not in ["RGB","RGBA"] or (cvar.ALWAYS_32BIT_WORKAROUND_FLAG and pil_img.mode != "RGBA")): pil_img = pil_img.convert(mode="RGBA") depth = pil_depth_map[pil_img.mode] img = frombuffer(piltostring(pil_img),uint8) img = resize(img, (pil_img.size[1],pil_img.size[0],depth)) format = pil_format_map[pil_img.mode] GraphicsContextArray.__init__(self, img, pix_format=format, interpolation=interpolation, bottom_up = bottom_up) def convert_pixel_format(self,pix_format,inplace=0): "Convert gc from one pixel format to another." # We override the one in the base GraphicsContextArray because that # one calls our __init__, which is not really the behavior we want. # # This problem can be avoided altogether down the road when the # Image subclass is turned into a factory function. new_img = GraphicsContextArray((self.width(),self.height()), pix_format=pix_format, interpolation=self.get_image_interpolation(), bottom_up = self.bottom_up()) new_img.draw_image(self) if inplace: old_this = self.this self.this = new_img.this new_img.this = old_this self.bmp_array = new_img.bmp_array return self else: return new_img %} %{ #include "gl_graphics_context.h" %} namespace kiva { %rename(GraphicsContextGL) gl_graphics_context; class gl_graphics_context : public graphics_context_base { public: gl_graphics_context(int width, int height, kiva::pix_format_e format=kiva::pix_format_rgb24); ~gl_graphics_context(); //--------------------------------------------------------------- // GL-specific methods //--------------------------------------------------------------- void gl_init(); void gl_cleanup(); void begin_page(); void gl_render_path(kiva::compiled_path *path, bool polygon=false, bool fill=false); void gl_render_points(double** points, bool polygon, bool fill, kiva::draw_mode_e mode = FILL); //--------------------------------------------------------------- // GraphicsContextBase interface //--------------------------------------------------------------- kiva::pix_format_e format(); void save_state(); void restore_state(); //--------------------------------------------------------------- // Clipping path manipulation //--------------------------------------------------------------- void clip(); void even_odd_clip(); void clip_to_rect(double x, double y, double sx, double sy); void clip_to_rect(kiva::rect_type &rect); void clip_to_rects(double* new_rects, int Nrects); void clip_to_rects(kiva::rect_list_type &rects); kiva::rect_type transform_clip_rectangle(const kiva::rect_type &rect); void clear_clip_path(); int get_num_clip_regions(); kiva::rect_type get_clip_region(unsigned int i); //--------------------------------------------------------------- // Painting paths (drawing and filling contours) //--------------------------------------------------------------- // Declare clear() to pass by reference so that the typemap applies, // even though it is pass by value in the actual C++ class void clear(agg24::rgba& value=_clear_color); void fill_path(); void eof_fill_path(); void stroke_path(); // empty function; for some reason this is abstract in the base class inline void _stroke_path() { } void draw_path(draw_mode_e mode=FILL_STROKE); void draw_rect(double rect[4], draw_mode_e mode=FILL_STROKE); %feature("shadow") draw_marker_at_points(double* pts,int Npts, int size, agg24::marker_e type = agg24::marker_square) %{ def draw_marker_at_points(self,pts,size,kiva_marker_type): marker = kiva_marker_to_agg.get(kiva_marker_type, None) if marker is None: success = 0 else: args = (self,pts,int(size),marker) success = _agg.GraphicsContextGL_draw_marker_at_points(self, pts, int(size), marker) return success %} int draw_marker_at_points(double* pts,int Npts,int size, agg24::marker_e type=agg24::marker_square); void draw_path_at_points(double* pts,int Npts, kiva::compiled_path& marker, draw_mode_e mode); bool show_text(char *text); void draw_glyphs(kiva::graphics_context_base* img, double tx, double ty); int draw_image(kiva::graphics_context_base* img, double rect[4], bool force_copy=false); int draw_image(kiva::graphics_context_base* img); }; } enthought-chaco2-4.8.1.orig/kiva/agg/src/dummy.cpp0000644000175000017500000003560013233644505021024 0ustar varunvarun#include "agg_trans_affine.h" #include "kiva_graphics_context.h" #include "kiva_compiled_path.h" #include "kiva_font_type.h" #include "kiva_rect.h" #include // ripped from Agg bool write_ppm(const unsigned char* buf, unsigned width, unsigned height, const char* file_name) { FILE* fd = fopen(file_name, "wb"); if(fd) { fprintf(fd, "P6 %d %d 255 ", width, height); fwrite(buf, 1, width * height * 3, fd); fclose(fd); return true; } return false; } agg24::rgba black(0.0, 0.0, 0.0); agg24::rgba white(1.0, 1.0, 1.0); agg24::rgba lightgray(0.2, 0.2, 0.2); agg24::rgba red(1.0, 0.0, 0.0); agg24::rgba green(0.0, 1.0, 0.0); agg24::rgba blue(0.0, 0.0, 1.0); agg24::rgba niceblue(0.411, 0.584, 0.843); typedef agg24::pixfmt_rgb24 AGG_PIX_TYPE; typedef kiva::graphics_context GC_TYPE; typedef std::vector rect_list_type; void draw_sub_image(GC_TYPE &gc_img, unsigned int width, unsigned int height) { gc_img.clear(white); gc_img.set_alpha(0.4); gc_img.set_fill_color(green); gc_img.rect(0, 0, width, height); gc_img.fill_path(); gc_img.set_alpha(1.0); gc_img.set_stroke_color(red); gc_img.move_to(0.0,0.0); gc_img.line_to(width,height); gc_img.stroke_path(); gc_img.set_stroke_color(blue); gc_img.move_to(0.0, height); gc_img.line_to(width, 0.0); gc_img.stroke_path(); //show_clip_rects(gc_img); } void test_arc_to2(GC_TYPE &gc, double x2, double y2, double radiusstep=25.0) { gc.set_stroke_color(lightgray); //gc.move_to(100, 0); //gc.line_to(0, 0); gc.move_to(0, 0); gc.line_to(100, 0); gc.line_to(x2, y2); gc.stroke_path(); gc.set_stroke_color(black); int numradii = 7; for (int i=0; ix << " " << it->y << " " << it->w << " " << it->h << std::endl; // } //gc.clip_to_rects(mclip_rects); //kiva::test_disjoint_union(); //draw_sub_image(gc, 200, 200); double color_delta = 0.0; for (kiva::rect_iterator it=actual_rects.begin(); it != actual_rects.end(); it++) { agg24::rgba tmpcolor(0.0, 0.4+color_delta, 0.0); gc.set_fill_color(tmpcolor); gc.rect(*it); gc.fill_path(); color_delta += 0.5/actual_rects.size(); } gc.set_alpha(1.0); gc.set_stroke_color(black); gc.set_line_width(1); //gc.clear_clip_path(); gc.rects(mclip_rects); gc.rect(0, 0, 200, 200); gc.stroke_path(); gc.restore_state(); } void test_disjoint_intersect(GC_TYPE &gc) { kiva::rect_list_type output_rects; kiva::rect_list_type input_rects; //kiva::rect_type rect1(atof(argv[0]),atof(argv[1]),atof(argv[2]),atof(argv[3])); //kiva::rect_type rect2(atof(argv[4]),atof(argv[5]),atof(argv[6]),atof(argv[7])); input_rects.push_back(kiva::rect_type(20.5,20.5,60,50)); //input_rects.push_back(kiva::rect_type(40.5,40.5,60,10)); input_rects.push_back(kiva::rect_type(60.5,80.5,35,60)); // input_rects.push_back(kiva::rect_type(40.5,60.5,60,60)); kiva::rect_type new_rect(40.5,60.5,60,60); output_rects = kiva::disjoint_intersect(input_rects, new_rect); gc.save_state(); gc.set_alpha(1.0); gc.set_stroke_color(blue); gc.rects(input_rects); gc.rect(new_rect); gc.stroke_path(); gc.set_alpha(0.4); gc.set_fill_color(red); gc.rects(output_rects); gc.fill_path(); gc.restore_state(); } void test_compiled_path(GC_TYPE &gc) { // Compiled path test kiva::compiled_path mypath; mypath.begin_path(); mypath.move_to(0.0, 0.0); mypath.line_to(20.0, 0.0); mypath.line_to(20.0,20.0); mypath.line_to(0.0, 20.0); mypath.line_to(0.0, 10.0); mypath.close_path(); agg24::rgba tmpcolor(0.0, 0.0, 1.0); gc.set_stroke_color(tmpcolor); gc.add_path(mypath); gc.stroke_path(); double points[] = {25, 25, 75, 25, 25, 75, 75, 75, 50, 50}; gc.draw_path_at_points(points, 5, mypath, kiva::STROKE); } void test_handling_text(GC_TYPE &gc) { char unicodeString[] = {230, 234, 223, 220, 0}; // Text handling test. Make sure timesi.ttf is in the current directory! kiva::font_type timesFont("times", 12, "regular"); kiva::font_type copperFont("coprgtl", 12, "regular"); kiva::font_type curlzFont("arial", 12, "regular"); //kiva::font_type unicodeFont("uni_font", 12, "regular"); gc.set_alpha(1.0); gc.set_text_drawing_mode(kiva::TEXT_FILL); gc.set_font(timesFont); //gc.set_font(unicodeFont); gc.translate_ctm(100.0, 100.0); gc.move_to(-5,0); gc.line_to(5,0); gc.move_to(0,5); gc.line_to(0,-5); gc.move_to(0,0); gc.stroke_path(); //agg24::trans_affine_translation txtTrans(200.0,150.0); agg24::trans_affine_rotation txtRot(agg24::deg2rad(30)); //txtTrans.premultiply(txtRot); //txtTrans *= txtRot; gc.set_text_matrix(txtRot); //gc.set_text_position(150.5, 350.5); //kiva::rect_type bbox(gc.get_text_extent("Hello")); //gc.get_text_matrix().transform(&bbox.x, &bbox.y); gc.show_text("Hello"); gc.show_text("foobar"); gc.show_text(unicodeString); //txtRot.invert(); //gc.set_text_matrix(txtRot); //gc.show_text("inverted"); // gc.rect(bbox); // gc.stroke_path(); /* gc.set_font(copperFont); gc.set_text_position(150.5, 250.5); kiva::rect_type bbox2(gc.get_text_extent("Hello")); gc.get_text_matrix().transform(&bbox2.x, &bbox2.y); gc.show_text("Hello"); // gc.rect(bbox2); // gc.stroke_path(); gc.set_font(curlzFont); gc.set_text_position(150.5, 150.5); kiva::rect_type bbox3(gc.get_text_extent("Hello")); gc.get_text_matrix().transform(&bbox3.x, &bbox3.y); gc.show_text("Hello"); // gc.rect(bbox3); // gc.stroke_path(); */ //gc.set_stroke_color(red); //gc.show_text("blah"); //gc.set_text_position(200.0, 100.0); //gc.show_text("Hello"); //gc.show_text_translate("Hello", 10.0, 360.0); //gc.set_font_size(36); //gc.show_text_translate("Hello", 10.0, 190.0); } void gc_stress_test() { int width = 100; int height = 100; int pixelsize = 3; unsigned char *buf = new unsigned char[width * height * pixelsize]; bool tmp = true; for (int i=0; i<100000; i++) { if (i%1000 == 0) { printf("%d\n", i); } GC_TYPE gc(buf, width, height, -width*pixelsize); kiva::font_type f("arial"); gc.set_font(f); // tmp = gc.show_text("hello"); if (f.filename == "") { int q = 5; } } delete[] buf; } void brandon_draw_test(GC_TYPE &gc) { gc.set_stroke_color(red); gc.set_line_width(1.0); gc.begin_path(); gc.move_to(30.0, 10.0); gc.line_to(20.0, 10.0); gc.line_to(20.0, 90.0); gc.line_to(10.0, 10.0); gc.close_path(); gc.stroke_path(); } int main(int argc, char **argv) { unsigned int width = 640; unsigned int height = 480; unsigned char pixelsize = 0; AGG_PIX_TYPE *msvc6_dummy = NULL; switch (kiva::agg_pix_to_kiva(msvc6_dummy)) { case (kiva::pix_format_gray8) : pixelsize = 1; break; case (kiva::pix_format_rgb24) : case (kiva::pix_format_bgr24) : pixelsize = 3; break; case (kiva::pix_format_bgra32): case (kiva::pix_format_rgba32): case (kiva::pix_format_argb32): case (kiva::pix_format_abgr32): pixelsize = 4; break; } unsigned char *buf = new unsigned char[width * height * pixelsize]; GC_TYPE gc((unsigned char*)buf, width, height, -width * pixelsize); gc.clear(); //brandon_draw_test(gc); //gc_stress_test(); //test_handling_text(gc); test_clip_stack(gc); //test_arc_curve(gc); //test_arc_to(gc); //test_clip_stack(gc); if (!write_ppm(buf, width, height, "dummy.ppm")) { printf("\nError writing file.\n"); } delete[] buf; return 0; } enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_gradient.cpp0000644000175000017500000000146013233644505022475 0ustar varunvarun#include "kiva_gradient.h" using namespace kiva; gradient::gradient(gradient_type_e gradient_type) : gradient_type(gradient_type), spread_method(pad) { } gradient::gradient(gradient_type_e gradient_type, std::vector points, std::vector stops, const char* spread_method, const char* units) : points(points), stops(stops), gradient_type(gradient_type), spread_method(pad) { if (strcmp(spread_method, "reflect") == 0) this->spread_method = kiva::reflect; else if (strcmp(spread_method, "repeat") == 0) this->spread_method = kiva::repeat; if (strcmp(units, "userSpaceOnUse") == 0) this->units = kiva::user_space; else this->units = kiva::object_bounding_box; } gradient::~gradient() { } enthought-chaco2-4.8.1.orig/kiva/agg/src/compiled_path.i0000644000175000017500000001110413233644505022140 0ustar varunvarun%{ #include "kiva_compiled_path.h" %} // handle kiva::rect declarations %include "rect.i" %include "agg_typemaps.i" %apply (double* point_array, int point_count) {(double* pts, int Npts)}; %apply (double* point_array, int point_count) {(double* start, int Nstart)}; %apply (double* point_array, int point_count) {(double* end, int Nend)}; %apply (double* rect_array, int rect_count) {(double* all_rects, int Nrects)}; %apply (double *vertex_x, double* vertex_y) {(double* x, double *y)}; namespace kiva { %rename(CompiledPath) compiled_path; class compiled_path { public: compiled_path(); void remove_all(); void begin_path(); void close_path(); void move_to(double x, double y); void line_to(double x, double y); void quad_curve_to(double x_ctrl, double y_ctrl, double x_to, double y_to); void curve_to(double x_ctrl1, double y_ctrl1, double x_ctrl2, double y_ctrl2, double x_to, double y_to); void arc(double x, double y, double radius, double start_angle, double end_angle, bool cw=false); void arc_to(double x1, double y1, double x2, double y2, double radius); void add_path(compiled_path& vs); void lines(double* pts, int Npts); void line_set(double* start, int Nstart, double* end, int Nend); void rect(kiva::rect_type &rect); void rect(double x, double y, double sx, double sy); void rects(double* all_rects, int Nrects); void translate_ctm(double x, double y); void rotate_ctm(double angle); void scale_ctm(double sx, double sy); %rename(concat_ctm_agg) concat_ctm(agg24::trans_affine&); void concat_ctm(agg24::trans_affine& m); %rename(set_ctm_agg) set_ctm(agg24::trans_affine&); void set_ctm(agg24::trans_affine& m); %pythoncode %{ def kivaaffine_to_aggaffine(self, ctm): return AffineMatrix(ctm[0,0], ctm[0,1], ctm[1,0], ctm[1,1], ctm[2,0], ctm[2,1]) def concat_ctm(self, ctm): # This is really tortured and may cause performance problems. # Unfortunately I don't see a much better way right now. if '__class__' in dir(ctm) and ctm.__class__.__name__.count('AffineMatrix'): self.concat_ctm_agg(ctm) else: self.concat_ctm_agg(self.kivaaffine_to_aggaffine(ctm)) def set_ctm(self, ctm): if '__class__' in dir(ctm) and ctm.__class__.__name__.count('AffineMatrix'): self.set_ctm_agg(ctm) else: self.set_ctm_agg(self.kivaaffine_to_aggaffine(ctm)) %} agg24::trans_affine get_ctm(); void save_ctm(); void restore_ctm(); // methods from agg24::path_storage that are used in testing unsigned total_vertices() const; %rename(_rewind) rewind(unsigned); void rewind(unsigned start=0); %rename (_vertex) vertex(unsigned, double*, double*); unsigned vertex(unsigned idx, double* x, double* y) const; %rename (_vertex) vertex(double*, double*); unsigned vertex(double* x, double* y); }; } %pythoncode { from numpy import array, float64 def _vertices(self): """ This is only used for testing. It allows us to retrieve all the vertices in the path at once. The vertices are returned as an Nx4 array of the following format. x0, y0, cmd0, flag0 x1, y1, cmd0, flag1 ... """ vertices = [] self._rewind() cmd_flag = 1 while cmd_flag != 0: pt, cmd_flag = self._vertex() cmd,flag = _agg.path_cmd(cmd_flag),_agg.path_flags(cmd_flag) vertices.append((pt[0],pt[1], cmd, flag)) return array(vertices) CompiledPath._vertices = _vertices def get_kiva_ctm(self): aff = self.get_ctm() return array([[aff[0], aff[1], 0], [aff[2], aff[3], 0], [aff[4], aff[5], 1]], float64) CompiledPath.get_kiva_ctm = get_kiva_ctm } %clear (double *x, double *y); enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_graphics_context_base.cpp0000755000175000017500000004057313477706655025270 0ustar varunvarun #ifdef _WIN32 // Win32 threads #include static CRITICAL_SECTION gCriticalSection; #else // POSIX threads #endif #include #include "utf8.h" #include "agg_path_storage.h" #include "kiva_exceptions.h" #include "kiva_graphics_context_base.h" using namespace kiva; #ifdef KIVA_USE_FREETYPE static font_engine_type gFontEngine; #endif #ifdef KIVA_USE_WIN32 static font_engine_type gFontEngine(hdc); #endif static font_manager_type gFontManager(gFontEngine); font_engine_type* kiva::GlobalFontEngine() { return &gFontEngine; } font_manager_type* kiva::GlobalFontManager() { return &gFontManager; } void kiva::cleanup_font_threading_primitives() { #ifdef _WIN32 DeleteCriticalSection(&gCriticalSection); #else #endif } // Create a static pool of font engines that get recycled. //static FontEngineCache font_engine_cache = FontEngineCache(); graphics_context_base::graphics_context_base(unsigned char *data, int width, int height, int stride, interpolation_e interp): buf(), _image_interpolation(interp) { this->buf.attach(data, width, height, stride); } graphics_context_base::~graphics_context_base() { } int graphics_context_base::width() { return this->buf.width(); } int graphics_context_base::height() { return this->buf.height(); } int graphics_context_base::stride() { return this->buf.stride(); } int graphics_context_base::bottom_up() { return (this->stride() > 0 ? 0 : 1); } agg24::rendering_buffer& graphics_context_base::rendering_buffer() { return this->buf; } kiva::interpolation_e graphics_context_base::get_image_interpolation() { return this->_image_interpolation; } void graphics_context_base::set_image_interpolation(kiva::interpolation_e interpolation) { this->_image_interpolation = interpolation; } //--------------------------------------------------------------- // set graphics_state values //--------------------------------------------------------------- void graphics_context_base::set_stroke_color(agg24::rgba& value) { this->state.line_color = value; } agg24::rgba& graphics_context_base::get_stroke_color() { return this->state.line_color; } void graphics_context_base::set_line_width(double value) { this->state.line_width = value; } void graphics_context_base::set_line_join(kiva::line_join_e value) { this->state.line_join = value; } void graphics_context_base::set_line_cap(kiva::line_cap_e value) { this->state.line_cap = value; } void graphics_context_base::set_line_dash(double* pattern, int n, double phase) { this->state.line_dash = kiva::dash_type(phase, pattern, n); } void graphics_context_base::set_blend_mode(kiva::blend_mode_e value) { this->state.blend_mode = value; } kiva::blend_mode_e graphics_context_base::get_blend_mode() { return this->state.blend_mode; } void graphics_context_base::set_fill_color(agg24::rgba& value) { this->state.fill_color = value; } agg24::rgba& graphics_context_base::get_fill_color() { return this->state.fill_color; } void graphics_context_base::set_alpha(double value) { // alpha should be between 0 and 1, so clamp: if (value < 0.0) { value = 0.0; } else if (value > 1.0) { value = 1.0; } this->state.alpha = value; } double graphics_context_base::get_alpha() { return this->state.alpha; } void graphics_context_base::set_antialias(int value) { this->state.should_antialias = value; } int graphics_context_base::get_antialias() { return this->state.should_antialias; } void graphics_context_base::set_miter_limit(double value) { this->state.miter_limit = value; } void graphics_context_base::set_flatness(double value) { this->state.flatness = value; } //--------------------------------------------------------------- // text and font functions //--------------------------------------------------------------- void graphics_context_base::set_text_position(double tx, double ty) { double temp[6]; this->text_matrix.store_to(temp); temp[4] = tx; temp[5] = ty; this->text_matrix.load_from(temp); } void graphics_context_base::get_text_position(double* tx, double* ty) { double temp[6]; agg24::trans_affine result = this->get_text_matrix(); result.store_to(temp); *tx = temp[4]; *ty = temp[5]; } bool graphics_context_base::is_font_initialized() { // This method is left in here just for legacy reasons. Although // technically the font is *never* initialized now that all GCs // are sharing a single font_cache_manager, external users of the // class should be able to proceed as if the font were initialized. return true; } void graphics_context_base::set_text_matrix(agg24::trans_affine& value) { this->text_matrix = value; } agg24::trans_affine graphics_context_base::get_text_matrix() { return this->text_matrix; } void graphics_context_base::set_character_spacing(double value) { this->state.character_spacing = value; } double graphics_context_base::get_character_spacing() { return this->state.character_spacing; } void graphics_context_base::set_text_drawing_mode(kiva::text_draw_mode_e value) { this->state.text_drawing_mode = value; } //--------------------------------------------------------------- // save/restore graphics state //--------------------------------------------------------------- void graphics_context_base::save_state() { this->state_stack.push(this->state); this->path.save_ctm(); } //--------------------------------------------------------------- // coordinate transform matrix transforms //--------------------------------------------------------------- void graphics_context_base::translate_ctm(double x, double y) { this->path.translate_ctm(x, y); } void graphics_context_base::rotate_ctm(double angle) { this->path.rotate_ctm(angle); } void graphics_context_base::scale_ctm(double sx, double sy) { this->path.scale_ctm(sx, sy); } void graphics_context_base::concat_ctm(agg24::trans_affine& m) { this->path.concat_ctm(m); } void graphics_context_base::set_ctm(agg24::trans_affine& m) { this->path.set_ctm(m); } agg24::trans_affine graphics_context_base::get_ctm() { return this->path.get_ctm(); } void graphics_context_base::get_freetype_text_matrix(double* out) { agg24::trans_affine result = this->get_ctm(); result.multiply(this->get_text_matrix()); result.store_to(out); // freetype and agg transpose their matrix conventions double temp = out[1]; out[1] = out[2]; out[2] = temp; } //--------------------------------------------------------------- // Sending drawing data to a device //--------------------------------------------------------------- void graphics_context_base::flush() { // TODO-PZW: clarify this and other "not sure if anything is needed" functions // not sure if anything is needed. } void graphics_context_base::synchronize() { // not sure if anything is needed. } //--------------------------------------------------------------- // Page Definitions //--------------------------------------------------------------- void graphics_context_base::begin_page() { // not sure if anything is needed. } void graphics_context_base::end_page() { // not sure if anything is needed. } //--------------------------------------------------------------- // Path operations //--------------------------------------------------------------- void graphics_context_base::begin_path() { this->path.begin_path(); } void graphics_context_base::move_to(double x, double y) { this->path.move_to(x, y); } void graphics_context_base::line_to( double x, double y) { this->path.line_to(x, y); } void graphics_context_base::curve_to(double cpx1, double cpy1, double cpx2, double cpy2, double x, double y) { this->path.curve_to(cpx1, cpy1, cpx2, cpy2, x, y); } void graphics_context_base::quad_curve_to(double cpx, double cpy, double x, double y) { this->path.quad_curve_to(cpx, cpy, x, y); } void graphics_context_base::arc(double x, double y, double radius, double start_angle, double end_angle, bool cw) { this->path.arc(x, y, radius, start_angle, end_angle, cw); } void graphics_context_base::arc_to(double x1, double y1, double x2, double y2, double radius) { this->path.arc_to(x1, y1, x2, y2, radius); } void graphics_context_base::close_path() { this->path.close_polygon(); } void graphics_context_base::add_path(kiva::compiled_path& other_path) { this->path.add_path(other_path); } void graphics_context_base::lines(double* pts, int Npts) { this->path.lines(pts, Npts); } void graphics_context_base::line_set(double* start, int Nstart, double* end, int Nend) { this->path.line_set(start, Nstart, end, Nend); } void graphics_context_base::rect(double x, double y, double sx, double sy) { this->path.rect(x, y, sx, sy); } void graphics_context_base::rect(kiva::rect_type &rect) { this->path.rect(rect); } void graphics_context_base::rects(double* all_rects, int Nrects) { this->path.rects(all_rects,Nrects); } void graphics_context_base::rects(kiva::rect_list_type &rectlist) { this->path.rects(rectlist); } kiva::compiled_path graphics_context_base::_get_path() { return this->path; } kiva::rect_type graphics_context_base::_get_path_bounds() { double xmin = 0., ymin = 0., xmax = 0., ymax = 0.; double x = 0., y = 0.; for (unsigned i = 0; i < this->path.total_vertices(); ++i) { this->path.vertex(i, &x, &y); if (i == 0) { xmin = xmax = x; ymin = ymax = y; continue; } if (x < xmin) xmin = x; else if (xmax < x) xmax = x; if (y < ymin) ymin = y; else if (ymax < y) ymax = y; } return kiva::rect_type(xmin, ymin, xmax-xmin, ymax-ymin); } agg24::path_storage graphics_context_base::boundary_path(agg24::trans_affine& affine_mtx) { // Return the path that outlines the image in device space // This is used in _draw to specify the device area // that should be rendered. agg24::path_storage clip_path; double p0x = 0; double p0y = 0; double p1x = this->width(); double p1y = 0; double p2x = this->width(); double p2y = this->height(); double p3x = 0; double p3y = this->height(); affine_mtx.transform(&p0x, &p0y); affine_mtx.transform(&p1x, &p1y); affine_mtx.transform(&p2x, &p2y); affine_mtx.transform(&p3x, &p3y); clip_path.move_to(p0x, p0y); clip_path.line_to(p1x, p1y); clip_path.line_to(p2x, p2y); clip_path.line_to(p3x, p3y); clip_path.close_polygon(); return clip_path; } ///////////////////////////////////////////////////////////////////////////// // Text methods ///////////////////////////////////////////////////////////////////////////// bool graphics_context_base::set_font(kiva::font_type& font) { // See if the font is the same; if it is, then do nothing: if (font == this->state.font) { return true; } this->state.font = font; // short-circuit: if the font didn't even load properly, then this // call can't succeed. if (!this->state.font.is_loaded()) { return false; } else { return true; } } kiva::font_type& graphics_context_base::get_font() { return this->state.font; } bool graphics_context_base::set_font_size(int size) { // just make sure the font is loaded; don't check is_font_initialized if (!this->state.font.is_loaded()) { return false; } else { this->state.font.size = size; return true; } } bool graphics_context_base::show_text_at_point(char *text, double tx, double ty) { double oldx, oldy; this->get_text_position(&oldx, &oldy); this->set_text_position(tx, ty); bool retval = this->show_text(text); this->set_text_position(oldx, oldy); return retval; } kiva::rect_type graphics_context_base::get_text_extent(char *text) { const agg24::glyph_cache *glyph = NULL; // Explicitly decode UTF8 bytes to 32-bit codepoints to feed into the // font API. size_t text_length = strlen(text); utf8::iterator p(text, text, text+text_length); utf8::iterator p_end(text+text_length, text, text+text_length); double x1 = 0.0, x2 = 0.0, y1 = 0.0, y2= 0.0; static font_manager_type *font_manager = GlobalFontManager(); if (font_manager == NULL) return kiva::rect_type(0, 0, 0, 0); this->_grab_font_manager(); //typedef agg24::glyph_raster_bin GlyphGeneratorType; //GlyphGeneratorType glyphGen(this->font_manager.glyph(*p)->data); for (; p!=p_end; ++p) { glyph = font_manager->glyph(*p); if (glyph == NULL) { continue; } font_manager->add_kerning(&x2, &y2); x1 = kiva::min(x1, glyph->bounds.x1); x2 += glyph->advance_x; y1 = kiva::min(y1, glyph->bounds.y1); y2 = kiva::max(y2, glyph->bounds.y2); } this->_release_font_manager(); return kiva::rect_type(x1, y1, x2-x1, y2 - y1); } bool graphics_context_base::get_text_bbox_as_rect(char *text) { return false; } int graphics_context_base::draw_image(kiva::graphics_context_base* img) { double tmp[] = {0, 0, img->width(), img->height()}; return this->draw_image(img, tmp); } void graphics_context_base::_grab_font_manager() { // Win32 threads #ifdef _WIN32 static bool critical_section_initialized = false; if (!critical_section_initialized) { // FIXME: We need to delete the CriticalSection object when the process // exits, but where should we put that code? InitializeCriticalSection(&gCriticalSection); critical_section_initialized = true; } EnterCriticalSection(&gCriticalSection); // POSIX threads #else #endif // _WIN32 font_engine_type *font_engine = GlobalFontEngine(); if (font_engine == NULL) return; font_type *font = &this->state.font; #ifdef KIVA_USE_FREETYPE if (font->filename != "") { font_engine->load_font(font->filename.c_str(), 0, agg24::glyph_ren_agg_gray8); } else { font_engine->load_font(font->name.c_str(), 0, agg24::glyph_ren_agg_gray8); } #endif #ifdef KIVA_USE_WIN32 font_engine->create_font(font->name, agg24::glyph_ren_native_gray8, font->size); #endif font_engine->hinting(1); font_engine->resolution(72); // The following is a more laborious but more "correct" way of determining // the correct font size to use under Win32. Unfortunately, it doesn't // work exactly right either; characters come out just a few pixels larger. // Thus, for the time being, we're going to punt and leave the hard-coded // adjustment factor. // // this->font_engine.height(12.0); // this->font_engine.width(12.0); // kiva::rect_type tmp(this->get_text_extent("X")); // this->font_engine.height(font.size*12.0/tmp.h); // this->font_engine.width(font.size*12.0/tmp.w); font_engine->height(font->size); font_engine->width(font->size); } void graphics_context_base::_release_font_manager() { // Win32 thread-safe implementations of GlobalFontEngine and GlobalFontManager #ifdef _WIN32 LeaveCriticalSection(&gCriticalSection); // POSIX thread-safe implementations of GlobalFontEngine and GlobalFontManager #else #endif // _WIN32 } //--------------------------------------------------------------------- // Gradient support //--------------------------------------------------------------------- void graphics_context_base::linear_gradient(double x1, double y1, double x2, double y2, std::vector stops, const char* spread_method, const char* units) { // not implemented throw kiva::not_implemented_error; } void graphics_context_base::radial_gradient(double cx, double cy, double r, double fx, double fy, std::vector stops, const char* spread_method, const char* units) { // not implemented throw kiva::not_implemented_error; } enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_font_type.cpp0000755000175000017500000000653613233644505022723 0ustar varunvarun#include "kiva_font_type.h" #include // In the python layer, the enthought.freetype library is used for font lookup. // Since we can't use that, we emulate the functionality here. #ifdef _WIN32 const char* font_dirs[] = { "c:/windows/fonts/", "./", "c:/winnt/fonts/", "c:/windows/system32/fonts/" }; #elif defined SUNOS const char* font_dirs[] = { "/usr/openwin/lib/X11/fonts" }; #elif defined DARWIN const char* font_dirs[] = { "/Library/Fonts/" }; #else const char* font_dirs[] = { "./", "/usr/lib/X11/fonts/", "/usr/share/fonts/truetype/", "/usr/share/fonts/msttcorefonts/", "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/", "/usr/share/fonts/truetype/msttcorefonts/", }; #endif const char* freetype_suffixes[] = { ".ttf", ".pfa", ".pfb" }; // This really only for testing purposes. Font searching is superceded by the code borrowed from // matplotlib, however, since that is in python, we can't load a font from C++ for C++ tests. // Therefore this simple function is left in. kiva::font_type::font_type(std::string _name, int _size, int _family, int _style, int _encoding, bool validate): name(_name), size(_size), family(_family), style(_style), encoding(_encoding), _is_loaded(false) { std::string full_file_name; if (validate) { if (this->name == "") { this->_is_loaded = false; } else { for (unsigned int d=0; d < sizeof(font_dirs) / sizeof(char*); d++) { for (unsigned int e=0; e < sizeof(freetype_suffixes) / sizeof(char*); e++) { full_file_name = font_dirs[d]; full_file_name.append(this->name); full_file_name.append(freetype_suffixes[e]); FILE *f = fopen(full_file_name.c_str(), "rb"); if (f != NULL) { fclose(f); this->filename = full_file_name; this->_is_loaded = true; break; } } } } this->filename = ""; this->name = ""; this->_is_loaded = false; } else { this->filename = this->name; this->_is_loaded = true; } } kiva::font_type::font_type(const kiva::font_type &font) : name(font.name), filename(font.filename), size(font.size), _is_loaded(font.is_loaded()) { this->family = font.family; this->style = font.style; } kiva::font_type &kiva::font_type::operator=(const kiva::font_type& font) { this->size = font.size; this->family = font.family; this->style = font.style; this->encoding = font.encoding; this->name = font.name; this->filename = font.filename; this->_is_loaded = font.is_loaded(); return *this; } int kiva::font_type::change_filename(std::string _filename) { FILE *f = fopen(_filename.c_str(), "rb"); if (f != NULL) { fclose(f); this->filename = _filename; this->_is_loaded = true; return 1; } else return 0; } enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_alpha_gamma.h0000644000175000017500000000065613233644505022602 0ustar varunvarun#ifndef KIVA_ALPHA_GAMMA_H #define KIVA_ALPHA_GAMMA_H #include "agg_gamma_functions.h" namespace kiva { struct alpha_gamma { alpha_gamma(double alpha, double gamma) : m_alpha(alpha), m_gamma(gamma) {} double operator() (double x) const { return m_alpha(m_gamma(x)); } agg24::gamma_multiply m_alpha; agg24::gamma_power m_gamma; }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/rect.i0000644000175000017500000000166013233644505020273 0ustar varunvarun%{ #include "kiva_rect.h" %} %typemap(in) (kiva::rect_type &rect) { PyArrayObject* ary=NULL; int is_new_object; ary = obj_to_array_contiguous_allow_conversion($input, PyArray_DOUBLE, is_new_object); int size[1] = {4}; if (!ary || !require_dimensions(ary, 1) || !require_size(ary, size, 1)) { goto fail; } double* data = (double*)(ary->data); kiva::rect_type rect(data[0], data[1], data[2], data[3]); $1 = ▭ if (is_new_object) { Py_DECREF(ary); } } %typemap(out) kiva::rect_type { PyObject *pt = PyTuple_New(4); PyTuple_SetItem(pt,0,PyFloat_FromDouble($1.x)); PyTuple_SetItem(pt,1,PyFloat_FromDouble($1.y)); PyTuple_SetItem(pt,2,PyFloat_FromDouble($1.w)); PyTuple_SetItem(pt,3,PyFloat_FromDouble($1.h)); $result = pt; } enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_compiled_path.h0000644000175000017500000001133613233644505023160 0ustar varunvarun#ifndef COMPILED_PATH_H #define COMPILED_PATH_H #include #include #include "agg_basics.h" #include "agg_path_storage.h" #include "agg_trans_affine.h" #include "kiva_rect.h" namespace kiva { class compiled_path : public agg24::path_storage { /*------------------------------------------------------------------- This extends the standard agg24::path_storage class to include matrix transforms within the path definition. Doing so requires overriding a number of methods to apply the matrix transformation to vertices added to the path. The overridden methods are: move_to line_to add_path curve3 curve4 add_path There are a few others that need to be looked at also... In addition, we need to add several methods: translate_ctm rotate_ctm scale_ctm concat_ctm set_ctm get_ctm save_ctm restore_ctm -------------------------------------------------------------------*/ // hack to get VC++ 6.0 to compile correctly typedef agg24::path_storage base; /*------------------------------------------------------------------- ptm -- path transform matrix. This is used to transform each point added to the path. It begins as an identity matrix and accumulates every transform made during the path formation. At the end of the path creation, the ptm holds the total transformation seen during the path formation. It can thus be multiplied with the ctm to determine what the ctm should be after the compiled_path has been drawn. Todo: Should this default to the identity matrix or the current ctm? -------------------------------------------------------------------*/ agg24::trans_affine ptm; // ptm_stack is used for save/restore of the ptm std::stack ptm_stack; // If the path contains curves, this value is true; bool _has_curves; public: // constructor compiled_path() : base(), ptm(agg24::trans_affine()) {} //--------------------------------------------------------------- // path_storage interface //--------------------------------------------------------------- void remove_all(); void begin_path(); void close_path(); void move_to(double x, double y); void line_to(double x, double y); void quad_curve_to(double x_ctrl, double y_ctrl, double x_to, double y_to); void curve_to(double x_ctrl1, double y_ctrl1, double x_ctrl2, double y_ctrl2, double x_to, double y_to); // see graphics_context_base for descriptions of these functions void arc(double x, double y, double radius, double start_angle, double end_angle, bool cw=false); void arc_to(double x1, double y1, double x2, double y2, double radius); void add_path(compiled_path& other_path); void lines(double* pts, int Npts); void line_set(double* start, int Nstart, double* end, int Nend); void rect(double x, double y, double sx, double sy); void rect(kiva::rect_type &rect); void rects(double* all_rects, int Nrects); void rects(kiva::rect_list_type &rectlist); //--------------------------------------------------------------- // compiled_path interface //--------------------------------------------------------------- void _transform_ctm(agg24::trans_affine& m); void translate_ctm(double x, double y); void rotate_ctm(double angle); void scale_ctm(double sx, double sy); void concat_ctm(agg24::trans_affine& m); void set_ctm(agg24::trans_affine& m); agg24::trans_affine get_ctm(); //--------------------------------------------------------------- // save/restore ptm methods //--------------------------------------------------------------- void save_ctm(); void restore_ctm(); //--------------------------------------------------------------- // Test whether curves exist in path. //--------------------------------------------------------------- inline bool has_curves() { return this->_has_curves;} }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/rgba_array.i0000644000175000017500000000476513233644505021460 0ustar varunvarun// -------------------------------------------------------------------------- // // Convert agg24::rgba types to/from Numeric arrays. The rgba_as_array // typemap will accept any 3 or 4 element sequence of float compatible // objects and convert them into an agg24::rgba object. // // The typemap also converts any rgba output value back to a numeric array // in python. This is a more useful representation for numerical // manipulation. // // -------------------------------------------------------------------------- %{ #include "agg_color_rgba.h" %} %include "numeric.i" #ifdef SWIGPYTHON %typemap(in) rgba_as_array (int must_free=0) { must_free = 0; if ((SWIG_ConvertPtr($input,(void **) &$1, SWIGTYPE_p_agg24__rgba, SWIG_POINTER_EXCEPTION | 0 )) == -1) { PyErr_Clear(); if (!PySequence_Check($input)) { PyErr_SetString(PyExc_TypeError,"Expecting a sequence"); return NULL; } int seq_len = PyObject_Length($input); if (seq_len != 3 && seq_len != 4) { PyErr_SetString(PyExc_ValueError, "Expecting a sequence with 3 or 4 elements"); return NULL; } double temp[4] = {0.0,0.0,0.0,1.0}; for (int i =0; i < seq_len; i++) { PyObject *o = PySequence_GetItem($input,i); if (PyFloat_Check(o)) { temp[i] = PyFloat_AsDouble(o); } else { PyObject* converted = PyNumber_Float(o); if (!converted) { PyErr_SetString(PyExc_TypeError, "Expecting a sequence of floats"); return NULL; } temp[i] = PyFloat_AsDouble(converted); Py_DECREF(converted); } if ((temp[i] < 0.0) || (temp [i] > 1.0)) { PyErr_SetString(PyExc_ValueError, "Color values must be between 0.0 an 1.0"); return NULL; } } $1 = new agg24::rgba(temp[0],temp[1],temp[2],temp[3]); must_free = 1; } } %typemap(freearg) rgba_as_array { if (must_free$argnum) delete $1; } %typemap(out) rgba_as_array { npy_intp size = 4; $result = PyArray_SimpleNew(1, &size, PyArray_DOUBLE); double* data = (double*)((PyArrayObject*)$result)->data; data[0] = $1->r; data[1] = $1->g; data[2] = $1->b; data[3] = $1->a; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_constants.h0000644000175000017500000001165213233644505022365 0ustar varunvarun#ifndef KIVA_CONSTANTS_H #define KIVA_CONSTANTS_H namespace kiva { //----------------------------------------------------------------------- // Line Cap Constants //----------------------------------------------------------------------- enum line_cap_e { CAP_ROUND = 0, CAP_BUTT = 1, CAP_SQUARE = 2 }; //----------------------------------------------------------------------- // Line Join Constants //----------------------------------------------------------------------- enum line_join_e { JOIN_ROUND = 0, JOIN_BEVEL = 1, JOIN_MITER = 2 }; //----------------------------------------------------------------------- // Path Drawing Mode Constants // // Path drawing modes for path drawing methods. // The values are chosen so that bit flags can be checked in a later // C version. //----------------------------------------------------------------------- enum draw_mode_e { FILL = 1, EOF_FILL = 2, STROKE = 4, FILL_STROKE = 5, EOF_FILL_STROKE = 6 }; //----------------------------------------------------------------------- // Font Constants // // These are pretty much taken from wxPython. // !! Not sure if they are needed. //----------------------------------------------------------------------- enum text_style_e { NORMAL = 0, BOLD = 1, ITALIC = 2 }; //----------------------------------------------------------------------- // Text Drawing Mode Constants //----------------------------------------------------------------------- enum text_draw_mode_e { TEXT_FILL = 0, TEXT_STROKE = 1, TEXT_FILL_STROKE = 2, TEXT_INVISIBLE = 3, TEXT_FILL_CLIP = 4, TEXT_STROKE_CLIP = 5, TEXT_FILL_STROKE_CLIP = 6, TEXT_CLIP = 7 }; //----------------------------------------------------------------------- // The following enums are Agg-specific, and might not be applicable // to other backends. //----------------------------------------------------------------------- enum interpolation_e { nearest = 0, bilinear = 1, bicubic = 2, spline16 = 3, spline36 = 4, sinc64 = 5, sinc144 = 6, sinc256 = 7, blackman64 = 8, blackman100 = 9, blackman256 = 10 }; enum pix_format_e { pix_format_undefined = 0, // By default. No conversions are applied pix_format_gray8, // Simple 256 level grayscale pix_format_rgb555, // 15 bit rgb. Depends on the byte ordering! pix_format_rgb565, // 16 bit rgb. Depends on the byte ordering! pix_format_rgb24, // R-G-B, one byte per color component pix_format_bgr24, // B-G-R, native win32 BMP format. pix_format_rgba32, // R-G-B-A, one byte per color component pix_format_argb32, // A-R-G-B, native MAC format pix_format_abgr32, // A-B-G-R, one byte per color component pix_format_bgra32, // B-G-R-A, native win32 BMP format end_of_pix_formats }; enum blend_mode_e { blend_normal, // pdf nrmal blending mode. blend_copy, // overright destination with src ignoring any alpha setting. /* // these are copies from agg -- but not yet supported. blend_clear, //----clear blend_src, //----src blend_dst, //----dst blend_src_over, //----src_over blend_dst_over, //----dst_over blend_src_in, //----src_in blend_dst_in, //----dst_in blend_src_out, //----src_out blend_dst_out, //----dst_out blend_src_atop, //----src_atop blend_dst_atop, //----dst_atop blend_xor, //----xor blend_plus, //----plus blend_minus, //----minus blend_multiply, //----multiply blend_screen, //----screen blend_overlay, //----overlay blend_darken, //----darken blend_lighten, //----lighten blend_color_dodge, //----color_dodge blend_color_burn, //----color_burn blend_hard_light, //----hard_light blend_soft_light, //----soft_light blend_difference, //----difference blend_exclusion, //----exclusion blend_contrast, //----contrast */ end_of_e }; enum gradient_type_e { grad_none = 0, grad_linear, grad_radial }; enum gradient_spread_e { pad = 0, reflect, repeat }; enum gradient_units_e { user_space = 0, object_bounding_box }; } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva_affine_helpers.h0000644000175000017500000000074613233644505023325 0ustar varunvarun#ifndef KIVA_AFFINE_MATRIX_H #define KIVA_AFFINE_MATRIX_H #include "agg_trans_affine.h" namespace kiva { bool is_identity(agg24::trans_affine& mat, double epsilon=1e-3); bool only_translation(agg24::trans_affine& mat, double epsilon=1e-3); bool only_scale_and_translation(agg24::trans_affine& mat, double epsilon=1e-3); void get_translation(agg24::trans_affine& m, double* tx, double* ty); void get_scale(agg24::trans_affine& m, double* dx, double* dy); } #endif enthought-chaco2-4.8.1.orig/kiva/agg/src/todo.txt0000644000175000017500000003024313233644505020671 0ustar varunvarun Kiva Demo: *. Add tool for sticking these all in a single notebook example. DONE (wx_demo.py)* set up simple example *. fix flicker. DONE*. Lion example DONE *. add use/don't use image. *. VLSI circuit with multiple layers example *. Ask Chris for a file. *. Laplace's equation or FDTD example. *. Medical image registration. DONE*. Get an example running. *. Ask dad if he has access to better images? *. Work on scaling methodolgy so that it is centered around the image. *. Force image to keep the dimensions we want. *. moving objects around with tied points. *. How does Dave do hit testing for polygons? *. Satellite overlay example. *. Ask someone as NOAA for a good *. Andrew loop *. US ground image *. State border outlines. *. Slides *. add image example. *. DONE *. fix lion path so that it is centered at 0,0 DONE*. Clean up text positioning DONE*. get text to draw right-side up DONE*. Fix text positioning with respect to bottom_up DONE*. show_text should accept x,y position coordinates. DONE*. Handle image positioning correctly. *. get_current_position() isn't currently defined. *. update to newest agg. *. add load method. *. Fix ImageFromFile *. Work on fancy examples based on wxcore2d examples. DONE * fix convert_pix_format. DONE (although doesn't work for RGBA) * add save method. DONE * It looks to me like some memory is not being kept correctly on image conversions. We need to look into this... DONE (1) Move GraphicsContextBitmap to GraphicsContextArray DONE graphics_context_bitmap -> graphics_context DONE GraphicsContextBitmap -> GraphicsContextArray DONE GraphicsContextBitmap.bitmap -> GraphicsContextArray.bmp_array (2) Rework Image DONE *. derive Image from _GraphicsContextArray DONE *. add ImageFromFile method DONE *. outline_path -> boundary_path *. need to check that strides match on images when checking for conversion.? *. Unify pixel_map constants and agg constants DONE (3) Add GraphicsContextSystem method that builds a GraphicsContextArray using a PixelMap DONE *. Fix GraphicsContextArray to allow for a bottom_up parameter. (5) Move from factory to using a constructor for GraphicsContextArray (6) Add convert_pix_format(new_format) function to GraphicsContextArray cleaning up agg: DONE* is fast text used at all? DONE * If not, delete it. DONE * take it out of setup.py DONE* clean up enumeration typemaps. * can we get McSeem to move agg typemaps into a single file? DONE* track down memory leak in the library initializer in _ft. DONE* track down memory leak in the transform initializers. DONE* fix errors in test_image suite. * re-factor test functions like test_name() and save() DONE* change "interpolation_scheme" to "interpolation" DONE* change "simple" to "nearest" gotcha: *. Clicking on a bar in the far right column should move to the first point in the calling function where this routine is called. F3 should find the next call, etc. !! Gotcha says that a function call is happening in a particular !! enclosing function, but I am not able to find the call to the !! function in the source code for the enclosing function. It !! appears that it is missing at least one level of nesting here. *. Try getting rid of bar outlines and see if that helps make the text more readable. *. Make text at least one font size smaller and see if that also helps. Perhaps there should be a user preference setting for the font size. Changing this would also make the bars wider or thinner as appropriate. agg: *. add is_identity to affine_transform class *. add only_translation to affine_transform class *. Get all enum types to have an xxx_end value to make it easy to check for correct values in typemaps. *. Fix typemaps to use these values. priority: *. The y-axis on the middle graph is offset to the left of the actual graph. It should be on top of the graph edge just like the other graphs. *. distributions should remember there values when you switch between them. *. Make Oil Expelled the default graph shown in the middle graph -- not GOR. *. Text labels at the top-right of P10, P50 marker lines -- still inside the bounds of the graph with a small font. (figure out how to do this) *. fix clipping on upper and left of plot. The clip box appears to be 2-3 pixels to large currently. Or maybe it has to do with the lines being drawn to long.? Well, markers also overshoot the boundary, so I do think it is the clop box. *. track down why min_size is always called when rendering. It accounts for about 20% of the time. *. Are line widths scaling correctly. *. color choices reviewed. DONE*. fix line dash bug. (!Woohoo!) *. Check index test -- set joining type to miter causes problems. *. Fix the lookup table to be a lot faster -- search sorted is called way to many times, and it is the source of most of the overhead. *. Look into whether we can speed draw_path_at_points any faster. *. document the API. DONE*. speed up scatter plot rendering. *. Test clipping for images and text. *. write fast version of blit to window fo wxPython. *. Add get/set functions for all the set_*** and get_*** methods. *. sub-class image from gc. *. add save/load functions to image. *. search down memory leaks in freetype wrappers. These appear in the init_ft call which is strange to me. DONE*. Fix rendering of text images. DONE 1. Images without a gc_alpha value are rendered as colored squares. DONE 2. Fill color alpha is being ignored in image rendering. DONE*. Add test suite for image rendering *. Add test suite for text rendering DONE*. Start weeding out potential problems with dashed lines. DONE *. Walk through and stub calls in gc to see if that fixes it DONE *. Look at the path output for the dashed line and see what DONE its problem might be. !! The problems was in the SWIG wrapper. DONE*. See if bypassing the rgb_as_array typemap fixes our troubles DONE even with the rendering of dashed lines... *. rename this to rgb_from_array *. clean up array typemaps. DONE *. Mostly Done. They live in agg_typemaps.i now. DONE *. Alter image typemaps to allow non-contiguous arrays that are only non-contiguous in in the first dimension to handle window bitmaps correctly. DONE *. Do this in combinations with building method to wrap windows bitmaps with arrays. DONE*. find problem in render method return PyObject_NULL sometimes in freetype wrappers DONE*. chase down problem in color_from_array code... DONE This exhibits itself on the first run of test_image.main() DONE after a build of the library. DONE !! It isn't appearin any more after I've cleaned up the DONE !! typemaps above. I thought there was a problem with the DONE !! color typemaps though, so it may resurface... DONE*. set_text_position doesn't exist DONE*. set_text_matrix needs to work with whatever kind of matrix it is DONE handed. *. Look at how we handle the set_font issues in the standard agg *. Review and clean it all up. DONE*. handle pixel formats intelligently. User must specify the format now. It is never assumed accept for on a gc (bgra32). We will need to make this a platform specific value in the future. BUT... needs testing... DONE *. speed up text rendering I'm sure this can be sped up by moving more and more into agg, but this is "fast enough" for our purpose. It takes about 1.5 milleseconds to render a 10 character string in a "normal" font size. That is *way* to slow for a general drawing engine, but will work fine for drawing 20 or so labels, etc. on a graph. DONE *. Move image array creation code to weave. DONE *. Move to standard module so that it can be built without weave. *. allow images to be created from a file (use PIL) DONE *. add a convert() method to convert to a new image format. This will require some coordination between python and C++. Create the array in Python, and hand it into the array so that we can keep the bitmap array pointing to the correct data. DONE*. try intel compiler and see if it is any better. add these around line 240 of distutils msvccompiler.py file self.cc = "icl.exe" self.linker = "xilink.exe" self.compile_options = [ '/nologo', '/O3', '/QxW', '/Qipo', '/Fe_ipo_file', '/Qvec_reportN','/MD', '/W3' ] !!I was rewarded with a slight slow down compared to the microsoft compiler. !!That doesn't sound promising... DONE*. Fix clipping on image insertion. BUT... No attempt to reconcile this with the actual clipping path is made. 7. Add an Image class to kiva to pass into draw_image a. work on format conversions. DONE b. fix clipping boundaries c. handle scaling to rect. DONE d. fix text to use new algorithm. DONE e. templatize routines so that we can use faster null_alpha_color class when alpha = 1.0 DONE f. The only thing different about the image and graphics_context_bitmap is that the image has a interpolation_scheme and the gc does not. This could lead to a bit of confusion, but I don't think much. We should unify the two. DONE *. This brings up the point... Should we attach the interpolation flag to the image or to the gc?? PDF doesn't so the answer is probably no... DONE 11. Create an image with the correct strides for a windows bitmap. DONE*. check gc.set_alpha() transparency for rendering images. DONE *. Add a clear method to GraphicsContextBitmap agg::renderer_util ru(rbuf_img(0)); ru.clear(agg::rgba(1.0, 1.0, 1.0)); *. Clipping support DONE *. Test with chaco. DONE *. Make available to the world. other: DONE1. split dash_type and font_type into their own files. DONE3. add freetype stuff to GraphicsContextBitmap I added this stuff through the graphics_context.i file. It is getting a little hairy... DONE4. Fix FreeType engine to use "unic" if encoding is empty. DONE5. Test it out with a real image... -- see test_image.py !!!! 5a. Figure out why PIL isn't installed correctly. 2. set_line_dash should accept a dash_type object. ?? 9. Test as replacement for current gc wrappers. *. Make the text handling for kiva robust. DONE a. Get rotation working correctly. DONE b. Test all transformation modes. BUT... test_image.py requires visual inspection. c. Should font_type size be a double? d. We need better diagnostics to calculate bounding region of text. DONE 1. add bbox_as_rect() to freetype a. use this in all kiva implementations e. drawing is slow. All the time is in draw_glyphs. Figure out what is eating all the time in the agg C++ code. DONE*. Add type conversions from sequences to colors. BUT... Need more testing. *. Move from using get_xxx() to python's new property mechanism. 12. Add curve support for path rendering 13. Fix filling rules for thick lines (use presentation examples as guide) PART10. Make typemaps for image arrays in safe... I've elected to do most typechecking in Python because it is less error prone. I handle this by just overriding the affected class methods/functions in the %pythoncode section WAIT6. Figure out how to create a agg_a8_image that allows me to set the color and only use an alpha channel in the image. Should be fairly easy... !! Wait until McSeem is back and ask him about this. 8. Get the box scaling for images working correctly. 8a. Look at how this is done on the Mac. *. Should the graphics state store the current point? *. font_type should be shared between kiva and freetype... FUTURE VERSIONS: *. Look into shading??? *. Color spaces for grayscale images. Tests: enthought-chaco2-4.8.1.orig/kiva/agg/src/rgba.i0000644000175000017500000000406513233644505020253 0ustar varunvarun%{ #include "agg_color_rgba.h" %} %include "numeric.i" %typemap(in, numinputs=0) double* out (double temp[4]) { $1 = temp; } %typemap(argout) double *out { // Append output value $1 to $result npy_intp dims = 4; PyArrayObject* ary_obj = (PyArrayObject*) PyArray_SimpleNew(1,&dims,PyArray_DOUBLE); if( ary_obj == NULL ) return NULL; double* data = (double*)ary_obj->data; for (int i=0; i < 4;i++) data[i] = $1[i]; Py_DECREF($result); $result = PyArray_Return(ary_obj); } %typemap(check) (double r) { if ($1 < 0.0 || $1 > 1.0) { PyErr_Format(PyExc_ValueError, "color values must be between 0.0 and 1.0, Got: %g", $1); } } %apply (double r) {double g, double b, double a}; namespace agg24 { %rename(_Rgba) rgba; struct rgba { double r; double g; double b; double a; rgba(double r_=0.0, double g_=0.0, double b_=0.0, double a_=1.0); //void opacity(double a_); //double opacity() const; rgba gradient(rgba c, double k) const; const rgba &premultiply(); }; } %extend agg24::rgba { char *__repr__() { static char tmp[1024]; sprintf(tmp,"Rgba(%g,%g,%g,%g)", self->r,self->g,self->b,self->a); return tmp; } int __eq__(agg24::rgba& o) { return (self->r == o.r && self->g == o.g && self->b == o.b && self->a == o.a); } void asarray(double* out) { out[0] = self->r; out[1] = self->g; out[2] = self->b; out[3] = self->a; } } %pythoncode %{ def is_sequence(arg): try: len(arg) return 1 except: return 0 # Use sub-class to allow sequence as input class Rgba(_Rgba): def __init__(self,*args): if len(args) == 1 and is_sequence(args[0]): args = tuple(args[0]) if len(args) not in [3,4]: raise ValueError("array argument must be 1x3 or 1x4") _Rgba.__init__(self,*args) %} %clear double r, double g, double b, double a; enthought-chaco2-4.8.1.orig/kiva/agg/src/readme.txt0000644000175000017500000000510313233644505021156 0ustar varunvarunThis directory contains the C++ source files and SWIG wrappers for Kiva's Agg backend. Support files ------------------------------ readme.txt this file todo.txt Eric's old todo file SWIG wrappers (*.i) ------------------------------ affine_matrix.i agg_trans_affine.h classes agg_std_string.i typemaps for member access to font_type.name agg_typemaps.i typemaps for various agg classes (rect, color, etc.) compiled_path.i wrapper for kiva_compiled_path.h constants.i common enumerations and constants used by Agg and Kiva font_type.i wrapper for kiva_font_type.h graphic_context.i the main wrapper defining the Agg graphics context numeric.i typemaps and wrappers for Numeric array used in kiva numeric_ext.i same as numeric.i rect.i wrapper for kiva_rect.h rgba.i RGBA color class and utility functions rgba_array.i maps Numeric 3- and 4-tuples into RGBA color instances sequence_to_array.i maps Python tuples into double[] swig_questions.txt questions and problems we are currently having with our use of SWIG C/C++ files ------------------------------- agg_examples.cpp C++ source code for demonstrating use of various agg features kiva_affine_helpers.h/.cpp kiva_affine_matrix.h kiva_basics.h kiva_compiled_path.h/.cpp kiva_constants.h kiva_dash_type.h kiva_exceptions.h kiva_font_type.h kiva_graphics_context_base.h/.cpp non-templatized base class for graphics contexts (which are templatized on pixel format) kiva_graphics_context.h template graphics_context class and typedef specializations for various pixel formats. kiva_image_filters.h A helper class that associates the right types of image filters for various pixel formats kiva_pix_format.h defines agg_pix_to_kiva() kiva_rect.h/.cpp Kiva rectangle class (with converters to/from double*, Agg rects, etc.) Visual Studio 6 files ------------------------------- kiva.dsp Project file for the agg wrapper kiva.dsw workspace file for kiva.dsp The following files are generated by Visual Studio during compilation kiva.ncd kiva.opt kiva.plg Directories ------------------------------- gtk1 support files for grabbing a graphics context in GTK win32 " " " " " " " " win32 x11 " " " " " " " " xwindows gl " " " " " " " " openGL enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva.vcproj0000644000175000017500000010234213233644505021342 0ustar varunvarun enthought-chaco2-4.8.1.orig/kiva/agg/src/kiva.dsw0000644000175000017500000000076613233644505020643 0ustar varunvarunMicrosoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "kiva"=.\kiva.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### enthought-chaco2-4.8.1.orig/kiva/basecore2d.py0000644000175000017500000013337513421603267020232 0ustar varunvarun# Copyright (c) 2005-2014, Enthought, Inc. # some parts copyright Space Telescope Science Institute # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! """ Pure-Python reference implementation of a Kiva graphics context. Data Structures --------------- color 1-D array with 4 elements. The array elements represent (red, green, blue, alpha) and are each between 0 and 1. Alpha is a transparency value with 0 being fully transparent and 1 being fully opaque. Many backends do not handle tranparency and treat any alpha value greater than 0 as fully opaque. transform currently a 3x3 array. This is not the most convenient in some backends. Mac and OpenGL use a 1-D 6 element array. We need to either make transform a class or always use accessor functions to access its values. Currently, I do the latter. """ from __future__ import absolute_import, print_function import six.moves as sm import numpy as np from numpy import alltrue, array, asarray, float64, shape, pi, concatenate from .constants import (POINT, LINE, LINES, RECT, NO_DASH, CLOSE, CAP_ROUND, CAP_BUTT, CAP_SQUARE, JOIN_ROUND, JOIN_BEVEL, JOIN_MITER, STROKE, FILL_STROKE, EOF_FILL_STROKE, FILL, EOF_FILL, TEXT_FILL, TEXT_STROKE, TEXT_FILL_STROKE, TEXT_INVISIBLE, TEXT_FILL_CLIP, TEXT_STROKE_CLIP, TEXT_FILL_STROKE_CLIP, TEXT_CLIP, TEXT_OUTLINE, SCALE_CTM, TRANSLATE_CTM, ROTATE_CTM, CONCAT_CTM, LOAD_CTM) from .abstract_graphics_context import AbstractGraphicsContext from .line_state import LineState, line_state_equal from .graphics_state import GraphicsState from .fonttools import Font import kiva.affine as affine # -------------------------------------------------------------------- # Drawing style tests. # # Simple tests used by drawing methods to determine what kind of # drawing command is supposed to be executed. # -------------------------------------------------------------------- def is_point(tup): return tup[0] == POINT def is_line(tup): return tup[0] == LINE def is_fully_transparent(color): """ Tests a color array to see whether it is fully transparent or not. This is true if the alpha value (4th entry in the color array) is 0.0. """ transparent = (color[3] == 0.0) return transparent def fill_equal(fill1, fill2): """ Compares the two fill colors. """ return alltrue(fill1 == fill2) class GraphicsContextBase(AbstractGraphicsContext): """ Concrete base implementation of a GraphicsContext Attributes ---------- state Current state of graphics context. state_stack Stack used to save graphics states path The drawing path. active_subpath The active drawing subpath This class needs to be sub-classed by device types that handle drawing but don't handle more advanced concepts like paths, graphics state, and coordinate transformations. This class can also be used as a null backend for testing purposes. """ def __init__(self, *args, **kwargs): super(GraphicsContextBase, self).__init__() self.state = GraphicsState() # The line state has multiple properties that are tracked by a class self.last_drawn_line_state = LineState(None, None, None, None, None) # The fill state is simply a color. self.last_drawn_fill_state = None self.last_font_state = None # Used by save/restore state. self.state_stack = [] # Variables for used in drawing paths. # The path_transform_indices holds a list of indices pointing into # active_subpath that affect the ctm. It is necessary to preserve # these across begin_path calls. self.active_subpath = [] self.path_transform_indices = [] self.path = [self.active_subpath] # Whether the particular underlying graphics context considers the # "origin" of a pixel to be the center of the pixel or the lower-left # corner. Most vector-based drawing systems consider the origin to # be at the corner, whereas most raster systems place the origin at # the center. # # This is ultimately used to determine whether certain methods should # automatically tack on a (0.5, 0.5) offset. self.corner_pixel_origin = True # -------------------------------------------------------------------- # We're currently maintaining a couple of copies of the ctm around. # The state.ctm is used mainly for user querying, etc. We also have # something called the device_ctm which is actually used in the # drawing of objects. In some implementation (OpenGL), the # device_ctm is actually maintained in hardware. # -------------------------------------------------------------------- self.device_prepare_device_ctm() # ------------------------------------------------------------------------ # Coordinate Transform Matrix Manipulation # # Note: I'm not sure we really need to keep the state.ctm around now # that we're keeping the device_ctm around, but I'm reluctant to # unify the two yet. I think it can (and probably should) be done # though. # ------------------------------------------------------------------------ def scale_ctm(self, sx, sy): """ Sets the coordinate system scale to the given values, (sx, sy). Parameters ---------- sx : float The new scale factor for the x axis sy : float The new scale factor for the y axis """ self.state.ctm = affine.scale(self.state.ctm, sx, sy) self.active_subpath.append((SCALE_CTM, (sx, sy))) self.path_transform_indices.append(len(self.active_subpath)-1) def translate_ctm(self, tx, ty): """ Translates the coordinate system by the value given by (tx, ty) Parameters ---------- tx : float The distance to move in the x direction ty : float The distance to move in the y direction """ self.state.ctm = affine.translate(self.state.ctm, tx, ty) self.active_subpath.append((TRANSLATE_CTM, (tx, ty))) self.path_transform_indices.append(len(self.active_subpath)-1) def rotate_ctm(self, angle): """ Rotates the coordinate space for drawing by the given angle. Parameters ---------- angle : float the angle, in radians, to rotate the coordinate system """ self.state.ctm = affine.rotate(self.state.ctm, angle) self.active_subpath.append((ROTATE_CTM, (angle,))) self.path_transform_indices.append(len(self.active_subpath)-1) def concat_ctm(self, transform): """ Concatenates the transform to current coordinate transform matrix. Parameters ---------- transform : affine_matrix the transform matrix to concatenate with the current coordinate matrix. """ self.state.ctm = affine.concat(self.state.ctm, transform) self.active_subpath.append((CONCAT_CTM, (transform,))) self.path_transform_indices.append(len(self.active_subpath)-1) def get_ctm(self): """ Returns the current coordinate transform matrix. """ return self.state.ctm.copy() def set_ctm(self, transform): """ Returns the current coordinate transform matrix. """ self.state.ctm = transform self.active_subpath.append((LOAD_CTM, (transform,))) self.path_transform_indices.append(len(self.active_subpath)-1) # ---------------------------------------------------------------- # Save/Restore graphics state. # ---------------------------------------------------------------- def save_state(self): """ Saves the current graphic's context state. Always pair this with a `restore_state()`, for example using try ... finally ... or the context manager interface. """ self.state_stack.append(self.state) self.state = self.state.copy() def restore_state(self): """ Restores the previous graphics state. """ self.state = self.state_stack.pop(-1) self.active_subpath.append((LOAD_CTM, (self.state.ctm,))) self.path_transform_indices.append(len(self.active_subpath)-1) # ---------------------------------------------------------------- # context manager interface # ---------------------------------------------------------------- def __enter__(self): self.save_state() def __exit__(self, type, value, traceback): self.restore_state() # ---------------------------------------------------------------- # Manipulate graphics state attributes. # ---------------------------------------------------------------- def set_antialias(self, value): """ Sets/Unsets anti-aliasing for bitmap graphics context. Ignored on most platforms. """ self.state.antialias = value def get_antialias(self, value): """ Returns the anti-aliasing for bitmap graphics context. Ignored on most platforms. """ return self.state.antialias def set_image_interpolation(self, value): """ Sets image interpolation for bitmap graphics context. Ignored on most platforms. """ self.state.image_interpolation = value def get_image_interpolation(self, value): """ Sets/Unsets anti-aliasing for bitmap graphics context. Ignored on most platforms. """ return self.state.image_interpolation def set_line_width(self, width): """ Sets the line width for drawing Parameters ---------- width : float The new width for lines in user space units. """ self.state.line_state.line_width = width def set_line_join(self, style): """ Sets the style for joining lines in a drawing. Parameters ---------- style : join_style The line joining style. The available styles are JOIN_ROUND, JOIN_BEVEL, JOIN_MITER. """ if style not in (JOIN_ROUND, JOIN_BEVEL, JOIN_MITER): msg = "Invalid line join style. See documentation for valid styles" raise ValueError(msg) self.state.line_state.line_join = style def set_miter_limit(self, limit): """ Specifies limits on line lengths for mitering line joins. If line_join is set to miter joins, the limit specifies which line joins should actually be mitered. If lines are not mitered, they are joined with a bevel. The line width is divided by the length of the miter. If the result is greater than the limit, the bevel style is used. This is not implemented on most platforms. Parameters ---------- limit : float limit for mitering joins. defaults to 1.0. """ self.state.miter_limit = limit def set_line_cap(self, style): """ Specifies the style of endings to put on line ends. Parameters ---------- style : cap_style The line cap style to use. Available styles are CAP_ROUND, CAP_BUTT, CAP_SQUARE. """ if style not in (CAP_ROUND, CAP_BUTT, CAP_SQUARE): msg = "Invalid line cap style. See documentation for valid styles" raise ValueError(msg) self.state.line_state.line_cap = style def set_line_dash(self, pattern, phase=0): """ Sets the line dash pattern and phase for line painting. Parameters ---------- pattern : float array An array of floating point values specifing the lengths of on/off painting pattern for lines. phase : float Specifies how many units into dash pattern to start. phase defaults to 0. """ if not alltrue(pattern): self.state.line_state.line_dash = NO_DASH return pattern = asarray(pattern) if len(pattern) < 2: raise ValueError("dash pattern should have at least two entries.") # not sure if this check is really needed. if phase < 0: raise ValueError("dash phase should be a positive value.") self.state.line_state.line_dash = (phase, pattern) def set_flatness(self, flatness): """ Not implemented It is device dependent and therefore not recommended by the PDF documentation. flatness determines how accurately curves are rendered. Setting it to values less than one will result in more accurate drawings, but they take longer. It defaults to None """ self.state.flatness = flatness # ---------------------------------------------------------------- # Sending drawing data to a device # ---------------------------------------------------------------- def flush(self): """ Sends all drawing data to the destination device. """ pass def synchronize(self): """ Prepares drawing data to be updated on a destination device. Currently this is a NOP for all implementations. """ pass # ---------------------------------------------------------------- # Page Definitions # ---------------------------------------------------------------- def begin_page(self): """ Creates a new page within the graphics context. Currently this is a NOP for all implementations. The PDF backend should probably implement it, but the ReportLab Canvas uses the showPage() method to handle both begin_page and end_page issues. """ pass def end_page(self): """ Ends drawing in the current page of the graphics context. Currently this is a NOP for all implementations. The PDF backend should probably implement it, but the ReportLab Canvas uses the showPage() method to handle both begin_page and end_page issues. """ pass # ---------------------------------------------------------------- # Building paths (contours that are drawn) # # + Currently, nothing is drawn as the path is built. Instead, the # instructions are stored and later drawn. Should this be changed? # We will likely draw to a buffer instead of directly to the canvas # anyway. # # Hmmm. No. We have to keep the path around for storing as a # clipping region and things like that. # # + I think we should keep the current_path_point hanging around. # # ---------------------------------------------------------------- def begin_path(self): """ Clears the current drawing path and begin a new one. """ # Need to check here if the current subpath contains matrix # transforms. If it does, pull these out, and stick them # in the new subpath. if self.path_transform_indices: tf = array(self.active_subpath, object)[self.path_transform_indices, :] self.path_transform_indices = list(sm.range(len(tf))) self.active_subpath = list(tf) else: self.active_subpath = [] self.path = [self.active_subpath] def move_to(self, x, y): """ Starts a new drawing subpath and place the current point at (x, y). Notes: Not sure how to treat state.current_point. Should it be the value of the point before or after the matrix transformation? It looks like before in the PDF specs. """ self._new_subpath() pt = array((x, y), dtype=float64) self.state.current_point = pt self.active_subpath.append((POINT, pt)) def line_to(self, x, y): """ Adds a line from the current point to the given point (x, y). The current point is moved to (x, y). What should happen if move_to hasn't been called? Should it always begin at (0, 0) or raise an error? Notes: See note in move_to about the current_point. """ pt = array((x, y), dtype=float64) self.state.current_point = pt self.active_subpath.append((LINE, pt)) def lines(self, points): """ Adds a series of lines as a new subpath. Parameters ---------- points an Nx2 array of x, y pairs The current_point is moved to the last point in 'points' """ self._new_subpath() pts = points self.active_subpath.append((LINES, pts)) self.state.current_point = points[-1] def line_set(self, starts, ends): """ Adds a set of disjoint lines as a new subpath. Parameters ---------- starts an Nx2 array of x, y pairs ends an Nx2 array of x, y pairs Starts and ends should have the same length. The current point is moved to the last point in 'ends'. """ self._new_subpath() for i in sm.range(min(len(starts), len(ends))): self.active_subpath.append((POINT, starts[i])) self.active_subpath.append((LINE, ends[i])) self.state.current_point = ends[i] def rect(self, x, y, sx, sy): """ Adds a rectangle as a new subpath. """ pts = array(((x, y), (x, y+sy), (x+sx, y+sy), (x+sx, y),)) self.lines(pts) self.close_path('rect') def draw_rect(self, rect, mode): self.rect(*rect) self.draw_path(mode=mode) def rects(self, rects): """ Adds multiple rectangles as separate subpaths to the path. Not very efficient -- calls rect multiple times. """ for x, y, sx, sy in rects: self.rect(x, y, sx, sy) def close_path(self, tag=None): """ Closes the path of the current subpath. Currently starts a new subpath -- is this what we want? """ self.active_subpath.append((CLOSE, (tag,))) self._new_subpath() def curve_to(self, x_ctrl1, y_ctrl1, x_ctrl2, y_ctrl2, x_to, y_to): """ Draw a cubic bezier curve from the current point. Parameters ---------- x_ctrl1 : float X-value of the first control point. y_ctrl1 : float Y-value of the first control point. x_ctrl2 : float X-value of the second control point. y_ctrl2 : float Y-value of the second control point. x_to : float X-value of the ending point of the curve. y_to : float Y-value of the ending point of the curve. """ # XXX: figure out a reasonable number of points from the current scale # and arc length. Since the arc length is expensive to calculate, the # sum of the lengths of the line segments from (xy0, xy_ctrl1), # (xy_ctrl1, xy_ctrl2), and (xy_ctrl2, xy_to) would be a reasonable # approximation. n = 100 t = np.arange(1, n+1) / float(n) t2 = t*t t3 = t2*t u = 1 - t u2 = u*u u3 = u2*u x0, y0 = self.state.current_point pts = np.column_stack([ x0*u3 + 3*(x_ctrl1*t*u2 + x_ctrl2*t2*u) + x_to*t3, y0*u3 + 3*(y_ctrl1*t*u2 + y_ctrl2*t2*u) + y_to*t3, ]) self.active_subpath.append((LINES, pts)) self.state.current_point = pts[-1] def quad_curve_to(self, x_ctrl, y_ctrl, x_to, y_to): """ Draw a quadratic bezier curve from the current point. Parameters ---------- x_ctrl : float X-value of the control point y_ctrl : float Y-value of the control point. x_to : float X-value of the ending point of the curve y_to : float Y-value of the ending point of the curve. """ # A quadratic Bezier curve is just a special case of the cubic. Reuse # its implementation in case it has been implemented for the specific # backend. x0, y0 = self.state.current_point xc1 = (x0 + x_ctrl + x_ctrl) / 3.0 yc1 = (y0 + y_ctrl + y_ctrl) / 3.0 xc2 = (x_to + x_ctrl + x_ctrl) / 3.0 yc2 = (y_to + y_ctrl + y_ctrl) / 3.0 self.curve_to(xc1, yc1, xc2, yc2, x_to, y_to) def arc(self, x, y, radius, start_angle, end_angle, cw=False): """ Draw a circular arc. If there is a current path and the current point is not the initial point of the arc, a line will be drawn to the start of the arc. If there is no current path, then no line will be drawn. Parameters ---------- x : float X-value of the center of the arc. y : float Y-value of the center of the arc. radius : float The radius of the arc. start_angle : float The angle, in radians, that the starting point makes with respect to the positive X-axis from the center point. end_angle : float The angles, in radians, that the final point makes with respect to the positive X-axis from the center point. cw : bool, optional Whether the arc should be drawn clockwise or not. """ # XXX: pick the number of line segments based on the current scale and # the radius. n = 100 if end_angle < start_angle and not cw: end_angle += 2*pi elif start_angle < end_angle and cw: start_angle += 2*pi theta = np.linspace(start_angle, end_angle, n) pts = radius * np.column_stack([np.cos(theta), np.sin(theta)]) pts += np.array([x, y]) self.active_subpath.append((LINES, pts)) self.state.current_point = pts[-1] def arc_to(self, x1, y1, x2, y2, radius): """ """ raise NotImplementedError("arc_to is not implemented") def _new_subpath(self): """ Starts a new drawing subpath. Only creates a new subpath if the current one contains objects. """ if self.active_subpath: self.active_subpath = [] self.path_transform_indices = [] self.path.append(self.active_subpath) # ---------------------------------------------------------------- # Getting infomration on paths # ---------------------------------------------------------------- def is_path_empty(self): """ Tests to see whether the current drawing path is empty """ # If the first subpath is empty, then the path is empty res = 0 if not self.path[0]: res = 1 else: res = 1 for sub in self.path: if not is_point(sub[-1]): res = 0 break return res def get_path_current_point(self): """ Returns the current point from the graphics context. Note: Currently the current_point is only affected by move_to, line_to, and lines. It should also be affected by text operations. I'm not sure how rect and rects and friends should affect it -- will find out on Mac. """ pass def get_path_bounding_box(self): """ """ pass def from_agg_affine(self, aff): """Convert an agg.AffineTransform to a numpy matrix representing the affine transform usable by kiva.affine and other non-agg parts of kiva""" return array([[aff[0], aff[1], 0], [aff[2], aff[3], 0], [aff[4], aff[5], 1]], float64) def add_path(self, path): """Draw a compiled path into this gc. Note: if the CTM is changed and not restored to the identity in the compiled path, the CTM change will continue in this GC.""" # Local import to avoid a dependency if we can avoid it. from kiva import agg multi_state = 0 # For multi-element path commands we keep the previous x_ctrl1 = 0 # information in these variables. y_ctrl1 = 0 x_ctrl2 = 0 y_ctrl2 = 0 for x, y, cmd, flag in path._vertices(): if cmd == agg.path_cmd_line_to: self.line_to(x, y) elif cmd == agg.path_cmd_move_to: self.move_to(x, y) elif cmd == agg.path_cmd_stop: self.concat_ctm(path.get_kiva_ctm()) elif cmd == agg.path_cmd_end_poly: self.close_path() elif cmd == agg.path_cmd_curve3: if multi_state == 0: x_ctrl1 = x y_ctrl1 = y multi_state = 1 else: self.quad_curve_to(x_ctrl1, y_ctrl1, x, y) multi_state = 0 elif cmd == agg.path_cmd_curve4: if multi_state == 0: x_ctrl1 = x y_ctrl1 = y multi_state = 1 elif multi_state == 1: x_ctrl2 = x y_ctrl2 = y multi_state = 2 elif multi_state == 2: self.curve_to(x_ctrl1, y_ctrl1, x_ctrl2, y_ctrl2, x, y) # ---------------------------------------------------------------- # Clipping path manipulation # ---------------------------------------------------------------- def clip(self): """ """ pass def even_odd_clip(self): """ """ pass def clip_to_rect(self, x, y, width, height): """ Sets the clipping path to the intersection of the current clipping path with the area defined by the specified rectangle """ if not self.state.clipping_path: self.state.clipping_path = (x, y, width, height) self.device_set_clipping_path(x, y, width, height) else: # Find the intersection of the clipping regions: xmin1, ymin1, width1, height1 = self.state.clipping_path xclip_min = max(xmin1, x) xclip_max = min(xmin1 + width1, x + width) yclip_min = max(ymin1, y) yclip_max = min(ymin1 + height1, y + height) height_clip = max(0, yclip_max - yclip_min) width_clip = max(0, xclip_max - xclip_min) self.state.clipping_path = (xclip_min, yclip_min, width_clip, height_clip) self.device_set_clipping_path(xclip_min, yclip_min, width_clip, height_clip) def clip_to_rects(self): """ """ pass def clear_clip_path(self): self.state.clipping_path = None self.device_destroy_clipping_path() # ---------------------------------------------------------------- # Color manipulation # ---------------------------------------------------------------- def set_fill_color(self, color): """ set_fill_color takes a sequences of rgb or rgba values between 0.0 and 1.0 """ if len(color) == 3: self.state.fill_color[:3] = color self.state.fill_color[3] = 1.0 else: self.state.fill_color[:] = color def get_fill_color(self, color): """ set_fill_color returns a sequence of rgb or rgba values between 0.0 and 1.0 """ return self.state.fill_color def linear_gradient(self, x1, y1, x2, y2, stops, spread_method, units): """ Modify the fill color to be a linear gradient """ pass def radial_gradient(self, cx, cy, r, fx, fy, stops, spread_method, units): """ Modify the fill color to be a linear gradient """ pass def set_stroke_color(self, color): """ set_stroke_color takes a sequences of rgb or rgba values between 0.0 and 1.0 """ if len(color) == 3: self.state.line_state.line_color[:3] = color self.state.line_state.line_color[3] = 1.0 else: self.state.line_state.line_color[:] = color def get_stroke_color(self, color): """ set_stroke_color returns a sequence of rgb or rgba values between 0.0 and 1.0 """ return self.state.stroke_color def set_alpha(self, alpha): """ Set the alpha to use when drawing """ self.state.alpha = alpha def get_alpha(self, alpha): """ Return the alpha used when drawing """ return self.state.alpha # ---------------------------------------------------------------- # Drawing Images # ---------------------------------------------------------------- def draw_image(self, img, rect=None): """ """ self.device_draw_image(img, rect) # ------------------------------------------------------------------------- # Drawing Text # # Font handling needs more attention. # # ------------------------------------------------------------------------- def select_font(self, face_name, size=12, style="regular", encoding=None): """ Selects a new font for drawing text. Parameters ---------- face_name The name of a font. E.g.: "Times New Roman" !! Need to specify a way to check for all the types size The font size in points. style One of "regular", "bold", "italic", "bold italic" encoding A 4 letter encoding name. Common ones are: * "unic" -- unicode * "armn" -- apple roman * "symb" -- symbol Not all fonts support all encodings. If none is specified, fonts that have unicode encodings default to unicode. Symbol is the second choice. If neither are available, the encoding defaults to the first one returned in the FreeType charmap list for the font face. """ # !! should check if name and encoding are valid. self.state.font = Font(face_name, size=size, style=style) def set_font(self, font): """ Set the font for the current graphics context. """ self.state.font = font.copy() def get_font(self, font): """ Set the font for the current graphics context. """ return self.state.font.copy() def set_font_size(self, size): """ Sets the size of the font. The size is specified in user space coordinates. Note: I don't think the units of this are really "user space coordinates" on most platforms. I haven't looked into the text drawing that much, so this stuff needs more attention. """ self.state.font.size = size def set_character_spacing(self, spacing): """ Sets the amount of additional spacing between text characters. Parameters ---------- spacing : float units of space extra space to add between text coordinates. It is specified in text coordinate system. Notes ----- 1. I'm assuming this is horizontal spacing? 2. Not implemented in wxPython. """ self.state.character_spacing = spacing def get_character_spacing(self): """ Gets the amount of additional spacing between text characters. """ return self.state.character_spacing def set_text_drawing_mode(self, mode): """ Specifies whether text is drawn filled or outlined or both. Parameters ---------- mode determines how text is drawn to the screen. If a CLIP flag is set, the font outline is added to the clipping path. Possible values: TEXT_FILL fill the text TEXT_STROKE paint the outline TEXT_FILL_STROKE fill and outline TEXT_INVISIBLE paint it invisibly ?? TEXT_FILL_CLIP fill and add outline clipping path TEXT_STROKE_CLIP outline and add outline to clipping path TEXT_FILL_STROKE_CLIP fill, outline, and add to clipping path TEXT_CLIP add text outline to clipping path Note: wxPython currently ignores all but the INVISIBLE flag. """ if mode not in (TEXT_FILL, TEXT_STROKE, TEXT_FILL_STROKE, TEXT_INVISIBLE, TEXT_FILL_CLIP, TEXT_STROKE_CLIP, TEXT_FILL_STROKE_CLIP, TEXT_CLIP, TEXT_OUTLINE): msg = ("Invalid text drawing mode. See documentation for valid " + "modes") raise ValueError(msg) self.state.text_drawing_mode = mode def set_text_position(self, x, y): """ """ a, b, c, d, tx, ty = affine.affine_params(self.state.text_matrix) tx, ty = x, y self.state.text_matrix = affine.affine_from_values(a, b, c, d, tx, ty) def get_text_position(self): """ """ a, b, c, d, tx, ty = affine.affine_params(self.state.text_matrix) return tx, ty def set_text_matrix(self, ttm): """ """ self.state.text_matrix = ttm.copy() def get_text_matrix(self): """ """ return self.state.text_matrix.copy() def show_text(self, text): """ Draws text on the device at the current text position. This calls the device dependent device_show_text() method to do all the heavy lifting. It is not clear yet how this should affect the current point. """ self.device_show_text(text) def show_text_tanslate(self, text, dx, dy): """ Draws text at the specified offset. """ x, y = self.get_text_position() self.set_text_position(x+dx, y+dy) self.device_show_text(text) self.set_text_position(x, y) # ------------------------------------------------------------------------ # kiva defaults to drawing text using the freetype rendering engine. # # If you would like to use a systems native text rendering engine, # override this method in the class concrete derived from this one. # ------------------------------------------------------------------------ def device_show_text(self, text): """ Draws text on the device at the current text position. This relies on the FreeType engine to render the text to an array and then calls the device dependent device_show_text() to display the rendered image to the screen. !! antiliasing is turned off until we get alpha blending !! of images figured out. """ # This is not currently implemented in a device-independent way. return def show_glyphs(self): """ """ pass def show_text_at_point(self, text, x, y): """ """ pass def show_glyphs_at_point(self): """ """ pass # ---------------------------------------------------------------- # Painting paths (drawing and filling contours) # ---------------------------------------------------------------- def get_empty_path(self): """ Get an empty CompiledPath instance """ pass def stroke_path(self): self.draw_path(mode=STROKE) def fill_path(self): self.draw_path(mode=FILL) def eof_fill_path(self): self.draw_path(mode=EOF_FILL) def draw_path(self, mode=FILL_STROKE): """ Walks through all the drawing subpaths and draw each element. Each subpath is drawn separately. Parameters ---------- mode Specifies how the subpaths are drawn. The default is FILL_STROKE. The following are valid values. FILL Paint the path using the nonzero winding rule to determine the regions for painting. EOF_FILL Paint the path using the even-odd fill rule. STROKE Draw the outline of the path with the current width, end caps, etc settings. FILL_STROKE First fill the path using the nonzero winding rule, then stroke the path. EOF_FILL_STROKE First fill the path using the even-odd fill method, then stroke the path. """ # --------------------------------------------------------------------- # FILL AND STROKE settings are handled by setting the alpha value of # the line and fill colors to zero (transparent) if stroke or fill # is not needed. # --------------------------------------------------------------------- old_line_alpha = self.state.line_state.line_color[3] old_fill_alpha = self.state.fill_color[3] if mode not in [STROKE, FILL_STROKE, EOF_FILL_STROKE]: self.state.line_state.line_color[3] = 0.0 if mode not in [FILL, EOF_FILL, FILL_STROKE, EOF_FILL_STROKE]: self.state.fill_color[3] = 0.0 self.device_update_line_state() self.device_update_fill_state() for subpath in self.path: # reset the current point for drawing. self.clear_subpath_points() for func, args in subpath: if func == POINT: self.draw_subpath(mode) self.add_point_to_subpath(args) self.first_point = args elif func == LINE: self.add_point_to_subpath(args) elif func == LINES: self.draw_subpath(mode) # add all points in list to subpath. self.add_point_to_subpath(args) self.first_point = args[0] elif func == CLOSE: self.add_point_to_subpath(self.first_point) self.draw_subpath(mode) elif func == RECT: self.draw_subpath(mode) self.device_draw_rect(args[0], args[1], args[2], args[3], mode) elif func in [SCALE_CTM, ROTATE_CTM, TRANSLATE_CTM, CONCAT_CTM, LOAD_CTM]: self.device_transform_device_ctm(func, args) else: print('oops:', func) # finally, draw any remaining paths. self.draw_subpath(mode) # --------------------------------------------------------------------- # reset the alpha values for line and fill values. # --------------------------------------------------------------------- self.state.line_state.line_color[3] = old_line_alpha self.state.fill_color[3] = old_fill_alpha # --------------------------------------------------------------------- # drawing methods always consume the path on Mac OS X. We'll follow # this convention to make implementation there easier. # --------------------------------------------------------------------- self.begin_path() def device_prepare_device_ctm(self): self.device_ctm = affine.affine_identity() def device_transform_device_ctm(self, func, args): """ Default implementation for handling scaling matrices. Many implementations will just use this function. Others, like OpenGL, can benefit from overriding the method and using hardware acceleration. """ if func == SCALE_CTM: self.device_ctm = affine.scale(self.device_ctm, args[0], args[1]) elif func == ROTATE_CTM: self.device_ctm = affine.rotate(self.device_ctm, args[0]) elif func == TRANSLATE_CTM: self.device_ctm = affine.translate(self.device_ctm, args[0], args[1]) elif func == CONCAT_CTM: self.device_ctm = affine.concat(self.device_ctm, args[0]) elif func == LOAD_CTM: self.device_ctm = args[0].copy() def device_draw_rect(self, x, y, sx, sy, mode): """ Default implementation of drawing a rect. """ self._new_subpath() # When rectangles are rotated, they have to be drawn as a polygon # on most devices. We'll need to specialize this on API's that # can handle rotated rects such as Quartz and OpenGL(?). # All transformations are done in the call to lines(). pts = array(((x, y), (x, y+sy), (x+sx, y+sy), (x+sx, y), (x, y))) self.add_point_to_subpath(pts) self.draw_subpath(mode) def stroke_rect(self): """ """ pass def stroke_rect_with_width(self): """ """ pass def fill_rect(self): """ """ pass def fill_rects(self): """ """ pass def clear_rect(self): """ """ pass # ---------------------------------------------------------------- # Subpath point management and drawing routines. # ---------------------------------------------------------------- def add_point_to_subpath(self, pt): self.draw_points.append(pt) def clear_subpath_points(self): self.draw_points = [] def get_subpath_points(self, debug=0): """ Gets the points that are in the current path. The first entry in the draw_points list may actually be an array. If this is true, the other points are converted to an array and concatenated with the first """ if self.draw_points and len(shape(self.draw_points[0])) > 1: first_points = self.draw_points[0] other_points = asarray(self.draw_points[1:]) if len(other_points): pts = concatenate((first_points, other_points), 0) else: pts = first_points else: pts = asarray(self.draw_points) return pts def draw_subpath(self, mode): """ Fills and strokes the point path. After the path is drawn, the subpath point list is cleared and ready for the next subpath. Parameters ---------- mode Specifies how the subpaths are drawn. The default is FILL_STROKE. The following are valid values. FILL Paint the path using the nonzero winding rule to determine the regions for painting. EOF_FILL Paint the path using the even-odd fill rule. STROKE Draw the outline of the path with the current width, end caps, etc settings. FILL_STROKE First fill the path using the nonzero winding rule, then stroke the path. EOF_FILL_STROKE First fill the path using the even-odd fill method, then stroke the path. Note: If path is closed, it is about 50% faster to call DrawPolygon with the correct pen set than it is to call DrawPolygon and DrawLines separately in wxPython. But, because paths can be left open, Polygon can't be called in the general case because it automatically closes the path. We might want a separate check in here and allow devices to specify a faster version if the path is closed. """ pts = self.get_subpath_points() if len(pts) > 1: self.device_fill_points(pts, mode) self.device_stroke_points(pts, mode) self.clear_subpath_points() def get_text_extent(self, textstring): """ Calls device specific text extent method. """ return self.device_get_text_extent(textstring) def device_get_text_extent(self, textstring): return self.device_get_full_text_extent(textstring) def get_full_text_extent(self, textstring): """ Calls device specific text extent method. """ return self.device_get_full_text_extent(textstring) def device_get_full_text_extent(self, textstring): return (0.0, 0.0, 0.0, 0.0) # ------------------------------------------- # Misc functions # ------------------------------------------- def save(self, filename, file_format=None, pil_options=None): """ Save the graphics context to a file """ raise NotImplementedError enthought-chaco2-4.8.1.orig/kiva/_hit_test.cpp0000644000175000017500000001075513233644505020332 0ustar varunvarun#include "_hit_test.h" namespace kiva { // Adapted from: http://www.alienryderflex.com/polygon/ // // The function will return TRUE if the point x,y is inside the // polygon, or FALSE if it is not. If the point x,y is exactly on // the edge of the polygon, then the function may return TRUE or // FALSE. // // Note that division by zero is avoided because the division is // protected by the "if" clause which surrounds it. // // Note: If the test point is on the border of the polygon, this // algorithm will deliver unpredictable results; i.e. the result // may be "inside" or "outside" depending on arbitrary factors // such as how the polygon is oriented with respect to the // coordinate system. inline bool toggle_odd_node(double x, double y, double p1x, double p1y, double p2x, double p2y) { bool toggle = false; if ( ((p1y=y)) || ((p2y=y)) ) { if (p1x + (y-p1y)/(p2y-p1y) * (p2x-p1x) < x) { toggle = true; } } return toggle; } bool point_in_polygon(double x, double y, double* poly_pts, int Npoly_pts) { bool odd_nodes=false; double p1_x, p1_y, p2_x, p2_y; for (int i=0; i y) { if ( is_left( x, y, x1, y1, x2, y2 ) > 0 ) { return 1; } } } else { if (y2 <= y) { if ( is_left( x, y, x1, y1, x2, y2 ) < 0 ) { return -1; } } } return 0; } bool point_in_polygon_winding(double x, double y, double* poly_pts, int Npoly_pts) { int winding_number = 0; double p1_x, p1_y, p2_x, p2_y; for (int i=0; i # ----------------------------------------------------------------------------- import sys from numpy import get_include def configuration(parent_package=None, top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('kiva', parent_package, top_path) config.add_data_dir('tests') config.add_data_files('*.txt') config.add_subpackage('agg') config.add_subpackage('fonttools') config.add_subpackage('fonttools.tests') config.add_subpackage('trait_defs') config.add_subpackage('trait_defs.ui') config.add_subpackage('trait_defs.ui.*') if sys.platform == 'darwin': config.add_subpackage('quartz') config.get_version() ext_sources = ['_cython_speedups.cpp', '_hit_test.cpp'] config.add_extension('_cython_speedups', sources=ext_sources, include_dirs=['.', get_include()]) return config enthought-chaco2-4.8.1.orig/kiva/image.py0000644000175000017500000000320413421603267017266 0ustar varunvarun#------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # some parts copyright 2002 by Space Telescope Science Institute # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! #------------------------------------------------------------------------------ """ This backend supports Kiva drawing into memory buffers. Though this can be used to perform drawing in non-GUI applications, the Image backend is also used by many of the GUI backends to draw into the memory space of the graphics contexts. """ # Soon the Agg subpackage will be renamed for real. For now, just # proxy the imports. from .agg import GraphicsContextArray as GraphicsContext # FontType will be unified with the Kiva FontType soon. from .agg import AggFontType as FontType # GraphicsContextSystem wraps up platform- and toolkit- specific low # level calls with a GraphicsContextArray. Eventually this low-level code # will be moved out of the Agg subpackage, and we won't have be importing # this here. from .agg import GraphicsContextSystem, Image # CompiledPath is an object that can efficiently store paths to be reused # multiple times. from .agg import CompiledPath def font_metrics_provider(): """ Create an object to be used for querying font metrics. """ return GraphicsContext((1, 1)) enthought-chaco2-4.8.1.orig/kiva/api.py0000644000175000017500000000214113233644505016755 0ustar varunvarun# flake8: noqa from .affine import ( affine_identity, affine_from_values, affine_from_scale, affine_from_rotation, affine_from_translation, scale, rotate, translate, concat, invert, is_identity, affine_params, tsr_factor, trs_factor, transform_point, transform_points, IDENTITY ) from .constants import ( NO_DASH, CAP_ROUND, CAP_BUTT, CAP_SQUARE, JOIN_ROUND, JOIN_BEVEL, JOIN_MITER, FILL, EOF_FILL, STROKE, FILL_STROKE, EOF_FILL_STROKE, NORMAL, BOLD, ITALIC, BOLD_ITALIC, DEFAULT, SWISS, ROMAN, MODERN, DECORATIVE, SCRIPT, TELETYPE, TEXT_FILL, TEXT_STROKE, TEXT_FILL_STROKE, TEXT_INVISIBLE, TEXT_FILL_CLIP, TEXT_STROKE_CLIP, TEXT_FILL_STROKE_CLIP, TEXT_CLIP, TEXT_OUTLINE, POINT, LINE, LINES, RECT, CLOSE, CURVE_TO, QUAD_CURVE_TO, ARC, ARC_TO, SCALE_CTM, TRANSLATE_CTM, ROTATE_CTM, CONCAT_CTM, LOAD_CTM, NO_MARKER, SQUARE_MARKER, DIAMOND_MARKER, CIRCLE_MARKER, CROSSED_CIRCLE_MARKER, CROSS_MARKER, TRIANGLE_MARKER, INVERTED_TRIANGLE_MARKER, PLUS_MARKER, DOT_MARKER, PIXEL_MARKER ) from ._cython_speedups import points_in_polygon from .fonttools import Font enthought-chaco2-4.8.1.orig/kiva/trait_defs/0000755000175000017500000000000013544357631017766 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/trait_defs/__init__.py0000644000175000017500000000007713233644505022075 0ustar varunvarun# Copyright (c) 2007 by Enthought, Inc. # All rights reserved. enthought-chaco2-4.8.1.orig/kiva/trait_defs/kiva_font_trait.py0000644000175000017500000001373213421603267023522 0ustar varunvarun#------------------------------------------------------------------------------ # Copyright (c) 2005-2007 by Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! # #------------------------------------------------------------------------------ """ Trait definition for a wxPython-based Kiva font. """ #------------------------------------------------------------------------------- # Imports: #------------------------------------------------------------------------------- from traits.etsconfig.api import ETSConfig if ETSConfig.toolkit == 'wx': from .ui.wx.kiva_font_editor import KivaFontEditor elif ETSConfig.toolkit == 'qt4': # FIXME #from .ui.qt4.kiva_font_editor import KivaFontEditor KivaFontEditor = None else: KivaFontEditor = None from traits.api import Trait, TraitError, TraitHandler, TraitFactory #------------------------------------------------------------------------------- # Convert a string into a valid 'Font' object (if possible): #------------------------------------------------------------------------------- # Strings to ignore in text representations of fonts font_noise = [ 'pt', 'point', 'family' ] font_families = font_styles = font_weights = DEFAULT = NORMAL = None def init_constants ( ): """ Dynamically load Kiva constants to avoid import dependencies. """ global font_families, font_styles, font_weights, default_face, DEFAULT, NORMAL if font_families is not None: return import kiva.constants as kc DEFAULT = kc.DEFAULT NORMAL = kc.NORMAL # Mapping of strings to valid Kiva font families: font_families = { 'default': kc.DEFAULT, 'decorative': kc.DECORATIVE, 'roman': kc.ROMAN, 'script': kc.SCRIPT, 'swiss': kc.SWISS, 'modern': kc.MODERN } # Mapping of strings to Kiva font styles: font_styles = { 'italic': kc.ITALIC } # Mapping of strings to Kiva font weights: font_weights = { 'bold': kc.BOLD } default_face = { kc.SWISS: "Arial", kc.ROMAN: "Times", kc.MODERN: "Courier", kc.SCRIPT: "Zapfino", kc.DECORATIVE: "Zapfino", # need better choice for this } # Strings to ignore in text representations of fonts font_noise = [ 'pt', 'point', 'family' ] #------------------------------------------------------------------------------- # 'TraitKivaFont' class' #------------------------------------------------------------------------------- class TraitKivaFont ( TraitHandler ): """ Ensures that values assigned to a trait attribute are valid font descriptor strings for Kiva fonts; the value actually assigned is the corresponding Kiva font. """ #--------------------------------------------------------------------------- # Validates that the value is a valid font: #--------------------------------------------------------------------------- def validate ( self, object, name, value ): """ Validates that the value is a valid font. """ from kiva.fonttools import Font if isinstance( value, Font ): return value # Make sure all Kiva related data is loaded: init_constants() try: point_size = 10 family = DEFAULT style = NORMAL weight = NORMAL underline = 0 facename = [] for word in value.split(): lword = word.lower() if lword in font_families: family = font_families[ lword ] elif lword in font_styles: style = font_styles[ lword ] elif lword in font_weights: weight = font_weights[ lword ] elif lword == 'underline': underline = 1 elif lword not in font_noise: try: point_size = int( lword ) except: facename.append( word ) if facename == "": facename = default_face.get(family, "") # FIXME: The above if clause never happens, the below should # be correct though it results in loading weird fonts. # if facename == []: # facename = [default_face.get(family, "")] return Font(face_name = " ".join(facename), size = point_size, family = family, weight = weight, style = style, underline = underline) except: pass raise TraitError( object, name, 'a font descriptor string', repr( value ) ) def info ( self ): return ( "a string describing a font (e.g. '12 pt bold italic " "swiss family Arial' or 'default 12')" ) fh = TraitKivaFont() if KivaFontEditor is not None: KivaFontTrait = Trait(fh.validate(None, None, 'modern 12'), fh, editor = KivaFontEditor) else: KivaFontTrait = Trait(fh.validate(None, None, 'modern 12'), fh) def KivaFontFunc ( *args, **metadata ): """ Returns a trait whose value must be a GUI toolkit-specific font. Description ----------- For wxPython, the returned trait accepts any of the following: * an kiva.fonttools.Font instance * a string describing the font, including one or more of the font family, size, weight, style, and typeface name. Default Value ------------- For wxPython, 'Arial 10' """ return KivaFontTrait( *args, **metadata ) KivaFont = TraitFactory( KivaFontFunc ) enthought-chaco2-4.8.1.orig/kiva/trait_defs/api.py0000644000175000017500000000004613233644505021103 0ustar varunvarunfrom .kiva_font_trait import KivaFont enthought-chaco2-4.8.1.orig/kiva/trait_defs/ui/0000755000175000017500000000000013544357631020403 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/trait_defs/ui/__init__.py0000644000175000017500000000007713233644505022512 0ustar varunvarun# Copyright (c) 2007 by Enthought, Inc. # All rights reserved. enthought-chaco2-4.8.1.orig/kiva/trait_defs/ui/wx/0000755000175000017500000000000013544357631021041 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/trait_defs/ui/wx/__init__.py0000644000175000017500000000007713233644505023150 0ustar varunvarun# Copyright (c) 2007 by Enthought, Inc. # All rights reserved. enthought-chaco2-4.8.1.orig/kiva/trait_defs/ui/wx/kiva_font_editor.py0000644000175000017500000001220513421603267024732 0ustar varunvarun#------------------------------------------------------------------------------ # Copyright (c) 2005-2007 by Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! # #------------------------------------------------------------------------------ """ Defines the font editor factory for Kiva fonts, for the wxPython user interface toolkit. """ #------------------------------------------------------------------------------- # Imports: #------------------------------------------------------------------------------- import wx from traits.trait_base \ import SequenceTypes from traitsui.wx.font_editor \ import ToolkitEditorFactory as EditorFactory from kiva.fonttools.font_manager import fontManager #------------------------------------------------------------------------------- # 'ToolkitEditorFactory' class: #------------------------------------------------------------------------------- class ToolkitEditorFactory ( EditorFactory ): """ wxPython editor factory for Kiva fonts. """ #--------------------------------------------------------------------------- # Returns a Font's 'face name': #--------------------------------------------------------------------------- def face_name ( self, font ): """ Returns a Font's typeface name. """ face_name = font.face_name if type( face_name ) in SequenceTypes: face_name = face_name[0] return face_name #--------------------------------------------------------------------------- # Returns a wxFont object corresponding to a specified object's font trait: #--------------------------------------------------------------------------- def to_wx_font ( self, editor ): """ Returns a wxFont object corresponding to a specified object's font trait. """ import kiva.constants as kc font = editor.value weight = ( wx.NORMAL, wx.BOLD )[ font.weight == kc.BOLD ] style = ( wx.NORMAL, wx.ITALIC )[ font.style == kc.ITALIC ] family = { kc.DEFAULT: wx.DEFAULT, kc.DECORATIVE: wx.DECORATIVE, kc.ROMAN: wx.ROMAN, kc.SCRIPT: wx.SCRIPT, kc.SWISS: wx.SWISS, kc.MODERN: wx.MODERN }.get( font.family, wx.SWISS ) return wx.Font( font.size, family, style, weight, (font.underline != 0), self.face_name( font ) ) #--------------------------------------------------------------------------- # Gets the application equivalent of a wxPython value: #--------------------------------------------------------------------------- def from_wx_font ( self, font ): """ Gets the application equivalent of a wxPython value. """ import kiva.constants as kc from kiva.fonttools import Font return Font( size = font.GetPointSize(), family = { wx.DEFAULT: kc.DEFAULT, wx.DECORATIVE: kc.DECORATIVE, wx.ROMAN: kc.ROMAN, wx.SCRIPT: kc.SCRIPT, wx.SWISS: kc.SWISS, wx.MODERN: kc.MODERN }.get( font.GetFamily(), kc.SWISS ), weight = ( kc.NORMAL, kc.BOLD )[ font.GetWeight() == wx.BOLD ], style = ( kc.NORMAL, kc.ITALIC )[ font.GetStyle() == wx.ITALIC ], underline = font.GetUnderlined() - 0, #convert Bool to an int type face_name = font.GetFaceName() ) #--------------------------------------------------------------------------- # Returns the text representation of the specified object trait value: #--------------------------------------------------------------------------- def str_font ( self, font ): """ Returns the text representation of the specified object trait value. """ import kiva.constants as kc weight = { kc.BOLD: ' Bold' }.get( font.weight, '' ) style = { kc.ITALIC: ' Italic' }.get( font.style, '' ) underline = [ '', ' Underline' ][ font.underline != 0 ] return '%s point %s%s%s%s' % ( font.size, self.face_name( font ), style, weight, underline ) #--------------------------------------------------------------------------- # Returns a list of all available font facenames: #--------------------------------------------------------------------------- def all_facenames ( self ): """ Returns a list of all available font typeface names. """ facenames = list(fontManager.ttfdict.keys()) return facenames def KivaFontEditor (*args, **traits): return ToolkitEditorFactory (*args, **traits) enthought-chaco2-4.8.1.orig/kiva/gl.py0000644000175000017500000003647113421603267016622 0ustar varunvarun from __future__ import absolute_import, print_function # Major library imports import ctypes from math import floor from numpy import array, ndarray # Pyglet and pyglet-related imports # Before we import anything else from pyglet, we need to set the shadow_window # option to False, so that it does not conflict with WX, in case someone is # trying to use the kiva GL GraphicsContext from within WX. # This is necessary as of pyglet 1.1. import pyglet pyglet.options['shadow_window'] = False from pyglet.text import Label from pyglet.font import load as load_font from pyglet.font.base import Font as PygletFont from pyglet import gl from pygarrayimage.arrayimage import ArrayInterfaceImage # Local kiva imports from .affine import affine_from_values, transform_points from .agg import GraphicsContextGL as _GCL from .agg import AggFontType from .agg import CompiledPath from .constants import BOLD, BOLD_ITALIC, ITALIC from .fonttools import Font class ArrayImage(ArrayInterfaceImage): """ pyglet ImageData made from numpy arrays. Customized from pygarrayimage's ArrayInterfaceImage to override the texture creation. """ def create_texture(self, cls, rectangle=False, force_rectangle=False): '''Create a texture containing this image. If the image's dimensions are not powers of 2, a TextureRegion of a larger Texture will be returned that matches the dimensions of this image. :Parameters: `cls` : class (subclass of Texture) Class to construct. `rectangle` : bool ``True`` if a rectangle can be created; see `AbstractImage.get_texture`. :rtype: cls or cls.region_class ''' _is_pow2 = lambda v: (v & (v - 1)) == 0 target = gl.GL_TEXTURE_2D if rectangle and not (_is_pow2(self.width) and _is_pow2(self.height)): if gl.gl_info.have_extension('GL_ARB_texture_rectangle'): target = gl.GL_TEXTURE_RECTANGLE_ARB elif gl.gl_info.have_extension('GL_NV_texture_rectangle'): target = gl.GL_TEXTURE_RECTANGLE_NV texture = cls.create_for_size(target, self.width, self.height) subimage = False if texture.width != self.width or texture.height != self.height: texture = texture.get_region(0, 0, self.width, self.height) subimage = True internalformat = self._get_internalformat(self.format) gl.glBindTexture(texture.target, texture.id) gl.glTexParameteri(texture.target, gl.GL_TEXTURE_WRAP_S, gl.GL_CLAMP_TO_EDGE) gl.glTexParameteri(texture.target, gl.GL_TEXTURE_WRAP_T, gl.GL_CLAMP_TO_EDGE) gl.glTexParameteri(texture.target, gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR) gl.glTexParameteri(texture.target, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR) if subimage: width = texture.owner.width height = texture.owner.height blank = (ctypes.c_ubyte * (width * height * 4))() gl.glTexImage2D(texture.target, texture.level, internalformat, width, height, 1, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, blank) internalformat = None self.blit_to_texture(texture.target, texture.level, 0, 0, 0, internalformat) return texture def blit_to_texture(self, target, level, x, y, z, internalformat=None): '''Draw this image to to the currently bound texture at `target`. If `internalformat` is specified, glTexImage is used to initialise the texture; otherwise, glTexSubImage is used to update a region. ''' data_format = self.format data_pitch = abs(self._current_pitch) # Determine pixel format from format string matrix = None format, type = self._get_gl_format_and_type(data_format) if format is None: if (len(data_format) in (3, 4) and gl.gl_info.have_extension('GL_ARB_imaging')): # Construct a color matrix to convert to GL_RGBA def component_column(component): try: pos = 'RGBA'.index(component) return [0] * pos + [1] + [0] * (3 - pos) except ValueError: return [0, 0, 0, 0] # pad to avoid index exceptions lookup_format = data_format + 'XXX' matrix = (component_column(lookup_format[0]) + component_column(lookup_format[1]) + component_column(lookup_format[2]) + component_column(lookup_format[3])) format = { 3: gl.GL_RGB, 4: gl.GL_RGBA}.get(len(data_format)) type = gl.GL_UNSIGNED_BYTE gl.glMatrixMode(gl.GL_COLOR) gl.glPushMatrix() gl.glLoadMatrixf((gl.GLfloat * 16)(*matrix)) else: # Need to convert data to a standard form data_format = { 1: 'L', 2: 'LA', 3: 'RGB', 4: 'RGBA'}.get(len(data_format)) format, type = self._get_gl_format_and_type(data_format) # Workaround: don't use GL_UNPACK_ROW_LENGTH if gl.current_context._workaround_unpack_row_length: data_pitch = self.width * len(data_format) # Get data in required format (hopefully will be the same format it's # already in, unless that's an obscure format, upside-down or the # driver is old). data = self._convert(data_format, data_pitch) if data_pitch & 0x1: alignment = 1 elif data_pitch & 0x2: alignment = 2 else: alignment = 4 row_length = data_pitch / len(data_format) gl.glPushClientAttrib(gl.GL_CLIENT_PIXEL_STORE_BIT) gl.glPixelStorei(gl.GL_UNPACK_ALIGNMENT, alignment) gl.glPixelStorei(gl.GL_UNPACK_ROW_LENGTH, row_length) self._apply_region_unpack() gl.glTexParameteri(target, gl.GL_TEXTURE_WRAP_S, gl.GL_CLAMP_TO_EDGE) gl.glTexParameteri(target, gl.GL_TEXTURE_WRAP_T, gl.GL_CLAMP_TO_EDGE) gl.glTexParameteri(target, gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR) gl.glTexParameteri(target, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR) if target == gl.GL_TEXTURE_3D: assert not internalformat gl.glTexSubImage3D(target, level, x, y, z, self.width, self.height, 1, format, type, data) elif internalformat: gl.glTexImage2D(target, level, internalformat, self.width, self.height, 0, format, type, data) else: gl.glTexSubImage2D(target, level, x, y, self.width, self.height, format, type, data) gl.glPopClientAttrib() if matrix: gl.glPopMatrix() gl.glMatrixMode(gl.GL_MODELVIEW) def image_as_array(img): """ Adapt an image object into a numpy array. Typically, this is used to adapt an agg GraphicsContextArray which has been used for image storage in Kiva applications. """ if hasattr(img, 'bmp_array'): # Yup, a GraphicsContextArray. return img.bmp_array elif isinstance(img, ndarray): return img else: msg = "can't convert %r into a numpy array" % (img,) raise NotImplementedError(msg) def get_dpi(): """ Returns the appropriate DPI setting for the system""" pass class MRU(dict): def __init__(self, *args, **kw): # An ordering of keys in self; the last item was the most recently used self.__order__ = [] self.__maxlength__ = 30 dict.__init__(self, *args, **kw) def __getitem__(self, key): val = dict.__getitem__(self, key) # If we get here, then key was found in our dict self.__touch__(key) return val def __setitem__(self, key, value): dict.__setitem__(self, key, value) self.__touch__(key) def __delitem__(self, key): dict.__delitem__(self, key) if key in self.__order__: self.__order__.remove(key) def __touch__(self, key): """ Puts **key** as the most recently used item """ if len(self.__order__) == 0: self.__order__.append(key) if (len(self.__order__) == self.__maxlength__) and \ key not in self.__order__: # The MRU is full, so pop the oldest element del self[self.__order__[0]] if key != self.__order__[-1]: try: ndx = self.__order__.index(key) self.__order__[ndx:-1] = self.__order__[ndx+1:] self.__order__[-1] = key except ValueError: # new key that's not already in the cache if len(self.__order__) == self.__maxlength__: self.__order__ = self.__order__[1:] + [key] else: self.__order__.append(key) return # Use a singleton for the font cache GlobalFontCache = MRU() def GetFont(font): """ Returns a Pylget Font object for the given Agg or Kiva font """ if isinstance(font, PygletFont): pyglet_font = font else: # AggFontType key = (font.name, font.size, font.family, font.style) if key not in GlobalFontCache: if isinstance(font, AggFontType): agg_font = font font = Font(face_name=agg_font.name, size=agg_font.size, family=agg_font.family, style=agg_font.style) bold = False italic = False if font.style in [BOLD, BOLD_ITALIC] or font.weight == BOLD: bold = True if font.style in [ITALIC, BOLD_ITALIC]: italic = True pyglet_font = load_font(font.findfontname(), font.size, bold, italic) GlobalFontCache[key] = pyglet_font else: pyglet_font = GlobalFontCache[key] return pyglet_font # Because Pyglet 1.1 uses persistent Label objects to efficiently lay # out and render text, we cache these globally to minimize the creation # time. An MRU is not really the right structure to use here, though. # (We typically expect that the same numbers of labels will be rendered.) GlobalTextCache = MRU() GlobalTextCache.__maxlength__ = 100 def GetLabel(text, pyglet_font): """ Returns a Pyglet Label object for the given text and font """ key = (text, pyglet_font) if key not in GlobalTextCache: # Use anchor_y="bottom" because by default, pyglet sets the baseline to # the y coordinate given. Unfortunately, it doesn't expose a per-Text # descent (only a per-Font descent), so it's impossible to know how to # offset the y value properly for a given string. label = Label(text, font_name=pyglet_font.name, font_size=pyglet_font.size, anchor_y="bottom") GlobalTextCache[key] = label else: label = GlobalTextCache[key] return label class GraphicsContext(_GCL): def __init__(self, size, *args, **kw): # Ignore the pix_format argument for now if "pix_format" in kw: kw.pop("pix_format") _GCL.__init__(self, size[0], size[1], *args, **kw) self.corner_pixel_origin = True self._font_stack = [] self._current_font = None def save_state(self): super(GraphicsContext, self).save_state() self._font_stack.append(self._current_font) def restore_state(self): super(GraphicsContext, self).restore_state() self._current_font = self._font_stack.pop() def set_font(self, font): super(GraphicsContext, self).set_font(font) self._current_font = font def get_text_extent(self, text): if self._current_font is None: return (0, 0, 0, 0) pyglet_font = GetFont(self._current_font) label = GetLabel(text, pyglet_font) return (0, 0, label.content_width, label.content_height) def show_text(self, text, point=None): if point is None: point = (0, 0) return self.show_text_at_point(text, *point) def show_text_at_point(self, text, x, y): if self._current_font is None: return pyglet_font = GetFont(self._current_font) label = GetLabel(text, pyglet_font) xform = self.get_ctm() x0 = xform[4] y0 = xform[5] # The GL backend places the center of a pixel at (0.5, 0.5); however, # for show_text_at_point, we don't actually want to render the text # offset by half a pixel. There is probably a better, more uniform way # to handle this across all of Kiva, because this is probably a common # issue that will arise, but for now, we just round the position down. x = floor(x + x0) y = floor(y + y0) label.x = x label.y = y c = self.get_fill_color() label.color = (int(c[0]*255), int(c[1]*255), int(c[2]*255), int(c[3]*255)) label.draw() return True def linear_gradient(self, x1, y1, x2, y2, stops, spread_method, units='userSpaceOnUse'): """ Not implemented. """ pass def radial_gradient(self, cx, cy, r, fx, fy, stops, spread_method, units='userSpaceOnUse'): """ Not implemented. """ pass def draw_image(self, img, rect=None, force_copy=False): """ Renders a GraphicsContextArray into this GC """ xform = self.get_ctm() image = image_as_array(img) shape = image.shape if shape[2] == 4: fmt = "RGBA" else: fmt = "RGB" aii = ArrayImage(image, format=fmt) texture = aii.texture # The texture coords consists of (u,v,r) for each corner of the # texture rectangle. The coordinates are stored in the order # bottom left, bottom right, top right, top left. x, y, w, h = rect texture.width = w texture.height = h t = texture.tex_coords points = array([ [x, y+h], [x+w, y+h], [x+w, y], [x, y], ]) p = transform_points(affine_from_values(*xform), points) a = (gl.GLfloat*32)( t[0], t[1], t[2], 1., p[0, 0], p[0, 1], 0, 1., t[3], t[4], t[5], 1., p[1, 0], p[1, 1], 0, 1., t[6], t[7], t[8], 1., p[2, 0], p[2, 1], 0, 1., t[9], t[10], t[11], 1., p[3, 0], p[3, 1], 0, 1., ) gl.glPushAttrib(gl.GL_ENABLE_BIT) gl.glEnable(texture.target) gl.glBindTexture(texture.target, texture.id) gl.glPushClientAttrib(gl.GL_CLIENT_VERTEX_ARRAY_BIT) gl.glInterleavedArrays(gl.GL_T4F_V4F, 0, a) gl.glDrawArrays(gl.GL_QUADS, 0, 4) gl.glPopClientAttrib() gl.glPopAttrib() def font_metrics_provider(): return GraphicsContext((1, 1)) enthought-chaco2-4.8.1.orig/kiva/ps.py0000644000175000017500000002751613421603267016642 0ustar varunvarun#------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! #------------------------------------------------------------------------------ """ Chaco's PostScript (PS/EPSF) backend :Copyright: ActiveState :License: BSD Style :Author: David Ascher (davida@activestate.com) :Version: $Revision: 1.2 $ """ from __future__ import print_function # Major library imports import os import sys import warnings import six from numpy import arange, ravel, array # Local, relative Kiva imports from . import affine from . import basecore2d from . import constants from .constants import ( FILL_STROKE, EOF_FILL_STROKE, FILL, STROKE, EOF_FILL, LOAD_CTM, CONCAT_CTM, SCALE_CTM, ROTATE_CTM, TRANSLATE_CTM ) from . import agg # This backend does not have compiled paths, yet. CompiledPath = None try: import logging import tempfile _logfile = os.path.join(tempfile.gettempdir(), "kivaps.log") hdlr = logging.FileHandler(_logfile) BASIC_FORMAT = "%(levelname)s: %(name)s: %(message)s" fmt = logging.Formatter(BASIC_FORMAT) hdlr.setFormatter(fmt) logging.root.addHandler(hdlr) log = logging.getLogger('') log.setLevel(logging.INFO) except ImportError: class FakeLogger: def debug(self, message): print("DEBUG:", message, file=sys.stderr) def info(self, message): print("INFO:", message, file=sys.stderr) def warn(self, message): print("WARN:", message, file=sys.stderr) def error(self, message): print("ERROR:", message, file=sys.stderr) def critical(self, message): print("CRITICAL:", message, file=sys.stderr) log = FakeLogger() def _strpoints(points): c = six.StringIO() for x,y in points: c.write('%3.2f,%3.2f ' % (x,y)) return c.getvalue() def _mkstyle(kw): return '"' + '; '.join([str(k) + ':' + str(v) for k,v in kw.items()]) +'"' def default_filter(kw1): kw = {} for (k,v) in kw1.items(): if type(v) == type(()): if v[0] != v[1]: kw[k] = v[0] else: kw[k] = v return kw line_cap_map = { constants.CAP_BUTT: 0, constants.CAP_ROUND: 1, constants.CAP_SQUARE: 2, } line_join_map = { constants.JOIN_MITER: 0, constants.JOIN_ROUND: 1, constants.JOIN_BEVEL: 2, } font_map = {'Arial': 'Helvetica'} try: # reportlab supports more fonts import reportlab.pdfbase.pdfmetrics as pdfmetrics import reportlab.pdfbase._fontdata as _fontdata _reportlab_loaded = 1 except ImportError: # we support the basic 14 from . import _fontdata from . import pdfmetrics _reportlab_loaded = 0 font_face_map = {'Arial': 'Helvetica', '': 'Helvetica'} _clip_counter = 0 fill_stroke_map = {FILL_STROKE: ('fill', 'stroke'), EOF_FILL_STROKE: ('eofill', 'stroke'), FILL: ('fill', None), STROKE: ('stroke', None), EOF_FILL: ('eofill', None) } class PSGC(basecore2d.GraphicsContextBase): def __init__(self, size, *args, **kwargs): super(PSGC, self).__init__(size, *args, **kwargs) self.size = size self._height = size[1] self.contents = six.StringIO() self._clipmap = {} self.clip_id = None def clear(self): self.contents = six.StringIO() def width(self): return self.size[0] def height(self): return self.size[1] def save(self, filename): f = open(filename, 'w') ext = os.path.splitext(filename)[1] if ext in ('.eps', '.epsf'): f.write("%!PS-Adobe-3.0 EPSF-3.0\n") f.write('%%%%BoundingBox: 0 0 %d %d\n' % self.size) f.write(self.contents.getvalue()) elif ext == '.ps': f.write("%!PS-Adobe-2.0\n") f.write(self.contents.getvalue()) else: raise ValueError("don't know how to write a %s file" % ext) # Text handling code def set_font(self, font): self.face_name = font_face_map.get(font.face_name, font.face_name) self.font = pdfmetrics.Font(self.face_name, self.face_name, pdfmetrics.defaultEncoding) self.font_size = font.size self.contents.write("""/%s findfont %3.3f scalefont setfont\n""" % (self.face_name, self.font_size)) def device_show_text(self, text): ttm = self.get_text_matrix() ctm = self.get_ctm() # not device_ctm!! m = affine.concat(ctm,ttm) if self.state.clipping_path: self.contents.write('clipsave\n') self.contents.write('%3.3f %3.3f %3.3f %3.3f rectclip\n' % self.state.clipping_path) self.contents.write('gsave\n') self.device_transform_device_ctm(LOAD_CTM, [m]) self.contents.write('%3.3f %3.3f moveto\n' % (0,0)) r,g,b,a = self.state.line_color self.contents.write('%1.3f %1.3f %1.3f setrgbcolor\n' % (r,g,b) ) self.contents.write('(%s) show\n' % text) self.contents.write('grestore\n') if self.state.clipping_path: self.contents.write('cliprestore\n') def get_full_text_extent(self, text): ascent,descent=_fontdata.ascent_descent[self.face_name] descent = (-descent) * self.font_size / 1000.0 ascent = ascent * self.font_size / 1000.0 height = ascent + descent width = pdfmetrics.stringWidth(text, self.face_name, self.font_size) return width, height, descent, height*1.2 # assume leading of 1.2*height # actual implementation =) def device_draw_image(self, img, rect): """ draw_image(img_gc, rect=(x,y,w,h)) Draws another gc into this one. If 'rect' is not provided, then the image gc is drawn into this one, rooted at (0,0) and at full pixel size. If 'rect' is provided, then the image is resized into the (w,h) given and drawn into this GC at point (x,y). img_gc is either a Numeric array (WxHx3 or WxHx4) or a GC from Kiva's Agg backend (kiva.agg.GraphicsContextArray). Requires the Python Imaging Library (PIL). """ from kiva.compat import pilfromstring, piltostring, Image as PilImage if type(img) == type(array([])): # Numeric array converted_img = agg.GraphicsContextArray(img, pix_format='rgba32') format = 'RGBA' elif isinstance(img, agg.GraphicsContextArray): if img.format().startswith('RGBA'): format = 'RGBA' elif img.format().startswith('RGB'): format = 'RGB' else: converted_img = img.convert_pixel_format('rgba32', inplace=0) format = 'RGBA' # Should probably take this into account # interp = img.get_image_interpolation() else: warnings.warn("Cannot render image of type %r into EPS context." % type(img)) return # converted_img now holds an Agg graphics context with the image pil_img = pilfromstring(format, (converted_img.width(), converted_img.height()), piltostring(converted_img.bmp_array)) if rect == None: rect = (0, 0, img.width(), img.height()) # PIL PS output doesn't support alpha. if format != 'RGB': pil_img = pil_img.convert('RGB') left, top, width, height = rect if width != img.width() or height != img.height(): # This is not strictly required. pil_img = pil_img.resize((int(width), int(height)), PilImage.NEAREST) self.contents.write('gsave\n') self.contents.write('initmatrix\n') m = self.get_ctm() self.contents.write('[%.3f %.3f %.3f %.3f %.3f %.3f] concat\n' % \ affine.affine_params(m)) self.contents.write('%.3f %.3f translate\n' % (left, top)) # Rely on PIL's EpsImagePlugin to do the hard work here. pil_img.save(self.contents, 'eps', eps=0) self.contents.write('grestore\n') def device_transform_device_ctm(self,func,args): if func == LOAD_CTM: self.contents.write('initmatrix\n') func = CONCAT_CTM if func == SCALE_CTM: sx, sy = args self.contents.write('%.3f %.3f scale\n' % (sx, sy)) elif func == ROTATE_CTM: r, = args self.contents.write('%.3f rotate\n' % r) elif func == TRANSLATE_CTM: tx, ty = args self.contents.write('%.3f %.3f translate\n' % (tx, ty)) elif func == CONCAT_CTM: m, = args self.contents.write('[%.3f %.3f %.3f %.3f %.3f %.3f] concat\n' % \ affine.affine_params(m)) def device_fill_points(self, points, mode): if self.state.clipping_path: self.contents.write('clipsave\n') self.contents.write('%3.3f %3.3f %3.3f %3.3f rectclip\n' % self.state.clipping_path) linecap = line_cap_map[self.state.line_cap] linejoin = line_join_map[self.state.line_join] dasharray = self._dasharray() if dasharray: self.contents.write('%s 0 setdash\n' % dasharray) self.contents.write('%3.3f setlinewidth\n' % self.state.line_width) self.contents.write('%d setlinecap\n' % linecap) self.contents.write('%d setlinejoin\n' % linejoin) self.contents.write('newpath\n') x,y = points[0] self.contents.write(' %3.3f %3.3f moveto\n' % (x,y)) for (x,y) in points[1:]: self.contents.write(' %3.3f %3.3f lineto\n' % (x,y)) first_pass, second_pass = fill_stroke_map[mode] if second_pass: if first_pass in ('fill', 'eofill'): r,g,b,a = self.state.fill_color self.contents.write('%1.3f %1.3f %1.3f setrgbcolor\n' % (r,g,b) ) else: r,g,b,a = self.state.line_color self.contents.write('%1.3f %1.3f %1.3f setrgbcolor\n' % (r,g,b) ) self.contents.write('gsave %s grestore %s\n' % (first_pass, second_pass)) else: if first_pass in ('fill', 'eofill'): r,g,b,a = self.state.fill_color self.contents.write('%1.3f %1.3f %1.3f setrgbcolor\n' % (r,g,b) ) else: r,g,b,a = self.state.line_color self.contents.write('%1.3f %1.3f %1.3f setrgbcolor\n' % (r,g,b) ) self.contents.write(first_pass + '\n') if self.state.clipping_path: self.contents.write('cliprestore\n') def device_stroke_points(self, points, mode): # handled by device_fill_points pass def device_set_clipping_path(self, x, y, width, height): pass def device_destroy_clipping_path(self): pass # utility routines def _color(self, color): r,g,b,a = color return '#%02x%02x%02x' % (r*255,g*255,b*255) def _dasharray(self): dasharray = '' for x in self.state.line_dash: if type(x) == type(arange(3)): # why is this so hard? x = ravel(x)[0] dasharray += ' ' + '%3.2f' % x if not dasharray or dasharray == " 0.00 0.00": return '[]' return '[ ' + dasharray + ' ]' # noops which seem to be needed def device_update_line_state(self): pass def device_update_fill_state(self): pass enthought-chaco2-4.8.1.orig/kiva/fonttools/0000755000175000017500000000000013544357630017670 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/fonttools/afm.py0000644000175000017500000002705013421603267021003 0ustar varunvarun""" This is a python interface to Adobe Font Metrics Files. Although a number of other python implementations exist (and may be more complete than mine) I decided not to go with them because either they were either 1) copyighted or used a non-BSD compatible license 2) had too many dependencies and I wanted a free standing lib 3) Did more than I needed and it was easier to write my own than figure out how to just get what I needed from theirs It is pretty easy to use, and requires only built-in python libs >>> from afm import AFM >>> fh = file('ptmr8a.afm') >>> afm = AFM(fh) >>> afm.string_width_height('What the heck?') (6220.0, 683) >>> afm.get_fontname() 'Times-Roman' >>> afm.get_kern_dist('A', 'f') 0 >>> afm.get_kern_dist('A', 'y') -92.0 >>> afm.get_bbox_char('!') [130, -9, 238, 676] >>> afm.get_bbox_font() [-168, -218, 1000, 898] AUTHOR: John D. Hunter """ from __future__ import absolute_import, print_function import os import logging logger = logging.getLogger(__name__) # Convert value to a python type _to_int = int _to_float = float _to_str = str def _to_list_of_ints(s): s = s.replace(',', ' ') return [_to_int(val) for val in s.split()] def _to_list_of_floats(s): return [_to_float(val) for val in s.split()] def _to_bool(s): return s.lower().strip() in ('false', '0', 'no') def _parse_header(fh): """ Reads the font metrics header (up to the char metrics) and returns a dictionary mapping key to val. val will be converted to the appropriate python type as necessary; eg 'False'->False, '0'->0, '-168 -218 1000 898'-> [-168, -218, 1000, 898] Dictionary keys are StartFontMetrics, FontName, FullName, FamilyName, Weight, ItalicAngle, IsFixedPitch, FontBBox, UnderlinePosition, UnderlineThickness, Version, Notice, EncodingScheme, CapHeight, XHeight, Ascender, Descender, StartCharMetrics """ headerConverters = { 'StartFontMetrics': _to_float, 'FontName': _to_str, 'FullName': _to_str, 'FamilyName': _to_str, 'Weight': _to_str, 'ItalicAngle': _to_float, 'IsFixedPitch': _to_bool, 'FontBBox': _to_list_of_ints, 'UnderlinePosition': _to_int, 'UnderlineThickness': _to_int, 'Version': _to_str, 'Notice': _to_str, 'EncodingScheme': _to_str, 'CapHeight': _to_float, 'XHeight': _to_float, 'Ascender': _to_float, 'Descender': _to_float, 'StartCharMetrics': _to_int, 'Characters': _to_int, 'Capheight': _to_int, } d = {} while True: line = fh.readline() if not line: break line = line.rstrip() if line.startswith('Comment'): continue lst = line.split(' ', 1) key = lst[0] if len(lst) == 2: val = lst[1] else: val = '' try: d[key] = headerConverters[key](val) except ValueError: msg = 'Value error parsing header in AFM: {} {}'.format(key, val) logger.error(msg) continue except KeyError: logging.error('Key error converting in AFM') continue if key == 'StartCharMetrics': return d raise RuntimeError('Bad parse') def _parse_char_metrics(fh): """ Return a character metric dictionary. Keys are the ASCII num of the character, values are a (wx, name, bbox) tuple, where wx is the character width name is the postscript language name bbox (llx, lly, urx, ury) This function is incomplete per the standard, but thus far parse all the sample afm files I have """ d = {} while 1: line = fh.readline() if not line: break line = line.rstrip() if line.startswith('EndCharMetrics'): return d vals = line.split(';')[:4] if len(vals) != 4: raise RuntimeError('Bad char metrics line: %s' % line) num = _to_int(vals[0].split()[1]) if num == -1: continue wx = _to_float(vals[1].split()[1]) name = vals[2].split()[1] bbox = _to_list_of_ints(vals[3][2:]) d[num] = (wx, name, bbox) raise RuntimeError('Bad parse') def _parse_kern_pairs(fh): """ Return a kern pairs dictionary; keys are (char1, char2) tuples and values are the kern pair value. For example, a kern pairs line like KPX A y -50 will be represented as d[ ('A', 'y') ] = -50 """ line = fh.readline() if not line.startswith('StartKernPairs'): raise RuntimeError('Bad start of kern pairs data: %s' % line) d = {} while 1: line = fh.readline() if not line: break line = line.rstrip() if len(line) == 0: continue if line.startswith('EndKernPairs'): fh.readline() # EndKernData return d vals = line.split() if len(vals) != 4 or vals[0] != 'KPX': raise RuntimeError('Bad kern pairs line: %s' % line) c1, c2, val = vals[1], vals[2], _to_float(vals[3]) d[(c1, c2)] = val raise RuntimeError('Bad kern pairs parse') def _parse_composites(fh): """ Return a composites dictionary. Keys are the names of the composites. vals are a num parts list of composite information, with each element being a (name, dx, dy) tuple. Thus if a composites line reading: CC Aacute 2 ; PCC A 0 0 ; PCC acute 160 170 ; will be represented as d['Aacute'] = [ ('A', 0, 0), ('acute', 160, 170) ] """ d = {} while 1: line = fh.readline() if not line: break line = line.rstrip() if len(line) == 0: continue if line.startswith('EndComposites'): return d vals = line.split(';') cc = vals[0].split() name = cc[1] pccParts = [] for s in vals[1:-1]: pcc = s.split() name, dx, dy = pcc[1], _to_float(pcc[2]), _to_float(pcc[3]) pccParts.append((name, dx, dy)) d[name] = pccParts raise RuntimeError('Bad composites parse') def _parse_optional(fh): """ Parse the optional fields for kern pair data and composites return value is a kernDict, compositeDict which are the return values from parse_kern_pairs, and parse_composites if the data exists, or empty dicts otherwise """ optional = { 'StartKernData': _parse_kern_pairs, 'StartComposites': _parse_composites, } d = {'StartKernData': {}, 'StartComposites': {}} while 1: line = fh.readline() if not line: break line = line.rstrip() if len(line) == 0: continue key = line.split()[0] if key in optional: d[key] = optional[key](fh) l = (d['StartKernData'], d['StartComposites']) return l def parse_afm(fh): """ Parse the Adobe Font Metics file in file handle fh Return value is a (dhead, dcmetrics, dkernpairs, dcomposite) tuple where dhead : a parse_header dict dcmetrics : a parse_composites dict dkernpairs : a parse_kern_pairs dict, possibly {} dcomposite : a parse_composites dict , possibly {} """ dhead = _parse_header(fh) dcmetrics = _parse_char_metrics(fh) doptional = _parse_optional(fh) return dhead, dcmetrics, doptional[0], doptional[1] class AFM(object): def __init__(self, fh): """ Parse the AFM file in file object fh """ (dhead, dcmetrics, dkernpairs, dcomposite) = parse_afm(fh) self._header = dhead self._kern = dkernpairs self._metrics = dcmetrics self._composite = dcomposite def get_bbox_char(self, c, isord=False): if not isord: c = ord(c) wx, name, bbox = self._metrics[c] return bbox def string_width_height(self, s): """ Return the string width (including kerning) and string height as a w,h tuple """ if not len(s): return (0, 0) totalw = 0 namelast = None miny = 1e9 maxy = 0 for c in s: if c == '\n': continue wx, name, bbox = self._metrics[ord(c)] l, b, w, h = bbox # find the width with kerning try: kp = self._kern[(namelast, name)] except KeyError: kp = 0 totalw += wx + kp # find the max y thismax = b+h if thismax > maxy: maxy = thismax # find the min y thismin = b if thismin < miny: miny = thismin return totalw, maxy-miny def get_str_bbox(self, s): """ Return the string bounding box """ if not len(s): return (0, 0, 0, 0) totalw = 0 namelast = None miny = 1e9 maxy = 0 left = 0 for c in s: if c == '\n': continue wx, name, bbox = self._metrics[ord(c)] l, b, w, h = bbox if l < left: left = l # find the width with kerning try: kp = self._kern[(namelast, name)] except KeyError: kp = 0 totalw += wx + kp # find the max y thismax = b+h if thismax > maxy: maxy = thismax # find the min y thismin = b if thismin < miny: miny = thismin return left, miny, totalw, maxy-miny def get_name_char(self, c): """ Get the name of the character, ie, ';' is 'semicolon' """ wx, name, bbox = self._metrics[ord(c)] return name def get_width_char(self, c, isord=False): """ Get the width of the character from the character metric WX field """ if not isord: c = ord(c) wx, name, bbox = self._metrics[c] return wx def get_height_char(self, c, isord=False): """ Get the height of character c from the bounding box. This is the ink height (space is 0) """ if not isord: c = ord(c) wx, name, bbox = self._metrics[c] return bbox[-1] def get_kern_dist(self, c1, c2): """ Return the kerning pair distance (possibly 0) for chars c1 and c2 """ name1, name2 = self.get_name_char(c1), self.get_name_char(c2) try: return self._kern[(name1, name2)] except: return 0 def get_fontname(self): "Return the font name, eg, Times-Roman" return self._header['FontName'] def get_fullname(self): "Return the font full name, eg, Times-Roman" return self._header['FullName'] def get_familyname(self): "Return the font family name, eg, Times" return self._header['FamilyName'] def get_weight(self): "Return the font weight, eg, 'Bold' or 'Roman'" return self._header['Weight'] def get_angle(self): "Return the fontangle as float" return self._header['ItalicAngle'] if __name__ == '__main__': pathname = '/usr/local/share/fonts/afms/adobe' for fname in os.listdir(pathname): fh = open(os.path.join(pathname, fname)) afm = AFM(fh) w, h = afm.string_width_height('John Hunter is the Man!') enthought-chaco2-4.8.1.orig/kiva/fonttools/font_manager.py0000644000175000017500000013465513544356225022717 0ustar varunvarun""" ####### NOTE ####### This is based heavily on matplotlib's font_manager.py rev 8713, but has been modified to not use other matplotlib modules #################### A module for finding, managing, and using fonts across platforms. This module provides a single :class:`FontManager` instance that can be shared across backends and platforms. The :func:`findfont` function returns the best TrueType (TTF) font file in the local or system font path that matches the specified :class:`FontProperties` instance. The :class:`FontManager` also handles Adobe Font Metrics (AFM) font files for use by the PostScript backend. The design is based on the `W3C Cascading Style Sheet, Level 1 (CSS1) font specification `_. Future versions may implement the Level 2 or 2.1 specifications. Experimental support is included for using `fontconfig` on Unix variant platforms (Linux, OS X, Solaris). To enable it, set the constant ``USE_FONTCONFIG`` in this file to ``True``. Fontconfig has the advantage that it is the standard way to look up fonts on X11 platforms, so if a font is installed, it is much more likely to be found. KNOWN ISSUES - documentation - font variant is untested - font stretch is incomplete - font size is incomplete - font size_adjust is incomplete - default font algorithm needs improvement and testing - setWeights function needs improvement - 'light' is an invalid weight value, remove it. - update_fonts not implemented Authors : John Hunter Paul Barrett Michael Droettboom Copyright : John Hunter (2004,2005), Paul Barrett (2004,2005) License : matplotlib license (PSF compatible) The font directory code is from ttfquery, see license/LICENSE_TTFQUERY. """ from __future__ import absolute_import, print_function import logging import os import sys import glob import subprocess import warnings import tempfile import errno import six import six.moves as sm from fontTools.ttLib import TTCollection, TTFont, TTLibError from traits.etsconfig.api import ETSConfig from . import afm logger = logging.getLogger(__name__) USE_FONTCONFIG = False font_scalings = { 'xx-small': 0.579, 'x-small': 0.694, 'small': 0.833, 'medium': 1.0, 'large': 1.200, 'x-large': 1.440, 'xx-large': 1.728, 'larger': 1.2, 'smaller': 0.833, None: 1.0 } stretch_dict = { 'ultra-condensed': 100, 'extra-condensed': 200, 'condensed': 300, 'semi-condensed': 400, 'normal': 500, 'semi-expanded': 600, 'expanded': 700, 'extra-expanded': 800, 'ultra-expanded': 900 } weight_dict = { 'ultralight': 100, 'light': 200, 'normal': 400, 'regular': 400, 'book': 400, 'medium': 500, 'roman': 500, 'semibold': 600, 'demibold': 600, 'demi': 600, 'bold': 700, 'heavy': 800, 'extra bold': 800, 'black': 900 } font_family_aliases = set(['serif', 'sans-serif', 'sans serif', 'cursive', 'fantasy', 'monospace', 'sans', 'modern']) # OS Font paths MSFolders = \ r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders' MSFontDirectories = [ r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts', r'SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts' ] X11FontDirectories = [ # an old standard installation point "/usr/X11R6/lib/X11/fonts/TTF/", # here is the new standard location for fonts "/usr/share/fonts/", # documented as a good place to install new fonts "/usr/local/share/fonts/", # common application, not really useful "/usr/lib/openoffice/share/fonts/truetype/", ] OSXFontDirectories = [ "/Library/Fonts/", "/Network/Library/Fonts/", "/System/Library/Fonts/" ] if not USE_FONTCONFIG: home = os.environ.get('HOME') if home is not None: # user fonts on OSX path = os.path.join(home, 'Library', 'Fonts') OSXFontDirectories.append(path) path = os.path.join(home, '.fonts') X11FontDirectories.append(path) ############################################################################### # functions to replace those that matplotlib ship in different modules ############################################################################### preferred_fonts = { 'fantasy': ['Comic Sans MS', 'Chicago', 'Charcoal', 'ImpactWestern', 'fantasy'], 'cursive': ['Apple Chancery', 'Textile', 'Zapf Chancery', 'Sand', 'cursive'], 'monospace': ['Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Andale Mono', 'Nimbus Mono L', 'Courier New', 'Courier', 'Fixed', 'Terminal', 'monospace'], 'serif': ['Bitstream Vera Serif', 'DejaVu Serif', 'New Century Schoolbook', 'Century Schoolbook L', 'Utopia', 'ITC Bookman', 'Bookman', 'Nimbus Roman No9 L', 'Times New Roman', 'Times', 'Palatino', 'Charter', 'serif'], 'sans-serif': ['Bitstream Vera Sans', 'DejaVu Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Arial', 'Helvetica', 'Avant Garde', 'sans-serif'] } def _is_writable_dir(p): """ p is a string pointing to a putative writable dir -- return True p is such a string, else False """ if not isinstance(p, six.string_types): return False try: t = tempfile.TemporaryFile(dir=p) t.write(b'kiva.test') t.close() except OSError: return False else: return True def get_configdir(): """ Return the string representing the configuration dir. If s is the special string _default_, use HOME/.kiva. s must be writable """ p = os.path.join(ETSConfig.application_data, 'kiva') try: os.makedirs(p) except OSError as e: if e.errno != errno.EEXIST: raise if not _is_writable_dir(p): raise IOError('Configuration directory %s must be writable' % p) return p def is_string_like(obj): 'Return True if *obj* looks like a string' from numpy import ma if isinstance(obj, six.string_types): return True # numpy strings are subclass of str, ma strings are not if ma.isMaskedArray(obj): if obj.ndim == 0 and obj.dtype.kind in 'SU': return True else: return False try: obj + '' except Exception: return False return True def decode_prop(prop): """ Decode a prop string. Parameters ---------- prop : bytestring Returns ------- string """ # Adapted from: https://gist.github.com/pklaus/dce37521579513c574d0 encoding = "utf-16-be" if b"\x00" in prop else "utf-8" return prop.decode(encoding) def getPropDict(font): n = font['name'] propdict = {} for prop in n.names: try: if 'name' in propdict and 'sfnt4' in propdict: break elif prop.nameID == 1 and 'name' not in propdict: propdict['name'] = decode_prop(prop.string) elif prop.nameID == 4 and 'sfnt4' not in propdict: propdict['sfnt4'] = decode_prop(prop.string) except UnicodeDecodeError: continue return propdict ############################################################################### # matplotlib code below ############################################################################### synonyms = {'ttf': ('ttf', 'otf', 'ttc'), 'otf': ('ttf', 'otf', 'ttc'), 'ttc': ('ttf', 'otf', 'ttc'), 'afm': ('afm',)} def get_fontext_synonyms(fontext): """ Return a list of file extensions extensions that are synonyms for the given file extension *fileext*. """ return synonyms[fontext] def win32FontDirectory(): """ Return the user-specified font directory for Win32. This is looked up from the registry key:: \\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Fonts # noqa If the key is not found, $WINDIR/Fonts will be returned. """ try: from six.moves import winreg except ImportError: pass # Fall through to default else: try: user = winreg.OpenKey(winreg.HKEY_CURRENT_USER, MSFolders) try: try: return winreg.QueryValueEx(user, 'Fonts')[0] except OSError: pass # Fall through to default finally: winreg.CloseKey(user) except OSError: pass # Fall through to default return os.path.join(os.environ['WINDIR'], 'Fonts') def win32InstalledFonts(directory=None, fontext='ttf'): """ Search for fonts in the specified font directory, or use the system directories if none given. A list of TrueType font filenames are returned by default, or AFM fonts if *fontext* == 'afm'. """ from six.moves import winreg if directory is None: directory = win32FontDirectory() fontext = get_fontext_synonyms(fontext) key, items = None, {} for fontdir in MSFontDirectories: try: local = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, fontdir) except OSError: continue if not local: files = [] for ext in fontext: files.extend(glob.glob(os.path.join(directory, '*.'+ext))) return files try: for j in sm.range(winreg.QueryInfoKey(local)[1]): try: key, direc, any = winreg.EnumValue(local, j) if not os.path.dirname(direc): direc = os.path.join(directory, direc) direc = os.path.abspath(direc).lower() if os.path.splitext(direc)[1][1:] in fontext: items[direc] = 1 except EnvironmentError: continue except WindowsError: continue return list(items.keys()) finally: winreg.CloseKey(local) return None def OSXFontDirectory(): """ Return the system font directories for OS X. This is done by starting at the list of hardcoded paths in :attr:`OSXFontDirectories` and returning all nested directories within them. """ fontpaths = [] for fontdir in OSXFontDirectories: try: if os.path.isdir(fontdir): fontpaths.append(fontdir) for dirpath, dirs, _files in os.walk(fontdir): fontpaths.extend([os.path.join(dirpath, d) for d in dirs]) except (IOError, OSError, TypeError, ValueError): pass return fontpaths def OSXInstalledFonts(directory=None, fontext='ttf'): """ Get list of font files on OS X - ignores font suffix by default. """ if directory is None: directory = OSXFontDirectory() fontext = get_fontext_synonyms(fontext) files = [] for path in directory: if fontext is None: files.extend(glob.glob(os.path.join(path, '*'))) else: for ext in fontext: files.extend(glob.glob(os.path.join(path, '*.'+ext))) files.extend(glob.glob(os.path.join(path, '*.'+ext.upper()))) return files def x11FontDirectory(): """ Return the system font directories for X11. This is done by starting at the list of hardcoded paths in :attr:`X11FontDirectories` and returning all nested directories within them. """ fontpaths = [] for fontdir in X11FontDirectories: try: if os.path.isdir(fontdir): fontpaths.append(fontdir) for dirpath, dirs, _files in os.walk(fontdir): fontpaths.extend([os.path.join(dirpath, d) for d in dirs]) except (IOError, OSError, TypeError, ValueError): pass return fontpaths def get_fontconfig_fonts(fontext='ttf'): """ Grab a list of all the fonts that are being tracked by fontconfig by making a system call to ``fc-list``. This is an easy way to grab all of the fonts the user wants to be made available to applications, without needing knowing where all of them reside. """ fontext = get_fontext_synonyms(fontext) fontfiles = {} try: pipe = subprocess.Popen(['fc-list', '', 'file'], stdout=subprocess.PIPE) output = pipe.communicate()[0] except OSError: # Calling fc-list did not work, so we'll just return nothing return fontfiles output = output.decode('utf8') if pipe.returncode == 0: for line in output.split('\n'): fname = line.split(':')[0] if (os.path.splitext(fname)[1][1:] in fontext and os.path.exists(fname)): fontfiles[fname] = 1 return fontfiles def findSystemFonts(fontpaths=None, fontext='ttf'): """ Search for fonts in the specified font paths. If no paths are given, will use a standard set of system paths, as well as the list of fonts tracked by fontconfig if fontconfig is installed and available. A list of TrueType fonts are returned by default with AFM fonts as an option. """ fontfiles = {} fontexts = get_fontext_synonyms(fontext) if fontpaths is None: if sys.platform == 'win32': fontdir = win32FontDirectory() fontpaths = [fontdir] # now get all installed fonts directly... for f in win32InstalledFonts(fontdir): base, ext = os.path.splitext(f) if len(ext) > 1 and ext[1:].lower() in fontexts: fontfiles[f] = 1 else: # check for OS X & load its fonts if present if sys.platform == 'darwin': fontpaths = [] for f in OSXInstalledFonts(fontext=fontext): fontfiles[f] = 1 else: # Otherwise, check X11. fontpaths = x11FontDirectory() for f in get_fontconfig_fonts(fontext): fontfiles[f] = 1 elif isinstance(fontpaths, six.string_types): fontpaths = [fontpaths] for path in fontpaths: files = [] for ext in fontexts: files.extend(glob.glob(os.path.join(path, '*.'+ext))) files.extend(glob.glob(os.path.join(path, '*.'+ext.upper()))) for fname in files: abs_path = os.path.abspath(fname) # Handle dirs which look like font files, but may contain font # files if os.path.isdir(abs_path): fontpaths.append(abs_path) else: fontfiles[abs_path] = 1 return [fname for fname in fontfiles.keys() if os.path.exists(fname)] def weight_as_number(weight): """ Return the weight property as a numeric value. String values are converted to their corresponding numeric value. """ if isinstance(weight, str): try: weight = weight_dict[weight.lower()] except KeyError: weight = 400 elif weight in range(100, 1000, 100): pass else: raise ValueError('weight not a valid integer') return weight class FontEntry(object): """ A class for storing Font properties. It is used when populating the font lookup dictionary. """ def __init__(self, fname='', name='', style='normal', variant='normal', weight='normal', stretch='normal', size='medium'): self.fname = fname self.name = name self.style = style self.variant = variant self.weight = weight self.stretch = stretch try: self.size = str(float(size)) except ValueError: self.size = size def __repr__(self): return "" % ( self.name, os.path.basename(self.fname), self.style, self.variant, self.weight, self.stretch) def ttfFontProperty(fpath, font): """ A function for populating the :class:`FontKey` by extracting information from the TrueType font file. *font* is a :class:`FT2Font` instance. """ props = getPropDict(font) name = props.get('name') if name is None: raise KeyError("No name could be found for: {}".format(fpath)) # Styles are: italic, oblique, and normal (default) sfnt4 = props.get('sfnt4', '') if sfnt4.find('oblique') >= 0: style = 'oblique' elif sfnt4.find('italic') >= 0: style = 'italic' else: style = 'normal' # Variants are: small-caps and normal (default) # !!!! Untested if name.lower() in ['capitals', 'small-caps']: variant = 'small-caps' else: variant = 'normal' # Weights are: 100, 200, 300, 400 (normal: default), 500 (medium), # 600 (semibold, demibold), 700 (bold), 800 (heavy), 900 (black) # lighter and bolder are also allowed. weight = None for w in weight_dict.keys(): if sfnt4.find(w) >= 0: weight = w break if not weight: weight = 400 weight = weight_as_number(weight) # Stretch can be absolute and relative # Absolute stretches are: ultra-condensed, extra-condensed, condensed, # semi-condensed, normal, semi-expanded, expanded, extra-expanded, # and ultra-expanded. # Relative stretches are: wider, narrower # Child value is: inherit if (sfnt4.find('narrow') >= 0 or sfnt4.find('condensed') >= 0 or sfnt4.find('cond') >= 0): stretch = 'condensed' elif sfnt4.find('demi cond') >= 0: stretch = 'semi-condensed' elif sfnt4.find('wide') >= 0 or sfnt4.find('expanded') >= 0: stretch = 'expanded' else: stretch = 'normal' # Sizes can be absolute and relative. # Absolute sizes are: xx-small, x-small, small, medium, large, x-large, # and xx-large. # Relative sizes are: larger, smaller # Length value is an absolute font size, e.g. 12pt # Percentage values are in 'em's. Most robust specification. # !!!! Incomplete size = 'scalable' return FontEntry(fpath, name, style, variant, weight, stretch, size) def afmFontProperty(fontpath, font): """ A function for populating a :class:`FontKey` instance by extracting information from the AFM font file. *font* is a class:`AFM` instance. """ name = font.get_familyname() fontname = font.get_fontname().lower() # Styles are: italic, oblique, and normal (default) if font.get_angle() != 0 or name.lower().find('italic') >= 0: style = 'italic' elif name.lower().find('oblique') >= 0: style = 'oblique' else: style = 'normal' # Variants are: small-caps and normal (default) # !!!! Untested if name.lower() in ['capitals', 'small-caps']: variant = 'small-caps' else: variant = 'normal' # Weights are: 100, 200, 300, 400 (normal: default), 500 (medium), # 600 (semibold, demibold), 700 (bold), 800 (heavy), 900 (black) # lighter and bolder are also allowed. weight = weight_as_number(font.get_weight().lower()) # Stretch can be absolute and relative # Absolute stretches are: ultra-condensed, extra-condensed, condensed, # semi-condensed, normal, semi-expanded, expanded, extra-expanded, # and ultra-expanded. # Relative stretches are: wider, narrower # Child value is: inherit if (fontname.find('narrow') >= 0 or fontname.find('condensed') >= 0 or fontname.find('cond') >= 0): stretch = 'condensed' elif fontname.find('demi cond') >= 0: stretch = 'semi-condensed' elif fontname.find('wide') >= 0 or fontname.find('expanded') >= 0: stretch = 'expanded' else: stretch = 'normal' # Sizes can be absolute and relative. # Absolute sizes are: xx-small, x-small, small, medium, large, x-large, # and xx-large. # Relative sizes are: larger, smaller # Length value is an absolute font size, e.g. 12pt # Percentage values are in 'em's. Most robust specification. # All AFM fonts are apparently scalable. size = 'scalable' return FontEntry(fontpath, name, style, variant, weight, stretch, size) def createFontList(fontfiles, fontext='ttf'): """ A function to create a font lookup list. The default is to create a list of TrueType fonts. An AFM font list can optionally be created. """ # FIXME: This function is particularly difficult to debug fontlist = [] # Add fonts from list of known font files. seen = {} for fpath in fontfiles: logger.debug("createFontDict %s", fpath) fname = os.path.split(fpath)[1] if fname in seen: continue else: seen[fname] = 1 if fontext == 'afm': try: fh = open(fpath, 'r') except Exception: logger.error( "Could not open font file %s", fpath, exc_info=True) continue try: try: font = afm.AFM(fh) finally: fh.close() except RuntimeError: logger.error( "Could not parse font file %s", fpath, exc_info=True) continue try: prop = afmFontProperty(fpath, font) except Exception: logger.error( "Could not covert font to FontEntry for file %s", fpath, exc_info=True ) continue else: _, ext = os.path.splitext(fpath) try: if ext.lower() == ".ttc": collection = TTCollection(six.text_type(fpath)) try: props = [] for font in collection.fonts: props.append(ttfFontProperty(fpath, font)) fontlist.extend(props) continue except Exception: logger.error( "Could not covert font to FontEntry for file %s", fpath, exc_info=True ) continue else: font = TTFont(six.text_type(fpath)) except (RuntimeError, TTLibError): logger.error( "Could not open font file %s", fpath, exc_info=True) continue except UnicodeError: logger.error( "Cannot handle unicode file: %s", fpath, exc_info=True) continue try: prop = ttfFontProperty(fpath, font) except Exception: logger.error( "Could not covert font to FontEntry for file %s", fpath, exc_info=True ) continue fontlist.append(prop) return fontlist class FontProperties(object): """ A class for storing and manipulating font properties. The font properties are those described in the `W3C Cascading Style Sheet, Level 1 `_ font specification. The six properties are: - family: A list of font names in decreasing order of priority. The items may include a generic font family name, either 'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace'. In that case, the actual font to be used will be looked up from the associated rcParam in :file:`matplotlibrc`. - style: Either 'normal', 'italic' or 'oblique'. - variant: Either 'normal' or 'small-caps'. - stretch: A numeric value in the range 0-1000 or one of 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded' or 'ultra-expanded' - weight: A numeric value in the range 0-1000 or one of 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black' - size: Either an relative value of 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' or an absolute font size, e.g. 12 The default font property for TrueType fonts (as specified in the default :file:`matplotlibrc` file) is:: sans-serif, normal, normal, normal, normal, scalable. Alternatively, a font may be specified using an absolute path to a .ttf file, by using the *fname* kwarg. The preferred usage of font sizes is to use the relative values, e.g. 'large', instead of absolute font sizes, e.g. 12. This approach allows all text sizes to be made larger or smaller based on the font manager's default font size. This class will also accept a `fontconfig `_ pattern, if it is the only argument provided. See the documentation on `fontconfig patterns `_. This support does not require fontconfig to be installed. We are merely borrowing its pattern syntax for use here. Note that matplotlib's internal font manager and fontconfig use a different algorithm to lookup fonts, so the results of the same pattern may be different in matplotlib than in other applications that use fontconfig. """ def __init__(self, family=None, style=None, variant=None, weight=None, stretch=None, size=None, fname=None, _init=None): # if fname is set, it's a hardcoded filename to use # _init is used only by copy() self._family = None self._slant = None self._variant = None self._weight = None self._stretch = None self._size = None self._file = None # This is used only by copy() if _init is not None: self.__dict__.update(_init.__dict__) return if is_string_like(family): # Treat family as a fontconfig pattern if it is the only # parameter provided. if (style is None and variant is None and weight is None and stretch is None and size is None and fname is None): self.set_fontconfig_pattern(family) return self.set_family(family) self.set_style(style) self.set_variant(variant) self.set_weight(weight) self.set_stretch(stretch) self.set_file(fname) self.set_size(size) def __hash__(self): lst = [(k, getattr(self, "get" + k)()) for k in sorted(self.__dict__)] return hash(repr(lst)) def __str__(self): return str((self._family, self._slant, self._variant, self._weight, self._stretch, self._size)) def get_family(self): """ Return a list of font names that comprise the font family. """ return self._family def get_name(self): """ Return the name of the font that best matches the font properties. """ filename = six.text_type(fontManager.findfont(self)) if filename.endswith('.afm'): return afm.AFM(open(filename)).get_familyname() font = fontManager.findfont(self) prop_dict = getPropDict(TTFont(six.text_type(font))) return prop_dict['name'] def get_style(self): """ Return the font style. Values are: 'normal', 'italic' or 'oblique'. """ return self._slant get_slant = get_style def get_variant(self): """ Return the font variant. Values are: 'normal' or 'small-caps'. """ return self._variant def get_weight(self): """ Set the font weight. Options are: A numeric value in the range 0-1000 or one of 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black' """ return self._weight def get_stretch(self): """ Return the font stretch or width. Options are: 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'. """ return self._stretch def get_size(self): """ Return the font size. """ return self._size def get_size_in_points(self): if self._size is not None: try: return float(self._size) except ValueError: pass default_size = fontManager.get_default_size() return default_size * font_scalings.get(self._size) def get_file(self): """ Return the filename of the associated font. """ return self._file def set_family(self, family): """ Change the font family. May be either an alias (generic name is CSS parlance), such as: 'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace', or a real font name. """ if family is None: self._family = None else: if '' != b'' and isinstance(family, bytes): family = family.decode('utf8') if is_string_like(family): family = [family] self._family = family set_name = set_family def set_style(self, style): """ Set the font style. Values are: 'normal', 'italic' or 'oblique'. """ if style not in ('normal', 'italic', 'oblique', None): raise ValueError("style must be normal, italic or oblique") self._slant = style set_slant = set_style def set_variant(self, variant): """ Set the font variant. Values are: 'normal' or 'small-caps'. """ if variant not in ('normal', 'small-caps', None): raise ValueError("variant must be normal or small-caps") self._variant = variant def set_weight(self, weight): """ Set the font weight. May be either a numeric value in the range 0-1000 or one of 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black' """ if weight is not None: try: weight = int(weight) if weight < 0 or weight > 1000: raise ValueError() except ValueError: if weight not in weight_dict: raise ValueError("weight is invalid") self._weight = weight def set_stretch(self, stretch): """ Set the font stretch or width. Options are: 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded' or 'ultra-expanded', or a numeric value in the range 0-1000. """ if stretch is not None: try: stretch = int(stretch) if stretch < 0 or stretch > 1000: raise ValueError() except ValueError: if stretch not in stretch_dict: raise ValueError("stretch is invalid") else: stretch = 500 self._stretch = stretch def set_size(self, size): """ Set the font size. Either an relative value of 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' or an absolute font size, e.g. 12. """ if size is not None: try: size = float(size) except ValueError: if size is not None and size not in font_scalings: raise ValueError("size is invalid") self._size = size def set_file(self, file): """ Set the filename of the fontfile to use. In this case, all other properties will be ignored. """ self._file = file def copy(self): """Return a deep copy of self""" return FontProperties(_init=self) def ttfdict_to_fnames(d): """ flatten a ttfdict to all the filenames it contains """ fnames = [] for named in d.values(): for styled in named.values(): for variantd in styled.values(): for weightd in variantd.values(): for stretchd in weightd.values(): for fname in stretchd.values(): fnames.append(fname) return fnames def pickle_dump(data, filename): """ Equivalent to pickle.dump(data, open(filename, 'wb')) but closes the file to prevent filehandle leakage. """ fh = open(filename, 'wb') try: sm.cPickle.dump(data, fh) finally: fh.close() def pickle_load(filename): """ Equivalent to pickle.load(open(filename, 'rb')) but closes the file to prevent filehandle leakage. """ fh = open(filename, 'rb') try: data = sm.cPickle.load(fh) finally: fh.close() return data class FontManager: """ On import, the :class:`FontManager` singleton instance creates a list of TrueType fonts based on the font properties: name, style, variant, weight, stretch, and size. The :meth:`findfont` method does a nearest neighbor search to find the font that most closely matches the specification. If no good enough match is found, a default font is returned. """ # Increment this version number whenever the font cache data # format or behavior has changed and requires a existing font # cache files to be rebuilt. __version__ = 7 def __init__(self, size=None, weight='normal'): self._version = self.__version__ self.__default_weight = weight self.default_size = size paths = [] # Create list of font paths for pathname in ['TTFPATH', 'AFMPATH']: if pathname in os.environ: ttfpath = os.environ[pathname] if ttfpath.find(';') >= 0: # win32 style paths.extend(ttfpath.split(';')) elif ttfpath.find(':') >= 0: # unix style paths.extend(ttfpath.split(':')) else: paths.append(ttfpath) logger.debug("font search path %s", six.text_type(paths)) # Load TrueType fonts and create font dictionary. self.ttffiles = findSystemFonts(paths) + findSystemFonts() self.defaultFamily = { 'ttf': 'Bitstream Vera Sans', 'afm': 'Helvetica'} self.defaultFont = {} for fname in self.ttffiles: logger.debug("trying fontname %s", fname) if fname.lower().find('vera.ttf') >= 0: self.defaultFont['ttf'] = fname break else: # use anything self.defaultFont['ttf'] = self.ttffiles[0] self.ttflist = createFontList(self.ttffiles) self.afmfiles = findSystemFonts(paths, fontext='afm') + \ findSystemFonts(fontext='afm') self.afmlist = createFontList(self.afmfiles, fontext='afm') self.defaultFont['afm'] = None self.ttf_lookup_cache = {} self.afm_lookup_cache = {} def get_default_weight(self): """ Return the default font weight. """ return self.__default_weight def get_default_size(self): """ Return the default font size. """ return self.default_size def set_default_weight(self, weight): """ Set the default font weight. The initial value is 'normal'. """ self.__default_weight = weight def update_fonts(self, filenames): """ Update the font dictionary with new font files. Currently not implemented. """ # !!!! Needs implementing raise NotImplementedError # Each of the scoring functions below should return a value between # 0.0 (perfect match) and 1.0 (terrible match) def score_family(self, families, family2): """ Returns a match score between the list of font families in *families* and the font family name *family2*. An exact match anywhere in the list returns 0.0. A match by generic font name will return 0.1. No match will return 1.0. """ global preferred_fonts family2 = family2.lower() for i, family1 in enumerate(families): family1 = family1.lower() if family1 in font_family_aliases: if family1 in ('sans', 'sans serif', 'modern'): family1 = 'sans-serif' options = preferred_fonts[family1] options = [x.lower() for x in options] if family2 in options: idx = options.index(family2) return 0.1 * (float(idx) / len(options)) elif family1 == family2: return 0.0 return 1.0 def score_style(self, style1, style2): """ Returns a match score between *style1* and *style2*. An exact match returns 0.0. A match between 'italic' and 'oblique' returns 0.1. No match returns 1.0. """ if style1 == style2: return 0.0 elif style1 in ('italic', 'oblique') and \ style2 in ('italic', 'oblique'): return 0.1 return 1.0 def score_variant(self, variant1, variant2): """ Returns a match score between *variant1* and *variant2*. An exact match returns 0.0, otherwise 1.0. """ if variant1 == variant2: return 0.0 else: return 1.0 def score_stretch(self, stretch1, stretch2): """ Returns a match score between *stretch1* and *stretch2*. The result is the absolute value of the difference between the CSS numeric values of *stretch1* and *stretch2*, normalized between 0.0 and 1.0. """ try: stretchval1 = int(stretch1) except ValueError: stretchval1 = stretch_dict.get(stretch1, 500) try: stretchval2 = int(stretch2) except ValueError: stretchval2 = stretch_dict.get(stretch2, 500) return abs(stretchval1 - stretchval2) / 1000.0 def score_weight(self, weight1, weight2): """ Returns a match score between *weight1* and *weight2*. The result is the absolute value of the difference between the CSS numeric values of *weight1* and *weight2*, normalized between 0.0 and 1.0. """ try: weightval1 = int(weight1) except ValueError: weightval1 = weight_dict.get(weight1, 500) try: weightval2 = int(weight2) except ValueError: weightval2 = weight_dict.get(weight2, 500) return abs(weightval1 - weightval2) / 1000.0 def score_size(self, size1, size2): """ Returns a match score between *size1* and *size2*. If *size2* (the size specified in the font file) is 'scalable', this function always returns 0.0, since any font size can be generated. Otherwise, the result is the absolute distance between *size1* and *size2*, normalized so that the usual range of font sizes (6pt - 72pt) will lie between 0.0 and 1.0. """ if size2 == 'scalable': return 0.0 # Size value should have already been try: sizeval1 = float(size1) except ValueError: sizeval1 = self.default_size * font_scalings(size1) try: sizeval2 = float(size2) except ValueError: return 1.0 return abs(sizeval1 - sizeval2) / 72.0 def findfont(self, prop, fontext='ttf', directory=None, fallback_to_default=True, rebuild_if_missing=True): """ Search the font list for the font that most closely matches the :class:`FontProperties` *prop*. :meth:`findfont` performs a nearest neighbor search. Each font is given a similarity score to the target font properties. The first font with the highest score is returned. If no matches below a certain threshold are found, the default font (usually Vera Sans) is returned. `directory`, is specified, will only return fonts from the given directory (or subdirectory of that directory). The result is cached, so subsequent lookups don't have to perform the O(n) nearest neighbor search. If `fallback_to_default` is True, will fallback to the default font family (usually "Bitstream Vera Sans" or "Helvetica") if the first lookup hard-fails. See the `W3C Cascading Style Sheet, Level 1 `_ documentation for a description of the font finding algorithm. """ if not isinstance(prop, FontProperties): prop = FontProperties(prop) fname = prop.get_file() if fname is not None: logger.debug("findfont returning %s", fname) return fname if fontext == 'afm': font_cache = self.afm_lookup_cache fontlist = self.afmlist else: font_cache = self.ttf_lookup_cache fontlist = self.ttflist if directory is None: cached = font_cache.get(hash(prop)) if cached: return cached best_score = 1e64 best_font = None for font in fontlist: fname = font.fname if (directory is not None and os.path.commonprefix([fname, directory]) != directory): continue # Matching family should have highest priority, so it is multiplied # by 10.0 score = \ self.score_family(prop.get_family(), font.name) * 10.0 + \ self.score_style(prop.get_style(), font.style) + \ self.score_variant(prop.get_variant(), font.variant) + \ self.score_weight(prop.get_weight(), font.weight) + \ self.score_stretch(prop.get_stretch(), font.stretch) + \ self.score_size(prop.get_size(), font.size) if score < best_score: best_score = score best_font = font if score == 0: break if best_font is None or best_score >= 10.0: if fallback_to_default: warnings.warn( 'findfont: Font family %s not found. Falling back to %s' % (prop.get_family(), self.defaultFamily[fontext])) default_prop = prop.copy() default_prop.set_family(self.defaultFamily[fontext]) return self.findfont(default_prop, fontext, directory, False) else: # This is a hard fail -- we can't find anything reasonable, # so just return the vera.ttf warnings.warn( 'findfont: Could not match %s. Returning %s' % (prop, self.defaultFont[fontext]), UserWarning) result = self.defaultFont[fontext] else: logger.debug( "findfont: Matching %s to %s (%s) with score of %f", prop, best_font.name, best_font.fname, best_score ) result = best_font.fname if not os.path.isfile(result): if rebuild_if_missing: logger.debug( "findfont: Found a missing font file. Rebuilding cache.") _rebuild() return fontManager.findfont( prop, fontext, directory, True, False) else: raise ValueError("No valid font could be found") if directory is None: font_cache[hash(prop)] = result return result _is_opentype_cff_font_cache = {} def is_opentype_cff_font(filename): """ Returns True if the given font is a Postscript Compact Font Format Font embedded in an OpenType wrapper. Used by the PostScript and PDF backends that can not subset these fonts. """ if os.path.splitext(filename)[1].lower() == '.otf': result = _is_opentype_cff_font_cache.get(filename) if result is None: fd = open(filename, 'rb') tag = fd.read(4) fd.close() result = (tag == 'OTTO') _is_opentype_cff_font_cache[filename] = result return result return False fontManager = None _fmcache = os.path.join(get_configdir(), 'fontList.cache') def _rebuild(): global fontManager fontManager = FontManager() pickle_dump(fontManager, _fmcache) logger.debug("generated new fontManager") # The experimental fontconfig-based backend. if USE_FONTCONFIG and sys.platform != 'win32': import re def fc_match(pattern, fontext): fontexts = get_fontext_synonyms(fontext) try: pipe = subprocess.Popen(['fc-match', '-sv', pattern], stdout=subprocess.PIPE) output = pipe.communicate()[0] except OSError: return None if pipe.returncode == 0: for match in _fc_match_regex.finditer(output): file = match.group(1) if os.path.splitext(file)[1][1:] in fontexts: return file return None _fc_match_regex = re.compile(r'\sfile:\s+"([^"]*)"') _fc_match_cache = {} def findfont(prop, fontext='ttf'): if not is_string_like(prop): prop = prop.get_fontconfig_pattern() cached = _fc_match_cache.get(prop) if cached is not None: return cached result = fc_match(prop, fontext) if result is None: result = fc_match(':', fontext) _fc_match_cache[prop] = result return result else: try: fontManager = pickle_load(_fmcache) if (not hasattr(fontManager, '_version') or fontManager._version != FontManager.__version__): _rebuild() else: fontManager.default_size = None logger.debug("Using fontManager instance from %s", _fmcache) except Exception: _rebuild() def findfont(prop, **kw): global fontManager font = fontManager.findfont(prop, **kw) return font enthought-chaco2-4.8.1.orig/kiva/fonttools/__init__.py0000644000175000017500000000004413233644505021772 0ustar varunvarunfrom .font import Font, str_to_font enthought-chaco2-4.8.1.orig/kiva/fonttools/sstruct.py0000644000175000017500000001464013421603267021750 0ustar varunvarun"""sstruct.py -- SuperStruct Higher level layer on top of the struct module, enabling to bind names to struct elements. The interface is similar to struct, except the objects passed and returned are not tuples (or argument lists), but dictionaries or instances. Just like struct, we use format strings to describe a data structure, except we use one line per element. Lines are separated by newlines or semi-colons. Each line contains either one of the special struct characters ('@', '=', '<', '>' or '!') or a 'name:formatchar' combo (eg. 'myFloat:f'). Repetitions, like the struct module offers them are not useful in this context, except for fixed length strings (eg. 'myInt:5h' is not allowed but 'myString:5s' is). The 'x' format character (pad byte) is treated as 'special', since it is by definition anonymous. Extra whitespace is allowed everywhere. The sstruct module offers one feature that the "normal" struct module doesn't: support for fixed point numbers. These are spelled as "n.mF", where n is the number of bits before the point, and m the number of bits after the point. Fixed point numbers get converted to floats. pack(format, object): 'object' is either a dictionary or an instance (or actually anything that has a __dict__ attribute). If it is a dictionary, its keys are used for names. If it is an instance, it's attributes are used to grab struct elements from. Returns a string containing the data. unpack(format, data, object=None) If 'object' is omitted (or None), a new dictionary will be returned. If 'object' is a dictionary, it will be used to add struct elements to. If it is an instance (or in fact anything that has a __dict__ attribute), an attribute will be added for each struct element. In the latter two cases, 'object' itself is returned. unpack2(format, data, object=None) Convenience function. Same as unpack, except data may be longer than needed. The returned value is a tuple: (object, leftoverdata). calcsize(format) like struct.calcsize(), but uses our own format strings: it returns the size of the data in bytes. """ # XXX I would like to support pascal strings, too, but I'm not # sure if that's wise. Would be nice if struct supported them # "properly", but that would certainly break calcsize()... # Updated to Python 2.7/3.0, CJW from __future__ import absolute_import, print_function __version__ = "1.2" __copyright__ = "Copyright 1998, Just van Rossum " import struct import re class SStructError(Exception): pass def pack(format, obj): """ Return bytes of values v1, v2, ... packed according to format. """ formatstring, names, fixes = getformat(format) elements = [] if not isinstance(obj, dict): obj = obj.__dict__ for name in names: value = obj[name] if name in fixes: # fixed point conversion value = int(round(value*fixes[name])) elements.append(value) data = struct.pack(formatstring, *elements) return data def unpack(format, data, obj=None): """ Unpack bytes containing packed C structure data, according to format. Requires len(bytes) == calcsize(format). By default returns a dictionary of data, but can be given existing dict or an arbitrary object which has its __dict__ populated. """ if obj is None: obj = {} formatstring, names, fixes = getformat(format) if isinstance(obj, dict): d = obj else: d = obj.__dict__ elements = struct.unpack(formatstring, data) for i in range(len(names)): name = names[i] value = elements[i] if name in fixes: # fixed point conversion value = value / fixes[name] d[name] = value return obj def unpack2(format, data, object=None): """ As unpack(), but truncating to length of format """ length = calcsize(format) return unpack(format, data[:length], object), data[length:] def calcsize(format): """ Compute the size of the data structure described by format """ formatstring, names, fixes = getformat(format) return struct.calcsize(formatstring) # matches "name:formatchar" (whitespace is allowed) _elementRE = re.compile( "\s*" # whitespace "([A-Za-z_][A-Za-z_0-9]*)" # name (python identifier) "\s*:\s*" # whitespace : whitespace "([cbBhHiIlLfd]|[0-9]+[ps]|" # formatchar... "([0-9]+)\.([0-9]+)(F))" # ...formatchar # noqa "\s*" # whitespace "(#.*)?$" # [comment] + end of string ) # matches the special struct format chars and 'x' (pad byte) _extraRE = re.compile("\s*([x@=<>!])\s*(#.*)?$") # matches an "empty" string, possibly containing whitespace and/or a comment _emptyRE = re.compile("\s*(#.*)?$") _fixedpointmappings = { 8: "b", 16: "h", 32: "l" } _formatcache = {} def getformat(format): """ Convert sstruct format to struct format, names and fixed point data """ try: formatstring, names, fixes = _formatcache[format] except KeyError: lines = re.split("[\n;]", format) formatstring = "" names = [] fixes = {} for line in lines: if _emptyRE.match(line): continue m = _extraRE.match(line) if m: formatchar = m.group(1) if formatchar != 'x' and formatstring: raise SStructError("Special format chars must be first") else: m = _elementRE.match(line) if not m: raise SStructError("syntax error in format: '%s'" % line) name = m.group(1) names.append(name) formatchar = m.group(2) if m.group(3): # fixed point before = int(m.group(3)) after = int(m.group(4)) bits = before + after if bits not in [8, 16, 32]: msg = "fixed point must be 8, 16 or 32 bits long" raise SStructError(msg) formatchar = _fixedpointmappings[bits] assert m.group(5) == "F" fixes[name] = float(1 << after) formatstring = formatstring + formatchar _formatcache[format] = formatstring, names, fixes return formatstring, names, fixes enthought-chaco2-4.8.1.orig/kiva/fonttools/tests/0000755000175000017500000000000013544357630021032 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/fonttools/tests/__init__.py0000644000175000017500000000000013233644505023124 0ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/fonttools/tests/test_sstruct.py0000644000175000017500000000405313421603267024146 0ustar varunvarun from unittest import TestCase from ..sstruct import SStructError, calcsize, getformat, pack, unpack class TestSStruct(TestCase): def test_roundtrip(self): format = """ # comments are allowed > # big endian (see documentation for struct) # empty lines are allowed: ashort: h along: l abyte: b # a byte achar: c astr: 5s afloat: f; adouble: d # multiple "statements" are allowed afixed: 16.16F """ self.assertEqual(calcsize(format), 29) class foo(object): pass i = foo() i.ashort = 0x7fff i.along = 0x7fffffff i.abyte = 0x7f i.achar = b"a" i.astr = b"12345" i.afloat = 0.5 i.adouble = 0.5 i.afixed = 1.5 data = pack(format, i) self.assertEqual( data, b'\x7f\xff' + b'\x7f\xff\xff\xff' + b'\x7f' + b'a' + b'12345' + b'\x3f\x00\x00\x00' + b'\x3f\xe0\x00\x00\x00\x00\x00\x00' + b'\x00\x01\x80\x00' ) self.assertEqual( unpack(format, data), { 'ashort': i.ashort, 'abyte': i.abyte, 'achar': i.achar, 'along': i.along, 'astr': i.astr, 'afloat': i.afloat, 'adouble': i.adouble, 'afixed': i.afixed, } ) i2 = foo() unpack(format, data, i2) self.assertEqual(vars(i), vars(i2)) def test_bad_format_char(self): format = "test: b; >" with self.assertRaises(SStructError): getformat(format) def test_format_syntax_error(self): format = "test: z" with self.assertRaises(SStructError): getformat(format) def test_fixed_point_error(self): format = "test: 4.8F" with self.assertRaises(SStructError): getformat(format) enthought-chaco2-4.8.1.orig/kiva/fonttools/tests/test_font_manager.py0000644000175000017500000000411213544356225025100 0ustar varunvarunimport os import unittest try: from unittest import mock except ImportError: import mock from pkg_resources import resource_filename from fontTools.ttLib import TTFont from ..font_manager import FontEntry, createFontList, ttfFontProperty data_dir = resource_filename('kiva.fonttools.tests', 'data') class TestCreateFontList(unittest.TestCase): def setUp(self): self.ttc_fontpath = os.path.join(data_dir, "TestTTC.ttc") def test_fontlist_from_ttc(self): # When fontlist = createFontList([self.ttc_fontpath]) # Then self.assertEqual(len(fontlist), 2) for fontprop in fontlist: self.assertIsInstance(fontprop, FontEntry) @mock.patch( "kiva.fonttools.font_manager.ttfFontProperty", side_effect=ValueError) def test_ttc_exception_on_ttfFontProperty(self, m_ttfFontProperty): # When fontlist = createFontList([self.ttc_fontpath]) # Then self.assertEqual(len(fontlist), 0) self.assertEqual(m_ttfFontProperty.call_count, 1) @mock.patch( "kiva.fonttools.font_manager.TTCollection", side_effect=RuntimeError) def test_ttc_exception_on_TTCollection(self, m_TTCollection): # When fontlist = createFontList([self.ttc_fontpath]) # Then self.assertEqual(len(fontlist), 0) self.assertEqual(m_TTCollection.call_count, 1) class TestTTFFontProperty(unittest.TestCase): def test_font(self): # Given test_font = os.path.join(data_dir, "TestTTF.ttf") exp_name = "Test TTF" exp_style = "normal" exp_variant = "normal" exp_weight = 400 exp_stretch = "normal" exp_size = "scalable" # When entry = ttfFontProperty(test_font, TTFont(test_font)) # Then self.assertEqual(entry.name, exp_name) self.assertEqual(entry.style, exp_style) self.assertEqual(entry.variant, exp_variant) self.assertEqual(entry.weight, exp_weight) self.assertEqual(entry.stretch, exp_stretch) self.assertEqual(entry.size, exp_size) enthought-chaco2-4.8.1.orig/kiva/fonttools/tests/data/0000755000175000017500000000000013544357630021743 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/fonttools/tests/data/TestTTC.ttc0000644000175000017500000000506013477706655023764 0ustar varunvarunttcfАpDSIG OS/2g#°`cmap1"█t·cvt pfpgmtgaspx glyfR4ДhheadxD░ь6hheaTр$$hmtxмаHloca^L`maxpp name╗п>Рbpostr%─р Ї7prep ,АpDSIG OS/2g#°`cmap1"█t·cvt pfpgmtgaspx glyfR4ДhheadxD░ь6hheaTр$$hmtxмаHloca^L`maxpp name╗п>Рbpostr%─р Ї7prep ,ИР╝КМ╝К▌2· АNONE└ &ю ╚Д,Ї╝ \@  . &   . &   ї у ╓▀▀Ю╩   2┬ю3!'!2Р2■╘ю¤2К¤v7║z73#7ГГzz  7Ьz&'ёт(┤┘n_<їш╤Ц7╘¤яе2Ью Д■╘╙22ЬЇ2··ё7╙7"4 J44<C4 \i)x б б #к #к;═4 h p А 2О p └ ┌ R° J J F\ F\ vвCopyright (c) 2015 by FontTools. No rights reserved.Test TTFRegularFontTools: Test TTF: 2015Version 1.000TestTTF-RegularTest TTF is not a trademark of FontTools.FontToolshttps://github.com/behdad/fonttoolshttps://github.com/behdad/fonttools/blob/master/LICENSE.txtCopyright (c) 2015 by FontTools. No rights reserved.Test TTFRegularFontTools: Test TTF: 2015Version 1.000TestTTF-RegularTest TTF is not a trademark of FontTools.FontToolshttps://github.com/behdad/fonttoolshttps://github.com/behdad/fonttools/blob/master/LICENSE.txt ╡2л.nullCRenthought-chaco2-4.8.1.orig/kiva/fonttools/tests/data/fonttools_LICENSE.txt0000644000175000017500000000206013477706655025705 0ustar varunvarunMIT License Copyright (c) 2017 Just van Rossum Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. enthought-chaco2-4.8.1.orig/kiva/fonttools/tests/data/source.txt0000644000175000017500000000064213544356225024005 0ustar varunvarunProject License File ---------------------------------------------------------------------------- fonttools MIT fonttools_LICENSE.txt Files and orginal authors: ---------------------------------------------------------------------------- kiva/fonttools/tests/data: TestTTC.ttc | fonttools TestTTF.ttf | fonttools enthought-chaco2-4.8.1.orig/kiva/fonttools/tests/data/TestTTF.ttf0000644000175000017500000000444013544356225023760 0ustar varunvarunАpDSIG OS/2g#°x`cmap1"█Ё·cvt Їfpgmьgasp glyfR4hheadxD░№6hheaTр4$hmtxма╪loca^L°maxpX name╗п>pbpostr%─р╘7prepЁ(┤┘n_<їш╤Ц7╘¤яе2Ью Д■╘╙22Ь ИР╝КМ╝К▌2· АNONE└ &ю ╚Д,Ї╝ Ї2··ё7╙7\@  . &   . &   ї у ╓▀▀Ю╩"42┬ю3!'!2Р2■╘ю¤2К¤v7║z73#7ГГzz  7Ьz&'ётJ44<C4 \i)x б б #к #к;═4 h p А 2О p └ ┌ R° J J F\ F\ vвCopyright (c) 2015 by FontTools. No rights reserved.Test TTFRegularFontTools: Test TTF: 2015Version 1.000TestTTF-RegularTest TTF is not a trademark of FontTools.FontToolshttps://github.com/behdad/fonttoolshttps://github.com/behdad/fonttools/blob/master/LICENSE.txtCopyright (c) 2015 by FontTools. No rights reserved.Test TTFRegularFontTools: Test TTF: 2015Version 1.000TestTTF-RegularTest TTF is not a trademark of FontTools.FontToolshttps://github.com/behdad/fonttoolshttps://github.com/behdad/fonttools/blob/master/LICENSE.txt ╡2л.nullCR   enthought-chaco2-4.8.1.orig/kiva/fonttools/font.py0000644000175000017500000001277313544356225021221 0ustar varunvarun""" Defines the Kiva Font class and a utility method to parse free-form font specification strings into Font instances. """ from __future__ import absolute_import, print_function import six import copy from kiva.constants import (DEFAULT, DECORATIVE, ROMAN, SCRIPT, SWISS, MODERN, TELETYPE, NORMAL, ITALIC, BOLD, BOLD_ITALIC) # Various maps used by str_to_font font_families = { 'default': DEFAULT, 'decorative': DECORATIVE, 'roman': ROMAN, 'script': SCRIPT, 'swiss': SWISS, 'modern': MODERN } font_styles = {'italic': ITALIC} font_weights = {'bold': BOLD} font_noise = ['pt', 'point', 'family'] def str_to_font(fontspec): """ Converts a string specification of a font into a Font instance. string specifications are of the form: "modern 12", "9 roman italic", and so on. """ point_size = 10 family = DEFAULT style = NORMAL weight = NORMAL underline = 0 facename = [] for word in fontspec.split(): lword = word.lower() if lword in font_families: family = font_families[lword] elif lword in font_styles: style = font_styles[lword] elif lword in font_weights: weight = font_weights[lword] elif lword == 'underline': underline = 1 elif lword not in font_noise: try: point_size = int(lword) except: facename.append(word) return Font(size=point_size, family=family, weight=weight, style=style, underline=underline, face_name=' '.join(facename)) class Font(object): """ Font class for device independent font specification. It is primarily based on wxPython, but looks to be similar to the needs of Mac OS X, etc. The family defaults to SWISS so that font rotation will work correctly under wxPython. Revisit as we get more platforms defined. """ # Maps the constants for font families to names to use when searching for # fonts. familymap = { DEFAULT: "serif", SWISS: "sans-serif", ROMAN: "serif", MODERN: "sans-serif", DECORATIVE: "fantasy", SCRIPT: "script", TELETYPE: "monospace" } def __init__(self, face_name="", size=12, family=SWISS, weight=NORMAL, style=NORMAL, underline=0, encoding=DEFAULT): if (type(size) != int) or (type(family) != type(SWISS)) or \ (type(weight) != type(NORMAL)) or (type(style) != type(NORMAL)) or \ (type(underline) != int) or (not isinstance(face_name, six.string_types)) or \ (type(encoding) != type(DEFAULT)): raise RuntimeError("Bad value in Font() constructor.") ### HACK: C++ stuff expects a string (not unicode) for the face_name, so fix ### if needed. ### Only for python < 3 if six.PY2 and isinstance(face_name, six.text_type): face_name = face_name.encode("latin1") self.size = size self.family = family self.weight = weight self.style = style self.underline = underline self.face_name = face_name self.encoding = encoding def findfont(self): """ Returns the file name containing the font that most closely matches our font properties. """ from .font_manager import fontManager fp = self._make_font_props() return str(fontManager.findfont(fp)) def findfontname(self): """ Returns the name of the font that most closely matches our font properties """ fp = self._make_font_props() return fp.get_name() def _make_font_props(self): """ Returns a font_manager.FontProperties object that encapsulates our font properties """ from .font_manager import FontProperties # XXX: change the weight to a numerical value if self.style == BOLD or self.style == BOLD_ITALIC: weight = "bold" else: weight = "normal" if self.style == ITALIC or self.style == BOLD_ITALIC: style = "italic" else: style = "normal" fp = FontProperties(family=self.familymap[self.family], style=style, weight=weight, size=self.size) if self.face_name != "": fp.set_name(self.face_name) return fp def _get_name(self): return self.face_name def _set_name(self, val): self.face_name = val name = property(_get_name, _set_name) def copy(self): """ Returns a copy of the font object.""" return copy.deepcopy(self) def __eq__(self, other): result = False try: if (self.family == other.family and self.size == other.size and self.weight == other.weight and self.style == other.style and self.underline == other.underline and self.face_name == other.face_name and self.encoding == other.encoding): result = True except AttributeError: pass return result def __ne__(self, other): return not self.__eq__(other) def __repr__(self): fmt = ("Font(size=%d,family=%d,weight=%d, style=%d, face_name='%s', " + "encoding=%d)") return fmt % (self.size, self.family, self.weight, self.style, self.face_name, self.encoding) enthought-chaco2-4.8.1.orig/kiva/qpainter.py0000644000175000017500000007243013421603267020036 0ustar varunvarun# ------------------------------------------------------------------------------ # Copyright (c) 2010, Enthought, Inc # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! # ------------------------------------------------------------------------------ """ This is the QPainter backend for kiva. """ from __future__ import absolute_import, print_function from functools import partial import six.moves as sm import numpy as np import warnings # Major package imports. from pyface.qt import QtCore, QtGui # Local imports. from .abstract_graphics_context import AbstractGraphicsContext from .arc_conversion import arc_to_tangent_points from .fonttools import Font import kiva.constants as constants # These are the symbols that a backend has to define. __all__ = ["CompiledPath", "Font", "font_metrics_provider", "GraphicsContext"] cap_style = {} cap_style[constants.CAP_ROUND] = QtCore.Qt.RoundCap cap_style[constants.CAP_SQUARE] = QtCore.Qt.SquareCap cap_style[constants.CAP_BUTT] = QtCore.Qt.FlatCap join_style = {} join_style[constants.JOIN_ROUND] = QtCore.Qt.RoundJoin join_style[constants.JOIN_BEVEL] = QtCore.Qt.BevelJoin join_style[constants.JOIN_MITER] = QtCore.Qt.MiterJoin draw_modes = {} draw_modes[constants.FILL] = QtCore.Qt.OddEvenFill draw_modes[constants.EOF_FILL] = QtCore.Qt.WindingFill draw_modes[constants.STROKE] = 0 draw_modes[constants.FILL_STROKE] = QtCore.Qt.OddEvenFill draw_modes[constants.EOF_FILL_STROKE] = QtCore.Qt.WindingFill gradient_coord_modes = {} gradient_coord_modes['userSpaceOnUse'] = QtGui.QGradient.LogicalMode gradient_coord_modes['objectBoundingBox'] = QtGui.QGradient.ObjectBoundingMode gradient_spread_modes = {} gradient_spread_modes['pad'] = QtGui.QGradient.PadSpread gradient_spread_modes['repeat'] = QtGui.QGradient.RepeatSpread gradient_spread_modes['reflect'] = QtGui.QGradient.ReflectSpread class GraphicsContext(object): """ Simple wrapper around a Qt QPainter object. """ def __init__(self, size, *args, **kwargs): super(GraphicsContext, self).__init__() self._width = size[0] self._height = size[1] self.text_pos = [0.0, 0.0] self.text_transform = (1.0, 0.0, 0.0, 1.0, 0.0, 0.0) # create some sort of device context parent = kwargs.pop("parent", None) if parent is None: # no parent -> offscreen context self.qt_dc = QtGui.QPixmap(*size) else: # normal windowed context self.qt_dc = parent self.gc = QtGui.QPainter(self.qt_dc) self.path = CompiledPath() # flip y trans = QtGui.QTransform() trans.translate(0, size[1]) trans.scale(1.0, -1.0) self.gc.setWorldTransform(trans) # enable antialiasing self.gc.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing, True) # set the pen and brush to useful defaults self.gc.setPen(QtCore.Qt.black) self.gc.setBrush(QtGui.QBrush(QtCore.Qt.SolidPattern)) def __del__(self): # stop the painter if needed if self.gc.isActive(): self.gc.end() # ---------------------------------------------------------------- # Size info # ---------------------------------------------------------------- def height(self): """ Returns the height of the context. """ return self._height def width(self): """ Returns the width of the context. """ return self._width # ---------------------------------------------------------------- # Coordinate Transform Matrix Manipulation # ---------------------------------------------------------------- def scale_ctm(self, sx, sy): """ Set the coordinate system scale to the given values, (sx, sy). sx:float -- The new scale factor for the x axis sy:float -- The new scale factor for the y axis """ self.gc.scale(sx, sy) def translate_ctm(self, tx, ty): """ Translate the coordinate system by the given value by (tx, ty) tx:float -- The distance to move in the x direction ty:float -- The distance to move in the y direction """ self.gc.translate(tx, ty) def rotate_ctm(self, angle): """ Rotates the coordinate space for drawing by the given angle. angle:float -- the angle, in radians, to rotate the coordinate system """ self.gc.rotate(np.rad2deg(angle)) def concat_ctm(self, transform): """ Concatenate the transform to current coordinate transform matrix. transform:affine_matrix -- the transform matrix to concatenate with the current coordinate matrix. """ m11, m12, m21, m22, tx, ty = transform self.gc.setTransform(QtGui.QTransform(m11, m12, m21, m22, tx, ty), True) def get_ctm(self): """ Return the current coordinate transform matrix. """ t = self.gc.transform() return (t.m11(), t.m12(), t.m21(), t.m22(), t.dx(), t.dy()) # ---------------------------------------------------------------- # Save/Restore graphics state. # ---------------------------------------------------------------- def save_state(self): """ Save the current graphic's context state. This should always be paired with a restore_state """ self.gc.save() def restore_state(self): """ Restore the previous graphics state. """ self.gc.restore() # ---------------------------------------------------------------- # context manager interface # ---------------------------------------------------------------- def __enter__(self): self.save_state() def __exit__(self, type, value, traceback): self.restore_state() # ---------------------------------------------------------------- # Manipulate graphics state attributes. # ---------------------------------------------------------------- def set_antialias(self, value): """ Set/Unset antialiasing for bitmap graphics context. """ self.gc.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing, value) def set_line_width(self, width): """ Set the line width for drawing width:float -- The new width for lines in user space units. """ pen = self.gc.pen() pen.setWidthF(width) self.gc.setPen(pen) def set_line_join(self, style): """ Set style for joining lines in a drawing. style:join_style -- The line joining style. The available styles are JOIN_ROUND, JOIN_BEVEL, JOIN_MITER. """ try: sjoin = join_style[style] except KeyError: msg = "Invalid line join style. See documentation for valid styles" raise ValueError(msg) pen = self.gc.pen() pen.setJoinStyle(sjoin) self.gc.setPen(pen) def set_miter_limit(self, limit): """ Specifies limits on line lengths for mitering line joins. If line_join is set to miter joins, the limit specifies which line joins should actually be mitered. If lines aren't mitered, they are joined with a bevel. The line width is divided by the length of the miter. If the result is greater than the limit, the bevel style is used. limit:float -- limit for mitering joins. """ pen = self.gc.pen() pen.setMiterLimit(limit) self.gc.setPen(pen) def set_line_cap(self, style): """ Specify the style of endings to put on line ends. style:cap_style -- the line cap style to use. Available styles are CAP_ROUND, CAP_BUTT, CAP_SQUARE """ try: scap = cap_style[style] except KeyError: msg = "Invalid line cap style. See documentation for valid styles" raise ValueError(msg) pen = self.gc.pen() pen.setCapStyle(scap) self.gc.setPen(pen) def set_line_dash(self, lengths, phase=0): """ lengths:float array -- An array of floating point values specifing the lengths of on/off painting pattern for lines. phase:float -- Specifies how many units into dash pattern to start. phase defaults to 0. """ lengths = list(lengths) if lengths is not None else [] pen = self.gc.pen() pen.setDashPattern(lengths) pen.setDashOffset(phase) self.gc.setPen(pen) def set_flatness(self, flatness): """ Not implemented It is device dependent and therefore not recommended by the PDF documentation. """ raise NotImplementedError() # ---------------------------------------------------------------- # Sending drawing data to a device # ---------------------------------------------------------------- def flush(self): """ Send all drawing data to the destination device. """ pass def synchronize(self): """ Prepares drawing data to be updated on a destination device. """ pass # ---------------------------------------------------------------- # Page Definitions # ---------------------------------------------------------------- def begin_page(self): """ Create a new page within the graphics context. """ pass def end_page(self): """ End drawing in the current page of the graphics context. """ pass # ---------------------------------------------------------------- # Building paths (contours that are drawn) # # + Currently, nothing is drawn as the path is built. Instead, the # instructions are stored and later drawn. Should this be changed? # We will likely draw to a buffer instead of directly to the canvas # anyway. # # Hmmm. No. We have to keep the path around for storing as a # clipping region and things like that. # # + I think we should keep the current_path_point hanging around. # # ---------------------------------------------------------------- def begin_path(self): """ Clear the current drawing path and begin a new one. """ self.path = CompiledPath() def move_to(self, x, y): """ Start a new drawing subpath at place the current point at (x, y). """ self.path.move_to(x, y) def line_to(self, x, y): """ Add a line from the current point to the given point (x, y). The current point is moved to (x, y). """ self.path.line_to(x, y) def lines(self, points): """ Add a series of lines as a new subpath. Currently implemented by calling line_to a zillion times. Points is an Nx2 array of x, y pairs. """ self.path.lines(points) def line_set(self, starts, ends): """ Draw multiple disjoint line segments. """ for start, end in sm.zip(starts, ends): self.path.path.moveTo(start[0], start[1]) self.path.path.lineTo(end[0], end[1]) def rect(self, x, y, sx, sy): """ Add a rectangle as a new subpath. """ self.path.rect(x, y, sx, sy) def rects(self, rects): """ Add multiple rectangles as separate subpaths to the path. """ self.path.rects(rects) def draw_rect(self, rect, mode=constants.FILL_STROKE): """ Draw a rect. """ rect = QtCore.QRectF(*rect) if mode == constants.STROKE: save_brush = self.gc.brush() self.gc.setBrush(QtGui.QBrush(QtCore.Qt.NoBrush)) self.gc.drawRect(rect) self.gc.setBrush(save_brush) elif mode in [constants.FILL, constants.EOF_FILL]: self.gc.fillRect(rect, self.gc.brush()) else: self.gc.fillRect(rect, self.gc.brush()) self.gc.drawRect(rect) def add_path(self, path): """ Add a subpath to the current path. """ self.path.add_path(path) def close_path(self): """ Close the path of the current subpath. """ self.path.close_path() def curve_to(self, cp1x, cp1y, cp2x, cp2y, x, y): """ """ self.path.curve_to(cp1x, cp1y, cp2x, cp2y, x, y) def quad_curve_to(self, cpx, cpy, x, y): """ """ self.path.quad_curve_to(cpx, cpy, x, y) def arc(self, x, y, radius, start_angle, end_angle, clockwise=False): """ """ self.path.arc(x, y, radius, start_angle, end_angle, clockwise) def arc_to(self, x1, y1, x2, y2, radius): """ """ self.path.arc_to(x1, y1, x2, y2, radius) # ---------------------------------------------------------------- # Getting infomration on paths # ---------------------------------------------------------------- def is_path_empty(self): """ Test to see if the current drawing path is empty """ return self.path.is_empty() def get_path_current_point(self): """ Return the current point from the graphics context. """ return self.path.get_current_point() def get_path_bounding_box(self): """ Return the bounding box for the current path object. """ return self.path.get_bounding_box() # ---------------------------------------------------------------- # Clipping path manipulation # ---------------------------------------------------------------- def clip(self): """ """ self.gc.setClipPath(self.path.path) def even_odd_clip(self): """ """ self.gc.setClipPath(self.path.path, operation=QtCore.Qt.IntersectClip) def clip_to_rect(self, x, y, w, h): """ Clip context to the given rectangular region. Region should be a 4-tuple or a sequence. """ self.gc.setClipRect(QtCore.QRectF(x, y, w, h), operation=QtCore.Qt.IntersectClip) def clip_to_rects(self, rects): """ """ # Create a region which is a union of all rects. clip_region = QtGui.QRegion() for rect in rects: clip_region = clip_region.unite(QtGui.QRegion(*rect)) # Then intersect that region with the current clip region. self.gc.setClipRegion(clip_region, operation=QtCore.Qt.IntersectClip) # ---------------------------------------------------------------- # Color space manipulation # # I'm not sure we'll mess with these at all. They seem to # be for setting the color system. Hard coding to RGB or # RGBA for now sounds like a reasonable solution. # ---------------------------------------------------------------- def set_fill_color_space(self): """ """ msg = "set_fill_color_space not implemented on Qt yet." raise NotImplementedError(msg) def set_stroke_color_space(self): """ """ msg = "set_stroke_color_space not implemented on Qt yet." raise NotImplementedError(msg) def set_rendering_intent(self): """ """ msg = "set_rendering_intent not implemented on Qt yet." raise NotImplementedError(msg) # ---------------------------------------------------------------- # Color manipulation # ---------------------------------------------------------------- def set_fill_color(self, color): """ """ r, g, b = color[:3] try: a = color[3] except IndexError: a = 1.0 brush = self.gc.brush() brush.setColor(QtGui.QColor.fromRgbF(r, g, b, a)) self.gc.setBrush(brush) def set_stroke_color(self, color): """ """ r, g, b = color[:3] try: a = color[3] except IndexError: a = 1.0 pen = self.gc.pen() pen.setColor(QtGui.QColor.fromRgbF(r, g, b, a)) self.gc.setPen(pen) def set_alpha(self, alpha): """ """ self.gc.setOpacity(alpha) # ---------------------------------------------------------------- # Gradients # ---------------------------------------------------------------- def _apply_gradient(self, grad, stops, spread_method, units): """ Configures a gradient object and sets it as the current brush. """ grad.setSpread(gradient_spread_modes.get(spread_method, QtGui.QGradient.PadSpread)) grad.setCoordinateMode(gradient_coord_modes.get( units, QtGui.QGradient.LogicalMode)) for stop in stops: grad.setColorAt(stop[0], QtGui.QColor.fromRgbF(*stop[1:])) self.gc.setBrush(QtGui.QBrush(grad)) def linear_gradient(self, x1, y1, x2, y2, stops, spread_method, units='userSpaceOnUse'): """ Sets a linear gradient as the current brush. """ grad = QtGui.QLinearGradient(x1, y1, x2, y2) self._apply_gradient(grad, stops, spread_method, units) def radial_gradient(self, cx, cy, r, fx, fy, stops, spread_method, units='userSpaceOnUse'): """ Sets a radial gradient as the current brush. """ grad = QtGui.QRadialGradient(cx, cy, r, fx, fy) self._apply_gradient(grad, stops, spread_method, units) # ---------------------------------------------------------------- # Drawing Images # ---------------------------------------------------------------- def draw_image(self, img, rect=None): """ img is either a N*M*3 or N*M*4 numpy array, or a Kiva image rect - a tuple (x, y, w, h) """ from kiva import agg def copy_padded(array): """ Pad image width to a multiple of 4 pixels, and minimum dims of 12x12. QImage is very particular about its data. """ y, x, d = array.shape pad = lambda v: (4 - (v % 4)) % 4 nx = max(x + pad(x), 12) ny = max(y, 12) if x == nx and y == ny: return array ret = np.zeros((ny, nx, d), dtype=np.uint8) ret[:y, :x] = array[:] return ret if type(img) == type(np.array([])): # Numeric array if img.shape[2] == 3: format = QtGui.QImage.Format_RGB888 elif img.shape[2] == 4: format = QtGui.QImage.Format_RGB32 width, height = img.shape[:2] copy_array = copy_padded(img) draw_img = QtGui.QImage(img.astype(np.uint8), copy_array.shape[1], height, format) pixmap = QtGui.QPixmap.fromImage(draw_img) elif isinstance(img, agg.GraphicsContextArray): converted_img = img.convert_pixel_format('bgra32', inplace=0) copy_array = copy_padded(converted_img.bmp_array) width, height = img.width(), img.height() draw_img = QtGui.QImage(copy_array.flatten(), copy_array.shape[1], height, QtGui.QImage.Format_RGB32) pixmap = QtGui.QPixmap.fromImage(draw_img) elif (isinstance(img, GraphicsContext) and isinstance(img.qt_dc, QtGui.QPixmap) and img.gc.isActive()): # An offscreen Qt kiva context # Calling qpainter.device() appears to introduce a memory leak. # using the display context and calling qpainter.isActive() has # the same outcome. pixmap = img.qt_dc width, height = pixmap.width(), pixmap.height() else: msg = ("Cannot render image of type '%r' into Qt4 context." % type(img)) warnings.warn(msg) return # create a rect object to draw into if rect is None: dest_rect = QtCore.QRectF(0.0, 0.0, self.width(), self.height()) else: dest_rect = QtCore.QRectF(*rect) # draw using the entire image's data source_rect = QtCore.QRectF(0.0, 0.0, width, height) flip_trans = QtGui.QTransform() flip_trans.scale(1.0, -1.0) pixmap = pixmap.transformed(flip_trans) # draw self.gc.drawPixmap(dest_rect, pixmap, source_rect) # ---------------------------------------------------------------- # Drawing Text # ---------------------------------------------------------------- def select_font(self, name, size, textEncoding): """ Set the font for the current graphics context. """ self.gc.setFont(QtGui.QFont(name, size)) def set_font(self, font): """ Set the font for the current graphics context. """ self.select_font(font.face_name, font.size, None) def set_font_size(self, size): """ """ font = self.gc.font() font.setPointSizeF(size) self.gc.setFont(font) def set_character_spacing(self, spacing): """ """ font = self.gc.font() font.setLetterSpacing(QtGui.QFont.AbsoluteSpacing, spacing) self.gc.setFont(font) def set_text_drawing_mode(self): """ """ pass def set_text_position(self, x, y): """ """ self.text_pos = [x, y] def get_text_position(self): """ """ return self.text_pos def set_text_matrix(self, ttm): """ """ self.text_transform = ttm def get_text_matrix(self): """ """ return self.text_transform def show_text(self, text, point=None): """ Draw text on the device at current text position. This is also used for showing text at a particular point specified by x and y. """ if point is None: pos = tuple(self.text_pos) else: pos = tuple(point) unflip_trans = QtGui.QTransform(*self.text_transform) unflip_trans.translate(0, self._height) unflip_trans.scale(1.0, -1.0) self.gc.save() self.gc.setTransform(unflip_trans, True) self.gc.drawText(QtCore.QPointF(pos[0], self._flip_y(pos[1])), text) self.gc.restore() def show_text_at_point(self, text, x, y): """ Draw text at some point (x, y). """ self.show_text(text, (x, y)) def show_glyphs(self): """ """ msg = "show_glyphs not implemented on Qt yet." raise NotImplementedError(msg) def get_text_extent(self, text): """ Returns the bounding rect of the rendered text """ fm = self.gc.fontMetrics() rect = fm.boundingRect(text) return rect.left(), -fm.descent(), rect.right(), fm.height() def get_full_text_extent(self, text): """ Backwards compatibility API over .get_text_extent() for Enable """ x1, y1, x2, y2 = self.get_text_extent(text) return x2, y2, y1, x1 # ---------------------------------------------------------------- # Painting paths (drawing and filling contours) # ---------------------------------------------------------------- def stroke_path(self): """ """ self.gc.strokePath(self.path.path, self.gc.pen()) self.begin_path() def fill_path(self): """ """ self.gc.fillPath(self.path.path, self.gc.brush()) self.begin_path() def eof_fill_path(self): """ """ self.path.path.setFillRule(QtCore.Qt.OddEvenFill) self.gc.fillPath(self.path.path, self.gc.brush()) self.begin_path() def stroke_rect(self, rect): """ """ self.gc.drawRect(QtCore.QRectF(*rect)) def stroke_rect_with_width(self, rect, width): """ """ save_pen = self.gc.pen() draw_pen = QtGui.QPen(save_pen) draw_pen.setWidthF(width) self.gc.setPen(draw_pen) self.stroke_rect(rect) self.gc.setPen(save_pen) def fill_rect(self, rect): """ """ self.gc.fillRect(QtCore.QRectF(*rect), self.gc.brush()) def fill_rects(self): """ """ msg = "fill_rects not implemented on Qt yet." raise NotImplementedError(msg) def clear_rect(self, rect): """ """ self.gc.eraseRect(QtCore.QRectF(*rect)) def clear(self, clear_color=(1.0, 1.0, 1.0, 1.0)): """ """ if len(clear_color) == 4: r, g, b, a = clear_color else: r, g, b = clear_color a = 1.0 self.gc.setBackground(QtGui.QBrush(QtGui.QColor.fromRgbF(r, g, b, a))) self.gc.eraseRect(QtCore.QRectF(0, 0, self.width(), self.height())) def draw_path(self, mode=constants.FILL_STROKE): """ Walk through all the drawing subpaths and draw each element. Each subpath is drawn separately. """ if mode == constants.STROKE: self.stroke_path() elif mode in [constants.FILL, constants.EOF_FILL]: mode = draw_modes[mode] self.path.path.setFillRule(mode) self.fill_path() else: mode = draw_modes[mode] self.path.path.setFillRule(mode) self.gc.drawPath(self.path.path) self.begin_path() def get_empty_path(self): """ Return a path object that can be built up and then reused. """ return CompiledPath() def draw_path_at_points(self, points, path, mode=constants.FILL_STROKE): # set up drawing state and function if mode == constants.STROKE: draw_func = partial(self.gc.strokePath, path.path, self.gc.pen()) elif mode in [constants.FILL, constants.EOF_FILL]: mode = draw_modes[mode] path.path.setFillRule(mode) draw_func = partial(self.gc.fillPath, path.path, self.gc.brush()) else: mode = draw_modes[mode] path.path.setFillRule(mode) draw_func = partial(self.gc.drawPath, path.path) for point in points: x, y = point self.gc.save() self.gc.translate(x, y) draw_func() self.gc.restore() def _flip_y(self, y): "Converts between a Kiva and a Qt y coordinate" return self._height - y - 1 def save(self, filename, file_format=None): """ Save the contents of the context to a file """ if isinstance(self.qt_dc, QtGui.QPixmap): self.qt_dc.save(filename, format=file_format) else: msg = "save not implemented for window contexts." raise NotImplementedError(msg) class CompiledPath(object): def __init__(self): self.path = QtGui.QPainterPath() def begin_path(self): return def move_to(self, x, y): self.path.moveTo(x, y) def arc(self, x, y, r, start_angle, end_angle, clockwise=False): sweep_angle = (end_angle-start_angle if not clockwise else start_angle-end_angle) self.path.moveTo(x, y) self.path.arcTo(QtCore.QRectF(x-r, y-r, r*2, r*2), np.rad2deg(start_angle), np.rad2deg(sweep_angle)) def arc_to(self, x1, y1, x2, y2, r): # get the current pen position current_point = self.get_current_point() # Get the two points on the curve where it touches the line segments t1, t2 = arc_to_tangent_points(current_point, (x1, y1), (x2, y2), r) # draw! self.path.lineTo(*t1) self.path.quadTo(x1, y1, *t2) self.path.lineTo(x2, y2) def line_to(self, x, y): self.path.lineTo(x, y) def lines(self, points): self.path.moveTo(points[0][0], points[0][1]) for x, y in points[1:]: self.path.lineTo(x, y) def curve_to(self, cx1, cy1, cx2, cy2, x, y): self.path.cubicTo(cx1, cy1, cx2, cy2, x, y) def quad_curve_to(self, cx, cy, x, y): self.path.quadTo(cx, cy, x, y) def rect(self, x, y, sx, sy): self.path.addRect(x, y, sx, sy) def rects(self, rects): for x, y, sx, sy in rects: self.path.addRect(x, y, sx, sy) def add_path(self, other_path): if isinstance(other_path, CompiledPath): self.path.addPath(other_path.path) def close_path(self): self.path.closeSubpath() def is_empty(self): return self.path.isEmpty() def get_current_point(self): point = self.path.currentPosition() return point.x(), point.y() def get_bounding_box(self): rect = self.path.boundingRect() return rect.x(), rect.y(), rect.width(), rect.height() # GraphicsContext should implement AbstractGraphicsContext AbstractGraphicsContext.register(GraphicsContext) def font_metrics_provider(): """ Creates an object to be used for querying font metrics. """ return GraphicsContext((1, 1)) enthought-chaco2-4.8.1.orig/kiva/quartz/0000755000175000017500000000000013544357630017167 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/quartz/mac_context.h0000644000175000017500000000024113233644505021634 0ustar varunvarun// // mac_context.h // // Created by John Wiggins // Copyright (c) 2011-2012 Enthought. All rights reserved. // void * get_cg_context_ref(void *view_ptr); enthought-chaco2-4.8.1.orig/kiva/quartz/CoreFoundation.pxi0000644000175000017500000001552313233644505022631 0ustar varunvarun# :Author: Robert Kern # :Copyright: 2004, Enthought, Inc. # :License: BSD Style cdef extern from "CoreFoundation/CoreFoundation.h": ctypedef int OSStatus cdef enum: noErr ctypedef enum CFStringEncoding: kCFStringEncodingMacRoman = 0 kCFStringEncodingWindowsLatin1 = 0x0500 kCFStringEncodingISOLatin1 = 0x0201 kCFStringEncodingNextStepLatin = 0x0B01 kCFStringEncodingASCII = 0x0600 kCFStringEncodingUnicode = 0x0100 kCFStringEncodingUTF8 = 0x08000100 kCFStringEncodingNonLossyASCII = 0x0BFF ctypedef unsigned char UInt8 ctypedef unsigned short UniChar ctypedef int bool ctypedef bool Boolean ctypedef void* CFTypeRef ctypedef unsigned int CFTypeID void CFRelease(CFTypeRef cf) ctypedef CFTypeRef CFStringRef ctypedef unsigned int CFIndex ctypedef CFIndex CFNumberType ctypedef unsigned long CFHashCode ctypedef struct CFRange: CFIndex location CFIndex length CFRange CFRangeMake(CFIndex location, CFIndex length) CFStringRef CFStringCreateWithCString(void* alloc, char* cStr, CFStringEncoding encoding) char* CFStringGetCStringPtr(CFStringRef string, CFStringEncoding encoding) Boolean CFStringGetCString(CFStringRef theString, char* buffer, CFIndex bufferSize, CFStringEncoding encoding) CFIndex CFStringGetLength(CFStringRef theString) void CFStringGetCharacters(CFStringRef theString, CFRange range, UniChar *buffer) ctypedef enum CFURLPathStyle: kCFURLPOSIXPathStyle = 0 kCFURLHFSPathStyle = 1 kCFURLWindowsPathStyle = 2 ctypedef CFTypeRef CFURLRef CFURLRef CFURLCreateWithFileSystemPath(void* allocator, CFStringRef filePath, CFURLPathStyle pathStyle, bool isDirectory) void CFShow(CFTypeRef cf) CFTypeID CFGetTypeID(CFTypeRef cf) ctypedef struct CFArrayCallBacks: CFIndex version #CFArrayRetainCallBack retain #CFArrayReleaseCallBack release #CFArrayCopyDescriptionCallBack copyDescription #CFArrayEqualCallBack equal cdef CFArrayCallBacks kCFTypeArrayCallBacks #ctypedef void (*CFArrayApplierFunction)(void *value, void *context) ctypedef CFTypeRef CFArrayRef ctypedef CFTypeRef CFMutableArrayRef CFArrayRef CFArrayCreate(void* allocator, void **values, CFIndex numValues, CFArrayCallBacks *callBacks) CFArrayRef CFArrayCreateCopy(void* allocator, CFArrayRef theArray) CFMutableArrayRef CFArrayCreateMutable(void* allocator, CFIndex capacity, CFArrayCallBacks *callBacks) CFMutableArrayRef CFArrayCreateMutableCopy(void* allocator, CFIndex capacity, CFArrayRef theArray) CFIndex CFArrayGetCount(CFArrayRef theArray) CFIndex CFArrayGetCountOfValue(CFArrayRef theArray, CFRange range, void *value) Boolean CFArrayContainsValue(CFArrayRef theArray, CFRange range, void *value) void *CFArrayGetValueAtIndex(CFArrayRef theArray, CFIndex idx) void CFArrayGetValues(CFArrayRef theArray, CFRange range, void **values) #void CFArrayApplyFunction(CFArrayRef theArray, CFRange range, # CFArrayApplierFunction applier, void *context) CFIndex CFArrayGetFirstIndexOfValue(CFArrayRef theArray, CFRange range, void *value) CFIndex CFArrayGetLastIndexOfValue(CFArrayRef theArray, CFRange range, void *value) #CFIndex CFArrayBSearchValues(CFArrayRef theArray, CFRange range, # void *value, CFComparatorFunction comparator, void *context) void CFArrayAppendValue(CFMutableArrayRef theArray, void *value) void CFArrayInsertValueAtIndex(CFMutableArrayRef theArray, CFIndex idx, void *value) void CFArraySetValueAtIndex(CFMutableArrayRef theArray, CFIndex idx, void *value) void CFArrayRemoveValueAtIndex(CFMutableArrayRef theArray, CFIndex idx) void CFArrayRemoveAllValues(CFMutableArrayRef theArray) void CFArrayReplaceValues(CFMutableArrayRef theArray, CFRange range, void **newValues, CFIndex newCount) void CFArrayExchangeValuesAtIndices(CFMutableArrayRef theArray, CFIndex idx1, CFIndex idx2) #void CFArraySortValues(CFMutableArrayRef theArray, CFRange range, # CFComparatorFunction comparator, void *context) void CFArrayAppendArray(CFMutableArrayRef theArray, CFArrayRef otherArray, CFRange otherRange) ctypedef CFTypeRef CFDictionaryRef ctypedef CFTypeRef CFMutableDictionaryRef ctypedef struct CFDictionaryKeyCallBacks: CFIndex version #CFDictionaryRetainCallBack retain #CFDictionaryReleaseCallBack release #CFDictionaryCopyDescriptionCallBack copyDescription #CFDictionaryEqualCallBack equal #CFDictionaryHashCallBack hash ctypedef struct CFDictionaryValueCallBacks: CFIndex version #CFDictionaryRetainCallBack retain #CFDictionaryReleaseCallBack release #CFDictionaryCopyDescriptionCallBack copyDescription #CFDictionaryEqualCallBack equal cdef CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks cdef CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks CFDictionaryRef CFDictionaryCreate(void* allocator, void** keys, void** values, CFIndex numValues, CFDictionaryKeyCallBacks* keyCallBacks, CFDictionaryValueCallBacks* valueCallBacks) CFMutableDictionaryRef CFDictionaryCreateMutable(void* allocator, CFIndex capacity, CFDictionaryKeyCallBacks *keyCallBacks, CFDictionaryValueCallBacks *valueCallBacks) void CFDictionaryAddValue(CFMutableDictionaryRef theDict, void *key, void *value) void CFDictionarySetValue(CFMutableDictionaryRef theDict, void *key, void *value) ctypedef CFTypeRef CFAttributedStringRef ctypedef CFTypeRef CFMutableAttributedStringRef CFAttributedStringRef CFAttributedStringCreate(void* alloc, CFStringRef str, CFDictionaryRef attributes) CFMutableAttributedStringRef CFAttributedStringCreateMutable(void* alloc, CFIndex maxLength) void CFAttributedStringReplaceString(CFMutableAttributedStringRef aStr, CFRange range, CFStringRef replacement) void CFAttributedStringSetAttribute(CFMutableAttributedStringRef aStr, CFRange range, CFStringRef attrName, CFTypeRef value) ctypedef CFTypeRef CFNumberRef ctypedef enum CFNumberType_: kCFNumberSInt8Type = 1 kCFNumberSInt16Type = 2 kCFNumberSInt32Type = 3 kCFNumberSInt64Type = 4 kCFNumberFloat32Type = 5 kCFNumberFloat64Type = 6 kCFNumberCharType = 7 kCFNumberShortType = 8 kCFNumberIntType = 9 kCFNumberLongType = 10 kCFNumberLongLongType = 11 kCFNumberFloatType = 12 kCFNumberDoubleType = 13 kCFNumberCFIndexType = 14 CFNumberRef CFNumberCreate(void* allocator, CFNumberType theType, void *valuePtr) enthought-chaco2-4.8.1.orig/kiva/quartz/ABCGI.pyx0000644000175000017500000026463413321720235020541 0ustar varunvarun# :Author: Robert Kern # :Copyright: 2004, 2007, Enthought, Inc. # :License: BSD Style from __future__ import print_function include "Python.pxi" include "CoreFoundation.pxi" include "CoreGraphics.pxi" include "CoreText.pxi" cimport c_numpy import os import warnings from CTFont import default_font_info cdef extern from "math.h": double sqrt(double arg) int isnan(double arg) cdef CFURLRef url_from_filename(char* filename) except NULL: cdef CFStringRef filePath filePath = CFStringCreateWithCString(NULL, filename, kCFStringEncodingUTF8) if filePath == NULL: raise RuntimeError("could not create CFStringRef") cdef CFURLRef cfurl cfurl = CFURLCreateWithFileSystemPath(NULL, filePath, kCFURLPOSIXPathStyle, 0) CFRelease(filePath) if cfurl == NULL: raise RuntimeError("could not create a CFURLRef") return cfurl cdef CGRect CGRectMakeFromPython(object seq): return CGRectMake(seq[0], seq[1], seq[2], seq[3]) # Enumerations class LineCap: butt = kCGLineCapButt round = kCGLineCapRound square = kCGLineCapSquare class LineJoin: miter = kCGLineJoinMiter round = kCGLineJoinRound bevel = kCGLineJoinBevel class PathDrawingMode: fill = kCGPathFill eof_fill = kCGPathEOFill stroke = kCGPathStroke fill_stroke = kCGPathFillStroke eof_fill_stroke = kCGPathEOFillStroke class RectEdge: min_x_edge = CGRectMinXEdge min_y_edge = CGRectMinYEdge max_x_edge = CGRectMaxXEdge max_y_edge = CGRectMaxYEdge class ColorRenderingIntent: default = kCGRenderingIntentDefault absolute_colorimetric = kCGRenderingIntentAbsoluteColorimetric realative_colorimetric = kCGRenderingIntentRelativeColorimetric perceptual = kCGRenderingIntentPerceptual saturation = kCGRenderingIntentSaturation #class ColorSpaces: # gray = kCGColorSpaceUserGray # rgb = kCGColorSpaceUserRGB # cmyk = kCGColorSpaceUserCMYK class FontEnum: index_max = kCGFontIndexMax index_invalid = kCGFontIndexInvalid glyph_max = kCGGlyphMax class TextDrawingMode: fill = kCGTextFill stroke = kCGTextStroke fill_stroke = kCGTextFillStroke invisible = kCGTextInvisible fill_clip = kCGTextFillClip stroke_clip = kCGTextStrokeClip fill_stroke_clip = kCGTextFillStrokeClip clip = kCGTextClip class TextEncodings: font_specific = kCGEncodingFontSpecific mac_roman = kCGEncodingMacRoman class ImageAlphaInfo: none = kCGImageAlphaNone premultiplied_last = kCGImageAlphaPremultipliedLast premultiplied_first = kCGImageAlphaPremultipliedFirst last = kCGImageAlphaLast first = kCGImageAlphaFirst none_skip_last = kCGImageAlphaNoneSkipLast none_skip_first = kCGImageAlphaNoneSkipFirst only = kCGImageAlphaOnly class InterpolationQuality: default = kCGInterpolationDefault none = kCGInterpolationNone low = kCGInterpolationLow high = kCGInterpolationHigh class PathElementType: move_to = kCGPathElementMoveToPoint, line_to = kCGPathElementAddLineToPoint, quad_curve_to = kCGPathElementAddQuadCurveToPoint, curve_to = kCGPathElementAddCurveToPoint, close_path = kCGPathElementCloseSubpath class StringEncoding: mac_roman = kCFStringEncodingMacRoman windows_latin1 = kCFStringEncodingWindowsLatin1 iso_latin1 = kCFStringEncodingISOLatin1 nextstep_latin = kCFStringEncodingNextStepLatin ascii = kCFStringEncodingASCII unicode = kCFStringEncodingUnicode utf8 = kCFStringEncodingUTF8 nonlossy_ascii = kCFStringEncodingNonLossyASCII class URLPathStyle: posix = kCFURLPOSIXPathStyle hfs = kCFURLHFSPathStyle windows = kCFURLWindowsPathStyle c_numpy.import_array() import numpy from kiva import constants cap_style = {} cap_style[constants.CAP_ROUND] = kCGLineCapRound cap_style[constants.CAP_SQUARE] = kCGLineCapSquare cap_style[constants.CAP_BUTT] = kCGLineCapButt join_style = {} join_style[constants.JOIN_ROUND] = kCGLineJoinRound join_style[constants.JOIN_BEVEL] = kCGLineJoinBevel join_style[constants.JOIN_MITER] = kCGLineJoinMiter draw_modes = {} draw_modes[constants.FILL] = kCGPathFill draw_modes[constants.EOF_FILL] = kCGPathEOFill draw_modes[constants.STROKE] = kCGPathStroke draw_modes[constants.FILL_STROKE] = kCGPathFillStroke draw_modes[constants.EOF_FILL_STROKE] = kCGPathEOFillStroke text_modes = {} text_modes[constants.TEXT_FILL] = kCGTextFill text_modes[constants.TEXT_STROKE] = kCGTextStroke text_modes[constants.TEXT_FILL_STROKE] = kCGTextFillStroke text_modes[constants.TEXT_INVISIBLE] = kCGTextInvisible text_modes[constants.TEXT_FILL_CLIP] = kCGTextFillClip text_modes[constants.TEXT_STROKE_CLIP] = kCGTextStrokeClip text_modes[constants.TEXT_FILL_STROKE_CLIP] = kCGTextFillStrokeClip text_modes[constants.TEXT_CLIP] = kCGTextClip # this last one doesn't exist in Quartz text_modes[constants.TEXT_OUTLINE] = kCGTextStroke cdef class CGContext cdef class CGContextInABox(CGContext) cdef class CGImage cdef class CGPDFDocument cdef class Rect cdef class CGLayerContext(CGContextInABox) cdef class CGGLContext(CGContextInABox) cdef class CGBitmapContext(CGContext) cdef class CGPDFContext(CGContext) cdef class CGImageMask(CGImage) cdef class CGAffine cdef class CGMutablePath cdef class Shading cdef class ShadingFunction cdef class CGContext: cdef CGContextRef context cdef long can_release cdef object current_font cdef object current_style cdef CGAffineTransform text_matrix cdef object font_cache cdef object fill_color cdef object stroke_color def __cinit__(self, *args, **kwds): self.context = NULL self.can_release = 0 self.text_matrix = CGAffineTransformMake(1.0, 0.0, 0.0, 1.0, 0.0, 0.0) def __init__(self, size_t context, long can_release=0): self.context = context self.can_release = can_release self.fill_color = (0.0, 0.0, 0.0, 1.0) self.stroke_color = (0.0, 0.0, 0.0, 1.0) self._setup_color_space() self._setup_fonts() def _setup_color_space(self): # setup an RGB color space cdef CGColorSpaceRef space space = CGColorSpaceCreateDeviceRGB() CGContextSetFillColorSpace(self.context, space) CGContextSetStrokeColorSpace(self.context, space) CGColorSpaceRelease(space) def _setup_fonts(self): self.current_font = None self.current_style = None self.font_cache = {} self.select_font("Helvetica", 12) CGContextSetShouldSmoothFonts(self.context, 1) CGContextSetShouldAntialias(self.context, 1) CGContextSetTextMatrix(self.context, CGAffineTransformIdentity); #---------------------------------------------------------------- # Coordinate Transform Matrix Manipulation #---------------------------------------------------------------- def scale_ctm(self, float sx, float sy): """ Set the coordinate system scale to the given values, (sx,sy). sx:float -- The new scale factor for the x axis sy:float -- The new scale factor for the y axis """ CGContextScaleCTM(self.context, sx, sy) def translate_ctm(self, float tx, float ty): """ Translate the coordinate system by the given value by (tx,ty) tx:float -- The distance to move in the x direction ty:float -- The distance to move in the y direction """ CGContextTranslateCTM(self.context, tx, ty) def rotate_ctm(self, float angle): """ Rotates the coordinate space for drawing by the given angle. angle:float -- the angle, in radians, to rotate the coordinate system """ CGContextRotateCTM(self.context, angle) def concat_ctm(self, object transform): """ Concatenate the transform to current coordinate transform matrix. transform:affine_matrix -- the transform matrix to concatenate with the current coordinate matrix. """ cdef float a,b,c,d,tx,ty a,b,c,d,tx,ty = transform cdef CGAffineTransform atransform atransform = CGAffineTransformMake(a,b,c,d,tx,ty) CGContextConcatCTM(self.context, atransform) def get_ctm(self): """ Return the current coordinate transform matrix. """ cdef CGAffineTransform t t = CGContextGetCTM(self.context) return (t.a, t.b, t.c, t.d, t.tx, t.ty) def get_ctm_scale(self): """ Returns the average scaling factor of the transform matrix. This isn't really part of the GC interface, but it is a convenience method to make up for us not having full AffineMatrix support in the Mac backend. """ cdef CGAffineTransform t t = CGContextGetCTM(self.context) x = sqrt(2.0) / 2.0 * (t.a + t.b) y = sqrt(2.0) / 2.0 * (t.c + t.d) return sqrt(x*x + y*y) #---------------------------------------------------------------- # Save/Restore graphics state. #---------------------------------------------------------------- def save_state(self): """ Save the current graphic's context state. This should always be paired with a restore_state """ CGContextSaveGState(self.context) def restore_state(self): """ Restore the previous graphics state. """ CGContextRestoreGState(self.context) #---------------------------------------------------------------- # context manager interface #---------------------------------------------------------------- def __enter__(self): self.save_state() def __exit__(self, object type, object value, object traceback): self.restore_state() #---------------------------------------------------------------- # Manipulate graphics state attributes. #---------------------------------------------------------------- def set_antialias(self, bool value): """ Set/Unset antialiasing for bitmap graphics context. """ CGContextSetShouldAntialias(self.context, value) def set_line_width(self, float width): """ Set the line width for drawing width:float -- The new width for lines in user space units. """ CGContextSetLineWidth(self.context, width) def set_line_join(self, object style): """ Set style for joining lines in a drawing. style:join_style -- The line joining style. The available styles are JOIN_ROUND, JOIN_BEVEL, JOIN_MITER. """ try: sjoin = join_style[style] except KeyError: msg = "Invalid line join style. See documentation for valid styles" raise ValueError(msg) CGContextSetLineJoin(self.context, sjoin) def set_miter_limit(self, float limit): """ Specifies limits on line lengths for mitering line joins. If line_join is set to miter joins, the limit specifies which line joins should actually be mitered. If lines aren't mitered, they are joined with a bevel. The line width is divided by the length of the miter. If the result is greater than the limit, the bevel style is used. limit:float -- limit for mitering joins. """ CGContextSetMiterLimit(self.context, limit) def set_line_cap(self, object style): """ Specify the style of endings to put on line ends. style:cap_style -- the line cap style to use. Available styles are CAP_ROUND,CAP_BUTT,CAP_SQUARE """ try: scap = cap_style[style] except KeyError: msg = "Invalid line cap style. See documentation for valid styles" raise ValueError(msg) CGContextSetLineCap(self.context, scap) def set_line_dash(self, object lengths, float phase=0.0): """ lengths:float array -- An array of floating point values specifing the lengths of on/off painting pattern for lines. phase:float -- Specifies how many units into dash pattern to start. phase defaults to 0. """ cdef int n cdef int i cdef CGFloat *flengths if lengths is None: # No dash; solid line. CGContextSetLineDash(self.context, 0.0, NULL, 0) return else: n = len(lengths) flengths = PyMem_Malloc(n*sizeof(CGFloat)) if flengths == NULL: raise MemoryError("could not allocate %s floats" % n) for i from 0 <= i < n: flengths[i] = lengths[i] CGContextSetLineDash(self.context, phase, flengths, n) PyMem_Free(flengths) def set_flatness(self, float flatness): """ It is device dependent and therefore not recommended by the PDF documentation. """ CGContextSetFlatness(self.context, flatness) #---------------------------------------------------------------- # Sending drawing data to a device #---------------------------------------------------------------- def flush(self): """ Send all drawing data to the destination device. """ CGContextFlush(self.context) def synchronize(self): """ Prepares drawing data to be updated on a destination device. """ CGContextSynchronize(self.context) #---------------------------------------------------------------- # Page Definitions #---------------------------------------------------------------- def begin_page(self, media_box=None): """ Create a new page within the graphics context. """ cdef CGRect mbox cdef CGRect* mbox_ptr if media_box is not None: mbox = CGRectMakeFromPython(media_box) mbox_ptr = &mbox else: mbox_ptr = NULL CGContextBeginPage(self.context, mbox_ptr) def end_page(self): """ End drawing in the current page of the graphics context. """ CGContextEndPage(self.context) #---------------------------------------------------------------- # Building paths (contours that are drawn) # # + Currently, nothing is drawn as the path is built. Instead, the # instructions are stored and later drawn. Should this be changed? # We will likely draw to a buffer instead of directly to the canvas # anyway. # # Hmmm. No. We have to keep the path around for storing as a # clipping region and things like that. # # + I think we should keep the current_path_point hanging around. # #---------------------------------------------------------------- def begin_path(self): """ Clear the current drawing path and begin a new one. """ CGContextBeginPath(self.context) def move_to(self, float x, float y): """ Start a new drawing subpath at place the current point at (x,y). """ CGContextMoveToPoint(self.context, x,y) def line_to(self, float x, float y): """ Add a line from the current point to the given point (x,y). The current point is moved to (x,y). """ CGContextAddLineToPoint(self.context, x,y) def lines(self, object points): """ Add a series of lines as a new subpath. Points is an Nx2 array of x,y pairs. current_point is moved to the last point in points """ cdef int n cdef int i cdef c_numpy.ndarray apoints cdef float x, y n = len(points) # Shortcut for the 0 and 1 point case if n < 2: return apoints = (numpy.asarray(points, dtype=numpy.float32)) if apoints.nd != 2 or apoints.dimensions[1] != 2: msg = "must pass array of 2-D points" raise ValueError(msg) x = (c_numpy.PyArray_GETPTR2(apoints, 0, 0))[0] y = (c_numpy.PyArray_GETPTR2(apoints, 0, 1))[0] CGContextMoveToPoint(self.context, x, y) for i from 1 <= i < n: x = (c_numpy.PyArray_GETPTR2(apoints, i, 0))[0] y = (c_numpy.PyArray_GETPTR2(apoints, i, 1))[0] CGContextAddLineToPoint(self.context, x, y) def line_set(self, object starts, object ends): """ Adds a series of disconnected line segments as a new subpath. starts and ends are Nx2 arrays of (x,y) pairs indicating the starting and ending points of each line segment. current_point is moved to the last point in ends """ cdef int n n = len(starts) if len(ends) < n: n = len(ends) cdef int i for i from 0 <= i < n: CGContextMoveToPoint(self.context, starts[i][0], starts[i][1]) CGContextAddLineToPoint(self.context, ends[i][0], ends[i][1]) def rect(self, float x, float y, float sx, float sy): """ Add a rectangle as a new subpath. """ CGContextAddRect(self.context, CGRectMake(x,y,sx,sy)) def rects(self, object rects): """ Add multiple rectangles as separate subpaths to the path. """ cdef int n n = len(rects) cdef int i for i from 0 <= i < n: CGContextAddRect(self.context, CGRectMakeFromPython(rects[i])) def close_path(self): """ Close the path of the current subpath. """ if not CGContextIsPathEmpty(self.context): CGContextClosePath(self.context) def curve_to(self, float cp1x, float cp1y, float cp2x, float cp2y, float x, float y): """ """ CGContextAddCurveToPoint(self.context, cp1x, cp1y, cp2x, cp2y, x, y ) def quad_curve_to(self, float cpx, float cpy, float x, float y): """ """ CGContextAddQuadCurveToPoint(self.context, cpx, cpy, x, y) def arc(self, float x, float y, float radius, float start_angle, float end_angle, bool clockwise=False): """ """ CGContextAddArc(self.context, x, y, radius, start_angle, end_angle, clockwise) def arc_to(self, float x1, float y1, float x2, float y2, float radius): """ """ CGContextAddArcToPoint(self.context, x1, y1, x2, y2, radius) def add_path(self, CGMutablePath path not None): """ """ CGContextAddPath(self.context, path.path) #---------------------------------------------------------------- # Getting information on paths #---------------------------------------------------------------- def is_path_empty(self): """ Test to see if the current drawing path is empty """ return CGContextIsPathEmpty(self.context) def get_path_current_point(self): """ Return the current point from the graphics context. Note: This should be a tuple or array. """ cdef CGPoint result result = CGContextGetPathCurrentPoint(self.context) return result.x, result.y def get_path_bounding_box(self): """ should return a tuple or array instead of a strange object. """ cdef CGRect result result = CGContextGetPathBoundingBox(self.context) return (result.origin.x, result.origin.y, result.size.width, result.size.height) #---------------------------------------------------------------- # Clipping path manipulation #---------------------------------------------------------------- def clip(self): """ """ if not CGContextIsPathEmpty(self.context): CGContextClip(self.context) def even_odd_clip(self): """ """ CGContextEOClip(self.context) def clip_to_rect(self, float x, float y, float width, float height): """ Clip context to the given rectangular region. """ CGContextClipToRect(self.context, CGRectMake(x,y,width,height)) def clip_to_rects(self, object rects): """ """ cdef int n n = len(rects) cdef int i cdef CGRect* cgrects cgrects = PyMem_Malloc(n*sizeof(CGRect)) if cgrects == NULL: raise MemoryError("could not allocate memory for CGRects") for i from 0 <= i < n: cgrects[i] = CGRectMakeFromPython(rects[i]) CGContextClipToRects(self.context, cgrects, n) PyMem_Free(cgrects) #---------------------------------------------------------------- # Color space manipulation # # I'm not sure we'll mess with these at all. They seem to # be for setting the color system. Hard coding to RGB or # RGBA for now sounds like a reasonable solution. #---------------------------------------------------------------- def set_fill_color_space(self): """ """ msg = "set_fill_color_space not implemented on Macintosh yet." raise NotImplementedError(msg) def set_stroke_color_space(self): """ """ msg = "set_stroke_color_space not implemented on Macintosh yet." raise NotImplementedError(msg) def set_rendering_intent(self, intent): """ """ CGContextSetRenderingIntent(self.context, intent) #---------------------------------------------------------------- # Color manipulation #---------------------------------------------------------------- def set_fill_color(self, object color): """ """ r,g,b = color[:3] try: a = color[3] except IndexError: a = 1.0 self.fill_color = (r,g,b,a) CGContextSetRGBFillColor(self.context, r, g, b, a) def set_stroke_color(self, object color): """ """ r,g,b = color[:3] try: a = color[3] except IndexError: a = 1.0 self.stroke_color = (r,g,b,a) CGContextSetRGBStrokeColor(self.context, r, g, b, a) def set_alpha(self, float alpha): """ """ CGContextSetAlpha(self.context, alpha) #def set_gray_fill_color(self): # """ # """ # pass #def set_gray_stroke_color(self): # """ # """ # pass #def set_rgb_fill_color(self): # """ # """ # pass #def set_rgb_stroke_color(self): # """ # """ # pass #def cmyk_fill_color(self): # """ # """ # pass #def cmyk_stroke_color(self): # """ # """ # pass #---------------------------------------------------------------- # Drawing Images #---------------------------------------------------------------- def draw_image(self, object image, object rect=None): """ Draw an image or another CGContext onto a region. """ if rect is None: rect = (0, 0, self.width(), self.height()) if isinstance(image, numpy.ndarray): self._draw_cgimage(CGImage(image), rect) elif isinstance(image, CGImage): self._draw_cgimage(image, rect) elif hasattr(image, 'bmp_array'): self._draw_cgimage(CGImage(image.bmp_array), rect) elif isinstance(image, CGLayerContext): self._draw_cglayer(image, rect) else: raise TypeError("could not recognize image %r" % type(image)) def _draw_cgimage(self, CGImage image, object rect): """ Draw a CGImage into a region. """ CGContextDrawImage(self.context, CGRectMakeFromPython(rect), image.image) def _draw_cglayer(self, CGLayerContext layer, object rect): """ Draw a CGLayer into a region. """ CGContextDrawLayerInRect(self.context, CGRectMakeFromPython(rect), layer.layer) def set_interpolation_quality(self, quality): CGContextSetInterpolationQuality(self.context, quality) #---------------------------------------------------------------- # Drawing PDF documents #---------------------------------------------------------------- def draw_pdf_document(self, object rect, CGPDFDocument document not None, int page=1): """ rect:(x,y,width,height) -- rectangle to draw into document:CGPDFDocument -- PDF file to read from page=1:int -- page number of PDF file """ cdef CGRect cgrect cgrect = CGRectMakeFromPython(rect) CGContextDrawPDFDocument(self.context, cgrect, document.document, page) #---------------------------------------------------------------- # Drawing Text #---------------------------------------------------------------- def select_font(self, object name, float size, style='regular'): """ """ key = (name, size, style) if key not in self.font_cache: self.current_style = default_font_info.lookup(name, style=style) self.font_cache[key] = self.current_style.get_font(size) self.current_font = self.font_cache[key] def set_font(self, font): """ Set the font for the current graphics context. I need to figure out this one. """ style = { constants.NORMAL: 'regular', constants.BOLD: 'bold', constants.ITALIC: 'italic', constants.BOLD_ITALIC: 'bold italic', }[font.weight | font.style] self.select_font(font.face_name, font.size, style=style) def set_font_size(self, float size): """ Change the size of the currently selected font """ if self.current_style is None: return name = self.current_style.family_name style = self.current_style.style key = (name, size, style) if key not in self.font_cache: self.font_cache[key] = self.current_style.get_font(size) self.current_font = self.font_cache[key] def set_character_spacing(self, float spacing): """ """ # XXX: Perhaps this should be handled by the kerning attribute # in the attributed string that is used to make a line of text? CGContextSetCharacterSpacing(self.context, spacing) def set_text_drawing_mode(self, object mode): """ """ try: cgmode = text_modes[mode] except KeyError: msg = "Invalid text drawing mode. See documentation for valid modes" raise ValueError(msg) CGContextSetTextDrawingMode(self.context, cgmode) def set_text_position(self, float x,float y): """ """ self.text_matrix.tx = x self.text_matrix.ty = y def get_text_position(self): """ """ return self.text_matrix.tx, self.text_matrix.ty def set_text_matrix(self, object ttm): """ """ cdef float a,b,c,d,tx,ty # Handle both matrices that this class returns and agg._AffineMatrix # instances. try: ((a, b, _), (c, d, _), (tx, ty, _)) = ttm except: a,b,c,d,tx,ty = ttm cdef CGAffineTransform transform transform = CGAffineTransformMake(a,b,c,d,tx,ty) self.text_matrix = transform def get_text_matrix(self): """ """ return ((self.text_matrix.a, self.text_matrix.b, 0.0), (self.text_matrix.c, self.text_matrix.d, 0.0), (self.text_matrix.tx,self.text_matrix.ty,1.0)) def get_text_extent(self, object text): """ Measure the space taken up by given text using the current font. """ cdef size_t pointer cdef CTFontRef ct_font cdef CTLineRef ct_line cdef CGFloat ascent = 0.0, descent = 0.0 cdef double x1,x2,y1,y2, width = 0.0 pointer = self.current_font.get_pointer() ct_font = pointer ct_line = _create_ct_line(text, ct_font, None) if ct_line != NULL: width = CTLineGetTypographicBounds(ct_line, &ascent, &descent, NULL) CFRelease(ct_line) x1 = 0.0 x2 = width y1 = -descent y2 = -y1 + ascent return x1, y1, x2, y2 def get_full_text_extent(self, object text): """ Backwards compatibility API over .get_text_extent() for Enable. """ x1, y1, x2, y2 = self.get_text_extent(text) return x2, y2, y1, x1 def show_text(self, object text, object xy=None): """ Draw text on the device at current text position. This is also used for showing text at a particular point specified by xy == (x, y). """ cdef float x, y cdef size_t pointer cdef CTFontRef ct_font cdef CTLineRef ct_line if not text: # Nothing to draw return pointer = self.current_font.get_pointer() ct_font = pointer ct_line = _create_ct_line(text, ct_font, self.stroke_color) if ct_line == NULL: return if xy is None: x = 0.0 y = 0.0 else: x = xy[0] y = xy[1] self.save_state() try: CGContextConcatCTM(self.context, self.text_matrix) CGContextSetTextPosition(self.context, x, y) CTLineDraw(ct_line, self.context) finally: self.restore_state() CFRelease(ct_line) def show_text_at_point(self, object text, float x, float y): """ Draw text on the device at a given text position. """ self.show_text(text, (x, y)) def show_glyphs(self): """ """ msg = "show_glyphs not implemented on Macintosh yet." raise NotImplementedError(msg) #---------------------------------------------------------------- # Painting paths (drawing and filling contours) #---------------------------------------------------------------- def stroke_path(self): """ """ CGContextStrokePath(self.context) def fill_path(self): """ """ CGContextFillPath(self.context) def eof_fill_path(self): """ """ CGContextEOFillPath(self.context) def stroke_rect(self, object rect): """ """ CGContextStrokeRect(self.context, CGRectMakeFromPython(rect)) def stroke_rect_with_width(self, object rect, float width): """ """ CGContextStrokeRectWithWidth(self.context, CGRectMakeFromPython(rect), width) def fill_rect(self, object rect): """ """ CGContextFillRect(self.context, CGRectMakeFromPython(rect)) def fill_rects(self, object rects): """ """ cdef int n n = len(rects) cdef int i cdef CGRect* cgrects cgrects = PyMem_Malloc(n*sizeof(CGRect)) if cgrects == NULL: raise MemoryError("could not allocate memory for CGRects") for i from 0 <= i < n: cgrects[i] = CGRectMakeFromPython(rects[i]) CGContextFillRects(self.context, cgrects, n) def clear_rect(self, object rect): """ """ CGContextClearRect(self.context, CGRectMakeFromPython(rect)) def draw_path(self, object mode=constants.FILL_STROKE): """ Walk through all the drawing subpaths and draw each element. Each subpath is drawn separately. """ cg_mode = draw_modes[mode] CGContextDrawPath(self.context, cg_mode) def draw_rect(self, rect, object mode=constants.FILL_STROKE): """ Draw a rectangle with the given mode. """ self.save_state() CGContextBeginPath(self.context) CGContextAddRect(self.context, CGRectMakeFromPython(rect)) cg_mode = draw_modes[mode] CGContextDrawPath(self.context, cg_mode) self.restore_state() def get_empty_path(self): """ Return a path object that can be built up and then reused. """ return CGMutablePath() def draw_path_at_points(self, points, CGMutablePath marker not None, object mode=constants.FILL_STROKE): cdef int i cdef int n cdef c_numpy.ndarray apoints cdef float x, y apoints = (numpy.asarray(points, dtype=numpy.float32)) if apoints.nd != 2 or apoints.dimensions[1] != 2: msg = "must pass array of 2-D points" raise ValueError(msg) cg_mode = draw_modes[mode] n = len(points) for i from 0 <= i < n: x = (c_numpy.PyArray_GETPTR2(apoints, i, 0))[0] y = (c_numpy.PyArray_GETPTR2(apoints, i, 1))[0] CGContextSaveGState(self.context) CGContextTranslateCTM(self.context, x, y) CGContextAddPath(self.context, marker.path) CGContextDrawPath(self.context, cg_mode) CGContextRestoreGState(self.context) def linear_gradient(self, x1, y1, x2, y2, stops, spread_method, units='userSpaceOnUse'): cdef CGRect path_rect if units == 'objectBoundingBox': # transform from relative coordinates path_rect = CGContextGetPathBoundingBox(self.context) x1 = path_rect.origin.x + x1 * path_rect.size.width x2 = path_rect.origin.x + x2 * path_rect.size.width y1 = path_rect.origin.y + y1 * path_rect.size.height y2 = path_rect.origin.y + y2 * path_rect.size.height stops_list = stops.transpose().tolist() func = PiecewiseLinearColorFunction(stops_list) # Shadings fill the current clip path self.clip() if spread_method == 'pad' or spread_method == '': shading = AxialShading(func, (x1,y1), (x2,y2), extend_start=1, extend_end=1) self.draw_shading(shading) else: self.repeat_linear_shading(x1, y1, x2, y2, stops, spread_method, func) def repeat_linear_shading(self, x1, y1, x2, y2, stops, spread_method, ShadingFunction func not None): cdef CGRect clip_rect = CGContextGetClipBoundingBox(self.context) cdef double dirx, diry, slope cdef double startx, starty, endx, endy cdef int func_index = 0 if spread_method == 'reflect': # generate the mirrored color function stops_list = stops[::-1].transpose() stops_list[0] = 1-stops_list[0] funcs = [func, PiecewiseLinearColorFunction(stops_list.tolist())] else: funcs = [func, func] dirx, diry = x2-x1, y2-y1 startx, starty = x1, y1 endx, endy = x2, y2 if dirx == 0. and diry == 0.: slope = float('nan') diry = 100.0 elif diry == 0.: slope = 0. else: # perpendicular slope slope = -dirx/diry while _line_intersects_cgrect(startx, starty, slope, clip_rect): shading = AxialShading(funcs[func_index&1], (startx, starty), (endx, endy), extend_start=0, extend_end=0) self.draw_shading(shading) startx, starty = endx, endy endx, endy = endx+dirx, endy+diry func_index += 1 # reverse direction dirx, diry = x1-x2, y1-y2 startx, starty = x1+dirx, y1+diry endx, endy = x1, y1 func_index = 1 if dirx == 0. and diry == 0.: slope = float('nan') diry = 100.0 elif diry == 0.: slope = 0. else: # perpendicular slope slope = -dirx/diry while _line_intersects_cgrect(endx, endy, slope, clip_rect): shading = AxialShading(funcs[func_index&1], (startx, starty), (endx, endy), extend_start=0, extend_end=0) self.draw_shading(shading) endx, endy = startx, starty startx, starty = endx+dirx, endy+diry func_index += 1 def radial_gradient(self, cx, cy, r, fx, fy, stops, spread_method, units='userSpaceOnUse'): cdef CGRect path_rect if units == 'objectBoundingBox': # transform from relative coordinates path_rect = CGContextGetPathBoundingBox(self.context) r = r * path_rect.size.width cx = path_rect.origin.x + cx * path_rect.size.width fx = path_rect.origin.x + fx * path_rect.size.width cy = path_rect.origin.y + cy * path_rect.size.height fy = path_rect.origin.y + fy * path_rect.size.height stops_list = stops.transpose().tolist() func = PiecewiseLinearColorFunction(stops_list) # 12/11/2010 John Wiggins - In order to avoid a bug in Quartz, # the radius of a radial gradient must be greater than the distance # between the center and the focus. When input runs afoul of this bug, # the focus point will be moved towards the center so that the distance # is less than the radius. This matches the behavior of AGG. cdef double dx = fx-cx cdef double dy = fy-cy cdef double dist = sqrt(dx*dx + dy*dy) if r <= dist: newdist = r-0.001 fx = cx+newdist*dx/dist fy = cy+newdist*dy/dist # Shadings fill the current clip path self.clip() if spread_method == 'pad' or spread_method == '': shading = RadialShading(func, (fx, fy), 0.0, (cx, cy), r, extend_start=1, extend_end=1) self.draw_shading(shading) else: # 'reflect' and 'repeat' need to iterate self.repeat_radial_shading(cx, cy, r, fx, fy, stops, spread_method, func) def repeat_radial_shading(self, cx, cy, r, fx, fy, stops, spread_method, ShadingFunction func not None): cdef CGRect clip_rect = CGContextGetClipBoundingBox(self.context) cdef double rad = 0., dirx = 0., diry = 0. cdef double startx, starty, endx, endy cdef int func_index = 0 if spread_method == 'reflect': # generate the mirrored color function stops_list = stops[::-1].transpose() stops_list[0] = 1-stops_list[0] funcs = [func, PiecewiseLinearColorFunction(stops_list.tolist())] else: funcs = [func, func] dirx, diry = cx-fx, cy-fy startx, starty = fx,fy endx, endy = cx, cy while not _cgrect_within_circle(clip_rect, endx, endy, rad): shading = RadialShading(funcs[func_index & 1], (startx, starty), rad, (endx, endy), rad+r, extend_start=0, extend_end=0) self.draw_shading(shading) startx, starty = endx, endy endx, endy = endx+dirx, endy+diry rad += r func_index += 1 def draw_shading(self, Shading shading not None): CGContextDrawShading(self.context, shading.shading) #---------------------------------------------------------------- # Extra routines that aren't part of DisplayPDF # # Some access to font metrics are needed for laying out text. # Not sure how to handle this yet. The candidates below are # from Piddle. Perhaps there is another alternative? # #---------------------------------------------------------------- #def font_height(self): # '''Find the total height (ascent + descent) of the given font.''' # #return self.font_ascent() + self.font_descent() #def font_ascent(self): # '''Find the ascent (height above base) of the given font.''' # pass #def font_descent(self): # '''Find the descent (extent below base) of the given font.''' # extents = self.dc.GetFullTextExtent(' ', wx_font) # return extents[2] def __dealloc__(self): if self.context != NULL and self.can_release: CGContextRelease(self.context) self.context = NULL # The following are Quartz APIs not in Kiva def set_pattern_phase(self, float tx, float ty): """ tx,ty:floats -- A translation in user-space to apply to a pattern before it is drawn """ CGContextSetPatternPhase(self.context, CGSizeMake(tx, ty)) def set_should_smooth_fonts(self, bool value): """ value:bool -- specify whether to enable font smoothing or not """ CGContextSetShouldSmoothFonts(self.context, value) cdef class CGContextInABox(CGContext): """ A CGContext that knows its size. """ cdef readonly object size cdef readonly int _width cdef readonly int _height def __init__(self, object size, size_t context, long can_release=0, *args, **kwargs): self.context = context self.can_release = can_release self._width, self._height = size self._setup_color_space() self._setup_fonts() def clear(self, object clear_color=(1.0,1.0,1.0,1.0)): self.save_state() # Reset the transformation matrix back to the identity. CGContextConcatCTM(self.context, CGAffineTransformInvert(CGContextGetCTM(self.context))) self.set_fill_color(clear_color) CGContextFillRect(self.context, CGRectMake(0,0,self._width,self._height)) self.restore_state() def width(self): return self._width def height(self): return self._height cdef class CGLayerContext(CGContextInABox): cdef CGLayerRef layer cdef object gc def __init__(self, object size, CGContext gc not None, *args, **kwargs): self.gc = gc self.layer = CGLayerCreateWithContext(gc.context, CGSizeMake(size[0], size[1]), NULL) self.context = CGLayerGetContext(self.layer) self.size = size self._width, self._height = size self.can_release = 1 self._setup_color_space() self._setup_fonts() def __dealloc__(self): if self.layer != NULL: CGLayerRelease(self.layer) self.layer = NULL # The documentation doesn't say whether I need to release the # context derived from the layer or not. I believe that means # I don't. self.context = NULL self.gc = None def save(self, object filename, file_format=None, pil_options=None): """ Save the GraphicsContext to a file. Output files are always saved in RGB or RGBA format; if this GC is not in one of these formats, it is automatically converted. If filename includes an extension, the image format is inferred from it. file_format is only required if the format can't be inferred from the filename (e.g. if you wanted to save a PNG file as a .dat or .bin). filename may also be "file-like" object such as a StringIO, in which case a file_format must be supplied. pil_options is a dict of format-specific options that are passed down to the PIL image file writer. If a writer doesn't recognize an option, it is silently ignored. If the image has an alpha channel and the specified output file format does not support alpha, the image is saved in rgb24 format. """ cdef CGBitmapContext bmp # Create a CGBitmapContext from this layer, draw to it, then let it save # itself out. rect = (0, 0) + self.size bmp = CGBitmapContext(self.size) CGContextDrawLayerInRect(bmp.context, CGRectMakeFromPython(rect), self.layer) bmp.save(filename, file_format=file_format, pil_options=pil_options) cdef class CGContextFromSWIG(CGContext): def __init__(self, swig_obj): self.can_release = False ptr = int(swig_obj.this.split('_')[1], 16) CGContext.__init__(self, ptr) cdef class CGGLContext(CGContextInABox): cdef readonly size_t glcontext def __init__(self, size_t glcontext, int width, int height): if glcontext == 0: raise ValueError("Need a valid pointer") self.glcontext = glcontext self.context = CGGLContextCreate(glcontext, CGSizeMake(width, height), NULL) if self.context == NULL: raise RuntimeError("could not create CGGLContext") self.can_release = 1 self._width = width self._height = height self.size = (self._width, self._height) self._setup_color_space() self._setup_fonts() def resize(self, int width, int height): CGGLContextUpdateViewportSize(self.context, CGSizeMake(width, height)) self._width = width self._height = height self.size = (width, height) cdef class CGPDFContext(CGContext): cdef readonly char* filename cdef CGRect media_box def __init__(self, char* filename, rect=None): cdef CFURLRef cfurl cfurl = url_from_filename(filename) cdef CGRect cgrect cdef CGRect* cgrect_ptr if rect is None: cgrect = CGRectMake(0,0,612,792) cgrect_ptr = &cgrect else: cgrect = CGRectMakeFromPython(rect) cgrect_ptr = &cgrect self.context = CGPDFContextCreateWithURL(cfurl, cgrect_ptr, NULL) CFRelease(cfurl) self.filename = filename self.media_box = cgrect if self.context == NULL: raise RuntimeError("could not create CGPDFContext") self.can_release = 1 self._setup_color_space() self._setup_fonts() CGContextBeginPage(self.context, cgrect_ptr) def begin_page(self, media_box=None): cdef CGRect* box_ptr cdef CGRect box if media_box is None: box_ptr = &(self.media_box) else: box = CGRectMakeFromPython(media_box) box_ptr = &box CGContextBeginPage(self.context, box_ptr) def flush(self, end_page=True): if end_page: self.end_page() CGContextFlush(self.context) def begin_transparency_layer(self): CGContextBeginTransparencyLayer(self.context, NULL) def end_transparency_layer(self): CGContextEndTransparencyLayer(self.context) cdef class CGBitmapContext(CGContext): cdef void* data def __cinit__(self, *args, **kwds): self.data = NULL def __init__(self, object size_or_array, bool grey_scale=0, int bits_per_component=8, int bytes_per_row=-1, alpha_info=kCGImageAlphaPremultipliedLast): cdef int bits_per_pixel cdef CGColorSpaceRef colorspace cdef void* dataptr if hasattr(size_or_array, '__array_interface__'): # It's an array. arr = numpy.asarray(size_or_array, order='C') typestr = arr.dtype.str if typestr != '|u1': raise ValueError("expecting an array of unsigned bytes; got %r" % typestr) shape = arr.shape if len(shape) != 3 or shape[-1] not in (3, 4): raise ValueError("expecting a shape (width, height, depth) " "with depth either 3 or 4; got %r" % shape) height, width, depth = shape if depth == 3: # Need to add an alpha channel. alpha = numpy.empty((height, width), dtype=numpy.uint8) alpha.fill(255) arr = numpy.dstack([arr, alpha]) depth = 4 ptr, readonly = arr.__array_interface__['data'] dataptr = ptr else: # It's a size tuple. width, height = size_or_array arr = None if grey_scale: alpha_info = kCGImageAlphaNone bits_per_component = 8 bits_per_pixel = 8 colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericGray) elif bits_per_component == 5: alpha_info = kCGImageAlphaNoneSkipFirst bits_per_pixel = 16 colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB) elif bits_per_component == 8: if alpha_info not in (kCGImageAlphaNoneSkipFirst, kCGImageAlphaNoneSkipLast, kCGImageAlphaPremultipliedFirst, kCGImageAlphaPremultipliedLast, ): raise ValueError("not a valid alpha_info") bits_per_pixel = 32 colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB) else: raise ValueError("bits_per_component must be 5 or 8") cdef int min_bytes min_bytes = (width*bits_per_pixel + 7) / 8 if bytes_per_row < min_bytes: bytes_per_row = min_bytes self.data = PyMem_Malloc(height*bytes_per_row) if self.data == NULL: CGColorSpaceRelease(colorspace) raise MemoryError("could not allocate memory") if arr is not None: # Copy the data from the array. memcpy(self.data, dataptr, width*height*depth) self.context = CGBitmapContextCreate(self.data, width, height, bits_per_component, bytes_per_row, colorspace, alpha_info) CGColorSpaceRelease(colorspace) if self.context == NULL: raise RuntimeError("could not create CGBitmapContext") self.can_release = 1 self._setup_fonts() def __dealloc__(self): if self.context != NULL and self.can_release: CGContextRelease(self.context) self.context = NULL if self.data != NULL: # Hmm, this could be tricky if anything in Quartz retained a # reference to self.context PyMem_Free(self.data) self.data = NULL property alpha_info: def __get__(self): return CGBitmapContextGetAlphaInfo(self.context) property bits_per_component: def __get__(self): return CGBitmapContextGetBitsPerComponent(self.context) property bits_per_pixel: def __get__(self): return CGBitmapContextGetBitsPerPixel(self.context) property bytes_per_row: def __get__(self): return CGBitmapContextGetBytesPerRow(self.context) # property colorspace: # def __get__(self): # return CGBitmapContextGetColorSpace(self.context) def height(self): return CGBitmapContextGetHeight(self.context) def width(self): return CGBitmapContextGetWidth(self.context) def __getsegcount__(self, void* tmp): cdef int *lenp lenp = tmp if lenp != NULL: lenp[0] = self.height()*self.bytes_per_row return 1 def __getreadbuffer__(self, int segment, void** ptr): # ignore invalid segment; the caller can't mean anything but the only # segment available; we're all adults ptr[0] = self.data return self.height()*self.bytes_per_row def __getwritebuffer__(self, int segment, void** ptr): # ignore invalid segment; the caller can't mean anything but the only # segment available; we're all adults ptr[0] = self.data return self.height()*self.bytes_per_row def __getcharbuffer__(self, int segment, char** ptr): # ignore invalid segment; the caller can't mean anything but the only # segment available; we're all adults ptr[0] = (self.data) return self.height()*self.bytes_per_row def clear(self, object clear_color=(1.0, 1.0, 1.0, 1.0)): """Paint over the whole image with a solid color. """ self.save_state() # Reset the transformation matrix back to the identity. CGContextConcatCTM(self.context, CGAffineTransformInvert(CGContextGetCTM(self.context))) self.set_fill_color(clear_color) CGContextFillRect(self.context, CGRectMake(0, 0, self.width(), self.height())) self.restore_state() def save(self, object filename, file_format=None, pil_options=None): """ Save the GraphicsContext to a file. Output files are always saved in RGB or RGBA format; if this GC is not in one of these formats, it is automatically converted. If filename includes an extension, the image format is inferred from it. file_format is only required if the format can't be inferred from the filename (e.g. if you wanted to save a PNG file as a .dat or .bin). filename may also be "file-like" object such as a StringIO, in which case a file_format must be supplied. pil_options is a dict of format-specific options that are passed down to the PIL image file writer. If a writer doesn't recognize an option, it is silently ignored. If the image has an alpha channel and the specified output file format does not support alpha, the image is saved in rgb24 format. """ try: from kiva.compat import pilfromstring except ImportError: raise ImportError("need PIL (or Pillow) to save images") if self.bits_per_pixel == 32: if self.alpha_info == kCGImageAlphaPremultipliedLast: mode = 'RGBA' elif self.alpha_info == kCGImageAlphaPremultipliedFirst: mode = 'ARGB' else: raise ValueError("cannot save this pixel format") elif self.bits_per_pixel == 8: mode = 'L' else: raise ValueError("cannot save this pixel format") if file_format is None: file_format = '' img = pilfromstring(mode, (self.width(), self.height()), self) if 'A' in mode: # Check the output format to see if it can handle an alpha channel. no_alpha_formats = ('jpg', 'bmp', 'eps', 'jpeg') if ((isinstance(filename, basestring) and os.path.splitext(filename)[1][1:] in no_alpha_formats) or (file_format.lower() in no_alpha_formats)): img = img.convert('RGB') img.save(filename, format=file_format, options=pil_options) cdef class CGImage: cdef CGImageRef image cdef void* data cdef readonly c_numpy.ndarray bmp_array def __cinit__(self, *args, **kwds): self.image = NULL property width: def __get__(self): return CGImageGetWidth(self.image) property height: def __get__(self): return CGImageGetHeight(self.image) property bits_per_component: def __get__(self): return CGImageGetBitsPerComponent(self.image) property bits_per_pixel: def __get__(self): return CGImageGetBitsPerPixel(self.image) property bytes_per_row: def __get__(self): return CGImageGetBytesPerRow(self.image) property alpha_info: def __get__(self): return CGImageGetAlphaInfo(self.image) property should_interpolate: def __get__(self): return CGImageGetShouldInterpolate(self.image) property is_mask: def __get__(self): return CGImageIsMask(self.image) def __init__(self, object size_or_array, bool grey_scale=0, int bits_per_component=8, int bytes_per_row=-1, alpha_info=kCGImageAlphaLast, int should_interpolate=1): cdef int bits_per_pixel cdef CGColorSpaceRef colorspace if hasattr(size_or_array, '__array_interface__'): # It's an array. arr = size_or_array typestr = arr.__array_interface__['typestr'] if typestr != '|u1': raise ValueError("expecting an array of unsigned bytes; got %r" % typestr) shape = arr.__array_interface__['shape'] if grey_scale: if (len(shape) == 3 and shape[-1] != 1) or (len(shape) != 2): raise ValueError("with grey_scale, expecting a shape " "(height, width) or (height, width, 1); got " "%r" % (shape,)) height, width = shape[:2] depth = 1 else: if len(shape) != 3 or shape[-1] not in (3, 4): raise ValueError("expecting a shape (height, width, depth) " "with depth either 3 or 4; got %r" % (shape,)) height, width, depth = shape if depth in (1, 3): alpha_info = kCGImageAlphaNone else: # Make a copy. arr = numpy.array(arr) alpha_info = kCGImageAlphaPremultipliedLast else: # It's a size tuple. width, height = size_or_array if grey_scale: lastdim = 1 alpha_info = kCGImageAlphaNone else: lastdim = 4 alpha_info = kCGImageAlphaPremultipliedLast arr = numpy.zeros((height, width, lastdim), dtype=numpy.uint8) self.bmp_array = arr Py_INCREF(self.bmp_array) self.data = c_numpy.PyArray_DATA(self.bmp_array) if grey_scale: alpha_info = kCGImageAlphaNone bits_per_component = 8 bits_per_pixel = 8 colorspace = CGColorSpaceCreateDeviceGray() elif bits_per_component == 5: alpha_info = kCGImageAlphaNoneSkipFirst bits_per_pixel = 16 colorspace = CGColorSpaceCreateDeviceRGB() elif bits_per_component == 8: if alpha_info in (kCGImageAlphaNoneSkipFirst, kCGImageAlphaNoneSkipLast, kCGImageAlphaPremultipliedFirst, kCGImageAlphaPremultipliedLast, kCGImageAlphaFirst, kCGImageAlphaLast, ): bits_per_pixel = 32 elif alpha_info == kCGImageAlphaNone: bits_per_pixel = 24 colorspace = CGColorSpaceCreateDeviceRGB() else: raise ValueError("bits_per_component must be 5 or 8") cdef int min_bytes min_bytes = (width*bits_per_pixel + 7) / 8 if bytes_per_row < min_bytes: bytes_per_row = min_bytes cdef CGDataProviderRef provider provider = CGDataProviderCreateWithData( NULL, self.data, c_numpy.PyArray_SIZE(self.bmp_array), NULL) if provider == NULL: raise RuntimeError("could not make provider") cdef CGColorSpaceRef space space = CGColorSpaceCreateDeviceRGB() self.image = CGImageCreate(width, height, bits_per_component, bits_per_pixel, bytes_per_row, space, alpha_info, provider, NULL, should_interpolate, kCGRenderingIntentDefault) CGColorSpaceRelease(space) CGDataProviderRelease(provider) if self.image == NULL: raise RuntimeError("could not make image") def __dealloc__(self): if self.image != NULL: CGImageRelease(self.image) self.image = NULL Py_XDECREF(self.bmp_array) cdef class CGImageFile(CGImage): def __init__(self, object image_or_filename, int should_interpolate=1): cdef int width, height, bits_per_component, bits_per_pixel, bytes_per_row cdef CGImageAlphaInfo alpha_info from PIL import Image from kiva.compat import piltostring import types if type(image_or_filename) is str: img = Image.open(image_or_filename) img.load() elif isinstance(image_or_filename, Image.Image): img = image_or_filename else: raise ValueError("need a PIL Image or a filename") width, height = img.size mode = img.mode if mode not in ["L", "RGB","RGBA"]: img = img.convert(mode="RGBA") mode = 'RGBA' bits_per_component = 8 if mode == 'RGB': bits_per_pixel = 24 alpha_info = kCGImageAlphaNone elif mode == 'RGBA': bits_per_pixel = 32 alpha_info = kCGImageAlphaPremultipliedLast elif mode == 'L': bits_per_pixel = 8 alpha_info = kCGImageAlphaNone bytes_per_row = (bits_per_pixel*width + 7)/ 8 cdef char* data cdef char* py_data cdef int dims[3] dims[0] = height dims[1] = width dims[2] = bits_per_pixel/bits_per_component self.bmp_array = c_numpy.PyArray_SimpleNew(3, &(dims[0]), c_numpy.NPY_UBYTE) data = self.bmp_array.data s = piltostring(img) py_data = PyBytes_AsString(s) memcpy(data, py_data, len(s)) self.data = data cdef CGDataProviderRef provider provider = CGDataProviderCreateWithData( NULL, data, len(data), NULL) if provider == NULL: raise RuntimeError("could not make provider") cdef CGColorSpaceRef space space = CGColorSpaceCreateDeviceRGB() self.image = CGImageCreate(width, height, bits_per_component, bits_per_pixel, bytes_per_row, space, alpha_info, provider, NULL, should_interpolate, kCGRenderingIntentDefault) CGColorSpaceRelease(space) CGDataProviderRelease(provider) if self.image == NULL: raise RuntimeError("could not make image") def __dealloc__(self): if self.image != NULL: CGImageRelease(self.image) self.image = NULL Py_XDECREF(self.bmp_array) cdef class CGImageMask(CGImage): def __init__(self, char* data, int width, int height, int bits_per_component, int bits_per_pixel, int bytes_per_row, int should_interpolate=1): cdef CGDataProviderRef provider provider = CGDataProviderCreateWithData( NULL, data, len(data), NULL) if provider == NULL: raise RuntimeError("could not make provider") self.image = CGImageMaskCreate(width, height, bits_per_component, bits_per_pixel, bytes_per_row, provider, NULL, should_interpolate) CGDataProviderRelease(provider) if self.image == NULL: raise RuntimeError("could not make image") cdef class CGPDFDocument: cdef CGPDFDocumentRef document property number_of_pages: def __get__(self): return CGPDFDocumentGetNumberOfPages(self.document) property allows_copying: def __get__(self): return CGPDFDocumentAllowsCopying(self.document) property allows_printing: def __get__(self): return CGPDFDocumentAllowsPrinting(self.document) property is_encrypted: def __get__(self): return CGPDFDocumentIsEncrypted(self.document) property is_unlocked: def __get__(self): return CGPDFDocumentIsUnlocked(self.document) def __init__(self, char* filename): import os if not os.path.exists(filename) or not os.path.isfile(filename): raise ValueError("%s is not a file" % filename) cdef CFURLRef cfurl cfurl = url_from_filename(filename) self.document = CGPDFDocumentCreateWithURL(cfurl) CFRelease(cfurl) if self.document == NULL: raise RuntimeError("could not create CGPDFDocument") def unlock_with_password(self, char* password): return CGPDFDocumentUnlockWithPassword(self.document, password) def get_media_box(self, int page): cdef CGRect cgrect cgrect = CGPDFDocumentGetMediaBox(self.document, page) return (cgrect.origin.x, cgrect.origin.y, cgrect.size.width, cgrect.size.height) def get_crop_box(self, int page): cdef CGRect cgrect cgrect = CGPDFDocumentGetCropBox(self.document, page) return (cgrect.origin.x, cgrect.origin.y, cgrect.size.width, cgrect.size.height) def get_bleed_box(self, int page): cdef CGRect cgrect cgrect = CGPDFDocumentGetBleedBox(self.document, page) return (cgrect.origin.x, cgrect.origin.y, cgrect.size.width, cgrect.size.height) def get_trim_box(self, int page): cdef CGRect cgrect cgrect = CGPDFDocumentGetTrimBox(self.document, page) return (cgrect.origin.x, cgrect.origin.y, cgrect.size.width, cgrect.size.height) def get_art_box(self, int page): cdef CGRect cgrect cgrect = CGPDFDocumentGetArtBox(self.document, page) return (cgrect.origin.x, cgrect.origin.y, cgrect.size.width, cgrect.size.height) def get_rotation_angle(self, int page): cdef int angle angle = CGPDFDocumentGetRotationAngle(self.document, page) if angle == 0: raise ValueError("page %d does not exist" % page) def __dealloc__(self): if self.document != NULL: CGPDFDocumentRelease(self.document) self.document = NULL cdef CGDataProviderRef CGDataProviderFromFilename(char* string) except NULL: cdef CFURLRef cfurl cdef CGDataProviderRef result cfurl = url_from_filename(string) if cfurl == NULL: raise RuntimeError("could not create CFURLRef") result = CGDataProviderCreateWithURL(cfurl) CFRelease(cfurl) if result == NULL: raise RuntimeError("could not create CGDataProviderRef") return result cdef class CGAffine: cdef CGAffineTransform real_transform property a: def __get__(self): return self.real_transform.a def __set__(self, float value): self.real_transform.a = value property b: def __get__(self): return self.real_transform.b def __set__(self, float value): self.real_transform.b = value property c: def __get__(self): return self.real_transform.c def __set__(self, float value): self.real_transform.c = value property d: def __get__(self): return self.real_transform.d def __set__(self, float value): self.real_transform.d = value property tx: def __get__(self): return self.real_transform.tx def __set__(self, float value): self.real_transform.tx = value property ty: def __get__(self): return self.real_transform.ty def __set__(self, float value): self.real_transform.ty = value def __init__(self, float a=1.0, float b=0.0, float c=0.0, float d=1.0, float tx=0.0, float ty=0.0): self.real_transform = CGAffineTransformMake(a,b,c,d,tx,ty) def translate(self, float tx, float ty): self.real_transform = CGAffineTransformTranslate(self.real_transform, tx, ty) return self def rotate(self, float angle): self.real_transform = CGAffineTransformRotate(self.real_transform, angle) return self def scale(self, float sx, float sy): self.real_transform = CGAffineTransformScale(self.real_transform, sx, sy) return self def invert(self): self.real_transform = CGAffineTransformInvert(self.real_transform) return self def concat(self, CGAffine other not None): self.real_transform = CGAffineTransformConcat(self.real_transform, other.real_transform) return self def __mul__(CGAffine x not None, CGAffine y not None): cdef CGAffineTransform new_transform new_transform = CGAffineTransformConcat(x.real_transform, y.real_transform) new_affine = CGAffine() set_affine_transform(new_affine, new_transform) return new_affine cdef void init_from_cgaffinetransform(self, CGAffineTransform t): self.real_transform = t def __div__(CGAffine x not None, CGAffine y not None): cdef CGAffineTransform new_transform new_transform = CGAffineTransformInvert(y.real_transform) new_affine = CGAffine() set_affine_transform(new_affine, CGAffineTransformConcat(x.real_transform, new_transform)) return new_affine def apply_to_point(self, float x, float y): cdef CGPoint oldpoint oldpoint = CGPointMake(x, y) cdef CGPoint newpoint newpoint = CGPointApplyAffineTransform(oldpoint, self.real_transform) return newpoint.x, newpoint.y def apply_to_size(self, float width, float height): cdef CGSize oldsize oldsize = CGSizeMake(width, height) cdef CGSize newsize newsize = CGSizeApplyAffineTransform(oldsize, self.real_transform) return newsize.width, newsize.height def __repr__(self): return "CGAffine(%r, %r, %r, %r, %r, %r)" % (self.a, self.b, self.c, self.d, self.tx, self.ty) def as_matrix(self): return ((self.a, self.b, 0.0), (self.c, self.d, 0.0), (self.tx,self.ty,1.0)) cdef set_affine_transform(CGAffine t, CGAffineTransform newt): t.init_from_cgaffinetransform(newt) ##cdef class Point: ## cdef CGPoint real_point ## ## property x: ## def __get__(self): ## return self.real_point.x ## def __set__(self, float value): ## self.real_point.x = value ## ## property y: ## def __get__(self): ## return self.real_point.y ## def __set__(self, float value): ## self.real_point.y = value ## ## def __init__(self, float x, float y): ## self.real_point = CGPointMake(x, y) ## ## def apply_transform(self, CGAffine transform not None): ## self.real_point = CGPointApplyTransform(self.real_point, ## transform.real_transform) cdef class Rect: cdef CGRect real_rect property x: def __get__(self): return self.real_rect.origin.x def __set__(self, float value): self.real_rect.origin.x = value property y: def __get__(self): return self.real_rect.origin.y def __set__(self, float value): self.real_rect.origin.y = value property width: def __get__(self): return self.real_rect.size.width def __set__(self, float value): self.real_rect.size.width = value property height: def __get__(self): return self.real_rect.size.height def __set__(self, float value): self.real_rect.size.height = value property min_x: def __get__(self): return CGRectGetMinX(self.real_rect) property max_x: def __get__(self): return CGRectGetMaxX(self.real_rect) property min_y: def __get__(self): return CGRectGetMinY(self.real_rect) property max_y: def __get__(self): return CGRectGetMaxY(self.real_rect) property mid_x: def __get__(self): return CGRectGetMidX(self.real_rect) property mid_y: def __get__(self): return CGRectGetMidY(self.real_rect) property is_null: def __get__(self): return CGRectIsNull(self.real_rect) property is_empty: def __get__(self): return CGRectIsEmpty(self. real_rect) def __init__(self, float x=0.0, float y=0.0, float width=0.0, float height=0.0): self.real_rect = CGRectMake(x,y,width,height) def intersects(self, Rect other not None): return CGRectIntersectsRect(self.real_rect, other.real_rect) def contains_rect(self, Rect other not None): return CGRectContainsRect(self.real_rect, other.real_rect) def contains_point(self, float x, float y): return CGRectContainsPoint(self.real_rect, CGPointMake(x,y)) def __richcmp__(Rect x not None, Rect y not None, int op): if op == 2: return CGRectEqualToRect(x.real_rect, y.real_rect) elif op == 3: return not CGRectEqualToRect(x.real_rect, y.real_rect) else: raise NotImplementedError("only (in)equality can be tested") def standardize(self): self.real_rect = CGRectStandardize(self.real_rect) return self def inset(self, float x, float y): cdef CGRect new_rect new_rect = CGRectInset(self.real_rect, x, y) rect = Rect() set_rect(rect, new_rect) return rect def offset(self, float x, float y): cdef CGRect new_rect new_rect = CGRectOffset(self.real_rect, x, y) rect = Rect() set_rect(rect, new_rect) return rect def integral(self): self.real_rect = CGRectIntegral(self.real_rect) return self def __add__(Rect x not None, Rect y not None): cdef CGRect new_rect new_rect = CGRectUnion(x.real_rect, y.real_rect) rect = Rect() set_rect(rect, new_rect) return rect def union(self, Rect other not None): cdef CGRect new_rect new_rect = CGRectUnion(self.real_rect, other.real_rect) rect = Rect() set_rect(rect, new_rect) return rect def intersection(self, Rect other not None): cdef CGRect new_rect new_rect = CGRectIntersection(self.real_rect, other.real_rect) rect = Rect() set_rect(rect, new_rect) return rect def divide(self, float amount, edge): cdef CGRect slice cdef CGRect remainder CGRectDivide(self.real_rect, &slice, &remainder, amount, edge) pyslice = Rect() set_rect(pyslice, slice) pyrem = Rect() set_rect(pyrem, remainder) return pyslice, pyrem cdef init_from_cgrect(self, CGRect cgrect): self.real_rect = cgrect def __repr__(self): return "Rect(%r, %r, %r, %r)" % (self.x, self.y, self.width, self.height) cdef set_rect(Rect pyrect, CGRect cgrect): pyrect.init_from_cgrect(cgrect) cdef class CGMutablePath: cdef CGMutablePathRef path def __init__(self, CGMutablePath path=None): if path is not None: self.path = CGPathCreateMutableCopy(path.path) else: self.path = CGPathCreateMutable() def begin_path(self): return def move_to(self, float x, float y, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) CGPathMoveToPoint(self.path, ptr, x, y) def arc(self, float x, float y, float r, float startAngle, float endAngle, bool clockwise=False, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) CGPathAddArc(self.path, ptr, x, y, r, startAngle, endAngle, clockwise) def arc_to(self, float x1, float y1, float x2, float y2, float r, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) CGPathAddArcToPoint(self.path, ptr, x1,y1, x2,y2, r) def curve_to(self, float cx1, float cy1, float cx2, float cy2, float x, float y, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) CGPathAddCurveToPoint(self.path, ptr, cx1, cy1, cx2, cy2, x, y) def line_to(self, float x, float y, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) CGPathAddLineToPoint(self.path, ptr, x, y) def lines(self, points, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) cdef int n n = len(points) cdef int i CGPathMoveToPoint(self.path, ptr, points[0][0], points[0][1]) for i from 1 <= i < n: CGPathAddLineToPoint(self.path, ptr, points[i][0], points[i][1]) def add_path(self, CGMutablePath other_path not None, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) CGPathAddPath(self.path, ptr, other_path.path) def quad_curve_to(self, float cx, float cy, float x, float y, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) CGPathAddQuadCurveToPoint(self.path, ptr, cx, cy, x, y) def rect(self, float x, float y, float sx, float sy, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) CGPathAddRect(self.path, ptr, CGRectMake(x,y,sx,sy)) def rects(self, rects, CGAffine transform=None): cdef CGAffineTransform *ptr ptr = NULL if transform is not None: ptr = &(transform.real_transform) cdef int n n = len(rects) cdef int i for i from 0 <= i < n: CGPathAddRect(self.path, ptr, CGRectMakeFromPython(rects[i])) def close_path(self): CGPathCloseSubpath(self.path) def is_empty(self): return CGPathIsEmpty(self.path) def get_current_point(self): cdef CGPoint point point = CGPathGetCurrentPoint(self.path) return point.x, point.y def get_bounding_box(self): cdef CGRect rect rect = CGPathGetBoundingBox(self.path) return (rect.origin.x, rect.origin.y, rect.size.width, rect.size.height) def __richcmp__(CGMutablePath x not None, CGMutablePath y not None, int op): if op == 2: # testing for equality return CGPathEqualToPath(x.path, y.path) elif op == 3: # testing for inequality return not CGPathEqualToPath(x.path, y.path) else: raise NotImplementedError("only (in)equality tests are allowed") def __dealloc__(self): if self.path != NULL: CGPathRelease(self.path) self.path = NULL cdef class _Markers: def get_marker(self, int marker_type, float size=1.0): """ Return the CGMutablePath corresponding to the given marker enumeration. Marker.get_marker(marker_type, size=1.0) Parameters ---------- marker_type : int One of the enumerated marker types in kiva.constants. size : float, optional The linear size in points of the marker. Some markers (e.g. dot) ignore this. Returns ------- path : CGMutablePath """ if marker_type == constants.NO_MARKER: return CGMutablePath() elif marker_type == constants.SQUARE_MARKER: return self.square(size) elif marker_type == constants.DIAMOND_MARKER: return self.diamond(size) elif marker_type == constants.CIRCLE_MARKER: return self.circle(size) elif marker_type == constants.CROSSED_CIRCLE_MARKER: raise NotImplementedError elif marker_type == constants.CROSS_MARKER: return self.cross(size) elif marker_type == constants.TRIANGLE_MARKER: raise NotImplementedError elif marker_type == constants.INVERTED_TRIANGLE_MARKER: raise NotImplementedError elif marker_type == constants.PLUS_MARKER: raise NotImplementedError elif marker_type == constants.DOT_MARKER: raise NotImplementedError elif marker_type == constants.PIXEL_MARKER: raise NotImplementedError def square(self, float size): cdef float half half = size / 2 m = CGMutablePath() m.rect(-half,-half,size,size) return m def diamond(self, float size): cdef float half half = size / 2 m = CGMutablePath() m.move_to(0.0, -half) m.line_to(-half, 0.0) m.line_to(0.0, half) m.line_to(half, 0.0) m.close_path() return m def x(self, float size): cdef float half half = size / 2 m = CGMutablePath() m.move_to(-half,-half) m.line_to(half,half) m.move_to(-half,half) m.line_to(half,-half) return m def cross(self, float size): cdef float half half = size / 2 m = CGMutablePath() m.move_to(0.0, -half) m.line_to(0.0, half) m.move_to(-half, 0.0) m.line_to(half, 0.0) return m def dot(self): m = CGMutablePath() m.rect(-0.5,-0.5,1.0,1.0) return m def circle(self, float size): cdef float half half = size / 2 m = CGMutablePath() m.arc(0.0, 0.0, half, 0.0, 6.2831853071795862, 1) return m Markers = _Markers() cdef class ShadingFunction: cdef CGFunctionRef function cdef void _setup_function(self, CGFunctionEvaluateCallback callback): cdef int i cdef CGFunctionCallbacks callbacks callbacks.version = 0 callbacks.releaseInfo = NULL callbacks.evaluate = callback cdef CGFloat domain_bounds[2] cdef CGFloat range_bounds[8] domain_bounds[0] = 0.0 domain_bounds[1] = 1.0 for i from 0 <= i < 4: range_bounds[2*i] = 0.0 range_bounds[2*i+1] = 1.0 self.function = CGFunctionCreate(self, 1, domain_bounds, 4, range_bounds, &callbacks) if self.function == NULL: raise RuntimeError("could not make CGFunctionRef") cdef void shading_callback(object self, CGFloat* in_data, CGFloat* out_data): cdef int i out = self(in_data[0]) for i from 0 <= i < self.n_dims: out_data[i] = out[i] cdef class Shading: cdef CGShadingRef shading cdef public object function cdef int n_dims def __init__(self, ShadingFunction func not None): raise NotImplementedError("use AxialShading or RadialShading") def __dealloc__(self): if self.shading != NULL: CGShadingRelease(self.shading) cdef class AxialShading(Shading): def __init__(self, ShadingFunction func not None, object start, object end, int extend_start=0, int extend_end=0): self.n_dims = 4 cdef CGPoint start_point, end_point start_point = CGPointMake(start[0], start[1]) end_point = CGPointMake(end[0], end[1]) self.function = func cdef CGColorSpaceRef space space = CGColorSpaceCreateDeviceRGB() self.shading = CGShadingCreateAxial(space, start_point, end_point, func.function, extend_start, extend_end) CGColorSpaceRelease(space) if self.shading == NULL: raise RuntimeError("could not make CGShadingRef") cdef class RadialShading(Shading): def __init__(self, ShadingFunction func not None, object start, float start_radius, object end, float end_radius, int extend_start=0, int extend_end=0): self.n_dims = 4 cdef CGPoint start_point, end_point start_point = CGPointMake(start[0], start[1]) end_point = CGPointMake(end[0], end[1]) self.function = func cdef CGColorSpaceRef space space = CGColorSpaceCreateDeviceRGB() self.shading = CGShadingCreateRadial(space, start_point, start_radius, end_point, end_radius, func.function, extend_start, extend_end) CGColorSpaceRelease(space) if self.shading == NULL: raise RuntimeError("could not make CGShadingRef") cdef void safe_free(void* mem): if mem != NULL: PyMem_Free(mem) cdef class PiecewiseLinearColorFunction(ShadingFunction): cdef int num_stops cdef CGFloat* stops cdef CGFloat* red cdef CGFloat* green cdef CGFloat* blue cdef CGFloat* alpha def __init__(self, object stop_colors): cdef c_numpy.ndarray stop_array cdef int i stop_colors = numpy.array(stop_colors).astype(numpy.float32) if not (4 <= stop_colors.shape[0] <= 5) or len(stop_colors.shape) != 2: raise ValueError("need array [stops, red, green, blue[, alpha]]") if stop_colors[0,0] != 0.0 or stop_colors[0,-1] != 1.0: raise ValueError("stops need to start with 0.0 and end with 1.0") if not numpy.greater_equal(numpy.diff(stop_colors[0]), 0.0).all(): raise ValueError("stops must be sorted and unique") self.num_stops = stop_colors.shape[1] self.stops = PyMem_Malloc(sizeof(CGFloat)*self.num_stops) self.red = PyMem_Malloc(sizeof(CGFloat)*self.num_stops) self.green = PyMem_Malloc(sizeof(CGFloat)*self.num_stops) self.blue = PyMem_Malloc(sizeof(CGFloat)*self.num_stops) self.alpha = PyMem_Malloc(sizeof(CGFloat)*self.num_stops) has_alpha = stop_colors.shape[0] == 5 for i from 0 <= i < self.num_stops: self.stops[i] = stop_colors[0,i] self.red[i] = stop_colors[1,i] self.green[i] = stop_colors[2,i] self.blue[i] = stop_colors[3,i] if has_alpha: self.alpha[i] = stop_colors[4,i] else: self.alpha[i] = 1.0 self._setup_function(piecewise_callback) def dump(self): cdef int i print('PiecewiseLinearColorFunction') print(' num_stops = %i' % self.num_stops) print(' stops = ', end=" ") for i from 0 <= i < self.num_stops: print(self.stops[i], end=" ") print() print(' red = ', end=" ") for i from 0 <= i < self.num_stops: print(self.red[i], end=" ") print() print(' green = ', end=" ") for i from 0 <= i < self.num_stops: print(self.green[i], end=" ") print() print(' blue = ', end=" ") for i from 0 <= i < self.num_stops: print(self.blue[i], end=" ") print() print(' alpha = ', end=" ") for i from 0 <= i < self.num_stops: print(self.alpha[i], end=" ") print() def __dealloc__(self): safe_free(self.stops) safe_free(self.red) safe_free(self.green) safe_free(self.blue) safe_free(self.alpha) cdef int bisect_left(PiecewiseLinearColorFunction self, CGFloat t): cdef int lo, hi, mid cdef CGFloat stop hi = self.num_stops lo = 0 while lo < hi: mid = (lo + hi)/2 stop = self.stops[mid] if t < stop: hi = mid else: lo = mid + 1 return lo cdef void piecewise_callback(void* obj, CGFloat* t, CGFloat* out): cdef int i cdef CGFloat eps cdef PiecewiseLinearColorFunction self self = obj eps = 1e-6 if fabs(t[0]) < eps: out[0] = self.red[0] out[1] = self.green[0] out[2] = self.blue[0] out[3] = self.alpha[0] return if fabs(t[0] - 1.0) < eps: i = self.num_stops - 1 out[0] = self.red[i] out[1] = self.green[i] out[2] = self.blue[i] out[3] = self.alpha[i] return i = bisect_left(self, t[0]) cdef CGFloat f, g, dx dx = self.stops[i] - self.stops[i-1] if dx > eps: f = (t[0]-self.stops[i-1])/dx else: f = 1.0 g = 1.0 - f out[0] = f*self.red[i] + g*self.red[i-1] out[1] = f*self.green[i] + g*self.green[i-1] out[2] = f*self.blue[i] + g*self.blue[i-1] out[3] = f*self.alpha[i] + g*self.alpha[i-1] cdef double _point_distance(double x1, double y1, double x2, double y2): cdef double dx = x1-x2 cdef double dy = y1-y2 return sqrt(dx*dx+dy*dy) cdef bool _cgrect_within_circle(CGRect rect, double cx, double cy, double rad): cdef double d1 = _point_distance(cx,cy, rect.origin.x, rect.origin.y) cdef double d2 = _point_distance(cx,cy, rect.origin.x+rect.size.width, rect.origin.y) cdef double d3 = _point_distance(cx,cy, rect.origin.x+rect.size.width, rect.origin.y+rect.size.height) cdef double d4 = _point_distance(cx,cy, rect.origin.x, rect.origin.y+rect.size.height) return (d1 Returns the pointer (as an ssize_t) of the CGContextRef of an NSView pointer"}, {NULL, NULL} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef mac_context_module = { PyModuleDef_HEAD_INIT, "mac_context", /* m_name */ NULL, /* m_doc */ -1, /* m_size */ mac_context_methods, /* m_methods */ NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; PyMODINIT_FUNC PyInit_mac_context(void) { return PyModule_Create(&mac_context_module); } #else void initmac_context(void) { Py_InitModule("mac_context", mac_context_methods); } #endif enthought-chaco2-4.8.1.orig/kiva/quartz/Python.pxi0000644000175000017500000000276113321720235021164 0ustar varunvarun# :Author: Robert Kern # :Copyright: 2004, Enthought, Inc. # :License: BSD Style ctypedef void (*cobject_destr)(void *) cdef extern from "Python.h": ctypedef int size_t ctypedef int Py_ssize_t char* PyBytes_AsString(object string) object PyString_FromString(char* c_string) object PyString_FromStringAndSize(char* v, Py_ssize_t len) int PyString_AsStringAndSize(object obj, char **buffer, Py_ssize_t *length) int PyObject_AsCharBuffer(object obj, char **buffer, Py_ssize_t *buffer_len) int PyObject_AsReadBuffer(object obj, void **buffer, Py_ssize_t *buffer_len) int PyObject_CheckReadBuffer(object o) int PyObject_AsWriteBuffer(object obj, void **buffer, Py_ssize_t *buffer_len) void* PyMem_Malloc(size_t n) void* PyMem_Realloc(void* buf, size_t n) void PyMem_Free(void* buf) void Py_DECREF(object obj) void Py_XDECREF(object obj) void Py_INCREF(object obj) void Py_XINCREF(object obj) int PyUnicode_Check(ob) int PyString_Check(ob) ctypedef int Py_UNICODE Py_UNICODE *PyUnicode_AS_UNICODE(ob) int PyUnicode_GET_SIZE(ob) char *PyString_AS_STRING(ob) object PyCObject_FromVoidPtr(void* cobj, cobject_destr destr) void* PyCObject_AsVoidPtr(object self) cdef extern from "string.h": void *memcpy(void *s1, void *s2, int n) cdef extern from "math.h": double fabs(double x) cdef extern from "stdlib.h": void free(void *ptr) void *malloc(size_t size) void *realloc(void *ptr, size_t size) enthought-chaco2-4.8.1.orig/kiva/quartz/CTFont.pyx0000644000175000017500000001440213233644505021062 0ustar varunvarun# :Author: John Wiggins # :Copyright: 2011, Enthought, Inc. # :License: BSD Style from __future__ import print_function include "CoreFoundation.pxi" include "CoreGraphics.pxi" include "CoreText.pxi" cdef object _cf_string_to_pystring(CFStringRef cf_string): cdef char* c_string cdef char buf[256] c_string = CFStringGetCStringPtr(cf_string, kCFStringEncodingMacRoman) if c_string == NULL: success = CFStringGetCString(cf_string, buf, 256, kCFStringEncodingMacRoman) retval = str(buf) else: retval = str(c_string) return retval cdef CFArrayRef _get_system_fonts(): cdef CFIndex value = 1 cdef CFNumberRef cf_number cdef CFMutableDictionaryRef cf_options_dict cdef CTFontCollectionRef cf_font_collection cdef CFArrayRef cf_font_descriptors cf_options_dict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) if cf_options_dict != NULL: cf_number = CFNumberCreate(NULL, kCFNumberCFIndexType, &value) CFDictionaryAddValue(cf_options_dict, kCTFontCollectionRemoveDuplicatesOption, cf_number) CFRelease(cf_number) else: msg = "unknown error building options dictionary for font list" raise RuntimeError(msg) cf_font_collection = CTFontCollectionCreateFromAvailableFonts(cf_options_dict) CFRelease(cf_options_dict) cf_font_descriptors = CTFontCollectionCreateMatchingFontDescriptors(cf_font_collection) CFRelease(cf_font_collection) return cf_font_descriptors cdef class CTFont: cdef CTFontRef ct_font def __cinit__(self, *args, **kwargs): self.ct_font = NULL def __dealloc__(self): if self.ct_font != NULL: CFRelease(self.ct_font) cpdef size_t get_pointer(self): return self.ct_font cdef set_pointer(self, CTFontRef pointer): self.ct_font = pointer cdef class CTFontStyle: cdef CTFontDescriptorRef ct_font_descriptor cdef CFDictionaryRef attribute_dictionary cdef readonly object family_name cdef readonly object style def __cinit__(self, *args, **kwargs): self.ct_font_descriptor = NULL self.attribute_dictionary = NULL def __dealloc__(self): if self.attribute_dictionary != NULL: CFRelease(self.attribute_dictionary) if self.ct_font_descriptor != NULL: CFRelease(self.ct_font_descriptor) def __init__(self, name, style='regular'): self.family_name = name self.style = style self.attribute_dictionary = self._build_attribute_dictionary(name, style) self.ct_font_descriptor = CTFontDescriptorCreateWithAttributes(self.attribute_dictionary) def get_descent_ascent(self, object text): """ Get the descent and ascent font metrics for a given string of text. """ cdef CTFontRef ct_font cdef float ascent, descent ct_font = CTFontCreateWithFontDescriptor(self.ct_font_descriptor, 0.0, NULL) ascent = CTFontGetAscent(ct_font) descent = CTFontGetDescent(ct_font) CFRelease(ct_font) return descent, ascent def get_font(self, float font_size): """ Get a CTFont matching the descriptor at the given size. """ cdef CTFontRef ct_font ct_font = CTFontCreateWithFontDescriptor(self.ct_font_descriptor, font_size, NULL) font = CTFont() font.set_pointer(ct_font) return font property postcript_name: def __get__(self): cdef CFStringRef cf_ps_name cf_ps_name = CTFontDescriptorCopyAttribute(self.ct_font_descriptor, kCTFontNameAttribute) retval = _cf_string_to_pystring(cf_ps_name) CFRelease(cf_ps_name) return retval cdef CFDictionaryRef _build_attribute_dictionary(self, name, style): cdef CFStringRef cf_name, cf_style cdef CFMutableDictionaryRef cf_dict mac_name = name.strip().encode('utf-8') cf_name = CFStringCreateWithCString(NULL, mac_name, kCFStringEncodingUTF8) style = style.title() mac_style = style.strip().encode('utf-8') cf_style = CFStringCreateWithCString(NULL, mac_style, kCFStringEncodingUTF8) cf_dict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) if cf_dict != NULL: CFDictionaryAddValue(cf_dict, kCTFontFamilyNameAttribute, cf_name) CFDictionaryAddValue(cf_dict, kCTFontStyleNameAttribute, cf_style) else: msg = "unknown error building descriptor dictionary for font %r"%mac_name raise RuntimeError(msg) CFRelease(cf_name) CFRelease(cf_style) return cf_dict cdef class FontLookup: cdef readonly object cache cdef public object default_font def lookup(self, name=None, style='regular'): return CTFontStyle(name or self.default_font, style) def names(self): cdef CFIndex idx, count cdef CFStringRef cf_fam_name cdef CFArrayRef cf_font_descriptors cdef CTFontDescriptorRef cf_font_descriptor cf_font_descriptors = _get_system_fonts() families = [] count = CFArrayGetCount(cf_font_descriptors) for idx from 0 <= idx < count: cf_font_descriptor = CFArrayGetValueAtIndex(cf_font_descriptors, idx) cf_fam_name = CTFontDescriptorCopyAttribute(cf_font_descriptor, kCTFontFamilyNameAttribute) families.append(_cf_string_to_pystring(cf_fam_name)) CFRelease(cf_fam_name) CFRelease(cf_font_descriptors) families.sort() return list(set(families)) def styles(self, font_name): raise NotImplementedError def list_fonts(self): for name in self.names(): print(name, self.styles(name)) default_font_info = FontLookup() default_font_info.default_font = 'Helvetica' enthought-chaco2-4.8.1.orig/kiva/quartz/c_numpy.pxd0000644000175000017500000000702113233644505021351 0ustar varunvarun# :Author: Travis Oliphant cdef extern from "numpy/arrayobject.h": cdef enum NPY_TYPES: NPY_BOOL NPY_BYTE NPY_UBYTE NPY_SHORT NPY_USHORT NPY_INT NPY_UINT NPY_LONG NPY_ULONG NPY_LONGLONG NPY_ULONGLONG NPY_FLOAT NPY_DOUBLE NPY_LONGDOUBLE NPY_CFLOAT NPY_CDOUBLE NPY_CLONGDOUBLE NPY_OBJECT NPY_STRING NPY_UNICODE NPY_VOID NPY_NTYPES NPY_NOTYPE cdef enum requirements: NPY_CONTIGUOUS NPY_FORTRAN NPY_OWNDATA NPY_FORCECAST NPY_ENSURECOPY NPY_ENSUREARRAY NPY_ELEMENTSTRIDES NPY_ALIGNED NPY_NOTSWAPPED NPY_WRITEABLE NPY_UPDATEIFCOPY NPY_ARR_HAS_DESCR NPY_BEHAVED NPY_BEHAVED_NS NPY_CARRAY NPY_CARRAY_RO NPY_FARRAY NPY_FARRAY_RO NPY_DEFAULT NPY_IN_ARRAY NPY_OUT_ARRAY NPY_INOUT_ARRAY NPY_IN_FARRAY NPY_OUT_FARRAY NPY_INOUT_FARRAY NPY_UPDATE_ALL cdef enum defines: # Note: as of Pyrex 0.9.5, enums are type-checked more strictly, so this # can't be used as an integer. NPY_MAXDIMS ctypedef struct npy_cdouble: double real double imag ctypedef struct npy_cfloat: double real double imag ctypedef int npy_intp ctypedef extern class numpy.dtype [object PyArray_Descr]: cdef int type_num, elsize, alignment cdef char type, kind, byteorder, hasobject cdef object fields, typeobj ctypedef extern class numpy.ndarray [object PyArrayObject]: cdef char *data cdef int nd cdef npy_intp *dimensions cdef npy_intp *strides cdef object base cdef dtype descr cdef int flags ctypedef extern class numpy.flatiter [object PyArrayIterObject]: cdef int nd_m1 cdef npy_intp index, size cdef ndarray ao cdef char *dataptr ctypedef extern class numpy.broadcast [object PyArrayMultiIterObject]: cdef int numiter cdef npy_intp size, index cdef int nd # These next two should be arrays of [NPY_MAXITER], but that is # difficult to cleanly specify in Pyrex. Fortunately, it doesn't matter. cdef npy_intp *dimensions cdef void **iters object PyArray_ZEROS(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran) object PyArray_EMPTY(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran) dtype PyArray_DescrFromTypeNum(NPY_TYPES type_num) object PyArray_SimpleNew(int ndims, npy_intp* dims, NPY_TYPES type_num) int PyArray_Check(object obj) object PyArray_ContiguousFromAny(object obj, NPY_TYPES type, int mindim, int maxdim) npy_intp PyArray_SIZE(ndarray arr) npy_intp PyArray_NBYTES(ndarray arr) void *PyArray_DATA(ndarray arr) object PyArray_FromAny(object obj, dtype newtype, int mindim, int maxdim, int requirements, object context) object PyArray_FROMANY(object obj, NPY_TYPES type_num, int min, int max, int requirements) object PyArray_NewFromDescr(object subtype, dtype newtype, int nd, npy_intp* dims, npy_intp* strides, void* data, int flags, object parent) void* PyArray_GETPTR2(object obj, int i, int j) void PyArray_ITER_NEXT(flatiter it) void import_array() enthought-chaco2-4.8.1.orig/kiva/quartz/mac_context_cocoa.m0000644000175000017500000000043713233644505023014 0ustar varunvarun#import void * get_cg_context_ref(void *view_ptr) { id object = (id)view_ptr; if ([object isKindOfClass:[NSView class]]) { NSView *view = (NSView *)object; return [[[view window] graphicsContext] graphicsPort]; } return (void *)0; } enthought-chaco2-4.8.1.orig/kiva/quartz/numpy.pxi0000644000175000017500000000165713233644505021065 0ustar varunvarun# :Author: Robert Kern # :Copyright: 2004, Enthought, Inc. # :License: BSD Style cdef extern from "numpy/oldnumeric.h": ctypedef enum PyArray_TYPES: PyArray_CHAR PyArray_UBYTE PyArray_SBYTE PyArray_SHORT PyArray_USHORT PyArray_INT PyArray_UINT PyArray_LONG PyArray_FLOAT PyArray_DOUBLE PyArray_CFLOAT PyArray_CDOUBLE PyArray_OBJECT PyArray_NTYPES PyArray_NOTYPE struct PyArray_Descr: int type_num, elsize char type ctypedef class numpy.ndarray [object PyArrayObject]: cdef char *data cdef int nd cdef int *dimensions cdef int *strides cdef object base cdef PyArray_Descr *descr cdef int flags ndarray PyArray_FromDims(int ndims, int* dims, int item_type) int PyArray_Free(object obj, char* data) void import_array() enthought-chaco2-4.8.1.orig/kiva/quartz/CoreText.pxi0000644000175000017500000003670013233644505021447 0ustar varunvarun# :Author: John Wiggins # :Copyright: 2011, Enthought, Inc. # :License: BSD Style include "CoreFoundation.pxi" include "CoreGraphics.pxi" cdef extern from "ApplicationServices/ApplicationServices.h": ctypedef CFTypeRef CTFontRef ctypedef CFTypeRef CTFontCollectionRef ctypedef CFTypeRef CTFontDescriptorRef ctypedef CFTypeRef CTLineRef # Constants that are used throughout CoreText cdef CFStringRef kCTFontAttributeName cdef CFStringRef kCTKernAttributeName cdef CFStringRef kCTLigatureAttributeName cdef CFStringRef kCTForegroundColorAttributeName cdef CFStringRef kCTParagraphStyleAttributeName cdef CFStringRef kCTUnderlineStyleAttributeName cdef CFStringRef kCTVerticalFormsAttributeName cdef CFStringRef kCTGlyphInfoAttributeName ctypedef enum CTUnderlineStyle: kCTUnderlineStyleNone = 0x00 kCTUnderlineStyleSingle = 0x01 kCTUnderlineStyleThick = 0x02 kCTUnderlineStyleDouble = 0x09 ctypedef enum CTUnderlineStyleModifiers: kCTUnderlinePatternSolid = 0x0000 kCTUnderlinePatternDot = 0x0100 kCTUnderlinePatternDash = 0x0200 kCTUnderlinePatternDashDot = 0x0300 kCTUnderlinePatternDashDotDot = 0x0400 cdef CFStringRef kCTFontSymbolicTrait cdef CFStringRef kCTFontWeightTrait cdef CFStringRef kCTFontWidthTrait cdef CFStringRef kCTFontSlantTrait ctypedef enum: kCTFontClassMaskShift = 28 ctypedef enum CTFontSymbolicTraits: kCTFontItalicTrait = (1 << 0) kCTFontBoldTrait = (1 << 1) kCTFontExpandedTrait = (1 << 5) kCTFontCondensedTrait = (1 << 6) kCTFontMonoSpaceTrait = (1 << 10) kCTFontVerticalTrait = (1 << 11) kCTFontUIOptimizedTrait = (1 << 12) kCTFontClassMaskTrait = (15 << kCTFontClassMaskShift) ctypedef enum CTFontStylisticClass: kCTFontUnknownClass = (0 << kCTFontClassMaskShift) kCTFontOldStyleSerifsClass = (1 << kCTFontClassMaskShift) kCTFontTransitionalSerifsClass = (2 << kCTFontClassMaskShift) kCTFontModernSerifsClass = (3 << kCTFontClassMaskShift) kCTFontClarendonSerifsClass = (4 << kCTFontClassMaskShift) kCTFontSlabSerifsClass = (5 << kCTFontClassMaskShift) kCTFontFreeformSerifsClass = (7 << kCTFontClassMaskShift) kCTFontSansSerifClass = (8 << kCTFontClassMaskShift) kCTFontOrnamentalsClass = (9 << kCTFontClassMaskShift) kCTFontScriptsClass = (10 << kCTFontClassMaskShift) kCTFontSymbolicClass = (12 << kCTFontClassMaskShift) cdef CFStringRef kCTFontNameAttribute cdef CFStringRef kCTFontDisplayNameAttribute cdef CFStringRef kCTFontFamilyNameAttribute cdef CFStringRef kCTFontStyleNameAttribute cdef CFStringRef kCTFontTraitsAttribute cdef CFStringRef kCTFontVariationAttribute cdef CFStringRef kCTFontSizeAttribute cdef CFStringRef kCTFontMatrixAttribute cdef CFStringRef kCTFontCascadeListAttribute cdef CFStringRef kCTFontCharacterSetAttribute cdef CFStringRef kCTFontLanguagesAttribute cdef CFStringRef kCTFontBaselineAdjustAttribute cdef CFStringRef kCTFontMacintoshEncodingsAttribute cdef CFStringRef kCTFontFeaturesAttribute cdef CFStringRef kCTFontFeatureSettingsAttribute cdef CFStringRef kCTFontFixedAdvanceAttribute cdef CFStringRef kCTFontOrientationAttribute ctypedef enum CTFontOrientation: kCTFontDefaultOrientation = 0 kCTFontHorizontalOrientation = 1 kCTFontVerticalOrientation = 2 cdef CFStringRef kCTFontCopyrightNameKey cdef CFStringRef kCTFontFamilyNameKey cdef CFStringRef kCTFontSubFamilyNameKey cdef CFStringRef kCTFontStyleNameKey cdef CFStringRef kCTFontUniqueNameKey cdef CFStringRef kCTFontFullNameKey cdef CFStringRef kCTFontVersionNameKey cdef CFStringRef kCTFontPostScriptNameKey cdef CFStringRef kCTFontTrademarkNameKey cdef CFStringRef kCTFontManufacturerNameKey cdef CFStringRef kCTFontDesignerNameKey cdef CFStringRef kCTFontDescriptionNameKey cdef CFStringRef kCTFontVendorURLNameKey cdef CFStringRef kCTFontDesignerURLNameKey cdef CFStringRef kCTFontLicenseNameKey cdef CFStringRef kCTFontLicenseURLNameKey cdef CFStringRef kCTFontSampleTextNameKey cdef CFStringRef kCTFontPostScriptCIDNameKey ctypedef enum CTFontUIFontType: kCTFontNoFontType = -1 kCTFontUserFontType = 0 kCTFontUserFixedPitchFontType = 1 kCTFontSystemFontType = 2 kCTFontEmphasizedSystemFontType = 3 kCTFontSmallSystemFontType = 4 kCTFontSmallEmphasizedSystemFontType = 5 kCTFontMiniSystemFontType = 6 kCTFontMiniEmphasizedSystemFontType = 7 kCTFontViewsFontType = 8 kCTFontApplicationFontType = 9 kCTFontLabelFontType = 10 kCTFontMenuTitleFontType = 11 kCTFontMenuItemFontType = 12 kCTFontMenuItemMarkFontType = 13 kCTFontMenuItemCmdKeyFontType = 14 kCTFontWindowTitleFontType = 15 kCTFontPushButtonFontType = 16 kCTFontUtilityWindowTitleFontType = 17 kCTFontAlertHeaderFontType = 18 kCTFontSystemDetailFontType = 19 kCTFontEmphasizedSystemDetailFontType = 20 kCTFontToolbarFontType = 21 kCTFontSmallToolbarFontType = 22 kCTFontMessageFontType = 23 kCTFontPaletteFontType = 24 kCTFontToolTipFontType = 25 kCTFontControlContentFontType = 26 cdef CFStringRef kCTFontVariationAxisIdentifierKey cdef CFStringRef kCTFontVariationAxisMinimumValueKey cdef CFStringRef kCTFontVariationAxisMaximumValueKey cdef CFStringRef kCTFontVariationAxisDefaultValueKey cdef CFStringRef kCTFontVariationAxisNameKey cdef CFStringRef kCTFontFeatureTypeIdentifierKey cdef CFStringRef kCTFontFeatureTypeNameKey cdef CFStringRef kCTFontFeatureTypeExclusiveKey cdef CFStringRef kCTFontFeatureTypeSelectorsKey cdef CFStringRef kCTFontFeatureSelectorIdentifierKey cdef CFStringRef kCTFontFeatureSelectorNameKey cdef CFStringRef kCTFontFeatureSelectorDefaultKey cdef CFStringRef kCTFontFeatureSelectorSettingKey #ctypedef enum CTFontTableTag: # kCTFontTableBASE # kCTFontTableCFF # kCTFontTableDSIG # kCTFontTableEBDT # kCTFontTableEBLC # kCTFontTableEBSC # kCTFontTableGDEF # kCTFontTableGPOS # kCTFontTableGSUB # kCTFontTableJSTF # kCTFontTableLTSH # kCTFontTableOS2 # kCTFontTablePCLT # kCTFontTableVDMX # kCTFontTableVORG # kCTFontTableZapf # kCTFontTableAcnt # kCTFontTableAvar # kCTFontTableBdat # kCTFontTableBhed # kCTFontTableBloc # kCTFontTableBsln # kCTFontTableCmap # kCTFontTableCvar # kCTFontTableCvt # kCTFontTableFdsc # kCTFontTableFeat # kCTFontTableFmtx # kCTFontTableFpgm # kCTFontTableFvar # kCTFontTableGasp # kCTFontTableGlyf # kCTFontTableGvar # kCTFontTableHdmx # kCTFontTableHead # kCTFontTableHhea # kCTFontTableHmtx # kCTFontTableHsty # kCTFontTableJust # kCTFontTableKern # kCTFontTableLcar # kCTFontTableLoca # kCTFontTableMaxp # kCTFontTableMort # kCTFontTableMorx # kCTFontTableName # kCTFontTableOpbd # kCTFontTablePost # kCTFontTablePrep # kCTFontTableProp # kCTFontTableTrak # kCTFontTableVhea # kCTFontTableVmtx # #ctypedef enum CTFontTableOptions: # kCTFontTableOptionNoOptions = 0 # kCTFontTableOptionExcludeSynthetic = (1 << 0) # cdef CFStringRef kCTFontCollectionRemoveDuplicatesOption ctypedef enum CTLineTruncationType: kCTLineTruncationStart = 0 kCTLineTruncationEnd = 1 kCTLineTruncationMiddle = 2 # Fonts CTFontRef CTFontCreateWithName(CFStringRef name, CGFloat size, void *matrix) CTFontRef CTFontCreateWithFontDescriptor(CTFontDescriptorRef descriptor, CGFloat size, void *matrix) #CTFontRef CTFontCreateUIFontForLanguage(CTFontUIFontType uiType, # CGFloat size, CFStringRef language) #CTFontRef CTFontCreateCopyWithAttributes(CTFontRef font, CGFloat size, # void *matrix, CTFontDescriptorRef attributes) CTFontRef CTFontCreateCopyWithSymbolicTraits(CTFontRef font, CGFloat size, void *matrix, CTFontSymbolicTraits symTraitValue, CTFontSymbolicTraits symTraitMask) #CTFontRef CTFontCreateCopyWithFamily(CTFontRef font, CGFloat size, # void *matrix, CFStringRef family) #CTFontRef CTFontCreateForString(CTFontRef currentFont, CFStringRef string, # CFRange range) CTFontDescriptorRef CTFontCopyFontDescriptor(CTFontRef font) CFTypeRef CTFontCopyAttribute(CTFontRef font, CFStringRef attribute) CGFloat CTFontGetSize(CTFontRef font) void CTFontGetMatrix(CTFontRef font) CTFontSymbolicTraits CTFontGetSymbolicTraits(CTFontRef font) CFDictionaryRef CTFontCopyTraits(CTFontRef font) CFStringRef CTFontCopyPostScriptName(CTFontRef font) CFStringRef CTFontCopyFamilyName(CTFontRef font) CFStringRef CTFontCopyFullName(CTFontRef font) CFStringRef CTFontCopyDisplayName(CTFontRef font) CFStringRef CTFontCopyName(CTFontRef font, CFStringRef nameKey) CFStringRef CTFontCopyLocalizedName(CTFontRef font, CFStringRef nameKey, CFStringRef *language) #CFCharacterSetRef CTFontCopyCharacterSet(CTFontRef font) CFStringEncoding CTFontGetStringEncoding(CTFontRef font) CFArrayRef CTFontCopySupportedLanguages(CTFontRef font) Boolean CTFontGetGlyphsForCharacters(CTFontRef font, UniChar characters[], CGGlyph glyphs[], CFIndex count) CGFloat CTFontGetAscent(CTFontRef font) CGFloat CTFontGetDescent(CTFontRef font) CGFloat CTFontGetLeading(CTFontRef font) unsigned CTFontGetUnitsPerEm(CTFontRef font) CFIndex CTFontGetGlyphCount(CTFontRef font) CGRect CTFontGetBoundingBox(CTFontRef font) CGFloat CTFontGetUnderlinePosition(CTFontRef font) CGFloat CTFontGetUnderlineThickness(CTFontRef font) CGFloat CTFontGetSlantAngle(CTFontRef font) CGFloat CTFontGetCapHeight(CTFontRef font) CGFloat CTFontGetXHeight(CTFontRef font) CGGlyph CTFontGetGlyphWithName(CTFontRef font, CFStringRef glyphName) CGRect CTFontGetBoundingRectsForGlyphs(CTFontRef font, CTFontOrientation orientation, CGGlyph glyphs[], CGRect boundingRects[],CFIndex count) double CTFontGetAdvancesForGlyphs(CTFontRef font, CTFontOrientation orientation, CGGlyph glyphs[], CGSize advances[], CFIndex count) void CTFontGetVerticalTranslationsForGlyphs(CTFontRef font, CGGlyph glyphs[], CGSize translations[], CFIndex count) CGPathRef CTFontCreatePathForGlyph(CTFontRef font, CGGlyph glyph, void * transform) CFArrayRef CTFontCopyVariationAxes(CTFontRef font) CFDictionaryRef CTFontCopyVariation(CTFontRef font) CFArrayRef CTFontCopyFeatures(CTFontRef font) CFArrayRef CTFontCopyFeatureSettings(CTFontRef font) CGFontRef CTFontCopyGraphicsFont(CTFontRef font, CTFontDescriptorRef *attributes) CTFontRef CTFontCreateWithGraphicsFont(CGFontRef graphicsFont, CGFloat size, void *matrix, CTFontDescriptorRef attributes) #ATSFontRef CTFontGetPlatformFont(CTFontRef font, CTFontDescriptorRef *attributes) #CTFontRef CTFontCreateWithPlatformFont(ATSFontRef platformFont, CGFloat size, # void *matrix, CTFontDescriptorRef attributes) #CTFontRef CTFontCreateWithQuickdrawInstance(ConstStr255Param name, # int16_t identifier, uint8_t style, CGFloat size) #CFArrayRef CTFontCopyAvailableTables(CTFontRef font, # CTFontTableOptions options) #CFDataRef CTFontCopyTable(CTFontRef font, CTFontTableTag table, # CTFontTableOptions options) # Font Collections CTFontCollectionRef CTFontCollectionCreateFromAvailableFonts(CFDictionaryRef options) CTFontCollectionRef CTFontCollectionCreateWithFontDescriptors(CFArrayRef descriptors, CFDictionaryRef options) #CTFontCollectionRef CTFontCollectionCreateCopyWithFontDescriptors( # CTFontCollectionRef original, CFArrayRef descriptors, # CFDictionaryRef options) CFArrayRef CTFontCollectionCreateMatchingFontDescriptors(CTFontCollectionRef collection) #CFArrayRef CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback( # CTFontCollectionRef collection, # CTFontCollectionSortDescriptorsCallback sortCallback, # void* refCon) # Font Descriptors CTFontDescriptorRef CTFontDescriptorCreateWithNameAndSize(CFStringRef name, CGFloat size) CTFontDescriptorRef CTFontDescriptorCreateWithAttributes( CFDictionaryRef attributes) CTFontDescriptorRef CTFontDescriptorCreateCopyWithAttributes( CTFontDescriptorRef original, CFDictionaryRef attributes) #CTFontDescriptorRef CTFontDescriptorCreateCopyWithVariation( # CTFontDescriptorRef original, CFNumberRef variationIdentifier, # CGFloat variationValue) #CTFontDescriptorRef CTFontDescriptorCreateCopyWithFeature( # CTFontDescriptorRef original, CFNumberRef featureTypeIdentifier, # CFNumberRef featureSelectorIdentifier) #CFArrayRef CTFontDescriptorCreateMatchingFontDescriptors( # CTFontDescriptorRef descriptor, CFSetRef mandatoryAttributes) #CTFontDescriptorRef CTFontDescriptorCreateMatchingFontDescriptor( # CTFontDescriptorRef descriptor, CFSetRef mandatoryAttributes) #CFDictionaryRef CTFontDescriptorCopyAttributes(CTFontDescriptorRef descriptor) CFTypeRef CTFontDescriptorCopyAttribute( CTFontDescriptorRef descriptor, CFStringRef attribute) #CFTypeRef CTFontDescriptorCopyLocalizedAttribute( # CTFontDescriptorRef descriptor, CFStringRef attribute, # CFStringRef *language) # Lines CTLineRef CTLineCreateWithAttributedString(CFAttributedStringRef string) CTLineRef CTLineCreateTruncatedLine(CTLineRef line, double width, CTLineTruncationType truncationType, CTLineRef truncationToken) CTLineRef CTLineCreateJustifiedLine(CTLineRef line, CGFloat justificationFactor, double justificationWidth) CFIndex CTLineGetGlyphCount(CTLineRef line) CFArrayRef CTLineGetGlyphRuns(CTLineRef line) CFRange CTLineGetStringRange(CTLineRef line) double CTLineGetPenOffsetForFlush(CTLineRef line, CGFloat flushFactor, double flushWidth) void CTLineDraw(CTLineRef line, CGContextRef context) CGRect CTLineGetImageBounds(CTLineRef line, CGContextRef context) double CTLineGetTypographicBounds(CTLineRef line, CGFloat* ascent, CGFloat* descent, CGFloat* leading) double CTLineGetTrailingWhitespaceWidth(CTLineRef line) CFIndex CTLineGetStringIndexForPosition(CTLineRef line, CGPoint position) CGFloat CTLineGetOffsetForStringIndex(CTLineRef line, CFIndex charIndex, CGFloat* secondaryOffset) enthought-chaco2-4.8.1.orig/kiva/svg.py0000644000175000017500000003642613421603267017017 0ustar varunvarun#------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! #------------------------------------------------------------------------------ """ Chaco's SVG backend :Copyright: ActiveState :License: BSD Style :Author: David Ascher (davida@activestate.com) :Version: $Revision: 1.5 $ """ #### # # Known limitations # # * BUG: Weird behavior with compound plots # * Limitation: text widths are lousy if reportlab is not installed # * Missing feature: rotated text """ Miscellaneous notes: * the way to do links: """ # Major library imports import os import sys from numpy import arange, ravel, array import warnings import six # Local, relative Kiva imports from . import affine from . import basecore2d from . import constants from .constants import ( FILL, FILL_STROKE, EOF_FILL_STROKE, EOF_FILL, STROKE ) from . import agg from base64 import b64encode def _strpoints(points): c = six.StringIO() for x,y in points: c.write('%3.2f,%3.2f ' % (x,y)) return c.getvalue() def _mkstyle(kw): return '; '.join([str(k) + ':' + str(v) for k,v in kw.items()]) def default_filter(kw1): kw = {} for (k,v) in kw1.items(): if type(v) == type(()): if v[0] != v[1]: kw[k] = v[0] else: kw[k] = v return kw line_cap_map = { constants.CAP_ROUND: 'round', constants.CAP_SQUARE: 'square', constants.CAP_BUTT: 'butt' } line_join_map = { constants.JOIN_ROUND: 'round', constants.JOIN_BEVEL: 'bevel', constants.JOIN_MITER: 'miter' } xmltemplate = """ %(contents)s """ htmltemplate = """ %(contents)s """ font_map = {'Arial': 'Helvetica', } try: # expensive way of computing string widths import reportlab.pdfbase.pdfmetrics as pdfmetrics import reportlab.pdfbase._fontdata as _fontdata _reportlab_loaded = 1 except ImportError: from . import pdfmetrics from . import _fontdata _reportlab_loaded = 0 font_face_map = {'Arial': 'Helvetica', '': 'Helvetica'} # This backend has no compiled path object, yet. class CompiledPath(object): pass _clip_counter = 0 class GraphicsContext(basecore2d.GraphicsContextBase): def __init__(self, size, *args, **kwargs): super(GraphicsContext, self).__init__(self, size, *args, **kwargs) self.size = size self._height = size[1] self.contents = six.StringIO() self._clipmap = {} def render(self, format): assert format == 'svg' height, width = self.size contents = self.contents.getvalue().replace("\n' return x def _debug_draw_clipping_path(self, x, y, width, height): a,b,c,d,tx,ty = affine.affine_params(self.get_ctm()) transform = 'matrix(%(a)f,%(b)f,%(c)f,%(d)f,%(tx)f,%(ty)f)' % locals() self._emit('rect', x=x, y=y, width=width, height=height, transform=transform, style=_mkstyle({'stroke-width': 5, 'fill':'none', 'stroke': 'green'})) def device_set_clipping_path(self, x, y, width, height): #self._debug_draw_clipping_path(x, y, width, height) #return global _clip_counter self.state._clip_id = 'clip_%d' % _clip_counter _clip_counter += 1 x,y = self._fixpoints([[x,y]])[0] a,b,c,d,tx,ty = affine.affine_params(self.get_ctm()) transform = 'matrix(%(a)f,%(b)f,%(c)f,%(d)f,%(tx)f,%(ty)f)' % locals() rect = self._build('rect', x=x, y=y, width=width, height=height) clippath = self._build('clipPath', contents=rect, id=self.state._clip_id) self._emit('g', transform=transform, contents=clippath) def device_destroy_clipping_path(self): self.state._clip_id = None # utility routines def _fixpoints(self, points): return points # convert lines from Kiva coordinate space to PIL coordinate space # XXX I suspect this is the location of the bug w.r.t. compound graphs and # "global" sizing. # XXX this should be made more efficient for NumPy arrays np = [] for (x,y) in points: np.append((x,self._height-y)) return np def _emit(self, name, contents=None, kw={}, **otherkw): self.contents.write('\n') else: self.contents.write('>') if name != 'text': self.contents.write('\n') self.contents.write(contents) self.contents.write('\n') def _color(self, color): r,g,b,a = color return '#%02x%02x%02x' % (int(r*255),int(g*255),int(b*255)) def _dasharray(self): dasharray = '' for x in self.state.line_dash: if type(x) == type(arange(3)): # why is this so hard? x = ravel(x)[0] dasharray += ' ' + '%3.2f' % x if not dasharray or dasharray == " 0.00 0.00": dasharray = 'none' return dasharray # noops which seem to be needed def device_update_line_state(self): pass def device_update_fill_state(self): pass def font_metrics_provider(): return GraphicsContext((1,1)) SVGGC = GraphicsContext # for b/w compatibility enthought-chaco2-4.8.1.orig/kiva/_cython_speedups.cpp0000644000175000017500000356431513477722705021745 0ustar varunvarun/* Generated by Cython 0.29.10 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else #define CYTHON_ABI "0_29_10" #define CYTHON_HEX_VERSION 0x001D0AF0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG #if PY_VERSION_HEX >= 0x02070000 #define HAVE_LONG_LONG #endif #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #undef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #if PY_VERSION_HEX < 0x02070000 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif #if PY_VERSION_HEX < 0x02070000 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if PY_VERSION_HEX < 0x030300F0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #endif #ifndef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) #endif #ifndef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #undef SHIFT #undef BASE #undef MASK #ifdef SIZEOF_VOID_P enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_cpp_attribute #define __has_cpp_attribute(x) 0 #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif #ifndef CYTHON_MAYBE_UNUSED_VAR # if defined(__cplusplus) template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } # else # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 typedef unsigned char uint8_t; typedef unsigned int uint32_t; #else typedef unsigned __int8 uint8_t; typedef unsigned __int32 uint32_t; #endif #endif #else #include #endif #ifndef CYTHON_FALLTHROUGH #if defined(__cplusplus) && __cplusplus >= 201103L #if __has_cpp_attribute(fallthrough) #define CYTHON_FALLTHROUGH [[fallthrough]] #elif __has_cpp_attribute(clang::fallthrough) #define CYTHON_FALLTHROUGH [[clang::fallthrough]] #elif __has_cpp_attribute(gnu::fallthrough) #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_attribute(fallthrough) #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) #else #define CYTHON_FALLTHROUGH #endif #endif #if defined(__clang__ ) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." #endif #ifndef CYTHON_INLINE #if defined(__clang__) #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) #else #define CYTHON_INLINE inline #endif #endif template void __Pyx_call_destructor(T& x) { x.~T(); } template class __Pyx_FakeReference { public: __Pyx_FakeReference() : ptr(NULL) { } __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } template bool operator ==(U other) { return *ptr == other; } template bool operator !=(U other) { return *ptr != other; } private: T *ptr; }; #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #if PY_VERSION_HEX < 0x030800A4 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif #ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif #ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 #endif typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 #define PyMem_RawMalloc(n) PyMem_Malloc(n) #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) #define PyMem_RawFree(p) PyMem_Free(p) #endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() #elif PY_VERSION_HEX >= 0x03000000 #define __Pyx_PyThreadState_Current PyThreadState_GET() #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 typedef int Py_tss_t; static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { *key = PyThread_create_key(); return 0; } static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); *key = Py_tss_NEEDS_INIT; return key; } static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { PyObject_Free(key); } static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { return *key != Py_tss_NEEDS_INIT; } static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { PyThread_delete_key(*key); *key = Py_tss_NEEDS_INIT; } static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { return PyThread_set_key_value(*key, value); } static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else #define __Pyx_PyDict_NewPresized(n) PyDict_New() #endif #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) #else #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 #define PyUnicode_2BYTE_KIND 2 #define PyUnicode_4BYTE_KIND 4 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) #define PyObject_ASCII(o) PyObject_Repr(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #define PyObject_Unicode PyObject_Str #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #else #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY #ifndef PyUnicode_InternFromString #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #else #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef __Pyx_PyAsyncMethodsStruct typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { \ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__kiva___cython_speedups #define __PYX_HAVE_API__kiva___cython_speedups /* Early includes */ #include #include #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "_hit_test.h" #include "pythread.h" #include #include "pystate.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #endif typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ (sizeof(type) < sizeof(Py_ssize_t)) ||\ (sizeof(type) > sizeof(Py_ssize_t) &&\ likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX) &&\ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ v == (type)PY_SSIZE_T_MIN))) ||\ (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { return (size_t) i < (size_t) limit; } #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } Py_DECREF(ascii_chars_u); Py_DECREF(ascii_chars_b); } Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); return -1; } #endif #endif /* Test for GCC > 2.95 */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } static PyObject *__pyx_m = NULL; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_cython_runtime = NULL; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; /* Header.proto */ #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "_cython_speedups.pyx", "__init__.pxd", "stringsource", "type.pxd", }; /* MemviewSliceStruct.proto */ struct __pyx_memoryview_obj; typedef struct { struct __pyx_memoryview_obj *memview; char *data; Py_ssize_t shape[8]; Py_ssize_t strides[8]; Py_ssize_t suboffsets[8]; } __Pyx_memviewslice; #define __Pyx_MemoryView_Len(m) (m.shape[0]) /* Atomics.proto */ #include #ifndef CYTHON_ATOMICS #define CYTHON_ATOMICS 1 #endif #define __pyx_atomic_int_type int #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\ !defined(__i386__) #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1) #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1) #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0 #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type LONG #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value) #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value) #ifdef __PYX_DEBUG_ATOMICS #pragma message ("Using MSVC atomics") #endif #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0 #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value) #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value) #ifdef __PYX_DEBUG_ATOMICS #warning "Using Intel atomics" #endif #else #undef CYTHON_ATOMICS #define CYTHON_ATOMICS 0 #ifdef __PYX_DEBUG_ATOMICS #warning "Not using atomics" #endif #endif typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #if CYTHON_ATOMICS #define __pyx_add_acquisition_count(memview)\ __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock) #define __pyx_sub_acquisition_count(memview)\ __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock) #else #define __pyx_add_acquisition_count(memview)\ __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #define __pyx_sub_acquisition_count(memview)\ __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #endif /* ForceInitThreads.proto */ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif /* NoFastGil.proto */ #define __Pyx_PyGILState_Ensure PyGILState_Ensure #define __Pyx_PyGILState_Release PyGILState_Release #define __Pyx_FastGIL_Remember() #define __Pyx_FastGIL_Forget() #define __Pyx_FastGilFuncInit() /* BufferFormatStructs.proto */ #define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { const char* name; struct __Pyx_StructField_* fields; size_t size; size_t arraysize[8]; int ndim; char typegroup; char is_unsigned; int flags; } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; size_t struct_alignment; int is_complex; char enc_type; char new_packmode; char enc_packmode; char is_valid_array; } __Pyx_BufFmt_Context; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* Declarations.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); /* Declarations.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); /*--- Type declarations ---*/ struct __pyx_array_obj; struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; /* "View.MemoryView":105 * * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * * cdef: */ struct __pyx_array_obj { PyObject_HEAD struct __pyx_vtabstruct_array *__pyx_vtab; char *data; Py_ssize_t len; char *format; int ndim; Py_ssize_t *_shape; Py_ssize_t *_strides; Py_ssize_t itemsize; PyObject *mode; PyObject *_format; void (*callback_free_data)(void *); int free_data; int dtype_is_object; }; /* "View.MemoryView":279 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< * cdef object name * def __init__(self, name): */ struct __pyx_MemviewEnum_obj { PyObject_HEAD PyObject *name; }; /* "View.MemoryView":330 * * @cname('__pyx_memoryview') * cdef class memoryview(object): # <<<<<<<<<<<<<< * * cdef object obj */ struct __pyx_memoryview_obj { PyObject_HEAD struct __pyx_vtabstruct_memoryview *__pyx_vtab; PyObject *obj; PyObject *_size; PyObject *_array_interface; PyThread_type_lock lock; __pyx_atomic_int acquisition_count[2]; __pyx_atomic_int *acquisition_count_aligned_p; Py_buffer view; int flags; int dtype_is_object; __Pyx_TypeInfo *typeinfo; }; /* "View.MemoryView":961 * * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" * */ struct __pyx_memoryviewslice_obj { struct __pyx_memoryview_obj __pyx_base; __Pyx_memviewslice from_slice; PyObject *from_object; PyObject *(*to_object_func)(char *); int (*to_dtype_func)(char *, PyObject *); }; /* "View.MemoryView":105 * * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * * cdef: */ struct __pyx_vtabstruct_array { PyObject *(*get_memview)(struct __pyx_array_obj *); }; static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; /* "View.MemoryView":330 * * @cname('__pyx_memoryview') * cdef class memoryview(object): # <<<<<<<<<<<<<< * * cdef object obj */ struct __pyx_vtabstruct_memoryview { char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); }; static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; /* "View.MemoryView":961 * * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" * */ struct __pyx_vtabstruct__memoryviewslice { struct __pyx_vtabstruct_memoryview __pyx_base; }; static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) #define __Pyx_DECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ (version_var) = __PYX_GET_DICT_VERSION(dict);\ (cache_var) = (value); #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ (VAR) = __pyx_dict_cached_value;\ } else {\ (VAR) = __pyx_dict_cached_value = (LOOKUP);\ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ }\ } static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else #define __PYX_GET_DICT_VERSION(dict) (0) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS #define __Pyx_GetModuleGlobalName(var, name) {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } #define __Pyx_GetModuleGlobalNameUncached(var, name) {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyIntCompare.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); /* PyCFunctionFastCall.proto */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); #else #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) #endif /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); #else #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) #endif /* PyObjectCall2Args.proto */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyIntCompare.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ __Pyx_GetItemInt_Generic(o, to_py_func(i)))) #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #define __Pyx_PyErr_Occurred() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #endif #else #define __Pyx_PyErr_Clear() PyErr_Clear() #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* BufferIndexError.proto */ static void __Pyx_RaiseBufferIndexError(int axis); /* MemviewSliceInit.proto */ #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d #define __Pyx_MEMVIEW_DIRECT 1 #define __Pyx_MEMVIEW_PTR 2 #define __Pyx_MEMVIEW_FULL 4 #define __Pyx_MEMVIEW_CONTIG 8 #define __Pyx_MEMVIEW_STRIDED 16 #define __Pyx_MEMVIEW_FOLLOW 32 #define __Pyx_IS_C_CONTIG 1 #define __Pyx_IS_F_CONTIG 2 static int __Pyx_init_memviewslice( struct __pyx_memoryview_obj *memview, int ndim, __Pyx_memviewslice *memviewslice, int memview_is_new_reference); static CYTHON_INLINE int __pyx_add_acquisition_count_locked( __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p) #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview)) #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__) static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name)\ (likely(PyDict_CheckExact(obj)) ?\ __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) #else #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); /* RaiseNeedMoreValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /* GetTopmostException.proto */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); #else #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif /* PyErrExceptionMatches.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); /* IncludeStringH.proto */ #include /* BytesEquals.proto */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /* UnicodeEquals.proto */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /* StrEquals.proto */ #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals #else #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif /* None.proto */ static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* UnaryNegOverflows.proto */ #define UNARY_NEG_WOULD_OVERFLOW(x)\ (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ /* GetAttr.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /* ObjectGetItem.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); #else #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif /* decode_c_string_utf16.proto */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = -1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } /* decode_c_string.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); /* GetAttr3.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); #endif /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); if (likely(L->allocated > len)) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); Py_SIZE(list) = len+1; return 0; } return PyList_Append(list, x); } #else #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); #else #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif /* ListExtend.proto */ static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { #if CYTHON_COMPILING_IN_CPYTHON PyObject* none = _PyList_Extend((PyListObject*)L, v); if (unlikely(!none)) return -1; Py_DECREF(none); return 0; #else return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); #endif } /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); Py_SIZE(list) = len+1; return 0; } return PyList_Append(list, x); } #else #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif /* None.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); /* None.proto */ static CYTHON_INLINE long __Pyx_div_long(long, long); /* WriteUnraisableException.proto */ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, int full_traceback, int nogil); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr #endif /* PyObject_GenericGetAttr.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif /* SetVTable.proto */ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); /* TypeImport.proto */ #ifndef __PYX_HAVE_RT_ImportType_proto #define __PYX_HAVE_RT_ImportType_proto enum __Pyx_ImportType_CheckSize { __Pyx_ImportType_CheckSize_Error = 0, __Pyx_ImportType_CheckSize_Warn = 1, __Pyx_ImportType_CheckSize_Ignore = 2 }; static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); #endif /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) #else static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif /* BufferStructDeclare.proto */ typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; typedef struct { size_t refcount; Py_buffer pybuffer; } __Pyx_Buffer; typedef struct { __Pyx_Buffer *rcbuffer; char *data; __Pyx_Buf_DimInfo diminfo[8]; } __Pyx_LocalBuf_ND; /* MemviewSliceIsContig.proto */ static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); /* OverlappingSlices.proto */ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, __Pyx_memviewslice *slice2, int ndim, size_t itemsize); /* Capsule.proto */ static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint8(npy_uint8 value); /* MemviewDtypeToObject.proto */ static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_uint8_t(const char *itemp); static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_uint8_t(const char *itemp, PyObject *obj); /* RealImag.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(__cplusplus) && CYTHON_CCOMPLEX\ && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif /* Arithmetic.proto */ #if CYTHON_CCOMPLEX #define __Pyx_c_eq_float(a, b) ((a)==(b)) #define __Pyx_c_sum_float(a, b) ((a)+(b)) #define __Pyx_c_diff_float(a, b) ((a)-(b)) #define __Pyx_c_prod_float(a, b) ((a)*(b)) #define __Pyx_c_quot_float(a, b) ((a)/(b)) #define __Pyx_c_neg_float(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero_float(z) ((z)==(float)0) #define __Pyx_c_conj_float(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs_float(z) (::std::abs(z)) #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero_float(z) ((z)==0) #define __Pyx_c_conj_float(z) (conjf(z)) #if 1 #define __Pyx_c_abs_float(z) (cabsf(z)) #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif /* Arithmetic.proto */ #if CYTHON_CCOMPLEX #define __Pyx_c_eq_double(a, b) ((a)==(b)) #define __Pyx_c_sum_double(a, b) ((a)+(b)) #define __Pyx_c_diff_double(a, b) ((a)-(b)) #define __Pyx_c_prod_double(a, b) ((a)*(b)) #define __Pyx_c_quot_double(a, b) ((a)/(b)) #define __Pyx_c_neg_double(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero_double(z) ((z)==(double)0) #define __Pyx_c_conj_double(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs_double(z) (::std::abs(z)) #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero_double(z) ((z)==0) #define __Pyx_c_conj_double(z) (conj(z)) #if 1 #define __Pyx_c_abs_double(z) (cabs(z)) #define __Pyx_c_pow_double(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value); /* MemviewSliceCopyTemplate.proto */ static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const char *mode, int ndim, size_t sizeof_dtype, int contig_flag, int dtype_is_object); /* CIntFromPy.proto */ static CYTHON_INLINE npy_uint8 __Pyx_PyInt_As_npy_uint8(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); /* IsLittleEndian.proto */ static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); /* BufferFormatCheck.proto */ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type); /* TypeInfoCompare.proto */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); /* MemviewSliceValidateAndInit.proto */ static int __Pyx_ValidateAndInit_memviewslice( int *axes_specs, int c_or_f_flag, int buf_flags, int ndim, __Pyx_TypeInfo *dtype, __Pyx_BufFmt_StackElem stack[], __Pyx_memviewslice *memviewslice, PyObject *original_obj); /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *, int writable_flag); /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_uint8_t(PyObject *, int writable_flag); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'cpython' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'cpython.mem' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'kiva._hit_test' */ /* Module declarations from 'kiva._cython_speedups' */ static PyTypeObject *__pyx_array_type = 0; static PyTypeObject *__pyx_MemviewEnum_type = 0; static PyTypeObject *__pyx_memoryview_type = 0; static PyTypeObject *__pyx_memoryviewslice_type = 0; static PyObject *generic = 0; static PyObject *strided = 0; static PyObject *indirect = 0; static PyObject *contiguous = 0; static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ static PyObject *_unellipsify(PyObject *, int); /*proto*/ static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/ static int __pyx_memoryview_err(PyObject *, char *); /*proto*/ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 }; #define __Pyx_MODULE_NAME "kiva._cython_speedups" extern int __pyx_module_is_main_kiva___cython_speedups; int __pyx_module_is_main_kiva___cython_speedups = 0; /* Implementation of 'kiva._cython_speedups' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_ImportError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; static const char __pyx_k_O[] = "O"; static const char __pyx_k_c[] = "c"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_np[] = "np"; static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_pts[] = "pts"; static const char __pyx_k_base[] = "base"; static const char __pyx_k_bool[] = "bool_"; static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_mode[] = "mode"; static const char __pyx_k_name[] = "name"; static const char __pyx_k_ndim[] = "ndim"; static const char __pyx_k_pack[] = "pack"; static const char __pyx_k_size[] = "size"; static const char __pyx_k_step[] = "step"; static const char __pyx_k_stop[] = "stop"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_ASCII[] = "ASCII"; static const char __pyx_k_class[] = "__class__"; static const char __pyx_k_dtype[] = "dtype"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_flags[] = "flags"; static const char __pyx_k_numpy[] = "numpy"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_shape[] = "shape"; static const char __pyx_k_start[] = "start"; static const char __pyx_k_uint8[] = "uint8"; static const char __pyx_k_zeros[] = "zeros"; static const char __pyx_k_astype[] = "astype"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_name_2[] = "__name__"; static const char __pyx_k_pickle[] = "pickle"; static const char __pyx_k_reduce[] = "__reduce__"; static const char __pyx_k_struct[] = "struct"; static const char __pyx_k_unpack[] = "unpack"; static const char __pyx_k_update[] = "update"; static const char __pyx_k_asarray[] = "asarray"; static const char __pyx_k_float64[] = "float64"; static const char __pyx_k_fortran[] = "fortran"; static const char __pyx_k_memview[] = "memview"; static const char __pyx_k_reshape[] = "reshape"; static const char __pyx_k_results[] = "results"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_itemsize[] = "itemsize"; static const char __pyx_k_poly_pts[] = "poly_pts"; static const char __pyx_k_pts_view[] = "pts_view"; static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_transpose[] = "transpose"; static const char __pyx_k_IndexError[] = "IndexError"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_pyx_result[] = "__pyx_result"; static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_PickleError[] = "PickleError"; static const char __pyx_k_use_winding[] = "use_winding"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_poly_pts_view[] = "poly_pts_view"; static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_ascontiguousarray[] = "ascontiguousarray"; static const char __pyx_k_points_in_polygon[] = "points_in_polygon"; static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_cython_speedups_pyx[] = "_cython_speedups.pyx"; static const char __pyx_k_strided_and_indirect[] = ""; static const char __pyx_k_contiguous_and_direct[] = ""; static const char __pyx_k_kiva__cython_speedups[] = "kiva._cython_speedups"; static const char __pyx_k_MemoryView_of_r_object[] = ""; static const char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; static const char __pyx_k_contiguous_and_indirect[] = ""; static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; static const char __pyx_k_points_in_polygon_line_6[] = "points_in_polygon (line 6)"; static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; static const char __pyx_k_strided_and_direct_or_indirect[] = ""; static const char __pyx_k_Test_whether_point_pairs_in_pts[] = "Test whether point pairs in pts are within the polygon, poly_pts.\n\n Parameters\n ----------\n pts\n an Nx2 array of x,y point pairs (floating point). Each point is tested\n to determine whether it falls within the polygon defined by `poly_pts`.\n poly_pts\n an Mx2 array of x,y point pairs (floating point) that define the\n boundaries of a polygon. The last point is considered to be connected\n to the first point.\n return\n a 1D array of integers. 1 is returned if the corresponding x,y pair\n in `pts` falls within `poly_pts`. 0 is returned otherwise.\n\n This algorithm works for complex polygons.\n\n Note: If the test point is on the border of the polygon, this\n algorithm will deliver unpredictable results; i.e. the result\n may be \"inside\" or \"outside\" depending on arbitrary factors\n such as how the polygon is oriented with respect to the\n coordinate system.\n\n Adapted from: http://www.alienryderflex.com/polygon/\n\n Example::\n\n >>> import numpy as np\n >>> from enable import points_in_polygon\n >>> poly = np.array(((0.0, 0.0),\n (10.0, 0.0),\n (10.0, 10.0),\n (0.0, 10.0)))\n >>> pts = np.array(((-1.0, -1.0),\n (5.0, 5.0),\n (15.0, 15.0)))\n >>> results = points_in_polygon(pts, poly)\n [0 1 0]\n\n "; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; static const char __pyx_k_pts_must_be_an_Nx2_or_2xN_array[] = "pts must be an Nx2 or 2xN array"; static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview"; static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_poly_pts_must_be_an_Nx2_or_2xN_a[] = "poly_pts must be an Nx2 or 2xN array"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; static PyObject *__pyx_n_s_ASCII; static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; static PyObject *__pyx_kp_s_Cannot_index_with_type_s; static PyObject *__pyx_n_s_Ellipsis; static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; static PyObject *__pyx_n_s_ImportError; static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0; static PyObject *__pyx_n_s_IndexError; static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d; static PyObject *__pyx_n_s_MemoryError; static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; static PyObject *__pyx_kp_s_MemoryView_of_r_object; static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; static PyObject *__pyx_n_b_O; static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; static PyObject *__pyx_n_s_PickleError; static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_kp_u_Test_whether_point_pairs_in_pts; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; static PyObject *__pyx_n_s_ValueError; static PyObject *__pyx_n_s_View_MemoryView; static PyObject *__pyx_n_s_allocate_buffer; static PyObject *__pyx_n_s_asarray; static PyObject *__pyx_n_s_ascontiguousarray; static PyObject *__pyx_n_s_astype; static PyObject *__pyx_n_s_base; static PyObject *__pyx_n_s_bool; static PyObject *__pyx_n_s_c; static PyObject *__pyx_n_u_c; static PyObject *__pyx_n_s_class; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_kp_s_contiguous_and_direct; static PyObject *__pyx_kp_s_contiguous_and_indirect; static PyObject *__pyx_kp_s_cython_speedups_pyx; static PyObject *__pyx_n_s_dict; static PyObject *__pyx_n_s_dtype; static PyObject *__pyx_n_s_dtype_is_object; static PyObject *__pyx_n_s_encode; static PyObject *__pyx_n_s_enumerate; static PyObject *__pyx_n_s_error; static PyObject *__pyx_n_s_flags; static PyObject *__pyx_n_s_float64; static PyObject *__pyx_n_s_format; static PyObject *__pyx_n_s_fortran; static PyObject *__pyx_n_u_fortran; static PyObject *__pyx_n_s_getstate; static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi; static PyObject *__pyx_n_s_id; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_itemsize; static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; static PyObject *__pyx_n_s_kiva__cython_speedups; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_memview; static PyObject *__pyx_n_s_mode; static PyObject *__pyx_n_s_name; static PyObject *__pyx_n_s_name_2; static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; static PyObject *__pyx_n_s_ndim; static PyObject *__pyx_n_s_new; static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; static PyObject *__pyx_n_s_np; static PyObject *__pyx_n_s_numpy; static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; static PyObject *__pyx_n_s_obj; static PyObject *__pyx_n_s_pack; static PyObject *__pyx_n_s_pickle; static PyObject *__pyx_n_s_points_in_polygon; static PyObject *__pyx_kp_u_points_in_polygon_line_6; static PyObject *__pyx_n_s_poly_pts; static PyObject *__pyx_kp_s_poly_pts_must_be_an_Nx2_or_2xN_a; static PyObject *__pyx_n_s_poly_pts_view; static PyObject *__pyx_n_s_pts; static PyObject *__pyx_kp_s_pts_must_be_an_Nx2_or_2xN_array; static PyObject *__pyx_n_s_pts_view; static PyObject *__pyx_n_s_pyx_PickleError; static PyObject *__pyx_n_s_pyx_checksum; static PyObject *__pyx_n_s_pyx_getbuffer; static PyObject *__pyx_n_s_pyx_result; static PyObject *__pyx_n_s_pyx_state; static PyObject *__pyx_n_s_pyx_type; static PyObject *__pyx_n_s_pyx_unpickle_Enum; static PyObject *__pyx_n_s_pyx_vtable; static PyObject *__pyx_n_s_range; static PyObject *__pyx_n_s_reduce; static PyObject *__pyx_n_s_reduce_cython; static PyObject *__pyx_n_s_reduce_ex; static PyObject *__pyx_n_s_reshape; static PyObject *__pyx_n_s_results; static PyObject *__pyx_n_s_setstate; static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_n_s_shape; static PyObject *__pyx_n_s_size; static PyObject *__pyx_n_s_start; static PyObject *__pyx_n_s_step; static PyObject *__pyx_n_s_stop; static PyObject *__pyx_kp_s_strided_and_direct; static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; static PyObject *__pyx_kp_s_strided_and_indirect; static PyObject *__pyx_kp_s_stringsource; static PyObject *__pyx_n_s_struct; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_transpose; static PyObject *__pyx_n_s_uint8; static PyObject *__pyx_kp_s_unable_to_allocate_array_data; static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; static PyObject *__pyx_n_s_unpack; static PyObject *__pyx_n_s_update; static PyObject *__pyx_n_s_use_winding; static PyObject *__pyx_n_s_zeros; static PyObject *__pyx_pf_4kiva_16_cython_speedups_points_in_polygon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pts, PyObject *__pyx_v_poly_pts, PyObject *__pyx_v_use_winding); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; static PyObject *__pyx_int_184977713; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; static PyObject *__pyx_tuple__5; static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; static PyObject *__pyx_slice__26; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; static PyObject *__pyx_tuple__13; static PyObject *__pyx_tuple__14; static PyObject *__pyx_tuple__15; static PyObject *__pyx_tuple__16; static PyObject *__pyx_tuple__17; static PyObject *__pyx_tuple__18; static PyObject *__pyx_tuple__19; static PyObject *__pyx_tuple__20; static PyObject *__pyx_tuple__21; static PyObject *__pyx_tuple__22; static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__24; static PyObject *__pyx_tuple__25; static PyObject *__pyx_tuple__27; static PyObject *__pyx_tuple__28; static PyObject *__pyx_tuple__29; static PyObject *__pyx_tuple__30; static PyObject *__pyx_tuple__32; static PyObject *__pyx_tuple__33; static PyObject *__pyx_tuple__34; static PyObject *__pyx_tuple__35; static PyObject *__pyx_tuple__36; static PyObject *__pyx_tuple__37; static PyObject *__pyx_codeobj__31; static PyObject *__pyx_codeobj__38; /* Late includes */ /* "kiva/_cython_speedups.pyx":6 * * * def points_in_polygon(pts, poly_pts, use_winding=False): # <<<<<<<<<<<<<< * """Test whether point pairs in pts are within the polygon, poly_pts. * */ /* Python wrapper */ static PyObject *__pyx_pw_4kiva_16_cython_speedups_1points_in_polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4kiva_16_cython_speedups_points_in_polygon[] = "Test whether point pairs in pts are within the polygon, poly_pts.\n\n Parameters\n ----------\n pts\n an Nx2 array of x,y point pairs (floating point). Each point is tested\n to determine whether it falls within the polygon defined by `poly_pts`.\n poly_pts\n an Mx2 array of x,y point pairs (floating point) that define the\n boundaries of a polygon. The last point is considered to be connected\n to the first point.\n return\n a 1D array of integers. 1 is returned if the corresponding x,y pair\n in `pts` falls within `poly_pts`. 0 is returned otherwise.\n\n This algorithm works for complex polygons.\n\n Note: If the test point is on the border of the polygon, this\n algorithm will deliver unpredictable results; i.e. the result\n may be \"inside\" or \"outside\" depending on arbitrary factors\n such as how the polygon is oriented with respect to the\n coordinate system.\n\n Adapted from: http://www.alienryderflex.com/polygon/\n\n Example::\n\n >>> import numpy as np\n >>> from enable import points_in_polygon\n >>> poly = np.array(((0.0, 0.0),\n (10.0, 0.0),\n (10.0, 10.0),\n (0.0, 10.0)))\n >>> pts = np.array(((-1.0, -1.0),\n (5.0, 5.0),\n (15.0, 15.0)))\n >>> results = points_in_polygon(pts, poly)\n [0 1 0]\n\n "; static PyMethodDef __pyx_mdef_4kiva_16_cython_speedups_1points_in_polygon = {"points_in_polygon", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4kiva_16_cython_speedups_1points_in_polygon, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4kiva_16_cython_speedups_points_in_polygon}; static PyObject *__pyx_pw_4kiva_16_cython_speedups_1points_in_polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_pts = 0; PyObject *__pyx_v_poly_pts = 0; PyObject *__pyx_v_use_winding = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("points_in_polygon (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pts,&__pyx_n_s_poly_pts,&__pyx_n_s_use_winding,0}; PyObject* values[3] = {0,0,0}; values[2] = ((PyObject *)Py_False); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pts)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_poly_pts)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("points_in_polygon", 0, 2, 3, 1); __PYX_ERR(0, 6, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_winding); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "points_in_polygon") < 0)) __PYX_ERR(0, 6, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_pts = values[0]; __pyx_v_poly_pts = values[1]; __pyx_v_use_winding = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("points_in_polygon", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 6, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("kiva._cython_speedups.points_in_polygon", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4kiva_16_cython_speedups_points_in_polygon(__pyx_self, __pyx_v_pts, __pyx_v_poly_pts, __pyx_v_use_winding); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4kiva_16_cython_speedups_points_in_polygon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pts, PyObject *__pyx_v_poly_pts, PyObject *__pyx_v_use_winding) { __Pyx_memviewslice __pyx_v_pts_view = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_poly_pts_view = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; Py_ssize_t __pyx_t_8; __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; Py_ssize_t __pyx_t_11; Py_ssize_t __pyx_t_12; Py_ssize_t __pyx_t_13; Py_ssize_t __pyx_t_14; Py_ssize_t __pyx_t_15; Py_ssize_t __pyx_t_16; Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; Py_ssize_t __pyx_t_19; Py_ssize_t __pyx_t_20; __Pyx_RefNannySetupContext("points_in_polygon", 0); __Pyx_INCREF(__pyx_v_pts); __Pyx_INCREF(__pyx_v_poly_pts); /* "kiva/_cython_speedups.pyx":49 * * # Check the shape of pts and transpose if necessary. * pts = np.asarray(pts, dtype=np.float64) # <<<<<<<<<<<<<< * if pts.size == 0: * # Quick exit for empty pts array */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_pts); __Pyx_GIVEREF(__pyx_v_pts); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pts); __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_5); __pyx_t_5 = 0; /* "kiva/_cython_speedups.pyx":50 * # Check the shape of pts and transpose if necessary. * pts = np.asarray(pts, dtype=np.float64) * if pts.size == 0: # <<<<<<<<<<<<<< * # Quick exit for empty pts array * return np.zeros(0, dtype=np.uint8) */ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pts, __pyx_n_s_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { /* "kiva/_cython_speedups.pyx":52 * if pts.size == 0: * # Quick exit for empty pts array * return np.zeros(0, dtype=np.uint8) # <<<<<<<<<<<<<< * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple_, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "kiva/_cython_speedups.pyx":50 * # Check the shape of pts and transpose if necessary. * pts = np.asarray(pts, dtype=np.float64) * if pts.size == 0: # <<<<<<<<<<<<<< * # Quick exit for empty pts array * return np.zeros(0, dtype=np.uint8) */ } /* "kiva/_cython_speedups.pyx":53 * # Quick exit for empty pts array * return np.zeros(0, dtype=np.uint8) * if pts.ndim == 1: # <<<<<<<<<<<<<< * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pts, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { /* "kiva/_cython_speedups.pyx":54 * return np.zeros(0, dtype=np.uint8) * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) # <<<<<<<<<<<<<< * if np.shape(pts)[1] != 2: * if np.shape(pts)[0] == 2: */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_reshape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_v_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_pts); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Add(__pyx_tuple__2, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_pts, __pyx_t_4}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_pts, __pyx_t_4}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_1 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL; } __Pyx_INCREF(__pyx_v_pts); __Pyx_GIVEREF(__pyx_v_pts); PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_7, __pyx_v_pts); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_7, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_3); __pyx_t_3 = 0; /* "kiva/_cython_speedups.pyx":53 * # Quick exit for empty pts array * return np.zeros(0, dtype=np.uint8) * if pts.ndim == 1: # <<<<<<<<<<<<<< * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: */ } /* "kiva/_cython_speedups.pyx":55 * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: # <<<<<<<<<<<<<< * if np.shape(pts)[0] == 2: * pts = np.ascontiguousarray(np.transpose(pts)) */ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_pts); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_NeObjC(__pyx_t_1, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { /* "kiva/_cython_speedups.pyx":56 * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: * if np.shape(pts)[0] == 2: # <<<<<<<<<<<<<< * pts = np.ascontiguousarray(np.transpose(pts)) * else: */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_pts); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_6)) { /* "kiva/_cython_speedups.pyx":57 * if np.shape(pts)[1] != 2: * if np.shape(pts)[0] == 2: * pts = np.ascontiguousarray(np.transpose(pts)) # <<<<<<<<<<<<<< * else: * raise ValueError('pts must be an Nx2 or 2xN array') */ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_transpose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_pts); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_3); __pyx_t_3 = 0; /* "kiva/_cython_speedups.pyx":56 * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: * if np.shape(pts)[0] == 2: # <<<<<<<<<<<<<< * pts = np.ascontiguousarray(np.transpose(pts)) * else: */ goto __pyx_L6; } /* "kiva/_cython_speedups.pyx":59 * pts = np.ascontiguousarray(np.transpose(pts)) * else: * raise ValueError('pts must be an Nx2 or 2xN array') # <<<<<<<<<<<<<< * * # Check the shape of poly_pts and transpose if necessary */ /*else*/ { __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 59, __pyx_L1_error) } __pyx_L6:; /* "kiva/_cython_speedups.pyx":55 * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: # <<<<<<<<<<<<<< * if np.shape(pts)[0] == 2: * pts = np.ascontiguousarray(np.transpose(pts)) */ } /* "kiva/_cython_speedups.pyx":62 * * # Check the shape of poly_pts and transpose if necessary * poly_pts = np.asarray(poly_pts, dtype=np.float64) # <<<<<<<<<<<<<< * if poly_pts.size == 0: * # Quick exit for empty poly array */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_poly_pts); __Pyx_GIVEREF(__pyx_v_poly_pts); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_poly_pts); __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_poly_pts, __pyx_t_4); __pyx_t_4 = 0; /* "kiva/_cython_speedups.pyx":63 * # Check the shape of poly_pts and transpose if necessary * poly_pts = np.asarray(poly_pts, dtype=np.float64) * if poly_pts.size == 0: # <<<<<<<<<<<<<< * # Quick exit for empty poly array * return np.zeros(len(pts), dtype=np.uint8) */ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_poly_pts, __pyx_n_s_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_4, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { /* "kiva/_cython_speedups.pyx":65 * if poly_pts.size == 0: * # Quick exit for empty poly array * return np.zeros(len(pts), dtype=np.uint8) # <<<<<<<<<<<<<< * if poly_pts.ndim == 1: * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_8 = PyObject_Length(__pyx_v_pts); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 65, __pyx_L1_error) __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "kiva/_cython_speedups.pyx":63 * # Check the shape of poly_pts and transpose if necessary * poly_pts = np.asarray(poly_pts, dtype=np.float64) * if poly_pts.size == 0: # <<<<<<<<<<<<<< * # Quick exit for empty poly array * return np.zeros(len(pts), dtype=np.uint8) */ } /* "kiva/_cython_speedups.pyx":66 * # Quick exit for empty poly array * return np.zeros(len(pts), dtype=np.uint8) * if poly_pts.ndim == 1: # <<<<<<<<<<<<<< * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_poly_pts, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { /* "kiva/_cython_speedups.pyx":67 * return np.zeros(len(pts), dtype=np.uint8) * if poly_pts.ndim == 1: * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) # <<<<<<<<<<<<<< * if np.shape(poly_pts)[1] != 2: * if np.shape(poly_pts)[0] == 2: */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_poly_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_poly_pts); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Add(__pyx_tuple__2, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_poly_pts, __pyx_t_1}; __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_poly_pts, __pyx_t_1}; __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; } __Pyx_INCREF(__pyx_v_poly_pts); __Pyx_GIVEREF(__pyx_v_poly_pts); PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_v_poly_pts); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_poly_pts, __pyx_t_5); __pyx_t_5 = 0; /* "kiva/_cython_speedups.pyx":66 * # Quick exit for empty poly array * return np.zeros(len(pts), dtype=np.uint8) * if poly_pts.ndim == 1: # <<<<<<<<<<<<<< * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: */ } /* "kiva/_cython_speedups.pyx":68 * if poly_pts.ndim == 1: * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: # <<<<<<<<<<<<<< * if np.shape(poly_pts)[0] == 2: * poly_pts = np.ascontiguousarray(np.transpose(poly_pts)) */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_poly_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_poly_pts); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyInt_NeObjC(__pyx_t_4, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { /* "kiva/_cython_speedups.pyx":69 * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: * if np.shape(poly_pts)[0] == 2: # <<<<<<<<<<<<<< * poly_pts = np.ascontiguousarray(np.transpose(poly_pts)) * else: */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_poly_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_poly_pts); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_3, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (likely(__pyx_t_6)) { /* "kiva/_cython_speedups.pyx":70 * if np.shape(poly_pts)[1] != 2: * if np.shape(poly_pts)[0] == 2: * poly_pts = np.ascontiguousarray(np.transpose(poly_pts)) # <<<<<<<<<<<<<< * else: * raise ValueError('poly_pts must be an Nx2 or 2xN array') */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_transpose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_v_poly_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_poly_pts); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_poly_pts, __pyx_t_5); __pyx_t_5 = 0; /* "kiva/_cython_speedups.pyx":69 * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: * if np.shape(poly_pts)[0] == 2: # <<<<<<<<<<<<<< * poly_pts = np.ascontiguousarray(np.transpose(poly_pts)) * else: */ goto __pyx_L10; } /* "kiva/_cython_speedups.pyx":72 * poly_pts = np.ascontiguousarray(np.transpose(poly_pts)) * else: * raise ValueError('poly_pts must be an Nx2 or 2xN array') # <<<<<<<<<<<<<< * * cdef double[:, ::1] pts_view = np.ascontiguousarray(pts) */ /*else*/ { __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 72, __pyx_L1_error) } __pyx_L10:; /* "kiva/_cython_speedups.pyx":68 * if poly_pts.ndim == 1: * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: # <<<<<<<<<<<<<< * if np.shape(poly_pts)[0] == 2: * poly_pts = np.ascontiguousarray(np.transpose(poly_pts)) */ } /* "kiva/_cython_speedups.pyx":74 * raise ValueError('poly_pts must be an Nx2 or 2xN array') * * cdef double[:, ::1] pts_view = np.ascontiguousarray(pts) # <<<<<<<<<<<<<< * cdef double[:, ::1] poly_pts_view = np.ascontiguousarray(poly_pts) * cdef uint8_t[::1] results = np.zeros(len(pts), dtype=np.uint8) */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_pts); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_pts_view = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL; /* "kiva/_cython_speedups.pyx":75 * * cdef double[:, ::1] pts_view = np.ascontiguousarray(pts) * cdef double[:, ::1] poly_pts_view = np.ascontiguousarray(poly_pts) # <<<<<<<<<<<<<< * cdef uint8_t[::1] results = np.zeros(len(pts), dtype=np.uint8) * */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_poly_pts) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_poly_pts); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_poly_pts_view = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL; /* "kiva/_cython_speedups.pyx":76 * cdef double[:, ::1] pts_view = np.ascontiguousarray(pts) * cdef double[:, ::1] poly_pts_view = np.ascontiguousarray(poly_pts) * cdef uint8_t[::1] results = np.zeros(len(pts), dtype=np.uint8) # <<<<<<<<<<<<<< * * if use_winding: */ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_8 = PyObject_Length(__pyx_v_pts); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 76, __pyx_L1_error) __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_uint8_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_results = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; /* "kiva/_cython_speedups.pyx":78 * cdef uint8_t[::1] results = np.zeros(len(pts), dtype=np.uint8) * * if use_winding: # <<<<<<<<<<<<<< * _hit_test.points_in_polygon_winding(&pts_view[0][0], pts_view.shape[0], * &poly_pts_view[0][0], */ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_use_winding); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 78, __pyx_L1_error) if (__pyx_t_6) { /* "kiva/_cython_speedups.pyx":79 * * if use_winding: * _hit_test.points_in_polygon_winding(&pts_view[0][0], pts_view.shape[0], # <<<<<<<<<<<<<< * &poly_pts_view[0][0], * poly_pts_view.shape[0], */ __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_7 = -1; if (__pyx_t_11 < 0) { __pyx_t_11 += __pyx_v_pts_view.shape[0]; if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 0; } else if (unlikely(__pyx_t_11 >= __pyx_v_pts_view.shape[0])) __pyx_t_7 = 0; if (__pyx_t_12 < 0) { __pyx_t_12 += __pyx_v_pts_view.shape[1]; if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 1; } else if (unlikely(__pyx_t_12 >= __pyx_v_pts_view.shape[1])) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); __PYX_ERR(0, 79, __pyx_L1_error) } /* "kiva/_cython_speedups.pyx":80 * if use_winding: * _hit_test.points_in_polygon_winding(&pts_view[0][0], pts_view.shape[0], * &poly_pts_view[0][0], # <<<<<<<<<<<<<< * poly_pts_view.shape[0], * &results[0], results.shape[0]) */ __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_7 = -1; if (__pyx_t_13 < 0) { __pyx_t_13 += __pyx_v_poly_pts_view.shape[0]; if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 0; } else if (unlikely(__pyx_t_13 >= __pyx_v_poly_pts_view.shape[0])) __pyx_t_7 = 0; if (__pyx_t_14 < 0) { __pyx_t_14 += __pyx_v_poly_pts_view.shape[1]; if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 1; } else if (unlikely(__pyx_t_14 >= __pyx_v_poly_pts_view.shape[1])) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); __PYX_ERR(0, 80, __pyx_L1_error) } /* "kiva/_cython_speedups.pyx":82 * &poly_pts_view[0][0], * poly_pts_view.shape[0], * &results[0], results.shape[0]) # <<<<<<<<<<<<<< * else: * _hit_test.points_in_polygon(&pts_view[0][0], pts_view.shape[0], */ __pyx_t_15 = 0; __pyx_t_7 = -1; if (__pyx_t_15 < 0) { __pyx_t_15 += __pyx_v_results.shape[0]; if (unlikely(__pyx_t_15 < 0)) __pyx_t_7 = 0; } else if (unlikely(__pyx_t_15 >= __pyx_v_results.shape[0])) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); __PYX_ERR(0, 82, __pyx_L1_error) } /* "kiva/_cython_speedups.pyx":79 * * if use_winding: * _hit_test.points_in_polygon_winding(&pts_view[0][0], pts_view.shape[0], # <<<<<<<<<<<<<< * &poly_pts_view[0][0], * poly_pts_view.shape[0], */ kiva::points_in_polygon_winding((&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_pts_view.data + __pyx_t_11 * __pyx_v_pts_view.strides[0]) )) + __pyx_t_12)) )))), (__pyx_v_pts_view.shape[0]), (&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_poly_pts_view.data + __pyx_t_13 * __pyx_v_poly_pts_view.strides[0]) )) + __pyx_t_14)) )))), (__pyx_v_poly_pts_view.shape[0]), (&(*((__pyx_t_5numpy_uint8_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_uint8_t *) __pyx_v_results.data) + __pyx_t_15)) )))), (__pyx_v_results.shape[0])); /* "kiva/_cython_speedups.pyx":78 * cdef uint8_t[::1] results = np.zeros(len(pts), dtype=np.uint8) * * if use_winding: # <<<<<<<<<<<<<< * _hit_test.points_in_polygon_winding(&pts_view[0][0], pts_view.shape[0], * &poly_pts_view[0][0], */ goto __pyx_L11; } /* "kiva/_cython_speedups.pyx":84 * &results[0], results.shape[0]) * else: * _hit_test.points_in_polygon(&pts_view[0][0], pts_view.shape[0], # <<<<<<<<<<<<<< * &poly_pts_view[0][0], * poly_pts_view.shape[0], */ /*else*/ { __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_7 = -1; if (__pyx_t_16 < 0) { __pyx_t_16 += __pyx_v_pts_view.shape[0]; if (unlikely(__pyx_t_16 < 0)) __pyx_t_7 = 0; } else if (unlikely(__pyx_t_16 >= __pyx_v_pts_view.shape[0])) __pyx_t_7 = 0; if (__pyx_t_17 < 0) { __pyx_t_17 += __pyx_v_pts_view.shape[1]; if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 1; } else if (unlikely(__pyx_t_17 >= __pyx_v_pts_view.shape[1])) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); __PYX_ERR(0, 84, __pyx_L1_error) } /* "kiva/_cython_speedups.pyx":85 * else: * _hit_test.points_in_polygon(&pts_view[0][0], pts_view.shape[0], * &poly_pts_view[0][0], # <<<<<<<<<<<<<< * poly_pts_view.shape[0], * &results[0], results.shape[0]) */ __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_7 = -1; if (__pyx_t_18 < 0) { __pyx_t_18 += __pyx_v_poly_pts_view.shape[0]; if (unlikely(__pyx_t_18 < 0)) __pyx_t_7 = 0; } else if (unlikely(__pyx_t_18 >= __pyx_v_poly_pts_view.shape[0])) __pyx_t_7 = 0; if (__pyx_t_19 < 0) { __pyx_t_19 += __pyx_v_poly_pts_view.shape[1]; if (unlikely(__pyx_t_19 < 0)) __pyx_t_7 = 1; } else if (unlikely(__pyx_t_19 >= __pyx_v_poly_pts_view.shape[1])) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); __PYX_ERR(0, 85, __pyx_L1_error) } /* "kiva/_cython_speedups.pyx":87 * &poly_pts_view[0][0], * poly_pts_view.shape[0], * &results[0], results.shape[0]) # <<<<<<<<<<<<<< * * return results.base.astype(np.bool_) */ __pyx_t_20 = 0; __pyx_t_7 = -1; if (__pyx_t_20 < 0) { __pyx_t_20 += __pyx_v_results.shape[0]; if (unlikely(__pyx_t_20 < 0)) __pyx_t_7 = 0; } else if (unlikely(__pyx_t_20 >= __pyx_v_results.shape[0])) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); __PYX_ERR(0, 87, __pyx_L1_error) } /* "kiva/_cython_speedups.pyx":84 * &results[0], results.shape[0]) * else: * _hit_test.points_in_polygon(&pts_view[0][0], pts_view.shape[0], # <<<<<<<<<<<<<< * &poly_pts_view[0][0], * poly_pts_view.shape[0], */ kiva::points_in_polygon((&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_pts_view.data + __pyx_t_16 * __pyx_v_pts_view.strides[0]) )) + __pyx_t_17)) )))), (__pyx_v_pts_view.shape[0]), (&(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_poly_pts_view.data + __pyx_t_18 * __pyx_v_poly_pts_view.strides[0]) )) + __pyx_t_19)) )))), (__pyx_v_poly_pts_view.shape[0]), (&(*((__pyx_t_5numpy_uint8_t *) ( /* dim=0 */ ((char *) (((__pyx_t_5numpy_uint8_t *) __pyx_v_results.data) + __pyx_t_20)) )))), (__pyx_v_results.shape[0])); } __pyx_L11:; /* "kiva/_cython_speedups.pyx":89 * &results[0], results.shape[0]) * * return results.base.astype(np.bool_) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_results, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_uint8_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_uint8_t, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_bool); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "kiva/_cython_speedups.pyx":6 * * * def points_in_polygon(pts, poly_pts, use_winding=False): # <<<<<<<<<<<<<< * """Test whether point pairs in pts are within the polygon, poly_pts. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); __Pyx_AddTraceback("kiva._cython_speedups.points_in_polygon", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_pts_view, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_poly_pts_view, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); __Pyx_XDECREF(__pyx_v_pts); __Pyx_XDECREF(__pyx_v_poly_pts); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fulfill the PEP. */ /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyArray_Descr *__pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; } __Pyx_RefNannySetupContext("__getbuffer__", 0); __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265 * * cdef int i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266 * cdef int i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270 * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270 * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ if (unlikely(__pyx_t_1)) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 272, __pyx_L1_error) /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270 * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L7_bool_binop_done; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L7_bool_binop_done:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ if (unlikely(__pyx_t_1)) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 276, __pyx_L1_error) /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim)))); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284 * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285 * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_4 = __pyx_v_ndim; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ goto __pyx_L9; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ /*else*/ { __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L9:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = PyArray_DESCR(self) * cdef int offset */ __pyx_v_f = NULL; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297 * cdef int t * cdef char* f = NULL * cdef dtype descr = PyArray_DESCR(self) # <<<<<<<<<<<<<< * cdef int offset * */ __pyx_t_7 = PyArray_DESCR(__pyx_v_self); __pyx_t_3 = ((PyObject *)__pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300 * cdef int offset * * info.obj = self # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(descr): */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302 * info.obj = self * * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0); if (__pyx_t_1) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303 * * if not PyDataType_HASFIELDS(descr): * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_4 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_4; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304 * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0); if (!__pyx_t_2) { goto __pyx_L15_next_or; } else { } __pyx_t_2 = (__pyx_v_little_endian != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L14_bool_binop_done; } __pyx_L15_next_or:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L14_bool_binop_done; } __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L14_bool_binop_done:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304 * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ if (unlikely(__pyx_t_1)) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 306, __pyx_L1_error) /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304 * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ switch (__pyx_v_t) { case NPY_BYTE: __pyx_v_f = ((char *)"b"); break; case NPY_UBYTE: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_v_f = ((char *)"B"); break; case NPY_SHORT: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_v_f = ((char *)"h"); break; case NPY_USHORT: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_v_f = ((char *)"H"); break; case NPY_INT: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_v_f = ((char *)"i"); break; case NPY_UINT: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_v_f = ((char *)"I"); break; case NPY_LONG: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_v_f = ((char *)"l"); break; case NPY_ULONG: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_v_f = ((char *)"L"); break; case NPY_LONGLONG: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_v_f = ((char *)"q"); break; case NPY_ULONGLONG: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_v_f = ((char *)"Q"); break; case NPY_FLOAT: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_v_f = ((char *)"f"); break; case NPY_DOUBLE: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_v_f = ((char *)"d"); break; case NPY_LONGDOUBLE: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_v_f = ((char *)"g"); break; case NPY_CFLOAT: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_v_f = ((char *)"Zf"); break; case NPY_CDOUBLE: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_v_f = ((char *)"Zd"); break; case NPY_CLONGDOUBLE: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_v_f = ((char *)"Zg"); break; case NPY_OBJECT: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_v_f = ((char *)"O"); break; default: /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 325, __pyx_L1_error) break; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = PyObject_Malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302 * info.obj = self * * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329 * return * else: * info.format = PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ /*else*/ { __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF)); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330 * else: * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331 * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332 * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< * info.format + _buffer_format_string_len, * &offset) */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error) __pyx_v_f = __pyx_t_9; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fulfill the PEP. */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info->obj == Py_None) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) */ /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * PyObject_Free(info.strides) */ PyObject_Free(__pyx_v_info->format); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340 * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * PyObject_Free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341 * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * PyObject_Free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ PyObject_Free(__pyx_v_info->strides); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340 * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * PyObject_Free(info.strides) * # info.shape was stored after info.strides in the same block */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline tuple PyDataType_SHAPE(dtype d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< * if PyDataType_HASSUBARRAY(d): * return d.subarray.shape */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< * return d.subarray.shape * else: */ __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); if (__pyx_t_1) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838 * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): * return d.subarray.shape # <<<<<<<<<<<<<< * else: * return () */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< * return d.subarray.shape * else: */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840 * return d.subarray.shape * else: * return () # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ /*else*/ { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_empty_tuple); __pyx_r = __pyx_empty_tuple; goto __pyx_L0; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< * if PyDataType_HASSUBARRAY(d): * return d.subarray.shape */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842 * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; long __pyx_t_8; char *__pyx_t_9; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847 * * cdef dtype child * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848 * cdef dtype child * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(__pyx_v_descr->names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(1, 851, __pyx_L1_error) } __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ if (unlikely(__pyx_v_descr->fields == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 852, __pyx_L1_error) } __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(__pyx_v_fields != Py_None)) { PyObject* sequence = __pyx_v_fields; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(1, 853, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error) } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); if (unlikely(__pyx_t_6)) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 856, __pyx_L1_error) /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (!__pyx_t_7) { goto __pyx_L8_next_or; } else { } __pyx_t_7 = (__pyx_v_little_endian != 0); if (!__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_L8_next_or:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_6 = __pyx_t_7; __pyx_L7_bool_binop_done:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ if (unlikely(__pyx_t_6)) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 860, __pyx_L1_error) /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) break; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 0x78; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_8 = 0; (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_8 = 0; (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_6) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); __pyx_t_4 = 0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (unlikely(__pyx_t_6)) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(1, 880, __pyx_L1_error) /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x68; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x69; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x6C; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x71; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x66; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x64; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x67; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 0x66; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 0x64; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 0x67; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_6)) { (__pyx_v_f[0]) = 79; goto __pyx_L15; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ /*else*/ { __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(1, 901, __pyx_L1_error) } __pyx_L15:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ goto __pyx_L13; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ /*else*/ { __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error) __pyx_v_f = __pyx_t_9; } __pyx_L13:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842 * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022 * int _import_umath() except -1 * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * Py_INCREF(base) # important to do this before stealing the reference below! * PyArray_SetBaseObject(arr, base) */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_array_base", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023 * * cdef inline void set_array_base(ndarray arr, object base): * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< * PyArray_SetBaseObject(arr, base) * */ Py_INCREF(__pyx_v_base); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024 * cdef inline void set_array_base(ndarray arr, object base): * Py_INCREF(base) # important to do this before stealing the reference below! * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022 * int _import_umath() except -1 * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * Py_INCREF(base) # important to do this before stealing the reference below! * PyArray_SetBaseObject(arr, base) */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026 * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * base = PyArray_BASE(arr) * if base is NULL: */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_v_base; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027 * * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< * if base is NULL: * return None */ __pyx_v_base = PyArray_BASE(__pyx_v_arr); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028 * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) * if base is NULL: # <<<<<<<<<<<<<< * return None * return base */ __pyx_t_1 = ((__pyx_v_base == NULL) != 0); if (__pyx_t_1) { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029 * base = PyArray_BASE(arr) * if base is NULL: * return None # <<<<<<<<<<<<<< * return base * */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028 * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) * if base is NULL: # <<<<<<<<<<<<<< * return None * return base */ } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030 * if base is NULL: * return None * return base # <<<<<<<<<<<<<< * * # Versions of the import_* functions which are more suitable for */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_base)); __pyx_r = ((PyObject *)__pyx_v_base); goto __pyx_L0; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026 * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * base = PyArray_BASE(arr) * if base is NULL: */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< * try: * _import_array() */ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_array", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< * _import_array() * except Exception: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036 * cdef inline int import_array() except -1: * try: * _import_array() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.multiarray failed to import") */ __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error) /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< * _import_array() * except Exception: */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037 * try: * _import_array() * except Exception: # <<<<<<<<<<<<<< * raise ImportError("numpy.core.multiarray failed to import") * */ __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(1, 1038, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< * _import_array() * except Exception: */ __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L8_try_end:; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< * try: * _import_array() */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< * try: * _import_umath() */ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_umath", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042 * cdef inline int import_umath() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error) /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< * raise ImportError("numpy.core.umath failed to import") * */ __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(1, 1044, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L8_try_end:; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< * try: * _import_umath() */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< * try: * _import_umath() */ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_ufunc", 0); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048 * cdef inline int import_ufunc() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error) /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< * raise ImportError("numpy.core.umath failed to import") */ __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(1, 1050, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L8_try_end:; } /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< * try: * _import_umath() */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":122 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< * mode="c", bint allocate_buffer=True): * */ /* Python wrapper */ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_shape = 0; Py_ssize_t __pyx_v_itemsize; PyObject *__pyx_v_format = 0; PyObject *__pyx_v_mode = 0; int __pyx_v_allocate_buffer; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; PyObject* values[5] = {0,0,0,0,0}; values[3] = ((PyObject *)__pyx_n_s_c); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode); if (value) { values[3] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer); if (value) { values[4] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_shape = ((PyObject*)values[0]); __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error) __pyx_v_format = values[2]; __pyx_v_mode = values[3]; if (values[4]) { __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) } else { /* "View.MemoryView":123 * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< * * cdef int idx */ __pyx_v_allocate_buffer = ((int)1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error) if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error) } __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); /* "View.MemoryView":122 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< * mode="c", bint allocate_buffer=True): * */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { int __pyx_v_idx; Py_ssize_t __pyx_v_i; Py_ssize_t __pyx_v_dim; PyObject **__pyx_v_p; char __pyx_v_order; int __pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; char *__pyx_t_7; int __pyx_t_8; Py_ssize_t __pyx_t_9; PyObject *__pyx_t_10 = NULL; Py_ssize_t __pyx_t_11; __Pyx_RefNannySetupContext("__cinit__", 0); __Pyx_INCREF(__pyx_v_format); /* "View.MemoryView":129 * cdef PyObject **p * * self.ndim = len(shape) # <<<<<<<<<<<<<< * self.itemsize = itemsize * */ if (unlikely(__pyx_v_shape == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(2, 129, __pyx_L1_error) } __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error) __pyx_v_self->ndim = ((int)__pyx_t_1); /* "View.MemoryView":130 * * self.ndim = len(shape) * self.itemsize = itemsize # <<<<<<<<<<<<<< * * if not self.ndim: */ __pyx_v_self->itemsize = __pyx_v_itemsize; /* "View.MemoryView":132 * self.itemsize = itemsize * * if not self.ndim: # <<<<<<<<<<<<<< * raise ValueError("Empty shape tuple for cython.array") * */ __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); if (unlikely(__pyx_t_2)) { /* "View.MemoryView":133 * * if not self.ndim: * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< * * if itemsize <= 0: */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(2, 133, __pyx_L1_error) /* "View.MemoryView":132 * self.itemsize = itemsize * * if not self.ndim: # <<<<<<<<<<<<<< * raise ValueError("Empty shape tuple for cython.array") * */ } /* "View.MemoryView":135 * raise ValueError("Empty shape tuple for cython.array") * * if itemsize <= 0: # <<<<<<<<<<<<<< * raise ValueError("itemsize <= 0 for cython.array") * */ __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); if (unlikely(__pyx_t_2)) { /* "View.MemoryView":136 * * if itemsize <= 0: * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * * if not isinstance(format, bytes): */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(2, 136, __pyx_L1_error) /* "View.MemoryView":135 * raise ValueError("Empty shape tuple for cython.array") * * if itemsize <= 0: # <<<<<<<<<<<<<< * raise ValueError("itemsize <= 0 for cython.array") * */ } /* "View.MemoryView":138 * raise ValueError("itemsize <= 0 for cython.array") * * if not isinstance(format, bytes): # <<<<<<<<<<<<<< * format = format.encode('ASCII') * self._format = format # keep a reference to the byte string */ __pyx_t_2 = PyBytes_Check(__pyx_v_format); __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_4) { /* "View.MemoryView":139 * * if not isinstance(format, bytes): * format = format.encode('ASCII') # <<<<<<<<<<<<<< * self._format = format # keep a reference to the byte string * self.format = self._format */ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); __pyx_t_3 = 0; /* "View.MemoryView":138 * raise ValueError("itemsize <= 0 for cython.array") * * if not isinstance(format, bytes): # <<<<<<<<<<<<<< * format = format.encode('ASCII') * self._format = format # keep a reference to the byte string */ } /* "View.MemoryView":140 * if not isinstance(format, bytes): * format = format.encode('ASCII') * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< * self.format = self._format * */ if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error) __pyx_t_3 = __pyx_v_format; __Pyx_INCREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_format); __Pyx_DECREF(__pyx_v_self->_format); __pyx_v_self->_format = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "View.MemoryView":141 * format = format.encode('ASCII') * self._format = format # keep a reference to the byte string * self.format = self._format # <<<<<<<<<<<<<< * * */ if (unlikely(__pyx_v_self->_format == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); __PYX_ERR(2, 141, __pyx_L1_error) } __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error) __pyx_v_self->format = __pyx_t_7; /* "View.MemoryView":144 * * * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< * self._strides = self._shape + self.ndim * */ __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); /* "View.MemoryView":145 * * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< * * if not self._shape: */ __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); /* "View.MemoryView":147 * self._strides = self._shape + self.ndim * * if not self._shape: # <<<<<<<<<<<<<< * raise MemoryError("unable to allocate shape and strides.") * */ __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); if (unlikely(__pyx_t_4)) { /* "View.MemoryView":148 * * if not self._shape: * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< * * */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(2, 148, __pyx_L1_error) /* "View.MemoryView":147 * self._strides = self._shape + self.ndim * * if not self._shape: # <<<<<<<<<<<<<< * raise MemoryError("unable to allocate shape and strides.") * */ } /* "View.MemoryView":151 * * * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ __pyx_t_8 = 0; __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; for (;;) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error) #else __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_dim = __pyx_t_9; __pyx_v_idx = __pyx_t_8; __pyx_t_8 = (__pyx_t_8 + 1); /* "View.MemoryView":152 * * for idx, dim in enumerate(shape): * if dim <= 0: # <<<<<<<<<<<<<< * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) * self._shape[idx] = dim */ __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); if (unlikely(__pyx_t_4)) { /* "View.MemoryView":153 * for idx, dim in enumerate(shape): * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< * self._shape[idx] = dim * */ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __PYX_ERR(2, 153, __pyx_L1_error) /* "View.MemoryView":152 * * for idx, dim in enumerate(shape): * if dim <= 0: # <<<<<<<<<<<<<< * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) * self._shape[idx] = dim */ } /* "View.MemoryView":154 * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) * self._shape[idx] = dim # <<<<<<<<<<<<<< * * cdef char order */ (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; /* "View.MemoryView":151 * * * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "View.MemoryView":157 * * cdef char order * if mode == 'fortran': # <<<<<<<<<<<<<< * order = b'F' * self.mode = u'fortran' */ __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error) if (__pyx_t_4) { /* "View.MemoryView":158 * cdef char order * if mode == 'fortran': * order = b'F' # <<<<<<<<<<<<<< * self.mode = u'fortran' * elif mode == 'c': */ __pyx_v_order = 'F'; /* "View.MemoryView":159 * if mode == 'fortran': * order = b'F' * self.mode = u'fortran' # <<<<<<<<<<<<<< * elif mode == 'c': * order = b'C' */ __Pyx_INCREF(__pyx_n_u_fortran); __Pyx_GIVEREF(__pyx_n_u_fortran); __Pyx_GOTREF(__pyx_v_self->mode); __Pyx_DECREF(__pyx_v_self->mode); __pyx_v_self->mode = __pyx_n_u_fortran; /* "View.MemoryView":157 * * cdef char order * if mode == 'fortran': # <<<<<<<<<<<<<< * order = b'F' * self.mode = u'fortran' */ goto __pyx_L10; } /* "View.MemoryView":160 * order = b'F' * self.mode = u'fortran' * elif mode == 'c': # <<<<<<<<<<<<<< * order = b'C' * self.mode = u'c' */ __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error) if (likely(__pyx_t_4)) { /* "View.MemoryView":161 * self.mode = u'fortran' * elif mode == 'c': * order = b'C' # <<<<<<<<<<<<<< * self.mode = u'c' * else: */ __pyx_v_order = 'C'; /* "View.MemoryView":162 * elif mode == 'c': * order = b'C' * self.mode = u'c' # <<<<<<<<<<<<<< * else: * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) */ __Pyx_INCREF(__pyx_n_u_c); __Pyx_GIVEREF(__pyx_n_u_c); __Pyx_GOTREF(__pyx_v_self->mode); __Pyx_DECREF(__pyx_v_self->mode); __pyx_v_self->mode = __pyx_n_u_c; /* "View.MemoryView":160 * order = b'F' * self.mode = u'fortran' * elif mode == 'c': # <<<<<<<<<<<<<< * order = b'C' * self.mode = u'c' */ goto __pyx_L10; } /* "View.MemoryView":164 * self.mode = u'c' * else: * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< * * self.len = fill_contig_strides_array(self._shape, self._strides, */ /*else*/ { __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __PYX_ERR(2, 164, __pyx_L1_error) } __pyx_L10:; /* "View.MemoryView":166 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) * * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< * itemsize, self.ndim, order) * */ __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); /* "View.MemoryView":169 * itemsize, self.ndim, order) * * self.free_data = allocate_buffer # <<<<<<<<<<<<<< * self.dtype_is_object = format == b'O' * if allocate_buffer: */ __pyx_v_self->free_data = __pyx_v_allocate_buffer; /* "View.MemoryView":170 * * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< * if allocate_buffer: * */ __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_v_self->dtype_is_object = __pyx_t_4; /* "View.MemoryView":171 * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' * if allocate_buffer: # <<<<<<<<<<<<<< * * */ __pyx_t_4 = (__pyx_v_allocate_buffer != 0); if (__pyx_t_4) { /* "View.MemoryView":174 * * * self.data = malloc(self.len) # <<<<<<<<<<<<<< * if not self.data: * raise MemoryError("unable to allocate array data.") */ __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); /* "View.MemoryView":175 * * self.data = malloc(self.len) * if not self.data: # <<<<<<<<<<<<<< * raise MemoryError("unable to allocate array data.") * */ __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); if (unlikely(__pyx_t_4)) { /* "View.MemoryView":176 * self.data = malloc(self.len) * if not self.data: * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< * * if self.dtype_is_object: */ __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __PYX_ERR(2, 176, __pyx_L1_error) /* "View.MemoryView":175 * * self.data = malloc(self.len) * if not self.data: # <<<<<<<<<<<<<< * raise MemoryError("unable to allocate array data.") * */ } /* "View.MemoryView":178 * raise MemoryError("unable to allocate array data.") * * if self.dtype_is_object: # <<<<<<<<<<<<<< * p = self.data * for i in range(self.len / itemsize): */ __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_4) { /* "View.MemoryView":179 * * if self.dtype_is_object: * p = self.data # <<<<<<<<<<<<<< * for i in range(self.len / itemsize): * p[i] = Py_None */ __pyx_v_p = ((PyObject **)__pyx_v_self->data); /* "View.MemoryView":180 * if self.dtype_is_object: * p = self.data * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< * p[i] = Py_None * Py_INCREF(Py_None) */ if (unlikely(__pyx_v_itemsize == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); __PYX_ERR(2, 180, __pyx_L1_error) } else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); __PYX_ERR(2, 180, __pyx_L1_error) } __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize); __pyx_t_9 = __pyx_t_1; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "View.MemoryView":181 * p = self.data * for i in range(self.len / itemsize): * p[i] = Py_None # <<<<<<<<<<<<<< * Py_INCREF(Py_None) * */ (__pyx_v_p[__pyx_v_i]) = Py_None; /* "View.MemoryView":182 * for i in range(self.len / itemsize): * p[i] = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< * * @cname('getbuffer') */ Py_INCREF(Py_None); } /* "View.MemoryView":178 * raise MemoryError("unable to allocate array data.") * * if self.dtype_is_object: # <<<<<<<<<<<<<< * p = self.data * for i in range(self.len / itemsize): */ } /* "View.MemoryView":171 * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' * if allocate_buffer: # <<<<<<<<<<<<<< * * */ } /* "View.MemoryView":122 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< * mode="c", bint allocate_buffer=True): * */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_format); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":185 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< * cdef int bufmode = -1 * if self.mode == u"c": */ /* Python wrapper */ static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_bufmode; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; char *__pyx_t_4; Py_ssize_t __pyx_t_5; int __pyx_t_6; Py_ssize_t *__pyx_t_7; if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; } __Pyx_RefNannySetupContext("__getbuffer__", 0); __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); /* "View.MemoryView":186 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 # <<<<<<<<<<<<<< * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ __pyx_v_bufmode = -1; /* "View.MemoryView":187 * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 * if self.mode == u"c": # <<<<<<<<<<<<<< * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": */ __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "View.MemoryView":188 * cdef int bufmode = -1 * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); /* "View.MemoryView":187 * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 * if self.mode == u"c": # <<<<<<<<<<<<<< * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": */ goto __pyx_L3; } /* "View.MemoryView":189 * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": # <<<<<<<<<<<<<< * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): */ __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* "View.MemoryView":190 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") */ __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); /* "View.MemoryView":189 * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": # <<<<<<<<<<<<<< * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): */ } __pyx_L3:; /* "View.MemoryView":191 * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): # <<<<<<<<<<<<<< * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data */ __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* "View.MemoryView":192 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< * info.buf = self.data * info.len = self.len */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(2, 192, __pyx_L1_error) /* "View.MemoryView":191 * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): # <<<<<<<<<<<<<< * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data */ } /* "View.MemoryView":193 * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data # <<<<<<<<<<<<<< * info.len = self.len * info.ndim = self.ndim */ __pyx_t_4 = __pyx_v_self->data; __pyx_v_info->buf = __pyx_t_4; /* "View.MemoryView":194 * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data * info.len = self.len # <<<<<<<<<<<<<< * info.ndim = self.ndim * info.shape = self._shape */ __pyx_t_5 = __pyx_v_self->len; __pyx_v_info->len = __pyx_t_5; /* "View.MemoryView":195 * info.buf = self.data * info.len = self.len * info.ndim = self.ndim # <<<<<<<<<<<<<< * info.shape = self._shape * info.strides = self._strides */ __pyx_t_6 = __pyx_v_self->ndim; __pyx_v_info->ndim = __pyx_t_6; /* "View.MemoryView":196 * info.len = self.len * info.ndim = self.ndim * info.shape = self._shape # <<<<<<<<<<<<<< * info.strides = self._strides * info.suboffsets = NULL */ __pyx_t_7 = __pyx_v_self->_shape; __pyx_v_info->shape = __pyx_t_7; /* "View.MemoryView":197 * info.ndim = self.ndim * info.shape = self._shape * info.strides = self._strides # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = self.itemsize */ __pyx_t_7 = __pyx_v_self->_strides; __pyx_v_info->strides = __pyx_t_7; /* "View.MemoryView":198 * info.shape = self._shape * info.strides = self._strides * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = self.itemsize * info.readonly = 0 */ __pyx_v_info->suboffsets = NULL; /* "View.MemoryView":199 * info.strides = self._strides * info.suboffsets = NULL * info.itemsize = self.itemsize # <<<<<<<<<<<<<< * info.readonly = 0 * */ __pyx_t_5 = __pyx_v_self->itemsize; __pyx_v_info->itemsize = __pyx_t_5; /* "View.MemoryView":200 * info.suboffsets = NULL * info.itemsize = self.itemsize * info.readonly = 0 # <<<<<<<<<<<<<< * * if flags & PyBUF_FORMAT: */ __pyx_v_info->readonly = 0; /* "View.MemoryView":202 * info.readonly = 0 * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< * info.format = self.format * else: */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { /* "View.MemoryView":203 * * if flags & PyBUF_FORMAT: * info.format = self.format # <<<<<<<<<<<<<< * else: * info.format = NULL */ __pyx_t_4 = __pyx_v_self->format; __pyx_v_info->format = __pyx_t_4; /* "View.MemoryView":202 * info.readonly = 0 * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< * info.format = self.format * else: */ goto __pyx_L5; } /* "View.MemoryView":205 * info.format = self.format * else: * info.format = NULL # <<<<<<<<<<<<<< * * info.obj = self */ /*else*/ { __pyx_v_info->format = NULL; } __pyx_L5:; /* "View.MemoryView":207 * info.format = NULL * * info.obj = self # <<<<<<<<<<<<<< * * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); /* "View.MemoryView":185 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< * cdef int bufmode = -1 * if self.mode == u"c": */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info->obj == Py_None) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } __pyx_L2:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":211 * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") * * def __dealloc__(array self): # <<<<<<<<<<<<<< * if self.callback_free_data != NULL: * self.callback_free_data(self.data) */ /* Python wrapper */ static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); /* "View.MemoryView":212 * * def __dealloc__(array self): * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< * self.callback_free_data(self.data) * elif self.free_data: */ __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); if (__pyx_t_1) { /* "View.MemoryView":213 * def __dealloc__(array self): * if self.callback_free_data != NULL: * self.callback_free_data(self.data) # <<<<<<<<<<<<<< * elif self.free_data: * if self.dtype_is_object: */ __pyx_v_self->callback_free_data(__pyx_v_self->data); /* "View.MemoryView":212 * * def __dealloc__(array self): * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< * self.callback_free_data(self.data) * elif self.free_data: */ goto __pyx_L3; } /* "View.MemoryView":214 * if self.callback_free_data != NULL: * self.callback_free_data(self.data) * elif self.free_data: # <<<<<<<<<<<<<< * if self.dtype_is_object: * refcount_objects_in_slice(self.data, self._shape, */ __pyx_t_1 = (__pyx_v_self->free_data != 0); if (__pyx_t_1) { /* "View.MemoryView":215 * self.callback_free_data(self.data) * elif self.free_data: * if self.dtype_is_object: # <<<<<<<<<<<<<< * refcount_objects_in_slice(self.data, self._shape, * self._strides, self.ndim, False) */ __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_1) { /* "View.MemoryView":216 * elif self.free_data: * if self.dtype_is_object: * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< * self._strides, self.ndim, False) * free(self.data) */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); /* "View.MemoryView":215 * self.callback_free_data(self.data) * elif self.free_data: * if self.dtype_is_object: # <<<<<<<<<<<<<< * refcount_objects_in_slice(self.data, self._shape, * self._strides, self.ndim, False) */ } /* "View.MemoryView":218 * refcount_objects_in_slice(self.data, self._shape, * self._strides, self.ndim, False) * free(self.data) # <<<<<<<<<<<<<< * PyObject_Free(self._shape) * */ free(__pyx_v_self->data); /* "View.MemoryView":214 * if self.callback_free_data != NULL: * self.callback_free_data(self.data) * elif self.free_data: # <<<<<<<<<<<<<< * if self.dtype_is_object: * refcount_objects_in_slice(self.data, self._shape, */ } __pyx_L3:; /* "View.MemoryView":219 * self._strides, self.ndim, False) * free(self.data) * PyObject_Free(self._shape) # <<<<<<<<<<<<<< * * @property */ PyObject_Free(__pyx_v_self->_shape); /* "View.MemoryView":211 * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") * * def __dealloc__(array self): # <<<<<<<<<<<<<< * if self.callback_free_data != NULL: * self.callback_free_data(self.data) */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "View.MemoryView":222 * * @property * def memview(self): # <<<<<<<<<<<<<< * return self.get_memview() * */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":223 * @property * def memview(self): * return self.get_memview() # <<<<<<<<<<<<<< * * @cname('get_memview') */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "View.MemoryView":222 * * @property * def memview(self): # <<<<<<<<<<<<<< * return self.get_memview() * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":226 * * @cname('get_memview') * cdef get_memview(self): # <<<<<<<<<<<<<< * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE * return memoryview(self, flags, self.dtype_is_object) */ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { int __pyx_v_flags; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("get_memview", 0); /* "View.MemoryView":227 * @cname('get_memview') * cdef get_memview(self): * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< * return memoryview(self, flags, self.dtype_is_object) * */ __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); /* "View.MemoryView":228 * cdef get_memview(self): * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< * * def __len__(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "View.MemoryView":226 * * @cname('get_memview') * cdef get_memview(self): # <<<<<<<<<<<<<< * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE * return memoryview(self, flags, self.dtype_is_object) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":230 * return memoryview(self, flags, self.dtype_is_object) * * def __len__(self): # <<<<<<<<<<<<<< * return self._shape[0] * */ /* Python wrapper */ static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); /* "View.MemoryView":231 * * def __len__(self): * return self._shape[0] # <<<<<<<<<<<<<< * * def __getattr__(self, attr): */ __pyx_r = (__pyx_v_self->_shape[0]); goto __pyx_L0; /* "View.MemoryView":230 * return memoryview(self, flags, self.dtype_is_object) * * def __len__(self): # <<<<<<<<<<<<<< * return self._shape[0] * */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":233 * return self._shape[0] * * def __getattr__(self, attr): # <<<<<<<<<<<<<< * return getattr(self.memview, attr) * */ /* Python wrapper */ static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__getattr__", 0); /* "View.MemoryView":234 * * def __getattr__(self, attr): * return getattr(self.memview, attr) # <<<<<<<<<<<<<< * * def __getitem__(self, item): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "View.MemoryView":233 * return self._shape[0] * * def __getattr__(self, attr): # <<<<<<<<<<<<<< * return getattr(self.memview, attr) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":236 * return getattr(self.memview, attr) * * def __getitem__(self, item): # <<<<<<<<<<<<<< * return self.memview[item] * */ /* Python wrapper */ static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__getitem__", 0); /* "View.MemoryView":237 * * def __getitem__(self, item): * return self.memview[item] # <<<<<<<<<<<<<< * * def __setitem__(self, item, value): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "View.MemoryView":236 * return getattr(self.memview, attr) * * def __getitem__(self, item): # <<<<<<<<<<<<<< * return self.memview[item] * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":239 * return self.memview[item] * * def __setitem__(self, item, value): # <<<<<<<<<<<<<< * self.memview[item] = value * */ /* Python wrapper */ static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setitem__", 0); /* "View.MemoryView":240 * * def __setitem__(self, item, value): * self.memview[item] = value # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":239 * return self.memview[item] * * def __setitem__(self, item, value): # <<<<<<<<<<<<<< * self.memview[item] = value * */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(2, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* Python wrapper */ static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(2, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":244 * * @cname("__pyx_array_new") * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< * char *mode, char *buf): * cdef array result */ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { struct __pyx_array_obj *__pyx_v_result = 0; struct __pyx_array_obj *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("array_cwrapper", 0); /* "View.MemoryView":248 * cdef array result * * if buf == NULL: # <<<<<<<<<<<<<< * result = array(shape, itemsize, format, mode.decode('ASCII')) * else: */ __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); if (__pyx_t_1) { /* "View.MemoryView":249 * * if buf == NULL: * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), */ __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_shape); __Pyx_GIVEREF(__pyx_v_shape); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); __pyx_t_4 = 0; /* "View.MemoryView":248 * cdef array result * * if buf == NULL: # <<<<<<<<<<<<<< * result = array(shape, itemsize, format, mode.decode('ASCII')) * else: */ goto __pyx_L3; } /* "View.MemoryView":251 * result = array(shape, itemsize, format, mode.decode('ASCII')) * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< * allocate_buffer=False) * result.data = buf */ /*else*/ { __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_shape); __Pyx_GIVEREF(__pyx_v_shape); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_3 = 0; /* "View.MemoryView":252 * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), * allocate_buffer=False) # <<<<<<<<<<<<<< * result.data = buf * */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error) /* "View.MemoryView":251 * result = array(shape, itemsize, format, mode.decode('ASCII')) * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< * allocate_buffer=False) * result.data = buf */ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); __pyx_t_5 = 0; /* "View.MemoryView":253 * result = array(shape, itemsize, format, mode.decode('ASCII'), * allocate_buffer=False) * result.data = buf # <<<<<<<<<<<<<< * * return result */ __pyx_v_result->data = __pyx_v_buf; } __pyx_L3:; /* "View.MemoryView":255 * result.data = buf * * return result # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = __pyx_v_result; goto __pyx_L0; /* "View.MemoryView":244 * * @cname("__pyx_array_new") * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< * char *mode, char *buf): * cdef array result */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":281 * cdef class Enum(object): * cdef object name * def __init__(self, name): # <<<<<<<<<<<<<< * self.name = name * def __repr__(self): */ /* Python wrapper */ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_name = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_name = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* "View.MemoryView":282 * cdef object name * def __init__(self, name): * self.name = name # <<<<<<<<<<<<<< * def __repr__(self): * return self.name */ __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); __Pyx_GOTREF(__pyx_v_self->name); __Pyx_DECREF(__pyx_v_self->name); __pyx_v_self->name = __pyx_v_name; /* "View.MemoryView":281 * cdef class Enum(object): * cdef object name * def __init__(self, name): # <<<<<<<<<<<<<< * self.name = name * def __repr__(self): */ /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":283 * def __init__(self, name): * self.name = name * def __repr__(self): # <<<<<<<<<<<<<< * return self.name * */ /* Python wrapper */ static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); /* "View.MemoryView":284 * self.name = name * def __repr__(self): * return self.name # <<<<<<<<<<<<<< * * cdef generic = Enum("") */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->name); __pyx_r = __pyx_v_self->name; goto __pyx_L0; /* "View.MemoryView":283 * def __init__(self, name): * self.name = name * def __repr__(self): # <<<<<<<<<<<<<< * return self.name * */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state * cdef object _dict */ /* Python wrapper */ static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { PyObject *__pyx_v_state = 0; PyObject *__pyx_v__dict = 0; int __pyx_v_use_setstate; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":5 * cdef object _dict * cdef bint use_setstate * state = (self.name,) # <<<<<<<<<<<<<< * _dict = getattr(self, '__dict__', None) * if _dict is not None: */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_self->name); __Pyx_GIVEREF(__pyx_v_self->name); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); __pyx_v_state = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":6 * cdef bint use_setstate * state = (self.name,) * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< * if _dict is not None: * state += (_dict,) */ __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v__dict = __pyx_t_1; __pyx_t_1 = 0; /* "(tree fragment)":7 * state = (self.name,) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< * state += (_dict,) * use_setstate = True */ __pyx_t_2 = (__pyx_v__dict != Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { /* "(tree fragment)":8 * _dict = getattr(self, '__dict__', None) * if _dict is not None: * state += (_dict,) # <<<<<<<<<<<<<< * use_setstate = True * else: */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v__dict); __Pyx_GIVEREF(__pyx_v__dict); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; /* "(tree fragment)":9 * if _dict is not None: * state += (_dict,) * use_setstate = True # <<<<<<<<<<<<<< * else: * use_setstate = self.name is not None */ __pyx_v_use_setstate = 1; /* "(tree fragment)":7 * state = (self.name,) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< * state += (_dict,) * use_setstate = True */ goto __pyx_L3; } /* "(tree fragment)":11 * use_setstate = True * else: * use_setstate = self.name is not None # <<<<<<<<<<<<<< * if use_setstate: * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state */ /*else*/ { __pyx_t_3 = (__pyx_v_self->name != Py_None); __pyx_v_use_setstate = __pyx_t_3; } __pyx_L3:; /* "(tree fragment)":12 * else: * use_setstate = self.name is not None * if use_setstate: # <<<<<<<<<<<<<< * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state * else: */ __pyx_t_3 = (__pyx_v_use_setstate != 0); if (__pyx_t_3) { /* "(tree fragment)":13 * use_setstate = self.name is not None * if use_setstate: * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_INCREF(__pyx_int_184977713); __Pyx_GIVEREF(__pyx_int_184977713); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; /* "(tree fragment)":12 * else: * use_setstate = self.name is not None * if use_setstate: # <<<<<<<<<<<<<< * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state * else: */ } /* "(tree fragment)":15 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /*else*/ { __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_INCREF(__pyx_int_184977713); __Pyx_GIVEREF(__pyx_int_184977713); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __pyx_t_5 = 0; __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state * cdef object _dict */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_state); __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":16 * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* Python wrapper */ static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":17 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":16 * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":298 * * @cname('__pyx_align_pointer') * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< * "Align pointer memory on a given boundary" * cdef Py_intptr_t aligned_p = memory */ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) { Py_intptr_t __pyx_v_aligned_p; size_t __pyx_v_offset; void *__pyx_r; int __pyx_t_1; /* "View.MemoryView":300 * cdef void *align_pointer(void *memory, size_t alignment) nogil: * "Align pointer memory on a given boundary" * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< * cdef size_t offset * */ __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); /* "View.MemoryView":304 * * with cython.cdivision(True): * offset = aligned_p % alignment # <<<<<<<<<<<<<< * * if offset > 0: */ __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); /* "View.MemoryView":306 * offset = aligned_p % alignment * * if offset > 0: # <<<<<<<<<<<<<< * aligned_p += alignment - offset * */ __pyx_t_1 = ((__pyx_v_offset > 0) != 0); if (__pyx_t_1) { /* "View.MemoryView":307 * * if offset > 0: * aligned_p += alignment - offset # <<<<<<<<<<<<<< * * return aligned_p */ __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); /* "View.MemoryView":306 * offset = aligned_p % alignment * * if offset > 0: # <<<<<<<<<<<<<< * aligned_p += alignment - offset * */ } /* "View.MemoryView":309 * aligned_p += alignment - offset * * return aligned_p # <<<<<<<<<<<<<< * * */ __pyx_r = ((void *)__pyx_v_aligned_p); goto __pyx_L0; /* "View.MemoryView":298 * * @cname('__pyx_align_pointer') * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< * "Align pointer memory on a given boundary" * cdef Py_intptr_t aligned_p = memory */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "View.MemoryView":345 * cdef __Pyx_TypeInfo *typeinfo * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< * self.obj = obj * self.flags = flags */ /* Python wrapper */ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_obj = 0; int __pyx_v_flags; int __pyx_v_dtype_is_object; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_obj = values[0]; __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error) if (values[2]) { __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error) } else { __pyx_v_dtype_is_object = ((int)0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; __Pyx_RefNannySetupContext("__cinit__", 0); /* "View.MemoryView":346 * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): * self.obj = obj # <<<<<<<<<<<<<< * self.flags = flags * if type(self) is memoryview or obj is not None: */ __Pyx_INCREF(__pyx_v_obj); __Pyx_GIVEREF(__pyx_v_obj); __Pyx_GOTREF(__pyx_v_self->obj); __Pyx_DECREF(__pyx_v_self->obj); __pyx_v_self->obj = __pyx_v_obj; /* "View.MemoryView":347 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): * self.obj = obj * self.flags = flags # <<<<<<<<<<<<<< * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) */ __pyx_v_self->flags = __pyx_v_flags; /* "View.MemoryView":348 * self.obj = obj * self.flags = flags * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: */ __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_3 = (__pyx_v_obj != Py_None); __pyx_t_2 = (__pyx_t_3 != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* "View.MemoryView":349 * self.flags = flags * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None */ __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error) /* "View.MemoryView":350 * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: # <<<<<<<<<<<<<< * (<__pyx_buffer *> &self.view).obj = Py_None * Py_INCREF(Py_None) */ __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); if (__pyx_t_1) { /* "View.MemoryView":351 * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< * Py_INCREF(Py_None) * */ ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; /* "View.MemoryView":352 * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< * * global __pyx_memoryview_thread_locks_used */ Py_INCREF(Py_None); /* "View.MemoryView":350 * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: # <<<<<<<<<<<<<< * (<__pyx_buffer *> &self.view).obj = Py_None * Py_INCREF(Py_None) */ } /* "View.MemoryView":348 * self.obj = obj * self.flags = flags * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: */ } /* "View.MemoryView":355 * * global __pyx_memoryview_thread_locks_used * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 */ __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); if (__pyx_t_1) { /* "View.MemoryView":356 * global __pyx_memoryview_thread_locks_used * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: */ __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); /* "View.MemoryView":357 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< * if self.lock is NULL: * self.lock = PyThread_allocate_lock() */ __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); /* "View.MemoryView":355 * * global __pyx_memoryview_thread_locks_used * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 */ } /* "View.MemoryView":358 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: # <<<<<<<<<<<<<< * self.lock = PyThread_allocate_lock() * if self.lock is NULL: */ __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); if (__pyx_t_1) { /* "View.MemoryView":359 * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< * if self.lock is NULL: * raise MemoryError */ __pyx_v_self->lock = PyThread_allocate_lock(); /* "View.MemoryView":360 * if self.lock is NULL: * self.lock = PyThread_allocate_lock() * if self.lock is NULL: # <<<<<<<<<<<<<< * raise MemoryError * */ __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); if (unlikely(__pyx_t_1)) { /* "View.MemoryView":361 * self.lock = PyThread_allocate_lock() * if self.lock is NULL: * raise MemoryError # <<<<<<<<<<<<<< * * if flags & PyBUF_FORMAT: */ PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error) /* "View.MemoryView":360 * if self.lock is NULL: * self.lock = PyThread_allocate_lock() * if self.lock is NULL: # <<<<<<<<<<<<<< * raise MemoryError * */ } /* "View.MemoryView":358 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: # <<<<<<<<<<<<<< * self.lock = PyThread_allocate_lock() * if self.lock is NULL: */ } /* "View.MemoryView":363 * raise MemoryError * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') * else: */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { /* "View.MemoryView":364 * * if flags & PyBUF_FORMAT: * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< * else: * self.dtype_is_object = dtype_is_object */ __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L11_bool_binop_done; } __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0); __pyx_t_1 = __pyx_t_2; __pyx_L11_bool_binop_done:; __pyx_v_self->dtype_is_object = __pyx_t_1; /* "View.MemoryView":363 * raise MemoryError * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') * else: */ goto __pyx_L10; } /* "View.MemoryView":366 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') * else: * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< * * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( */ /*else*/ { __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; } __pyx_L10:; /* "View.MemoryView":368 * self.dtype_is_object = dtype_is_object * * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) * self.typeinfo = NULL */ __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); /* "View.MemoryView":370 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) * self.typeinfo = NULL # <<<<<<<<<<<<<< * * def __dealloc__(memoryview self): */ __pyx_v_self->typeinfo = NULL; /* "View.MemoryView":345 * cdef __Pyx_TypeInfo *typeinfo * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< * self.obj = obj * self.flags = flags */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":372 * self.typeinfo = NULL * * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< * if self.obj is not None: * __Pyx_ReleaseBuffer(&self.view) */ /* Python wrapper */ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { int __pyx_v_i; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; PyThread_type_lock __pyx_t_6; PyThread_type_lock __pyx_t_7; __Pyx_RefNannySetupContext("__dealloc__", 0); /* "View.MemoryView":373 * * def __dealloc__(memoryview self): * if self.obj is not None: # <<<<<<<<<<<<<< * __Pyx_ReleaseBuffer(&self.view) * */ __pyx_t_1 = (__pyx_v_self->obj != Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "View.MemoryView":374 * def __dealloc__(memoryview self): * if self.obj is not None: * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< * * cdef int i */ __Pyx_ReleaseBuffer((&__pyx_v_self->view)); /* "View.MemoryView":373 * * def __dealloc__(memoryview self): * if self.obj is not None: # <<<<<<<<<<<<<< * __Pyx_ReleaseBuffer(&self.view) * */ } /* "View.MemoryView":378 * cdef int i * global __pyx_memoryview_thread_locks_used * if self.lock != NULL: # <<<<<<<<<<<<<< * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: */ __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); if (__pyx_t_2) { /* "View.MemoryView":379 * global __pyx_memoryview_thread_locks_used * if self.lock != NULL: * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 */ __pyx_t_3 = __pyx_memoryview_thread_locks_used; __pyx_t_4 = __pyx_t_3; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; /* "View.MemoryView":380 * if self.lock != NULL: * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: */ __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); if (__pyx_t_2) { /* "View.MemoryView":381 * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< * if i != __pyx_memoryview_thread_locks_used: * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( */ __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); /* "View.MemoryView":382 * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0); if (__pyx_t_2) { /* "View.MemoryView":384 * if i != __pyx_memoryview_thread_locks_used: * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< * break * else: */ __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]); /* "View.MemoryView":383 * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) * break */ (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6; (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7; /* "View.MemoryView":382 * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ } /* "View.MemoryView":385 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) * break # <<<<<<<<<<<<<< * else: * PyThread_free_lock(self.lock) */ goto __pyx_L6_break; /* "View.MemoryView":380 * if self.lock != NULL: * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: */ } } /*else*/ { /* "View.MemoryView":387 * break * else: * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< * * cdef char *get_item_pointer(memoryview self, object index) except NULL: */ PyThread_free_lock(__pyx_v_self->lock); } __pyx_L6_break:; /* "View.MemoryView":378 * cdef int i * global __pyx_memoryview_thread_locks_used * if self.lock != NULL: # <<<<<<<<<<<<<< * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: */ } /* "View.MemoryView":372 * self.typeinfo = NULL * * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< * if self.obj is not None: * __Pyx_ReleaseBuffer(&self.view) */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "View.MemoryView":389 * PyThread_free_lock(self.lock) * * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< * cdef Py_ssize_t dim * cdef char *itemp = self.view.buf */ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { Py_ssize_t __pyx_v_dim; char *__pyx_v_itemp; PyObject *__pyx_v_idx = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; PyObject *(*__pyx_t_4)(PyObject *); PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; char *__pyx_t_7; __Pyx_RefNannySetupContext("get_item_pointer", 0); /* "View.MemoryView":391 * cdef char *get_item_pointer(memoryview self, object index) except NULL: * cdef Py_ssize_t dim * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< * * for dim, idx in enumerate(index): */ __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); /* "View.MemoryView":393 * cdef char *itemp = self.view.buf * * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< * itemp = pybuffer_index(&self.view, itemp, idx, dim) * */ __pyx_t_1 = 0; if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 393, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 393, __pyx_L1_error) #else __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 393, __pyx_L1_error) #else __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } } else { __pyx_t_5 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(2, 393, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_5); } __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); __pyx_t_5 = 0; __pyx_v_dim = __pyx_t_1; __pyx_t_1 = (__pyx_t_1 + 1); /* "View.MemoryView":394 * * for dim, idx in enumerate(index): * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< * * return itemp */ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 394, __pyx_L1_error) __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 394, __pyx_L1_error) __pyx_v_itemp = __pyx_t_7; /* "View.MemoryView":393 * cdef char *itemp = self.view.buf * * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< * itemp = pybuffer_index(&self.view, itemp, idx, dim) * */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "View.MemoryView":396 * itemp = pybuffer_index(&self.view, itemp, idx, dim) * * return itemp # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_itemp; goto __pyx_L0; /* "View.MemoryView":389 * PyThread_free_lock(self.lock) * * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< * cdef Py_ssize_t dim * cdef char *itemp = self.view.buf */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_idx); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":399 * * * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< * if index is Ellipsis: * return self */ /* Python wrapper */ static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { PyObject *__pyx_v_have_slices = NULL; PyObject *__pyx_v_indices = NULL; char *__pyx_v_itemp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; char *__pyx_t_6; __Pyx_RefNannySetupContext("__getitem__", 0); /* "View.MemoryView":400 * * def __getitem__(memoryview self, object index): * if index is Ellipsis: # <<<<<<<<<<<<<< * return self * */ __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "View.MemoryView":401 * def __getitem__(memoryview self, object index): * if index is Ellipsis: * return self # <<<<<<<<<<<<<< * * have_slices, indices = _unellipsify(index, self.view.ndim) */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; /* "View.MemoryView":400 * * def __getitem__(memoryview self, object index): * if index is Ellipsis: # <<<<<<<<<<<<<< * return self * */ } /* "View.MemoryView":403 * return self * * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * * cdef char *itemp */ __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 403, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (likely(__pyx_t_3 != Py_None)) { PyObject* sequence = __pyx_t_3; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(2, 403, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); #else __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 403, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 403, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 403, __pyx_L1_error) } __pyx_v_have_slices = __pyx_t_4; __pyx_t_4 = 0; __pyx_v_indices = __pyx_t_5; __pyx_t_5 = 0; /* "View.MemoryView":406 * * cdef char *itemp * if have_slices: # <<<<<<<<<<<<<< * return memview_slice(self, indices) * else: */ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 406, __pyx_L1_error) if (__pyx_t_2) { /* "View.MemoryView":407 * cdef char *itemp * if have_slices: * return memview_slice(self, indices) # <<<<<<<<<<<<<< * else: * itemp = self.get_item_pointer(indices) */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* "View.MemoryView":406 * * cdef char *itemp * if have_slices: # <<<<<<<<<<<<<< * return memview_slice(self, indices) * else: */ } /* "View.MemoryView":409 * return memview_slice(self, indices) * else: * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< * return self.convert_item_to_object(itemp) * */ /*else*/ { __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 409, __pyx_L1_error) __pyx_v_itemp = __pyx_t_6; /* "View.MemoryView":410 * else: * itemp = self.get_item_pointer(indices) * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< * * def __setitem__(memoryview self, object index, object value): */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; } /* "View.MemoryView":399 * * * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< * if index is Ellipsis: * return self */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_have_slices); __Pyx_XDECREF(__pyx_v_indices); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":412 * return self.convert_item_to_object(itemp) * * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< * if self.view.readonly: * raise TypeError("Cannot assign to read-only memoryview") */ /* Python wrapper */ static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { PyObject *__pyx_v_have_slices = NULL; PyObject *__pyx_v_obj = NULL; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("__setitem__", 0); __Pyx_INCREF(__pyx_v_index); /* "View.MemoryView":413 * * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: # <<<<<<<<<<<<<< * raise TypeError("Cannot assign to read-only memoryview") * */ __pyx_t_1 = (__pyx_v_self->view.readonly != 0); if (unlikely(__pyx_t_1)) { /* "View.MemoryView":414 * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< * * have_slices, index = _unellipsify(index, self.view.ndim) */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(2, 414, __pyx_L1_error) /* "View.MemoryView":413 * * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: # <<<<<<<<<<<<<< * raise TypeError("Cannot assign to read-only memoryview") * */ } /* "View.MemoryView":416 * raise TypeError("Cannot assign to read-only memoryview") * * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * * if have_slices: */ __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(__pyx_t_2 != Py_None)) { PyObject* sequence = __pyx_t_2; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(2, 416, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 416, __pyx_L1_error) } __pyx_v_have_slices = __pyx_t_3; __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); __pyx_t_4 = 0; /* "View.MemoryView":418 * have_slices, index = _unellipsify(index, self.view.ndim) * * if have_slices: # <<<<<<<<<<<<<< * obj = self.is_slice(value) * if obj: */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 418, __pyx_L1_error) if (__pyx_t_1) { /* "View.MemoryView":419 * * if have_slices: * obj = self.is_slice(value) # <<<<<<<<<<<<<< * if obj: * self.setitem_slice_assignment(self[index], obj) */ __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = __pyx_t_2; __pyx_t_2 = 0; /* "View.MemoryView":420 * if have_slices: * obj = self.is_slice(value) * if obj: # <<<<<<<<<<<<<< * self.setitem_slice_assignment(self[index], obj) * else: */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 420, __pyx_L1_error) if (__pyx_t_1) { /* "View.MemoryView":421 * obj = self.is_slice(value) * if obj: * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< * else: * self.setitem_slice_assign_scalar(self[index], value) */ __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "View.MemoryView":420 * if have_slices: * obj = self.is_slice(value) * if obj: # <<<<<<<<<<<<<< * self.setitem_slice_assignment(self[index], obj) * else: */ goto __pyx_L5; } /* "View.MemoryView":423 * self.setitem_slice_assignment(self[index], obj) * else: * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< * else: * self.setitem_indexed(index, value) */ /*else*/ { __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 423, __pyx_L1_error) __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L5:; /* "View.MemoryView":418 * have_slices, index = _unellipsify(index, self.view.ndim) * * if have_slices: # <<<<<<<<<<<<<< * obj = self.is_slice(value) * if obj: */ goto __pyx_L4; } /* "View.MemoryView":425 * self.setitem_slice_assign_scalar(self[index], value) * else: * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< * * cdef is_slice(self, obj): */ /*else*/ { __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L4:; /* "View.MemoryView":412 * return self.convert_item_to_object(itemp) * * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< * if self.view.readonly: * raise TypeError("Cannot assign to read-only memoryview") */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_have_slices); __Pyx_XDECREF(__pyx_v_obj); __Pyx_XDECREF(__pyx_v_index); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":427 * self.setitem_indexed(index, value) * * cdef is_slice(self, obj): # <<<<<<<<<<<<<< * if not isinstance(obj, memoryview): * try: */ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; __Pyx_RefNannySetupContext("is_slice", 0); __Pyx_INCREF(__pyx_v_obj); /* "View.MemoryView":428 * * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< * try: * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { /* "View.MemoryView":429 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); __Pyx_XGOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { /* "View.MemoryView":430 * if not isinstance(obj, memoryview): * try: * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< * self.dtype_is_object) * except TypeError: */ __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 430, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); /* "View.MemoryView":431 * try: * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) # <<<<<<<<<<<<<< * except TypeError: * return None */ __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 431, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); /* "View.MemoryView":430 * if not isinstance(obj, memoryview): * try: * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< * self.dtype_is_object) * except TypeError: */ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 430, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_obj); __Pyx_GIVEREF(__pyx_v_obj); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 430, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); __pyx_t_7 = 0; /* "View.MemoryView":429 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) */ } __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L9_try_end; __pyx_L4_error:; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /* "View.MemoryView":432 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) * except TypeError: # <<<<<<<<<<<<<< * return None * */ __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); if (__pyx_t_9) { __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 432, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_6); /* "View.MemoryView":433 * self.dtype_is_object) * except TypeError: * return None # <<<<<<<<<<<<<< * * return obj */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L7_except_return; } goto __pyx_L6_except_error; __pyx_L6_except_error:; /* "View.MemoryView":429 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) */ __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L1_error; __pyx_L7_except_return:; __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L0; __pyx_L9_try_end:; } /* "View.MemoryView":428 * * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< * try: * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ } /* "View.MemoryView":435 * return None * * return obj # <<<<<<<<<<<<<< * * cdef setitem_slice_assignment(self, dst, src): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_obj); __pyx_r = __pyx_v_obj; goto __pyx_L0; /* "View.MemoryView":427 * self.setitem_indexed(index, value) * * cdef is_slice(self, obj): # <<<<<<<<<<<<<< * if not isinstance(obj, memoryview): * try: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_obj); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":437 * return obj * * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice dst_slice * cdef __Pyx_memviewslice src_slice */ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { __Pyx_memviewslice __pyx_v_dst_slice; __Pyx_memviewslice __pyx_v_src_slice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); /* "View.MemoryView":441 * cdef __Pyx_memviewslice src_slice * * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< * get_slice_from_memview(dst, &dst_slice)[0], * src.ndim, dst.ndim, self.dtype_is_object) */ if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 441, __pyx_L1_error) /* "View.MemoryView":442 * * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< * src.ndim, dst.ndim, self.dtype_is_object) * */ if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 442, __pyx_L1_error) /* "View.MemoryView":443 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], * get_slice_from_memview(dst, &dst_slice)[0], * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 443, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 443, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 443, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 443, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":441 * cdef __Pyx_memviewslice src_slice * * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< * get_slice_from_memview(dst, &dst_slice)[0], * src.ndim, dst.ndim, self.dtype_is_object) */ __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 441, __pyx_L1_error) /* "View.MemoryView":437 * return obj * * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice dst_slice * cdef __Pyx_memviewslice src_slice */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":445 * src.ndim, dst.ndim, self.dtype_is_object) * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< * cdef int array[128] * cdef void *tmp = NULL */ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { int __pyx_v_array[0x80]; void *__pyx_v_tmp; void *__pyx_v_item; __Pyx_memviewslice *__pyx_v_dst_slice; __Pyx_memviewslice __pyx_v_tmp_slice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; char const *__pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); /* "View.MemoryView":447 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): * cdef int array[128] * cdef void *tmp = NULL # <<<<<<<<<<<<<< * cdef void *item * */ __pyx_v_tmp = NULL; /* "View.MemoryView":452 * cdef __Pyx_memviewslice *dst_slice * cdef __Pyx_memviewslice tmp_slice * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< * * if self.view.itemsize > sizeof(array): */ __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); /* "View.MemoryView":454 * dst_slice = get_slice_from_memview(dst, &tmp_slice) * * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: */ __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); if (__pyx_t_1) { /* "View.MemoryView":455 * * if self.view.itemsize > sizeof(array): * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< * if tmp == NULL: * raise MemoryError */ __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); /* "View.MemoryView":456 * if self.view.itemsize > sizeof(array): * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: # <<<<<<<<<<<<<< * raise MemoryError * item = tmp */ __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0); if (unlikely(__pyx_t_1)) { /* "View.MemoryView":457 * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: * raise MemoryError # <<<<<<<<<<<<<< * item = tmp * else: */ PyErr_NoMemory(); __PYX_ERR(2, 457, __pyx_L1_error) /* "View.MemoryView":456 * if self.view.itemsize > sizeof(array): * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: # <<<<<<<<<<<<<< * raise MemoryError * item = tmp */ } /* "View.MemoryView":458 * if tmp == NULL: * raise MemoryError * item = tmp # <<<<<<<<<<<<<< * else: * item = array */ __pyx_v_item = __pyx_v_tmp; /* "View.MemoryView":454 * dst_slice = get_slice_from_memview(dst, &tmp_slice) * * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: */ goto __pyx_L3; } /* "View.MemoryView":460 * item = tmp * else: * item = array # <<<<<<<<<<<<<< * * try: */ /*else*/ { __pyx_v_item = ((void *)__pyx_v_array); } __pyx_L3:; /* "View.MemoryView":462 * item = array * * try: # <<<<<<<<<<<<<< * if self.dtype_is_object: * ( item)[0] = value */ /*try:*/ { /* "View.MemoryView":463 * * try: * if self.dtype_is_object: # <<<<<<<<<<<<<< * ( item)[0] = value * else: */ __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_1) { /* "View.MemoryView":464 * try: * if self.dtype_is_object: * ( item)[0] = value # <<<<<<<<<<<<<< * else: * self.assign_item_from_object( item, value) */ (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); /* "View.MemoryView":463 * * try: * if self.dtype_is_object: # <<<<<<<<<<<<<< * ( item)[0] = value * else: */ goto __pyx_L8; } /* "View.MemoryView":466 * ( item)[0] = value * else: * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< * * */ /*else*/ { __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 466, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L8:; /* "View.MemoryView":470 * * * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0); if (__pyx_t_1) { /* "View.MemoryView":471 * * if self.view.suboffsets != NULL: * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, * item, self.dtype_is_object) */ __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 471, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "View.MemoryView":470 * * * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ } /* "View.MemoryView":472 * if self.view.suboffsets != NULL: * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< * item, self.dtype_is_object) * finally: */ __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } /* "View.MemoryView":475 * item, self.dtype_is_object) * finally: * PyMem_Free(tmp) # <<<<<<<<<<<<<< * * cdef setitem_indexed(self, index, value): */ /*finally:*/ { /*normal exit:*/{ PyMem_Free(__pyx_v_tmp); goto __pyx_L7; } __pyx_L6_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_11); __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename; { PyMem_Free(__pyx_v_tmp); } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); } __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8); __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5; goto __pyx_L1_error; } __pyx_L7:; } /* "View.MemoryView":445 * src.ndim, dst.ndim, self.dtype_is_object) * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< * cdef int array[128] * cdef void *tmp = NULL */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":477 * PyMem_Free(tmp) * * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< * cdef char *itemp = self.get_item_pointer(index) * self.assign_item_from_object(itemp, value) */ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { char *__pyx_v_itemp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("setitem_indexed", 0); /* "View.MemoryView":478 * * cdef setitem_indexed(self, index, value): * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< * self.assign_item_from_object(itemp, value) * */ __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 478, __pyx_L1_error) __pyx_v_itemp = __pyx_t_1; /* "View.MemoryView":479 * cdef setitem_indexed(self, index, value): * cdef char *itemp = self.get_item_pointer(index) * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< * * cdef convert_item_to_object(self, char *itemp): */ __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "View.MemoryView":477 * PyMem_Free(tmp) * * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< * cdef char *itemp = self.get_item_pointer(index) * self.assign_item_from_object(itemp, value) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":481 * self.assign_item_from_object(itemp, value) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" */ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { PyObject *__pyx_v_struct = NULL; PyObject *__pyx_v_bytesitem = 0; PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; size_t __pyx_t_10; int __pyx_t_11; __Pyx_RefNannySetupContext("convert_item_to_object", 0); /* "View.MemoryView":484 * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" * import struct # <<<<<<<<<<<<<< * cdef bytes bytesitem * */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; /* "View.MemoryView":487 * cdef bytes bytesitem * * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< * try: * result = struct.unpack(self.view.format, bytesitem) */ __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":488 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< * result = struct.unpack(self.view.format, bytesitem) * except struct.error: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_t_4); /*try:*/ { /* "View.MemoryView":489 * bytesitem = itemp[:self.view.itemsize] * try: * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< * except struct.error: * raise ValueError("Unable to convert item to object") */ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 489, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 489, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 489, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 489, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 489, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; } __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_v_bytesitem); __Pyx_GIVEREF(__pyx_v_bytesitem); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); __pyx_t_6 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 489, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; /* "View.MemoryView":488 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< * result = struct.unpack(self.view.format, bytesitem) * except struct.error: */ } /* "View.MemoryView":493 * raise ValueError("Unable to convert item to object") * else: * if len(self.view.format) == 1: # <<<<<<<<<<<<<< * return result[0] * return result */ /*else:*/ { __pyx_t_10 = strlen(__pyx_v_self->view.format); __pyx_t_11 = ((__pyx_t_10 == 1) != 0); if (__pyx_t_11) { /* "View.MemoryView":494 * else: * if len(self.view.format) == 1: * return result[0] # <<<<<<<<<<<<<< * return result * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 494, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L6_except_return; /* "View.MemoryView":493 * raise ValueError("Unable to convert item to object") * else: * if len(self.view.format) == 1: # <<<<<<<<<<<<<< * return result[0] * return result */ } /* "View.MemoryView":495 * if len(self.view.format) == 1: * return result[0] * return result # <<<<<<<<<<<<<< * * cdef assign_item_from_object(self, char *itemp, object value): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L6_except_return; } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; /* "View.MemoryView":490 * try: * result = struct.unpack(self.view.format, bytesitem) * except struct.error: # <<<<<<<<<<<<<< * raise ValueError("Unable to convert item to object") * else: */ __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 490, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9); __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; if (__pyx_t_8) { __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 490, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_1); /* "View.MemoryView":491 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< * else: * if len(self.view.format) == 1: */ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 491, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(2, 491, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "View.MemoryView":488 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< * result = struct.unpack(self.view.format, bytesitem) * except struct.error: */ __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); goto __pyx_L1_error; __pyx_L6_except_return:; __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); goto __pyx_L0; } /* "View.MemoryView":481 * self.assign_item_from_object(itemp, value) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_struct); __Pyx_XDECREF(__pyx_v_bytesitem); __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":497 * return result * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" */ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { PyObject *__pyx_v_struct = NULL; char __pyx_v_c; PyObject *__pyx_v_bytesvalue = 0; Py_ssize_t __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; PyObject *__pyx_t_10 = NULL; char *__pyx_t_11; char *__pyx_t_12; char *__pyx_t_13; char *__pyx_t_14; __Pyx_RefNannySetupContext("assign_item_from_object", 0); /* "View.MemoryView":500 * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" * import struct # <<<<<<<<<<<<<< * cdef char c * cdef bytes bytesvalue */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; /* "View.MemoryView":505 * cdef Py_ssize_t i * * if isinstance(value, tuple): # <<<<<<<<<<<<<< * bytesvalue = struct.pack(self.view.format, *value) * else: */ __pyx_t_2 = PyTuple_Check(__pyx_v_value); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { /* "View.MemoryView":506 * * if isinstance(value, tuple): * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< * else: * bytesvalue = struct.pack(self.view.format, value) */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 506, __pyx_L1_error) __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; /* "View.MemoryView":505 * cdef Py_ssize_t i * * if isinstance(value, tuple): # <<<<<<<<<<<<<< * bytesvalue = struct.pack(self.view.format, *value) * else: */ goto __pyx_L3; } /* "View.MemoryView":508 * bytesvalue = struct.pack(self.view.format, *value) * else: * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< * * for i, c in enumerate(bytesvalue): */ /*else*/ { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 508, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 508, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 508, __pyx_L1_error) __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; } __pyx_L3:; /* "View.MemoryView":510 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< * itemp[i] = c * */ __pyx_t_9 = 0; if (unlikely(__pyx_v_bytesvalue == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); __PYX_ERR(2, 510, __pyx_L1_error) } __Pyx_INCREF(__pyx_v_bytesvalue); __pyx_t_10 = __pyx_v_bytesvalue; __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10); __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10)); for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { __pyx_t_11 = __pyx_t_14; __pyx_v_c = (__pyx_t_11[0]); /* "View.MemoryView":511 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< * * @cname('getbuffer') */ __pyx_v_i = __pyx_t_9; /* "View.MemoryView":510 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< * itemp[i] = c * */ __pyx_t_9 = (__pyx_t_9 + 1); /* "View.MemoryView":511 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< * * @cname('getbuffer') */ (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* "View.MemoryView":497 * return result * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_struct); __Pyx_XDECREF(__pyx_v_bytesvalue); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":514 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< * if flags & PyBUF_WRITABLE and self.view.readonly: * raise ValueError("Cannot create writable memory view from read-only memoryview") */ /* Python wrapper */ static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; Py_ssize_t *__pyx_t_4; char *__pyx_t_5; void *__pyx_t_6; int __pyx_t_7; Py_ssize_t __pyx_t_8; if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; } __Pyx_RefNannySetupContext("__getbuffer__", 0); __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); /* "View.MemoryView":515 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< * raise ValueError("Cannot create writable memory view from read-only memoryview") * */ __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = (__pyx_v_self->view.readonly != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* "View.MemoryView":516 * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< * * if flags & PyBUF_ND: */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(2, 516, __pyx_L1_error) /* "View.MemoryView":515 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< * raise ValueError("Cannot create writable memory view from read-only memoryview") * */ } /* "View.MemoryView":518 * raise ValueError("Cannot create writable memory view from read-only memoryview") * * if flags & PyBUF_ND: # <<<<<<<<<<<<<< * info.shape = self.view.shape * else: */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); if (__pyx_t_1) { /* "View.MemoryView":519 * * if flags & PyBUF_ND: * info.shape = self.view.shape # <<<<<<<<<<<<<< * else: * info.shape = NULL */ __pyx_t_4 = __pyx_v_self->view.shape; __pyx_v_info->shape = __pyx_t_4; /* "View.MemoryView":518 * raise ValueError("Cannot create writable memory view from read-only memoryview") * * if flags & PyBUF_ND: # <<<<<<<<<<<<<< * info.shape = self.view.shape * else: */ goto __pyx_L6; } /* "View.MemoryView":521 * info.shape = self.view.shape * else: * info.shape = NULL # <<<<<<<<<<<<<< * * if flags & PyBUF_STRIDES: */ /*else*/ { __pyx_v_info->shape = NULL; } __pyx_L6:; /* "View.MemoryView":523 * info.shape = NULL * * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< * info.strides = self.view.strides * else: */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); if (__pyx_t_1) { /* "View.MemoryView":524 * * if flags & PyBUF_STRIDES: * info.strides = self.view.strides # <<<<<<<<<<<<<< * else: * info.strides = NULL */ __pyx_t_4 = __pyx_v_self->view.strides; __pyx_v_info->strides = __pyx_t_4; /* "View.MemoryView":523 * info.shape = NULL * * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< * info.strides = self.view.strides * else: */ goto __pyx_L7; } /* "View.MemoryView":526 * info.strides = self.view.strides * else: * info.strides = NULL # <<<<<<<<<<<<<< * * if flags & PyBUF_INDIRECT: */ /*else*/ { __pyx_v_info->strides = NULL; } __pyx_L7:; /* "View.MemoryView":528 * info.strides = NULL * * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< * info.suboffsets = self.view.suboffsets * else: */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); if (__pyx_t_1) { /* "View.MemoryView":529 * * if flags & PyBUF_INDIRECT: * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< * else: * info.suboffsets = NULL */ __pyx_t_4 = __pyx_v_self->view.suboffsets; __pyx_v_info->suboffsets = __pyx_t_4; /* "View.MemoryView":528 * info.strides = NULL * * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< * info.suboffsets = self.view.suboffsets * else: */ goto __pyx_L8; } /* "View.MemoryView":531 * info.suboffsets = self.view.suboffsets * else: * info.suboffsets = NULL # <<<<<<<<<<<<<< * * if flags & PyBUF_FORMAT: */ /*else*/ { __pyx_v_info->suboffsets = NULL; } __pyx_L8:; /* "View.MemoryView":533 * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< * info.format = self.view.format * else: */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { /* "View.MemoryView":534 * * if flags & PyBUF_FORMAT: * info.format = self.view.format # <<<<<<<<<<<<<< * else: * info.format = NULL */ __pyx_t_5 = __pyx_v_self->view.format; __pyx_v_info->format = __pyx_t_5; /* "View.MemoryView":533 * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< * info.format = self.view.format * else: */ goto __pyx_L9; } /* "View.MemoryView":536 * info.format = self.view.format * else: * info.format = NULL # <<<<<<<<<<<<<< * * info.buf = self.view.buf */ /*else*/ { __pyx_v_info->format = NULL; } __pyx_L9:; /* "View.MemoryView":538 * info.format = NULL * * info.buf = self.view.buf # <<<<<<<<<<<<<< * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize */ __pyx_t_6 = __pyx_v_self->view.buf; __pyx_v_info->buf = __pyx_t_6; /* "View.MemoryView":539 * * info.buf = self.view.buf * info.ndim = self.view.ndim # <<<<<<<<<<<<<< * info.itemsize = self.view.itemsize * info.len = self.view.len */ __pyx_t_7 = __pyx_v_self->view.ndim; __pyx_v_info->ndim = __pyx_t_7; /* "View.MemoryView":540 * info.buf = self.view.buf * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< * info.len = self.view.len * info.readonly = self.view.readonly */ __pyx_t_8 = __pyx_v_self->view.itemsize; __pyx_v_info->itemsize = __pyx_t_8; /* "View.MemoryView":541 * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize * info.len = self.view.len # <<<<<<<<<<<<<< * info.readonly = self.view.readonly * info.obj = self */ __pyx_t_8 = __pyx_v_self->view.len; __pyx_v_info->len = __pyx_t_8; /* "View.MemoryView":542 * info.itemsize = self.view.itemsize * info.len = self.view.len * info.readonly = self.view.readonly # <<<<<<<<<<<<<< * info.obj = self * */ __pyx_t_1 = __pyx_v_self->view.readonly; __pyx_v_info->readonly = __pyx_t_1; /* "View.MemoryView":543 * info.len = self.view.len * info.readonly = self.view.readonly * info.obj = self # <<<<<<<<<<<<<< * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); /* "View.MemoryView":514 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< * if flags & PyBUF_WRITABLE and self.view.readonly: * raise ValueError("Cannot create writable memory view from read-only memoryview") */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info->obj == Py_None) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } __pyx_L2:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":549 * * @property * def T(self): # <<<<<<<<<<<<<< * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":550 * @property * def T(self): * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< * transpose_memslice(&result.from_slice) * return result */ __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 550, __pyx_L1_error) __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":551 * def T(self): * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< * return result * */ __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 551, __pyx_L1_error) /* "View.MemoryView":552 * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) * return result # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; /* "View.MemoryView":549 * * @property * def T(self): # <<<<<<<<<<<<<< * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":555 * * @property * def base(self): # <<<<<<<<<<<<<< * return self.obj * */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":556 * @property * def base(self): * return self.obj # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->obj); __pyx_r = __pyx_v_self->obj; goto __pyx_L0; /* "View.MemoryView":555 * * @property * def base(self): # <<<<<<<<<<<<<< * return self.obj * */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":559 * * @property * def shape(self): # <<<<<<<<<<<<<< * return tuple([length for length in self.view.shape[:self.view.ndim]]) * */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { Py_ssize_t __pyx_v_length; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t *__pyx_t_2; Py_ssize_t *__pyx_t_3; Py_ssize_t *__pyx_t_4; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":560 * @property * def shape(self): * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { __pyx_t_2 = __pyx_t_4; __pyx_v_length = (__pyx_t_2[0]); __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 560, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; /* "View.MemoryView":559 * * @property * def shape(self): # <<<<<<<<<<<<<< * return tuple([length for length in self.view.shape[:self.view.ndim]]) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":563 * * @property * def strides(self): # <<<<<<<<<<<<<< * if self.view.strides == NULL: * */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { Py_ssize_t __pyx_v_stride; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; Py_ssize_t *__pyx_t_3; Py_ssize_t *__pyx_t_4; Py_ssize_t *__pyx_t_5; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":564 * @property * def strides(self): * if self.view.strides == NULL: # <<<<<<<<<<<<<< * * raise ValueError("Buffer view does not expose strides") */ __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); if (unlikely(__pyx_t_1)) { /* "View.MemoryView":566 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(2, 566, __pyx_L1_error) /* "View.MemoryView":564 * @property * def strides(self): * if self.view.strides == NULL: # <<<<<<<<<<<<<< * * raise ValueError("Buffer view does not expose strides") */ } /* "View.MemoryView":568 * raise ValueError("Buffer view does not expose strides") * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { __pyx_t_3 = __pyx_t_5; __pyx_v_stride = (__pyx_t_3[0]); __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 568, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; /* "View.MemoryView":563 * * @property * def strides(self): # <<<<<<<<<<<<<< * if self.view.strides == NULL: * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":571 * * @property * def suboffsets(self): # <<<<<<<<<<<<<< * if self.view.suboffsets == NULL: * return (-1,) * self.view.ndim */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { Py_ssize_t __pyx_v_suboffset; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t *__pyx_t_4; Py_ssize_t *__pyx_t_5; Py_ssize_t *__pyx_t_6; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":572 * @property * def suboffsets(self): * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< * return (-1,) * self.view.ndim * */ __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); if (__pyx_t_1) { /* "View.MemoryView":573 * def suboffsets(self): * if self.view.suboffsets == NULL: * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__23, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* "View.MemoryView":572 * @property * def suboffsets(self): * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< * return (-1,) * self.view.ndim * */ } /* "View.MemoryView":575 * return (-1,) * self.view.ndim * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 575, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { __pyx_t_4 = __pyx_t_6; __pyx_v_suboffset = (__pyx_t_4[0]); __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 575, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 575, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 575, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "View.MemoryView":571 * * @property * def suboffsets(self): # <<<<<<<<<<<<<< * if self.view.suboffsets == NULL: * return (-1,) * self.view.ndim */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":578 * * @property * def ndim(self): # <<<<<<<<<<<<<< * return self.view.ndim * */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":579 * @property * def ndim(self): * return self.view.ndim # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "View.MemoryView":578 * * @property * def ndim(self): # <<<<<<<<<<<<<< * return self.view.ndim * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":582 * * @property * def itemsize(self): # <<<<<<<<<<<<<< * return self.view.itemsize * */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":583 * @property * def itemsize(self): * return self.view.itemsize # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "View.MemoryView":582 * * @property * def itemsize(self): # <<<<<<<<<<<<<< * return self.view.itemsize * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":586 * * @property * def nbytes(self): # <<<<<<<<<<<<<< * return self.size * self.view.itemsize * */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":587 * @property * def nbytes(self): * return self.size * self.view.itemsize # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* "View.MemoryView":586 * * @property * def nbytes(self): # <<<<<<<<<<<<<< * return self.size * self.view.itemsize * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":590 * * @property * def size(self): # <<<<<<<<<<<<<< * if self._size is None: * result = 1 */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_length = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; Py_ssize_t *__pyx_t_3; Py_ssize_t *__pyx_t_4; Py_ssize_t *__pyx_t_5; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":591 * @property * def size(self): * if self._size is None: # <<<<<<<<<<<<<< * result = 1 * */ __pyx_t_1 = (__pyx_v_self->_size == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "View.MemoryView":592 * def size(self): * if self._size is None: * result = 1 # <<<<<<<<<<<<<< * * for length in self.view.shape[:self.view.ndim]: */ __Pyx_INCREF(__pyx_int_1); __pyx_v_result = __pyx_int_1; /* "View.MemoryView":594 * result = 1 * * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< * result *= length * */ __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { __pyx_t_3 = __pyx_t_5; __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); __pyx_t_6 = 0; /* "View.MemoryView":595 * * for length in self.view.shape[:self.view.ndim]: * result *= length # <<<<<<<<<<<<<< * * self._size = result */ __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); __pyx_t_6 = 0; } /* "View.MemoryView":597 * result *= length * * self._size = result # <<<<<<<<<<<<<< * * return self._size */ __Pyx_INCREF(__pyx_v_result); __Pyx_GIVEREF(__pyx_v_result); __Pyx_GOTREF(__pyx_v_self->_size); __Pyx_DECREF(__pyx_v_self->_size); __pyx_v_self->_size = __pyx_v_result; /* "View.MemoryView":591 * @property * def size(self): * if self._size is None: # <<<<<<<<<<<<<< * result = 1 * */ } /* "View.MemoryView":599 * self._size = result * * return self._size # <<<<<<<<<<<<<< * * def __len__(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_size); __pyx_r = __pyx_v_self->_size; goto __pyx_L0; /* "View.MemoryView":590 * * @property * def size(self): # <<<<<<<<<<<<<< * if self._size is None: * result = 1 */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":601 * return self._size * * def __len__(self): # <<<<<<<<<<<<<< * if self.view.ndim >= 1: * return self.view.shape[0] */ /* Python wrapper */ static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__len__", 0); /* "View.MemoryView":602 * * def __len__(self): * if self.view.ndim >= 1: # <<<<<<<<<<<<<< * return self.view.shape[0] * */ __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); if (__pyx_t_1) { /* "View.MemoryView":603 * def __len__(self): * if self.view.ndim >= 1: * return self.view.shape[0] # <<<<<<<<<<<<<< * * return 0 */ __pyx_r = (__pyx_v_self->view.shape[0]); goto __pyx_L0; /* "View.MemoryView":602 * * def __len__(self): * if self.view.ndim >= 1: # <<<<<<<<<<<<<< * return self.view.shape[0] * */ } /* "View.MemoryView":605 * return self.view.shape[0] * * return 0 # <<<<<<<<<<<<<< * * def __repr__(self): */ __pyx_r = 0; goto __pyx_L0; /* "View.MemoryView":601 * return self._size * * def __len__(self): # <<<<<<<<<<<<<< * if self.view.ndim >= 1: * return self.view.shape[0] */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":607 * return 0 * * def __repr__(self): # <<<<<<<<<<<<<< * return "" % (self.base.__class__.__name__, * id(self)) */ /* Python wrapper */ static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); /* "View.MemoryView":608 * * def __repr__(self): * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< * id(self)) * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 608, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 608, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 608, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "View.MemoryView":609 * def __repr__(self): * return "" % (self.base.__class__.__name__, * id(self)) # <<<<<<<<<<<<<< * * def __str__(self): */ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "View.MemoryView":608 * * def __repr__(self): * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< * id(self)) * */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 608, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 608, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "View.MemoryView":607 * return 0 * * def __repr__(self): # <<<<<<<<<<<<<< * return "" % (self.base.__class__.__name__, * id(self)) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":611 * id(self)) * * def __str__(self): # <<<<<<<<<<<<<< * return "" % (self.base.__class__.__name__,) * */ /* Python wrapper */ static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__str__", 0); /* "View.MemoryView":612 * * def __str__(self): * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "View.MemoryView":611 * id(self)) * * def __str__(self): # <<<<<<<<<<<<<< * return "" % (self.base.__class__.__name__,) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":615 * * * def is_c_contig(self): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp */ /* Python wrapper */ static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice *__pyx_v_mslice; __Pyx_memviewslice __pyx_v_tmp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("is_c_contig", 0); /* "View.MemoryView":618 * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< * return slice_is_contig(mslice[0], 'C', self.view.ndim) * */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); /* "View.MemoryView":619 * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< * * def is_f_contig(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "View.MemoryView":615 * * * def is_c_contig(self): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":621 * return slice_is_contig(mslice[0], 'C', self.view.ndim) * * def is_f_contig(self): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp */ /* Python wrapper */ static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice *__pyx_v_mslice; __Pyx_memviewslice __pyx_v_tmp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("is_f_contig", 0); /* "View.MemoryView":624 * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< * return slice_is_contig(mslice[0], 'F', self.view.ndim) * */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); /* "View.MemoryView":625 * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< * * def copy(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 625, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "View.MemoryView":621 * return slice_is_contig(mslice[0], 'C', self.view.ndim) * * def is_f_contig(self): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":627 * return slice_is_contig(mslice[0], 'F', self.view.ndim) * * def copy(self): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice mslice * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ /* Python wrapper */ static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice __pyx_v_mslice; int __pyx_v_flags; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_memviewslice __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("copy", 0); /* "View.MemoryView":629 * def copy(self): * cdef __Pyx_memviewslice mslice * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< * * slice_copy(self, &mslice) */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); /* "View.MemoryView":631 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS * * slice_copy(self, &mslice) # <<<<<<<<<<<<<< * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, * self.view.itemsize, */ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); /* "View.MemoryView":632 * * slice_copy(self, &mslice) * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_C_CONTIGUOUS, */ __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 632, __pyx_L1_error) __pyx_v_mslice = __pyx_t_1; /* "View.MemoryView":637 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< * * def copy_fortran(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "View.MemoryView":627 * return slice_is_contig(mslice[0], 'F', self.view.ndim) * * def copy(self): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice mslice * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":639 * return memoryview_copy_from_slice(self, &mslice) * * def copy_fortran(self): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice src, dst * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ /* Python wrapper */ static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice __pyx_v_src; __Pyx_memviewslice __pyx_v_dst; int __pyx_v_flags; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_memviewslice __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("copy_fortran", 0); /* "View.MemoryView":641 * def copy_fortran(self): * cdef __Pyx_memviewslice src, dst * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< * * slice_copy(self, &src) */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); /* "View.MemoryView":643 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS * * slice_copy(self, &src) # <<<<<<<<<<<<<< * dst = slice_copy_contig(&src, "fortran", self.view.ndim, * self.view.itemsize, */ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); /* "View.MemoryView":644 * * slice_copy(self, &src) * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_F_CONTIGUOUS, */ __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 644, __pyx_L1_error) __pyx_v_dst = __pyx_t_1; /* "View.MemoryView":649 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "View.MemoryView":639 * return memoryview_copy_from_slice(self, &mslice) * * def copy_fortran(self): # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice src, dst * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(2, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* Python wrapper */ static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(2, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":653 * * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo */ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { struct __pyx_memoryview_obj *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); /* "View.MemoryView":654 * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< * result.typeinfo = typeinfo * return result */ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 654, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 654, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 654, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_o); __Pyx_GIVEREF(__pyx_v_o); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 654, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); __pyx_t_2 = 0; /* "View.MemoryView":655 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo # <<<<<<<<<<<<<< * return result * */ __pyx_v_result->typeinfo = __pyx_v_typeinfo; /* "View.MemoryView":656 * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo * return result # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_check') */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; /* "View.MemoryView":653 * * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":659 * * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< * return isinstance(o, memoryview) * */ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("memoryview_check", 0); /* "View.MemoryView":660 * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): * return isinstance(o, memoryview) # <<<<<<<<<<<<<< * * cdef tuple _unellipsify(object index, int ndim): */ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); __pyx_r = __pyx_t_1; goto __pyx_L0; /* "View.MemoryView":659 * * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< * return isinstance(o, memoryview) * */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":662 * return isinstance(o, memoryview) * * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< * """ * Replace all ellipses with full slices and fill incomplete indices with */ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { PyObject *__pyx_v_tup = NULL; PyObject *__pyx_v_result = NULL; int __pyx_v_have_slices; int __pyx_v_seen_ellipsis; CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; PyObject *__pyx_v_item = NULL; Py_ssize_t __pyx_v_nslices; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; Py_ssize_t __pyx_t_5; PyObject *(*__pyx_t_6)(PyObject *); PyObject *__pyx_t_7 = NULL; Py_ssize_t __pyx_t_8; int __pyx_t_9; int __pyx_t_10; PyObject *__pyx_t_11 = NULL; __Pyx_RefNannySetupContext("_unellipsify", 0); /* "View.MemoryView":667 * full slices. * """ * if not isinstance(index, tuple): # <<<<<<<<<<<<<< * tup = (index,) * else: */ __pyx_t_1 = PyTuple_Check(__pyx_v_index); __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { /* "View.MemoryView":668 * """ * if not isinstance(index, tuple): * tup = (index,) # <<<<<<<<<<<<<< * else: * tup = index */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_index); __Pyx_GIVEREF(__pyx_v_index); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); __pyx_v_tup = __pyx_t_3; __pyx_t_3 = 0; /* "View.MemoryView":667 * full slices. * """ * if not isinstance(index, tuple): # <<<<<<<<<<<<<< * tup = (index,) * else: */ goto __pyx_L3; } /* "View.MemoryView":670 * tup = (index,) * else: * tup = index # <<<<<<<<<<<<<< * * result = [] */ /*else*/ { __Pyx_INCREF(__pyx_v_index); __pyx_v_tup = __pyx_v_index; } __pyx_L3:; /* "View.MemoryView":672 * tup = index * * result = [] # <<<<<<<<<<<<<< * have_slices = False * seen_ellipsis = False */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_result = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "View.MemoryView":673 * * result = [] * have_slices = False # <<<<<<<<<<<<<< * seen_ellipsis = False * for idx, item in enumerate(tup): */ __pyx_v_have_slices = 0; /* "View.MemoryView":674 * result = [] * have_slices = False * seen_ellipsis = False # <<<<<<<<<<<<<< * for idx, item in enumerate(tup): * if item is Ellipsis: */ __pyx_v_seen_ellipsis = 0; /* "View.MemoryView":675 * have_slices = False * seen_ellipsis = False * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< * if item is Ellipsis: * if not seen_ellipsis: */ __Pyx_INCREF(__pyx_int_0); __pyx_t_3 = __pyx_int_0; if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) { __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 675, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 675, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_6)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 675, __pyx_L1_error) #else __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 675, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 675, __pyx_L1_error) #else __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 675, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } } else { __pyx_t_7 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_7)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(2, 675, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 675, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_7; __pyx_t_7 = 0; /* "View.MemoryView":676 * seen_ellipsis = False * for idx, item in enumerate(tup): * if item is Ellipsis: # <<<<<<<<<<<<<< * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) */ __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* "View.MemoryView":677 * for idx, item in enumerate(tup): * if item is Ellipsis: * if not seen_ellipsis: # <<<<<<<<<<<<<< * result.extend([slice(None)] * (ndim - len(tup) + 1)) * seen_ellipsis = True */ __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); if (__pyx_t_1) { /* "View.MemoryView":678 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 678, __pyx_L1_error) __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 678, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { __Pyx_INCREF(__pyx_slice__26); __Pyx_GIVEREF(__pyx_slice__26); PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__26); } } __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 678, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "View.MemoryView":679 * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) * seen_ellipsis = True # <<<<<<<<<<<<<< * else: * result.append(slice(None)) */ __pyx_v_seen_ellipsis = 1; /* "View.MemoryView":677 * for idx, item in enumerate(tup): * if item is Ellipsis: * if not seen_ellipsis: # <<<<<<<<<<<<<< * result.extend([slice(None)] * (ndim - len(tup) + 1)) * seen_ellipsis = True */ goto __pyx_L7; } /* "View.MemoryView":681 * seen_ellipsis = True * else: * result.append(slice(None)) # <<<<<<<<<<<<<< * have_slices = True * else: */ /*else*/ { __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__26); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 681, __pyx_L1_error) } __pyx_L7:; /* "View.MemoryView":682 * else: * result.append(slice(None)) * have_slices = True # <<<<<<<<<<<<<< * else: * if not isinstance(item, slice) and not PyIndex_Check(item): */ __pyx_v_have_slices = 1; /* "View.MemoryView":676 * seen_ellipsis = False * for idx, item in enumerate(tup): * if item is Ellipsis: # <<<<<<<<<<<<<< * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) */ goto __pyx_L6; } /* "View.MemoryView":684 * have_slices = True * else: * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< * raise TypeError("Cannot index with type '%s'" % type(item)) * */ /*else*/ { __pyx_t_2 = PySlice_Check(__pyx_v_item); __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_10) { } else { __pyx_t_1 = __pyx_t_10; goto __pyx_L9_bool_binop_done; } __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0); __pyx_t_1 = __pyx_t_10; __pyx_L9_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* "View.MemoryView":685 * else: * if not isinstance(item, slice) and not PyIndex_Check(item): * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< * * have_slices = have_slices or isinstance(item, slice) */ __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_11, 0, 0, 0); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __PYX_ERR(2, 685, __pyx_L1_error) /* "View.MemoryView":684 * have_slices = True * else: * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< * raise TypeError("Cannot index with type '%s'" % type(item)) * */ } /* "View.MemoryView":687 * raise TypeError("Cannot index with type '%s'" % type(item)) * * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< * result.append(item) * */ __pyx_t_10 = (__pyx_v_have_slices != 0); if (!__pyx_t_10) { } else { __pyx_t_1 = __pyx_t_10; goto __pyx_L11_bool_binop_done; } __pyx_t_10 = PySlice_Check(__pyx_v_item); __pyx_t_2 = (__pyx_t_10 != 0); __pyx_t_1 = __pyx_t_2; __pyx_L11_bool_binop_done:; __pyx_v_have_slices = __pyx_t_1; /* "View.MemoryView":688 * * have_slices = have_slices or isinstance(item, slice) * result.append(item) # <<<<<<<<<<<<<< * * nslices = ndim - len(result) */ __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 688, __pyx_L1_error) } __pyx_L6:; /* "View.MemoryView":675 * have_slices = False * seen_ellipsis = False * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< * if item is Ellipsis: * if not seen_ellipsis: */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "View.MemoryView":690 * result.append(item) * * nslices = ndim - len(result) # <<<<<<<<<<<<<< * if nslices: * result.extend([slice(None)] * nslices) */ __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 690, __pyx_L1_error) __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); /* "View.MemoryView":691 * * nslices = ndim - len(result) * if nslices: # <<<<<<<<<<<<<< * result.extend([slice(None)] * nslices) * */ __pyx_t_1 = (__pyx_v_nslices != 0); if (__pyx_t_1) { /* "View.MemoryView":692 * nslices = ndim - len(result) * if nslices: * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< * * return have_slices or nslices, tuple(result) */ __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { __Pyx_INCREF(__pyx_slice__26); __Pyx_GIVEREF(__pyx_slice__26); PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__26); } } __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "View.MemoryView":691 * * nslices = ndim - len(result) * if nslices: # <<<<<<<<<<<<<< * result.extend([slice(None)] * nslices) * */ } /* "View.MemoryView":694 * result.extend([slice(None)] * nslices) * * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): */ __Pyx_XDECREF(__pyx_r); if (!__pyx_v_have_slices) { } else { __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L14_bool_binop_done; } __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __pyx_t_4; __pyx_t_4 = 0; __pyx_L14_bool_binop_done:; __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_r = ((PyObject*)__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L0; /* "View.MemoryView":662 * return isinstance(o, memoryview) * * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< * """ * Replace all ellipses with full slices and fill incomplete indices with */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tup); __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_idx); __Pyx_XDECREF(__pyx_v_item); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":696 * return have_slices or nslices, tuple(result) * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: */ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { Py_ssize_t __pyx_v_suboffset; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t *__pyx_t_1; Py_ssize_t *__pyx_t_2; Py_ssize_t *__pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); /* "View.MemoryView":697 * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< * if suboffset >= 0: * raise ValueError("Indirect dimensions not supported") */ __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { __pyx_t_1 = __pyx_t_3; __pyx_v_suboffset = (__pyx_t_1[0]); /* "View.MemoryView":698 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< * raise ValueError("Indirect dimensions not supported") * */ __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); if (unlikely(__pyx_t_4)) { /* "View.MemoryView":699 * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< * * */ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 699, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(2, 699, __pyx_L1_error) /* "View.MemoryView":698 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< * raise ValueError("Indirect dimensions not supported") * */ } } /* "View.MemoryView":696 * return have_slices or nslices, tuple(result) * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":706 * * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< * cdef int new_ndim = 0, suboffset_dim = -1, dim * cdef bint negative_step */ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { int __pyx_v_new_ndim; int __pyx_v_suboffset_dim; int __pyx_v_dim; __Pyx_memviewslice __pyx_v_src; __Pyx_memviewslice __pyx_v_dst; __Pyx_memviewslice *__pyx_v_p_src; struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; __Pyx_memviewslice *__pyx_v_p_dst; int *__pyx_v_p_suboffset_dim; Py_ssize_t __pyx_v_start; Py_ssize_t __pyx_v_stop; Py_ssize_t __pyx_v_step; int __pyx_v_have_start; int __pyx_v_have_stop; int __pyx_v_have_step; PyObject *__pyx_v_index = NULL; struct __pyx_memoryview_obj *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; struct __pyx_memoryview_obj *__pyx_t_4; char *__pyx_t_5; int __pyx_t_6; Py_ssize_t __pyx_t_7; PyObject *(*__pyx_t_8)(PyObject *); PyObject *__pyx_t_9 = NULL; Py_ssize_t __pyx_t_10; int __pyx_t_11; Py_ssize_t __pyx_t_12; __Pyx_RefNannySetupContext("memview_slice", 0); /* "View.MemoryView":707 * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< * cdef bint negative_step * cdef __Pyx_memviewslice src, dst */ __pyx_v_new_ndim = 0; __pyx_v_suboffset_dim = -1; /* "View.MemoryView":714 * * * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< * * cdef _memoryviewslice memviewsliceobj */ (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); /* "View.MemoryView":718 * cdef _memoryviewslice memviewsliceobj * * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< * * if isinstance(memview, _memoryviewslice): */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(2, 718, __pyx_L1_error) } } #endif /* "View.MemoryView":720 * assert memview.view.ndim > 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< * memviewsliceobj = memview * p_src = &memviewsliceobj.from_slice */ __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "View.MemoryView":721 * * if isinstance(memview, _memoryviewslice): * memviewsliceobj = memview # <<<<<<<<<<<<<< * p_src = &memviewsliceobj.from_slice * else: */ if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 721, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_v_memview); __Pyx_INCREF(__pyx_t_3); __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); __pyx_t_3 = 0; /* "View.MemoryView":722 * if isinstance(memview, _memoryviewslice): * memviewsliceobj = memview * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< * else: * slice_copy(memview, &src) */ __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); /* "View.MemoryView":720 * assert memview.view.ndim > 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< * memviewsliceobj = memview * p_src = &memviewsliceobj.from_slice */ goto __pyx_L3; } /* "View.MemoryView":724 * p_src = &memviewsliceobj.from_slice * else: * slice_copy(memview, &src) # <<<<<<<<<<<<<< * p_src = &src * */ /*else*/ { __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); /* "View.MemoryView":725 * else: * slice_copy(memview, &src) * p_src = &src # <<<<<<<<<<<<<< * * */ __pyx_v_p_src = (&__pyx_v_src); } __pyx_L3:; /* "View.MemoryView":731 * * * dst.memview = p_src.memview # <<<<<<<<<<<<<< * dst.data = p_src.data * */ __pyx_t_4 = __pyx_v_p_src->memview; __pyx_v_dst.memview = __pyx_t_4; /* "View.MemoryView":732 * * dst.memview = p_src.memview * dst.data = p_src.data # <<<<<<<<<<<<<< * * */ __pyx_t_5 = __pyx_v_p_src->data; __pyx_v_dst.data = __pyx_t_5; /* "View.MemoryView":737 * * * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< * cdef int *p_suboffset_dim = &suboffset_dim * cdef Py_ssize_t start, stop, step */ __pyx_v_p_dst = (&__pyx_v_dst); /* "View.MemoryView":738 * * cdef __Pyx_memviewslice *p_dst = &dst * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< * cdef Py_ssize_t start, stop, step * cdef bint have_start, have_stop, have_step */ __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); /* "View.MemoryView":742 * cdef bint have_start, have_stop, have_step * * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< * if PyIndex_Check(index): * slice_memviewslice( */ __pyx_t_6 = 0; if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 742, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 742, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 742, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } } else { __pyx_t_9 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_9)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(2, 742, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_9); } __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); __pyx_t_9 = 0; __pyx_v_dim = __pyx_t_6; __pyx_t_6 = (__pyx_t_6 + 1); /* "View.MemoryView":743 * * for dim, index in enumerate(indices): * if PyIndex_Check(index): # <<<<<<<<<<<<<< * slice_memviewslice( * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], */ __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); if (__pyx_t_2) { /* "View.MemoryView":747 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], * dim, new_ndim, p_suboffset_dim, * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< * 0, 0, 0, # have_{start,stop,step} * False) */ __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 747, __pyx_L1_error) /* "View.MemoryView":744 * for dim, index in enumerate(indices): * if PyIndex_Check(index): * slice_memviewslice( # <<<<<<<<<<<<<< * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], * dim, new_ndim, p_suboffset_dim, */ __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 744, __pyx_L1_error) /* "View.MemoryView":743 * * for dim, index in enumerate(indices): * if PyIndex_Check(index): # <<<<<<<<<<<<<< * slice_memviewslice( * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], */ goto __pyx_L6; } /* "View.MemoryView":750 * 0, 0, 0, # have_{start,stop,step} * False) * elif index is None: # <<<<<<<<<<<<<< * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 */ __pyx_t_2 = (__pyx_v_index == Py_None); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* "View.MemoryView":751 * False) * elif index is None: * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 */ (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; /* "View.MemoryView":752 * elif index is None: * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< * p_dst.suboffsets[new_ndim] = -1 * new_ndim += 1 */ (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; /* "View.MemoryView":753 * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< * new_ndim += 1 * else: */ (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; /* "View.MemoryView":754 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 * new_ndim += 1 # <<<<<<<<<<<<<< * else: * start = index.start or 0 */ __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); /* "View.MemoryView":750 * 0, 0, 0, # have_{start,stop,step} * False) * elif index is None: # <<<<<<<<<<<<<< * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 */ goto __pyx_L6; } /* "View.MemoryView":756 * new_ndim += 1 * else: * start = index.start or 0 # <<<<<<<<<<<<<< * stop = index.stop or 0 * step = index.step or 0 */ /*else*/ { __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 756, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 756, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 756, __pyx_L1_error) __pyx_t_10 = __pyx_t_12; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L7_bool_binop_done; } __pyx_t_10 = 0; __pyx_L7_bool_binop_done:; __pyx_v_start = __pyx_t_10; /* "View.MemoryView":757 * else: * start = index.start or 0 * stop = index.stop or 0 # <<<<<<<<<<<<<< * step = index.step or 0 * */ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 757, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 757, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 757, __pyx_L1_error) __pyx_t_10 = __pyx_t_12; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L9_bool_binop_done; } __pyx_t_10 = 0; __pyx_L9_bool_binop_done:; __pyx_v_stop = __pyx_t_10; /* "View.MemoryView":758 * start = index.start or 0 * stop = index.stop or 0 * step = index.step or 0 # <<<<<<<<<<<<<< * * have_start = index.start is not None */ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 758, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 758, __pyx_L1_error) __pyx_t_10 = __pyx_t_12; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L11_bool_binop_done; } __pyx_t_10 = 0; __pyx_L11_bool_binop_done:; __pyx_v_step = __pyx_t_10; /* "View.MemoryView":760 * step = index.step or 0 * * have_start = index.start is not None # <<<<<<<<<<<<<< * have_stop = index.stop is not None * have_step = index.step is not None */ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = (__pyx_t_9 != Py_None); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_have_start = __pyx_t_1; /* "View.MemoryView":761 * * have_start = index.start is not None * have_stop = index.stop is not None # <<<<<<<<<<<<<< * have_step = index.step is not None * */ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = (__pyx_t_9 != Py_None); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_have_stop = __pyx_t_1; /* "View.MemoryView":762 * have_start = index.start is not None * have_stop = index.stop is not None * have_step = index.step is not None # <<<<<<<<<<<<<< * * slice_memviewslice( */ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = (__pyx_t_9 != Py_None); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_have_step = __pyx_t_1; /* "View.MemoryView":764 * have_step = index.step is not None * * slice_memviewslice( # <<<<<<<<<<<<<< * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], * dim, new_ndim, p_suboffset_dim, */ __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 764, __pyx_L1_error) /* "View.MemoryView":770 * have_start, have_stop, have_step, * True) * new_ndim += 1 # <<<<<<<<<<<<<< * * if isinstance(memview, _memoryviewslice): */ __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); } __pyx_L6:; /* "View.MemoryView":742 * cdef bint have_start, have_stop, have_step * * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< * if PyIndex_Check(index): * slice_memviewslice( */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "View.MemoryView":772 * new_ndim += 1 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, */ __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "View.MemoryView":773 * * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< * memviewsliceobj.to_object_func, * memviewsliceobj.to_dtype_func, */ __Pyx_XDECREF(((PyObject *)__pyx_r)); /* "View.MemoryView":774 * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< * memviewsliceobj.to_dtype_func, * memview.dtype_is_object) */ if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 774, __pyx_L1_error) } /* "View.MemoryView":775 * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< * memview.dtype_is_object) * else: */ if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 775, __pyx_L1_error) } /* "View.MemoryView":773 * * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< * memviewsliceobj.to_object_func, * memviewsliceobj.to_dtype_func, */ __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 773, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 773, __pyx_L1_error) __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "View.MemoryView":772 * new_ndim += 1 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, */ } /* "View.MemoryView":778 * memview.dtype_is_object) * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< * memview.dtype_is_object) * */ /*else*/ { __Pyx_XDECREF(((PyObject *)__pyx_r)); /* "View.MemoryView":779 * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 778, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "View.MemoryView":778 * memview.dtype_is_object) * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< * memview.dtype_is_object) * */ if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 778, __pyx_L1_error) __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; } /* "View.MemoryView":706 * * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< * cdef int new_ndim = 0, suboffset_dim = -1, dim * cdef bint negative_step */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); __Pyx_XDECREF(__pyx_v_index); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":803 * * @cname('__pyx_memoryview_slice_memviewslice') * cdef int slice_memviewslice( # <<<<<<<<<<<<<< * __Pyx_memviewslice *dst, * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { Py_ssize_t __pyx_v_new_shape; int __pyx_v_negative_step; int __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; /* "View.MemoryView":823 * cdef bint negative_step * * if not is_slice: # <<<<<<<<<<<<<< * * if start < 0: */ __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); if (__pyx_t_1) { /* "View.MemoryView":825 * if not is_slice: * * if start < 0: # <<<<<<<<<<<<<< * start += shape * if not 0 <= start < shape: */ __pyx_t_1 = ((__pyx_v_start < 0) != 0); if (__pyx_t_1) { /* "View.MemoryView":826 * * if start < 0: * start += shape # <<<<<<<<<<<<<< * if not 0 <= start < shape: * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) */ __pyx_v_start = (__pyx_v_start + __pyx_v_shape); /* "View.MemoryView":825 * if not is_slice: * * if start < 0: # <<<<<<<<<<<<<< * start += shape * if not 0 <= start < shape: */ } /* "View.MemoryView":827 * if start < 0: * start += shape * if not 0 <= start < shape: # <<<<<<<<<<<<<< * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) * else: */ __pyx_t_1 = (0 <= __pyx_v_start); if (__pyx_t_1) { __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); } __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { /* "View.MemoryView":828 * start += shape * if not 0 <= start < shape: * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< * else: * */ __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 828, __pyx_L1_error) /* "View.MemoryView":827 * if start < 0: * start += shape * if not 0 <= start < shape: # <<<<<<<<<<<<<< * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) * else: */ } /* "View.MemoryView":823 * cdef bint negative_step * * if not is_slice: # <<<<<<<<<<<<<< * * if start < 0: */ goto __pyx_L3; } /* "View.MemoryView":831 * else: * * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< * * if have_step and step == 0: */ /*else*/ { __pyx_t_1 = ((__pyx_v_have_step != 0) != 0); if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L6_bool_binop_done; } __pyx_t_1 = ((__pyx_v_step < 0) != 0); __pyx_t_2 = __pyx_t_1; __pyx_L6_bool_binop_done:; __pyx_v_negative_step = __pyx_t_2; /* "View.MemoryView":833 * negative_step = have_step != 0 and step < 0 * * if have_step and step == 0: # <<<<<<<<<<<<<< * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) * */ __pyx_t_1 = (__pyx_v_have_step != 0); if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L9_bool_binop_done; } __pyx_t_1 = ((__pyx_v_step == 0) != 0); __pyx_t_2 = __pyx_t_1; __pyx_L9_bool_binop_done:; if (__pyx_t_2) { /* "View.MemoryView":834 * * if have_step and step == 0: * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< * * */ __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error) /* "View.MemoryView":833 * negative_step = have_step != 0 and step < 0 * * if have_step and step == 0: # <<<<<<<<<<<<<< * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) * */ } /* "View.MemoryView":837 * * * if have_start: # <<<<<<<<<<<<<< * if start < 0: * start += shape */ __pyx_t_2 = (__pyx_v_have_start != 0); if (__pyx_t_2) { /* "View.MemoryView":838 * * if have_start: * if start < 0: # <<<<<<<<<<<<<< * start += shape * if start < 0: */ __pyx_t_2 = ((__pyx_v_start < 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":839 * if have_start: * if start < 0: * start += shape # <<<<<<<<<<<<<< * if start < 0: * start = 0 */ __pyx_v_start = (__pyx_v_start + __pyx_v_shape); /* "View.MemoryView":840 * if start < 0: * start += shape * if start < 0: # <<<<<<<<<<<<<< * start = 0 * elif start >= shape: */ __pyx_t_2 = ((__pyx_v_start < 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":841 * start += shape * if start < 0: * start = 0 # <<<<<<<<<<<<<< * elif start >= shape: * if negative_step: */ __pyx_v_start = 0; /* "View.MemoryView":840 * if start < 0: * start += shape * if start < 0: # <<<<<<<<<<<<<< * start = 0 * elif start >= shape: */ } /* "View.MemoryView":838 * * if have_start: * if start < 0: # <<<<<<<<<<<<<< * start += shape * if start < 0: */ goto __pyx_L12; } /* "View.MemoryView":842 * if start < 0: * start = 0 * elif start >= shape: # <<<<<<<<<<<<<< * if negative_step: * start = shape - 1 */ __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); if (__pyx_t_2) { /* "View.MemoryView":843 * start = 0 * elif start >= shape: * if negative_step: # <<<<<<<<<<<<<< * start = shape - 1 * else: */ __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { /* "View.MemoryView":844 * elif start >= shape: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< * else: * start = shape */ __pyx_v_start = (__pyx_v_shape - 1); /* "View.MemoryView":843 * start = 0 * elif start >= shape: * if negative_step: # <<<<<<<<<<<<<< * start = shape - 1 * else: */ goto __pyx_L14; } /* "View.MemoryView":846 * start = shape - 1 * else: * start = shape # <<<<<<<<<<<<<< * else: * if negative_step: */ /*else*/ { __pyx_v_start = __pyx_v_shape; } __pyx_L14:; /* "View.MemoryView":842 * if start < 0: * start = 0 * elif start >= shape: # <<<<<<<<<<<<<< * if negative_step: * start = shape - 1 */ } __pyx_L12:; /* "View.MemoryView":837 * * * if have_start: # <<<<<<<<<<<<<< * if start < 0: * start += shape */ goto __pyx_L11; } /* "View.MemoryView":848 * start = shape * else: * if negative_step: # <<<<<<<<<<<<<< * start = shape - 1 * else: */ /*else*/ { __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { /* "View.MemoryView":849 * else: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< * else: * start = 0 */ __pyx_v_start = (__pyx_v_shape - 1); /* "View.MemoryView":848 * start = shape * else: * if negative_step: # <<<<<<<<<<<<<< * start = shape - 1 * else: */ goto __pyx_L15; } /* "View.MemoryView":851 * start = shape - 1 * else: * start = 0 # <<<<<<<<<<<<<< * * if have_stop: */ /*else*/ { __pyx_v_start = 0; } __pyx_L15:; } __pyx_L11:; /* "View.MemoryView":853 * start = 0 * * if have_stop: # <<<<<<<<<<<<<< * if stop < 0: * stop += shape */ __pyx_t_2 = (__pyx_v_have_stop != 0); if (__pyx_t_2) { /* "View.MemoryView":854 * * if have_stop: * if stop < 0: # <<<<<<<<<<<<<< * stop += shape * if stop < 0: */ __pyx_t_2 = ((__pyx_v_stop < 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":855 * if have_stop: * if stop < 0: * stop += shape # <<<<<<<<<<<<<< * if stop < 0: * stop = 0 */ __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); /* "View.MemoryView":856 * if stop < 0: * stop += shape * if stop < 0: # <<<<<<<<<<<<<< * stop = 0 * elif stop > shape: */ __pyx_t_2 = ((__pyx_v_stop < 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":857 * stop += shape * if stop < 0: * stop = 0 # <<<<<<<<<<<<<< * elif stop > shape: * stop = shape */ __pyx_v_stop = 0; /* "View.MemoryView":856 * if stop < 0: * stop += shape * if stop < 0: # <<<<<<<<<<<<<< * stop = 0 * elif stop > shape: */ } /* "View.MemoryView":854 * * if have_stop: * if stop < 0: # <<<<<<<<<<<<<< * stop += shape * if stop < 0: */ goto __pyx_L17; } /* "View.MemoryView":858 * if stop < 0: * stop = 0 * elif stop > shape: # <<<<<<<<<<<<<< * stop = shape * else: */ __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); if (__pyx_t_2) { /* "View.MemoryView":859 * stop = 0 * elif stop > shape: * stop = shape # <<<<<<<<<<<<<< * else: * if negative_step: */ __pyx_v_stop = __pyx_v_shape; /* "View.MemoryView":858 * if stop < 0: * stop = 0 * elif stop > shape: # <<<<<<<<<<<<<< * stop = shape * else: */ } __pyx_L17:; /* "View.MemoryView":853 * start = 0 * * if have_stop: # <<<<<<<<<<<<<< * if stop < 0: * stop += shape */ goto __pyx_L16; } /* "View.MemoryView":861 * stop = shape * else: * if negative_step: # <<<<<<<<<<<<<< * stop = -1 * else: */ /*else*/ { __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { /* "View.MemoryView":862 * else: * if negative_step: * stop = -1 # <<<<<<<<<<<<<< * else: * stop = shape */ __pyx_v_stop = -1L; /* "View.MemoryView":861 * stop = shape * else: * if negative_step: # <<<<<<<<<<<<<< * stop = -1 * else: */ goto __pyx_L19; } /* "View.MemoryView":864 * stop = -1 * else: * stop = shape # <<<<<<<<<<<<<< * * if not have_step: */ /*else*/ { __pyx_v_stop = __pyx_v_shape; } __pyx_L19:; } __pyx_L16:; /* "View.MemoryView":866 * stop = shape * * if not have_step: # <<<<<<<<<<<<<< * step = 1 * */ __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); if (__pyx_t_2) { /* "View.MemoryView":867 * * if not have_step: * step = 1 # <<<<<<<<<<<<<< * * */ __pyx_v_step = 1; /* "View.MemoryView":866 * stop = shape * * if not have_step: # <<<<<<<<<<<<<< * step = 1 * */ } /* "View.MemoryView":871 * * with cython.cdivision(True): * new_shape = (stop - start) // step # <<<<<<<<<<<<<< * * if (stop - start) - step * new_shape: */ __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); /* "View.MemoryView":873 * new_shape = (stop - start) // step * * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< * new_shape += 1 * */ __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); if (__pyx_t_2) { /* "View.MemoryView":874 * * if (stop - start) - step * new_shape: * new_shape += 1 # <<<<<<<<<<<<<< * * if new_shape < 0: */ __pyx_v_new_shape = (__pyx_v_new_shape + 1); /* "View.MemoryView":873 * new_shape = (stop - start) // step * * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< * new_shape += 1 * */ } /* "View.MemoryView":876 * new_shape += 1 * * if new_shape < 0: # <<<<<<<<<<<<<< * new_shape = 0 * */ __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":877 * * if new_shape < 0: * new_shape = 0 # <<<<<<<<<<<<<< * * */ __pyx_v_new_shape = 0; /* "View.MemoryView":876 * new_shape += 1 * * if new_shape < 0: # <<<<<<<<<<<<<< * new_shape = 0 * */ } /* "View.MemoryView":880 * * * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< * dst.shape[new_ndim] = new_shape * dst.suboffsets[new_ndim] = suboffset */ (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); /* "View.MemoryView":881 * * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< * dst.suboffsets[new_ndim] = suboffset * */ (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; /* "View.MemoryView":882 * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< * * */ (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; } __pyx_L3:; /* "View.MemoryView":885 * * * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< * dst.data += start * stride * else: */ __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":886 * * if suboffset_dim[0] < 0: * dst.data += start * stride # <<<<<<<<<<<<<< * else: * dst.suboffsets[suboffset_dim[0]] += start * stride */ __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); /* "View.MemoryView":885 * * * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< * dst.data += start * stride * else: */ goto __pyx_L23; } /* "View.MemoryView":888 * dst.data += start * stride * else: * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< * * if suboffset >= 0: */ /*else*/ { __pyx_t_3 = (__pyx_v_suboffset_dim[0]); (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); } __pyx_L23:; /* "View.MemoryView":890 * dst.suboffsets[suboffset_dim[0]] += start * stride * * if suboffset >= 0: # <<<<<<<<<<<<<< * if not is_slice: * if new_ndim == 0: */ __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":891 * * if suboffset >= 0: * if not is_slice: # <<<<<<<<<<<<<< * if new_ndim == 0: * dst.data = ( dst.data)[0] + suboffset */ __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); if (__pyx_t_2) { /* "View.MemoryView":892 * if suboffset >= 0: * if not is_slice: * if new_ndim == 0: # <<<<<<<<<<<<<< * dst.data = ( dst.data)[0] + suboffset * else: */ __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":893 * if not is_slice: * if new_ndim == 0: * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< * else: * _err_dim(IndexError, "All dimensions preceding dimension %d " */ __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); /* "View.MemoryView":892 * if suboffset >= 0: * if not is_slice: * if new_ndim == 0: # <<<<<<<<<<<<<< * dst.data = ( dst.data)[0] + suboffset * else: */ goto __pyx_L26; } /* "View.MemoryView":895 * dst.data = ( dst.data)[0] + suboffset * else: * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< * "must be indexed and not sliced", dim) * else: */ /*else*/ { /* "View.MemoryView":896 * else: * _err_dim(IndexError, "All dimensions preceding dimension %d " * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< * else: * suboffset_dim[0] = new_ndim */ __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 895, __pyx_L1_error) } __pyx_L26:; /* "View.MemoryView":891 * * if suboffset >= 0: * if not is_slice: # <<<<<<<<<<<<<< * if new_ndim == 0: * dst.data = ( dst.data)[0] + suboffset */ goto __pyx_L25; } /* "View.MemoryView":898 * "must be indexed and not sliced", dim) * else: * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< * * return 0 */ /*else*/ { (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; } __pyx_L25:; /* "View.MemoryView":890 * dst.suboffsets[suboffset_dim[0]] += start * stride * * if suboffset >= 0: # <<<<<<<<<<<<<< * if not is_slice: * if new_ndim == 0: */ } /* "View.MemoryView":900 * suboffset_dim[0] = new_ndim * * return 0 # <<<<<<<<<<<<<< * * */ __pyx_r = 0; goto __pyx_L0; /* "View.MemoryView":803 * * @cname('__pyx_memoryview_slice_memviewslice') * cdef int slice_memviewslice( # <<<<<<<<<<<<<< * __Pyx_memviewslice *dst, * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "View.MemoryView":906 * * @cname('__pyx_pybuffer_index') * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 */ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { Py_ssize_t __pyx_v_shape; Py_ssize_t __pyx_v_stride; Py_ssize_t __pyx_v_suboffset; Py_ssize_t __pyx_v_itemsize; char *__pyx_v_resultp; char *__pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("pybuffer_index", 0); /* "View.MemoryView":908 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< * cdef Py_ssize_t itemsize = view.itemsize * cdef char *resultp */ __pyx_v_suboffset = -1L; /* "View.MemoryView":909 * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< * cdef char *resultp * */ __pyx_t_1 = __pyx_v_view->itemsize; __pyx_v_itemsize = __pyx_t_1; /* "View.MemoryView":912 * cdef char *resultp * * if view.ndim == 0: # <<<<<<<<<<<<<< * shape = view.len / itemsize * stride = itemsize */ __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":913 * * if view.ndim == 0: * shape = view.len / itemsize # <<<<<<<<<<<<<< * stride = itemsize * else: */ if (unlikely(__pyx_v_itemsize == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); __PYX_ERR(2, 913, __pyx_L1_error) } else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); __PYX_ERR(2, 913, __pyx_L1_error) } __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); /* "View.MemoryView":914 * if view.ndim == 0: * shape = view.len / itemsize * stride = itemsize # <<<<<<<<<<<<<< * else: * shape = view.shape[dim] */ __pyx_v_stride = __pyx_v_itemsize; /* "View.MemoryView":912 * cdef char *resultp * * if view.ndim == 0: # <<<<<<<<<<<<<< * shape = view.len / itemsize * stride = itemsize */ goto __pyx_L3; } /* "View.MemoryView":916 * stride = itemsize * else: * shape = view.shape[dim] # <<<<<<<<<<<<<< * stride = view.strides[dim] * if view.suboffsets != NULL: */ /*else*/ { __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); /* "View.MemoryView":917 * else: * shape = view.shape[dim] * stride = view.strides[dim] # <<<<<<<<<<<<<< * if view.suboffsets != NULL: * suboffset = view.suboffsets[dim] */ __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); /* "View.MemoryView":918 * shape = view.shape[dim] * stride = view.strides[dim] * if view.suboffsets != NULL: # <<<<<<<<<<<<<< * suboffset = view.suboffsets[dim] * */ __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); if (__pyx_t_2) { /* "View.MemoryView":919 * stride = view.strides[dim] * if view.suboffsets != NULL: * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< * * if index < 0: */ __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); /* "View.MemoryView":918 * shape = view.shape[dim] * stride = view.strides[dim] * if view.suboffsets != NULL: # <<<<<<<<<<<<<< * suboffset = view.suboffsets[dim] * */ } } __pyx_L3:; /* "View.MemoryView":921 * suboffset = view.suboffsets[dim] * * if index < 0: # <<<<<<<<<<<<<< * index += view.shape[dim] * if index < 0: */ __pyx_t_2 = ((__pyx_v_index < 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":922 * * if index < 0: * index += view.shape[dim] # <<<<<<<<<<<<<< * if index < 0: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) */ __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); /* "View.MemoryView":923 * if index < 0: * index += view.shape[dim] * if index < 0: # <<<<<<<<<<<<<< * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * */ __pyx_t_2 = ((__pyx_v_index < 0) != 0); if (unlikely(__pyx_t_2)) { /* "View.MemoryView":924 * index += view.shape[dim] * if index < 0: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * if index >= shape: */ __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 924, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 924, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 924, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(2, 924, __pyx_L1_error) /* "View.MemoryView":923 * if index < 0: * index += view.shape[dim] * if index < 0: # <<<<<<<<<<<<<< * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * */ } /* "View.MemoryView":921 * suboffset = view.suboffsets[dim] * * if index < 0: # <<<<<<<<<<<<<< * index += view.shape[dim] * if index < 0: */ } /* "View.MemoryView":926 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * if index >= shape: # <<<<<<<<<<<<<< * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * */ __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); if (unlikely(__pyx_t_2)) { /* "View.MemoryView":927 * * if index >= shape: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * resultp = bufp + index * stride */ __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 927, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 927, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 927, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(2, 927, __pyx_L1_error) /* "View.MemoryView":926 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * if index >= shape: # <<<<<<<<<<<<<< * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * */ } /* "View.MemoryView":929 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * resultp = bufp + index * stride # <<<<<<<<<<<<<< * if suboffset >= 0: * resultp = ( resultp)[0] + suboffset */ __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); /* "View.MemoryView":930 * * resultp = bufp + index * stride * if suboffset >= 0: # <<<<<<<<<<<<<< * resultp = ( resultp)[0] + suboffset * */ __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":931 * resultp = bufp + index * stride * if suboffset >= 0: * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< * * return resultp */ __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); /* "View.MemoryView":930 * * resultp = bufp + index * stride * if suboffset >= 0: # <<<<<<<<<<<<<< * resultp = ( resultp)[0] + suboffset * */ } /* "View.MemoryView":933 * resultp = ( resultp)[0] + suboffset * * return resultp # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_resultp; goto __pyx_L0; /* "View.MemoryView":906 * * @cname('__pyx_pybuffer_index') * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":939 * * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< * cdef int ndim = memslice.memview.view.ndim * */ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { int __pyx_v_ndim; Py_ssize_t *__pyx_v_shape; Py_ssize_t *__pyx_v_strides; int __pyx_v_i; int __pyx_v_j; int __pyx_r; int __pyx_t_1; Py_ssize_t *__pyx_t_2; long __pyx_t_3; long __pyx_t_4; Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; /* "View.MemoryView":940 * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< * * cdef Py_ssize_t *shape = memslice.shape */ __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; __pyx_v_ndim = __pyx_t_1; /* "View.MemoryView":942 * cdef int ndim = memslice.memview.view.ndim * * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< * cdef Py_ssize_t *strides = memslice.strides * */ __pyx_t_2 = __pyx_v_memslice->shape; __pyx_v_shape = __pyx_t_2; /* "View.MemoryView":943 * * cdef Py_ssize_t *shape = memslice.shape * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< * * */ __pyx_t_2 = __pyx_v_memslice->strides; __pyx_v_strides = __pyx_t_2; /* "View.MemoryView":947 * * cdef int i, j * for i in range(ndim / 2): # <<<<<<<<<<<<<< * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] */ __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); __pyx_t_4 = __pyx_t_3; for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { __pyx_v_i = __pyx_t_1; /* "View.MemoryView":948 * cdef int i, j * for i in range(ndim / 2): * j = ndim - 1 - i # <<<<<<<<<<<<<< * strides[i], strides[j] = strides[j], strides[i] * shape[i], shape[j] = shape[j], shape[i] */ __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); /* "View.MemoryView":949 * for i in range(ndim / 2): * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< * shape[i], shape[j] = shape[j], shape[i] * */ __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; /* "View.MemoryView":950 * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: */ __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; /* "View.MemoryView":952 * shape[i], shape[j] = shape[j], shape[i] * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * */ __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); if (!__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L6_bool_binop_done; } __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); __pyx_t_7 = __pyx_t_8; __pyx_L6_bool_binop_done:; if (__pyx_t_7) { /* "View.MemoryView":953 * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< * * return 1 */ __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 953, __pyx_L1_error) /* "View.MemoryView":952 * shape[i], shape[j] = shape[j], shape[i] * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * */ } } /* "View.MemoryView":955 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * * return 1 # <<<<<<<<<<<<<< * * */ __pyx_r = 1; goto __pyx_L0; /* "View.MemoryView":939 * * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< * cdef int ndim = memslice.memview.view.ndim * */ /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* "View.MemoryView":972 * cdef int (*to_dtype_func)(char *, object) except 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * */ /* Python wrapper */ static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* "View.MemoryView":973 * * def __dealloc__(self): * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< * * cdef convert_item_to_object(self, char *itemp): */ __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); /* "View.MemoryView":972 * cdef int (*to_dtype_func)(char *, object) except 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "View.MemoryView":975 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< * if self.to_object_func != NULL: * return self.to_object_func(itemp) */ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("convert_item_to_object", 0); /* "View.MemoryView":976 * * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: # <<<<<<<<<<<<<< * return self.to_object_func(itemp) * else: */ __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); if (__pyx_t_1) { /* "View.MemoryView":977 * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: * return self.to_object_func(itemp) # <<<<<<<<<<<<<< * else: * return memoryview.convert_item_to_object(self, itemp) */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 977, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "View.MemoryView":976 * * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: # <<<<<<<<<<<<<< * return self.to_object_func(itemp) * else: */ } /* "View.MemoryView":979 * return self.to_object_func(itemp) * else: * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< * * cdef assign_item_from_object(self, char *itemp, object value): */ /*else*/ { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 979, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; } /* "View.MemoryView":975 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< * if self.to_object_func != NULL: * return self.to_object_func(itemp) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":981 * return memoryview.convert_item_to_object(self, itemp) * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< * if self.to_dtype_func != NULL: * self.to_dtype_func(itemp, value) */ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("assign_item_from_object", 0); /* "View.MemoryView":982 * * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< * self.to_dtype_func(itemp, value) * else: */ __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); if (__pyx_t_1) { /* "View.MemoryView":983 * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< * else: * memoryview.assign_item_from_object(self, itemp, value) */ __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 983, __pyx_L1_error) /* "View.MemoryView":982 * * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< * self.to_dtype_func(itemp, value) * else: */ goto __pyx_L3; } /* "View.MemoryView":985 * self.to_dtype_func(itemp, value) * else: * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * * @property */ /*else*/ { __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 985, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_L3:; /* "View.MemoryView":981 * return memoryview.convert_item_to_object(self, itemp) * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< * if self.to_dtype_func != NULL: * self.to_dtype_func(itemp, value) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":988 * * @property * def base(self): # <<<<<<<<<<<<<< * return self.from_object * */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":989 * @property * def base(self): * return self.from_object # <<<<<<<<<<<<<< * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->from_object); __pyx_r = __pyx_v_self->from_object; goto __pyx_L0; /* "View.MemoryView":988 * * @property * def base(self): # <<<<<<<<<<<<<< * return self.from_object * */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(2, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* Python wrapper */ static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(2, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":995 * * @cname('__pyx_memoryview_fromslice') * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< * int ndim, * object (*to_object_func)(char *), */ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; Py_ssize_t __pyx_v_suboffset; PyObject *__pyx_v_length = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_TypeInfo *__pyx_t_4; Py_buffer __pyx_t_5; Py_ssize_t *__pyx_t_6; Py_ssize_t *__pyx_t_7; Py_ssize_t *__pyx_t_8; Py_ssize_t __pyx_t_9; __Pyx_RefNannySetupContext("memoryview_fromslice", 0); /* "View.MemoryView":1003 * cdef _memoryviewslice result * * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< * return None * */ __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); if (__pyx_t_1) { /* "View.MemoryView":1004 * * if memviewslice.memview == Py_None: * return None # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; /* "View.MemoryView":1003 * cdef _memoryviewslice result * * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< * return None * */ } /* "View.MemoryView":1009 * * * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< * * result.from_slice = memviewslice */ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); __pyx_t_2 = 0; /* "View.MemoryView":1011 * result = _memoryviewslice(None, 0, dtype_is_object) * * result.from_slice = memviewslice # <<<<<<<<<<<<<< * __PYX_INC_MEMVIEW(&memviewslice, 1) * */ __pyx_v_result->from_slice = __pyx_v_memviewslice; /* "View.MemoryView":1012 * * result.from_slice = memviewslice * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< * * result.from_object = ( memviewslice.memview).base */ __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); /* "View.MemoryView":1014 * __PYX_INC_MEMVIEW(&memviewslice, 1) * * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< * result.typeinfo = memviewslice.memview.typeinfo * */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1014, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_result->from_object); __Pyx_DECREF(__pyx_v_result->from_object); __pyx_v_result->from_object = __pyx_t_2; __pyx_t_2 = 0; /* "View.MemoryView":1015 * * result.from_object = ( memviewslice.memview).base * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< * * result.view = memviewslice.memview.view */ __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; /* "View.MemoryView":1017 * result.typeinfo = memviewslice.memview.typeinfo * * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< * result.view.buf = memviewslice.data * result.view.ndim = ndim */ __pyx_t_5 = __pyx_v_memviewslice.memview->view; __pyx_v_result->__pyx_base.view = __pyx_t_5; /* "View.MemoryView":1018 * * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None */ __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); /* "View.MemoryView":1019 * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data * result.view.ndim = ndim # <<<<<<<<<<<<<< * (<__pyx_buffer *> &result.view).obj = Py_None * Py_INCREF(Py_None) */ __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; /* "View.MemoryView":1020 * result.view.buf = memviewslice.data * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< * Py_INCREF(Py_None) * */ ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; /* "View.MemoryView":1021 * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< * * if (memviewslice.memview).flags & PyBUF_WRITABLE: */ Py_INCREF(Py_None); /* "View.MemoryView":1023 * Py_INCREF(Py_None) * * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< * result.flags = PyBUF_RECORDS * else: */ __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); if (__pyx_t_1) { /* "View.MemoryView":1024 * * if (memviewslice.memview).flags & PyBUF_WRITABLE: * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< * else: * result.flags = PyBUF_RECORDS_RO */ __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; /* "View.MemoryView":1023 * Py_INCREF(Py_None) * * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< * result.flags = PyBUF_RECORDS * else: */ goto __pyx_L4; } /* "View.MemoryView":1026 * result.flags = PyBUF_RECORDS * else: * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< * * result.view.shape = result.from_slice.shape */ /*else*/ { __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; } __pyx_L4:; /* "View.MemoryView":1028 * result.flags = PyBUF_RECORDS_RO * * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< * result.view.strides = result.from_slice.strides * */ __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); /* "View.MemoryView":1029 * * result.view.shape = result.from_slice.shape * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< * * */ __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); /* "View.MemoryView":1032 * * * result.view.suboffsets = NULL # <<<<<<<<<<<<<< * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: */ __pyx_v_result->__pyx_base.view.suboffsets = NULL; /* "View.MemoryView":1033 * * result.view.suboffsets = NULL * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< * if suboffset >= 0: * result.view.suboffsets = result.from_slice.suboffsets */ __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { __pyx_t_6 = __pyx_t_8; __pyx_v_suboffset = (__pyx_t_6[0]); /* "View.MemoryView":1034 * result.view.suboffsets = NULL * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< * result.view.suboffsets = result.from_slice.suboffsets * break */ __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_1) { /* "View.MemoryView":1035 * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< * break * */ __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); /* "View.MemoryView":1036 * if suboffset >= 0: * result.view.suboffsets = result.from_slice.suboffsets * break # <<<<<<<<<<<<<< * * result.view.len = result.view.itemsize */ goto __pyx_L6_break; /* "View.MemoryView":1034 * result.view.suboffsets = NULL * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< * result.view.suboffsets = result.from_slice.suboffsets * break */ } } __pyx_L6_break:; /* "View.MemoryView":1038 * break * * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< * for length in result.view.shape[:ndim]: * result.view.len *= length */ __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; __pyx_v_result->__pyx_base.view.len = __pyx_t_9; /* "View.MemoryView":1039 * * result.view.len = result.view.itemsize * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< * result.view.len *= length * */ __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { __pyx_t_6 = __pyx_t_8; __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1039, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); __pyx_t_2 = 0; /* "View.MemoryView":1040 * result.view.len = result.view.itemsize * for length in result.view.shape[:ndim]: * result.view.len *= length # <<<<<<<<<<<<<< * * result.to_object_func = to_object_func */ __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1040, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1040, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1040, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result->__pyx_base.view.len = __pyx_t_9; } /* "View.MemoryView":1042 * result.view.len *= length * * result.to_object_func = to_object_func # <<<<<<<<<<<<<< * result.to_dtype_func = to_dtype_func * */ __pyx_v_result->to_object_func = __pyx_v_to_object_func; /* "View.MemoryView":1043 * * result.to_object_func = to_object_func * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< * * return result */ __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; /* "View.MemoryView":1045 * result.to_dtype_func = to_dtype_func * * return result # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_get_slice_from_memoryview') */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; /* "View.MemoryView":995 * * @cname('__pyx_memoryview_fromslice') * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< * int ndim, * object (*to_object_func)(char *), */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":1048 * * @cname('__pyx_memoryview_get_slice_from_memoryview') * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj */ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; __Pyx_memviewslice *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("get_slice_from_memview", 0); /* "View.MemoryView":1051 * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< * obj = memview * return &obj.from_slice */ __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "View.MemoryView":1052 * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): * obj = memview # <<<<<<<<<<<<<< * return &obj.from_slice * else: */ if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1052, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_v_memview); __Pyx_INCREF(__pyx_t_3); __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); __pyx_t_3 = 0; /* "View.MemoryView":1053 * if isinstance(memview, _memoryviewslice): * obj = memview * return &obj.from_slice # <<<<<<<<<<<<<< * else: * slice_copy(memview, mslice) */ __pyx_r = (&__pyx_v_obj->from_slice); goto __pyx_L0; /* "View.MemoryView":1051 * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< * obj = memview * return &obj.from_slice */ } /* "View.MemoryView":1055 * return &obj.from_slice * else: * slice_copy(memview, mslice) # <<<<<<<<<<<<<< * return mslice * */ /*else*/ { __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); /* "View.MemoryView":1056 * else: * slice_copy(memview, mslice) * return mslice # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_slice_copy') */ __pyx_r = __pyx_v_mslice; goto __pyx_L0; } /* "View.MemoryView":1048 * * @cname('__pyx_memoryview_get_slice_from_memoryview') * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_obj); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":1059 * * @cname('__pyx_memoryview_slice_copy') * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< * cdef int dim * cdef (Py_ssize_t*) shape, strides, suboffsets */ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { int __pyx_v_dim; Py_ssize_t *__pyx_v_shape; Py_ssize_t *__pyx_v_strides; Py_ssize_t *__pyx_v_suboffsets; __Pyx_RefNannyDeclarations Py_ssize_t *__pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; Py_ssize_t __pyx_t_5; __Pyx_RefNannySetupContext("slice_copy", 0); /* "View.MemoryView":1063 * cdef (Py_ssize_t*) shape, strides, suboffsets * * shape = memview.view.shape # <<<<<<<<<<<<<< * strides = memview.view.strides * suboffsets = memview.view.suboffsets */ __pyx_t_1 = __pyx_v_memview->view.shape; __pyx_v_shape = __pyx_t_1; /* "View.MemoryView":1064 * * shape = memview.view.shape * strides = memview.view.strides # <<<<<<<<<<<<<< * suboffsets = memview.view.suboffsets * */ __pyx_t_1 = __pyx_v_memview->view.strides; __pyx_v_strides = __pyx_t_1; /* "View.MemoryView":1065 * shape = memview.view.shape * strides = memview.view.strides * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< * * dst.memview = <__pyx_memoryview *> memview */ __pyx_t_1 = __pyx_v_memview->view.suboffsets; __pyx_v_suboffsets = __pyx_t_1; /* "View.MemoryView":1067 * suboffsets = memview.view.suboffsets * * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< * dst.data = memview.view.buf * */ __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); /* "View.MemoryView":1068 * * dst.memview = <__pyx_memoryview *> memview * dst.data = memview.view.buf # <<<<<<<<<<<<<< * * for dim in range(memview.view.ndim): */ __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); /* "View.MemoryView":1070 * dst.data = memview.view.buf * * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] */ __pyx_t_2 = __pyx_v_memview->view.ndim; __pyx_t_3 = __pyx_t_2; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_dim = __pyx_t_4; /* "View.MemoryView":1071 * * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< * dst.strides[dim] = strides[dim] * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 */ (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); /* "View.MemoryView":1072 * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 * */ (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); /* "View.MemoryView":1073 * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_copy_object') */ if ((__pyx_v_suboffsets != 0)) { __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); } else { __pyx_t_5 = -1L; } (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; } /* "View.MemoryView":1059 * * @cname('__pyx_memoryview_slice_copy') * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< * cdef int dim * cdef (Py_ssize_t*) shape, strides, suboffsets */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "View.MemoryView":1076 * * @cname('__pyx_memoryview_copy_object') * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< * "Create a new memoryview object" * cdef __Pyx_memviewslice memviewslice */ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { __Pyx_memviewslice __pyx_v_memviewslice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("memoryview_copy", 0); /* "View.MemoryView":1079 * "Create a new memoryview object" * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< * return memoryview_copy_from_slice(memview, &memviewslice) * */ __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); /* "View.MemoryView":1080 * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_copy_object_from_slice') */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1080, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "View.MemoryView":1076 * * @cname('__pyx_memoryview_copy_object') * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< * "Create a new memoryview object" * cdef __Pyx_memviewslice memviewslice */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":1083 * * @cname('__pyx_memoryview_copy_object_from_slice') * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< * """ * Create a new memoryview object from a given memoryview object and slice. */ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { PyObject *(*__pyx_v_to_object_func)(char *); int (*__pyx_v_to_dtype_func)(char *, PyObject *); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *(*__pyx_t_3)(char *); int (*__pyx_t_4)(char *, PyObject *); PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); /* "View.MemoryView":1090 * cdef int (*to_dtype_func)(char *, object) except 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< * to_object_func = (<_memoryviewslice> memview).to_object_func * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "View.MemoryView":1091 * * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func * else: */ __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; __pyx_v_to_object_func = __pyx_t_3; /* "View.MemoryView":1092 * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< * else: * to_object_func = NULL */ __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; __pyx_v_to_dtype_func = __pyx_t_4; /* "View.MemoryView":1090 * cdef int (*to_dtype_func)(char *, object) except 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< * to_object_func = (<_memoryviewslice> memview).to_object_func * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ goto __pyx_L3; } /* "View.MemoryView":1094 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func * else: * to_object_func = NULL # <<<<<<<<<<<<<< * to_dtype_func = NULL * */ /*else*/ { __pyx_v_to_object_func = NULL; /* "View.MemoryView":1095 * else: * to_object_func = NULL * to_dtype_func = NULL # <<<<<<<<<<<<<< * * return memoryview_fromslice(memviewslice[0], memview.view.ndim, */ __pyx_v_to_dtype_func = NULL; } __pyx_L3:; /* "View.MemoryView":1097 * to_dtype_func = NULL * * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< * to_object_func, to_dtype_func, * memview.dtype_is_object) */ __Pyx_XDECREF(__pyx_r); /* "View.MemoryView":1099 * return memoryview_fromslice(memviewslice[0], memview.view.ndim, * to_object_func, to_dtype_func, * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1097, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; /* "View.MemoryView":1083 * * @cname('__pyx_memoryview_copy_object_from_slice') * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< * """ * Create a new memoryview object from a given memoryview object and slice. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "View.MemoryView":1105 * * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< * if arg < 0: * return -arg */ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { Py_ssize_t __pyx_r; int __pyx_t_1; /* "View.MemoryView":1106 * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: # <<<<<<<<<<<<<< * return -arg * else: */ __pyx_t_1 = ((__pyx_v_arg < 0) != 0); if (__pyx_t_1) { /* "View.MemoryView":1107 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: * return -arg # <<<<<<<<<<<<<< * else: * return arg */ __pyx_r = (-__pyx_v_arg); goto __pyx_L0; /* "View.MemoryView":1106 * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: # <<<<<<<<<<<<<< * return -arg * else: */ } /* "View.MemoryView":1109 * return -arg * else: * return arg # <<<<<<<<<<<<<< * * @cname('__pyx_get_best_slice_order') */ /*else*/ { __pyx_r = __pyx_v_arg; goto __pyx_L0; } /* "View.MemoryView":1105 * * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< * if arg < 0: * return -arg */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "View.MemoryView":1112 * * @cname('__pyx_get_best_slice_order') * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< * """ * Figure out the best memory access order for a given slice. */ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { int __pyx_v_i; Py_ssize_t __pyx_v_c_stride; Py_ssize_t __pyx_v_f_stride; char __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; /* "View.MemoryView":1117 * """ * cdef int i * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< * cdef Py_ssize_t f_stride = 0 * */ __pyx_v_c_stride = 0; /* "View.MemoryView":1118 * cdef int i * cdef Py_ssize_t c_stride = 0 * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< * * for i in range(ndim - 1, -1, -1): */ __pyx_v_f_stride = 0; /* "View.MemoryView":1120 * cdef Py_ssize_t f_stride = 0 * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] */ for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { __pyx_v_i = __pyx_t_1; /* "View.MemoryView":1121 * * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< * c_stride = mslice.strides[i] * break */ __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); if (__pyx_t_2) { /* "View.MemoryView":1122 * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< * break * */ __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); /* "View.MemoryView":1123 * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< * * for i in range(ndim): */ goto __pyx_L4_break; /* "View.MemoryView":1121 * * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< * c_stride = mslice.strides[i] * break */ } } __pyx_L4_break:; /* "View.MemoryView":1125 * break * * for i in range(ndim): # <<<<<<<<<<<<<< * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] */ __pyx_t_1 = __pyx_v_ndim; __pyx_t_3 = __pyx_t_1; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; /* "View.MemoryView":1126 * * for i in range(ndim): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< * f_stride = mslice.strides[i] * break */ __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); if (__pyx_t_2) { /* "View.MemoryView":1127 * for i in range(ndim): * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< * break * */ __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); /* "View.MemoryView":1128 * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): */ goto __pyx_L7_break; /* "View.MemoryView":1126 * * for i in range(ndim): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< * f_stride = mslice.strides[i] * break */ } } __pyx_L7_break:; /* "View.MemoryView":1130 * break * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< * return 'C' * else: */ __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); if (__pyx_t_2) { /* "View.MemoryView":1131 * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): * return 'C' # <<<<<<<<<<<<<< * else: * return 'F' */ __pyx_r = 'C'; goto __pyx_L0; /* "View.MemoryView":1130 * break * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< * return 'C' * else: */ } /* "View.MemoryView":1133 * return 'C' * else: * return 'F' # <<<<<<<<<<<<<< * * @cython.cdivision(True) */ /*else*/ { __pyx_r = 'F'; goto __pyx_L0; } /* "View.MemoryView":1112 * * @cname('__pyx_get_best_slice_order') * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< * """ * Figure out the best memory access order for a given slice. */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "View.MemoryView":1136 * * @cython.cdivision(True) * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< * char *dst_data, Py_ssize_t *dst_strides, * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { CYTHON_UNUSED Py_ssize_t __pyx_v_i; CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; Py_ssize_t __pyx_v_dst_extent; Py_ssize_t __pyx_v_src_stride; Py_ssize_t __pyx_v_dst_stride; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; /* "View.MemoryView":1143 * * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< * cdef Py_ssize_t dst_extent = dst_shape[0] * cdef Py_ssize_t src_stride = src_strides[0] */ __pyx_v_src_extent = (__pyx_v_src_shape[0]); /* "View.MemoryView":1144 * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< * cdef Py_ssize_t src_stride = src_strides[0] * cdef Py_ssize_t dst_stride = dst_strides[0] */ __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); /* "View.MemoryView":1145 * cdef Py_ssize_t src_extent = src_shape[0] * cdef Py_ssize_t dst_extent = dst_shape[0] * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< * cdef Py_ssize_t dst_stride = dst_strides[0] * */ __pyx_v_src_stride = (__pyx_v_src_strides[0]); /* "View.MemoryView":1146 * cdef Py_ssize_t dst_extent = dst_shape[0] * cdef Py_ssize_t src_stride = src_strides[0] * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< * * if ndim == 1: */ __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); /* "View.MemoryView":1148 * cdef Py_ssize_t dst_stride = dst_strides[0] * * if ndim == 1: # <<<<<<<<<<<<<< * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): */ __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_1) { /* "View.MemoryView":1149 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< * src_stride == itemsize == dst_stride): * memcpy(dst_data, src_data, itemsize * dst_extent) */ __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L5_bool_binop_done; } __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L5_bool_binop_done; } /* "View.MemoryView":1150 * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< * memcpy(dst_data, src_data, itemsize * dst_extent) * else: */ __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); if (__pyx_t_2) { __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); } __pyx_t_3 = (__pyx_t_2 != 0); __pyx_t_1 = __pyx_t_3; __pyx_L5_bool_binop_done:; /* "View.MemoryView":1149 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< * src_stride == itemsize == dst_stride): * memcpy(dst_data, src_data, itemsize * dst_extent) */ if (__pyx_t_1) { /* "View.MemoryView":1151 * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< * else: * for i in range(dst_extent): */ (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); /* "View.MemoryView":1149 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< * src_stride == itemsize == dst_stride): * memcpy(dst_data, src_data, itemsize * dst_extent) */ goto __pyx_L4; } /* "View.MemoryView":1153 * memcpy(dst_data, src_data, itemsize * dst_extent) * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< * memcpy(dst_data, src_data, itemsize) * src_data += src_stride */ /*else*/ { __pyx_t_4 = __pyx_v_dst_extent; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "View.MemoryView":1154 * else: * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< * src_data += src_stride * dst_data += dst_stride */ (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); /* "View.MemoryView":1155 * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< * dst_data += dst_stride * else: */ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); /* "View.MemoryView":1156 * memcpy(dst_data, src_data, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< * else: * for i in range(dst_extent): */ __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); } } __pyx_L4:; /* "View.MemoryView":1148 * cdef Py_ssize_t dst_stride = dst_strides[0] * * if ndim == 1: # <<<<<<<<<<<<<< * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): */ goto __pyx_L3; } /* "View.MemoryView":1158 * dst_data += dst_stride * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< * _copy_strided_to_strided(src_data, src_strides + 1, * dst_data, dst_strides + 1, */ /*else*/ { __pyx_t_4 = __pyx_v_dst_extent; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "View.MemoryView":1159 * else: * for i in range(dst_extent): * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< * dst_data, dst_strides + 1, * src_shape + 1, dst_shape + 1, */ _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); /* "View.MemoryView":1163 * src_shape + 1, dst_shape + 1, * ndim - 1, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< * dst_data += dst_stride * */ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); /* "View.MemoryView":1164 * ndim - 1, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, */ __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); } } __pyx_L3:; /* "View.MemoryView":1136 * * @cython.cdivision(True) * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< * char *dst_data, Py_ssize_t *dst_strides, * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ /* function exit code */ } /* "View.MemoryView":1166 * dst_data += dst_stride * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< * __Pyx_memviewslice *dst, * int ndim, size_t itemsize) nogil: */ static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { /* "View.MemoryView":1169 * __Pyx_memviewslice *dst, * int ndim, size_t itemsize) nogil: * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< * src.shape, dst.shape, ndim, itemsize) * */ _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); /* "View.MemoryView":1166 * dst_data += dst_stride * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< * __Pyx_memviewslice *dst, * int ndim, size_t itemsize) nogil: */ /* function exit code */ } /* "View.MemoryView":1173 * * @cname('__pyx_memoryview_slice_get_size') * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< * "Return the size of the memory occupied by the slice in number of bytes" * cdef int i */ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { int __pyx_v_i; Py_ssize_t __pyx_v_size; Py_ssize_t __pyx_r; Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; /* "View.MemoryView":1176 * "Return the size of the memory occupied by the slice in number of bytes" * cdef int i * cdef Py_ssize_t size = src.memview.view.itemsize # <<<<<<<<<<<<<< * * for i in range(ndim): */ __pyx_t_1 = __pyx_v_src->memview->view.itemsize; __pyx_v_size = __pyx_t_1; /* "View.MemoryView":1178 * cdef Py_ssize_t size = src.memview.view.itemsize * * for i in range(ndim): # <<<<<<<<<<<<<< * size *= src.shape[i] * */ __pyx_t_2 = __pyx_v_ndim; __pyx_t_3 = __pyx_t_2; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; /* "View.MemoryView":1179 * * for i in range(ndim): * size *= src.shape[i] # <<<<<<<<<<<<<< * * return size */ __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i])); } /* "View.MemoryView":1181 * size *= src.shape[i] * * return size # <<<<<<<<<<<<<< * * @cname('__pyx_fill_contig_strides_array') */ __pyx_r = __pyx_v_size; goto __pyx_L0; /* "View.MemoryView":1173 * * @cname('__pyx_memoryview_slice_get_size') * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< * "Return the size of the memory occupied by the slice in number of bytes" * cdef int i */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "View.MemoryView":1184 * * @cname('__pyx_fill_contig_strides_array') * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, * int ndim, char order) nogil: */ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { int __pyx_v_idx; Py_ssize_t __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; /* "View.MemoryView":1193 * cdef int idx * * if order == 'F': # <<<<<<<<<<<<<< * for idx in range(ndim): * strides[idx] = stride */ __pyx_t_1 = ((__pyx_v_order == 'F') != 0); if (__pyx_t_1) { /* "View.MemoryView":1194 * * if order == 'F': * for idx in range(ndim): # <<<<<<<<<<<<<< * strides[idx] = stride * stride = stride * shape[idx] */ __pyx_t_2 = __pyx_v_ndim; __pyx_t_3 = __pyx_t_2; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_idx = __pyx_t_4; /* "View.MemoryView":1195 * if order == 'F': * for idx in range(ndim): * strides[idx] = stride # <<<<<<<<<<<<<< * stride = stride * shape[idx] * else: */ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; /* "View.MemoryView":1196 * for idx in range(ndim): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< * else: * for idx in range(ndim - 1, -1, -1): */ __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } /* "View.MemoryView":1193 * cdef int idx * * if order == 'F': # <<<<<<<<<<<<<< * for idx in range(ndim): * strides[idx] = stride */ goto __pyx_L3; } /* "View.MemoryView":1198 * stride = stride * shape[idx] * else: * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< * strides[idx] = stride * stride = stride * shape[idx] */ /*else*/ { for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { __pyx_v_idx = __pyx_t_2; /* "View.MemoryView":1199 * else: * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride # <<<<<<<<<<<<<< * stride = stride * shape[idx] * */ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; /* "View.MemoryView":1200 * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< * * return stride */ __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } } __pyx_L3:; /* "View.MemoryView":1202 * stride = stride * shape[idx] * * return stride # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_copy_data_to_temp') */ __pyx_r = __pyx_v_stride; goto __pyx_L0; /* "View.MemoryView":1184 * * @cname('__pyx_fill_contig_strides_array') * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, * int ndim, char order) nogil: */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "View.MemoryView":1205 * * @cname('__pyx_memoryview_copy_data_to_temp') * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< * __Pyx_memviewslice *tmpslice, * char order, */ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { int __pyx_v_i; void *__pyx_v_result; size_t __pyx_v_itemsize; size_t __pyx_v_size; void *__pyx_r; Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; struct __pyx_memoryview_obj *__pyx_t_4; int __pyx_t_5; int __pyx_t_6; /* "View.MemoryView":1216 * cdef void *result * * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< * cdef size_t size = slice_get_size(src, ndim) * */ __pyx_t_1 = __pyx_v_src->memview->view.itemsize; __pyx_v_itemsize = __pyx_t_1; /* "View.MemoryView":1217 * * cdef size_t itemsize = src.memview.view.itemsize * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< * * result = malloc(size) */ __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); /* "View.MemoryView":1219 * cdef size_t size = slice_get_size(src, ndim) * * result = malloc(size) # <<<<<<<<<<<<<< * if not result: * _err(MemoryError, NULL) */ __pyx_v_result = malloc(__pyx_v_size); /* "View.MemoryView":1220 * * result = malloc(size) * if not result: # <<<<<<<<<<<<<< * _err(MemoryError, NULL) * */ __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); if (__pyx_t_2) { /* "View.MemoryView":1221 * result = malloc(size) * if not result: * _err(MemoryError, NULL) # <<<<<<<<<<<<<< * * */ __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1221, __pyx_L1_error) /* "View.MemoryView":1220 * * result = malloc(size) * if not result: # <<<<<<<<<<<<<< * _err(MemoryError, NULL) * */ } /* "View.MemoryView":1224 * * * tmpslice.data = result # <<<<<<<<<<<<<< * tmpslice.memview = src.memview * for i in range(ndim): */ __pyx_v_tmpslice->data = ((char *)__pyx_v_result); /* "View.MemoryView":1225 * * tmpslice.data = result * tmpslice.memview = src.memview # <<<<<<<<<<<<<< * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] */ __pyx_t_4 = __pyx_v_src->memview; __pyx_v_tmpslice->memview = __pyx_t_4; /* "View.MemoryView":1226 * tmpslice.data = result * tmpslice.memview = src.memview * for i in range(ndim): # <<<<<<<<<<<<<< * tmpslice.shape[i] = src.shape[i] * tmpslice.suboffsets[i] = -1 */ __pyx_t_3 = __pyx_v_ndim; __pyx_t_5 = __pyx_t_3; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "View.MemoryView":1227 * tmpslice.memview = src.memview * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< * tmpslice.suboffsets[i] = -1 * */ (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); /* "View.MemoryView":1228 * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, */ (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; } /* "View.MemoryView":1230 * tmpslice.suboffsets[i] = -1 * * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< * ndim, order) * */ (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); /* "View.MemoryView":1234 * * * for i in range(ndim): # <<<<<<<<<<<<<< * if tmpslice.shape[i] == 1: * tmpslice.strides[i] = 0 */ __pyx_t_3 = __pyx_v_ndim; __pyx_t_5 = __pyx_t_3; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "View.MemoryView":1235 * * for i in range(ndim): * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< * tmpslice.strides[i] = 0 * */ __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); if (__pyx_t_2) { /* "View.MemoryView":1236 * for i in range(ndim): * if tmpslice.shape[i] == 1: * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< * * if slice_is_contig(src[0], order, ndim): */ (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; /* "View.MemoryView":1235 * * for i in range(ndim): * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< * tmpslice.strides[i] = 0 * */ } } /* "View.MemoryView":1238 * tmpslice.strides[i] = 0 * * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< * memcpy(result, src.data, size) * else: */ __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); if (__pyx_t_2) { /* "View.MemoryView":1239 * * if slice_is_contig(src[0], order, ndim): * memcpy(result, src.data, size) # <<<<<<<<<<<<<< * else: * copy_strided_to_strided(src, tmpslice, ndim, itemsize) */ (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); /* "View.MemoryView":1238 * tmpslice.strides[i] = 0 * * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< * memcpy(result, src.data, size) * else: */ goto __pyx_L9; } /* "View.MemoryView":1241 * memcpy(result, src.data, size) * else: * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< * * return result */ /*else*/ { copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); } __pyx_L9:; /* "View.MemoryView":1243 * copy_strided_to_strided(src, tmpslice, ndim, itemsize) * * return result # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_result; goto __pyx_L0; /* "View.MemoryView":1205 * * @cname('__pyx_memoryview_copy_data_to_temp') * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< * __Pyx_memviewslice *tmpslice, * char order, */ /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = NULL; __pyx_L0:; return __pyx_r; } /* "View.MemoryView":1248 * * @cname('__pyx_memoryview_err_extents') * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< * Py_ssize_t extent2) except -1 with gil: * raise ValueError("got differing extents in dimension %d (got %d and %d)" % */ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err_extents", 0); /* "View.MemoryView":1251 * Py_ssize_t extent2) except -1 with gil: * raise ValueError("got differing extents in dimension %d (got %d and %d)" % * (i, extent1, extent2)) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_err_dim') */ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; /* "View.MemoryView":1250 * cdef int _err_extents(int i, Py_ssize_t extent1, * Py_ssize_t extent2) except -1 with gil: * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< * (i, extent1, extent2)) * */ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(2, 1250, __pyx_L1_error) /* "View.MemoryView":1248 * * @cname('__pyx_memoryview_err_extents') * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< * Py_ssize_t extent2) except -1 with gil: * raise ValueError("got differing extents in dimension %d (got %d and %d)" % */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "View.MemoryView":1254 * * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< * raise error(msg.decode('ascii') % dim) * */ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err_dim", 0); __Pyx_INCREF(__pyx_v_error); /* "View.MemoryView":1255 * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_err') */ __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_v_error); __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(2, 1255, __pyx_L1_error) /* "View.MemoryView":1254 * * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< * raise error(msg.decode('ascii') % dim) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "View.MemoryView":1258 * * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< * if msg != NULL: * raise error(msg.decode('ascii')) */ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err", 0); __Pyx_INCREF(__pyx_v_error); /* "View.MemoryView":1259 * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: # <<<<<<<<<<<<<< * raise error(msg.decode('ascii')) * else: */ __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); if (unlikely(__pyx_t_1)) { /* "View.MemoryView":1260 * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< * else: * raise error */ __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_error); __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(2, 1260, __pyx_L1_error) /* "View.MemoryView":1259 * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: # <<<<<<<<<<<<<< * raise error(msg.decode('ascii')) * else: */ } /* "View.MemoryView":1262 * raise error(msg.decode('ascii')) * else: * raise error # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_copy_contents') */ /*else*/ { __Pyx_Raise(__pyx_v_error, 0, 0, 0); __PYX_ERR(2, 1262, __pyx_L1_error) } /* "View.MemoryView":1258 * * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< * if msg != NULL: * raise error(msg.decode('ascii')) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "View.MemoryView":1265 * * @cname('__pyx_memoryview_copy_contents') * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< * __Pyx_memviewslice dst, * int src_ndim, int dst_ndim, */ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { void *__pyx_v_tmpdata; size_t __pyx_v_itemsize; int __pyx_v_i; char __pyx_v_order; int __pyx_v_broadcasting; int __pyx_v_direct_copy; __Pyx_memviewslice __pyx_v_tmp; int __pyx_v_ndim; int __pyx_r; Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; void *__pyx_t_7; int __pyx_t_8; /* "View.MemoryView":1273 * Check for overlapping memory and verify the shapes. * """ * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< * cdef size_t itemsize = src.memview.view.itemsize * cdef int i */ __pyx_v_tmpdata = NULL; /* "View.MemoryView":1274 * """ * cdef void *tmpdata = NULL * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< * cdef int i * cdef char order = get_best_order(&src, src_ndim) */ __pyx_t_1 = __pyx_v_src.memview->view.itemsize; __pyx_v_itemsize = __pyx_t_1; /* "View.MemoryView":1276 * cdef size_t itemsize = src.memview.view.itemsize * cdef int i * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< * cdef bint broadcasting = False * cdef bint direct_copy = False */ __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); /* "View.MemoryView":1277 * cdef int i * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False # <<<<<<<<<<<<<< * cdef bint direct_copy = False * cdef __Pyx_memviewslice tmp */ __pyx_v_broadcasting = 0; /* "View.MemoryView":1278 * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False * cdef bint direct_copy = False # <<<<<<<<<<<<<< * cdef __Pyx_memviewslice tmp * */ __pyx_v_direct_copy = 0; /* "View.MemoryView":1281 * cdef __Pyx_memviewslice tmp * * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: */ __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); if (__pyx_t_2) { /* "View.MemoryView":1282 * * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< * elif dst_ndim < src_ndim: * broadcast_leading(&dst, dst_ndim, src_ndim) */ __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); /* "View.MemoryView":1281 * cdef __Pyx_memviewslice tmp * * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: */ goto __pyx_L3; } /* "View.MemoryView":1283 * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< * broadcast_leading(&dst, dst_ndim, src_ndim) * */ __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); if (__pyx_t_2) { /* "View.MemoryView":1284 * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< * * cdef int ndim = max(src_ndim, dst_ndim) */ __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); /* "View.MemoryView":1283 * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< * broadcast_leading(&dst, dst_ndim, src_ndim) * */ } __pyx_L3:; /* "View.MemoryView":1286 * broadcast_leading(&dst, dst_ndim, src_ndim) * * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< * * for i in range(ndim): */ __pyx_t_3 = __pyx_v_dst_ndim; __pyx_t_4 = __pyx_v_src_ndim; if (((__pyx_t_3 > __pyx_t_4) != 0)) { __pyx_t_5 = __pyx_t_3; } else { __pyx_t_5 = __pyx_t_4; } __pyx_v_ndim = __pyx_t_5; /* "View.MemoryView":1288 * cdef int ndim = max(src_ndim, dst_ndim) * * for i in range(ndim): # <<<<<<<<<<<<<< * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: */ __pyx_t_5 = __pyx_v_ndim; __pyx_t_3 = __pyx_t_5; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; /* "View.MemoryView":1289 * * for i in range(ndim): * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< * if src.shape[i] == 1: * broadcasting = True */ __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); if (__pyx_t_2) { /* "View.MemoryView":1290 * for i in range(ndim): * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: # <<<<<<<<<<<<<< * broadcasting = True * src.strides[i] = 0 */ __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); if (__pyx_t_2) { /* "View.MemoryView":1291 * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: * broadcasting = True # <<<<<<<<<<<<<< * src.strides[i] = 0 * else: */ __pyx_v_broadcasting = 1; /* "View.MemoryView":1292 * if src.shape[i] == 1: * broadcasting = True * src.strides[i] = 0 # <<<<<<<<<<<<<< * else: * _err_extents(i, dst.shape[i], src.shape[i]) */ (__pyx_v_src.strides[__pyx_v_i]) = 0; /* "View.MemoryView":1290 * for i in range(ndim): * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: # <<<<<<<<<<<<<< * broadcasting = True * src.strides[i] = 0 */ goto __pyx_L7; } /* "View.MemoryView":1294 * src.strides[i] = 0 * else: * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * * if src.suboffsets[i] >= 0: */ /*else*/ { __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1294, __pyx_L1_error) } __pyx_L7:; /* "View.MemoryView":1289 * * for i in range(ndim): * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< * if src.shape[i] == 1: * broadcasting = True */ } /* "View.MemoryView":1296 * _err_extents(i, dst.shape[i], src.shape[i]) * * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< * _err_dim(ValueError, "Dimension %d is not direct", i) * */ __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); if (__pyx_t_2) { /* "View.MemoryView":1297 * * if src.suboffsets[i] >= 0: * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< * * if slices_overlap(&src, &dst, ndim, itemsize): */ __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1297, __pyx_L1_error) /* "View.MemoryView":1296 * _err_extents(i, dst.shape[i], src.shape[i]) * * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< * _err_dim(ValueError, "Dimension %d is not direct", i) * */ } } /* "View.MemoryView":1299 * _err_dim(ValueError, "Dimension %d is not direct", i) * * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * * if not slice_is_contig(src, order, ndim): */ __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); if (__pyx_t_2) { /* "View.MemoryView":1301 * if slices_overlap(&src, &dst, ndim, itemsize): * * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< * order = get_best_order(&dst, ndim) * */ __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0); if (__pyx_t_2) { /* "View.MemoryView":1302 * * if not slice_is_contig(src, order, ndim): * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) */ __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); /* "View.MemoryView":1301 * if slices_overlap(&src, &dst, ndim, itemsize): * * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< * order = get_best_order(&dst, ndim) * */ } /* "View.MemoryView":1304 * order = get_best_order(&dst, ndim) * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< * src = tmp * */ __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1304, __pyx_L1_error) __pyx_v_tmpdata = __pyx_t_7; /* "View.MemoryView":1305 * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) * src = tmp # <<<<<<<<<<<<<< * * if not broadcasting: */ __pyx_v_src = __pyx_v_tmp; /* "View.MemoryView":1299 * _err_dim(ValueError, "Dimension %d is not direct", i) * * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * * if not slice_is_contig(src, order, ndim): */ } /* "View.MemoryView":1307 * src = tmp * * if not broadcasting: # <<<<<<<<<<<<<< * * */ __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); if (__pyx_t_2) { /* "View.MemoryView":1310 * * * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): */ __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0); if (__pyx_t_2) { /* "View.MemoryView":1311 * * if slice_is_contig(src, 'C', ndim): * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< * elif slice_is_contig(src, 'F', ndim): * direct_copy = slice_is_contig(dst, 'F', ndim) */ __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); /* "View.MemoryView":1310 * * * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): */ goto __pyx_L12; } /* "View.MemoryView":1312 * if slice_is_contig(src, 'C', ndim): * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< * direct_copy = slice_is_contig(dst, 'F', ndim) * */ __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0); if (__pyx_t_2) { /* "View.MemoryView":1313 * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< * * if direct_copy: */ __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); /* "View.MemoryView":1312 * if slice_is_contig(src, 'C', ndim): * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< * direct_copy = slice_is_contig(dst, 'F', ndim) * */ } __pyx_L12:; /* "View.MemoryView":1315 * direct_copy = slice_is_contig(dst, 'F', ndim) * * if direct_copy: # <<<<<<<<<<<<<< * * refcount_copying(&dst, dtype_is_object, ndim, False) */ __pyx_t_2 = (__pyx_v_direct_copy != 0); if (__pyx_t_2) { /* "View.MemoryView":1317 * if direct_copy: * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); /* "View.MemoryView":1318 * * refcount_copying(&dst, dtype_is_object, ndim, False) * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< * refcount_copying(&dst, dtype_is_object, ndim, True) * free(tmpdata) */ (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); /* "View.MemoryView":1319 * refcount_copying(&dst, dtype_is_object, ndim, False) * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< * free(tmpdata) * return 0 */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); /* "View.MemoryView":1320 * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) * free(tmpdata) # <<<<<<<<<<<<<< * return 0 * */ free(__pyx_v_tmpdata); /* "View.MemoryView":1321 * refcount_copying(&dst, dtype_is_object, ndim, True) * free(tmpdata) * return 0 # <<<<<<<<<<<<<< * * if order == 'F' == get_best_order(&dst, ndim): */ __pyx_r = 0; goto __pyx_L0; /* "View.MemoryView":1315 * direct_copy = slice_is_contig(dst, 'F', ndim) * * if direct_copy: # <<<<<<<<<<<<<< * * refcount_copying(&dst, dtype_is_object, ndim, False) */ } /* "View.MemoryView":1307 * src = tmp * * if not broadcasting: # <<<<<<<<<<<<<< * * */ } /* "View.MemoryView":1323 * return 0 * * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< * * */ __pyx_t_2 = (__pyx_v_order == 'F'); if (__pyx_t_2) { __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); } __pyx_t_8 = (__pyx_t_2 != 0); if (__pyx_t_8) { /* "View.MemoryView":1326 * * * transpose_memslice(&src) # <<<<<<<<<<<<<< * transpose_memslice(&dst) * */ __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1326, __pyx_L1_error) /* "View.MemoryView":1327 * * transpose_memslice(&src) * transpose_memslice(&dst) # <<<<<<<<<<<<<< * * refcount_copying(&dst, dtype_is_object, ndim, False) */ __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1327, __pyx_L1_error) /* "View.MemoryView":1323 * return 0 * * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< * * */ } /* "View.MemoryView":1329 * transpose_memslice(&dst) * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< * copy_strided_to_strided(&src, &dst, ndim, itemsize) * refcount_copying(&dst, dtype_is_object, ndim, True) */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); /* "View.MemoryView":1330 * * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< * refcount_copying(&dst, dtype_is_object, ndim, True) * */ copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); /* "View.MemoryView":1331 * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< * * free(tmpdata) */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); /* "View.MemoryView":1333 * refcount_copying(&dst, dtype_is_object, ndim, True) * * free(tmpdata) # <<<<<<<<<<<<<< * return 0 * */ free(__pyx_v_tmpdata); /* "View.MemoryView":1334 * * free(tmpdata) * return 0 # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_broadcast_leading') */ __pyx_r = 0; goto __pyx_L0; /* "View.MemoryView":1265 * * @cname('__pyx_memoryview_copy_contents') * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< * __Pyx_memviewslice dst, * int src_ndim, int dst_ndim, */ /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "View.MemoryView":1337 * * @cname('__pyx_memoryview_broadcast_leading') * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< * int ndim, * int ndim_other) nogil: */ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { int __pyx_v_i; int __pyx_v_offset; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; /* "View.MemoryView":1341 * int ndim_other) nogil: * cdef int i * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< * * for i in range(ndim - 1, -1, -1): */ __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); /* "View.MemoryView":1343 * cdef int offset = ndim_other - ndim * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< * mslice.shape[i + offset] = mslice.shape[i] * mslice.strides[i + offset] = mslice.strides[i] */ for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { __pyx_v_i = __pyx_t_1; /* "View.MemoryView":1344 * * for i in range(ndim - 1, -1, -1): * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< * mslice.strides[i + offset] = mslice.strides[i] * mslice.suboffsets[i + offset] = mslice.suboffsets[i] */ (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); /* "View.MemoryView":1345 * for i in range(ndim - 1, -1, -1): * mslice.shape[i + offset] = mslice.shape[i] * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * */ (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); /* "View.MemoryView":1346 * mslice.shape[i + offset] = mslice.shape[i] * mslice.strides[i + offset] = mslice.strides[i] * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< * * for i in range(offset): */ (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); } /* "View.MemoryView":1348 * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * * for i in range(offset): # <<<<<<<<<<<<<< * mslice.shape[i] = 1 * mslice.strides[i] = mslice.strides[0] */ __pyx_t_1 = __pyx_v_offset; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; /* "View.MemoryView":1349 * * for i in range(offset): * mslice.shape[i] = 1 # <<<<<<<<<<<<<< * mslice.strides[i] = mslice.strides[0] * mslice.suboffsets[i] = -1 */ (__pyx_v_mslice->shape[__pyx_v_i]) = 1; /* "View.MemoryView":1350 * for i in range(offset): * mslice.shape[i] = 1 * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< * mslice.suboffsets[i] = -1 * */ (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); /* "View.MemoryView":1351 * mslice.shape[i] = 1 * mslice.strides[i] = mslice.strides[0] * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * * */ (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; } /* "View.MemoryView":1337 * * @cname('__pyx_memoryview_broadcast_leading') * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< * int ndim, * int ndim_other) nogil: */ /* function exit code */ } /* "View.MemoryView":1359 * * @cname('__pyx_memoryview_refcount_copying') * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< * int ndim, bint inc) nogil: * */ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { int __pyx_t_1; /* "View.MemoryView":1363 * * * if dtype_is_object: # <<<<<<<<<<<<<< * refcount_objects_in_slice_with_gil(dst.data, dst.shape, * dst.strides, ndim, inc) */ __pyx_t_1 = (__pyx_v_dtype_is_object != 0); if (__pyx_t_1) { /* "View.MemoryView":1364 * * if dtype_is_object: * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< * dst.strides, ndim, inc) * */ __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); /* "View.MemoryView":1363 * * * if dtype_is_object: # <<<<<<<<<<<<<< * refcount_objects_in_slice_with_gil(dst.data, dst.shape, * dst.strides, ndim, inc) */ } /* "View.MemoryView":1359 * * @cname('__pyx_memoryview_refcount_copying') * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< * int ndim, bint inc) nogil: * */ /* function exit code */ } /* "View.MemoryView":1368 * * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< * Py_ssize_t *strides, int ndim, * bint inc) with gil: */ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { __Pyx_RefNannyDeclarations #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); /* "View.MemoryView":1371 * Py_ssize_t *strides, int ndim, * bint inc) with gil: * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_refcount_objects_in_slice') */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); /* "View.MemoryView":1368 * * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< * Py_ssize_t *strides, int ndim, * bint inc) with gil: */ /* function exit code */ __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif } /* "View.MemoryView":1374 * * @cname('__pyx_memoryview_refcount_objects_in_slice') * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< * Py_ssize_t *strides, int ndim, bint inc): * cdef Py_ssize_t i */ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { CYTHON_UNUSED Py_ssize_t __pyx_v_i; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; Py_ssize_t __pyx_t_2; Py_ssize_t __pyx_t_3; int __pyx_t_4; __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); /* "View.MemoryView":1378 * cdef Py_ssize_t i * * for i in range(shape[0]): # <<<<<<<<<<<<<< * if ndim == 1: * if inc: */ __pyx_t_1 = (__pyx_v_shape[0]); __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; /* "View.MemoryView":1379 * * for i in range(shape[0]): * if ndim == 1: # <<<<<<<<<<<<<< * if inc: * Py_INCREF(( data)[0]) */ __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_4) { /* "View.MemoryView":1380 * for i in range(shape[0]): * if ndim == 1: * if inc: # <<<<<<<<<<<<<< * Py_INCREF(( data)[0]) * else: */ __pyx_t_4 = (__pyx_v_inc != 0); if (__pyx_t_4) { /* "View.MemoryView":1381 * if ndim == 1: * if inc: * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< * else: * Py_DECREF(( data)[0]) */ Py_INCREF((((PyObject **)__pyx_v_data)[0])); /* "View.MemoryView":1380 * for i in range(shape[0]): * if ndim == 1: * if inc: # <<<<<<<<<<<<<< * Py_INCREF(( data)[0]) * else: */ goto __pyx_L6; } /* "View.MemoryView":1383 * Py_INCREF(( data)[0]) * else: * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< * else: * refcount_objects_in_slice(data, shape + 1, strides + 1, */ /*else*/ { Py_DECREF((((PyObject **)__pyx_v_data)[0])); } __pyx_L6:; /* "View.MemoryView":1379 * * for i in range(shape[0]): * if ndim == 1: # <<<<<<<<<<<<<< * if inc: * Py_INCREF(( data)[0]) */ goto __pyx_L5; } /* "View.MemoryView":1385 * Py_DECREF(( data)[0]) * else: * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< * ndim - 1, inc) * */ /*else*/ { /* "View.MemoryView":1386 * else: * refcount_objects_in_slice(data, shape + 1, strides + 1, * ndim - 1, inc) # <<<<<<<<<<<<<< * * data += strides[0] */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); } __pyx_L5:; /* "View.MemoryView":1388 * ndim - 1, inc) * * data += strides[0] # <<<<<<<<<<<<<< * * */ __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); } /* "View.MemoryView":1374 * * @cname('__pyx_memoryview_refcount_objects_in_slice') * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< * Py_ssize_t *strides, int ndim, bint inc): * cdef Py_ssize_t i */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "View.MemoryView":1394 * * @cname('__pyx_memoryview_slice_assign_scalar') * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< * size_t itemsize, void *item, * bint dtype_is_object) nogil: */ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { /* "View.MemoryView":1397 * size_t itemsize, void *item, * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, * itemsize, item) */ __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); /* "View.MemoryView":1398 * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< * itemsize, item) * refcount_copying(dst, dtype_is_object, ndim, True) */ __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); /* "View.MemoryView":1400 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, * itemsize, item) * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< * * */ __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); /* "View.MemoryView":1394 * * @cname('__pyx_memoryview_slice_assign_scalar') * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< * size_t itemsize, void *item, * bint dtype_is_object) nogil: */ /* function exit code */ } /* "View.MemoryView":1404 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< * Py_ssize_t *strides, int ndim, * size_t itemsize, void *item) nogil: */ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { CYTHON_UNUSED Py_ssize_t __pyx_v_i; Py_ssize_t __pyx_v_stride; Py_ssize_t __pyx_v_extent; int __pyx_t_1; Py_ssize_t __pyx_t_2; Py_ssize_t __pyx_t_3; Py_ssize_t __pyx_t_4; /* "View.MemoryView":1408 * size_t itemsize, void *item) nogil: * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< * cdef Py_ssize_t extent = shape[0] * */ __pyx_v_stride = (__pyx_v_strides[0]); /* "View.MemoryView":1409 * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< * * if ndim == 1: */ __pyx_v_extent = (__pyx_v_shape[0]); /* "View.MemoryView":1411 * cdef Py_ssize_t extent = shape[0] * * if ndim == 1: # <<<<<<<<<<<<<< * for i in range(extent): * memcpy(data, item, itemsize) */ __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_1) { /* "View.MemoryView":1412 * * if ndim == 1: * for i in range(extent): # <<<<<<<<<<<<<< * memcpy(data, item, itemsize) * data += stride */ __pyx_t_2 = __pyx_v_extent; __pyx_t_3 = __pyx_t_2; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; /* "View.MemoryView":1413 * if ndim == 1: * for i in range(extent): * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< * data += stride * else: */ (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); /* "View.MemoryView":1414 * for i in range(extent): * memcpy(data, item, itemsize) * data += stride # <<<<<<<<<<<<<< * else: * for i in range(extent): */ __pyx_v_data = (__pyx_v_data + __pyx_v_stride); } /* "View.MemoryView":1411 * cdef Py_ssize_t extent = shape[0] * * if ndim == 1: # <<<<<<<<<<<<<< * for i in range(extent): * memcpy(data, item, itemsize) */ goto __pyx_L3; } /* "View.MemoryView":1416 * data += stride * else: * for i in range(extent): # <<<<<<<<<<<<<< * _slice_assign_scalar(data, shape + 1, strides + 1, * ndim - 1, itemsize, item) */ /*else*/ { __pyx_t_2 = __pyx_v_extent; __pyx_t_3 = __pyx_t_2; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; /* "View.MemoryView":1417 * else: * for i in range(extent): * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< * ndim - 1, itemsize, item) * data += stride */ __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); /* "View.MemoryView":1419 * _slice_assign_scalar(data, shape + 1, strides + 1, * ndim - 1, itemsize, item) * data += stride # <<<<<<<<<<<<<< * * */ __pyx_v_data = (__pyx_v_data + __pyx_v_stride); } } __pyx_L3:; /* "View.MemoryView":1404 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< * Py_ssize_t *strides, int ndim, * size_t itemsize, void *item) nogil: */ /* function exit code */ } /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v___pyx_type = values[0]; __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) __pyx_v___pyx_state = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_v___pyx_PickleError = 0; PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) */ __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0); if (__pyx_t_1) { /* "(tree fragment)":5 * cdef object __pyx_result * if __pyx_checksum != 0xb068931: * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_PickleError); __Pyx_GIVEREF(__pyx_n_s_PickleError); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_v___pyx_PickleError = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":6 * if __pyx_checksum != 0xb068931: * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: */ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_v___pyx_PickleError); __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(2, 6, __pyx_L1_error) /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) */ } /* "(tree fragment)":7 * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< * if __pyx_state is not None: * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v___pyx_result = __pyx_t_3; __pyx_t_3 = 0; /* "(tree fragment)":8 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result */ __pyx_t_1 = (__pyx_v___pyx_state != Py_None); __pyx_t_6 = (__pyx_t_1 != 0); if (__pyx_t_6) { /* "(tree fragment)":9 * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): */ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":8 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result */ } /* "(tree fragment)":10 * if __pyx_state is not None: * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result # <<<<<<<<<<<<<< * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v___pyx_result); __pyx_r = __pyx_v___pyx_result; goto __pyx_L0; /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v___pyx_PickleError); __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":11 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; Py_ssize_t __pyx_t_3; int __pyx_t_4; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); /* "(tree fragment)":12 * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): * __pyx_result.__dict__.update(__pyx_state[1]) */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(2, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->name); __Pyx_DECREF(__pyx_v___pyx_result->name); __pyx_v___pyx_result->name = __pyx_t_1; __pyx_t_1 = 0; /* "(tree fragment)":13 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< * __pyx_result.__dict__.update(__pyx_state[1]) */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(2, 13, __pyx_L1_error) } __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) __pyx_t_4 = ((__pyx_t_3 > 1) != 0); if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) __pyx_t_5 = (__pyx_t_4 != 0); __pyx_t_2 = __pyx_t_5; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { /* "(tree fragment)":14 * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< */ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(2, 14, __pyx_L1_error) } __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":13 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< * __pyx_result.__dict__.update(__pyx_state[1]) */ } /* "(tree fragment)":11 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_vtabstruct_array __pyx_vtable_array; static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_array_obj *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; p = ((struct __pyx_array_obj *)o); p->__pyx_vtab = __pyx_vtabptr_array; p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_array(PyObject *o) { struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_array___dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->mode); Py_CLEAR(p->_format); (*Py_TYPE(o)->tp_free)(o); } static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { PyObject *r; PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); Py_DECREF(x); return r; } static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { if (v) { return __pyx_array___setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); return -1; } } static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); v = __pyx_array___getattr__(o, n); } return v; } static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); } static PyMethodDef __pyx_methods_array[] = { {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_array[] = { {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; static PySequenceMethods __pyx_tp_as_sequence_array = { __pyx_array___len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_array, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_array = { __pyx_array___len__, /*mp_length*/ __pyx_array___getitem__, /*mp_subscript*/ __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_array = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif __pyx_array_getbuffer, /*bf_getbuffer*/ 0, /*bf_releasebuffer*/ }; static PyTypeObject __pyx_type___pyx_array = { PyVarObject_HEAD_INIT(0, 0) "kiva._cython_speedups.array", /*tp_name*/ sizeof(struct __pyx_array_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_array, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ __pyx_tp_getattro_array, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_array, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_array, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_array, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif #if PY_VERSION_HEX >= 0x030800b1 0, /*tp_vectorcall*/ #endif }; static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_MemviewEnum_obj *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; p = ((struct __pyx_MemviewEnum_obj *)o); p->name = Py_None; Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_Enum(PyObject *o) { struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->name); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { int e; struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; if (p->name) { e = (*v)(p->name, a); if (e) return e; } return 0; } static int __pyx_tp_clear_Enum(PyObject *o) { PyObject* tmp; struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; tmp = ((PyObject*)p->name); p->name = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyMethodDef __pyx_methods_Enum[] = { {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type___pyx_MemviewEnum = { PyVarObject_HEAD_INIT(0, 0) "kiva._cython_speedups.Enum", /*tp_name*/ sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_Enum, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif __pyx_MemviewEnum___repr__, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_Enum, /*tp_traverse*/ __pyx_tp_clear_Enum, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_Enum, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_MemviewEnum___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_Enum, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif #if PY_VERSION_HEX >= 0x030800b1 0, /*tp_vectorcall*/ #endif }; static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_memoryview_obj *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; p = ((struct __pyx_memoryview_obj *)o); p->__pyx_vtab = __pyx_vtabptr_memoryview; p->obj = Py_None; Py_INCREF(Py_None); p->_size = Py_None; Py_INCREF(Py_None); p->_array_interface = Py_None; Py_INCREF(Py_None); p->view.obj = NULL; if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_memoryview(PyObject *o) { struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_memoryview___dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->obj); Py_CLEAR(p->_size); Py_CLEAR(p->_array_interface); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { int e; struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; if (p->obj) { e = (*v)(p->obj, a); if (e) return e; } if (p->_size) { e = (*v)(p->_size, a); if (e) return e; } if (p->_array_interface) { e = (*v)(p->_array_interface, a); if (e) return e; } if (p->view.obj) { e = (*v)(p->view.obj, a); if (e) return e; } return 0; } static int __pyx_tp_clear_memoryview(PyObject *o) { PyObject* tmp; struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; tmp = ((PyObject*)p->obj); p->obj = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->_size); p->_size = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->_array_interface); p->_array_interface = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); Py_CLEAR(p->view.obj); return 0; } static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { PyObject *r; PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); Py_DECREF(x); return r; } static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { if (v) { return __pyx_memoryview___setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); return -1; } } static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); } static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); } static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); } static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); } static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); } static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); } static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); } static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); } static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); } static PyMethodDef __pyx_methods_memoryview[] = { {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0}, {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_memoryview[] = { {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0}, {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0}, {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0}, {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0}, {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0}, {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0}, {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0}, {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0}, {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; static PySequenceMethods __pyx_tp_as_sequence_memoryview = { __pyx_memoryview___len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_memoryview, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_memoryview = { __pyx_memoryview___len__, /*mp_length*/ __pyx_memoryview___getitem__, /*mp_subscript*/ __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_memoryview = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif __pyx_memoryview_getbuffer, /*bf_getbuffer*/ 0, /*bf_releasebuffer*/ }; static PyTypeObject __pyx_type___pyx_memoryview = { PyVarObject_HEAD_INIT(0, 0) "kiva._cython_speedups.memoryview", /*tp_name*/ sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif __pyx_memoryview___repr__, /*tp_repr*/ 0, /*tp_as_number*/ &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ __pyx_memoryview___str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_memoryview, /*tp_traverse*/ __pyx_tp_clear_memoryview, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_memoryview, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_memoryview, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_memoryview, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif #if PY_VERSION_HEX >= 0x030800b1 0, /*tp_vectorcall*/ #endif }; static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_memoryviewslice_obj *p; PyObject *o = __pyx_tp_new_memoryview(t, a, k); if (unlikely(!o)) return 0; p = ((struct __pyx_memoryviewslice_obj *)o); p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; p->from_object = Py_None; Py_INCREF(Py_None); p->from_slice.memview = NULL; return o; } static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_memoryviewslice___dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->from_object); PyObject_GC_Track(o); __pyx_tp_dealloc_memoryview(o); } static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { int e; struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; if (p->from_object) { e = (*v)(p->from_object, a); if (e) return e; } return 0; } static int __pyx_tp_clear__memoryviewslice(PyObject *o) { PyObject* tmp; struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; __pyx_tp_clear_memoryview(o); tmp = ((PyObject*)p->from_object); p->from_object = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); __PYX_XDEC_MEMVIEW(&p->from_slice, 1); return 0; } static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o); } static PyMethodDef __pyx_methods__memoryviewslice[] = { {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type___pyx_memoryviewslice = { PyVarObject_HEAD_INIT(0, 0) "kiva._cython_speedups._memoryviewslice", /*tp_name*/ sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif #if CYTHON_COMPILING_IN_PYPY __pyx_memoryview___repr__, /*tp_repr*/ #else 0, /*tp_repr*/ #endif 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ #if CYTHON_COMPILING_IN_PYPY __pyx_memoryview___str__, /*tp_str*/ #else 0, /*tp_str*/ #endif 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "Internal class for passing memoryview slices to Python", /*tp_doc*/ __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ __pyx_tp_clear__memoryviewslice, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods__memoryviewslice, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets__memoryviewslice, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new__memoryviewslice, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif #if PY_VERSION_HEX >= 0x030800b1 0, /*tp_vectorcall*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 #if CYTHON_PEP489_MULTI_PHASE_INIT static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ static int __pyx_pymod_exec__cython_speedups(PyObject* module); /*proto*/ static PyModuleDef_Slot __pyx_moduledef_slots[] = { {Py_mod_create, (void*)__pyx_pymod_create}, {Py_mod_exec, (void*)__pyx_pymod_exec__cython_speedups}, {0, NULL} }; #endif static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, "_cython_speedups", 0, /* m_doc */ #if CYTHON_PEP489_MULTI_PHASE_INIT 0, /* m_size */ #else -1, /* m_size */ #endif __pyx_methods /* m_methods */, #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_moduledef_slots, /* m_slots */ #else NULL, /* m_reload */ #endif NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define CYTHON_SMALL_CODE __attribute__((cold)) #else #define CYTHON_SMALL_CODE #endif #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0}, {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, {&__pyx_kp_u_Test_whether_point_pairs_in_pts, __pyx_k_Test_whether_point_pairs_in_pts, sizeof(__pyx_k_Test_whether_point_pairs_in_pts), 0, 1, 0, 0}, {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1}, {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, {&__pyx_n_s_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 0, 1, 1}, {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, {&__pyx_kp_s_cython_speedups_pyx, __pyx_k_cython_speedups_pyx, sizeof(__pyx_k_cython_speedups_pyx), 0, 0, 1, 0}, {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, {&__pyx_n_s_kiva__cython_speedups, __pyx_k_kiva__cython_speedups, sizeof(__pyx_k_kiva__cython_speedups), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, {&__pyx_n_s_points_in_polygon, __pyx_k_points_in_polygon, sizeof(__pyx_k_points_in_polygon), 0, 0, 1, 1}, {&__pyx_kp_u_points_in_polygon_line_6, __pyx_k_points_in_polygon_line_6, sizeof(__pyx_k_points_in_polygon_line_6), 0, 1, 0, 0}, {&__pyx_n_s_poly_pts, __pyx_k_poly_pts, sizeof(__pyx_k_poly_pts), 0, 0, 1, 1}, {&__pyx_kp_s_poly_pts_must_be_an_Nx2_or_2xN_a, __pyx_k_poly_pts_must_be_an_Nx2_or_2xN_a, sizeof(__pyx_k_poly_pts_must_be_an_Nx2_or_2xN_a), 0, 0, 1, 0}, {&__pyx_n_s_poly_pts_view, __pyx_k_poly_pts_view, sizeof(__pyx_k_poly_pts_view), 0, 0, 1, 1}, {&__pyx_n_s_pts, __pyx_k_pts, sizeof(__pyx_k_pts), 0, 0, 1, 1}, {&__pyx_kp_s_pts_must_be_an_Nx2_or_2xN_array, __pyx_k_pts_must_be_an_Nx2_or_2xN_array, sizeof(__pyx_k_pts_must_be_an_Nx2_or_2xN_array), 0, 0, 1, 0}, {&__pyx_n_s_pts_view, __pyx_k_pts_view, sizeof(__pyx_k_pts_view), 0, 0, 1, 1}, {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, {&__pyx_n_s_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 0, 0, 1, 1}, {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1}, {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1}, {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1}, {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, {&__pyx_n_s_use_winding, __pyx_k_use_winding, sizeof(__pyx_k_use_winding), 0, 0, 1, 1}, {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 59, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 285, __pyx_L1_error) __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error) __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error) __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 400, __pyx_L1_error) __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 609, __pyx_L1_error) __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 828, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "kiva/_cython_speedups.pyx":52 * if pts.size == 0: * # Quick exit for empty pts array * return np.zeros(0, dtype=np.uint8) # <<<<<<<<<<<<<< * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); /* "kiva/_cython_speedups.pyx":54 * return np.zeros(0, dtype=np.uint8) * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) # <<<<<<<<<<<<<< * if np.shape(pts)[1] != 2: * if np.shape(pts)[0] == 2: */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* "kiva/_cython_speedups.pyx":59 * pts = np.ascontiguousarray(np.transpose(pts)) * else: * raise ValueError('pts must be an Nx2 or 2xN array') # <<<<<<<<<<<<<< * * # Check the shape of poly_pts and transpose if necessary */ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_pts_must_be_an_Nx2_or_2xN_array); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); /* "kiva/_cython_speedups.pyx":72 * poly_pts = np.ascontiguousarray(np.transpose(poly_pts)) * else: * raise ValueError('poly_pts must be an Nx2 or 2xN array') # <<<<<<<<<<<<<< * * cdef double[:, ::1] pts_view = np.ascontiguousarray(pts) */ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_poly_pts_must_be_an_Nx2_or_2xN_a); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 856, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 1038, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); /* "../../../.edm/envs/cython/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 1044, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); /* "View.MemoryView":133 * * if not self.ndim: * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< * * if itemsize <= 0: */ __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); /* "View.MemoryView":136 * * if itemsize <= 0: * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * * if not isinstance(format, bytes): */ __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); /* "View.MemoryView":148 * * if not self._shape: * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< * * */ __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); /* "View.MemoryView":176 * self.data = malloc(self.len) * if not self.data: * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< * * if self.dtype_is_object: */ __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); /* "View.MemoryView":192 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< * info.buf = self.data * info.len = self.len */ __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); /* "View.MemoryView":414 * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< * * have_slices, index = _unellipsify(index, self.view.ndim) */ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); /* "View.MemoryView":491 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< * else: * if len(self.view.format) == 1: */ __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); /* "View.MemoryView":516 * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< * * if flags & PyBUF_ND: */ __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); /* "View.MemoryView":566 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); /* "View.MemoryView":573 * def suboffsets(self): * if self.view.suboffsets == NULL: * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ __pyx_tuple__23 = PyTuple_New(1); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_INCREF(__pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_tuple__23, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_tuple__23); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); /* "View.MemoryView":678 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ __pyx_slice__26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(2, 678, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__26); __Pyx_GIVEREF(__pyx_slice__26); /* "View.MemoryView":699 * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< * * */ __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 699, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); /* "kiva/_cython_speedups.pyx":6 * * * def points_in_polygon(pts, poly_pts, use_winding=False): # <<<<<<<<<<<<<< * """Test whether point pairs in pts are within the polygon, poly_pts. * */ __pyx_tuple__30 = PyTuple_Pack(6, __pyx_n_s_pts, __pyx_n_s_poly_pts, __pyx_n_s_use_winding, __pyx_n_s_pts_view, __pyx_n_s_poly_pts_view, __pyx_n_s_results); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cython_speedups_pyx, __pyx_n_s_points_in_polygon, 6, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 6, __pyx_L1_error) /* "View.MemoryView":286 * return self.name * * cdef generic = Enum("") # <<<<<<<<<<<<<< * cdef strided = Enum("") # default * cdef indirect = Enum("") */ __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(2, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32); /* "View.MemoryView":287 * * cdef generic = Enum("") * cdef strided = Enum("") # default # <<<<<<<<<<<<<< * cdef indirect = Enum("") * */ __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(2, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); /* "View.MemoryView":288 * cdef generic = Enum("") * cdef strided = Enum("") # default * cdef indirect = Enum("") # <<<<<<<<<<<<<< * * */ __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(2, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); /* "View.MemoryView":291 * * * cdef contiguous = Enum("") # <<<<<<<<<<<<<< * cdef indirect_contiguous = Enum("") * */ __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(2, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); /* "View.MemoryView":292 * * cdef contiguous = Enum("") * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(2, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ __pyx_tuple__37 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__37); __Pyx_GIVEREF(__pyx_tuple__37); __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ generic = Py_None; Py_INCREF(Py_None); strided = Py_None; Py_INCREF(Py_None); indirect = Py_None; Py_INCREF(Py_None); contiguous = Py_None; Py_INCREF(Py_None); indirect_contiguous = Py_None; Py_INCREF(Py_None); __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_export_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); /*--- Variable export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_export_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); /*--- Function export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ __pyx_vtabptr_array = &__pyx_vtable_array; __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_array.tp_print = 0; #endif if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error) __pyx_array_type = &__pyx_type___pyx_array; if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_MemviewEnum.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error) __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_memoryview.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error) __pyx_memoryview_type = &__pyx_type___pyx_memoryview; __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 961, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_memoryviewslice.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 961, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 961, __pyx_L1_error) __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore); if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error) __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error) __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error) __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore); if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error) __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_variable_import_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); /*--- Variable import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_import_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); /*--- Function import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } #if PY_MAJOR_VERSION < 3 #ifdef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC void #else #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #endif #else #ifdef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyObject * #else #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #endif #endif #if PY_MAJOR_VERSION < 3 __Pyx_PyMODINIT_FUNC init_cython_speedups(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC init_cython_speedups(void) #else __Pyx_PyMODINIT_FUNC PyInit__cython_speedups(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC PyInit__cython_speedups(void) #if CYTHON_PEP489_MULTI_PHASE_INIT { return PyModuleDef_Init(&__pyx_moduledef); } static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { #if PY_VERSION_HEX >= 0x030700A1 static PY_INT64_T main_interpreter_id = -1; PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); if (main_interpreter_id == -1) { main_interpreter_id = current_id; return (unlikely(current_id == -1)) ? -1 : 0; } else if (unlikely(main_interpreter_id != current_id)) #else static PyInterpreterState *main_interpreter = NULL; PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; if (!main_interpreter) { main_interpreter = current_interpreter; } else if (unlikely(main_interpreter != current_interpreter)) #endif { PyErr_SetString( PyExc_ImportError, "Interpreter change detected - this module can only be loaded into one interpreter per process."); return -1; } return 0; } static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { result = PyDict_SetItemString(moddict, to_name, value); } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); } else { result = -1; } return result; } static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); if (unlikely(!modname)) goto bad; module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: Py_XDECREF(module); return NULL; } static CYTHON_SMALL_CODE int __pyx_pymod_exec__cython_speedups(PyObject *__pyx_pyinit_module) #endif #endif { PyObject *__pyx_t_1 = NULL; static PyThread_type_lock __pyx_t_2[8]; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { if (__pyx_m == __pyx_pyinit_module) return 0; PyErr_SetString(PyExc_RuntimeError, "Module '_cython_speedups' has already been imported. Re-initialisation is not supported."); return -1; } #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__cython_speedups(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pxy_PyFrame_Initialize_Offsets __Pxy_PyFrame_Initialize_Offsets(); #endif __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_m = __pyx_pyinit_module; Py_INCREF(__pyx_m); #else #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("_cython_speedups", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) #endif __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_b); __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_cython_runtime); if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_kiva___cython_speedups) { if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "kiva._cython_speedups")) { if (unlikely(PyDict_SetItemString(modules, "kiva._cython_speedups", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error; (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /* "kiva/_cython_speedups.pyx":1 * import numpy as np # <<<<<<<<<<<<<< * from numpy cimport uint8_t * cimport _hit_test */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "kiva/_cython_speedups.pyx":6 * * * def points_in_polygon(pts, poly_pts, use_winding=False): # <<<<<<<<<<<<<< * """Test whether point pairs in pts are within the polygon, poly_pts. * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4kiva_16_cython_speedups_1points_in_polygon, NULL, __pyx_n_s_kiva__cython_speedups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_points_in_polygon, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "kiva/_cython_speedups.pyx":1 * import numpy as np # <<<<<<<<<<<<<< * from numpy cimport uint8_t * cimport _hit_test */ __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_points_in_polygon_line_6, __pyx_kp_u_Test_whether_point_pairs_in_pts) < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":209 * info.obj = self * * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * def __dealloc__(array self): */ __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 209, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_array_type); /* "View.MemoryView":286 * return self.name * * cdef generic = Enum("") # <<<<<<<<<<<<<< * cdef strided = Enum("") # default * cdef indirect = Enum("") */ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(generic); __Pyx_DECREF_SET(generic, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":287 * * cdef generic = Enum("") * cdef strided = Enum("") # default # <<<<<<<<<<<<<< * cdef indirect = Enum("") * */ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(strided); __Pyx_DECREF_SET(strided, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":288 * cdef generic = Enum("") * cdef strided = Enum("") # default * cdef indirect = Enum("") # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect); __Pyx_DECREF_SET(indirect, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":291 * * * cdef contiguous = Enum("") # <<<<<<<<<<<<<< * cdef indirect_contiguous = Enum("") * */ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(contiguous); __Pyx_DECREF_SET(contiguous, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":292 * * cdef contiguous = Enum("") * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect_contiguous); __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; /* "View.MemoryView":316 * * DEF THREAD_LOCKS_PREALLOCATED = 8 * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ * PyThread_allocate_lock(), */ __pyx_memoryview_thread_locks_used = 0; /* "View.MemoryView":317 * DEF THREAD_LOCKS_PREALLOCATED = 8 * cdef int __pyx_memoryview_thread_locks_used = 0 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< * PyThread_allocate_lock(), * PyThread_allocate_lock(), */ __pyx_t_2[0] = PyThread_allocate_lock(); __pyx_t_2[1] = PyThread_allocate_lock(); __pyx_t_2[2] = PyThread_allocate_lock(); __pyx_t_2[3] = PyThread_allocate_lock(); __pyx_t_2[4] = PyThread_allocate_lock(); __pyx_t_2[5] = PyThread_allocate_lock(); __pyx_t_2[6] = PyThread_allocate_lock(); __pyx_t_2[7] = PyThread_allocate_lock(); memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); /* "View.MemoryView":545 * info.obj = self * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 545, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_memoryview_type); /* "View.MemoryView":991 * return self.from_object * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 991, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 991, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_memoryviewslice_type); /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":11 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init kiva._cython_speedups", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_CLEAR(__pyx_m); } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init kiva._cython_speedups"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if CYTHON_PEP489_MULTI_PHASE_INIT return (__pyx_m != NULL) ? 0 : -1; #elif PY_MAJOR_VERSION >= 3 return __pyx_m; #else return; #endif } /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule(modname); if (!m) goto end; p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #endif /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { PyObject *dict = Py_TYPE(obj)->tp_dict; return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; } static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { PyObject **dictptr = NULL; Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; if (offset) { #if CYTHON_COMPILING_IN_CPYTHON dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); #else dictptr = _PyObject_GetDictPtr(obj); #endif } return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { PyObject *dict = Py_TYPE(obj)->tp_dict; if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) return 0; return obj_dict_version == __Pyx_get_object_dict_version(obj); } #endif /* GetModuleGlobalName */ #if CYTHON_USE_DICT_VERSIONS static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif { PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } else if (unlikely(PyErr_Occurred())) { return NULL; } #else result = PyDict_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } #endif #else result = PyObject_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } PyErr_Clear(); #endif return __Pyx_GetBuiltinName(name); } /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyIntCompare */ static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { if (op1 == op2) { Py_RETURN_TRUE; } #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long a = PyInt_AS_LONG(op1); if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE; } #endif #if CYTHON_USE_PYLONG_INTERNALS if (likely(PyLong_CheckExact(op1))) { int unequal; unsigned long uintval; Py_ssize_t size = Py_SIZE(op1); const digit* digits = ((PyLongObject*)op1)->ob_digit; if (intval == 0) { if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; } else if (intval < 0) { if (size >= 0) Py_RETURN_FALSE; intval = -intval; size = -size; } else { if (size <= 0) Py_RETURN_FALSE; } uintval = (unsigned long) intval; #if PyLong_SHIFT * 4 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 4)) { unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif #if PyLong_SHIFT * 3 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 3)) { unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif #if PyLong_SHIFT * 2 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 2)) { unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif #if PyLong_SHIFT * 1 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 1)) { unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; } #endif if (PyFloat_CheckExact(op1)) { const long b = intval; double a = PyFloat_AS_DOUBLE(op1); if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; } return ( PyObject_RichCompare(op1, op2, Py_EQ)); } /* PyCFunctionFastCall */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); int flags = PyCFunction_GET_FLAGS(func); assert(PyCFunction_Check(func)); assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, because it may clear it (directly or indirectly) and so the caller loses its exception */ assert(!PyErr_Occurred()); if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); } else { return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); } } #endif /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject **fastlocals; Py_ssize_t i; PyObject *result; assert(globals != NULL); /* XXX Perhaps we should create a specialized PyFrame_New() that doesn't take locals, but does take builtins without sanity checking them. */ assert(tstate != NULL); f = PyFrame_New(tstate, co, globals, NULL); if (f == NULL) { return NULL; } fastlocals = __Pyx_PyFrame_GetLocalsplus(f); for (i = 0; i < na; i++) { Py_INCREF(*args); fastlocals[i] = *args++; } result = PyEval_EvalFrameEx(f,0); ++tstate->recursion_depth; Py_DECREF(f); --tstate->recursion_depth; return result; } #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); PyObject *argdefs = PyFunction_GET_DEFAULTS(func); PyObject *closure; #if PY_MAJOR_VERSION >= 3 PyObject *kwdefs; #endif PyObject *kwtuple, **k; PyObject **d; Py_ssize_t nd; Py_ssize_t nk; PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { return NULL; } if ( #if PY_MAJOR_VERSION >= 3 co->co_kwonlyargcount == 0 && #endif likely(kwargs == NULL || nk == 0) && co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { if (argdefs == NULL && co->co_argcount == nargs) { result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); goto done; } else if (nargs == 0 && argdefs != NULL && co->co_argcount == Py_SIZE(argdefs)) { /* function called with no arguments, but all parameters have a default value: use default values as arguments .*/ args = &PyTuple_GET_ITEM(argdefs, 0); result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); goto done; } } if (kwargs != NULL) { Py_ssize_t pos, i; kwtuple = PyTuple_New(2 * nk); if (kwtuple == NULL) { result = NULL; goto done; } k = &PyTuple_GET_ITEM(kwtuple, 0); pos = i = 0; while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { Py_INCREF(k[i]); Py_INCREF(k[i+1]); i += 2; } nk = i / 2; } else { kwtuple = NULL; k = NULL; } closure = PyFunction_GET_CLOSURE(func); #if PY_MAJOR_VERSION >= 3 kwdefs = PyFunction_GET_KW_DEFAULTS(func); #endif if (argdefs != NULL) { d = &PyTuple_GET_ITEM(argdefs, 0); nd = Py_SIZE(argdefs); } else { d = NULL; nd = 0; } #if PY_MAJOR_VERSION >= 3 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, args, nargs, k, (int)nk, d, (int)nd, kwdefs, closure); #else result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, args, nargs, k, (int)nk, d, (int)nd, closure); #endif Py_XDECREF(kwtuple); done: Py_LeaveRecursiveCall(); return result; } #endif #endif /* PyObjectCall2Args */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { PyObject *args, *result = NULL; #if CYTHON_FAST_PYCALL if (PyFunction_Check(function)) { PyObject *args[2] = {arg1, arg2}; return __Pyx_PyFunction_FastCall(function, args, 2); } #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(function)) { PyObject *args[2] = {arg1, arg2}; return __Pyx_PyCFunction_FastCall(function, args, 2); } #endif args = PyTuple_New(2); if (unlikely(!args)) goto done; Py_INCREF(arg1); PyTuple_SET_ITEM(args, 0, arg1); Py_INCREF(arg2); PyTuple_SET_ITEM(args, 1, arg2); Py_INCREF(function); result = __Pyx_PyObject_Call(function, args, NULL); Py_DECREF(args); Py_DECREF(function); done: return result; } /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = PyCFunction_GET_FUNCTION(func); self = PyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallOneArg */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); if (unlikely(!args)) return NULL; Py_INCREF(arg); PyTuple_SET_ITEM(args, 0, arg); result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { return __Pyx_PyFunction_FastCall(func, &arg, 1); } #endif if (likely(PyCFunction_Check(func))) { if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif } } return __Pyx__PyObject_CallOneArg(func, arg); } #else static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_Pack(1, arg); if (unlikely(!args)) return NULL; result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } #endif /* PyIntCompare */ static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { if (op1 == op2) { Py_RETURN_FALSE; } #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long a = PyInt_AS_LONG(op1); if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE; } #endif #if CYTHON_USE_PYLONG_INTERNALS if (likely(PyLong_CheckExact(op1))) { int unequal; unsigned long uintval; Py_ssize_t size = Py_SIZE(op1); const digit* digits = ((PyLongObject*)op1)->ob_digit; if (intval == 0) { if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; } else if (intval < 0) { if (size >= 0) Py_RETURN_TRUE; intval = -intval; size = -size; } else { if (size <= 0) Py_RETURN_TRUE; } uintval = (unsigned long) intval; #if PyLong_SHIFT * 4 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 4)) { unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif #if PyLong_SHIFT * 3 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 3)) { unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif #if PyLong_SHIFT * 2 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 2)) { unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif #if PyLong_SHIFT * 1 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 1)) { unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; } #endif if (PyFloat_CheckExact(op1)) { const long b = intval; double a = PyFloat_AS_DOUBLE(op1); if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; } return ( PyObject_RichCompare(op1, op2, Py_NE)); } /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS Py_ssize_t wrapped_i = i; if (wraparound & unlikely(i < 0)) { wrapped_i += PyList_GET_SIZE(o); } if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS Py_ssize_t wrapped_i = i; if (wraparound & unlikely(i < 0)) { wrapped_i += PyTuple_GET_SIZE(o); } if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (!PyErr_ExceptionMatches(PyExc_OverflowError)) return NULL; PyErr_Clear(); } } return m->sq_item(o, i); } } #else if (is_list || PySequence_Check(o)) { return PySequence_GetItem(o, i); } #endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } /* PyErrFetchRestore */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #endif /* RaiseException */ #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } if (PyType_Check(type)) { #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } } __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if CYTHON_COMPILING_IN_PYPY PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #endif } bad: Py_XDECREF(owned_instance); return; } #endif /* BufferIndexError */ static void __Pyx_RaiseBufferIndexError(int axis) { PyErr_Format(PyExc_IndexError, "Out of bounds on buffer access (axis %d)", axis); } /* MemviewSliceInit */ static int __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, int ndim, __Pyx_memviewslice *memviewslice, int memview_is_new_reference) { __Pyx_RefNannyDeclarations int i, retval=-1; Py_buffer *buf = &memview->view; __Pyx_RefNannySetupContext("init_memviewslice", 0); if (memviewslice->memview || memviewslice->data) { PyErr_SetString(PyExc_ValueError, "memviewslice is already initialized!"); goto fail; } if (buf->strides) { for (i = 0; i < ndim; i++) { memviewslice->strides[i] = buf->strides[i]; } } else { Py_ssize_t stride = buf->itemsize; for (i = ndim - 1; i >= 0; i--) { memviewslice->strides[i] = stride; stride *= buf->shape[i]; } } for (i = 0; i < ndim; i++) { memviewslice->shape[i] = buf->shape[i]; if (buf->suboffsets) { memviewslice->suboffsets[i] = buf->suboffsets[i]; } else { memviewslice->suboffsets[i] = -1; } } memviewslice->memview = memview; memviewslice->data = (char *)buf->buf; if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { Py_INCREF(memview); } retval = 0; goto no_fail; fail: memviewslice->memview = 0; memviewslice->data = 0; retval = -1; no_fail: __Pyx_RefNannyFinishContext(); return retval; } #ifndef Py_NO_RETURN #define Py_NO_RETURN #endif static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { va_list vargs; char msg[200]; #ifdef HAVE_STDARG_PROTOTYPES va_start(vargs, fmt); #else va_start(vargs); #endif vsnprintf(msg, 200, fmt, vargs); va_end(vargs); Py_FatalError(msg); } static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, PyThread_type_lock lock) { int result; PyThread_acquire_lock(lock, 1); result = (*acquisition_count)++; PyThread_release_lock(lock); return result; } static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, PyThread_type_lock lock) { int result; PyThread_acquire_lock(lock, 1); result = (*acquisition_count)--; PyThread_release_lock(lock); return result; } static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) { int first_time; struct __pyx_memoryview_obj *memview = memslice->memview; if (!memview || (PyObject *) memview == Py_None) return; if (__pyx_get_slice_count(memview) < 0) __pyx_fatalerror("Acquisition count is %d (line %d)", __pyx_get_slice_count(memview), lineno); first_time = __pyx_add_acquisition_count(memview) == 0; if (first_time) { if (have_gil) { Py_INCREF((PyObject *) memview); } else { PyGILState_STATE _gilstate = PyGILState_Ensure(); Py_INCREF((PyObject *) memview); PyGILState_Release(_gilstate); } } } static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) { int last_time; struct __pyx_memoryview_obj *memview = memslice->memview; if (!memview ) { return; } else if ((PyObject *) memview == Py_None) { memslice->memview = NULL; return; } if (__pyx_get_slice_count(memview) <= 0) __pyx_fatalerror("Acquisition count is %d (line %d)", __pyx_get_slice_count(memview), lineno); last_time = __pyx_sub_acquisition_count(memview) == 1; memslice->data = NULL; if (last_time) { if (have_gil) { Py_CLEAR(memslice->memview); } else { PyGILState_STATE _gilstate = PyGILState_Ensure(); Py_CLEAR(memslice->memview); PyGILState_Release(_gilstate); } } else { memslice->memview = NULL; } } /* DictGetItem */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) { if (unlikely(PyTuple_Check(key))) { PyObject* args = PyTuple_Pack(1, key); if (likely(args)) { PyErr_SetObject(PyExc_KeyError, args); Py_DECREF(args); } } else { PyErr_SetObject(PyExc_KeyError, key); } } return NULL; } Py_INCREF(value); return value; } #endif /* RaiseTooManyValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* RaiseNeedMoreValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* RaiseNoneIterError */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } /* ExtTypeTest */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (likely(__Pyx_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } /* GetTopmostException */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; } return exc_info; } #endif /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = type; exc_info->exc_value = value; exc_info->exc_traceback = tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } #endif /* PyErrExceptionMatches */ #if CYTHON_FAST_THREAD_STATE static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(tuple); #if PY_MAJOR_VERSION >= 3 for (i=0; icurexc_type; if (exc_type == err) return 1; if (unlikely(!exc_type)) return 0; if (unlikely(PyTuple_Check(err))) return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); } #endif /* GetException */ #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { PyObject *local_type, *local_value, *local_tb; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); #if CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) #endif goto bad; #if PY_MAJOR_VERSION >= 3 if (local_tb) { if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; } #endif Py_XINCREF(local_tb); Py_XINCREF(local_type); Py_XINCREF(local_value); *type = local_type; *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; } #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_SetExcInfo(local_type, local_value, local_tb); #endif return 0; bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; } /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } else if (exact) { #if PY_MAJOR_VERSION == 2 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { if (likely(__Pyx_TypeCheck(obj, type))) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } /* BytesEquals */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { return (equals == Py_EQ); } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { const char *ps1, *ps2; Py_ssize_t length = PyBytes_GET_SIZE(s1); if (length != PyBytes_GET_SIZE(s2)) return (equals == Py_NE); ps1 = PyBytes_AS_STRING(s1); ps2 = PyBytes_AS_STRING(s2); if (ps1[0] != ps2[0]) { return (equals == Py_NE); } else if (length == 1) { return (equals == Py_EQ); } else { int result; #if CYTHON_USE_UNICODE_INTERNALS Py_hash_t hash1, hash2; hash1 = ((PyBytesObject*)s1)->ob_shash; hash2 = ((PyBytesObject*)s2)->ob_shash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { return (equals == Py_NE); } #endif result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { return (equals == Py_NE); } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { return (equals == Py_NE); } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } #endif } /* UnicodeEquals */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else #if PY_MAJOR_VERSION < 3 PyObject* owned_ref = NULL; #endif int s1_is_unicode, s2_is_unicode; if (s1 == s2) { goto return_eq; } s1_is_unicode = PyUnicode_CheckExact(s1); s2_is_unicode = PyUnicode_CheckExact(s2); #if PY_MAJOR_VERSION < 3 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { owned_ref = PyUnicode_FromObject(s2); if (unlikely(!owned_ref)) return -1; s2 = owned_ref; s2_is_unicode = 1; } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { owned_ref = PyUnicode_FromObject(s1); if (unlikely(!owned_ref)) return -1; s1 = owned_ref; s1_is_unicode = 1; } else if (((!s2_is_unicode) & (!s1_is_unicode))) { return __Pyx_PyBytes_Equals(s1, s2, equals); } #endif if (s1_is_unicode & s2_is_unicode) { Py_ssize_t length; int kind; void *data1, *data2; if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; length = __Pyx_PyUnicode_GET_LENGTH(s1); if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { goto return_ne; } #if CYTHON_USE_UNICODE_INTERNALS { Py_hash_t hash1, hash2; #if CYTHON_PEP393_ENABLED hash1 = ((PyASCIIObject*)s1)->hash; hash2 = ((PyASCIIObject*)s2)->hash; #else hash1 = ((PyUnicodeObject*)s1)->hash; hash2 = ((PyUnicodeObject*)s2)->hash; #endif if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { goto return_ne; } } #endif kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; } data1 = __Pyx_PyUnicode_DATA(s1); data2 = __Pyx_PyUnicode_DATA(s2); if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { goto return_ne; } else if (length == 1) { goto return_eq; } else { int result = memcmp(data1, data2, (size_t)(length * kind)); #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & s2_is_unicode) { goto return_ne; } else if ((s2 == Py_None) & s1_is_unicode) { goto return_ne; } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } return_eq: #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_EQ); return_ne: #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_NE); #endif } /* None */ static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { Py_ssize_t q = a / b; Py_ssize_t r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } /* GetAttr */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_USE_TYPE_SLOTS #if PY_MAJOR_VERSION >= 3 if (likely(PyUnicode_Check(n))) #else if (likely(PyString_Check(n))) #endif return __Pyx_PyObject_GetAttrStr(o, n); #endif return PyObject_GetAttr(o, n); } /* ObjectGetItem */ #if CYTHON_USE_TYPE_SLOTS static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { PyObject *runerr; Py_ssize_t key_value; PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; if (unlikely(!(m && m->sq_item))) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); return NULL; } key_value = __Pyx_PyIndex_AsSsize_t(index); if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { PyErr_Clear(); PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); } return NULL; } static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; if (likely(m && m->mp_subscript)) { return m->mp_subscript(obj, key); } return __Pyx_PyObject_GetIndex(obj, key); } #endif /* decode_c_string */ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { Py_ssize_t length; if (unlikely((start < 0) | (stop < 0))) { size_t slen = strlen(cstring); if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { PyErr_SetString(PyExc_OverflowError, "c-string too long to convert to Python"); return NULL; } length = (Py_ssize_t) slen; if (start < 0) { start += length; if (start < 0) start = 0; } if (stop < 0) stop += length; } length = stop - start; if (unlikely(length <= 0)) return PyUnicode_FromUnicode(NULL, 0); cstring += start; if (decode_func) { return decode_func(cstring, length, errors); } else { return PyUnicode_Decode(cstring, length, encoding, errors); } } /* GetAttr3 */ static PyObject *__Pyx_GetAttr3Default(PyObject *d) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) return NULL; __Pyx_PyErr_Clear(); Py_INCREF(d); return d; } static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { PyObject *r = __Pyx_GetAttr(o, n); return (likely(r)) ? r : __Pyx_GetAttr3Default(d); } /* SwapException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = *type; exc_info->exc_value = *value; exc_info->exc_traceback = *tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; #endif *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); PyErr_SetExcInfo(*type, *value, *tb); *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #endif /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; } #endif if (!module) { #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } bad: #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } /* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = a->tp_base; if (a == b) return 1; } return b == &PyBaseObject_Type; } static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (a == b) return 1; mro = a->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(a, b); } #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; int res; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&exception, &value, &tb); res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; if (unlikely(res == -1)) { PyErr_WriteUnraisable(err); res = 0; } if (!res) { res = PyObject_IsSubclass(err, exc_type2); if (unlikely(res == -1)) { PyErr_WriteUnraisable(err); res = 0; } } __Pyx_ErrRestore(exception, value, tb); return res; } #else static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; if (!res) { res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; assert(PyExceptionClass_Check(exc_type)); n = PyTuple_GET_SIZE(tuple); #if PY_MAJOR_VERSION >= 3 for (i=0; i= 0 || (x^b) >= 0)) return PyInt_FromLong(x); return PyLong_Type.tp_as_number->nb_add(op1, op2); } #endif #if CYTHON_USE_PYLONG_INTERNALS if (likely(PyLong_CheckExact(op1))) { const long b = intval; long a, x; #ifdef HAVE_LONG_LONG const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif const digit* digits = ((PyLongObject*)op1)->ob_digit; const Py_ssize_t size = Py_SIZE(op1); if (likely(__Pyx_sst_abs(size) <= 1)) { a = likely(size) ? digits[0] : 0; if (size == -1) a = -a; } else { switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_add(op1, op2); } } x = a + b; return PyLong_FromLong(x); #ifdef HAVE_LONG_LONG long_long: llx = lla + llb; return PyLong_FromLongLong(llx); #endif } #endif if (PyFloat_CheckExact(op1)) { const long b = intval; double a = PyFloat_AS_DOUBLE(op1); double result; PyFPE_START_PROTECT("add", return NULL) result = ((double)a) + (double)b; PyFPE_END_PROTECT(result) return PyFloat_FromDouble(result); } return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); } #endif /* None */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } /* None */ static CYTHON_INLINE long __Pyx_div_long(long a, long b) { long q = a / b; long r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } /* WriteUnraisableException */ static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, int full_traceback, CYTHON_UNUSED int nogil) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_PyThreadState_declare #ifdef WITH_THREAD PyGILState_STATE state; if (nogil) state = PyGILState_Ensure(); #ifdef _MSC_VER else state = (PyGILState_STATE)-1; #endif #endif __Pyx_PyThreadState_assign __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); if (full_traceback) { Py_XINCREF(old_exc); Py_XINCREF(old_val); Py_XINCREF(old_tb); __Pyx_ErrRestore(old_exc, old_val, old_tb); PyErr_PrintEx(1); } #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else ctx = PyUnicode_FromString(name); #endif __Pyx_ErrRestore(old_exc, old_val, old_tb); if (!ctx) { PyErr_WriteUnraisable(Py_None); } else { PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } #ifdef WITH_THREAD if (nogil) PyGILState_Release(state); #endif } /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); #else "cannot import name %S", name); #endif } return value; } /* HasAttr */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { PyObject *r; if (unlikely(!__Pyx_PyBaseString_Check(n))) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return -1; } r = __Pyx_GetAttr(o, n); if (unlikely(!r)) { PyErr_Clear(); return 0; } else { Py_DECREF(r); return 1; } } /* PyObject_GenericGetAttrNoDict */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 "'%.50s' object has no attribute '%U'", tp->tp_name, attr_name); #else "'%.50s' object has no attribute '%.400s'", tp->tp_name, PyString_AS_STRING(attr_name)); #endif return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { PyObject *descr; PyTypeObject *tp = Py_TYPE(obj); if (unlikely(!PyString_Check(attr_name))) { return PyObject_GenericGetAttr(obj, attr_name); } assert(!tp->tp_dictoffset); descr = _PyType_Lookup(tp, attr_name); if (unlikely(!descr)) { return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); } Py_INCREF(descr); #if PY_MAJOR_VERSION < 3 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) #endif { descrgetfunc f = Py_TYPE(descr)->tp_descr_get; if (unlikely(f)) { PyObject *res = f(descr, obj, (PyObject *)tp); Py_DECREF(descr); return res; } } return descr; } #endif /* PyObject_GenericGetAttr */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { return PyObject_GenericGetAttr(obj, attr_name); } return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); } #endif /* SetVTable */ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 PyObject *ob = PyCapsule_New(vtable, 0, 0); #else PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); #endif if (!ob) goto bad; if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; bad: Py_XDECREF(ob); return -1; } /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { ret = -1; } if (unlikely(ret < 0)) { PyErr_Clear(); ret = 0; } Py_XDECREF(name_attr); return ret; } static int __Pyx_setup_reduce(PyObject* type_obj) { int ret = 0; PyObject *object_reduce = NULL; PyObject *object_reduce_ex = NULL; PyObject *reduce = NULL; PyObject *reduce_ex = NULL; PyObject *reduce_cython = NULL; PyObject *setstate = NULL; PyObject *setstate_cython = NULL; #if CYTHON_USE_PYTYPE_LOOKUP if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD; #else if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD; #endif #if CYTHON_USE_PYTYPE_LOOKUP object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD; #else object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD; #endif reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD; if (reduce_ex == object_reduce_ex) { #if CYTHON_USE_PYTYPE_LOOKUP object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD; #else object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD; #endif reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD; ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD; ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD; setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD; ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD; ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD; } PyType_Modified((PyTypeObject*)type_obj); } } goto GOOD; BAD: if (!PyErr_Occurred()) PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); ret = -1; GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); #endif Py_XDECREF(reduce); Py_XDECREF(reduce_ex); Py_XDECREF(reduce_cython); Py_XDECREF(setstate); Py_XDECREF(setstate_cython); return ret; } /* TypeImport */ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif result = PyObject_GetAttrString(module, class_name); if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%.200s.%.200s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if ((size_t)basicsize < size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize); goto bad; } if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize); goto bad; } else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize); if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(result); return NULL; } #endif /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif if (unlikely(!__pyx_cython_runtime)) { return c_line; } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); #if CYTHON_COMPILING_IN_CPYTHON cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); if (likely(cython_runtime_dict)) { __PYX_PY_DICT_LOOKUP_IF_MODIFIED( use_cline, *cython_runtime_dict, __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) } else #endif { PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); } else { PyErr_Clear(); use_cline = NULL; } } if (!use_cline) { c_line = 0; PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); return c_line; } #endif /* CodeObjectCache */ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; PyThreadState *tstate = __Pyx_PyThreadState_Current; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( tstate, /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; __Pyx_PyFrame_SetLineNumber(py_frame, py_line); PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *obj = view->obj; if (!obj) return; if (PyObject_CheckBuffer(obj)) { PyBuffer_Release(view); return; } if ((0)) {} else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); view->obj = NULL; Py_DECREF(obj); } #endif /* MemviewSliceIsContig */ static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) { int i, index, step, start; Py_ssize_t itemsize = mvs.memview->view.itemsize; if (order == 'F') { step = 1; start = 0; } else { step = -1; start = ndim - 1; } for (i = 0; i < ndim; i++) { index = start + step * i; if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) return 0; itemsize *= mvs.shape[index]; } return 1; } /* OverlappingSlices */ static void __pyx_get_array_memory_extents(__Pyx_memviewslice *slice, void **out_start, void **out_end, int ndim, size_t itemsize) { char *start, *end; int i; start = end = slice->data; for (i = 0; i < ndim; i++) { Py_ssize_t stride = slice->strides[i]; Py_ssize_t extent = slice->shape[i]; if (extent == 0) { *out_start = *out_end = start; return; } else { if (stride > 0) end += stride * (extent - 1); else start += stride * (extent - 1); } } *out_start = start; *out_end = end + itemsize; } static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, __Pyx_memviewslice *slice2, int ndim, size_t itemsize) { void *start1, *end1, *start2, *end2; __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); return (start1 < end2) && (start2 < end1); } /* Capsule */ static CYTHON_INLINE PyObject * __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) { PyObject *cobj; #if PY_VERSION_HEX >= 0x02070000 cobj = PyCapsule_New(p, sig, NULL); #else cobj = PyCObject_FromVoidPtr(p, NULL); #endif return cobj; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint8(npy_uint8 value) { const npy_uint8 neg_one = (npy_uint8) ((npy_uint8) 0 - (npy_uint8) 1), const_zero = (npy_uint8) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(npy_uint8) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(npy_uint8) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(npy_uint8) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(npy_uint8) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(npy_uint8) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(npy_uint8), little, !is_unsigned); } } /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ {\ func_type value = func_value;\ if (sizeof(target_type) < sizeof(func_type)) {\ if (unlikely(value != (func_type) (target_type) value)) {\ func_type zero = 0;\ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ return (target_type) -1;\ if (is_unsigned && unlikely(value < zero))\ goto raise_neg_overflow;\ else\ goto raise_overflow;\ }\ }\ return (target_type) value;\ } /* MemviewDtypeToObject */ static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_uint8_t(const char *itemp) { return (PyObject *) __Pyx_PyInt_From_npy_uint8(*(__pyx_t_5numpy_uint8_t *) itemp); } static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_uint8_t(const char *itemp, PyObject *obj) { __pyx_t_5numpy_uint8_t value = __Pyx_PyInt_As_npy_uint8(obj); if ((value == ((npy_uint8)-1)) && PyErr_Occurred()) return 0; *(__pyx_t_5numpy_uint8_t *) itemp = value; return 1; } /* Declarations */ #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif /* Arithmetic */ #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } #if 1 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { if (b.imag == 0) { return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); } else if (fabsf(b.real) >= fabsf(b.imag)) { if (b.real == 0 && b.imag == 0) { return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { float r = b.imag / b.real; float s = (float)(1.0) / (b.real + b.imag * r); return __pyx_t_float_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { float r = b.real / b.imag; float s = (float)(1.0) / (b.imag + b.real * r); return __pyx_t_float_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } } #else static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { if (b.imag == 0) { return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); } else { float denom = b.real * b.real + b.imag * b.imag; return __pyx_t_float_complex_from_parts( (a.real * b.real + a.imag * b.imag) / denom, (a.imag * b.real - a.real * b.imag) / denom); } } #endif static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod_float(a, a); return __Pyx_c_prod_float(a, a); case 3: z = __Pyx_c_prod_float(a, a); return __Pyx_c_prod_float(z, a); case 4: z = __Pyx_c_prod_float(a, a); return __Pyx_c_prod_float(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } else if (b.imag == 0) { z.real = powf(a.real, b.real); z.imag = 0; return z; } else if (a.real > 0) { r = a.real; theta = 0; } else { r = -a.real; theta = atan2f(0.0, -1.0); } } else { r = __Pyx_c_abs_float(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif /* Declarations */ #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif /* Arithmetic */ #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } #if 1 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { if (b.imag == 0) { return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); } else if (fabs(b.real) >= fabs(b.imag)) { if (b.real == 0 && b.imag == 0) { return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { double r = b.imag / b.real; double s = (double)(1.0) / (b.real + b.imag * r); return __pyx_t_double_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { double r = b.real / b.imag; double s = (double)(1.0) / (b.imag + b.real * r); return __pyx_t_double_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } } #else static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { if (b.imag == 0) { return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); } else { double denom = b.real * b.real + b.imag * b.imag; return __pyx_t_double_complex_from_parts( (a.real * b.real + a.imag * b.imag) / denom, (a.imag * b.real - a.real * b.imag) / denom); } } #endif static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod_double(a, a); return __Pyx_c_prod_double(a, a); case 3: z = __Pyx_c_prod_double(a, a); return __Pyx_c_prod_double(z, a); case 4: z = __Pyx_c_prod_double(a, a); return __Pyx_c_prod_double(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } else if (b.imag == 0) { z.real = pow(a.real, b.real); z.imag = 0; return z; } else if (a.real > 0) { r = a.real; theta = 0; } else { r = -a.real; theta = atan2(0.0, -1.0); } } else { r = __Pyx_c_abs_double(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(int) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(enum NPY_TYPES) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(enum NPY_TYPES) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES), little, !is_unsigned); } } /* MemviewSliceCopyTemplate */ static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const char *mode, int ndim, size_t sizeof_dtype, int contig_flag, int dtype_is_object) { __Pyx_RefNannyDeclarations int i; __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } }; struct __pyx_memoryview_obj *from_memview = from_mvs->memview; Py_buffer *buf = &from_memview->view; PyObject *shape_tuple = NULL; PyObject *temp_int = NULL; struct __pyx_array_obj *array_obj = NULL; struct __pyx_memoryview_obj *memview_obj = NULL; __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); for (i = 0; i < ndim; i++) { if (from_mvs->suboffsets[i] >= 0) { PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " "indirect dimensions (axis %d)", i); goto fail; } } shape_tuple = PyTuple_New(ndim); if (unlikely(!shape_tuple)) { goto fail; } __Pyx_GOTREF(shape_tuple); for(i = 0; i < ndim; i++) { temp_int = PyInt_FromSsize_t(from_mvs->shape[i]); if(unlikely(!temp_int)) { goto fail; } else { PyTuple_SET_ITEM(shape_tuple, i, temp_int); temp_int = NULL; } } array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL); if (unlikely(!array_obj)) { goto fail; } __Pyx_GOTREF(array_obj); memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( (PyObject *) array_obj, contig_flag, dtype_is_object, from_mvs->memview->typeinfo); if (unlikely(!memview_obj)) goto fail; if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) goto fail; if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, dtype_is_object) < 0)) goto fail; goto no_fail; fail: __Pyx_XDECREF(new_mvs.memview); new_mvs.memview = NULL; new_mvs.data = NULL; no_fail: __Pyx_XDECREF(shape_tuple); __Pyx_XDECREF(temp_int); __Pyx_XDECREF(array_obj); __Pyx_RefNannyFinishContext(); return new_mvs; } /* CIntFromPy */ static CYTHON_INLINE npy_uint8 __Pyx_PyInt_As_npy_uint8(PyObject *x) { const npy_uint8 neg_one = (npy_uint8) ((npy_uint8) 0 - (npy_uint8) 1), const_zero = (npy_uint8) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(npy_uint8) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(npy_uint8, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (npy_uint8) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (npy_uint8) 0; case 1: __PYX_VERIFY_RETURN_INT(npy_uint8, digit, digits[0]) case 2: if (8 * sizeof(npy_uint8) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(npy_uint8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(npy_uint8) >= 2 * PyLong_SHIFT) { return (npy_uint8) (((((npy_uint8)digits[1]) << PyLong_SHIFT) | (npy_uint8)digits[0])); } } break; case 3: if (8 * sizeof(npy_uint8) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(npy_uint8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(npy_uint8) >= 3 * PyLong_SHIFT) { return (npy_uint8) (((((((npy_uint8)digits[2]) << PyLong_SHIFT) | (npy_uint8)digits[1]) << PyLong_SHIFT) | (npy_uint8)digits[0])); } } break; case 4: if (8 * sizeof(npy_uint8) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(npy_uint8, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(npy_uint8) >= 4 * PyLong_SHIFT) { return (npy_uint8) (((((((((npy_uint8)digits[3]) << PyLong_SHIFT) | (npy_uint8)digits[2]) << PyLong_SHIFT) | (npy_uint8)digits[1]) << PyLong_SHIFT) | (npy_uint8)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (npy_uint8) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(npy_uint8) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(npy_uint8, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(npy_uint8) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(npy_uint8, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (npy_uint8) 0; case -1: __PYX_VERIFY_RETURN_INT(npy_uint8, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(npy_uint8, digit, +digits[0]) case -2: if (8 * sizeof(npy_uint8) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(npy_uint8, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(npy_uint8) - 1 > 2 * PyLong_SHIFT) { return (npy_uint8) (((npy_uint8)-1)*(((((npy_uint8)digits[1]) << PyLong_SHIFT) | (npy_uint8)digits[0]))); } } break; case 2: if (8 * sizeof(npy_uint8) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(npy_uint8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(npy_uint8) - 1 > 2 * PyLong_SHIFT) { return (npy_uint8) ((((((npy_uint8)digits[1]) << PyLong_SHIFT) | (npy_uint8)digits[0]))); } } break; case -3: if (8 * sizeof(npy_uint8) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(npy_uint8, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(npy_uint8) - 1 > 3 * PyLong_SHIFT) { return (npy_uint8) (((npy_uint8)-1)*(((((((npy_uint8)digits[2]) << PyLong_SHIFT) | (npy_uint8)digits[1]) << PyLong_SHIFT) | (npy_uint8)digits[0]))); } } break; case 3: if (8 * sizeof(npy_uint8) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(npy_uint8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(npy_uint8) - 1 > 3 * PyLong_SHIFT) { return (npy_uint8) ((((((((npy_uint8)digits[2]) << PyLong_SHIFT) | (npy_uint8)digits[1]) << PyLong_SHIFT) | (npy_uint8)digits[0]))); } } break; case -4: if (8 * sizeof(npy_uint8) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(npy_uint8, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(npy_uint8) - 1 > 4 * PyLong_SHIFT) { return (npy_uint8) (((npy_uint8)-1)*(((((((((npy_uint8)digits[3]) << PyLong_SHIFT) | (npy_uint8)digits[2]) << PyLong_SHIFT) | (npy_uint8)digits[1]) << PyLong_SHIFT) | (npy_uint8)digits[0]))); } } break; case 4: if (8 * sizeof(npy_uint8) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(npy_uint8, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(npy_uint8) - 1 > 4 * PyLong_SHIFT) { return (npy_uint8) ((((((((((npy_uint8)digits[3]) << PyLong_SHIFT) | (npy_uint8)digits[2]) << PyLong_SHIFT) | (npy_uint8)digits[1]) << PyLong_SHIFT) | (npy_uint8)digits[0]))); } } break; } #endif if (sizeof(npy_uint8) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(npy_uint8, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(npy_uint8) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(npy_uint8, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else npy_uint8 val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (npy_uint8) -1; } } else { npy_uint8 val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (npy_uint8) -1; val = __Pyx_PyInt_As_npy_uint8(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to npy_uint8"); return (npy_uint8) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to npy_uint8"); return (npy_uint8) -1; } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (int) -1; } } else { int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (long) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (long) -1; } } else { long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* CIntFromPy */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(char) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (char) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (char) 0; case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) case 2: if (8 * sizeof(char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); } } break; case 3: if (8 * sizeof(char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); } } break; case 4: if (8 * sizeof(char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (char) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(char) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (char) 0; case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) case -2: if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case 2: if (8 * sizeof(char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case -3: if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case 3: if (8 * sizeof(char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case -4: if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; case 4: if (8 * sizeof(char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); } } break; } #endif if (sizeof(char) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (char) -1; } } else { char val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (char) -1; val = __Pyx_PyInt_As_char(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); return (char) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to char"); return (char) -1; } /* IsLittleEndian */ static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) { union { uint32_t u32; uint8_t u8[4]; } S; S.u32 = 0x01020304; return S.u8[0] == 4; } /* BufferFormatCheck */ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; ctx->is_valid_array = 0; ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t <= '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static int __Pyx_BufFmt_ExpectNumber(const char **ts) { int number = __Pyx_BufFmt_ParseNumber(ts); if (number == -1) PyErr_Format(PyExc_ValueError,\ "Does not understand character buffer dtype format string ('%c')", **ts); return number; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'c': return "'char'"; case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } /* These are for computing the padding at the end of the struct to align on the first member of the struct. This will probably the same as above, but we don't have any guarantees. */ typedef struct { short x; char c; } __Pyx_pad_short; typedef struct { int x; char c; } __Pyx_pad_int; typedef struct { long x; char c; } __Pyx_pad_long; typedef struct { float x; char c; } __Pyx_pad_float; typedef struct { double x; char c; } __Pyx_pad_double; typedef struct { long double x; char c; } __Pyx_pad_longdouble; typedef struct { void *x; char c; } __Pyx_pad_void_p; #ifdef HAVE_LONG_LONG typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': return 'H'; case 'b': case 'h': case 'i': case 'l': case 'q': case 's': case 'p': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; if (ctx->head->field->type->arraysize[0]) { int i, ndim = 0; if (ctx->enc_type == 's' || ctx->enc_type == 'p') { ctx->is_valid_array = ctx->head->field->type->ndim == 1; ndim = 1; if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %zu", ctx->head->field->type->arraysize[0], ctx->enc_count); return -1; } } if (!ctx->is_valid_array) { PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", ctx->head->field->type->ndim, ndim); return -1; } for (i = 0; i < ctx->head->field->type->ndim; i++) { arraysize *= ctx->head->field->type->arraysize[i]; } ctx->is_valid_array = 0; ctx->enc_count = 1; } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; if (ctx->struct_alignment == 0) ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, ctx->is_complex); } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } if ((type->typegroup == 'H' || group == 'H') && type->size == size) { } else { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; if (arraysize) ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static PyObject * __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; int i = 0, number; int ndim = ctx->head->field->type->ndim; ; ++ts; if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, "Cannot handle repeated arrays in format string"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; while (*ts && *ts != ')') { switch (*ts) { case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; default: break; } number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) return PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %d", ctx->head->field->type->arraysize[i], number); if (*ts != ',' && *ts != ')') return PyErr_Format(PyExc_ValueError, "Expected a comma in format string, got '%c'", *ts); if (*ts == ',') ts++; i++; } if (i != ndim) return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", ctx->head->field->type->ndim, i); if (!*ts) { PyErr_SetString(PyExc_ValueError, "Unexpected end of format string, expected ')'"); return NULL; } ctx->is_valid_array = 1; ctx->new_count = 1; *tsp = ++ts; return Py_None; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case '\r': case '\n': ++ts; break; case '<': if (!__Pyx_Is_Little_Endian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_Is_Little_Endian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; ctx->enc_count = 0; ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': { size_t alignment = ctx->struct_alignment; ++ts; if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; if (alignment && ctx->fmt_offset % alignment) { ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); } } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } CYTHON_FALLTHROUGH; case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; ctx->new_count = 1; got_Z = 0; ++ts; break; } CYTHON_FALLTHROUGH; case 's': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; case '(': if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; break; default: { int number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; ctx->new_count = (size_t)number; } } } } /* TypeInfoCompare */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) { int i; if (!a || !b) return 0; if (a == b) return 1; if (a->size != b->size || a->typegroup != b->typegroup || a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) { if (a->typegroup == 'H' || b->typegroup == 'H') { return a->size == b->size; } else { return 0; } } if (a->ndim) { for (i = 0; i < a->ndim; i++) if (a->arraysize[i] != b->arraysize[i]) return 0; } if (a->typegroup == 'S') { if (a->flags != b->flags) return 0; if (a->fields || b->fields) { if (!(a->fields && b->fields)) return 0; for (i = 0; a->fields[i].type && b->fields[i].type; i++) { __Pyx_StructField *field_a = a->fields + i; __Pyx_StructField *field_b = b->fields + i; if (field_a->offset != field_b->offset || !__pyx_typeinfo_cmp(field_a->type, field_b->type)) return 0; } return !a->fields[i].type && !b->fields[i].type; } } return 1; } /* MemviewSliceValidateAndInit */ static int __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) { if (buf->shape[dim] <= 1) return 1; if (buf->strides) { if (spec & __Pyx_MEMVIEW_CONTIG) { if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) { if (buf->strides[dim] != sizeof(void *)) { PyErr_Format(PyExc_ValueError, "Buffer is not indirectly contiguous " "in dimension %d.", dim); goto fail; } } else if (buf->strides[dim] != buf->itemsize) { PyErr_SetString(PyExc_ValueError, "Buffer and memoryview are not contiguous " "in the same dimension."); goto fail; } } if (spec & __Pyx_MEMVIEW_FOLLOW) { Py_ssize_t stride = buf->strides[dim]; if (stride < 0) stride = -stride; if (stride < buf->itemsize) { PyErr_SetString(PyExc_ValueError, "Buffer and memoryview are not contiguous " "in the same dimension."); goto fail; } } } else { if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) { PyErr_Format(PyExc_ValueError, "C-contiguous buffer is not contiguous in " "dimension %d", dim); goto fail; } else if (spec & (__Pyx_MEMVIEW_PTR)) { PyErr_Format(PyExc_ValueError, "C-contiguous buffer is not indirect in " "dimension %d", dim); goto fail; } else if (buf->suboffsets) { PyErr_SetString(PyExc_ValueError, "Buffer exposes suboffsets but no strides"); goto fail; } } return 1; fail: return 0; } static int __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) { if (spec & __Pyx_MEMVIEW_DIRECT) { if (buf->suboffsets && buf->suboffsets[dim] >= 0) { PyErr_Format(PyExc_ValueError, "Buffer not compatible with direct access " "in dimension %d.", dim); goto fail; } } if (spec & __Pyx_MEMVIEW_PTR) { if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) { PyErr_Format(PyExc_ValueError, "Buffer is not indirectly accessible " "in dimension %d.", dim); goto fail; } } return 1; fail: return 0; } static int __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag) { int i; if (c_or_f_flag & __Pyx_IS_F_CONTIG) { Py_ssize_t stride = 1; for (i = 0; i < ndim; i++) { if (stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1) { PyErr_SetString(PyExc_ValueError, "Buffer not fortran contiguous."); goto fail; } stride = stride * buf->shape[i]; } } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) { Py_ssize_t stride = 1; for (i = ndim - 1; i >- 1; i--) { if (stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1) { PyErr_SetString(PyExc_ValueError, "Buffer not C contiguous."); goto fail; } stride = stride * buf->shape[i]; } } return 1; fail: return 0; } static int __Pyx_ValidateAndInit_memviewslice( int *axes_specs, int c_or_f_flag, int buf_flags, int ndim, __Pyx_TypeInfo *dtype, __Pyx_BufFmt_StackElem stack[], __Pyx_memviewslice *memviewslice, PyObject *original_obj) { struct __pyx_memoryview_obj *memview, *new_memview; __Pyx_RefNannyDeclarations Py_buffer *buf; int i, spec = 0, retval = -1; __Pyx_BufFmt_Context ctx; int from_memoryview = __pyx_memoryview_check(original_obj); __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0); if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *) original_obj)->typeinfo)) { memview = (struct __pyx_memoryview_obj *) original_obj; new_memview = NULL; } else { memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( original_obj, buf_flags, 0, dtype); new_memview = memview; if (unlikely(!memview)) goto fail; } buf = &memview->view; if (buf->ndim != ndim) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", ndim, buf->ndim); goto fail; } if (new_memview) { __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned) buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) " "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } for (i = 0; i < ndim; i++) { spec = axes_specs[i]; if (!__pyx_check_strides(buf, i, ndim, spec)) goto fail; if (!__pyx_check_suboffsets(buf, i, ndim, spec)) goto fail; } if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)) goto fail; if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice, new_memview != NULL) == -1)) { goto fail; } retval = 0; goto no_fail; fail: Py_XDECREF(new_memview); retval = -1; no_fail: __Pyx_RefNannyFinishContext(); return retval; } /* ObjectToMemviewSlice */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; int retcode; if (obj == Py_None) { result.memview = (struct __pyx_memoryview_obj *) Py_None; return result; } retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2, &__Pyx_TypeInfo_double, stack, &result, obj); if (unlikely(retcode == -1)) goto __pyx_fail; return result; __pyx_fail: result.memview = NULL; result.data = NULL; return result; } /* ObjectToMemviewSlice */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_5numpy_uint8_t(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; int retcode; if (obj == Py_None) { result.memview = (struct __pyx_memoryview_obj *) Py_None; return result; } retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, stack, &result, obj); if (unlikely(retcode == -1)) goto __pyx_fail; return result; __pyx_fail: result.memview = NULL; result.data = NULL; return result; } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); } return 0; } /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT #if !CYTHON_PEP393_ENABLED static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; } #else static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (likely(PyUnicode_IS_ASCII(o))) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif } #endif #endif static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else #endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { int retval; if (unlikely(!x)) return -1; retval = __Pyx_PyObject_IsTrue(x); Py_DECREF(x); return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "__int__ returned non-int (type %.200s). " "The ability to return an instance of a strict subclass of int " "is deprecated, and may be removed in a future version of Python.", Py_TYPE(result)->tp_name)) { Py_DECREF(result); return NULL; } return result; } #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", type_name, type_name, Py_TYPE(result)->tp_name); Py_DECREF(result); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x) || PyLong_Check(x))) #else if (likely(PyLong_Check(x))) #endif return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = m->nb_int(x); } else if (m && m->nb_long) { name = "long"; res = m->nb_long(x); } #else if (likely(m && m->nb_int)) { name = "int"; res = m->nb_int(x); } #endif #else if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { res = PyNumber_Int(x); } #endif if (likely(res)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { #else if (unlikely(!PyLong_CheckExact(res))) { #endif return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(b))) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else return PyInt_AsSsize_t(b); } #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)b)->ob_digit; const Py_ssize_t size = Py_SIZE(b); if (likely(__Pyx_sst_abs(size) <= 1)) { ival = likely(size) ? digits[0] : 0; if (size == -1) ival = -ival; return ival; } else { switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; } } #endif return PyLong_AsSsize_t(b); } x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */ enthought-chaco2-4.8.1.orig/kiva/_fontdata.py0000644000175000017500000016623613421603267020162 0ustar varunvarun#------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! # # Author: Enthought, Inc. # Description: #------------------------------------------------------------------------------ #copyright ReportLab Inc. 2001 #see license.txt for license details #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/pdfbase/_fontdata.py?cvsroot=reportlab #$Header $ __version__=''' $Id: _fontdata.py,v 1.1 2002/12/03 08:06:29 da Exp $ ''' __doc__=""" database of font related things standardFonts tuple of the 14 standard string font names standardEncodings tuple of the known standard font names encodings a mapping object from standard encoding names (and minor variants) to the encoding vectors ie the tuple of string glyph names widthsByFontGlyph fontname x glyphname --> width of glyph widthVectorsByFont fontName -> vector of widths """ import os import sys from six.moves import UserDict # mapping of name to width vector, starts empty until fonts are added # e.g. widths['Courier'] = [...600,600,600,...] widthVectorsByFont = {} fontsByName = {} fontsByBaseEnc = {} # this is a list of the standard 14 font names in Acrobat Reader standardFonts = ( 'Courier', 'Courier-Bold', 'Courier-Oblique', 'Courier-BoldOblique', 'Helvetica', 'Helvetica-Bold', 'Helvetica-Oblique', 'Helvetica-BoldOblique', 'Times-Roman', 'Times-Bold', 'Times-Italic', 'Times-BoldItalic', 'Symbol','ZapfDingbats') #this maps fontnames to the equivalent filename root. if sys.platform in ('linux2',): _font2fnrMap = { 'symbol': 'Symbol', 'zapfdingbats': 'ZapfDingbats', 'helvetica': 'Arial', 'helvetica-bold': 'Arial-Bold', 'helvetica-boldoblique': 'Arial-BoldItalic', 'helvetica-oblique': 'Arial-Italic', 'times-bold': 'TimesNewRoman-Bold', 'times-bolditalic':'TimesNewRoman-BoldItalic', 'times-italic': 'TimesNewRoman-Italic', 'times-roman': 'TimesNewRoman', 'courier-bold': 'Courier-Bold', 'courier-boldoblique': 'Courier-BoldOblique', 'courier': 'Courier', 'courier-oblique': 'Courier-Oblique', } else: _font2fnrMap = { 'symbol': 'Sy______', 'zapfdingbats': 'Zd______', 'helvetica': '_a______', 'helvetica-bold': '_ab_____', 'helvetica-boldoblique': '_abi____', 'helvetica-oblique': '_ai_____', 'times-bold': '_eb_____', 'times-bolditalic': '_ebi____', 'times-italic': '_ei_____', 'times-roman': '_er_____', 'courier-bold': 'cob_____', 'courier-boldoblique': 'cobo____', 'courier': 'com_____', 'courier-oblique': 'coo_____', } def _findFNR(fontName): return _font2fnrMap[fontName.lower()] def findT1File(fontName,ext='.pfb'): # XXX Kiva-specific changes T1SearchPath = [] # XXX should be modified if Kiva wants to support T1 fonts assert T1SearchPath!=[], "No Type-1 font search path" if sys.platform in ('linux2',) and ext=='.pfb': ext = '' n = _findFNR(fontName)+ext for d in T1SearchPath: f = os.path.join(d,n) if os.path.isfile(f): return f return None # this lists the predefined font encodings - WinAnsi and MacRoman. We have # not added MacExpert - it's possible, but would complicate life and nobody # is asking. StandardEncoding means something special. standardEncodings = ('WinAnsiEncoding','MacRomanEncoding','StandardEncoding','SymbolEncoding','ZapfDingbatsEncoding','PDFDocEncoding', 'MacExpertEncoding') #this is the global mapping of standard encodings to name vectors class _Name2StandardEncodingMap(UserDict): '''Trivial fake dictionary with some [] magic''' _XMap = {'winansi':'WinAnsiEncoding','macroman': 'MacRomanEncoding','standard':'StandardEncoding','symbol':'SymbolEncoding', 'zapfdingbats':'ZapfDingbatsEncoding','pdfdoc':'PDFDocEncoding', 'macexpert':'MacExpertEncoding'} def __setitem__(self,x,v): y = x.lower() if y[-8:]=='encoding': y = y[:-8] y = self._XMap[y] if y in self: raise IndexError('Encoding %s is already set' % y) self.data[y] = v def __getitem__(self,x): y = x.lower() if y[-8:]=='encoding': y = y[:-8] y = self._XMap[y] return self.data[y] encodings = _Name2StandardEncodingMap() encodings['WinAnsiEncoding'] = ( None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'bullet', 'Euro', 'bullet', 'quotesinglbase', 'florin', 'quotedblbase', 'ellipsis', 'dagger', 'daggerdbl', 'circumflex', 'perthousand', 'Scaron', 'guilsinglleft', 'OE', 'bullet', 'Zcaron', 'bullet', 'bullet', 'quoteleft', 'quoteright', 'quotedblleft', 'quotedblright', 'bullet', 'endash', 'emdash', 'tilde', 'trademark', 'scaron', 'guilsinglright', 'oe', 'bullet', 'zcaron', 'Ydieresis', 'space', 'exclamdown', 'cent', 'sterling', 'currency', 'yen', 'brokenbar', 'section', 'dieresis', 'copyright', 'ordfeminine', 'guillemotleft', 'logicalnot', 'hyphen', 'registered', 'macron', 'degree', 'plusminus', 'twosuperior', 'threesuperior', 'acute', 'mu', 'paragraph', 'periodcentered', 'cedilla', 'onesuperior', 'ordmasculine', 'guillemotright', 'onequarter', 'onehalf', 'threequarters', 'questiondown', 'Agrave', 'Aacute', 'Acircumflex', 'Atilde', 'Adieresis', 'Aring', 'AE', 'Ccedilla', 'Egrave', 'Eacute', 'Ecircumflex', 'Edieresis', 'Igrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Eth', 'Ntilde', 'Ograve', 'Oacute', 'Ocircumflex', 'Otilde', 'Odieresis', 'multiply', 'Oslash', 'Ugrave', 'Uacute', 'Ucircumflex', 'Udieresis', 'Yacute', 'Thorn', 'germandbls', 'agrave', 'aacute', 'acircumflex', 'atilde', 'adieresis', 'aring', 'ae', 'ccedilla', 'egrave', 'eacute', 'ecircumflex', 'edieresis', 'igrave', 'iacute', 'icircumflex', 'idieresis', 'eth', 'ntilde', 'ograve', 'oacute', 'ocircumflex', 'otilde', 'odieresis', 'divide', 'oslash', 'ugrave', 'uacute', 'ucircumflex', 'udieresis', 'yacute', 'thorn', 'ydieresis') encodings['MacRomanEncoding'] = ( None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', None, 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', 'Odieresis', 'Udieresis', 'aacute', 'agrave', 'acircumflex', 'adieresis', 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', 'ograve', 'ocircumflex', 'odieresis', 'otilde', 'uacute', 'ugrave', 'ucircumflex', 'udieresis', 'dagger', 'degree', 'cent', 'sterling', 'section', 'bullet', 'paragraph', 'germandbls', 'registered', 'copyright', 'trademark', 'acute', 'dieresis', None, 'AE', 'Oslash', None, 'plusminus', None, None, 'yen', 'mu', None, None, None, None, None, 'ordfeminine', 'ordmasculine', None, 'ae', 'oslash', 'questiondown', 'exclamdown', 'logicalnot', None, 'florin', None, None, 'guillemotleft', 'guillemotright', 'ellipsis', 'space', 'Agrave', 'Atilde', 'Otilde', 'OE', 'oe', 'endash', 'emdash', 'quotedblleft', 'quotedblright', 'quoteleft', 'quoteright', 'divide', None, 'ydieresis', 'Ydieresis', 'fraction', 'currency', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', 'periodcentered', 'quotesinglbase', 'quotedblbase', 'perthousand', 'Acircumflex', 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', None, 'Ograve', 'Uacute', 'Ucircumflex', 'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron') encodings['SymbolEncoding']=(None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'space', 'exclam', 'universal', 'numbersign', 'existential', 'percent', 'ampersand', 'suchthat', 'parenleft', 'parenright', 'asteriskmath', 'plus', 'comma', 'minus', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'congruent', 'Alpha', 'Beta', 'Chi', 'Delta', 'Epsilon', 'Phi', 'Gamma', 'Eta', 'Iota', 'theta1', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Omicron', 'Pi', 'Theta', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'sigma1', 'Omega', 'Xi', 'Psi', 'Zeta', 'bracketleft', 'therefore', 'bracketright', 'perpendicular', 'underscore', 'radicalex', 'alpha', 'beta', 'chi', 'delta', 'epsilon', 'phi', 'gamma', 'eta', 'iota', 'phi1', 'kappa', 'lambda', 'mu', 'nu', 'omicron', 'pi', 'theta', 'rho', 'sigma', 'tau', 'upsilon', 'omega1', 'omega', 'xi', 'psi', 'zeta', 'braceleft', 'bar', 'braceright', 'similar', None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'Euro', 'Upsilon1', 'minute', 'lessequal', 'fraction', 'infinity', 'florin', 'club', 'diamond', 'heart', 'spade', 'arrowboth', 'arrowleft', 'arrowup', 'arrowright', 'arrowdown', 'degree', 'plusminus', 'second', 'greaterequal', 'multiply', 'proportional', 'partialdiff', 'bullet', 'divide', 'notequal', 'equivalence', 'approxequal', 'ellipsis', 'arrowvertex', 'arrowhorizex', 'carriagereturn', 'aleph', 'Ifraktur', 'Rfraktur', 'weierstrass', 'circlemultiply', 'circleplus', 'emptyset', 'intersection', 'union', 'propersuperset', 'reflexsuperset', 'notsubset', 'propersubset', 'reflexsubset', 'element', 'notelement', 'angle', 'gradient', 'registerserif', 'copyrightserif', 'trademarkserif', 'product', 'radical', 'dotmath', 'logicalnot', 'logicaland', 'logicalor', 'arrowdblboth', 'arrowdblleft', 'arrowdblup', 'arrowdblright', 'arrowdbldown', 'lozenge', 'angleleft', 'registersans', 'copyrightsans', 'trademarksans', 'summation', 'parenlefttp', 'parenleftex', 'parenleftbt', 'bracketlefttp', 'bracketleftex', 'bracketleftbt', 'bracelefttp', 'braceleftmid', 'braceleftbt', 'braceex', None, 'angleright', 'integral', 'integraltp', 'integralex', 'integralbt', 'parenrighttp', 'parenrightex', 'parenrightbt', 'bracketrighttp', 'bracketrightex', 'bracketrightbt', 'bracerighttp', 'bracerightmid', 'bracerightbt', None) encodings['ZapfDingbatsEncoding'] = ( None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'space', 'a1', 'a2', 'a202', 'a3', 'a4', 'a5', 'a119', 'a118', 'a117', 'a11', 'a12', 'a13', 'a14', 'a15', 'a16', 'a105', 'a17', 'a18', 'a19', 'a20', 'a21', 'a22', 'a23', 'a24', 'a25', 'a26', 'a27', 'a28', 'a6', 'a7', 'a8', 'a9', 'a10', 'a29', 'a30', 'a31', 'a32', 'a33', 'a34', 'a35', 'a36', 'a37', 'a38', 'a39', 'a40', 'a41', 'a42', 'a43', 'a44', 'a45', 'a46', 'a47', 'a48', 'a49', 'a50', 'a51', 'a52', 'a53', 'a54', 'a55', 'a56', 'a57', 'a58', 'a59', 'a60', 'a61', 'a62', 'a63', 'a64', 'a65', 'a66', 'a67', 'a68', 'a69', 'a70', 'a71', 'a72', 'a73', 'a74', 'a203', 'a75', 'a204', 'a76', 'a77', 'a78', 'a79', 'a81', 'a82', 'a83', 'a84', 'a97', 'a98', 'a99', 'a100', None, 'a89', 'a90', 'a93', 'a94', 'a91', 'a92', 'a205', 'a85', 'a206', 'a86', 'a87', 'a88', 'a95', 'a96', None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'a101', 'a102', 'a103', 'a104', 'a106', 'a107', 'a108', 'a112', 'a111', 'a110', 'a109', 'a120', 'a121', 'a122', 'a123', 'a124', 'a125', 'a126', 'a127', 'a128', 'a129', 'a130', 'a131', 'a132', 'a133', 'a134', 'a135', 'a136', 'a137', 'a138', 'a139', 'a140', 'a141', 'a142', 'a143', 'a144', 'a145', 'a146', 'a147', 'a148', 'a149', 'a150', 'a151', 'a152', 'a153', 'a154', 'a155', 'a156', 'a157', 'a158', 'a159', 'a160', 'a161', 'a163', 'a164', 'a196', 'a165', 'a192', 'a166', 'a167', 'a168', 'a169', 'a170', 'a171', 'a172', 'a173', 'a162', 'a174', 'a175', 'a176', 'a177', 'a178', 'a179', 'a193', 'a180', 'a199', 'a181', 'a200', 'a182', None, 'a201', 'a183', 'a184', 'a197', 'a185', 'a194', 'a198', 'a186', 'a195', 'a187', 'a188', 'a189', 'a190', 'a191', None) encodings['StandardEncoding']=(None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,"space","exclam", "quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus", "comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon", "semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O", "P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore", "quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y", "z","braceleft","bar","braceright","asciitilde",None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None, None,None,None,"exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft", "guillemotleft","guilsinglleft","guilsinglright","fi","fl",None,"endash","dagger","daggerdbl","periodcentered",None, "paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand", None,"questiondown",None,"grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis",None,"ring", "cedilla",None,"hungarumlaut","ogonek","caron","emdash",None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,"AE",None,"ordfeminine", None,None,None,None,"Lslash","Oslash","OE","ordmasculine",None,None,None,None,None,"ae",None,None,None,"dotlessi",None,None,"lslash","oslash", "oe","germandbls",None,None,None,None) encodings['PDFDocEncoding']=(None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None, None,None,None,None,None,"breve","caron","circumflex", "dotaccent","hungarumlaut","ogonek","ring","tilde","space","exclam","quotedbl","numbersign","dollar","percent", "ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero", "one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater", "question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X", "Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g", "h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright", "asciitilde",None,"bullet","dagger","daggerdbl","ellipsis","emdash","endash","florin","fraction","guilsinglleft", "guilsinglright","minus","perthousand","quotedblbase","quotedblleft","quotedblright","quoteleft","quoteright", "quotesinglbase","trademark","fi","fl","Lslash","OE","Scaron","Ydieresis","Zcaron","dotlessi","lslash","oe", "scaron","zcaron",None,"Euro","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis", "copyright","ordfeminine","guillemotleft","logicalnot",None,"registered","macron","degree","plusminus","twosuperior", "threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright", "onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring", "AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth", "Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex", "Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae", "ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde", "ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis", "yacute","thorn","ydieresis") encodings['MacExpertEncoding'] = (None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'space', 'exclamsmall', 'Hungarumlautsmall', 'centoldstyle', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', None, 'threequartersemdash', None, 'questionsmall', None, None, None, None, 'Ethsmall', None, None, 'onequarter', 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', None, None, None, None, None, None, 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', None, 'parenrightinferior', 'Circumflexsmall', 'hypheninferior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', None, None, 'asuperior', 'centsuperior', None, None, None, None, 'Aacutesmall', 'Agravesmall', 'Acircumflexsmall', 'Adieresissmall', 'Atildesmall', 'Aringsmall', 'Ccedillasmall', 'Eacutesmall', 'Egravesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Iacutesmall', 'Igravesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ntildesmall', 'Oacutesmall', 'Ogravesmall', 'Ocircumflexsmall', 'Odieresissmall', 'Otildesmall', 'Uacutesmall', 'Ugravesmall', 'Ucircumflexsmall', 'Udieresissmall', None, 'eightsuperior', 'fourinferior', 'threeinferior', 'sixinferior', 'eightinferior', 'seveninferior', 'Scaronsmall', None, 'centinferior', 'twoinferior', None, 'Dieresissmall', None, 'Caronsmall', 'osuperior', 'fiveinferior', None, 'commainferior', 'periodinferior', 'Yacutesmall', None, 'dollarinferior', None, None, 'Thornsmall', None, 'nineinferior', 'zeroinferior', 'Zcaronsmall', 'AEsmall', 'Oslashsmall', 'questiondownsmall', 'oneinferior', 'Lslashsmall', None, None, None, None, None, None, 'Cedillasmall', None, None, None, None, None, 'OEsmall', 'figuredash', 'hyphensuperior', None, None, None, None, 'exclamdownsmall', None, 'Ydieresissmall', None, 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'ninesuperior', 'zerosuperior', None, 'esuperior', 'rsuperior', 'tsuperior', None, None, 'isuperior', 'ssuperior', 'dsuperior', None, None, None, None, None, 'lsuperior', 'Ogoneksmall', 'Brevesmall', 'Macronsmall', 'bsuperior', 'nsuperior', 'msuperior', 'commasuperior', 'periodsuperior', 'Dotaccentsmall', 'Ringsmall', None, None, None, None) ascent_descent = { 'Courier': (629, -157), 'Courier-Bold': (626, -142), 'Courier-BoldOblique': (626, -142), 'Courier-Oblique': (629, -157), 'Helvetica': (718, -207), 'Helvetica-Bold': (718, -207), 'Helvetica-BoldOblique': (718, -207), 'Helvetica-Oblique': (718, -207), 'Times-Roman': (683, -217), 'Times-Bold': (676, -205), 'Times-BoldItalic': (699, -205), 'Times-Italic': (683, -205), 'Symbol': (0, 0), 'ZapfDingbats': (0, 0) } # nuild this up one entry at a time to stay under JPython's 64k limit. widthsByFontGlyph = {} widthsByFontGlyph['Helvetica'] = {'A': 667, 'AE': 1000, 'Aacute': 667, 'Acircumflex': 667, 'Adieresis': 667, 'Agrave': 667, 'Aring': 667, 'Atilde': 667, 'B': 667, 'C': 722, 'Ccedilla': 722, 'D': 722, 'E': 667, 'Eacute': 667, 'Ecircumflex': 667, 'Edieresis': 667, 'Egrave': 667, 'Eth': 722, 'Euro': 556, 'F': 611, 'G': 778, 'H': 722, 'I': 278, 'Iacute': 278, 'Icircumflex': 278, 'Idieresis': 278, 'Igrave': 278, 'J': 500, 'K': 667, 'L': 556, 'Lslash': 556, 'M': 833, 'N': 722, 'Ntilde': 722, 'O': 778, 'OE': 1000, 'Oacute': 778, 'Ocircumflex': 778, 'Odieresis': 778, 'Ograve': 778, 'Oslash': 778, 'Otilde': 778, 'P': 667, 'Q': 778, 'R': 722, 'S': 667, 'Scaron': 667, 'T': 611, 'Thorn': 667, 'U': 722, 'Uacute': 722, 'Ucircumflex': 722, 'Udieresis': 722, 'Ugrave': 722, 'V': 667, 'W': 944, 'X': 667, 'Y': 667, 'Yacute': 667, 'Ydieresis': 667, 'Z': 611, 'Zcaron': 611, 'a': 556, 'aacute': 556, 'acircumflex': 556, 'acute': 333, 'adieresis': 556, 'ae': 889, 'agrave': 556, 'ampersand': 667, 'aring': 556, 'asciicircum': 469, 'asciitilde': 584, 'asterisk': 389, 'at': 1015, 'atilde': 556, 'b': 556, 'backslash': 278, 'bar': 260, 'braceleft': 334, 'braceright': 334, 'bracketleft': 278, 'bracketright': 278, 'breve': 333, 'brokenbar': 260, 'bullet': 350, 'c': 500, 'caron': 333, 'ccedilla': 500, 'cedilla': 333, 'cent': 556, 'circumflex': 333, 'colon': 278, 'comma': 278, 'copyright': 737, 'currency': 556, 'd': 556, 'dagger': 556, 'daggerdbl': 556, 'degree': 400, 'dieresis': 333, 'divide': 584, 'dollar': 556, 'dotaccent': 333, 'dotlessi': 278, 'e': 556, 'eacute': 556, 'ecircumflex': 556, 'edieresis': 556, 'egrave': 556, 'eight': 556, 'ellipsis': 1000, 'emdash': 1000, 'endash': 556, 'equal': 584, 'eth': 556, 'exclam': 278, 'exclamdown': 333, 'f': 278, 'fi': 500, 'five': 556, 'fl': 500, 'florin': 556, 'four': 556, 'fraction': 167, 'g': 556, 'germandbls': 611, 'grave': 333, 'greater': 584, 'guillemotleft': 556, 'guillemotright': 556, 'guilsinglleft': 333, 'guilsinglright': 333, 'h': 556, 'hungarumlaut': 333, 'hyphen': 333, 'i': 222, 'iacute': 278, 'icircumflex': 278, 'idieresis': 278, 'igrave': 278, 'j': 222, 'k': 500, 'l': 222, 'less': 584, 'logicalnot': 584, 'lslash': 222, 'm': 833, 'macron': 333, 'minus': 584, 'mu': 556, 'multiply': 584, 'n': 556, 'nine': 556, 'ntilde': 556, 'numbersign': 556, 'o': 556, 'oacute': 556, 'ocircumflex': 556, 'odieresis': 556, 'oe': 944, 'ogonek': 333, 'ograve': 556, 'one': 556, 'onehalf': 834, 'onequarter': 834, 'onesuperior': 333, 'ordfeminine': 370, 'ordmasculine': 365, 'oslash': 611, 'otilde': 556, 'p': 556, 'paragraph': 537, 'parenleft': 333, 'parenright': 333, 'percent': 889, 'period': 278, 'periodcentered': 278, 'perthousand': 1000, 'plus': 584, 'plusminus': 584, 'q': 556, 'question': 556, 'questiondown': 611, 'quotedbl': 355, 'quotedblbase': 333, 'quotedblleft': 333, 'quotedblright': 333, 'quoteleft': 222, 'quoteright': 222, 'quotesinglbase': 222, 'quotesingle': 191, 'r': 333, 'registered': 737, 'ring': 333, 's': 500, 'scaron': 500, 'section': 556, 'semicolon': 278, 'seven': 556, 'six': 556, 'slash': 278, 'space': 278, 'sterling': 556, 't': 278, 'thorn': 556, 'three': 556, 'threequarters': 834, 'threesuperior': 333, 'tilde': 333, 'trademark': 1000, 'two': 556, 'twosuperior': 333, 'u': 556, 'uacute': 556, 'ucircumflex': 556, 'udieresis': 556, 'ugrave': 556, 'underscore': 556, 'v': 500, 'w': 722, 'x': 500, 'y': 500, 'yacute': 500, 'ydieresis': 500, 'yen': 556, 'z': 500, 'zcaron': 500, 'zero': 556} widthsByFontGlyph['Helvetica-Bold'] = {'A': 722, 'AE': 1000, 'Aacute': 722, 'Acircumflex': 722, 'Adieresis': 722, 'Agrave': 722, 'Aring': 722, 'Atilde': 722, 'B': 722, 'C': 722, 'Ccedilla': 722, 'D': 722, 'E': 667, 'Eacute': 667, 'Ecircumflex': 667, 'Edieresis': 667, 'Egrave': 667, 'Eth': 722, 'Euro': 556, 'F': 611, 'G': 778, 'H': 722, 'I': 278, 'Iacute': 278, 'Icircumflex': 278, 'Idieresis': 278, 'Igrave': 278, 'J': 556, 'K': 722, 'L': 611, 'Lslash': 611, 'M': 833, 'N': 722, 'Ntilde': 722, 'O': 778, 'OE': 1000, 'Oacute': 778, 'Ocircumflex': 778, 'Odieresis': 778, 'Ograve': 778, 'Oslash': 778, 'Otilde': 778, 'P': 667, 'Q': 778, 'R': 722, 'S': 667, 'Scaron': 667, 'T': 611, 'Thorn': 667, 'U': 722, 'Uacute': 722, 'Ucircumflex': 722, 'Udieresis': 722, 'Ugrave': 722, 'V': 667, 'W': 944, 'X': 667, 'Y': 667, 'Yacute': 667, 'Ydieresis': 667, 'Z': 611, 'Zcaron': 611, 'a': 556, 'aacute': 556, 'acircumflex': 556, 'acute': 333, 'adieresis': 556, 'ae': 889, 'agrave': 556, 'ampersand': 722, 'aring': 556, 'asciicircum': 584, 'asciitilde': 584, 'asterisk': 389, 'at': 975, 'atilde': 556, 'b': 611, 'backslash': 278, 'bar': 280, 'braceleft': 389, 'braceright': 389, 'bracketleft': 333, 'bracketright': 333, 'breve': 333, 'brokenbar': 280, 'bullet': 350, 'c': 556, 'caron': 333, 'ccedilla': 556, 'cedilla': 333, 'cent': 556, 'circumflex': 333, 'colon': 333, 'comma': 278, 'copyright': 737, 'currency': 556, 'd': 611, 'dagger': 556, 'daggerdbl': 556, 'degree': 400, 'dieresis': 333, 'divide': 584, 'dollar': 556, 'dotaccent': 333, 'dotlessi': 278, 'e': 556, 'eacute': 556, 'ecircumflex': 556, 'edieresis': 556, 'egrave': 556, 'eight': 556, 'ellipsis': 1000, 'emdash': 1000, 'endash': 556, 'equal': 584, 'eth': 611, 'exclam': 333, 'exclamdown': 333, 'f': 333, 'fi': 611, 'five': 556, 'fl': 611, 'florin': 556, 'four': 556, 'fraction': 167, 'g': 611, 'germandbls': 611, 'grave': 333, 'greater': 584, 'guillemotleft': 556, 'guillemotright': 556, 'guilsinglleft': 333, 'guilsinglright': 333, 'h': 611, 'hungarumlaut': 333, 'hyphen': 333, 'i': 278, 'iacute': 278, 'icircumflex': 278, 'idieresis': 278, 'igrave': 278, 'j': 278, 'k': 556, 'l': 278, 'less': 584, 'logicalnot': 584, 'lslash': 278, 'm': 889, 'macron': 333, 'minus': 584, 'mu': 611, 'multiply': 584, 'n': 611, 'nine': 556, 'ntilde': 611, 'numbersign': 556, 'o': 611, 'oacute': 611, 'ocircumflex': 611, 'odieresis': 611, 'oe': 944, 'ogonek': 333, 'ograve': 611, 'one': 556, 'onehalf': 834, 'onequarter': 834, 'onesuperior': 333, 'ordfeminine': 370, 'ordmasculine': 365, 'oslash': 611, 'otilde': 611, 'p': 611, 'paragraph': 556, 'parenleft': 333, 'parenright': 333, 'percent': 889, 'period': 278, 'periodcentered': 278, 'perthousand': 1000, 'plus': 584, 'plusminus': 584, 'q': 611, 'question': 611, 'questiondown': 611, 'quotedbl': 474, 'quotedblbase': 500, 'quotedblleft': 500, 'quotedblright': 500, 'quoteleft': 278, 'quoteright': 278, 'quotesinglbase': 278, 'quotesingle': 238, 'r': 389, 'registered': 737, 'ring': 333, 's': 556, 'scaron': 556, 'section': 556, 'semicolon': 333, 'seven': 556, 'six': 556, 'slash': 278, 'space': 278, 'sterling': 556, 't': 333, 'thorn': 611, 'three': 556, 'threequarters': 834, 'threesuperior': 333, 'tilde': 333, 'trademark': 1000, 'two': 556, 'twosuperior': 333, 'u': 611, 'uacute': 611, 'ucircumflex': 611, 'udieresis': 611, 'ugrave': 611, 'underscore': 556, 'v': 556, 'w': 778, 'x': 556, 'y': 556, 'yacute': 556, 'ydieresis': 556, 'yen': 556, 'z': 500, 'zcaron': 500, 'zero': 556} widthsByFontGlyph['Helvetica-Oblique'] = {'A': 667, 'AE': 1000, 'Aacute': 667, 'Acircumflex': 667, 'Adieresis': 667, 'Agrave': 667, 'Aring': 667, 'Atilde': 667, 'B': 667, 'C': 722, 'Ccedilla': 722, 'D': 722, 'E': 667, 'Eacute': 667, 'Ecircumflex': 667, 'Edieresis': 667, 'Egrave': 667, 'Eth': 722, 'Euro': 556, 'F': 611, 'G': 778, 'H': 722, 'I': 278, 'Iacute': 278, 'Icircumflex': 278, 'Idieresis': 278, 'Igrave': 278, 'J': 500, 'K': 667, 'L': 556, 'Lslash': 556, 'M': 833, 'N': 722, 'Ntilde': 722, 'O': 778, 'OE': 1000, 'Oacute': 778, 'Ocircumflex': 778, 'Odieresis': 778, 'Ograve': 778, 'Oslash': 778, 'Otilde': 778, 'P': 667, 'Q': 778, 'R': 722, 'S': 667, 'Scaron': 667, 'T': 611, 'Thorn': 667, 'U': 722, 'Uacute': 722, 'Ucircumflex': 722, 'Udieresis': 722, 'Ugrave': 722, 'V': 667, 'W': 944, 'X': 667, 'Y': 667, 'Yacute': 667, 'Ydieresis': 667, 'Z': 611, 'Zcaron': 611, 'a': 556, 'aacute': 556, 'acircumflex': 556, 'acute': 333, 'adieresis': 556, 'ae': 889, 'agrave': 556, 'ampersand': 667, 'aring': 556, 'asciicircum': 469, 'asciitilde': 584, 'asterisk': 389, 'at': 1015, 'atilde': 556, 'b': 556, 'backslash': 278, 'bar': 260, 'braceleft': 334, 'braceright': 334, 'bracketleft': 278, 'bracketright': 278, 'breve': 333, 'brokenbar': 260, 'bullet': 350, 'c': 500, 'caron': 333, 'ccedilla': 500, 'cedilla': 333, 'cent': 556, 'circumflex': 333, 'colon': 278, 'comma': 278, 'copyright': 737, 'currency': 556, 'd': 556, 'dagger': 556, 'daggerdbl': 556, 'degree': 400, 'dieresis': 333, 'divide': 584, 'dollar': 556, 'dotaccent': 333, 'dotlessi': 278, 'e': 556, 'eacute': 556, 'ecircumflex': 556, 'edieresis': 556, 'egrave': 556, 'eight': 556, 'ellipsis': 1000, 'emdash': 1000, 'endash': 556, 'equal': 584, 'eth': 556, 'exclam': 278, 'exclamdown': 333, 'f': 278, 'fi': 500, 'five': 556, 'fl': 500, 'florin': 556, 'four': 556, 'fraction': 167, 'g': 556, 'germandbls': 611, 'grave': 333, 'greater': 584, 'guillemotleft': 556, 'guillemotright': 556, 'guilsinglleft': 333, 'guilsinglright': 333, 'h': 556, 'hungarumlaut': 333, 'hyphen': 333, 'i': 222, 'iacute': 278, 'icircumflex': 278, 'idieresis': 278, 'igrave': 278, 'j': 222, 'k': 500, 'l': 222, 'less': 584, 'logicalnot': 584, 'lslash': 222, 'm': 833, 'macron': 333, 'minus': 584, 'mu': 556, 'multiply': 584, 'n': 556, 'nine': 556, 'ntilde': 556, 'numbersign': 556, 'o': 556, 'oacute': 556, 'ocircumflex': 556, 'odieresis': 556, 'oe': 944, 'ogonek': 333, 'ograve': 556, 'one': 556, 'onehalf': 834, 'onequarter': 834, 'onesuperior': 333, 'ordfeminine': 370, 'ordmasculine': 365, 'oslash': 611, 'otilde': 556, 'p': 556, 'paragraph': 537, 'parenleft': 333, 'parenright': 333, 'percent': 889, 'period': 278, 'periodcentered': 278, 'perthousand': 1000, 'plus': 584, 'plusminus': 584, 'q': 556, 'question': 556, 'questiondown': 611, 'quotedbl': 355, 'quotedblbase': 333, 'quotedblleft': 333, 'quotedblright': 333, 'quoteleft': 222, 'quoteright': 222, 'quotesinglbase': 222, 'quotesingle': 191, 'r': 333, 'registered': 737, 'ring': 333, 's': 500, 'scaron': 500, 'section': 556, 'semicolon': 278, 'seven': 556, 'six': 556, 'slash': 278, 'space': 278, 'sterling': 556, 't': 278, 'thorn': 556, 'three': 556, 'threequarters': 834, 'threesuperior': 333, 'tilde': 333, 'trademark': 1000, 'two': 556, 'twosuperior': 333, 'u': 556, 'uacute': 556, 'ucircumflex': 556, 'udieresis': 556, 'ugrave': 556, 'underscore': 556, 'v': 500, 'w': 722, 'x': 500, 'y': 500, 'yacute': 500, 'ydieresis': 500, 'yen': 556, 'z': 500, 'zcaron': 500, 'zero': 556} widthsByFontGlyph['Helvetica-BoldOblique'] = {'A': 722, 'AE': 1000, 'Aacute': 722, 'Acircumflex': 722, 'Adieresis': 722, 'Agrave': 722, 'Aring': 722, 'Atilde': 722, 'B': 722, 'C': 722, 'Ccedilla': 722, 'D': 722, 'E': 667, 'Eacute': 667, 'Ecircumflex': 667, 'Edieresis': 667, 'Egrave': 667, 'Eth': 722, 'Euro': 556, 'F': 611, 'G': 778, 'H': 722, 'I': 278, 'Iacute': 278, 'Icircumflex': 278, 'Idieresis': 278, 'Igrave': 278, 'J': 556, 'K': 722, 'L': 611, 'Lslash': 611, 'M': 833, 'N': 722, 'Ntilde': 722, 'O': 778, 'OE': 1000, 'Oacute': 778, 'Ocircumflex': 778, 'Odieresis': 778, 'Ograve': 778, 'Oslash': 778, 'Otilde': 778, 'P': 667, 'Q': 778, 'R': 722, 'S': 667, 'Scaron': 667, 'T': 611, 'Thorn': 667, 'U': 722, 'Uacute': 722, 'Ucircumflex': 722, 'Udieresis': 722, 'Ugrave': 722, 'V': 667, 'W': 944, 'X': 667, 'Y': 667, 'Yacute': 667, 'Ydieresis': 667, 'Z': 611, 'Zcaron': 611, 'a': 556, 'aacute': 556, 'acircumflex': 556, 'acute': 333, 'adieresis': 556, 'ae': 889, 'agrave': 556, 'ampersand': 722, 'aring': 556, 'asciicircum': 584, 'asciitilde': 584, 'asterisk': 389, 'at': 975, 'atilde': 556, 'b': 611, 'backslash': 278, 'bar': 280, 'braceleft': 389, 'braceright': 389, 'bracketleft': 333, 'bracketright': 333, 'breve': 333, 'brokenbar': 280, 'bullet': 350, 'c': 556, 'caron': 333, 'ccedilla': 556, 'cedilla': 333, 'cent': 556, 'circumflex': 333, 'colon': 333, 'comma': 278, 'copyright': 737, 'currency': 556, 'd': 611, 'dagger': 556, 'daggerdbl': 556, 'degree': 400, 'dieresis': 333, 'divide': 584, 'dollar': 556, 'dotaccent': 333, 'dotlessi': 278, 'e': 556, 'eacute': 556, 'ecircumflex': 556, 'edieresis': 556, 'egrave': 556, 'eight': 556, 'ellipsis': 1000, 'emdash': 1000, 'endash': 556, 'equal': 584, 'eth': 611, 'exclam': 333, 'exclamdown': 333, 'f': 333, 'fi': 611, 'five': 556, 'fl': 611, 'florin': 556, 'four': 556, 'fraction': 167, 'g': 611, 'germandbls': 611, 'grave': 333, 'greater': 584, 'guillemotleft': 556, 'guillemotright': 556, 'guilsinglleft': 333, 'guilsinglright': 333, 'h': 611, 'hungarumlaut': 333, 'hyphen': 333, 'i': 278, 'iacute': 278, 'icircumflex': 278, 'idieresis': 278, 'igrave': 278, 'j': 278, 'k': 556, 'l': 278, 'less': 584, 'logicalnot': 584, 'lslash': 278, 'm': 889, 'macron': 333, 'minus': 584, 'mu': 611, 'multiply': 584, 'n': 611, 'nine': 556, 'ntilde': 611, 'numbersign': 556, 'o': 611, 'oacute': 611, 'ocircumflex': 611, 'odieresis': 611, 'oe': 944, 'ogonek': 333, 'ograve': 611, 'one': 556, 'onehalf': 834, 'onequarter': 834, 'onesuperior': 333, 'ordfeminine': 370, 'ordmasculine': 365, 'oslash': 611, 'otilde': 611, 'p': 611, 'paragraph': 556, 'parenleft': 333, 'parenright': 333, 'percent': 889, 'period': 278, 'periodcentered': 278, 'perthousand': 1000, 'plus': 584, 'plusminus': 584, 'q': 611, 'question': 611, 'questiondown': 611, 'quotedbl': 474, 'quotedblbase': 500, 'quotedblleft': 500, 'quotedblright': 500, 'quoteleft': 278, 'quoteright': 278, 'quotesinglbase': 278, 'quotesingle': 238, 'r': 389, 'registered': 737, 'ring': 333, 's': 556, 'scaron': 556, 'section': 556, 'semicolon': 333, 'seven': 556, 'six': 556, 'slash': 278, 'space': 278, 'sterling': 556, 't': 333, 'thorn': 611, 'three': 556, 'threequarters': 834, 'threesuperior': 333, 'tilde': 333, 'trademark': 1000, 'two': 556, 'twosuperior': 333, 'u': 611, 'uacute': 611, 'ucircumflex': 611, 'udieresis': 611, 'ugrave': 611, 'underscore': 556, 'v': 556, 'w': 778, 'x': 556, 'y': 556, 'yacute': 556, 'ydieresis': 556, 'yen': 556, 'z': 500, 'zcaron': 500, 'zero': 556} # Courier can be expressed more compactly! _w = {} for charname in widthsByFontGlyph['Helvetica']: _w[charname] = 600 widthsByFontGlyph['Courier'] = _w widthsByFontGlyph['Courier-Bold'] = _w widthsByFontGlyph['Courier-Oblique'] = _w widthsByFontGlyph['Courier-BoldOblique'] = _w widthsByFontGlyph['Times-Roman'] = {'A': 722, 'AE': 889, 'Aacute': 722, 'Acircumflex': 722, 'Adieresis': 722, 'Agrave': 722, 'Aring': 722, 'Atilde': 722, 'B': 667, 'C': 667, 'Ccedilla': 667, 'D': 722, 'E': 611, 'Eacute': 611, 'Ecircumflex': 611, 'Edieresis': 611, 'Egrave': 611, 'Eth': 722, 'Euro': 500, 'F': 556, 'G': 722, 'H': 722, 'I': 333, 'Iacute': 333, 'Icircumflex': 333, 'Idieresis': 333, 'Igrave': 333, 'J': 389, 'K': 722, 'L': 611, 'Lslash': 611, 'M': 889, 'N': 722, 'Ntilde': 722, 'O': 722, 'OE': 889, 'Oacute': 722, 'Ocircumflex': 722, 'Odieresis': 722, 'Ograve': 722, 'Oslash': 722, 'Otilde': 722, 'P': 556, 'Q': 722, 'R': 667, 'S': 556, 'Scaron': 556, 'T': 611, 'Thorn': 556, 'U': 722, 'Uacute': 722, 'Ucircumflex': 722, 'Udieresis': 722, 'Ugrave': 722, 'V': 722, 'W': 944, 'X': 722, 'Y': 722, 'Yacute': 722, 'Ydieresis': 722, 'Z': 611, 'Zcaron': 611, 'a': 444, 'aacute': 444, 'acircumflex': 444, 'acute': 333, 'adieresis': 444, 'ae': 667, 'agrave': 444, 'ampersand': 778, 'aring': 444, 'asciicircum': 469, 'asciitilde': 541, 'asterisk': 500, 'at': 921, 'atilde': 444, 'b': 500, 'backslash': 278, 'bar': 200, 'braceleft': 480, 'braceright': 480, 'bracketleft': 333, 'bracketright': 333, 'breve': 333, 'brokenbar': 200, 'bullet': 350, 'c': 444, 'caron': 333, 'ccedilla': 444, 'cedilla': 333, 'cent': 500, 'circumflex': 333, 'colon': 278, 'comma': 250, 'copyright': 760, 'currency': 500, 'd': 500, 'dagger': 500, 'daggerdbl': 500, 'degree': 400, 'dieresis': 333, 'divide': 564, 'dollar': 500, 'dotaccent': 333, 'dotlessi': 278, 'e': 444, 'eacute': 444, 'ecircumflex': 444, 'edieresis': 444, 'egrave': 444, 'eight': 500, 'ellipsis': 1000, 'emdash': 1000, 'endash': 500, 'equal': 564, 'eth': 500, 'exclam': 333, 'exclamdown': 333, 'f': 333, 'fi': 556, 'five': 500, 'fl': 556, 'florin': 500, 'four': 500, 'fraction': 167, 'g': 500, 'germandbls': 500, 'grave': 333, 'greater': 564, 'guillemotleft': 500, 'guillemotright': 500, 'guilsinglleft': 333, 'guilsinglright': 333, 'h': 500, 'hungarumlaut': 333, 'hyphen': 333, 'i': 278, 'iacute': 278, 'icircumflex': 278, 'idieresis': 278, 'igrave': 278, 'j': 278, 'k': 500, 'l': 278, 'less': 564, 'logicalnot': 564, 'lslash': 278, 'm': 778, 'macron': 333, 'minus': 564, 'mu': 500, 'multiply': 564, 'n': 500, 'nine': 500, 'ntilde': 500, 'numbersign': 500, 'o': 500, 'oacute': 500, 'ocircumflex': 500, 'odieresis': 500, 'oe': 722, 'ogonek': 333, 'ograve': 500, 'one': 500, 'onehalf': 750, 'onequarter': 750, 'onesuperior': 300, 'ordfeminine': 276, 'ordmasculine': 310, 'oslash': 500, 'otilde': 500, 'p': 500, 'paragraph': 453, 'parenleft': 333, 'parenright': 333, 'percent': 833, 'period': 250, 'periodcentered': 250, 'perthousand': 1000, 'plus': 564, 'plusminus': 564, 'q': 500, 'question': 444, 'questiondown': 444, 'quotedbl': 408, 'quotedblbase': 444, 'quotedblleft': 444, 'quotedblright': 444, 'quoteleft': 333, 'quoteright': 333, 'quotesinglbase': 333, 'quotesingle': 180, 'r': 333, 'registered': 760, 'ring': 333, 's': 389, 'scaron': 389, 'section': 500, 'semicolon': 278, 'seven': 500, 'six': 500, 'slash': 278, 'space': 250, 'sterling': 500, 't': 278, 'thorn': 500, 'three': 500, 'threequarters': 750, 'threesuperior': 300, 'tilde': 333, 'trademark': 980, 'two': 500, 'twosuperior': 300, 'u': 500, 'uacute': 500, 'ucircumflex': 500, 'udieresis': 500, 'ugrave': 500, 'underscore': 500, 'v': 500, 'w': 722, 'x': 500, 'y': 500, 'yacute': 500, 'ydieresis': 500, 'yen': 500, 'z': 444, 'zcaron': 444, 'zero': 500} widthsByFontGlyph['Times-Bold'] = {'A': 722, 'AE': 1000, 'Aacute': 722, 'Acircumflex': 722, 'Adieresis': 722, 'Agrave': 722, 'Aring': 722, 'Atilde': 722, 'B': 667, 'C': 722, 'Ccedilla': 722, 'D': 722, 'E': 667, 'Eacute': 667, 'Ecircumflex': 667, 'Edieresis': 667, 'Egrave': 667, 'Eth': 722, 'Euro': 500, 'F': 611, 'G': 778, 'H': 778, 'I': 389, 'Iacute': 389, 'Icircumflex': 389, 'Idieresis': 389, 'Igrave': 389, 'J': 500, 'K': 778, 'L': 667, 'Lslash': 667, 'M': 944, 'N': 722, 'Ntilde': 722, 'O': 778, 'OE': 1000, 'Oacute': 778, 'Ocircumflex': 778, 'Odieresis': 778, 'Ograve': 778, 'Oslash': 778, 'Otilde': 778, 'P': 611, 'Q': 778, 'R': 722, 'S': 556, 'Scaron': 556, 'T': 667, 'Thorn': 611, 'U': 722, 'Uacute': 722, 'Ucircumflex': 722, 'Udieresis': 722, 'Ugrave': 722, 'V': 722, 'W': 1000, 'X': 722, 'Y': 722, 'Yacute': 722, 'Ydieresis': 722, 'Z': 667, 'Zcaron': 667, 'a': 500, 'aacute': 500, 'acircumflex': 500, 'acute': 333, 'adieresis': 500, 'ae': 722, 'agrave': 500, 'ampersand': 833, 'aring': 500, 'asciicircum': 581, 'asciitilde': 520, 'asterisk': 500, 'at': 930, 'atilde': 500, 'b': 556, 'backslash': 278, 'bar': 220, 'braceleft': 394, 'braceright': 394, 'bracketleft': 333, 'bracketright': 333, 'breve': 333, 'brokenbar': 220, 'bullet': 350, 'c': 444, 'caron': 333, 'ccedilla': 444, 'cedilla': 333, 'cent': 500, 'circumflex': 333, 'colon': 333, 'comma': 250, 'copyright': 747, 'currency': 500, 'd': 556, 'dagger': 500, 'daggerdbl': 500, 'degree': 400, 'dieresis': 333, 'divide': 570, 'dollar': 500, 'dotaccent': 333, 'dotlessi': 278, 'e': 444, 'eacute': 444, 'ecircumflex': 444, 'edieresis': 444, 'egrave': 444, 'eight': 500, 'ellipsis': 1000, 'emdash': 1000, 'endash': 500, 'equal': 570, 'eth': 500, 'exclam': 333, 'exclamdown': 333, 'f': 333, 'fi': 556, 'five': 500, 'fl': 556, 'florin': 500, 'four': 500, 'fraction': 167, 'g': 500, 'germandbls': 556, 'grave': 333, 'greater': 570, 'guillemotleft': 500, 'guillemotright': 500, 'guilsinglleft': 333, 'guilsinglright': 333, 'h': 556, 'hungarumlaut': 333, 'hyphen': 333, 'i': 278, 'iacute': 278, 'icircumflex': 278, 'idieresis': 278, 'igrave': 278, 'j': 333, 'k': 556, 'l': 278, 'less': 570, 'logicalnot': 570, 'lslash': 278, 'm': 833, 'macron': 333, 'minus': 570, 'mu': 556, 'multiply': 570, 'n': 556, 'nine': 500, 'ntilde': 556, 'numbersign': 500, 'o': 500, 'oacute': 500, 'ocircumflex': 500, 'odieresis': 500, 'oe': 722, 'ogonek': 333, 'ograve': 500, 'one': 500, 'onehalf': 750, 'onequarter': 750, 'onesuperior': 300, 'ordfeminine': 300, 'ordmasculine': 330, 'oslash': 500, 'otilde': 500, 'p': 556, 'paragraph': 540, 'parenleft': 333, 'parenright': 333, 'percent': 1000, 'period': 250, 'periodcentered': 250, 'perthousand': 1000, 'plus': 570, 'plusminus': 570, 'q': 556, 'question': 500, 'questiondown': 500, 'quotedbl': 555, 'quotedblbase': 500, 'quotedblleft': 500, 'quotedblright': 500, 'quoteleft': 333, 'quoteright': 333, 'quotesinglbase': 333, 'quotesingle': 278, 'r': 444, 'registered': 747, 'ring': 333, 's': 389, 'scaron': 389, 'section': 500, 'semicolon': 333, 'seven': 500, 'six': 500, 'slash': 278, 'space': 250, 'sterling': 500, 't': 333, 'thorn': 556, 'three': 500, 'threequarters': 750, 'threesuperior': 300, 'tilde': 333, 'trademark': 1000, 'two': 500, 'twosuperior': 300, 'u': 556, 'uacute': 556, 'ucircumflex': 556, 'udieresis': 556, 'ugrave': 556, 'underscore': 500, 'v': 500, 'w': 722, 'x': 500, 'y': 500, 'yacute': 500, 'ydieresis': 500, 'yen': 500, 'z': 444, 'zcaron': 444, 'zero': 500} widthsByFontGlyph['Times-Italic'] = {'A': 611, 'AE': 889, 'Aacute': 611, 'Acircumflex': 611, 'Adieresis': 611, 'Agrave': 611, 'Aring': 611, 'Atilde': 611, 'B': 611, 'C': 667, 'Ccedilla': 667, 'D': 722, 'E': 611, 'Eacute': 611, 'Ecircumflex': 611, 'Edieresis': 611, 'Egrave': 611, 'Eth': 722, 'Euro': 500, 'F': 611, 'G': 722, 'H': 722, 'I': 333, 'Iacute': 333, 'Icircumflex': 333, 'Idieresis': 333, 'Igrave': 333, 'J': 444, 'K': 667, 'L': 556, 'Lslash': 556, 'M': 833, 'N': 667, 'Ntilde': 667, 'O': 722, 'OE': 944, 'Oacute': 722, 'Ocircumflex': 722, 'Odieresis': 722, 'Ograve': 722, 'Oslash': 722, 'Otilde': 722, 'P': 611, 'Q': 722, 'R': 611, 'S': 500, 'Scaron': 500, 'T': 556, 'Thorn': 611, 'U': 722, 'Uacute': 722, 'Ucircumflex': 722, 'Udieresis': 722, 'Ugrave': 722, 'V': 611, 'W': 833, 'X': 611, 'Y': 556, 'Yacute': 556, 'Ydieresis': 556, 'Z': 556, 'Zcaron': 556, 'a': 500, 'aacute': 500, 'acircumflex': 500, 'acute': 333, 'adieresis': 500, 'ae': 667, 'agrave': 500, 'ampersand': 778, 'aring': 500, 'asciicircum': 422, 'asciitilde': 541, 'asterisk': 500, 'at': 920, 'atilde': 500, 'b': 500, 'backslash': 278, 'bar': 275, 'braceleft': 400, 'braceright': 400, 'bracketleft': 389, 'bracketright': 389, 'breve': 333, 'brokenbar': 275, 'bullet': 350, 'c': 444, 'caron': 333, 'ccedilla': 444, 'cedilla': 333, 'cent': 500, 'circumflex': 333, 'colon': 333, 'comma': 250, 'copyright': 760, 'currency': 500, 'd': 500, 'dagger': 500, 'daggerdbl': 500, 'degree': 400, 'dieresis': 333, 'divide': 675, 'dollar': 500, 'dotaccent': 333, 'dotlessi': 278, 'e': 444, 'eacute': 444, 'ecircumflex': 444, 'edieresis': 444, 'egrave': 444, 'eight': 500, 'ellipsis': 889, 'emdash': 889, 'endash': 500, 'equal': 675, 'eth': 500, 'exclam': 333, 'exclamdown': 389, 'f': 278, 'fi': 500, 'five': 500, 'fl': 500, 'florin': 500, 'four': 500, 'fraction': 167, 'g': 500, 'germandbls': 500, 'grave': 333, 'greater': 675, 'guillemotleft': 500, 'guillemotright': 500, 'guilsinglleft': 333, 'guilsinglright': 333, 'h': 500, 'hungarumlaut': 333, 'hyphen': 333, 'i': 278, 'iacute': 278, 'icircumflex': 278, 'idieresis': 278, 'igrave': 278, 'j': 278, 'k': 444, 'l': 278, 'less': 675, 'logicalnot': 675, 'lslash': 278, 'm': 722, 'macron': 333, 'minus': 675, 'mu': 500, 'multiply': 675, 'n': 500, 'nine': 500, 'ntilde': 500, 'numbersign': 500, 'o': 500, 'oacute': 500, 'ocircumflex': 500, 'odieresis': 500, 'oe': 667, 'ogonek': 333, 'ograve': 500, 'one': 500, 'onehalf': 750, 'onequarter': 750, 'onesuperior': 300, 'ordfeminine': 276, 'ordmasculine': 310, 'oslash': 500, 'otilde': 500, 'p': 500, 'paragraph': 523, 'parenleft': 333, 'parenright': 333, 'percent': 833, 'period': 250, 'periodcentered': 250, 'perthousand': 1000, 'plus': 675, 'plusminus': 675, 'q': 500, 'question': 500, 'questiondown': 500, 'quotedbl': 420, 'quotedblbase': 556, 'quotedblleft': 556, 'quotedblright': 556, 'quoteleft': 333, 'quoteright': 333, 'quotesinglbase': 333, 'quotesingle': 214, 'r': 389, 'registered': 760, 'ring': 333, 's': 389, 'scaron': 389, 'section': 500, 'semicolon': 333, 'seven': 500, 'six': 500, 'slash': 278, 'space': 250, 'sterling': 500, 't': 278, 'thorn': 500, 'three': 500, 'threequarters': 750, 'threesuperior': 300, 'tilde': 333, 'trademark': 980, 'two': 500, 'twosuperior': 300, 'u': 500, 'uacute': 500, 'ucircumflex': 500, 'udieresis': 500, 'ugrave': 500, 'underscore': 500, 'v': 444, 'w': 667, 'x': 444, 'y': 444, 'yacute': 444, 'ydieresis': 444, 'yen': 500, 'z': 389, 'zcaron': 389, 'zero': 500} widthsByFontGlyph['Times-BoldItalic'] = {'A': 667, 'AE': 944, 'Aacute': 667, 'Acircumflex': 667, 'Adieresis': 667, 'Agrave': 667, 'Aring': 667, 'Atilde': 667, 'B': 667, 'C': 667, 'Ccedilla': 667, 'D': 722, 'E': 667, 'Eacute': 667, 'Ecircumflex': 667, 'Edieresis': 667, 'Egrave': 667, 'Eth': 722, 'Euro': 500, 'F': 667, 'G': 722, 'H': 778, 'I': 389, 'Iacute': 389, 'Icircumflex': 389, 'Idieresis': 389, 'Igrave': 389, 'J': 500, 'K': 667, 'L': 611, 'Lslash': 611, 'M': 889, 'N': 722, 'Ntilde': 722, 'O': 722, 'OE': 944, 'Oacute': 722, 'Ocircumflex': 722, 'Odieresis': 722, 'Ograve': 722, 'Oslash': 722, 'Otilde': 722, 'P': 611, 'Q': 722, 'R': 667, 'S': 556, 'Scaron': 556, 'T': 611, 'Thorn': 611, 'U': 722, 'Uacute': 722, 'Ucircumflex': 722, 'Udieresis': 722, 'Ugrave': 722, 'V': 667, 'W': 889, 'X': 667, 'Y': 611, 'Yacute': 611, 'Ydieresis': 611, 'Z': 611, 'Zcaron': 611, 'a': 500, 'aacute': 500, 'acircumflex': 500, 'acute': 333, 'adieresis': 500, 'ae': 722, 'agrave': 500, 'ampersand': 778, 'aring': 500, 'asciicircum': 570, 'asciitilde': 570, 'asterisk': 500, 'at': 832, 'atilde': 500, 'b': 500, 'backslash': 278, 'bar': 220, 'braceleft': 348, 'braceright': 348, 'bracketleft': 333, 'bracketright': 333, 'breve': 333, 'brokenbar': 220, 'bullet': 350, 'c': 444, 'caron': 333, 'ccedilla': 444, 'cedilla': 333, 'cent': 500, 'circumflex': 333, 'colon': 333, 'comma': 250, 'copyright': 747, 'currency': 500, 'd': 500, 'dagger': 500, 'daggerdbl': 500, 'degree': 400, 'dieresis': 333, 'divide': 570, 'dollar': 500, 'dotaccent': 333, 'dotlessi': 278, 'e': 444, 'eacute': 444, 'ecircumflex': 444, 'edieresis': 444, 'egrave': 444, 'eight': 500, 'ellipsis': 1000, 'emdash': 1000, 'endash': 500, 'equal': 570, 'eth': 500, 'exclam': 389, 'exclamdown': 389, 'f': 333, 'fi': 556, 'five': 500, 'fl': 556, 'florin': 500, 'four': 500, 'fraction': 167, 'g': 500, 'germandbls': 500, 'grave': 333, 'greater': 570, 'guillemotleft': 500, 'guillemotright': 500, 'guilsinglleft': 333, 'guilsinglright': 333, 'h': 556, 'hungarumlaut': 333, 'hyphen': 333, 'i': 278, 'iacute': 278, 'icircumflex': 278, 'idieresis': 278, 'igrave': 278, 'j': 278, 'k': 500, 'l': 278, 'less': 570, 'logicalnot': 606, 'lslash': 278, 'm': 778, 'macron': 333, 'minus': 606, 'mu': 576, 'multiply': 570, 'n': 556, 'nine': 500, 'ntilde': 556, 'numbersign': 500, 'o': 500, 'oacute': 500, 'ocircumflex': 500, 'odieresis': 500, 'oe': 722, 'ogonek': 333, 'ograve': 500, 'one': 500, 'onehalf': 750, 'onequarter': 750, 'onesuperior': 300, 'ordfeminine': 266, 'ordmasculine': 300, 'oslash': 500, 'otilde': 500, 'p': 500, 'paragraph': 500, 'parenleft': 333, 'parenright': 333, 'percent': 833, 'period': 250, 'periodcentered': 250, 'perthousand': 1000, 'plus': 570, 'plusminus': 570, 'q': 500, 'question': 500, 'questiondown': 500, 'quotedbl': 555, 'quotedblbase': 500, 'quotedblleft': 500, 'quotedblright': 500, 'quoteleft': 333, 'quoteright': 333, 'quotesinglbase': 333, 'quotesingle': 278, 'r': 389, 'registered': 747, 'ring': 333, 's': 389, 'scaron': 389, 'section': 500, 'semicolon': 333, 'seven': 500, 'six': 500, 'slash': 278, 'space': 250, 'sterling': 500, 't': 278, 'thorn': 500, 'three': 500, 'threequarters': 750, 'threesuperior': 300, 'tilde': 333, 'trademark': 1000, 'two': 500, 'twosuperior': 300, 'u': 556, 'uacute': 556, 'ucircumflex': 556, 'udieresis': 556, 'ugrave': 556, 'underscore': 500, 'v': 444, 'w': 667, 'x': 500, 'y': 444, 'yacute': 444, 'ydieresis': 444, 'yen': 500, 'z': 389, 'zcaron': 389, 'zero': 500} widthsByFontGlyph['Symbol'] = {'Alpha': 722, 'Beta': 667, 'Chi': 722, 'Delta': 612, 'Epsilon': 611, 'Eta': 722, 'Euro': 750, 'Gamma': 603, 'Ifraktur': 686, 'Iota': 333, 'Kappa': 722, 'Lambda': 686, 'Mu': 889, 'Nu': 722, 'Omega': 768, 'Omicron': 722, 'Phi': 763, 'Pi': 768, 'Psi': 795, 'Rfraktur': 795, 'Rho': 556, 'Sigma': 592, 'Tau': 611, 'Theta': 741, 'Upsilon': 690, 'Upsilon1': 620, 'Xi': 645, 'Zeta': 611, 'aleph': 823, 'alpha': 631, 'ampersand': 778, 'angle': 768, 'angleleft': 329, 'angleright': 329, 'apple': 790, 'approxequal': 549, 'arrowboth': 1042, 'arrowdblboth': 1042, 'arrowdbldown': 603, 'arrowdblleft': 987, 'arrowdblright': 987, 'arrowdblup': 603, 'arrowdown': 603, 'arrowhorizex': 1000, 'arrowleft': 987, 'arrowright': 987, 'arrowup': 603, 'arrowvertex': 603, 'asteriskmath': 500, 'bar': 200, 'beta': 549, 'braceex': 494, 'braceleft': 480, 'braceleftbt': 494, 'braceleftmid': 494, 'bracelefttp': 494, 'braceright': 480, 'bracerightbt': 494, 'bracerightmid': 494, 'bracerighttp': 494, 'bracketleft': 333, 'bracketleftbt': 384, 'bracketleftex': 384, 'bracketlefttp': 384, 'bracketright': 333, 'bracketrightbt': 384, 'bracketrightex': 384, 'bracketrighttp': 384, 'bullet': 460, 'carriagereturn': 658, 'chi': 549, 'circlemultiply': 768, 'circleplus': 768, 'club': 753, 'colon': 278, 'comma': 250, 'congruent': 549, 'copyrightsans': 790, 'copyrightserif': 790, 'degree': 400, 'delta': 494, 'diamond': 753, 'divide': 549, 'dotmath': 250, 'eight': 500, 'element': 713, 'ellipsis': 1000, 'emptyset': 823, 'epsilon': 439, 'equal': 549, 'equivalence': 549, 'eta': 603, 'exclam': 333, 'existential': 549, 'five': 500, 'florin': 500, 'four': 500, 'fraction': 167, 'gamma': 411, 'gradient': 713, 'greater': 549, 'greaterequal': 549, 'heart': 753, 'infinity': 713, 'integral': 274, 'integralbt': 686, 'integralex': 686, 'integraltp': 686, 'intersection': 768, 'iota': 329, 'kappa': 549, 'lambda': 549, 'less': 549, 'lessequal': 549, 'logicaland': 603, 'logicalnot': 713, 'logicalor': 603, 'lozenge': 494, 'minus': 549, 'minute': 247, 'mu': 576, 'multiply': 549, 'nine': 500, 'notelement': 713, 'notequal': 549, 'notsubset': 713, 'nu': 521, 'numbersign': 500, 'omega': 686, 'omega1': 713, 'omicron': 549, 'one': 500, 'parenleft': 333, 'parenleftbt': 384, 'parenleftex': 384, 'parenlefttp': 384, 'parenright': 333, 'parenrightbt': 384, 'parenrightex': 384, 'parenrighttp': 384, 'partialdiff': 494, 'percent': 833, 'period': 250, 'perpendicular': 658, 'phi': 521, 'phi1': 603, 'pi': 549, 'plus': 549, 'plusminus': 549, 'product': 823, 'propersubset': 713, 'propersuperset': 713, 'proportional': 713, 'psi': 686, 'question': 444, 'radical': 549, 'radicalex': 500, 'reflexsubset': 713, 'reflexsuperset': 713, 'registersans': 790, 'registerserif': 790, 'rho': 549, 'second': 411, 'semicolon': 278, 'seven': 500, 'sigma': 603, 'sigma1': 439, 'similar': 549, 'six': 500, 'slash': 278, 'space': 250, 'spade': 753, 'suchthat': 439, 'summation': 713, 'tau': 439, 'therefore': 863, 'theta': 521, 'theta1': 631, 'three': 500, 'trademarksans': 786, 'trademarkserif': 890, 'two': 500, 'underscore': 500, 'union': 768, 'universal': 713, 'upsilon': 576, 'weierstrass': 987, 'xi': 493, 'zero': 500, 'zeta': 494} widthsByFontGlyph['ZapfDingbats'] = {'a1': 974, 'a10': 692, 'a100': 668, 'a101': 732, 'a102': 544, 'a103': 544, 'a104': 910, 'a105': 911, 'a106': 667, 'a107': 760, 'a108': 760, 'a109': 626, 'a11': 960, 'a110': 694, 'a111': 595, 'a112': 776, 'a117': 690, 'a118': 791, 'a119': 790, 'a12': 939, 'a120': 788, 'a121': 788, 'a122': 788, 'a123': 788, 'a124': 788, 'a125': 788, 'a126': 788, 'a127': 788, 'a128': 788, 'a129': 788, 'a13': 549, 'a130': 788, 'a131': 788, 'a132': 788, 'a133': 788, 'a134': 788, 'a135': 788, 'a136': 788, 'a137': 788, 'a138': 788, 'a139': 788, 'a14': 855, 'a140': 788, 'a141': 788, 'a142': 788, 'a143': 788, 'a144': 788, 'a145': 788, 'a146': 788, 'a147': 788, 'a148': 788, 'a149': 788, 'a15': 911, 'a150': 788, 'a151': 788, 'a152': 788, 'a153': 788, 'a154': 788, 'a155': 788, 'a156': 788, 'a157': 788, 'a158': 788, 'a159': 788, 'a16': 933, 'a160': 894, 'a161': 838, 'a162': 924, 'a163': 1016, 'a164': 458, 'a165': 924, 'a166': 918, 'a167': 927, 'a168': 928, 'a169': 928, 'a17': 945, 'a170': 834, 'a171': 873, 'a172': 828, 'a173': 924, 'a174': 917, 'a175': 930, 'a176': 931, 'a177': 463, 'a178': 883, 'a179': 836, 'a18': 974, 'a180': 867, 'a181': 696, 'a182': 874, 'a183': 760, 'a184': 946, 'a185': 865, 'a186': 967, 'a187': 831, 'a188': 873, 'a189': 927, 'a19': 755, 'a190': 970, 'a191': 918, 'a192': 748, 'a193': 836, 'a194': 771, 'a195': 888, 'a196': 748, 'a197': 771, 'a198': 888, 'a199': 867, 'a2': 961, 'a20': 846, 'a200': 696, 'a201': 874, 'a202': 974, 'a203': 762, 'a204': 759, 'a205': 509, 'a206': 410, 'a21': 762, 'a22': 761, 'a23': 571, 'a24': 677, 'a25': 763, 'a26': 760, 'a27': 759, 'a28': 754, 'a29': 786, 'a3': 980, 'a30': 788, 'a31': 788, 'a32': 790, 'a33': 793, 'a34': 794, 'a35': 816, 'a36': 823, 'a37': 789, 'a38': 841, 'a39': 823, 'a4': 719, 'a40': 833, 'a41': 816, 'a42': 831, 'a43': 923, 'a44': 744, 'a45': 723, 'a46': 749, 'a47': 790, 'a48': 792, 'a49': 695, 'a5': 789, 'a50': 776, 'a51': 768, 'a52': 792, 'a53': 759, 'a54': 707, 'a55': 708, 'a56': 682, 'a57': 701, 'a58': 826, 'a59': 815, 'a6': 494, 'a60': 789, 'a61': 789, 'a62': 707, 'a63': 687, 'a64': 696, 'a65': 689, 'a66': 786, 'a67': 787, 'a68': 713, 'a69': 791, 'a7': 552, 'a70': 785, 'a71': 791, 'a72': 873, 'a73': 761, 'a74': 762, 'a75': 759, 'a76': 892, 'a77': 892, 'a78': 788, 'a79': 784, 'a8': 537, 'a81': 438, 'a82': 138, 'a83': 277, 'a84': 415, 'a85': 509, 'a86': 410, 'a87': 234, 'a88': 234, 'a89': 390, 'a9': 577, 'a90': 390, 'a91': 276, 'a92': 276, 'a93': 317, 'a94': 317, 'a95': 334, 'a96': 334, 'a97': 392, 'a98': 392, 'a99': 668, 'space': 278} enthought-chaco2-4.8.1.orig/kiva/compat.py0000644000175000017500000000070313421603267017470 0ustar varunvarun""" Compatibility module to help support various versions of PIL and Pillow. """ from PIL import Image HAS_FROM_BYTES = hasattr(Image, 'frombytes') def piltostring(image): if hasattr(image, 'tobytes'): return image.tobytes() else: return image.tostring() def pilfromstring(*args, **kwargs): if HAS_FROM_BYTES: return Image.frombytes(*args, **kwargs) else: return Image.fromstring(*args, **kwargs) enthought-chaco2-4.8.1.orig/kiva/pdf.py0000644000175000017500000006255213477706655017010 0ustar varunvarun# Copyright (c) 2005-2014, Enthought, Inc. # some parts copyright 2002 by Space Telescope Science Institute # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! """ PDF implementation of the core2d drawing library :Author: Eric Jones, Enthought, Inc., eric@enthought.com :Copyright: Space Telescope Science Institute :License: BSD Style The PDF implementation relies heavily on the ReportLab project. """ from __future__ import absolute_import, print_function # standard library imports import six.moves as sm import warnings import copy from numpy import array, pi # ReportLab PDF imports import reportlab.pdfbase.pdfmetrics import reportlab.pdfbase._fontdata from reportlab.pdfgen import canvas # local, relative Kiva imports from .arc_conversion import arc_to_tangent_points from .basecore2d import GraphicsContextBase from .line_state import is_dashed from .constants import FILL, STROKE, EOF_FILL import kiva.constants as constants import kiva.affine as affine cap_style = {} cap_style[constants.CAP_ROUND] = 1 cap_style[constants.CAP_SQUARE] = 2 cap_style[constants.CAP_BUTT] = 0 join_style = {} join_style[constants.JOIN_ROUND] = 1 join_style[constants.JOIN_BEVEL] = 2 join_style[constants.JOIN_MITER] = 0 # stroke, fill, mode path_mode = {} path_mode[constants.FILL_STROKE] = (1, 1, canvas.FILL_NON_ZERO) path_mode[constants.FILL] = (0, 1, canvas.FILL_NON_ZERO) path_mode[constants.EOF_FILL] = (0, 1, canvas.FILL_EVEN_ODD) path_mode[constants.STROKE] = (1, 0, canvas.FILL_NON_ZERO) path_mode[constants.EOF_FILL_STROKE] = (1, 1, canvas.FILL_EVEN_ODD) # fixme: I believe this can be implemented but for now, it is not. class CompiledPath(object): pass class GraphicsContext(GraphicsContextBase): """ Simple wrapper around a PDF graphics context. """ def __init__(self, pdf_canvas, *args, **kwargs): from .image import GraphicsContext as GraphicsContextImage self.gc = pdf_canvas self.current_pdf_path = None self.current_point = (0, 0) self.text_xy = None, None # get an agg backend to assist in measuring text self._agg_gc = GraphicsContextImage((1, 1)) super(GraphicsContext, self).__init__(self, *args, **kwargs) # ---------------------------------------------------------------- # Coordinate Transform Matrix Manipulation # ---------------------------------------------------------------- def scale_ctm(self, sx, sy): """ scale_ctm(sx: float, sy: float) -> None Sets the coordinate system scale to the given values, (sx, sy). """ self.gc.scale(sx, sy) def translate_ctm(self, tx, ty): """ translate_ctm(tx: float, ty: float) -> None Translates the coordinate syetem by the given value by (tx, ty) """ self.gc.translate(tx, ty) def rotate_ctm(self, angle): """ rotate_ctm(angle: float) -> None Rotates the coordinate space by the given angle (in radians). """ self.gc.rotate(angle * 180 / pi) def concat_ctm(self, transform): """ concat_ctm(transform: affine_matrix) Concatenates the transform to current coordinate transform matrix. transform is an affine transformation matrix (see kiva.affine_matrix). """ self.gc.transform(transform) def get_ctm(self): """ Returns the current coordinate transform matrix. XXX: This should really return a 3x3 matrix (or maybe an affine object?) like the other API's. Needs thought. """ return affine.affine_from_values(*copy.copy(self.gc._currentMatrix)) def set_ctm(self, transform): """ Set the coordinate transform matrix """ # We have to do this by inverting the current state to zero it out, # then transform by desired transform, as Reportlab Canvas doesn't # provide a method to directly set the ctm. current = self.get_ctm() self.concat_ctm(affine.invert(current)) self.concat_ctm(transform) # ---------------------------------------------------------------- # Save/Restore graphics state. # ---------------------------------------------------------------- def save_state(self): """ Saves the current graphic's context state. Always pair this with a `restore_state()` """ self.gc.saveState() def restore_state(self): """ Restores the previous graphics state. """ self.gc.restoreState() # ---------------------------------------------------------------- # Manipulate graphics state attributes. # ---------------------------------------------------------------- def set_should_antialias(self, value): """ Sets/Unsets anti-aliasing for bitmap graphics context. """ msg = "antialias is not part of the PDF canvas. Should it be?" raise NotImplementedError(msg) def set_line_width(self, width): """ Sets the line width for drawing Parameters ---------- width : float The new width for lines in user space units. """ self.gc.setLineWidth(width) def set_line_join(self, style): """ Sets style for joining lines in a drawing. style : join_style The line joining style. The available styles are JOIN_ROUND, JOIN_BEVEL, JOIN_MITER. """ try: sjoin = join_style[style] except KeyError: msg = "Invalid line join style. See documentation for valid styles" raise ValueError(msg) self.gc.setLineJoin(sjoin) def set_miter_limit(self, limit): """ Specifies limits on line lengths for mitering line joins. If line_join is set to miter joins, the limit specifies which line joins should actually be mitered. If lines aren't mitered, they are joined with a bevel. The line width is divided by the length of the miter. If the result is greater than the limit, the bevel style is used. Parameters ---------- limit : float limit for mitering joins. """ self.gc.setMiterLimit(limit) def set_line_cap(self, style): """ Specifies the style of endings to put on line ends. Parameters ---------- style : cap_style the line cap style to use. Available styles are CAP_ROUND, CAP_BUTT, CAP_SQUARE """ try: scap = cap_style[style] except KeyError: msg = "Invalid line cap style. See documentation for valid styles" raise ValueError(msg) self.gc.setLineCap(scap) def set_line_dash(self, lengths, phase=0): """ Parameters ---------- lengths : float array An array of floating point values specifing the lengths of on/off painting pattern for lines. phase : float Specifies how many units into dash pattern to start. phase defaults to 0. """ if is_dashed((phase, lengths)): lengths = list(lengths) if lengths is not None else [] self.gc.setDash(lengths, phase) def set_flatness(self, flatness): """ It is device dependent and therefore not recommended by the PDF documentation. """ raise NotImplementedError("Flatness not implemented yet on PDF") # ---------------------------------------------------------------- # Sending drawing data to a device # ---------------------------------------------------------------- def flush(self): """ Sends all drawing data to the destination device. Currently, this is a NOP. It used to call ReportLab's save() method, and maybe it still should, but flush() is likely to be called a lot, so this will really slow things down. Also, I think save() affects the paging of a document I think. We'll have to look into this more. """ pass def synchronize(self): """ Prepares drawing data to be updated on a destination device. Currently, doesn't do anything. Should this call ReportLab's canvas object's showPage() method. """ pass # ---------------------------------------------------------------- # Page Definitions # ---------------------------------------------------------------- def begin_page(self): """ Creates a new page within the graphics context. Currently, this just calls ReportLab's canvas object's showPage() method. Not sure about this... """ self.gc.showPage() def end_page(self): """ Ends drawing in the current page of the graphics context. Currently, this just calls ReportLab's canvas object's showPage() method. Not sure about this... """ self.gc.showPage() # ---------------------------------------------------------------- # Building paths (contours that are drawn) # # + Currently, nothing is drawn as the path is built. Instead, the # instructions are stored and later drawn. Should this be changed? # We will likely draw to a buffer instead of directly to the canvas # anyway. # # Hmmm. No. We have to keep the path around for storing as a # clipping region and things like that. # # + I think we should keep the current_path_point hanging around. # # ---------------------------------------------------------------- def begin_path(self): """ Clears the current drawing path and begins a new one. """ self.current_pdf_path = self.gc.beginPath() self.current_point = (0, 0) def move_to(self, x, y): """ Starts a new drawing subpath at place the current point at (x, y). """ if self.current_pdf_path is None: self.begin_path() self.current_pdf_path.moveTo(x, y) self.current_point = (x, y) def line_to(self, x, y): """ Adds a line from the current point to the given point (x, y). The current point is moved to (x, y). """ if self.current_pdf_path is None: self.begin_path() self.current_pdf_path.lineTo(x, y) self.current_point = (x, y) def lines(self, points): """ Adds a series of lines as a new subpath. Currently implemented by calling line_to a zillion times. Points is an Nx2 array of x, y pairs. current_point is moved to the last point in points """ if self.current_pdf_path is None: self.begin_path() self.current_pdf_path.moveTo(points[0][0], points[0][1]) for x, y in points[1:]: self.current_pdf_path.lineTo(x, y) self.current_point = (x, y) def line_set(self, starts, ends): if self.current_pdf_path is None: self.begin_path() for start, end in sm.zip(starts, ends): self.current_pdf_path.moveTo(start[0], start[1]) self.current_pdf_path.lineTo(end[0], end[1]) self.current_point = (end[0], end[1]) def rect(self, *args): """ Adds a rectangle as a new subpath. Can be called in two ways: rect(x, y, w, h) rect( (x, y, w, h) ) """ if self.current_pdf_path is None: self.begin_path() if len(args) == 1: args = args[0] self.current_pdf_path.rect(*args) self.current_point = (args[0], args[1]) def draw_rect(self, rect, mode=constants.FILL_STROKE): self.rect(rect) self.draw_path(mode) self.current_point = (rect[0], rect[1]) def rects(self, rects): """ Adds multiple rectangles as separate subpaths to the path. Currently implemented by calling rect a zillion times. """ if self.current_pdf_path is None: self.begin_path() for x, y, sx, sy in rects: self.current_pdf_path.rect(x, y, sx, sy) self.current_point = (x, y) def close_path(self): """ Closes the path of the current subpath. """ self.current_pdf_path.close() def curve_to(self, cp1x, cp1y, cp2x, cp2y, x, y): """ """ if self.current_pdf_path is None: self.begin_path() self.current_pdf_path.curveTo(cp1x, cp1y, cp2x, cp2y, x, y) self.current_point = (x, y) def quad_curve_to(self, cpx, cpy, x, y): """ """ msg = "quad curve to not implemented yet on PDF" raise NotImplementedError(msg) def arc(self, x, y, radius, start_angle, end_angle, clockwise=False): """ """ if self.current_pdf_path is None: self.begin_path() self.current_pdf_path.arc(x - radius, y - radius, x + radius, y + radius, start_angle * 180.0 / pi, (end_angle-start_angle) * 180.0 / pi) self.current_point = (x, y) def arc_to(self, x1, y1, x2, y2, radius): """ """ if self.current_pdf_path is None: self.begin_path() # Get the endpoints on the curve where it touches the line segments t1, t2 = arc_to_tangent_points(self.current_point, (x1, y1), (x2, y2), radius) # draw! self.current_pdf_path.lineTo(*t1) self.current_pdf_path.curveTo(x1, y1, x1, y1, *t2) self.current_pdf_path.lineTo(x2, y2) self.current_point = (x2, y2) # ---------------------------------------------------------------- # Getting infomration on paths # ---------------------------------------------------------------- def is_path_empty(self): """ Tests to see whether the current drawing path is empty """ msg = "is_path_empty not implemented yet on PDF" raise NotImplementedError(msg) def get_path_current_point(self): """ Returns the current point from the graphics context. Note: This should be a tuple or array. """ return self.current_point def get_path_bounding_box(self): """ Should return a tuple or array instead of a strange object. """ msg = "get_path_bounding_box not implemented yet on PDF" raise NotImplementedError(msg) # ---------------------------------------------------------------- # Clipping path manipulation # ---------------------------------------------------------------- def clip(self): """ """ self.gc._fillMode = canvas.FILL_NON_ZERO self.gc.clipPath(self.current_pdf_path, stroke=0, fill=0) def even_odd_clip(self): """ """ self.gc._fillMode = canvas.FILL_EVEN_ODD self.gc.clipPath(self.current_pdf_path, stroke=0, fill=1) def clip_to_rect(self, x, y, width, height): """ Clips context to the given rectangular region. Region should be a 4-tuple or a sequence. """ clip_path = self.gc.beginPath() clip_path.rect(x, y, width, height) self.gc.clipPath(clip_path, stroke=0, fill=0) def clip_to_rects(self): """ """ msg = "clip_to_rects not implemented yet on PDF." raise NotImplementedError(msg) def clear_clip_path(self): """ """ return self.clip_to_rect(0, 0, 10000, 10000) # ---------------------------------------------------------------- # Color space manipulation # # I'm not sure we'll mess with these at all. They seem to # be for setting the color syetem. Hard coding to RGB or # RGBA for now sounds like a reasonable solution. # ---------------------------------------------------------------- def set_fill_color_space(self): """ """ msg = "set_fill_color_space not implemented on PDF yet." raise NotImplementedError(msg) def set_stroke_color_space(self): """ """ msg = "set_stroke_color_space not implemented on PDF yet." raise NotImplementedError(msg) def set_rendering_intent(self): """ """ msg = "set_rendering_intent not implemented on PDF yet." raise NotImplementedError(msg) # ---------------------------------------------------------------- # Color manipulation # ---------------------------------------------------------------- def set_fill_color(self, color): """ """ r, g, b = color[:3] try: a = color[3] except IndexError: a = 1.0 self.gc.setFillColorRGB(r, g, b, a) def set_stroke_color(self, color): """ """ r, g, b = color[:3] try: a = color[3] except IndexError: a = 1.0 self.gc.setStrokeColorRGB(r, g, b, a) def set_alpha(self, alpha): """ Sets alpha globally. Note that this will not affect draw_image because reportlab does not currently support drawing images with alpha. """ self.gc.setFillAlpha(alpha) self.gc.setStrokeAlpha(alpha) super(GraphicsContext, self).set_alpha(alpha) # ---------------------------------------------------------------- # Drawing Images # ---------------------------------------------------------------- def draw_image(self, img, rect=None): """ draw_image(img_gc, rect=(x, y, w, h)) Draws another gc into this one. If 'rect' is not provided, then the image gc is drawn into this one, rooted at (0, 0) and at full pixel size. If 'rect' is provided, then the image is resized into the (w, h) given and drawn into this GC at point (x, y). img_gc is either a Numeric array (WxHx3 or WxHx4) or a GC from Kiva's Agg backend (kiva.agg.GraphicsContextArray). Requires the Python Imaging Library (PIL). """ # We turn img into a PIL object, since that is what ReportLab # requires. To do this, we first determine if the input image # GC needs to be converted to RGBA/RGB. If so, we see if we can # do it nicely (using convert_pixel_format), and if not, we do # it brute-force using Agg. from reportlab.lib.utils import ImageReader from kiva import agg from kiva.compat import pilfromstring, piltostring if type(img) == type(array([])): # Numeric array converted_img = agg.GraphicsContextArray(img, pix_format='rgba32') format = 'RGBA' elif isinstance(img, agg.GraphicsContextArray): if img.format().startswith('RGBA'): format = 'RGBA' elif img.format().startswith('RGB'): format = 'RGB' else: converted_img = img.convert_pixel_format('rgba32', inplace=0) format = 'RGBA' else: warnings.warn("Cannot render image of type %r into PDF context." % type(img)) return # converted_img now holds an Agg graphics context with the image pil_img = pilfromstring(format, (converted_img.width(), converted_img.height()), piltostring(converted_img.bmp_array)) if rect is None: rect = (0, 0, img.width(), img.height()) # Draw the actual image. # Wrap it in an ImageReader object, because that's what reportlab # actually needs. self.gc.drawImage(ImageReader(pil_img), rect[0], rect[1], rect[2], rect[3]) # ---------------------------------------------------------------- # Drawing Text # ---------------------------------------------------------------- def select_font(self, name, size, textEncoding): """ PDF ignores the Encoding variable. """ self.gc.setFont(name, size) def set_font(self, font): """ Sets the font for the current graphics context. """ # TODO: Make this actually do the right thing face_name = font.face_name if face_name == "": face_name = "Helvetica" self.gc.setFont(face_name, font.size) def get_font(self): """ Get the current font """ raise NotImplementedError def set_font_size(self, size): """ """ font = self.gc._fontname self.gc.setFont(font, size) def set_character_spacing(self): """ """ pass def get_character_spacing(self): """ Get the current font """ raise NotImplementedError def set_text_drawing_mode(self): """ """ pass def set_text_position(self, x, y): """ """ self.text_xy = x, y def get_text_position(self): """ """ return self.state.text_matrix[2, :2] def set_text_matrix(self, ttm): """ """ a, b, c, d, tx, ty = affine.affine_params(ttm) self.gc._textMatrix = (a, b, c, d, tx, ty) def get_text_matrix(self): """ """ a, b, c, d, tx, ty = self.gc._textMatrix return affine.affine_from_values(a, b, c, d, tx, ty) def show_text(self, text, x=None, y=None): """ Draws text on the device at current text position. This is also used for showing text at a particular point specified by x and y. This ignores the text matrix for now. """ if x and y: pass else: x, y = self.text_xy self.gc.drawString(x, y, text) def show_text_at_point(self, text, x, y): self.show_text(text, x, y) def show_glyphs(self): """ """ msg = "show_glyphs not implemented on PDF yet." raise NotImplementedError(msg) def get_full_text_extent(self, textstring): fontname = self.gc._fontname fontsize = self.gc._fontsize ascent, descent = reportlab.pdfbase._fontdata.ascent_descent[fontname] # get the AGG extent (we just care about the descent) aw, ah, ad, al = self._agg_gc.get_full_text_extent(textstring) # ignore the descent returned by reportlab if AGG returned 0.0 descent descent = 0.0 if ad == 0.0 else descent * fontsize / 1000.0 ascent = ascent * fontsize / 1000.0 height = ascent + abs(descent) width = self.gc.stringWidth(textstring, fontname, fontsize) # the final return value is defined as leading. do not know # how to get that number so returning zero return width, height, descent, 0 def get_text_extent(self, textstring): w, h, d, l = self.get_full_text_extent(textstring) return w, h # ---------------------------------------------------------------- # Painting paths (drawing and filling contours) # ---------------------------------------------------------------- def clear(self): """ """ warnings.warn("clear() is ignored for the pdf backend") def stroke_path(self): """ """ self.draw_path(mode=STROKE) def fill_path(self): """ """ self.draw_path(mode=FILL) def eof_fill_path(self): """ """ self.draw_path(mode=EOF_FILL) def stroke_rect(self, rect): """ """ self.begin_path() self.rect(rect[0], rect[1], rect[2], rect[3]) self.stroke_path() def stroke_rect_with_width(self, rect, width): """ """ msg = "stroke_rect_with_width not implemented on PDF yet." raise NotImplementedError(msg) def fill_rect(self, rect): """ """ self.begin_path() self.rect(rect[0], rect[1], rect[2], rect[3]) self.fill_path() def fill_rects(self): """ """ msg = "fill_rects not implemented on PDF yet." raise NotImplementedError(msg) def clear_rect(self, rect): """ """ msg = "clear_rect not implemented on PDF yet." raise NotImplementedError(msg) def draw_path(self, mode=constants.FILL_STROKE): """ Walks through all the drawing subpaths and draw each element. Each subpath is drawn separately. """ if self.current_pdf_path is not None: stroke, fill, mode = path_mode[mode] self.gc._fillMode = mode self.gc.drawPath(self.current_pdf_path, stroke=stroke, fill=fill) # erase the current path. self.current_pdf_path = None def save(self): self.gc.save() def simple_test(): pdf = canvas.Canvas("bob.pdf") gc = GraphicsContext(pdf) gc.begin_path() gc.move_to(50, 50) gc.line_to(100, 100) gc.draw_path() gc.flush() pdf.save() if __name__ == "__main__": import sys if len(sys.argv) == 1: sys.exit("Usage: %s output_file" % sys.argv[0]) enthought-chaco2-4.8.1.orig/kiva/celiagg.py0000644000175000017500000007331113544354521017607 0ustar varunvarun# ----------------------------------------------------------------------------- # Copyright (c) 2016, Enthought, Inc # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! # ----------------------------------------------------------------------------- from __future__ import absolute_import, print_function, division from collections import namedtuple from math import fabs import os import warnings import numpy as np import celiagg as agg from .abstract_graphics_context import AbstractGraphicsContext from .fonttools import Font import kiva.constants as constants # These are the symbols that a backend has to define. __all__ = ["CompiledPath", "Font", "font_metrics_provider", "GraphicsContext"] cap_style = { constants.CAP_ROUND: agg.LineCap.CapRound, constants.CAP_SQUARE: agg.LineCap.CapSquare, constants.CAP_BUTT: agg.LineCap.CapButt, } join_style = { constants.JOIN_ROUND: agg.LineJoin.JoinRound, constants.JOIN_BEVEL: agg.LineJoin.JoinBevel, constants.JOIN_MITER: agg.LineJoin.JoinMiter, } draw_modes = { constants.FILL: agg.DrawingMode.DrawFill, constants.EOF_FILL: agg.DrawingMode.DrawEofFill, constants.STROKE: agg.DrawingMode.DrawStroke, constants.FILL_STROKE: agg.DrawingMode.DrawFillStroke, constants.EOF_FILL_STROKE: agg.DrawingMode.DrawEofFillStroke, } text_modes = { constants.TEXT_FILL: agg.TextDrawingMode.TextDrawFill, constants.TEXT_STROKE: agg.TextDrawingMode.TextDrawStroke, constants.TEXT_FILL_STROKE: agg.TextDrawingMode.TextDrawFillStroke, constants.TEXT_INVISIBLE: agg.TextDrawingMode.TextDrawInvisible, constants.TEXT_FILL_CLIP: agg.TextDrawingMode.TextDrawFillClip, constants.TEXT_STROKE_CLIP: agg.TextDrawingMode.TextDrawStrokeClip, constants.TEXT_FILL_STROKE_CLIP: agg.TextDrawingMode.TextDrawFillStrokeClip, # noqa constants.TEXT_CLIP: agg.TextDrawingMode.TextDrawClip, constants.TEXT_OUTLINE: agg.TextDrawingMode.TextDrawStroke, } gradient_coord_modes = { 'userSpaceOnUse': agg.GradientUnits.UserSpace, 'objectBoundingBox': agg.GradientUnits.ObjectBoundingBox, } gradient_spread_modes = { 'pad': agg.GradientSpread.SpreadPad, 'repeat': agg.GradientSpread.SpreadRepeat, 'reflect': agg.GradientSpread.SpreadReflect, } pix_formats = { 'gray8': agg.PixelFormat.Gray8, 'rgb24': agg.PixelFormat.RGB24, 'bgr24': agg.PixelFormat.BGR24, 'rgba32': agg.PixelFormat.RGBA32, 'argb32': agg.PixelFormat.ARGB32, 'abgr32': agg.PixelFormat.ABGR32, 'bgra32': agg.PixelFormat.BGRA32, } pix_format_canvases = { 'rgba32': agg.CanvasRGBA32, 'bgra32': agg.CanvasBGRA32, 'rgb24': agg.CanvasRGB24, } StateBundle = namedtuple('StateBundle', ['state', 'path', 'stroke', 'fill', 'transform', 'text_transform', 'font']) class GraphicsContext(object): def __init__(self, size, *args, **kwargs): super(GraphicsContext, self).__init__() self._width = size[0] self._height = size[1] self.pix_format = kwargs.get('pix_format', 'rgba32') shape = (self._height, self._width, 4) canvas_klass = pix_format_canvases[self.pix_format] self.gc = canvas_klass(np.zeros(shape, dtype=np.uint8), bottom_up=True) # init the state variables clip = agg.Rect(0, 0, self._width, self._height) self.canvas_state = agg.GraphicsState(clip_box=clip) self.stroke_paint = agg.SolidPaint(0.0, 0.0, 0.0) self.fill_paint = agg.SolidPaint(0.0, 0.0, 0.0) self.path = CompiledPath() self.text_transform = agg.Transform() self.text_pos = (0.0, 0.0) self.transform = agg.Transform() self.font = None self.__state_stack = [] # ---------------------------------------------------------------- # Size info # ---------------------------------------------------------------- def height(self): """ Returns the height of the context. """ return self._height def width(self): """ Returns the width of the context. """ return self._width # ---------------------------------------------------------------- # Coordinate Transform Matrix Manipulation # ---------------------------------------------------------------- def scale_ctm(self, sx, sy): """ Set the coordinate system scale to the given values, (sx, sy). sx:float -- The new scale factor for the x axis sy:float -- The new scale factor for the y axis """ self.transform.scale(sx, sy) def translate_ctm(self, tx, ty): """ Translate the coordinate system by the given value by (tx, ty) tx:float -- The distance to move in the x direction ty:float -- The distance to move in the y direction """ self.transform.translate(tx, ty) def rotate_ctm(self, angle): """ Rotates the coordinate space for drawing by the given angle. angle:float -- the angle, in radians, to rotate the coordinate system """ self.transform.rotate(angle) def concat_ctm(self, transform): """ Concatenate the transform to current coordinate transform matrix. transform:affine_matrix -- the transform matrix to concatenate with the current coordinate matrix. """ self.transform.premultiply(agg.Transform(*transform)) def get_ctm(self): """ Return the current coordinate transform matrix. """ t = self.transform return (t.sx, t.shy, t.shx, t.sy, t.tx, t.ty) # ---------------------------------------------------------------- # Save/Restore graphics state. # ---------------------------------------------------------------- def save_state(self): """ Save the current graphic's context state. This should always be paired with a restore_state """ state = StateBundle( state=self.canvas_state.copy(), path=self.path.copy(), stroke=self.stroke_paint.copy(), fill=self.fill_paint.copy(), transform=self.transform.copy(), text_transform=self.text_transform.copy(), font=(None if self.font is None else self.font.copy())) self.__state_stack.append(state) def restore_state(self): """ Restore the previous graphics state. """ state = self.__state_stack.pop() self.canvas_state = state.state self.path = state.path self.stroke_paint = state.stroke self.fill_paint = state.fill self.transform = state.transform self.text_transform = state.text_transform self.font = state.font # ---------------------------------------------------------------- # context manager interface # ---------------------------------------------------------------- def __enter__(self): self.save_state() def __exit__(self, type, value, traceback): self.restore_state() # ---------------------------------------------------------------- # Manipulate graphics state attributes. # ---------------------------------------------------------------- def set_antialias(self, value): """ Set/Unset antialiasing for bitmap graphics context. """ self.canvas_state.anti_aliased = value def set_line_width(self, width): """ Set the line width for drawing width:float -- The new width for lines in user space units. """ self.canvas_state.line_width = width def set_line_join(self, style): """ Set style for joining lines in a drawing. style:join_style -- The line joining style. The available styles are JOIN_ROUND, JOIN_BEVEL, JOIN_MITER. """ try: sjoin = join_style[style] self.canvas_state.line_join = sjoin except KeyError: msg = "Invalid line join style. See documentation for valid styles" raise ValueError(msg) def set_miter_limit(self, limit): """ Specifies limits on line lengths for mitering line joins. If line_join is set to miter joins, the limit specifies which line joins should actually be mitered. If lines aren't mitered, they are joined with a bevel. The line width is divided by the length of the miter. If the result is greater than the limit, the bevel style is used. limit:float -- limit for mitering joins. """ self.canvas_state.miter_limit = limit def set_line_cap(self, style): """ Specify the style of endings to put on line ends. style:cap_style -- the line cap style to use. Available styles are CAP_ROUND, CAP_BUTT, CAP_SQUARE """ try: scap = cap_style[style] self.canvas_state.line_cap = scap except KeyError: msg = "Invalid line cap style. See documentation for valid styles" raise ValueError(msg) def set_line_dash(self, lengths, phase=0): """ lengths:float array -- An array of floating point values specifing the lengths of on/off painting pattern for lines. phase:float -- Specifies how many units into dash pattern to start. phase defaults to 0. """ if lengths is not None: count = len(lengths) lengths = np.array(lengths).reshape(count//2, 2) else: lengths = [] self.canvas_state.line_dash_pattern = lengths self.canvas_state.line_dash_phase = phase def set_flatness(self, flatness): """ Not implemented It is device dependent and therefore not recommended by the PDF documentation. """ msg = "set_flatness not implemented for celiagg" raise NotImplementedError(msg) # ---------------------------------------------------------------- # Sending drawing data to a device # ---------------------------------------------------------------- def flush(self): """ Send all drawing data to the destination device. """ def synchronize(self): """ Prepares drawing data to be updated on a destination device. """ # ---------------------------------------------------------------- # Page Definitions # ---------------------------------------------------------------- def begin_page(self): """ Create a new page within the graphics context. """ def end_page(self): """ End drawing in the current page of the graphics context. """ # ---------------------------------------------------------------- # Path creation # ---------------------------------------------------------------- def begin_path(self): """ Clear the current drawing path and begin a new one. """ self.path.path.reset() def move_to(self, x, y): """ Start a new drawing subpath at place the current point at (x, y). """ self.path.move_to(x, y) def line_to(self, x, y): """ Add a line from the current point to the given point (x, y). The current point is moved to (x, y). """ self.path.line_to(x, y) def lines(self, points): """ Add a series of lines as a new subpath. Currently implemented by calling line_to a zillion times. Points is an Nx2 array of x, y pairs. """ self.path.lines(points) def line_set(self, starts, ends): """ Draw multiple disjoint line segments. """ self.path.line_set(starts, ends) def rect(self, x, y, sx, sy): """ Add a rectangle as a new subpath. """ self.path.rect(x, y, sx, sy) def rects(self, rects): """ Add multiple rectangles as separate subpaths to the path. """ self.path.rects(rects) def draw_rect(self, rect, mode=constants.FILL_STROKE): """ Draw a rect. """ # XXX: kiva::graphics_context<>::_draw_rect_simple() does a VERY # specific optimization for drawing rectangles in certain circumstances # which results in chaco plot borders which are sharp. # This implements that same special case. - JW 2018/09/01 transform = self.transform if (not self.canvas_state.anti_aliased and self.canvas_state.line_width in (0.0, 1.0) and fabs(self.transform.shx) < 1e-3 and fabs(self.transform.shy) < 1e-3): scale_x = self.transform.sx scale_y = self.transform.sy tx = self.transform.tx ty = self.transform.ty x1 = int(rect[0] * scale_x + tx) y1 = int(rect[1] * scale_y + ty) x2 = int((rect[0] + rect[2]) * scale_x + tx) y2 = int((rect[1] + rect[3]) * scale_y + ty) rect = (x1, y1, abs(x2-x1), abs(y2-y1)) # XXX: The base transform is a half-pixel translate transform = agg.Transform(tx=0.5, ty=0.5) path = agg.Path() path.rect(*rect) self.canvas_state.drawing_mode = draw_modes[mode] self.gc.draw_shape(path, transform, self.canvas_state, stroke=self.stroke_paint, fill=self.fill_paint) def add_path(self, path): """ Add a subpath to the current path. """ self.path.add_path(path) def close_path(self): """ Close the path of the current subpath. """ self.path.close_path() def curve_to(self, cp1x, cp1y, cp2x, cp2y, x, y): self.path.curve_to(cp1x, cp1y, cp2x, cp2y, x, y) def quad_curve_to(self, cpx, cpy, x, y): self.path.quad_curve_to(cpx, cpy, x, y) def arc(self, x, y, radius, start_angle, end_angle, clockwise=False): self.path.arc(x, y, radius, start_angle, end_angle, clockwise) def arc_to(self, x1, y1, x2, y2, radius): self.path.arc_to(x1, y1, x2, y2, radius) # ---------------------------------------------------------------- # Getting infomration on paths # ---------------------------------------------------------------- def is_path_empty(self): """ Test to see if the current drawing path is empty """ return self.path.is_empty() def get_path_current_point(self): """ Return the current point from the graphics context. """ return self.path.get_current_point() def get_path_bounding_box(self): """ Return the bounding box for the current path object. """ return self.path.get_bounding_box() # ---------------------------------------------------------------- # Clipping path manipulation # ---------------------------------------------------------------- def clip(self): """ Clip context to a filled version of the current path. """ if not self.path.is_empty(): self._clip_impl(self.path.path, agg.DrawingMode.DrawFill) self.begin_path() def even_odd_clip(self): """ Clip context to a even-odd filled version of the current path. """ if not self.path.is_empty(): self._clip_impl(self.path.path, agg.DrawingMode.DrawEofFill) self.begin_path() def clip_to_rect(self, x, y, w, h): """ Clip context to the given rectangular region. Region should be a 4-tuple or a sequence. """ tx, ty = self.transform.tx, self.transform.ty self.canvas_state.clip_box = agg.Rect(tx+x, ty+y, w, h) def clip_to_rects(self, rects): """ Clip context to a collection of rectangles """ path = agg.Path() path.rects(rects) self._clip_impl(path, agg.DrawingMode.DrawFill) def _clip_impl(self, shape, drawing_mode): """ Internal implementation for the complex clipping methods. """ size = (self._height, self._width) stencil = agg.CanvasG8(np.empty(size, dtype=np.uint8), bottom_up=True) stencil.clear(0.0, 0.0, 0.0) clip_box = agg.Rect(0, 0, self._width, self._height) gs = agg.GraphicsState(drawing_mode=drawing_mode, clip_box=clip_box) paint = agg.SolidPaint(1.0, 1.0, 1.0) stencil.draw_shape(shape, self.transform, gs, stroke=paint, fill=paint) self.canvas_state.stencil = stencil.image # ---------------------------------------------------------------- # Color space manipulation # # I'm not sure we'll mess with these at all. They seem to # be for setting the color system. Hard coding to RGB or # RGBA for now sounds like a reasonable solution. # ---------------------------------------------------------------- def set_fill_color_space(self): msg = "set_fill_color_space not implemented for celiagg yet." raise NotImplementedError(msg) def set_stroke_color_space(self): msg = "set_stroke_color_space not implemented for celiagg yet." raise NotImplementedError(msg) def set_rendering_intent(self): msg = "set_rendering_intent not implemented for celiagg yet." raise NotImplementedError(msg) # ---------------------------------------------------------------- # Color manipulation # ---------------------------------------------------------------- def set_fill_color(self, color): self.fill_paint = agg.SolidPaint(*color) def set_stroke_color(self, color): self.stroke_paint = agg.SolidPaint(*color) def set_alpha(self, alpha): self.canvas_state.master_alpha = alpha # ---------------------------------------------------------------- # Gradients # ---------------------------------------------------------------- def _get_gradient_enums(self, spread, units): """ Configures a gradient object and sets it as the current brush. """ spread = gradient_spread_modes.get(spread, agg.GradientSpread.SpreadPad) units = gradient_coord_modes.get(units, agg.GradientUnits.UserSpace) return spread, units def linear_gradient(self, x1, y1, x2, y2, stops, spread_method, units='userSpaceOnUse'): """ Sets a linear gradient as the current brush. """ spread, units = self._get_gradient_enums(spread_method, units) self.fill_paint = agg.LinearGradientPaint(x1, y1, x2, y2, stops, spread, units) def radial_gradient(self, cx, cy, r, fx, fy, stops, spread_method, units='userSpaceOnUse'): """ Sets a radial gradient as the current brush. """ spread, units = self._get_gradient_enums(spread_method, units) self.fill_paint = agg.RadialGradientPaint(cx, cy, r, fx, fy, stops, spread, units) # ---------------------------------------------------------------- # Drawing Images # ---------------------------------------------------------------- def draw_image(self, img, rect=None): """ img is either a N*M*3 or N*M*4 numpy array, or a Kiva image rect - a tuple (x, y, w, h) """ def get_format(array): if array.shape[2] == 3: return agg.PixelFormat.RGB24 elif array.shape[2] == 4: return agg.PixelFormat.RGBA32 img_format = agg.PixelFormat.RGB24 if isinstance(img, np.ndarray): # Numeric array img_array = img.astype(np.uint8) img_format = get_format(img_array) elif isinstance(img, GraphicsContext): img_array = img.gc.array img_format = pix_formats[img.pix_format] elif hasattr(img, 'bmp_array'): # An offscreen kiva context # XXX: Use a copy to kill the read-only flag which plays havoc # with the Cython memoryviews used by celiagg img_array = img.bmp_array.copy() img_format = get_format(img_array) else: msg = "Cannot render image of type '{}' into celiagg context." warnings.warn(msg.format(type(img))) return x, y, w, h = rect img_height, img_width = img_array.shape[:2] sx, sy = w / img_width, h / img_height transform = agg.Transform() transform.multiply(self.transform) transform.translate(x, y) transform.scale(sx, sy) self.gc.draw_image(img_array, img_format, transform, self.canvas_state, bottom_up=True) # ---------------------------------------------------------------- # Drawing Text # ---------------------------------------------------------------- def select_font(self, name, size, textEncoding): """ Set the font for the current graphics context. """ self.font = agg.Font(name, size, agg.FontCacheType.RasterFontCache) def set_font(self, font): """ Set the font for the current graphics context. """ self.select_font(font.findfont(), font.size, None) def set_font_size(self, size): """ Set the font size for the current graphics context. """ if self.font is None: return font = self.font self.select_font(font.filepath, size, font.cache_type) def set_character_spacing(self, spacing): msg = "set_character_spacing not implemented on celiagg yet." raise NotImplementedError(msg) def set_text_drawing_mode(self, mode): try: tmode = text_modes[mode] except KeyError: msg = "Invalid text drawing mode" raise ValueError(msg) self.canvas_state.text_drawing_mode = tmode def set_text_position(self, x, y): self.text_pos = (x, y) def get_text_position(self): return self.text_pos def set_text_matrix(self, ttm): self.text_transform = ttm def get_text_matrix(self): return self.text_transform def show_text(self, text, point=None): """ Draw text on the device at current text position. This is also used for showing text at a particular point specified by x and y. """ if self.font is None: raise RuntimeError("show_text called before setting a font!") if point is None: pos = tuple(self.text_pos) else: pos = tuple(point) transform = agg.Transform() transform.multiply(self.transform) transform.translate(*pos) self.gc.draw_text(text, self.font, transform, self.canvas_state, stroke=self.stroke_paint) def show_text_at_point(self, text, x, y): """ Draw text at some point (x, y). """ self.show_text(text, (x, y)) def show_glyphs(self): msg = "show_glyphs not implemented on celiagg" raise NotImplementedError(msg) def get_text_extent(self, text): """ Returns the bounding rect of the rendered text """ if self.font is None: raise RuntimeError("get_text_extent called before setting a font!") x1, x2 = 0.0, self.font.width(text) y1, y2 = 0.0, self.font.height return x1, y1, x2, y2 def get_full_text_extent(self, text): """ Backwards compatibility API over .get_text_extent() for Enable """ x1, y1, x2, y2 = self.get_text_extent(text) return x2, y2, y1, x1 # ---------------------------------------------------------------- # Painting paths (drawing and filling contours) # ---------------------------------------------------------------- def stroke_path(self): self.canvas_state.drawing_mode = agg.DrawingMode.DrawStroke self.gc.draw_shape(self.path.path, self.transform, self.canvas_state, stroke=self.stroke_paint) self.begin_path() def fill_path(self): self.canvas_state.drawing_mode = agg.DrawingMode.DrawFill self.gc.draw_shape(self.path.path, self.transform, self.canvas_state, fill=self.fill_paint) self.begin_path() def eof_fill_path(self): self.canvas_state.drawing_mode = agg.DrawingMode.DrawEofFill self.gc.draw_shape(self.path.path, self.transform, self.canvas_state, fill=self.fill_paint) self.begin_path() def stroke_rect(self, rect): self.stroke_rect_with_width(rect, 1.0) def stroke_rect_with_width(self, rect, width): shape = agg.Path() shape.rect(*rect) self.canvas_state.line_width = width self.canvas_state.drawing_mode = agg.DrawingMode.DrawStroke self.gc.draw_shape(shape, self.transform, self.canvas_state, stroke=self.stroke_paint) def fill_rect(self, rect): shape = agg.Path() shape.rect(*rect) self.canvas_state.drawing_mode = agg.DrawingMode.DrawFill self.gc.draw_shape(shape, self.transform, self.canvas_state, fill=self.fill_paint) def fill_rects(self, rects): path = agg.Path() path.rects(rects) self.canvas_state.drawing_mode = agg.DrawingMode.DrawFill self.gc.draw_shape(path, self.transform, self.canvas_state, fill=self.fill_paint) def clear_rect(self, rect): shape = agg.Path() shape.rect(*rect) paint = agg.SolidPaint(0.0, 0.0, 0.0, 0.0) self.canvas_state.drawing_mode = agg.DrawingMode.DrawFill self.gc.draw_shape(shape, self.transform, self.canvas_state, fill=paint) def clear(self, clear_color=(1.0, 1.0, 1.0, 1.0)): self.gc.clear(*clear_color) def draw_path(self, mode=constants.FILL_STROKE): """ Walk through all the drawing subpaths and draw each element. Each subpath is drawn separately. """ self.canvas_state.drawing_mode = draw_modes[mode] self.gc.draw_shape(self.path.path, self.transform, self.canvas_state, stroke=self.stroke_paint, fill=self.fill_paint) self.begin_path() def get_empty_path(self): """ Return a path object that can be built up and then reused. """ return CompiledPath() def draw_path_at_points(self, points, path, mode=constants.FILL_STROKE): """ Draw a path object at many different points. XXX: This is currently broken for some reason """ shape = agg.ShapeAtPoints(path.path, points) self.canvas_state.drawing_mode = draw_modes[mode] self.gc.draw_shape(shape, self.transform, self.canvas_state, stroke=self.stroke_paint, fill=self.fill_paint) def save(self, filename, file_format=None): """ Save the contents of the context to a file """ try: from kiva.compat import pilfromstring except ImportError: raise ImportError("need PIL (or Pillow) to save images") if file_format is None: file_format = '' # Data is BGRA; Convert to RGBA pixels = self.gc.array data = np.empty(pixels.shape, dtype=np.uint8) data[..., 0] = pixels[..., 2] data[..., 1] = pixels[..., 1] data[..., 2] = pixels[..., 0] data[..., 3] = pixels[..., 3] size = (int(self._width), int(self._height)) img = pilfromstring('RGBA', size, data) # Check the output format to see if it can handle an alpha channel. no_alpha_formats = ('jpg', 'bmp', 'eps', 'jpeg') if ((isinstance(filename, str) and os.path.splitext(filename)[1][1:] in no_alpha_formats) or (file_format.lower() in no_alpha_formats)): img = img.convert('RGB') img.save(filename, format=file_format) class CompiledPath(object): def __init__(self): self.path = agg.Path() def copy(self): cpy = CompiledPath() cpy.path = self.path.copy() return cpy def begin_path(self): self.path.begin() def move_to(self, x, y): self.path.move_to(x, y) def arc(self, x, y, r, start_angle, end_angle, clockwise=False): self.path.arc(x, y, r, start_angle, end_angle, clockwise) def arc_to(self, x1, y1, x2, y2, r): self.path.arc_to(x1, y1, x2, y2, r) def line_to(self, x, y): self.path.line_to(x, y) def lines(self, points): self.path.lines(points) def line_set(self, starts, ends): self.path.lines_set(starts, ends) def curve_to(self, cx1, cy1, cx2, cy2, x, y): self.path.cubic_to(cx1, cy1, cx2, cy2, x, y) def quad_curve_to(self, cx, cy, x, y): self.path.quadric_to(cx, cy, x, y) def rect(self, x, y, sx, sy): self.path.rect(x, y, sx, sy) def rects(self, rects): self.path.rects(rects) def add_path(self, other_path): if isinstance(other_path, CompiledPath): self.path.add_path(other_path.path) def close_path(self): self.path.close() def is_empty(self): return self.path.length() == 0 def get_current_point(self): return self.path.final_point() def get_bounding_box(self): return self.path.bounding_rect() # GraphicsContext should implement AbstractGraphicsContext AbstractGraphicsContext.register(GraphicsContext) def font_metrics_provider(): """ Creates an object to be used for querying font metrics. """ return GraphicsContext((1, 1)) enthought-chaco2-4.8.1.orig/kiva/arc_conversion.py0000644000175000017500000000424313421603267021222 0ustar varunvarunfrom numpy import sqrt, dot, sin, array, pi from math import atan2, acos def two_point_arc_to_kiva_arc(p1, p2, theta): """ Converts an arc in two point and subtended angle format (startpoint, endpoint, theta (positive for ccw, negative for cw)) into kiva format (x, y, radius, start_angle, end_angle, cw) """ chord = p2-p1 chordlen = sqrt(dot(chord, chord)) radius = abs(chordlen/(2*sin(theta/2))) altitude = sqrt(pow(radius, 2) - pow(chordlen/2, 2)) if theta > pi or theta < 0: altitude = -altitude chordmidpoint = (p1+p2)/2 rotate90 = array(((0.0, -1.0), (1.0, 0.0))) centerpoint = dot(rotate90, (chord/chordlen))*altitude + chordmidpoint start_angle = atan2(*(p1 - centerpoint)[::-1]) end_angle = start_angle + theta if theta < 0: start_angle, end_angle, = end_angle, start_angle cw = False radius = abs(radius) return (centerpoint[0], centerpoint[1], radius, start_angle, end_angle, cw) def arc_to_tangent_points(start, p1, p2, radius): """ Given a starting point, two endpoints of a line segment, and a radius, calculate the tangent points for arc_to(). """ def normalize_vector(x, y): """ Given a vector, return its unit length representation. """ length = sqrt(x**2+y**2) if length <= 1e-6: return (0.0, 0.0) return (x/length, y/length) # calculate the angle between the two line segments v1 = normalize_vector(start[0]-p1[0], start[1]-p1[1]) v2 = normalize_vector(p2[0]-p1[0], p2[1]-p1[1]) angle = acos(v1[0]*v2[0]+v1[1]*v2[1]) # punt if the half angle is zero or a multiple of pi sin_half_angle = sin(angle/2.0) if sin_half_angle == 0.0: return (p1, p2) # calculate the distance from p1 to the center of the arc dist_to_center = radius / sin_half_angle # calculate the distance from p1 to each tangent point dist_to_tangent = sqrt(dist_to_center**2-radius**2) # calculate the tangent points t1 = (p1[0]+v1[0]*dist_to_tangent, p1[1]+v1[1]*dist_to_tangent) t2 = (p1[0]+v2[0]*dist_to_tangent, p1[1]+v2[1]*dist_to_tangent) return (t1, t2) enthought-chaco2-4.8.1.orig/kiva/testing.py0000644000175000017500000000521713477706655017707 0ustar varunvarun# Copyright (c) 2008-2013 by Enthought, Inc. # All rights reserved. try: from unittest.mock import Mock except ImportError: from mock import Mock from kiva.image import GraphicsContext class KivaTestAssistant(object): """ Mixin test helper for kiva drawing tests. """ def create_mock_gc( self, width, height, methods=()): """ Create an image graphics context that with mocked methods. Parameters ---------- width, height : The size of the graphics context canvas. methods : iterable the methods which are going to be mocked with a Mock object. """ gc = GraphicsContext((int(width), int(height))) gc.clear((0.0, 0.0, 0.0, 0.0)) for method in methods: setattr(gc, method, Mock()) return gc def assertPathsAreProcessed(self, drawable, width=200, height=200): """ Check that all the paths have been compiled and processed. Parameters ---------- drawable : A drawable object that has a draw method. width : int, optional The width of the array buffer (default is 200). height : int, optional The height of the array buffer (default is 200). note :: A drawable that draws nothing will pass this check. """ gc = GraphicsContext((width, height)) drawable.draw(gc) compiled_path = gc._get_path() total_vertices = compiled_path.total_vertices() self.assertEqual( total_vertices, 0, msg='There are {0} vertices in compiled paths {1} that ' 'have not been processed'.format(total_vertices, compiled_path)) def assertPathsAreCreated(self, drawable, width=200, height=200): """ Check that drawing creates paths. When paths and lines creation methods are used from a graphics context the drawing paths are compiled and processed. By using a mock graphics context we can check if something has been drawn. Parameters ---------- drawable : A drawable object that has a draw method. width : int, optional The width of the array buffer (default is 200). height : int, optional The height of the array buffer (default is 200). """ gc = self.create_mock_gc(width, height, ('draw_path', 'stroke_path')) drawable.draw(gc) compiled_path = gc._get_path() self.assertTrue( compiled_path.total_vertices() > 0, msg='There are no compiled paths ' 'created: {0}'.format(compiled_path)) enthought-chaco2-4.8.1.orig/kiva/abstract_graphics_context.py0000644000175000017500000003746513421603267023453 0ustar varunvarunfrom __future__ import absolute_import from abc import ABCMeta, abstractmethod import six from .constants import FILL_STROKE, SQUARE_MARKER @six.add_metaclass(ABCMeta) class AbstractGraphicsContext(object): """ Abstract Base Class for Kiva Graphics Contexts """ # ---------------------------------------------------------------- # Save/Restore graphics state. # ---------------------------------------------------------------- @abstractmethod def save_state(self): """ Push the current graphics state onto the stack """ @abstractmethod def restore_state(self): """ Pop the previous graphics state from the stack """ # ---------------------------------------------------------------- # context manager interface # ---------------------------------------------------------------- def __enter__(self): self.save_state() def __exit__(self, type, value, traceback): self.restore_state() # ------------------------------------------- # Graphics state methods # ------------------------------------------- @abstractmethod def set_stroke_color(self, color): """ Set the color used when stroking a path """ @abstractmethod def get_stroke_color(self): """ Get the current color used when stroking a path """ @abstractmethod def set_line_width(self, width): """ Set the width of the pen used to stroke a path """ @abstractmethod def set_line_join(self, line_join): """ Set the style of join to use a path corners """ @abstractmethod def set_line_cap(self, line_cap): """ Set the style of cap to use a path ends """ @abstractmethod def set_line_dash(self, line_dash): """ Set the dash style to use when stroking a path Parameters ---------- line_dash An even-lengthed tuple of floats that represents the width of each dash and gap in the dash pattern. """ @abstractmethod def set_fill_color(self, color): """ Set the color used to fill the region bounded by a path """ @abstractmethod def get_fill_color(self): """ Get the color used to fill the region bounded by a path """ @abstractmethod def linear_gradient(self, x1, y1, x2, y2, stops, spread_method, units): """ Modify the fill color to be a linear gradient """ @abstractmethod def radial_gradient(self, cx, cy, r, fx, fy, stops, spread_method, units): """ Modify the fill color to be a linear gradient """ @abstractmethod def set_alpha(self, alpha): """ Set the alpha to use when drawing """ @abstractmethod def get_alpha(self, alpha): """ Return the alpha used when drawing """ @abstractmethod def set_antialias(self, antialias): """ Set whether or not to antialias when drawing """ @abstractmethod def get_antialias(self): """ Set whether or not to antialias when drawing """ @abstractmethod def set_miter_limit(self, miter_limit): """ Set the limit at which mitered joins are flattened """ @abstractmethod def set_flatness(self, flatness): """ Set the error tolerance when drawing curved paths """ @abstractmethod def set_image_interpolation(self, interpolation): """ Set the type of interpolation to use when scaling images """ @abstractmethod def get_image_interpolation(self): """ Get the type of interpolation to use when scaling images """ # ------------------------------------------- # Transformation matrix methods # ------------------------------------------- @abstractmethod def translate_ctm(self, x, y): """ Concatenate a translation to the current transformation matrix """ @abstractmethod def rotate_ctm(self, angle): """ Concatenate a rotation to the current transformation matrix """ @abstractmethod def concat_ctm(self, matrix): """ Concatenate an arbitrary affine matrix to the current transformation matrix """ @abstractmethod def scale_ctm(self, x_scale, y_scale): """ Concatenate a scaling to the current transformation matrix """ @abstractmethod def set_ctm(self, matrix): """ Set the current transformation matrix """ @abstractmethod def get_ctm(self): """ Get the current transformation matrix """ # ------------------------------------------- # Clipping functions # ------------------------------------------- @abstractmethod def clip_to_rect(self, rect): """ Set the clipping region to the specified rectangle """ @abstractmethod def clip_to_rects(self, rect_array): """ Set the clipping region to the collection of rectangles """ @abstractmethod def clip(self): """ Set the clipping region to the current path """ @abstractmethod def even_odd_clip(self): """ Modify clipping region with current path using even-odd rule """ # ------------------------------------------- # Path construction functions # ------------------------------------------- @abstractmethod def begin_path(self): """ Start a new path """ @abstractmethod def close_path(self): """ Finish a subpath, connecting back to the start """ @abstractmethod def get_empty_path(self): """ Get an empty CompiledPath instance """ @abstractmethod def add_path(self, compiled_path): """ Add the current path to a compiled path """ @abstractmethod def move_to(self, x, y): """ Move the current point on the path without drawing """ @abstractmethod def line_to(self, x, y): """ Add a line from the current point to (x, y) to the path """ @abstractmethod def lines(self, points): """ Adds a series of lines as a new subpath. Parameters ---------- points an Nx2 sequence of (x, y) pairs The current_point is moved to the last point in `point_array`. """ @abstractmethod def line_set(self, starts, ends): """ Adds a set of disjoint lines as a new subpath. Parameters ---------- starts an Nx2 array of x,y pairs ends an Nx2 array of x,y pairs Starts and ends arrays should have the same length. The current point is moved to the last point in 'ends'. """ @abstractmethod def rect(self, x, y, w, h): """ Add a rectangle as a new sub-path The bottom left corner is (x, y) the width is w and height is h. """ @abstractmethod def rects(self, rect_array): """ Add a sequence of rectangles as separate sub-paths. Parameters ---------- rect_array: An Nx4 array of (x, y, w, h) quadruples """ @abstractmethod def curve_to(self, x1, y1, x2, y2, end_x, end_y): """ Draw a cubic bezier curve The curve starts from the current point and ends at (end_x, end_y), with control points (x1,y1) and (x2,y2). """ @abstractmethod def quad_curve_to(self, cp_x, cp_y, end_x, end_y): """ Draw a quadratic bezier curve The curve starts the current point and ends at (end_x, end_y), with control point (cp_x, cp_y) """ @abstractmethod def arc(self, x, y, radius, start_angle, end_angle, cw=False): """ Draw a circular arc of the given radius, centered at (x,y) The angular span is from start_angle to end_angle, where angles are measured counter-clockwise from the positive X axis. If "cw" is true, then the arc is swept from the end_angle back to the start_angle (it does not change the sense in which the angles are measured, but may affect rendering based on winding number calculations). """ @abstractmethod def arc_to(self, x1, y1, x2, y2, radius): """ Draw a circular arc from current point to tangent line The arc is tangent to the line from the current pen position to (x1,y1), and it is also tangent to the line from (x1,y1) to (x2,y2). (x1,y1) is the imaginary intersection point of the two lines tangent to the arc at the current point and at (x2,y2). If the tangent point on the line from the current pen position to (x1,y1) is not equal to the current pen position, a line is drawn to it. Depending on the supplied radius, the tangent point on the line fron (x1,y1) to (x2,y2) may or may not be (x2,y2). In either case, the arc is drawn to the point of tangency, which is also the new pen position. Consider the common case of rounding a rectangle's upper left corner. Let "r" be the radius of rounding. Let the current pen position be (x_left + r, y_top). Then (x2,y2) would be (x_left, y_top - radius), and (x1,y1) would be (x_left, y_top). """ # ------------------------------------------- # Drawing functions # ------------------------------------------- @abstractmethod def stroke_path(self): """ Stroke the current path with pen settings from current state """ @abstractmethod def fill_path(self): """ Fill the current path with fill settings from the current state This fills using the nonzero rule filling algorithm """ @abstractmethod def eof_fill_path(self): """ Fill the current path with fill settings from the current state This fills using the even-odd rule filling algorithm """ @abstractmethod def draw_path(self, draw_mode=FILL_STROKE): """ Draw the current path with the specified mode """ @abstractmethod def draw_rect(self, rect, draw_mode=FILL_STROKE): """ Draw a rectangle with the specified mode The rectangle is specified by a tuple (x, y, w, h). """ @abstractmethod def draw_image(image, rect=None): """ Render an image into a rectangle The rectangle is specified as an (x, y, w, h) tuple. If it is not specified then the bounds of the the graphics context are used as the rectangle. """ # ------------------------------------------- # Text functions # ------------------------------------------- @abstractmethod def set_text_drawing_mode(self, draw_mode): """ Set the drawing mode to use with text """ @abstractmethod def set_text_matrix(self, text_matrix): """ Set the transformation matrix to use when drawing text """ @abstractmethod def get_text_matrix(self): """ Get the transformation matrix to use when drawing text """ @abstractmethod def set_text_position(self, x, y): """ Set the current point for drawing text This point is on the baseline of the text """ @abstractmethod def get_text_position(self): """ Get the current point where text will be drawn """ @abstractmethod def show_text(self, text): """ Draw the specified string at the current point """ @abstractmethod def get_text_extent(self, text): """ Return a rectangle which encloses the specified text The rectangle (x, y, w, h) is relative to an origin which is at the baseline of the text and at the left of the first character rendered. In other words, x is the leading and y the descent. """ @abstractmethod def get_full_text_extent(self, string): """ Get the text extent as a tuple (w, h, x, y) This method is deprecated: you should use get_text_extent() instead. This order is provided for backwards-compatibility with existing Enable code. """ @abstractmethod def select_font(self, name, size=12, style="regular", encoding=None): """ Set the font based on the provided parameters Parameters ---------- name: The name of a font. E.g.: "Times New Roman" size The font size in points. style One of "regular", "bold", "italic", "bold italic" encoding A 4 letter encoding name. Common ones are: * "unic" -- unicode * "armn" -- apple roman * "symb" -- symbol Not all fonts support all encodings. If none is specified, fonts that have unicode encodings default to unicode. Symbol is the second choice. If neither are available, the encoding defaults to the first one returned in the FreeType charmap list for the font face. """ @abstractmethod def set_font(self, font): """ Set the font with a Kiva font object """ @abstractmethod def get_font(self): """ Get the current font """ @abstractmethod def set_font_size(self, size): """ Set the size of the current font """ @abstractmethod def set_character_spacing(self, spacing): """ Set the spacing between characters when drawing text Parameters ---------- spacing : float units of space extra space to add between text coordinates. It is specified in text coordinate system. """ @abstractmethod def get_character_spacing(self): """ Get the current spacing between characters when drawing text """ @abstractmethod def show_text_at_point(self, x, y): """ Draw text at the absolute position specified by the point """ # ------------------------------------------- # Misc functions # ------------------------------------------- @abstractmethod def flush(self): """ Render all pending draw operations immediately This only makes sense in GUI window contexts (eg. Quartz or QPainter). """ @abstractmethod def synchronize(self): """ A deferred version of flush() Also only relevant in window contexts. """ @abstractmethod def begin_page(self): """ Start rendering in a new page """ @abstractmethod def end_page(self): """ Finish rendering in a page """ @abstractmethod def clear_rect(self, rect): """ Set rectangle to background colour This may not be available in some backends, such as PDF or PostScript. """ @abstractmethod def save(self, filename, file_format=None, pil_options=None): """ Save the graphics context to a file Data is always saved in RGB or RGBA format, and converted to that format if not already in it. If the file_format argument is None, then the file format is inferred from the filename extension, and so is not usually needed. The pil_options argument is a dictionary of format-specific options that can be passed directly to PIL's image file writers. For example, this can be used to control the compression level of JPEG or PNG output. Unrecognized options are silently ignored. """ class EnhancedAbstractGraphicsContext(AbstractGraphicsContext): """ ABC for graphics contexts which provide additional methods """ @abstractmethod def draw_marker_at_points(self, point_array, size, marker=SQUARE_MARKER): """ Draw a marker at a collection of points The shape and size of the marker are specified by the size and marker arguments. """ @abstractmethod def draw_path_at_points(self, point_array, compiled_path, draw_mode): """ Draw a compiled path at a collection of points The starting point of the paths are specified by the points, and the drawing mode is specified by the third argument. """ @abstractmethod def show_text_translate(self, text, dx, dy): """ Draw the specified text translated as specified """ enthought-chaco2-4.8.1.orig/kiva/constants.py0000644000175000017500000000752613421603267020233 0ustar varunvarun# ------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # some parts copyright Space Telescope Science Institute # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! # ------------------------------------------------------------------------------ """ Constants used by core2d drawing engine. """ from numpy import array # -------------------------------------------------------------------- # Line Dash Constants # -------------------------------------------------------------------- NO_DASH = (0, array([0])) del array # -------------------------------------------------------------------- # Line Cap Constants # -------------------------------------------------------------------- CAP_ROUND = 0 CAP_BUTT = 1 CAP_SQUARE = 2 # -------------------------------------------------------------------- # Line Join Constants # -------------------------------------------------------------------- JOIN_ROUND = 0 JOIN_BEVEL = 1 JOIN_MITER = 2 # -------------------------------------------------------------------- # Path Drawing Mode Constants # # Path drawing modes for path drawing methods. # The values are chosen so that bit flags can be checked in a later # C version. # -------------------------------------------------------------------- FILL = 1 EOF_FILL = 2 STROKE = 4 FILL_STROKE = 5 EOF_FILL_STROKE = 6 # ----------------------------------------------------------------------------- # Font Constants # ----------------------------------------------------------------------------- NORMAL = 0 BOLD = 1 ITALIC = 2 BOLD_ITALIC = 3 # Font families, as defined by the Windows API, and their CSS equivalents DEFAULT = 0 SWISS = 1 # Sans-serif ROMAN = 2 # Serif MODERN = 3 # Monospace DECORATIVE = 4 # Fantasy SCRIPT = 5 # Cursive TELETYPE = 6 # ----------------------------------------------------------------------------- # Text Drawing Mode Constants # ----------------------------------------------------------------------------- TEXT_FILL = 0 TEXT_STROKE = 1 TEXT_FILL_STROKE = 2 TEXT_INVISIBLE = 3 TEXT_FILL_CLIP = 4 TEXT_STROKE_CLIP = 5 TEXT_FILL_STROKE_CLIP = 6 TEXT_CLIP = 7 TEXT_OUTLINE = 8 # ----------------------------------------------------------------------------- # Subpath Drawing Primitive Constants # # Used by the drawing state machine to determine what object to draw. # ----------------------------------------------------------------------------- POINT = 0 LINE = 1 LINES = 2 RECT = 3 CLOSE = 4 CURVE_TO = 5 QUAD_CURVE_TO = 6 ARC = 7 ARC_TO = 8 # ----------------------------------------------------------------------------- # Subpath CTM Constants # # These are added so its possible for OpenGL to do the matrix transformations # on the data (its much faster than doing it with Numeric). # ----------------------------------------------------------------------------- SCALE_CTM = 5 TRANSLATE_CTM = 6 ROTATE_CTM = 7 CONCAT_CTM = 8 LOAD_CTM = 9 # ----------------------------------------------------------------------------- # Marker Types # # These are the marker types for draw_marker_at_points. Some backends # (like Agg) have fast implementations for these; other backends manually # construct the paths representing these markers. # # Note that draw_marker_at_points takes a marker name as a string. # ----------------------------------------------------------------------------- NO_MARKER = 0 SQUARE_MARKER = 1 DIAMOND_MARKER = 2 CIRCLE_MARKER = 3 CROSSED_CIRCLE_MARKER = 4 CROSS_MARKER = 5 TRIANGLE_MARKER = 6 INVERTED_TRIANGLE_MARKER = 7 PLUS_MARKER = 8 DOT_MARKER = 9 PIXEL_MARKER = 10 enthought-chaco2-4.8.1.orig/kiva/cairo.py0000644000175000017500000013111213421603267017301 0ustar varunvarun""" Implementation of the core2d drawing library, using cairo for rendering :Author: Bryan Cole (bryan@cole.uklinux.net) :Copyright: Bryan Cole (except parts copied from basecore2d) :License: BSD Style This is currently under development and is not yet fully functional. """ from __future__ import absolute_import import cairo import copy import six.moves as sm import numpy import warnings from .arc_conversion import arc_to_tangent_points from . import basecore2d, constants line_join = {constants.JOIN_BEVEL: cairo.LINE_JOIN_BEVEL, constants.JOIN_MITER: cairo.LINE_JOIN_MITER, constants.JOIN_ROUND: cairo.LINE_JOIN_ROUND } line_cap = {constants.CAP_BUTT: cairo.LINE_CAP_BUTT, constants.CAP_ROUND: cairo.LINE_CAP_ROUND, constants.CAP_SQUARE: cairo.LINE_CAP_SQUARE } font_slant = {"regular":cairo.FONT_SLANT_NORMAL, "bold":cairo.FONT_SLANT_NORMAL, "italic":cairo.FONT_SLANT_ITALIC, "bold italic":cairo.FONT_SLANT_ITALIC } font_weight = {"regular":cairo.FONT_WEIGHT_NORMAL, "bold":cairo.FONT_WEIGHT_BOLD, "italic":cairo.FONT_WEIGHT_NORMAL, "bold italic":cairo.FONT_WEIGHT_BOLD } spread_methods = {"pad":cairo.EXTEND_PAD, "reflect":cairo.EXTEND_REFLECT, "repeat":cairo.EXTEND_REPEAT } text_draw_modes = {'FILL': (constants.TEXT_FILL, constants.TEXT_FILL_CLIP, constants.TEXT_FILL_STROKE, constants.TEXT_FILL_STROKE_CLIP), 'STROKE':(constants.TEXT_FILL_STROKE, constants.TEXT_FILL_STROKE_CLIP, constants.TEXT_STROKE, constants.TEXT_STROKE_CLIP), 'CLIP':(constants.TEXT_CLIP, constants.TEXT_FILL_CLIP, constants.TEXT_FILL_STROKE_CLIP, constants.TEXT_STROKE_CLIP), 'INVISIBLE': constants.TEXT_INVISIBLE } class PixelMap(object): def __init__(self, surface, width, height): self.surface = surface self.width = width self.height = height def draw_to_wxwindow(self, window, x, y): import wx window_dc = getattr(window,'_dc',None) if window_dc is None: window_dc = wx.PaintDC(window) arr = self.convert_to_rgbarray() image = wx.EmptyImage(self.width, self.height) image.SetDataBuffer(arr.data) bmp = wx.BitmapFromImage(image, depth=-1) window_dc.BeginDrawing() window_dc.DrawBitmap(bmp,x,y) window_dc.EndDrawing() return def convert_to_rgbarray(self): pixels = numpy.frombuffer(self.surface.get_data(), numpy.uint8) red = pixels[2::4] green = pixels[1::4] blue = pixels[0::4] return numpy.vstack((red, green, blue)).T.flatten() def convert_to_argbarray(self, flip=False): pixels = numpy.frombuffer(self.surface.get_data(), numpy.uint8) alpha = pixels[0::4] red = pixels[1::4] green = pixels[2::4] blue = pixels[3::4] if flip: return numpy.vstack((alpha, red, green, blue)).T\ .reshape((self.height, self.width, 4))[::-1,...].flatten() # no flip return numpy.vstack((alpha, red, green, blue)).T.flatten() class GraphicsState(object): """ Holds information used by a graphics context when drawing. The Cairo state stores the following: * Operator (the blend mode) * Tolerance * Antialias (bool) * stroke style (line width, cap, join, mitre-limit, dash-style) * fill rule * font face * scaled font * font matrix (includes font size) * font options (antialias, subpixel order, hint style, hint metrics) * clip region * target surface and previous target surface * CTM, CTM-inverse, source CTM The Quartz2D state (which kiva follows AFAIK) includes: * CTM * stroke style (line width, cap, join, mitre, dash) * clip region * tolerance (accuracy) * anti-alias * \*fill- and stroke- colors * \*fill- and stroke- Color Space (RGB, HSV, CMYK etc.) * \*Rendering intent (something to do with Color Spaces) * \*alpha value * blend mode * text font * text font size * \*text drawing mode (stroked, filled, clipped and combinations of these) * \*text character spacing (extra space between glyphs) \*: items in the Quartz2D state that Cairo doesn't support directly. basecore2d GraphicsState includes: * ctm * line_color * line_width * line_join * line_cap * line_dash * fill_color * alpha * font * \*text_matrix * clipping_path * \*current_point * should_antialias * miter_limit * flatness * character_spacing * text_drawing_mode * rendering_intent (not yet implemented) \*: discrepancies compared to Quartz2D """ def __init__(self): self.fill_color = [1,1,1] self.stroke_color = [1,1,1] self.alpha = 1.0 self.text_drawing_mode = constants.TEXT_FILL self.has_gradient = False #not implemented yet... self.text_character_spacing = None self.fill_colorspace = None self.stroke_colorspace = None self.rendering_intent = None def copy(self): return copy.deepcopy(self) class GraphicsContext(basecore2d.GraphicsContextBase): def __init__(self, size, *args, **kw): super(GraphicsContext, self).__init__(size, *args, **kw) w,h = size self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h) self.surface.set_device_offset(0,h) if 'context' in kw: ctx = kw.pop('context') else: ctx = cairo.Context(self.surface) ctx.set_source_rgb(1,1,1) ctx.scale(1,-1) self._ctx = ctx self.state = GraphicsState() self.state_stack = [] #the text-matrix includes the text position self.text_matrix = cairo.Matrix(1,0,0,-1,0,0) #not part of the graphics state self.pixel_map = PixelMap(self.surface, w, h) def clear(self, color=(1,1,1)): self.save_state() if len(color) == 4: self._ctx.set_source_rgba(*color) else: self._ctx.set_source_rgb(*color) self.rect(0, 0, self.width(), self.height()) self.draw_path(constants.FILL) self.restore_state() def height(self): return self._ctx.get_target().get_height() def width(self): return self._ctx.get_target().get_width() def scale_ctm(self, sx, sy): """ Sets the coordinate system scale to the given values, (sx,sy). Parameters ---------- sx : float The new scale factor for the x axis sy : float The new scale factor for the y axis """ self._ctx.scale(sx, sy) def translate_ctm(self, tx, ty): """ Translates the coordinate system by the value given by (tx,ty) Parameters ---------- tx : float The distance to move in the x direction ty : float The distance to move in the y direction """ self._ctx.translate(tx, ty) def rotate_ctm(self, angle): """ Rotates the coordinate space for drawing by the given angle. Parameters ---------- angle : float the angle, in radians, to rotate the coordinate system """ self._ctx.rotate(angle) def concat_ctm(self, transform): """ Concatenates the transform to current coordinate transform matrix. Parameters ---------- transform : affine_matrix the transform matrix to concatenate with the current coordinate matrix. """ try: #assume transform is a cairo.Matrix object self._ctx.transform(transform) except TypeError: #now assume transform is a list of matrix elements (floats) self._ctx.transform(cairo.Matrix(*transform)) def get_ctm(self): """ Returns the current coordinate transform matrix as a list of matrix elements """ return list(self._ctx.get_matrix()) #---------------------------------------------------------------- # Save/Restore graphics state. #---------------------------------------------------------------- def save_state(self): """ Saves the current graphic's context state. Always pair this with a `restore_state()`. """ self._ctx.save() self.state_stack.append(self.state) self.state = self.state.copy() def restore_state(self): """ Restores the previous graphics state. """ self._ctx.restore() self.state = self.state_stack.pop() #---------------------------------------------------------------- # Manipulate graphics state attributes. #---------------------------------------------------------------- def set_antialias(self,value): """ Sets/Unsets anti-aliasing for bitmap graphics context. Ignored on most platforms. """ if bool(value): val = cairo.ANTIALIAS_DEFAULT else: val = cairo.ANTIALIAS_NONE self._ctx.set_antialias(val) def set_line_width(self,width): """ Sets the line width for drawing Parameters ---------- width : float The new width for lines in user space units. """ self._ctx.set_line_width(width) def set_line_join(self,style): """ Sets the style for joining lines in a drawing. Parameters ---------- style : join_style The line joining style. The available styles are JOIN_ROUND, JOIN_BEVEL, JOIN_MITER. """ try: self._ctx.set_line_join(line_join[style]) except KeyError: raise ValueError("Invalid line-join style") def set_miter_limit(self,limit): """ Specifies limits on line lengths for mitering line joins. If line_join is set to miter joins, the limit specifies which line joins should actually be mitered. If lines are not mitered, they are joined with a bevel. The line width is divided by the length of the miter. If the result is greater than the limit, the bevel style is used. This is not implemented on most platforms. Parameters ---------- limit : float limit for mitering joins. defaults to 1.0. (XXX is this the correct default?) """ self._ctx.set_miter_limit(limit) def set_line_cap(self,style): """ Specifies the style of endings to put on line ends. Parameters ---------- style : cap_style The line cap style to use. Available styles are CAP_ROUND, CAP_BUTT, CAP_SQUARE. """ try: self._ctx.set_line_cap(line_cap[style]) except KeyError: raise ValueError("Invalid line cap style") def set_line_dash(self,pattern,phase=0): """ Sets the line dash pattern and phase for line painting. Parameters ---------- pattern : float array An array of floating point values specifing the lengths of on/off painting pattern for lines. phase : float Specifies how many units into dash pattern to start. phase defaults to 0. """ if pattern is not None: pattern = list(pattern) self._ctx.set_dash(pattern, phase) def set_flatness(self,flatness): """ Not implemented It is device dependent and therefore not recommended by the PDF documentation. flatness determines how accurately lines are rendered. Setting it to values less than one will result in more accurate drawings, but they take longer. It defaults to None """ self._ctx.set_tolerance(flatness) #---------------------------------------------------------------- # Sending drawing data to a device #---------------------------------------------------------------- def flush(self): """ Sends all drawing data to the destination device. Currently this is a NOP for wxPython. """ s = self._ctx.get_target() s.flush() def synchronize(self): """ Prepares drawing data to be updated on a destination device. Currently this is a NOP for all implementations. """ pass #---------------------------------------------------------------- # Page Definitions #---------------------------------------------------------------- def begin_page(self): """ Creates a new page within the graphics context. Currently this is a NOP for all implementations. The PDF backend should probably implement it, but the ReportLab Canvas uses the showPage() method to handle both begin_page and end_page issues. """ pass def end_page(self): """ Ends drawing in the current page of the graphics context. Currently this is a NOP for all implementations. The PDF backend should probably implement it, but the ReportLab Canvas uses the showPage() method to handle both begin_page and end_page issues. """ pass def radial_gradient(self, cx, cy, r, fx, fy, stops, spreadMethod='pad', units='userSpaceOnUse', transforms=None): """ Set a radial gradient as the fill color. """ # TODO: handle transforms if units == 'objectBoundingBox': # transform from relative coordinates path_rect = self._ctx.path_extents() width = path_rect[2]-path_rect[0] height = path_rect[3]-path_rect[1] r = r * width cx = path_rect[0] + cx * width fx = path_rect[0] + fx * width cy = path_rect[1] + cy * height fy = path_rect[1] + fy * height gradient = cairo.RadialGradient(fx, fy, 0.0, cx, cy, r) gradient.set_extend(spread_methods.get(spreadMethod, cairo.EXTEND_NONE)) for stop in stops: #FIXME: the stops are possibly being generated wrong if the offset is specified if stop.size == 10: start = tuple(stop[0:5]) end = tuple(stop[5:10]) gradient.add_color_stop_rgba(*start) gradient.add_color_stop_rgba(*end) else: start = tuple(stop[0:5]) gradient.add_color_stop_rgba(*start) self.state.has_gradient = True self._ctx.set_source(gradient) def linear_gradient(self, x1, y1, x2, y2, stops, spreadMethod='pad', units='userSpaceOnUse', transforms=None): """ Set a linear gradient as the fill color. """ # TODO: handle transforms if units == 'objectBoundingBox': # transform from relative coordinates path_rect = self._ctx.path_extents() width = path_rect[2]-path_rect[0] height = path_rect[3]-path_rect[1] x1 = path_rect[0] + x1 * width x2 = path_rect[0] + x2 * width y1 = path_rect[1] + y1 * height y2 = path_rect[1] + y2 * height gradient = cairo.LinearGradient(x1, y1, x2, y2) gradient.set_extend(spread_methods.get(spreadMethod, cairo.EXTEND_NONE)) for stop in stops: # FIXME: the stops are possibly being generated wrong if the offset is specified if stop.size == 10: start = tuple(stop[0:5]) end = tuple(stop[5:10]) gradient.add_color_stop_rgba(*start) gradient.add_color_stop_rgba(*end) else: start = tuple(stop[0:5]) gradient.add_color_stop_rgba(*start) self.state.has_gradient = True self._ctx.set_source(gradient) #---------------------------------------------------------------- # Building paths (contours that are drawn) # # + Currently, nothing is drawn as the path is built. Instead, the # instructions are stored and later drawn. Should this be changed? # We will likely draw to a buffer instead of directly to the canvas # anyway. # # Hmmm. No. We have to keep the path around for storing as a # clipping region and things like that. # # + I think we should keep the current_path_point hanging around. # #---------------------------------------------------------------- def begin_path(self): """ Clears the current drawing path and begin a new one. """ # Need to check here if the current subpath contains matrix # transforms. If it does, pull these out, and stick them # in the new subpath. self._ctx.new_path() def move_to(self,x,y): """ Starts a new drawing subpath and place the current point at (x,y). Notes: Not sure how to treat state.current_point. Should it be the value of the point before or after the matrix transformation? It looks like before in the PDF specs. """ self._ctx.move_to(x,y) def line_to(self,x,y): """ Adds a line from the current point to the given point (x,y). The current point is moved to (x,y). What should happen if move_to hasn't been called? Should it always begin at 0,0 or raise an error? Notes: See note in move_to about the current_point. """ self._ctx.line_to(x,y) def lines(self,points): """ Adds a series of lines as a new subpath. Parameters ---------- points an Nx2 array of x,y pairs The current_point is moved to the last point in 'points' """ self._ctx.new_sub_path() for point in points: self._ctx.line_to(*point) def line_set(self, starts, ends): """ Adds a set of disjoint lines as a new subpath. Parameters ---------- starts an Nx2 array of x,y pairs ends an Nx2 array of x,y pairs Starts and ends should have the same length. The current point is moved to the last point in 'ends'. N.B. Cairo cannot make disjointed lines as a single subpath, thus each line forms it's own subpath """ for start, end in sm.zip(starts, ends): self._ctx.move_to(*start) self._ctx.line_to(*end) def rect(self,x,y,sx,sy): """ Adds a rectangle as a new subpath. """ self._ctx.rectangle(x,y,sx,sy) # def draw_rect(self, rect, mode): # self.rect(*rect) # self.draw_path(mode=mode) # # def rects(self,rects): # """ Adds multiple rectangles as separate subpaths to the path. # # Not very efficient -- calls rect multiple times. # """ # for x,y,sx,sy in rects: # self.rect(x,y,sx,sy) def close_path(self,tag=None): """ Closes the path of the current subpath. Currently starts a new subpath -- is this what we want? ... Cairo starts a new subpath automatically. """ self._ctx.close_path() def curve_to(self, x_ctrl1, y_ctrl1, x_ctrl2, y_ctrl2, x_to, y_to): """ Draw a cubic bezier curve from the current point. Parameters ---------- x_ctrl1 : float X-value of the first control point. y_ctrl1 : float Y-value of the first control point. x_ctrl2 : float X-value of the second control point. y_ctrl2 : float Y-value of the second control point. x_to : float X-value of the ending point of the curve. y_to : float Y-value of the ending point of the curve. """ self._ctx.curve_to(x_ctrl1, y_ctrl1, x_ctrl2, y_ctrl2, x_to, y_to) # def quad_curve_to(self, x_ctrl, y_ctrl, x_to, y_to): # """ Draw a quadratic bezier curve from the current point. # # Parameters # ---------- # x_ctrl : float # X-value of the control point # y_ctrl : float # Y-value of the control point. # x_to : float # X-value of the ending point of the curve # y_to : float # Y-value of the ending point of the curve. # """ # # A quadratic Bezier curve is just a special case of the cubic. Reuse # # its implementation in case it has been implemented for the specific # # backend. # x0, y0 = self.state.current_point # xc1 = (x0 + x_ctrl + x_ctrl) / 3.0 # yc1 = (y0 + y_ctrl + y_ctrl) / 3.0 # xc2 = (x_to + x_ctrl + x_ctrl) / 3.0 # yc2 = (y_to + y_ctrl + y_ctrl) / 3.0 # self.curve_to(xc1, yc1, xc2, yc2, x_to, y_to) def arc(self, x, y, radius, start_angle, end_angle, cw=False): """ Draw a circular arc. If there is a current path and the current point is not the initial point of the arc, a line will be drawn to the start of the arc. If there is no current path, then no line will be drawn. Parameters ---------- x : float X-value of the center of the arc. y : float Y-value of the center of the arc. radius : float The radius of the arc. start_angle : float The angle, in radians, that the starting point makes with respect to the positive X-axis from the center point. end_angle : float The angles, in radians, that the final point makes with respect to the positive X-axis from the center point. cw : bool, optional Whether the arc should be drawn clockwise or not. """ if cw: #not sure if I've got this the right way round self._ctx.arc_negative( x, y, radius, start_angle, end_angle) else: self._ctx.arc( x, y, radius, start_angle, end_angle) def arc_to(self, x1, y1, x2, y2, radius): """ Draw an arc between the line segments from the current point to (x1,y1) and from (x1,y1) to (x2,y2). Straight lines are also added from the current point to the start of the curve and from the end of the curve to (x2,y2). """ current_point = self.get_path_current_point() # Get the endpoints on the curve where it touches the line segments t1, t2 = arc_to_tangent_points(current_point, (x1,y1), (x2,y2), radius) # draw! self._ctx.line_to(*t1) self._ctx.curve_to(x1,y1, x1,y1, *t2) self._ctx.line_to(x2,y2) #---------------------------------------------------------------- # Getting infomration on paths #---------------------------------------------------------------- def is_path_empty(self): """ Tests to see whether the current drawing path is empty What does 'empty' mean??? """ p = self._ctx.copy_path() return any(a[0] for a in p) def get_path_current_point(self): """ Returns the current point from the graphics context. Note: Currently the current_point is only affected by move_to, line_to, and lines. It should also be affected by text operations. I'm not sure how rect and rects and friends should affect it -- will find out on Mac. """ return self._ctx.get_current_point() def get_path_bounding_box(self): """ cairo.Context.path_extents not yet implemented on my cairo version. It's in new ones though. What should this method return? """ if self.is_path_empty(): return [[0,0],[0,0]] p = [a[1] for a in self._ctx.copy_path()] p = numpy.array(p) return [p.min(axis=1), p.max(axis=1)] def add_path(self, path): """Draw a compiled path into this gc. In this case, a compiled path is a Cairo.Path""" if isinstance(path, CompiledPath): self.begin_path() for op_name, op_args in path.state: op = getattr(self, op_name) op(*op_args) self.close_path() #---------------------------------------------------------------- # Clipping path manipulation #---------------------------------------------------------------- def clip(self): """ Should this use clip or clip_preserve """ fr = self._ctx.get_fill_rule() self._ctx.set_fill_rule(cairo.FILL_RULE_WINDING) self._ctx.clip() self._ctx.set_fill_rule(fr) def even_odd_clip(self): """ """ fr = self._ctx.get_fill_rule() self._ctx.set_fill_rule(cairo.FILL_RULE_EVEN_ODD) self._ctx.clip() self._ctx.set_fill_rule(fr) def clip_to_rect(self,x,y,width,height): """ Sets the clipping path to the intersection of the current clipping path with the area defined by the specified rectangle """ ctx = self._ctx #get the current path p = ctx.copy_path() ctx.new_path() ctx.rectangle(x,y,width,height) ctx.clip() ctx.append_path(p) # def clip_to_rects(self): # """ # """ # pass def clear_clip_path(self): self._ctx.reset_clip() #---------------------------------------------------------------- # Color space manipulation # # I'm not sure we'll mess with these at all. They seem to # be for setting the color system. Hard coding to RGB or # RGBA for now sounds like a reasonable solution. #---------------------------------------------------------------- #def set_fill_color_space(self): # """ # """ # pass #def set_stroke_color_space(self): # """ # """ # pass #def set_rendering_intent(self): # """ # """ # pass #---------------------------------------------------------------- # Color manipulation #---------------------------------------------------------------- def _set_source_color(self, color): if len(color) == 3: self._ctx.set_source_rgb(*color) else: self._ctx.set_source_rgba(*color) # gradients or other source patterns are blown away by set_source_rgb* self.state.has_gradient = False def set_fill_color(self,color): """ set_fill_color takes a sequences of rgb or rgba values between 0.0 and 1.0 """ self.state.fill_color = color def set_stroke_color(self,color): """ set_stroke_color takes a sequences of rgb or rgba values between 0.0 and 1.0 """ self.state.stroke_color = color def set_alpha(self,alpha): """ """ self.state.alpha = alpha #---------------------------------------------------------------- # Drawing Images #---------------------------------------------------------------- def draw_image(self,img,rect=None): """ img is either a N*M*3 or N*M*4 numpy array, or a Kiva image rect - what is this? assume it's a tuple (x,y, w, h) Only works with numpy arrays. What is a "Kiva Image" anyway? Not Yet Tested. """ from kiva import agg if type(img) == type(numpy.array([])): # Numeric array if img.shape[2]==3: format = cairo.FORMAT_RGB24 elif img.shape[2]==4: format = cairo.FORMAT_ARGB32 img_width, img_height = img.shape[:2] img_surface = cairo.ImageSurface.create_for_data(img.astype(numpy.uint8), format, img_width, img_height) elif isinstance(img, agg.GraphicsContextArray): converted_img = img.convert_pixel_format('rgba32', inplace=0) flipped_array = numpy.flipud(converted_img.bmp_array) img_width, img_height = converted_img.width(), converted_img.height() img_surface = cairo.ImageSurface.create_for_data(flipped_array.flatten(), cairo.FORMAT_RGB24, img_width, img_height) elif isinstance(img, GraphicsContext): # Another cairo kiva context img_width, img_height = img.pixel_map.width, img.pixel_map.height img_surface = cairo.ImageSurface.create_for_data(img.pixel_map.convert_to_argbarray(flip=True), cairo.FORMAT_ARGB32, img_width, img_height) else: warnings.warn("Cannot render image of type '%r' into cairo context." % \ type(img)) return ctx = self._ctx img_pattern = cairo.SurfacePattern(img_surface) if rect: x,y,sx,sy = rect if sx != img_width or sy != img_height: scaler = cairo.Matrix() scaler.scale(img_width/float(sx), img_height/float(sy)) img_pattern.set_matrix(scaler) img_pattern.set_filter(cairo.FILTER_BEST) ctx.set_source(img_pattern) #p = ctx.copy_path() #need to save the path ctx.new_path() ctx.rectangle(x,y,sx,sy) ctx.fill() else: ctx.set_source(img_pattern) ctx.paint() #------------------------------------------------------------------------- # Drawing Text # # Font handling needs more attention. # #------------------------------------------------------------------------- def select_font(self,face_name,size=12,style="regular",encoding=None): """ Selects a new font for drawing text. Parameters ---------- face_name The name of a font. E.g.: "Times New Roman" !! Need to specify a way to check for all the types size The font size in points. style One of "regular", "bold", "italic", "bold italic" encoding A 4 letter encoding name. Common ones are: * "unic" -- unicode * "armn" -- apple roman * "symb" -- symbol Not all fonts support all encodings. If none is specified, fonts that have unicode encodings default to unicode. Symbol is the second choice. If neither are available, the encoding defaults to the first one returned in the FreeType charmap list for the font face. """ # !! should check if name and encoding are valid. # self.state.font = freetype.FontInfo(face_name,size,style,encoding) self._ctx.select_font_face(face_name, font_slant[style], font_weight[style]) self._ctx.set_font_size(size) def set_font(self,font): """ Set the font for the current graphics context. A device-specific font object. In this case, a cairo FontFace object. It's not clear how this can be used right now. """ if font.weight in (constants.BOLD, constants.BOLD_ITALIC): weight = cairo.FONT_WEIGHT_BOLD else: weight = cairo.FONT_WEIGHT_NORMAL if font.style in (constants.ITALIC, constants.BOLD_ITALIC): style = cairo.FONT_SLANT_ITALIC else: style = cairo.FONT_SLANT_NORMAL face_name = font.face_name ctx = self._ctx ctx.select_font_face(face_name, style, weight) ctx.set_font_size(font.size) #facename = font.face_name #slant = font.style #self._ctx.set_font_face(font) def set_font_size(self,size): """ Sets the size of the font. The size is specified in user space coordinates. """ self._ctx.set_font_size(size) def set_character_spacing(self,spacing): """ Sets the amount of additional spacing between text characters. Parameters ---------- spacing : float units of space extra space to add between text coordinates. It is specified in text coordinate system. Notes ----- 1. I'm assuming this is horizontal spacing? 2. Not implemented in wxPython, or cairo (for the time being) """ self.state.character_spacing = spacing def set_text_drawing_mode(self, mode): """ Specifies whether text is drawn filled or outlined or both. Parameters ---------- mode determines how text is drawn to the screen. If a CLIP flag is set, the font outline is added to the clipping path. Possible values: TEXT_FILL fill the text TEXT_STROKE paint the outline TEXT_FILL_STROKE fill and outline TEXT_INVISIBLE paint it invisibly ?? TEXT_FILL_CLIP fill and add outline clipping path TEXT_STROKE_CLIP outline and add outline to clipping path TEXT_FILL_STROKE_CLIP fill, outline, and add to clipping path TEXT_CLIP add text outline to clipping path Note: wxPython currently ignores all but the INVISIBLE flag. """ if mode not in (TEXT_FILL, TEXT_STROKE, TEXT_FILL_STROKE, TEXT_INVISIBLE, TEXT_FILL_CLIP, TEXT_STROKE_CLIP, TEXT_FILL_STROKE_CLIP, TEXT_CLIP, TEXT_OUTLINE): msg = "Invalid text drawing mode. See documentation for valid modes" raise ValueError(msg) self.state.text_drawing_mode = mode def set_text_position(self,x,y): """ """ m = list(self.text_matrix) m[4:6] = x,y self.text_matrix = cairo.Matrix(*m) def get_text_position(self): """ """ return tuple(self.text_matrix)[4:6] def set_text_matrix(self,ttm): """ """ if isinstance(ttm, cairo.Matrix): m = ttm else: m = cairo.Matrix(ttm) self.text_matrix = m def get_text_matrix(self): """ """ return copy.copy(self.text_matrix) def show_text(self,text, point=(0.0,0.0)): """ Draws text on the device at the current text position. Leaves the current point unchanged. """ self.show_text_at_point(text, point[0], point[1]) def show_glyphs(self): """ """ pass def show_text_at_point(self, text, x, y): """ """ ctx = self._ctx #print text, list(ctx.get_matrix()) cur_path = ctx.copy_path() ctx.save() ctx.transform(self.text_matrix) ctx.transform(cairo.Matrix(1,0,0,1,x,y)) ctx.new_path() ctx.text_path(text) #need to set up text drawing mode #'outline' and 'invisible' modes are not supported. mode = self.state.text_drawing_mode if mode in text_draw_modes['STROKE']: self._set_source_color(self.state.stroke_color) ctx.stroke_preserve() if mode in text_draw_modes['FILL']: self._set_source_color(self.state.fill_color) ctx.fill_preserve() if mode in text_draw_modes['CLIP']: ctx.clip_preserve() ctx.restore() ctx.new_path() ctx.append_path(cur_path) def show_glyphs_at_point(self): """ """ pass #---------------------------------------------------------------- # Painting paths (drawing and filling contours) #---------------------------------------------------------------- def draw_path(self, mode=constants.FILL_STROKE): """ Walks through all the drawing subpaths and draw each element. Each subpath is drawn separately. Parameters ---------- mode Specifies how the subpaths are drawn. The default is FILL_STROKE. The following are valid values. FILL Paint the path using the nonzero winding rule to determine the regions for painting. EOF_FILL Paint the path using the even-odd fill rule. STROKE Draw the outline of the path with the current width, end caps, etc settings. FILL_STROKE First fill the path using the nonzero winding rule, then stroke the path. EOF_FILL_STROKE First fill the path using the even-odd fill method, then stroke the path. """ ctx = self._ctx fr = ctx.get_fill_rule() if mode in [constants.EOF_FILL, constants.EOF_FILL_STROKE]: ctx.set_fill_rule(cairo.FILL_RULE_EVEN_ODD) else: ctx.set_fill_rule(cairo.FILL_RULE_WINDING) if mode in [constants.FILL, constants.EOF_FILL]: if not self.state.has_gradient: self._set_source_color(self.state.fill_color) ctx.fill() elif mode == constants.STROKE: if not self.state.has_gradient: self._set_source_color(self.state.stroke_color) ctx.stroke() elif mode in [constants.FILL_STROKE, constants.EOF_FILL_STROKE]: if not self.state.has_gradient: self._set_source_color(self.state.fill_color) ctx.fill_preserve() if not self.state.has_gradient: self._set_source_color(self.state.stroke_color) ctx.stroke() ctx.set_fill_rule(fr) def stroke_rect(self): """ How does this affect the current path? """ pass def stroke_rect_with_width(self): """ """ pass def fill_rect(self): """ """ pass def fill_rects(self): """ """ pass def clear_rect(self): """ """ pass def get_text_extent(self,textstring): """ returns the width and height of the rendered text """ xb, yb, w, h, xa, ya = self._ctx.text_extents(textstring) return xb, yb, w, h def get_full_text_extent(self,textstring): """ How does this differ from 'get_text_extent' ??? This just calls get_text_extent, for the time being. """ x,y,w,h = self.get_text_extent(textstring) ascent, descent, height, maxx, maxy = self._ctx.font_extents() return w, ascent+descent, -descent, height def render_component(self, component, container_coords=False): """ Renders the given component. Parameters ---------- component : Component The component to be rendered. container_coords : Boolean Whether to use coordinates of the component's container Description ----------- If *container_coords* is False, then the (0,0) coordinate of this graphics context corresponds to the lower-left corner of the component's **outer_bounds**. If *container_coords* is True, then the method draws the component as it appears inside its container, i.e., it treats (0,0) of the graphics context as the lower-left corner of the container's outer bounds. """ x, y = component.outer_position w, h = component.outer_bounds if not container_coords: x = -x y = -y self.translate_ctm(x, y) component.draw(self, view_bounds=(0, 0, w, h)) return def save(self, filename, file_format=None): """ Save the GraphicsContext to a (PNG) file. file_format is ignored. """ self.surface.flush() self.surface.write_to_png(filename) class CompiledPath(object): def __init__(self): self.state = [] def add_path(self, *args): self.state.append(('begin_path', args)) def rect(self, *args): self.state.append(('rect', args)) def move_to(self, *args): self.state.append(('move_to', args)) def line_to(self, *args): self.state.append(('line_to', args)) def close_path(self, *args): self.state.append(('close_path', args)) def quad_curve_to(self, *args): self.state.append(('quad_curve_to', args)) def curve_to(self, *args): self.state.append(('curve_to', args)) def arc(self, *args): self.state.append(('arc', args)) def total_vertices(self): return len(self.state) + 1 def vertex(self, index): return (self.state[index-1][1][0:2],) def font_metrics_provider(): return GraphicsContext((1,1)) if __name__=="__main__": from numpy import fabs, linspace, pi, sin from scipy.special import jn from traits.api import false from chaco.api import ArrayPlotData, Plot, PlotGraphicsContext from chaco.example_support import COLOR_PALETTE from itertools import cycle DPI = 72.0 dpi_scale = DPI / 72.0 def create_plot(): numpoints = 100 low = -5 high = 15.0 x = linspace(low, high, numpoints) pd = ArrayPlotData(index=x) p = Plot(pd, bgcolor="lightgray", padding=50, border_visible=True) for t,i in sm.zip(cycle(['line','scatter']),sm.range(10)): pd.set_data("y" + str(i), jn(i,x)) p.plot(("index", "y" + str(i)), color=tuple(COLOR_PALETTE[i]), width = 2.0 * dpi_scale, type=t) p.x_grid.visible = True p.x_grid.line_width *= dpi_scale p.y_grid.visible = True p.y_grid.line_width *= dpi_scale p.legend.visible = True return p container = create_plot() container.outer_bounds = [800,600] container.do_layout(force=True) def render_cairo_png(): w,h = 800,600 scale = 1.0 s = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(w*scale),int(h*scale)) s.set_device_offset(0,h*scale) ctx = cairo.Context(s) ctx.set_source_rgb(1,1,1) ctx.paint() ctx.scale(1,-1) ctx.scale(scale,scale) gc = GraphicsContext((w,h), context=ctx) gc.render_component(container) s.flush() s.write_to_png("/tmp/kiva_cairo.png") def render_cairo_svg(): w,h = 800,600 scale = 1.0 s = cairo.SVGSurface("/tmp/kiva_cairo.svg", w*scale,h*scale) s.set_device_offset(0,h*scale) ctx = cairo.Context(s) ctx.set_source_rgb(1,1,1) ctx.paint() ctx.scale(1,-1) ctx.scale(scale,scale) gc = GraphicsContext((w,h), context=ctx) gc.render_component(container) s.finish() def render_cairo_pdf(): w,h = 800,600 scale = 1.0 s = cairo.PDFSurface("/tmp/kiva_cairo.pdf", w*scale,h*scale) s.set_device_offset(0,h*scale) ctx = cairo.Context(s) ctx.set_source_rgb(1,1,1) ctx.paint() ctx.scale(1,-1) ctx.scale(scale,scale) gc = GraphicsContext((w,h), context=ctx) gc.render_component(container) s.finish() def render_agg(): gc2 = PlotGraphicsContext((800,600), dpi=DPI) gc2.render_component(container) gc2.save("/tmp/kiva_agg.png") #render_agg() render_cairo_png() render_cairo_svg() render_cairo_pdf() render_agg() enthought-chaco2-4.8.1.orig/kiva/affine.py0000644000175000017500000002335213421603267017442 0ustar varunvarun# ------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # Thanks for using Enthought open source! # # Author: Enthought, Inc. # Description: # ------------------------------------------------------------------------------ """ Functions for affine matrices. :Copyright: Space Telescope Science Institute :License: BSD Style :Author: Eric Jones, Enthought, Inc., eric@enthought.com These affine operations are based coordinate system transformations, not translations of pts, etc. To translate a point, you multiply it by the affine transform matrix:: a b 0 [x, y, 1] * c d 0 = [x', y', 1] tx ty 1 This is the opposite order of multiplication from what many are accustomed to. Here is a useful link: http://mathworld.wolfram.com/AffineTransformation.html Notes: I'm not using a class because of possible speed implications. Currently the affine transform is a 3x3 array. Other tools use a 6-tuple of (a, b, c, d, tx, ty) to represent the transform because the other 3 array entries are constant. Other code should call methods from this module instead of manipulating the array, in case the implementation is changed at some future date. """ from numpy import (array, array_equal, arctan2, cos, dot, eye, float64, ones, sin, zeros) # ----------------------------------------------------------------------------- # Affine transform construction # ----------------------------------------------------------------------------- def affine_identity(): """ Returns a new identity affine_transform object. """ return eye(3, 3) def affine_from_values(a, b, c, d, tx, ty): """ Return the affine matrix corresponding to the values The result is the array:: [ a b 0 ] [ c d 0 ] [ tx ty 1 ] """ transform = array(((a, b, 0), (c, d, 0), (tx, ty, 1)), float64) return transform def affine_from_scale(sx, sy): """ Returns an affine transform providing the given scaling. """ r = affine_identity() return scale(r, sx, sy) def affine_from_rotation(angle): """ Returns an affine transform rotated by angle in radians. """ r = affine_identity() return rotate(r, angle) def affine_from_translation(x, y): """ Returns an affine transform with the given translation. """ r = affine_identity() return translate(r, x, y) # ----------------------------------------------------------------------------- # Affine transform manipulation # ----------------------------------------------------------------------------- def scale(transform, sx, sy): """ Returns a scaled version of the transform by the given values. Scaling is done using the following formula:: sx 0 0 a b 0 sx*a sx*b 0 0 sy 0 * c d 0 = sy*c sy*d 0 0 0 1 tx ty 1 0 0 1 """ # this isn't the operation described above, but produces the # same results. scaled = transform.copy() scaled[0] *= sx scaled[1] *= sy return scaled def rotate(transform, angle): """ Rotates transform by angle in radians. Rotation is done using the following formula:: cos(x) sin(x) 0 a b 0 -sin(x) cos(x) 0 * c d 0 = 0 0 1 tx ty 1 :: cos(x)*a+sin(x)*b cos(x)*b+sin(x)*d 0 -sin(x)*a+cos(x)*c -sin(x)*b+cos(x)*d 0 tx ty 1 where x = angle. """ a = cos(angle) b = sin(angle) c = -b d = a tx = 0. ty = 0. rot = affine_from_values(a, b, c, d, tx, ty) return dot(rot, transform) def translate(transform, x, y): """ Returns transform translated by (x, y). Translation:: 1 0 0 a b 0 a b 0 0 1 0 * c d 0 = c d 0 x y 1 tx ty 1 x*a+y*c+y x*b+y*d+ty 1 """ r = affine_identity() r[2, 0] = x r[2, 1] = y return dot(r, transform) def concat(transform, other): """ Returns the concatenation of transform with other. This is simply transform pre-multiplied by other. """ return dot(other, transform) def invert(m): """ Returns the inverse of the transform, m. """ inv = zeros(m.shape, float64) det = m[0, 0] * m[1, 1] - m[0, 1]*m[1, 0] inv[0, 0] = m[1, 1] inv[0, 1] = -m[0, 1] inv[0, 2] = 0 inv[1, 0] = -m[1, 0] inv[1, 1] = m[0, 0] inv[1, 2] = 0 inv[2, 0] = m[1, 0]*m[2, 1] - m[1, 1]*m[2, 0] inv[2, 1] = -m[0, 0]*m[2, 1] + m[0, 1]*m[2, 0] inv[2, 2] = m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] inv /= det return inv # ----------------------------------------------------------------------------- # Affine transform information # ----------------------------------------------------------------------------- IDENTITY = affine_identity() def is_identity(m): """ Tests whether an affine transform is the identity transform. """ return array_equal(m, IDENTITY) def affine_params(m): """ Returns the a, b, c, d, tx, ty values of an affine transform. """ a = m[0, 0] b = m[0, 1] c = m[1, 0] d = m[1, 1] tx = m[2, 0] ty = m[2, 1] return a, b, c, d, tx, ty def tsr_factor(m): """ Factors a matrix as if it is the product of translate/scale/rotate matrices applied (i.e., concatenated) in that order. It returns: tx, ty, sx, sy, angle where tx and ty are the translations, sx and sy are the scaling values and angle is the rotational angle in radians. If the input matrix was created in a way other than concatenating t/s/r matrices, the results could be wrong. For example, if there is any skew in the matrix, the returned results are wrong. Needs Test! """ # ------------------------------------------------------------------------- # Extract Values from Matrix # # Translation values are correct as extracted. Rotation and # scaling need a little massaging. # ------------------------------------------------------------------------- a, b, c, d, tx, ty = affine_params(m) # ------------------------------------------------------------------------- # Rotation -- tan(angle) = b/d # ------------------------------------------------------------------------- angle = arctan2(b, d) # ------------------------------------------------------------------------- # Scaling # # sx = a/cos(angle) or sx = -c/sin(angle) # sy = d/cos(angle) or sy = b/sin(angle) # ------------------------------------------------------------------------- cos_ang = cos(angle) sin_ang = sin(angle) if cos_ang != 0.0: sx, sy = a/cos_ang, d/cos_ang else: sx, sy = -c/sin_ang, b/sin_ang return tx, ty, sx, sy, angle def trs_factor(m): """ Factors a matrix as if it is the product of translate/rotate/scale matrices applied (i.e., concatenated) in that order. It returns: tx,ty,sx,sy,angle where tx and ty are the translations, sx and sy are the scaling values and angle is the rotational angle in radians. If the input matrix was created in a way other than concatenating t/r/s matrices, the results could be wrong. For example, if there is any skew in the matrix, the returned results are wrong. Needs Test! """ # ------------------------------------------------------------------------ # Extract Values from Matrix # # Translation values are correct as extracted. Rotation and # scaling need a little massaging. # ------------------------------------------------------------------------ a, b, c, d, tx, ty = affine_params(m) # ------------------------------------------------------------------------ # Rotation -- tan(angle) = -c/d # ------------------------------------------------------------------------ angle = arctan2(-c, d) # ------------------------------------------------------------------------ # Scaling # # sx = a/cos(angle) or sx = b/sin(angle) # sy = d/cos(angle) or sy = -c/sin(angle) # ------------------------------------------------------------------------ cos_ang = cos(angle) sin_ang = sin(angle) if cos_ang != 0.0: sx, sy = a/cos_ang, d/cos_ang else: sx, sy = b/sin_ang, -c/sin_ang return tx, ty, sx, sy, angle # ----------------------------------------------------------------------------- # Transforming points and arrays of points # ----------------------------------------------------------------------------- def transform_point(ctm, pt): """ Returns pt transformed by the affine transform, ctm. """ p1 = ones(3, float64) p1[:2] = pt res = dot(p1, ctm)[:2] return res def transform_points(ctm, pts): """ Transforms an array of points using the affine transform, ctm. """ if is_identity(ctm): res = pts else: x = pts[..., 0] y = pts[..., 1] a, b, c, d, tx, ty = affine_params(ctm) res = zeros(pts.shape, float64) res[..., 0] = a*x+c*y+tx res[..., 1] = b*x+d*y+ty return res enthought-chaco2-4.8.1.orig/kiva/_version.py0000644000175000017500000000026313544357556020047 0ustar varunvarun# THIS FILE IS GENERATED FROM ENABLE SETUP.PY version = '4.8.1' full_version = '4.8.1' git_revision = '04b8a6a' is_released = True if not is_released: version = full_version enthought-chaco2-4.8.1.orig/kiva/tests/0000755000175000017500000000000013544357631017004 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/tests/basecore2d_test_case.py0000644000175000017500000004345413421603267023424 0ustar varunvarun""" Test suite for affine transforms. :Author: Eric Jones, Enthought, Inc., eric@enthought.com :Copyright: Space Telescope Science Institute :License: BSD Style So far, this is mainly a "smoke test" suite to make sure nothing is obviously wrong. """ from __future__ import with_statement import unittest from numpy import alltrue, array, ravel from kiva import affine from kiva import basecore2d from kiva import constants class TestIsFullyTransparent(unittest.TestCase): def test_simple(self): self.assertTrue(basecore2d.is_fully_transparent([1, 1, 1, 0])) self.assertTrue(not basecore2d.is_fully_transparent([0, 0, 0, 1])) self.assertTrue(not basecore2d.is_fully_transparent([0, 0, 0, .5])) class TestFillEqual(unittest.TestCase): def test_simple(self): self.assertTrue(basecore2d.fill_equal(array([0, 0, 0, 0]), array([0, 0, 0, 0]))) self.assertTrue(not basecore2d.fill_equal(array([0, 0, 0, 0]), array([0, 0, 0, 1]))) self.assertTrue(not basecore2d.fill_equal(array([0, 0, 0, 0]), array([1, 0, 0, 0]))) class LineStateTestCase(unittest.TestCase): def create_ls(self): color = array([0, 0, 0, 1]) width = 2 join = basecore2d.JOIN_MITER cap = basecore2d.CAP_ROUND phase = 0 pattern = array([5, 5]) dash = (phase, pattern) ls = basecore2d.LineState(color, width, cap, join, dash) return ls def test_create(self): self.create_ls() def test_color_on_copy(self): # The following test to make sure that a copy # was actually made of the line_color container(array). # If it isn't, both ls1 and ls2 will point at the same # data, and the change to the color affects both # line_states instead of just ls1. ls1 = self.create_ls() ls2 = ls1.copy() ls1.line_color[1] = 10 self.assertTrue(not basecore2d.line_state_equal(ls1, ls2)) def test_dash_on_copy(self): ls1 = self.create_ls() ls2 = ls1.copy() ls1.line_dash[1][0] = 10 self.assertTrue(not basecore2d.line_state_equal(ls1, ls2)) def test_cmp_for_different_length_dash_patterns(self): ls1 = self.create_ls() ls2 = ls1.copy() ls1.line_dash = (ls1.line_dash[0], array([10, 10, 10, 10])) self.assertTrue(not basecore2d.line_state_equal(ls1, ls2)) def test_cmp(self): ls1 = self.create_ls() ls2 = ls1.copy() self.assertTrue(basecore2d.line_state_equal(ls1, ls2)) #line_dash no longer allowed to be none. #def test_cmp_with_dash_as_none(self): # ls1 = self.create_ls() # ls2 = ls1.copy() # #ls1.line_dash = None # assert(not basecore2d.line_state_equal(ls1,ls2)) class GraphicsContextTestCase(unittest.TestCase): def test_create_gc(self): gc = basecore2d.GraphicsContextBase() #---------------------------------------------------------------- # Test ctm transformations #---------------------------------------------------------------- def test_get_ctm(self): gc = basecore2d.GraphicsContextBase() # default ctm should be identity matrix. desired = affine.affine_identity() actual = gc.get_ctm() self.assertTrue(alltrue(ravel(actual == desired))) def test_scale_ctm(self): gc = basecore2d.GraphicsContextBase() ident = affine.affine_identity() sx, sy = 2., 3. desired = affine.scale(ident, sx, sy) gc.scale_ctm(sx, sy) actual = gc.get_ctm() self.assertTrue(alltrue(ravel(actual == desired))) def test_rotate_ctm(self): gc = basecore2d.GraphicsContextBase() ident = affine.affine_identity() angle = 2. desired = affine.rotate(ident, angle) gc.rotate_ctm(angle) actual = gc.get_ctm() self.assertTrue(alltrue(ravel(actual == desired))) def test_translate_ctm(self): gc = basecore2d.GraphicsContextBase() ident = affine.affine_identity() x, y = 2., 3. desired = affine.translate(ident, x, y) gc.translate_ctm(x, y) actual = gc.get_ctm() self.assertTrue(alltrue(ravel(actual == desired))) def test_concat_ctm(self): gc = basecore2d.GraphicsContextBase() ident = affine.affine_identity() trans = affine.affine_from_rotation(2.) x, y = 2., 3. desired = affine.concat(ident, trans) gc.concat_ctm(trans) actual = gc.get_ctm() self.assertTrue(alltrue(ravel(actual == desired))) #------------------------------------------------------------------------- # Setting drawing state variables # # These tests also check that the value is restored correctly with # save/restore state. # # Checks are only done to see if variables are represented correctly in # the graphics state. The effects on graphics rendering for these # variables is not checked. That is all pretty much handled in the # device_update_line_state and device_update_fill_state routines which # access the state variables. # # Note: The tests peek into the state object to see if the if state # variables are set. This ain't perfect, but core2d doesn't # define accessor functions... #------------------------------------------------------------------------- def test_state_antialias(self): gc = basecore2d.GraphicsContextBase() # defaults to 1 self.assertEqual(gc.state.antialias, 1) gc.set_antialias(0) gc.save_state() gc.set_antialias(1) self.assertEqual(gc.state.antialias, 1) gc.restore_state() self.assertEqual(gc.state.antialias, 0) def test_state_line_width(self): gc = basecore2d.GraphicsContextBase() # defaults to 1 self.assertEqual(gc.state.line_state.line_width, 1) gc.set_line_width(5) gc.save_state() gc.set_line_width(10) self.assertEqual(gc.state.line_state.line_width, 10) gc.restore_state() self.assertEqual(gc.state.line_state.line_width, 5) def test_state_line_join(self): gc = basecore2d.GraphicsContextBase() # defaults to JOIN_MITER self.assertEqual(gc.state.line_state.line_join, constants.JOIN_MITER) gc.set_line_join(constants.JOIN_BEVEL) gc.save_state() gc.set_line_join(constants.JOIN_ROUND) self.assertEqual(gc.state.line_state.line_join, constants.JOIN_ROUND) gc.restore_state() self.assertEqual(gc.state.line_state.line_join, constants.JOIN_BEVEL) # set_line_join should fail if one attempts to set a bad value. self.assertRaises(ValueError, gc.set_line_join, (100,)) def test_state_miter_limit(self): gc = basecore2d.GraphicsContextBase() # defaults to 1.0 self.assertEqual(gc.state.miter_limit, 1.0) gc.set_miter_limit(2.0) gc.save_state() gc.set_miter_limit(3.0) self.assertEqual(gc.state.miter_limit, 3.0) gc.restore_state() self.assertEqual(gc.state.miter_limit, 2.0) def test_state_line_cap(self): gc = basecore2d.GraphicsContextBase() # defaults to CAP_ROUND self.assertEqual(gc.state.line_state.line_cap, constants.CAP_ROUND) gc.set_line_cap(constants.CAP_BUTT) gc.save_state() gc.set_line_cap(constants.CAP_SQUARE) self.assertEqual(gc.state.line_state.line_cap, constants.CAP_SQUARE) gc.restore_state() self.assertEqual(gc.state.line_state.line_cap, constants.CAP_BUTT) # set_line_cap should fail if one attempts to set a bad value. self.assertRaises(ValueError, gc.set_line_cap, (100,)) def test_state_line_dash(self): gc = basecore2d.GraphicsContextBase() # defaults to non-dashed line self.assertTrue(not gc.state.line_state.is_dashed()) gc.set_line_dash([1.0, 2.0], phase=2.0) gc.save_state() gc.set_line_dash([3.0, 4.0]) self.assertTrue(gc.state.line_state.is_dashed()) self.assertEqual(gc.state.line_state.line_dash[0], 0) self.assertTrue(alltrue(ravel(gc.state.line_state.line_dash[1] == array([3.0, 4.0])))) gc.restore_state() self.assertTrue(gc.state.line_state.is_dashed()) self.assertEqual(gc.state.line_state.line_dash[0], 2.0) self.assertTrue(alltrue(ravel(gc.state.line_state.line_dash[1] == array([1.0, 2.0])))) # pattern must be a container with atleast two values self.assertRaises(ValueError, gc.set_line_cap, (100,)) self.assertRaises(ValueError, gc.set_line_cap, ([100],)) # phase must be positive. self.assertRaises(ValueError, gc.set_line_cap, ([100, 200], -1)) def test_state_flatness(self): gc = basecore2d.GraphicsContextBase() # defaults to 1.0 self.assertEqual(gc.state.flatness, 1.0) gc.set_flatness(2.0) gc.save_state() gc.set_flatness(3.0) self.assertEqual(gc.state.flatness, 3.0) gc.restore_state() self.assertEqual(gc.state.flatness, 2.0) def test_state_alpha(self): gc = basecore2d.GraphicsContextBase() # defaults to 1.0 self.assertEqual(gc.state.alpha, 1.0) gc.set_alpha(0.0) gc.save_state() gc.set_alpha(0.5) self.assertEqual(gc.state.alpha, 0.5) gc.restore_state() self.assertEqual(gc.state.alpha, 0.0) def test_state_fill_color(self): gc = basecore2d.GraphicsContextBase() # defaults to [0,0,0,1] self.assertTrue(alltrue(gc.state.fill_color == array([0, 0, 0, 1]))) gc.set_fill_color((0, 1, 0, 1)) gc.save_state() gc.set_fill_color((1, 1, 1, 1)) self.assertTrue(alltrue(gc.state.fill_color == array([1, 1, 1, 1]))) gc.restore_state() self.assertTrue(alltrue(gc.state.fill_color == array([0, 1, 0, 1]))) def test_state_stroke_color(self): gc = basecore2d.GraphicsContextBase() # defaults to [0,0,0,1] self.assertTrue(alltrue(gc.state.line_state.line_color == array([0, 0, 0, 1]))) gc.set_stroke_color((0, 1, 0, 1)) gc.save_state() gc.set_stroke_color((1, 1, 1, 1)) self.assertTrue(alltrue(gc.state.line_state.line_color == array([1, 1, 1, 1]))) gc.restore_state() self.assertTrue(alltrue(gc.state.line_state.line_color == array([0, 1, 0, 1]))) def test_state_character_spacing(self): gc = basecore2d.GraphicsContextBase() # defaults to None self.assertEqual(gc.state.character_spacing, 0.0) gc.set_character_spacing(1.0) gc.save_state() gc.set_character_spacing(2.0) self.assertEqual(gc.state.character_spacing, 2.0) gc.restore_state() self.assertEqual(gc.state.character_spacing, 1.0) def test_state_text_drawing_mode(self): gc = basecore2d.GraphicsContextBase() # defaults to None self.assertEqual(gc.state.text_drawing_mode, constants.TEXT_FILL) gc.set_text_drawing_mode(constants.TEXT_OUTLINE) gc.save_state() gc.set_text_drawing_mode(constants.TEXT_CLIP) self.assertEqual(gc.state.text_drawing_mode, constants.TEXT_CLIP) gc.restore_state() self.assertEqual(gc.state.text_drawing_mode, constants.TEXT_OUTLINE) # try an unacceptable value. self.assertRaises(ValueError, gc.set_text_drawing_mode, (10,)) #------------------------------------------------------------------------- # Use context manager for saving and restoring state. #------------------------------------------------------------------------- def test_state_context_manager(self): gc = basecore2d.GraphicsContextBase() # Set an assortment of state properties. gc.set_antialias(0) gc.set_line_width(5) gc.set_fill_color((0, 1, 0, 1)) with gc: # Change the state properties. gc.set_antialias(1) self.assertEqual(gc.state.antialias, 1) gc.set_line_width(10) self.assertEqual(gc.state.line_state.line_width, 10) gc.set_fill_color((1, 1, 1, 1)) self.assertTrue(alltrue(gc.state.fill_color == array([1, 1, 1, 1]))) # Verify that we're back to the earlier settings. self.assertEqual(gc.state.antialias, 0) self.assertEqual(gc.state.line_state.line_width, 5) self.assertTrue(alltrue(gc.state.fill_color == array([0, 1, 0, 1]))) def test_state_context_manager_nested(self): gc = basecore2d.GraphicsContextBase() # Set an assortment of state properties. gc.set_antialias(0) gc.set_line_width(5) gc.set_fill_color((0, 1, 0, 1)) with gc: # Change the state properties. gc.set_antialias(1) self.assertEqual(gc.state.antialias, 1) gc.set_line_width(10) self.assertEqual(gc.state.line_state.line_width, 10) gc.set_fill_color((1, 1, 1, 1)) self.assertTrue(alltrue(gc.state.fill_color == array([1, 1, 1, 1]))) with gc: # Change the state properties. gc.set_antialias(0) self.assertEqual(gc.state.antialias, 0) gc.set_line_width(2) self.assertEqual(gc.state.line_state.line_width, 2) gc.set_fill_color((1, 1, 0, 1)) self.assertTrue(alltrue(gc.state.fill_color == array([1, 1, 0, 1]))) # Verify that we're back to the earlier settings. self.assertEqual(gc.state.antialias, 1) self.assertEqual(gc.state.line_state.line_width, 10) self.assertTrue(alltrue(gc.state.fill_color == array([1, 1, 1, 1]))) # Verify that we're back to the earlier settings. self.assertEqual(gc.state.antialias, 0) self.assertEqual(gc.state.line_state.line_width, 5) self.assertTrue(alltrue(gc.state.fill_color == array([0, 1, 0, 1]))) #------------------------------------------------------------------------- # Begin/End Page # These are implemented yet. The tests are just here to remind me that # they need to be. #------------------------------------------------------------------------- def test_begin_page(self): #just to let me know it needs implementation. gc = basecore2d.GraphicsContextBase() gc.begin_page() def test_end_page(self): #just to let me know it needs implementation. gc = basecore2d.GraphicsContextBase() gc.end_page() #------------------------------------------------------------------------- # flush/synchronize # These are implemented yet. The tests are just here to remind me that # they need to be. #------------------------------------------------------------------------- def test_synchronize(self): #just to let me know it needs implementation. gc = basecore2d.GraphicsContextBase() gc.synchronize() def test_flush(self): #just to let me know it needs implementation. gc = basecore2d.GraphicsContextBase() gc.flush() #------------------------------------------------------------------------- # save/restore state. # # Note: These test peek into the state object to see if the if state # variables are set. This ain't perfect, but core2d doesn't # define accessor functions... # # items that need to be tested: # ctm # clip region (not implemented) # line width # line join # #------------------------------------------------------------------------- def test_save_state_line_width(self): gc = basecore2d.GraphicsContextBase() gc.set_line_width(5) gc.save_state() gc.set_line_width(10) self.assertEqual(gc.state.line_state.line_width, 10) gc.restore_state() self.assertEqual(gc.state.line_state.line_width, 5) #------------------------------------------------------------------------- # Test drawing path empty #------------------------------------------------------------------------- def test_is_path_empty1(self): """ A graphics context should start with an empty path. """ gc = basecore2d.GraphicsContextBase() self.assertTrue(gc.is_path_empty()) def test_is_path_empty2(self): """ A path that has moved to a point, but still hasn't drawn anything is empty. """ gc = basecore2d.GraphicsContextBase() x, y = 1., 2. gc.move_to(x, y) self.assertTrue(gc.is_path_empty()) def test_is_path_empty3(self): """ A path that has moved to a point multiple times, but hasn't drawn anything is empty. """ gc = basecore2d.GraphicsContextBase() x, y = 1., 2. gc.move_to(x, y) # this should create another path. x, y = 1., 2.5 gc.move_to(x, y) self.assertTrue(gc.is_path_empty()) def test_is_path_empty4(self): """ We've added a line, so the path is no longer empty. """ gc = basecore2d.GraphicsContextBase() x, y = 1., 2. gc.move_to(x, y) gc.line_to(x, y) self.assertTrue(not gc.is_path_empty()) #------------------------------------------------------------------------- # Test drawing path add line # # Testing needed! #------------------------------------------------------------------------- def test_add_line(self): """ """ pass ################################################## if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/tests/agg/0000755000175000017500000000000013544357631017542 5ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/tests/agg/test_arc.py0000644000175000017500000000642013421603267021713 0ustar varunvarunimport os import unittest from math import pi import numpy from kiva import agg def save_path(filename): return filename def draw_arcs(gc, x2, y2, radiusstep=25.0): gc.set_stroke_color((0.2,0.2,0.2)) # lightgray gc.move_to(0, 0) gc.line_to(100, 0) gc.line_to(x2, y2) gc.stroke_path() gc.set_stroke_color((0,0,0)) for i in range(7): gc.move_to(0, 0); gc.arc_to(100, 0, x2, y2, i*radiusstep+20.0) gc.stroke_path() class TestAffineMatrix(unittest.TestCase): def test_arc_to(self): gc = agg.GraphicsContextArray((640,480), "rgba32") axes = agg.CompiledPath() axes.move_to(0.5, 50.5) axes.line_to(100.5, 50.5) axes.move_to(50.5, 0.5) axes.line_to(50.5, 100.5) box = agg.CompiledPath() box.move_to(0.5, 0.5) box.line_to(100.5, 0.5) box.line_to(100.5, 100.5) box.line_to(0.5, 100.5) box.close_path() arc = agg.CompiledPath() arc.move_to(10, 10) arc.line_to(20, 10) arc.arc_to(40, 10, 40, 30, 20.0) arc.line_to(40, 40) whole_shebang = agg.CompiledPath() whole_shebang.save_ctm() whole_shebang.add_path(axes) whole_shebang.add_path(box) whole_shebang.translate_ctm(0.0, 50.5) whole_shebang.add_path(arc) whole_shebang.translate_ctm(50.5, 50.5) whole_shebang.rotate_ctm(-agg.pi/2) whole_shebang.add_path(arc) whole_shebang.rotate_ctm(agg.pi/2) whole_shebang.translate_ctm(50.5, -50.5) whole_shebang.rotate_ctm(-agg.pi) whole_shebang.add_path(arc) whole_shebang.rotate_ctm(agg.pi) whole_shebang.translate_ctm(-50.5, -50.5) whole_shebang.rotate_ctm(-3*agg.pi/2) whole_shebang.add_path(arc) whole_shebang.restore_ctm() gc.set_stroke_color((1.0,0.0,0.0)) gc.set_line_width(1.0) ctm1 = gc.get_ctm() gc.translate_ctm(50.5, 300.5) gc.add_path(whole_shebang) gc.stroke_path() gc.translate_ctm(130.5, 50.0) ctm2 = gc.get_ctm() gc.rotate_ctm(-agg.pi/6) gc.add_path(whole_shebang) gc.set_stroke_color((0.0,0.0,1.0)) gc.stroke_path() gc.set_ctm(ctm2) gc.translate_ctm(130.5, 0.0) ctm2 = gc.get_ctm() gc.rotate_ctm(-agg.pi/3) gc.scale_ctm(1.0, 2.0) gc.add_path(whole_shebang) gc.stroke_path() gc.set_ctm(ctm1) ctm1 = gc.get_ctm() gc.translate_ctm(150.5, 20.5) draw_arcs(gc, 70.5, 96.5) gc.translate_ctm(300.5, 0) draw_arcs(gc, 160.5, 76.5, 50.0) gc.set_ctm(ctm1) gc.translate_ctm(120.5, 100.5) gc.scale_ctm(-1.0, 1.0) draw_arcs(gc, 70.5, 96.5) gc.translate_ctm(-300.5, 100.5) gc.scale_ctm(0.75, -1.0) draw_arcs(gc, 160.5, 76.5, 50.0) gc.save(save_path("arc_to.png")) def test_arc(self): gc = agg.GraphicsContextArray((640,648)) gc.save(save_path("arc.png")) def test_skewing_matrix(self): val = agg.skewing_matrix(pi/4.,pi/4.) desired = numpy.array([ 1.0,1.0,1.0,1.0,0.0,0.0]) actual = val.asarray() assert(numpy.allclose(desired,actual)) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/tests/agg/clean.py0000755000175000017500000000030313421603267021166 0ustar varunvarun#!/usr/bin/env python import os, glob for ext in ('bmp', 'png', 'jpg'): for pic in glob.glob('*.'+ext): if pic.startswith('doubleprom'): continue os.unlink(pic) enthought-chaco2-4.8.1.orig/kiva/tests/agg/test_image3.py0000644000175000017500000001373413421603267022321 0ustar varunvarunfrom __future__ import print_function import os import time from math import pi from kiva import agg from kiva.fonttools import Font ArialFont = Font('arial') def save_path(filename): return filename def draw_text(gc, text, bbox, text_color, bbox_color): gc.set_stroke_color(bbox_color) gc.rect(bbox[0],bbox[1],bbox[2],bbox[3]) gc.stroke_path() gc.set_fill_color(text_color) gc.show_text(text) def main(): bbox_color = [1.0,0.0,0.0] text_color = [0.0,0.0,1.0,.5] text = "hello" tot1 = time.clock() t1 = time.clock() gc=agg.GraphicsContextArray((800,800)) gc.set_font(ArialFont) gc.set_alpha(1.0) bbox = gc.get_text_extent(text) draw_text(gc,text,bbox,text_color,bbox_color) t2 = time.clock() print('1st:', t2-t1) t1 = time.clock() with gc: gc.translate_ctm(50,50) gc.rotate_ctm(pi/4) draw_text(gc,text,bbox,text_color,bbox_color) t2 = time.clock() print('2nd:', t2-t1) t1 = time.clock() with gc: gc.translate_ctm(100,100) gc.scale_ctm(4.0,2.0) draw_text(gc,text,bbox,text_color,bbox_color) t2 = time.clock() print('3rd:', t2-t1) t1 = time.clock() with gc: gc.translate_ctm(200,200) gc.scale_ctm(4.0,2.0) gc.rotate_ctm(pi/4) draw_text(gc,text,bbox,text_color,bbox_color) t2 = time.clock() print('4th:', t2-t1) print('tot:', time.clock() - tot1) gc.save(save_path('text2.bmp')) import random import string alpha = list(string.ascii_letters) + list('012345679') N =100 strs = [] for i in range(N): random.shuffle(alpha) strs.append(''.join(alpha)) print('starting:') t1 = time.clock() for s in strs: gc.show_text(s) t2 = time.clock() print() print('1. %d different 62 letter strings(total,per string):' % N) print(' %f %f' % (t2-t1,((t2-t1)/N))) t1 = time.clock() for i in range(N/10): for s in strs[:10]: gc.show_text(s) t2 = time.clock() print('2. 10 strings with 62 letter rendered %d times (total,per str):' % N) print(' %f %f' % (t2-t1,((t2-t1)/N))) print("Version 2. above is common in graphs and should be about 10 ") print("times faster than the first because of caching") print() gc.save(save_path('text2.bmp')) def main2(): from PIL import Image pil_img = Image.open('doubleprom_soho_full.jpg') img = fromstring(pil_img.tostring(),UInt8) img = img.resize((pil_img.size[1],pil_img.size[0],3)) alpha = ones(pil_img.size,UInt8) * 255 img = concatenate((img[:,:,::-1],alpha[:,:,NewAxis]),-1).copy() print('typecode:', typecode(img) , iscontiguous(img)) print(shape(img)) gc=agg.GraphicsContextArray((1000,1000)) gc.draw_image(img) print(pil_img.getpixel((300,300)), img[300,300], gc.bmp_array[300,300]) gc.save('sun.bmp') def main3(): from PIL import Image pil_img = Image.open('doubleprom_soho_full.jpg') img = fromstring(pil_img.tostring(),UInt8) img = img.resize((pil_img.size[1],pil_img.size[0],3)) alpha = ones(pil_img.size,UInt8) * 255 img = concatenate((img[:,:,::-1],alpha[:,:,NewAxis]),-1).copy() print('typecode:', typecode(img) , iscontiguous(img)) print(shape(img)) agg_img = agg.Image(img,"bgra32", interpolation_scheme="simple") gc=agg.GraphicsContextArray((760,760)) N = 100 gc.show_text("SUN") t1 = time.clock() for i in range(N): with gc: #gc.rotate_ctm(.2) gc.set_alpha(1.0) gc.draw_image(agg_img) #print pil_img.getpixel((300,300)), img[300,300], gc.bmp_array[300,300] gc.translate_ctm(150,300) gc.scale_ctm(10,10) gc.set_fill_color((0.0,0,1.0,.25)) #gc.show_text("SUN") t2 = time.clock() print("images per second: %g" % (N/(t2-t1))) gc.save('sun3.bmp') def main4(): """ Test drawing an rgb24 into a bgra32""" from PIL import Image pil_img = Image.open('doubleprom_soho_full.jpg') img = fromstring(pil_img.tostring(),UInt8) img = img.resize((pil_img.size[1],pil_img.size[0],3)) print('typecode:', typecode(img) , iscontiguous(img)) print(shape(img)) agg_img = agg.Image(img,"rgb24", interpolation_scheme="simple") gc=agg.GraphicsContextArray((1000,1000)) N = 1 t1 = time.clock() for i in range(N): with gc: #gc.rotate_ctm(.2) #gc.set_alpha(0.5) gc.draw_image(agg_img) #print pil_img.getpixel((300,300)), img[300,300], gc.bmp_array[300,300] gc.translate_ctm(150,300) gc.scale_ctm(10,10) gc.set_fill_color((0.0,0,1.0,.5)) #gc.show_text("SUN") t2 = time.clock() print("images per second: %g" % (N/(t2-t1))) gc.save('sun2.bmp') def main5(gc): bbox_color = [1.0,0.0,0.0] text_color = [0.0,0.0,1.0,1.0] text = "hello" tot1 = time.clock() t1 = time.clock() gc.set_alpha(1.0) bbox = gc.get_text_extent(text) draw_text(gc,text,bbox,text_color,bbox_color) t2 = time.clock() print('1st:', t2-t1) import random import string strs = ['012345679', 'abcdefghi', 'jklmnopqr', 'stuvwxyzA', 'BCDEFGHIJ', 'KLMNOPQRS', 'TUVWXYZ!@', '#$%^&*()-', '=+{[}]|\:', '<,>.?/~`"'] N =100 t1 = time.clock() for i in range(N): for s in strs: #gc.translate_ctm(0,14) gc.show_text(s) t2 = time.clock() print() print(' %d strings(total,per string):' % (N*10)) print(' %f %f' % (t2-t1,((t2-t1)/(N*10)))) gc.save('text2.bmp') if __name__ == '__main__': import profile gc=agg.GraphicsContextArray((800,800)) #profile.run('main()') #main5(gc) #main5(gc) #main5(gc) #profile.run('main5(gc)') #main() #main2() #main3() #main4() main() #main2(gc) #main4(gc) #main5(gc) enthought-chaco2-4.8.1.orig/kiva/tests/agg/test_draw_dash.py0000644000175000017500000000172513421603267023105 0ustar varunvarunimport unittest from kiva import agg from kiva.compat import pilfromstring def save(img, file_name): """ This only saves the rgb channels of the image """ format = img.format() if format == "bgra32": size = (img.bmp_array.shape[1], img.bmp_array.shape[0]) bgr = img.bmp_array[:, :, :3] rgb = bgr[:, :, ::-1].copy() st = rgb.tostring() pil_img = pilfromstring("RGB", size, st) pil_img.save(file_name) else: raise NotImplementedError("currently only supports writing out " "bgra32 images") class TestDrawDash(unittest.TestCase): def test_dash(self): gc = agg.GraphicsContextArray((100, 100)) gc.set_line_dash([2, 2]) for i in range(10): gc.move_to(0, 0) gc.line_to(0, 100) gc.stroke_path() gc.translate_ctm(10, 0) save(gc, 'dash.bmp') if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/tests/agg/__init__.py0000644000175000017500000000000013233644505021633 0ustar varunvarunenthought-chaco2-4.8.1.orig/kiva/tests/agg/image_test_case.py0000644000175000017500000001755713477706655023260 0ustar varunvarunfrom __future__ import print_function from timeit import Timer import os, sys import unittest import six from PIL import Image from numpy import alltrue, array, concatenate, dtype, frombuffer, newaxis, \ pi, ravel, ones, zeros from kiva import agg from kiva.fonttools import Font from kiva.compat import pilfromstring, piltostring # alpha blending is approximate in agg, so we allow some "slop" between # desired and actual results, allow channel differences of to 2. slop_allowed = 2 UInt8 = dtype('uint8') Int32 = dtype('int32') def save(img, file_name): """ This only saves the rgb channels of the image """ format = img.format() if format == "bgra32": size = (img.bmp_array.shape[1], img.bmp_array.shape[0]) bgr = img.bmp_array[:, :, :3] rgb = bgr[:, :, ::-1].copy() st = rgb.tostring() pil_img = pilfromstring("RGB", size, st) pil_img.save(file_name) else: raise NotImplementedError( "currently only supports writing out bgra32 images") def test_name(): f = sys._getframe() class_name = f.f_back.f_locals['self'].__class__.__name__.replace('test_','') method_name = f.f_back.f_code.co_name.replace('check_','') # !! make sure we delete f or the their are memory leaks that # !! result (gc's passed to save are not released) del f return '.'.join((class_name,method_name)) def sun(interpolation_scheme="simple"): path = os.path.join(os.path.dirname(__file__), 'doubleprom_soho_full.jpg') pil_img = Image.open(path) img = frombuffer(piltostring(pil_img), UInt8) img.resize((pil_img.size[1],pil_img.size[0],3)) alpha = ones(pil_img.size,UInt8) * 255 img = concatenate((img[:,:,::-1],alpha[:,:,newaxis]),-1).copy() return agg.GraphicsContextArray(img,"bgra32", interpolation_scheme) def solid_bgra32(size,value = 0.0, alpha=1.0): img_array = zeros((size[1],size[0],4),UInt8) img_array[:,:,:-1] = array(value * 255,UInt8) img_array[:,:,-1] = array(alpha * 255,UInt8) return img_array def alpha_blend(src1,src2,alpha=1.0,ambient_alpha = 1.0): alpha_ary = src2[:,:,3]/255. * alpha * ambient_alpha res = src1[:,:,:] * (1-alpha_ary) + src2[:,:,:] * alpha_ary # alpha blending preserves the alpha mask channel of the destination (src1) res[:,:,-1] = src1[:,:,-1] return res.astype(Int32) def assert_equal(desired,actual): """ Only use for small arrays. """ try: assert alltrue (ravel(actual) == ravel(desired)) except AssertionError: size = sum(array(desired.shape)) if size < 10: diff = abs(ravel(actual.astype(Int32)) - ravel(desired.astype(Int32))) msg = '\n' msg+= 'desired: %s\n' % ravel(desired) msg+= 'actual: %s\n' % ravel(actual) msg+= 'abs diff: %s\n' % diff else: msg = "size: %d. To large to display" % size raise AssertionError(msg) def assert_close(desired,actual,diff_allowed=2): """ Only use for small arrays. """ try: # cast up so math doesn't underflow diff = abs(ravel(actual.astype(Int32)) - ravel(desired.astype(Int32))) assert alltrue(diff <= diff_allowed) except AssertionError: size = sum(array(desired.shape)) if size < 10: msg = '\n' msg+= 'desired: %s\n' % ravel(desired) msg+= 'actual: %s\n' % ravel(actual) msg+= 'abs diff: %s\n' % diff else: msg = "size: %d. To large to display" % size raise AssertionError(msg) #---------------------------------------------------------------------------- # Tests speed of various interpolation schemes # #---------------------------------------------------------------------------- class test_text_image(unittest.TestCase): def test_antialias(self): gc = agg.GraphicsContextArray((200,50),pix_format = "bgra32") gc.set_antialias(1) f = Font('modern') gc.set_font(f) gc.show_text("hello") save(gc,test_name()+'.bmp') def test_no_antialias(self): gc = agg.GraphicsContextArray((200,50),pix_format = "bgra32") f = Font('modern') gc.set_font(f) gc.set_antialias(0) gc.show_text("hello") save(gc,test_name()+'.bmp') def test_rotate(self): text = "hello" gc = agg.GraphicsContextArray((150,150),pix_format = "bgra32") f = Font('modern') gc.set_font(f) tx,ty,sx,sy = bbox = gc.get_text_extent(text) gc.translate_ctm(25,25) gc.rotate_ctm(pi/2.) gc.translate_ctm(0,-sy) #gc.show_text(text) gc.set_stroke_color([1,0,0]) gc.set_fill_color([.5,.5,.5]) gc.rect(tx,ty,sx,sy) gc.stroke_path() gc.show_text(text) save(gc,test_name()+'.bmp') class test_sun(unittest.TestCase): def generic_sun(self,scheme): img = sun(scheme) sz = array((img.width(),img.height())) scaled_sz = sz * .3 scaled_rect=(0,0,scaled_sz[0],scaled_sz[1]) gc = agg.GraphicsContextArray(tuple(scaled_sz),pix_format = "bgra32") gc.draw_image(img,scaled_rect) return gc def test_simple(self): gc = self.generic_sun("nearest") save(gc,test_name()+'.bmp') def test_bilinear(self): gc = self.generic_sun("bilinear") save(gc,test_name()+'.bmp') def test_bicubic(self): gc = self.generic_sun("bicubic") save(gc,test_name()+'.bmp') def test_spline16(self): gc = self.generic_sun("spline16") save(gc,test_name()+'.bmp') def test_spline36(self): gc = self.generic_sun("spline36") save(gc,test_name()+'.bmp') def test_sinc64(self): gc = self.generic_sun("sinc64") save(gc,test_name()+'.bmp') def test_sinc144(self): gc = self.generic_sun("sinc144") save(gc,test_name()+'.bmp') def test_sinc256(self): gc = self.generic_sun("sinc256") save(gc,test_name()+'.bmp') def test_blackman100(self): gc = self.generic_sun("blackman100") save(gc,test_name()+'.bmp') def test_blackman256(self): gc = self.generic_sun("blackman256") save(gc,test_name()+'.bmp') def bench(stmt='pass', setup='pass', repeat=5, adjust_runs=True): """ BenchMark the function. """ timer = Timer(stmt, setup) if adjust_runs: for i in range(100): number = 10**i time = timer.timeit(number) if time > 0.2: break else: number = 1 times = [timer.timeit(number) for i in range(repeat)] message = '{} calls, best of {} repeats: {:f} sec per call' return message.format(number, repeat, min(times)/number) #---------------------------------------------------------------------------- # Tests speed of various interpolation schemes # # #---------------------------------------------------------------------------- class test_interpolation_image(unittest.TestCase): size = (1000,1000) color = 0.0 def generic_timing(self,scheme,size): gc = agg.GraphicsContextArray(size,pix_format = "bgra32") desired = solid_bgra32(size,self.color) img = agg.GraphicsContextArray(desired, pix_format="bgra32", interpolation=scheme) print( "{!r} interpolation, ".format(scheme), bench(lambda: gc.draw_image(img))) def test_simple_timing(self): scheme = "nearest" self.generic_timing(scheme,self.size) def test_bilinear_timing(self): scheme = "bilinear" self.generic_timing(scheme,self.size) def test_bicubic_timing(self): scheme = "bicubic" self.generic_timing(scheme,self.size) def test_sinc144_timing(self): scheme = "sinc144" self.generic_timing(scheme,self.size) if __name__ == "__main__": unittest.main() enthought-chaco2-4.8.1.orig/kiva/tests/agg/test_text.py0000644000175000017500000000274113477706655022154 0ustar varunvarunfrom contextlib import contextmanager import locale import unittest from kiva import agg from kiva.fonttools import Font @contextmanager def locale_context(category, new=None): """ Temporarily set the locale. """ old = locale.getlocale(category) try: locale.setlocale(category, new) except locale.Error as e: raise unittest.SkipTest(str(e)) try: yield finally: locale.setlocale(category, old) class TestText(unittest.TestCase): def test_locale_independence(self): # Ensure that >ASCII Unicode text is decoded correctly regardless of # the locale. text = u'\N{GREEK SMALL LETTER MU}' with locale_context(locale.LC_CTYPE, ('en', 'UTF-8')): gc = agg.GraphicsContextArray((200, 200)) f = Font('modern') with gc: gc.set_font(f) gc.translate_ctm(50, 50) tx0, _, _, _ = gc.get_text_extent(text) gc.show_text(text) x0, _ = gc.get_text_position() with locale_context(locale.LC_CTYPE, ('en', 'ASCII')): gc = agg.GraphicsContextArray((200, 200)) f = Font('modern') with gc: gc.set_font(f) gc.translate_ctm(50, 50) tx1, _, _, _ = gc.get_text_extent(text) gc.show_text(text) x1, _ = gc.get_text_position() self.assertEqual(tx1, tx0) self.assertEqual(x1, x0) enthought-chaco2-4.8.1.orig/kiva/tests/agg/README.txt0000644000175000017500000000014113233644505021226 0ustar varunvarun NOTE: The tests in this folder write image files into this directory for visual inspection. enthought-chaco2-4.8.1.orig/kiva/tests/agg/doubleprom_soho_full.jpg0000644000175000017500000022525713233644505024475 0ustar varunvarun ╪ рJFIF ■HCREATOR: XV Version 3.10a Rev: 12/29/94 Quality = 75, Smoothing = 0  █C    $.' ",#(7),01444'9=82<.342 █C  2!!22222222222222222222222222222222222222222222222222 └щщ" ─  ─╡}!1AQa"q2БСб#B▒┴R╤Ё$3brВ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzГДЕЖЗИЙКТУФХЦЧШЩЪвгдежзийк▓│┤╡╢╖╕╣║┬├─┼╞╟╚╔╩╥╙╘╒╓╫╪┘┌стуфхцчшщъёЄєЇїЎў°∙· ─  ─╡w!1AQaq"2БBСб▒┴ #3RЁbr╤ $4с%ё&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzВГДЕЖЗИЙКТУФХЦЧШЩЪвгдежзийк▓│┤╡╢╖╕╣║┬├─┼╞╟╚╔╩╥╙╘╒╓╫╪┘┌туфхцчшщъЄєЇїЎў°∙· ┌ ?Ё,rp(a═┼.x▐д╥└z{╥ФК3╟ ╪1ЮbЧ<Їг┐^ФР`RуЬR чпj:tаaП╥В9эJ>ЁтФ╥ДЪщїЇауёаvЫїэKО┘┼Пj1ыAVO╩В2z┬БэыNыПJ╕▄Їт╝╤╨· ^1яHдРГФcїеЮ}qA═a0 ╬)G╙гСG~;ЎдRBcПЁеJ"ЦБ╪LqG|ёJ:c8ўг╜aд{Rу╩ФЁ:╤БК. ┐сK┤QА)z■КI<╤╖┌ЦЧ█4d&▀╬УqKяF8а,&:╤∙R·ГGnФГП╓В>ФвМR Їд█╟Єзvд╟┬┬cСA╥ўгЇ ├qУяKАsыKыGz┬цРї9сК mу╥УЄзc╓Р■Э(Д╟=( g╡.1█н/z.+ ┌РО╘ь·QОh ╖ОФШэN4ВБ4tд╟н/╥РiГ@F)0 /J;¤h%б╗xе┼╤╥БYF╜RС╧ZL·йЙа╟#`°╨~Эй;d╨!00sО(└╙ш)HгёжMЖуГ╟n╘ЗЮФяNi3∙тВl!Q╘уДsN9эK├d¤iЕУО)pає@`╨MЖрQБОФгз jbА(╚╞1K╟ZN╘J_JLqЪS@ДвК)ИJ\QI@Q@ВК(аК(аЧw╔╖оsОi(аi╪(вКQE8qKКSъi*Ml)╟хFЧ╥Мё№иБОШгgЬўе 8аO°╤╙ЬRdО▄╙║ч∙╥пjS╟ZG╥ФфЎад┤╖J\gеу=9№шаi3╟їе┴┼е/╥Р╥C@╧е8)аЮ┐Е(щE╩H@2=ш┼(рК^╣дRC@щN F?*ZCQїыJ№izP(*┬`у╫еч┌ЦЧ├зc"ФtcУJрв&L╤Оi╪ўгQr╣FуЪ\Rўа╨E.09аzwJE%а▄tгвЦА▓╖євЬz1E╟╩&3HE:МqЪ├qF8з 1E├Фn▄╥cн?е%(▄F)▌ищ@м7bЭяAа,Ж╤КZZaaШаОi╘u4 ┬bУ√S▒HE`╞i1эNдаV`qI╥ЭКJ╨ШЇдз╥wзqrН╞zЇгoQN└┼\9D*)╕¤)№RcМQq8ЙБ╫╙x┼?┌Ун144О;Rc╙уы▐Мr(%бЫp(┼;оi)Сa1БHG^i╠rry4З┐=hHnЇе╟єе#╕рzI┌Щ6░Аtшxд╟╕у╖bЩ6№из╙4Ф Й╫╜тГA═2D#ыE.x┼P!(┼Sgх╞^┤ФQ@Q@ВК(аК(аК(аК(аЪ;√╥ртО IнГ╕═Т(а╓БК8ю(О╘gз╡{╥АЮiqТ(чпчNpз*:bВТ╨N¤ёA_C°╥dnед5aHъs═z╤▐Б═ @mЧЬ╥рЪW)!е┼Яе(дRBcУK╖4cГ═.(╣I МsЮЇgе·╥-$╔гRЎвСVRБ╘Q°RОФ !1KКQ═.:╥)!╗h█┼8QE╞вЖэг╘ъ\QpхCB╥тК\P4Жэе┼ед КцЬ)q┼+Фf(┼;ШвтхcКu\vК1O└д"ЛГИ╠ 1┼<КCE┼╩4-!ЯIКw'ХРК}!ы@8б╗h"ЭA\9FуК1═;К:╤pхБHE?ШвтqКL ~8д█Nф╕Н█F?bЛЗ(▄RbЯ┌МsE╟╩3ФЄ)(╣.#q┼&)ЇШжKCHЇд█OэIE╔qC ╥S═6Э╔qЫК}'╡2М Zu3ыLЦм!ыF8е4ЗСLЖДъ)8щ╙∙╙▓╓Ы╨ЎаЦ'знqJyг┐¤йТ7RЬє¤))Уa)hд <╨ г╜и4JZJ^┤└J)i(QEvвК(вК(Lg·QГJIїаЮjMмД╟╜/@?:P1═ д; Г∙╨╬БKК H1═4 ZE$ГoZR9ыE-$4G4 ZE$&:gЮ)vўыKК\ E(Й╖4а}(эJе"ТФю╝ A╥Ч=8дZКv)Їеи)!1щN┼вСI!1┼.(яjE$&(┼;МQr╘D K╖КQNеrФP╠Q╢ЭК\R╕∙Fmгm?bЛПРf▐(█К~(┼AаRтЦЦЛНDn▐(█Ъ~(┼+Х╚F)зbМS╕╣FЕтВ╡ PE+ПУB28жС┼HE!юKИ└("ЭК\QryFmгm>ТЭ├Ф`═< 1╬h╕╣Fmгm?cЪ.Г1HEIКLd╤q8 █┼&*@)1═ ▌┤зуК1E├Рa▄T┤Швтp#┼qRM"Э╔q┤Q╢ЯIE╔qCжтдэIКw!─aШзЪn)Рт4О)1O┼&)Т╨╥)дfЮE&9жЩ#┼!Ў═!╚qFiS∙ "ОЮ┤юG(┬1▐У8зbУ{ЎжKCH┼зjS╫н%2ЇтРО╜йzёК(&┬bТФ√PiЙЙE(ы°Pp(Ж╤Ji)И(едаК;╤@ВК(а ▒╔┼&0h▌ЮisPth─>╘bЧыFxае╟бдаE!E(ВЭAhLSЕ╕дZ@4╕дяNдZB═.){P)Рvе╞EщiРАRтБ╓ЭHдДЧ╤┌ФPRHLbФ ╤█ЪQ╥СI КpN┼+Фв RБ@╕Н┤╕ее╥-D@)v╥БN┼M═Fэд█RА(+E╩ЎzэгmIГF)\~╠Лo╗jLRзq{1аRэтЮ(оZБ╩M╡6┌B┤о7LМ-.▐)рRтЛН@Дн4КЬпZc iЩ╬ЭИ┬╥mцд┼зr9mд+Rэд"ЛН╙#█F▐jLPWЪ./fG╢Н╝╘Ыi ╙╕╜Ш═┤mцд┼i\~╠f┌6╘АQ╖Ъ.?fG▓МTЕxд┼ эгm?RcЪw%└a^)╕йд┼;Рт3o▄TД~tШзrFmжтд"ЫКw3q╢Уд#н7зrFcОi1Ъ~8═╬Э╚qG▄d╙╚эF1Nф8Су4ЕG_ZРО:fУ╘S╣.#тЪсO= !╠┌#╟nЇ╔ч∙╙╚8Їд4юCИ┬дZiыO9ыЪC╓ЩЫCqюi1ы╓ФО╘:fиЖЖЪLfФО?┬ОЬ╨H╙Jh=s═)Т'z J(RR╥SдТry>┤ФQ@Q@ЙpEнZцашBўг┤P; ЇзRR╥)!└RтТФR4BтФ A╓Ь)3Hб1═;wедZBc"ЬаtеЛIM8 )iРФ╕вЦСI К\RОФге"╥╕е┤оZИАR╤N╥-!зтРSЕ&═"Г╘╗xеЧ74Q pZQNеsX─@)█i@зR┘┤`3m.┌Р/╗xй╣вжE▓РеO╢В┤s╪Рзmте█N Ъ9З$;xаеO│╡(C╓Ч1~─оФ%X0▓cp#<К┘▄"╢╙Жш}isбк%BЬS8нQзN╚HCLЫL╕МБхТ ╞EJн┌тХ/e.╩╙m.pамdТi[H╗@д─p▌═?mф}YЩЫ8д1╓кщw░c8їз6Нp ╣еэс▄ocьаз5н¤Сt─эИЪБь&^иsщTлEї%сЩЯ│ЪpП-V:йтзВ╤▌╛ю\╙uсюQt∙╕жьлE2╟КhП╜5 t.╚vRlцмжХцО`tH ╙vєSХ═&╠Sц3tИvSJ╒В┤┬╕ждDйжэ┼LG╥8к╣УжDVЫКФГM┼RfRБi6╘ДRbЭ╠▄ЎёM┌*b)╗i▄Ч2╝RйжСNцn$dq╥УЄ);U\╔─f8┼4АjJm37ДR_хN╟хIКfm #▐РМКy┤ШуD40О}йЇЮzqКiжМфИ╚Ўу▐ВsКy╞▐╝КkSL═─iЯ╜&3K╫╤Рп╡3;!зЇа¤0sJO╙кжBBїУь)К╫vC(╟4;ёL╠J)i(вК)ИJ(вБN┼!<╥Г═fu+ KО(а H\ \RRтСI КP(вСi ┼(wедZBБKК&ЦСкH1Ъ\QNй-!)q┼сH┤ЖуКP)╪евхиНьQК\EиЙМS▒KКZЫЦв7ьRтЧоZИ╨8зБ@Ё)6kАZ]┤аqO┼E═╘ЕзеЪx^FzRl╓0.i█iB╙┬╘6tFB╙╒ HйУМ~r;|Ю∙·VrЭНФ)ИI╟/┘XВkR д@╦░╟\[vЪ╔ 4 ╗R>SЮkЦж.0▌ПDrKd─fп[h╥MЭк~юA5╪╟еZ─А`│2MYБ Z=кl╫є╫║9X|8edgr9К╙Л┴ё▄╬G┴оАЙчylqКч`~Ў1ы┌╣'Мн-ЭИr}}ЇHl(H╟SV!╥с┬АЛА8╚т┤%Пq!$qЯZм█Fтг?НKп&╡e\А┘F░#\p1Tд▓Фо[h╞zVМЁ╢┬ЮbМП└U'┤╕eK└╟JpЫ▐рК3"вХ▒╬8UYц- ЧОwїй&ШpТO5┘H&5Л,▌═tFдFTKМAНзБ┼>=╗вv▄O+ОХ,╓rD\фv└рЖKvf<їшzU'░Ц7dє8<ёМ╒I№╫ЧqНFзZСdtu |c╡]IP╣Yну,ф┘ КЛ╕╗╪ Kg С1лу▓X├&хь ╬GVЬ▒1B7nфm9лLЙЭА╖8ъ:╓n╝У Ь└ЁьR╣|э┌л╧сЦW┬Ь╙&╗|а√U$ПdО <─B█╨и√вЪ╞╒Л▄\╟6Бq Ю7}+:k7ЛирЇпSЄJж<а┘╡F}>7Ф$╨Е└╚ї╜<╩_iТgЪ∙░═3╦╔8пDЫ├░┐╠╕ є═b▀°vH╝╞D Ю~^╒╫ONn┴ю│УhёQьнYь^5ХФz╥й┤ ╣т╗cQ2eM2бOji^*╔CL)эZ)JС\п▌Ь░SКf┌е#R ┌г`йЎЎжХкц3tИJёM"ж"ШG4╙2ФКёM TдSцй3 DМБHzc4Є8жтй3ДSHй1┼4МU&e(М bЫПе<О)к╣ЫИ┬=:RЪqд=)Щ44О°ДsN▌Е#й╕ЇжCHaєКЇзqКiти═л dqH@< *qд└жd╨Ш╔╟Zoу╞;SП▐эH▀чКd1зУI№й▄RqLЖДгК)Т└╥R╥─вЦТЩ%МRтМQYЭ╢Ф╕уееСHLSАаRтСI;Ф╜)РаSВ╥ pдiА \Q▐ЭRhРФр;╨)╘оkЙКQKKH┤АRтА1N┼M═cе┼(р┤оZИ▄RБO╞h┼+Ъ( ┼(ьSАеr╘FБOХEQўz╥г┌╟6тqяКж┌Тя8М`vы\╩-ьД2ъс▀ Ш╔╤Ыj╩x■╩Xо[√╟╓аKп┤н╤╫└ио%fЛ,Fr0╜Ek╦u╦a┌цГ_Eчк╚8╔ ╥Лйэ╤Ф*H√╕6═`Ei4∙bШ╟ўП5гR#▐О}hХ(╟f.Rъ^7Ц|Ш+М ▄■57┌ЮAK.┼oсN╣Ї═Q│%╠└Юрч∙╙uюО.╪┴рgЮ;╘r'+ ┼\╥3┴ц√1.G▐зMs▓яn┴╦ЯJ┬ЗQTщ З╧JIя>╨ЮaЙ▀╤Oz╙Ў·З"6wBg▀o╣р■щэ╘А╚З?ьЬV^Эz╔/ЦLБ?╗Аj{Л╡У$РкглT:rR░Y▄zР┼DЛУ╗°Е,╢A└}╪P?J|"&Лtb7 ё▄╘щ═╦И╢э╧▌ `\═=╗щlKoV vї┼5эуС▒(p╞G5еЫ┬╠$l┐OaUюИ╖P╠╪oL#Tк7+!й'▒ 0F8█╫Х%РО╪yrН╥ЬЬcn4HcX╔ъM6XaСШрч╣П=╫+╪ЫЇЎq.BЙ\aO\{R$ЦнПc╝ЭTчЭG4)=┐Ц▒░\c{7J╠Т▐+kн▒╬эЮIлДTЦ·ВJ╓'╣kЦ╣hэ╢"уцP2OуRоЭ:Dо% СТ╛╡-е│Фєs╔■▌)фLn0#╧√GЪэюоГ┐bЬЖteэiЬdVВjИ,МPe╔∙YN;╒{У, ┐╦ └ ╫5NR.д хсИэ╪╒$д╡-═eezHX┌3ОззчTе▒HЛy{ЫВЯ╩о┌YTмUЦ─╖яmuЙGФУpЖл═,khРБ╫Ц фbи∙$ВS ╚Ц>╒dи╣ЙV╤╣^rq▀?Х_"V╫Aеea-$ТJYI╜[В╝▓╫ f)be'°xе╥Їє╣ЭZ6фw№к{Ц+!Н▄HМxчУQ9E╬╦Q]^├эїPЬ1┌V╞*46_iYДЫЗV╣ж┼зЖ╬и╧▌nj┤6&R√TзУRФ5│гнНИявW▄ДЁx5х└ТQ3█/<Жнe+╡й*FFzg∙Uиgy МйфМ╘║|╗l.DЭ╞╝╠\2иЛ▐тмC<С(fД▌vЪ═╛??.┴q╘z╥ ╣L>^ЇtcZ:~О╥gy фPK'Э╡И kЪe┼╚yдНВ(чоCж}Ю)BБВч'·UgGXа╚Ф∙н┴И+ЫОHКО│ЄОЮ┘4╓═▄h▒sь┌╬_Ч<Кп4)h═72╔¤у╚кю∙@▐щ╣╪╙.уy-ЩМGз 51Уц╫и[▄ЧГh9ш3╘╘h╕b╚d:?╧╡WИ%гцq╗╢j▓Нm(fЄ$dш╛ХлКNЎ'YЪ ф)їк->┘└OЪSБ╕eЕYЪ╔.$▀QБ╜▒°TVV╫2З╩95qqQ╜╞iFEЬFYn7nQ┬їщM]bdСfpr╝ЪЕ┤└mЭ▐p▓└'╖╡PЕ%Ю∙!Ф┐У¤юХД%vї&╔юhъИ╤ЫГ▓чпЇмэ/Q +G+&ц┴ ├Хн[Э-Д,`aМ}yмCg:░RЫ╬{┼]/g(8НZ╞щ╛UМ╩g3▐бЛV]Нф─ЄС№Xр}Ma▌C*&┬ ( ╒¤1fe NуМ╤*0Мy╖Сeїy╔∙тzуv*3л├ *Ё║▒ьж║╡ЩИV╖%ь+5Їўi╜F└▌zwвд╨ХНї!┬ь}ЩфЬd╤YТH7+│Б╫С·╒{Ыqиu*y╔8мх╜ЛdиW;ЗNЬ╓\КjёA╕J╨▄╠V%d`rpkr╥-╨`рt┴мk{╕U╫ьуУVf┐Н▀ )Дуr~ФъFO▌K@jцмmrВ@кЫ%├╬▓FЯsm*Дa&O#╙ЪuЮкь■E╒┬ё╨о).жЩdgp°РLc8╛RRiЪР╠√Ў4l01╧jЖЄ(еШ>@ХGМ╒{k∙жМаptжЕ√CB═21ФqЬb│фqХЎ kr▌│L░У╛6ч8╟JК+ЖNPЫяnыЇкЦ║╜┘Ф[I$pJєО╒а-eF фg (Фy_╝n2юЪёр6s┼AfС┼#Щй#?0∙G╥╡V┼.Б#(OсX·ЕФё═▒A╧ :)ъ╣[dЯ╗rkШр╗Иэ]м:YMh╢ЄЬХnA┼]▓Qц$N╠з√├жjkИ^d1═ - К╥2p|╖/m \┼"жёРe0zVЗЦ┼'hдoS┼AРТe'зzИ@╢ёЦ├)ч O"Й5-╘ХeЙ╘OЧРыR Yу. RсU┌fЪ▀╩u╔ь╦щыV,bЦ8Ы╩╕└<20ыяNJ╤╘ s#m0q╘pjyfЕг┘Ну8e"аЫ|9&,'M╔Pб3┼0╖П*zУd╩║ЮФПЪ╒ Q╕╜лЪ╕╖┌╣└фЇо╨8▓СwфгЇЎ·╒[╦(пе╪Э╪р╫U CЖТ╪д╬"h8<·U7ИБЬVї▄7 В9шk>H╜8ЇпZЭ[вМ╢^*28л▓@W ВрВ9к╠+к2╣Ьсr)ЕjrвШV┤LцЭ2)Еyй╪SUжsN,┤╥*R┤┬*У9х&╥*VжСК┤╠e2) ЎзС┼!зs" 4ОjFНTЩМвDFi0iф{PGzлЩ8СcЪi╒.0ztжaTЩФв4ПZLi─s═#s╞iР╨┬╓В9цФї4З9жd╞уц═7 щOъHжq¤┌г6Z╟е.(э@щYттО▌(¤iy┼"Т┌ЦФ~ФЛH8┼8=й)FsH╤!└SАд╙■Х,┌(тЬ ьT│hб@зHdё▓Р8_Z▀Й╥'7▐хf╝╝F)▀Ц$JV╪к-ЩфЄёНз'ОЮ╘╖,6╪ Ч-Єє┼[еLь∙╪їщБYД▓Й[jЄГ!@эъkТФмBm╜Bьт,╝Бд=уїЭ"\А ╠O╡PI▐t2▒xз╔ДГ¤ь cїkS╗╣r!T;Б├еR┌┌oЫx8eя]t╒т╣╒╦^fЕм2ъЮsх v╧Z▐GsH░░#h Т╒j┌ъъkX╠Q*└▐р1.[Э═┤>Pk Mж┼vH┌к е|7М╘7F(№╒SУЪКтi!Э`Ъ,с■YСR ╟┬╞ЕЗcп╜BЗ[\V┤2[∙ЧЕn└wкЛ$Й!√6Dj?*ТтwЧ"D ЭЫ▐СVKu▌.ЗУ╗илК▓╘h╖dўFf╦Є  рTє┘,ПцгсЖ}єK┬С▐ИвУЩ88ч╜s╖н╓Д>цe█▒Ам*I@м8Ф}╡D┘НAчрVу│ ч ХюjHlIДТG╖ЮЩ╧5╫ КЬuъi{$X╞▌кX7ZнqYJ(фєЯJшg▓НБАМzQ▐┌б╖WН¤N╤J╒╨ФМне┌\ж╠trj─╧m9bШ5sьR2vB8∙║UиlдЦ@▓╟╞8lО╛ЖкUвў╤ЭЩ<╞D┌Ьї5ljR╟&╟aЬ ╤В5Е@}Ы:я·UKы╛ЭЕгЙМД·╓\ёУўЦВцW│3╓r.Цучаь+mg√M╢є3$гУ╨*║hq█─з&W√█7┼+Y╩ЫXюU¤рsSRPЦ─▐2,[kЄBН ╢щ#g БUт┐╝{в╔Їфc╞*Hэф╜"]╚─cу&з╝▒╗▒>lE╝У┬рєM█k╦╗[VNu(в"▒mРЄyи%╘pIa╚Q┤qYW3]O*СЦeї╟4█╗л╣ЗС4kр3'є═RвЭЛPH╥Бe╣А║Nк∙уМgЁитuЩ.УЬВ8мB.уРН√JВЗпхVэ.{-ъ┐жT╛жоTlЫLлРEk,pю▄Sч▒╧ж*└╙хЭ]ь╪╚╫б╥│╩╝1G:░ucўБ┴Хm╠Сg┤Щу╕╧╠└?Z╔яvLп╤Т;ИЙ$mзВщR гЪ╨(°щQШпwВл08 О3RФТМ@мЪK}┼ъV╔|╞┴Фu Мр╘Т#,rШу8р√bгєТ /╣W9Ъ░х0ЩXбЇэM▌Xжc]┌,ъ|╘∙Б╞EbMk┤ df║═э.╟+ЄЮМ:JВъ╥г1Ь+ГЄё╙╓║йWp╤ХsОЦ▌BF*Г╞Jщ.э^#▓E!ЗеdO28┼ztк▄fS.;Td{U╖U╟╙╜Wa]Сd╩7!+L"ж"Ш┬┤LцЬYiДsSL#Ъ┤╬i└ДКi)ДUжs╩$Rbд4╥1Us"9д"д"ЪERf2Й╥*C╓РПjд╠e.Ї╥*B9щ╓РїщTЩМв0Кa╧cO=xд┴╚8жМдЖ╧ШцЯПniд{╒\═─n=i╗E8В 4mюfтNGz1F)├знfv$еОФ ╥уКEдй@д┴зtЛHЎзcЮФ u#TАjx╨)ї ┌(\sNдё╥еЫ┼№ROе│x─зЕаj@*:a R*@бVнG╚╚ч5Феcк0░╪в▄}*т└rдК&▄r>ХбD;{ї5═RбdQ@┬\}тx╓╗MLH#YоўАdT┤}8▓Йd\t*s[╠▓HL`{g╫КёёXЗ'╚Мз.ДОеlўМ)'АO4$>\iЭ╜Я╩л╠"#єЇ Ц0#oЬя#Т═╞kЛDem7*\$мJЛМE№C╣кЧrMх░Y2ВHыэL╘ожЪu┘╪┬А╕iР╦r0╖6и$)_zшМIЫ%жеvєСU\▓ЙeЛu╥╗*МБ╥мZ┬n╠ЫU@йe╖ЦFBТ Л╞╨;Q*Й√гoбЗv═uиЙvT#нhWs#╜}ъЖб$П1╖М/Ъ─dzqRZ┼-╡┬ЙИУЬзК┌JёOaЪ█╥.S#p╞jЙFe>m┬&╓╚╧uэдЭЦ~s╩зaXz╠ж3ГЖЩ√Z╩Фyеd(У5╠vЄlJR╘Mй,юh╪Ў^ХV╦O╕Й╥тэAМ|─ЯХKwqp╪╡М( Ё╕р~U┐$yм╡є(Ю Z└▀є╨:V▓▐$Ў╛kp#шкz~UБkg|▒ M║ФSТqЬ╓мs9╖!mгB▀╟╗М}+*╨Е¤▀╠ЦУ3.═э╟Э ▌╙>їJ[vXШЖsыЮElъХБBvаcўкэot╨╜ V├'oZ╓ЭK%╤r:тE1D_r╞3[Є\ y# д│s╙б·╓ЦС├╙+H\ч`}kWLK√╦Й╦N╤┤`Vuт╣ЫьLСfюI/.HнС╤Ир╒iXY[╗▌);╕=Нh$С╣wd&$ЯZн{┤г╠Вlo#┼a]┘УЧ╗beЪЄ═S╬1VmсBШ▄w╥▓ч>E╣TЧhr┐╜hX╔▒є#Ь3ю▄W=∙SП╗u░хв╨m╚Ъ╘Яp¤ьК│чG=▓▓+╞2}k* VСg█")З╩H═Mг┘a АOM┤:rхN┴fэrгZ\Й╖╟$¤╬╒ut∙ вЩИ▐r─ЇйR╖LиS└╬яJ[ЛЫД█Фш5╚юvдИ▐k├8┼A=¤мlшЛЕ╬ь·Ю*9%═к"7ъН"ёJХpIфОФ█ЖHУ.2з5 \B╨+афsМSдК+шЎЩpGзZ╬╓zь+[╨d71\Лlо▄TSL╢4Hp{╒4%ТИKфУ╫╓ТkuРn ╙ЬЪе╦═фR▒Ь&Stеф┴СrKЎ  ╥КQ[64К№3КА╖.ЁоsБ╟j╕!О!╘c:╒NHr╢╠m═╜┤ЎЫХ%\ЬцЫзъ1╦k$╚[h┴Етr╩)зи`√"NNс■ян$▀+LЮT╒ЩСZ│сA▄зшHкЧZSХv8Fс JЮ;UУ╖ИЕфХ╟JйUNW{Н╔\ис═кёР:бь=кгЄJ▌┌▓▓С╩ч$╥Л¤"╩|└sыYЦЎ┐щЄ bК{J{ВeИпуЮ'─s▄Б┴й┤╚ И┼d∙╚▄j[Э2▌"QЩ╚╚∙{Tv╫Ў,ъ╟GВЧщ1K°╓gZfЧаїдZu#DзH2i├е#DГр)з УXб@зэH)EK5Ке< hзБR═рЗOР v*╒;8╬iыLjU шВ,└АР┼Чп▌яїнбЗNыY▒Ж▌Аyн8 )╦{ хкt╥╖дщЙ6%p|дrЇл╫p^▄▓\",s╫∙╒{ЛщJ┤{' )╚╥╗i╡k6К-1{ыdI!R3НыUf╖В▐ц8ТY|╠БЕцеE╗┤c─EUИ┴S▐Ю╤Лvn▌W_╫пzФььЮАh2█Zй2r}┼?╧Вkbm╚╜@Їи▐╓=J┘┘vЗQЄТ▄╒,х╢wHS╟N╡ВМZ╒ъЕ╣Tyя 0ТЁ8'ыZ╢╓░\@╤╚7RzVd2Mi4И#;2zВГp^@▓3XqОMtN.[ ╒Ю╓DW√*╢r└єKg=─o+▓╕й=}ыюnmюJ█╚ъ╕хO_еjщ╨╡ъ╗╚╠м6t?Z╞qqЕ█ 1=╨HРИ╖╠─фР~э2HnX╙p#К┬ЦхтRП╕?+╥н█▀6BЙ└ Ч8═s║M+Щ{6╢eo5б╗*ёр3щZ1┬CI╣╟┤}к┌ue,Ы╔┴=*$╖К╬ л&G\ГЪ$ю╡Ve▐√Д6╛dМєcЮ╕эVе▓╢eVPП╗О┐Э5v╦9╧╛jЬwj▓╝R▒z0йўе╖A;╖╣aЭЦS3┤ї╟╗ ╗ЫНз╫┌и\╞╫5┼╡╥ХМ фу>╘Ї╖7rЩр╗┌1Э╜┴ўн9"Х┘VV╘ЦЪg ┐ЗЮ?J╤!7э.Мч┌вКu! ╓cО°з5Ш)САы╙=+)I6DЪ╣,Nc╚^sыQyш╙:┤xУЮ▌╓Ч═ 'ТA▄√╥─Si╔╘э╕н╘S+ЖBр оЩ>Х┬╠P#p ╘ё8ЧНG/Шё6╞┴^ФFM=w}41тfВaМЇlr>Хег▀╦р╢Ш№З╫╫№j+ЦЮkQ╛/▐G№[zU3$w┼pОe╧bkе;ъ\г╧3╨у▒ЙcYКЮG%qЪе{$s╣ зяО╕эЪ~БоG5▒░FЎ5c╧╡Ъ╓G0╩ }{W\Ф%M(┤╗№ПўФъ>tЇ1юmZ▐ ╣кП╚ўи о=Нi╩╠шQB▓п ПJгхЩ▄Х▓p{WЭR)?tюз7mN{R▒√D{╨*Оq▐╣wДю╞▄vо┘сhe У╡√VE¤Ъч"sЗQ№ып[Ч▌g|Y╩╧пМUЛ-╟ш+fxОьЕ#щTхДМuфКїй╠г2E┴уЬ╘EjЇСЭ╝їи zWLd'ХИжS▓С┌Ш├вf3Б╥*R8жЮХiЬ╥Й i)╥*╙9е" ф╥0ъs▐д#┌Ш╒IШ╩$dcTМ)знR9фИ╚цШEHE4ГVМ$ЖКaйЪz╒#Daе╪┐є╪~┐сIГЪ)Щ|Йi╪ж}:╙ЗZУб1z \qE(й4H\p3N▄qяNдjЗbЬ:╙EX9Zbw`Ъй├K▒IhR░Щыs┬ч╓▄У╟uFмS╪wм┼│Y$YЧ)УПз╜h╔жЛi<╨7а┴ zО; U\[╕е╦urbС$ юOOzMыlЄрd ─║╛єY G"▒╗TЦЕж╢∙х,s╧5ЛQ╗BШд╕НцЮI√▌fGys2FЗа╡Mv.№╣э#ц═BЩWaJї╟_╞╗сгоеО▀9▄ъ╪9╔йe╕Ы╬BF╨Е■╡╤hэдOзк^<ЯhТаpzт▓5;#UЧ╨Ь}jьд┤v`n]╜║Nq~╕╧SQAльХ$О"К╠╝`ЎЇкў6!-с╣Х┘f 3┌┤lнь ▒Y^A*{ЬГщX5 u%┌─7zЭ╗1*T1ь}}j¤нв▐┘¤вP@UчoJцo,уkЙ┘▒Аxc▐ощ║▄╨BaE┌JьpNG=кХq8У╖║W╕iVр╟oЧ▓вЭm,ўS∙2Hcc└╚з▒╧чбs▐м\]гI h┬:с╖ГяыV▐ЦKцQежщ╖Wo L╗V=╟'· нsЎs╗HК∙O╡h└в8>╨▓№юF>n╡▄р╞Гr▓х┴\т╣9юЎ3Mєyzs#H╞Hs■╪╚╧сZvы▒ЪFUVn╕5J Н╒cН¤GqN╘еhт Н┤ОДw>ХSNR▓ъ['kЧОu.╦╡Пvл╩ы4;ШС┘л3%хЮ@a├╘sVэд├y{╛@9╔╔жtЇєD╕▄▄Y-oqдй├0o╜щU░Л+┼Х█▄ГP─╨у╧qЪеs║╬c╢@ё╚~щ<цбGЩ╪И┬╬╔П║&├*гўg╛zUЩu%HуЩBbGз~*к8╗У╦Рnущ┼:+ p▐Vцe ╞}кЪН╜¤╦iu-Oy ╖yЬ▓Ё}EQ╢KI#ix▌ЬЮzU╚ГЄЛН}z╘_┘ъ╗┘>щ¤)EдЪeбXIЎcШд! ╧q■sZ1js[▄8╔ЄЬВ∙· ╟╥<П╢РAкфrKйк6з╩ ╥In╖ EKs╛╥ТF└ьvG°╓=¤мЦ/CF ч╫№цйщЧУ[╦Ш&└╬@В╡h]▌¤▒┘&Я╔Zй╘зRТMZHЄ╒)╥мї╝YЧ8.╪q№'^dUfV┴q╕UИe$4{w`Є(Э`ЦрУ╫ЪфGt[Л▒═^iа;l╞1Х#╕мiнЎ╣R9эЯJэДk$,Зяпz┴╘mЁ├ ╬Ўоъ▌∙Y╝esЪТ x╟]вфуХл"s╙цў А} пJ5 2%Й╧Ък╦[┼ЄчА{ ╬Щ0xоЪs╕5rЩ╞ZЩЕ7a*X)┌ ╟№т║9ч)дTм)М*╙9з9ж░йж0лG4С╙XsO`F=щНVОy!ДsH├4єLjдa$0Кaд#ЪaH┬Hf{RoЎХ8Г°S6¤J┤`ю╢%9зA╡BBтЭО&8ей5H\S▒H)├е#XбE8SEЬwлBрMmўИ8╟"л█┴║$Й║╣┐еKис6┬E└▌╖н`¤чb]Ьмf\Dп:Фф&][UD2eUOqф╓t╫ Н1РjXH╕▐'СХВТИ╝є[J2х]Лce╕╡m╨╖rWЬ╙р┤X╛kuRД·ф╓Z╞К$ЦMсФхT╡{M-;╓b╟#з5ду╦uАыxч■╨├┬у q№¤*їювК╞▐ еWВGCЇл! 6яЎЫА7J(яYw"╩X_cБ27╩╣╞╚мУSТmt╪√[(]7nB▐╟sX╖Р┤dЯюСZ·T▒Ёd▐ ▌зуSObnn (┬░┴═iОЭG═▒W│2с┐d ┘TeєWЫQЖю6О.зА╞л▐i-ЫЕ╬ьЄ}EW▓│Э_а)▌єV╒).dIждV╬ЗbдО{╓'╪B╗Тs┤ЯZшc│2[ИхС╖mWRGJ]4└г╦\/bs═)+╥░[C'WdКх(О╨╕pzЮjН╗fщ$E ┴\Ї=лн╒╬4-$E▌Чha\═╛Эpє▒МdЇ■U╒BмeO]Э╤v)┼╠дm┌ДdоqТ+OPБEв▓аnСъMQ╙┤╓[░│В╩ЛЯЧМЬЇн3fў▒Oц;Dvэ@Gjчл(йл=Щ^9d{К  Є*ЪkMaРeП HфКt╔}ШH<┬vс{ц▓ї[Iэо┬LA''йн:pФЬXЇ:╗.x▐▄К@s▀╥Л╪dkгШ╩┼╨ёTmo_O╙#Т)╛s╔Q╫№ёZV▐!╡Ш*▌а-■╦W+Д╘ЬЦжrцNщ\╬F}╦CД~─pMkдK,J уZт;╣[═Ж╟к-цr┤Ч▀<Мcеiюь╩▄.-дKеХ#98A  ~йl ┤rЕ!П*═┼W╥яKАУ&Ё8<уbь▌GЕЄЩв╧о*▀4fУш=nJъe╡Кe∙&┌ру╜U▓yт╜)ЬЖnzsI фтV|й╖$J▓ Нn9\N)(┤Ъabэ▌╤▓Р╢╬ЁqSZ\ЛР╠АиР╘╫Ъ█/я|╣├Ютлн╧УlB┼ВxQ╓▒х╝mmI╡╤fцхаC4X▄8#╥╛ж'╖Йе ЕЖ╫>╡Иўmo"Й}╘╚бщVбK{Б▒фл9NxчгдгCСnm]╪Г 5│П3║й╬}┼Ek,╞if;Ч=▒I8Т╬tX&%И╚∙x=x¤(Gt%╛UgёЮ+'╡ИI╕ў. QС.cР^¤wХJfэ Аcю╘Ў) ┐ AРFryю*╛┬/С∙(NўйVUЫ4Ю╠bDnsЯЫМрr+7TБ┌ ЮzЇЇл╗ИДМо?Э6Ё~хрU╛S╧j"ьюЙЕ╘╖9YmLmР>VJБс!OХm╡╣╤ЎCЄё┌кШ ВHъ=+╢5NЫЬ№░ю е< Ь9э]─GNrk:h│Ь эеTf ╨эф*▒╬0Хпq(k1╙o▀NWBjхf╞йXTl+trM0ж0йTmZ#Тhc aє╓Ъ└╒гЪCsM>╘уЬ╙O╡R0ТE4ЄiфaH╞Hi╙*C╘╥mH╔бЇр)вЬ*MРю@у╜(двд┘┼(г╡8 УXа╟ёH)└T│hб╩*AL  ъВЮу┐╓Р Р ═│ккF+B╪#Мr8Ўк√ о[О& Р@№kЮдоН╓ЕБeR╣?Хii║┌ЬПФфхy№КйR╚qВ1Ьз╫їо╗N╡[KPсБyьg1Ю}kv6▀ы─ "┤QW<Т8·╙^╥Ko:2):Р{W1r▓K9ФC╡s╚^@леFХGt╢ #а╖╗ЭЎEцЛо нИmaycЩШ╨Б╙ёоr┼░Pч+Мщ■yн╘"Пr╛99J╬╡7{D ∙нa╕УШ└╧п╥Щm)└9╟oє╓▓m5?.ф╟ч,К}8н╕п╙%:йеqNЖПR]╨╦╜Bx┌x╘я╟O┬Чэ┬ю(╪6:8эQ═cй$ЛГЯzй!║Й├└"И╞:n "╣7k╔l█y>№sSj6╥\▄oЭ└r3Ю╕└л76░I:╦ M°╞р▀ХW┐│Сn!Р3e╫k|VСЪn6╙AлZ4ТYАТо▌бЖ+&т╖ЭсbIS┴\V╢Яq$RIТсBgЪu┬XI+ц0рУ▀№*гRQЫR╒╣УopЁ╩2GЦзЖ\ГК┐,Ў╬√Ъi|ё╨g╖З+╜╜щ Г╧▐+R╓[kИ$KЬлЕроуЇнъCi ЪЪ<0Om#>`фупЫ=їт▀Л1P┘├ЮХJ┌цH│#пp)▓▄╧1╦╠9╚=jUж█╒ ┌Э ╪AХв#фчЮ╡SMФ▄╦'Щэ┌в√d╖6█dБЬ╞ъ╜е=│n╞wУВ т░qpжюГdA┌├u#/▄n6╒Ы╢Кц─▄ZВ 2уUmWu┬I▀Ю~^ О╦TЮ/7|яро>я╜>NdкD7╒╙"34 .ф Г┐╖╡6╥)mюеX8LЦ*OOе>╬щм.%С06 ┴щОї╝Нз▌"0 ▐Шртжд▄[╙FLе╩Ў+█^й┌гaфрЇлz▓ТС;МЕ└*1Ъ╧╢ФX▀:╢0 С═Oytnб√8Жx8щК┬╔=6!┼єж╢FцТ) ╜3┴N╬y_/6wyн}2╞T╖єн╢Ф@2╜■╡Zт-ЧКa┬ХчЪ6V}AM6тZХ╤Фйg░уГ┌г√°╕▄3╙╖54) ▌ШТ(Ш═>`?▌·Ю╘°╚@и╥Н╞G==╛╡ 5╣Ч5ХЦх'6╞G`YN╥3УUМg╖j┘Г"л╞▄wкЧШIFъ_Z.╤д*]╪┬╝ЛГОЭ+эBТ╓║ ╒В{f▓g╖,┘╟▌B}═╤Й,yB─є▐▓ж^N=kztлlX[└И╨п╩ ^╡м- ║Ж8]╖Т2X|дЯщJЖ ■э▌п─uы╬▀╝VL╧Х .уЕяыP[A║Fy гнIz%╡ЭгН├аш▓Цї·╓]╞е)fd`ЛшгеMZРД╜юЭ е N>яR═ХяХw q╞;╓Н╩,pфсd=▒╨V>Йhє]╟9уЬф╖кE<┬WV╪┌2{Rе)*M_░ъ┬>┘E?S*√VЄцuБС╚щU ╠╖vЄ4_wжZXЇЩзvyИ▐├/щUюпSOfA╣qє\RцСш┬0^ь5f|S■°уО;єMkР6,лr╛Х[PЙV8цОE─Шcаїиэlф╜╜Є╥\Пс$рVъkШы╥╫5R n<╔СФ*░╚рLVЕ╗Дм╚=ъH4│┬ Т╞у▐╔ицC┴cbA=zё\╒/▒ЗКеК(Б╫5╛Ц╨╗б МР>\tнЩогHДГ=═fEйд╖GцUU1ЇкЕJ▓Li│RКq0И+Xщї┼W}>GЗx¤█ ▐╡┘K5╝м|е ┼╗╥▓.~╙$щ(:ё╟5╜,DмХм4╠{)№╢)+7а╟ ╘ЧDЁ+─pzутЯи┘y р.XF╤█╜Ck╠ЁН2К╣>╒╜╙ў╙░╠я0┼2┤`Б╨ПzЭфєх ъ▒ЯщM√+╟pQ╚┘УЬХ4╨ ╣МЦA╫·▌╕▌здM▓иє ╔'К┐ Ь╤K╕йф\Т ┴уК╙Yнп 2иУб╧jЖ▐╤&╕*I)№k2.▌эЬt№kо╖\,КАyU94TeР▒█БСГўO╓▒зZ1oЩ╬пй═ЙfYЛ0m╣фsZё╬й╣╩vчО╡V·╪[хnЇ═\ОЎ╓[bЫ└aБК┌гRIдQЫ%╘С╚"xT!ыЇлVаЮ Уkс=ыv╦├qj13УТеЗ юМ·jb∙╦AыКЩM8ш┐╚═UГЧ%ї+╚п8ie└"еG)╢Ln@н_╥цБэЬ╚АЮЗ>ЯуL▓H╘╜л9∙╜s7╨N{лlMз▌╦С\ГПч№ыGR│/▓т4Шm еЬэД,Жу╙№ё[vwЎыk$╗Ч√ДжкЪR╝dь║Хч╦%:z╛жEФMarУ╦)╬сЮ╪Ўи|╘2┤|'r¤*─ЧBkЕuPк╕▌╖ММT7PвNv6WЗ╢k=-╨╥:╩Є▌в╙РYv6~Q░╘WJ╥█╞┼ eеUє>ed╚┴═_ЖхeRМгСПCэBw▄Ч 4`╬Д~aМ╒wПМу5зuSє(└Ўк2╚╟>їд$╬╚╗лШЧPиN1ЮїЙpЭp{їЇны┤uц▓."7zї(H┤a╬Ыкь*ї╩йПvї▄n┴Ь¤zc·╒7щ┴шD╓Д$Tl*fV╔ЬУD,)М*Fи┌┤G╤╓зС═0К┤r═ #ЮiжЬGzB1═Z0ТI зfЫБы·U4KN▐№SЗJЖo8SЕ4SАйfёOК` иfёBКР f8знK: ЗБRиж.jU\╓mЭФ╤╟] n ]╩юмяFTїл╧fРF76№ЄAцз╣ц6¤р$9<╓m╒мq╩y╟╙К╥-MYшnjYе─▓У7Ф#$■U╕@Є1&KОт╣kmAьwу$"ОM]ГT║Шy┼Bй8╟`+ ┤ж▌·╬-▓▄╖▓Щ<ЕМчбчеc▐3█4n_. р·vнquh╢╠┼БРЄyк╫ЦМ-Л╚∙X∙р}(д╘]Ъ*6D╔tУiD"1СШЮШу╓й╠.u6Цври+∙К╠╥Л-·╩╚╩2B9ц║7┐W 89+IМtfоqЎR┤U┴лlgiиmZVТ▀╩╞З'яYў▓╦&в%┘И╖р╡9╘в╘n╘M+!,0╜*╢╗!k┤И8eQ╣L f╢зэ=хлCEп=Шya∙ г╖j╡mkх╩√Яq╞T·b▒ma╕iDПЄА╔■!]Э_;"IЖИ|╟ПЫ┌ж▓хV@┌Jь╞╘o╦\,,O-Ж= U╘M┬ ]д╢ьnQРj■▒еЗ╣KТ╪\№╟з#№К▒v╨5в6Kбуrё╧еi ┼(╕бЩ~zK▓┌Y8?7аЎй"╡X!g(╥Є ╛x9Хе Т█mЗуCыW=гўпеЩ╫tЧ1о╨r1щщZwР\╬nвTМp0ГО:T-Я│Е'jЮ:Uu▓dЙВ╚╕cСО+╬rR╜Ї3▓oЩФ59~╨°1░'n?ЭR╙я$░Сг'Съ+y,П┘жОBNтq╒]B%К┘дH│(VЁй╜ЭЛMlU╝╡YРNз№рtд▓П}▀╪╓1ЦP0┬и┬╖тT╦хqZb)mHЩФG▀v9·f┤Ч║╣oqЭГщ0щ:DВщ#С▌╢ЖCЭ╝gКчц╒V═nl$сvрф╒i╝C}rR"зddуh╬╚м¤fЎ9BНТM─№╒╧Ъi[OыsЮХ)%√╟v5╝│╢@╕9ыОz■╡нg,Iрeчнc▒фИv╞╧ 1n*uы41йp╚╕╞AъjчM╩╤gA╙╟q╠xS╔8д▓█o<ЩBў╞{╫'зjOo(,┴╖ЬqКщmoу╕P Д цлFT╢╪╬P▓▒viг╕p█БваФю]╩GjЖ3У\Я╬н╚лЖ1▓Э╕▄ ч╡Г╜╔╥:!Dёи*ищP▀Dё[Щб█╕Ї\чЇд6╠Я╛W№=j+█°оь0аЭнГ╖ГUоВKU╩3G╖IпСдL╛рvЮ3ыГSxВ╞▐╩°O╨qє&sГ╥лhЎ╙,л4▓∙` Н¤j═┼┬jWe[яО{у№■╡│ТMїеэo},C Э└D║▒ ▓Ж>╛╞┤,Ъ[еР∙E$Мb@A№■Хv;л]╤ШJО▓о}╘чпщY:vиf╕╕╧ ├О╡2Нуvg═)ж╥╙бПиGЛвм┬p9м√;wy┌8╩ючйо║}.╬XЭч|3боj▐7-Щ6э=G С[╥йюXшД╘ЦЕ¤*Єm6VНф1L*OC]эm2Iд╧Яюу  :хп{х╖▐'#пjЖ=FЄ█¤1 ╙╥Ч#Т║&t╣Я2▄ъТ╦9D0н3√;╦unA┌G╡Gдъ│║ИдRъzё═m╠ФУОzЁж░фщ╘цЬчM┘Лfт[tЖAЖЙЁ_╘U█н%^н╔<╥G  .√П\V└┴│Н7*`є^Н qj}П2╡g'Тk# у p0zB├╜уV?0}*▌№═╕оCО@╧JU╕ЖXЪU┴P1╟Q^tс╔-┤;б.u{ъU║╖h█й╞╙▐лЙ╘1с╫ЄлWм~╪d█Ь`СU5И_╣И НВ:ЬdTrж┘╒OTУьX┐2(╪q╣1XўW$sЯJ╫Y─ЦF&td·w >їЭ.╒fry>їQzЧKEcчpрЁ <╓dфЕ'=√╓▌╪3m8╟мkЕ$▒╬=л╨вюla▄п98┼T|МБ╟нh^ еg╔О├ъ╙wC{05uйвjшGAДSЬ▌iНZ#ОcsL#╨╙╧ШkDr╚a╙╓ЬG4ШH┬HgzL qы┼7ёк1d┤сIN шHP)рSi├еK7И■╘ёLЁ*Y╝G РQБR(иgDпb.XcЯcP(л)-╟еe#╢Ъ6t╪м▒▒└╧N╡╙+eLє╟n╕м-.Ф№─[)╥2Oнx╪Чy╦[UЁ└tїнЛx╨Z│r8╞qэYаМ.G┐^+Yв[и¤`■UчTfu╚бqє╩БpWpcи5"@Ц╚@аї┴ыэQ\"╝ььр|┤j2лO (ЖE█Ц#жqМPХ╥H;"]:эсIРфЕ▓їIevоВsПыNЪ&Д-█Ьс@:╔╕ЩэФюRdcЬ7yоКTя+вФUюЖAjУ▒gn╗ОYw┌Qd┌Ш╞xи`wIє ГУОК5Ъ]╥cючї╤-^еa─З|rру Zъm3=╕ zМ╫5 /Х№эАqїн{ ├m║┌d╞2Eq╓IЩUMн7$╛ЙmжA╠y╔nLN╣<ГОyкЄ▀o╣wЦ@0╪ўкSHЄ]юq╚Ў■║ЕNяQ╞.╦Ш╣q}╢ф∙s°UIяH]╬+╖С·╙d╢uцS╬p╚│■хAЦj╓ОЦ-$i╧5мm╚╬с8їjИmaДАpN:╒[{ .жPб╝аx╬j╒╠▒(НШ 0а╘╡жф┘^┼╡П═╖Q╗ їдК E 'ё|╪эXэ+[J┴у¤гР*╗▄√Гц╧Zqв▀]Хўл╝^9ГХВVдКЄ╠Fж`╩╪┌xйmрKИЎ▄d╚Gж*▌1Д■A╞GSЇнSГ┤K▒Vъц%с )шOS¤¤Uj^з&Т_т;Nянb╧ ╩SsС▄t5f█I╢Я°Gр(хЗыySз╩╣о6СJKй$ЬД╔ ▄▐╗▌*k)ь'П,8bNMrЦЦЁ└ъ#+┴╔'╕Їн ;H"БI▄ АO'Ёмё2J▌ ЬyХЙnЪ▌дeF╘їўйlмцHъpж#РPєЯZ├╘ЦUФ F▀[Б╚┐щVЇiC\е╝оY]А`?ЭKж╒;жb)╛╞╫)хсXЄ3АA╧. Ъ@%M┴2їняьЛ╖Х╘(Ф╜╕V]═ндМжqМЇSє~U*мedо iьR╘."x╓ ФкМрАжZЛл$2юa╕qГК╔3л].╞▐─ВKtе╜╓╬iwУЕyрs].Я,T{Хb¤╘╫W6╤лх 6ъЛMhРрю е?F╜DYч┴юq╔мэBE╝Э╗:єєйрЯеa╛~]ТьOзZЕi╬═уыУWь╝╕├y└0 NJєПj╦╡Кхт-╣Х╕чи 8л"▐X-╠╧╢QЯ║?LSио▌▐уe█╗ЖbPw√г&ЧMЛPiє║%?7╖еVk╣59QA╚ЎяR╪Ы█N┘AЖ@▄УщЮв▓q┤9t╣.Ў╨┐-¤─3ЭС¤Y╗√єY·Еы═uэ*╣пf5з▄ЪКIlёь╣▄@,╨+уLЮk┼ЖYT 9ы╧╓жЪК~ЎД╞╫╒jmщ╨$Р<оЙФ╪╬▄S5 [Iр!n▄*grОFk>щЮ╥╨┴З{toзеci■t╙H╖┤К[$Ж#єкЕ&я;ьОў╣не█Ф╣2gtj~єЯOo┬г╫.mю.О╪уpsБUю.т╙х0к>Hш¤НSЄН╚YгИqТN▀є═m7.yl]╡╕╚╒а╕wТTЄИ5fkДЮ ОсШу╣їгkеЙ √\╣╧'№єS\XYdХNТ╞ёС╧╦ЮsщV.|ЦЧ/єЬ|жЫНе~Г4l.ф╣П╩+░ГПjs█оY$m▒БЬv╧jбж_ZЫУc╦V╟╛Oин;у√╖X√Ём╝уы\єЛМэk\НЩXIq;"░"<№╟·UАЎўrIЗ;П'№√╓═В:ZHТ╬TЕ"▓■╬LR#) ЬуйлДТo░╙╓┬▌мЄ┬Т╢ їфt·V╢Йo eМКY╞ gнgлп╪─3эНs╬O"╞)г▌Тф╟┐е)=9E5ub}VIb╕ЄЫ; №з╜sЦ▓╕us╖╕└фєЪъВ┬Ўк╖$╞S█╓иъZ/№╝BрТгo╨SгR1\мQТ^ыM-Н┤?&:є▐аУNЮ,nE▌╩y=∙їн=;Siаh$pхОЖР╚єG*▓У┴ХsЛ░Фз{0╤f╠pШ=p+д▓Ч╬gЙ@╬2jХн╡┤6√BтBsМwл1О)KоYЯ9ъщ kг8qSRТ[С┌+г4+й╖jX`9Ф░┌}j│╪▄ cТ59q┤Сы ╫й═├ u ╩зї9пZO▐V╖тy2╗°]ю]■─WБ╒@╬z·f▒uлSknС╚И ъЇыгq#D▄0>ДU/╪ mбe█Єф╞║▒8HK чI╪|Lу]Bб┬NИ"B∙ SпнfмeП╧╔┼tЧ║cGз[J╡ЦРrGўzЯZ∙к┤ч Yгши╓ЛЛiФдFН╫kТ}k6тF.▄ЬО╡п|"XQ╞7.yХv╛A94а╡:щ╗лХg;у╚9√V4щ┴чйль─8ыВ: Ос2дcС╓╗i√жз=vШ є▄Vd├╓▌╨Ь╓E╚╓╜Z2BУ ЙкfиШWb9*"&ж5H╒ыZ#Кb┤-╖p!Ж2psПпзZЕ║╙╬)жнє╖B3M"Юz╙OыVОy!ФЬ·SИЫУTd╔i├н4fЬ*Д:Ь)вЮ*Y┤GSЕ4)┬бЫ─xй0 xZЖt└ХyлVфЇч┐╧╥кито┌й,╕═c=О╪ltV1╢V╞Xs╧ч[a├9╟nїС Eч+ЮG5йj█у┌xdЎп╛оу,кВ╤д3t·W@╩НВ▀yxЎ┼aEЕЦ2▒Є╜║q╓╢э^С│Цш?еq╧SЮ╖FSЮУnU23ЕIиЇШ┐╥З┌т$(!Жvр√╓ЇH!-9RBсWыСTmМ_╧$ш^R3╞Kgп=ще╦d╠Хg(┤Мыў з▒tю╚lрjцяц├*х gР8·U╗╗Ж╕є|з}К№й=}*И╢&PIBpH=ыжД9U┘╫d%м^h╞p9рN┤ВvЦшу8^I╡#╡█y(─╠FЄGч╡Eз┬╙?Ч·d╒√Dю╩╕У;┤[╒H<¤*+$/оH▌БТ+б╥cК e√HН┬Ьa∙╘ Z├▀ц_Ф\Е2╕яY╞IжС*Wm═┼┴уyР3┼tmн╖Т╤Аm%ЬєЮ8кж╒J╞ОH у'╡:;iZхТ▌ўйыПJцчц╨╬гRНпcTХДЮVUИ8╩Ю▀ч∙TvшUГЦ+Ує:Ї╖╩йzW's╘·╓│∙ЧZmВ фУ╕ОFkw.X%▄╤╗XСпЮ┘ah6№г╡Гй▐╔=╔╕╪+Оz╒█<Б*╣c╟^Жа{VШ╛▄ z╥з╦и(дюQД4╙I МртоG╔CД╚nдzT╢Ў2Х└└f№K (]рЯ├нTъ'.T;ЪVJM╕Фух#п5Хwk>цЗq ╬3ZЦos5▓└╦lх@╘%Ж9lTЕ· J█HF3]дз$вn`¤жQx0м>` U╧~╡║╤╔цЗС▒cx$Юї%ЖО▒╞/XyЛМ╧їл█ъ─УKnй #yCNеX╩VПAs#RВC░vs' {у╙Єлv·lЦСдJГzАpIКuЇO╞T▒┴╬╥ЯqмН▒┬╦Й фr?╬hцЬвФJ"╗╘ч{P1хФЮzфr+:▐5┬╚ю[>Зз^+b(#┐╕Vu°К╙░╤"ЪЇ5>hД п┼ м`╣b╡%╩0Wg:tАЗ ╤О9чёл0ZмZzлF;╔8╚э■}ъ═№ў╖@ `qЄЬ.9═Gл]9╖UЮ╪гХрйрtе╧RvOияp╘бК НW═#<7cїк·}ки-!╩хцл[[╧wjєIrJв№к╞м┘▌$ Ц│H\C/Ёцйз8зv1╓Р$wyС╔Б╖йнж│От╤№еtММd·ї№*Дk,3▒┌0┬pMVТюсK%─╞ь╬OёГ}ЎЗП) ╘9ZM(ь▐fd╬^=+WR▒Ц;@]┘ц ТzэПеsГ╬║a╟|b║)╡84КNыCUэв╕yZёВ░рdёK╠Qд]ЁГ┴SМєЪЖВ\ ║.фsМїцз╘ю-ЫИ3ЬА:Л]июА│cm%№RKf∙@╟NX б~НfН&э√░ УВ яО┤║бЩvм╠^#╦t╧QZЪКщzХ┬╔м╤Hpд ╨ w;╜Й╗R╖C3K╕ЪE%ФОдg_╠-gHу_▐я╬}}kг│╥EдO%╕iРб∙Ыc╥╣ы╗S>в<┼a%ГЯ~╒1ФeQ╗hЪУ╨еu4Ч╫╛bА8дЮд╪>`╧ўI=тйе─ЦЧ<QO▀╖5n;ё+vf,д2╕╬TЪъqФm╩┤EП│╙Ы Xк░lgз#▐╖нгЭA╡Сvрчq95╦Iqu├Iє4g╣їоЛH╘╦"QєчВGZ├Єєn)^┌ВхmеЙзВ@═gы2@▓ а|`a▒їйд╖є█╠ДЄzu#5Х╦QXуСCЄFTz╤╔).`qsОж°YуЬ1$а=IщZ1ўYNяCщUtЩу╜╙▐9  Ог┌лщ├ьЪШРф▀Ь¤i╙¤▄у&sT\ЁЬМяЦ№@╞&УфИщОФЪ╖┘∙╕ ├9═%п╪╡y▌T ╗:╫-~■\█crаp2x·W│Й─:tУviэЄuє╣PичJ╙░Ф;cй8т7╟╜%╓ЬgЖ9╠╦хЕplЁGZnж-╖╣▄╕ з┌Т╒е▄ЩB2Т}L▒йM5╔╡К х°щы∙TЯbЪ9D▓y0╔V<╙l4Ў╡█wСМЭы╨КПR╛П╧а╔.ь *ъ▐\┤Ў5ыб,╦Aq2IА╪ш)┌]ї■їYSyь<■5J 2;ЦL0`NI ╚№*ч┘.lе1гоє╨УВGеTїК▄EыНN ЩHЧdnзН"ЩeХJУЄ╧5jчKТm8б\№эяUнне┤BI^юJT╘n/PКIY C=И 19sЕ└ш3╘цн╪▀^щўцL│FO ┴┤╟╜Yю<╣@г;▓9яКЮ=V'И┬ЛСЬ('єкУХ╡И5ufj]ъэйHмy<6:ё▐░uыieСv|└МДQhЎ╖∙Гc)b:sщPK<╖JVV╪#hъGеуiє┼К1QVО─v$k▒S%Й▄н№щ╖:kDC AЯу`*[+Л2Ж╚8╧$╒┘,Юў╔3╔╕3№├tVТиг;збA╕ИGpД4q·√·U-FътЄхPиВЖF}+N¤г┤О+╗ЄкO▐кq▐5╒╧юг\}▄c┐оk:oэ╪K╕╘╙ц╢S$СТ~юAыш i┌┐█m╝ВЮ\xч=╣з▐щ╫_aa╝Ж?0ўжi2╝q5╣НЯXЎ═e9є├ЫкюоМ;шaОYЩ╢n?8уПе\│[иьЦц&л№$▀еj═ak╣┌рй|аЯ─U4#▄ЦR!T-┤Ю¤1∙VЮ█ЪГ╜╤b ╫╗PУэ▐Wю Я┬У√5Щ&Х>Bz-YЕlRс#1q╨▒8Їк╙▐╔к░Фo%Онbп{CBo╤bi╩│\.цуалKwщ─ Чx(тм^сb0679╬p{╥▓e6╥х╫В8&┤Нкkb╖(╦"ф┤.U{Ж¤нK{DkП3═М\Е[Ёкri╤╦qШЩ9bJ6d┬ТTgз∙═tIє+&3д╤ ЁLМ*NхЎйпюэUЄ┌▀┬qСXРъ╫Q ╢7└l╢3їи..гvxdК0чч9?Zцt\ейЯ'╜╠╟ъ Bи╞xrsЇ№ы.i|▄АsЄgБ∙╓Х╝ 4╙й*зTГI№b╩kce`|│▌kxI┼r╟SBМO%├)u ░ЎZM23ЕЙBs│░>╡Пr┼ (E▌Цюj╝▒╝ъ▀хvlрыNVФн╡А╤От[X─С4О├ф┌═Х9№∙цоЭF)Їє#D▐`ро2sЇивВ8-%Э╦╟S¤hKa(_.MйР╪Q╧╔.Gл&╔ъWk'+ЎЭсМQ╘·TV┌[5╥B▓c╠9`AщZ┌Н╥EhИ─|АCыFЫwЎЛП5г─╚T░╧ZеR|╝▌wkР▌ZCl╤"s¤уU~▀¤ЯvH,щ╘t№j▐зkqц3╣s┤vЎ5ХdН}Я,#Д'╡:i8єKaнcй|ZЛ╪щ$`э╒q№кв█ AЙФФq╧╡h,╔lп>pTvкzКJ╨ЩQ┘ЄNWў┼У╜║ -╟ФъUО▄ёЮЖо]╚╦p╠9R21Y┌ cl╩2H└5<2=▐л*б"OaяX╘^√ьf╥ц╣▒д▀=бYя>OыV5щ█,HкHщМ ╒╞ОhтН╞рTОЭъ╬й(╕К2г╖n╞ЪЯю▄╟#ВucQ-юTє╚О8▄dРGzщ№1zmют ┘B6▓У╧ ^╣[e¤╬╔▓л`{WYа╟mV@Фэfнp<╩╝\^ж8їd╙G^▀zO"L?▐╟ыYzЮж$│├1ЖX╘ю▌ОN*╢бvm┘гf┌vрl`vоFЄi'rLН#Г╔щ^╬;1Ўi┬'СГ└є╡) Цu21дn'°╣кєзШНхЬ+|└ :Кx╝┤G'оsэOОr╓К8ЇпЫm╜YЇJ6I─дb.qМsUЪ к[=Е\Т6\лрUIО:q┼\[:Q╔j 6r8т▓&)№·╓▐вKкНч9№kщЗ*=k▐аЇEвЛjйЫо;╘M╓╗╤╧PЙ╕ж7н<╙[нhО9СЮ┤╞4єКcUгЪc !$oZS╥Ъj╤═!Зн3ПJyы═&~╡H┴ТbЮ7зБR╬Шб└bЬ)аSАиfё*@*1╥дбЭ0╛Х ыLZХEf╬╩hЮ%.ybц║Ma0к$■╧EО@Ў┼tZ.╘┌3Э└╫)√ЗAд%V~0Wо;К╒ВQ№й╣уФЎфЧ ГП┬пBТв╞TГОI■uф╘IвY╖ ╛DQ8╧'#ЮФ02─Є(;ШЬЯнWЩ ┬Дя└цв╢╗Стs╞79┴оTоМ9zн╞j3\D╝ДC╣З╜RtТ▐╫.?y1┬УВ@5xиx┌,Т +d}ы3V╗TЭauRщ╨ОЕ{VЇя&вНcжЕ#Ч╦<В├?╓ЦцR╖г VзБщМSеQ4─ТFqNxд[|Хo)ЯJъ║╤▓╔╒5YШМэ╛ЯН=4шЗЮ"c√вqМsїн [▒ЙNqТ1╨S"lН═█╢kЭ╒wi1_S7ь.╤│жG╚7`U5Б╥Q─ь═tйp>╠$ └_Я=k7>t╗Фn∙р Ь╒┬┤╡╕&Z┤Ж6 AГ\Ж#ВsN╜Ж┌5й]ьAщSMх├nй.є╒XЇ·V6аtЪ9I}╕└q╫ФЬпq-K"Iж│6ш╠┘l`У╟╥ж╡ЙфS >хBHч<╒G║iХY1╡ИR}ioЦhьЙYI =╜kFI1%$ї+┘╣ЖАХ-╞3└5пfчN7)vнЪ8╧z├Е^8╖вB~щ^}  ┘КF╘m#IX8Д|а╖#ЮХu,╡╒╫РY4/;╔)╩арcйй ЯэDaИq\Од Ц}%#░√F■йЕPy<╒8Uтku▌Д^3№ыEЬgvЩkM║b╥фd1лаО¤нсЖT`qў_Ojч┤°ДrHдsЄС╨╓Э№жюРEх#┴_ROZи═╞ю/╨чп╩i5бвўfю╥KЧУчVч=3Мт╣йоvI╜I<ўжЙ╧Т┴ШБя╟уPK▓мvg╓Фцъ5╠iFВзtZЮш^╝╓VЫu╢9∙╫з=j·>3ТG╠;╫ЗR-{дЫ╫Ойa┴Ь▌ъМVё╝ёЦsЧШ╘ЧW*░[фф2щMiR▐┌hф│!(├▒ &╣╒╠`ЪЙЫыR┤`─иqРx┼eыРа╛@pTdnєЪТYДЙ/╠VCБПZПPшЕЙ▄ъ7 уё╙M54═R▒^6q~SВ7~vЎыuЪGn0Б│)╟SЮQY"єєЖ▀╙>▀JХтє uМ6╟=?нi$оЫF┼Е▄Й ∙d|╦┤Ьuдh[xБА╡eiL fIKt╚╔н6Эц╛№▄╣#ГКцйIдKVzNМ[ШC∙√╡U4°m *$L│gОаUФQ╕▒?6╥>Щмя)═╥;sъ3Y┼▌=HП7r3┐Щ;╢ ФН╣└Ў5AЮ7╢6┬/ШВIу╜ijK-╣T8фcМU Д4│Ьй^I5╤ Єєно6 lEUF{¤j■Ю╤оє ╖▀ZЛW░║Д╟8Пll8╡NeKcю3╚кiMzКъKCRЄрBЩБГpF▀JdK4╓вb>R╕ ▄К╧√;-йb3Ц ЬММfзЗPHl╥0ф№▄5G%гюъьj┴3JД\aвчйи╠└╩С.хbNr?ZЕ┘nЪBО''К╜u$* ╬@p╜Е`╒Щ;3"ю┬g)√┬@ ▄· ·ъфn╢╓ шFG'╪ї┌#Ю┬│/nр╗ШШ├ Г╞ke╧▌Т╤л╤Лy~.ТD╩0x {Sг╝Цц╫8█АЬЬр╒ЪYгUp┼Б╟`zЪЪxbЭ *ЁГ╔9оЧN)Yaнi╥FbР╧│Рxў>▌kSRЗ√>▐0%ЄWhn─Ъ╬╙╛╓¤╞К╒╝╣Нг▐б/бии▀:ОЎ╖0l6═ Y╫b▄WK%╥├ЙjСС╟j╩╙┌╨Щ╚vЇ╩zчК╓╣НД1фиT╔╞O5┌Ф╒─ў1УR :▒9lr?Къф\G$ы└N╙░tўлв╬╬ёJэ>cОй╥м&Э*lгFd┘Т▌єяU╧N.Ў╘wG7mижp╗Z203┴═K▒╙4Шя╢н^шш▓~э@фВ2-Yэ┴HH*┼dўWG=&╣пa▌ √e┼ЇъЩY@8КР█ьU─ПЄрvйэ,d╙Р╬╩╞╩ЄG5j}УD▓И╣CС█&▓ХDЭб░╧з\G*D▀Ї▌NHa╖ О ы▌┐┬н╔z╥1"УГзыYV<-q2рЄ6пOj╥Э▄УЫюЯ▓─ б╪╕тA└S█>╜jф╓WpДСF╙УБПнX▓hТ╟1c яKЎЫ╢O%Ф▄ЮGQXJдЬЭАЖ┌i!ЖGТM╦╘пo╬бГ\I)╖ БыБщVmmЪ▐сб┌ПХ√╧╧5bM:╒дVWP=1Г■.T╙|╚N▌J║trТLr├vцяыX╖6O6жП* Э╩ ╫hn!ZмaLАХ%yч╢k*┌┘╝╫Яrфы°╙зY┼╣ 2╣ТЎ ц"Ф┌╠zОzT╬╥ЛHв+F№чZ╗0Q)iЫоЬЎРLр$омдчЄнc>ksO▒Т╞6u,d√▓ўi0╖НЙ┌мчКd╥═Ъл#╫б№ъБ░ЮgYzи8 =jRR╓Z╓╟ка6жQхз@;wкWVp╚<шdfq┴ыYя╝Kхde`╒Йн╡dЖ9mЙIЬ7^ЯфW3\н4╠╘T^Ъm`w▒єаEgИ`рc═╧5╦▌,W√▒щ╖▐╖ь5i4█ywвк;rvф0┼@╨CйDnHЛeQ;c╓о A▌аЛТУ╛╞U▌аUBY╪їU█│4xgP БЗ█╬*a:}в+y╤╟LTЪдС_Й└ЛОyз╬█JE6ю\Ёї╓tЙоЄ66┐q╥▒/хY$hJ"▀1└aTtэMьЎл╨Аvйїв{┤╕Чэ!СРOoнkьдк^┌tai7▄╤uИНУi№bк╟н[∙@F2'|А HЛ:л#║Э╝Г╟╜e╛ЪтtЄЫўб 0╧е8BЫ║СgMфZe╧ЬЫW ╙>╡═n[{∙C2/▐├UС3┼@^q▀ ╫M║Д┼Э1√╬┐ztра┌ю$мlщP┌^█\З|Je═╞DЦ▄ЇLО{К┴▒2гЩ72рчЖ╟╘fоDўB]╣╩╣╚nї)jї j▓;Эи╟'ВЗ╙5л│┼"Е8я┤ЪmЪ,DяUU9Ї5▒бШЙCщ═aRе▌Т&sQ▄г%фРN▒╣∙X`нVBxYВп▄fз╜Йд╜.Г%:V.aНmcФАЮї дРУJ▐eл60ЩUдфЇ═TЯRwВB╣╬H╬{╒═)В█═цJW<8╧Z╦Ъ(╛╙*[ГфsГ█щI%c8дцюКвC$<Є─ї┼i^/┘c{Ю╒V─=w/r1V5ЫЯ>рl$/▌ч╥йд▌Н|щt3$ТyВ1*╟║є╫пнkZ(X7IТvу8щXёJ╢╚▀╝9С╙>ЗїнБq░ w0є∙╤VуХЎEЁКmХ╚╧'Їзy╦,Q@m╕ўвл ЧKER╗@╬3╫нg\j йОz╓I6¤╙M╦sU╝ТсЭdУrЖуО╡╠▄▒lё·╓н╓_-СВs┼fNЩМ·▐╜╠╨├ш▌h└i·УБ└Vъ▌уr╚>|cн@│5┤ёv▌' AтбB·вt╨│wlu; v2N;К╚╙UОTTЧ№Zш╕Р№геW√y9sПjкulм┬2IjZТфO2▓Цg╙ЛйZпШйNбн╥КuЯ╣!}jHlQбfЦA╗tО╘F\▓║d┼╞;2ХНК═FKc<═╕╙fОr▒оЇfш+╨┤[_▓Х1|─Iрї╬k╢ўЕ ├aИ╞sС[■Є O∙ИеИSй(%▒╧│ЕєImеH┬№╒╗Лsp ╛яЫж▐1їмыЖЦIЛ(▄хА▄'╡^┤╘&y╥╬XЄч<О╒SRII,ФGРmд ╣RF9ыX-mp╙rн│?1╪>ПЩi┘╝▐╪╬~Ч=Э┼ФRJ m╬cя ЪUm╢ьШ╬/c,г┘рrг~┤╢С╢┬ГН┘╩О╣лP#╠т?ХФГ╥Ц.&╢Ю@vс░p╝{╒╧Kg╔kqd└╞UэEоЫ&дdvХЧ К╘xхyHХ╘&╬╜9м╚їCзO│nї'!ЗUFsТ|╗Б]╨┘╩▒╝╠г sы[ёO▒¤Ю9Ш╚Gb=▒XZХ┌▐*║Е\r Aе▌в▐Fх9u\щ:Рц{а▒╨┤wv╙$)~╦╚уоsI{-ЬвD|┴Ж ┌╡dФ}в)I▐YqЇм;Й$ЦщгxKF[╧@3\Ф▀;╒╡▄Тхг[o2fH╬∙╘ЦzЧ╔┤d┬КК6О7СШяB1╔╧haИ4j8╒Єжм╤FМ╓н|Ы кдЬї┼Db{[bоN$╘╫Р"лТ┴z'ЪЮmJ?9`Р▌╩С╬jyfЯ-┤@O3цO(Д$С┌г╕▌й╬Р└ф,г7AZў.н│` 9уеW╙l┘'С│╣юЮШнDЧ5м╨╚м"╣▒VИ┬кч#8·╘й,й#к@ь╛ХЫ&╖2▌4SЬОЬ nл╢ZШЦbe\А/ кЬщ╧YIz$I-─рЬ)яY:Х╠HБє╝P+bGt░Ц;6V╦nlК╚KbП═╗>c7(шs└игkє?╕H╖аIA/ШIR╣a▀"л╔й2ъfKtfR╕√╛Х│oQZД О<ч∙fЩkжK╬cx∙S╣╧zЯiiIб]]▄[ДВЄЬхЫm╟Щ=║Э▓.┼aО:gqо&▒╘UШГ<аК╬╒.╛┌Є_▌А─ рч╓Э(╩щ-ЖЙ ╦QШc`pЗ╓е░6╥▓\йtГы┼e█4Лm ╥эE\rO$f║;kЕ╣ua$b|╪■/ojк╖ВktB╡╒ВKw╬bV?tp·їNmQтХR▄▒╢М3╥Щп¤Ю[Р- 2Оq┐8·UэY═дШs!99ыЪ,гMNZ∙vЇ╗ ╙■╒й╞░░+╔5пiiЭr╤╩хАрZйuwРЄс[й"│ЄWСЛ\Мб╬ёQ╦*Ън4▀а▀╧+▄Екф л╚исо,  ■d{╒+Ыл╣▌Щ[rСєq┼:┌Iэ╖└└0#w╚└чО9о╪╥хжЦЧE%d6жЛ*UF▐▒эV$╣Y-╝╣Ф wи%А2│o╦c$}*УJУаЙ╞я╕чеjаеке-╘Льl∙cмY]╖ Ч}╩├nХДН+ВОI∙UЛ8хСХ▄ #╜д╣ZиP.mчЕ#$ю▄╕эQъPьхЩ╛·░ї№*▌Ц"ДNё╛╥╕=j=ZO6█bp Ж╝╪╔кЙ-оOS#x ╞╝ю┴?SZвEЖ╥"UХЗнR╙гB╗caчК╥╕m╔▒9$БZUkЫФe┐┤E╡B!┌NG8нЖИGШ,`чуY╧l#╢YTс└уК╨╙фОх|╣NKёУ\VODsUzs-СZWВHМ┬M▓gкЧ-х┌Д]╕cТзщ[+зAu3╟ю╪q╖√▐╕д:дO)SЮЩщWrnЎ!Wз*┌щд┘'к¤▐їЙ}й&]╗FЬb╡/8╚Н·╡*@·VTBeРn!╧9s╥Уj-б╞RЬю(░) K╟╧Мbп╪AawМАFЄx▒д▒╝;ь$wчО;`┼hеТёаПp\у╪SНУRе;┼╗yДЎКЧk Хvdс╔р¤*█E$ШЫък┌:Кб-м┴дPbЬО=ъcq$ Кф╕╪0;уыC┐CfЫъ_╕;э╖1чТ∙№kЯ╗Р:▓uуж╫ ╢кFy╔чъk■u%И!XЮЩ■Ut"∙Зm █й.1ЮkъV О╟╜Z╜Ч+ЬВsыY│>ї=s▐╜к0▓4+╚yиX╙фnj&9ошг Т╞гcNja5в8j1мiД╥╡4Ъ╤▓cOLSM8їжЪд`╞ЪoуN=i╣Ўк1dВЬ=iФсR═вH:uзz`тЮ*Y╝GКСxи┼Hв│gT ┌еNj%йWнg#▓Щеd▐─фVїкю8чй┼bXАTg Mm┬└ПЁп7╣╥h,J╤р=)Яe!┴_aП╞д╢╦c2+V8╘ ∙N}}k═ЭGM╦ЦС$╓▒кчv╤┤f┤YЙЩ7й1nAЇ4ЦVЛ$║Вpнcc ▓∙СИ╞╘#╢:V0е)]г╬нZ*Vf&з╡P фr6ї╞Mq√ZТ @∙Йї╪ы1╡╡─oМъз▐╣╖o┤3┴╖╟╓┤дЪЫЛ:ЁюЇ╙E;╔HгО6рuu5╔К.├√╛_Z%Л╗8 pGн[b▒╒Ыи8о╗ЄдС╣╖зг&Ь╣b═ЮЯЕ[H7Mц~ВЩl@Б6Є1╬9бЪQ3└ ╪>ЮХх╔╖&dяи█П8▄и Єt═Gwb^/78█А08д╣╘V8ШРуё¤i·}єMfсГ`Ю >╡IJ+Ш~ЄD╥Ж╖Ж├л▄u├q╓Ы=├к№г'А*╙э34─. dАN)─Ыi▄Є╖4ЪWП}╦ЦsC╝g#╘7S│E"Ж╪└g╖╜3 ╩H<ГDQ─у|БЩКЯ╗╧чIoи╣R|┼█ RU▓Є\Н╦╨оFEs╖Wj║А2!`╖SVn/уYЦ<sОЭ=+Cь╓ nюўHТ`▒з+x╢ЭфБ(╙m█s/эvi$даССя╓Т-B╥ ┌рВ═О3╚ЕW╗И▀\Эк╗╢О1М·Utй╤F╩uOпхZ╞Э6╜чc[&м═Ы?47 ° ╬I┴шAтЭн▐╗Z!y ╞▀┬CщX╓Ъz─М╥e∙└■╡oVНь,v▒╦vтЫДDвO$TоЦе; ╣тR╤дВ,∙x>╡лжъЄ╟ЛBа╣}╟pщ┼d┼иЛ'hРmН{·~uЎ╘_iєХхAЕb╜┐уЪ╓tЬяюФтЮц╒т бЦ]р" ВQT~TL~f# sI╥^[о╫#q∙ФЮjгAp&yДG?ZШFQўoaХї+Жe┘ХНЖrге@йфдyP} ЎнЛНX╗жSР├бMЮа└"║Аr@т╖НYиоt2╞Зv╙▌Gо▀)╟9┴ло╚│Kцc%И#ЬэUoBYE┼║1a╔f5ЯowuйI u¤╨ЇїоWvъ-6╓ф▓[мТдhчц#%p23Z╤┌[[╟Щy╟щ\─76│8cС╨7еh▌▌ТС╬e,Л№=¤ыJФж┌Кz в+▀!юIB├ ЄЬёКгф∙╖БV]н╕?╡k┘╟ыЩЬл(NaP═{k4A Fчs9лД┌ўR╪ в}N┌н╪b w08'5╖ зAх∙ее`)=*оЧм {qpТ▌3╘ў═R║ВmBё▐E┌└ Y╞УцхЮСBHмЦi-u&[a╔Ї їU╗KнЄ┬А`╬09лqF╓m├GР╠┬иEpп2ь?9`Eo═╬Яe▒G[к\[┌┴ D╚▐b|└РkЬ▒╖`╧<а╝QЁ┴ЯР3╘VЕ┘┘Щ'║ЄM]Ц;;╗L9ъ8┘╓╕у.H┘-╚KХX╟ЫS▀:C╪ИF5гu>ZYШ╖╫нP╝╥#╖╢Е┴_^)╠`[h▀╖┐ є┼[PТN%WW-;ЦМLI Ж■лГ╦!Р╞ц▐╒й░д 4НВ├оxлV│@b v;;mце╘p┐*v2.t┴$MH╠Ш╚,▄КТ;еК0йХN└gJ√\Хoa  \уМ╥д░╘ЦxМda█9чён]:ЬЧТ╨eina╣╗&%H╧ С╟z╗ g:╠7Gc·╓oЫi╔3F╠м╪╚c3D╠}3V┐▓╤╠Тo┌в═Y"h╟FT╨оZ-MD╬pXВ╟╜i][┤L┬I &~^sY└▐`ёWcЩд?[ Ю3■sO┌.^VМк┬ЄЎС,оХ,Bъ]е└R'$fгЦЖ╞3".T■u=жоbwИ#<╗▒эSkQI0O/б╬kg nЫФ79╘ъ*К30ю╦-┬^GPуnж,Уд╠╨!▄G╠1ЬVМp╩щofsАwe╗їе{r▄ч8э■sOШG]╪а&▓╢зjJх9зЄ╤A┴RзСXwEЙc╬8zUлЎx vWюО>ХН4╬▒▓эфц╜=>и╤.Й|укO&м▄6K╕╔·U2└ї∙п^Ъ╨▓#sQ┐?JV<╙еnС╟9 cLj{u└цШkDr╠aжЪqж╡Z9ф4ёM4зн!кFz√╥`·╙Идк2hxтФuжvз)3HТ pжЮФёЪЖoH*EиЕJжбЭPdлS.3PнJЭk)Ї═[Сўлj╘БВ{К├┤p#нn─Б╫╜y╡╒█77-BДl ╣┐кГ█╫еf#b Ю3SyМ@щ╓╝╔BьGQд\┤PaЯ90│0щ▒│аf9╦gюЮ+╬ч│╦#├ПХ╜EN.╟/┐я:2╩кxtяфsEдТRXММ╙$F ┴╧}qЇл╫▓яTъ Кенs?Цф+┴#9┤]╒╤щ&Сtж┘bьл╘О*╒╝л=╦╞0■*КdБF╨╕l}ъ[{pОd╕$WЩ7█Fn┌│']CўXГ╔юjMI╥8╩э\┴╔цнъУO((}╖В)Й╞BЯФуя V╝щ╥Q);вym";H#йцЭ▒╦╝а{╘╪&i(u9СЬSukЪyЭqВFэYижь╔m'f,У кPМOJs╧ИХуущ\╗ъфB╝1я∙╓н╛й!БаЄўР~Vнm,;КLзЄ█╟єЮO▐я┼щЄKp╦┴ ╔Ї&жH.═лH╠кH╨ Е]╙оbК=юЇщ┴═KЫKF)IебЛw{,Д░BxP╖2[9w╩У╙┐сZУ┘╟upe'ldюч5 ╢0ox┘╪>>@8лМсжЪФЩЯз▄Ы╔ф/z╗мФFрй▄6ГМрUM;O▌6хq┤¤т▌ыaхНеo1вНwn>╛ФъI*Й─ч%~жUVЄ╕/┤qН▀_jв╢фNлБУ█< WIu{ms?ФКб_а╟"дY[▌F│mX╩sЯеuF╗Дma▄хдОdТ9"▄p╬╢м5[dД├qЁпВs╔цз╕К╓[ -▀чЇzV V{оT╞─и╦O\z╓ЧНh√┌X{Э ▀Р╞)V<аlГМч=кYnm4╪╘н▒VcЬ╬+9╡О(▀`Xў╠?┬е╓g[┤vЧ╖еsкnъ2╪D╦wщ┌╤ф1рg∙╙Дgs╣OРF _зНo!HЛЇ·Єk@I-ю7╚p╝z}*еOХщ░ЪXЬ∙``;dцзЦUH╚p=:kщКЫd╦ЙA╘SVЛ`@ь√▒!g∙JёМ uы▄чП╞яЁ░&╢О%тТRбЖp8ц░рЖKГ*кюЙТOZ╤╜ЭМ▐^╒EщСVЇ¤&9t√ЭнЩ▐К┬йK┘┼╔ї ╪гэk o$:@зEr╫w'`Є┴9ы╥еXуЙ─eЛm№▄Sя-"kyкТuEP~n{╨хэ╕═9 /┘Ш└ч#нAkamg╡╓=╝чыTwJЪlУС√х| ї╞9лV y{  оCg5╬руgзQ╒nД╫ ┬├v╞мY\Э7l╖jзх╞▐З>вЯЎHхЭC╩rгn▀S■qYz╔╣╕ЮLd<Lgj}kшn╡└╘J╗├Мэ=Ebj╢нotм"!2AчАzbпiёH├╠ьЛ∙Цлўв ╦`╚┼╤▒╧=zЪИ╦┘OMЕ│▓0о'╖ЧOHbФn▀єg╕кj╓#v;Ш~а╒З╙┘cЦ0я╣▓ъ{тп1┤Ъ╨─ЫD╚GCО╒╙╧пwTQ:rK в*╦╪dБ■xм╚t│ЎМDHen╕ъ?еii7В╥/(Р╠═┤ ·ъ╤1,r^Ba█┌з┌Nh 3YBД▒╞vЄ1└"к░T╖P▓АG▌З┌нOиE<{IROp9мG?щl╤▒c╨f╡еI{├-┘js┌\Ц Б╥мЛлйciтПУ╔oю√╘VЎ╤J┴%Р'╖g┌вЫA+EXХ#=xкqR~ъ╘Ц╞╔<Б$ДI1┌OнQ:xY^G(X╪К═MQсr┼▄?T9ъ;╓╡╠тт╓8wН═єМ}+Щ┬д%л▄ZЩS▄╝╨СўВЬУYQZдУnХ░y?Z┘6s)(2И~Ў;ПzT░D*Z@uюkк5cа╚┘L╤мsJьГРnвЛOdШБe'УМb╢mьуdE4J9$рZ60гТvпЗjцЦ#С; фZR┤H9#Ф=Иов╞╙╧}хr1щO╤<7oww││Ч`GЁПZЇЛM"╬╬=Йe}Yr:╙ ЧO/i▓<\├2зG▌Z│КЧOa Зq<РеKЩ$Сэ┌Пюk╡}║я╪Аn p)╬ Tg^Nд·ЪЇ╓PУ╗╪ё▐f┌▓9╪№:■VQХЫ8+╓ЩиZI╜lг@X ╢▐{WXеcQцBOV-№i╘╖r╩< Ї┴нk`й╙зю№¤ щbъN~ў╦╘фoр зnd┴▌Єчєм╔gЙDи+╖╖нY╫o─Ыc^АЁ ck╢▀fЖТ07ы_3U)T┤v╪·\<*чыqlфЪA<╤¤╨wp9у╥║:fЯOСдх├wэ┼sЪ|Нmj6Зп∙їоВ╥┘mэЧ═l X ?чн┤Ы╢├┼%m~FОЛ┌5ШДСф)р╒c\uТї┴UUєн-#MHцHзh╬NZ╟╘цhяЦUE|УЄ░╚пVt▌,-е╒Ю╒MМД#у8└ ╒лл╣>╧хп╩м6ё▐╕-╨╩I╡de╡╘йиА▓чшkJhRтўoW╚┴ь}кеВ∙▐~U7бп'ыS├|. 0У╢HЙ╪N*ч╛Э-Ї& мн!9╟jгйъ░W╢\чЙ╧Rюцттh├Ьg8╧╓й\─WЖЇйн)RWNLj^х}:╔nю6ТяЮvзa[s[ g∙%@T^?╞ишwMmuХEТ>╡╕┴отР╢эШрcн^"rS╫a╢╙Є(█Х]░V<ЄOzп'Ыцf ╛Wёу╓е╖╢╜Й▌ZM▒'n▄юЎ╧н-┤╢q;¤ь7'ПщQ{6╓г╣e9aQ9AЬu═eъw NУ┐бQ┴№к─kз▐K╝ъOQщКГQ║╙пs>ЄЗи кqjwjшJў5Ї═GKhЪ;АъI╞r8n∙кwє$dмE[wd9▓^[o%Т╓1Ою╟ю╘q^ Fi#╖#Єн nР(Y╢hKд╟и╣√╬┐1S9dО)бL`g№;╙эoо┐vGяbБДру╢*M_WdТ;x6<▓йщI{NnWиї╣╬пЭчy╗╚|Ьп╡9─ЁZ╠С╞2рЮzК╗k╛kЯ:HХq╒▒Ртж║К9Jк\Pз∙■╡╘ъ{╓hг#JР═hЎr[╧╦■╔їд+4yАб_,|└Ўя¤jdycЯ═ЛЩАwTyдs,Ь√ч█▐╡╒╔╡╖ъЛ М ░ v¤=+j╓+pЖ]зp╣╚оvтQхI∙╕╚=ые╙м╒-FщCew╧|W6#E═}─╠╒╝╩b0╔я┼U╗Ы╔╝1Jw─&3╔№jKЫ▓╩_ ╠▄у╨UШ4╪ю"▄G+А▄ПsTЭ8√▌Е^K╢H╩GПсэ╞*ьlЦЙ$oWa╡@ю)(m╞э├+╞3╨REt▓_ =╟б8щY╔єl┤▓╢ВюRКnМГM+R╟kq┐╩▀╔_Oйн а╗GUэ╬@═R╘n l▐]┐Щ╖$╣цв2rХА╜u-У]Е│ ▒ LS.┐r▒┤b0Щ&░Цё&╕YОwS¤q]k▄iWЛ║HСHP┘ OjU щ╡r_╗e╣AнddдЩkuл3╩н$╝V>▌єэC^O┤DNюШфМ J╧╘╡7Rб#c╬ ┌▓КФфРў4з╒а╗╖0LНгэр■5KЎoСeНаъ6√╥[█mФЗ▐x^;U)aХЦ5╪├х9lМzтк1Л╝SbЦИ╣Ўх┴─#Н▌ы6T╖є№т|╢9#Ю■ЯЭ6[°aS░СЖ▐ /╜F Кё╫╬Шд}rгп╓╖Е>]vE>Я"NeДCГ╫п╥Т═ц╖КHЩ ├{S╓hнS╩ЙЙdn~xХ-Х№^tЦrF╗dю╚╔?Z╒╣r╗лБ┼кOТ/P;¤+ky └┌╪c╬j┐v╧ ┴D,8╙`М3rNzё╓║)╖▐у%░Юi';cM╠6Є8ы╜2DЫ рф|АbпЖ╨ЖV╞9'▀╓дЕЪщМЄe╧=zX:Н>hьYм╥S +H├nqЯхOО╪Bсз|mшрїЎцпJСX\┬]P∙Г У└тлkWqN?rкеOug╩m%│ъ"?╢ylJРЙ 1ыїиэX4Н$а>Ox╡Хм║Н╗╩╪'C╨Hт║F1С┴=Зз к╡хК║OQЫO{чаL$K╙hлЦrfpК8рыXv■n■W>БПOz┌┤ОHдКI▀3Я| улdK=BЫьB vЖБЯJэЁм(ъД│r;W╖╤CkjV1╨╓╜ПЙА░┌#▌ сI=+╓└c)╤П│r╢З╔уp│л/hвtЙtыn╥HЕqУЖрКч?╢Э'Эрu▐*Fw╪и┐╢d║Mмф.>`NrGJ╟▓Хg╒'-Є02хOШ98*l0°%'Q3▀Oиylb┌y}╟Z├╒$ ╗Ў1=rAT_Y0∙RхQy уЪК¤ф╕╥`Т▌Б%8╞zv5┴_эв╒ю сО┌GNJ·#юя═║QМx╧е$Ч2jB└`АtкM█nХ░╧Ь═miя ОФcЪ ЄJI9Їэ\In{R┤R▓╣ ФA█ГГо╞э"K(╘З*x5╔Y█J┴J!є■M[}D╧p-ўВ▒РГTки)]nrb)║│V{Y╘g╙-этMе ЗqыXrLЄL$$¤}√╘║У╩с;xИэщSЕhьVv* зАGA■EoWъ╛TЇG%: ТцkVd_e%}└n╔╧▒иdШGjFNq╚з^Lвf╔·╓Uї┴XФНа┐a█╓╕гfz░Нтоd╧*Є:ЎмЛЩ~sОн╪▐╒nIF6уВ>╡Яq╡ЖFyпbМltў'$dМgМUV#ї=┴а№jлЬ╫еб2vC╘d╙Ы9ж5lОI▓2yжsiЖ┤G╪╙M4уM5HчРДєM4дN8╙TМd4УЪ8вЫЖў№ъМЫГ╟о)┘эLЎ═8╨ ПbЮ*>╘ёR═т╔й╘CеHз5 щГ&L▒└RO\ СM@чRўм┌;)╩┼Еoz░УЕП╞й+TВ▓Фnu┬w4г╣ уъs╓н%у6x=VR?╔М╣зЙNыЮZ┬T╙5: Ыв╢Р║Сь}x ыW[в_Ж1Хр■f╕НPФ┤╡╦O=1■ElxzэЦYФ`■5цт)'KЩw&QRV;,Pъ╦"В╨ЄJzКб|К■t╤─лУХ▒OНЮGЙЖ╨qЙ9ю*╚у|╖<ЕЎч5цs4╠Rхw9]F2╞)R0[=y┼]KЕЕ#&4RG!yл╫Ц'ь√CеsАz┼ВDKЕ2Таp▀¤jыЛU!n╞╔ж┤7фmМК╪#№)М▓,.АdчщQ▐РbЙг├ В0}*╦╬МЬcКф┘&I @╓7п▄╧╕╟z▒░Цrё)ЁGїkS┤От╥▐xЯlгВAэ╞3S┼ [Ш"YХФфю<є┼TЧЩЗ╡ўo╫№М |┐6;PА:uэ═%╓Юк■t▒ЦОEH<|VЭ═М╓┌лN╤ХSМgблЎD╨M╚P~\ЬuЇ5i┌V╜КХ[EJ:ШZfСo2)w▓╢шT╓─х- %Ф{ПCК├Ъy-n<╚0 ╚╓Т]]. r9`{╥qФ¤э╩Ф%)^·╢ЧIr(╣╟═БX▓┘gQ c7Я_єыVнgЕг█n└Г╔чз╡X╣║x*├щ╚<╘з(Iд4╣^ЖVб╖эд├)╡r1╘╓dй░oЪ5└сwэ▐┤їMEТЫBєs╞}6├G╣╗▒kЦ╕1ЮбAрКъз.X'- ╜Цз= Вvфзб< ╡Щ4└╬с5ч┤EдpJT╣,8c┤sZ7ЁЩ,ЙН╔v\dЮг╥┤Ю#U╦╘лЛз4qYл*"лuЎ9о{T▄ў,BПЩ╕*1Мїк¤Е┤ЙИ$'ф┴ы№ыEм#BМГ╕~їТФiTo{ЛfaAД;%Э║ tЎ;эЄvХ'▒эЪMf─сеPNH╟йин!yДД) O}kбr╕єбЪ░╔conGТ7wuц╣ллЕЦR@ sА:V╪aЮЁ║.¤─ю=H╟Бхп▐<А@_нV)6╪!Чj#В═У▀▐║}.DО╟#Цe╧#5╠^C╝г╪^Д╒╪gСV&@Y@ф)чЄн+CЮ ▄ЮЄ╥7@сN№iЧў^TjcbHSА+.▌b┐║Є─,▒7ОлZЎ║ jOЫzЯ╝G\ хФaMоf'e╣AcТъ▀p╖c(Ю┘л╓mн╔ЮД╢9Їл╓Ў1[╦,Юq▐нГМ¤MP╛╣7▓=┤╟jлАg<╘s√G╩╢ю^Ц1"#┼█БУ╓л═ ┐efD╦УVнm╛╧b█q└╔иEёyV{Ц^GФ[┐╗нАж║dYM$╨цnБк=╪ц═нСЪ┘╤Ж{пъОгc&Я,l╧ИYFчЮЭkVЄ┌km6▐hх*XЬU.ЮтщB║4░(╞zVУДcV╡╨єщTУЧ2zjO<ыкZмAє*aЖ3╬8┼g]┌M╥D╪й^Х│е[├┤Ч,2!┌Oнf]k)╚мбБtєПе9╞ёМцїbе))╕SZ#ЮH ▄я█╜$ы╟_зєи/t"╠ЖLУ╖·U╚ї._k~щ╛`ш}кK╗╒6кёg&бJдdмz7Х╤OH╙.вЙ█╦mзЦ{VМ╓Fт╩╝)╔уРjнЮ╡t,K*|█И√╪b^ї*№╩Mн╩╢zВ∙l╧Аx94╫/)Jп{╒{╪aО╪╕n ╧ъХН╘1╞щц0▄sЦкждЬтК/╟{█гtVu8?╥в╜НcП(нЯOj╔Ц▄жк<Ц┴88э[w0HЎс$~H╧оQМ$Ъ{БП3╚ЎЄТ╠д{~Х╜мOnАМ╚фУ╧Юїnь∙H╢└З▄Cd| JТцЗM Q*║ЭТKл╩├j┌jзЦл0$ы═e┬┬╞ЁFъЇ┼7█нЙСY╪Яяr╡gH╬╫э${Щ I№?ч╓кЭ)^QР╬Т;qi╕┘ЕqЕЎлS▌lРy╟$|О|tкv▓]ъ6иaWг·{╒√"REМиf_jфйв|┌▒1 ▄║У└ry╚ыыTf2%├╚z╨ЮkY▓$p6ёГ▐иъAзE|/▌°╘╙Ч╜kr▐K╖░@шрхПеg┤DLy фсGOj╨7Д┤H#┴└$ [л9]╖"┤{╬qЮХ1Ч+╫KЙ7╥║╦И│фЯ╝?ЭMpB█П,╨ Ж╟зjщ,╝?п1ї▐├q9яQ╦жBЦ╥эУўhrаО▀J╤╫К▓%TЛvGў.Т│▄ОА`СRг╦,L╧ ЄкА7gеt_bВ▌Vшк╚╚gй╘2B╓слLg▐╡xФ■ЧsЦК╥9чdХ уєKЎkЫ+Цhу;AGў╜┴нлсe ФЕхN?нMrэ м2├АFs┌л█╖m4ar╡╜┼мЎ▐Q;n╦я$Ё@щ°╓nеp!║(фя╚О??╞й╪#╛ТUF╬▌╕╔ц┤LЯk▓2Ib@0_╣н=Я│Ч3┘ЕЗ╟фТо└mїїн%ФюєXпЦгhфу╓▓щaМгофш}EW░Хх2ї(г$┌вTЬУl цkyзrйА╜q▐ЪЯh2#$;╘6@>ЭН$s┌ uxG╬╟┴ц╖уЪ M<3й,@ф JКТp╤ fO█оу╜hфaЕЇъЎй2`4мн+tH╬GN╓т+ы▌ўАrW'8з┼ tЖь┐╦╟ZЙ$дом╨нй"^╝ъbНГхПJ─ЮI$Э6Fy5╘Zдq4й"e└с@╚╪╒XмуК&uЛР7|аqJЭX┼╜уlф[eРd3А▒Y]е*йЕфmвk╫ОшЗR9ух┼X╖║I&@Ш╦|еXVёДбywgL│q0У╠\'=√V─W i╘HXm?w┐уRyРщ╔┐rр&3╙ЪВ╬▌.d`eЧв v╕з>{╔№ЙzТ▄@╦yЙ#┬Hr9ЎжY°n·Ї\┤$ИАэ█ЪЖk╗зНwэ]зхc№Uзгъ╥ *Т/╬rурJqn Є█╚Й√Ess┌═o╛7h╩ч╬ZЬ╩░Г─Ю3▐┤f╙ouMEЎD 27'А3YТY4RH8F┴∙╣ыыNъI6TfезScKВ%╖Ш╩U7эq╥йгдЧnXМ¤э└уа ?Х_▓├du╩ю▌░ЇcОTО4Т_4*,╗ЙdщХ 8м[Z▓"їl╗j&ЬI#хqЬpн╜KЦсМсЙЛТr8Кпждh┴Зl$Ьй■.8нЕ┐M6╩Hг┬╗>p╜oЗзN■╥ж╚єёUgм ╡f╖j'╗Т8{ффtP;╓ h■X╔9?1яZw║Ы╟#▓Я╝0HЇоvYў1lпбыЪ╔.v┌╪ябF HY.>y░v*║сХQ[/Мю>┤щФ4[[У╗,:╙нэ%Й"ХA2>2@?.O╓ъ╔Ъ├¤Эkцn,─dРz}kЯ╣Ш;│▒└щЬ╓▐мяЎpАРy,у&╣Й▀ В╣aЄх}*░▒ц\╠Q█R╜─ёUOc╙ЇыT%┴■шz╥M┤й▌╖w╖╓бv┌аГЮ0s^╝!bИЯ╪╘,xйчжj6щ]1и╚ЪШiцШ▌лDq╠cSЮ╞г'єн╦6!ж58Ъa<╒#ЮLCMn╝╥У ыд-TМd╨╓╥`√╨I8дч╘UШ╢4г4╬? pыA)Т┼(4┴N&╔ПКx4╠ёNеЫ┼ТR/,@╔ъ{Tcе9j╙N╡*Ю*5*Яz╔г║ЬЙT`╔' ╡k#@хВйmмЫXgя8ўчПCUJ│ o╚╚рzт▓Ю╟\ ╢╥ШI╩ї5┌iТ3┌МБЬ╫РЧ∙▓r22k░╤&khмбХ░╗{Ї ы~╡хуbЬn╖*EЎєГ▐8<ЬUх╗X┴<рМ·╒uI7з╠оkA 2Дv╟└ы^Tэе╚Х║Хб╣6у╚Т?▌╣┌дўчбкЪн┴IрX╒pЕ╢╖qыЪ╗sиI╩░%ЗхЯ╩Ы}╡ВэМТUСШжЬцLJ╫╣F{Wxб╣МЦ/МЪ▌╤╘гЫAОХB╥]╢╨─@+┐Z $WaВ╥ЙMэ╪Кн╕ЄЫ╖ЪРЯNHY0╨╕ Юрца╙5RбВэ9╛∙кm╕┼&WхPp╪?НdУ1&@МЬЬV▓─╘чS8iсa(8Эеє[жЩ2[МЄ{Еy№и╫7Rк╢1╨zV▀┌Ю[ЯyБ'╠┌╬SPf╦`С╗█╥ЭZ╛┘є%k#lII_QЎ╓$з╠q┴8=к─┌zмh8▄p└t▒йдЪ?<гsЮ JЦСС╥WfМОц░u%{│н╔юs^T╥<С╞@`zu,Z|ц0╞P$НБ└ ч9йоRM?T¤╤┬H╣чеmDКк$╞╔6БПZ▐uЬRkйNVF=Г&Ьdiг;Фr╪ъ %▄НyvОЯ.9у┐JТVЪяTbz(рЪОyС|гp╧▒?Е%м╣║Н.е─ЕgO▐.LнлBл`┼\CЮOVd·╠жBиJїюlH▓:УЙофWE2─еуlу°│┴йофдТWдS┬Ы9ы╟_ыYЙiЧ/√╞∙╘░═$ <М╚═╨cВ=3MHЫэr[@О╥2Г╫ЕшП4ov╖gЄ8▓▀6rLSl╠╨▄┤УЕ√Є) ╜╡АвJТч#Ъе>иR7Y"├:№дёЬqS╣&вА╤i■╘╚`оЮЩеТ╩шЕkЕmжk▄▌yq:.v Їны;ЙЮH*s╧SэJд?Д т▐X7Hу/Р└▐п╪j7* ^GщSл<ъб°═Mm╝ё╫ц╣чQIZKR$Ї╘ы№;■Уcp╫Nл ВGЇи╓╥┬уG╣В"Пs.Fу╨ Ў5Бкk╔Б│┤|+Ь▒=═`╟т└ ▀!Vуєое?r)FЎM_╫▒чG Rm╬Ў╗║^Жн╒ДЦvьмдаъO5Х )Bx*>\О+Hът{BН(┴=3\ь╖Y]n╬-╪p}O╜s╙ГХ╤шSц╖╜╕▓[n╕▄чr)С╟^Їыы┘@&╚╞ьFяеQТрd2╗эС░PЇн╕Ї╕~╠▓F╕рa█9╖ЫP│Щг╨чnьБ┐R╥,[╫?Oj░╓W┐┘я░─Q╕,аВ:╒эD::Й <З°АцГ}%╡кC$@3sЬ~\ ╙┌═╞6╘bL├j╦╣Ic╨ЮАSЇЯ:K╟щ├чЬ Ю*╬лbBЛЖV1¤у╪uїлZ-ъirJ╬YpеuJещ7v╞Ў╦MЦk¤ОбUX\ёы]│З╚О_їhа Ўоd\ яМ┬bИtчHОЎ(ХffФМю,p=╜+Ж╗jqsdKGvs■l):╜Ь ┤jFhс╗O4э╚∙Їлw·}┬═nТ(▌└2*(м█P╕К[Д`H─]║zUє┼л▄лн═юn┤шК!YW+щ■yмW╕╕ЖA"╔ДcП/<╓ЭфKР█▄O√С¤сМ:UKчIе╞jpлМєY╥╖m─КWY║╛/┴ ╚а┤▒╣ЯU.г-Б╨`╘Ё╚┼[o▐╟▐л╛y░лЕS╞z╫DдсnИm┘╒ ┼д═ЎЧFvLА;s╓е╨юнх╕Dv┴aЕ у[6С]╦х╔╨rr3┌░m┤┘·VП(иr= r┬pЭ6ЮМФюмv3щV│\G╜ВМdчЪ╧╘tшнц█╠∙▒╡О95^▐ь▄м6╠┼]О▄ Z╣йH╤^$bc│АuщУXj┤0КЬdУaзakЎ!&~lє╧■tЪ~Ыqк▄v|и7>*+ уТyaмF{ЬU═7TС/ИЕДy└pгЮїIъ╣ЎA5(й8%~чGec╥3╩ЖNИ√гyмЭ:╬┌[├╥╣Еi#ЮуЭ*┬Ч╗Фм/╚√┴Nr*╣FDСсgх/OzйJ>эгв№N().dхл№Ююx┤їЕb]╨┼bЄ▌Жq\6е|$▌*В7╢XgАjmzfЮ[prп {~ўV#Ь·╓ ╥╛уь ╥╜Om+-С╢ й╟Щю╟╔ЛДТT╚U#Ь╒4B]Кг~т щЛpq%╕f+ЬЕ┐н,PН═4Гб'Я╬ЕUйшн!XpQП╓оC)╣╗fL,(─F╗O▐Я╟ Т▄Bсх,з#КСc[{}°`═РAЩ·╫<хs6юcj│ЩЩzv"░оЬJy+Р?╞╢я╚ю├ЬЬЄ+Xv│cПщ]╪{$hМY·Ю∙яUфЯЕ^╣^+=л╓з░Kb2qLfтХк2q] sР50╨ZЪyчnЪ┤m╕╥▓Eн>ш└нЭ└й!╜EPТ8жТKШ%zбcZAЛHцЙЦсА9Ч5Ш{╒lэ▌ЬМу4щЄ▌╜Б╤╧&╒o5░JГ·╫A ─V┌i╦ЬЇьjа┤0╕С░╥ЮЩв▐YfGКDGМё┤u▒вгUТйЯ-фоОоC╔╘┴!╗РC╣M├Нм[еhщЎ0*╝─┼·Кбsnc╢Х6,▒└╧┐z╡87╩РюYЗ═╣┤Кe]м>p╟ЬАjЭ╠нwи$RЁ╣ g╡]╙н╠а│ydччoz═єR{Ў%XН╟ЎэD-╠э╨╜╝╢Рх э√╜:К#╘│ ┌\FЕs╗q└е246╥o9НXл ёМїк╥╡иx└┌aЫинc/И √IгШ╙х\ЭББч=kN эЛЬйээQ 9Ш┬╙▀т▓з.Xъ─пmLЙ╝╪н╠╔FbU╘╘Q▌▄║5мЩt УZ║Д ╥BЩ+Ьо▀еRПJ╣Т┌iуQzГ┴уЬ╫T'╚в В╕ мw/;}щ┤Я┌НCpШЬф фvо]"╝Е$ЭХQяKзo╜Ч╩╬pГ°╤VФg vD╩*KSrЄH'%╕%Лrь; УUM╜└╓Dь@XЄG|~╡╤█x|ЫЬa╬ЮЯZ╧╓┤з▒ШKЫ╢6Є=ыТЭH№(Х8╖╩Щпoїгнг∙` ╚ўо^d█nЄ<╣nЬї═oZNc ▒FМц│5╢КH■L+╪оЬ=у.NЕн ╕o$TАд╖╘i┌┼▌─bИИ',TdКуЦ6W]┘+С[╢с╓ F.;p1]8ЪpТ╪7▄╙Ы_2МHI=7УTb╘К╚%┬У░чз╙╥│~╚TрЮ∙щUчYR°mLУ╙ъ!Зз▓Т5ї ╞╗Пl╝С╚9к╤kdGEП{0#Ю╟╓ШЎw%#/╖.9#╡RТ▄G:ЕС\Р√Їн!NЫ\а^╢╗;ў6H'ж03[z5├C~╙ШОцRcэО+ЭPи─оp9▀╜hY\2N%.з@zVuщйE╪╣╨i┌Їн╛=┐99/Му╤]▐[ШД]╙0aiZЭЕ╜╘еa%ж<Т8\·V╝p,┌К■ў`рЮ+╔мТЦК╞JўkaЙc╡ ▄бPР Jд#KЩ╔!a╖УО╡6╗%╙\b6╪ШгO╕М[ЛhФ┤ъyjЫ5d8╖╦vD╙$xИXЬc╨cнh[X%н╣, ╜qЬужk-┤ыы╜AеСGЪПЦ╟B*══ф╓Й┘ХЁ}qБDг{F/pХхвgIn╨hvLжрK<Ях9^¤k ч─N│GnW`m┘└vуКч■▌;┬FЦ?1&вєV╥╫sЦ▄─уmtЄIщ° 4SrЦнЭНї╛с=щ&02?1ўм█т▓╟!ЙВ│°К╚I^у,A+Ьj╥л╠█F@_╬Пbаюnгgr$TОCУЬ ўн8`sk,╥кфcч№цнщ^[ЧvЪl*й<ЮOi╠/l#МК┘f'яК╡WBy╙|иnМЙ EС∙S╕юqБК│й▄B╨nWNXпЧ╬~╜?нQ#╬Л╡:~*ДёьUt,u▄yНdТУ'ТЄц╣М6Ю@ю■uСrwq╙╥┤K|└їЫu┤F'vzWm%ййСsЄЮж│д9$р ╗pс╙йк ^╡%аз▒ TMR=F▄ щGЯPНП┐4╥xнL5в8ф─$╙Iа╙s▐н# H 4╨{RTМd╞Ю)h'ЪBjМ[К?HM&Oе3&╨аЯ╞ФMы∙╥ГэLЪrЪfp:SЕIкdА∙fФgjp5&╔ТNN[О}iФвбЫ┼ТГOS╞j!R)иgL0< ХZаS┼H f╤┘NEдХЧб╟9н╕2¤Ў∙л)MYНё╧ДрЩ█r■ьР▄~?_╓╖Ї√ДФ*У╢D+ч╕ьkЫМЦ ┐#о2kN)К▒╚q\UсubЩ╪┴,Q╚Зчk Ўз▒EoХ░╕,;╓Эr╨MЧ$гВеp┼l*Y┐Uт╝ЪФ╘И╡Йх╖ЦhDЛўА▄▌иноД,┘┌═ВдГ┌н[<Р(3?╚╦МО╟╥и═ж╡╝∙G&nзеDlюЩ)▌┘Х╡9┌Pv8E┴▄AUm.7Оnеz■=jэ╒й.~цGUщ┼KШТY╗б8К▌NЕЛ║H╙╕╗T│▌w!{СэY╨╠юю!_Щ>Хf┌i╟╨НК~Ў:√T╢Р,ўr┬╨АAшG'ыX/vшЕh&fDЛi!lmНйн8f┌%TПtRЁўт│o`┘j╨Б√╚█ЭкХЭ╔╢Ю'з°ЁЮ╒╖':ц[Ц╒╤bъєт` фn■щи.4╣▐;лЦV=Ч=¤ъ╙]╦╞2П)qЭ°уЄкяи ╚6mц7┌г╘їд]Ek|├R═┤▀║ i╟ 1╓▒яd<Г╣6уoФ[L╔p ╣=ЭO<╤╝└▓cыZ╞Убз?Ыnbx╗аўйюн╥╓i%НЗ╚9q№UR╒G╪Y░s╖Ъо╖Тyok)ъ9у9Ў№лFф┌SJ┌■)pс└8╔>Ф╔мцW%╞ЮKpfi6│╦)Г▒ЫАGZ█╘a√5ЫЄЭ╕aЯєщS4й╬╤`┌╜КvўС┌Y]"4rm╬2pqК┴╢Т@П╔;╬N#Ц*bR~nБММ╘╥"?Ф`О0ZэН%ўc▒гnс|ШуbKdуУ╥з╛┤╕╡╢єcхr2з╡R░ТkхУЖyЕk╟sЎлy┘ВХ ╙=ы ОQХ╓└d├<7lТ║%╞яФZZL│├*G*Й%ИБ╟╡`╞й-╙чjН▀0█└ўоК╬hнаЪ{tєei9√▀¤~i╫I+%╕=М╦Ще┐╒cР@·{■о║╝69ВKfLЮЫ?фV5╖Э,═0o-GQ╞)ol&╜x┘ОTйЛqК%6г-РЪOBцбwo2б ■│СГ╟нWОїlтЩPd╗8к│╟=╢ЭфйО@q╟╢z╘R█M vЭ¤П╜\i╞╓╛Г]Й┘ф6√БOU№)кё▄к▓Zм{[ФЮqYп■`Еrx8Їл▒г, ░╧ТзФЬ╫Dав┤╣mnт&└#v╬}кнцбsooхЕсФХ ╡╒╠дС╨тмZ]└aqpКю▄¤+ЧСзvоД,zмFЛaє[БАI 8н МЦс 1МЪв cViShХ╣r к┤Q╟h▓о╓-╦)8у№т▓й╦mрgъ6 ЎIR)rКзёмksиi╤ЦDфб█═tч╚dлА:СО▐їCR╣ТїDV╧Д+╦╥╡гV_W]nЖЯ-─Юt$Югн6р╡┤АHсвРМs╖Пы\▌Ь7!№╥WОHўлУСЩ34|`Ё6·PЁ▐ ╣░X▒{хЄУєb▒гЦ,[БрчК╛Пцз╩~SЬ░и.t╚т`Ay√геtS┤}╓1НrТ∙o∙#%Хшj█▄ЫDA╖,├#╖О╤╞'PшqСЯO■╜[ybАчп.G┐Jtщ╔G@<Їn#┘Ю#5f((ЙТLЖфО╝ ·щe хлТN{СКY╠╫║О0кЛ╬{¤j▄ЫKkl┐-╕єЮ hY═pў"|╢╘!ВГTтКduєFрN@=j▄╙*(╠d╖?ч╡s╘ўЯи┐n7У+]]¤Э[ж9'№*U▒К╞Ї∙9∙╚%А╚┼a┬К"Иg8╔╧OєК╜6а ДфБОGN+Кt▐╤#Ц█я╝@╤^ьК@ЗT9кЮz]б╬IъIм╕U^UcОOj▄╢╥ЮTiC2F:qDу/1Z0DDjЮNET6вI╪рэ╣┼o├lZ▌╝ ╠@е╖┤ВєrДoJ┼Vхtc█X│8HW#q╔нПьЇ┤НO°∙У°[Нл ылp╬╓ўвHbНJЬх@╔тФнц│qЎ┘,AдvшsчO╣ФкJ·шЕ[k█─o""кк7Ьtя°UI"0└`VRТ6I#К▀╣╕6Zh▓I31ФОь{g╙╦jRLЧlО; RВМФbїъgBRЭ▀NЯцJ╥└ЁЕ SКец╞├h?.x╔кBo)°$z╥JсFхlй89ыZFХО┤мAД$оqЬРGJ┼╕Ш0с┐ ╫╣С\цkш!П@`s┼zuже#2g╚кьxз▒ъ*#╥╜Hл═С╡DzS┌г'К┘}F1│QЪСйЖ┤G$╞9жyжхVОizSOт╠WnN3ЬvжЮ*СМЖЪiыяN>Ї╥q═R2РШ╟zLZ8їг╨■Ф╠─ч╫ЪPyщIС╔щJ╜hЬSЖzSGN╘с╓У5ИьЮ)G╡%(═Iк┌Ь 4SЗZЖoуБOZ`цЮ╝ Цt@СsRнB*@k6u┴Уjx╬╓лиуЪХ_hмдОъo╣зo▓зkGМ'+╫╪V Wм .pгйЎЩЩwEЗb0}лК┤esm╦╥▄$H▒/$`ЯRkv╬y─ъ?╩╣(agБе ├ЮA╧Нtzl╦ q*ии'98 ?Хpт`╣t╘MpпЫ/╩ ўыO18М22▓В╣иMСи#1УЮCSA3е┴МaХ╫Х#9═y╢ъfя║кмй&>hЄH=щє╩Л l]╝ч█ЁйЦ! ═,k║╡Еs%7яхH!zщ`TЪ│л2─}╙XO-╙■u╩ўо·KE╨╒iаY╩┼Z ╣G\O?ZЗьэЕ╗c=к┬1│DКабP▄JZFHA∙H>╡нь█PвЙX9╔эГ╓СЙ;8рБ▐еЦ4Жр╞бJБ├┼U╗W╔╪─з╙нkZйШтОPуv:Vнн┼╘FOФ2Г└ъ@оc╦С@Р21ПЫn▐ю|F¤сЇиЭkж+ёNm\ТBО [^╜Оb▒┌│e└-╬yмЯ*цI r╢╞╧$ї5гi`░р( )<V~╬ТЫwanе+{7/╗А╣┴ф╒╧▒<ёвDMкrI╞*V;'*Xu╔╟хS\╠▒┘4Р┬C2ЄzтЙTУj└f▄¤к▄╟ ш▓ 2 й-KBЄM"сх)╓ЩдY╔4╬drфЯо~Х▒-║_юИпЦ╩╚Ъu&гю┐ШО╢ўУэA▒БрОїjkV┤Ы╩y[╔u▄@щЪ╒эLСИFр3ЯяVuю∙ЬoФД<Х╟J╕√ю╔шЪ▐k╡┼╗№∙р(ъ*v░╝[9T╣,╜БфVжЙe Z,А t╔р¤=ъ вlзХт▐ы╘Оуj=│sфП@╣Йgф┤nv░╔ MX╗╣Ф█ьУкЁOййюw╬ВDИЖ` ╘пЪ╬Xою╕<Z┌№╧ЩМ╧┤ХZ}═УЮЮ┤ч╣hn$Є8╧0j[┘╓Б┤ЮaУЖzcYЧ;уrбўdє╞1]1П;┐p:Ы!=їЯЩ.Ж*CY7PЮEG╦п$1з[▌кYl0lч№*7╖7▓З▄X∙ВОyЎм!6Ї@>цYнн>k│K9bЕёЪ┬GO0мeГ75гi н┌y╛Ё2─╤Z)нAХпn┼─ЖM {Т0z╒_▒Is+у(█8╟NХyэрЖIА*ЄIэUв╛хбН▒Ю╡pv^р!ЦKiИ#v▐ \Тw(H─#O°иЮH╫p▐╛╕╟53й/й(uр2Ї5мм▌┌ї╠vё"m'=9+4yн,В2╗ цжТ┌y┴wRа:√UЕhэбDЄ■nфЪ╞/Х[v7I┌ъ{/е2>Yц▀ўIяUеЩсu>[aЄГ▐╢эnФ -Т─g>Фцх√аd╧жJ╠┴Bх8Їз5Л├Ж-Вn=║╒ЧЭ─╠6s╟;│═YX╠ммoЯёб╘ТJрVВ`и▒крС╔9йC%║<ОдR╔х╪╕ ╚"П8\LВBСєdVo]R╨ Zs:йeR@└и╓▌но╠U.y tз9[AН 0?w=кя6▄Х)╗ыI'ow`,;pЫЖО@s╚ЪхX9s└╧Ozнх Р╔&x╫╙вY╘═,дБС╡уУXTЧ*║ 7╩Йўrr╟┌║╔їmbkXЖ╪┘Aaы■N+.]N╪ZK ( ╖имЙ▐ь╞хTВOзQ\й╬nяC SЎоЄ[╞XвLds╚ФУj3mP%a╝▒╞▐j+Ї▓█zЇ-М■оЫ-eФ;чnYFxммв┌{Х&ЦЧ╘╕С┼#═Ч─YЮЬzVМЪ▓Ej▒[|╣\1a╚·{W0оё█yм[ )эT╛▌$МUA┴?{┌оЯ:OР╩Xe7яt:о"X╚/┬s╧R╚оjючtмIуqs╦#&╞$Б╙Ъг+~щ┐ЗЮ╡е*vwfЁВИ╔e┴▄?J╬√^╓'є┤Ч?#vAц│цp╞1ы^Н:J╞Е╫╜(0P·╒)жV]ш[wCь*У╩O~╜iл!╬x·W\hеи (╬Xt=к│К╡&9"а*$kв,╩дo▒]НF▌)яРpz╙ у▓<┘▒ЖШi╠iМj╤╦64╙ЬM4╒гЪCM4╙Йь)ДфUг0>╞Ы╧╡)д=iЩ1чКM╟√┤g=h╧╥Щ ОгМ╥МГК2I4н1!∙тФ{S{})└╘Ъж8tзLБN╧нIкc┴з nM(йf╔ТКPj0qR.▌├q;s╬=*╝XЁsS ╟^┤╚╫╜?<√Vlэжнл$-█4Ык▄╥цХН=е╔ГUШоdЛю63╫▐йБR)йФS▄╓ЭFu║MЄ╡жnrz╒╣I∙ 98ч╥╣;Y`аї5╖юQ╣ЖцVаг+гнjоj[ы orк─┤]ЇоЖО~CЄ╣H=+ПdD6▒═li7дI╠ Г├═qb(лsDMФЬ%xМТ+i!Л╩.zф`╓uъLЧ,╦08√┴╜)╧к▓╠IЧ╬╓\|╡Zтт+ЗiЬэ8э╥╡з й]Бj┌т┘-╔yw░';╗{U+Лз╖╡r0TЬёКе∙l─H╕n}ъСЄф▐Ж@╣╔ч·WT(л▄b╟╡Zттi&%▓ =* ┼Х%ОAВ:SМ%в╕7b╒╠п'╔pY▄Їчблq┼mnм┼ГяvкQ╞&M╦╞0}jтY\BЕ%И!є╓жvJ╫░.%П!г$7ишj═нзЬ┼ЪBп═Г═6▐8c▐оБўq═>┘Э. Ю^b МzПJ$Ї┤@Кы|м@'hрф╒xаh▀яsЮХеpщUT=EcЙJ╥Яzкm╕ш╙в ┬╔c╓е┤Ь3#╚$чнG4╞шмj6ВsR¤ТXв(м1╗ишxжэ╦i╜¤г%╒мpХGwцл╩И╥ЦNгМ·UьЎ┘▄ws╙╡S╕╣{АА}Ё▀{5╧ *■ю└k\D'u+є0pн]Kcц }к=╬s┼sттkwU#цщ┼_[йчН╤▒У╨■зNI-t╞гn 9ЙГ╩▄№╝`╒;HоМ√╔!Jубе┤vЮn°╦░^ж{■┤√}цт7lьROо=*9▄SИ╛Ч4бжe ╬Fу╨тк П░1T_Э╬ж+▓}B5┤duЇ∙G+iцъхШкН┐wМV4л╢Я┤Z >цlH$У3\єМЎлйз~ў>V7В(Т7│∙г@╠╟zR[▌▄%╠Е╨я'ючНi)JJё+┘эЖ_▐/ЩЁ░ =й┌TТ>Ъу$lg╨TQZ_^▌╗ЩT)?6OL╓╝(иd╡╡╩ ╦║Б╚мjJ╤хnяЄ)и03$дH═ўJsГю=(╣Р< ЄИ╬8 ЮkCID╖є'▌qР'w╡P╝&KйgС▒╬qКДя!_R].їмоWй┘Х╓╢M█, ь─&r{d╓ A9Млэ╟VЇrтъ%[ц█■нWЬч╓▒лi+ ┼7▒BЄхОсТS╘qУш) э;dИ#cхо=ъu▒(ВъффШ╙╘·Ъп9iC│╢XЪ┌<пDQ]nNNIыы╥л▄▄Е}∙┼8эEc╓│ч╬rsМТ uB ▒Хоe┴8м∙%-∙цдЮBкМ╒ш╙ЕРе+jM┘яM'▐Э▌╪9┴Їнмa╠█▒819ыQХ┌A╟Ь╔хЇ9НKмСШ▄Ў∙OеEэк6▀}╩У'Ш ERj╜&SЯJВт<йСzв╢Г8q0╜┌▄кiЖЬiж╢GЧ!Н╥ЪsJz╙OJ┤s╚BiзыJ╞ЪOH╞L\SXRУHyкFRcN;ЪL{╥УF▀aL╧}Д╬е8i╣╔=Е(а╘p'm(Ўд¤iGZFИx'г╡3╡8╥д╒1рёNщL)Aй5LРz|▄TCыV T╦DtRўеb|`R9 cё4QH▀7╓▓HюЬФPIu4Єyуе6√┴╬),xцЩЬ^ДАЬTАУPч╡<M┬Dъ╪щVьc╪O|╒0▄╘а╓RН╬╩s4`Э╘иAї╬3ZЁ▄OрхЖ9т╣фrзkv├ТsЮMrVз~ЗVчeiz│╞▒4А╬1┤Ї5м7вЗLоFH#·╫ ┴є7#╚ ╫]жjъ╘B_2/z╫ЛЙася-МфЛцv(оF>`y╟╜TТ┌R ╞ #їл 8@й *╦└n╣─╥#Fъкb|М╞╬kЦ7OBU╓─1╧#"#л6N▄чХкЧvў.Оо°чхu=к╠▒ЧХ%╢'╞╣·~57Ш▓er;gнhе╩юЛЇ3mo▐╤UЖ╣'╛jэ╕Оъ]кc╨·wкОл"┤oTаЄ)╗TB&ОFИ/ПZ╥I=zНЦ▒ЩгЯП/РGqD[О|ж ╧ ЮE(╖y╩П0▒#╬IРГ╙■эЛ:Э,Kb╞vЦYAbx qПє═HвGIRGWLaUЕ: МgхРМБыэYНЎЫV_ШгNsМ╒┼9н┴jOlР┬З═АЭю}ja!Ъ3"U╞╬1Tр7:?ЧФЮ╝{*╡y=╕щ г0╪уыU%яj2ЮЪШШлйNy╓Е▌ёKдH╨Ь.8юjm╠╓n┼╩H%ЗыU.moc_┤DDмx▄8╞)╡╧V 7│┘▐ИЭ7юх╢ўЇ№kBт(я%X q╕уЯhЧ7,▐kИд└!П9ж═qqe+,ю$∙{UJЧ╗║:Moo1.ДuшjХ╞║й#Aє bи^]=╞B эяэU|▐\йО∙№+жxя!╪Ъ+Г$╥mЦуч5;iЧкЕ╬╙*пn╛D▐dC?И·TєI}#yБ╦ч kY]K▌╪е▓p╔ФhPp Aк7VIчП╕Г╫═h ЛЛи╔Ю0√{╨ы$1лa0Nс╪╒╞rЛ╫p(*Ис&NO^i-МrВC╘gе9╫╧}О@·TЪ}К}ил╟╕  т┤m(╢└aE╖~W j%hчМdУОК{U√ФX/Qd;Г~5 їТ3т ┴?3TFi┤╪hшзАCыHnfТAЧg┌█╛jЮH>╧╡СБ<С╞jHнфШяНz)╞q[9Gpfi$╦А╣└рbе√|vVа".ьрЇР▄`Я("фЬ╙m"O=бxюy¤+&в╓╗P┤Мнq1'vF°Rд)"л.r9щZv╩╫m╠Дй`poJЮг`<Ш┴8узZзU(▌T[╔∙Ф2.╞:К▌{ыmB$)╬2:Я╞гЯI╘ф╡D▐Xn╛╒Нu╡p j▓ВGzч┤k[]╗ F:{╦G▐и[Йм╪пLq▓*ВY│╕╓Ф┌K[█3АXЕ9у╓и[ZАс╪Х$рg№т║i√>WmA▀б42#Ш╠Д∙jqО╡┐ОIТ$БК:YiзHЎ╚Е╢Э╪╓хСЪ▄Kj╬! rт&нюНУn╖И7Ц╜▀п5imЦ$єж^Щ┬╖AR┌ше4ї╕║qЖT╖БЭ╦рЕь╣ш*ФЧ╖▌┼@$U┴угТupxоИRKDВ┴4▄0qY│Lv7й4∙s╬9кSH1┴ъs]Фр2╗╖&б&Ю╞в&╗9jJь дFч∙RH:ёWcЯЫSMN√p їу╡V лSнШПбSЖ0={V;3╜{╤LG`ы▒╗t5TnM╤║╒;rа╘d ишjубХUwжц{о и═O8├g┐н@kж:г├к╣d╨╥)Зе8тЪzVИхУE!еnФ╙щTМd4О╘═╥>┤╠ЭД#4sы·╥Рi7{╒╢оТN╜)F}h╚ы№и╜hТ})A╔4└HрG╫┌СкcйG▐▐╘атд┤╟ч"ЧЪh4сH╒1▌к№CjеQNXb┤W1°V5шр╓нН#ф&лHrчpоc#╓и░!╩╥Бо%4Рї╚фОй"mК═Юq┼7заZkааьhzшL}╧xNqR+ХувЬ 2%ЪРДСMKGD$X ╥жОLэUAйл'║Ь═ЫiWz+1ы╬9т╢сТ+▐Fь╥СУ\ФrФ`AщZ╓│yСю'Р1\5щu:7;?UЛPa╞<└;t=к┴ЕmЬ(&H╪ЬГ╞▀Cїф■Х┬+еdbнuЦДwDG)┌сx|╫Щ_ь¤шь╔q▒q╡╙я#│Э█Ej[┘▌У1╛ a█ъ* н9&p└Ё├ГЮ3RY█(FОPx╝ГX>N[н┼e╕в6ОO1tг<З4╪уiЛHBг├!ю=йНd▒NT╚LGТ3▐жFLзЕm@ЦMm#╚МvГХ╖╡Yц)ЩЛo╟ Э╗ПыКпjцI Й▓зхЎ4═CўO.▌p}*м▄мў BЄC(▐Ы]GчH═=┼в╧№#Тг╢=*▄С┌]├ЫИў`85ZaЙ╢nrЗМїн"╫-Т╒ ╙Кт8"▌".$╟╠гО*+╣mwlШ)Н╚╔Їм▌F26╝rЛ╨╓T╙Юr┼█┌Кxu/y1$h^\pV┌|!ззz╣o-╙Бr╚8┴kЭЕТ┬J~BsЇг=╙щє$ЎоrO╦Пєы[╬Ц╤CeлЛХ┤ШйP░оп|щЬ 22:Ъ}╘э7Шя"юnjБЙИ*G▐9╓Їi(л╜╞ДЗPС╣╔уУVJ<°ЩЇрbйЛS░Э╕8щМтнC,╤&R║>8ъ{WD╥▐ C╣ХБv=xзyюЮ и▀&{К│f#Юь$о▒┤М╚ш?MN╚█▌IrВ╜Иtм∙╙Ч+ZБfX╒\▓ЮДї=╬▓л╚[ЪвУ▓─Юa @┴╘єг┤A╔UМОsГяI╟Upm√РcХvz1цЬЖ5f(Y ╫Ьтл5╕ ТF╟9фМе$═"HКТ ╘М{UZ·\ ╙J~╨d|Э▌N1W-фєЙдFsщUefКm▓┼▀гV╜╜╓ш!МZБO$c5UвмАйw▄┼√╡сp1ъiрЫ3√╠+рЖр\A7Ш┤ls┤vнл╪ЫQНZHЦ"Л╗;║╓RЧ*IьdЛчл╗╚╟ХSКtVP ▓I6║ЪXэрД>─%ЬtЇЇл▀gЬ┴!Уhpу ╫S)█D└О√Fє`iaРIБ╣╞zbЩhвFo▐F▐1Ъ]:Ї├░;уpуОi│[,0я'ч?ЭEхЁIБж╖w┌∙q╦╕Рr·W>╓╥═:.x╚$чУЇйэцЭБ`(у**{(хЬ0\Т2└:q^╩Ўёмq■юfУ╩$╛∙кsLШ╤2╛Rz√U∙lЩэ┘ЦCцч╢? В%!Дд( 1╘К#(яp*ip▄╧#U∙kг■╦VRЄ$q╥к┘X╝h&Ю]аО╕н3}DdYЕ|r}ы їe){Вe╦НUьЇф╢╜T ф*╠-3ЙгО8Гp9кbRd▀3ч╛jkлИх╒JG╞qY*v╙rTR╪┌В╔ ╗lbо├СЬГЇк╔зoРФо╙╨v·Ri7 кF█Ю0jЇ─ЩЖ`їоy9╞M\Z▐┼kЫ8└"╞Lрф■╡Jцl└m┴з┌~ХfY┬H6&т:К╔Ю=ўM(РВ¤;╓┤У{▓Рх╕eИЧbNК╛ЮїgэЛBХ@щ╘╒Xэх7yйчТjvS#ь\tхЫ▒нdв╞Vi^iХ╖byB8pA<Ч-╪dПхQ┌ЛxеЧ;╗╓кj╥╡№f4┬╨ч4э═.Uв;нH▄и╗#QЄнTYI┼5lе╟ 6О└ёL0╡}k9 Яz╤П╜cPЇЁOб2▓в9t▄0@ч8ыTю мй▌═BFЁ╦Пj╩:3о║цКDJ▄УУ╥г',i█X`p ф╘yнТ<∙I┌╠xзfгКp44С 5 5зГP╤╤ ┼HЪГ4рj:c2└j│╦!╞N╙TГbдVмхнNкu56╦*p┘й`╗Є▀Т├ОqY1KГ╧#лРХ#кЯйоi╙Iju&Ъ:▌/YОi<╣О▀F╔╟нn█I╗"7 с[йЎп8РXБ╙о+в╥їАРьФС╖бZє18M9а у╠УюРHщN▓О ч╟╣A%Ы84╦Х╝И╞sО╜iЄ6├│~¤╓їоuюТї╨б;¤ЪщqЄ■юс╨√√QxЖц5┌╪Ї W.Ц5$ИГ╬)Ч)@п╞м+H╦g╘w3ДEСвg ╚*Vи▄▄nv,пl╒∙W$H эПo■╡TФмА░`╠:ш+ж e;╗ц,B7▐==)╢ёyaЄ∙Ч┐Z╣VЧ',Ш└■ >╡├╬Z@└Т?ЭnдТхC"M:i╚(М─Ї^їcy~QГЕ√┘ъ*5╛kyПШ№П^╞┤╓їoм@aЧ╬C ч3Ф╒ЫZч▄ЕК@WЧМтЭF ьГzєVю-DnLМJїтТ╚█KTIАСЖf╡ч\╖C"О:\ПЧwo╥мд(&tР∙~f^З№ЪКk\╩QYЙ╬0JXdТ│a╧Bю*[║╤Б╓┬шTRSЬО╝Uy.∙XЦnДg╡\i~╧;Б╔9╟jd│,ь_jє¤▀Jи╖╫`(┘BТM╞SКЮєИ╩▓6╥8чЩ,MБМу¤Ю╡`█mД─рgЗ═Т3W)+жa░7^d|0U╧ыQ¤ЪdАЫИ░Э─уЯZщt╣тKгЙ308%╟■ХS─Бg;▒╖#цPr╥╣у^Nз#Z ·Ь▐чЦ_Э ЮIн%╕EНc▄еBУ┤ЬОxтлX▄5ЙiWk|дaЖXP▌~Ё*ЭДЬО+жj√ьЖl@ЙolЧnFшIщ┼g╦дЙтds╨S^ЎI8U@U<Я┬п_[4й$А ¤kЭ' k╗╜Ь&EС0х╢ЬsА*VЧuи1+яЪ╠ОfyV3╟Ёч=кVЖDЯ r╕эя╥┤Ф5╘ЙcQ╜╒Ж╙ЬГ╓Ьпqи:ГЯ,Ю3S}Кq8 ╛ДрTНj╤Я&¤уcn├┬╥sП╠ AgнТох'║·Пj─С&╕Ч`Йcё╡│°╒рЧ╢RG ╚О╜└╒╪Ї+┘д▐g▐ЬsЇоx═S╓Nў%┤╖2жYУtaЫf>w>Х=СИА%ФТ╦Тjyбrэ█)ЄНЗКпin..Z=д=╞jЬУОг4)онWtmцХ └ TriW"e0зС╚╞*╫█K╚fU<р╒й ╖)nД╖кўо_i8┐!]Ь¤╠&┌@КGШ9lЎ·Q Р02G╗°╚└н√m1╗▄\Ь Ьта╕╖Д2ХB▐дt·╒кщ√адЩB5,╗╢;Ъ╤ОUt@╠OcЪн=╥l¤┌Д TnL╣щ▐УЛТ╗ехЙ )╧╡A5ФJфю;√fпZ7ё8╚у╓Щqф╩┼Шa╜bд╘м+ъg╟FS╖&СеКуЙ№ {▄E%A'▀бм╦╦╕х┴Uф zшД\▐г#╕║─Ц╟?tsU$╘#НH▌шiN╙Яs╙╓л╔j ╧нv┬Z1СЭHУА╪Х)╕iБ9т▓е╖d 6жЛхnЮ╛Х╒ьb╒т&╥▄╫i7├В"▒е?;VТ╛фcР g\п╬i╤Vv▒U│QУO▌ЬОЇ╞о┤qO]Ж╛╘ЯxтЧ┐5:Fў5M╪╩0scQ0╡(└Z╓?Хg╣╘ТКyд)╚>l·S!j┼s█╥лфbдc╕УщQ┐ UgVW╘L№ЗЪн"ВБ╗цж╔╞C!ўнc╣┴YзJчыM#КRi╛╪нСцIИ@SHЎе'М╙Iтй╔а4╥;P╟КCяTd╪З┼'╧ы·╨H╟j7 ╜L╬шNЇ╜щ3ЬЮЇАчо)Уq ╥М√КLё▐ОЗа╞qHлО┴щN╚┼7╢{╥ВХ"╙$·■┤вЪr;╥чХ&ў$^в┤a?*√╓bРAнП╚=лиЇpR╒Т╟├▓ЪНО┘└їяO'ўЩ┘╙xупQY-╬∙▀ЧNГ&Аэїк╝Їн1Ч╢ ОGZ╧x▌т0=jс.Мц┼R╡е╕╬zbФ╙sыN5б╚Щ"Юi┘иБзfегh╠У4ЁMD 8ЦНг"Q╓дSPцЮ С8jХ$█╞2 V яOVиq:бR┼и▄Ж╚8┼[Оp╕єяY╩°зЖме ЭQЪf▌Юж╓УЙbl(<ПZымї[k°║ьФ<В}л╬СЎЬўэVрЬж═╣8╚т╕qH╘╫йV╣ш0R┴O<фОjЩСOC▐░4┐IмS6°А└ї╓√╔э╖Щк@ ё╘WЩ:2е+Ih#1оZud1ТрГ╟╡Q@Л0I▓Pї┴р╓Дщ<#gп╖═YЄяХUa╟nyокvщ░╔<Сjссf+ЬА9#ыN╣╘ЩвQ;0√╘ЦЧ>CпШгx└∙╗T7иLм \ЮWg▌цй+╦▐Ю╙ ▐рц╡┤л╕ьЙ▌R╟8жCe" ▓*МО╕-Ф3&Lж;Пю799эU9BKХьэvцс╩к┤O╚оiЁ@-][ц▐дАЗ$}Ef¤Щб ДМ1╥зHnннг╕МчЮJЮk┼5h▒ ▒╢╕{ЩФJW W\1№*╠ЎЧ\цa╖p╬q╞jXnmя1чюY╞Ш╝7▒иж║╗yЦ9n╖┬╜3╤кжх╪5*╦n"оЦч'М╒TО▐#Ж v=*k╗┴%╧B(└Q═Wv236╤Г└n╡╤+j2х╜╠QLГ!Ж╙┴№щН-╗3:&Зпj[XJ|╥ ┴▒¤j-GLh%#НМ╣∙{TоN{\F▓▐Y eE пХpзйo╜═A>Щ1Е.^HфМУ┬┐#ъ+8╓уrЫНЫ~юъ╘▒ Lм█У╣езьїЛ XС┤еh ╤▓э√╕'е$╓┌@╛Cяb2FGZXQХ7Я,ёМтна Я%│yC■Z/еCФ╓ь 6ЖhЗШаЙ3╙─2▄(Iе$Б]%╞ЪЛjn$╕eММо;Y▐]жт"СЙ╬Lм╕д+й-цL┴э_СЬўыКЪ▐■dЗў1У╕р▒лm@|с2wpEY√,v╢шcp√╫%vу╨U╩д\U╒╞U╕Жk▀ЪM╦╧9n*эШЦ╩▀1I 2╞H№jХgМТ<╛╪-Ь╒┐1 Г╦dNG▓Ыvх╖╚D╛o┘AСФЧ=й│k╩╣2л■Є╫╪]IlуОyTUO▌э°Ъ║У▄,═╣┴p▌ПOёи#╒R 'К╥╠nfхШМтеЦdТ% 2I'еg4як'W║$ТIдКO║▌║╒WЮCХцЇкТy@B╜px4┘уТ`З?.~чP}ъгM-╩Hз,Н4д ╖AW !еUjч╓Ы5и 3╔8ч╡HИ╝m7й┤дЪ╨fЕ╡╪╖╠Y$rMT╗╛ ! Гз<їжN№╣┴=}qTЭЧ/'еg qoШI-╩ў∙8=╛ХPЄ╥FZСўo┘МТxмл╦│ ж!╡Иэ<^Н(_DQлVсZIцвўnї^_ClфY█л№O╙?J└ТwРх╪ЪА╖=kж8T▌чйФк$jjz╠┌ж╙,0г/x╫nk;╠╧ ═FZЩ║║aN1\▒FкhArPИ┘▓ЭПе-└$√К╧Y6¤*Ўс"фcеLбgsjU╙EI<О┤▄2ТA┴T╬ЬёHшkDЇ2Х?xН#∙▓zS╧5!8иШ╤{Н┼Ah&ьqHM0ЬУN^i╪╦Ю·М╥Е4жгvу-G'╩Жл∙еУЕF4№oЛ>Х~g:wM9Є┬░к╬┘9═X╕ V>╡PЯj┌ йцт%g╩╙Fi╣н'! !аЮi ыTМЫ╫КkqМ╨O_JBriг)0└гцЪN:ЇїгёжE╨▄qH={Q╗┌Ч┐^jМ┤МО1яK╫ёIЬRфtд]╨ю@╧j"Р(╬1╧jEвN╘лэщMїзobбsХыRmЗз *ЇmБПjа Uи█ zт│Ъ╣█ЕЯ+-ГO√╔ю*┘LОвЭЩ5ГGзКЎ}K1>#№jд╥ю М8эSОЯZКXC └Ъ#dї*┤з(Z= Щеi]1С╟jh8н╧*═;1╘вЩЪx?ZEж:Ю5isR╤мdKЮi┴к,╙Бйh╓3$еOZДsRR╤╤ND╣цдSPце Y┤u╙Щ(4їzоЬКЧx╘-╟"Г╬jхнЇ╢╠|╖+╗п?Нenз+Рx5Ьйж╡5SLыь|@МытюN┼G#їнKН6 т3[╕t'!│╥╝■9 Ю╡ел4`СЧ9т╕*р┌wжь=Ў7.э╢аfc╕ Pj╝ З*фТ╕Ю1O▓╫бx╠wимыяS╦м╤ю┤ud'I╔П╜vhcb╦M├g╫МU∙aТHт3*нўу8"к└═▐OРМU╕█ўgеq╫w╜c6яt#:ъРРI1цТй6∙q@Вk`∙22)XeY>ёEUЪ┬╩#╛я ф=lКqкЪ┤Р\╧/╞╫O.PsХ Ym╕u [┐Z╙О╕П0О|№┴┐J═Ю┴╓sШ'vAн\gэ░-ь▌ yXrЎеx╞0└╧S┼_В█╩S f█ЬАkAc▓ДЦ╤ММ╕╧бї┼9V│ю0m╖ф╖▐\ЮOj│3┐С┬╗Мr┘╚nk'u∙f П╚чЎж-╗ LR░╦/%ZЗR/P1М╨О#'ЬўлVЮ\Fч%╣уЮ>Хн6РdГўr╟&8 ╧Г╙╡Pm"v╟ Ю╪╓йVД╒Ы Цт░▓╗╢h╞%-╕3/┌е{;Л{!oЎЄ╤и?*· ЕTk'В(фP@'1фщV(-$KЗv FCп С█Ъ┴╖} ╠ #Тю[И#^Ю`╚╟╕к6ЁL╫ ╖3&╞хЖ85еqx┌ЩH#У.GуХe▌├wi╠эРFxэNЭїZ&┴..Ц HЕc9р№╝╘k#╚э├їкЦўEq┴8╟&о┴nа┤▒#ц┌p1Vта╡е─F6*юъа)┼ZО;Л┤Eh┐tЗйл▓+!]c▄0s╔и№й!╡]│╟?П5╥щwh4°bЕо'СI Л╬*╡ъдЗjВДЯЧ░з[`╛╪╫tЫ│Ь╓┤>I KЧd Еe)╕JяQlg┬ЯgTХю└9!╖wIvpл"Б№Y╞j√╠▒;м╤ю№аGсTЯ╩ЭПЩ┤ чъ#+╛fАмТ╕НХ0s╨ї═]▓░ю╗ВЬpOZОhуX├' юиf╫Ц╒pОwcМtлjSVВ~ЖФvСм╣$|╜A■ФТmI┘░01╨V$╛!SЄМJЎн┤╠нaK``╘.F)╠p)╧'╡R╨╬m╦AШщRD└da<╥М v╣ТЧ+╣┘├c╡U8╞j┼╤Б═V'К▐ C╩─╦ўМJC■qIFkCС░=)Мxї4ыTf╪ДcГH}:Pzїйs╟Ї╠█Їд╔аЮ╞МWжgш!VS╙н'╛3Їг<╤ЪfwA╪КPъLёэF{Г@╒Зу╢hП_н79ыJхЪEжЗ■4у╔╞н0tтА{qСH╤2TaЪ▒@·кh╚й╘фиТ:и╔"╥╘y┘&=hV╚╬yяK"яLОаqяY[S╣╢уu╨░дМ¤)rT 1U▓№пСщSЗ╚Ю}jMсY?RIWtьЮу╡TТ3;ГVГcщJq┤МeOjhu)╞ж╜J$эJ(v├}:R╥╡84N├∙ежяOU$ё╥У..ю╚pыOU└цР╛цЭ█'ЄиlшМ{О╜(ф╘e╣з/'мjенЙSУRЮ:╙pd╘EўЛ\щцPV{ТюцЧuA║ЬС╓ЗFб2╖=iск╘р▄╘┤kЕА▄╙Г╒`ЇЁ╒.&╤кYVч&н┼wхХ┌_╢qЪ╬NЪ╬P╛чDj&tЦЪ╟ J▀/z╓ЛR┤┴┌U2Iя\@РББR-├>c╟╜rT┴╞[t╬·)CАcrqРhk┼GV@┬SЭ┘оZ-c╚╡П┐Мцд┤ё╞Ьб╚W#┴╧W`:╚d╖Х|щlффл4Q∙√ЙЮБO▒О┐nыЧЛ▓0;Uж╣┤ХХф9эЪ╦╪N[ЕЙ ╤1F`;.jЎАH9╞юj╥Руу^iСж╔▓@<Ї?╓йJ└SТix┘╞ЛА_GА└|╚TIМ(tлШМГ¤cn0г┐zДщo$ХФcа9═'8┤па М┘┼ГчH_║РqZV╫а─ЎёH╗И∙wёК╬╖▒EЦ5Ю6╧rзилЄbW┼╛ю1ЮЬVu9^ЫГ)▄мСD^сF▄ёГ╔кЁн╜╙mР░▄оЫ┼ЄI1Жa╧╠3UрH╬▐JGУЬЕчщWklЗЎdqн╚¤▀.яыY│^╟p┼ЬG╤░▌~┤бЭЧa╕юxй!Ж╛y9╧БB\║╔▌Бv╨%X╪о1OQПц▀ХрА╪н┤@Рё├ЧЭViW!ї5*r{Б,qгТ├ж▐ч?■к░╢░Ыd╩Ж╞~ё╚їUю НЙ∙SБўG.╡╡▒DLГ╨ЪЗ ╦сF╝И|▀%7zГ╙щTnф.╤▓╚╚QГЮ°╓lЮ%o(Т2j─╗╒еЭБ @Їнщa*9^AnчS.ехг<Т9ъ╡f═о(╦A╔ч&╣╞║vъ═╧\ЪЙе,y=k▓(н┬щєjВт?▐╔┤gЕ▌Yє\BюдJ▌I√╣м▌Ї┬ї╙ :О─:Й┌Ёd ─7S╥Ш.┴Уq.>Н╓йжЦнU$Cм^[ИРУ┤╢{V,/mг╕─щ╡OёvЪ╚▀═иtУV'█Ыzж▒ч■ъ;ёgнb╔д-L'ЪкtгdcRн╟жцУu75нМ╟fh-M═4Ме!IжцРЪB}*мdф:зАчхэ╘╒lцнк∙iПт=je▒╡ ereЫpi▌* тР╣їм∙N▀keйbЫ▐вYyцЯ║ХКUЕ4▐)sЪkSD╔С╖'Ъ╜)щM"ичdy∙Е╜Ад#Ь╘*√е╞q┌┤Jч,з╦г9сMA┼MpFBО╒XЯj┌+C╠п/}КOсIЪBi?╧g3bЯzfA=щI8д9№iЩ╢ ьi:ёA9яM'Jвф:╤СэHzQ°╬Вn3┤╝УMг╜QН╟cАE'е=zPVБ╪╙АрfЫЮ┘ає▐Р╙░№q┌Р~┤Ф{╨U╟ЎцеКMЩХяPg#из/▒йjцРЫЛ║/Е■%9ZХW╙Рk>9МdO╜^ОtУОЖ░ЬZ=L=hO╔МТыГND8√└КЬаeыЪИB съy┤7tm+д*>3СS($┬вЄъ е<Nф╘╗t6з╠╛!^dc┤У╪Tg8Йлk =й]7QIIгI╨ДїEO)й╔ЎзaЫ╪Tе{SIS▄■T∙оgь╘t@_н4▒ni╟╩'Уюi~╨ЙўTS╘ЧmЫ▓acВ~QяRoHЖЦїиv~з╨SQ╩▐тЎ░ОР√╔KЦ9&МєQnз┼;к\x<╙БиБзд╤qЩ 4ь╘AЕ.ъV4S&Ь C║Ь▐егX╠Ш58Tй█°й▒▓иM║ЧuW▌F№Q╩5X▒╛Н°к√щwRх╖,зЙ ╕ Є*о·]ЇЬKUН╝СP№Ц╬jXїIТrх╔╧QY[ё▐Ф=Cе╨╤b ╕ї╗Д^$9▌╟░л°Охг оTч$рsэ\ш|Rям▐Ыw▒j╣╙╟тgЄPH╗ЬdБNo31>SС╧5╦ )w╘}NЧa√doH╪╩&QПzХ5х9WN ·W7╛НїO O░╜║7?╖fU!Vь}й_\ЦAєtЎяX{ш/яG╒б╪~┘нк╠╥ЮжIйLрЖs╖У╥│<╩B№Uк1]ыг@▌ПОsMТэфMм{цизoкЎiпrr№Tl▄╙7╙YкФHХ[бх∙д/Qд▀U╩bъТЦжЦцг▌Ajj$:╖║УuFZН▄╙▒ЫиIЪM╘═╘Б╣зa:ДЩжУ═7u&ъ,KШтyжцМКL╙▒AЪL╥nцУ5V3rЪnyдг4ьCС< Ц▄{T∙╔жD1ўцЬ╜═dїg}5╦АЮiДК uиЭ╕4╥"s▒"░фЪBЄbв▌Де╖ ╣4┌╨═T|╔Хw/j6jh▒В,Б∙Nт}лk3╙ЎjQ╣Ltжї5!5 6╙Z-NY√╗НУ`КкTгэVOZo}лHшqUJoBУфўи╧jHx%*кро2+x╗Ю]h8╜FУ° 3яЯйгv?╬У'╥мцlAIыHN:NЬ╙!░"Гы█┌РЇ╬(┤ЬQ▐БЛы═ г╓└№гкnтФZ~═ёsor╧┌$╬sMi║╡@OсK╗<╤╩ЙЎ╥z6IЯJ3QЦщsКv:$я▐Б№йЫ╗╥ГСJ┼)═.y┼F ;4мRР№╙БЇ5<╥ЖЇ4мhдH)EG╗ЪvъV-I p5ьRютж╞кhР5╘e╜ш▌яEЗэ 21FъМ5╕в┴э Їе╧5ъ7R▒Jd╗йwsPяе▌EЖкфRцб▌K║ХКU ГqK║а▌K║ОRХRP╘╗к╘╗йrНU% FъЗw╜ихjLФУМуПZЗu│G(¤оДбй T[и▌N─║ЪЖе PютА▐┤rНU&═#f■(-J├u4"Р╡7u4╢ RFRШ№╤ЪМ╡!ni╪Ч2L╥fЩ║Уv %╠У4gЪfi7QasТfУ<╙wRdS░sП╧ЩжцУ4XNc═74Ы▒IЬS▒Bч╓МєM╧╜зb\Л└№гщKЯФ╘h┘М}(╧▒▒шйшёU▄№╒=WУЖлЙ═Y╗sБ°R[╛ ═6BqQ+`цй+г TхЪfмl9їзю=ы:9ёЬ╘щ8lєX╩ Їйbв╒ЛыКмч,EI┐ф&к╩°&Ьcйъл╗С╚щЮФ, ЕBь[ЁтЫОyЇоХc┼uдеюЧCфЪkaP/╦╤│Їй3╞EMмnкs+2Пh╬j#V╧╠*┤Г └╞9н"╬*╨KT0єMыGхКСVr╢)8╙╧Єїд'=щТ╪╣└д▄╛ФbУ>Ї╔╕┌QIE2╞(г4PЎдг4Rю╧9д└╟&У'Ёеаwtг`d╥dP:Ш№v?■ктУ>ФR*шy┼/иє┼.x═+д;┌Ь╦╧Jfs№йAчРiШ№q═*Оz╙ cО▀J7qJ┼є$╟╛ЬS│ъ0▒№йwQaй4гиўuзgJV)IяJZП4р▀Йеb╘Зї ╥О0]▄V-HzQ╫ЪМ7чN╧Xе!└╙єКИ]╪8еb╘мIЯz\тг▌═ун+╬?4╜к-╪╣╚в└ж?9еи├Rюв├RCєKЯzП9╗йXоqЇдтг▌Fъ, hРzRj=╘╗йXе1р·╥цг═│EКч$═эQю═)jVq∙цВiЩгu8№╨M34fЛ8№ёIЪh4Е╕в┬ч$МєQюгvi╪9╔sFiЫ╕тУ4мW8ЄiдєI║ЪOzi)О═жfВi╪З1┘г4╥i цЛ ╚~xгu3u&h░╣╔3I╗Ъni2{╤`sЪ3°╙3ыFъvaфєM═&sIEЙrЪ3═74Щ4ь'"╒╗їSScУT╚lК╝2ЖФ╒Э╬▄=E(ЄЎ╘n3═<Ї4╓4 rNHж┌▒1М╣Й╦№╡]■bi╠╒┐╦М╘┼╓й}└ }▐MFy94n>дS їнR8%5bEluщR╜zЇк∙уе>#╬╥r;P╨Bж╢$╧ оЪ 0эЪW8їжu·╥E═╜ИЯПjL zbЬ¤3L O\ g9н╟-─р╤▐К 3;ЗQI∙~tзNi9■ящL┌(вЩШ┤RvвБЛE&hавК(hЮ)(д;Л╥Ч#н&h╬╕ьКQ╙жgО┤╗╕┼"ФЗcК^а╙w{QУ╨У╓ВоЗQКL╤Hwp)▌┐╞ШHфуЁ┼.iШуМ╨1Т)д·Ё)r ч╨4╨язJ_єКn{╥чЬwдZcё╓ЧнGСТе'4мZРсэN╚жgЪP~ФЖд8i┘иєїа╢;╤bФЗчЪ\╘y№щsПе+ HwъМis┌Л Hpе╧Єжnг?Z,>aуїгз4└▀Э.O╢(░∙РьёKЪfM.xеaйе═34╝,>a╘д╙е'КV)KA└тМ╙3▐Чb.Ї╝fЯiiswнЭ╝╖pСBЕ▌╕╬ЮФ√э>√J╣6┌ЕХ═е╞╨▐U─M`Ї8`=щX|╚ДуЁгз4╠єJатЛШu.y╠рRУ█╥Л HpэK┌ЩЪ3їеbФЗК;цШ: ZvAаiО╚гид╧4Ы╣р╥√ПяFiЩэЪ\╤aй)AЇжn№йsEЖд;4fЩЪ3ыEГШ~i ═7>┤EГШpцМ√S2M.h░╣Ег"ЫЬsЪ3EГШwQ█д╙sО) ═mОФMУ=ш░sъh>Ф▄Ъ аW╘sIM╧h=i╪\├║■gУM═!в┬ц▐ТР╧4Э(░ЫIHвЭГШuцЫЪ?*уПе7<╤┌У?Эc╣┼&sH=щ(c╒ЎїйRrЗ фTжєЪS*5eН$Щ\u┴зРO`k/$zpХ╘}уК═╥ьuGежЛмўE@юzЪБеc╞j=▌ ЭT`cWЮ├Щ▓~┤▄╥┴╧Zns╟z╒#Е╦Qs═ЇЭПzN▀Е2эRB╗Й╚┼BzTРУ┐>╘Ю┼╙kЭ\Ь№╕иў└еТS╖║Є*,√ёяRС╡Iл┘ IяQ╖SOc╔╡лG<╪;RqE3+Ж(у╓Вh№ш+╤m~&Kа№6╙mС.;@╔2─Уцў┴п7Ё╬│т[[╪tпъЧЦТ▀\$k╜┴МI#лЮ@юMv┐t╫╨╝у?_█╠Й.Ьtы@╠KчcqМЬ~ьВ8#w^▄}╟ВukoX°╜Lщ╖S4XЕЩдЕФ░∙╞0┌przОЩь_ ё6ГЁ╞╫C█иjэх═лjў *╗ю╗№╩╗ЎуЕрє╞╛yпXЁ╘l■°цmd╬4зВ▐цt{Щ2"Т<Ё0█rGк№в╕яЗ■У╞▐/┤╥2[Я▐▄╚ДHФН─g┐ 'еv·LkЁырЇ·ыВ║яЙФ█Y╝gCo▌╖v╬уЮS╙К_ юbЁ╫В|_усI5[8т┤░С║└╥Те╞AЄзС╤H╚ kтЯК╙┼^3Эь╬4╦5╢h2EрЬ{ЬЯж+c└╢rы №wд┘╞d╝МZ▐$J├sк1-Б╘р)щ▄Б▐А7>xыRё_Йо╝3тэAї-3XЖeЄ'\П4р№еFPa[QВy]оекx_X║■╩╘n-.╜╗Mnц6e ╚у▒*=Еw┤7╣°КЧ╫Q═ \2╬Є╖╚Ир┌─ПG{Ф╙Р3▀\┬╚ВЗАN[х╧BsГМW'о@|KёRГEA?ЎЖй(╡ А<Зi╧a╬sщ@&u? ЇK{KЛЯkС*ш┌*4▒Ц83\ОQPddО┐\q├kz╜╟И5ыэZщЭж╗Эе`╬XАO Я@0░Wб№Q╘m╝7бщ┐tЩ├`·МиGяо╬ ъqЬрЇ∙}<л4ЖПiёИ4Э{рU╫Ў.БНgkк├Е$▐d;▐╟Цш2rN:╫Я№:╕┤┤°Нс∙яЮ$╖K─,ЄХOЁУщЖ╟=║ё[ЦЄo·┐¤Зb ╤bг°1mmsё.╔nbВRС╔$+>єUrДg╕ @·Щuс МS|DЪ[]bx4╢╣o.эхИ└Сc∙9 qН╝ЬО╡ф n,.~)kЄi■_СчкЙ┤dуwЗ╔юyч9лw >#Gу)├ъzДzТLA░Д▒Йps┤E╚+╟\Оч5kуe▓[x╞─╡нен№·d3ъ1ZэL╬d$yЗЕЁ╬ЕqтoXhЎ▄=╘╦|gb а╔№(aо╧\Ё╟К№Gс Е·╟МuЭ^Єю{т,┤e╕╣g &X;эlй┴Є═З╣є] └z▀И╝7кk║|P-4/Щ.░╗ЫhяЕ┴9╟^2xняЛ┌═дЪхЯЖ4┤U╙/Я°Яh^Я╪6Я╔йt╖26|и▌xWр╬╖тm╬?эsйЛ3zQ [C╢"O╠Ab:eФЎй№5т}[╟^ёnУт·щЪc_Z\═│─шн┴nт├`Я╜У╪с° QёFЙс-gT╡╤ь╡ +Е╘,ю╒]w зp^╝eI8#С╞Gmб°в[яЖ2╣╙4=$щ═ ┐┘cЄ┌yrXу`уё4╤2zЮ=iE4┐с@'╡A║hv)sшiБ╗p)sЪ,>e╨vx№isL╡.Nh░╘З~t`?-;$vеaйитШ ?Z\ёEЖд)#4сL╬)r@в├Lp4S3Ъ\їцЛШp╔4fЫЮNi3EГШyыэA>Ф╠╨NM0сК 7╔▄МaРЩЇм °▀─~єЖЕкIh│РdMЙ"▒Ў╕#>Ї┌(Ў■A¤Ч¤ ├■ xы─╛.О(ї▌VK╕бm╔─Нc┌А у┐╣ж°o╞Ю!ЁЛ╬┌е%ШЬГ"ДGV╞qР└ОцР╤K█∙√/√ З№╟И╛ °л┼ЦЛiнъЄ][л╥5▄3ГДQЮжУ├Ю?ёOДэ▐▀D╒х╡Б╬уDСsъВу╡AE▀╚_┘▀№?рЧї°├╞╚Ъnзл╦w╦DН]ФFOз╛=л░╙ ┐■ MлЕK}w─╥∙6Тл4vАr├#АpNW■zFsЬcДГ■>" |:э>" ╟ЧГ ьo¤hUЫo@ЮZЧ*ц╒▀збх5ебы·пЖ╡4╘t{щ-.╘Ш9и ф0Ў К╣E▀╚?▓ ┐°┴5uК▐7╫4┘┤эC^ТKYЖ$HрК-├╨ФPqъ3ГX╛ёN╖сK╫╝╨ї ,цСv9Pмg8*└Г∙TжБG╖ЄЎ_ў °&ж▒ёS╞┌ЎЧ6Ыиы▓Ii0─Сд1E╕zК=Fpkж°OзЖ4=kт&а▒╬Ц lьнП ў ч'Б┴МЬ3p3├wо╨ ╔_√?Ў┌Ън~ДO.х╖╜╗╢▀ЁO3║║Ю·юkлЩZ[ЙЬ╝Т9╔f<Тj*▌ївЧ╖Є4■╦■ с й╗йEс∙t╣╞Ы4тхр1п2А█▒╗ащЬU[ыЭ2■█)▐ ЫwE*UЗCZ╜иеэ№З¤Ч¤я├■ ╤/╞пИJаЬ lр?√N╕╜GQ╝╒╡ яяю$╕║Э╖╦,НЦc■p1╪ ╥аQэ╝БeЦ√_З№╓╧З|UоxJЄKнQТ╬IcэUeqюм Ьv$q═>РQэ╝З¤Щ¤я├■ го|KёЗИм%░╒u╣g┤ФёгНXgjОрV6Зпъ~╘╫Q╤ю╛═vк╚▓╒Ё`Ё└К▒Gj=╖Рf{Ё ВcHя,Н$М╬ь─│1╔$ї$╓▐Уу D╤п┤Н7Pk{№¤ж6№НзТ pE4╤G╢Єь▀я~ЁL^ Ўн-c]╘╡ыИ'╒.|∙-э╥┌#▒SlkЭлЄБЬdЄyлЦПmф5Ц {Ё В/З<_п°Jyе╨╡│y┬∙╕Dp°╬2╞у∙╒┐x ┼^)│Ъ╓п-═╛р■V─Нr3ВB_єКеGj=╖Рfн∙┐°&8¤)q▐╢(4╜╖С_┘▀▐№?рШ├╓ФЪ╪ь(г█yЎў┐°&?ЁЇ4╝нБHzQэ|З¤Я¤я├■ СКSА▌+_╜#uг┌∙√>▀kЁ Вd~┤ьОХл▐Фїеэ|Б`?╜°┴29V╡н╫╚>б¤я├■ Т){ц╡EПkф?иiё~ЁLЮЇ╕уК╓эIG╡Єи{Ё2GыKъ+ZУ╜╫╚>бo╡°┴2║╥V╖jNцПkф/и {Ё ВeБ∙╥v8нnЇЭщ√_ ·Пў┐°&Vhя┼kRwг┌∙╘╜°┴2╧ оУ import GraphicsContext, Canvas, CanvasWindow is one of: image - in-memory GraphicsContext, uses Agg to raster, can save out to any PIL format wx - uses Agg to raster to a platform-dependent wx window wx_gl - uses Agg to raster into a platform-dependent wx.glcanvas gl - uses OpenGL module to draw into a GL window mac - calls Quartz drawing routines into an OS X window/GraphicsContext ps - PostScript file output svg - SVG file output pdf - PDF file output (uses ReportLab) enthought-chaco2-4.8.1.orig/setup.py0000644000175000017500000002374313544356225016431 0ustar varunvarun# Copyright (c) 2008-2017 by Enthought, Inc. # All rights reserved. # These are necessary to get the clib compiled. The following also adds # an additional option --compiler=STR to develop, which usually does not # have such an option. The code below is a bad hack, as it changes # sys.argv to fool setuptools which therefore has to be imported BELOW # this hack. import sys if 'develop' in sys.argv: idx = sys.argv.index('develop') compiler = [] for arg in sys.argv[idx+1:]: if arg.startswith('--compiler='): compiler = ['-c', arg[11:]] del sys.argv[idx+1:] # insert extra options right before 'develop' sys.argv[idx:idx] = ['build_src', '--inplace', 'build_clib'] + compiler + \ ['build_ext', '--inplace'] + compiler from os.path import dirname, exists, join # Setuptools must be imported BEFORE numpy.distutils for things to work right! import setuptools import distutils import distutils.command.clean from setuptools.command.build_py import build_py import os import re import shutil import subprocess from numpy.distutils.core import setup from numpy.distutils.misc_util import is_string MAJOR = 4 MINOR = 8 MICRO = 1 IS_RELEASED = True VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) def read_version_py(path): """ Read a _version.py file in a safe way. """ with open(path, 'r') as fp: code = compile(fp.read(), 'kiva._version', 'exec') context = {} exec(code, context) return context['git_revision'], context['full_version'] def git_version(): """ Return the git revision as a string """ def _minimal_ext_cmd(cmd): # construct minimal environment env = {} for k in ['SYSTEMROOT', 'PATH']: v = os.environ.get(k) if v is not None: env[k] = v # LANGUAGE is used on win32 env['LANGUAGE'] = 'C' env['LANG'] = 'C' env['LC_ALL'] = 'C' out = subprocess.Popen( cmd, stdout=subprocess.PIPE, env=env, ).communicate()[0] return out try: out = _minimal_ext_cmd(['git', 'describe', '--tags']) except OSError: out = '' git_description = out.strip().decode('ascii') expr = r'.*?\-(?P\d+)-g(?P[a-fA-F0-9]+)' match = re.match(expr, git_description) if match is None: git_revision, git_count = 'Unknown', '0' else: git_revision, git_count = match.group('hash'), match.group('count') return git_revision, git_count def write_version_py(filename): template = """\ # THIS FILE IS GENERATED FROM ENABLE SETUP.PY version = '{version}' full_version = '{full_version}' git_revision = '{git_revision}' is_released = {is_released} if not is_released: version = full_version """ # Adding the git rev number needs to be done inside # write_version_py(), otherwise the import of kiva._version messes # up the build under Python 3. fullversion = VERSION kiva_version_path = join(dirname(__file__), 'kiva', '_version.py') if exists(join(dirname(__file__), '.git')): git_revision, dev_num = git_version() elif exists(kiva_version_path): # must be a source distribution, use existing version file try: git_revision, full_version = read_version_py(kiva_version_path) except (SyntaxError, KeyError): raise RuntimeError("Unable to read git_revision. Try removing " "kiva/_version.py and the build directory " "before building.") match = re.match(r'.*?\.dev(?P\d+)', full_version) if match is None: dev_num = '0' else: dev_num = match.group('dev_num') else: git_revision = 'Unknown' dev_num = '0' if not IS_RELEASED: fullversion += '.dev{0}'.format(dev_num) with open(filename, "wt") as fp: fp.write(template.format(version=VERSION, full_version=fullversion, git_revision=git_revision, is_released=IS_RELEASED)) # Configure python extensions. def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(None, parent_package, top_path) config.set_options( ignore_setup_xxx_py=True, assume_default_configuration=True, delegate_options_to_subpackages=True, quiet=True, ) config.add_subpackage('kiva') return config class MyBuildPy(build_py): """ This is NumPy's version of build_py with 2to3 folded in """ def run(self): build_src = self.get_finalized_command('build_src') if build_src.py_modules_dict and self.packages is None: self.packages = list(build_src.py_modules_dict.keys()) build_py.run(self) def find_package_modules(self, package, package_dir): modules = build_py.find_package_modules(self, package, package_dir) # Find build_src generated *.py files. build_src = self.get_finalized_command('build_src') modules += build_src.py_modules_dict.get(package, []) return modules def find_modules(self): old_py_modules = self.py_modules[:] new_py_modules = [_m for _m in self.py_modules if is_string(_m)] self.py_modules[:] = new_py_modules modules = build_py.find_modules(self) self.py_modules[:] = old_py_modules return modules class MyClean(distutils.command.clean.clean): ''' Subclass to remove any files created in an inplace build. This subclasses distutils' clean because neither setuptools nor numpy.distutils implements a clean command. ''' def run(self): distutils.command.clean.clean.run(self) # Clean any build or dist directory if os.path.isdir("build"): shutil.rmtree("build", ignore_errors=True) if os.path.isdir("dist"): shutil.rmtree("dist", ignore_errors=True) # Clean out any files produced by an in-place build. Note that our # code assumes the files are relative to the 'kiva' dir. INPLACE_FILES = ( # Common AGG join("agg", "agg.py"), join("agg", "plat_support.py"), join("agg", "agg_wrap.cpp"), # Mac join("quartz", "ABCGI.so"), join("quartz", "ABCGI.c"), join("quartz", "macport.so"), join("quartz", "mac_context.so"), join("quartz", "CTFont.so"), join("quartz", "CTFont.c"), # Win32 Agg join("agg", "_agg.pyd"), join("agg", "_plat_support.pyd"), join("agg", "src", "win32", "plat_support.pyd"), join("agg", "src", "win32", "plat_support_wrap.cpp"), # *nix Agg join("agg", "_agg.so"), join("agg", "_plat_support.so"), join("agg", "src", "x11", "plat_support_wrap.cpp"), # Misc join("agg", "src", "gl", "plat_support_wrap.cpp"), join("agg", "src", "gl", "plat_support.py"), ) for f in INPLACE_FILES: f = join("kiva", f) if os.path.isfile(f): os.remove(f) if __name__ == "__main__": write_version_py(filename='enable/_version.py') write_version_py(filename='kiva/_version.py') from enable import __version__, __requires__ # Build the full set of packages by appending any found by setuptools' # find_packages to those discovered by numpy.distutils. config = configuration().todict() packages = setuptools.find_packages(exclude=config['packages'] + ['docs', 'examples']) config['packages'] += packages setup(name='enable', version=__version__, author='Enthought, Inc', author_email='info@enthought.com', maintainer='ETS Developers', maintainer_email='enthought-dev@enthought.com', url='https://github.com/enthought/enable/', classifiers=[c.strip() for c in """\ Development Status :: 5 - Production/Stable Intended Audience :: Developers Intended Audience :: Science/Research License :: OSI Approved :: BSD License Operating System :: MacOS Operating System :: Microsoft :: Windows Operating System :: OS Independent Operating System :: POSIX Operating System :: Unix Programming Language :: C Programming Language :: Python Topic :: Scientific/Engineering Topic :: Software Development Topic :: Software Development :: Libraries """.splitlines() if len(c.strip()) > 0], cmdclass={ # Work around a numpy distutils bug by forcing the use of the # setuptools' sdist command. 'sdist': setuptools.command.sdist.sdist, # Use our customized commands 'clean': MyClean, 'build_py': MyBuildPy, }, description='low-level drawing and interaction', long_description=open('README.rst').read(), # Note that this URL is only valid for tagged releases. download_url=('https://github.com/enthought/enable/archive/' '{0}.tar.gz'.format(__version__)), install_requires=__requires__, license='BSD', package_data={ '': ['*.zip', '*.svg', 'images/*'], 'enable': ['tests/primitives/data/PngSuite/*.png'], 'enable.savage.trait_defs.ui.wx': ['data/*.svg'], 'kiva': ['tests/agg/doubleprom_soho_full.jpg', 'fonttools/tests/data/*.ttc', 'fonttools/tests/data/*.ttf', 'fonttools/tests/data/*.txt'], }, platforms=["Windows", "Linux", "Mac OS-X", "Unix", "Solaris"], zip_safe=False, use_2to3=False, **config) enthought-chaco2-4.8.1.orig/setup.cfg0000644000175000017500000000004613544357631016531 0ustar varunvarun[egg_info] tag_build = tag_date = 0 enthought-chaco2-4.8.1.orig/image_LICENSE_Nuvola.txt0000644000175000017500000005664513233644505021233 0ustar varunvarunGNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: * a) The modified work must itself be a software library. * b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. * c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. * d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: * a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) * b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. * c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. * d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. * e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: * a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. * b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. enthought-chaco2-4.8.1.orig/image_LICENSE_Eclipse.txt0000644000175000017500000002604313233644505021340 0ustar varunvarunEclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENTТS ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i)changes to the Program, and ii)additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such ContributorТs behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is RecipientТs responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial ContributorТs responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such RecipientТs patent(s), then such RecipientТs rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All RecipientТs rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all RecipientТs rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, RecipientТs obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. enthought-chaco2-4.8.1.orig/image_LICENSE.txt0000644000175000017500000000531513233644505017673 0ustar varunvarunThe icons are mostly derived work from other icons. As such they are licensed accordingly to the original license: Project License File ---------------------------------------------------------------------------- Crystal Project LGPL image_LICENSE_CP.txt Eclipse Eclipse Public License image_LICENSE_Eclipse.txt Enthought BSD 3-Clause LICENSE.txt GV (Gael Varoquaux) Public Domain N/A NASA Public Domain N/A Nuvola LGPL image_LICENSE_Nuvola.txt OOo LGPL image_LICENSE_OOo.txt Rick Marin Public Domain N/A US Government Public Domain N/A Unless stated in this file, icons are the work of Enthought, and are released under a 3 clause BSD license. Files and original authors: ---------------------------------------------------------------------------- enable/images: 0_weight.gif | Enthought 1_weight.gif | Enthought 2_weight.gif | Enthought 3_weight.gif | Enthought 4_weight.gif | Enthought 5_weight.gif | Enthought 6_weight.gif | Enthought 7_weight.gif | Enthought 8_weight.gif | Enthought bottom_center_position.gif | Enthought bottom_left_position.gif | Enthought bottom_right_position.gif | Enthought center_align.gif | Enthought center_left_position.gif | Enthought center_position.gif | Enthought center_right_position.gif | Enthought left_align.gif | Enthought right_align.gif | Enthought top_center_position.gif | Enthought top_left_position.gif | Enthought top_right_position.gif | Enthought enable/image/images: colorchip.png | Enthought image.png | Enthought inspector.png | Crystal Project enable/savage/traits/ui/wx/data: button_toggle.svg | Enthought examples/enable: deepfield.jpg | NASA examples/savage: edit-copy.svg | Oxygen, CC 3.0 and GPL edit-paste.svg | Oxygen, CC 3.0 and GPL examples/kiva/agg/examples: serengeti.jpg | Rick Marin finger1.gif | US Government finger2.gif | US Government integrationtests/kiva/agg: doubleprom_soho_full.jpg | NASA enthought-chaco2-4.8.1.orig/examples/0000755000175000017500000000000013544357572016532 5ustar varunvarunenthought-chaco2-4.8.1.orig/examples/kiva/0000755000175000017500000000000013544357574017466 5ustar varunvarunenthought-chaco2-4.8.1.orig/examples/kiva/agg/0000755000175000017500000000000013544357574020224 5ustar varunvarunenthought-chaco2-4.8.1.orig/examples/kiva/agg/conv.py0000644000175000017500000000075013233644505021531 0ustar varunvarunimport sys from kiva import agg gc = agg.GraphicsContextArray((100,100)) gc.move_to(0,0) gc.line_to(100,100) gc.stroke_path() gc.save("bob.bmp") gc.save("bob.jpg") gc.convert_pixel_format("rgb24") gc.save("bob1.bmp") if sys.platform == "win32": from kiva.agg import GraphicsContextSystem gc = GraphicsContextSystem((100,100)) gc.move_to(0,0) gc.line_to(100,100) gc.stroke_path() gc.save("bob2.bmp") gc.convert_pixel_format("rgb24") gc.save("bob3.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/simple.py0000644000175000017500000000115613233644505022056 0ustar varunvarunfrom __future__ import print_function from kiva import agg from kiva import constants gc = agg.GraphicsContextArray((100,100)) #gc.bmp_array[:5,:5] = (128,128,128,128) gc.set_stroke_color((1,0,0)) #gc.move_to(0,0) #gc.line_to(100,100) #gc.stroke_path() #print gc.bmp_array[:6,:6,0] gc.set_fill_color((0,0,1)) #gc.rect(0,0,5,5) gc.rect(0.5,0.5,5.0,5.0) gc.draw_path() print(gc.bmp_array[:7,:7,0]) gc.clear() gc.set_line_cap(constants.CAP_SQUARE) gc.set_line_join(constants.JOIN_MITER) gc.set_fill_color((0,0,1)) #gc.rect(0,0,5,5) gc.rect(0.5,0.5,5.0,5.0) gc.draw_path() print(gc.bmp_array[:7,:7,0]) #gc.save("pr.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/finger1.gif0000644000175000017500000020446013233644505022240 0ustar varunvarunGIF89aЁў   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~АААБББВВВГГГДДДЕЕЕЖЖЖЗЗЗИИИЙЙЙКККЛЛЛМММНННОООПППРРРСССТТТУУУФФФХХХЦЦЦЧЧЧШШШЩЩЩЪЪЪЫЫЫЬЬЬЭЭЭЮЮЮЯЯЯааабббвввгггдддееежжжзззииийййккклллмммннноооппп░░░▒▒▒▓▓▓│││┤┤┤╡╡╡╢╢╢╖╖╖╕╕╕╣╣╣║║║╗╗╗╝╝╝╜╜╜╛╛╛┐┐┐└└└┴┴┴┬┬┬├├├───┼┼┼╞╞╞╟╟╟╚╚╚╔╔╔╩╩╩╦╦╦╠╠╠═══╬╬╬╧╧╧╨╨╨╤╤╤╥╥╥╙╙╙╘╘╘╒╒╒╓╓╓╫╫╫╪╪╪┘┘┘┌┌┌███▄▄▄▌▌▌▐▐▐▀▀▀рррссстттуууфффхххцццчччшшшщщщъъъыыыьььэээюююяяяЁЁЁёёёЄЄЄєєєЇЇЇїїїЎЎЎўўў°°°∙∙∙···√√√№№№¤¤¤■■■   !∙,Ё■m▓├ч╧;{ъфсгз╬;zЎЁ┘ГGO>wЄ°щcG ╨SO=є─╧}·4иП=ўь#╔чрєO?√╪SП<шю╫╬:ы╕Cрё└├О<э┤;сlуM>щHєK-┤╪В╦/╢╠bKТжШ╥K1╘LcМ2╫hcL-бШЄЛ1╝фвЛ0╬3Л,└├╦.│итК.┐ьBK*д└2K(г°тK/)╖╩(░мR╩)▓швKК│╘rKЦ╧,єeЛ- 3 1╠Hy 3╪TГL4╔4═1-Rz!-▓░BК'и░╥I*Ю╚Т░(Ы@в╚#Ъ|ЄЙ+к|Є"НX▓I'бд ■,зДК.▒ШR╩,└УKУ┤р2i.╡L2И!Ж№aI.└`"╚ОМЄЛ/ЭHЄИ#ЭьM3╗░╥HР░bМК╣\В╞Ц$▐b"Зє╬;э╚╙▀<║╗ую=Ё╨3╧<єх╟:·╠wП=є,?н╣Єр■о;Є▄╗╧;ъ┤3╬3cjс-y╩ +г┤°(кє╦1╩єЇ1╕ЇшK╤╗▄2Л0╤ 40╛╝RK.╗0╞ь$Л_Ё"ЧX,vQ _ЬВЩ8Е*FQ1SМbL·Я0^E ]├┼02^д i|И╬РF3ЖБМ_├╜а-T▒ V╝"пX┼)ZС ^$C■┼И┼)0сBBХ╚D&TбЙF@ВжXE+NКPавЪ╚Д(B▒КY`иЯ,<ХЛY┤ВБ╪├!"сЙTьмtxJБЛLDВH─%N▒ eCN▄)^aМi╘┬Г ╒x╨Ж eдуўИ=ьСП|╪Cxє╕ф|шё|рaыи<╓б;u╨уФЄ╔ПюкўОxL ┘r<─?UhпhЕ.1┴иX╘вп╚┼+vцK√Хb╗xШ1d1КSP╛pЕ,шd┼╒т┐╕Е)b!0ZАBЦ╚D*l╤КJмС SE+Pq┴\р"л0Y,d1Лa┴■p▀1Мq їгБ>K╞/Ё∙╦UШ"ЦP▌,Б7VЁЪ╛аE)8AЙJl┬Э╪D%бЗ@╠кЛ╡Ши'4· XМ"С║,R1К╗Етё$┼':!;bЛ(0БBг@Д№рJ|G┼└Eв1 Elтти,▄╞З.д!ОP┼/╕q~0ПТ╔лЗЁФнwьz╕C;ЁСЯ∙ шZЎ0ЧЁЁcоnэ#Т╫ЪЗ8РБЛZ,Г╣АЕ*RA├O .e▒ИE.RбЙN╕т┬ф─'nс%КЕВ├╚E╫J╤ Z╕┬Q;ъЕ0|Q T─пм@┼LM ХОо°■-( Хх╔Ю░"0gБ _шт╖╪┼@7╞|ЄB╞¤E0ТД .Вт└├▒ A%╩TЙ':QКйBVОP─!!ЙS№i#U"*vёКW└в4л┼).б O4S?┬#ё?x╟д8+6AFPbГhД)jс яl┬йиD!*с╘_ c╠8а└APВ║╪╞к╒╝хarТ√╕=фС;дcТ╓║]ЁЄбП№HKЦ =р╤ЯwМ┴ИT1┤╣ЙLlB<═─*\1КK$1ХрД+j1 TXвгp∙4QК !╨▌E/'X└ЯйtI▓@E■ OqК[рbE)*\.fv [▄┬а0$D!Л∙╔ВMЕ4ЫЇ1Zфва-^10[╕"б╕│(2qЙъvЧШ(!a7<рОи%" JH6У╨─8╖ KDBЫ8┼H5Aл╜bвЁТ?б ZyyА├°ЙUа╠Ч`Д!№`ИJРyР─|╔ Jx┬└D,АQ pLуМр!`- lаcў8╨=╪ I|XЄоЩФ╟■рs▒c░|G=Ўб¤\л?║#▐=цwА├v┬Есм№J\BЛ╕C$Ёkк▄rbО]i'╤OШВб╪D)■HЫ Jив┴Ё&)X┴КPtВ╡ЙуЕ-·L `2О╜P╞2v1╬ZмBнP╤╫yЛZ└┬Є╤*№WчЮэbGbЄE╩К╤МЦL|│╪╪0v1═\рzг╨'°╨ЗB@тЖ8─%BБ▀X─╧N,▌% QъH\ва0┼+f4WД"ЙxD(\ Kф0rD&0лhNшt П╨P% M╕!2 E╕ЙGд"фаЖ(▄0ИP░В╒H╟:H\П╕r+°И%▌-=р!?РФЗыЯ╖<В┐Гё╥З>Жзxl#▀EE+$Б IT^ПP#*a6R╠Вй╪U$А■N*LD`+┼╔УQЛOLB╖╨┼+╛╞К*SЪэы D Ы)№┌Веu-bQ S:S╖└ `Є з`hУ▓"бВ%Gb ╬░ └ЁvЇф єt йаKзЗO╗M╗` Та#ФPОА ЬЁpQ6iПЁ╘g░ ЦP ї -г иР мP)%У)б0 Т└ еP?ЬАmеFЮа ╝p иА Щ@{` дАD lЁО╨ ╠ ═зSФЁ █║аjАq├pцP¤F ЇРЎаЄ,G БЄСЧ ў@c∙pУФ√▒<н─c╥р ;rМрqжа ■жЁ б░Eн`Pе╨ да ╒┼ Ё d ╩╫ИG Ц└*║T yGO═E hє5Н% Зш Ю╒YМУCywEк >й└ Ёe ─р Э .C ~т ╣└MЙ ├└ Лж ХЁ иU ЦрQХ0 Н0+t Y4yv╖F▒ЖZй░dЕв Ца д╨u9# ╥W▓ г└ йtВ╕ "ЗОб@ мP ГаP М  ! д░hн╨`nр· КрГbeДЕLе ╚zгP`╡pыpnЁ╨ЁА╥ТУ$кdСЗ4VХdЗ∙░№Ж&IplхJ∙ ╦ 8н ■ С░Ю AvТ0е 9в Ь д Щ└Yё(wьxw▀еИw╙Lж (░ЕK╘5cSCm' ░А пА HXБBЇZвА ГU XL┘ЧeоЁ ▓ph>W и ╘#╢░ VdFеPqд0 %╫ММрцО0^ОЙ@ Рh2 ╘ *L║P ╜а'нE л░П▒@CкPrд7д╨ mг ╡@ Ц╨ВЩРwз` vРwрXв% Ч░Эа!еp ЗPvм╥Eм аа ╞ащА бР Яа ъ-вд{y(Щ4-о─;°└y└V!йЦ4-w╚o░GЗїр√@ ▓┬■РЛ▓Р "° Ша T ╣╒ЪЭЦврС╨ к7ЧpwЮаEoцF; и0ВmsEшФНлЁ(╜ ║ph┐x шe УА еаXжp ▌xQЧi И`v║`пРНN ,uL │"─╪ NВ √( ┐а ╬А1┤7Ыp ж6 Ь0fМЁвО` ваN┌#о╨YФТ Я0HT&Xн $кP Ж `fЧШа ┴░ Ф`ЙАHЪ└ а░oаРЦp"в└QН╨ЛР7О`q@|Ёе ▓░3╗P ▐P А│ ╡ °Ё├╙-¤║7;&V─├╖З YI╬Э№v■─єЎР=рp ┤` Юpгж7Щ \DCе дP в E Ъ░wдPЫZ╢CzЯо`FЬрПPiЫА б╨ е@ G· \#EB#$М П` ж┼ е0 С0 Уp ЯP П БPy║╕2Ю`(wrzZ╞MSsк╨!O╟ ъ3B┬ ├W╜pв64 ╜@EТ9С vОp в░ ▒@ Р╒ ~gEйЁqг╨ ╗░ л░ П9wрЩрv╘ ж tPs ПiААe└ФаTВРЛаnPИДPw@p@да ╛fjзА ╩└ жрE┬а ╫`╣sI╓ВЭЁА■Ьzxуa.ю&Т4╞V(┘¤└─){·А╒@ ═P vОн ?║аZЇ └ ,є 3Є `╙ %хs5HА6─'щйой@ К░Г[╣p yI аx йЖ ▒0 |є █uRЛI w3SxswЬ юеNм "╪]░pЦWi2ю5O╩╖1╞ пАОЮ &╖>┐0Мж Hна ар У@оШp ПpМл \є В° в Sо6 K4L╣ЎЛ0l@ГЧШivкz ГА7ЙPН░QЖЁB╣Щu░ГсхЖА}ЁZцrЮ` Ча7ЛР ╗░u┐p ▀pэр.─■У-;╔3Iwp{ФT.&Щ<РTТ№P.;╞;┌`O┬░XПк ЬХ Ю5╣@ў CФ г╨G╡r0Х xбжphдаЩxгeD─ка░C▓╨ Я└PлР ╟иг╨s) DX[Ч;#пЧ0 ЗШ└Вв3`)4╕P?о`AбЛ═х68╙ ЩаУН╨~╨bW l АpУРЛ мy╫╖нpvЦА Ш0 сХКv└дK*йГbPиP ·АЁ ╞а 2Х ЩрiУЁБ╨┬к З аР"xЖ|x░К КЄs ж░5з╨Мц п РР ╝Р у░rЪ ├C-■rxСЗ·└°А│ЦДJ Т ї╨Jю@ #У о└┤▒╨dЮЁ ╢`╡Z ╛аДЯ` ├ 8Щ╨ZфЙfХь ┬└Г╗└ЙВ╞ Рpwк&ИР└%e ▒ S╩7 Х Ъ└v^cМЮPEn# ┤Й╔╕д╢ъ─5╕@ \╥"┘╘ v╔(LT ├ЇЩ'╡Ъ иz{А└е7с╗t└Y64╖└ О │М░Сv!ИQЬр ┤ О (oє1,е ░БР ╣ДEОP~аУ0╦{r К0О└ ╨ ∙ЛtАа╞6╜mp ▓Ugга_kЩ Аа■├ цpСЕlьР{╘"■{y░i(з╬Й│l┼o┬ГЎё▄а ┬╨ ╖rЬ Ю└Щ#h░╨ИШ╝~Тe ё: Ю0╘┴╝╣4┬А └░ ╜p0ф├Y?ЩаЁr║ Ур мP?ЩР╗#╡tл║└╜<Чq╣ ┴└w-">4ГOўЇ Т"[9xМ!╫НЖECЙШоО╓вВГg┘╠rР}@D┼ дЁйЭЁ"ШP╠╖ ╟Н0 Ы└┴~r иа ЪpAзрKеp,оp Ву ЧРЕ░о9┤ИЁ йР ╟0 шмb░ИР0НДрpХАs╦дЪА √WЧ╢└ чvуа╦│Ї┌{ ╚■а qЗн$З┬WХtJ~\╪p ╫P нp╣JhаЎЫ╔з╨L▐е м═Є╖Ny{ еЁ$╦рШЪI3╞ DbйЇШжMЫЗhЧЪ╨ ╝РrЦ`НЬ Ej<Вх6{$}ЫШ╞`@Rўt▓РK |съFfЭ╒ЭЖB КЖP| Y$ р$╟"╕м8B_┴ ГЫ{3. aг з` ┘: П[ yРа░ аРxрNh ШаziА`б ~Х╥^┤а ▐╘щ! а╚qЬP ЛА9ш╟ ЯPQDЪ ╜` щаzю└ц чА;хPp╫р ╙А~0-ъP|}<-lЭ∙■▌P ╒р1t =% ирhбА║ЩРИОАгP'&╬┤iV хх)└`ЯПjh├Ё $ ╕7и rЛ}ЙИ ╥ ЫP╗`gE╒┘гРC░Ё3\s е└Ц#│ М├8░р2╢p0DК}е║н M║а>*$┬pДMОk *дНp ЙОУжB с┼джf_ ЬK╕в╝| N2 ш5 aь▌ Зpv`DМ \jpP8eОЁ ╥ ╞xй┤А Оа├Х└Kб в ВрЪр ┐8RВTO╠Ё ▌Р ▄ ▌0 '+хАра ╒░ Yр┬Гщ@ Є{vh.ЎЁТ■ ╦Р ╛0Eй@`~0 Т}|) U НаЛёXЧKнМЫ Б4tс{' xrLо└Ц"J Чю@gОйPeD, ьнгJ°r \CКЕO╛рж#\?╝Ш "║ >гRГ┼rи@Ы0├r▓z0BгуУЫ ЬАпс) Ъ@ГA▀ХУ#евН└_╥ў╤ЁrП█6Ч`╗v[╢| УtЦ@A 6╒┘д╨╣┌сёдА ╖а Т0П░ а┬ Р░╥╖╣№g╟и[╢░гmG9├p5╞ █░ ┌└ █▐░ ▀` ╟╨Брn№▒<Е\╛░ч<°р┘P%└└ Т`(аРSУ■░Ии@╣У░П╕╚ иp╕4ФОнРО7юэ@┬wмЩ^щZ@╦p ╗Р ╩frюЗ Е┬ Їj$а0 И иРfШ9 ^I ўd ^│M╖F ыUмZ╕n╜е╔Ф*VиBueъзRкLБ╡jжAxшЇ94(#JЛЄ°й4ъ'LХ0}RkХ'LЪ╒╞╨гIТ0Е┌╘H"FЫhvK╘в;w Qъ╩г=~ЄDjУ(DД·╘ЙмOЙ ]z┼+╫ж=rQЕ*Цм[бRНrEJ0b│DС║uьЩ4j╫┬▒Kў-\7nс╚I;╢╞П╜|Ёцх╗╖ПЯ┐~∙Ёх■╦W/^:m╚jСк─ИлOК ┴5┼J&LаNЩ╒Й╘к╗аJнкuP,Wк\╒В╡J*RЭ0m UJо.[л2Q╩┤К:)JУJ┼·% ┌-ЙХ u┬еЛФ%KQEйкUЛ╒дDТR╣ZЙ*╒+[╣hе┌dH29EЦYd▒┼ЧOLб┼\VA┼ХTVв$Р= >юРГПB dСЯLYE\^YЕ7MЩО<к*dМ>∙фТG$!`z▒ЕG■└#ПA┘cР>·xC =yфУM"ПDQeR&РG╗zBb0ЖЫBг`06S:Е╖:M0@^ВД\∙─)DPGрOxЕV"Й∙ГО<7єшГ:└КЩJИГ╨"2AhДC└Rx<1°Г<╚ГPxKH;ИS S├f(_ЁQF╨Д] ЖL■-IЕё╜[╨ЕcИd╕Уk└ЖoxhиЖh░uhЗrдw°Rw╙wpMю"ЗhАЕ0*ЕG╡─Х╨+JXH┼HhZKСЙN0Ю└╩`╨ЕV8Е╦▒ЭW(╦Ё@√t┬c`Жx╔Е 'LhЕb░ЖXЕ'л*р[-WeH\ЕLЁпШJЕLИa╣YШпT(Щ╙╙О╔╒X└Е\x▓}┬\ЁгїЙХWаЕ``ЖdJhC IАє╤+KрД┐БД┐Д?амY[Fи5└нDШ┌иD°EЁ M8K@РГ1└▓nс8PГ@8<шГўшДQ░G╨■_Бгегg└bXЕ3S Vp∙+-MиЕeА▌;X░Еi8mhl8ЗjРkиЖl@З╩Г╢sЗ╘МЗwXЗwxЗКPШДKhЙK°^WЖfH{j┐q┘═Ч2E[└$ЩTVъ╚Е^░]b°aЁ]шFШДLKHI2╠╤ДIРз>h5░1 _╓Д7@Г;hW╚■8ЇГ5pГ=╚ГDh?XДM(?░┼ *U`╣>_TАДKШ] ЖSX? ДаУ9АГB@Д=xXPлjиЖfшa`оnЗq°lрЖoЗ╠дГ;РЗGБЗvh^FЮм╤oЖ]хФN(*Г╣hЩдй-KЧzЗI┌SАОd(%,RK╤╗╚Q╚йк"dрЕ`@%YPйL0Щд,ЖjрCpДI0(MЖU8XPf`╛=Еc(ЖW╘гbК№Д▌єDЕf·`°dШЖgЖ\xаRWя╨P_qДAЁГ= ├>E=c0Жi└°р┌тД|"╔╡ДF■а┐Hxз, └BP&L %3ДO└┘╢╝8ИГ6Ш╣╞Е;p4╪ГH@|EM└ЛCbv*cFшГФРB8Д;tДCшЫ9и╠n╕╥RJoxоr Зmu@ЗпЛDVdF~!кЗulЗt Зch=╧i3ыP░═^aНЎ╛В[R`/^Ж╪Е╕рД│Y╚ЕU haш╜a@%ї├убNx░bШHШДXРЖkрЕ├ДSшЕgшЕЦp_H`8Ез2T8gы▀T0Р[e╕▌│эдNТЕOVK8ДМyаMYc[ ДB└╨ЗЛ╔─K <√"\ ■sФrLж#QvЙJ░Г3рMабL┘+yъИ1шГЫ Л@╚6XГщ#E╚-QШ UPB╕EQ(6(b;МoM8нЕYЁКЎШ╧l╚▀хЖr└Ъo╨sА;9@dv`dЛU╗ёJ═sj°AМ╝О2Х№^хщAКH╣HАПЗ(УRЖ^ШA.╔░LрД√┬jC1 P┐√}Yшf[8╣█HЕЦ┤ЖaрA@ДMрЕb@YрTep^└ФNИЙQ┌5Ц▐╙zБ╖Ю┌g√▓рХOдX8Р]06ф0ЕYВO7L└[D°Гrе@╕ЗЙ■ЫЕZ`B;мI└╛╞щЮG(Д▀rДPhХHиФNx,Kx7 b:╓ДsыИ@є:(Д┤д<Рн:ДЙ>PХ!╬U(жB_╚Д╘▓╡▌o8r8tфl8whЗЯ╢ГЄ╢╪w`ЫSУЗ!j)нcPк┘  ╗Дє(С]иYЬSЧ¤│ОQLPzQfэшoU8iц╤╡%▀AY,Y8 eЁ╨[@>шЛДA╩{Y°рcЭ╙YА_ШQбХV Vx_JhR░╫YHKWd_╚_a8dиц`р_8[Хj∙ ї:TД9ИEHmN@@■PQР╧\HX▌ юДц╗ShД?`ЧM└┴*F(ДLp╧A└=╟╒м>pd=P°Г8░95F"Д-ISК>╨JhEIД=ДY█CrpuPrШnЗuищuPЗ9└-┼XxшщGпN+oxр╝шД╛)█`╛ЧТчAЕIд■J└$╤JЄ[бЕ_Jо(УtЖ\рШmSФЛ_АeiнЁVбеjCИДV╨_Е;c└k└ЫjйhPЖTШДPP║╚\`L┌[нJи;В▐]╨╖d@Жe░nШcА*И ─Zр=МПQmi╧п■X╪╡a╡ЭБ╝Г<└у▒U(чxЭХ8ЮYАн"ДF0YшЧPД>│D°=°=hЛ:рГ";ШCxНN@:└Г@x█МЕKиBh┼╗IИ&Vк},Д?ДFЕcЁоp╨ 4Зл!2З6╨ГAБx╙ZЗSKЗw(ф#+kI ▌hЕLФХ╖Э╣*├дKХ4eТ┤щФйSйp▌%*гS╗ДэвЕ TйT┬в├UыVн_╗VYЪФъШ╢e┤:iBХы╪3JГuжLЦ%Hв^ЫVЛ!M┤ДсТUлзSбJ┴КЕ*-c║Ъц·ї╦╫оZ┤n┘r■ХJХкUн─ю║хIЦг?Ыl┘ВE+W.YиXё2&╡╘#Iw92UJ╘&Q░TyїiТ%VE]*пVзIBD)еБТй┘3ш"NЮ ё╣гg╥)Jt╬(J╘*ю'>БыTзOЭCб2q╩tшO#L╖┬н{7╬╕g╨к╜[g-Ь║3y▐╔kў.^;yё╪╔Ы╫Ю╕_мL╣*Ещ╤'RЫXЕJ%КT&Wз>yъD╔С#FФ0Е·T)У(а╠вЛ0н$▓И(зЬТЛ.лА▓I(░№L/╖L─Л+╖╨К!ДД"╠4├x"$╖@├╠/Зфё1┘ш▓II╣HS═1зXB╩)■┐Dє╠1╛┤ТЙ%ЫмЄ 1╣╝╥ ,░╘╥Л0┐▄ЄКСеД▓╔$РH╔eУ4b %|хQ#KбЛ-╛рТJ*║єЛ4╟рв &ZJBI$КHB╩W┤дК'ирТЛ(К(b╔"Ъ░вL.░Ьт╚v`Є &o╚╚Г4RЙ%Еф╤%SB▓И$ЛРЄ ,ж8b zИТЙ!Кь╤И-йаВJ&yM▓ 5╘p├ 6▌ ├ /╫МєНujфa;Ёx<┼╔уО:╒╨"хR√ЕВ╩|З0R (ШИЄ &л╕Т'ЗlЄ╔)а<ЄH&Ш└ТK/ж╥H*╢ФВ .и|ЄЙ+┼#L.о@ЙU■*еh2 (╖№тС)в╘╥╠4┼╪R %пP═*Э┤м7╦╚r░'░ 3═3╝и╥╔%гМ╔╦0╤вЛ-▓╝BъСm▒╥J+м░т -│└ %ЯьI 'Ъ░4╔$@ТRJ%РlК&й╚▓Л╟лPrH АьH%в╕Bф0╢ЬR╩*дt: "ЖtBLdйМ TRК)С,R }╔'╚A╚'ваbK.2% o]ў1Ж!ЮШBJ"ПРЄ*кФ╥Й$кь 4┌h├ К║HS╬9эи├я└╙=°└<ь░╙7┐ИbJ&Мt╗╩уб8ТG A[╔╣о┤Є╔(еP▓4*Ыr■И$Уp )я╜B╦ё│р╦+▓ЇЄL1╛─r *▐ cJIк├╠-@гRL5═╪2 'к 0иь╘K7уP3 ',┴ЙQрb║pЕ&qгYЇМ╝ ╞0xё JPB╖8Ж3ФС e0#г┼UxёКR╝"+п░┼.Е-UX┬вр─$"ё@,Вз╪Д*F▒ЙGDДаL&NСМjPcг▒╥(`QКK┤░]▓8┼"рDhb4П@ъ└Gtт7ЭАEЬцтЙA╪!Дx─z4!?lв/r"юаЦVМ╧шбE3╕ё plу╗HЖ6╝ёНn░aк{З=ЄПx╠■;э@З3XснJ вХ@Я aй Q Щ╕╚$6б HDта0┼'ЙK НЩQ.т XdИ╛0F2faJWф│PEfjaМZ<(ош\1LБ LфВdh├─,xADcмв%ёE*Ъ╞-X°B+▓АЕ-xСЛXdцЯИ1ФqМ Г─FQlYМbу╩°Е-В▒Мeг║0╢Nс KМ"{rД"Ё@ЙR╕b╖`Е'0╤BВА╩A сИQ╨"жHД 1КPPвЕpD"ЇрЗE(тqD^R─вА╕D(V <шбТR.╤ЗBДв■▓ш─$Ў░"п╜┬Рp(|Б q|#╚hЕ)n╤ mdг xhG<▐QП{└CЎ░<▄БdШВ%Ш═$.С GBНи'*Q RHвЧиД"41'М╝ЗЧ8W%$q [°╠▓XE╜xёз'нВTРmEАfСМ]LвФ0Е/ибМSDв╡РЖ1RСИ?XB╤`.╞2 el├╢╨─ ▒Кb8г╔ш{:8Rь┬╛рE0О1М\p%О▌E0ДqМ`C▓╞а╞4Тё "▐│Ч╣X┼(F╤ N─b╗╣DЕ!Б╕РьBоЭ4Z ^дУ╨Д╕^Q7и! ■П8'BE:,"ВшГ~qИDИbН°Г$D! IЁaКp+|A T,bЗhE0pёЙBшБР .Ас №Ш"▄и╞6║Б NФ"ршЖю ╓y╪уЄиЗY╙ЪОcдbШРД'шL\вВ8─ ёQ╪ёйОИ^!бЯOШHщ Ga╝Y╚ВмP┼-^XHWэ[-ШсМW$bТИ┼,^▒ УТт╙hЕ!·`╠et#д┼.ЬбНgxЇЪ░а2ас gфb9БD¤И╤Мgc╦РЇ0tС БBt($ a Xdх╝Оq \╪"▒■╪3╢сМg4CзШ ■Ё╔ЭсымX#"бЙQ╝fйHr%XAЙ@└с x@DiGQЙ?╪!Й╜rиЦ╣ФJ╚┤ПpД ╬MИN@fнШ─q┬FЁAБ0Д&tсМ`I╕P.6╓сУ!=#^ХЗ>юБП|╘Cыи;Ж▄ [x┬Ъ└|H║CHIИЁ─%╤Зр┬Ь╫"░э RБ╦Ю╨Д+j▒КёМЕ Aе)^! g№РШ/ОБ ZфNЬ0Ж(■░"W\7Т╚C!\ё j$├Ь░6▓сМ^ЁЙ├Ё┼VИсМU|тiбшDV}Нl0у╕╟¤■─%q<b?с╡·ЕAqКХ┬r}┌Е)vQМ_АH╙ Ж1╢· J°З░D'F1Л\╨BЫ°Л$EЮМxx┼$И-ОvАщ%(▒ёB╨!ВрЦъ)бИжэцїЫhЕзeИ7*tЁ"ъоY_ИВдЪЕ-╕СНm(уйp/╓@З│тc∙╪G=┌╤EВП─`║XСЙJ|B╕Эp▄єzC,8М░(*ёEDВ┘а`─'Ад P,НnиLК,Ш┬#`┬'ИK╣0В'ш┬-Ь┬*\D4хВ№С3pГ~ 'ш2@C0tВ'09TГ, ,├1■-м┬0ГФВ#мB8¤В ├-─.мB(,$&hB+Ф./╠КQ< ТдF$`кpЙ)╘В/H1ИВ'РBCщpРДР─&├TLВPB*tB#А┬*D-C/фВ%а┴P┬#Д ]В"иd($BьA$ ┼a"hВ,▄В}ЭJ,(C1ИB╔%,дBЬр┴дч,├0▄┬#B+<9@├+ШR.|┴╨Г<╚=0R;╪├<└├6Г1─Г:иC:АГ5@├2╪R0╘0ДВOНBНf9╗╣ВєT┬СЎБ~ZВ%р■Tc"Ч╡┤'░-╘┬р╤ЪчёВТв┬(иBypT O%lВ'`I,HГ7\0ФВ,р5М:B/x├3дBШDC8DC┘АXПўB3ИG;В'°┬6рП3p╤;ДвВ+]ТPO(ДВRt┬-C/ЇBVи┬ьЪ-№h~ЧB#─бфds" МwВb├T√║#Р"B!<┬%┬tБ0В"ЇAOбG∙е, B%╪ % B °╢TFоf3Їо'Г1░┬#ьБ!ш│НV╤(ШBxбЭ*дw4X╡№о5ш@╚├g>xєь═{╟О\7oфЬ√U Y3`бub╡■K'KС<╣┌thУкLЖFЕ"UкФ+VЪ@Б┬tйSзQ┤p╒ ╓Л0Ь▒JБ"╦нKХFЭ▓ЇhшиJжОiГ6 +e╙└M ї'╤,fп!▓оZлGеВM│ЎlШ.Nв`х║eK┘8m╟кsхкФм@БM╥4Й░иSб8Е·TЙТ)в╞Р ЎЛV0К║f¤Ъ╒hP<Г Y▓┤ Ф'IН2╣тELЧиFТP╔jшР <8│Ж═FКZt Ц┘;ВY┬╒k;Л(нRї╔Q$X╬м┘║dйrнMЕ-┼Jшк╥ЪTб┬╡jV,b╔вY╗Цм╫=єЇ▌+П■=xю╪1чo┬щ]ЖQжa\ЙДUz╣еM┼P@ E┤ФHY YF ъСC ╤$_~╔EШ_А&ЦX6┴дУR^Й╨4J )ДU`бЁeЬСхУ!й!'Ь]$!фcА╤$MФ┘FЧH6ёrЪqFfA╞ЫlxQ┼o╘СЖZ,й─O(бфФ]И∙хЦ]║щЖ^zщеЦYdyN*1ёЦiЬa╤bи)FЧT8╤фТI2)хСРbYeФ ┘[EТB$!еХ=I$РD D4╘фТLщ#РCF∙EХE°°#ПOXaО;aD]x ТNtЙ╞ШTd■\Е_`9─Mд╙ Ч╥j┴ШЦlaхg└1GЬk╚╕/┐{юСG┐w╘qчЭrиAF]В!FШ]baЕХ\\ё%ЧODЙфХXPёDJ"ЙФO8щдХ[\БЕХM╠\vб┼Ч]ЁLеФH ф,]t9eT&)O,!$X~Й%FByеkrсdФыОaфСSК1цaOЪ╣ЬhLdMкq&ШY^)ЦlvaЕLXAРЪdЬQцШ╚дiцX<кV▓if┌H&EЦZHб╥ZО┘еЦTH9eIщCCDЩЦNё╒Rp tЦ\dщdC !$С╬ц╪CI■"qд╫YxqС>Q─QBС;6┘┼Y2IДТWxiЕG$ye▐-ЙЦШer1eФVВ╤%╗K┴┼h╛!gО<ц╔зЮz╥Gy▄БЗЭnЦ∙┼cШlNR╞ШUjy%УT6╔e╧T2╣дQUJ┼НliхWR E▒ORСQT▒%[nQЙ>╪сYп╕Е]бж!]┬╔8Ж0VБchC╚ш&М▒МcHвЬ`Ж5P┴ЗFЇSЙ)║w dhЖ╞ШF1\G GlтD╪а6Ц╤ |═┬╟6Р┴ ^р┬╚F5ЮqМa#┘иЕ(aЙI(тВр■▐Лb╤КMГhД'X UРBFгP+P!Sа"жx] Ї░K,┬ e╪├#&╤Jт╕ F' сУ╔┬│Pс йвБxК*Z1КLШBadЕ(F1 ]ь"ыЩ─%VaМ[xвд+Ц:рA ¤▒=°Aо{└у╬@Ж2швCP8┤╕/41 P─╜╨EQBС еGж$?qM╘mж°─(qL|b╖`┼+е N@Bй╪┼-fб KЬb0п°┼.l0X,г0L 9ЄВUЁтNЛxГ$ЦaМa╕Z╬p}1 ` ╗(Е■╩nбНn@#└╪$4 Нel#╦P╞3оНf`у▄╕╞4в!Нjр0s╢!■:h┬гE-\КJ0bдИЕ-j┴ЛRXb╗╞-R1 Ip┬▓Е"ЎРLxBuД!ю`M("з *FсЩ?\т┬@Е!▄pЗBЬтжШT&VQ e╚нн╚E2XСИ╥ёBУpEш Л[─B Е)ИБН2фБя╚=·╤П■─C▐Ш3Ф1<`М1ЦHE/вКФАт0╡иЕ*\AЛщx"Х╪°^! I2Пш┼╓0╞1К! +/╖ЁЕ7QБ╔W\B╬ПRв8Z╠┬Ч8M(V■с Up┬е0+d1╕┐тBM%2СУL4" &ёЗN г█╪┼&(QЛqА├[/8╢Й`@ЧP$nA c╨┤нЁ─$Jt i─┬Ш╢╨Е+PС ╕T╩лЭ$+╤╚BDВКрМЙ;сF┤в║0╞5X¤═╨1"ОЕl`1 fд┬Л╚E3za XРВТ╖F+* RxУБИ├ <с ф▐!Да(l* Rрв+Q┼+rAХQфеHE'№PюcУ`D'NЛO"М░E%eqЛUд┬|A¤E/r╤Л0▄бЇ╨З?юax4╢\Ж╟╨В■╢R╪тпcK4в┼°КГетЮHE+01ИJао0┼&"бЙJ(S6F*╥ Mxт▓X└(┴ЙHсsA#P!XБЖAj6A>°═сЪ@бб>б┐╥Оnf8a.(ьЄjAja;┴Z+2Gd! OъlсоБ╢jкБRб.aЦБ с:╞═СКбЮ!сHEfA▓Фб*laс<w`Бtб.AтЖИlсР! Е┴&aPAf,бвH°└*Б2a8O`a"0hЮЪМ╨■xД`!5Аa╚gыж&сЦю @:aOЗи╘/НJOкm■@ррT!╚ЗиvбxacРafA;ТмOДG╠@ъБ?ЁБюбЁA╪б╪AЬбК шH6бh!2╫уBC.ИюБНF$╞ъК:Бт╔^БВb(v╥ BБ╬^б╨Й(fФ,оArсг8jЎРс-mAГLA&║Ad!ИeXРсZ┴D(TскtисАAШсhб┤бТ┴БЪAЦ!╨є■ТДA|A░f1DВЧaБgA^N!┴!~aV!lFa─hйи╬<Nb!┼ Б%Zб▐б~сЙ,с.AL!йъ`!L!ь ·FсTa ┴╨#iыМК+(Б4c!▄А!·@бИБ╓`╩ЕЁ┴∙├╨с╩Af═iнR╠CД(l┴pНT(gю@┌З2-БЎbDП╫h!HaЬ┴╔@ж:╨`!tб▐П└чп░"@AпШБ"K┴█╝╬t█XБлxaжс:БК0бШPa[вalo|■бТ╤xбе"ШaдaЕВAаz'о╚0Cх/$БФda╘1Tс 0║o#╚H$с╕ГrБ\фPБ╠╚╖AК a■`&P! a╞пом^┴9aТdб8a№рВ Б╞.">сXс┤╨GбШЖXсqТ! ° шБ фхa(ыи┴Цс4│ЪnzbY┼╖>)№АWkт AьиHbбТВ!Z бБФ@ ┴4[уауMю~aР┴ку╩&фHtaZГбl■0┌ar+Б░cЮ┴вl!Ъ(┴оAВвЪ!Ш╕с─╚,7!Ў0a2!F&чт╨ч╞фBz┴j┬^Б═vtyБ$!LYсzz!бфgH╘!ПЖ+ЄА┘\сюЖdбЖбЄ└ св╞&чОaQ,P┴%Aaы╥░Ёi БП┬Hэpxт└■Єрa▄!╬aвИб8IDЖ9с:╬IФЬйсI@БL╞ж0┴M?бh┴0ROК!XтэЇDБW"нPa╘p├■Ъ4┴+кб┴А┴ЮA╘╒мaБЧБрЖсЗ~б╝-╕!▓!ёn,м▓б|@J^aи XjA1Йа╕зр6Б6ЇNЖьз┐ВбпЮє-0I▌╤T|┴XaК ▓x6F,┴>!]╙╨jA26RНы╥NJa┬╬ьа!ZРE╕XЪe°аЪщ0Б\kссlбiDn0JbO H"╘Ў Ї╠l7ач ─aшKаkДНRбЪИбФё@Д\'┴ГA╟й ═й╤4ЕAТBA,d)Л.■hA\ЗБ╘Л╨▄ХАП┴ БОxсaКб~W!Д!Ж┴║сШб┬ю░Бв▒Фd╝╠И╚bИ!▌0бNКБЬ!жБ▓Р!╨SЇОa2ЖБ24М,С(yMКы&aЭ╥CfсAh;!~4сД▄V╟Ta\HkЛ┬"Я╨а!° ╪OО╕I╥`Ас╨>╢ЮВv┴ЪЎ6AВAс0(_rю Ўа/Щф]▐сТ╞┤┴░бDБM!6uMи:БЫ╫Fз▐B*■с;$╖дМj!ФБд3(\aZ!~яRОh╥3<сFAдaМсfси8кБж╝ў┌юОa╞/┤БКaHМx┴╢б(м╣ YбrTБА%ТжaЁU!бЪrБ║сp!иAдAОбAЮJ┴*a*aЇ Afбб|o#Mk"бдКЗ■№Ар9E╜Ы·`HсO"┴$сьОs╠А №``Ш┬ДA┴DFБбъ@|КD╧╩Bз"dа┴ ib<6Бxс░Yб ┤ wуБ▐┴╠!■▐бtp║AvФёQ3Бм╙KMa┬t┴aJсж┼@ГD&(б!ШArВR!Еїm╗-!▄ЪАРG9<╬a┤t└!8сбшО~M┴D┴Ь!nБ<@ ИDБ биБШб|AИqaмCxбШhA.╞Ц!ВзШБТ!FбaR┴Ю┬Abб!0Б! ╪`─l╗1с\ЭЁy┴╣5╡■А├Ё`цзбt!йU┴!7с·а ╩@EСK Vз╥яє:AБ<┴b■m╢д╒ш0pa╧TK╔LaBскыдHЭ╘╫сМб┬!\с@TA64|сH╦о"У┴F6б░▐Ї]U┴ГCuс"ShКВY!Ї:сuА bБиqБ`║|┤abA#х+!}┴вdБppи┴` ДБv╘[!бЖсЙ┴TсО╒ЧЦЕЖ".ы*кб│Б╢!оi░ ╔5JvvAжa▓Kсqa`р(Є(@б^р└а3iu╞кЄ└>ь Бb┴Ц╒lБ╞б|c│у pы2╚■K!`A~Ыжє= Ї╟FAРbЪC╟cи╥DК,сZБ Ї└╪X!vц╚┴║A╓p°x╩+с╒ЧжЪXa└TэXб╢!сl┴"e6a┬╘ЎnA8с-╒kBh╚B┴&┌╦¤Амг╝бI2┴╢с2A■@Ыa∙БтрюQбЇр■╨W┌а xJ2Н#ia№@Ц0╬ЇИD║p╢C}6ш@ A|!ab╙%MЮ2ARфi(HН<╤╥Т╟Ю╝yїр═ЛgоЭ╗rр┤ГEjU.`╛f╜*╢ьзT┬д5+*╙%Q▓l▒·дHTлX╜xСz─╔V,TеV╤ ╡╩╒'GМaBЕJ╥!FЬP╣║їйL├╢%у╘шХ5o╗дJКvM╪!7w╜ЪЦ ╒ AжИ-3х(╤кi┌ВбBф╦йAИ0ЕZц,█3h┘Ж╒Zк╙+_▓N┼b╡ъ╘зMб^щт╒lЪ▒\╖h▒┌─Й╘м]│F]*╘╔ФиPЪ:ЇйЦ.■TЛЩ║╘J1WО$]zы$>}$Щ·єh═Jv■,Х)Я3В0щ Х╟╧з]┬JU┌Фi)TЪ:u W,MН2MJД ЬJ░\С┬д╔*пА" $аD╢H КМ2ЕЇ└#=я─є╬<ъpН.┤ь▓К.жф▓L-┤└ +д╪bМ3╟─4КBнЁЄ╩$Лp┬Й&│Л%би▓Y%Ц░ЄJ*Я<т&ЫЬЄK*ХbI,╣°bЛ'З,╥ 2╔Ь▓╟'╚ДУL(Ц┤bLZмф╟ 1╨а├╠(ПД╥Л/м<вH)╪Ьc )Ь╘ 0УRЙ+╔мc<суJ'л┤BК)└<у ■-f3KжtТЭ+╚<# 6╫<╙М.гXB╔@Ь`Т *ЭtвI$╢e▓Ю)ЪHвI"Я╝"М-ЪhТ╔'╢°BJ!АLRК(РфёИ-б°q╚мф2Ьw в ,аTвЙ)╗ьB%жМЛ_МRЙj░(r╟ЪЮДЄ╚z╔тJ$ИДR╦+ииЄК*е`В╚!аda<ї╝#O=ьи├<▀8Н3╬┬Л,╡Ё▓ -Ц\╥ 0╩X9 )йМТJ.╜└Є╔%г░вJЗ╣Р2 )Щd"╔$╣╙ &3y╔(╝x╚ЭЁ"╠+Q╥╚&│░┬бd3═.}rK7╩tB╟!┴c╬5╪Д■╩╦└Ат█/ЬЎ▓m-╬$уJ&жt┼N:т\3╠*ЮЬВ -╛,c 7╪0 5╞ SL3╧╠bJ&ПhвЛ▀╪мC7╔иВИ}0ТJ+ж░К#ЫМ▓╚$Т,I(в\I╩╜C 'О└╠,Ы,вИ#░prGОа┬╔!~дrЛ,е╟╬И'╖─ТК+Ю}ВJ+е&5ж!ЖМ╥К!wТЙ*▓ИЄH$2оЗ$зlЫT*$Л▓I*Z▄П=Ё╨ГO<ЁмC:═р╥К,├L3 '╗,CЛ)Б"М1╗╘тЙH`о╚Е-P▒ JЬBг(┼-v│ PPLгаE/(gЙJh0┤(Е&A■ИPcзxД%ц1ПtмГ╚р-pСМ■hи"╢╞(0Б NИв╕(E'ИGИВ┤а%"▒ MToжAV┴ Q|ви╪╠&:Q*E"е@╞0B M░┬ЬTД)Ь┴НUb{б╞'·░ l$ГЭ Ж&,AЛhГИH6Цс @|┬╒ * iиC╬PF)$aЙZ#b╗и)2ФНj`╘а6И┴│Xи┬>Э`Е'БSмsЖ*<К@т▒ёД)H QXBСаDS╤╞Jx"║└┼G7▒КZдb9ЙE)┴>@BФP(TQ N╨"Ы0Es P░┬░е░─!СG■фBqиГ'j▒ЛVX╗H┼#╓ sZвy@Д(n╤╖\|┬еР3хQ0{─C#З5Ж·МeР╙(╙+┘,М2 G,вwиД)\КG,ВНЕ(4▒ЙЦ"й'Nё OШ0иx┼*ВХЙD└aОа─+N┴║WфbвЕ! ┴ mDCУш5║сМЇ Ф(D&nQИB№тУx─,ЮёЛW,в╕╟3J▒U\#рZEa ЭуI╬И╞4мq i,#╦x╞3кС gtc╝░┼)RБЛU ┬О0Д%@ё!╝Щ╟}8NSq(X╚вбP(2;КP,■Є└╕j$*▒ \Р┬╚║─╜°└░ ВбM─$Xб _pbл╚─,P!КZ уЫ(ДV°ИDl"Йы'Lr H№г°#°ЁF\e▒hE-В=Dи■z<╩!Пr,C╙АF2`q└чjв┐`Fe1Fты┴IQSхЛ-┼РK┴Y╝вХ╕D*jaТRLв|рD'(┴ЙG┬┬()■└CиВжи(D(Оq_lт├шб╘Bxbд ─+ОЛNДтлH3X╤ИP(у╗─!&lLГ┬p╞6╞┴НhЁвrО╚,╢К]у■╘╞-╓+ ч┤┬4^ЕvK┴ИE4в+4Е-rq P]тбР┼.\С*K─fЬ0D$fёЛX,т╨уZXИqSь&BgеЖ,;qYщЁ"╞╚кб WмbЩРL)nJХI∙ИШ9Е'(▒ИCdв▒Р┼-АQ /ЇбщЫ╟=╘╖Оs$C└14|б HАs▓PF0─ЪИGа┬аа┼*4qИ-л5Ы°─ч,q Zит@S .'v ∙╨GпP %ёЗIш┬╪oаГ*Ю▒C>C├┘°,╕1 K8В░╨Г"И╤ ╙CМ┼.Ш╤М_РтД╟еЧ╛Й_p├■ур9.м╥КVш·kRj+@ёЙS°ЪнШ.фе -у┐йDs▒ ╠Р┬GЛP°╙1Q Ebн╚E*ё@l┬┤x─6▒ЛbивЖD}Wц╜KTвЯ!Б │░ФrЖ ╝ л Sr BV г@-Й@3Еа╤Х кa ёё|Фаv'▒P ╡p UаєАУЄ ░═А ▄0▌└ ╦@XBц m╟ з-`Д ЫФ*┼╤ з Х|Б ▒@ /ц Яр нg │░@ ▒2ЭЁ ▒ВXv jBЕP █p >╢ ┌Р Ь╨Я╨ W ╗` ■ЛН` ├ Ё╙О@ ┘░ 0 ЮЁ ┘└ гТ(▀ж ╫А пА5}╢ Ф ╝p ╜а ╛Ё ╡А ╛р Da Я<о` ╔└ ╨ Аs О└ %b@╕р 4 ЧЁ У трПа ░╨fv─ ╖0 Н░&нр жаzЛорYЎ┴ЪРq}а й0 Н п└)3╖А а Kд#рgиbBЮA °@└└ Ю╨╒Q ╖vqY@яPїРъєч цр ┐ JЧq ║ ЧаXйpBеP ╠ Ч аrПР вP ї1)VV Ча ┤░ Ц>Ю░■ *с W░" $еgаPbАГР ═░ БА ╩└ м  сs┤p ╢А┐ ╘0 ╖а{╨ ┘р ╔└zП└ ╨Р&З.Чр ┬╨Rй@ П╨ ╣Ё └`1C╒ ╩Ё rд ╥0 ║p ╬░Sй]Ъ┤ Ы▓ tG d ж└O╘^┘9▓Ў С`У ж5 ░&зй░ d╒ 9B|ХpРоА Та╨В Р░ВP ╕рYМ└ оP З╨$╓Д КЁРа │p Ф@ ┼ ╣,▓` нРЬ% зтПP ╛` ╟@|pЁBЄР┘РИ═ mд /■f ║ Н*фЦ ╚ ╟Р j JБЛЧp ЭАS│ё к░ ▓P?tБ/В ┤P jзAб╨ Є" #^ЗЁ'Ї|а╛р$╖ ╞0 лА"┐р {ЁЗ╞ ─╨ x ╧╫░ kрm╞А ╕ П@}ЬА ╚Р;$Е ┴P ╠А ▓0 ╤░ м0 ШX ┬А :В ┼ ╕p ╣ ЖUD╦Z┤` даИP %CЕо)еЇ БSвЫаС` пЁ Д0kАm╞0Ф ║0 в С╨ ¤ё ЭА╨ (├ИP2ШР ╪5 Cш иР ▒РwР░ │@Ч ┼а■щ&в╨ТаЛв░ сP│Р ║Раїp·`∙`¤╧р 8йl┴p ╢@ ┼p Ч` з ╪7 ╠а ┐р Eё ╡С иА ░pБX┼ ┐ ╜р68Ц фd ╟еЪ╨ ╪╤ ┼╙FП`y1VИза └ Й└ ═а ░v ┌p НP░Pi╗└ l* хp Tд=─╨ GJ╫0 ╦░ ┼░ЬY°0│0 ╡╩ ┴ ╬о=├и┴А оЙ╝╨еЮаЕ░ ╖ЁS─Ё?╡СХ└gЄЩ}даdб( ╡ В░~ ─Ё wА` ┐░Э ▌╘ М╨;#■ш╫╕ юзТ└JГЇ █G >з░╤∙ ░Р ╣ зРДйРЕ╖!"K M┤i.╚ а░wPЫ{*Є╨┌А Й╤ ╞0ЙМР Ъ╨ ▓ ╟└ ┘ └Pвп)ў ╕ и└╝е└ ▓╨=Х b ├А░│А Р└ Ю# Э@РР Ю░ )\  1uРiш Ц@ *V Н■░╣╩0 А0 ЬТл╨ ═ ▓ЁWрр eг ▓╨ █└ Я  М т0 ╛ ИLG▓ЛкаИ<к Ч #F╤ 6Q Re ═P[ ш·GП╨!M ЙаШАO|вСpwап@ ╓[Н@ ╠` ЦJv д ╦▒p ╙ ╜С о@ ╢P e ╬}d─Ё Їх'┼0 Сt┐░ зAaкИдЁ м0 OмKфф к@ мР ╠К цw0Cюрщ ╗@b└р7╬╪5╙ ─` ╥@ ╝Ё\ў ┴Ё ╚ ╖АV╔ T╖ ╢ЁН0 %.7oи ╡`■gMбРТ╨ -ТДлРYЩ╚DЇTЩ ц└ жрc╧P╡└ ╛@ ─p ~ ╬р ╜░Ф+ ╡└ЙА ╔а ╠`NR╦ Ф1Шp}Р ║рсY∙ ╤р з0 ├` Й ВЙ╕╨ ╗ к ╖╬?/sLИ└ а &[ нОЖХкА zРЩ0нЁy пРАД╨кРo├` h ╟А ┐╨BЦУ ╒р Уа n"к нN┼ ─╨╩дАFлРЩР ╗ ┤ ═е2л0║еэ ═Р ╡╨|АЫЁ└╘ЁР┌░Й└@т└┤ ┴/┬ Шєe└@■b√┼ q│IПHЬххЗфг`u╜0 ╗а к │╣R& Щ(CгzK╡щ╙иR┤Фхкфй░_Щ0┘"Цм╫,\┬Оm:┤╚0WУMBХk╫о^▒@uZх+ЦжT■╛lSЕъ2\╖╞╚Щ/^=zўф▒#╥X/TЮ8┘:ьTвAЦ\╡:UJ░╕гLБвTыФйYеp╔Rх*SвMзv ╞ыХзLеLщBv╦$DЯp▒Ъ4К╫Ё`╡\Эъф)Ф'U╠ЦЕкДk┌│^Ш еВцЛСЫM╞ЖuZЇйШ6eТ0щкVMTЯP╔мa√uj╓л\╦tїТцн█╥Z`йER0бTL┼QD▒ШkzeЦ\@▒$ХSx)fdVёДХMЙDХ[JYJ:с$ТJNЙ%УQ6сГОNИQFQ"ёdcVщ─]ЦifMС%SP %RЎcEXВ■AЖ&LbПWj∙%ЩZH▒o5VFБЕ_x▒еФIZ╙еSjAfШ^ZAЕ╬Z╣Вzтб'Я{ьaзЫhФ╣ж`~ж\jDТXd╤eYТ%_^┴$NБд]Ж▒хR*1)Х]*еF1%Х^Т┴%╡@∙tM╚leЧЖjI%PLa╞V$хЩpкб┼ТPФQFDжRсИd$жhd▒дТe┤БцS8й%f░ЙЕФaО┴EPAхTE╣DO^q┼УJ. Е│XLQH■bБцШ\&Дcp╔dD[РI&W0ePXaЕФQшФEOVЩИQX╔х\6УЕ]^)хкcДСЦNЗ╣eХYXqe9йдiЖ[>ЩфV┤╨zь╤Зw└сfЩЙР╔ЕZ|ёеХM*й$Ф[n)ЖЧ\ИСe╖NБДKiДФ7[сDУJ0Y`rY%FMТl┼ad9M[TБ76Xp┴ЪhЖ┴E┴[╝й┼JАGЫ`Dсnna$ТS╕9цFlyцP2бEkXЙ$Фb╢q&QVfЪh└З GЕCT∙eЦSd f├`О ЦQ0 хХW~╔ж7■g╛fШS╣x╢f EР<IЕЦdx┴═йVlёеЦ'eВка╘)╤1\`ИаЁ┼4$Т#LШ"о╨Ч)\ё T╠х╩01PБ,[ьВ5F-T!5Щuти╞2*│ЛX╚iЩx┼1f┴ bМОдhЄAПz▄щ╪F0:╚#]╚,{нxЩ'\Q f\╛°┼($С &ZBг╨Д%NМ╗Hbеx/~б TtBеHЕ ]aЛ█Ат│╕E'*КO\B╖8Ж4ЬqМa╠В╥)С h└Ыа[8╞! M╠В┌0┼!"▒С T°в╩ШF5vA Fм"╩АЖ4Шq┴]\┬Ц°─*ЮГ3I8b│PЖ╥XPАB╔`Ж/(╤Fьfпш)hq YФb╣(-h! JРb▒Ё─#F [мBЩ`─,Ж┴ PЇд2с-zQМa└┬аh┬"░_фSd║┼' ╤И]бвЯbRЁаy╨уыЗ+Ъrxc<ЖЁД)D WЇ╓╕F6Ф╤Л[Д┬е╪вldсL,nтЦPEлЮ! ZxbмА╘j`сКPPт▓0═'RqоMРВ╫■РЖ1Дa c,#Ю(─!daНg└тu╙╚ЖД\!Нr▄bа╕Е5аБ L┤В╚ЕОО╤Н]Lb╛8╞*╪ТOtйF2╨AНglc╔°1Ь!М_DЇnЫ'!кR8C╫P┼,АБ G b^и°Д╧b┴ Ftв╣h)(Q Uу╚╕╠ К^TqЩрDgBA KХbкMsД*B@вt─'hQ ├JлhЕ*дЩ `рВФ.^Б W╕х╙л┼.sA CDPг╣xЕ(PQ;╪CЁИЗ;рбОlЬГ╓P╞,.СHИв║╚I2И!Нe№ВнH■)┴Pc╘┬╝│ Н%┌ВМg0C"кРE2ЪБ┘X\3Ы│Ё-FAК[шBk╜:е/tAМlL├А╕Г%К J@В╤x╞* ёIнЁп╪░(`! j ,║Р╞44ёИWГЧ┬Р"╚{ hLc╟Ш / м╩=Cц+д1 z1Вн85ЖёЛWЬZ1E+`ЛЯ╒BРЁ2*w иИЙ╨XЖ*бEФСД─>! MИ&мH.V1CS╝"Н─к┤ ZЬ╖╚-ФDКV╨bПшДч8qИB└┬-╡ШЕ-Д уж0"ёЙ^,Гx■■└x┤г┐ыP7ЬQHCЁA)─╕E+XбЛg@Ctн Е*Rь3`0CЩ░Dя`|и╗u;*╬`F.2╓оёC║·D,lЙЮМ┬мо┼0╞╤МDАA╕шE%Ёр\dгЯHД-╢QМQT┘°Ж.б e|уДhД2╚ёН_№┴╝hE'ТЇЛE<т╛╟6`МWH╧еФИD&jCR╨Н╠h╞7║б [hb;Н╞5^╝МY("╔┼+ФБ WPвsp_▓┴КRDй╓╪!Є╨\ уЗ8─ дЧ√¤"бРE/|╒QмтП╨Г#@БЛ`tц╘E+■Є╛Лb└BЁл8О+V1б╤Й/╕ ┼*P1ЛBъс Б╪'VA f|aє└З<·[ОsдC╔p4Дч ZЬШ:З5pqКMD┬┬ П╤ UhbB╣Eйvы!ЧТB├ F+(QЬM┤в{╔@,▒ЙQ\"zр─dLс eXn╚'zё Bт╟8Ю'`ё gЬтЪ╕БA[\Cо(┐3иС КУf╕Еў+ЕF╕aСDИ.SXКYHиЙЕ^└Q╝WhM Жh0бс@0╛aaш`Qбцк;d`╖E IРЕf╕Жa YШЖm°ЕNаГA0■c(0KPM╚4Q^@ЕТЙ[ШЪ═*C╚J░Е`└XHДBpaиТAЖZh(ZрЕЁ:s;FP║╙ЕЁ1[H N╕ДJ°NX'kh?0МvxЗw ЗГ ^HЖg@#VИXЛйeЁb`ЕJhДMnASx┴;ЙыЩ0N╕>л║а9Е+УcрЕS8KрTАЩP@DаG(зXHЙBHI─SиГ>иo└W░ZрЖjЁ5иfЖXРBрkаOЁUРa`└KИЕkPЖ▐│ДQ(Жl╪ЖjyЩR°Aсl`ЮhgP╡b╖F■РДY╚б[PЩ#4ЕLш4aPZX╗бЪKш[X`0мFЁД\`bPЕJрД[hЖ`Я3ЖЬZCаS°KР>Zxй╩[/tM╚<╕ГЪH╪ГIш─J0Q╨X└СLXРYxX(GPДKшДЯk№Ж№X8еb0╪ zЗ<∙)e╚lhЖ`╕PpFА╜]ЖX8L°Дa└Жe└ЕV_└ДA W(ЕрrS`гYш5]тUpMиaS@ДH`дVЁДO(N°OXД?Аv)Д@АДaH_╨C8h╨ТgИРz┌а■W░Z[j°H░Д┐╥Ч-i[иДH8nШЖZрДсЕf0Z ЗrmИkrиc/9 ЕM0bpЮl ZИLPIиbЕчГ▐_░f ├Hа:+вR оUhhЖX(ДKаЕX@ЕЇлТU╨R└Е]X╟lйLhДE5SP╩R╕ЕаЬM ЕЗТШTИ=(ДPpЕ`╪]╕N°СQ╕▒Y╚;_р _м╦TРЕ+╨Гx╕ЗzШЗrPЖтдЖrhЫЄЕSрДG_и Zа;╤Еn└Ж\Ё│с 4PРЕ╢AWпЄ2К`Р░RшZ╪иY╨Д@P■PШ YH#Nx╣ЁГc#Д:╨Д`Зe`ЕbMZ╪ГLЁFV0HР!┘A╚■шЕRа^└gHЕEXЕ\QMH?8k└╣H`V`Жm qиЖc Жc°Ч╔!dPЖh╨ЖmиiИёa░AЩhx└Д║Y6√K)Ё{╪Зy░`╚ЕЪjЗvАЦ│ВAhШЕO`C\░Nc■░Ж\p╣.СДH Е\ап╘RИЫS°Еf░Ечh%жЄфв╤@╚Дz<нH░ уJШ╟@8Д[ШiHФOрn`ЖM S@a╨AрcPйC└S░GK└V└AДZРЖhшAшKЖZЕиИЖoрЖl[HR0Е╤╚P╨Л╣g╪oЗfшЕOёПuNPДM░ЕX╨ FЄ╘В╔Е`ЁЕy┌,ФЖZ╝Д╝(ЖMЁ@╚лhRLРд\Ci├√IJЕH╤U8ЬД┴cУХZX ЪнA(ДH╪y"@╬°DXЖ\╕Д╛dЕ<мЬз$Е■(╨y╕ЗС2Зmшi░Жq(ЗiЖTЛ╗ЕLpN└РT╕ЕghЖє┤Щ=ж┌`ЖNxДJ(╖ЎZЖZX;B└нБы ┘ДНIДVpЖйE0?ZеД■█]╕E8Еh8gТ╣Ж_x c(iШЕDXT]BЕe8З_pДЄ]PDш2┴D`▒┌ЖЮEгrS8би┴]pЖl░G]OHOk8kЖUаДL╪ДU╨Е`АIO╕Пбб |з \EШэ▒F╪ГH└#J8BЁДOСДJаЕащДщ╩┬OP>ЦЛДA(ДбXа╧Vx■ДI(Е:ЕOАДт┬Е3┬Ы9YЕЎ*Ж[Ё╖8a\Иy─/vИЗwШЗyHuаЖhh╢rЖ╠7TpЩUpДщ╖_┤K орY░Е_ЖUXЕ rц+x1Д╠АЕ]└ЕZ`79╝dиI`I°┬ас ЕЎ2J ▐=xR█5РYиЖ`╕F@д╞рL(kG└\аЖk└лЖkи╟TlИЖPМYМ^_а,+┌ДT╕!5гЖj░Ж5UЗoаЖc╕QhчU@ЖМx┬КУH╚Еl╚[XEPДY°:ahЖ╚рДP╚bxb@рN@ЕUЮa╚■fш┘V║°┼<и╬O│ДW(Ж_ЕG°Д\P(┼╣╧нДQИaАKрlT╪Wэ`╨ЕЕлвS\и.] z╤ДMАуN Ж!╚zXЗskpЖРа*╗БЖB$ЕEXj°гМyДFшAшР╙Еп+зPрUXД╧}ЕZ` @I8vr0_А▄IOd8ЖW0-z└gЁ╟L Д@ ╣T@Е?ШД▌ИЕWА;Ш┴dИЕ╣Ж`0ЕF╕i╪ЖVHД╟■ZРU╪ЛmШЕdц{РkXY ?/c╪ЖпpnаktЁЖm╨aЁ╘▒Ю]рЕ┐$ЖPИ-N╔■jxYч<┘MМ╕ █═Я о0с97ЖNЁiЩ'Ц `Tш.\░бGpЇ2RHШ]°Nи ╥'╫Е=W└Е5Q+`КДT╪_ ╗4ZшЕ QPЕT░bр8Рw└эmАсmWllшьLX├ЩbЖй░DxГ1иЁ[и7TXДEИU╙▌┬_иь+%Dh╚aИЖо·NP(к QєJгл╗БД@xBШГB╞:0ДYИЖc░ЄP@j┤R@Жim▄лMp`ръRР\╚Й-=QHaШ FЕBЁйФ=ЕЩqЕT ВZiшgpЕK■ш968иеL(ЭKаV8@▀P`\+╖ю╘ХJЕ-╧!к*IЮЯC8щS╚6═АЕЕ<[pЕC\╞<ГДD`>/ы4╬иЕ^╔RP╡XXЕOq╒┴й]IRpV0и`╚bR└з^ 8иЗxPЗtH)gШЕg Зbс╢W[щbШKиГ4ШМtз╤ГAрДг1"3ъНJ(=ю┤]x╝,v╫Ы·Э?~<<шДH8S╨=`))╬йWШvU°Г?h╚еMU`+\РQиpB`aрЖhhЕIллЫ^pйVИV╪m1ЎDР■╤─ДIиДLЁД)#wc`RШ5Яh╚Е&ГF-БЕI0─JА°(яЕ)Зч(ЕV╬NHЕ№А)mT8·?ИCшДS╚юCUрХU` M╚рWаЕN]╪▓┐ОTCY@╡ЧQЕс4нБД▄`ЗАЕOаДKЁМ\$иЁ│1аГ{hoЁЖq@ЗnHlЁЖi╕║╗3"cpЖ▒ЕN╕<C-O;╕,QБ<┬[h╒Fа╗Яa╣vQ█skА8Uш зU┐d!B├&╤иWЧ]*H▒l╣&К5о╪'@П|a├Ш╢jм6 G-TJ╩▓їRT(Т.f┼■|}$I.kрtYr─h([└В∙┬%лУ'OиДe╗f,иLмb єэзHзh┘J╒╚жLйf┘╩╡ ╓)OЫ2Э╩uлХеNеh!√e+ЮHм|╤BD'OгT╖\ЙBЕkV+Sйlёr╡)╘,`│8a2kV(GШf▌JEк╙кXв[щ КнWв4q Х╦W/WЩ5вtЦ,[▓HQйSя▄5i╒┤IєElY3c╣TЙ║Е ╡`░`m┬фйTлTЭ2YBtЗOжV┤z%█fЛ╥вEРHїFьЧ*GГ.╔ъe╠Z6]НMbJ2╪ьbzLт %МPb╚СЁтL1Ь,Т╔■1┘HЙ%╗PєМXз8├ /ЬФRM7╜dr-╘,cКН╨В═6╧ь !вг═4▒Dt╚'░3═7хФ╙═4лД"Й%╖dS /л°"╠-ЫФb═8╦`╥И*╕рB╦)йИ *▓ЁB 1│М╥╚}ц┼вI'ЭШ▓╦bи\В╔&оьb╩&И(2К^Ъx┬Л,МЭЄ /╕аK,╡╠╩"Т░V $РЬ"Л+оp2К,╗╪╥J,╛╪тK0╖РrI&бЬR╦/╣Мb_ Ю╕2 1╬#Jw╪у╬8╪$CМ.╦ь▓ 2└Ь"J,┴ДМ(Яс"L.аpRЙ"П("╔"Ь╚R .┼4 )Ж╝X■К.╞╙╦+ЦьQG$│ S 6┼dтFйш2═3╕`т╚cЪ▄С)Н ▓К0╞ФВH%║l│L!rlM5┴░В╩2╤pVЙ+╪,У (▒DН,Т$К0хTS )Ю╘ВМ4┘└r╚$гит 3╬Hs═6█dГM3╗xЄИ(┴├е5╤ьB╩╧╬`# (x3╠0╢рrК%∙" 4╧)rЗ"бЬц'а▄╥K╙жD"H&╜ьRЛ%НtВ╢&П|RКвжШBK┌Ь\в +▓lI)м╕╩%ЮШ┬К-░┤rK1┐мB +╡ш /о%6J+╢╘в╩&Р0Є *├$M2н ▒╟=є└1╡┤■┬Н4┼▄в╩)╖(├╠0нt&╔.╩ s $О№▐ЙЭЫ╝Т +п,ў╔$ПЮв╦/h│т╔%Jк"╠3╘Ї▓I!z(ЄК3┬|н╩,═4Г╦ВВ!bЛ1▓RИ)╠XCK%Рр▓M1иАв 4╤ФЄI*┬HГGдИБR \д╟|О`Е6╕с VD┬пx╞4ФС Y└B▒pE-ВБ hрbУ┼,rБМmФkо┼(Ю┴М\м┬┼81TЛU░bй┼,К1 \|ТЁД-ЖБЛ_└┬a0`ё B@┬╗╨┼)2Q]░ВДИ─(XAКOит║АD#Бг]ДтMRTf■Fq ╜╪mж)*j! aшВ╡╙*\ XD,бА┌wб=╚уЁGmVСМp\#Ъ└Е╒X┼K8E┴8S"ЙM№внр(PС*╦РBХ°─+pС [LB{`Г╤ i(г|АDтВ▒ Q─┴╕F3xё╢A╠AХ╚┼/(GЇ╚░Д%j╤ l╠ЭРE7в1 W #╧ЁД"JОiд"Р░е7иA E$B█ШЖ/4б Yг┐░╡! GBqb-0 Nд╒°1аA B4b╦°(ZqМaИ╤Й]4(+XQК`р"аЁ─,В■┼М╬b3╠`12QШaГR/╥╔З oi╢p┼;!!,WtВп(-·Ў \АКтуE.`Q юФi┬P!*■ЦЛ`г▒╪D*^єКaиБьX╟9╩бНc▌░E#H!НfиBzЭШЕ0|qЛZ<+m╜E.hсЙ╕┴ВцЄ─*С [╪Ы`─┤FZуС╕C┴КfdCН╪х/д= ВD)QИ[hcЫр(оСНZ$В▒└,,pNi╝тTYЖ'С cT├vФШ,О╤ f─"вХ+БЙO┬л╘c%.!Нm0В=E,К1■r└тбxЕ-И&ЙI°/8,E$┴ SЇт▒@,FБдтэB░▓╕\0~┴╥Ph┐мX─:aЛU`ВДРD)HСЙQшbtЕ-"G A@Oи╨D)░2 SаВ┤┴Е'╪%FхB▐1Е.╨ъЛ]XёЛг└ЕЎ0П{─├ш╨6Ф┴║ ё"УP&╢ЇЛ]╝┬┴dмДх63 Q└в1хD'"&Л╫'lD%Ja dЙOМтжрД$*A╪>╛┬Э Е▒ЗQm0э┌█Їя4ВaК5шбб╨4ЬсЛЎ╩┬^з╪Гna 8╝a┴аЕ$°`КЗ■9ВТ╞╗№ n<├в╪6Ш╤ G╨┬═аЛ*L}НUвдH╞KЮAЦK4b2У╨D*ШaHbC╡p4╓Ч q\├vШ(┼*╥]Нh┤Bз8Ж4ШсКA№бOУE)8сИ┘b╢y╘Ї╕Л[Ь'п@/ЦС RРbп╨D#4▒ ╗щ░P▒P╣'`б KyBa─#ЁаOд"bд°┼2hСЙJИВвP (ё N╣BPж┼▀^Б╝;#е┼Ё wd├▄ш{╪╧Б [▄┬┤╕к/^Кж└ [Д┴ЙW╨т[Д╪╣/Т1Ў▄ДїСVP1А┬■╩▄ghВ"аB4└─m`┬*LВьA,─В#В!└B4рє╣Х(EВ&├4╨%dВ.`O%p0╨&аВ1$й9 B─P┌)шA$мВ(°*$8xC50╚B#BГM$▄BПщВаd%PF4╪П*╘╤1l2x)╪_и▄┬,tД$дBКэT*┤┬+─0D (мB^5)`Bе└BUНB*ь-и)╝B,рMхa&┬&░B1xВ BАмB■╚G(В#мB/Г+H┬!DB'▄!/К,░┬)А▌эВT¤)XВ▄┴9h├ЭY├D!├5╨ ╒┬■1№-и┬Ў▒▄0─┬)lB╘╒БП╘,` ╚V1├2 C($В$РИ.ш┬в Г/Д!рAс▄┬20├(Ї┴8B0pC╧. Bь+D)╝┴Д┬к( Г2иB┘В58C)$г0\-hB-LC5|В"╝П4<-┬ TY%Ь.$ВXВ$C*`B0lГ2рB+А┬#d╚\┬ЇA(ШI/@1tВ$дЮ1╨Z. Ь-\├3м┬oЬВ*М┬{Щ┬*uВA/ИI,╝1└?╒B1д Z-_&а┬+,"%А┬,ЦВ%Y_щв-Е┴╠$+|└└р2У*м▄е╚■-<СBВьVхB╩╜НUXК,а*dXГsW3C9XГ.┤ZрB0╘*РB╣Вm▒BHNB╔Щ┬бp"@*╚ 50N$@D)фВ4xа*░Q ЇA#╝BйEC14B B(PG-А,<Г2°A\┬1C!xБ"▄B5─ВВ/dГ+ш┴!░c4─"ь┴,80|В+8C∙T*№┬єФ┬#`X╕0мB @N Г3├0X├4и '\G░╠U╘*Ї1ДC6ьB' -0.h┬%░┬їд)О)|В└┘)PB+№Вy╪Вд}B+ш-t┬%'Й┴╩*■t┬#tВ Х┬" (ф%%8┬'╨В╣Ui─фё∙`,XlN%XB$├M╨c%tЗ┤°"и-А^+Hц(ф╦{бB,Д╩▄Б7H├2\C8ЁШ6<Г,K/шP,мS┼+и┘°╦!5М┬я└Ч╝)TzйВ.(C╧щ┬ЖВ6в╞3@├0ЬиБ%ЁВ4шB╚хH0HВ"╨┬1АВА┴(C1@┬P┬5y┬`B/xC6@Р&02h┬"Ё┬5ВшО╤qВ"@,,Г1 ├xX:ЕB┤C0lX"X0`Г5H├4*4"|┬) Г9PC+4B╗їВ4■%░═.LC2%@\┤B-▄+TВnф┬Iе!PВ(─Ыё┤B)И╤'0(╕&h┬(╨В,DВ,и┬ChB,╝B'$LB*└)Д%\uB▄#pВ┴▒P+аe&@В*░ВЬ- h┬'Д┬'АQ·нB$аЧ(Ф┬,№Bф8 ═5|Р╜Ї╩3dГ1╝Вз ├3 ГПBщ В$─RК┬W ╠DЙ"$┬"а1$KеВ+╝c$!РВ14Г5─╫#╚БTВ3$'P 1L,Ф▄гMВ┬┘┬шшA"р┬4H=rdDюb*╦й4B"(Ы*0Е┬&!HL2дВ \В3 C'ШЬ/@Г(Д8зМВ■@ВG>Г(▄с0@C+<",XГ0,I4ш┬ $g1И5°ВГAs ├'$В╥FC/|┘,<┬#TB&,aЩ╦,LC.├5\Г/д╛вВ5T─тBb78C(┤.\C4C$▄-ш.и┬╟э═-4M0Ф_\B.4*╙Еу┴Bэ=╧)hзt┼*|Ю(ИВ.ш]С╥,╘╞%└Э*мBЗ╔B1╪Ь ╕Ч.└B*иВ6эН-ФВ0┬ T+Д%1Аъ&А)ФВ*И|В$°┬3║В0рL5╨/╣ S╤B)0В8┬Л╩┬+└B!xхТ ГКЩВ(LВ┐ИX0ь┬ТФ"(■'┤В/(Г2Ф%а▓$╕fсB#шA+T├)┬┘дЩ <Уe В%ок/МB=Z├/T7VГў+(┬&ф┬4ШГuf┬&$╤║┬"h0XГ7и/╨g)д97ЇnBb`R-0CuxВ%Ё'6РL-pХ3LC7 Г)%3L├,$ p]щоK╬┤Н╩(АK%╠┬г1чx=jЁ1#*PВ@-Ж(ая|°,╕Bг B┼Юи╬╚&РВZCфцA!ЬН-╝┬ 'Р║Ж$B°┴$░/┤#╢~╤_M!W┬/(Г1мъ4<445$Z~┬&h$$В&╨┬/▄Ю*D■╫&╘sM▐Vщe▀*$к!H┬'ШЬ,°43Г*hnФB28C-\┌)├2pВ!РВ2|Г'шRГ&╪┴|BpzВ8~.Й%4╡4ДГ7Р(t'░▀╥'PВ-l9LГЯи-@34╞Є0├1|2pN%$B%H┬6Q!▒ШТ3а├Йа 1~Г5╘%,1 ├(┤G&мщ1╕░Эм┬-|б_AВ$°╔9яB9є┬1─B)╘/°эL.Ф2>м╖hB(└В(4┬А╞B'#L┬дюВ/,├zdB'АWЕ%xы,╪U*<В°Бх▓┬Щ╪+Шс*■XБМК.C╬-9РГ3H,L┬#а ЁUXеBЭ`B║∙В╚БЪ 8В*(╡БB#0Вцж*░BjtЙkX$PB)hъ2ФB!╘┬жъ┬d╠К2HBxBV ╨A*(├>┴A"°B3фx╚7pГЁцD╖=M2╝┬'\(4CjеBVё+HC.╪+)ЬB+D┘7LГ3h▐)0B( +p#7Гю┬3x6h+Ї┬wС╓&ДК¤ФВ"┬'$╖1╨ёbПW/(├.аBФ▓0|-╕В. Ъ╠/╪'X°+╚нй═Y┬%Ш┬)Д┬Р∙М▒▐Ї╜ЮQCJСH▌аB■&┬ l!)╪┬З┌╫╬О.А┬'╠B-Де-X┴ИC7$4 пЯ6ЁВ^╪$РВє┬.P,4B┬ ёB+!° dи'  XВ)абк zJя*16шГ╓╡08Г1МR-А3x┬ ┬пT┬ЇЛ04├-p┬!Р┬D¤В+$#1РГ5дB$BDВ0L├0Гhд[4ЁВ.LВ'ЇB-ф╟щ9BАх╤,XГ6C7Ш├6@ГT:В│CНЎ*щ╩В5д2АВ%╕B6Шъ*TВ*╪2ф┬&4B&h▄24Q(`',з╝с┬(tЩ-№Q^▓Ш.╕Bo─▓&л,▄■В&lВ)фВпМB$`┬^ЖB$@|!Г5C)t╗╢ВR╚B&x(╝┬/╪{$dBыЛ╚╬з┐К┬#°Eш╔В╚Б6@7░Ё3p├6D├/`+d<╞tк.В TЦ'╕RQ5+ЦCM╝"┬╪Aw║R╪"1м°"И┬*@юг╔5}4╨╫s∙═ж┬ЕяB4╪Bф┴$╚├├Э&фB3─/495OГ(,Вsо5`ЩJ+47,▌ЭўgGPъ9hГ╠p╡.Р╧7░∙'╘ЕB¤ВcШ5'l<1`В!pВ28▄,0B'( 1Ё┬╫q╤┤]i&`ВE╖ОхиJ№С+■trв░B(<В ДМ-Д%KЫZ +╞ъвM▒hХ┬╘I╒мb╠КЩ║Дън[оjбВuJUо`╝VqВ╔╙'[╟|е┬ф"AШH╔тeЛЛX┐x ЫхыШ▒g╥Ш!Kf X-]╢D!тH╤E?С┘Т┼що]лDy╥─йП Е╢zхЄ%╠W,JД4┘╥ХМX2_Цm╥хьW'Dз╕E╗д╚Ф5p╬(Е9фл/MА╤Rц╠иZ╜Ъy╙6L(J│Ф}kЎйQеN▒мYv S-a╣Ф)U Ц0f▀дБКд(СвO╡РY6*Сйe╞f╤Вj╥)fоeъ╒ ▐│Oв`╜■vЛSдGЩb═КEк&Sи:yBEЛХжO▒pїъt╚С*a╕6Хb╡J╙бCЩ╕n╥dъ^\ёСK\щЧS8╤ФYrfЦRZ╤фXb)цЧa\9eФЭtYS4yD2`~╔┼ЦZ2)фLJy%Ц0xES`a┼iОСFcД1fTФ%;.IхYha╞Ч\LЙхФP\eG:ЕФG81eQжV89─RrСEШ`ДieР<: fN ┼jdёCТ_вiFFеЩe▓┼.>AЙFXBH▓0Я2tсИ7░■БP┌╞┴ nlГ]№┼/pБAE0┘┬┼Mf1М^\┬Ч(I"┴ИP╚BЮ,Е.rё Ntт$П╕D+Ш& `▄ДЙЁ├&ЖqМQЇ!┌├D#BС _D├~pC$Ж /"┬г8F7а Q▄B▄╚3nБ;LЎ╞1raЭjМC╗x0└q├Ьр┼4L1 TЕ(Ц2Ц┴КYDп╚─/┤б W$В╖И4Д╤ЙDФB╒И(БЙ`XCкPД 6zЛ\tDРЕAбI┤Ї├h╔CT┘\╠вШE-v( R°тЭР─+МQМP"■Х═E) бHмТЮH┼(4!КWрb$╢АE)Fq cЁb│а00K Че+лxE*rЧQ Ш╕BаAОqDу╘Ш╞2· Y╠bа└#-TсКXаbQе╨ГЙDLвЩим-~╤ТVИ┬xД!<ёК_╠вV█╚е#1ИJь┬nРи0GёЗHЇb╩ИF)№PVЇВpPГ@╤ nAz!|av├zэea┴ШыG■Цn"p[╞а Кс▓!КВ┤мс╥B5j┴,┴┴(б4═┐РБpб№А&!&■@┴МAТ┴Юбn╩eЦмК┴вбz┴B┴№└@хt$JaъАLaзкБ┴ с┐Б|a2Al!║┴PaHс.жAxбYa╓AК*┴┐%,скa !ЬБВтЮЗ╚!xKКбдF~┴2\┴сДБм!№E░сXatcЬvO█.╩hЙЁZ┴,j┴ Б&|aМГЕЮбFБ?ИсДБ■'maЖ!@бh0&2(Б№ю╣┬AжЕFэZ&┴.A╡d! ╒4┴║Жlс*БHaj▓@ jХбж!Осjj!ЛXAD┴XA^БЧha╨в.Ay a0┴Hс^!rjс"Ab6/rБ6б+lХМaДсI5q)ф ВсPt!б2УсNсTд!вб┤є╢Aа┴R Й╠nAAXA`anб4a╨·ц:J!#zOи*Ь$лр2t░Б@)T!╩╨I\┴░Ala╬шnAЦn■┴(!■l0хоНТбdбNс-ъ░4бС┴.бxг 5°GРЗN!(qPВЄP▒ :Б*a= 1щМAXБ#J┴Ё╞МpAZ=! ╞@Ьб╢бн▓AЪ\!┌tXa>с┬Ас:═KJ┬r├+TсfмBшx╬Z!TБ<сЮm3Ч!╝/!БX╨╕щ$БУЪ0lцаа┌)Ёр\!ж{d(║┴жб:OО!жa,╩nбЬс:бAФбЦAHa+чє╬~j5TB░!dвмс■ДaNсj!n@Xє─┴┤@aвбтLБjd╣$с6┴&АaEa7тbJА*'-вzК┴VgВaBzaipA=0┴fha8БJdб.f`БJ┴h9Нlс4БAfa>R! ╛L6Ф;& ─аИ!в┴0Ыб5вЦ&,T!eGвFA\<сAN┴┬╓Ртx. vAFa~,iбVATГLеefAРra ] сdа┴l!ъ└pЇЯ┴╢боБ╬l─r╝Uо╝Б■Dt%■ЎАиA|8б╞!Ar!,aл░Бшв╛бjсЎОмбШa,a*╝!Цa*aЬЪ!@б┐▐' KбEZЗJБ° D┴"╩ўмaeбcgБrArgАa╫ZБza`4a.Б=F!■Їg2Иы>T┴втєдс UЕ╛─▄с·\║сlс^!ииaЗXaо╕б~!Т9V┴░.Б√═|X~ЇХ╥L┴╝!▐L!Т╙╩|p2ИбўFavб┤╨ч*┴|~A$Б]3╘~MHЦсEYБ!~бpБlл'`!SqKIб$с┴4Cб[!a╥nA╣╡р░Би■сШбвЪыzсnЦa`сd┴U+(ёоПєh!y2A$уМП┼.VсР√i░╕8┬Д$a*a·Т╓тшVасКa┴,A▓║Бx!X!z5\┴YБ└┴Шбkс└б┬Y!lс3Я!Ю┴\A6 (Eh┴и│aаA.aдсВБьаДх╛Р$ОЮсfJ╘*!цZaзиС<╨╚}6W╙єHкШЪ°ЇNб Bvс6сЇб}A,√рВ█░b!?с`A5|Б<№ЧHapБtWБ"!■$Б╤P(ИБс?чtIuKьE ь└╩┴uФБжМa^яихJЫЪбjсЫa├з4┴b ╥WКбую@┌.|!HТЖєGЄFcад└ ╒Vз░ИЧЗЛ`} Ла■w4 bХ ╔ bх ╩╒W|░*У ▌'tvW Мч ╦╨:цД ┴`ш -а║ Бё\╪ · д╨ ╞ ┬pСйР │░ Lс ╥░ ╔Ё&f6Ых и╞@ xd.╕р ╓P ─А ef!Х╢ ╨` └р З┘D║6kW лР ╧@;;[ к ═ л ЖPЖ` м░ Х@ ■┘ *УEbщA /G БА УР┴Q и@ Т `ла ї ╒┴ н└ЦЛРНD И@КG╖@ хШ i√ЙPsа цp╨(жа Э@ Ш└ШїєMt6 ═vЗH┬ пАA5 )■ЕZД∙ ХаКP PUАаГрМ╨ нрЯ·Ц ║р S ╡р Э└t ( мр|Э ЛVМ╞ n╩ ╚P ▐└@┴T║р ╪тр ╞p$ Y ┌р ╗p єy ╚░ у` ─ WXк Ж┴ 6з╓Ямp Н ┐p $╗'∙ ╕0 ╘5 зРEpyС  гp1─ ═p ОC ▓р лe ЭЁ~p и@VЯE▄┬ 5гIIЕ л╨ ▒` [Т!|░дч: Щ╨ T█ ╜зk╞@ Os ░а К╒Г0pР═бд└(сst░pqа р░3╕р)W ■Ы0гЁ/п└ж▓0 ╛╨ ╝09hSг╚ ╕``ЭP'Лp ╙HШ@Х▀H╛Ш ╣u╚Ы┐Аf╣xJ0 ╔e о oqеY█░v╗║NH% сPю%q╠# ╔P ╪ж╫┬l╞` х╨ р CT ╓р 86`a ! e_Яр ╟ ╫╨ ·╗93Є ╪░ ▓P╓є ╚л ╦└┬╖ Юа┴se ╝в Ьpg└└ЙЖЕ Є6и░дг░t╥╙ ╖Р ├а┐╡Ё─╥F ж╛╘8Ор{X╒є@P╘Ю·┴l┐р╞)╜Ш{@П Н`0xд 4# ^ ┌а╩R■ ╬6Jе|E╣Ё┤┴` с3>╥╨mЧ╕:╔а │Ёc▓@к` ИРа ░А Шu PЖ╡▓p зu└` ┬╔ДXШр е└r┴A`5Г7╨wШФа┴╧╣В╠p сЪ ─░ ╢У ╙p!╢└╛)°x └@-H  ╟р92hЪуp ╥ oиР Щ С╓ ░0 z▒ └% ш2ГW ╥р р└ ┬ Tщ{m├ З bЄС═╣ ЦрxГцw√╣ >√ПР ┐а иРТ╨г╡░ЮШ`e▒Р{л Е`~Ф└bй о╚ЙКУ?5 % ░░ Ф Р¤Zp}рЮ■╨ ТPPр▌`╓а ╨с|юТq▓рKХЁ┬!F╖P ТеE╩░:бЖ └Ё<Хъ фkZ╕А╬ч╗РпЁ ┬Qг╤ЛЛ└гРзР Э ═й m╘ Ъ@║>:лЁ ╥░ 6т ╡Ё ╦P╟╪@ c╙=┘ў╝ЮV ╟Р╝╦=9$▌аo╪0A╙╨ ╤Y ╥0 ▒pW\╤╞ 9Lг╥0эьG¤╢F╞А | |$ма.╡ йр╪ъ▓П╗-pm╫ ╜р╙╔╨ и`!х─▄ЙpШp з д╪жT)╖ ЙрЛPw3·w3U3wа bЕ ─└╗Е 7 ОрH■Я└ЁEP▄░ ╦аt╘╒╠╛С f╒║ц Л 3оА П Аё ┴Ёw╒╢ ░`аO&G3= ЗA yD┤Л[V╔╓╓Йwv,аT у▒ u D╡Ьx nQ ┼@нP ╧0 ▐@╦╨ (u ╞p 2k ╤ ╒╨═╟ ╔░ Р╒Ечp ёч ╟└ СЁx╬0 ╦`И╩ ┌P ╫p ╕╨ Ii ╤░ 'є ]оЕл╨ ╨p zBLЮ@ ц╤wL ╩╟хК╙ ╨╓o░0UьpжР╣°1 Б░!Ў║(К`├Т0Y· px ¤ ]о]|% и; }2Б{ЎяrW< /■ К з0s ╩ ╫Ы│BЧjЕP Н╖ м ZЗPЫА|б0 ╛ R▒ п.я е ╖аTЬ╨e╟═ Ь└ЛЁZФ░rгP uлк░йQшM╤УЧжc@╣ЁV╤╡╕ ы╟ ═-╤░ Ц╨ 3ЛO╠Аf┼р:{Дру▀Aи ГA е╔Z░ п ┬p ;у °щ с0╩╗P╪м╨ ╙Ё щ`▌р ┤╨▄7є █░ ╩p 9Ё─ в╕┼╚ ├└ ╦`9│р д ь╤|кpVА'БН`Tп╨м0 О@ СРБфl т╝PfйрвЦ И`<ИАо9■ь Ллпф9<Ю ┐╨eрв▒FrЗЙ ,r ЮР гf╜║{гА╬╝p╠ ╢╨╦Рp f▐D' НPЙ@у/5 Ф@Н2ъМ┴╜░Fп` rоеР Kи ═а ░D У$бPХц╕╠pиїж╤р ╤p ыy╧0│╘┐сР eA ╜рJи. ╕╒╬┬АcП@ +Е ╡└$╧∙ш╤Ё Ql)^┼аm#ўM-TиT╤2Vэ4cЮ,▒║%,░b╖`╔К%л╫▒e╨ДСЪДITйV┤x∙┬ )[▓hн▓Ti╒.`╔|╔zХ)Р Gкzє5ыUо\└~оRК■%HИВ4 ╥"LнZe╩фкW1`╝nё 6мЛШ^╗t╤┬3VйE{йB ╘еHЯh▌ZE*Uн_└ВSЦL╪/\м@q*kмXR¤дИТ'RзTе2еJ21c├|эRЎлUиPж@U╥T Ц-\╜И!│E+╓,Zн<'╩┤ы8o═fс╥4╩5m▌к5√еt╒+cс└Еуэ╪/[оdн┬4 Uпe╫║Х█Ў \5dк$UтдыY,HХЦЫц █.N░@├2&Ыn░▒еХN&сДЦf┤ёЖXИ╔%ХVd╣х[jiEФQb▒Еbb╤РP4Aе^Ж9жЧV8∙Ц\■`iщZШqF\:1$СIT╤┼^bqEaИжB^vйeQ°▓DУJa─ТSN▒УWzЩМv▒)Л8Ф)&ШZn╤хЦR0СфТKqдТQ>∙ФN8!┼ХVr&]h╦е\t┴EW^СеVpo+N09%дZ▐2еЦYP{f╗^xAMLБЕЦu ж]x∙┼M1EХO╥D┼o╬С╙I^╨oЮщ┼ХR\∙┼iЬiЪ├МсEV@EMЁzdТ[ТYF`Ь▒FЫEс$pФ %HL┴┼Чcдiж`Z▒дСL`1иЩb`й$СJ`ЖgЖ√eТ■E69┼Ц_Ж┘%I6∙фХ]v∙│╠TКeЖ▒хG║╥ebxйE`h9%▓┌\bmз┼*jС aЇт║ *V KdтpаГ!qИC0тХиш4█$уN0▐а╞╞╥W g╘ВСx%м√їIА╛╪+8К ODтg╢l┼+\AКPpв■JдШE/T▒ и4Чм╚X0nHюKt1╣нpEZS┬Ql╢Ф`D'T╒ c#ц@╟6д▒Л^Їт╓┬E0Ь┴ ]ф"╩5ФСQЛш-├Х░Д)J╦У\╚tИ╪╫+bA╪S8"╛м└║+:С B([▒т"DСKЁ┴bNЮа─"ё╒T└┬¤╕8▓ЇoбЙFЕВВ╚J шЗ= ┬Сx ─bLА8Зl╛cё╔РЗиЕ1∙]`B3 \ИЕ?Ж]╚ZP■Е╢╣WШЙPxДL°OHШЩм$ъ.OJ╣f·NxМFpД┼┌▒Ip3H╚Д╙rGРДXXЕ┴Ш \░ЖaАo╨Ж█╕╝^Жb("_°#lw8Зl╪u Зn Зt@:hрfаЖcИЕРPж\PЕJЕSЁДPfшt(Зi0╕Y°ДB╪ГE`dе▀YУШWаn╕Ж`O°Дdиi└ЕO°ЩF YАЪI╪?PДРыДUРSшДўP║╩╗lrBДBpKы=ша/]рP№?HД2AV└ЛM▄Е▄pЕS°╝JXД?шD`ДqDX(#Ч╩ЕРy?9ЖbшHЖdСВQhW╨└┐░XЕQЕэ[ЪOhI╚H8$╔кДАКNш┼BHДH╣O0Е∙й<█SЖ▄РЕbрЕ4LЕШ╚Еc@Жeаl╨vhlxЖlp7Фr(Зq(qЗl┼Щ╝t4dрQpOиЕТАiИgИЖ[░C`ДВщО^АЖiИhШЕkCТ╪F[0пЕzЛR╕ДVж+╤ЕQ`ДB`НJЫ\╕ЕFД@АOИ8▌аТCЁГ?(ДI"6┤Ж!i[°HрГ6ш╕■OШ8уEF╪Д·A1╦Е ╠7AЭ({?0ДA`ДF1Ш_°b╪ ╪RКд┘ чК╟C;▌ЫНXАЕ"ГZЕ╧ЩЕёs9WЁд|кЙVШ=R(░.УД^ФТэR9^╨X NЁ■r'3gа/Г2ЕKиRраQ(-P0Mз`m╚*l0k╚ЮU░РЕ┘*jшnPЖКЗ;·=jЗhФЫ░Д\BЕRрЕjшph3+-UЕJ(Ц[Жl@P8Е] M[Жg@Ж▓ ЕYЖaрШU°ДN`@aJЬСOOАМT╚Ў▒▐╝NPЫ qFpHа╨B(■ДM }▓1╨АDC╨>ШIМN╪K Еek╡\└Ш"Е$i5ДIа6шfxV░JЖАЕY8│2qЕя╗(VpК\Ё└ЁA╤√ ╓viЖcи7_╨G┴BЕ2'[@ю*V░ЬZ.╖╔Ш`Q`xЖiXЖРтДj╟JИ║MЁL`u├Ж=┬rэЁЕ+QIЕ/;яz╨[hЖ]8_ш#,мЖru└пЖ\NU@Д>╚\kxзfИc0┐N0ЕXР>cшT_0ЖSАм╘йЕ[Ш*ЖhрЕ▌tЯъТ_РSаДGаГ╔ЕK╝] СZ■"и└@9°5┴╡▓┌ЕНРРM ДJ8ДBАГ:8BрEHшДNXэjСy ∙СYhGNа;╕Жe`Ж┼шTШcа╧=A╨нщУ^╪1Mр╤YNУiaPЖ`шИQ░AQ╚Е─╧;]┬ЕbшЖ% )bАdшB юЩJДQ─ e╧W╨]°Еe└ЖТЇg╪d└e{ЩГ^]·Е``LаВБУ│БеMыЕdЁ┬РD_АЖэ╝T╚─O╪1O@к ╗fнХ█ЕTиДbSfHа╓┬U`9МщЕE║Vи▓Fx╨m╩dNP■3l5 СЕK╦HPhв[╪Е$Ыя{ДDД╔ъ╥0- AiЕQИEpC ЫнДH8A █G0JЪHИД╡#Е8ЩВ:─`[┬Б Tb╨Е]А(- O▒[h4╗▌╣q4√q ╔ЕfЕU╨eЙYР▒KZЬ!i<мЩ▓РЕSрїa?╚Г=и╤ъ┬;Kiрj8╝qр┬hXЕЬ╨Kш\P*нbЖjА1^Рм│└VCMш [^H*─╜lkИЖa╗╤лMpЕ╢кбв╚jЖ2Zм√∙╞`р@Vа Z╪Еh uЗ╥Є╣ДЖ■P`Hл)▒ЬM8╥LрДоBДЎ!и=█╤n1Д=Д~╘ж╨шОе└.Б тFД@(DxD╚@ШДMкpД~7╨─aБ╜РlЛFШЕP╕@ ╗M─╘`ИЩ^└c0╕ЩXЁ╥╬Де╔0ўГЩQc b Е╝&║ъ  hG°ВДFCиД9edрО^`hИ╔1"MWXQ└X@jxЖqIpt╨Жm╕ЖkрЖo╚ЖixfИfаLЁ9S°АЕ▒YHg└h╪^╪Ы`╣O`VР`Рjш▀i0ЖUШJXТcPЖщр=b■иd`ёг_Ш▌S╪ВЩ¤┘│PАJ╪│MАM╚5CLC░ ЦЕ>!=EPДD@шУНЪJ┤Е▄алVилTаДF@>▓ёЙтSрDH4\Л4РdfфЕЗ;)░ЪРWg╓8ЯєБ6ьaА!"CаМH ╝█Ем╫RиiuZP░ ЗxЕS8├ЕЩ/h)ЦЭdшHЕХ*иёщДЦ4_└│dрЖq╕Sm╪%dp@f@ЬjИЖ├ЗsЗ@║F}кf9Й╕F1e╛Бo Зg° ∙Ї$е°╕\аф@├ДJРoй┌Г+?╔\pЖ╦kЕн,ДFИ■Nъ"МxMРД┘\Д>XДf╣t╓┘╝vьДMАчF°<рCxДB@╨МLрпЁLЕ█ъOXаЭ _zЕVиыH0kKPВ5░iР_ЛЖ{#▀Р1] ╫Lи9╔в▒╣└╢СR_╨R┌ИЩ#├ЮЩе█АhnjmЬQXV╡iИЗdэ\xh╓├jHдh▌V╕L№ы╗пR╕O▀[d*╘i`Ж╙ДOШ CщДВdЕpEЖl╚q0йтЖeи БЕtИO Е╧┼dИЖjPЖbYи╤К)M╕─<КdPЖe8Ж\╚'Г|eб╡Ь/ц$░R0HИKрЮ&·■ЄсДKр█?E└/ЪС╣*╗-вЯb╣BDhBД?°Г@8J╚жmхЛH╕╟I╪&.ОЯPPТ█jЮI:(╔q°╜iP@щ┤^ЕЕЬхдQ(фZ╝█т3█Q║мєЕ╢0pЗХЫЕЄС[У╝3ФyCb╨Ыg╕БЕ?│ШЩHHGА>╜.ЕP╕ш╚°Еfиn(f`9cи┼_8Zю=К28LюЛUилсR╞gаЖkаhа╔ /ФхЖ▄DG┤`IМ3}c╪Cц┤Еd ЕR&ЖfРЭh№юpАлQуЗа?╓&вT`s}°:╙╠Д│nДCУ■┌nX0╖u╨bР1:Є]■ёзПM═°ялК@ДCHB0ДFxДGАSHhДFx╢T╕\&╕ГqsиаЭr`╪Е дFы╙U(░U░Еd░@WxУvDЕ)Н\(Т-ЖmTСС!'sёЕbx▓0ЖлRЖ┼p╗ ░P─C╪Г=XfiєжZиtj r0┬mИякЕ+Щ▄╚w^▀g╪╙l|Щ█ТЫШ═g╨Жl@фсVI@Phф╧Б к▀╟bЁ7═ТSh,"оg@kXWГR╡Aью[Z[уJДEиыэЙ ,J M├O8ЕЕ9С╣еsыМ╥lo■$єЇТ═ФKPєїл V4Д▓ЦД╞M YЕ,ШГnа┬╘2^╚т_AЩQ>ZР Pш*■У┴е█jЮJ\╢єСФ2√▒Й▄h╢Zї┬ЁФwBЪ└YQшD(МХЪqБiа┬m°H═S┼LHЯвЖm╪tpdjЁЖq╕¤l°Жn└д▀лЄcрxGQ∙Мrв7oИ<G╞ tX╪G╕Й-■V╫╔s╪▄a?ъ ДSиУbРЯlЕJ0/№▐ДщрОN│?Йz√о`)rГчO 7╟йц╞БC@РgїcД·╚5J╒юИVйFm%kХеIг2∙дIТ■ЯCЭFQЄЇйФ*TTтШ;╟Н│_└t ╞кT,ZкN╜Z╒щ-a┴Аїк╡ ╒*VйLЙ"EкФм\пNсlЕкФ+^░t║╩╡ AU░NЙZe+W(MЦ0qъъ)!к]╜Шe{ц Ы╕i╢b∙"V,┘2c╛pхтї,7k┘╬й7.\7n▌╝чНЫрoр┬}#gннZаy*kW1f╬ЪU│ЖM[╢h─v▌Z8jUйPдV╜ЪuыЧ2│╔Рэ:┼й╥ 7Вюь┴Д ┤╟└ЦA│EIТ)Rйh+╞Л(NЙЎ$ %*T+Wоо╥вK╘'NШ^*┬│'Rг;Й&!z$hРаB■П К▓x*;мXоTНЪE╦,оШR╩,оН╥╔&Ц сF8тpC╪4╙╘╥J(ЧX╥╔)м╨в╦.║╙М3╟╙K.╡╚т +л,'╠.к╝" 2╕Ш╪╩(ЬИ╥К*жДвЪ)гxJ'Хнr╩WЪT"╔$ХhB╩+▓╠RМ4┴M├╦+н╠Т #АLbJУ╢ЁR 4┌АГL0╣▄┬╦1╙lєН4─ЇЄЛL╛№Т╠4╫x:█М#╬5╙<г╦'ма)о╝ВКЬ┼▄╒Н6╒ ├Л-b┘тJ+Я<4,┬╨I 4dтТ╩&Зшб╟#з╠ТЛ/╚0sН6┬t┬╚#Т`К)л─▓ 1кlВИ"Ш`■RЙ'ЮМЄJ-┤▄b╦Iм8 *аа╥I+╫aI'Ф4rm#ЛЄЗ}┬╚$Ь№ &дМЄ╔(еатд*кАТ +Юё╟;ьМ╬5├ЁТ *б░ЛХ┴╨Є%2├ьBK,▓└R Ь╛°2 0┴CМ.s"sм-│и"╩(йДтЙVФX┬Й│Ц8в╔(а№╪IWAЪrK┴┬уЛ-╕┤2 $Ма,I"Я▄rLl╓lУН4═Ф"Й!рbb .║─ы *жТ +┐╕╣╦1╘  7циc6╩DS╠+!Ьr(и▄▓L6▌l6╓L│ Л╝╘2((DХтЛ0╦PSН3╩(Cс&гЬК%Т■рЄ╦2╙4г *┴В▓г(и─ЄЪ.йi╔"КDТ (зв]+╣╪▓R)з─т +>Ктв&вАвI$ЖЇqG{°сGАBИЦЦDт%ЧА"K+йГ╥ -е(┴:▀d╙ .▒иR(1╔Ї▓╕-┐0├L.еШВ|*▓ г 1╟Hг 0"ї"L1╗┤ЦЛ.╢╝╥.ВЪl┬Ie8Ц2╩(BКUш"'нёlR9mIтМ╚ :q ]°В╒╨╞6║╤Н╨$cв^сL┴КМ╡b╡ F\|A [C┤╨╨/b1Л_H├КёЛ7Ъёжd№bЪ└─&Na `├.╪╨р6╕б kD■═▄1vс OА┬┐╞/К┴йe(Г─x&!>U╠тC╠(╞*H┴ Ф╣"п╕╠щЪхCПH#(Б!V▄bФАД%2с HT"У°ДК0╤ "Uт▒к─&6AЙBшy╚ГxСИG8"Яа░М╫..╚ч╕F2и┤Y|╔┬ш┼. ДЛ]╚┬rX╝.ВёЛ╚Фй╗рEБx┴Л[фBF█╔uVгЭXрB╙Е_a(X╨┤@M)ёHвбА┼-,! ]°-уа5ЮQ ]TУ╧<Н┴ iL#╤x4оёНphC╞pF4b─КV╚B■з0┼,z fhГу З ├1Н_Ф╚I╡АЕ)8▒К[#{╙р╞7║ё ┬0╩┬@┼(L▒Hq▌Bб╩Ш5Ф╤ЛМЭ┬РЕ.Тб cЇBШ╨у(HёQЁй┼о* C,bМ╕D'їKpЛp─%2qЬH`dЦ┘&@бг`┬йШj.1 #1bОЕШг$к2Ж?╚C╥°┼Es!]фз╙Е+PёКЪQ╨┐╪E.bБ 2▐BлЁO╙fQ┐V°^:9┼cgёКXш5┤ь^.rd T4лvВДFoзfc┼°Е/Ъ┴М ╜q│╝h╞Ъ┬сНldу{■JЗ84(sР▀°╞GФ! "2C°!0p1 hdў╥Ж7╢qНhдТб°QOС![°"╜ `дq fLЯpj&2ёЙuy(╬HЖ-v╡ИMи"╟x╞2n!К_EВ▀▌D)Z╤O└"№{D ML┬Ю8кЕ1ЙK№PРh$@I PrШcЩРД&XС CС┬╔╣D$╠╣LЬвT@Г7╝!Нe$уЯWв░'ы╠]ь├(УduaMXА╙пм0g!e9╩v┬_▒АE)HaКTИВжи┘*~$ `°в┴Є'&бE<" #Ж@л╫,с Рх▓■E╓╝Qu┤г▀шч<╗1Оk0г┘x(8─!┐И╜ Ъ╞1МQМЩ╥┬ЫИ*+С! rФ├урЖ4:ШЛЭDX ╬Е0╓+НjT#n╥@Ж-xт▒аrL╡шE3Д! ;ЄЯxТ2Оё VdbЯ°й'Ф3ЛV├йxЕ'qИKT┬Аx─-1КGLbдИЕ%▒JdbЕ°!оХ$H8в∙╢*ТНЪO\TI╚└НphWЗ║┼$╓ГКZ╠bЫp0ДБ VР"▓hZ▒╛ФМ`╠▓ f┼@e8JЩ"Т║у&j KXBfrгE>!╔Jм╛8╓■-@уJ ┬ЙPD╚ЕсМрp├╕Нт╞2КqМ\Р╜шЕ+Dq щFW╞h╞4░╤sqа0Лй╞0j&КH╥▒(╞4к█шСzуqQ-r┴╙[L═е╨2ЬQ ┴\├,╤╞0|Q╦Rдв╠X╞2╛XЙCвr░ш┼3вAЛH вБ D$Щх[┤о╨> CтЁHl╔ЙЕXk╤ЙI<"ЪPД╓░G,вОhk╖!БЙ¤17┼Лn!ЛW░ e `иМZ8у/!*D┴ЦЪTЙ╘Ь%1Ш1qbЁ┬(йP╣W╤КX─т·@L─▐т█PuзE-■!╪ЗШb┐°!Ям>┬╦)г╝┴в%гА╛ж+╘ШЛ,┼фЬJAЕB)ЁQ0Cд!5`Г7ЬГ8`6╝B@╥╗╕В.№Ч╨l├e├6Ш╙aАГ58├-иЬ*╪BKK╓╤9x3(mЁВ/╕┬,╚BЗ\+В░№-├/┤B&ф "шБф┴#\&|&ЬНА&p%T%ш╧& Ф,ШКМB$№Бь┴i¤┴"dВ#рБЬ╠фlВ&И╒(h┬ПФBХ┬Ш7LC5HC│╡EщGJЬ╚йЇВ.рТ.╨╧╤ё0├╠ b-рВ┼%р*╕-ф┬,ФВ■╔4┬!,┬%╦(┤В▓мВ*\шДВ ЙB&&GВD┬"H█'фA▌Gi@a5 ├▒╘B, ├1╠Ж╨95]╙4├О%Г,(╦-KМП-шB1ИНЇlk├Ё . IDГ╨F6hCГt8tC4НЯaеМ┬e4`C╘F?C)|ВOИB-╨в/м┬%PBаpЯїИ┬щх┴╬З(lB1Й-`Y&l┼пК RS@О>ZВZИ$C╘┴╫РцMШО^┘9ЩС*▐¤ўНЪO├-\О|Ю 0DГ3H┌-╕BЗЬ7№╕╨АИВ$ #и╠"ДШ"T:Х{■ hз$XУ╘G J'─┬Д└Л+М4Г. ЦL{Ю█╙%C#]╨E/№╫S│P5d┐Щu@64═┬1h├ сE6,еЩПК├хC/─ВHкФ-CуhMi!Р-№3┤В)иЬMЙ,&иу8mT╔LЪ KN %(┬[MДЯФ▐(]Б fQК&<В"HB▓aЦ'T╪%Ш┬┬▄В/Г╢jЖ3д┴ЬC6TA#`YНМ, .ўфU╨а/tT1м*,ЬКP└B[Ї/C╘^Жa█ZQ┤┬"хё'DВ №Ы&ОЧ!ОЛ}Ч(dB*─>зк4 1CЗ°B╤G╧■ЙФ9°5plCгmC9а├:LxО┼3=qW04Зs4и3Оa╬59461ГоЇ0мК7<╕7p╫··@ьтEl4l▀о-CVLЧ,SТFХJ 0b─VБТ╘(,a╔Ю5[6,'HО2]ЪdiTн_└Д=c6LX░_├hНКTИOЮ@ОQК╔╙)Tнb┼rХjХм[╖r9ьJХкQЭ&A┌┤кV.]╛r╤jыЦ//s╢%3F,X0XкВ-ЦK2b└~їЄїыЧ/^║p═r╡КХлд╢p┘╩┼лVк[мP╤║%╩Т(LЬ&еT2еФRN TR)┼╟W\)хL*сD"V^AEФO:%╚&▐╨ЖЩ-ЧiЖ/cЪaжЛФQ&Щ3╒ц^dA┼ФUbЩ%ЦWfЩ╔VF▒dORAЕE ▒d■OL)ESXБ%S>сфLX1fЩeВ&Ъj┬ДжЦ]О╣eЧцк╣бkи╤ыв[Paх/U8▒Х\j▒Eеd╔cШЙЖЪm╥У-s╘qgЬn─ '╢nм╣&ПЩЪhЦщЦUи]еY|БцД╠Aи`lщ ШaЬЙжiкY╞`d)ЕW#цZ|ё┼P>ЩдM@1EЦd║A╞]Nс,УMXYEQ\бЧa┬LШXHE'JQ─M"qdТMBб2SPСDТJКZ┼XF∙dУM4╤фУR(▒дPBЕ"°X'Ьp╕┴fЫgкA&iЦI╤hг╦Д░■Ч¤╢Ш`z1%MTiеK8a$иHHsхJ^эE^ЖIF▐S╒O▐$УH:ADТ╛ГFХЫM╣╓Цз"|%Чdксцr─'q╞9Зr╚╤нKuеFfgШ┘х═[К9╖ЪiОуЬoи1ж^┬^9хУWРyЫh|)х~E!ЕТLj)╞└E╔фDYД°ФЩ&Щ[T!Тл!╤daR^СEЦZВ)&оKeWZеR·№$УN*_┼NPб Э╔bB-├Д═О2ЦVдB╕├╪с▄h#$cтE■/xС"^┤в╜и╦2Д▒)\╠й,╢H)ИtФXЬ┬!CР'^qЛж№"┼╕┼Xn┴┬C"Й(Д ░▓BфбЖЁ#RвИA BмHE.┬ KРвR╛╪EэЖсЛe╠$╣(╞3фТЛcи╦▌°╨1v▒КQ░"7<Жыvє ╥ХГх8╟9╛!Нc╪т┼╦8╕1 cHР═P╞0И╖ЧfXГЭK╞.> Y,Й╖PС-Tб aЇй_В√┼n<шKтС`D)l1 ZМKЬ╛░├┌╪╞6Fb gHГ─xРBм╪ЛYШ┬├шE.bС╦VД5╢м╨┼/╚ М7╒B,░xЕ(жхЙD▄┴Еа" БИHdтзh╪-`q!X└тШ░T/daЛ^у╫иF5░Бe@├┌0HKебМgШыu╨АF6ОQМmиухXЗQ╖#:od#Y╪└FБ~бШ`$Ck1Ж2в╣it╓Ё;└1vtt╫а╧2C┐7эв Ф╥E+O!КЁЙbОш╙*Rq X╚В╞xц2p╟ Vё╦Э$ГE/╞8`8lBЪ0ДшЁ■А."ДD∙&$Q\┬3йаЕ,Xц #IтСE· &ЙHМ┬╣иp*░░vЬc▐З6мС Сzг╤xxz╤ЛZ└Йjў"E-А▒ Xи2/╤Е-lБ└<O*~╤!ДМ8*Св│▄bр┌М $у╚╞4fЄ lTу╡░ь*4С _ Iо(В@q╚XвнPцндamРгЁА╟8Ахwа▓4Ю╒`▄"ЯпрNЛqМК\C:ъX╟~│▒ gр╡E(XQ╧]4г═╧(.$│К╣в╗PЯ)В┬ S8h7█`FqВaЛRpЖо╨┼]Ж ■JЕ╚ЪЕ$ёГbтЭh[#бИJ╠ьGЪ╕Д№,ЙLИВZг└ДЦ9sЙGвФpВ╬сОtи#▌╨╞5░СЭlDC╚Ж/ьъ╬sъВ"юЕЇЮ \u┌┼мhбЛb╬т╧м8E╢UсКWШвН└ДиQБК[░┼Ь╔д!╖шНr`#г└k_╤зX╚в?╜Аю+pёr Нз\+LQX№┬ ╓Р7╝ё+gУ4фИpu╝A R╔─╬0ЖЛ(a,Єф▌8З8РН[Дт~8Л┼M ТC#╤░╞2vсЛ^░ЯЁ·*vi`├м╔Ё,DбА■bвл╨YГ╜М▄юв°CЕ╠LбЙyWy@ЄЧ,(t┼щ¤В┌8ЇE0J╤ N`НЁDр@Оo8#╠PЖ3╪вМlhг─`.Тд O]nыЫЧ·bёЧk!г┴HМ/а9═╩┘╗Р3|`┼Fa@!v:бЎH┴р\Б─^бжa7╚┴ЬAо┤БдAWжб╥╝с ─сЁX─┴вAЮAШБ8└G╘Д┴Ц!└ж!з!Tо@▓┴╠╞б╨a╪┌┴ъИаanс+`QfWВ╝└ББб"~OTсP\ Мжб╞дЖfоб`eBAP■Б2AВБЬи!Т!Ч<с2юG╗`AМсAРaА!Щz!ZБLABjO2hБ"tсZ!▄мЁ└├8╔мш%╓╞└║aО 0a4┴LAИ┴╘|iBA┼pA j!)d!ьNa"┬E▒Ш┴█╘в7d6аA#)T! 1aцF*AzпfЖHRБ~рiИa▒Иб1d┴─aРБ`г╝a╢║Р╢с@*яДгз╬,Lв┴s░┴Ф!rфоя╞/╞╧╚Бе"╠А0 ├┴┐и!▐ЮвV┴Nб=L╛сRLG╓иH5■Ц!.Ъ0Ш!ЯФn&Бbб╧жжxъb╪na D┴Nfбсшд,ъ┼┬b┬┼кВтЁjбХdсЬ─H~бй╨ЖМa-╕ Ю!т ╚а ╘а ─4!°└о╩п*GK!█.мJ!ЮВО!жДКб╖┴7д┴╠ЖжHбyN^!╢p╞(иQ@с3`AМ@иTб┌Rф└IМdчДa]vс└╠и┴║ы├дшд╨╚┴┌╠! '┐8эЛ║+ в║╝Rj╙!hxеVa■▄hбИ┴u┤я╠RP■x,┴Ї(сP─D╩бfВ-ra`be8AlЖaЛ╨~A.б╨$╥%ДBAс╬╔╖Єd2a6с%B! aпAP┼╚вТ4╥ ф б ╨р╠ ╛р0┴ Шр ФЛO<Бц Na$cHьН┤╦┤АaВц╗и!ЛB┴ pp!iбЮсx!шт/p!оЖ╬+ЖБ NЦБАс+fс(RсЁЗm"6с\БК"Ї┌2┤и╢сW"єЖ Р└!Р* uЁ2эл╔┼~Б└u6*t╛┴ш╩"x┴ЮR)\■^A╩БОосО&<═z@A2\с ,д╤╕QахrA▓В:^va9Б╗zсTa┴ю@сц└!Т4┴ бЄ<БКьA_Їт└:с ┼ЙцR"Za ╓@ъ` с*с!сў22Ю╒2Nо-3Дт>с|оЄВtБ ╠А╓р $aвд|aьLБ╞а БJЁ ┤└PсSzКЁхxd3МсYРБЫ~Б░+╧ta\|с│JbбoA]всТA!^єи╠4ЯCаazj▓Cе╠▓сР╝GЇИб▄k╟FТф╠0║┬Г╞шИ┴▄т я╠AдфБ■╘!В Ц╓A╞A`╧!╢a╙ВCw╓╘Б╞!╠їKmt(бbБjhТеn╨(┴ ф└ ╞``!Шc┬2╝уrАбаe<ьоЖ$эь╔▓>L0Ё$An4╢Rт [Т┴╨!г╞Є╢Az╫ёlMф|У[ў ╪оБ7▐h┴╛Б┴XЦ7╢b;Їдж27Bb┴рj╝в■Б>ДъЪюK─┌┴юИщёО$Ч@ ;0IЁxD4жш╕`^МБм"Р╩"ЛРoG2сrС6g║ПXЭr!|ТP▒jЦ)║"V╒0▒(jEЮJё&╛├№2╫шяРмБ╠*╜Р┴ ╢р└ ╬└Ї└бМ|П!Б Є` ╢рTБДЖЬс\qYЗA`8Ч>й┬┴И)0hБFБ)ОNwй┴Pп7кaC─a`│▄!Ёс▀сu┼б╣┴Ц╝┤ГH╦б1┴xи╬#я▓Бpеr╣┴ю╬у/ ┴╚к!■ИЕ`yКМСфazJ╫a╫ожРСhcyaНz╧DTБ.aHБ,ьХП:╧ЁК┴оцX%:▀─PБkЛБ5\ГКбKE|б=&aЄабaT┴╤C!gб^юoМZ.оaXФ┴ЄШpв┤Ьбwл┴│╕б6&│╒¤kv√hnlбх^ ^Х"&'F╤╓эAЮРhAЭш╨(я╩~с╘·h▓й╝LКдv'Нs0╩!`ъЖ{{YЕ╡┼C╨eКJ√╞Бt╙╓!u╢!е╘!Э■з▒s▓╞╦@PaHц(B^Б╩KЩ{эЦ1кДBBс╬╠4<\╠№Ё/WYС╤Чe╒Ї@ЄКс~*─&║ <б ╢h╝xл!ф ░ ┤А Pб№rс╫Хax°╘╠░_╓ЪaA89цуА┴ЖvaАaTБ2ЁЫибx╟Е╢б6vGLt┴BцМ┴т╣p╜¤F1ЪбШ╣БО╟9║№X╥оBг!,eБвe xєС6┼|_Г0](·│└с╕9ЖaЁХ)mF+Wг╠<п▐!hX╧sHg|#Y╘°Ъ╪Б■а│┴лAРVоHT├ОaМB┬хvбЛ.╚SЫBl█чv!чИО¤┼фгМб+&Й6!ba(U@Кa └ ╓,бz2/$с ║а фр╟╩ тcЮ▒8hщ╦=░▒└Б9h√4Тa:┼ФabбВX┤f─jхЪV-W,W╗r∙Вv-Э╕f└| ГMZ4lц╘БЛvМX1e╦Жщ·┼,█6pц╬Х#W╬Ь9o╓ЮЦ╠8v╪ЮaS&l 5m╨ТєuЛкU┤<1┌D╩пd╥м]╗жн█╖l╩ВГxн┌3c║^б▓╡ЛЧ.^H[■Щzu╦-]═╝Е╙╞ ]║p▀╩┴cЗо▄]i╬\Й:5KЦм╕┐v╜"Eъ╒Ie│UГЎ Z.\╝pнb+жPду 4╦XCС.∙B )▓yL1╚4CMe╠У╠1LсBЛ,▒дтЙ%У`"╔'ЭАВI,╦H│▀5╘°" 2╞╘т -╗\aЖ(yм┴╞m╝A 0йШAЕР╕ВK4╕╚qE ╢8є 7╨8╙ -луg5╥0иУ3▄ИM1╓@)MX┌|3═4шD║М15M3├Їб xШCZ]З7мб h╚BьД(,A LЁЮЁД Pa ^°ВЪLВА;enthought-chaco2-4.8.1.orig/examples/kiva/agg/serengeti.jpg0000644000175000017500000015755313233644505022717 0ustar varunvarun ╪ рJFIF┤┤ сExifMM* █C  !"$"$ █C └рА" ─ ─;!1A"Qa2qБ#BСб▒┴╤3RсЁё$brCВв ─ ─&!1AQ"aq#2БС ┌ ?шИ\}╒ ШрєJЙ1╔лўЭО╒ц╤щe9▄╘щМН═дr*ВF╤C▒Ь █V╒S№█PX∙╙¤ъЪПтР[*Ї╢ї#*╣═,I╞█цо2F?╓А╢Q╬─WЛC(|ов}99в╪Г+яV,9╘"0иlgЪ, ъ°л)╬h@/╜x9а<^Y(:ЖпеJчz,ЧЎиюСцк┼qRt╬(░┘с│╛j{╞и▓тдБфQa░л0;╫╗°цГ╚п2gНи░╪a.▄я^яzа Ъё+иmN└!ЬГр╫╛г} еФ58LНН+ЖяV2Б╔╗лШН+ %O$fк╙┼мdя¤л┴cаЕ▌jU┌д #S╚,к▄∙ ╘%фnH_VЭН]┤`Нм(ХЗqFрoСєU∙∙=e┬qЦищЧ╖Ю+╩└эP║я^Зpj┐<■ЫaЕЛй┼T╚к85S╬uWМ@ЬfП╧?бД~YAjL╪ЄhB02k═<?<■Ж°_╗ч▐дH▄EєЪЭpMЮ_C№ │cБUiОsCЇфя^ ccKє╧шaЕ╗█фГКЁЭudи╧тлд^g┼?╧?бД>КєL@╪Ь╒}>jR2(№є·Cсhф ъ▀&вVYл zб8< j╢╡Є3Gчф·/╟В╞c╗qV╨ЪJч│шф╩jВHї╦░█Ъ╔& Н2В1и╒0їPSr═X+╒ЪО╦1ёлКХ╥TхиLБЖ╟єRи1Еn)ly0МСМz╧їлЮ I sCT`K╣гb╢=а■rj═█-Х4ИG ЬПы^VuQ░╚p║╢├jа+пvе╞sТ├Ъє[!▓h╪d7Биск├╖╢√╥jю5q╛╒Vi┴└AАy═CьsUЇтЦWФйpjЭ╔▓A№цЦ╞Щаtш╨╪Э╞║PN╞оЫЬQc╚i█╜xВqЖ═*╬└╧ юз}и░┤>▒er:0├)/йerАUМяА1╜+ C' Ha╜Gf\чPам╠6у5]vу╘┘┼+AМsу|U╥sВi4╝2╞$\Б^K╣XЭ╚в┬╨у┼ ozЎЙтЧ[ЩTdЭиС╠╥▐╘XYfэPи▌j▓▄мJИOоН▒┴Лc╨bIїU╛∙лдш╩@д:НК╤РБ╛√╘ў╫Q35рboN e"╕Y╞з^√^)gHYtАв╨&╔26@-^ю1_╗51)ы╞j╠С1Эш▒╪╕├═Uя Lrvмю▓╦j╠╟&68∙╧МV-ўSUx╩IТ}${З╔FOТЩ╙I{РHple_L╤▄.╕м6∙kЪЧм╖╒сxC╡0:А║BK`рТEf█Х4╬пз^39уs┐ЎжdЩДГюkСщ╫Ъ-ўoVrNkR;У"гл8.▐}лE*[)Hщf╙Э@т╝g8м!}█!2I_╕VФ┼3 9▐л1ж4&9┴&oj░Й&и╤╞╗ГN┬╦wИЄ1B╕Ш┤,G Pц0щ}ын_¤0ю&вДaЕLдСh║╧f@ w#┼ю¤ZExххr1ц╕йюS╢╧Р└ЭЙб█^╠╓┌5чГЭщ█1№пг╛╖ыk)X)╞&ОЭD) югБК∙ьW╩_VмУєMд╟Oп ╗тЗc\мщ:м▌╢fI0з|Г\╗]╝ЮТpЪЙ`w■Я4{╦╚ю*9V+Жy╠=╘бЮ20╩█ЬШЄOf▄73-╠2F╠!Bu<Ъы╖NКoгУ ╜c┘╔r╩cаcIMZф#Aду*G╡hиJTН/╙┐й╒gb╚▄Ъє▀Ож╥оЭ5x5╠]3 уFR╪╪p+R─RЕИ19╬гт│ЪI█╚·╣Н╥BЭ╞╘╗Н;Цл█)╕e3НHлТЯaY7ЭJd╣яFYЩ?j▄╔)";n <╓ШшЧ$Щ╥▌L (╨┌$e°└н>П-╒Л,Р▓╕Пё\Uеэ╠▓вk╒ОWEcї=╘Т9КММНЖ*% CМ╙v}┌ЄCf{╠зsBПк;ФH╙╥ Wo╒'Т┤ЄЧ.╕╥6╡lzЕ╖╥╠aАЁwдш\Чщ╖7UШXЩ Лv╘qСЬКжї4 мНdn+ч│u9fП┤ы▒lj╧╤■Щ╖k{╗╣╝W╞√Н┼M▒╞m│wиїAmhЛиn[уzпq$bи╤гЭ:░═ л▀G2I┼T^k`Й*Нў═{щb/ЯF3┐╜yэaH┌МР╢3█╓ЮЩ╔¤ъСбхd-Па╞лЬЖ4"%cK$DЗ╔ufЖСЪа╣Sщ╬йiTЬП┼,ВЛ УКСГ╛Ъв║*УТ~k╞eQў QТ <аЗ╧┼_8ёЬ№╨Dё*n╪╜═╗М$К▀ГBv╬┘&Ч{Ш┌~╩╕Y<E:3йd╞9а╝6жq)q┴в╞╣"╢уёAЦiA!д)ЯК7~4C ОhS▌┌ ■FSEКДf│╝Щ√В¤Б╬vв¤╪7%є┐л▐Н й,║вpF>▀jtK╙═╨ФlZ╗ ЩЭu8лЗФ7н╒╜йвъ▐F7Pc¤й)Xё!u¤┘▀ц╜#ЧПш*п>з ╡AФфиП╟4ZaAг!│Нё═< ╧N Z*╬JшУf>╘Аd$ЪH,╣i=╘-г╣┐╚в╟П ∙е▄В├IsКЄJї b ╞^Tй═T╜╔\)L№╒Cб>УЯq^bАМ▒┼0г'к╔rA*БTd6√фо╫XY]┤╩рm╡w╖]│,З °5╩uРМг╢ЮаHQЪ├ХяH═┴z╠VWд%U▓pNMx\фP0╕└єЪWи▄▄▓Ж@4Э,=Е п4@ш@~▄y4у╒Ш6ЦС╨█▄ъ!╬█i)Фъ╬#ы9W╩Ь╫1qw(DW┬╕у▐ГЄ.Cфц╡\C№ФvўЖf Еr=[є[_з.Vф╤╞Ы ўc\_IG╜╗B╬Dk╣ ╨u.ж,R┌0гh▄Жм▄)д\]эЭ╠W9└РI▐Л▌EQо+вu.гw╘#ГH1БЦo╒▒Pз∙ЕiЙ┤Zj╠■╜?a╗Ыщ5Х{3╧jшt║Х√G?Ъзъ ╢ ╪Ю&ЯK╢+(<йnа9rз(├┌г│ =Шяm╠n╠\єэV╥4├F}Xн░юO▌f╞Х╔n*╠╚╨P╕fЁGГZ╓["Q╒Ш`З╘·╤░~j^]ВXАyєT┐Йнеp$П|Vj═№Wb┘└└▐н+1r6!Эдv╓uxМщlкХ╔;Юk&▐y#Uw8╒ф p3,ъFK ~k9*шIьqdtШ$О╬тЧЪуc С▓O╪P.Щ╒ ╣F╟Ъ╚2═Ў0з$Ъи╞Ў[6ьф/:фjV▀#▄Qю.pЕK,V╘щEСBВG╪гaKC1ЪшЗ;╖┼' Ш╗Khт╢╞\1▄ЮsJ]Ор(ЩeSАE4J╣]hHр№h█Fйз╣Н┴└▓─b]D│СЛDн.└f┤╓эф-╝А0╚*├lЯzв└░aуЛНЗ╜т#!а Ьe▒╛M%╚д╟╥=ТC)3ВKЬqQи ▄#2г(pM),╖BРtГ╕Ўжрh─QMВT╢нХ1╬ХngaкE3├keoЮ6╣ЇУ╕╞6ёXвящ.(э╚:├jjaо№▓кшvф∙═KЙкдищръNщЭ8bгПКOгYвu'Еаё═cЇ┘Ъ█╣-к ╦y¤щ╬Чu1Ъ9√з╕Oи{╘т╓╦Л╢vp]Iэ@ЛПN]яgL(МТ| └{∙I╟+`░▐Я╖Тс╪JШ9дС║n╞┌·ё└?LPОA5шoя─ГT>УB{йбї\,jЭYкз╕6Єм█йўзH-.╪є^▄РIДээEОё╝─└P ЭА<√╘█╞З┐Їl^ЬьЗ·UЦ°щ9C¤)r╩┴I█╪╫Лq╡M┬?P|Н1УKK╓Uо J└8фUЦP[I^h ej╥k0В■їI} Ж·xў╙╔>їo АsР╬>┌к╗A'НыMU╤2н¤(б.┘9▐к з8вmзNн¤шPЯ╠╟╜J╟Р22*ZМ3ьjA▄√4hd╜XH╬ї~╩и╧?Ъ▒:W*┘╧5р°└╒ЯЁ(а╩┬M╒tЯj╣F#╙з5f}АjD╕&Кiу╗Рл┐╡-%Эє0ї чМ╓Л╧  IbГїeHYРбcАi╪Э\╪▀J4Ю▀їб█ЇЙ ╚H╨gТ ннNF╪ √ЪЇy╓▐п█4ЄhTМї╡ЭPМС√╒эсЮ=▀╒┐╜:цBМєBСLСХс╝oHtБИI9╥7ч5C╙вС4╝dПqFГXB"д{╡X╝х?ДЫОA<╥дГд├n·в.╔жЕвую4;v╝/№EiБпV7┴й┼6АМН ┴Июgўк▓░\f5`ЪW$a╜Е%1KоЪ│╧▐ie рэWЙ$Л#╕X╢╘╦H└ЎЇУ╖5шуaЎЬfЪКE8'МQK( Р№TБ&2q¤* ` РOтКC#ОA°а╚bL#┼л╧┼2r8й▌▀cэКzдРхР(МЛЭ#√╘ўVубжМ0^XПj)v ?zY5 Qп85tpWqЯjЭ>√JРdV╗cЪЭ#╤╡Vs#lЕTr*T6АK~ЇR┌}X┬СA╕ЖB║PкУ╟ЬQyєц╝дч`xвРАA╠J2ъ═фКgСъ\ЪкI&а▓) Ь)ПT WpW;m\ЗQ╢╣ПYЖMB#й▓}G>╒▄▄"╦#-Кчzеаr═Э.╚>k&кVDуg-─JтRв0т│ж└ t╗zЧ█ёFЭи╨У█Ь|z╦Tx░а3БЯV8оШ┼trK▓Т╚d┐dНЙ][fШ╓ь[I$и╦ёY╙\┤RU]DgSrj╢╖ $┌Swя▒нЬLЄ╢u▌+й-зn!жN@ф√╓ДK%рCЦ╕,cёь+Ящё▄Ee╫H'|~+ш_зz|ЎР+K$qнО?╡sOGTш╙щ}<[┘в$F!ч}щтЮГе╖LJ.Ф9Ў&н╛IeQЯЪQ│вХwhfs▌ЖM╢╘л╡`ї3╗2*╢▄фb╗лЗ ДO▄╫╫"·ЗЧ╣"gN╘Яf<ЛсЙs╒%Й√H─г.7═-%цЫDР┬┌ГАю+єI\J╩t3+(}ъ ╜QjЎь $∙Ё+HDц╦щп╘Y.э├┬╠ъп╛Кч%╢УыdМ)╩·Ж╪╚ўнNУ ┌╜╗ єч╜e▐]╔%рФы└&▐~*рЪ{&_H·ХТ1д·C@цЮ╡Т& │U_VN─╥▀KвxфlкЭЛ7│чР,ЄИОP1▄yгсУl█ХвЮbp╬╠$ю┤{+{F9ЦU,╪?uazэ4Снr?е3 ы*╠H;ю=к> 3vх-уЙh6ug¤А]╡─р√╥Ё_f=┴<`Ъї▌ёHБ▓y?1ЛL╛Ў`С[∙1┴цлрФaШ!^sA3О╬.ps╢╘╛ЭwдD@М&rG&Ю)Ў4ш╓Вь3 QизЁ(л)╓t6XНАмxц|2─г└ўнk8дОd3DF|Vsу╟в▄мpLB┬М╬69тУ[)vж@Я┼hZщUЪM├═╪DНtъТOУDdЦШичzДєEzYфюmр╓ЧN╛WН#\)'vєЯКKм[ШюK╦√■(pCщюБ (3щ└оЗМЦЖн3в╕vPюp╪O═3·Z Еэ═q@W!Ш°5Х%─ gйФЗl╢=╛i╖ыIs╖=IфЩЪBN9╬╘╫F╗╖P╥Oм▒Є< J"SRgkI#э╝Ду}ПЪf5i╘qєYv=B╞YV(└@╔&╡V0─{~i╥:"яг┘1Сциd9╚╬jЄ 5ПыUcRKцЪHлaВкМ √ёВO#┌ж2▌┐Qч┼x╔ГМn╟═gЫ,кМ╛Hч╪mFdПю**[QрБКЖ!Б-уГFl,СЩ┤ЎЁ╡Iй╒и╘8╕>ХaКп `╞c`г&ўYTjPNxpu++l?╜8ч╞fЕlєw╦ QЬ щц─2LcSйH╞ЬoAr%П LOМ╤Х#rЙ№╤;`╢1БМЪ3Щ\(╗F9▄СE(Є 2ТA╞h┬┌ JЭ┼Q!Б=c уfЧфV╕ЩnR[.9╟фErССЬта4l[OБFИаU9-√╤∙дR)Yд┴mC═(┬о]░3Я┼]1НJ╬╞╝]C>▀ЪOУ@иJр╩╙Ю╓Уч|╘┬Чvr4╧гV@ё╞(к╔аь.A╥b╔╘ЙР│ьZ┤я{Ївуїyзc`2l к;fPAєHnЩ0╦╛<н▓їpKщэ╚;╙m*`bкgeП╥7#╘└╣YCГЪЖg Рwщf╥КJТ|тд▓Ч╚LТ8еР╩┤озf5Q!mЙ#╝ З$╞4У═S+d-7!М[pH┼UХїXgКНr(9└╞у4▐sr╣ё╜,АddьOUI`─c qK╔╦[iF╝д7j ТOViф&h!fрd Чy1С┼!<╖╤╠ЭИ37$╤в{Зb{j╞yеР ╙дюЪQКч═]╒t6IиGУ`ъA№╤Г┬∙4f │dкю9и/0`T`yQ╩╕#f╝╩sи╢Ї│■Бu9dКЄ│j╦sF╚╞ рPY2ru~╘є )н┘╕ЯPМvXЎ├Ц╪ЬqOJфEИ└╧╣аИчd╫!ї{)I┌б;¤]╨;Шnэ▄\·ФЮ9о^KЖY╗oФэ╛ фW╒·╠ :иЦ-Xq_2ы0"═s ╥лм=╜л~^Щ╦╦vsWq·╦Т7>УцЗ╙уuЮR╠П;Ъї├ЩI█УW▓ЛU№@·▓┘▐║▐С╧v╧е■ОЖ·РЮx╩╟nКи}╧▀<бР+рБ\Wш╓О$╘╚Ц├Єkоiтю*╬G%vо═Y▀иШ√ctЇЯ═ у│╘╧╖╢к"Шеb║▐ TZ ╦║фglmKЄ Ж¤ЇQъ■*┐nЦ═d▄,rBg ─Н█╒нн│╔9Тк╕├rkидhДдnИ▐qте═Ш╩Ь╜ўM╫ 4QщРwАщ"FQa:█▀Ь╫s╙mс│Эg{асЙW,8└м▐пog3KqX(0O$тог C╙СД╚╖Jы`+йD d┴T;я═/·rъk╛й█]Ey┴< ш╖%fWсн╘▐+Ы9$Б$< м8ЇшЄ╣Ъwн\зVUРЗ┌░фС Ыg╒╕▀┼Л{!кfфWYYF╩7╔цХ╕╣TП░К@Ё}и=)1Щ[╥МяKuВ3ШєМd╙Qй ueэ│▄e`vZЦ╣nЄЙБ:*+6"Cй ╧4F║p┼Тв┤p f┼═╨Сдy gsФ?0▄HE&┴╕°Щ >ос╬ЬmЪv╟LМ╠═М ЧЖ╖гcж█9БчИъХe°жzqЮkЕM$I%╧o╙1H%e▓GзpGШИG7RHF╦7╡r╬{h╕гE8ндэЭX╞G╧К^┌VОсЬ╖ё1АД{╙ С▀Т╦#г┼cu М7▓Ў├V|╓\V┘}їфЪс╣СIRt(\УX3═╙яф╢S 5Bоl[ИЦ╤о╗О╥у$ф·╡├▄NП!`┌╖оо)ejЕ)YнJж@@єC╡╗ Єо1╖ЪГнрНR=е╞фЬ╓\┌Цb║╟у┌╡Tdь█┤║Wm%╢╬qяM█ЗДvGSТ Щ╥эхu╞┴╚Їр╙ёt╔$╠Й(∙` e7Н┘KщLК║5)╞sэB▒╗Бк╛[ф∙ўзз▒{╜┴╨(└╞┘м-e^кc@kФЩ║╠ўНе┌4 ├ Йгtх╝I═~T)▌q═7%╔Э=╤╨зm_К:╚ГJmH─D`Щд_·╜и╓=F╥y(1Я∙вЖ█▒╔░дI▄БLFйВTЪA.ыГяК╗З╥ПЇЎд nш&T▄√mL SМ8фPUJ7╟┴тлЙ╓FbгчХШWA▌V^<╒tF╥W;bД$bфв╢=Нx#╖ )PкDўгV └и4i"╟Ў4│йf╙ВW╨╩щrC7Uь9к='Оk╤ШП#═ В7:[Э╝╫аI2Sr<[▒ь╘■╪К(╥X ўм╞С╙ф°ткў▌йя√U MгI╔ю пO№02yд┼╔(^!иГ╜▄#┬2Щ>╘м-С д─Вs@Ц6y4З└лгаr┴0H┴"г╘:3ЮEЫ+═кфу<УMBA>н╬qCН ХА█▐Еq(ОAўcЭ╜щМ;│Зlи└тФ╣╜ыЛ╕9тжKшFu╢3Ъх▐∙о ХУ18<уzдЙФ▒:╦^г ╩w]∙в,ъ═йX<Мё\uе┴Л╥Д╟Ъ╙ЖI#Рй╬░7═9FД╣-Z7┌°4└+g╙Q╠оМ n<╫7e$Вp%┴\dbЫЖу╩└Х'Ъ═Фдl+и╚╚?5щ.?Чj╬i░Щ<ОhR╩]эМoSУ/Жо░╦и йЭJХ┼`[ї<╩Ў╥Т Ю}ш▄╔ЩS╘ ЯoКнУЩн╒Ї3щf▄НИё_5 фЯ5╕Nе!Ыg ┴окєи╩ызt╞С√VGъ{╞╣щR└╩ clєЪ╛)a$c╦4╤ЄщY л╣ТwнNК▒н°Рщ!Fp╘Ъ╪╣ "М.│▒ЎнтdoOлHЁ8пJRTs┐DЦ+UЛ*╬╠╣ I5┘╪1Тaл рйЁkч?ж║ДN╬▓zq ,√V╡▀]q0KРF Sц╝∙╟gLyGhЦWт╧&A9цЭa ЕБ С┼s¤;нhDWmaWv'|╘ї^║ q#▐│┤НsUгN╬U7;╢ ``ёTЦц╥Kёk VR2 ╫/U ╩дЦЄ3X▌GкM-ь╣┬└4╥▓?#GA╓аВiю#╢S▄;аA╡aC)В┌DЮ▀╝мДЬъ╧№Эv%┴GТ$sY╜BщбW:■у:│ф╒┴╓ЩМЪ{1пз[ОСqlСл\;ЪВ -s]:{Ы{╓Рм├╓╠в^Ч(Х╚╓>яfSт▒/R╙GАфрWlзF¤,я;└dФЖїшAЯыT1Б0iБ лР╣еes╣b┴9U╬┘нфОxТ}╠qзр ╤╟бЯиTДШ▀Ъ╧ЪIaГщ;bвw:В╙Г╟ГVРВрЬi┼*г>Б═вE╔>sWH─ОCяA╥к├╘w■╘{bД╧5^ ыв┼B! @>wнЮБg ї╣Н1гrэ┴ВH█м┘┤║l╧ бФgц│ЯZ]_G"┌I-\Б/█п8PZaP7Ze╫чl╘Ax%Aв%2▓6■o5дЎ│нк═5к╗Х└╞▀┌╕▌)[Ї╒mXФ╜U$ФKэ╔лJЖc═?xт═UT4н║Ьф№╓j▒▌┤4b2u{╘╖iтc╥·Оw┌к|im║3║╜╠ыj#lz┤оуХc Nо╠U╔▄ч¤+wлДГ%W╢ЄtуК╠щр[│ Н│Ъ╛)■║3}ЪIj▒жu░╚'|V-╘pЩЭёР уz~юш ePwм┘gО9W щУf╟PNь nМ│[█$┌T:┤╙н}u╒г√О8═dЙ╤B$OБ║Н∙иЪRлВ╦▄?╓│зСjTи╓ycС─Оэ░╚еТ╙╝▌╒єи╣дM╦Еу═lY╬┬4Р▒╔█▀M4=2Чб!╨ЙМzАn*Э╩▐ъI%╜`аgJУ═hIoї1ТьIrtоx┼зt╞╕╢э+Ц3А╔ЎеХ!еgA·vт╧жY0+Рr чu¤ATС,b^╘М╪8К├╗Вс-"╜Э+В ▀єZв║C┴▌L╞@4▒┘Ж+?╓НrУxгг╜Y┌.▄.UЧ═e╔~?ВёТqН┐═k┤Ч!HEL№Ъ╔kKЭr<АТ╟▐гW┘│ЛgRмТ I5%Sэх╞pOК╩▒╣╬╝ъSЮ╜7 ╬ЄЗ9!F3√╥┐ RL╒Ku]#I'N╘9auСt╚█═z+Т║Xъ'НкL╩╥╥v▐Ж╩=qnXВ9°бGnQ╚яЁ}щЖ╕ └.▐ї2JmФlr)Y:Ю╪Jм┴╞=ъ╢Э9SяSУ┴г╦:ЗvЪhNZ2├vQc ЖFpЗфn) ╬ПмФ0╪яZыx;еHрРE\▄!Мg╒ЭйYVbЩqьЪХ▒Х5Eщ6ч5п+ёърmтЖ$ ▐УУтМБ$" 1жФC═ ┌╚^9═0[X#Ж?цЖеJ░}Щv┼,КЁ╔ЭЎги*ч╙и╖б┬ЖsКї╙ЦД8╔┼4╔aQф!г$P.Эг Бш#╘Fц6vF9~Mц9g╖([ПIўв─╪+D╤:┬·│є┼╬┌p}FusЁ*Э&7╡,BkS╣#mыMЬ:З╞r)╪'ЇXШh╤╕°лвбВН╝ ЄJЕЁTFцд:и╙ч566╦в1Цez▒█┤9╨кsМcЪ;Э*Ky▄ ╤ЗфyкTKd╞!╤Ра#+j$iрbЗEС▓└В8∙г┴ 'I╟П┤ аOЦxк╝hm8+L╬U┐ЫIjЕ@ш pvж#8╕╘>(ПRыЭк/Kг)цЛ" #Y  FoS╢╢p╚иTi$Ъфюь╠ ИI*█рМf╗$М=╩Жb╩у▐Еwd$sП╥▐jУг9ьу:╕хYePK*от╖жFkЖю┬рz*Їqj╚╨АFA эяКz·█╗mй?ФфoJR▓#еFkz═ЦHГ# Dmю*ў: ЕЩ╔b8м\йш╖q7▌=╒UВl7╬6б┌█*╤Г!фоТЄъ ∙┼#Q╝м░а╦f╢М▌lМR╢щ1 Т&dуцЫ2┌cщ9∙нkhQр зR√UеДCi▒^F3YOФ╤еFcLС┬Q@lфЪL]█H^9\G╤еЖ╒фФA#N$Sрч:Еи▓╝)uj▐о)LцУi┌:гКtДМ╔9▐╣о▒4Ийж9нл;вй ═г&лq Hмz╝яZG▓█trцсЦ@╠r4╙▌Oq'x ?е8z=═┬йXH╘y╞;  э▄$R.<5лФhT╬nЁ╧q%Р▒╬▐цСТ nr0@!ла~Э4╫▌Шу&4╘Gўк╔╥■ЯищП,╩qЁAнc$║'┘╩їu╕X#╒С╡iY[ц▄F№Ы▐Ч~е▌у' дГVО╓Є╫N╕ШщЄ?z╣4╓Ш╥Т=3Чf"ИазK┌╖nzlR╟╓pСЫж\█Mн├Nьy iЎLа╠╦И√nyуКжТл╞7т╖д╡╨OзС@<Я P╜cДfV╘pо┘кSK▒(│$├t KеЁA ▐щvА┌3▌ОрюI°й░щ╖VY_"║М╫G╙╘╬╨ИV=+Д╞╟5ФчЁ╥1·s¤>xчЙmJХЦ6Ї1;Ю+кЮ ╡╣Q%╙HЛ√у┌░bщm┌╠╤хI:▒▒\╓╫RЖktКVЫZ╕└═╦-шr╕г7щ┼╝SHщ▄ryМ╓╜Ьcщ#СЖАЛХф╨#╓эR\.Hч4╩Z╧w╙iд\ССэByGcМNkо,т@┼Ы8╙Ю)зЩн^H╔b6┼tSЇ╕╓&О5╦Ть0E-╙,$fxПбЫь>°н#(╓ЙqvaD%Ж"d╖9*ЧУIг│Ж█Q°н∙н;sЎ▐,лю∙в╜КзSdСX!QаикsAЙ╔Amq+Iк6╚┘Oз║EдЦцG╣Myр▒═vb┴Z┘█qЕ╙═^nФ9К─0I█Є+?╦lп╟G" I$√БQЬэ¤лB═ Bс┤6>·c*,СиН│ГьiЛi"Н├╞═УВ|Uv /╤hAЦ1ЬА▄л╨&О8%Rж3и`чЯЪнЧNУGm_ГТ1╛Ї╧O▒Мo+чЄ+ ЧIm║║iо@ЫH╓0 ^+~╔uHЖ└nOЪ┴k ЮЇzЬ>+з░Т6А·v5Нр┌█оBx¤ъг[g#yзфT8╥лП4'cy4$jдМ█╣Ци╘¤щЫ+╚╗.рЭ╢5И╦#*цMГzБ ╥8эХe╥4юj\}2Rгv ТpуcфU"╣┴╞╛8мX.╔У·TnOЪдWКю═$>ф{Vo&ЇVGBўJопЇЮMDWН+╝KР└rk┌f.╚Kh═;╙лu└<{Ъо╔╦щм│ДERumъ&Ы╢ЫУЯК&Rн╞ToFI@Т3Т 5.L│VG ёPУт0∙╪ЬR\Ц`┘√N G╘/l.╝▄fЗ0OFЫю5Wqo╬дЦыV2K3PЄ╢0╠h╦CRy╪)uфPМь[$r7аЩР┘;╨RuWr█Е═╟ф FнмННC╚<э╢цУV2█Г▒]╬╘7y1з╬Ь 2Cы2╤ДАFю╘6м╚▀°Y╥ugH$v╦c╧╜ D╣lv9 d И╪╨ю/ТY╔ @█цЧ·СЎ+dё┼ёТ@А╕ Ю>hRoвe1ж┐I╝dл6─oL}@ Ш7bЦ▒Хaф(Ь052JзR┬_хжЭЫc\2ЬЯл^3╕НPВзsёI▌З╩ў'▄Е═P╬"╥рТмyў°ж█{' ╥^ip╣╔┴тв йвpИ ╣+ИТEфэJ9Х▌ЄN╢/┼JV%#вЛ!QВq╕∙°г}VиXщ`~k╕Ж╓J╧╬(╖е╔oIЁi╦Еy╨АР╕└дс}ХИц·м1┼2▄E┤еА╟В){■Ф.a┬и2А@9т║h:jрwKчq┼JXЎ$q4zХ▒Ж╢Д▒D>4╬wдt∙эб╠r ь|УE['[┬J6Ц╞>>kоЪ╟╗ ╨jSМЮMNЮj]q ╪ПКЙJ╪╫┤sЁ█т╒аюw#qE╗▒I$КeИ▒╞Vм6Зш■┤┼╡│<%2T(║4PЁчв▒DrLA 8ўгZЇ╦;Ио;░ъrva▒S[╙Za@└5ыk\1└┴aВE<ЎЬ¤╟щ╥nг╩С═DЯзн@╫╬█#jэ#╖-Н▌Iс~(/jл■f^vб═ЦвО ~ЪП'TL9Rў┐з$ЩГ░.A└_$|╫~ЛХ,╕ эГTьаrX`c┼┐бВгчt ЧQEcМ∙°зь:R%─i┌ ▒$Ю+лЮд7з┌б-P▓6Э╫ГCфdи#z4e█╢║┐¤╧┼>Ра╞ц СБ╞kyгU╬╪фfИ]<Нщf╩дa/FTsСЬо√fЦ=)к]G°оеS╗А@╟эTxБ╬СЬМ╤У tpёЇ╡[м┬}A@┴b║ В└#═i%аY╨|gj1L (╘Г<▓НЙ╚\Tи+рsEэ?и╒hг▀IїКФ╪▒гЦъ║!q$g!X3gГDКт;ОЪ%W╘XртФ║c*░9 Э#?┌й╥LLиа`·АёZ4┌│ўв$Ї▀Р═щ └>k╔!яepАn°ўR¤FTF,╟RI¤ъЦ╙D╖ ╣╓Т|╥m IYб?SЖ2С:╬эёW[╬цжЁ5Э╒Ї2.ДP{Г╒┴┼3Gp╜Ьу'8твУУ│ZYЄ},3аdч▐КoдьдqР╬ДdБ№_║AД'ri╬ЭюO+╛5MRЙy6n╜╔Ь>I` [вд╗ГББYQ▐╟ъ╔╘╣╟р╘\\8\H0 °бё┐AH╫ОЁ╚c√ЙЩН▓u;·Ж─f│!BЦ·И"D ■╘R╠═&@№КЧV═UУ@ю8╧эAiDМXЁд!ЪMJ_█Г¤л┬&[Щк▓ъфsPб╜ВСмgHcMNркЯёVDV` {К╧╣╢Х╘8,╣═[мМ%Рь╗qфUо?б&ь█║Ъ(0·¤.|Ъд▓ It▒ф{VYП┐aw A╔┼сж╢?PЩ╨╔зO╟╜5-О┼!Y┴ Wж нмХ9;╔┤Х╫▒Т╢)╚ZIK╟зVЮ|╤°╞Т░╖б┤,Ju`Гр╥ъёЭ!Vю57/И╪Ьdgn(Ў0El$\▒ї|╤(У(╗╤k╨f_сч<I┤W▒8РЕ ░>=щ┘g&HBиN┼)╒gЬвД╧з!╝~(М[шRНб├r░╔╣ НО )╩▐УТI╪°ё\T╜U╓s!9Е`wж:}№╔sФbq╛√xк|2[2┤Оф\┬бL║ШЭБЎл╩bЧcЗ█Г\№}G■U╝▓/pГ░єOYDe>ж╥∙ЇЬ№Tb╤┤ceнXХ└m"п,╢1w0█ВGК╞╗Б╥3d,К▄№╓=ф│┴vcv\8╬<№╤°ЬЯcЪ~T╫VТ╚░E8ЇєиєBeuСZ$>оOи┼qб" Af╩╕;СєOЇйпэщ╚gbN2sКoЕгЭь┌╕║ФC1к▒╚└Уswr╧б лg'j#├|ЎтPъпXЎHн╢║И/з#ФbК╞╦@Ч.Є-╥Веyj╩╛ш╩╜дgl+FеrЧ┐JЙШ╪щтЛїKsо9╡аСР┐5дrЙ-*╤Хk`Ў═┘│Бц┤ф[ЖФ$x AєЪ4Л301ФdQБяE│КN╠н1+бЖr3M╧шE1и$С╙╟G@?zЙ'Ш<ни1╞2~i!(Й▓мзqB{С*╚!Ё├¤hЛeXk&Щc1╬0нС▒н(UbBТ}╝Я4б1м!tТH╬╞╘{i#uT#c═)б╟zМ*J5дю6жю-{uю "ЦWGpИC°єG╝╜[{vРф╕╙юi"║0:╝СY█┤к1┌aйy└Єh мw#Н:дmMи`и═bїОпcw fWe■0ю▄эXЎZ┌+╔eСВэYуnM_уug7фyh·┘Р+ёF"3щ#СКч:\7OЎЭ╞ЬH@╬}леXK■>*:у╛К╨29цЦGby╞9єUUРNQУ ч┬ЎЇ~ьbСiСД%CP=.ї r*#РСЖ-NмХ#'╨█)Е|gaCf*─/▌эQg[%vв╚NC ър№PРQBю~▄√ ,L└с╜ъТг:)╔█ТMY┼xwё@╤A+ВдРOЪ╛м18Й┴A*Х╚SЬ╤е╨╚бч4/ГСpp@9иLД╨З>Їw╬Р╠WOГTL╨ ▐Щ*'ВkПV7fк57иН╟#▐ШМмDйёKN┼eF>}щIEЇaK(╔чшЬўF└oэC:@╔╧Km$фч$ьнИ▐м╗я▒oNДЦ╬р╒nГяS╬i[{[и ФF╘[<ё╡i▄╠╥аР1д┴иЪIШРBЖ&Юm*г╖│мHc╢▌KхtУЮiGЩ#ИMК|Єvй¤BЧ▓[3A8]°#4н╜мИ@Х=*I#▄╓К)Ш╩█"ц╠$╦╗└ЯэAО·H▄юU╞▄Q╗$┘┬┘!└М ╒-z{HМкьN╝GКxF╢╗КU1РыоQ╕ёєGЖ2D еG┘╖╢∙еtv^;UП[K▒╪SN╠Ъ[╓аhтзе№5ЛdGe"Ж Urq╕∙п ╟r"▓Hrvу┌пk<╨╠!Р╔\огЬU╒С.сЯPL0ЎеЭХLЫЧУ╢Кд▒v▀Ъoеў~вт9S8SЖ╬1N█[-─hU (;ч╪∙лшhеХМ ую9.КQ+┘Y3 P7 `╒н`ctь╧йn?щ4─XуH' Эи¤дE%├Л─JKy%HS^ёКBbнoеЧТsяZяА{Д8xб╟█`ь├pHеХ*╠╞╡x@9$`M<жVМеqК$╠▒дm│┼ WtСvЄE,ЭТТЁТ█#Вt╛TП>Ї╦йяjНАМОтБШж|лю7к4я╥чsЭ¤к▄паш╖`K кп╘OБЪ(Й┘с9 O┼'gs&V'V┘¤щ└$i╪eN═QФВь2[╟▌ CТ╝╥7Vхc╕2Б8_ЪmU╨╖lюNhРG,С▓Jp╘б&&О* жL▓░иH5axg5~Э╙.ў0■вG"╗_дКCЭZ▓>6кXbН{jГ[оFDbsяcs┴+DеШ¤▐╒╜g aШР3р∙ёEkpёй#эуёWО▓Ги1°иoщIPмБ ╟Vr─Х8цБwe╩$Э╝╢ ╨Ж$dAВ1░5щe*OiT6о*Uv6╠│`пл║╛е9{S"╪ √МВ3╔жЦX√z▄ф╒ZN√8\з ╨ф█с╡Нс,С¤╦║Ю3ёёYK╥фIрc╓дO"┬sЎ▐й├,lёСMьUоД`щ$╬М▒юд щУ╤с╙еЁDeО▀4╘7Щ7hs▄ЭzЧ╥w╚д ╛  ├┬Ў╠k╜ъПзu╨5Тv°н&╕"%:phroМЄi┌9╘╡Ьi Ьg┼37IКE╩╞ъ╥.ъ╖бP╛ж│░┌О▓v└█jе ┼w2TН╢ЧМуЪ╜╜▓J2г ┴8ф╓▀зw`┘чjцр╜{k╖[Ч`к@|НЙ'┼ ┘2U▒Ыx╗+@lСєJ╦╠ЄХЪd·p╝╖З╧Кsк0Й`Hep╬FJ√╡dї╔пR ╗Ц8К";eNKУф╨Й}S8╬╖╤.,жЦ4ЕцgЛкфcЪ╠ш6╢Чо/$С└g╒ё_GЦ┌якY·▓л▒R9¤ыЯ░шm?^0э┬ЗP ▒aЪ┌2╙FKЛvt зЭ╤с Hwp$чёЪ╪шwлyKc#|П┌Р¤A7+щГЎРsПО9╤#╡щv╤,:еw#`vК┼;:ж=4╠&d М5L┼┘╦uЛr}@%Н0KПцТ╤v0В_т0$П▓Q╣╪ф|╤]у<єI╧9Мх@?ЪY1фЖ,дGF `Я5vР*Р╗╓oNЭeШ╞Д( фy╚Э┐U╡╣┤ЬмыGРк▀{jЫ┘iZ╤╥A,l0уЪ$пЧhї cу5╔Ї■╣ haV2╝═дo║■j═╒#╕ъRЫi█\Щ\.▀>Ї╔jH█Н╚, 8∙ж╦l022`їй▓FNйF бFH∙5~Я╒╥IХC╢=щnм6╗7J╢Тзbx&кYВ94в^л─usWY╗АHGнР╠▐й2зMX║Х╧89ЬЄХeєлС^2ФИТpар№Q'бф6ькд▓яРjAТ┴6>igЬmъ╬█U╤R рМ■╘X&i─уэ''СTe'%7тУКх]╜[┴ггю┌_√╙┤╞╪╦i╒t▒└└┼*ш─ъ╥ psDVФлo┼]pI▄ф ╙д+╢┴КЬщnqEX╞VO89йЙ┬╢Ёpj"v╥TяК(,ИУ║4А∙лЛuV╚U%}ъиП╚─М6█dсЭФ -є@X\)├gzй╘NW9№WЯJщР+nNE\*ЙИ╔┴\c┌е─vPъ*нБмЭъ$╦H║F─T═БП8ыЖ:Pу-:(оtБЯЪ╢ТйТ ╚еЗГГч4▄rО╩!<T0 нл<МqэBed∙зRсЖ ╖ О(wА┘╥i╨ирв>вЩ*9╘▐>+E$Вє╖╣НKЮEa╟x╤╔!Ц┘д╨~ьcX.E└Iь╞С╦mVуТ┘ТжmA &BЪ mЪ[кt╜HJ RеЦеe7$H[Х╧Ъf9[▓c╨JфdУВ+?╟]╕╙╪Ьv1Ў╤mС╡K~▀qNв─ц┤nГЙXDЪ└▀9дJ еЧLх \lxкзщn:1f╣1LФn6цН┌2└e'2Fuрyж>Схu%=,0╠р╤"┤Эг-└оч|цi╖сН$'4Fl:╕╥AlgПК%Їj▌%Uд└ Ц#БёE╣▒hаEУМwцвЄ&Уз<:ПпsБ░ЎЬm1дt(╟-┤m ч*7╬╒C12┤eО└ы4┐BAom╕╨ёN yRсеb$рБS$ь╥6С[E┼┴|zX╥Oўж╣WE`з;P╘Hи─(l¤Aг┼ЦuП╖?9в└Иб,Д(╔p>їSОN╤Aр■iиYХ╞ gzЎc#c)▒╤У2╚дlдr(╔YФжь24ф╨+#╢РFq╧ ╒b╖6х@9╬1ЯaT╢ДР│YHeVF╪╧У@╛╢eС┴╥л╞XqZЄ·ёа┐▄)KэNц2ф√╨Р4Е!╖НЇуНйИгWMЛ63B╨┼[Sc+МКj╙Nб'RР г┘8ИЦx╠МIqDKЕ{q"╚ -В*▀иbЬ[ И▒#;xпЪ┌~аЯ■+%ДИbolєWжV'╘W[igе┘иb0Ё╠Д╞№╓WC┐ЙнК1А╪U┐ыVvўpдR)oчR█ПЪj oїa(╕нгeа█9рМ╒d}щ-╣> '╧ iг*ъq╕4^█╦l─╩Ьр╓SГшQ ▓Ь╝Аъ ^@Дм├c╜g█╟1B&9╙№╩~)╕`ЫtХПУ╜ 4ГD┤JъМКфoGь▓шv╔8лкiМб╞йHцдРыGТ║y═╟H│ЬIХроу4КЩJп>hД,дИ╧и ┼u(Л" DRiЙ`3▒P5222"`Nчтп │G\фєERАЎ╠j╣┘ M1зbЄў@PШ╪С┐╡z%m\фр╘╚ю,╪Ни▒*d)╚88█jx║/!tRQ┐<╙(┼2фТк╡-В1CPъ;т╝Єы▄О1KhiQKy│!╥v'pЧXВb╙E}╪G2│╦¤h=J НIШ╒▌╞ТкHЙ3;Йуъ╤┼#ЖЙFИЄ2s[wWc#║ щ╙Н┐5ылkx┌TPъr4№╙вLН.ЦQАljн4 WBжЪ5Fх╙щу5П╘eЦйYр╩К┬U] еn_YЙтьи╙д ёY╤tЫШжIР─М╚ыTдС@╓y║М╨Е╛Ь╢F9╚ў°нл.Ь▒K<╩ьK Ч?m┌╪C0n╪┴8╟┐═4╤2(r┐╥ж■·*Т╧▄>В1╣жпl1МВ**jНЎўа\▄*!E9h╚тж╨м╗9╓g$l+;и4д+Б╔╞Ї╙╗│а#╞28═D╪¤<цУ лa?MB~╜ж|`с√У╧Ўо7ї┤6]rуL┼cGm{nMuЎ╫В▐kgПqС╢ї╠■б[k▐╡x▓е█ Я5┐gBиПCЮ▌:╝rгй┴OЪ╨ы▌V╬>е=м йf ┴v█▀єX=1I╝М(▐6╩э╜Wн$▓uidК \Е ю?5╢╜#?╚╤╗a╘mпзжб█╬s╖пKъ%┘Ч*$lч┌йih#шсb+▌`uрю╡У`QLсБ╞цЭ+┘▐▌▄7╥wb┴/Аqр╤ьoР'pv"▒·5╪y)T;Э╡V▄$kо02нлКq┬M▐:Й▌У$Вкн1чR░▀єCa'k(u╚─а∙ж~ХДаM"ж8?<╘╞-╜ХЇ╓uVlи╚╒$fvM+А=¤й█ы{(ЯYЬЬ√&╞Т?J bn╙уNїгтЯ┬Е▐WНЩX8"ЫЖх┌─┤j{Аc■їБ╒z═┤бhхd'sМoRzъ}9Xcьг Й99∙г WE┼Z╪~Н·ЦyЦHфИ╝СЬЗ╞N│·Ът┘Снр╓╥ Т7{W&diжю{k&@зЗМ╙▀жС.║Т╩▓ #fЗ c┌║?лЪ;ы+аювAЖ╞HЎ╚жбУK░'#СЪ╧!ь▓чУяGA/qЩX╞pk┘Фз▒°дЕ▄▒; WТvV%╞wд`m!ХЖеoцЎ4Hд Jб╬цЭ╨9╓д@'jЖ$3·Б#№R░╩╩┼╞cЮ*┬GWb╗я┼$╟ЮГJ╪ЬoUrF╟aВ*gn█▐БД╔Вўйoe)Ч╙"F╗ч"н!bB╝эEdYPТ╪"Б▄■ ╒БКзв▓ nY%╥рР8п\I№╝кМ╒[Q╕'OЪ│#уцР&|╓ {Е╤г╕ПУЭ▒ВiK#%ЭєFА░*@ў╗ ;9&╖I$╞]rSo╛(2ЇЦ^аЧPЕ└╔Ч╬N+в2D(/:`ЁApмw┬1∙неД╚┴d▀у═Rт┼╥щзBNм>qOE sфfвMYид▒╧╞╤I>┘кK`"╣FТ╦П&╢J,╤а▄ir5[д╫РаЁ<╘=Й31э Ч)Ьg_╟тлд[8╚╬F9нoдДdфВ*n-╤\QПеV*Vc▄[еР ╢Q¤ёYf▀╖а╘#<фю=лж ▄NN°╝╓├$8Ё PЭМдЙ╛ЫH%▄o∙5й slС┐дНЎпIX╟бКlЦЎи╓УHg╔cКMhK▒иa═│>qи`╒$UW9W]┐4h┴К О└+ ╛i^вLРЕО]╚фJ┤ n▌J┼Жq╣б!ОIШaБяэXЭи\\\K╬0╪(ЗТ+b#Ьщ РFцФгZdзc2F┘ю╢vbоv╔9ЎkЦn┘;Wm°42Е9rX∙╟"Э╚AАеэ╞x#5Nб╝eА8╙ЯcFС7МоB Птм┌Z╘*хФ|яКq├▄■г1 U2¤╖ X.v▀╧эZдzуuI$n╨М╩m╚╬∙гI╙-╞h╒Lд▒$dфgnЗe╙ьмV8ЯQQщlo°■вЖэtBМУь▐/k$═Р║э╣5ЄЮб╤·LWПq▄R┘(Щ╔<ЯЪъ┐X■бПжY┼oЮфг╘sЎКтRE╣Р▄2йХў,|| шссеУ.\Ъ┼У_\┌╚Q]ДЩЇцТЦ¤#НЙзС▓я╬Су╫UМ ▐C!'└■Z╩╣x═Ы(OY}лHE^ВrХlwеuыюЭ{цш║ї)9W╓z?ъУ╒l╟fM/№└ьIпА┤тBUу╙дєEщ╜Fъ┬∙&ВRБsт║'─╣#╛╬U─╟\Ъ╞G╡uё╡JFН╥в?K\н┼ zh!╪{╨zэ√t╛╝ТлD▌°C:░╚88▒m╙Чз╩ьPO'∙kї▀KGъ6w ъё:Ф╪ЁsЬUe *d8НЇЫ▌w7&щФwбН▒Q<OpПj╩╠w:M`N.Ь5▒`ac`|yж: 7Ж@=ZNNї┤Эьquгg ┴#Рf АєС[Ч^%TKМй+╣]╖°о^;╢Уй¤KЬФ?hhн еКї╥+Ю┘s╖5П"Tм$▓GA╥Ъ.ЫfЧYwy?х;Еў4┐║┐╛DО=Z╣rxм^з}'dkН└QЖlxёGш╖GщЩаb█рxкКUб'JН╛нx▒─ЦюuВ┴pM'vнe▀&▒·Хые╖Ю<0}Aё╢h▓u4:а-НfFф№ ╒4Йr▌ ▌ЧQ╣RFs╖К╞║Ь├+GТк├84№є;б╘=`Т└√VLm╠ф\+╗d ь|╙╘БH ▄╫Ц╥9┤О9ЪPЗу╨■Йk╕-J]Ис ЕзЯsЪмVР╡╣Н╙╒ЭЙК┤J]╠ГШ╘6(Х╕╥@╒Э ╜▄гЫЭoP>iб╒5^╦aОtС\╫Pш╫W&)mюВН╒┐╙╒гЪDЩ"Ц3B@f·╫3уб8пN╓▌ю╠╤░m╘ё^I╗a_Hl·I╬ ЛЦБб2qЎЪf оCPqОC{°мфШD┤Ё┤ГH├gяЪк╔pо*TНўмд·╛ъ▓Я@БV╗║x┘1,hШ┴╒╔иwр╘Q▓Ч июXFxC!W╬A ф|VlWЁ3ХЯ@▌П °гЖ^ш*ъ це╦eU6╖$I&0+═HmMНПТqтРIcIRМ6тШЗ!ЙиєTфJ▒┬]j├}И&Ни║чтСюЯRБГ╧¤иЖVbн│+ Qeз▓╜9W╡л@└°п\╖iPо49╦┼{з└`╢1ў┤о2╒iМR&XМуJ№b╡kFиєiС=+Х щ4е╟q ЕORуI╬(й$Qv╒Й$Ё)[╔┴╣A"ВA■*^Н║Жm(б╚╬─Пl╒цeW╚╔╚╪К[╥#╬Р╣ў4?нГGl╣╒л J╫Д(@(NTуjЙдGu;╢▐k-оїЫ744╛%╘(bа√R▓s┘╢ЄФИУ╗p│д╗KД╤<Л░PAўє^╣║РС0FМфR═q;"░~=╞)┌AУ▒╣ю#╕Оц╥VЇуН│∙мюЧ╥~ЪX▐т`л▄b└Ьфcг\LКU@╞[Ў4rXЙ▄ яЬ╙┤'mь█╗╛Б"dТe д'Т)$┐┤ueFYОk2■;9cFЭЛР┘└;╓[ШOи╡%╬р|╒TZвЬЪ6┌>о;Л|.▄6╞(▒uh-bщ╫^v╟░iДo▌.╢╞м*√~hVЧС╬Т│тN┘╞уКЕв=6о┐PE#мp╛tЁES■',sF║ЄЄl0yоmп- И│Q9>├<╤Zш╞и╚еЯA╬q[(з░s:)·▄ЁоЖМш^KЯ5ЫъЁq T╪ЄзЪOи▄)Ы▒9#плOЯjу·Ї6╢Ё3[╚чQ╬ХР[▀mк_Р▄ХlэнюЦ}JdR╠2рQэо o.ъ╠sВMs="cme|9╞FУу┌╡"Н/Т+╕I&>7╞3яX>ЭЩ╩? ф╕ B1 ╖?5hх╚p╕╚м■╠ Э*A╚▀№╙ЄЧ╞НXo${P┼l`╦#фE/Э$уН¤к·▐5n°╚╞U"НЪnЄ▒R═Ц└рxл▄.и╠n╠KN╘ь╨кЕ`4╢чcУ Ю╒KГї╕█└oЯc^p═2% А4П?5HDм╟вA П'ЪъЇ*╝m№Sк=╢< ц)+л#;)Б╬UЄ·~hЎЁ╚╠K ╣;s╢вC░▄4кK&NW1╡ CqT%░┴├ЬМэси▒)A!╙ичaNЫwB╩Ду#╪RщlP▓л6ЬЬч╟QщЫН2╧#О4СAlГ╢* ╖О▌╠Я{Hm╢л┤(BЩP)▄`ЬтлmgrСw j╦ф¤┐4╟V& Nъ╥.жИ└√c┼'4╢╟K[╢▓╪╪z▌Ж╞╨E2║e∙x╧╣дdщ0[╝ko г`*Яj4KАГЖ нJ╞чўётЬ╝О[ОЬ╥FdOП┐j═gдуDlш╟ |{╙Q@ц▀!╫^√єЪ.║ 9╗.Ъё▓╦3P6)╔>╞Й╝kЄ,A]X·Xя┼tПhм╞,\Я└ЎдцщУў7Ї.пY Пzi¤)FЭШ-aї6¤┘х1DA√?;VН╖K╖Т!б╤┘FЬ╕ёЯЪ╫6Р╫XFFЄF3A{ YB┌╢8Pv°еЧЖx╖vP├√Vф] \╗vmМ-Ь▒w╞)╪a,пёЧ,=яєD╣=aоО ╬┌Y.2М4ГКъ?N╝1&╣cЕM%H▀>)ё╤МwK╔$Т DУ^щЎ╩▓╝2HPuy?·вS╔V,~╦QcЕ:N╩=ъ╚╜╗~┌nT`m╛▄~iИ:ВwтКe"Fl.w▀┼*Э6A&д9├sЮ?Qa)╣IЩ╘v▄√oS*eжrЯн//ю-M╝Ўег╖УIУ|ГЬутв╥юg╡Ж?г6├╣░'|x═t▌M#nн3█╩К_%╘ЯЪч║Э╘Ou%╗0┬`jўнюсIе+aoгюдRАРц║╬Тж+NмakЩО(d░Eюячє] ╠▒┼*м╞+>EqC╡z4БAыY~qWWЛ╣+Ю+?╕С╔┌К6'lч·╙0йЯ╣N▐╞бGшЫA ц(FoZЬБЭ═KкДї6№√yбФМGпQюgmъT  L3▓щ╟┐╜&U Nа6╩7└дю-ДС:ї.╒╔ХDИлдЬc4Vv Hлў(¤й!Qшa(░┬╔Т7╔>▄Qю-РтVMХПўцЕh[╜бЄ─}┐К5╚P║K░╟Ї"йКДд╡╘╪;!╪БёWТ@LБВ7 п▄Р(pzF@к▄▌DсdT9l ╝{Rv: ╙rDГ9;y№WТ╒нХОHуНмF4jДўф╤н┘K3.▐ы═?GйY├s W\Хр√╒эmW│H╘НЬ{╤ю▒Ж 6ё°кAЕЙXчmИдмMХг$╞ЗNбТ}▒@X16CЇфgцЛЕэВw р°пB└ jP6 n(И ДA1╢°вЎБСО Е ╙[ъfч?┼│иuУpК╪,(ж2╫(в▌C7е╕═'┌ъ╥№к╞t╣ї01]CZд%Йd}Ё|UчА╠ЪTЕEm╕зЫ @▀D▓0\ h"╨}:╝.078ёZ1FПjCЯ5C F║@╚m╣м╨Зb[╥X.°6q█!Рg;ёBШ▓ЦЦ`ё╖╡{╢╞e:┴Г╡C~ ╧┘ЮE$щe\Мy┌лiEг1Т#У┴▐Ц)АфТ╕фTрдz╡Е|эБ╢ї)Гhгoтй gu<цЛk J╬4чУI:А$6пыF3bb0·VR┤qK' cVд═ XYСP░ 3TЫК<мcULьOЪпi█; █eўк╠м└Ш╪фМХ5)ХU*°▄76¤ЙязQ╘лдуvкЛx!Q@Шу:З╕4m=█╬гП4+Cл╥2N7═Bб┘mmц·{╚b╘ю;RH▀╩ї╚▀$Чm√c)ьN0q[и./вшF.ЯpTл╚█Aо3к╦>;vh∙43╘ю/-\▄┘А%@rqЬ|М╓╜┤}╛ЦЭў<╕СШПQ ├\чO{Е│╠╥╝рlYЖ─S2▐╢bЛQb*|gcZ╬ ="!6╓╬Эn╔ Гор╓╝й╚m▒Мyо2▐ч1жТN√~ї╫Y▄DDX┘╚Сю*9%c"мFsиВp╪ 4+YЭ└cдГАh╓ь■╕Xч'|О√P┤Ф1:_$Я▐▓░д^X╛Ъ^ьg╣ xuТs°и╕*kCеЗ#<П┼JGЧЧW╜д╬TШц╛x$З ╟чcKїП╙VРEКI%Р7и│яПaZW) =X\F╩┌¤$1ў▀4№05┘NюТ0uЯ·@нпкК ╔#Cxу*0ЄЪэ,\Z┬^=2(┴^F▐kЫТ▌Zснд╓жF┬8ьMub3╖,M#l йЄЇЕшa=╖№╕IvsК!|:дф█yдfИVb5 Q┤iС&┬▒╬√■╒И41 ВRАХМ{№╤ЖАЖ к▐Ni ЩI,A<{gт┤$╖:V;уRltQТ7\&01Т╔▐Е,1DЗCzI9▀▀┌ЭдfщЫ ф■l√╓}┐L┐аТЦP┘|ЮEnдK$g$ПMYFИF ~EOв│-Е╒░ Ie'¤д╦$DFNТGГGЖТ┤№йen+╓ЁдR<`·er7№╤╛╩fУi}#lщЙ\Ы@╠╕fчКЩ"О─е@<`╘@бСОг│╛)╖ЇЇвГиоH═R#'|Б"ж0qМэM╟эў#RдrЪп╙╞$ieЩ}C┌О╔Т<ЧRA╛мэO┘кH и┬░╬╟o═ ╟▄M:A О|КєЙFШуЇчh▒vПDь╩ lш▒I№l)╙Э╖рROXЕ╒мn╪тЖDе┴W╚╬>(шkCТ7ёЎЫ|°uСD╗gC и:ЩвuУ╒╕├T$КdpрО┌Ю);)0▓I█uX╘e┐╡J╠A╦сО1БX╖NX╦B[#mПjШzБ╕I`╟г}№╨я┤;5▌└╦Ч┬рc>h ▌щ[╖Въ?акl╨┼▄пЯz4дхF N> $ь,ўuY╗goVsEbBфi╧ПWXDzd* э┐╜4(еМЕФ ABt+░╦"aЖYЫЭ┼Gy╣*Fг═.▓эСХёRЖfU?═ЬmьJEб╜RJГГ■╡{╦╕энС╩эп,y┼.^+ЦТ!з#═TП╡еЖЬ=щ)$├"ЖTэЕVYЬyеэЩЩtH╗i╙ЮqAYcО@·┬юе/Т°Hг б╚>~jй!н0┴д*cРщрf╝к┴б╚╚>╒Iз[)мРv╧Ъ sн─·Сtйб■*?гhсф╦uxй╖ЕcБГ│ы╞T|P Щ"Р2чЬ68л┌╣ю╗┤зрЪmВfМ╔Е╦x5h"С]ОАСЕї8mй[Л√Kф╕╕╙█╟дP,·▄Ч│1`В$\в▒ЎкМ\ХвЭ_aопмmc═╒ьA|▒мЫ╬╣ow Я╙ўq═qЦ`╚ЎЯ▐╕п■BЪd╗[╚Р╠nd!┬ППj?шЭ$У:пй╬2A┘GЬ╓╩LЦ╥tv гnzехН┘ъёЫyVlиw ¤EoX╖OяХТы║@їv№W·Т·тOвщУл╩╠ф╬┴GУYv}Nшг Jw#8╪№╥ЯЦ╪Fj= Є╟[О;╔-нZU╖F╟чц▒?Dїk╗k╖╕╢ю*:рй<z╖ъ.ЧїР░ГdЭ j?@╖0\@ W╓▒уJDф▄я├о╡╛KыЕygdr1Ьє]?KЦцXцa4Z@9"╕ж╡МР╚╪fпgy▄╤─G&б┼ХiЯE╕Lл╚lёКJ,ЧuUXsєXЎ╖ў ╣С]╢'Qн k╪о%б╪nз▐╣х ,n;u1шn~Ё~EX╟з╘TЭ■sC╗╛┤╖╕DЮх"-╢3Т~)┘ иИС! ╓1■┤Sb┼Й^Z╚┘D█ щ╧╟═y√╤\Dуu╬4X"ъL┴Б█Я4C╫WЪ=gУНБй┼°$.#yP╬T7┌=й;{kБ(c"ы╞Т?ъ╡дНBю╩=Aw╙∙а[▌┘6TL│i╪╒о9 $С !ОE█V°4"эЦe-╢@Ўв[p ─ лc═eaЎЬлМ■*iо╔eв╠╥FB?4)Ra0Т% n8∙ж`Їи\ , Лж6lАb"Ц┴шRhфXЙ╔─ЮMжe╕ОRё▓ч }жЩ╕ %╛zЗ█Я4#цФщ Ш╘┤Т▒░(╬nIHОС╢85,УwtХ╩╖УтЬ)"F ╫ЭН ┐"хФdЯ>EWhtV╩/Cе▒▒3E╨°СГм№l*ыд)1▒nvйwS(ф}░jo╥PЬК▐щжО3h╕█"╛Xў?UzX▓иТ│_\НаС{ZrZ2м1╚<╫╔:▌ф}#й\█¤4IТjGUёю=┼uЁ%╡щ: Ee╥и┤Н╣оvъс$ъ2$nЗД▀?▐ТNй}"jЫWsVи╘ЭА#СK┘├4Тй@═,Т`уТIн0жь┤u▌-eТ▌DQ╗╕╞qт║╗"Ў?Jo╠pw хЩ▒═m■Ощ┌D-pев@%cх¤┐Г ╔╓░▄t█K╕#gТ=C}╝КцфЦ═гCR┘═╣ФФ┴`Kk▐╣╓]QzyОGю╚Fр(8#>Mдїk╗╦3lЄ╝а[╟┼Lo=▄r┌╩цc┘J°╟КФ╖╨b╛Ъ¤соэ-яc.@]Ё|rхZMDо?╘Wм▌ щ╓КИСйПbN╪Ў┼╕д╝dВ<ЙRшДи┼╝░С7hй╒╕Ў(є?sд]├n┼.t)еFв Т}═BC hр.Cy┼8╢3Хщ¤:ъ╒ю 4ЗУ╛Т9┼tЙЮ═Вь┴Й_ЪfН3DЗ╬~hЦёЭL┼╫╢лr▒PДэ;оУT~iNУq+╟█Ю"ж7┘ПЯq¤лdлъ2IзN6╟Нъ^╘0V┬МЯ $╥ХТCк#Мz╢Ё)р╩NIG№JH╛Щ╜+Х;`Пz;┼┬─╠S▄pi4:&╠╢жqЬНй█6mnнГжФЙ[DЕuc└жbrёъ Вy┼B╕ИH ▀єI╙ ╦ q■╘E{УwtБ"╖╡)$М╖.е╖╚ўцКn \'`√СУ╚и▀BР╣`=BИDu%NJР?нL:9╗dцЭ Pнe┴pAхj╦м ╒╬УэёTH\:▓8СXqFМfT╞фчzMХE.н▌у╘├'╣а█г(`НХч~M3q▄V╦·Oд■iSIVE- I_0┐в<╪\°б░q#iP8#▐нbЇЧH╥w&Кdb{КQX'Є(ИQTS!m,0╟ти┬A*JэЯzl&УД█ ъеА, │фКm ЕЭ$XГ╞╛зєS72Ж└ yжUfN'ЯcWvТ 3ЎЦ╞▄v%ю(FRЩZЛш╗m Арj#═\ @/ъaцжV 2y№╥нF}═╝EГ,Dиўўб╟aГЎЙ┴╞)щЫP╠'PЄ<М╥g(T:3IП0╦;6н╘цж а│й#9n?x&}HVgтН╨М°нЗ┴├А|J╣╢+Ц,╟`цЫ)е"4*H╚>╘8Щу~▄╗y>EM2йК=Yс┐i┬╩И#rO╖╡>Ч!BяЬ╫гЫww╘╤.ОRт╓Iнж-▐cи:~э╖бЇ╚п╘rvИ╘╕+чўоХСЛ"ЭC╥*J,Г╨т%╞vэ═┌4╞▌ЩW▓вBН/а╢;П№╫)g{} ╠╥G2дYV> ∙╜v[зЫх"6`2qОxд.:<Лr╤╞г╖0%┴Є}ъртЦ╠┌bЎ╫2\$EЭ┬▒#`йн0Ht╬╢А█цХГе╧kД▄▓BГbч%ёE╗ТC╙▐┌╩8┌w!UЩ▒Е'||╘MлHеi uЮг▒╦╞Т─лд7╗√╥ЦЄ8Т(QB6N8мkйхК№┌БТм2з┼kЇЧЧъЗyС№╒╒uI}╫meЪoт*мj0лK▀uы.ЮёЇЮЙ4eиСr╢┘╬~Mlї9З{IP┘;R╜Sж┘▄Ї╣dО╒V∙$╓м62.1ПЬc√╒к▓efHfu2Щ▓O';Pх:ч█9═c}yK|╧╤DзpPАmт{юE]K┐"Й&(║╨▄xФ╞м2A?ЪПс┼0*г#og┬Fc2МЪX╗ $j▐ФYMYж%]Єpў╡║H\╛▓║╖?╝Є*┬Fн╪рU═╞Ш╒y╓┼4┼╤д▓╗▒тиЧW {гэ]┴тЖYЮ&e$ти%U╖╔чКЩE1ж╟╨┴╫д{╗жu╣ЛФ^═8fhвX╨6Г░'Рk╫0└ЧЮM6╙wў▄є┼gБзф╜1ф╝Я║aHнё[╢_й╗Qv#ЙеPрр▒∙5╚vQ╧ёdУ}╞(ёBЎ▒ъЙ╗СЮM:lЫH╙╛ъ7O█ш9м∙:ЗhkO▐В╠tjЎ;~+лLUДi№╟z╤FИm╢tK╒ШДХI;ю+kз_┼8ьй├8:Iё_?▓Э└├6kWд▄╘`,X(aи╘J6К;┬═ #Т27?∙яT·шЄЁЯ╣▓uэTЫщ[wШI╬}кЦ╢Ёд╩╩ёЦ''╒═q▓Х0ы:╣l1╪А(╤╬U2─МТ╕┼&╓z.%ХбО∙?▐Гq|▌ЧО< єцФ^┴─╥╗Фу у'═+,g╗─╞9└╬MdJ╥ўcя#Д╙ўТ cr dF ):F9╚цпн2╤▓.Y5Х╢╦┴9┴б5╔*\ЖbW└█т▓аОhб`╠╥Iд9S╢9ф!фН╞│Еm$°╟z5F┐щхЖYd╫4╩НеA▐kц йп╓W[аКsn┘ G█У╞kщ6"яNГKv┘qэЪ∙]№F╔m Вd%Й#▀БЪ╫Ж╓╔q╨г┼%ф╞IЦ>тоUW`>?еt?бmуn╖ke╠╩╠▄фq¤ёO~ЩщСЫKХH╗▓╖+ПЯ4/╨Р╦k?TЦqЕ√j5ni┘QG╨║ tЩn]И╔Ў╨ U]м▀ж┌∙К5СНё╡)·Кe▓щp█чI╙Ач▄╫'V·Я╘im!&)с1оOё¤ы$м╣:0·Х▌┼ЕСПжFи·ИїsКЫ[√┐M╥Mж~╨╚'lу■╒еЇmvТ$▒▓╝oеЧП═b4й б2КU■╥└¤kв =═╙┤v>■K╛Йl.є▄e╥мгкy%И!X▌uб█|ч▐│н@ j;l`(u(qР+9╠░F╫hЬС▄B+┐kЫI╒Д═▌Жp6∙н(:ФSF┬м'М√S@7 ╣T3Ц;fнЇф╩#2)O╕i5r┌Ч#lХг┌Jd╖EЩ└`3╟КjV#╫фм^@'єц╝Ъ2p c╕ў8ц╝╥kБ╬w√vЄ LД├3ilcА╗ ║*Э@cєU╝М╠С┤(─dТAкw╘ХV╗НиЦЄ4R3ВFЬЬ═;LtЕ%╢╒ХrtyMт┬r┼Х@'═RdaХМрСёF┤Щ╚оcЄHеc(JK/xйї{ю(░k3М¤╝gтЖЫU!Ў╟рцЧ~▒1%IКmЙ ╗2Му|gPS2$╤ом√В*.]Їлh`╜Д0M╚$sI#╨ xX]█Фъ;■ї║f НJ√=╖еmнRg╥┌░28дгшю.U─д9╪V┬#%cr└МНЄ эV╖╚ФЙУтлztO}Ьз  ~Лъ?Um╒:5╪ t═\с┴ї`╙ЦЭl,Ч·Щrx╚оЪЦL╞Є│! G9Ьа]!L`фg╞~kyЄфС*5│-·│ЎЩuя┴К_иЇ│iЕ>д;╚нYю ╩UАзfЩ2─ba&w╘ЇиЗ"Пch∙o !tnлw╤тО╞x дJun°д?NЇ ф╡╖╖╝n╓OУ╞OЇлШdXч·L┤M╩0■ї═оd╗m[ВгфWKф╩И\╡│'н╪╦╙└Дp╛Р╜%в#Г╜t]R;з_иZПWц╝▌>9`ic╬уфV8ЎkК}╡єтх|Кj#м┼ЯцQIu8┘&bI╚8ki▓ЙР6 ┌,╔гZЇ░R1┼фоХnyй╖▌ ▄цЗ0╚╘OBCкBZв/кF·g╚∙=мртк╒л'lbР3V3Dpw╬&M░1╕дoVг┼ЯVH<╨─БУЭ№W=|K\╗WElЪСБ√Еa_F;ПГцЯ` ╠·╢ёZЁ:╞▌╞ ╛k╪█|╙╫r╚-Ва8█?"Ушщoья%║WVь┬P2А ZУ╜иeП.ыЦ$y< еt¤,д¤┘ЯшNGК9┤О■P┌sС\ТЮ·5Мlц:-хЇNЧ 4Р█єёZ2┌K<═<,├АМ∙нS$rч0FнС╢(в(%1иN▐У╟П┼FK┤50еKЇ╛лТ╙cKs¤)╕·{JЪU╠n 'z╫Ц$Aы ╦Юyиh╡G$▒JгN№№P█`т)║л(╕Qмо5╧Їе.·2╔tg╬бЎЁ▓ШY╦┐▄lэ┐╡ KГ$НЬ# Г@ёBц3g╥е}y,аd√ ╫3'E╫I*НВЦr}№_Їнo╘╥=╜ФKмч'8Є< пIъ+"И┘3йBг┌╡уnн QBЎЧV]:═─а▒rXI'┼MмёC╫.!Pг╗░G╕ё¤ш▓┌╟▒╦$╗Aд9▀╓З·N▄^u1r┌]╥9иlsКк]РЭ2┐№ЗzЇ╞tF№╫lТ\▀$ы'o╢5f║╧╓M ╣╦Хюзq╬▄╓Яз┤m1иf8я¤)┼VЖх▒╬╡╫zЙ╖°m╢╗╢╟q▒ў╛qY¤5╧QъvP▄╪BєЖ╚JфБ■Хв╦ЇТ,Еe'─Wг│@ы* ╞┐К│)i{oТ├cE╢ЧPIП ╪|╙╪R▌9у`ф▓1ЯhтЕ `Х8єу╦Аэ┐ v┌УР1Шa╛G¤щ▒$YЕСЯV╟ЯЪ╖mF└юКj╙; 2pAEШ*╔С└╞╘╖рш$H╣Lг═x *йШoяJн╔ue;ъPйI╤gОЕ▄°б ВФSЦ╬ Р└ i╩╝%sжFм¤qўTЬАNфphМq7xтB)$3)аЯ$xаХХ5iz@унq6Я░ Xк═8CcQ┴▄ЭА4mh╘┌4ЖЪФHЄ▐Э╬чjV╬ьE9╖ЬiЇьs│f┤▐47═1ФЪ@ок0PПГтГt┼(IS╚ЎжюD}ЯRlH¤и1Лbф·Б╪6#ў╙ VVV╩Д╫О3∙а)}RTЭИг▄╞С╩▐Sm яCЕФ╞>ьgOр╘[▓SвЧйе├╣л║Й4эМА(c}q╗1 ZИЙ╝sТ}9n√U▌ЦЛ:+;╦ХЇЭ№TIЗР+ВA╟5╡Ъ7П[У╣╒ю*ЎщЭEЙ`4тЛ╪6&"╨tъ$j╪Q─R╔*╘ЬЫЧН└█ qЬ`HнVЇСч4УзМ╬■ТёщМ╒RHБ╥┘уsЯ¤SWjи▒Х&HHЇi?9еЁЯQ┌:ЧP╬HёUEYa*:0╪P}"н╞:JЦ>|U{Вu#Я▐Чю"ХЛ`zЕЖФ▓B╬╙уQ4─3ыМ║Дs╬HўЬпг╞·╢▀Ўл,┼BhwUoКt&╒ЗИH═Ц!╦dА9й╕Pm─9\Ц▀zI,c ф ∙вw╨└]у yлJ╔kg=╫$╛ET╖9-╛H┘M;л└Y.&█F7^[Яjщ'М;zBрV(cgД╝Z╡1nF)хZd╕[┤{з8Нcя╔Т@9d{╒ Utї╖ъN╨МlА(Р¤#╞ ь:NВг|S┐лп!KЛ ┬Г╞л&╓Ьk┴J╥>k·гзv&ic>Ї╥╫│ю╠юYYq┐МWC·▀0Е7╪└mКх┐N[·┌/su╦5S_лB^2┐и-╡╧Хs╡ -╚Т(9┴'·╫I╫!ї@▄U/-#╢╣wga┬√oS¤*└R┌5┤1ЬхXjVhrx╚▀Н 5x.х╕▓ь3┌▒*H▄|U"Б╪Ц╧ЎнUЩЛы.2 ┴5`г╖л#╨·С1I+▀;c═J2vJч╫CгdcО(И┘╨2B░┴▐Чf!UёА┌Лd8█▄~*lгb╪ qР╞6√VU▌ЫТ\.∙95╡╥╔╥╧зbПtaКёuфH┼ TM[8л`cо1ЪrE▓║╚^ ■$^е┼УЬ9Бж/Kк@G▄3╡WbG╨:У╤mдНГ╟█oэZ2rJ&╤ш╫f·kЕ(F√ЁFje╕%9╚lэц▓ю┌iNъ@╕CО^├╝╩Vd#@┘╝b│QbNЩиЄ HM@s┐█Y╙\ЎМЕP╔╛╬╟═ыКtR║уl░8┴RТHCBDm╢s░4%▒┘Szў╩ёдС`FA▐ШКfТъВC╛▐A ╜сТ▐щгЕ pLe╜╡7$wz;!є■;жЕ┤Є?й│eЩ├6W7%╜¤РКY4─TХG╞фЬc5╓├# $Й├┤ia┴¤щї $YQ┤d6Є=иЛбГ[ЛЙме8╪:щ┴Ўгt+ymg╒└╥└фЄ╕ж"К+S`[X└┴▄■MS?зbЭ; єяY╜UR;Ц╨·░╪9|╘щiЇQ╞5 ┴,М╙хtиQ·lZЭRРp╗√r=Н u╘$r щm┤юqA7#(─eH┴>w ╒LНлY,C7█ЭЖ~нs┘}ЦЗ╤(tхN∙■Ї╘W";Ц ч╚╬EgмеS┐! ─РA8пїwhWQ Ж}┐╜-╪ь~BVlЖ'Z■*gФ▓б╥pН│┴мЛОл,]>kХ┤77   6чт▓бы}^Yяь─▀єF ■├j╡╟&нХБ╘▓РэГдА╬╒@╠│▒PкВ>+-/МНОcз}$∙c9y┘▒`мЭН юДЫyKМw$x#4╚d:Рj╟;╓pХLжM%\.~╞*╞y'СКKз╘?∙єPcЭц╨хТдчф{╤-е{ИV3ЯP П&ГиcС╗ ╖╡ ╕{ЕИf█lx■Фв├aф2┼№╞yh%Ш░зoєA╣iЇЙчБЄG√╥q\NgUp;e░I°к╢+5ЖZ@хUЙ;ЪKсН╔(█sTuhР4.uП┼SR┐ё┴╦Ва╙╔╨<ЗwG╚m╟┴<К е@FCд№xаR╣░PsАOЙ┘З !IЭC чёJ╞С7Y:uб╘dП┌ны4*I9├/КYdпeг$oН№К"╚^5Т-) !ЧQ■┤&1UД6м1└'═Dv╔ } sтЪ╨▓DYв7 l)rбКС╬ucтШЫ▓&RI2ДЬ'С╜12<*╕╪єUЭuхvW]їcСC╖Ф¤D)3 ∙Ъ1ўQQF╛w╬°;Г√T╦}TТ█╠{/М*sЬяA=╚дC @█ЛМ5ВъFЦ8╬√╓Г░СcТ1Е`ё╢┘б< rPs│·yёAщ╬▒IЇr┐j]Uф5Sb╕2Ih┴$я╛▄╥M.ЩЬ ь├┼:A-ВT0─БK╚"d\иЇМРx╘╪яtz Жэf}QиЇ╢xтла<С=dрч√КИ╓┌}d╚■СПz╒╝╤█─▐СПI#Р*SЇЪж78 sйг╥>ю1КБp┘>Ьl╟єCЧ╕юeТ9$P`7'(3╠М▓4Q7lmл4уk▓ь╘Ц@aIcяЖ╥8йsE▄бrgYмгYвНВч9█l╤ЛHёфЬНKь*Ю─┬\╟Л╕М┌Й╧┌з╢%%╚╘v9рцЧ┤Ш┤Б Ъг╬7▀Qц:5┼╩ВJЯцУcN╦В_■▒m&B;ф|RУ@"A3\иzЛ6■?j-╡║H╘ С(*=╟╜ цЄK+╤╕U√АWС√╓ЧвЩ т9#СюC3 БnE-╘`y"ЧD═СЮ2X|V?_░╗╜ъй╪Р│)эОOWI╒°tв$ ╚ЮFч√╨Ы╢D[ХЩV}I╫1,aF╒Яb┤Р╟ Сл+ А;b░Wз│╪╝mLи`╚▄dф■ї╥v═╜║Z┼ъH╞Рq┐■й[cВiь╟жУ%d,u?oтп0БCjMX\и╔б▒╕-№9ОA9г0FaърcВ3╡;вшкА`Pз°Я╠<учцл СЩО"t pнр{эR ТB |■*є9*$UНИг─!х одиїz└ ф .c▓Д┬─А┼T#╜lEJ╪уЭы'їмk7LbТэ0d8ёцЪi:s6¤NkОФ-п#/]О}KX╓IcveQк&Їы№Vн╗f┘ФF0NвIеТ▄]┌^"Мi├бuуч═E1N┌Зеv╟┐╢╘А(] urTщ<чтЙзp#╕Мпйr єяZ23╝C[лv▀?5Ы╘·{▄дR#╕Tlz|╢ї= ┤*╙.з┬УйN64╠%;▓hut▄ r6м╘+n╜д-#Dwnv═д█═ i#╒б╜X╪ЬdК"Ў31Я│ ▄Hы(I7┴S╚є╜mtXДЩП%У╕╢x╒С╘:~&fмWRjo`╪ф╥ЭkОї┼╖╒▓─┘ еI$√т╖уiТ╙▒~г|├мH╧c╙ нщZ6V! P0у┼4Э▌$k╦жVХФglПїгеиЪ▒Он94╦М ▒we,╩▓;─H ▓ъP}ы#н~дюLm·SE╞╪╒&юэя°нЛ█8сR╠0 ▐╕n│╙\u ю║xюк nДgEfЪr┼Ъ8%FпLыq╡№i╓с╙П∙dF}╚н╦л╔rEM1&сA∙пЭJ│u nыоЦWJУEК;├,ЩelюT╖VлНфf∙4vWW(ЁЕF(чЖ╧Фщ╖юn▐ьъg┘╖фRгJXHXи╧┌jЭB е.эцю▀е$eУ;Ы{аZ┤k+!╘╪▀z,6╔#╖п ╛O╛Fk3Ї╧Q╢УзЎ╠║Щ│д┼j┘M4=AbЦ5xШ`Ь■р JхqiЦч№&Hаi╒A├y█■╘║вАr);БN\ zЇй╚╚8ч┌ЦОъ8с1:1WЎ4ж╥ьV щр ╘╖зх═jBdЧ@к╛°$яY0A wЗ0╢v├OBс╛└╩Кyj╤·╟kn▀m╟▄W$К^хТ@ёо╝4░эO+tAm/зclц]Гu?╜(ZF╗fгД╩я┴ж ╨░Р;А╪иЄ8 Z╗╞ТHТ,длРA╞ ■j}╪АK$Э╣&РСг▒╔╔цФ╕ku╕О!$йЮКd█ъYq"╝l=C8`h6ё▓╟ЫWp*─ьGэTЧв░]сця%└e8,дСУN▐ШфЗ\}╨╝[CОKБr║╗М4ЭIМ■@ж%fЮPП╙Р0╪з/д-3>(╧╒+epFЬ ╕єZP░Щt7┌▐ЬsПЪдфа c╘╝ЪЇQ═*╚▒оЬ ╝T6ь╤ЕНf╢╖eПМd1акГV▄ф.■їчмкbb 8QЯldrGН╬вк╔УиqП═UК┼Н│w╥4R7*NI Кb┴\i~|ьy┌НqF█╥я#кvК╒╢9┼'ж&ь╧╣Зщg`U╒mЕ╪ f╙╖":З╥V?╡LТJыЫ┤Рj9╘╖╝╓$╠^▐uTeфГМ╤╙)1ИW╡;; KВЫrq■╘0uA$lчNн`ч`j╥╣ ╩каСХ$Є(d\╚0А@┘╫qПСZ[*╨┴ЖfЭFLj╟сжо╟EBr7ojЁ╩[╡*ХR$№T╦4ф2GЦp>тДБХVъ╤У ▌─╟┴8б#╚lтю+eW зМр ╧┤║╕╡╢mjtЖr9&┤г╣u*╦B╩IS╕гhvИI1eSЮNv▐ЬХ╓ajЬфя═,g╠DШ│╛рКє╩╒Р·OА<╘эьM▓б[FNе9▄К╕НгПDД▓▒╚<■*ы3мШEИ~7к▌▄O4jсPHЗpгfЎ№U╪)Тр\F╩A╔├bГ}~их|##R98┌ЬUТVR▓;mфTъ0╚▓GФ$БР─s┐КJ╨шсd░ЦKy_&5CВJ╓Ящ╗(d╢╕ФжT╥Km╜я╗opшЖ@Въ|ч╚н[;а╡N─▀├$Т`й>1[╔■и╩┐cцЭR╬G~рt дпиу$qКь┐N└Ў╜ nfl,aСS?ї╢kї ║╣Вю{╫Ъe┘╬C)╧Г]█╝Й3Hў╨№V^╢╒╓!U(-╧є┼m╖░ЦСЛ╤х╖К┘"·w╘Fuk<■+жш═tl`1╧▓НГ ыЯv/c╝К5x╘·Ф7╗ШЭзщ░Ж5Хф∙┼_-%dC▒ЬДЪ9ЩWRхt _;Жд╚ОP cП┌╛Н╒г╤╥fС╓▒:Ж?"╣[K$=+╕H:▄╢3╞qС¤sKОCЭ Ї{Щ"ЬCЦЕРw2?ШqПы] ╕Ц!u1▓H┌▒р+Ьшь╤u`С2рГ╞кщїн▄$HXХaиsЯЎз╦$Ю╔К╨($╖Л╖ЇУВ╞бnf3╞йpЄ""─Xъ╞vв█═'{DТ+#∙╚ЎдцН╡иfДi╧░═LvZAНе╨С╬iЫK{h&7kБ┬`V{ZNё╣RI,qУ═1~ц█жм:╡2М<Уцо7vЗ lKйuNэяoY X ▌Ий"(╬о\╫╧/ч╤'s┘Бц╗Я╙╙┤ЩРР7¤лV▒F╩IЩ╜nygЩвE■c╘G╜j ё╧JК╓╥ттю4ЫъХ╡ дxб╧kk╘6C╘╧Ощ╧$юi╔·┼╜┤в#╢ГF>)B╢УеHхRЇ;nУ|'щ╨Ю╠ф·H╚V°°о`DRrя&d'rkы╜mb╕¤)n╚РusЯЎ┼|║єз╠▓eЖЭЙнтёg5YН╘oo4╝VRFмуH▌┐5Ы╤о.┌╬т9rУ ш├r╛+GкY8┴*№тСa"╚п!╥├пqэZ┴)DЙZfеР╕│T{v╤Ц╒с|Я┌╛Ч м╢Ё╝rюNб╢6 є{;Шоc`еPcz·$Eе│C )Бї{W?7ъTv9#*YАbю88чy╧Ўег╢7 0├афSVўv  ld!| е*│ $e>Ц╬0▀▐╣Ь┐Г║!-&M╞УОA 53[clcVф8╔■┬н$L▒Е8rUГg949`' З╫╣ yjU╢<ПXG"HIWpI°;╡^ъ)!С 07╨┘б¤)╖╗╤qибA╣р ╝6bw┘уCўsСЬ╒■лLeяRT╗?HP}ыЮЬP-~оmzФ╙Ю@X.Ь]У:Ж 7cу>+D,h АiНTw }╫¤┼ яDлЇNт█╝cХSb=JзТ*У@╠СшAчг:зg\oЗO#ёKIДвuЬc╚∙бшiФ╗╨fэдd>1╖н5Л▒f╓@>╒eFGhєъb*K)G╝А√ёёEХжxЭBx█b┐■иО]f╓└Т5fИсfgD и;ciтcНKЎr|Qд-У№3"Ьr ╠8б]│FБФ,q¤ш╩L"Шюз ╕╞h╨дСлд║Х>Ч·*мДСгGv'Cьj╓+$ЪH*40╪ЪK А╢Hй■hсk╥5 dф╒&иРжd Гm▒О6ўв\╟& W ТMRh]хЇъ╔]▒╕тй^- &8`3┐╜+hвТЛЗM&2║Tю7нi╔╠╤╛еl0╒╕∙№T█┼:ыМ┐pАOКБ█йТ■};>iйQЩ,╤ў\└УN─Я║СWw╙▄WОBЕIГЪ.е$9╙Р)нI*є8║ЙЙБC щ#КжG╩╖лМ═ij╤н`dДР}$j╘O┌ha$Ж=FMdМл╙Ja╕ а#c■ЇWэHйеЙ'bаzYlY[P╘·╞├5hThVli∙═ ▓░Ц.╥+c#╘[vvЕS┼√ЖMi▒▓ЧZ╠Л;dnTyю╥4Мз1│дzеюзШ3╛ЙQyё╕█5iс┼░Х\ЩW<щю)╔юР╣Ю0DeF░3┐єKrд!*╝ ∙Ў5Эst·Хз &A/Я>E]fУS@Nc└*q└5/HIЪ1╣э$jFьs╣#ЪbЎBm{БєЭ│Ьщj╬IX[╝nЪJ0!╡`БГ¤╕з!╢:55╠f▀H9 x4-а│ и4П╘%C▓=╟┼iG$F╞5 ╥иЇхw▀;╨·╦C=√IlвR╙ўч4K8╥╞тH╤5DЄыЬМЬцо|ЯкDE~╞Tщ╞Kє*ГжvЇm├`s¤)n╡нxсS`1Б└╟■лз╛Хбhцu├;j<╓%√nў╥эМ■jс0СХ╙D╦oq}8fэлq╛+м╢╣VўQй├к▓йoє\╟MКAu%г xXъ|ММq] Ek┌О12┬dU)ЄэP╕╫м~ЄB╜UЧ$\:и8р.ч№ПщKZ$ЦЎ)Т╕-АOЬTu▐б╙■Ц▐)з/zH<є╡UzДz"ОmС╔█й║Г@┌░хЄ┌С╫#c¤)>┐═█щF1ы╧╣тБwq╣kЩdm%│бFH4.лp▌Z╗FА`МM>]Д┌}v6╔'SО6ЇwqКэн 0─▒╞┘,еЫo┤ч╟э\зH[Sw,╖·P■лz╥Є4R╦╕MЫ>AцПЄ$юЕ┼╒Еы3Й║e╩djxИчмnЙ│■УэлРы)рqК'V╕DHуSл,t|рчz;Y┼j╨╚u ╩ЗЬsQQ╪фХКЇ└║уС╞ЭTч▐╖ ╔hfСуoїд▐╔wЕI╥Nд5Srт ╥>QFЯ№ўгС╪╒!Ёвcм#2 ЭЖ√╨fR╖+Э-ўi{Nе5┤D#eЗєy4uЫъ@mJY╞I>k,KЛ░▌А╤ФНQЩNU│Я№тл╔От╢аGКЇsI%8ЇпМWШ╚╧▄▌╛>1ЪЫн дB(Y╪╠IюoВ╕╟╜Zц{q░rД%q▒Ў4C0Ц(хPюTрЯКЩцП░BфЕaдуzк╓─╥▒kл' с░┌ФйёЭл╤─╔!:╬б▒8в┌═╣@Я╦ГЯК.М╠Ш)У ч▀ёA8дз└@0╦$iдЦ\╘ї+40ЙЄы╖║СS*Х@pЪС┤СD┘а@p=∙бw░бhb┴СВ╛='А├╥Яй& o█@'s[lС╧╢┴I╪W╓ц3╩└К╕/╪иъ╬sйсА9єЪэJ\¤/щУ8цg╨∙о*тUЙ╧▌╢ї╓╪├згY┌чP╗~N э[MДS╗у╖Py ┘:k3к▄H.¤9 М=щ╕Vb╚]$Y1е╨i┴╖РIYЇ>Б▌║¤3<2МЎ╬┤▀Ў?т╣^бТN5╚pз5╥■Х╣ █w +.1уй╓║r%├ьl~(┴ё╜t jzg3o=е┤┴&║X╦p▀═СЭлщ г▐┌чгТ▓ УVW<~+Ы╡¤?╤/c┤щ╫,ВwФ┴ї9╗╚,б┤Бa╖HтП╥6╙эOЭм0_░(a▓7&LМ▐ЬЯф╧Кн▀Kg!YцQрй▄╙. ЭїI№╘п╒+ХХ╫JяС╔Ўо═Ъ)█УK╕фЭї$J╪юЗ#>Э╢Є+╨╬ё!╒6╕╦ф`oЯЪ%─Й*ў╥Us╬Б╖эM-Z[У$ж6Й\ 8c¤*дf:]ЗГWТF┤╫Eп║51<Пj2ч╡кg╘нМВ╗╥h┤Р&ЗQRX░e√qБ^To[БНЩ~)ЙэYc]Xеpx∙кк!Uююe╘ %iУвцE LАу▄T▌╧n╩■жfиД8∙ч'┌╜:╓$]╬Э% ■Ї_╤╣HРг┤ЫЭЫ┌Е<о╙D╢у@Мщ╚s═S░ц6МHsзю╬w┼/н▌@щ└┌к■ФН(хЙfїc,╕■╡hЙF СЮ3ЬЪF▐) ┌¤F7|Юv┌о╔4eeb},y┴е'к еDv,1╣;щ■╡▄w╨@√ьLnWzЁН@ъ@О\9гI,hUcМrF|╘ц╓Г· СNО└"ррkЭйш#Й▄АхФg4╧Ё<SН;иСЖ\}дo'5W{5:║║&ТsЭиQ8╧o%K}єK╧ФVЗPf ░█$P!ЦI█XCи О7═KVД┘оe1╠щВуcё√PRhМ,mЎ&Х╢║щдe╒Съ└▀·╤аtkЖ╟ТДЦQэяJ▌УвmГ(iCГЬPеЬЖ■%tєГ╚5{жh╚!$TlРr RaеЬиb7 ∙Ё(s╟└Ї,┬мК?┼c╩[╢ ╢2╛▀°ixх╒G╪1рэ√UntўpББ╞rN∙о2╡E╨ЁБВz┤оаJЕ&:"╥дcH9твI┘эuЦ╥vQф~hqLУ··H╩у¤ш║-Вr\ ╩кЭЗ√╒IАСt▀*6"мK╞г3c╥NР<Пj ^ъ░2ч╘3╖ЇгOhKgзG▓╝Т5cг АЭ°тРНГH]е▀Vрьn `╣Кc2ч$╟▀NNk9ЦСdxDш╦А└&о╙╢ 2╤Д╣Й╠Ч─Ищ╘гЯЇию/yЭSнМrOяE╡Ж 9SЖ╢;eN╪■Ї12DШqе[|уЪ╔╠е¤=,╞Delй╪)nFїQmо2;o║ЭП┐цОн┌ Гr дmNЭ]═╚>6ж╞UЖЄ╪E;Юя╕╪№U%f╡╡╚СдP6╚■а╒-\тPн╣╬XЬБDЯз!К╕╚9jЇ4Дя║m╡Єе┤r2гaО9T┌└хЪХA█ 8в¤CЄкhe╩Я╞╘tc:аf╦)╚ls∙е)^ЙнВ╗Л╢╠ хq╢wКR═\Ўe Ш1НGЯ╠╧#FДn╚°дюcЦMSzЛи╚▀9в.╨Ъ-*г╠J+╣╧4yU^gS#г7птз│+;╔&W;єяS╕nЭr╟1▀╜Dн;╡с╣╗БОwП+Мc ╢+>di;ъP┘ Ї9нh$eb╤c╘b}ъРHppЫЭ;s═^o8г28{%╔Н┤рgqф╨&ВSn$vbN─oz╘Ы╓аяТ1МsFУFШи╩й╔╬<╒.M[нh┴0╔,ZСFI┴╬┘∙г}+>фР4у°ниэ╨лdаRp3ЮhvКИ\,lBй'>є5/ЧMВНШЧV╖:▀X▌@#KsСV│┤n▐ЩКВ ЮN k\i╘╬c!ЫЯф"ДС╔o)Uл Э5мg&н2\UЙ\ZCl¤█Lк╛4лН╘yнЭj╦ёNяР0v╟5иh8S╛p╜3R╟k*оыЎХ{╘NVЖСЭ╘бЪxdэ┬V0} {U═│╟█p[bЁ+b ╓└c╕╟ЛўДМ0XЬй# >k9r╖╨ёc-*"─%╘чэ╘6"Ф┐╡tFЭK▓0H╬wзгfь┬╞0YОУ╖;╒аФ^;ФN▐p8єJ3}▒5lPOh,{kdБ╙fР1ф╥ЁЕXLШW%╢8┴╡ж▓╖]R└uфю9┴дXvЖдM,√к▄╘РъА─Єw╡ъй├ JlJ╜вQ▒°ёСT╖2HМоF х} j╝РhМг>$rp@ф┼╗ш╥Є╧ 3ш]╤Ф╖8╞ ▐кЄ3>░ЩёэJ<7R└бр Ўг╟ipDТ\3qт╡Не╪▌аRG*OеYБфЯ┼? aгюляА@ 4vБJТ╕9aф╡e█│ГЭ'Aё ШиЫi╨'в°└Vw└'Ны╤<М╠fOєPДи∙Vмj┌П+Ж┴PNТ}№S]li',┴ОO╣їxоFїL]Fxф├sщр╫M;;H┬jу>╒Н╓-оЦE:7Ў;╒B[бгиt╟жW░ф╓╚Kю╗zL`√VoъЙnЦ╓@TАзaчн│ ГвZ┘ ыО╫∙ V┤[~0╧гBЖрС┐═eїx╦ВSЪb0┼J░j┌▄╠├╣р╒з▓oFчщЛЩ>Э#o╝М╙]SлO╝║"┘╞s·Узї>л╒Т°@єД*'Єc═g$?иmT─▌1┬╢4ф╫╘·U┘щ╜G╗█ ]qЬК█▌2Єх ┬фьоО>EЖ20ЬWЪ¤-╙#Ле█\Ig█╣,dnр:┐┐КшчC3Ж2 ╟П№▐Юъ2}Eщxг╩шUL ▒HШфО>р#FpC(5чЄ5Угж7I░└АЛ!╠ЙЎч8┼дС$n╙ДS;М╥].%63├,┼┘d╠d▒эV╓▒:4eФздУт░r▓Щ/$Ipщ+FАюq╞xгмj,Яs/ Ьй╠ЖGЭ@ОN}ш═Э)4' АъO┴╪ Jkвn·╕ТBJН%▒╣иН╦.Х*_<С░цК╖¤6ЗRъWW╨.╞"От9 2є Э l(e(Iu8╘4У0╗H2╣▄gp}єH\1vСв8▀>Э┬КjuBШY]_Ь▐Тi1RВmYF▐╒2╠╥╞r▐Klц+╓▒бЬ+иVaд0k╙┘JШHХFД;{╙╟C[`"╕+( ■ПgЪnц╨┤З°Г|▀ПzK╡█LЕApHєэГFeХc#4`>1BTОLZмfF`▄РI┴ @Щ╒%I\·╙└ўўк└¤╠*у┤пъ╚┴ QоуОF ▒3╖Ь╨ыбЮОrхW▓GдС╕┴▐кОоT N ╚?┌кЙ!fИ8d┴╞mН#dНС4Glшq╡5Xг╡FМиТA еА9┴є°дnzм╗█╠@╬GilьqFNЫ4└:╣*p=│KO╙т╜ie╕ ░*Дl╘с╗╤~фПиэ╕╔9у4╡М╙╩U$VH╦[;p6зТ╙щ╓!Ь╩P) ь▀ЯЪ╗└"ЩА!QЯ jГlмxF*М╚,|єWюGГ┤Fвwa╞*%╤ДIYШFO,=Н┌G6OV- вeТ,% Жx'~i{└La╦╢╠JХ╞3°жLLК>╓8sЯ4 l╪+│Iк2uєB╪тRnYдP&j╘2╢їGОYаОNЁ╩лл═╓╥)9!A▀МQKh5ї+>┼kXнfuХ─Ж'Е╬tб┴sЬрєєB╗GОtХ} f2ая╬╞╡║OЙХ R6╣лДБKъA 3XaтЖ╙&ЭИ█╬яi!┴2╩Цс░h╓·$ЕCa╖9┴═6l√РЩR@└▒8й=дB╔;!R|Та∙Мcр·УжE▄ю ╜l}@д■╘У█╬n$ЙGз>А<╒▐щ╛└2ар░8#iYжМFмnМП═(╙[│9$╣╖ЙЦh╩╧ЯHёDkOлL╠у╣╚СGh╓[HХц&U]E▒Э│Tщ╙Юf(dcS│RЧэоБ+BЁ[═С2S9;рi█И!vУмlFJsтФ╗x╤лy`G╧тЕa21ЖRGl·ПГ┼jш(2@СоХ╣╒ъ├ъ\mL╜мГOcо─j^хЕ▄ГLиКз,фQфЬмnёыMa VjЦР└ЫwХМ-╬бАEJ┼)╚С╒w╞5qэDК;ЬаiДКH' УL\Ї№▒&EЛ,7)4▀A▒VerэВкpH9HцS?r3ч ╙&ЖUav4ъS░и╣W╖╖ .Чp$QУЯтг╔╗D\▌╟█┬wb║ cK╟slўG%▓╟╨G$SЧv╓ю░I&Gp) лY-еI{c(r╕;oU}ЗHБ" hЭJлeХЕy'■дJw▄ТwчzдPkEКF ▄╬°╬=ъbЙ╒ эыУI@╩00M%l^тщ▓К5w5ру∙ЕZ┌х.Мё╥╤╢Я"Йcb╥йСadt|'юўй╖Е─Д╝!0r@ч5[M┤TВ╠\>H'гNV.уВСМjб@жI 2ХBбє╣°5u│СюtI"╙Гъ╞MCт]┤L0-═┤ТFC╝~вЪ▒╖┼СфЬ(RЛ╢Я┌Ш▓щ7╠╖ uВ╣|чb6и<Б_╢SНJpE^ТдUXл├№`2ч5б╙ц1шЇzIїЬqэC╣┤Я\rDF╜*Ь~*Э6)Z9МшNД╟▐│Фu╪Фv=pк┼eД.eRW╦ж и`хI;Т*b.ujmЁW┴{╕╠Рл─t─ ┘Ч50ГZNА5└·x╡sБ╟╜ Kл'У╛iЛr"ЬkX▌HС▒u[W ЗhфT√╒c%б$)╙цК┘2╠K 0═KHAЇ╚еЖNH8кK╙{l'KЕ*╚+У Ы╒аoс╡мО█пбКь7зЖБыг?з╗шХсT.=щ└╔+(2щ╥ ўбV╤Мг ╧¤8жж╖┘╓(ГР|y8дУD┼WgвК8чмдЖ├╕Ym┌E=┤┴╞ ╬qєH\├."ХKD1ън;Yм╠tйR Gятк1{l▒D═│1]1Р6№R│дЭ╒lрh╞ЬcaM_├ ╣'╥1╣c░?ўе&ЪGb╩еЬ(xй╪нЧ╖Щ%ХЮ─F6█Т LфE,ЪЖУиГ╬№U:|є V?зэлr╛╒N╣~ёtkЙ=r[!╪g№xн|eю.ГС0lщуjЫiсЇ6Я╖lЄ3╜|┐WuXя^d╕|╔\ь>+ьб:▄}oе╜шС#*@5i╔■+тIУ╟╔╩С^░nЮю▄ЕfН▀CЖ╙ЭMы╜&Т▓18з:\3▐═ErDе█рR}}бщъ▒:┘Ўr6┌к+сгtfнЮWQL 7el▒╚кг П>+╦╘-б╨Ж@╠№4¤дbI дс|b╡МLх#/к╕I-уQ╗6ї│ cNO▐▒║жЧыа┴dVу1TE Э[ЯК╒F╠ЬД$╖rg5D┤?[(╢I╥П-х╜л╢зP_nxбX▌¤D▓h╙дc фV\КСpl█╡║ЕнЦ<╝l╗П~<╥Р╢йЩdr╦А█ЁjСГНLхIмn8б1eB┴I╔у┌╕e│e╤[│Dнn*├у<эUъK/"kGVф╚═GL┐Хc1мД2}дба^╔ЛзТ Д?л@сpERКл&К╝▒╞ оаЗА<ф╤мрVХЬ..Ц╧═ +│HСЎ╦+ В·╤ю/"ЦhтTH@╞*▌Ощ/n5RС▒эиU#╔C.Х╬94I▌#хUЮ1БяB╕d0й@█√╤НlЫ РC Qn|═кШ┴Uf▄s▒еbЖy  ы!WП|цаNё▄┼ъР╚▐пi8фьvi2фЇЁF▀oяR╬r┴N╢Mє╞~(eцW└╥┴ОС╛0┼CIв5uj9lЮ}є■Ї*░ьYг╥]─g GW┼ё]QуИ 3дЁ+@╚qУША 7¤ш▓iХ╫Fуhot4-n *МЁ)еД2(фO■xа├:;НJр▓Т~v■╘x┤IКч╚єI?иZ`lу )I}ФnwйЪы╢╬│cЁ|Ъs ║X╬мГ┼5y%b3▒╞|ч┌Збщ0р└bМ5v{г ╖з|ЬmI╔─ub┌▄ UNHS╢ ╥Йy1╬уЖ╜ч╜ ┬D╕>я9╠ N═Ж\.0jг▒ г$╤М+ЮFhєDЯN▓Ж┘F▐Х▓╕uЙгФН╝ЯyкЛр╨OZБz№ з╨ЮЮ╞эхюЭQМь9в3┬Hю#Tl|█┼%/┐Ё█РEXї@ ╠F∙<╤@йХUc=╝ВX·H■Хх d╔NЄ╒уНПo╝ п╕б╩nЙd-╔>?ўD╛Й:╤kr╞uэЗНY▓┌╝фPцGTСРjB~╙ёэQhТ┤╥9`m╛p)Эb8Dzv$1>6йHa ╘-$ Р└8▀;╒{o2ЕФ"ЬГёUVФHKЙ├Ў╖тМЦьH╟N╪э┐╜5аь═Ф═№,с┴╔+Мc╞hё[╢ЯVFМЯ8и╝fi КZ<уw■┤▌Сwц# ░∙кпеж╝·ТмЙГO;oєD6.`РХ▀i@vє╕зЙgД8R eXэU╜1вw╘·G4'lTf╖KRа═m▓H▀&З╘,D┐┬ЕЕ┴Ї°4уuБ;Ep╕▄∙ўвЙЮYХi}╕┼KU╙(═УжФШ"╛Ф╚,?ъвdьЩ5╟╦▀▐Щu═)╦ч5hfDЫ╘Н$l2O╡M║ ·DЙ$rшОh╬бХ>рНкn&2agAзX'm╝╒п bОuPJ №P&EТ╥й|°кN╢Ёщ╣ФЕК% Ь╟╥└V5╘W6p┤ёfuЗs▀#уё[6зMгмZ╢Ёy═g▀O1╨Е╔Їe▒Ь°зwгЮK╫╪{VЖЄ┌9Ll %°╬ЇkРd┤ @р╓ s╦k5─o Д`z|╟тйg╓▐с╤фSn╪╬ i▀№╙Iнz╢6╤╬%Е└└Wїфo═k\█н║БыF8└╪К├╫<─═Щ; m шЮ)Иoо%tОaВr╕фPтt6ь╤╛и▄╢s^╕ЙeМ9`д ╚8┌ШX!hDк┌є╢j╕cfш╚╬╦М=ъ-/щ"Kу-рDka%╞}$xc¤ъЎў_├4иу·PЪFy─й `7 О>(}Ю┴Oм]' V)`SЫЩC;dg?Ъv@.Ь8 е╢╫Ь~╘╕┤Д╚┼╗r Ьу|Х╨7▓b╣FR8`A-БК4Ц╬Є<▒╚╥дДgiв╟m4$H СВOЪv#E 5SQё└┬Ъаv╧5дГ#;HЩ√Tю┐УQo< ▀N"rЮь6во╙▌┴╧'o═-$hУС┘F╔dэтЮ№ Её-▓.Яв■╘JВEП|d!lfЛ┌RAir╧МцвсуbX ·wьNДDШПG,9╧═Yt9XXYС╒ym'╘7╧╡=f╤оЮы;0╞е+╢їР j·t╕,╩4ЗSэLMx╓╚─╕WЄ▐┤жЇG]▒╦ :Iе╢╒IтtWЗ╕мЗCоЬ~їЭ'RdЭ╥5mX╟Кrк╖0F╤Dг║t╢═fа╤Y}{N╞┴╪Е┴dQрЬ╠Б{j)▀h│IЖ1║·qщ╙╣к█h╓п!Ф`л{√╥]ЕХgФaSй╞8╒°вG$К;gKzwRqяFТuИD█7tn╕теDo>┤nс 6°═Uе╪-К%╘╜╪т8■ 5wi^`З`x°е╗╙Cr5Аq░Vк*╚охЧP╟ГN1}2мШo2пи&0зЬP&WТV$╨▐З╚Дў6эL▄╔п%_╥Tj╘ЪHf\МлбГ(D_цж,o]oЧ 7Cуe5I &д┴╩М√ЪqTы╥кгЦ ь)l││ф▒Е;АO┐Ъ╝Т░▓╚СР СОj╞d╨шCФти╨оЬJ=Z│╕р╤МA▒hцИ╖*5.ъ|0°нiб╒┌РрХ▀+╢№PЦ╒UёСХ >▀БU*яruДcu?┌л═ ╒fК@оQт'яp╘д╢q╔┴п*X║╥iц┤Хfg+Хw╘1рК╕╔Э╗╪lN▐КIР╤Яo┌ЎцЙ░у ч┼.zmМ▌└!W╔├#═=5Л]Э(Y^2}'mй╦x;0@кT┴7Я▐ЖcыU[xI╬ыь·╨&▓┤M8/"╣bA╞ц┤/-╗+sC╣_jнё7╖╒е╘╟БRўвКРа1С█ nv4▌мЪAu#^Р┼*DСЬ :9╞▐=л╨<н3Dш-ъn)рSe─╝s7дРH╬тЙТ'~┴\j▀ёM╟аKкD8єS,1▓J╨Р└5JJ║%lFS*╔рЦlиm▒К╧Ц цФJ▒┴Б)уЮku` ъ\БЬУS;2i┴╪В[═ ╩╤Э╙ноe╖dЫ[ РХb7"Ыkp─8FMЇю9╜&_K<Є`й└Ї9$Э`D╩Б∙═ 4┬ш(h▄zдI╚$`БRЄD% Рp┌Ф НBмЛЬD─d ?ЪPю┌$l╨ЗРю07"Ьв┴1гZВr}шЯL&СW Єн░4МG╕#О╡╒аН╟тв▐°tыё=╞ы╘╣ЄpqЪI>╟cW0Щ▐H┬ @р∙┴б╞¤ЛПт:Ш▄щ▄qЁjWкw vlЗїF╟8тебО`═ауN@Ё>i+╗uhўHЇ)ў5yг3FЫй█r╡ $Эb╤pH╩ЮvжрЫU╕╫лaГ╖>╞Н▒шNx╗eьFGцЛ $JП╡▐нНZ■>тFъ╪Qщ8▐ТF@FрррJнPН"Ё─юг Ь"П$╔%ИС\ш╬─ьAмЧЧV=$╔цЛ$цUeЙDnд~<╒д$├╜╦J4╝,┼p╟тАsСжаQOЇ╬їNС▄┤sSЯы╡Wл#F╠╦Э¤%FЇФ]ЇSaT╩;мPФl╛╪єJ]%╫╙-╜Э╕╫#fLэ╡y.Чщ▌╬┼pм?<По $┐~╜╖▄╤9F╥&У{1║\A·Буcд╩мЬ№mUъл┌╗╖aфЮ)ЮгjUzЙСБЎЁhй╜r╒в┤╢*╢;╒╬ЮБ<▀h╨BУєY_гью╠\╩Чm+П№є[Ў╦╘M$Х╒"?kIc·Я╪╢NъДQяєG/Z"У╪КY`С@F2) k#кFй]╚▐2N=л^└J╙.FT(╬№╓wъp:grg>╣ЬБ єЭшр╥vЭк9╣╛ЮTBИЖ┌O┐╕олжZvmСвeU:O> s]Уи╜╝╣╫Яf╤└oС╚Н[C}кG8єS╩ЩP5mбv╖WYH:Жч}▒╣е╒ ;\]СО╬їKg╝ОИTВKКО№ўЭЮ0иqX(8╜ЪZc#$фЗ╚ї ю*kvs 2╚$є@╣Н╗ЗюG╔у№╨!Й╗мDeЇьNqМ|Uуdв╙t╢╣ЩзН√Тmд{b┤Rх√ЦДЕ█9▀PУ╔▄h▄wи╖╣iX6pУдmщb'%└Т}╕*Сз;Ъ┐O7-╡└]c~s▒┌Э║БuР╞▒╛TМ╤С┤юмpqу╟ўжв VЄщ║ТgP[VЦ└Ў┼фH▓ыYфОFq Шк+=└fwёЄiйC┌D$T╘▀r╙KB{tB─]T"щ№╫н.@Vxo8Ё)UЪA'пsВфg√№Q╦┼oбOи єцгшwkc░3 ЫлП═Dў'J└WSщ¤йLВpкрh;bЧЦNр-к6╙╬[4▄$╨┤8цGЇШ┘]$°;TыU.F▓╠rF·z^yх·ЦНK╒Я √╫ЮY.@PA`ч'>iери%╡┤IqР├CЁTч#5w│#2Ь┤{сTя¤( 1в╞ы▀ `о7ж%IdЕZgэ▓¤з8з80▒fNТЭ╕╩Тдэ╟■шP\!m,╟╥p@з.├╩ц YKЕ-эIEЇ╤░Wb>Aв╤┬Є$п SA╘?єj1┬╟X$J┐g╖М╥m5bw`,/ ЁЦp┴Б┴q°г╬╖-tо║T)╪c╬ щDО$Ў┴ )!Й╚>╒ч╗─$Fд╗ ЙЄGК╧їoCAо┘ JЭ_╨4(╗ЦЄ╕r@╘WmЄ(╓У ┌К |\)s▐м1╟═░{,П:▒W8уo═h-к[┌Ц23Ц█цФIЇN╤╢qу┴в;J▒0$╬F■(RЇ╥КKAS#╬in┌ЛЦ└`0Г^wЛ║┬СМg╪╘Jа√Жру╬╒ФдЮ╟eЪ-щ(╞бЬЯКз╥Mqid+&у#╚Ў?5[&Aг│1UЪiФlLbЭ¤&╠█фВчB4╢[5ж╖ UЙШНЗ╨▐Ї н10▄рsC╠─,Сшэъ┴n>jХ$%░ё╔4}еШАмy╔г╠╣Щ╘ф ;I%┬F╙(m8╨<╘]═"╩мзf IIUХTЛ9ЦpIXэBЧъS1П╒▒P?╕блУjy╪фчУG.Чы╣┬ю1FHд,тu╣чО╟W№pH╙:NB┤а┼ ФBВ·╟╡6,К╟QТ?J■*╘╙'`┌(ХєТ█НиRз%┬ю8Z<°юФ╥sQ5░hЙIm Э∙йr▌З√wА~йHсVH$6EXГJWгЯЪ И─е░x═7*м3вВ}-╞▒жEм"▄│2╢└╥╖*▓c:О6┼6ФKдУз8'еЫ$l├$`DJ╚▒:╖5ЯtёЙ[bаЁ╛╒rл!@╬▒Эx$∙в┼з║A╤.[#}╜НVMНRC DmйA№╫Щ{qэ░ ah╖║R_,qСутФРHu+ \ЬЭъСZzє4eZ╫Н▒хhТх*єz╝Н°б┘э═Я√Qd╦Ьэ╖МUй6FСGКФK■"ёЯ{ы{{ЫQ▌К2фzБ╥б╨JYЫOиWд╣9Ru№°═,пC▒W╡Вfьh┤ро6¤йШ#E╡Q▌lб#'═R'И│JX БМ°лhД:▓╢еb3цУФЗпBДР·Б пNэ9НгGЪдkИ1М~╜╒7iг╬ЬюM▒╥.▓+╞`e 9ЇС╢е┌╤cМк) █Ц?▐ЙrьЕUQI-ГЯ`╠-Ёч}Xv█■ї*M╥Й№=ЄwVY■+╓Ч!┬─╜╔v#`╛Їе▌ФМi╞╞ЗЮнЧ$&█mЪw"1╣u╗·Aчq╚ллдє(yFТ0E-╬ ┬ptС╢█P,╒г┐-аh;цл)+ж]гEЬ║8╚8╥x4Aa ╖a▄Е┴┴┴цй╒╥LЙ@ ∙█▐жXд[Цp╣j9єNх[&╨┐X╖As5▓j/╕85Я╓"о#F ГрWG╒l╡┬ЭSэiвэТ<що6k╞h"I▌\ й 2v∙жЭвЧf╫щ∙ю╚┬ф)_P└єZp╣Y0д Сё\яA╗HеVМp ╥|П═l╩·н┌т╪64сЧ■Ъ╓psZ2║fзOАOwФыPtЯЪх┐∙& ╗╓^ VЛЭ >+в¤7tOv═ж;xLШ╞∙;я_0ыЧ2M╘&yж.Ns═q╒ ╜ЭOшше╛ю╧(Aдc*' U╜▌Т qЗ:ugКчG╞Ёtх╪бv╒╬─qК▀╗R╤пmЬ╚МT;oяяX╧rвв7<КUОC ё@uОiF ╞УЭ┐z kеc Юk╫0Mqn9└8╚╓3и╘╒Х┤╩ШadОHхf$р+?▐мmтbe ├;РN8ес┤╕IЯ╖ГЖSщЎ4▌н┤╦#┼(*yЭНН.─Ю└Y│<лУВзН╡~hЁ─eЦWwT?Вj Уо╣√г8№╒тX┘3Ч z┬П5 ╪юЬ┬╕|г╜ ╨╪╗Ирw1иlЬуH█¤иўr╟/╙╝ ┌!8;gЙ\+kKвТ)\ыНєZPв\Z$F├ЖfоХЭХ║ТфeЮ4СH%}C¤шО╩╦·}▒у∙jЦ╦4qШы\¤╪єCХеяжpЙ]╕╥└╛╤hLlбе]с▒К ▄[▄╦Хbm^*ы(# Е8$y╟■шbEЦсUЩC┌Ы╛У%л#,n 6Ж8#Р=иЦ╤╞KHиЩ3╬2qI╚"е H gcН;j>%kgmZr▄■╒.╩HfYR▐]},&╝ (`>░}JIут│ЭBдєуцХ╖╕xоQYВиROч■╘ъ√b╨ї╟vIb╒иyг┼╚,WJёН╖42B▌╟╘з ╢OцйI│`МН╬yк╞?I_)SЧЇ╢H╟ўж-█▓╢O▒м■ёёХbк╛E0╥╞ё╞ГБ■ij.╨┐БbФE0f`╤∙U?p4┼фP+ ъF]├j╦H╗СдеЎ┴╙Ц╞)йTьNCВЗ$gРi╖и╪7╞ъ:>q∙ ╠T╦┌]ZЖ@√│тПy"ШU┬щ9█р╥:бyDrY▒№┘┴?ыSh #еН яЮ2(А.СЕRащу|yаG0ю8Р/#s═34Аб1╛wqЯ?4t┤7ЇйХZ4└Н╣ёCщУ)Р,СЬ Н╞j#I▐\оБМА╟Кв╞!╝"2т6▄ ь7в/z:4dР eBщЪїД╤¤C$▒Й╚ G+СHE{│3HCdо=кlf0_╩║B#@╟▌¤i╞u┘4┘жщ ╗(RМп╜^wd'V у╬)K] 2 о▓╕;цЛ▌kЙ,Jї0█╘Ф╦ТIHЇ╣чOЪfї╥EМ О0└Pn#h`' fMЎ▀+щЩ4АIў<К┼Eк@zНбЫХ`├5&fО&3Э╬▐╘Kpmj4░═DnUK╒Ж╞╒ж╪.╩╝ЄФ"╒JЭ░=▒D.ТL▓*hЬГцж!.ьэВGЪ 2кLсH Г#;яI║EF*╧\Lщ6Ж\А╪ hЧУЩoHLd6н┐╥мъТFV░w╬8л╠▒йS ┼╟>E(?яBВWР▓i┴$М|Q║Н!F√mэD2(ТM9█jЧ.ЕJ╢Ю8д█]I╢ЪE╛ Pv#╬)ЭO ▐H8lГёB8ITёL0ю@|║∙кnШhX╩D▐╢%█mи╦qйQ├2░╧уЪ ║ц3#.]N∙п М╚' o┼%}ВH4│▒SТNqБяBFX├3РT /╜р╔аi!FчцЦЦO╣UP╚╟Ь мШ(¤~╠3 v№WН╔ХNе з`HцУRЄШ┘█`4Э[fл,Г(Э└Tp1O6ЗКЇ}▐>╤ЪTljдSоK╧▒ ё2р2 ё┼ РмЕZ-┤к╖aIKФVh╠Ъу╞#?ЪЩдю3*hG'УэКмйСC&╖└ўкMЕХ▐l>┌Ь▀гК-gnбФЮтСМ∙┴пL$╥}n5r3цлk4qдОь4╠ж;пJEз ┌кc7б(ж- ae=╞╚u╞тЙ ЩРIАNrр▒╕Eyv╬8тЪ┤Б╬выС╞~(|Ф╞вU#МH#МП▀ц╝;Б*ыЭ╝∙к░HHeFf<фёєQ$╞RО╤щ╨╘жж<НhlRэюQ╛ь c┼4х┘вЩПWэL╛аз0ыIR<■j░│H?Н@<ОkL█@иЛгкч╡$аgQT!╠╩о= y(w, д9¤└к│▓Dt·sЎЮqS)0▓ўЪЪP[Rо69к+v╞н`ЭП&Х╜╕Ы╙УЬМl9в@бb@IбЪМЪЇIYt┘U╠ЗJGиМ JЙ═─╩Э╣┤&Ьэ╞}иНи┴J╢4ЭC═S╝╦б°;Пj╫&╨ЪIП#│?ё▄¤╝Qn.г▀ЇЯ8еCБIl КBЎцт2f*TITЪRo╨]ЭЧMЙя┐L▄йcк▄Гз█9┴ └:ДР]┤Ц┼b$Ў╪ЄW[·мGi╙zЬ(тXФF▐ ┐▄W?·гк▀╟=╜дWZ╤c,X79 jштJKlЩ6╝9╛ЬfL!▓ъ╔ў█z╘шhYЩт╕РЎ─y╔Ё DхgИг╓Nпqл╬╪▐J╖╥C",кмW$p=лN)8╦drе$w╖╫6╓}цьЛ╨бЭ░ач√С¤+МЦ Iю!`═Й$√5н╒ nб·tВГАБЬ`yдz=Лv▒иd╙╗nG┼i4╙BуХЭ<Л┌┬cT@Ъr▐ьг║щQ8▄oY2M4WЪ┌═ш`6"ЙvcI5┼!\СГ^tб%vmСб,ЁХЛa√╤║x ╥TД█YП$xЙРХF_Pг[▀Jё╣N▐Шєщў┌Фb╙■Ъ3[пЁЬ 2оF┘═]юZ@B║Чl√К╠{─УL╠├ С░йgxВcCк=▓wЎкQ╪╟в╛2е─SйEQй1чMR X░╙1l|╘їHIQC+NЇ║V&h╩╞@╥w╔╧√T4╥% ЧA╙Cо┤$сЖhТ╗шЕ ╘├+▒тоИtыm9╩ъ Z├л┼╔╩╖▄╛* иwрн▄Ъ╚╬гГъ№▐ПП`°╘ jч┌л03iХF░фcHр╘▌[E╥ъmMВМ├╬¤щжN├┴w4Цс╪щcАTё╡▄е─:Ёч┴█9мv║НСс*╤▒sяєRЖyэ]2┴ЇЁ╝6=и▀г4Vзb4ТuєЁi{╚╘H╚В╪+яV[Щ>ЗT╩Bфю(ЄM ╨иq▓ы#$ ;┌жL)22┤1▒@HР■G"л4╖lСмеu╠2>яj^укOo ■)SЬНёЯ|╤б╝{ш┘e*└nкy?У┘*L<*╧jDлбБр~<╨ю#К╟s╓─Г■( ╥.зНєГъф`НйwFЬ+╞е╬K╢1F(jR нQБС┐ДыъlЁhЦч\КЭ▄lєРGКf9]┌M┘b:у╧зтЕlЧ ├WcNХ#┴вqнЕЖЭДWїУ╕ўкt╬ж▓ї.╚DЗ╘ ▀#ГGM2iИGСВC| ч∙иЖ┘fЭШ─#Щ Пц`╘ф▐М▄_`zЗSдХPJ¤═рS╧z─h╚ББ<|╓^щ╫7WvР$L·е]^╞ЭLС+l╠AЎ Ti Вhx\vчUУIНЖwтЙ:DTх┴╞щ├т│&Fю,М║╘и╘ █Кn┌hц▒O┤1(#кQ)┐tМv╙LлнIRt√q■iА^9 >Р6╟Ьo¤iGЧЪpv╒╛■╞Э╢0╡├LщЩЗ▄╣└olRueEвТL!Ф┤ГЦ`9┼V╥т9\┼!VleчК-├G<╗!)├)9б[[┼└\Ф#:O∙5╜Х╪ 9YИ#N█чцХ║f╣Х^▒$┴╞╘·gYG>РpIЄ=щc█ОьпkSД┬ьp<N1▓dЗmВJU√lаdg4.М7 ░ hvoza$В"л$бuГд{cЪаH"LУ/ЬxnЙ╗q:╝*HW┴┌У╨[KD─в67к▀╚ж┼М`ЖV"нm4НoPH╘фxЎк╟ nГЇЖ2лЙJ+{Юh┴ @ 4Ф╞Є*CИ┘√Жйm0ЦfFRмДоЯЪЖТcMД║v▐HЩ\В▐╜Cщщ╚╚ц▒nюШ\v╨АrAdSqъ Уи╩В^EЛк[6$b"1CЕ╙║ЯUЪT╠rIn┼(▓DЫЇi ╕,╤и;oК_їэ█СR9─к█8╚№UвdB╚#ф`∙моб Й-╫Йє┴═V▐YZb╚BзЪ;Р*╚dСA9╬AёКЙeСX╕`┴ФН╝Rёc:8u■Ї╠J^р}█Нщ%oc╜Уыw;(╧═CИ╟&яУ╕ЎбЙ+j_P√▒FЪHе\,АdМэ┼&йд8Ї ёЭg+Ўя▒е#VНЙcл>}єO3Ч√Х ЙЎ┼Qвn┴.4Э░*╓иБ╪LЪ░ъNv>h╖1($▒ j№{╥▓тХQp0N╪▐ЭРЙЦBй▒xйфTЗТ░┌ё И╚ц╝A"╕╦щc)Э╦─В-8m█тЪОsтлу╓p╣Є)№V;m#иf]DцХdQr№яцШП╙xБr7<КЫШ╙╢YX6,3┼B╙б▄vТ4┬Ц╔╔▐ЭDFT1Теx,9е`uТ8╓HЗ█М√WЮFВs█РФQ┴ёU{бэIЇz!*Hm^вw▀4[ЖЩ\йn╓99фVdЄмТД и╞x▐Щ╣ЫZ.гл;┼L√ы░p╧и╚╠[H╧яGЩQшq╖цЧЮ╘ВI╓ █┼LSИ╤!@iФ█ZE)!Х▄╖nm╤qе╕═V┌fР╠М4╖Б■┤Ш╒Ж┬p №╙(╦ж6]CжЫjЕд╔kаМвXT╢9kЭd&R2I_4╝г║н$Ы2Э?ўм√╫Т9bН+┌╔┴єЪj╙жKzrgЙЩ#(ъ8в@╔"0lхW═╬dh╡┤б\э╧4HcNрQ ЬoцЯhY$Rkx▄Ў╘и╞=^jПd╨╔,08╟;╙Ч6рFeOvу├░рУтЪN;▒╩Z10╟Х+╕;С╜^т$Ъ-9W╘п№█r)Ы╬├@$;:ТФLpT1\Мо6┼K╗ ▓╓╨ЎR61·JСяКOк█ JўA%C{{VХ╢VT.р.ЬzNhЧi▒Зl)S▒ёGЖдb█Ї∙-явС▄ТТoдm°оcмtобSG╣╕╘д`П▐╛ВЙ$PFДЙ[Vu{Ъ1JСХ╥ ЬмeИЯьrV6╖С╔▄yu(°▀ЬЪxY░1╘╤ы$/АGГ[│GjёФэяз∙XoєE6░Z─X╛}┐╒~f┼°╒ЩgьЭq!┤▓СЭОh2┌С╡·E*О}НiK$r$ОAЛБОq@ЪсЗh6KврЮucК═Є╖"ФU3╟Й ╗▒╙ПG┴аZBЁ┐c└╧?5бo<ВI b4яБ╛кЇq\\4bSеуў_┼\YЪЛ3zsО╙w┘│┘@з уicEEo'РE9▓─╟║СCЯjащ╓ЄЩУ╫╞╘'l║╙╦<│+8ЇБэ═^ъц жAЩc8tч╞(ЙG0фRЭ▒Qtк&IGдЬъ└┌Ж╨$d3█Йэ Жч jZxе▒|о╜╕╟СOi╠9МХV╚;[5хИСaЗ╚єY╔ш┘Щaеeb$└И#qвa┌┘Р]Iu>*й вюD`<щ?╠Цrмм╟~0тй: BТ╪Е┼╢Yз*ГRgsF▓XнШ4aЧ,0HКn▌ ╤bB[b╚к┤K2йъ>╘Ц║)%E▐ 3╖u┤>AP3К├ QТ╚╦!Р)┼Й"НЩ$ПH;ri&P╬dНИ#∙┼11.╜hмщ$kш╬1ЁED)jКм╦!┴'╞~+NM/jЩLЖa°дzнРKdЦ"═Мg▐Й1UД┤e3ЧxЙW┘┤ь╧цЩ+│┴ЎЎ%sч═f╪..J┤║▒╞нлRXЮ;аэ║Н╘чf4Ю╨ТIК@═kv╦pЩy<`К╝Nw+c└╞ph7Nє╠═НkСВ9;oLAl╤@Q╘0╪у╟Ь╘ЎР├└ЖaВaеj╢QzVc│Ф!▓99пXШф╠*чПЭшЎ∙ CХ Q%бI$%w¤╤║Ў№P[╣$Ь ╢0?зqыОCдыa╖э@`╢БаяЬЁk╝г5$gIpБгИо]█ёV"5HЄ└оо1┐К=ч╙╔n]ф#╖С└╢ ╡"gНm!G 9#s[GлF║гFk>чо& п'~GтХеt║9╬Y▄U║u╚d╨CaI!═^яCёIмc}╢№P╨ТE╠Ъв2Х!╞руsК┤Q╜┬ЙCiUF#█q╛zy1jХО|ПБM─Dvж0Kч■Ї'Їка-▌1Cк┐:Я▄cК^щnb┤ОxA,Щ ёя z╗жWУHdя¤йЫy╕C$dc#°¤DэЩ?зоn:Е┤жъ4V╘tm╚4х╗ЮфЛЯ∙G Яo4 'эї^<`d7▒б▌Л┤g1i#Г[┘│(жвР▄▒ЯLM┴ї°кEкIД▒F"И╛0<╤dЩOl╠з!Fж▐╘мУ├иу╦"╕▄x4(ш┤V╤;Wf-z╧!┐щ4┴Жe <мЖ^цXГ╣ц│o^kkв╩фVЗOЩ▌9╬с│╜)╞Рти█єLc▄ПG╡zS"┌3Fд▄цЫ╣НдНг╒╚д.╪╟/iОЦСэYй4]КЎYbFT╪z_#qE2Fўбвf┘sцй╙e╧╘├█8Pp<ЬRЎ│ЭL╚@U╚нmС{∙eю█МХ╙ЬГ╞ЇkR╤╠M█ДНyў┴тЕ$жЄ╘БХX╪й"Ф=:yбb'f/ ╞■1TТ┘нq=У╚{jHРa зz\║-ИЩ┐хь║kХ╝╡╣ Е"рм╨7и└нюЪПtЫ╥З ЎйхНm2▓╨Yfiew╥F─√╨СZ8ч╓x├.їNж%·5T \<╨рЩфR║}]╜Є<т╣е`╪ь▓╩░!М└╔Qя^Fх└7)W└FтЧБLQ╞J░b╣?┌ЬH╪─btl╘МN╪>+hнR&╛У$бIj╚╞<УLZй(╥╝d МГBx ЦtЇЭ[┼;√uК.ТТ6╘п┘Ф▌*Nю└1:v▀═Xк4щ$И┼╫┴рP"ЪWЩ╨▒└oYея┼/mtРqПzoсIRм|Т1ЬmёK╩дKнКФ(C Jy▌KйTМ~*ў+ж▐n┘╦+sR╥hJ╙ЯWqbЛ9З5}e░$XВG49Мх┴╔╪╤$*ЗDЮвачГPкCьX╚э20m,=%j╥"║{ИsМ╒oХМ╤\а┘ШgwН╥сЛc ╝БтнУщf╕─Бd╔▄(°┌Ц╗ApfЕ╡6Э╛(ўM╕╓W)л П┼9ХKв¤╝o═MдЎ%'crўД"ЁЙS cmЕ ╩ф▄┌DдЮяАG8ж;и!М║дg#═-)О╤=╢ ∙кГ┘O{ шf╨BЦq╛x═!╘!УъKТ╜░3¤▒OЛ╔▄U.(6лДЛЎоp}ъд╖hБxуПщЁ╩ АdvтЪш▓G&└Nр╥==uZ┤▓Н"BфяСэMI№( ┌tо0р>)/Е{и╨▒жуэYw╔$ZJ дoE▒┐ОiSvБяОhўє7sBое╘=${╒╡HЇ^┌{;НўжS>Хt]╨С╔°еют{Kж╢yRX└$MЄ 1qqГ ]#ЯКШ╨ндЧ лщ9у#№TпВ╢e▐═%║E<Y╖╧Кb╓ш╠КУа╢JО*,вЦц┌XюT▓ Ю2*╓╓╨#Г)▌N∙щ"Rc"FIЄаАWР┴▄чгhV&П╢AJ№╙&GVPоsW5yЧ╤З]hШ°и┤UdР╛млeu =╜╔3&_с7МP▌▒В,2еI╟эQ ╠-х╨╪' е─sфQМ#хjmЮ8ц╨фс╛8йХ-│ ж_лПRЎ╔V\{╤#ЪтэХa┘░Ws═Hы▌,@ ╢Сэя@╤%╝ТJ_H+жЕ╜╒29-└H├╬@р∙жgyV╡ЇСыzS╝╔t╧b фёЪ#═шVA╕╪ф∙жУhд├├oоv8UуёK▐9tI°jуcьoЎн=пf1еЦWl=й{ФК5tBN79н4*НхKoжРхЖosFЮфH┬╒P Ц?цн9ь┼зу;ПzV┘ay╡ЯNеq┴Ън╢WD└╦e\ЮVТыl$И<~k6hB9x¤X#Fh╧7ёC╩°un▒й╚)0▓█,ирЖRгpз¤шё$ё█*░aТ$ПjsйVV├╪fФЪї╨н╢U]ў8?╔U╝t┬╥6нрXюJ фniyгhвv*23дЄ Sж╚╤╞мOРOГS9y$У2СБЬclTJoг>┘2G:┬>┬╛iHт2@¤З╩б$g┼ZH^YU╓@┌zШ;С<АAm$пГцЧhЖМ┘,.д│ЪE╕g*С∙┌ЛmovТлдD╞и5Еу;яN╩с#$ь)oл(║с|Ж█9цнuF▒z-o 8Tp#BI y# lщ лМep├Ъ$=T─H╢pr8█К╖╓└ё;Мl=mVБа6А:BЄ#АЪn▌Пe╜Cзцпц!БqБ┐ЯzT╝qj╔└Э>k=б╨6ML▌▄7nj┴bО?рЯZХ╒╬wл╠╢▓# ┴'ёK┬u╚U╫╙╬A■Фв a.╧ ┘enthought-chaco2-4.8.1.orig/examples/kiva/agg/polygon_hit_test.py0000644000175000017500000000316313233644505024157 0ustar varunvarunfrom __future__ import print_function import numpy from kiva.api import points_in_polygon poly = numpy.array((( 0.0, 0.0), (10.0, 0.0), (10.0, 10.0), ( 0.0, 10.0))) print(point_in_polygon(-1,-1,poly)) print(point_in_polygon(0.0,0.0,poly)) print(point_in_polygon(5,5,poly)) print(point_in_polygon(10,10,poly)) print(point_in_polygon(15,15,poly)) pts = numpy.array(((-1.0, -1.0), ( 0.1, 0.0), ( 0.0, 0.1), ( 0.0, 0.0), ( 5.0, 5.0), ( 10.0, 10.0), ( 15.0, 15.0))) results = points_in_polygon(pts, poly) print(results) pts = numpy.random.random_sample((20000, 2))*12.5-2.5 import time t1 = time.clock() results = points_in_polygon(pts, poly) t2 = time.clock() print('points_in_polygon() for %d pts in %d point polygon (sec): %f' % \ (len(pts), len(poly), t2-t1)) print(pts[:5]) print(results[:5]) poly = numpy.array((( 0.0, 0.0), ( 2.0, 0.0), ( 5.0, 0.0), ( 7.5, 0.0), (10.0, 0.0), (10.0, 2.5), (10.0, 5.0), (10.0, 7.5), (10.0, 10.0), ( 7.5, 10.0), ( 5.0, 10.0), ( 2.5, 10.0), ( 0.0, 10.0))) t1 = time.clock() results = points_in_polygon(pts, poly) t2 = time.clock() print('points_in_polygon() for %d pts in %d point polygon (sec): %f' % \ (len(pts), len(poly), t2-t1)) print(pts[:5]) print(results[:5]) enthought-chaco2-4.8.1.orig/examples/kiva/agg/text_ex.py0000644000175000017500000000326313233644505022246 0ustar varunvarunfrom __future__ import print_function import time from kiva.fonttools import Font from kiva.constants import MODERN from kiva.agg import AffineMatrix, GraphicsContextArray gc = GraphicsContextArray((200,200)) font = Font(family=MODERN) #print font.size font.size=8 gc.set_font(font) t1 = time.clock() # consecutive printing of text. with gc: gc.set_antialias(False) gc.set_fill_color((0,1,0)) gc.translate_ctm(50,50) gc.rotate_ctm(3.1416/4) gc.show_text("hello") gc.translate_ctm(-50,-50) gc.set_text_matrix(AffineMatrix()) gc.set_fill_color((0,1,1)) gc.show_text("hello") t2 = time.clock() print('aliased:', t2 - t1) gc.save("text_aliased.bmp") gc = GraphicsContextArray((200,200)) font = Font(family=MODERN) #print font.size font.size=8 gc.set_font(font) t1 = time.clock() with gc: gc.set_antialias(True) gc.set_fill_color((0,1,0)) gc.translate_ctm(50,50) gc.rotate_ctm(3.1416/4) gc.show_text("hello") gc.translate_ctm(-50,-50) gc.set_text_matrix(AffineMatrix()) gc.set_fill_color((0,1,1)) gc.show_text("hello") t2 = time.clock() print('antialiased:', t2 - t1) gc.save("text_antialiased.bmp") """ with gc: gc.set_fill_color((0,1,0)) gc.rotate_ctm(-45) gc.show_text_at_point("hello") gc.set_fill_color((0,1,1)) gc.show_text("hello") with gc: gc.translate_ctm(80,-3) gc.show_text("hello") with gc: gc.set_fill_color((0,1,0)) gc.translate_ctm(50,50) gc.show_text("hello") with gc: gc.set_fill_color((0,1,0)) gc.translate_ctm(50,50) gc.rotate_ctm(3.1416/4) gc.show_text("hello") gc.set_fill_color((1,0,0)) gc.show_text("hello") """ gc.save("text_antiliased.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/lion_data.py0000644000175000017500000005552213233644505022525 0ustar varunvarun""" Defines a function to return a vector image of a cartoon lion. This module relies on Agg solely for CompiledPath support. (Lion path data is copied from from Agg.) """ from numpy import amax, amin, array, dtype from enable.compiled_path import CompiledPath lion_string = """ f2cc99 M 69,18 L 82,8 L 99,3 L 118,5 L 135,12 L 149,21 L 156,13 L 165,9 L 177,13 L 183,28 L 180,50 L 164,91 L 155,107 L 154,114 L 151,121 L 141,127 L 139,136 L 155,206 L 157,251 L 126,342 L 133,357 L 128,376 L 83,376 L 75,368 L 67,350 L 61,350 L 53,369 L 4,369 L 2,361 L 5,354 L 12,342 L 16,321 L 4,257 L 4,244 L 7,218 L 9,179 L 26,127 L 43,93 L 32,77 L 30,70 L 24,67 L 16,49 L 17,35 L 18,23 L 30,12 L 40,7 L 53,7 L 62,12 L 69,18 L 69,18 L 69,18 e5b27f M 142,79 L 136,74 L 138,82 L 133,78 L 133,84 L 127,78 L 128,85 L 124,80 L 125,87 L 119,82 L 119,90 L 125,99 L 125,96 L 128,100 L 128,94 L 131,98 L 132,93 L 135,97 L 136,93 L 138,97 L 139,94 L 141,98 L 143,94 L 144,85 L 142,79 L 142,79 L 142,79 eb8080 M 127,101 L 132,100 L 137,99 L 144,101 L 143,105 L 135,110 L 127,101 L 127,101 L 127,101 f2cc99 M 178,229 L 157,248 L 139,296 L 126,349 L 137,356 L 158,357 L 183,342 L 212,332 L 235,288 L 235,261 L 228,252 L 212,250 L 188,251 L 178,229 L 178,229 L 178,229 9c826b M 56,229 L 48,241 L 48,250 L 57,281 L 63,325 L 71,338 L 81,315 L 76,321 L 79,311 L 83,301 L 75,308 L 80,298 L 73,303 L 76,296 L 71,298 L 74,292 L 69,293 L 74,284 L 78,278 L 71,278 L 74,274 L 68,273 L 70,268 L 66,267 L 68,261 L 60,266 L 62,259 L 65,253 L 57,258 L 59,251 L 55,254 L 55,248 L 60,237 L 54,240 L 58,234 L 54,236 L 56,229 L 56,229 L 56,229 M 74,363 L 79,368 L 81,368 L 85,362 L 89,363 L 92,370 L 96,373 L 101,372 L 108,361 L 110,371 L 113,373 L 116,371 L 120,358 L 122,363 L 123,371 L 126,371 L 129,367 L 132,357 L 135,361 L 130,376 L 127,377 L 94,378 L 84,376 L 76,371 L 74,363 L 74,363 L 74,363 M 212,250 L 219,251 L 228,258 L 236,270 L 235,287 L 225,304 L 205,332 L 177,343 L 171,352 L 158,357 L 166,352 L 168,346 L 168,339 L 165,333 L 155,327 L 155,323 L 161,320 L 165,316 L 169,316 L 167,312 L 171,313 L 168,308 L 173,309 L 170,306 L 177,306 L 175,308 L 177,311 L 174,311 L 176,316 L 171,315 L 174,319 L 168,320 L 168,323 L 175,327 L 179,332 L 183,326 L 184,332 L 189,323 L 190,328 L 194,320 L 194,325 L 199,316 L 201,320 L 204,313 L 206,316 L 208,310 L 211,305 L 219,298 L 226,288 L 229,279 L 228,266 L 224,259 L 217,253 L 212,250 L 212,250 L 212,250 M 151,205 L 151,238 L 149,252 L 141,268 L 128,282 L 121,301 L 130,300 L 126,313 L 118,324 L 116,337 L 120,346 L 133,352 L 133,340 L 137,333 L 145,329 L 156,327 L 153,319 L 153,291 L 157,271 L 170,259 L 178,277 L 193,250 L 174,216 L 151,205 L 151,205 L 151,205 M 78,127 L 90,142 L 95,155 L 108,164 L 125,167 L 139,175 L 150,206 L 152,191 L 141,140 L 121,148 L 100,136 L 78,127 L 78,127 L 78,127 M 21,58 L 35,63 L 38,68 L 32,69 L 42,74 L 40,79 L 47,80 L 54,83 L 45,94 L 34,81 L 32,73 L 24,66 L 21,58 L 21,58 L 21,58 M 71,34 L 67,34 L 66,27 L 59,24 L 54,17 L 48,17 L 39,22 L 30,26 L 28,31 L 31,39 L 38,46 L 29,45 L 36,54 L 41,61 L 41,70 L 50,69 L 54,71 L 55,58 L 67,52 L 76,43 L 76,39 L 68,44 L 71,34 L 71,34 L 71,34 M 139,74 L 141,83 L 143,89 L 144,104 L 148,104 L 155,106 L 154,86 L 157,77 L 155,72 L 150,77 L 144,77 L 139,74 L 139,74 L 139,74 M 105,44 L 102,53 L 108,58 L 111,62 L 112,55 L 105,44 L 105,44 L 105,44 M 141,48 L 141,54 L 144,58 L 139,62 L 137,66 L 136,59 L 137,52 L 141,48 L 141,48 L 141,48 M 98,135 L 104,130 L 105,134 L 108,132 L 108,135 L 112,134 L 113,137 L 116,136 L 116,139 L 119,139 L 124,141 L 128,140 L 133,138 L 140,133 L 139,140 L 126,146 L 104,144 L 98,135 L 98,135 L 98,135 M 97,116 L 103,119 L 103,116 L 111,118 L 116,117 L 122,114 L 127,107 L 135,111 L 142,107 L 141,114 L 145,118 L 149,121 L 145,125 L 140,124 L 127,121 L 113,125 L 100,124 L 97,116 L 97,116 L 97,116 M 147,33 L 152,35 L 157,34 L 153,31 L 160,31 L 156,28 L 161,28 L 159,24 L 163,25 L 163,21 L 165,22 L 170,23 L 167,17 L 172,21 L 174,18 L 175,23 L 176,22 L 177,28 L 177,33 L 174,37 L 176,39 L 174,44 L 171,49 L 168,53 L 164,57 L 159,68 L 156,70 L 154,60 L 150,51 L 146,43 L 144,35 L 147,33 L 147,33 L 147,33 M 85,72 L 89,74 L 93,75 L 100,76 L 105,75 L 102,79 L 94,79 L 88,76 L 85,72 L 85,72 L 85,72 M 86,214 L 79,221 L 76,232 L 82,225 L 78,239 L 82,234 L 78,245 L 81,243 L 79,255 L 84,250 L 84,267 L 87,254 L 90,271 L 90,257 L 95,271 L 93,256 L 95,249 L 92,252 L 93,243 L 89,253 L 89,241 L 86,250 L 87,236 L 83,245 L 87,231 L 82,231 L 90,219 L 84,221 L 86,214 L 86,214 L 86,214 ffcc7f M 93,68 L 96,72 L 100,73 L 106,72 L 108,66 L 105,63 L 100,62 L 93,68 L 93,68 L 93,68 M 144,64 L 142,68 L 142,73 L 146,74 L 150,73 L 154,64 L 149,62 L 144,64 L 144,64 L 144,64 9c826b M 57,91 L 42,111 L 52,105 L 41,117 L 53,112 L 46,120 L 53,116 L 50,124 L 57,119 L 55,127 L 61,122 L 60,130 L 67,126 L 66,134 L 71,129 L 72,136 L 77,130 L 76,137 L 80,133 L 82,138 L 86,135 L 96,135 L 94,129 L 86,124 L 83,117 L 77,123 L 79,117 L 73,120 L 75,112 L 68,116 L 71,111 L 65,114 L 69,107 L 63,110 L 68,102 L 61,107 L 66,98 L 61,103 L 63,97 L 57,99 L 57,91 L 57,91 L 57,91 M 83,79 L 76,79 L 67,82 L 75,83 L 65,88 L 76,87 L 65,92 L 76,91 L 68,96 L 77,95 L 70,99 L 80,98 L 72,104 L 80,102 L 76,108 L 85,103 L 92,101 L 87,98 L 93,96 L 86,94 L 91,93 L 85,91 L 93,89 L 99,89 L 105,93 L 107,85 L 102,82 L 92,80 L 83,79 L 83,79 L 83,79 M 109,77 L 111,83 L 109,89 L 113,94 L 117,90 L 117,81 L 114,78 L 109,77 L 109,77 L 109,77 M 122,128 L 127,126 L 134,127 L 136,129 L 134,130 L 130,128 L 124,129 L 122,128 L 122,128 L 122,128 M 78,27 L 82,32 L 80,33 L 82,36 L 78,37 L 82,40 L 78,42 L 81,46 L 76,47 L 78,49 L 74,50 L 82,52 L 87,50 L 83,48 L 91,46 L 86,45 L 91,42 L 88,40 L 92,37 L 86,34 L 90,31 L 86,29 L 89,26 L 78,27 L 78,27 L 78,27 M 82,17 L 92,20 L 79,21 L 90,25 L 81,25 L 94,28 L 93,26 L 101,30 L 101,26 L 107,33 L 108,28 L 111,40 L 113,34 L 115,45 L 117,39 L 119,54 L 121,46 L 124,58 L 126,47 L 129,59 L 130,49 L 134,58 L 133,44 L 137,48 L 133,37 L 137,40 L 133,32 L 126,20 L 135,26 L 132,19 L 138,23 L 135,17 L 142,18 L 132,11 L 116,6 L 94,6 L 78,11 L 92,12 L 80,14 L 90,16 L 82,17 L 82,17 L 82,17 M 142,234 L 132,227 L 124,223 L 115,220 L 110,225 L 118,224 L 127,229 L 135,236 L 122,234 L 115,237 L 113,242 L 121,238 L 139,243 L 121,245 L 111,254 L 95,254 L 102,244 L 104,235 L 110,229 L 100,231 L 104,224 L 113,216 L 122,215 L 132,217 L 141,224 L 145,230 L 149,240 L 142,234 L 142,234 L 142,234 M 115,252 L 125,248 L 137,249 L 143,258 L 134,255 L 125,254 L 115,252 L 115,252 L 115,252 M 114,212 L 130,213 L 140,219 L 147,225 L 144,214 L 137,209 L 128,207 L 114,212 L 114,212 L 114,212 M 102,263 L 108,258 L 117,257 L 131,258 L 116,260 L 109,265 L 102,263 L 102,263 L 102,263 M 51,241 L 35,224 L 40,238 L 23,224 L 31,242 L 19,239 L 28,247 L 17,246 L 25,250 L 37,254 L 39,263 L 44,271 L 47,294 L 48,317 L 51,328 L 60,351 L 60,323 L 53,262 L 47,246 L 51,241 L 51,241 L 51,241 M 2,364 L 9,367 L 14,366 L 18,355 L 20,364 L 26,366 L 31,357 L 35,364 L 39,364 L 42,357 L 47,363 L 53,360 L 59,357 L 54,369 L 7,373 L 2,364 L 2,364 L 2,364 M 7,349 L 19,345 L 25,339 L 18,341 L 23,333 L 28,326 L 23,326 L 27,320 L 23,316 L 25,311 L 20,298 L 15,277 L 12,264 L 9,249 L 10,223 L 3,248 L 5,261 L 15,307 L 17,326 L 11,343 L 7,349 L 7,349 L 7,349 M 11,226 L 15,231 L 25,236 L 18,227 L 11,226 L 11,226 L 11,226 M 13,214 L 19,217 L 32,227 L 23,214 L 16,208 L 15,190 L 24,148 L 31,121 L 24,137 L 14,170 L 8,189 L 13,214 L 13,214 L 13,214 M 202,254 L 195,258 L 199,260 L 193,263 L 197,263 L 190,268 L 196,268 L 191,273 L 188,282 L 200,272 L 194,272 L 201,266 L 197,265 L 204,262 L 200,258 L 204,256 L 202,254 L 202,254 L 202,254 845433 M 151,213 L 165,212 L 179,225 L 189,246 L 187,262 L 179,275 L 176,263 L 177,247 L 171,233 L 163,230 L 165,251 L 157,264 L 146,298 L 145,321 L 133,326 L 143,285 L 154,260 L 153,240 L 151,213 L 151,213 L 151,213 M 91,132 L 95,145 L 97,154 L 104,148 L 107,155 L 109,150 L 111,158 L 115,152 L 118,159 L 120,153 L 125,161 L 126,155 L 133,164 L 132,154 L 137,163 L 137,152 L 142,163 L 147,186 L 152,192 L 148,167 L 141,143 L 124,145 L 105,143 L 91,132 L 91,132 L 91,132 9c826b M 31,57 L 23,52 L 26,51 L 20,44 L 23,42 L 21,36 L 22,29 L 25,23 L 24,32 L 30,43 L 26,41 L 30,50 L 26,48 L 31,57 L 31,57 L 31,57 M 147,21 L 149,28 L 155,21 L 161,16 L 167,14 L 175,15 L 173,11 L 161,9 L 147,21 L 147,21 L 147,21 M 181,39 L 175,51 L 169,57 L 171,65 L 165,68 L 165,75 L 160,76 L 162,91 L 171,71 L 180,51 L 181,39 L 181,39 L 181,39 M 132,346 L 139,348 L 141,346 L 142,341 L 147,342 L 143,355 L 133,350 L 132,346 L 132,346 L 132,346 M 146,355 L 151,352 L 155,348 L 157,343 L 160,349 L 151,356 L 147,357 L 146,355 L 146,355 L 146,355 M 99,266 L 100,281 L 94,305 L 86,322 L 78,332 L 72,346 L 73,331 L 91,291 L 99,266 L 99,266 L 99,266 M 20,347 L 32,342 L 45,340 L 54,345 L 45,350 L 42,353 L 38,350 L 31,353 L 29,356 L 23,350 L 19,353 L 15,349 L 20,347 L 20,347 L 20,347 M 78,344 L 86,344 L 92,349 L 88,358 L 84,352 L 78,344 L 78,344 L 78,344 M 93,347 L 104,344 L 117,345 L 124,354 L 121,357 L 116,351 L 112,351 L 108,355 L 102,351 L 93,347 L 93,347 L 93,347 000000 M 105,12 L 111,18 L 113,24 L 113,29 L 119,34 L 116,23 L 112,16 L 105,12 L 105,12 L 105,12 M 122,27 L 125,34 L 127,43 L 128,34 L 125,29 L 122,27 L 122,27 L 122,27 M 115,13 L 122,19 L 122,15 L 113,10 L 115,13 L 115,13 L 115,13 ffe5b2 M 116,172 L 107,182 L 98,193 L 98,183 L 90,199 L 89,189 L 84,207 L 88,206 L 87,215 L 95,206 L 93,219 L 91,230 L 98,216 L 97,226 L 104,214 L 112,209 L 104,208 L 113,202 L 126,200 L 139,207 L 132,198 L 142,203 L 134,192 L 142,195 L 134,187 L 140,185 L 130,181 L 136,177 L 126,177 L 125,171 L 116,180 L 116,172 L 116,172 L 116,172 M 74,220 L 67,230 L 67,221 L 59,235 L 63,233 L 60,248 L 70,232 L 65,249 L 71,243 L 67,256 L 73,250 L 69,262 L 73,259 L 71,267 L 76,262 L 72,271 L 78,270 L 76,275 L 82,274 L 78,290 L 86,279 L 86,289 L 92,274 L 88,275 L 87,264 L 82,270 L 82,258 L 77,257 L 78,247 L 73,246 L 77,233 L 72,236 L 74,220 L 74,220 L 74,220 M 133,230 L 147,242 L 148,250 L 145,254 L 138,247 L 129,246 L 142,245 L 138,241 L 128,237 L 137,238 L 133,230 L 133,230 L 133,230 M 133,261 L 125,261 L 116,263 L 111,267 L 125,265 L 133,261 L 133,261 L 133,261 M 121,271 L 109,273 L 103,279 L 99,305 L 92,316 L 85,327 L 83,335 L 89,340 L 97,341 L 94,336 L 101,336 L 96,331 L 103,330 L 97,327 L 108,325 L 99,322 L 109,321 L 100,318 L 110,317 L 105,314 L 110,312 L 107,310 L 113,308 L 105,306 L 114,303 L 105,301 L 115,298 L 107,295 L 115,294 L 108,293 L 117,291 L 109,289 L 117,286 L 109,286 L 118,283 L 112,281 L 118,279 L 114,278 L 119,276 L 115,274 L 121,271 L 121,271 L 121,271 M 79,364 L 74,359 L 74,353 L 76,347 L 80,351 L 83,356 L 82,360 L 79,364 L 79,364 L 79,364 M 91,363 L 93,356 L 97,353 L 103,355 L 105,360 L 103,366 L 99,371 L 94,368 L 91,363 L 91,363 L 91,363 M 110,355 L 114,353 L 118,357 L 117,363 L 113,369 L 111,362 L 110,355 L 110,355 L 110,355 M 126,354 L 123,358 L 124,367 L 126,369 L 129,361 L 129,357 L 126,354 L 126,354 L 126,354 M 30,154 L 24,166 L 20,182 L 23,194 L 29,208 L 37,218 L 41,210 L 41,223 L 46,214 L 46,227 L 52,216 L 52,227 L 61,216 L 59,225 L 68,213 L 73,219 L 70,207 L 77,212 L 69,200 L 77,202 L 70,194 L 78,197 L 68,187 L 76,182 L 64,182 L 58,175 L 58,185 L 53,177 L 50,186 L 46,171 L 44,182 L 39,167 L 36,172 L 36,162 L 30,166 L 30,154 L 30,154 L 30,154 M 44,130 L 41,137 L 45,136 L 43,150 L 48,142 L 48,157 L 53,150 L 52,164 L 60,156 L 61,169 L 64,165 L 66,175 L 70,167 L 74,176 L 77,168 L 80,183 L 85,172 L 90,182 L 93,174 L 98,181 L 99,173 L 104,175 L 105,169 L 114,168 L 102,163 L 95,157 L 94,166 L 90,154 L 87,162 L 82,149 L 75,159 L 72,148 L 68,155 L 67,143 L 62,148 L 62,138 L 58,145 L 56,133 L 52,142 L 52,128 L 49,134 L 47,125 L 44,130 L 44,130 L 44,130 M 13,216 L 19,219 L 36,231 L 22,223 L 16,222 L 22,227 L 12,224 L 13,220 L 16,220 L 13,216 L 13,216 L 13,216 M 10,231 L 14,236 L 25,239 L 27,237 L 19,234 L 10,231 L 10,231 L 10,231 M 9,245 L 14,242 L 25,245 L 13,245 L 9,245 L 9,245 L 9,245 M 33,255 L 26,253 L 18,254 L 25,256 L 18,258 L 27,260 L 18,263 L 27,265 L 19,267 L 29,270 L 21,272 L 29,276 L 21,278 L 30,281 L 22,283 L 31,287 L 24,288 L 32,292 L 23,293 L 34,298 L 26,299 L 37,303 L 32,305 L 39,309 L 33,309 L 39,314 L 34,314 L 40,318 L 34,317 L 40,321 L 34,321 L 41,326 L 33,326 L 40,330 L 33,332 L 39,333 L 33,337 L 42,337 L 54,341 L 49,337 L 52,335 L 47,330 L 50,330 L 45,325 L 49,325 L 45,321 L 48,321 L 45,316 L 46,306 L 45,286 L 43,274 L 36,261 L 33,255 L 33,255 L 33,255 M 7,358 L 9,351 L 14,351 L 17,359 L 11,364 L 7,358 L 7,358 L 7,358 M 44,354 L 49,351 L 52,355 L 49,361 L 44,354 L 44,354 L 44,354 M 32,357 L 37,353 L 40,358 L 36,361 L 32,357 L 32,357 L 32,357 M 139,334 L 145,330 L 154,330 L 158,334 L 154,341 L 152,348 L 145,350 L 149,340 L 147,336 L 141,339 L 139,345 L 136,342 L 136,339 L 139,334 L 139,334 L 139,334 M 208,259 L 215,259 L 212,255 L 220,259 L 224,263 L 225,274 L 224,283 L 220,292 L 208,300 L 206,308 L 203,304 L 199,315 L 197,309 L 195,318 L 193,313 L 190,322 L 190,316 L 185,325 L 182,318 L 180,325 L 172,321 L 178,320 L 176,313 L 186,312 L 180,307 L 188,307 L 184,303 L 191,302 L 186,299 L 195,294 L 187,290 L 197,288 L 192,286 L 201,283 L 194,280 L 203,277 L 198,275 L 207,271 L 200,269 L 209,265 L 204,265 L 212,262 L 208,259 L 208,259 L 208,259 M 106,126 L 106,131 L 109,132 L 111,134 L 115,132 L 115,135 L 119,133 L 118,137 L 123,137 L 128,137 L 133,134 L 136,130 L 136,127 L 132,124 L 118,128 L 112,128 L 106,126 L 106,126 L 106,126 M 107,114 L 101,110 L 98,102 L 105,97 L 111,98 L 119,102 L 121,108 L 118,112 L 113,115 L 107,114 L 107,114 L 107,114 M 148,106 L 145,110 L 146,116 L 150,118 L 152,111 L 151,107 L 148,106 L 148,106 L 148,106 M 80,55 L 70,52 L 75,58 L 63,57 L 72,61 L 57,61 L 67,66 L 57,67 L 62,69 L 54,71 L 61,73 L 54,77 L 63,78 L 53,85 L 60,84 L 56,90 L 69,84 L 63,82 L 75,76 L 70,75 L 77,72 L 72,71 L 78,69 L 72,66 L 81,67 L 78,64 L 82,63 L 80,60 L 86,62 L 80,55 L 80,55 L 80,55 M 87,56 L 91,52 L 96,50 L 102,56 L 98,56 L 92,60 L 87,56 L 87,56 L 87,56 M 85,68 L 89,73 L 98,76 L 106,74 L 96,73 L 91,70 L 85,68 L 85,68 L 85,68 M 115,57 L 114,64 L 111,64 L 115,75 L 122,81 L 122,74 L 126,79 L 126,74 L 131,78 L 130,72 L 133,77 L 131,68 L 126,61 L 119,57 L 115,57 L 115,57 L 115,57 M 145,48 L 143,53 L 147,59 L 151,59 L 150,55 L 145,48 L 145,48 L 145,48 M 26,22 L 34,15 L 43,10 L 52,10 L 59,16 L 47,15 L 32,22 L 26,22 L 26,22 L 26,22 M 160,19 L 152,26 L 149,34 L 154,33 L 152,30 L 157,30 L 155,26 L 158,27 L 157,23 L 161,23 L 160,19 L 160,19 L 160,19 000000 M 98,117 L 105,122 L 109,122 L 105,117 L 113,120 L 121,120 L 130,112 L 128,108 L 123,103 L 123,99 L 128,101 L 132,106 L 135,109 L 142,105 L 142,101 L 145,101 L 145,91 L 148,101 L 145,105 L 136,112 L 135,116 L 143,124 L 148,120 L 150,122 L 142,128 L 133,122 L 121,125 L 112,126 L 103,125 L 100,129 L 96,124 L 98,117 L 98,117 L 98,117 M 146,118 L 152,118 L 152,115 L 149,115 L 146,118 L 146,118 L 146,118 M 148,112 L 154,111 L 154,109 L 149,109 L 148,112 L 148,112 L 148,112 M 106,112 L 108,115 L 114,116 L 118,114 L 106,112 L 106,112 L 106,112 M 108,108 L 111,110 L 116,110 L 119,108 L 108,108 L 108,108 L 108,108 M 106,104 L 109,105 L 117,106 L 115,104 L 106,104 L 106,104 L 106,104 M 50,25 L 41,26 L 34,33 L 39,43 L 49,58 L 36,51 L 47,68 L 55,69 L 54,59 L 61,57 L 74,46 L 60,52 L 67,42 L 57,48 L 61,40 L 54,45 L 60,36 L 59,29 L 48,38 L 52,30 L 47,32 L 50,25 L 50,25 L 50,25 M 147,34 L 152,41 L 155,49 L 161,53 L 157,47 L 164,47 L 158,43 L 168,44 L 159,40 L 164,37 L 169,37 L 164,33 L 169,34 L 165,28 L 170,30 L 170,25 L 173,29 L 175,27 L 176,32 L 173,36 L 175,39 L 172,42 L 172,46 L 168,49 L 170,55 L 162,57 L 158,63 L 155,58 L 153,50 L 149,46 L 147,34 L 147,34 L 147,34 M 155,71 L 159,80 L 157,93 L 157,102 L 155,108 L 150,101 L 149,93 L 154,101 L 152,91 L 151,83 L 155,79 L 155,71 L 155,71 L 155,71 M 112,78 L 115,81 L 114,91 L 112,87 L 113,82 L 112,78 L 112,78 L 112,78 M 78,28 L 64,17 L 58,11 L 47,9 L 36,10 L 28,16 L 21,26 L 18,41 L 20,51 L 23,61 L 33,65 L 28,68 L 37,74 L 36,81 L 43,87 L 48,90 L 43,100 L 40,98 L 39,90 L 31,80 L 30,72 L 22,71 L 17,61 L 14,46 L 16,28 L 23,17 L 33,9 L 45,6 L 54,6 L 65,12 L 78,28 L 78,28 L 78,28 M 67,18 L 76,9 L 87,5 L 101,2 L 118,3 L 135,8 L 149,20 L 149,26 L 144,19 L 132,12 L 121,9 L 105,7 L 89,8 L 76,14 L 70,20 L 67,18 L 67,18 L 67,18 M 56,98 L 48,106 L 56,103 L 47,112 L 56,110 L 52,115 L 57,113 L 52,121 L 62,115 L 58,123 L 65,119 L 63,125 L 69,121 L 68,127 L 74,125 L 74,129 L 79,128 L 83,132 L 94,135 L 93,129 L 85,127 L 81,122 L 76,126 L 75,121 L 71,124 L 71,117 L 66,121 L 66,117 L 62,117 L 64,112 L 60,113 L 60,110 L 57,111 L 61,105 L 57,107 L 60,101 L 55,102 L 56,98 L 56,98 L 56,98 M 101,132 L 103,138 L 106,134 L 106,139 L 112,136 L 111,142 L 115,139 L 114,143 L 119,142 L 125,145 L 131,142 L 135,138 L 140,134 L 140,129 L 143,135 L 145,149 L 150,171 L 149,184 L 145,165 L 141,150 L 136,147 L 132,151 L 131,149 L 126,152 L 125,150 L 121,152 L 117,148 L 111,152 L 110,148 L 105,149 L 104,145 L 98,150 L 96,138 L 94,132 L 94,130 L 98,132 L 101,132 L 101,132 L 101,132 M 41,94 L 32,110 L 23,132 L 12,163 L 6,190 L 7,217 L 5,236 L 3,247 L 9,230 L 12,211 L 12,185 L 18,160 L 26,134 L 35,110 L 43,99 L 41,94 L 41,94 L 41,94 M 32,246 L 41,250 L 50,257 L 52,267 L 53,295 L 53,323 L 59,350 L 54,363 L 51,365 L 44,366 L 42,360 L 40,372 L 54,372 L 59,366 L 62,353 L 71,352 L 75,335 L 73,330 L 66,318 L 68,302 L 64,294 L 67,288 L 63,286 L 63,279 L 59,275 L 58,267 L 56,262 L 50,247 L 42,235 L 44,246 L 32,236 L 35,244 L 32,246 L 32,246 L 32,246 M 134,324 L 146,320 L 159,322 L 173,327 L 179,337 L 179,349 L 172,355 L 158,357 L 170,350 L 174,343 L 170,333 L 163,328 L 152,326 L 134,329 L 134,324 L 134,324 L 134,324 M 173,339 L 183,334 L 184,338 L 191,329 L 194,332 L 199,323 L 202,325 L 206,318 L 209,320 L 213,309 L 221,303 L 228,296 L 232,289 L 234,279 L 233,269 L 230,262 L 225,256 L 219,253 L 208,252 L 198,252 L 210,249 L 223,250 L 232,257 L 237,265 L 238,277 L 238,291 L 232,305 L 221,323 L 218,335 L 212,342 L 200,349 L 178,348 L 173,339 L 173,339 L 173,339 M 165,296 L 158,301 L 156,310 L 156,323 L 162,324 L 159,318 L 162,308 L 162,304 L 165,296 L 165,296 L 165,296 M 99,252 L 105,244 L 107,234 L 115,228 L 121,228 L 131,235 L 122,233 L 113,235 L 109,246 L 121,239 L 133,243 L 121,243 L 110,251 L 99,252 L 99,252 L 99,252 M 117,252 L 124,247 L 134,249 L 136,253 L 126,252 L 117,252 L 117,252 L 117,252 M 117,218 L 132,224 L 144,233 L 140,225 L 132,219 L 117,218 L 117,218 L 117,218 M 122,212 L 134,214 L 143,221 L 141,213 L 132,210 L 122,212 L 122,212 L 122,212 M 69,352 L 70,363 L 76,373 L 86,378 L 97,379 L 108,379 L 120,377 L 128,378 L 132,373 L 135,361 L 133,358 L 132,366 L 127,375 L 121,374 L 121,362 L 119,367 L 117,374 L 110,376 L 110,362 L 107,357 L 106,371 L 104,375 L 97,376 L 90,375 L 90,368 L 86,362 L 83,364 L 86,369 L 85,373 L 78,370 L 73,362 L 71,351 L 69,352 L 69,352 L 69,352 M 100,360 L 96,363 L 99,369 L 102,364 L 100,360 L 100,360 L 100,360 M 115,360 L 112,363 L 114,369 L 117,364 L 115,360 L 115,360 L 115,360 M 127,362 L 125,364 L 126,369 L 128,365 L 127,362 L 127,362 L 127,362 M 5,255 L 7,276 L 11,304 L 15,320 L 13,334 L 6,348 L 2,353 L 0,363 L 5,372 L 12,374 L 25,372 L 38,372 L 44,369 L 42,367 L 36,368 L 31,369 L 30,360 L 27,368 L 20,370 L 16,361 L 15,368 L 10,369 L 3,366 L 3,359 L 6,352 L 11,348 L 17,331 L 19,316 L 12,291 L 9,274 L 5,255 L 5,255 L 5,255 M 10,358 L 7,362 L 10,366 L 11,362 L 10,358 L 10,358 L 10,358 M 25,357 L 22,360 L 24,366 L 27,360 L 25,357 L 25,357 L 25,357 M 37,357 L 34,361 L 36,365 L 38,361 L 37,357 L 37,357 L 37,357 M 49,356 L 46,359 L 47,364 L 50,360 L 49,356 L 49,356 L 49,356 M 130,101 L 132,102 L 135,101 L 139,102 L 143,103 L 142,101 L 137,100 L 133,100 L 130,101 L 130,101 L 130,101 M 106,48 L 105,52 L 108,56 L 109,52 L 106,48 L 106,48 L 106,48 M 139,52 L 139,56 L 140,60 L 142,58 L 141,56 L 139,52 L 139,52 L 139,52 M 25,349 L 29,351 L 30,355 L 33,350 L 37,348 L 42,351 L 45,347 L 49,345 L 44,343 L 36,345 L 25,349 L 25,349 L 25,349 M 98,347 L 105,351 L 107,354 L 109,349 L 115,349 L 120,353 L 118,349 L 113,346 L 104,346 L 98,347 L 98,347 L 98,347 M 83,348 L 87,352 L 87,357 L 89,351 L 87,348 L 83,348 L 83,348 L 83,348 M 155,107 L 163,107 L 170,107 L 186,108 L 175,109 L 155,109 L 155,107 L 155,107 L 155,107 M 153,114 L 162,113 L 175,112 L 192,114 L 173,114 L 154,115 L 153,114 L 153,114 L 153,114 M 152,118 L 164,120 L 180,123 L 197,129 L 169,123 L 151,120 L 152,118 L 152,118 L 152,118 M 68,109 L 87,106 L 107,106 L 106,108 L 88,108 L 68,109 L 68,109 L 68,109 M 105,111 L 95,112 L 79,114 L 71,116 L 85,115 L 102,113 L 105,111 L 105,111 L 105,111 M 108,101 L 98,99 L 87,99 L 78,99 L 93,100 L 105,102 L 108,101 L 108,101 L 108,101 M 85,63 L 91,63 L 97,60 L 104,60 L 108,62 L 111,69 L 112,75 L 110,74 L 108,71 L 103,73 L 106,69 L 105,65 L 103,64 L 103,67 L 102,70 L 99,70 L 97,66 L 94,67 L 97,72 L 88,67 L 84,66 L 85,63 L 85,63 L 85,63 M 140,74 L 141,66 L 144,61 L 150,61 L 156,62 L 153,70 L 150,73 L 152,65 L 150,65 L 151,68 L 149,71 L 146,71 L 144,66 L 143,70 L 143,74 L 140,74 L 140,74 L 140,74 M 146,20 L 156,11 L 163,9 L 172,9 L 178,14 L 182,18 L 184,32 L 182,42 L 182,52 L 177,58 L 176,67 L 171,76 L 165,90 L 157,105 L 160,92 L 164,85 L 168,78 L 167,73 L 173,66 L 172,62 L 175,59 L 174,55 L 177,53 L 180,46 L 181,29 L 179,21 L 173,13 L 166,11 L 159,13 L 153,18 L 148,23 L 146,20 L 146,20 L 146,20 M 150,187 L 148,211 L 150,233 L 153,247 L 148,267 L 135,283 L 125,299 L 136,292 L 131,313 L 122,328 L 122,345 L 129,352 L 133,359 L 133,367 L 137,359 L 148,356 L 140,350 L 131,347 L 129,340 L 132,332 L 140,328 L 137,322 L 140,304 L 154,265 L 157,244 L 155,223 L 161,220 L 175,229 L 186,247 L 185,260 L 176,275 L 178,287 L 185,277 L 188,261 L 196,253 L 189,236 L 174,213 L 150,187 L 150,187 L 150,187 M 147,338 L 142,341 L 143,345 L 141,354 L 147,343 L 147,338 L 147,338 L 147,338 M 157,342 L 156,349 L 150,356 L 157,353 L 163,346 L 162,342 L 157,342 L 157,342 L 157,342 M 99,265 L 96,284 L 92,299 L 73,339 L 73,333 L 87,300 L 99,265 L 99,265 L 99,265 """ def build_paths(lion_string): mins=[] maxs=[] colors = [] paths = [] lines = lion_string.split('\n') for line in lines: fields = line.split() if len(fields) == 0: pass elif len(fields) == 1: hex_color = fields[0] r = int(hex_color[:2],16)/255. g = int(hex_color[2:4],16)/255. b = int(hex_color[4:6],16)/255. colors.append(array((r,g,b,1.0))) paths.append(CompiledPath()) path = paths[-1] else: fields = array(fields,'O') cmd = fields[::2] pts = [array(eval(x), dtype=float) for x in fields[1::2]] mins.append(amin(pts,axis=0)) maxs.append(amax(pts,axis=0)) path_def = list(zip (cmd,pts)) for cmd, pt in path_def: pt[0] -= 119 pt[1] -= 190.5 if cmd == 'M': path.move_to(pt[0],pt[1]) if cmd == 'L': path.line_to(pt[0],pt[1]) min_pt = amin(array(mins),axis=0) max_pt = amax(array(maxs),axis=0) sz = max_pt - min_pt center = min_pt + sz/2.0 return list(zip(paths, colors)), sz, center def get_lion(): """get_lion() -> path_and_color, size, center path_and_color: [(path,color), ...] size: [width, height] center: [x, y] """ return build_paths(lion_string) # EOF enthought-chaco2-4.8.1.orig/examples/kiva/agg/star1.py0000644000175000017500000000100113233644505021604 0ustar varunvarunimport kiva from kiva import agg def add_star(gc): gc.begin_path() # star gc.move_to(-20,-30) gc.line_to(0,30) gc.line_to(20,-30) gc.line_to(-30,10) gc.line_to(30,10) gc.close_path() #line at top of star gc.move_to(-10,30) gc.line_to(10,30) gc = agg.GraphicsContextArray((500,500)) gc.translate_ctm(250,300) add_star(gc) gc.draw_path() gc.translate_ctm(0,-100) add_star(gc) gc.set_fill_color((0.0,0.0,1.0)) gc.draw_path(kiva.EOF_FILL_STROKE) gc.save("star1.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/compiled_path.py0000644000175000017500000000075013233644505023374 0ustar varunvarunfrom numpy import array from kiva.image import GraphicsContext, CompiledPath from kiva.constants import STROKE, FILL_STROKE cross = CompiledPath() cross.scale_ctm(10.0, 10.0) lines = array([(0,1),(0,2),(1,2),(1,3),(2,3),(2,2),(3,2),(3,1),(2,1), (2,0),(1,0),(1,1), (0,1)]) cross.lines(lines) gc = GraphicsContext((400,400)) gc.set_stroke_color((1,0,0,1)) gc.draw_path_at_points(array([(50,50), (200,50), (50,200), (200,200)]), cross, STROKE) gc.save("compiled_path.png") enthought-chaco2-4.8.1.orig/examples/kiva/agg/benchmark.py0000644000175000017500000001364713233644505022527 0ustar varunvarun""" Benchmarks Agg rendering times. """ from __future__ import print_function import time from scipy import stats, array, shape, arange, transpose, sin, cos from kiva import agg import kiva def benchmark_real_time(cycles=10,n_pts=1000,sz=(1000,1000)): """ Render a sin wave to the screen repeatedly. Clears the screen between each rendering. """ print('realtime:', end=' ') width,height = sz pts = zeros((n_pts,2),Float) x = pts[:,0] y = pts[:,1] interval = width / float(n_pts) x[:] = arange(0,width,interval) t1 = time.clock() gc = agg.GraphicsContextBitmap(sz) for i in range(cycles): y[:] = height/2. + height/2. * sin(x*2*pi/width+i*interval) #gc.clear() gc.lines(pts) gc.stroke_path() #agg.write_bmp_rgb24("sin%d.bmp" % i,gc.bitmap) t2 = time.clock() tot_time = t2 - t1 print('tot,per cycle:', tot_time, tot_time/cycles) return def benchmark_compiled_path(cycles=10,n_pts=1000,sz=(1000,1000)): """ Render a sin wave to a compiled_path then display it repeatedly. """ width,height = sz pts = zeros((n_pts,2),Float) x = pts[:,0] y = pts[:,1] interval = width / float(n_pts) x[:] = arange(0,width,interval) y[:] = height/2. + height/2. * sin(x*2*pi/n_pts) path = agg.CompiledPath() path.lines(pts) #path.move_to(pts[0,0],pts[0,1]) #for x,y in pts[1:]: # path.line_to(x,y) t1 = time.clock() gc = agg.GraphicsContextBitmap(sz) for i in range(cycles): #gc.clear() gc.add_path(path) gc.stroke_path() t2 = time.clock() tot_time = t2 - t1 print('tot,per cycle:', tot_time, tot_time/cycles) return def benchmark_draw_path_flags(cycles=10,n_pts=1000,sz=(1000,1000)): print('realtime:', end=' ') width,height = sz pts = zeros((n_pts,2),Float) x = pts[:,0] y = pts[:,1] interval = width / float(n_pts) x[:] = arange(0,width,interval) flags = [kiva.FILL, kiva.EOF_FILL, kiva.STROKE, kiva.FILL_STROKE, kiva.EOF_FILL_STROKE] for flag in flags: t1 = time.clock() for i in range(cycles): gc = agg.GraphicsContextBitmap(sz) y[:] = height/2. + height/2. * sin(x*2*pi/width+i*interval) gc.lines(pts) gc.draw_path(flag) t2 = time.clock() agg.write_bmp_rgb24("draw_path%d.bmp" % flag,gc.bitmap) tot_time = t2 - t1 print('tot,per cycle:', tot_time, tot_time/cycles) return def star_array(size=40): half_size = size * .5 tenth_size = size * .1 star_pts = [ array((tenth_size,0)), array((half_size,size - tenth_size)), array((size - tenth_size, 0)), array((0,half_size)), array((size,half_size)), array((tenth_size,0)), ] return array(star_pts) def circle_array(size=5): x = arange(0,6.3,.1) pts = transpose(array((cos(x), sin(x)))).copy()*size/2. return pts def star_path_gen(size = 40): star_path = agg.CompiledPath() #spts = circle_array() spts = star_array() #star_path.lines(spts) star_path.move_to(spts[0][0],spts[0][1]) for x,y in spts: star_path.line_to(x,y) star_path.close_path() return star_path def benchmark_individual_symbols(n_pts=1000,sz=(1000,1000)): "Draws some stars" width,height = sz pts = stats.norm.rvs(size=(n_pts,2)) * array(sz)/8.0 + array(sz)/2.0 print(pts[5,:]) print(shape(pts)) star_path = star_path_gen() gc = agg.GraphicsContextArray(sz) gc.set_fill_color((1.0,0.0,0.0,0.1)) gc.set_stroke_color((0.0,1.0,0.0,0.6)) t1 = time.clock() for x,y in pts: with gc: gc.translate_ctm(x,y) gc.add_path(star_path) gc.draw_path() t2 = time.clock() gc.save("benchmark_symbols1.bmp") tot_time = t2 - t1 print('star count, tot,per shape:', n_pts, tot_time, tot_time / n_pts) return def benchmark_rect(n_pts=1000,sz=(1000,1000)): "Draws a number of randomly-placed renctangles." width,height = sz pts = stats.norm.rvs(size=(n_pts,2)) * array(sz)/8. + array(sz)/2. print(pts[5,:]) print(shape(pts)) gc = agg.GraphicsContextArray(sz) gc.set_fill_color((1.0,0.0,0.0,0.1)) gc.set_stroke_color((0.0,1.0,0.0,0.6)) t1 = time.clock() for x,y in pts: with gc: gc.translate_ctm(x,y) gc.rect(-2.5,-2.5,5,5) gc.draw_path() t2 = time.clock() gc.save("benchmark_rect.bmp") tot_time = t2 - t1 print('rect count, tot,per shape:', n_pts, tot_time, tot_time / n_pts) return def benchmark_symbols_all_at_once(n_pts=1000,sz=(1000,1000)): """ Renders all the symbols. """ width,height = sz pts = stats.norm.rvs(size=(n_pts,2)) * array(sz)/8. + array(sz)/2. star_path = agg.CompiledPath() star_path.lines(circle_array()) gc = agg.GraphicsContextArray(sz) gc.set_fill_color((1.0,0.0,0.0,0.1)) gc.set_stroke_color((0.0,1.0,0.0,0.6)) path = agg.CompiledPath() t1 = time.clock() for x,y in pts: path.save_ctm() path.translate_ctm(x,y) path.add_path(star_path) path.restore_ctm() gc.add_path(path) t2 = time.clock() gc.draw_path() t3 = time.clock() gc.save("benchmark_symbols2.bmp") build_path_time = t2 - t1 render_path_time = t3 - t2 tot_time = t3 - t1 print('star count, tot,building path, rendering path:', n_pts, \ tot_time, build_path_time,render_path_time) return if __name__ == '__main__': #sz = (1000,1000) sz = (500,500) n_pts = 1000 #benchmark_real_time(n_pts = n_pts, sz = sz) #benchmark_compiled_path(n_pts = n_pts, sz=sz) benchmark_individual_symbols(n_pts = n_pts, sz=sz) benchmark_rect(n_pts = n_pts, sz=sz) benchmark_symbols_all_at_once(n_pts = n_pts, sz=sz) #benchmark_draw_path_flags(n_pts = n_pts, sz=sz) # EOF enthought-chaco2-4.8.1.orig/examples/kiva/agg/sub_path.py0000644000175000017500000000172613233644505022375 0ustar varunvarunimport numpy from kiva import agg line_color = (0.0,0.0,0.0) fill_color = numpy.array((200.,184.,106.))/255. gc = agg.GraphicsContextArray((1600,1600)) gc.rect(30,30,1200,300) gc.set_fill_color(fill_color) gc.fill_path() gc.set_fill_color((0.,0.,0.,.4)) gc.translate_ctm(50,50) gc.move_to(10,10) gc.line_to(400,400) gc.move_to(410,10) gc.line_to(410,400) gc.line_to(710,400) gc.line_to(550,300) gc.line_to(710,200) gc.line_to(500,10) gc.close_path() gc.rect(750,10,390,390) gc.draw_path() gc.save("sub_path1.bmp") line_color = (0.0,0.0,0.0) fill_color = numpy.array((200.,184.,106.))/255. gc = agg.GraphicsContextArray((1600,1600)) gc.rect(30,30,1200,300) gc.set_fill_color(fill_color) gc.fill_path() gc.set_fill_color((0.,0.,0.,.4)) gc.translate_ctm(50,50) gc.move_to(10,10) gc.line_to(400,400) gc.move_to(410,10) gc.line_to(410,400) gc.line_to(710,400) gc.curve_to(550,300,710,200,500,10) gc.close_path() gc.rect(650,10,390,390) gc.fill_path() gc.save("sub_path2.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/simple2.py0000644000175000017500000000035213233644505022135 0ustar varunvarunfrom kiva import agg gc = agg.GraphicsContextArray((500,500)) gc.rect(100,100,300,300) gc.draw_path() gc.save("rect.bmp") # directly manipulate the underlying # Numeric array. gc.bmp_array[:100,:100] = 255 * .5 gc.save("rect2.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/image_LICENSE.txt0000644000175000017500000000064613233644505023203 0ustar varunvarun serengeti.jpg: Wikipedia; This image has been released into the public domain by its author, Rick marin. This applies worldwide.\ finger1.gif: Wikipedia; This work is in the public domain in the United States because it is a work of the United States Federal Government under the terms of Title 17, Chapter 1, Section 105 of the US Code. finger2.gif: Enthought modification of finger1.gif enthought-chaco2-4.8.1.orig/examples/kiva/agg/finger2.gif0000644000175000017500000016532713233644505022251 0ustar varunvarunGIF89aЁў       !#%*,& 28!.#, #4)6%:+<%3 *5 ,; '8 1>1> +62<#,-B.I,A2E9F5K:M4C 6J Y>R 5CR8E#ANAVD[I^BT EZ J] IVANCTFZJ\ESL\GWQ] FaLcNiMc Ke QfSlYnQf Tk Yn XdVq[t^yWp \s ^y WxNbNbOhReUkYnRdVjZmXe]s_y]rWqOpavc|i~`w c| i~ jwavd{have{i~r~IZ#IV$Td"[l"Xi'^r"]s*Qd(bu#ez"i~$fz*gy+hx2fБjДnЙfБ kД nЙ gИqЖsМyОqЖ rМ yО uТ{Ф|ЩvС {Ф ~Ъ fБkДnЙgАlГnКqЖsМyОpЗsМyНvС{Ф~ЩwСzУ~ЩmГ"mГ(qЖ#tМ#uЛ*vЛ){У#|У+yФ$xЛ6}Т4oГ2~ЛEВЫБЦ ГЫ ЗЪВЦГЬГЬЙЮЕЩЗТЛг Йд Фй Щ│ ЕбМдЖвЛдНйФлТеФлШкЩ▓в╖д╕ГЫ#КЭ#ВЦ,ГЫ*КЭ+ВХ$БО9ГФ4ЕЫ3ЛЬ3ДУ;МЬ:ЗЧ;СЬ+Лг#Мв,Иг%Се#Ул#Щн#Тж+Фк,Щл+Ь▓$Ь▓+Мв3Мб<Те2Цй7Ь▒5г╖(г╖6вп,п─,н┬БОCВОKДТCЙЧFЕРUУеBбоG│╟I!∙!■VCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 75, Smoothing = 0 ,Ё■эAъЖпр7n▀╢▌·о[╕m!ъУ8QW╕}с╛с ЗK7wъ┌ЭУMЪ┤s═а╡Уў╣xЁкU+W.Ю║qщ╘ЭлGЮ╡РъЮ1Sm▐C7-┌┤╟╘Р┘Ыfм╪Ф╚ДQ°Е3°╖ДЕRP┼К<м└┬ЖЦ(D <юр#@Є░ПBоаВ +tаBи@$Р=и┼ДPЬx =ЕR╠сеЧm`с$Ч@Є╞$·РeЙPЇ7cН;°└j)чo╠бЗ$saЕz╠сГПVXЙQьшдR╝!ЙP┤ $sЁr 5╛Xсу┼Ё▓ А▀й,АЮ∙╔С ■ лxз┬з▐н╖┌j└░hР└*Ё└Д·╨JБ▓PмГ╠┼pЁ0ГЕ>ь╚CбЦhR╨╔X┤1бm№gbгъJ!в*bYhГЄ(Д@Є╦oН,м└гNк░├ +ь└п╕PL)oBьЖ"╢ё$ХHв╟z8;f%С╝сFЮmp┘╞n0┼╝▌nщ2Э3ъ┴Л$Т°ЄЖ<шA 1ХъГС╨мИ√`┼$┬@"EЛЕъ!О8z*Д─№▓├н╗.pкzчЭ'л ш│╧@у аЎ╫жТ╖5къEАБC─аA0─■ЬK@сьАUT1Р-р╕aФ8оb N2РЇV°бКoЎ╨ЖЎ╨вН╚q`phс,ЙszHd=╢А0┬"┤~$┴?м0─0ь─╘bX1Е╦FQaЖ╓КЙ1/fЮ┼УLт╞Б\┬З╝u╪!"дчЦитАKИ█(/╛@bцЇХc 1э╛бH$Чh,ъТBв╚Ї;И`┼,│X1╟╬'K▒B_{@jГObА  c3└рЁoX[OЕ"рlР$№рAЁ┬ж`(╪бq@ЦрМ╢-TIE[иЛxЕ└їАГx░Д;ФA ■SЁ┴fрГ*@сBLАC)@СЗ*Ї ╢ЕG(hT°Oи@ЕBa 4hС╢f╨dH[┬XЁ╘@ a'8сЙQd┬ЙHDи@╚аBшzC#!▓31В╒╨Ж(таЕ U┴p8a╨╒Дp╒╨yYx╓Б─Ї^#}Т╕0▐@ЙQ№┬JлD2T▒E№┬y "A Z╓┴s;├ ю╫fLB <┴ЁАФНШ┼0А0m║р╞╓J<_K█┌О AЇА00BZ0!L!pыв┤%HAЫтЗё ╬■Г┬ Ц└1м L─ЁЬ╡h N\й@З:мб чB├°╕"╨акCш░Е.Na <И╥Л·╪G╟Е▒@└!┐h└*\ё ]PД*f║ИG`U└├MЫЕС╔б Qp╤SШтЭР┬EеI9╪ZbЦЗША;╚┴ Yш╣аp▒KXт`ХDШмрЖ_L┬ХЪ░DЪРЕ`╨В юT*▄ Кlн@1@┬ ─ _dт}>ррL┬v └ИщАєЁ#0└▌Я╡нкVи Hї═bUHЦn`─╚СЙDDб XР'фРE╕a@шJ■─(░╨░╘bБ4р'╕АЕ(░! vЁЭЪ,┤EЫP`6░@:ї┤╩ЙЎ2bй@Е#QbR<" WЪS7$b╓Пh'шАЖL( YшД)B┴Е(иL╜шE2ТбЙ74свd%E*ЪбИ5"5UЖМEГN╨by(─N@`БЪxV6 рkЛUмиLEM╡-`▄└жю-A ТgUфмА Ж.фZkОDa K<в@АЦo<сЙМыбиГ■Z╪,┴╜]╕Є╚R3ВYh╣$═-┤╝@`╕Ўf~s-д\@Б╢h═/d╤С╥р 4B dА╘р @'╞M▌Єв ▒]pШЁUр╤╜ПxoсN$т ┘m┬╪▀ЫИм6aчuЁ]│а└`Nt\└иTСМ╦uy]nT".▒ °RВХЛH3FQЄ&$B─и'x└Б ╨ахxf Б╚╢-T°xЁ╡9Вж_,┌`╠╔ае▓O┬░Ж.иЩYНo{уЫS╟╫ cЗяia╩Й+hA B>╘№И.°╛ў║|╗└Е-╠q╖╟╗йС■hj.8№ 7 Еd 6pb ХnBxЖJ#Э5Ё┬╥s6Dб Ь░┼'8ёЙPьVўY└П@ яхяEuTG}V|o' зfQ|│W░QP\└,cўgtН└``|Ца й└ 6#g╢ ═а К`{╢ йРr╗╓s0 (pk@╢P F╛в5Х╡zj#pчё ▀`z─$+Fv6f╙zАDаjАўWGYХkjзUcwWР\аЮ |jАqЁrq`|\ `▐~c╟-╟т╫┼З╟}rшЕдж{nш|╪│^Мps╪├~kА~▓■O└lрvў╫uv|№ў а ЮА йрЛР Ц@q╟r-ў"=ГИ& ╚' Rh5Tu╨ ┤5an╨ё4HКрZYРIК хP А╟╟│ Ш╨{WАЙ к` КРI c{W ,АyE hХе6з6 Ё5к▓ ▀@F&*Aвb6PMeєzї5hрrМа[q0|kИеO└╕`╢vm╟Y└O0х|r°rнfs-djзїvrm╗И/ўgowЬЁ^╖цjб░ ■╫j╗жЗы╒h╟'hR oG}╫ЖhM╟R`РqЁxY╒vW░■5╒Йж╞,▓EХ┤s`°v╦В"АгlМУY╨┐─ЛНА Л Ша=рй уА ┴`Z╬R ╗░Ш` ╖╤f Ы ╖╡Е4╨╨>0=А#░+№Ж6ф8└G&°╨ @MG&Д$+т8P6░@роР-hц ~╚╟\EfwАj╫{rш|"}Z╚брq0Gpиs$rзtW ╟С4px╓xФ│F м└ ╔ц}<ы╒rsQTА~}di╕52`QЕ╙t2.RТYЁЩр П0G■чh3Т]╝ш<[■`|╧▓Nюв@ к0 йЁ╠R" ┬А╜а4mP O∙ щЁ C#─ С░ ╤2й о ТА2╨i Б░A└=░О│░я┴zр─LP@чшQ6H&Д▓"+фЧ!╨$-░Т[ З$Й╗┼╣F~Т)}Й0 █зvnSбРkWPTПРЁ5Сл╨q╢╟Ю└ZHjYр║ЙQXЛY%Z▐gЗ=┼жЕыхЕQ└,oЗ\744@╦ХоP|╘с2K &МПЗ иvЬр_ф[╠rEЩЇК4и1""n@ У└ уа m░N■<Ё9РmЧ 2ТP f Х0 √2Д$ └@HA ТmР╨riАjр xаL` rр!√▓  ░LиgoАбdЧ╘Фd|┘б|ieР5pQ>чЕЧbesн9GZ@(└ ij6╟УР9QLр}R }Ф╨vYидоuКq╨ Э└[╧b{╧bf(rК'T]╨|s гiPh░SР]jтQ░hА\@╚К∙E[QPgЙ@ н└ `ЦI╧Є┐@ ч░╕ж}29ЛцуеTK6%Qад #TШ* й@>■q2XЁ╤╢d┬ яу(й@№B1Щ Ра■ДДй╗а кP`∙│и Р░2УPFАк pНаwAа*!|∙бу╕Ч╘D*Ё0тpjўп5 ~Шk4`ежhZЁ o╖i└G[дї k@i╨ ж∙kДtv0хЩЁZ№ДпжЙgеi(и`Vaq@gV`К╦B)▓"d$F■Ah Йt иfXхXх│Hq┴@ ─Р<у Х ╦Аbз)Б,╗СР Ъ╨ й@ ╡tМЙp&P в "s#QР.oа цР 1┬%чгФэщ=ЄВР@ з г▓╜р ╝╗rж┼0.КDэ ЗЫ■@ Pа л7Mу1@ Р1 ЕeS@EФ*дТ6@@РD#╙nЁгЩдNMнОшфвUF]ipZRidD8s.Q╜е╖∙╗д┤S░H│Мp ╞(ТGпш┐╧B+─#$#Ї/СR7ЇмбАB8Л└gfЇ█[KAЙY@1o░Ю√ Ы@mЗЄ,h6н╛жГфг0 ~JHёE']r@.W0#XР └ЁWoT╢Ы┐0┼[z %2┤▀ ╝ д "УV`╓ /2│дш=└ PрЇA6 Yра┌p Y╛■ є?мwzТU ░╒BЬqцq)Ж.Ж"√К╦Є┬}╞║Хr4└[D─9вvOє╩%\М╡Иfе╛├MP┴░И(P@TцєнR@U >a░#ац!─╡;W`пQрs┐к┴szIU╨оЬ` K╣Пq│HHhV═"S═╦"щВU╜г>╨GjўКЧ+gnРй└ hЄ▒Т Ц`ЪаUY╪7║C/! └╨ КР.Ф Ф ┴р [╨7n╨J╫╩ э▒d>╕pW▐А ░+ рLТ5╚К%Yєq╨╨Pр┐дuЙh7■ q &Ю░ !╓Ч│Uм"Э╘ =╓╚╡"╧ТPАNЁ-рw`FЁ'p!Г)CОs╙т █─Їбц°?Ж▄`F0Э0 ^шСР ^._]`рwНп▌э┐хBК╤QЄМЯ └G[ 1OНАдтeа░Р}*╨e┌к╥/тeР4a╬цmм0 ╜х+═]Ht\р■ ж└╩╟Рh к0)цkШєЦ@Мкр╣ЪР Ыа !&РтNф"МЪ░├└░ Ы▒bТtф ъRи Ъp╧Ч└Х`Е ┼ ╝` Тp&К░ °йз╬вЪЁ Ра.+J_щpPI4ЬМр S└8fdР0└n└э Ш ю ╨"└╪ашб╠дKО█P@╨о` ╓F┐Мэ┐╬T╦Т.c╖Ё╠Э_хКНT╠╚╟hкLЄ░ШI╡╚`ЮPВ╗&&МД:7╥tpwX :zч[Pa╤ъkAМ(2!aжMPЄзg╞RPЯ┼#▄"у= }й■.Мд 7 С╨╘фR╔3B╣н Ш к└▓"гдx╢`╥mЎ~ ,╗╬Та ╜░ ╥/М8я¤╙LJў2Zї┌V Ф╨╝i%чTм)4h╪░б├ ,X!В H╨А┴Ы╛Ё(└@Аp╥└ -╕xJ╙ ,]▄─щВ%JП%X:q╩тiT,Y▓`╤▓dI&KШ4irеKЧиМP═─r%КФ8мX┼Й%О);RЦ┤`╤в╟Nt░8Х┬)vE┴▓*Ш#,nfFi2е╩*Pеt╣╥$JФ%4hЇрACmР>жLi▓$ &Rj║■yє╞hЦ.R▓$"¤жС(,P░4щ╤K╠D]m┌Д ╒иDZ27qуИе`Ф┌ШЦtщп]╝"Iv ТЫDP┌╕iУJ╙е]ЪBS║$I╥Ы6mф@▓МТ&3ЦЁ╚bJ&D╨░╨EИ H\└Д└ В╕╔' F@УH2рАPБ ;▄XDгк╗bФг▄шВ│6:ёф OБB6Ъгb│xrJ1и║pдС6║h VF9┼O8бЙ=жш╚;Є0л▓├hКc&аh$ХjБТ &z@гРO╨╨b1жШ╕В PРБЗ'xАb xXвX`a■bЛ(┤hн (H\м/H(yг ╫h║IК6^У"СENS─ТE"┘MС+╪╚МНFZ)Ga┴ ТхФсI yТa~Й─PE╩KFL$щ░QE▐╕DU=U$Т, sпС,оаб№0P!З.ирА IБ°/}VbСHКpС─пXJД│КQ╨Лiщ┴и@Е|П|LyВ╨@Е╞╕З|FЛKЛдрЖFШ1Н:щ 1 E╕Б[гD+hЩК`й]ГВZ$■ЙE$вLЪQ╒H╘tЖЕРPДи|с HИ*m( Cc╞7Dт╞╪Е"&AК6Lb╗░ylй MиВЭиВСKlвOш└R└Б 0╤Р@$PБ` !√и▄В!(└Z█zИf└┐─DvЬИ┼(оУУ╠ }YH '┬ЕЬфдEPyВ2щиРМ)RАQ▐#─)AБЕфB@┴ае#ЬЮвFв╤`╠ЫAра╪<хNT`BJ;╔░@ЫС╟О╩╝╔и═\ВPAC8Mии*DГы╡aKлt─"4бЭqI┼iМ╨╤Ц ├■Дn·L1Ьfиц╨IЇвбR─%QML╝j╟yГx═╛Pй4ЕG5В +ш(0Б d└└@>@В `└╡с└ЗFЄ╨m=┤BhрА M,"P╣│-(▒┐┤л]╢;Щ)DA╓ЫРИ)JЙєД5жpX'├Щ&ЇФ Ь0Eв`╘╪\!цеЙO░╘Кu -LиB)FQ╤,╠╦7O0к"QАВя┘оmrВ╟*3%*аб=Х╣5 Е.\Зg@лek▄р в─/*,L╞2Т▒Й┌P╩ М X╗Д╕JЮ¤╙8Ж/╞Ў─#n│DнqЙ■MTв5mАnАбЙвсP╪iВQї╚ДД6аHэ4ЁБФАhА╝СPР Що JЧ ╧┘у─WМ·]╧u╙Йiа╓б╓╨e╤Н`^йИM$#ТК_т└ЙNЗmСХД1иБМcд╪╬8Fн0qМpf:СH┼/4 г╜aГ┬╨─L,цVд" ЩБ├J{╨В■И╔┼АV[ВI9  ╩аjEnИYС y 1=cX╤И+╝╬5qЁUVМЎGй╨0Sx╧эd8Ёm \hC,Ё┤У%tвUш hр%╜F,з`─а╨ЙF─Б3LЁ┴tZс,,B╙∙Zў ╝7 ИA x╪B╢@З*@Б'UиBC─ИDdМ[]№─№LiГ╝┤ Q°я4>Чы"2 T№KqЩД0жЙ]LS╝ЁE│ЛсЛb#W╛└Дt▐└╦IPЪЁB`$:┼,"Цh═Z'4╞ 0╪Ф] o а6"╪╪Ж│>вe8■╬q Ю╝fГ╧жХ┼]Ў8CRRми░!4zЁФ. z1═C Pр=я┴ M!SSз┬Е5╨А4╨#░╫Їд1 У┼)т Jи╟!ВRАdxK▄.P 6=xВи╗{5╘┴)30┤ю;┘╒Шmб TрКлуР17┤"тТ░TИД єЛI EXД╞zДGxа█HЖKxГQPёцХUБ_ИЖhР_шЕу╨ГJёДShГ╣╤ яЩСCЕ∙шБ7HLX╪"ВN║3xБ·А ╨АИБ&█ Xp└╤3}SeйРЙ╖)╨В▒ бЮё■ ┐Щ'GШ/0В7╚В╖у ФГУQK:IГ:абЫБxВ'Ёйж(С+FhEкjНX9ОсР/лГ▄Q╜8А │H#╓йЙйH9а-X?=ЇБ▒зPКШ∙/-и└XЮаЙгс!╣┤Fр9╪,Ё╣LHZшД░ K0ЖW╠┤XБДLIШ иQДLшjП7Ш&P┴;_Ш) 9Ш/CсДt1 (`БрБ(0╞JТВ 4KИД7аXяЙВ'8Б ЁА╪А °А°АФАа╤S╥ГhАgСАXЛ є:д,)Ь└&=щЎ■┬.p &┤и╕╣▐Е4XВНЫи'ш$hВ50пЬHГ9cБ%иЪIд`В№щШБ)╪ю∙DlЧшq ╞Р \У>N░У KЛ╕*═x%,╢rЛНaЮЫ║й%ЛЯXиuqГS8ЕYсЩlЖfhЕLРДD8ФпSe(H╪ псЕb╪ЕчИм║╗lJ!)ШДDPКы╕ВFx┤╞РВ╣╣еI╚EиЖr╚ДHЖFАНБ0┤ш╨ pнЁА╓rнu┤ИЖj(hYX └А╚╚Ж√ЩDЁЯв 8р"┬КмA ┘╔.°ЮЫУК2йУ■>╙В5xВг·╟x &X<╚ВGИГ&РБа[0xRдРВVВ┤ГBи-ЁрxГ.h:┌═+╚H"J =tМ▄dS*М+xZъВмY%JрЯV@Е[ЄХxёБ5D2┘(а;╨▀ЩзH╪ДK(жdв$kЄ a║ДчpГЪДЪжhАC!П_▄Q!ЖJшЩу║ЁTДFxГ\RY╥В├RЁ fтЄ<Б╪иИШ Ё╝pн}╨И%,=С@АИШАP*└0К(И /М ╒YеVТднУ ьiеъk.рВ▐уД.╡╠иВ:▓°Зс■ ЮУF╨ЩdВP╨╦╪x┤Dдц╔ГP░)Cc+┐а-аВ/┼Ы╪дБ3Щ╔Ы[К4°-░SаэЛвX%╝·0[а┘ q∙иг╠hЇi +`ДT@ЕE╚КЯЙ9ЖsрЄ╚JРЮБДFП^А^└ж╨╪Е*▒йДHшЕМДLг╣ZД.╚ДqXоQФHШP7А╬ УXд╪П ШАЗш< h(╔ Зo0 (=}├7fYЙаА╨5║Ир╚╝╥ ═ТН k┤2╔Вх$И NЁЫ8X7@M5н 'ъКМ%ШВз(XЙ ╙■ШБ:иTHДNj&╪╛хi:░p:`│By е└WЄеO╚ГыkВ;HQ:;H┤┬1 ╥ШНEpДL╨▄HU 4К&╨=№aДI0 ┐(ПFиД╗╝ж╬Н9 HЖg`Ш╗Hи╗░йДa ╕+PДЇ ЯСВMЗr┼РХIшз;ПY4#h╞Жи РL╒"┬И▓o╪ИxV|Sи САjЭБ)┘╓ЩЁB·$╪8 ┐`%T░Х┌ЁNПiF(Ю.ИТN(└pМkC И╫-H 3Q╣ЇAГ╞└H9р#,АМ4ВI6┴<▓щ дH■#QМ.HPHH-3СБў34Бх°єIBz ЭшМЬНLXЖrЕ╥И╨MаД<ЇБ*╪NЁ/№ ╫Е! ┐ лсЁОYмaр▒┴ДчPОM`Ж▒ MhvїМEшЯZъо.└M9шБрфеTpД8PдbЕИ x2(Л▓А·Жo0█g▌вyЬ╚Фи)┴8└├┴╣Й╓╪ПQёBпЩ Tр╓+╨РК.84ZВЛ─ГКД? XГ s ~ $.аВ?дВ╙AЕPИ6ЕU└ВXИ╔;б[╦┴╔Э╩`░Ы╙ВOИW@╪P ЩФБпїKмЪиШ╪d■ВгаЛЧYМ3ж┼И┬`ЖtyK║╕ОDЁЩqM%гiГ*▐О 4Ъ^тЕM`_(╒офT·фUUАT=Q`╚ДбЙ Ю╣ДaЕзАб`'JаГ╕Р ЁА═УGАвА}`╓-sиПXЙy ╪рвШхДF( (РГ░╬F╨▌&ъШзТ*СЮШКP(Юэb▌-H$б█╜)ЯOрД+hБ ╪p╣Вюa; юй)╚P@'Рa0Vи┌ок╫╣щ40Є)Oк╟А$ЬЛ)F<згЮ%ZАГ┴ д5▄QhДe╪]i░Щ└╓=¤!з■█Эп+  )ZR<иБ&EРофОkМм:VQДeЗсX,ЖTАPpГ ЖH`%;АГQPЕMэ pИ x▓0╟╚(Л■Н╚2I^Р╬∙*р,аI6╚К∙╔[╨Ё╘сxйЮк┌╞АВS0─(═рNa╟PУy┼а4░[╪В@╕ГVpД%PБц9ЕjшДрА'иЪщБ:ЭCК4╝N6бЩ:Sb╝-4&p+╨ь2╣RшВ3HгO└w0ЕеZЮг∙╔Ч╩Х 58╝$е└гfДSHў╪КH0aШ+PД■ghмKx\mUшн╨XД▐╪бДD@ЕaшЛS░мH БёEX0И╬╙8В#°╔Дpр_╡═▓╞\РИАВ*╚O└К}┘ _┴7xД┼р╪ЎЫG╕ ═тБ.XS\е╨В:HГvЩc ▌SЭRH$.ЁZ~¤о█ыаВ:Ш0FкWаГ>`УДщ3▐о:║М╖ M╥$*─ГыA· ┐РЭaД ЭKЁn;и╫юЙКг▒`Hш<\├%шN)░ЩеBЕ┤┴╫+p0vЪPSМ1╥Ц7Ha ╕_qКпєЯёKXЗQш3,╚■ДX¤>C∙)рБH├╘В#Б№ХpрЖЗ`щiLhY °Б;╚ЮS8 ╧шNGhЕVиеї ┼0К.Ш╨йрqЙЎ╤DД y∙ жш■╥5%uВ╚XK├=&аs)РсЛь0Эа+`Ш╚И╨P╕5xУ╪pS(Д!╛╣№ZВ4HWp5X╚кb╖┤╨=ЧЭСcAYрAё║¤!Е┴ЕS cъЛE░ЮT╕ЮTдЛЬ0O░.`0BХ╛(hГHfxэRЙK└Д░!JP3т╒yTиё|эUbЖSаПyЯ3Жp{╦ь1Е408ИГ╪Б#■ИБ╠;oр╡аd╬СГ<шВF╕ I╔ЪL░уZJcЪ╦ШXm ▓еЭ╤ё|э.М╠╨CЩ|В┘Б б║ВGр3AЇ┼ВxчD·H@эГНЁ╦МмEтБ*шkFt·f<█Y ╒¤5xВ#О┐Й║)Pй┘Э(vыкхQ┴╩h╝о:(3ш+рQ0ЕjАь┘3`J╨]aВ¤jВPўs;0Г╘Я╤RPу╥▐`ИgHPU HёпAёL`╕▌гVИЕ-рЇE╪ЕM╕q╝ЁДPД╪ ╨ XБ3°$н ╚ЖpXLЖj█РА0Г■: DqДэ&▀TДGИЙqaбЯ╬Eйе4ыF└ЙODM╞╗У-QКе╚x-Г(╪┐1╫PX╕.рБE▓y7√▄ЪЕZрД│f ╪д&`ш└ГZ8ЕЖщъ╚]j#|╟pМ°├'ШТz%$я╤╜юAыV┐ь!ЁШCГ; Д0╓БХ`g╦ЕU пYДTЁД.ИKоdщв(╤6MP5k)КФ7С"IJi╤%^СQ╥╔═ХHЪe╔вHU&JСдЇрqeФ╢QQh0╔bйеFXШЇАт Ц6p└а╤Я4d ╖@АВ0`р└В+кDI■┤╚НEЛ%╩вщьвH&▒▌ишQЧEФHvБ%Ч+qxЧ]8В \M\СИ#Ы\сЙH▓IДY╝▒╚&ЧXТИ"СdI2╜`вHX^DЙЙиr╨3┤╨&╩и 6нdВК"L┤@├W<с■Op░┴+Ь1F<МN8 АpА -░╨Вq╦)BY^%т╞эОВJ*)═╒╞ФфTЧи╕aG#`uБ╬о╞╤е╢▒\лМТ┼t]HБE<їЁ╔X\иE&й─╤Г╝4╝╩В!K,Q┤ /U╚ЛEиМ"┼-9!─ BxсhLСЗ+│╨AЗ_=<┌Cм╘∙аsЭt"#н0в╙<Ь@mtЕ_m┤B ╣!'rЁ└Д~н$rW'╛ёЖЫ▄╜ёМ&РD╥ы-{Ї▒Ть┬╦0Рl"Й%ЦHтЖЧХ;b30N╩)аtЕIКУНЕ┬╤■К-Mа0Б }иaЗц╘h@T▄+Х▄╨В <╘a╧Пd╥╚шЦzЕaЕХ╩╟ФРвИr9wСЕЛ(вSтPб╩-в.Q`Д)<┴EDс шКC└уГSмB РЪ┴IС@!╒@&Ё1рбa,шJСяpтvXВj6└В °┴ e@C╨`.8ъ _[═ xтГE1К,▐▀░ Е.Р╠lгрD+ЧЙVГ╦A█═j6КQ4Б4А#▓└OМв QhГ░`ЕИC┼шE$ A2HToPДБ.╤Лe▄)█║%▐pЕ╩╡ЭX╘┌`;t■r▌AE0бЬ(`C,^AГ h`W╦Й╞7м┬АQ*аG├А:└В)l QSл▄Р С%╦8К└┬юxGa╜aЛ}Уw*ЧКQ▄ТшУ ║╨(┤Aга"ШИКF┤A ╒СB' ▒в4"нР┬╫├КXa)pуAdшГ<Ат;T╕ ZаtKи(и╨|mE║Rе 27eм%@BЬ@Е&ЇфflQДХ╪?`,IЩ█∙"┴ O\сVM╚В#&МшH┴ўГ─▐└ЛbЁвеwДДВ┬rЙpїв╤ЁЕ$F U,щKзаDtf└)Мb■УpCvz@ `H-M,H┴d╥x (V4╕0 рQJ╣ `рGTЁN╟·Qтhj┬╟┌ ГрьcbТчr9 ·ЕiЗPXцrЪ╨N└A mpCI╤ E╪е y╪Щтf╨Иj4В 'h6GЕЗЁ╚аX╨ b╡\Ц cВ*ГP*╨j3hOx,Ё╡Ўр 9╕ФBИ*a S┤?/╟eФhErУ╝FЬ^dAкQN@ЖRL'8╠a├ Ж$д ЙЩюОТиD#q L@╛└Д1vС v╜┴ятЙбИ8°а■╡Ъ╦┘fЕQ`kГ)┬ .АВ┼ар└АzАnpп`@┼J┘АмtN╪В`Р╞JМВHКу`░ЁЖ▓У UШВ=шАд&╖ро░р 4Ё┌ n[Шxа▒@═`<-`Вш5`,"b╔Д Ц┼ЕXq!НcJDsha ╝VЛ$╔re_БКЫЬиC║└и(0с░m°ы~ёЛ^@В╗А─.2 I(B╬РЖEюи_ьBй└Щ.Aб┤═┴Щm■H\Ъ V0╫ ┴─#┤ЁГ@u┴л┴v└Гz╘hдмЁЖБШ! h~%sjжD░TH р"K$6 Дlо<Ъq▐Рм,LK ВБuаа╚ж vq├)ёЖrВ g>AЪЦ)t`NИЦ=3оM┴7AА╨yВб*Ё:A&A╜R┴T0Г0!]╚─84б UМC_QЮ*PбКj`Гd\Eа░ЬЦp НвГyF!88, ╔Т▌┤3с╒MM╚L╒S ^HвъюэЕ0ШётD$├╔╕Д║▀░ЛbГrV└*PБ╣НP■wnЙz╘ЗЪ°DКРJ╬р0АБx╡n$ ├ рЮ v┤ БP#gm·ьм°┴║9^┘D2ФСМoХ▒8;lЦ┬WБ >0ЦЙ╡╠b1╟ F[ВфА[╧Ё  мБ ~А┴РLаЕ7ГRБё:┴aыtcр┴x 5БД!╔┤h─Mq ┬BБK;ю3┤Р(─ВФ :hацЄёр╡√c─й═╠e.14HY╩ДЬ]o`цXE╕С2l┬╔"XВ/@┬еM╚%\B╖e╞)pB_Н"dВ#xM$|K▓LЙ'| L╒■╘ ь ┤@uTC8`┼(aШШ└Н`@ Биll^╠└ ┼┴ОaБ` ▒Е&| ╔\Оq0┬$4В'шD▄МЦU┴ваPTБp┬PН▒╪Е│°Еh┴Ї p┬╘t└ B-╨B╨А*┼-╪B9╡@hA┤@ААКY█ L=qКВ,└-М╬X╟e,┴e5┴Ш╓Р%m╠kїEl╨A▒PН╟-D┴НМШДЯ╚┴┘ЁЙDDvё╪IБX/░┌L∙/Г0lВ"░A"XВ1ЇB%T┬МЙю╕0A'Р#┤─`A■*T├2jЗ╗├ЛЖ5ЖlаXАи└▄Г7,W)@pП│5@Ь h@@MAТ┴БPmБь mБ┼&ЇВ}┘YXXNЕ0B5ЁZrTЛ}╟бT─Б─B(`A┌°└ОYь_#╡└мPPHV-╚┬ hTN#\Y№M8XЁMь@  АЬ╚%TфБАВЧ@ЖР мЖkб┴и┴dGuthGтР╚1JБ|_Ш\┴_]AX╔хЖ_H^ф╓mAЕш[╗Д╦╛A@B1├.рN╒▌bьи┼V┬$Ае"ФЧ:░ВwhA╡х0b╖т╩╧B%╕Д▓\ sЁO@F, __s@ВFB%ЇBM}MЭE№ %№В*├╧ШNtB№ЎТ║БиА hA▓▓БaТ-┤н2¤,XьУ▓З─АР╒ ├6@HЕ■8@ПH@╝@┤Дkї─+Aд@T╚(xG(d'LBЦЕv╟2╡ ўЄД╥`ЗnBХt┴щU`#TЙН╤&Fj)─┬РБФdpdМеЄї┴╞N╬й▄B-╘Б*ёАРAид$рAx* \ЦpЇ Ь@╞Р┴ ВиБиТ▄,╝Ву└┬ЎЧ@р╠■p 0,├(Ldw╕┴(мbЩШ┌{dЖzi┬%T]л>э╟Р)XDОB+TB $РВ0╠Бg Ь)╪фНС#t╤|B|Ї' (F3ъж └-<ЖьАhА CН└H@ А■Ё AЇpц╞2^5A─╧AОl √&┌═Шt^ЕtB)lдrФ,CИP╜ОXI<ВЇ DБМaЁ╢@фБ╞┤@(Фр!\,\┘─┘аSз8AЙ▄▄┴+фИXз ═ь└R┤АAУнF Ё╩╙дРчЦ +А─2F"dВJ;B@╬╤+ШДУцМDlB╘╢Ч/├bЧЬВ1Є@?VВ"XБАE3|─Щ-PЧB░|a┌>їн▄▀АВ░A-g╘┴▌XБ<]├7└Th0\0T`└╪└ СП╨A,ф■AЎАЁП'<Э▐Ї╤═ЯНf№°ЇбСMЬB,ь,jюВ 2" До1B.5B·С\s<1зL┴RЖё ─C∙╫(РC░└ ╠└╗VБp8┴┤Я═АlA-╨A|Ц p└ юeСП<∙∙асN╬╙░1srJO4уФХ├8\  x╔■\р-╡З}tA'p┴Жт▀|юШи╫N_Bищ3╕┴$LЁ@у№0№┬  U%├0░B├hБ! ╚M4БB╚╚BдMДspfF┐mAn^8ДТ АНц°mАА ─@ аИacXnapAТ╕ЮC>╝■EAчН,┌4БРЙВ+е═╤╪┴4Ж╝Й$╕▌W\┌(\Оr╪oLрфJ╠А┬цx░B'h ╘A8kLo5єфПV7Ьjt╥ lд%═F-─h┴ЦL╦CnuvCmш╝tВ∙]2w╖Dб└┴╚╖+д┴a▐Я W Г$ЧМ"`┬╪%Г▒╠ЇE╠дВ$NqLB*ИB)ЬЮTВ&PB╕ўN╝5З'pВUF╞ ╕эФ+XГАФїН°А|└°ШзHJ'dGAкd▄Rs┤┤РQBE3╥ ЩEA╘A+╣╥╙╣ 0G■hБ~─t╪Б)XIўэr╔Аh└В+,┴│єku '╨ВsЭPd'#╛гtP)ДВИЬ@iktгPв°ELЫ НС-мВйМВ(░┬*ФЫ└Ыg╩@─П\ф*▒hЩI┴5─Bв▀_T├rцDBA#T3ь╬╢HB/ЁВБ K╗FТLЛgbЬ(ЬBE─-╛БХоi)└фd+X├(ЛS┌Єе═н°Ад─X░зOWY┼`B▀жD!}°ЕЧ|! $ H`+(ВS2╔Ю╪N4Ц└OМУx:╦█=В#\A3ЮJ╓╡'─Б Д@░БhA└ЪйИ 9 ╟╬д Є╕Р╪╚╢0┴plAXБ╣ўPш#c┘Mх0Гx#╓`&шbыЬ+░чt┴4╖ИB0Г╡Б$@├20ЬOшаН├√╕*Ї[ж╚АoXG<фmфTЇm\EH└╠└рж|╔@xGЩ'▌Т,YIJФЕI└▀╬\x{ фД 0В№UD─L╩fБ@x@Ёа!E з%&и`┬╔П -╕М┬┬в╔кBNZЇ@е■ KЛ3ЦHбcgФЫ&5lшpbр"f└]Ycf═Ч'b─Ё╨)Г┼ 4Ш╠Ш╤#'FН<СU Ый8МP)rГ┼═T,r┌└┴еЕК╙Ы0rуиъ▓`Л2╡uгиQгйhЩ`┘eK&LаP═"е &Й▄мТcЗФР[yиасФ В╚1╡дГ■1┤бб(LЩВвh┼С8`БЛUVЙE8Nъ`zШ┬7F╔dС,аhЕ╛И@^ё"5zМЕЦ0пУSдш (в`─O8дEE▐Hд &zhG8ь▓&┤рДУ5о0лЙ▓hXВкк┬kТT┴BСHx╤─ (мpCF║hВК-╝%(└├─e(╣К.▐h xш┴ V∙. ўьх а╪P│WюШмЕt╢imАbгMXАВИhБК)Ц╚, F╬bbЙ=IDС,Q%ШL┴т <IдЛ(NН"О-|ив(дшb*╔·d"ЛQ│■ИЛP│И▓E)тшб?!r▒еУ8hФjоhб Цhб)FщДN`┬VNйгЗ*и╖Е)\с╞7дX"$7ъ@бЕX8с /PрЕ[@с`^ФВЛNр╬&о@k╣D,QЕйа╨I QNб%8xРБ,F╢HФ FЙ▓Й╩┘* HxQд |∙ЕТ(КlCFьИ#пFк╔FФ6░╕дe6┴d╝.Ї[OК7Fiд В|╚МУК═·Й <ъЁAИ▓ЙTБ┘hMР@ `@┬Л5ИlВ╕-Ъ╨w р8ё$╔U6iлЛDщrP7vХМ ░Иc7■ЫhС7ЪЕтК░xCX)ШШ[р8AГ╥ИЕ:`A O░░ iQИ┬Px8!b7NёДУ-z@├ЗNhB),у┴&╢ивЗцЙЕPР0бhшA qYа┴АЧEОн~2ы E4Q%ХТЄ═B9f┤cЙ*╟b╣н,ёфлсR4┴ЛM@"E"2 <№@=шDZ╘┴ ЮEtwЇi nHE#ЦpВ°Б-`├d╨ 'Ис _гB>бNд▒Е,@Б.T ZhС╛zpЕк\A Xа─╞┴К1щ НЦ 0bЭ8a ╕dR(bРh%ЖбEDб >SЛ║░ iд >их╞▄р╜+DВЬЩ-NA 9╕A!─╥Шt6 ШMx┬╖Д 6x|г╬╢АK5 # :Яhб 4ЁД■)ЪАб%АD ЦQz"сбcйъ Si;CQЕ>¤дДН(Й▓╕ T─a ЬУ\IР9<`$]┤  4└!BСГ,h╨:Lб╨D!КЗq└║√:8ЁGD°Б:0 &Pс УyВ╘04x`ш8!Л<ф░╕╨А-0AbБ╦─л"мў]ЖH_1)#╪@Г"▓,Q╚Bн 742д╪Jx ёЖ.EF иРь#0aМE6<%\E2▒ ^i║&БЁшkeЬH0▒г╔@ Ж@┌╬жФ"H ║f-\A╕┴ v╘а e┬ .╨Бснф╕╕Л;к*pЫXЖ&╚уR,╫┤hщ┬#BaЛGах О°+║ЇЖ_lБ╢$%РЎH№H*XИ0ОaМ]HYxГНLсфv╬▒╬V>ъдї╥ =& ЦРИGаiJ\Ш м`╓фЦ7l@n╕Б┤@╫KHГД╙NЇ@Я\C╠▓■№IGЪnа─бKЗ,pbе^Ц,╠╔▓ШS─Єи @]Е*гр┬ (└Vc ┘кГ)с■j@UHxTа!▄б┬╓ ░0Л[вu,А|╗╚R╨в▌эA `а╚ф 5x jЁВ5и hШ┬ирИuО+ю╩DfМ#op)▐@Хї╜A2lрD9l╤┤(B┐и╒┐б7№В°ТB$~Q It■ ╗0╞1.!EX"ФИь`OШЕВФ`Kх нИ═NB"]ж▐V╞ИPtВЦ°j╟╚K^ЄLt0PP@S═╩IУYГ╢/■┤4ВМ╡Ь z╞УЩ8ь┐vш┴┴CрД и"H(бХ┤ тАHA*б Tb zЗA┬└Ш#wtg l!hр:` lб╨АЙ Мвб`рсЖр╩` и ╨лБ t^а┴:рМ(ПX иА ╨ dсЬрyЙ@-AU2AcсЦЄВ╝Za(бn$╕рF╝E╩сMЗЄ└]8@Ё`Мо├иА Dбк└#f└▐с| b╨аXБ ь Ь@.О. ^бюршАЛДI :╨#HсЦбF╬cВa+BхгXс ║/!%┴╟"┴ЁхfHa`B▓.сЬ!.!оGXсj╕`0*┴=┌р}т@▓Xп(бдаЖ░,Н" вa└■b#╖P7rш┬@ те|Ъ├Ц╢`F ▐g|Є xчV$г╢ X к ■Ша3а@-&M╬g}ъ` жА ▄`Ъ!@фda ·├<┴ФtЗP┴!OСZа BЁ8Zр Fса└╗( ╪е╕АT`╥nh ─@ a h` ─Єир╕Ё└8&#`2by─амЁжHЁД▐Д┼ КO)L┬Ыи░pЕааjж X"a~Б1t╞Ща@ДA"┴g aас┴┌@Ис╥║ищБ-[%'ўцг╪тKАШAМD╞:Г Ёч▓@X(A.■ дAZ├5J.а$TФа╓,ЧА╛├,в` ВЙdА :AокиH╢Рq ~h┼таЄ└и└ иВЮp*(#4a▌ZD.-aв@\ибр с8:Ао@╥ ▒акА║h ╡а(а"З фгь└@"`О┬`pмhx`вXBJ┤А8┴╬рл┌:@Z└╨└|IЙкш ▐ HсЦ▐а ═2БyЖ ╨л*И *сG:JЖфr8БhАсВ▓ ╡АuRбт(├╡╛$^Ж░A 4 bZaА [▓аV┴Vмrqвf` Lб0Д┤ДФа└д`4рHlир№└╛аX[:f ,Й'PАIвитДОt└╠о~aмшД▓АК║`иcсXкгрАO>jЄ┼F▐`FdgПrЄ (бOЩ`P┌ ╞┴j└у▒ЦкмДкь ЦбCnT*╚cb■с/║@ZБ^ы╡╪А и@ ┌@д└°┴$ЕJ5m$АА@ ЬаЯ└]┤ Ё H&{tо:┴fўFЦV,╤Z Ц╚sЁЖ2KЪ║ДI▐ 6 tЇcV%▒h3HБ&юZ TА░аY{CИЗи└38А jБ ,Й?╤аr║╘ и`-А& _┴ь@ ╝а_Y╡ fаъ&Ц─OА$ ╢р┬@(└U X&бVИC* xдr$B ┤l|р}R▓s&Б$с $БЖ!M┘ tд`оц hТ║╘ф@ ▓ц с г a■PAX!q║└b,Ў x └ыRE_╕мfkoЄa` └jа"@bр╝dаь`Б h`9┴Р╟J╘В╘,GU╪йDбДhУUЁ% рА ЄВUэ ░└"AЪ:В(оАИW"°+ hбЬz▓Аде╞ КХ╣4н<В▄рATН:!З#└╕┤ `сМаДАHPАU_└9]┬Q Ь@ ь└т ╥аjб ийdhАД MЦL(-й├Ї$3:╟fg:(2Гб . pяRлHсjБЇ╕╥Д▓зра ┤ Xж■HмdкA╡Ц@1▀аrИўОЗШlAВ╔zр ╡дa`Х `J╡('аЛбC╞Л∙X2crh┴N|ОЮ╦Д▐ЗЦЄт ▓`X$'AЙKЕYШБЬжIГFWд ░рJб_Uк[Pаг|вd!∙b┴l╒·о{дьу░ав`&Аь╡Дк└`ВАat[f9Лц`.АЦ▒а ╞kjбjбшx║З Є╨jEV\FY·э+м┘ ╥╢ЛЦГ@╟Ц4сG┌@▐(┴ЫИa┬гr ЪЧ м+rцG.QArЄ|ииб2О9МД<бг■ж"<┴Tсоп м└ x@╛aХiHА* 6%% TH╚Ч╩C┬c]:сЛFМ╘gcнДю$vФE+╣▓z┘,В┼1Tб*БjX┴ ┤сf! rК XБ b`xр <╗╘`jБbNсa╢└╕в ъ шаYА FFE4Na0YNRг_-рRА!r┴└└ |'~b╠├и\A╓╢кЬr эЦб$<╟TX┤Ў/2╛BFA9jмd╦г VЎ╥ЇЦО╡д└ аiБъ╖*XкМlДFa┘9`║Аюр8АраK║#tm@р╘`d┴·3{hа{@tb ╢рrкL¤XnСz▌D!"TNе*мcXBd9RADA а@e7с2мЬ╩[1лd╦ЫК▓К─S3├дТеЖ6жй"х%╞╖Еq<сACEтo▒J▓`Вaь└а■+T┘А6ф√rГ.`TЄ ║ мF ╠i┬еиА+▀w4a│z╔(╪2┤ t$Л*в┼А0╨Ої░6жLУ┴╞Б┬Eъфа8` @ж└рО ╞ъ~wOаJб p└╓`rж э╓рA @aj`fа !сА@>ю¤Йч_ ╞l¤х]╓j ИДU{еy░АЇД╔НE%┬nHМ:Rб `НжCИ 4Zl─Р}I*ДяLЫї QбbsЪХ^ё╖╘h┴Кф(VБе8ч2lД кАBКфВ& tВ╠Б`TЭ┌6 @КаT`■─р─а кает└:Б ~xИ|╟$Км^гO_fкHLиДв└VЩ@╠т╤#EXаD┴Т%KЧE╞0mJФенQ<:┤Р'LЛUЦ╠рсfЩ#&=Z╨рrн ╕╝Л┼дEЗ%г\∙ЁГhE P:Эк2ЛMШа`A%НШ%2fмqеЖ)П Az0Йв╦Х-аlq┬ДN(SМдHЙуFJУ&n▄@┴╥ 7Р)║╥#0fдЪЁИ"зС4░░Єе Ф╢ЩP╣щВEQлQQв0К╙%JУ6h▒ЇhBjвФ┼мhuВBcЙNWx`Фїк ЫD]9вS┼З■┬t0` АЁрTиш!K>Ш╠ШбеО-P|ЇШ┴ВП╖jQz╙Е )ZрdБBТЗk7Yф·Xr╡mЦDR░╚qГEJЧ7КМ-▓Ф╚#ЩдrЕ <Д2 +∙AИLL,▓КQ,ЇPb'X0Cvt"v3╚їD╕аA tDQUy─Ьh! 3╨А /╨0ЕL╨ CF╤OnЬ┬JK┤`ТO─с╔)Вu!┼=Д┼eи▒еI/кdAГ└(ГК╠╡╤K╨Е)гр'┼]x╥К`Ё9╥ %НTPoqВШUnМG=ЬхIа<,1Z ╣С╠аcАbGК┼ЖНlDn─ХЯЩX"yК░вMHRXK-R q\1░%d┴БЩ#ТЕЕЛiЕ'v░Cv┤ДNШ& К"Пf╨8└!QвA░║╨■Д+hб$;░В╓┴П▒ij8PAf -М vр┬╨ Щto NШ┬ьuи?5ВMрBV0╢╖d ═1И:┴EдbНа%h╒QР"RX─Т┴╪ \рЁpЛЬ@ чP :\ив skVAЬр xиГT└Б└┴ rР (@ ! шaю*P@%GbC╥Ё <д!l┴4аБ<иB'8сЖ(мMMР`'Р=ЄСА╠S И└ОЁБv гаД#░└н╢w Ца╓ёА їсB)тPРўT╔ОH x╨В4'ЛpГа6ЙE╝qRИВвРTP"LnHEx0 haМ8┴|PЗК╠ ┤И├Jy@K.░@K░XR9└В-▄a н2Csкt Z0bWДY+ h░Ж'╠АШOР▐ZШ`ЭLA /dБ─з]8╨┬pА┼фр┐╢И╔5qаE0▐ ()и"Кp▒╕┴ *p@3`┬>г╨■ ▒dафNTо їйLAю═аp╕цvNЛB*╩ юХ"─T╠(дA Nо JHПm$8и'■АшСh╚В#F╤Г~D ▓phА= Ч┘ж╪цgqК▐Ю╟: #╝╗╢─aЧUJ╓░BWИ4┴╖M°дЙф╨l└▒р┴q╤ ,tАехXў╠0ЛZШB┐QшДЁ@╔Ьем└FД{AП╥ 3@┴ .|л&исЕш└вирbЭZзИp(╘/=╪VTЩ%ЛC+4СИБIYЙ(╔!T}╒Л▒юA,>┴ P╚р┼дЬZр└Й╠ZE■JоюК':%╟в[ЁAИ▀┬Д.T╟ykбВ░╗ВЁр·Рз>.╧ D@0x╬МXЩ&┤6[ИГ└ФДР L└ кPЗ:dvhPHD+ Uь■q╫ыAр└G╣i-xбБ81ЯD╚3,╪┴ЄЖ|Rс0sУB*╩╤ ЁАК╕Тf╤КФuаХ╫X 4└Би` BuB╚Г ░р5╨уrбааьюъ~?аА╢3%Qдм┌м═G:вБйИД"P╤═.ЖsКp6'╞▒ G4сSе(╛Xр╓-pK 0▐B╥П╓И7┤Vy╪Q ЇД▄─с■ж@MOЮЫ]щiГbjТiЁДШХ;hэ3Ў[╘╣╬Эr Hy.╘!&еМ░*ГЕ-╕xз?{b╔2f&*гwM#dлЮ\.П││─зС╠%АaOаBдNTРwр B wBРл ╟с═─TН6▓у $#"[А [└╒╞f└╓╙AЁ│жB└O`=FЦаUа[@tАо└ ГЁ>Эа ж0,T% ф ЧЎ,/єJЙ╨ у└жКР╧OЇK,╨uP&!$CЎ▒╗Wрb-@wy░*█1╫╒■%# жт'|>АеPV`:╥4`IuШша 0OЬВ `ЯD;(QKжP Э zтbЯa*M др╛e&4╨ZU Pb*P└Э ДEб0 i└WА щжЗ@└╟у&]╨┘еа+╒NPj└3╨зp oTжP=░=┴2yP+╤=fpH0°;5(YUp`░PwPNоw2v@F▒гН╨T ;jP]-└<аM╫q╟\V░╨!+rwп┬=l5"('IRж+╡f`Е1 Ц╪W╤Й ЙPКтСqfЧ9й` hа(ЄуOїт!+TЦhв@ йрЬФ@uр■Q0 Н╙c░ ╦сtаУ`8e╦<ё0,╖*2ўО ╡р с!%_0А▒аФ %rА ж░▓S▓░█Cx ╨░Ёk-P ░0V═*a█aM]╨Фр ╦СHАj0cPйе`тhЁЪ┘ёv1еГФ@∙f└LР ЪР│┴єRРхPг░Уп[░sCл╨3╚E▒@ Ц СЖ4p╗ДZёL┴pQ■$Б▓t^юсA▄XZu▄DCnСPUPЗ j ╡╓ mPH╠g 'З░а°tT I'0\Р█B) c@ы╣6╪ЮТ#'╗в/TpK)~kа╨ VкJ2╨W└nqа}▌ Ч#з▄X`жF╥Rз <](┘!мr┘X@ >╨х└∙╘\ *nYМЬ0P"[@$ з(OPI=╘*+~P░б.$ч┼░X 7нBR╨r!T╫!CЙytda0░┴╠v к`s ТB3°!Q^%ЪеЭ]░ й╗+ў╟ кD~0 sАЗ■З╥6IЩРG8┐l└кНАJ■*╨ @[ЧрD@/╨=ZааHЮrг3Е ╟(0ДсПуеNрg tаСRтUЁrЪ┼6N┘7R└b[` Щ@дР╤┼t х└Q╪P AJ╧╘.КюP┌ёЭ0 xp` о·kp █';√Rh %тH╨l│Цл∙$+0}─Цер>PbдIClE НР╜}пЄPгBPueEr╙xєсЦ╗^╚┤>WВq░Р·aУ=Ё╒P v %Pр╒Ё[]╨▒`&убНXР╥АЗ┤■Ф█4╪Ж5,q0└Щ·pWgЁ6@.░Ц \птCyА╕ЖЗ╞r└ eR╗Bc▐НДНG╟Н╫Uзр lBЮуoр-Ьiм╨ў├jлгэ:z╓цЮРT= w07< r/?╩kL>Рп/'А_х┘*`x>ЕHб╘ИДЮхt8╓4Є▓3`░@Ышє╔wвЙ\∙ВЪЭР▒ёR[айTp@Ь!tж╨ =vПf2(Ь nдФ#qXА f"Щ@ ═еПm"г%йё(mЁД$Ьл·╘y╕лebz■uж P|Pm"╟▄╤AFъб'w╞q7(╓T▒1В╥*▄▄╙> #╗Rp┐СтжНM`Bt└IQР╜` Yа ╒Ё<SQЁ"ш╕ ╪%▓╨WиG ╟x╥ЮP, ▒0зт2Д╒Ам30ч(/А-╪#АЛ$°┬бдх3sув"PtрgК╨с╦ш╜ ЕВХ"Sщ▌│Эа?ЁЩА R╢0e╠Х│Wa?.г╢GТDiWрЪ░╩В┤H х░╩J┤Аi Ф┬J▒` \┌┴A┼)╕@O `C@цp№Т6P ■\KP4▄D*кi╫ДТ4B╘o╤] а0*У╨Х.╢A╪ iw$о> ╢E╩шгр'@`X╚╚w` ZЁxP ║=жА ■┬УCV╔ёG'иЫnнD╫tрPApC▀фOД─ pрv╡S;╒!/ q╨Кт▒\Ф`юОНВж▓ }К┘в*Qn░ ЫЁ╜цФPу%єJmтOW└\бYKдt9H>░LА╟m╤л@Ekb╞уБЭ╨b╠С╢Ё тлVа▓mP(O &АкF╨№Wо·врXfQТ/Z■` пДKз┘m Gэ ТеБp╖2(s1 УСS-а!зєЪХ╧Ц nРO=└jX с*Аk0Б<АJелжP ┐D┤А-0

ж0Б┬гE;▒:5б┴ДR2E]▓(╩Ф╩M,в8AY%ОЫ(▌`Б╥CК'[з▓DщтF УQ<5т E Oq┤,сAuЙ+Gi╚ш┴ф *U|°ШЇЭ╛0AB.@hPAГ╞Й■b@╤ЙеI.Ч┤сT*╬Т=№bдB ┼4░0jtКUгЮMЪpЄ4jTв.3Z@щ$кSФQ░Pъе Ш,кШК╒у─ \жЬша╖I P╢мё┴B2з%NPё╘EEXb┴Щ!у +,="ўШB%'У▒[ЬЁ!цNИбР8в┤kс X\сбГЪР┬ 7!Е)&ЄQ уауЙ┤╪b4й╧р╕илNфpC0~ ░ &f└вJ6┘DСЮкРгNа!ОQЄ`Б╬ЫБ╠RьЁA╣^·Ф PNS. 7BYВГшрO.^)D ЁT╕ р(И@Г Zт<;аШб╝0ДhБЗ(DщбГВ0#КQ(iвЗ1x`Б 7┴ВздB 9╞hA&▄Pф EXPБ┘M╣В Eкy)К8К-4 O▄рш&)xш TR╩зF№УвУСъa ;ърВGО5ЕЛk╖в┴5"`ю┌БиЗЙ&:м`E╒ГE`Bn░Д2RС│`▄MЙ┴╞├8`a╦ Е╞╘В:ШВ└)Г+КsP┴]X╚.вZ\Г ;TО╝Е*аa ^ ┬N@ y┬U8КДЦF4eА |АEh░,XшрЙL`" XА├жЁУ6tп*4й^ШРЕеп лаЕ(ВЕ8`б&┬Л├ў░0КSl. |ъМ╫У╔/■GБJ,DБЁ$и Ra├R╟ЖзЁдт╪GрЦ ▄я ┤АN Г■0a DКМЗВ1Оj╞РnXD+PсюUз!2XB#haКPд#>РB╞Жиа>hГ*XaКyEБ╦PE2ШyЙл ct`┴ Ш└Е┬'КQpф@Е└ъh╬ j 8О4╡АB └Sз-PсэТш░КF╕Б q`ШрPЕ╠ё#S├+`?m= {yiд╨PP!gьA▒4ёч1Э┌ЪШV4З lHE0Ю┘9Ї╦/PрB$ше2SZkВ<г╙-h)8■гfд .0L┼K ▄ЁИG░Б MX┬╨амШcT╥@&0╚р8 X└мнРЪЗ\F0FБ═\M└%ф┐2┴лЮИЕ<&░3╣Б@A╕R да fрд$ЦhF9:бE\т дЖ>╡E╚┬ PT+BС╨ ─?p\Q_j┴аhthЛ░`YqаE'ЬД/ЄА┤1EШАБ¤х|UHhZЖ;Аи#P.Jб(0a ▒X╘-R;(и$С\┬ўxкЕ&$Ж ╢└╞iz╨ДQг▒RXВj$∙-H2)q@╘Б╘╒Ф╒°╦tX└■Г░╕Ф╞!FP└ъ =М4нПр─ЮЁ',╔IsХ└J╟┘ЕH-В╨░>дА1К#▐╨╒╝AМ@р/p2eХNЦИ%╨╨Г Р╨#№@'йM={@┌Z| йЕД$Д! и@ЙXDZ░W$dL,C╤b╙Г:°aрN▒Д┤р ┌E>U╨O`З8┴С T─a Я╥(p?*─дгъ└╩░M;hб`A!bAр╢вБМ|фQCVАH▓rиC╢рОT┴rШЎ▄@КQtс?МИ├БЪP▓= ▒M└╡■FqШ4┬▄гH╨а"8Uе!>╪ВьА40A}]p─*lБ'`ф#mа>иDБ╪р@@AА ГиA $! ╓Ё aЦ─ ьz6╬"ё&!\<╚Вг╞ц%Д16L(.tшрl0ДHOx─"иР.e└sТXПа3СИpА╡ Gtu*░@H@Г+╚░┘`ь6Mи╠x@Б<Б nXB=;0YЬЎ 48Ч 6 9╥u жЁ╣░В└еlб с┌А╕ ЕЛр╔O╨BTо0$X╨╪Р┌u╡P:╨бv<аA@a ;<ьD¤zXLБЕ.<ц[╠nВ■8Q NXа5\ ╠7P─$N"ЙО0сзи┬xЦ└#·яLbPБ╠p1`∙ Ь╪oвOЙу╡@=Е)в@:юpXШРО0д0 #°Б 8┤8Е-П7├О1╕│ya║ЁОпТ(( @ГYР╘(д╦╙-Ёp 4щЮYOрЙл!0аНS└■ВB║,XnrГF8`ВЗ┬"-ШШы:"$г╤М&╨;┘╝┌щБx└З[Z╨A°╕0CАоz[ГX°Д4@ ╗hВL╨Д┬ИоБГ10Г┴Ю8╥░═гЧT°ЕIА%°Б(@7╪Hh-(O@М┐ъ>RиЖePД▒`rpЕ╗ШБb╪(╚('а 5>ЬЛГX@_кд╕Я-0ЕYа╟йй├0РЫ╩ДgЛЕ[83Hо Я8й°БPБ-аЕXА,╨0▒S .└В+PG╕ ╔.АГЧЁСП°╕)А┐"SиВыТЭFЁЖ■РВQ╨Nи!Aб ч9O)│b ЁРIpГ┌ёаVK A) ф░ИBМ4dДoЩГАёЖ[XАX√y·╕А'╚3 ░·ДOx╗╪<бO@ОА.а4 Sр"╝ЪEPЖ^Ш'10Вz┘cаД(╚DZЕ1Бш┴ВS ЖIш)XV╕:HU╚В/ЄБXpэуf╙┐А;а╞щ3S░Гё`Жб8RcВgbМXhД,А┤F8 (ДC8ЬгВPи8Б ░А&0Е,ШВ)8┤gы╚юРВ.PДHxГ+шБ;ШВP ИаЙ ъБ'рМ`■гЭ·J┤Ч╕В8 б\,╚(PIBК&`QА,hТ`В-ЁFё.╪ МxМ┌╣В4Р=R.(С6ШИx╪Ж╡8А[ЄА@Б'°А<шДUр1(┴°╥РQ` 8Й/pбБ6┴ЙП{J`c└ДF@#xq"ehMА ║h[эуJ(╩.░МАir┐ТВHxx4аFйи(╨(.Ё+Е╜)ошЁ9HоQ√ИЎёгB╕ЕBаВ0Т╗шТjБqzL(°4 бГ║ЇмNиЕZ└Г-АЙLPG`У1Ё*шE╚|▄ЬМ╨■аи╟ГR└Жёq%H*)АГп√Ю,╕)Ё╞є;ЕP`╞тёПМ╪[ы Sш[С├МNрДVJh$ХВ9`Zк аА @Бн@Б^в40<ТЁ#*рВ~╔В.╕NРГ6и!К&AРП@╢EQKH(ВХМh╪╣│p|ВP3и`0a(З*°ПE°Е.ЁUhД!кЪ│%рВga┐c║ИВN(?FГJ(,(─H╒5N0FH═C°Ги АuЧЁзФРГ-0Г?°БЪЙВhZаЕYр║Л/g+ЕПcВ(■░G@мЛoМПфт╢їРQ└Йkс0ЛГ^{ 78 a¤pГma;ш8xКShоkyp.рВ.Pл╘)ФМhГ6hЗn╕% °А√a/╕А ░XpеЕmВ4рД4X╞oiQ8'■dВ.HГАВРМЮoщb┼U╨вЩ&╚q ((Д╧Pзq&░ВI╨ДLшOь(WХГЄБT▒ ╨8Б┐Р╤xБаг┼"1Р)╕WаВ,xМШ├а{Б └$)╨ВWx!Ё.l<8@ЁP?olhБЪ╬╠YVшП▄XзА■Р╔╕гВСкФр▒дo9░лy╥*╪#WjВ╒╥0hTиД,КАёЬZ@зє▄ -ЁС·bГ.Ё-░ рБ6PДyр ╪(pЧIи0ГD) -шДMФ°RHPЕвЭhЕQ╚/ПPvМГ-иаЇ┬,X,▓бЪ└ВMGа Ш5╕ГО8ЕjрЕШФВqHЪ7°;╤ИпМT-8Wx-;аЩ@ГФ╓&8ЕgвWй╡├=7┤╞ё│rДEXД`HZш4иmiX'pnгГфPБ*0▓й▌;m8ИГЛ╕ЦБсЙoД■В<АЕJ╧ЙЕHКВз`7P6FР3ЬРWTрДJ╥╦EX|▌ РСФ.рC ╦Vpб╗%p▌╬C╝юpWgЗ ╪Б#└┤ HБ"°В/xВ╘a;yЯюСVQ9ЖжН}╧<╗zТЭNF╕5@2rХЕIРзF`ЖL0JX■ь+Z░жлДuалнЖZв(иЖс┘б'X;&и НН<5ь╥ВP`a╥$ZIфaР╗░'y WЄOи[╜ш<+Е<(АШ<иR [е┐─ЮN┐XВQЕ╔╙&иГ<╚Tи╛hЮ ╝K■"Е,╙F8%╔┬В5ЙГмQД8`КQД`P9~╒Y┴У.@EpEH╧LИ\ЛВ+p]N:└-░°QЖk└ИБ└рА╓Г@°В а═HЭ·╥gRhJшВЯП.АSX]< ▀4rПl║ РВ7░Д^ dwС `zД╛╖ЫаFA 7huhOEX<╚D:hЕ7аБ шЙх"Д[╨.Иn\ГSp'pхЪВ3Й╣C╔ИГSЕ1Q╝иN╕ЖSрВ-h 8Б(А 4°Бw SРХ@уi█ЙЬ╕КFрД┐дИ!=Еs╝.nr■ЁА&x]╢FиЖT0УFиоя▒ГUpEhЮoiД7X7╪▀Ю9¤:у╦+╕└ЛUPИГх6&6ЁД~┘ ЖXm╨╥y╫sЩРяhp╜о└N8Ет┤ :ЭG!Я┐кж аВ0Г┌╜T╪В(оxHXr└hБ4м]QШ UДc░ЖDЙ`а█FR╨!яJк■T@PГ·Ў7■Ч%╨Ph(╧╔┼ШW─┬FаОЄ╘\КyfВз8+J╚E░нс╢■Лдл9>;mвtJpДиЁmї╣FиgJаGzЖАВ╕xБ8Б╡П╤O,Ф╨ё0T}▌KИ┴вN0Ец╚/╠Р,ауУГ5В╚QХ╨VГ╘[рй;`a╧:ЗvАя°·F╨IE6Ш╓X(╪@Д шUxГ&╨?√а░XБ║pЄє▓fOpДFРГYh!ЁЛz[┤Иn:°и█┤%psб :8%i└ш[р МВъъ кр▐TЖ7╨╧&■p:│ъ єЙС3ё/n{▓!Д 4╣ubДт░╟└в1Мc╞МjЮ&шUАДKHFhеКБёЫ└В6└Вg`З6@p"╚A╪Яв>БxБ ═▄+`СPА'DM└ДD7Яh█N╚┴М┴ЮEPДDаE8аВ╒i4Ё>wm▄А%ЕZhВ╨mHP╧:aАД ░KPД4ы5РP╕Л╦qVр2Ш+╚Д8░Н╡fВ<Др|╩QРГ!╥ h!иВФРВИRо2PИ.шДAu▄╕Г╙В ╚]&hТч╚z,иC?║XиЕA┘6═бЛ╚ИK:mК3О■*╕pЄ °╣ ;Ш┴·ЪШ┴5КЁR╕Мь█─цВГуi╨lИ9°з╚!ЙЗЦhЕV░▓К∙R)╚В6xГЗEЗБ▀Б╕Б╕Н^JБчhБyП9░ГPИ;`л·║T@Е7p%З░ГS╔ь└м,└дМj:ш ЭФ╞$Pр*РБ┼┤╓А6╨RД^X8Ё+:└ZрВтВ╟╬Г/╩·Ry┴P'iЁе6Ё┐'ШИ:╨Ар┴cЖЕпF%:Е╓&'8Ё╨вНКz╕╤╥bЖ K:Бc╞ЪQЫ┤h╤г 'ERЦ°`╥─═гF\■x░PYЕNПM┤0ще-O=|└й2e \ъ┤СТeлUН░Hqc╦(8>zЇ№X'ОL&mЕТs ФгR╡Rїи 2нH╔ НП%B`h╨pт─ 'FN)%кУ8T|,i█%Q"7R╛v┴Тh+OWf╨XзSйPНд\Й╥г/(УuZ├уDЛ-╢Юш╙УВ┴сс#ХжrbZЁи├МNvaщШЕ4╢BAс!д:yшир└BJз*=иL╔MЦ*QЦr8бв )▒╨ф┘ЕЗИR╞бВ°╨EDPPq°Ё├-tA *nЇ╘B■Бo╕с╞=иДE#Эdw·G1┼┴ %P,БE[0БЬv╪СX02К'\dЕZ8╞<╨@_[HёS┤ЬТQK ┤M]4▒Di@┴ДGб3М░ ┬░0ц9ФбFЬ╚Б_ї╨ХЛЇТ Mм$З"йа╥EPE┬AЛ-vh╤VP-,QЗ'Й(ТЕTЁ╨┬ KШИ╙ Q╘┴Д,`┴╩)BмЁЖ*┴Ь┬FФtБQР t@E'┤tУ╟l3┤ E{>ф╓Г#tЁ─<Ї░E)r┤їДt└Жб  ░▄9C+°Ebx▒┴3╕!■G▐ЮЁVAD┌C"Л╝бZSQ╕бH"Р ╘b'X°@_U╡P╨чЖОw&J╟>ЛE'МИЕ(гt╤Г ,4╡E ╛─Vp└╤ЦhЭМV М-╚└DYt╤E'ЬXбeV╠3╠ _ЎцаPГN,q▐4ЁpЕ'иDb 0Ц╕сГAрс]\!d]МB 6▒T▒L╕ЄА┼*дdqЕ 4P№D г CЬ─╤CNVМrЩ >└є 'Pи╨ГЮ╕▒wA┘AGЬG╒оД╤┴=DaGS░╤LTQ╞-└R +Y╘, Tрс6 t Н╕ACDШ■1Жx 2Г30в 21JS,Е╤"Нас├ &ЄHшqEkЦ╔╘ДЮШR▒U8ЯЕ'мРтFvАrё@PШТ=└X░E╜mСGYўЁТPhс&▒Q─┴╟┬/qE"ОДЛ-а┤ РЙ=┌ЄГьб2@┴ PАВЬ╠АoЄ(б MDвг` f УхFr-h 9J─В#RС┤'H 9rX┼|└pa[b!Е pаrИ╟)pвоVЬт 9┴BЖ─В└╨р ┬YАStтS╪└ xа9бAh шаЕ&РM0\Ё─)■bЛ:8бр└ ░pК-░FpрК1PL м░азAс |Г#(Q+╨ КPDд░▒*8Б n╚BЦDCКQИA8f╠ #VБ F\u└├а7мB,jQф└#╪ а√╫∙:,l!;KиB^т╨И64БHбY┬'lqм╝@AЇ░№ЁA╝р2╠ g╨?ї@ ┴hE"Ї╫ДM LTч((с4,Ё mYM ЬЧTМв > ├ИЕT┤" 4└б'R%&╨в3PA Ш@ ZT!'nИД"к─z╞! ъзфYl@Aш)Ж■Г0dQ╕]z0Е(,БbUЁВ:СЙDp!chИ╨ИpвShБ 60(0f9*тPДiБQ\╚Wf▄└ Ў0! o(gV╪24Р"XАТо2Е P!vpЯ╙▐чГ*$`чdъ▓╘╝`BW`7@A+lБ cЪ` JDт ,ъ┴А@Г-МЁ К░=~└2тPБ ЮрЕ0sгXP#ё4)T╚Ы╕ьЪ7К6└uл!Цє░а#DB!?°A╢Б┴;5Вxъ"*QЕФЧhГZЪL4ВPA╫ш╨сЖЩ╔&■БШвoШ└ъаЕ-U-└Г>;0Г:╘БhР ░ЁКHх"*ш└ Ц XlQ0>а─*В░))PвЗPБ ш0КKP┬M>а'8Сб&4Aв`─NфГ)0в╕ЄdB"q!\jpЁ█ д╨ЕБЇ ▌{ уш╢╒Р'pQшрObбb░Dъ╜аАСЁ.еИLи┬jx d@▓(вТP─<ДСУp$( └@Гp6┬МhГБdВ-tP(=iЇ:QЗ;5 ZBХЪP╩jTC ащ┘~йЗUPт б)%╡@Еba╙ЕГ0x!в^AЫа├]PЕ■-Д┴#А ▄`ЙH@бшАxPN■H mс╧А|Р0t ypВ`╤ LДfAш@юД 4╦Э`йa░ДuїLP╚─2^▒В tM└`Дб╢└ИE▄)&Z*4qз0!^}H▐├!p┬═h|х╖ЩКZФ"ICб)в┴.ШВ=ид└Е╡$│8фB╟▐3═xХLаЪe╨JМуЧРF6Z░ F0c√Є┤╨JH"lЧ9J╧z└[─ KТE,╕P%pПu О╩B#сЙФД▀VE+▐0`Оh2'L┴Е-Ї@Pаjk╕<ЭB<┴j╕A*мdъ╪l(Qн┴'0ИЇЪ┬)ИlМIБ╬бN"@G°▓B*d0╛}Ьї cб!╟╞БЎЇ┼Вp0┤&Lh╦╝┴<ШГь└М9■ ╘ |В~└Фор╔°[k`БРВh¤ьhIдtP╨d╚hЗ▒ФE8J¤▒Е∙А(╕В,┬vЬ@Ьї╧ ▓@чЪB7╕┬█╣╫jь└JпOОf░j.л~PrС&|Ьt╧шФgTЦВhє ьЙ│№А░@└╚hЎ]─Вж@ B!8ГEх%+ПЇHeuf t┴*╪В'l┴#п┴ 6╨|ЬПs─OЇE}E╢╪┘)P[Лд+а0вЮ|мd ╨ЇЫ╘╧*┤╒╙а╠uJД╓╝LаГ5м@`А\дН├=┴#UР_{vB(<■к╢ь▓Є╡гнЮйэz┴└зш¤NыIи╩%%Ш ╤СmН▒Esб└A(йА6E╪юE└LБЗ`И,┼╠Ь└╗є╠ФZ'╘В┤Ф№Ф╪A м└ъЭ D┴*─▐В@ШСьиА┬,2mРAиГ]J┤APh*PB&Ч@╪l═╣▄|Ш.│@WК┴╩[ёИ?с┴`!Зm9B╘└KЖф┼л║Б╟hK¤щ }╨YмВ)М┬UШП∙сБцЖ<├8┤АP@Qw%0hШ_ Ї╤TЪ╞A(°l╟╨@ !╟[ХU#╚уЩэGxt└МE■H╧fGJ╨@"МC&(B╚J`Т╚,З5┬╝░U(0AQ ╞ °└+а╓Fэ@FЄФЁрDА@╚huСP┴ш╠ЇьZф╘c,АBКЧ┴∙С`щx┴-╚г4О`@NўQt ╠Pd!0YЬ╪-P┴ ├┼ ┤EвСЇ┬2MJ╕ББа╩╔ ╩└╘Й,Э;Р╙╩ЄП\¤ЬT&)jЛrя{n┴┴°АQZьАИ@╣ LAўЩL╪,▄Ь?ctL╛рI/ О╘7LLБ╝╖l╓S,H)иП@0VV)B9┤tЭ3#ш┘m╖@Р├■)`] 7 фA N ╟Имбf ╝Tb# 0┴8┴№@ К'4В▀Ш┴Й╒0 4┬cлфИ,p├pАсUHOHйА0╠ )┬люж╨O[dVl╥bYЙE/┴gy╨╤┼T`╗XьD░#ЗP%P[_HP^к@иDhРчщS╛╝╥)xВ∙ЇLhДЫ)▓*aШ┐L┴└[Б9├ И└╕@TкA8╨7бМS╢lЁУЪ·АоЬB"8╩ЙH ║и ╝П;▒МБФEVД]UЙ╨fB&xB'С,┬rГЩкд╪XM7Йм░oуA [h╣ъ┬ЮeШб 7:!М╚B|╞Д╦╨j3E├А0░ X2╕└P└[мвx-PTфрЖQPB|3╩ Иф8╕БaТNfй)Lб,╡YBв└■┤А3]H0╤ЙX─в ]p*(╤Йм$"ЛPД#Е┤pR╪В:  №`f╚ЕTЁ+ДБ Uh╝s&ДBqDhБ 4Бч|е└пZpВяQБНПbAь@Е╦p`0ЁФ8ЕD@c░ГЪа!`еHA`BN╤)Cо-'ЭZ╕vЄRqХmS└B'Fq"V╧ cP,aх1╬м@Е*Zё6tсэЬєgз]G╝ALVъ4┘5╤bБTбE9H╤ NЬЛЧ<╕┬Uв >╣·ЗR(■4У╨ьИи*фDEМ▓Д.@u7Kр/qч0Kb8Д.JББ<юAРw╚UГ/Ф!░@ЦъЕ2в6ю└ pз]ФАt(ъ hh Д`6 ╞п Шi?ш┼зN b┴bAyеЁ` ╥р╬в╥┌м б*╞Д╠e╣> %r р└@б┤@▓─ 'шщOdв▄B"!'ва еH\ !сї* v Dд╬aTFрА■lMЗб ┌А▐ Ч>╦-║4╪В╧тА ╥═pПїВБ,iДЮ╩ */▓`m\├.j┬ ■ь !▄'┤6F NA░рФfe`ij└ ^б┬@КJFV@&m(!rАjа\j!jр └└ a |р {m б `АН0А╥Д ;vаЛш╦Z╞ДА<&а■шАTа юр╢ ~ЖQъа Rл ▓ ╛O&Zc┴Оplф└GьbiБbи3та Z&▄f#с╠= №Bp(3╥lхъ ААv└м▓бHМД ЪА <Бf╛ ┤аЭh&@hRЛЫ|ж ┤ ┴x'╞Й┬Д4Бh Шр ╝ < ■к`╟трC╥L&AЖ░ lв8f╚fi╝в8ш W8рhV└╠р─аЛjrHgж&@4Lё8 Nр8р└р j`·▒`NTрfАТq A Ьа╕CвВ└ла@'╪и$Д@ ╞` ЬАъ┬r ┌Ж`■$ьРj ┤`VVДЖ▓qL&0╓b3Рхе═трBJ ║d╬а`Р&пk иHыЮNH8 ┌ ╘▒Ж4иT&ЁD╪` ,M*Р┴╨EA|FR╚Д № -▄А@HZБK▓Ь╢А ъ┬J#gЙ╩╓bcLм \P Б╝BЄ@Бш`■╩ар ▓а8╢ їQKф █8┴├▄в┤аdJ8р╚└ Dа┐┬2╞└ ^З+БЕ)┴КNдс fр, *gКY°ПЎ╧ДрЄ` °╦B╤$╨АLEw~ ╛л ╝р+=т|А ъ х|└ОR─NЦ ?Wф ╧▓АаBбк`36k4аа ╕"ыВТ:П·╥"иf─ 6cЖаА ╕@╟ш,Шюp┤PЁ╧Юь ·╥ "AМБ╕БНDqE╩┬фоа ▐чт@7gi Н ┬4 ╥@ Lо ьаPВ7*є5даCWnPсctжO,-9#ц└VHИ▐■ (aЁHaT░└╣дг :a,еКА №`(а╤TАZdVHвИа)╒рZj ╛@(┐└9╚k╘$ aИ@@-аЮ1│lущеваeК ╢Є■ Л┬р6fА ╨ o┬HN f` p░ЕPр ║└╩a╕) ("Mf"М.DzВПСrу▐В2х└:!╕H┼ ╥ДШ -NА1gRс№iLxFSjВ$A╕a& Жї"╫ 8б┬Рь`╬┌└ ┌ ╪оЖLЪ└ф$NQ:TE▒Д7nцж ▓`RБRсwL~вuЖh╚}ИhЦ┴■GоЕN@┌L №Аt<XдЬр8,тW`А Р@ю│@└~Ан╟j+eа!с v@\кыX|@ с┬А<F║╠`╫Ф]М└ЎI.еЦ╨\АВd ЄDO└j ▓└lБяоар@JЄЙ,h ┌юВ░аА╘j&Г┴7▄ЖP┬╟А vu┘шдОй#ГБ6┴! ╪ ╨4Е4┌F┬Б;4а╪тN>!M┐bIО34г.▓В▓b"И3─S▓А\ЕКП╝│ о┴╞╔4ИЧrPnиSИA╣*bFm\Кe┬ J╟(`№Юф■╝:NюЛМ└b`Їяf└ ВтЮИ█j SЕО ╨╝!=КъU└╠аeрлБb`м6 p╟".В█Врюа \ФЧ╢ЄрrВ╨ Ь ╓ lШа Б┌М╞аs?lдfDш5┤аJмд ▓АЙВ┴╕Ж:┐"ч*O2∙KA F р`Rс0с,с│ д└ ╘т,╖║8Й1╪n}@ ┌р2ьB x ВfВn#(`└▒bп P┴ш.┌@ ╛П╩╩":hдHp╚b╔ф@┬з3┴нt╔"чh└<╞а А@@wqги`h@═а. N■╡┐┤╖О┬б ~@Aд╥щ(а╝ Х╩`Нтз┬О`4iDрИр╩рж(фУ╠@чы2┬ ^ HЕ ╝└┴и╡Tд3в@xа ~╚E?)О╔|FфЛБАfж*ZAA╕цм3┐тттрЮ,s┘Ъа│fяAБBБ`'с"Б┬с║6р 0ЙLфНЫ;RЕ ю`╬ ╥ЄR■YННTр~р №└ H║┐Їo!ВВ└@╕WОЩr,sсОгШ@BzаD _ЦкWiфкЬ╝└ ╞@ ЮаОN`Ёао ·~ Ю└ xхЧ @с╥` RnFЦ└ ■├J╩"°В3мDhБF!eЕ-o#3М:Б!4бqUє├║&v┘6ямT╘Ae&шЩ╧|g║@ Dб ф@▄ ,╛В :Ьn╟ЎECк)3дЗ+hб*dO x┌┼gКДк┤Вр@бд$'LwЖК╔┼роw!4е╘ръw F ─@Y0▌┬5 LY кЗfх"─╝ъчаЄ@│tv>░▓)-Га║_tDBг╫x:─┬ 0ЮLОy Ш) ╢Нд`╟╟ўNF╥NЯгCSzаЖKEь3╠\gТ╟)"AющШr∙■Ю4ЕЖу!rWЖШ@ bўЦY╛┘-ц╠+░Аg|&,0i\7E*мАЖ|╙=═╞Д╠V┘`╓ЫЄдDтL&4E&ьаЛ╤\┴yА═Q╢ BБm| 4М Bf ,N░p!" 9╛Ф)уG !Bb╓╝z╡фб*:ph┴Г╬X▄ykЛ-D░ш┴CJ'SxЬ┤P┴b╞ФB╖ MЩ┴БE <\╔┬╙Е =╘╕к├е╔Lz,Y"е+ШXуМjtх* MhРlReK=ШPбз╩LкPщ╤вН<|0┘┼Нв├К%ъТhT+TЙдшС■/╪├Oд4ЙЄЙЫ&ЙRMВ╥5КЬTФ▄\щeIП&Z└8ё╖Z(Wь╕БТ┼MЦ,P░┤ж Уо4ЫLёAeKХп}gЇ╨*Лц╓RJЭ▓g НгTL╣S'O:мЁQ !(Xш0#╚"0j╘Ш▒╚╒Юi╕ЕsU4┼A*Р4├Q┤`DP@A<Ь╨AВA▄K)qD1CВ>▄с╩╢p┬ -╨!KtX%Г Lр▒EX41 ё╨ЕRfН8Т╚nL╣\┬д┬ Pа▒hDG'pDQд3 ┼U'лн▓╠2└DЄЖ"m╘#■ПТr┴╢ЖMмV#`P─БZPМ▓ШU░╡╞Г╞ ЕiX`сI#M`сF"Н─!┼PTQ]#НdБE(yTQGYё└CpG,▒╚QшдqЇАуQ*№!c╝╘┬└0ЭBаЗ ?xZ!P0┴аpВдpв P╤цS-▒╨СХ l0A ╢@йUd)╥-ИКй[Ё╨┴ тИ'nl╞┼)Юx┬EМt═Й[ZСМ┼(nИВ╡uX─┼tKD'p0├ eЁ╡┴Й,╚└_▄ИtВe ┼┬P@┴[8ЙЮЮщ  .vИ╥▌A╓▐ ■jС╞ qЯ@Гh▓─L╚Ё L╕тJi¤%Г╨v<'┼┌K`!╟(z^БЕYUДb 'q(ЄF"Щ(╙╠%КdqEО4┬Е]╢╤&XСtpGе(n╕A╢W8\]Юj%╪UдoV┤AO6*И░d\hё 2,╤ЕtX4aЬ■рD,┤└|E┴hЙкCSаB▓.`A ZШA┴,p═лЙ╕└И8─с%bBpьА▐%wкYMWтP.L^ШYИр/─ Y/°┬~ЮрД'l┼ aш АЁГ·░@!щ└0АБLHЩваЕЄа┴4ВЙЦ5Г&мсt@` Х рA W╤Ы╛╥Pт+║E'~з┐╞┤B▌s#╕└ЙFLв▌K─%zaМ^@в:и [BQ╗"╜&>░B┴░╨ ЗЭIФ╨%1 9┤!BNёTO|@+HA┘╕P Ь *РK╪)hЛ╣f:Mи■C4NtБ^аE╥▓>]┴`Dc┐~╙Е,№П №ZMСж(ТaС┼IД%PуS─вNШ┴╨│Б№Бjа┴,pБ╠└ OЁ┬иа+┘Б KЁБ╔ш└ЕZ╨! Uа├╓Ж$2юPA║и`#║PМр└ ~@иAU# ╨╨╩5Ї╠кт'╕Д@E аЁDоp└═taR[+  E Uдц Лф2J1;─H┴PDВcл╪IP_#ёJМ├иа%*Йц REєAu 1Нjl@>ё! PP3OLН`W!┘HЎJ╬╒БXА■(8СЖ-╘s3({л/╙r6°k5,╡ОтфW<т╧б┬%%Аra X╕&▌ 7╘Б -Pвс4 "╨ ъ┴ ЄД0╬└З ┘╔Lв`Е*АВSUшД,&┼0Ь$Aб;сXЕ;ьK bр 4Рм│Ї@ Ы*щaЇК4╪kМM°(Ц█Dб Нр]"ЁЕ(МM `уЕH@BТ╕%╢░ЬзМ╖{ШtД"м╙]+∙@bKxCН░РКT4BХ╞2Rб M," КhDU!бH ╪└ f╨╜╤` i°LСо▓╔┤ШоБJZ] K╪а,Ї ┌┐■Ш╨┴ffak╤,f╤.И┬rЯ(%╒юe╫Э╪╠гH╔w╢Ащбp д3оqИ┼Бa%.щС╔Сд'8aB=░BжG8 Dа@°ЁЗ/B╕EdpcuАOИ (Ъ║Нк! &"k>СWN!BOkD+Xбз!aБиЭрД╙4cШHTBСиъмД┐╕И╠ ¤EE+СЕ6└б ]ёЭUHц]я*b┐░й"вкOЬВй╕ДyСП \И/Ш╓л│ OИ#кR╠Mg┼┬ўz,IЖЖ╣оz0 ▄┬Лу└ ▀dНЬ`E(║■&ЗХК╨{йр ур╓dЕ6Rш╓ щ▄Бb┬АpфЇMИАD#zВ▄ >i~тс0`$▓аSXr^╢`ЗN╘┴G@рВ┴╢Ё╤NGГ╒Щ ╢PCУe└ЙпБ ╖╢+─А:|е]аDT}C┘╡zВ!gД7ГoBъЕМ;E╓э╕уXЪ┴ QРbФxQШпо8lP;fД'C ^ЬwёР▀x`R-╗h,НCс >ХлQ@╦¤J·)Ж╞Е Qь╓└╦j-╩Вл0k(VA┬й8iу '╞v╓Й,Q▀ка■Ж)8ajD И╖ pр╬b╠ЧЁ14DЬ┬рY└ 'Б╪ >*p┬╕┬Й╓P Ё╤└P╨'m@Я╪ВкМ╥5x╘Л╩ХAЁАЖ√ { b─p╡├8 <к╕=ёJс▒:ЖЩD$(▒ИEX┬ЩpЮ"DEY╩╗Ни╞(кuFRАDVрqR(╣cu├p Т ▐аHP[ё─vlZAЮ└ л g8rBTЁT░rёrkАMа:/2М pеk╡a░Б[│АWL!у)╖╤б░ЇS╧├GаРxpЕ▒*pCА"?4Р■ErДv@tPx╝т?aЙ╙А░e@Д=P#R` ╪АX┤,(А]TmT4S  ї! орJ'а/ZрвuB0VшAП╓6Е┬ бP/░TL]АIФр0X╨Р(Y` ╔а ─С┼4%E╖jo0 ФP ┬0 д@ Ф@5op РX(╓QLq╤>nа╥p &Ю╥K0Б∙├В┴AMAБ3Ax@0ўhP$/╫d°│\L°─r╙╢4░Д#lP@M╥╢ёHє)аP в╨AЮdX0╙╤t└9─╫ СаА&Ac└ПNA;╨уд'└pр ╓сїЄ"╞ВCЇ╙A╙Е?yГът `PR=p?'p@sx А┤Э8*ЦS4|Л n╨·51qQtэзСР x─ПдY╨Ф0 й└mРЮ└Н@ м░IюЗGn░Крuoр╚`Л"а+╨OPZ╨М·т Y╨RГ▒╖tKиГ#EВK5 аРQ╨02M,i#IГ#╙╤Ї)U▒d ╡А ╫ у"▌Uo'ёСД aСi RQOЁаe)q.*╨Юч)BА:Lрж■┴=W90KBVА$ЭАbM:"5WЁМ`%+'lZ╨Б9V@+Yв/иBWё4UY5F4W@AU kд0 ·UН╒L9е Ъф┤RpнQLНe┴ёг└ MЙiСР ЫаЙАIК С К0 рЁU╗BaKЁ`ЁE Ж#WЫq#єцK`ak╒Ї─iРМHгЩOрH─шln'B╙╜aФФ░ О`К╖ЩЛ$ёGtД ╡yуё ╡^└!p`8ЖГeДГ8Рєk2┴yаВ0╪ j├X1Р*DЁKЖ░└НТ■▒ RWpБ╗;/"` 1c─┼cг(╛Q(─R]рП└RыЩ0й└Фз '31╨ДIЩ╨~Щ└2Л╤U∙(Eаа$ь9P╣Щ░╚3 й└ ТЁЄ)+ ?Ё╤FT└ЛqЯ╟ўK,ДOY╤6L╨d=Ы┴P[ёF`АО╙6Z└ )5/n╤h;yq;U╨К]/ўЄЗ┴%Е>Ю┬.a a╨tG,@РD╨qЁ008щб╓ВODBЁ{u└гp└B& -ЁшA' Джn╨З^р└и ╡o о %Z=░fPZ4╫■-╟$бз0]├ЄG2Мр╛▒к RУУ@ qP№Д2ТМсЪpЙЦаЩР ┤VХЦr*\*иF╟'4 У oPр (╗Pv/4Pl%[nр╞ mЮzYВ╞╢Цвхў╔v 6#AuЁE=а.fPZp┴vGИ"╛b [БTШ f@Зр0а0 ─Ep(└4аK√B?%ш╪ИумPд.Аp╢E]ГгE╠╩НO@СZёЯЁ Б3,Ч7мЗkPrюЇbPj X╨П┬s Э╨ Й└еБ╡?╟У Щ■└ иёХхI▐UquсдФ9u яЧ вж щ╓0rPХКрr* .уЯE╙![`Jp z@▄░D Х,0D╞S МP~№4RАwV▓4Ы'!V>гХ%А╤БbОD2{БM№Ў;!l7пбt <ЮРH?Е╛wpfЁ?р4:*P5╨a 3└zЯр@dб?ЬT p@S ╖[ЛDJ╘"рwЖ$SжP ┤00Я╔m╪ qt([бЖАFССkхОА4рбз]ABZQLQ0 и╨=Л░W5Y░ЮЙЁТ┐pSn0А╒с(кBє╞■Q░LUy&╝cФc╤ир║Щ@ дp вx`]0 в ╓ao0└╦D╡Gg8г*HR▒└/■┘╬Ц?EC┤WA ┬64╤dАa[=4╞xЙ╜&хО#с)╓фТ'Л▓ ╒а б │O@GtМГ8Ёи`Ёfаr^F/0N┬Sp└Шcи{╦ё!╒rЪ╛Жh@T°.я"йЇ7╞┬∙Ы.d4,И╜,ZхЖп╤Рoє.2╨М@6Ка Щ░lЇо°е▐Y7ьК^ _ВМu ЕI, Ы░ щe pК oАjm`╤Ё А8∙■#oД$▒:E╥ЯЁРX▒%├GB√ u╨БqщCOЩhрlхH )W▒╖ "ГRmл└ ?U╣p┬f!%w╓Вб7аcz─2┐й`ЪЖиD╩Э╣u ЦЄI─╔и;Ё\а% ╕оF/0FdДRQh(U 4З╣s╖)_бV]``О░ Рс]YА├U K)qРo╨бйа иРHгP Ш"╞S(їЗYmУl╜ Ц░ЮШ╫QщчМjє░└DъaRъиp┬t ║Фй8Вo╝yng╕kPx╖zAEkАОOs;pСTЪ■О▓V║├ ]ЙН╨ U@F┴p┬H"РGвB╨╘rzU╢╫ЖE╢Э8m╦DЫеfqсtА nЁh|qDFA8─Х q╤╗pP▌QЗf┌G╘A0v└и0√G u└!1─,░Э RЁ1N╤┐SЙp═/ФEГБзpЁ▐>хдP C х0д м0╓Щр═╠еС╒XЫБ0╩RлСLL У╞У╫L╘╢u╓l0hпаї─╖%ї&5а╔f│ ИMLaH\@▌UcЫ6Y@И:H жМp╣ИЎ!!▒З╩А ZNx 9~aBрo■А"D 5р)5░J┤АpЪp7* wPqрПЯ\Ю▓╡ИУ╩Gєd░ Че!С ░ФЩ ╒@┌MЁGf!<з вPp└┬яв#ЙА╠4_эа6b─┌╔ZOгoр]Л░8)Uыз ЫЁ ┐зiн(жв(╤wU@YКB╖░{НА3]Р`╨&є&Zj─{k@ ┤j!j1╠·L*ж(в▌G?%Н` жтAm╨=─╬В~┴vL )u T ▓pQ;┴мР*░?w ?+=`[2!╛.х  ▓н0└7╨А0■yUАqж9г}├+@ r√╛c└y╪К7}─/Хr Й"=ЕqhСї.╢qь╓T,╙е/┼ZП┬╒1TкрQа_lэзк@&к░ й Єc▌ У vгЁПаЬл!эУ╫░╫ЁkЕ%(л■▀╜kАа8ыt╞▓╪╘i6OФЇ┴]╖t*╞И╞sA▒P аPУc tрж98j╨ #тПbрBвЬйKже{ЙаRdFЁGEЁЕ!╛5!rP;/▒и╥╬Е╛ЖD<╤r@`[w E╪Ї!y╙r4└╘▒`ёP=1▐p■╚ЇЗОВн(Л@ ызФH7╠-■╧▄Юxф/SЙ0э)Хъy&Щ ░▀ n грФ░Є]│(1)╤{]N?└PЯБ?jDГоСgп9а8O╨┐╒e#l│мц;КYЗ b▀x;▄eLКт_О бРМ> #▄}Ъ'Т @аE░0pэя└0ё/ЛУ╔*-Р╨dАf`aД4PааЕ?~q╥d ,qи°р1гЕ =j╪аbЗ5UжHЙГeI-Pиh$╚Ф1y@aщ1C'П*u@╒┴▓Ч-t┤`iЗФвEи(QZф╞■═7Ф╣╔Є&╥вDЙAКЇ╞НWEW│dщrЛвнo║D┴ЄиQ╫QОVНЄ┤ЇНe│HA─╦Ф%4h,iтД%ПQ┤H\ЩС1'c─╪╕1ДИ #╦У3ссcЖК 1x▄ вEc8tшМ┴/&О╡wАБЕxАSFЙгС8к`гdПXJЙ#╡[XВЛ::щд,║` ╙ЪАг к▄PdMyГ-7■║╚в,KщJСQ└┌к,9+од`┬┤,^ьтСG║pCJ▄hC t▐ЙNdБ 6ЁpхО)BгбЦД[т /}x┬ 0Ю╬1Йz`тК╒╢ИГ 7Ы└тC)░xё│+рА ╞ША#О8▄hДФQЦlВе┌ ╞Di├▒<╘вЕК  ::БЕK)шА8@;Д┤[[hA |k*ЇZб !АHоМ1юPCМ0╘ЫRЕ:@V╛ ╠0CМ;╨╨В 8ыБЕE╖░Г├:J╘ив4Ло▄иs5┌М" M2ё*Uy├л,") (l┤╩G■K2┴─ТE╩Zd+r█ал+║Hд ЕEФвНy·ЩN:zXвЛPlqE ─д░ ├ОCC '|в╠X=м░&┤аBс(о╪вЛ╒РФ╩НQNЙГЙ88▒зЙа╘Н9щ┬369╦вС.бХQHЙ#6T°4║ЎlН*ИЛтО1╘вИ!bа·9 ▓{@1▒Ё─Pшp┬Rаг ю6`╡ЕМи┤!╩ д3NЎ┤гРD¤aШи5(TРЗ(1┼.кИM╘%┘фL0бС\НocК▒xCХeV|г╬,L╧в B╦J$УdШ┘DK╢КД^жфИBКо╥║"■Л(зHКhрyoГ╒B 6ЪГe╤╕Иmё&иc /А╚Й2ъБКш╙иCЛ+оЁm5.▒ЩХS<ёДУ8:!J К╨h┬,ЪИ├(Tте(0иhД" BШa √╤АA,╝└°К№Ш$ T╕├Ь Д0xсYTXЄfйОdG:?рБ Q<╨┴$B░T<РБD╟?Х К0ИCФ!>шAkZpГL@+X ~Д: =ЁШ Z└a [`PЧоргEXB═╪Y╤ЙOkЇЭU─╥║&XБaK╙Д*:зЙMX"РH0hД■░о2\иS├┌└Оwh@PA Ю╨Д├мLaл∙НgV*D'3` ЫV╥Д-8& ЭyB81КPмВЁKЙR#)TvаCЯш┐╒╚и ЕЦ0ГxК#!9Бєj`$ б0А┴ Є╞ВN╡ BЁФ Z└8+|ж cШВЬ <ш>t┴Z0ГЩ 1F0┬   zф/X$a└* тa└!{9AИа┐BЬ У┬*А┬tа$ъиH#ЫИJ▐╨ИйЖN-zCЛRб 9─б5>└В╕h/А]E║Q─#║"S#йb#UDР ■pt`*┴SI1QL5Ъ╘ ХP ├№╔hч┌h╙ДFq┬~фвe╣▓HU╙@с"ЛВZ┤Щ╢hpЁ┴ ZрГйЭ@<Ё"РЁ▄`A▌>p H`Ш@6@Б┐№чRи┴╔─рмAшGЕ°└е4Шй (ЛVаВ ч├ЯN%$╤@00В$ ┴сБИ├┬ОAк╖─╔ &FЕ*ЇDmM√оЁGЁ╚ П╚─М^wз,|O░TРИ╥/▒ ЙМбл ┘TФгла▀┌рЖyАC>S3┬f%─P┴ Ми├2wЬ@мЪA0STк■.A kpL╠$B╒╨\ pшВD чГS╥` >@╠╥b╩гE┤В\ЁБ╕PК%DakЕ ДZЁ L ;ЪКNц┘СМа=ШBHжр├ВЩБS И0ДH ═#1S{Р*иa agc]Е├KA╟p,BrжpC8с-рT_)Фн╒:┴ в`Nш462╨2(n3 UмшWйS"я9▄%гШ╦X"▒;E87ф:XПм─ЖGа"ЬшД'tКЕzАc∙T┴┬╨▀эббХмрД╞Z┬Ве╥@К/K╝T▀э1БMЙЪБa%╤;СЖЦ\АВ╢Ер ■╔ ОиK║╨ИSмB)сd1:╝B╫wX╧─|Ё╚mCu╚6ы1▄░°└L|6j;/┤0рЫо)*╧┘=xБМрЕ0Ф┴ wА(@╤ 9H!Е*t+Bel2 ┬ ╦ЩБє"зЕF╪ПA9╠Йгa аEvЭ67еHi]jl6 )йРгWшї╞4K┴Jы╗BВDaЕ?ГАb┴ЗШFs"DЮfМДVMщ\№eafрГD╔@╘2RX═ЪT╗(дБГ(@!(%=Енf"Va Ў╡y N├|Ї7,╓S@т8fКXрБ■AV`╨pИц{GшVр<|J;ЩZ|Е@ю╕а╚gы+т#)▒ъ┼t8zBQЫьЭ,T,xИлJ/▒d"YМC,b┴/1O Ъф▓17DEУаD&X#rбf4нoQ$ЮЄ/ж8ВER) V║`еЕ┴AV└в9╕▒║▒WK`C╦VЕ%АЩOЁ┬tB*·` kHC4ЩУ0q▀3Mр(8!QЕ▒Z ^ФВяЧє╞t+эjДjLТ╖K!л=zВCZ ELБДИ╜БШ°БИ&}█/r2НШ╖┌)ГЙ"ш2°" Ыщ╨ОД@■╛т@╜1 %8╖1аГе╙в+ЪБ ('8ЕР* ;v#Ч╒ае*╪В) Иc╔2#879`UPи Л7p5rI5$╤E оЩДF░ЩQаСоP8мZjЗ}аh@X*└М ╡'8риbОLЫБЁЦМ@МO3НOИWX╬ -j{∙/ЩєТJВ╡Ю╒ИВшщр, рА╜IВ╣√И├iП┐вА@√л в └═ъТ'И╛▓9Ы "Р($°БЁФ "x ЁDа║ФrЮ ╪ЫpВ:░)аВ ╤ ╖■:тЙ-рЙ╨в╪[аЕ@є╘РВ╦с┴BИ╪д`M░MАДL╟█У ╘└9░Ч.╪оGбД╜xК▐JЩту▒В&б%z╨L╝░├8М'А5┘вТ)AHAPвR╥NHCе'└>1`В'ШЎъЁБ5pЕ4@Г╒2gSШ Щщ┘т)аГNX║Х╕УY;VЕI7аеэb )8?\┌Z║ВгНBЕDHйт:о8■Р5щAП"хБ░ЖpШ p─p/├ЁМБЇ9├pИ5╘Ь p'РC╠°М╬а04T─XВ╫8╤╪UV 7 КЛД>ZД╧ёйЧбГлГPиЙ° фpВїШП(Ё├ ий╤N║*#шГ╥BВ#H╚Х#╪Гм▒ #(2ЁВ81PЙ ╚Бf·Н@Б АIЯsВ5PГ5Ц2╣Q╡╩М5Ш1@q┌░┘ТzоF8Ю)┘9Йz/QЄ<9`ДзY<Б╒Rл:ИPRC ╙ИO8)L│6шДQ`7щМц{/ijq└Е Р░(с■/░4ъ3шыRФСJ╠(Я'8Ц`1\В0d═┌"║.╪╥,ЁДз╙Z▓Їв8░└╠FРВ╪╘Й 6ш╬╔eЁ ╪mф#є0M╤ю1sБ ZJ*1рAhПS╤Р"38@ЁВ╩ ШLXЖ╠JыШфS┤U╘P@$7) ЭР7ЕX?й9oaВ4гeДнMтШ╔:iMhЕaHЕ╝$г╙I бг%Й ЪС╡@орZMJ5+╛h xБ╕Б#иr ╫╚CЭVk, УЪEОф╨$╧`6╪В╬╪N╪ВmбГ6У■ГFpДкHЕзa"&╪ИP3О-Цl!ь╠Н╤┬m╝Ў1щА,ю└О╛·+┤9 `Б0<ВЁ╗°аll'ЁB0Д2 ╢а └] P+∙ГrB&╥╧Й╔>Fтедё  ┼рШТYв%└ВF`H╙В╟┼"М О)K", Еr$`шЕЛRДYr╔-Vs=╙caС┤ШЮт9GapР▓░XБаБDЯы╠Гl03░Х╡H╬ИИ=Ї .АH╒T%SиЯP╠:a :Т▓А4 X*Qё4 A─Шl┴:O┌╣*╚м<(Д*■ЁБСёrє!°<Р,Е░▒╨Ф√мИм│eAQБ"2(▀└█▀╡X╓РXж/H┘ъФЎ·╟'╪ьСИЭ╦Юф%F░/ЪK 5ш ;иГ▐┤%.ЁНbi"Р4+Л9cHАС ╡─i8╕ZВВ6АбЙFР╡╘lГэ┬zи'ВО(cБШ0ЇМKл9жт╒М┬0М╢Г*И.°+оЯNXЕ╪сВN╨$KЫБКAЩ:п7иh┼EP.Ш;р═█МrХп╨░{жГиBГXБEБШdв╜U■4`В4рКYиЛШБf╦¤┴ИQ)R(ш[8ЕNИЕ2░>?Iт жу9шДRh╖&(╡-В╓░Н!о icеN!ти╝гQПЇ4l╚├┤їWY[/Ё4 2╤М'Я┐~ЩЧСFЧK%б╙В Ц┬.аД┬lМ#гH╨nT░hOP .╕bь ВРОВ║ы░Л шDfїлГ ╩K\ЪT+#▌2И╗$ЁN БъфDP, └][∙л╙OєФпе4jк&Hц-MTєы'╨Вs1 Ї,)є(РVиYи\.VъТ,BГ)u■ЕI`)МQ░+0 {б╨Ї▒Тш.▀ёR╠a5ИFЗm└─·АВ<╕Р@dЛеЄrУaЯЕ*М╥рМщ)═TГГU└lxеQp о@ ▀ -РЩ&а╘И╩╩╖ 8ЦY▐И мзьФLH┬Ы╨АF╘Ф Ш║y,чq"╪>8╨Х└'┘Б├jП`╓╚ Ёge─°k1 qЯXГ58Д1╠З╛У2°2жЄЩ`80║в╩ 0╘AЕj`U J ЕTh)lгКP ЩКXR8ЕRЕ6PШ1zвaЯ■фЕ,И| >юРщh] Ёў╣╬kЩ.ЙВ4hрJт ЦеЦ∙╛ЧY¤Б.8ЕV v─3к▓pЦCэ╕А)ЮБ°02P1(в00CДk╓|Ў$ДAH]s;ДC иМ╧ЛУўл╓  Л6`k"H"Д>8h╩Б)В Х┐ВА и\┬`╧/ ┼p╓N∙i╬╔╫ЩM&Г[(ДA0#аЎрФfВ-░Й:зЬgР╔yU,аДyК╓СКгЕщe` ;0╤?Nи;╕O°aEє°QX╨└а 6$Ї0┬E■ 4Ц@╤еIФ%Q╕Pс1Г&ЧЇРшуЙKЬ<щ┴ДJЧP░Hi"EJФ.НF1║╥DЛСЫHд!Г,4P╪dР3f─Д)c&М/AД F╚МF╩°1ф╟И2~╩Pхбb├Ж0PРaБ╗4L╚ЛсCЗ.b╕pГH4bh╠Шq)╛Jр░сEMЪ5h╨°0ф─^бEM┴r┴▒Z░q:Ь─bKS┼ ?ФЖAшnД`¤p╒-№@ ,№А─4Eг└Vv|e]wu╠q`Є .HY 8ФРБ l AШПпB-ИБЗф'9▒Ж -а`┴2╚ tксJZ╕ТЗД└└└JPAcT╥8!T└|ЕЬJ4╕iВ▄ Е6╕AщШД╤7xтr└Nf┬ ъШ"v0Е(╤,t┬м ЕWТ└ъ8ыЁ╞Їpd`вoD╝ДНv8C■КxC▐аЙ^DВ&M╠Ж%<сm3ЁL╡FУ√╘@E╚ Tт*└ (шAKр╪Г■0f eИг P Г'╘) бб╥Ь0*TсyА═ю░5▄!v4аCJ2Е'░`4 1Ш·"Аa@z╘╦ЛЁ2р`G░@YЧВaа;BЁДрЕ0Pб&БB ,а╦─ч,р▌'^С&,a k`Б¤Np·ї╦Z/┬■@Л8XН;б9AbтлN░в┤╚─#R▒ U8┬ n`─(FС├ш4┬ЖлW#В1ОqTвCWш┬M─╡A)╘;╨4.qЕE,B■Kв2вQ _шб mИD3╪! ,иНECKz%8╥р3Ў√b югG╔`"┌2 ┌╓═└ ?X╤bКВР╡ыm`╝i╞ё┴╒║Ў-д! [`ъ@i║B 4X▐╕VжRАK^`┤Г5в┴ЭАьўм╚Ёш%¤b═8▒Ж4иa +ъ VА# ╕йШUАЬ╩ТlNБB╤ *ёВfБDК├'1│├ЙQt:\0з"&бs2вS█ВДр╣u|╙■jFмCM▐iРЕ,ЖL ╜o,└% И аK·]`РЙ)Ч╕д']О7 ┘K ^рЛ%д B`Б╪`╫▐#Б,Р▒╨Eл╞VАГЬБ hU╨┴ppГ%едk╨^╡pc"╦{"\д┴5у3гбБ╚ ╓└Ж■Й╞ЯiAmJГ╞yВ╡P┼#V 5░Л?LиёHр?°(═Н2^ФpЗ*°уsИFn∙жМqМ" 3Иo ┌╨ЁcDc;╕ъF Чи╟T07р├ЄЮ░гпж▒`Сy*╨ФДbЙHRъ#╞╤ША.■cЪВь╥EK┐╡Z&tЄrщEB_&¤*╞a┌y@:╥йЧД@ DF╓еА L╠D╪Зq╒A└hЙx м▀ ▄╔х╤gМСк Кь╒B Ї┴|A╘└ ,]Н╚@ №▌АPм}╣ д@L╤╬╜┘(<'░о┴РqBpВъ╕Лф∙шР─СД┴Xj┼1╠┴4,$h)╪A0nиP├1ГЯи@ Д└▄q ╘Е╧ |Ч D╞╫yРИЖ ╕└┤ФFБFs)WЛАF VTK A╨└И=▄QQpQ,╬М╞ ьБ■ ьAф@ ╠Фr╜А р╥YRЁ╠╧Н╫xY@╥∙·б@гЭр╜Ж МА╟]WQПV)▌d*╙2НвМ╤=W!&A ~Б|ArХ╩ ║╕н╚}╤А ~В╛┼N╜Х╩АЫ 8вАМ# pВ72В7zB(╘Р'T╓#pAщaЗq╕FГ$┤rtНдQ╪┴(├F1X┴╝╟L@ШАА[╙YDЫ╓Бт tWРl└О╝└БН | H╦ц №╣╫°╥│╒И╔5ZxБ=Wи`T║В╢нБАA ╝@ь%Rтг= И`d╬Bц" ё■L╘е╘б▀Л╒└│ ╟a$ ┴$И└B0EZ e╘¤_┐4]╥йрНдH ┴╚М№р░╦№─¤Ї▌\Af╨IфuFJ=╚GёА¤╪а¤P╫И$r+дB0МВ"(*d┬о\┴rPЩ@Г/@В/ЁВ@H|х╬Р┬08▄╓Г8Ёу┴_ФАT@R╕╚ М╡P@№@ ╞lи└└@Б+8Ж ╚Rh^╦°Т┬\╔┬ZQЮ@*6Ъ|а}Б~й╚KЮ_╪╔a╜А A<╫ Д╪%ю┴╕@W┴╨@Ё╘┘я■u└їЁ┼Y┼Eн! A и@УЬс ЁLЛ$╦tд.эd\▌]hLB┤Аn@A"XB&0BtЫ=ЛRlЧRв!* LEK╪╧А<вPl░\┴gшСи4Б<:>фГдK:>р├>x╕7\Г6hГ0Ш├3<;юM5L2L├=Ш·{╫C=DC4╘Г=Г=;enthought-chaco2-4.8.1.orig/examples/kiva/agg/simple_clip.py0000644000175000017500000000216213233644505023063 0ustar varunvarunfrom __future__ import print_function import time from kiva import agg samples = 1 pt = (250, 250) sz = (100, 100) transparent = (1,1,1,0.) gc_img = agg.GraphicsContextArray((500,500)) #gc_img.clear(transparent) # clear isn't working... gc_img.bmp_array[:] = (255,255,255,0) gc_img.set_fill_color((1,0,0,.5)) gc_img.set_stroke_color((0,0,1)) gc_img.rect(pt[0],pt[1],sz[0],sz[1]) gc_img.draw_path() gc_main = agg.GraphicsContextArray((500,500)) gc_main.set_fill_color((0,0,1,.5)) gc_main.set_stroke_color((0,1,0)) gc_main.rect(300,300,100,100) gc_main.draw_path() gc_main.clip_to_rect(pt[0],pt[1],sz[0],sz[1]) t1 = time.clock() for i in range(samples): gc_main.draw_image(gc_img) t2 = time.clock() print('with clip', t2 - t1) gc_main.save("with_clip.bmp") #gc_main.clear(transparent) gc_main.bmp_array[:] = (255,255,255,255) gc_main.clear_clip_path() gc_main.set_fill_color((0,0,1,.5)) gc_main.set_stroke_color((0,1,0)) gc_main.rect(300,300,100,100) gc_main.draw_path() t1 = time.clock() for i in range(samples): gc_main.draw_image(gc_img) t2 = time.clock() print('without clip', t2 - t1) gc_main.save("without_clip.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/star2.py0000644000175000017500000000116713233644505021622 0ustar varunvarun from math import pi from kiva import agg def add_star(gc): gc.begin_path() gc.move_to(-20,-30) gc.line_to(0,30) gc.line_to(20,-30) gc.line_to(-30,10) gc.line_to(30,10) gc.close_path() gc.move_to(-10,30) gc.line_to(10,30) gc = agg.GraphicsContextArray((500,500)) gc.set_alpha(0.3) gc.set_stroke_color((1.0,0.0,0.0)) gc.set_fill_color((0.0,1.0,0.0)) for i in range(0,600,5): with gc: gc.translate_ctm(i,i) gc.rotate_ctm(i*pi/180.) add_star(gc) gc.draw_path() gc.set_fill_color((0.5,0.5,0.5)) gc.rect(150,150,200,200) gc.fill_path() gc.save("star2.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/rect.py0000644000175000017500000000020613233644505021515 0ustar varunvarunfrom kiva import agg gc = agg.GraphicsContextArray((500,500)) gc.clear() gc.rect(100,100,300,300) gc.draw_path() gc.save("rect.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/star_path.py0000644000175000017500000000572013233644505022553 0ustar varunvarunfrom __future__ import print_function from math import sin, cos, pi from numpy import array, arange import kiva from kiva import agg def draw_circle(gc,radius=2): gc.begin_path() angle = 0 gc.move_to(radius*cos(angle), radius*sin(angle)) for angle in arange(pi/4.,2*pi,pi/4.): gc.line_to(radius*cos(angle), radius*sin(angle)) gc.close_path() gc.fill_path() star_points = [(-20,-30), (0, 30), (20,-30), (-30,10), (30,10), (-20,-30)] ring_point = (0,35) ring_radius = 5 #fill_color = array((1.0,0,0)) fill_color = array((200.,184.,106.))/255. point_color = array((.3,.3,.3)) line_color = point_color for i in range(len(star_points)+1): gc = agg.GraphicsContextArray((800,800)) gc.scale_ctm(8.0,8.0) gc.translate_ctm(50,50) # draw star gc.set_alpha(.5) x,y = star_points[0] gc.move_to(x,y) for x,y in star_points[1:]: gc.line_to(x,y) gc.close_path() gc.set_fill_color(fill_color) gc.get_fill_color() gc.fill_path() gc.set_alpha(.4) gc.set_stroke_color(line_color) gc.set_fill_color(line_color) gc.set_line_width(12) if i > 0: with gc: x,y = star_points[0] gc.translate_ctm(x,y) draw_circle(gc) if i > 1: points = star_points[:i] with gc: x,y = points[0] gc.move_to(x,y) for x,y in points[1:]: gc.line_to(x,y) gc.stroke_path() """ for x,y in points: with gc: gc.translate_ctm(x,y) draw_circle(gc) """ gc.save("star_path%d.bmp" % i) # draw star line_color = (0.0,0.0,0.0) gc = agg.GraphicsContextArray((800,800)) gc.scale_ctm(8.0,8.0) gc.translate_ctm(50,50) print('line color:', line_color) print('fill color:', fill_color) gc.set_stroke_color(line_color) gc.set_fill_color(fill_color) gc.set_line_width(12) x,y = star_points[0] gc.move_to(x,y) for x,y in star_points[1:]: gc.line_to(x,y) gc.close_path() gc.set_fill_color(fill_color) gc.get_fill_color() gc.draw_path() gc.save("star_path7.bmp") # draw star gc = agg.GraphicsContextArray((1700,400)) line_color = (0.0,0.0,0.0) gc.scale_ctm(4.0,4.0) offsets = array(((0,0),(80,0),(160,0),(240,0),(320,0))) modes = [agg.FILL, agg.EOF_FILL, agg.STROKE, agg.FILL_STROKE, agg.EOF_FILL_STROKE] pairs = list(zip(modes, offsets)) center = array((50,50)) for mode, offset in pairs: with gc: xo,yo = center+offset gc.translate_ctm(xo,yo) print('line color:', line_color) print('fill color:', fill_color) gc.set_stroke_color(line_color) gc.set_fill_color(fill_color) gc.set_line_width(12) x,y = star_points[0] gc.move_to(x,y) for x,y in star_points[1:]: gc.line_to(x,y) gc.close_path() gc.set_fill_color(fill_color) gc.get_fill_color() gc.draw_path(mode) gc.save("star_path8.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/agg/lion.py0000644000175000017500000000153013233644505021522 0ustar varunvarunfrom __future__ import print_function import time import sys from kiva import agg if sys.platform == 'win32': now = time.clock else: now = time.time from lion_data import get_lion def main(): sz = (1000,1000) t1 = now() path_and_color, size, center = get_lion() t2 = now() print(t2 - t1) gc = agg.GraphicsContextArray(sz) t1 = now() gc.translate_ctm(sz[0]/2.,sz[1]/2.) Nimages = 90 for i in range(Nimages): for path,color in path_and_color: gc.begin_path() gc.add_path(path) gc.set_fill_color(color) gc.set_alpha(0.3) gc.fill_path() gc.rotate_ctm(1) t2 = now() print('total time, sec/image, img/sec:', t2 - t1, (t2-t1)/Nimages, Nimages/(t2-t1)) gc.save('lion.bmp') if __name__ == "__main__": main() # EOF enthought-chaco2-4.8.1.orig/examples/kiva/agg/dash.py0000644000175000017500000000131313233644505021477 0ustar varunvarunfrom __future__ import print_function import time from numpy import array from kiva import agg import kiva def dash(sz=(1000,1000)): gc = agg.GraphicsContextArray(sz) gc.set_fill_color((1.0,0.0,0.0,0.1)) gc.set_stroke_color((0.0,1.0,0.0,0.6)) width = 10 gc.set_line_width(10) phase = width * 2.5; pattern = width * array((5,5)) gc.set_line_dash(pattern,phase) gc.set_line_cap(kiva.CAP_BUTT) t1 = time.clock() gc.move_to(10,10) gc.line_to(sz[0]-10,sz[1]-10) gc.line_to(10,sz[1]-10) gc.close_path() gc.draw_path() t2 = time.clock() gc.save("dash.bmp") tot_time = t2 - t1 print('time:', tot_time) if __name__ == "__main__": dash() enthought-chaco2-4.8.1.orig/examples/kiva/agg/star.py0000644000175000017500000000124613233644505021536 0ustar varunvarun from math import pi from kiva import agg def add_star(gc): gc.begin_path() gc.move_to(-20,-30) gc.line_to(0,30) gc.line_to(20,-30) gc.line_to(-30,10) gc.line_to(30,10) gc.close_path() gc.move_to(-10,30) gc.line_to(10,30) gc = agg.GraphicsContextArray((500,500)) with gc: gc.set_alpha(0.3) gc.set_stroke_color((1.0,0.0,0.0)) gc.set_fill_color((0.0,1.0,0.0)) for i in range(0,600,5): with gc: gc.translate_ctm(i,i) gc.rotate_ctm(i*pi/180.) add_star(gc) gc.draw_path() gc.set_fill_color((0.5,0.5,0.5,0.4)) gc.rect(150,150,200,200) gc.fill_path() gc.save("star.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/simple.py0000644000175000017500000000046113233644505021316 0ustar varunvarunfrom kiva import constants from kiva.image import GraphicsContext gc = GraphicsContext((100,100)) gc.clear() gc.set_line_cap(constants.CAP_SQUARE) gc.set_line_join(constants.JOIN_MITER) gc.set_stroke_color((1,0,0)) gc.set_fill_color((0,0,1)) gc.rect(0, 0, 30, 30) gc.draw_path() gc.save("simple.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/pdf_arcs.py0000644000175000017500000000300113233644505021577 0ustar varunvarun from numpy import pi from reportlab.pdfgen.canvas import Canvas from reportlab.lib.pagesizes import letter from kiva.pdf import GraphicsContext def draw_ellipse(gc, x, y, major, minor, angle): """ Draws an ellipse given major and minor axis lengths. **angle** is the angle between the major axis and the X axis, in radians. """ with gc: gc.translate_ctm(x, y) ratio = float(major) / minor gc.rotate_ctm(angle) gc.scale_ctm(ratio, 1.0) gc.arc(0, 0, minor, 0.0, 2 * pi) gc.stroke_path() gc.move_to(-minor, 0) gc.line_to(minor, 0) gc.move_to(0, -minor) gc.line_to(0, minor) gc.stroke_path() def draw_round_rect(gc): """ Draws a black rect with round corners. """ w = 500 h = 500 r = max(1, min(w,h)/10) gc.set_line_width(2.0) gc.set_stroke_color((0.0, 0.0, 0.0, 1.0)) gc.move_to(w/3, h/2) gc.arc_to(w/3, 2*h/3, w/2, 2*h/3, r) gc.arc_to(2*w/3, 2*h/3, 2*w/3, h/2, r) gc.arc_to(2*w/3, h/3, w/2, h/3, r) gc.arc_to(w/3, h/3, w/3, h/2, r) gc.line_to(w/3, h/2) gc.stroke_path() canvas = Canvas(filename='arcs.pdf', pagesize=letter) gc = GraphicsContext(canvas) gc.set_alpha(0.3) gc.set_stroke_color((1.0,0.0,0.0)) gc.set_fill_color((0.0,1.0,0.0)) gc.rect(95, 95, 10, 10) gc.fill_path() draw_ellipse(gc, 100, 100, 35.0, 25.0, pi / 6) draw_round_rect(gc) gc.save() enthought-chaco2-4.8.1.orig/examples/kiva/star1.py0000644000175000017500000000103613233644505021056 0ustar varunvarunfrom kiva.image import GraphicsContext from kiva import constants def add_star(gc): gc.begin_path() # star gc.move_to(-20,-30) gc.line_to(0,30) gc.line_to(20,-30) gc.line_to(-30,10) gc.line_to(30,10) gc.close_path() #line at top of star gc.move_to(-10,30) gc.line_to(10,30) gc = GraphicsContext((500,500)) gc.translate_ctm(250,300) add_star(gc) gc.draw_path() gc.translate_ctm(0,-100) add_star(gc) gc.set_fill_color((0.0,0.0,1.0)) gc.draw_path(constants.EOF_FILL_STROKE) gc.save("star1.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/compiled_path.py0000644000175000017500000000142313233644505022634 0ustar varunvarun# CompiledPath should always be imported from the same backend as the # GC you are using. In this case, we are using the image GraphicsContext # so we can save to disk when we're done, so we grab the CompiledPath # from there as well. from kiva.image import GraphicsContext, CompiledPath from kiva.constants import STROKE star_points = [(-20,-30), (0, 30), (20,-30), (-30,10), (30,10), (-20,-30)] path = CompiledPath() path.move_to(*star_points[0]) for pt in star_points[1:]: path.line_to(*pt) locs = [(100,100), (100,300), (100,500), (200,100), (200,300), (200,500)] gc = GraphicsContext((300,600)) gc.set_stroke_color((0,0,1,1)) gc.draw_path_at_points(locs, path, STROKE) gc.save("compiled_path.png") enthought-chaco2-4.8.1.orig/examples/kiva/sub_path.py0000644000175000017500000000172013233644505021631 0ustar varunvarun from numpy import array from kiva.image import GraphicsContext line_color = (0.0,0.0,0.0) fill_color = array((200.,184.,106.))/255. gc = GraphicsContext((900,900)) gc.rect(30,30,850,300) gc.set_fill_color(fill_color) gc.fill_path() gc.set_fill_color((0.,0.,0.,.4)) gc.translate_ctm(50,50) gc.move_to(10,10) gc.line_to(400,400) gc.move_to(410,10) gc.line_to(410,400) gc.line_to(710,400) gc.line_to(550,300) gc.line_to(710,200) gc.line_to(500,10) gc.close_path() gc.rect(750,10,390,390) gc.draw_path() gc.save("sub_path1.bmp") line_color = (0.0,0.0,0.0) fill_color = array((200.,184.,106.))/255. gc = GraphicsContext((900, 900)) gc.rect(30,30,850,300) gc.set_fill_color(fill_color) gc.fill_path() gc.set_fill_color((0.,0.,0.,.4)) gc.translate_ctm(50,50) gc.move_to(10,10) gc.line_to(400,400) gc.move_to(410,10) gc.line_to(410,400) gc.line_to(710,400) gc.curve_to(550,300,710,200,500,10) gc.close_path() gc.rect(650,10,390,390) gc.fill_path() gc.save("sub_path2.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/ui_gradient.py0000644000175000017500000000565713233644505022333 0ustar varunvarun import numpy as np from enable.api import Component, ComponentEditor from traits.api import HasTraits, Instance from traitsui.api import Item, View class MyCanvas(Component): def draw(self, gc, **kwargs): w,h = gc.width(), gc.height() # colors are 5 doubles: offset, red, green, blue, alpha starting_color = np.array([0.0, 1.0, 1.0, 1.0, 1.0]) ending_color = np.array([1.0, 0.0, 0.0, 0.0, 1.0]) gc.clear() # radial reflected background with gc: gc.rect(0, 0, w, h) start = np.array([0.0, 1.0, 0.0, 0.0, 1.0]) end = np.array([1.0, 1.0, 1.0, 1.0, 1.0]) gc.radial_gradient(w/4, h/4, 200, w/4+100, h/4+100, np.array([start, end]), 'reflect') gc.fill_path() # diagonal with gc: gc.rect(50,25,150,100) gc.linear_gradient(0,0,1,1, np.array([starting_color, ending_color]), "pad", 'objectBoundingBox') gc.fill_path() # vertical with gc: gc.rect(50,150,150,100) gc.linear_gradient(50,150,50,250, np.array([starting_color, ending_color]), "pad", 'userSpaceOnUse') gc.fill_path() # horizontal with gc: gc.rect(50,275,150,100) gc.linear_gradient(0,0,1,0, np.array([starting_color, ending_color]), "pad", 'objectBoundingBox') gc.fill_path() # radial with gc: gc.arc(325, 75, 50, 0.0, 2*np.pi) gc.radial_gradient(325, 75, 50, 325, 75, np.array([starting_color, ending_color]), "pad", 'userSpaceOnUse') gc.fill_path() # radial with focal point in upper left with gc: gc.arc(325, 200, 50, 0.0, 2*np.pi) gc.radial_gradient(0.5, 0.5, 0.5, 0.25, 0.75, np.array([starting_color, ending_color]), "pad", 'objectBoundingBox') gc.fill_path() # radial with focal point in bottom right with gc: gc.arc(325, 325, 50, 0.0, 2*np.pi) gc.radial_gradient(325, 325, 50, 350, 300, np.array([starting_color, ending_color]), "pad", 'userSpaceOnUse') gc.fill_path() return class Demo(HasTraits): canvas = Instance(Component) traits_view = View(Item('canvas', editor=ComponentEditor(bgcolor="lightgray"), show_label=False, width=500, height=500), resizable=True, title="Gradient Example") def _canvas_default(self): return MyCanvas() if __name__ == "__main__": Demo().configure_traits() enthought-chaco2-4.8.1.orig/examples/kiva/pyglet_gl.py0000644000175000017500000000240413233644505022012 0ustar varunvarun from numpy import array from pyglet.window import key, Window try: from kiva.gl import GraphicsContext except ImportError as e: raise Exception(e) from kiva.constants import FILL, STROKE, FILL_STROKE class TestWindow(Window): """ Press Q or Escape to exit """ def __init__(self, *args, **kw): Window.__init__(self, *args, **kw) self.init_window() def init_window(self): self.gc = GraphicsContext(size=(self.width, self.height)) self.gc.gl_init() def on_key_press(self, symbol, modifiers): if symbol in (key.ESCAPE, key.Q): self.has_exit = True def draw(self): gc = self.gc with gc: gc.clear((0, 1, 0, 1)) gc.set_stroke_color((1,1,1,1)) gc.set_line_width(2) pts = array([[50, 50], [50,100], [100,100], [100,50]]) gc.begin_path() gc.lines(pts) gc.close_path() gc.draw_path(STROKE) gc.flush() def main(): win = TestWindow(width = 640, height=480) exit = False while not exit: win.switch_to() win.dispatch_events() win.clear() win.draw() win.flip() exit = win.has_exit if __name__ == "__main__": main() enthought-chaco2-4.8.1.orig/examples/kiva/ui_text.py0000644000175000017500000000654413233644505021516 0ustar varunvarun from enable.api import Component, ComponentEditor from traits.api import HasTraits, Instance from traitsui.api import Item, View def glyph_a(gc): gc.move_to(28.47, 6.45) gc.quad_curve_to(21.58, 1.12, 19.82, 0.29) gc.quad_curve_to(17.19, -0.93, 14.21, -0.93) gc.quad_curve_to(9.57, -0.93, 6.57, 2.25) gc.quad_curve_to(3.56, 5.42, 3.56, 10.60) gc.quad_curve_to(3.56, 13.87, 5.03, 16.26) gc.quad_curve_to(7.03, 19.58, 11.99, 22.51) gc.quad_curve_to(16.94, 25.44, 28.47, 29.64) gc.line_to(28.47, 31.40) gc.quad_curve_to(28.47, 38.09, 26.34, 40.58) gc.quad_curve_to(24.22, 43.07, 20.17, 43.07) gc.quad_curve_to(17.09, 43.07, 15.28, 41.41) gc.quad_curve_to(13.43, 39.75, 13.43, 37.60) gc.line_to(13.53, 34.77) gc.quad_curve_to(13.53, 32.52, 12.38, 31.30) gc.quad_curve_to(11.23, 30.08, 9.38, 30.08) gc.quad_curve_to(7.57, 30.08, 6.42, 31.35) gc.quad_curve_to(5.27, 32.62, 5.27, 34.81) gc.quad_curve_to(5.27, 39.01, 9.57, 42.53) gc.quad_curve_to(13.87, 46.04, 21.63, 46.04) gc.quad_curve_to(27.59, 46.04, 31.40, 44.04) gc.quad_curve_to(34.28, 42.53, 35.64, 39.31) gc.quad_curve_to(36.52, 37.21, 36.52, 30.71) gc.line_to(36.52, 15.53) gc.quad_curve_to(36.52, 9.13, 36.77, 7.69) gc.quad_curve_to(37.01, 6.25, 37.57, 5.76) gc.quad_curve_to(38.13, 5.27, 38.87, 5.27) gc.quad_curve_to(39.65, 5.27, 40.23, 5.62) gc.quad_curve_to(41.26, 6.25, 44.19, 9.18) gc.line_to(44.19, 6.45) gc.quad_curve_to(38.72, -0.88, 33.74, -0.88) gc.quad_curve_to(31.35, -0.88, 29.93, 0.78) gc.quad_curve_to(28.52, 2.44, 28.47, 6.45) gc.close_path() gc.move_to(28.47, 9.62) gc.line_to(28.47, 26.66) gc.quad_curve_to(21.09, 23.73, 18.95, 22.51) gc.quad_curve_to(15.09, 20.36, 13.43, 18.02) gc.quad_curve_to(11.77, 15.67, 11.77, 12.89) gc.quad_curve_to(11.77, 9.38, 13.87, 7.06) gc.quad_curve_to(15.97, 4.74, 18.70, 4.74) gc.quad_curve_to(22.41, 4.74, 28.47, 9.62) gc.close_path() class MyCanvas(Component): def draw(self, gc, **kwargs): w,h = gc.width(), gc.height() gc.move_to(0,0) gc.line_to(w,h) gc.set_stroke_color((1,0,0)) gc.stroke_path() gc.move_to(0,h) gc.line_to(w,0) gc.set_stroke_color((0,1,0)) gc.stroke_path() gc.rect(0,0,w,h) gc.set_stroke_color((0,0,0,.5)) gc.set_line_width(20) gc.stroke_path() gc.set_fill_color((0,0,1,0.0)) gc.rect(0,0,w,h) gc.draw_path() gc.set_line_width(1) gc.translate_ctm(w/2.0,h/2.0) with gc: gc.scale_ctm(2.0,2.0) glyph_a(gc) gc.stroke_path() gc.translate_ctm(0,-20) gc.scale_ctm(2.0,2.0) glyph_a(gc) gc.set_fill_color((0,0,1,1.0)) gc.fill_path() class Demo(HasTraits): canvas = Instance(Component) traits_view = View(Item('canvas', editor=ComponentEditor(bgcolor="lightgray"), show_label=False, width=500, height=500), resizable=True, title="Gradient Example") def _canvas_default(self): return MyCanvas() if __name__ == "__main__": Demo().configure_traits() enthought-chaco2-4.8.1.orig/examples/kiva/ellipse.py0000644000175000017500000000151313233644505021461 0ustar varunvarun from scipy import pi from kiva.image import GraphicsContext def draw_ellipse(gc, x, y, major, minor, angle): """ Draws an ellipse given major and minor axis lengths. **angle** is the angle between the major axis and the X axis, in radians. """ with gc: gc.translate_ctm(x, y) ratio = float(major) / minor gc.rotate_ctm(angle) gc.scale_ctm(ratio, 1.0) gc.arc(0, 0, minor, 0.0, 2 * pi) gc.stroke_path() gc.move_to(-minor, 0) gc.line_to(minor, 0) gc.move_to(0, -minor) gc.line_to(0, minor) gc.stroke_path() gc = GraphicsContext((300,300)) gc.set_alpha(0.3) gc.set_stroke_color((1.0,0.0,0.0)) gc.set_fill_color((0.0,1.0,0.0)) gc.rect(95, 95, 10, 10) gc.fill_path() draw_ellipse(gc, 100, 100, 35.0, 25.0, pi / 6) gc.save("ellipse.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/simple2.py0000644000175000017500000000052013233644505021374 0ustar varunvarunfrom kiva.image import GraphicsContext gc = GraphicsContext((500,500)) gc.set_fill_color( (1, 0, 0) ) gc.rect(100,100,300,300) gc.draw_path() gc.save("simple2_pre.bmp") # directly manipulate the underlying Numeric array. # The color tuple is expressed as BGRA. gc.bmp_array[:100,:100] = (139, 60, 71, 255) gc.save("simple2_post.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/simple_clip.py0000644000175000017500000000216313233644505022326 0ustar varunvarunfrom __future__ import print_function import time from kiva.image import GraphicsContext samples = 1 pt = (250, 250) sz = (100, 100) transparent = (1,1,1,0.) gc_img = GraphicsContext((500,500)) #gc_img.clear(transparent) # clear isn't working... gc_img.bmp_array[:] = (255,255,255,0) gc_img.set_fill_color((1,0,0,.5)) gc_img.set_stroke_color((0,0,1)) gc_img.rect(pt[0],pt[1],sz[0],sz[1]) gc_img.draw_path() gc_main = GraphicsContext((500,500)) gc_main.set_fill_color((0,0,1,.5)) gc_main.set_stroke_color((0,1,0)) gc_main.rect(300,300,100,100) gc_main.draw_path() gc_main.clip_to_rect(pt[0],pt[1],sz[0],sz[1]) t1 = time.clock() for i in range(samples): gc_main.draw_image(gc_img) t2 = time.clock() print('with clip', t2 - t1) gc_main.save("with_clip.bmp") #gc_main.clear(transparent) gc_main.bmp_array[:] = (255,255,255,255) gc_main.clear_clip_path() gc_main.set_fill_color((0,0,1,.5)) gc_main.set_stroke_color((0,1,0)) gc_main.rect(300,300,100,100) gc_main.draw_path() t1 = time.clock() for i in range(samples): gc_main.draw_image(gc_img) t2 = time.clock() print('without clip', t2 - t1) gc_main.save("without_clip.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/gradient.py0000644000175000017500000000513613272065321021622 0ustar varunvarunfrom numpy import array, pi from os.path import splitext from enable.kiva_graphics_context import GraphicsContext from kiva.fonttools import Font from kiva import constants def draw(gc): # colors are 5 doubles: offset, red, green, blue, alpha starting_color = array([0.0, 1.0, 1.0, 1.0, 1.0]) ending_color = array([1.0, 0.0, 0.0, 0.0, 1.0]) gc.clear() # diagonal with gc: gc.rect(50,25,150,100) gc.linear_gradient(50,25,150,125, array([starting_color, ending_color]), "pad") gc.draw_path(constants.FILL) # vertical top to bottom with gc: gc.rect(50,150,150,50) gc.linear_gradient(0,200, 0,150, array([starting_color, ending_color]), "pad") gc.draw_path(constants.FILL) # horizontal left to right with gc: gc.rect(50,200,150,50) gc.linear_gradient(50,0, 150,0, array([starting_color, ending_color]), "pad") gc.draw_path(constants.FILL) # vertical bottom to top with gc: gc.rect(50,275,150,50) gc.linear_gradient(0,275, 0,325, array([starting_color, ending_color]), "pad") gc.draw_path(constants.FILL) # horizontal right to left with gc: gc.rect(50,325,150,50) gc.linear_gradient(200,0, 100,0, array([starting_color, ending_color]), "pad") gc.draw_path(constants.FILL) # radial with gc: gc.arc(325, 75, 50, 0.0, 2*pi) gc.radial_gradient(325, 75, 50, 325, 75, array([starting_color, ending_color]), "pad") gc.draw_path(constants.FILL) # radial with focal point in upper left with gc: gc.arc(325, 200, 50, 0.0, 2*pi) gc.radial_gradient(325, 200, 50, 300, 225, array([starting_color, ending_color]), "pad") gc.draw_path(constants.FILL) # radial with focal point in bottom right with gc: gc.arc(325, 325, 50, 0.0, 2*pi) gc.radial_gradient(325, 325, 50, 350, 300, array([starting_color, ending_color]), "pad") gc.draw_path(constants.FILL) return def main(): gc = GraphicsContext((500, 500)) gc.scale_ctm(1.25, 1.25) draw(gc) gc.save(splitext(__file__)[0]+'.png', file_format='png') if __name__ == '__main__': main() enthought-chaco2-4.8.1.orig/examples/kiva/rect.py0000644000175000017500000000024113233644505020756 0ustar varunvarunfrom enable.kiva_graphics_context import GraphicsContext gc = GraphicsContext((500,500)) gc.clear() gc.rect(100,100,300,300) gc.draw_path() gc.save("rect.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/star_path.py0000644000175000017500000000533213233644505022014 0ustar varunvarun from numpy import cos, sin, arange, pi, array from kiva.image import GraphicsContext from kiva.constants import * def draw_circle(gc,radius=2): gc.begin_path() angle = 0 gc.move_to(radius*cos(angle), radius*sin(angle)) for angle in arange(pi/4.,2*pi,pi/4.): gc.line_to(radius*cos(angle), radius*sin(angle)) gc.close_path() gc.fill_path() star_points = [(-20,-30), (0, 30), (20,-30), (-30,10), (30,10), (-20,-30)] ring_point = (0,35) ring_radius = 5 fill_color = array((200.,184.,106.))/255. point_color = array((.3,.3,.3)) line_color = point_color for i in range(len(star_points)+1): gc = GraphicsContext((800,800)) gc.scale_ctm(8.0,8.0) gc.translate_ctm(50,50) # draw star gc.set_alpha(.5) x,y = star_points[0] gc.move_to(x,y) for x,y in star_points[1:]: gc.line_to(x,y) gc.close_path() gc.set_fill_color(fill_color) gc.get_fill_color() gc.fill_path() gc.set_alpha(.4) gc.set_stroke_color(line_color) gc.set_fill_color(line_color) gc.set_line_width(12) if i > 0: with gc: x,y = star_points[0] gc.translate_ctm(x,y) draw_circle(gc) if i > 1: points = star_points[:i] with gc: x,y = points[0] gc.move_to(x,y) for x,y in points[1:]: gc.line_to(x,y) gc.stroke_path() """ for x,y in points: with gc: gc.translate_ctm(x,y) draw_circle(gc) """ gc.save("star_path%d.bmp" % i) # draw star line_color = (0.0,0.0,0.0) gc = GraphicsContext((800,800)) gc.scale_ctm(8.0,8.0) gc.translate_ctm(50,50) gc.set_stroke_color(line_color) gc.set_fill_color(fill_color) gc.set_line_width(12) x,y = star_points[0] gc.move_to(x,y) for x,y in star_points[1:]: gc.line_to(x,y) gc.close_path() gc.set_fill_color(fill_color) gc.get_fill_color() gc.draw_path() gc.save("star_path7.bmp") # draw star gc = GraphicsContext((1700,400)) line_color = (0.0,0.0,0.0) gc.scale_ctm(4.0,4.0) offsets = array(((0,0),(80,0),(160,0),(240,0),(320,0))) modes = [FILL, EOF_FILL, STROKE, FILL_STROKE, EOF_FILL_STROKE] pairs = list(zip(modes, offsets)) center = array((50,50)) for mode, offset in pairs: with gc: xo,yo = center+offset gc.translate_ctm(xo,yo) gc.set_stroke_color(line_color) gc.set_fill_color(fill_color) gc.set_line_width(12) x,y = star_points[0] gc.move_to(x,y) for x,y in star_points[1:]: gc.line_to(x,y) gc.close_path() gc.set_fill_color(fill_color) gc.get_fill_color() gc.draw_path(mode) gc.save("star_path8.bmp") enthought-chaco2-4.8.1.orig/examples/kiva/qt4_simple.py0000644000175000017500000000316513233644505022112 0ustar varunvarun# This is PyQt specific so force the toolkit selection. from traits.etsconfig.api import ETSConfig ETSConfig.toolkit = 'qt4.qpainter' from numpy import array import sys try: from pyface.qt import QtGui except ImportError: raise Exception('PyQt4 needs to be installed to run this example') from enable.example_canvas import Canvas class MyCanvas(Canvas): def do_draw(self, gc): w = gc.width() h = gc.height() # Draw a red gradient filled box with green border gc.rect(w/4, h/4, w/2, h/2) gc.set_line_width(5.0) gc.set_stroke_color((0.0, 1.0, 0.0, 1.0)) start = array([0.0, 1.0, 0.0, 0.0, 1.0]) end = array([1.0, 1.0, 1.0, 1.0, 1.0]) gc.radial_gradient(w/4, h/4, 200, w/4+100, h/4+100, array([start, end]), 'reflect') gc.draw_path() # draw a black rect with rounded corners r = max(1, min(w,h)/10) gc.set_line_width(2.0) gc.set_stroke_color((0.0, 0.0, 0.0, 1.0)) gc.move_to(w/3, h/2) gc.arc_to(w/3, 2*h/3, w/2, 2*h/3, r) gc.arc_to(2*w/3, 2*h/3, 2*w/3, h/2, r) gc.arc_to(2*w/3, h/3, w/2, h/3, r) gc.arc_to(w/3, h/3, w/3, h/2, r) gc.line_to(w/3, h/2) gc.stroke_path() return if __name__ == "__main__": app = QtGui.QApplication(sys.argv) w = MyCanvas() w.control.resize(500, 500) w.control.setWindowTitle("Simple Kiva.qt4 example") w.control.show() app.exec_() enthought-chaco2-4.8.1.orig/examples/kiva/dash.py0000644000175000017500000000135513233644505020747 0ustar varunvarunfrom __future__ import print_function import time import numpy from kiva import constants from kiva.agg import GraphicsContextArray def dash(sz=(1000,1000)): gc = GraphicsContextArray(sz) gc.set_fill_color((1.0,0.0,0.0,0.1)) gc.set_stroke_color((0.0,1.0,0.0,0.6)) width = 10 gc.set_line_width(10) phase = width * 2.5; pattern = width * numpy.array((5,5)) gc.set_line_dash(pattern,phase) gc.set_line_cap(constants.CAP_BUTT) t1 = time.clock() gc.move_to(10,10) gc.line_to(sz[0]-10,sz[1]-10) gc.line_to(10,sz[1]-10) gc.close_path() gc.draw_path() t2 = time.clock() gc.save("dash.bmp") tot_time = t2 - t1 print('time:', tot_time) if __name__ == "__main__": dash() enthought-chaco2-4.8.1.orig/examples/kiva/dummy.py0000644000175000017500000001460413233644505021164 0ustar varunvarun from enable.kiva_graphics_context import GraphicsContext from kiva import affine, agg, constants from kiva.fonttools import Font # Do some basic drawing tests and write the results out to PNG files. # This is mostly a python translation of the tests in kiva/agg/src/dummy.cpp black = (0.0, 0.0, 0.0, 1.0) white = (1.0, 1.0, 1.0, 1.0) lightgray = (0.2, 0.2, 0.2, 1.0) red = (1.0, 0.0, 0.0, 1.0) green = (0.0, 1.0, 0.0, 1.0) blue = (0.0, 0.0, 1.0, 1.0) niceblue = (0.411, 0.584, 0.843, 1.0) PI = 3.141592654 def draw_sub_image(gc, width, height): gc.clear(white) fill_color = green[:3] + (0.4,) #We want green, but with an alpha of 0.4 gc.set_fill_color(fill_color) gc.rect(0,0,width,height) gc.fill_path() gc.set_stroke_color(red) gc.move_to(0.0, 0.0) gc.line_to(width, height) gc.stroke_path() gc.set_stroke_color(blue) gc.move_to(0.0, height) gc.line_to(width, 0.0) gc.stroke_path() def test_arc_to2(gc, x2, y2, radiusstep=25.0): gc.set_stroke_color(lightgray) gc.move_to(0,0) gc.line_to(100,0) gc.line_to(x2, y2) gc.stroke_path() gc.set_stroke_color(black) numradii = 7 for i in range(numradii): gc.move_to(0,0) gc.arc_to(100, 0, x2, y2, i*radiusstep+20.0) gc.stroke_path() def test_arc_curve(gc): with gc: gc.translate_ctm(50.0, 50.0) gc.rotate_ctm(PI/8) gc.set_stroke_color(blue) gc.rect(0.5, 0.5, 210, 210) gc.stroke_path() gc.set_stroke_color(black) gc.set_line_width(1) gc.move_to(50.5, 25.5) gc.arc(50.5, 50.5, 50.0, 0.0, PI/2, False) gc.move_to(100.5, 50.5) gc.arc(100.5, 50.5, 50.0, 0.0, -PI/2*0.8, False) gc.stroke_path() with gc: gc.translate_ctm(250.5, 50.5) gc.set_stroke_color(blue) gc.rect(0.5, 0.5, 250.0, 250.0) gc.stroke_path() gc.set_stroke_color(red) gc.move_to(100.0, 100.0) gc.line_to(100.0, 150.0) gc.arc_to(100.0, 200.0, 150.0, 200.0, 50.0) gc.line_to(200.0, 200.0) gc.close_path() gc.stroke_path() def test_arc_to(gc): # We don't have compiled paths yet, so we simulate them by python functions def axes(gc): gc.move_to(0.5, 50.5) gc.line_to(100.5, 50.5) gc.move_to(50.5, 0.5) gc.line_to(50.5, 100.5) def box(gc): gc.move_to(0.5, 0.5) gc.line_to(100.5, 0.5) gc.line_to(100.5, 100.5) gc.line_to(0.5, 100.5) gc.close_path() def arc(gc): gc.move_to(10,10) gc.line_to(20,10) gc.arc_to(40, 10, 40, 30, 20) gc.line_to(40,40) def whole_shebang(gc): with gc: axes(gc) box(gc) gc.translate_ctm(0.0, 50.5) arc(gc) gc.translate_ctm(50.5, 50.5) gc.rotate_ctm(-PI/2) arc(gc) gc.rotate_ctm(PI/2) gc.translate_ctm(50.5, -50.5) gc.rotate_ctm(-PI) arc(gc) gc.rotate_ctm(PI) gc.translate_ctm(-50.5, -50.5) gc.rotate_ctm(-3*PI/2) arc(gc) gc.set_stroke_color(red) gc.set_line_width(1.0) with gc: gc.translate_ctm(50.5, 300.5) whole_shebang(gc) gc.stroke_path() gc.translate_ctm(130.5, 50.0) with gc: gc.rotate_ctm(PI/6) whole_shebang(gc) gc.set_stroke_color(blue) gc.stroke_path() gc.translate_ctm(130.5, 0.0) with gc: gc.rotate_ctm(PI/3) gc.scale_ctm(1.0, 2.0) whole_shebang(gc) gc.stroke_path() with gc: gc.translate_ctm(150.5, 20.5) test_arc_to2(gc, 160.4, 76.5, 50.0) gc.translate_ctm(120.5, 100.5) gc.scale_ctm(-1.0, 1.0) test_arc_to2(gc, 70.5, 96.5) gc.translate_ctm(-300.5, 100.5) gc.scale_ctm(0.75, -1.0) test_arc_to2(gc, 160.5, 76.5, 50.0) def test_simple_clip_stack(gc): gc.clear(white) gc.clip_to_rect(100.0, 100.0, 1.0, 1.0) gc.rect(0.0, 0.0, gc.width(), gc.height()) gc.set_fill_color(red) gc.fill_path() def test_clip_stack(gc): sub_windows = ((10.5, 250, 200, 200), (220.5, 250, 200, 200), (430.5, 250, 200, 200), (10.5, 10, 200, 200), (220.5, 10, 200, 200), (430.5, 10, 200, 200)) gc.set_line_width(2) gc.set_stroke_color(black) gc.rects(sub_windows) gc.stroke_path() img = GraphicsContext((200, 200)) main_rects = ((40.5, 30.5, 120, 50), (40.5, 120.5, 120, 50)) disjoint_rects = ((60.5, 115.5, 80, 15), (60.5, 70.5, 80, 15)) vert_rect = (60.5, 10.5, 55, 180) # Draw the full image draw_sub_image(img, 200, 200) gc.draw_image(img, sub_windows[0]) img.clear() # First clip img.clip_to_rects(main_rects) draw_sub_image(img, 200, 200); gc.draw_image(img, sub_windows[1]) # Second Clip with img: img.clear() img.clip_to_rects(main_rects) img.clip_to_rect(*vert_rect) draw_sub_image(img, 200, 200) gc.draw_image(img, sub_windows[2]) # Pop back to first clip img.clear() draw_sub_image(img, 200, 200) gc.draw_image(img, sub_windows[3]) # Adding a disjoing set of rects img.clear() with img: img.clip_to_rects(main_rects) img.clip_to_rects(disjoint_rects) draw_sub_image(img, 200, 200) gc.draw_image(img, sub_windows[4]) # Pop back to first clip img.clear() draw_sub_image(img, 200, 200) gc.draw_image(img, sub_windows[5]) def test_handling_text(gc): font = Font(face_name="Arial", size = 32) gc.set_font(font) gc.translate_ctm(100.0, 100.0) gc.move_to(-5,0) gc.line_to(5,0) gc.move_to(0,5) gc.line_to(0,-5) gc.move_to(0,0) gc.stroke_path() txtRot = agg.rotation_matrix(PI/6) gc.set_text_matrix(txtRot) gc.show_text("Hello") txtRot.invert() gc.set_text_matrix(txtRot) gc.show_text("inverted") if __name__ == "__main__": tests = ((test_clip_stack, "clip_stack.png"), (test_arc_to, "arc_to.png"), (test_handling_text, "handling_text.png")) for test_func, filename in tests: img = GraphicsContext((800, 600)) img.clear(white) test_func(img) img.save(filename) enthought-chaco2-4.8.1.orig/examples/kiva/star.py0000644000175000017500000000126013233644505020774 0ustar varunvarun from scipy import pi from kiva.image import GraphicsContext def add_star(gc): gc.begin_path() gc.move_to(-20,-30) gc.line_to(0,30) gc.line_to(20,-30) gc.line_to(-30,10) gc.line_to(30,10) gc.close_path() gc.move_to(-10,30) gc.line_to(10,30) gc = GraphicsContext((500,500)) with gc: gc.set_alpha(0.3) gc.set_stroke_color((1.0,0.0,0.0)) gc.set_fill_color((0.0,1.0,0.0)) for i in range(0,600,5): with gc: gc.translate_ctm(i,i) gc.rotate_ctm(i*pi/180.) add_star(gc) gc.draw_path() gc.set_fill_color((0.5,0.5,0.5,0.4)) gc.rect(150,150,200,200) gc.fill_path() gc.save("star.bmp") enthought-chaco2-4.8.1.orig/examples/savage/0000755000175000017500000000000013544357574020002 5ustar varunvarunenthought-chaco2-4.8.1.orig/examples/savage/button_demo.py0000644000175000017500000000260013233644505022655 0ustar varunvarunfrom copy import copy import os.path from enable.savage.trait_defs.ui.svg_button import SVGButton from traits.api import HasTraits, Str from traitsui.api import Item, View, HGroup button_size = (64, 64) class ButtonDemo(HasTraits): copy_button = SVGButton(label='Copy', filename=os.path.join(os.path.dirname(__file__), 'edit-copy.svg'), width=button_size[0], height=button_size[1]) paste_button = SVGButton(label='Paste', filename=os.path.join(os.path.dirname(__file__), 'edit-paste.svg'), width=button_size[0], height=button_size[1]) text = Str clipboard = Str traits_view = View(HGroup(Item('copy_button', show_label=False), Item('paste_button', show_label=False, enabled_when='len(clipboard)>0')), Item('text', width=200), title='SVG Button Demo') def _copy_button_fired(self, event): self.clipboard = copy(self.text) def _paste_button_fired(self, event): self.text += self.clipboard if __name__ == "__main__": example = ButtonDemo() example.configure_traits() enthought-chaco2-4.8.1.orig/examples/savage/buttons_on_canvas.py0000644000175000017500000001133513233644505024070 0ustar varunvarunfrom __future__ import print_function import os.path import xml.etree.cElementTree as etree from enable.api import Container, Component, ComponentEditor, BaseTool from kiva.constants import MODERN from kiva.fonttools import Font from traits.api import Instance, Callable, List, Str, HasTraits, Enum from traitsui.api import View, Item from enable.savage.svg.document import SVGDocument from enable.savage.svg.backends.kiva.renderer import Renderer as KivaRenderer class CanvasButton(Component): document = Instance(SVGDocument) toggle_document = Instance(SVGDocument) label = Str() callback = Callable callback_args = List(Str) state = Enum('up', 'down') bounds = [64, 64] def __init__(self, filename, callback, callback_args, *args, **kw): super(CanvasButton, self).__init__(*args, **kw) self.document = self._load_svg_document(filename) # set the toggle doc if it wasn't passed in as a keyword arg if self.toggle_document is None: toggle_filename = os.path.join(os.path.dirname(__file__), 'button_toggle.svg') self.toggle_document = self._load_svg_document(toggle_filename) self.callback = callback self.callback_args = callback_args def draw(self, gc, view_bounds, mode): if self.state == 'down': self._draw_svg_document(gc, self.toggle_document) self._draw_svg_document(gc, self.document) if len(self.label) > 0: self._draw_label(gc) def _load_svg_document(self, filename): if not os.path.exists(filename): raise ValueError tree = etree.parse(filename) root = tree.getroot() return SVGDocument(root, renderer=KivaRenderer) def _draw_svg_document(self, gc, document): with gc: gc.translate_ctm(self.x, self.y+self.height) doc_size = document.getSize() gc.scale_ctm(self.width/float(doc_size[0]), -self.height/float(doc_size[1])) document.render(gc) def _draw_label(self, gc): with gc: font = Font(family=MODERN) gc.set_font(font) x, y, width, height = gc.get_text_extent(self.label) text_x = self.x + (self.width - width)/2.0 text_y = self.y - height gc.show_text(self.label, (text_x, text_y)) def perform(self): self.callback(*self.callback_args) class ButtonCanvas(Container): def draw(self, gc, view_bounds=None, mode="default"): for component in self.components: component.draw(gc, view_bounds, mode) def add_button(self, button): button.container = self self.components.append(button) class ButtonSelectionTool(BaseTool): """ Listens for double-clicks and tries to open a traits editor on the graph node under the mouse. """ def normal_left_down(self, event): for component in self.component.components: if isinstance(component, CanvasButton) \ and component.is_in(event.x, event.y): component.state = 'down' component.request_redraw() component.perform() break def normal_left_up(self, event): for component in self.component.components: if isinstance(component, CanvasButton): component.state = 'up' component.request_redraw() class ButtonCanvasView(HasTraits): canvas = Instance(Container) traits_view = View(Item('canvas', editor=ComponentEditor(), show_label=False), width=400, height=400, resizable=True) def __init__(self, *args, **kw): super(ButtonCanvasView, self).__init__(*args, **kw) self.add_buttons() def _canvas_default(self): """ default setter for _canvas """ container = ButtonCanvas() container.tools.append(ButtonSelectionTool(component=container)) return container def add_buttons(self): data_dir = os.path.dirname(__file__) self.canvas.add_button(CanvasButton(os.path.join(data_dir, 'edit-copy.svg'), self.do_copy, [], label="Copy", x=150, y=150,)) self.canvas.add_button(CanvasButton(os.path.join(data_dir, 'edit-paste.svg'), self.do_paste, [], label="Paste", x=250, y=150)) def do_copy(self): print("copying something") def do_paste(self): print("pasting something") if __name__ == "__main__": ButtonCanvasView().configure_traits() enthought-chaco2-4.8.1.orig/examples/savage/static_image.py0000644000175000017500000000250613233644505022774 0ustar varunvarunfrom enable.savage.svg.document import SVGDocument from enable.savage.trait_defs.ui.svg_editor import SVGEditor from traits.api import HasTraits, Instance from traitsui.api import Item, View class StaticImageExample(HasTraits): svg = Instance(SVGDocument) traits_view = View(Item('svg', editor=SVGEditor(), width=450, height=450, show_label=False), resizable=True, title="StaticImageExample") def __init__(self, filename, renderer, *args, **kw): super(StaticImageExample, self).__init__(*args, **kw) self.svg = SVGDocument.createFromFile(filename, renderer=renderer) if __name__ == "__main__": import os.path import sys if '--wx' in sys.argv: from enable.savage.svg.backends.wx.renderer import Renderer sys.argv.remove('--wx') elif '--kiva' in sys.argv: from enable.savage.svg.backends.kiva.renderer import Renderer sys.argv.remove('--kiva') else: from enable.savage.svg.backends.kiva.renderer import Renderer if len(sys.argv) > 1: StaticImageExample(sys.argv[1], Renderer).configure_traits() else: filename = os.path.join(os.path.dirname(__file__), 'lion.svg') StaticImageExample(filename, Renderer).configure_traits() enthought-chaco2-4.8.1.orig/examples/savage/toggle_demo.py0000644000175000017500000000124113233644505022623 0ustar varunvarunimport os from traits.api import HasTraits from traitsui.api import View, Item from enable.savage.trait_defs.ui.svg_button import SVGButton pause_icon = os.path.join(os.path.dirname(__file__), 'player_pause.svg') resume_icon = os.path.join(os.path.dirname(__file__), 'player_play.svg') class SVGDemo(HasTraits): pause = SVGButton('Pause', filename=pause_icon, toggle_filename=resume_icon, toggle_state=True, toggle_label='Resume', toggle_tooltip='Resume', tooltip='Pause', toggle=True) trait_view = View(Item('pause')) SVGDemo().configure_traits() enthought-chaco2-4.8.1.orig/examples/kiva_explorer.py0000644000175000017500000000677513233644505021763 0ustar varunvarun""" Kiva Explorer ============= Interactive editor for exploring Kiva drawing commands. """ import time from traits.api import Any, Code, Float, Instance, Property, Str from traitsui.api import HSplit, ModelView, UItem, VGroup, View from enable.api import Component, ComponentEditor default_script = """# Write your code here. # The graphics context is available as gc. from math import pi from kiva import constants from kiva.fonttools import Font with gc: gc.set_fill_color((1.0, 1.0, 0.0, 1.0)) gc.arc(200, 200, 100, 0, 2*pi) gc.fill_path() with gc: gc.set_font(Font('Times New Roman', size=24)) gc.translate_ctm(200, 200) for i in range(0, 12): gc.set_fill_color((i/12.0, 0.0, 1.0-(i/12.0), 0.75)) gc.rotate_ctm(2*pi/12.0) gc.show_text_at_point("Hello World", 20, 0) gc.set_stroke_color((0.0, 0.0, 1.0, 1.0)) gc.set_line_width(7) gc.set_line_join(constants.JOIN_ROUND) gc.set_line_cap(constants.CAP_ROUND) gc.rect(100, 400, 50, 50) gc.stroke_path() """ class ScriptedComponent(Component): """ An Enable component that draws its mainlayer from a script """ #: kiva drawing code for mainlayer draw_script = Code(default_script) #: any errors which occur error = Str #: how long did the last draw take last_draw_time = Float(0.0) fps_display = Property(Str, depends_on='last_draw_time') #: compiled code _draw_code = Any def _draw_mainlayer(self, gc, view_bounds=None, mode="default"): """ Try running the compiled code with the graphics context as `gc` """ with gc: try: self.error = '' start_time = time.time() exec(self._draw_code, {}, {'gc': gc}) self.last_draw_time = time.time() - start_time except Exception as exc: self.error = str(exc) def _compile_script(self): """ Try compiling the script to bytecode """ try: self.error = '' return compile(self.draw_script, "