vispy 0.15.0__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vispy might be problematic. Click here for more details.
- vispy/__init__.py +33 -0
- vispy/app/__init__.py +15 -0
- vispy/app/_default_app.py +76 -0
- vispy/app/_detect_eventloop.py +148 -0
- vispy/app/application.py +263 -0
- vispy/app/backends/__init__.py +52 -0
- vispy/app/backends/_egl.py +264 -0
- vispy/app/backends/_glfw.py +513 -0
- vispy/app/backends/_jupyter_rfb.py +278 -0
- vispy/app/backends/_offscreen_util.py +121 -0
- vispy/app/backends/_osmesa.py +235 -0
- vispy/app/backends/_pyglet.py +451 -0
- vispy/app/backends/_pyqt4.py +36 -0
- vispy/app/backends/_pyqt5.py +36 -0
- vispy/app/backends/_pyqt6.py +40 -0
- vispy/app/backends/_pyside.py +37 -0
- vispy/app/backends/_pyside2.py +52 -0
- vispy/app/backends/_pyside6.py +53 -0
- vispy/app/backends/_qt.py +1003 -0
- vispy/app/backends/_sdl2.py +444 -0
- vispy/app/backends/_template.py +244 -0
- vispy/app/backends/_test.py +8 -0
- vispy/app/backends/_tk.py +800 -0
- vispy/app/backends/_wx.py +476 -0
- vispy/app/backends/tests/__init__.py +0 -0
- vispy/app/backends/tests/test_offscreen_util.py +52 -0
- vispy/app/backends/tests/test_rfb.py +77 -0
- vispy/app/base.py +294 -0
- vispy/app/canvas.py +828 -0
- vispy/app/qt.py +92 -0
- vispy/app/tests/__init__.py +0 -0
- vispy/app/tests/qt-designer.ui +58 -0
- vispy/app/tests/test_app.py +442 -0
- vispy/app/tests/test_backends.py +164 -0
- vispy/app/tests/test_canvas.py +122 -0
- vispy/app/tests/test_context.py +92 -0
- vispy/app/tests/test_qt.py +47 -0
- vispy/app/tests/test_simultaneous.py +134 -0
- vispy/app/timer.py +174 -0
- vispy/color/__init__.py +17 -0
- vispy/color/_color_dict.py +193 -0
- vispy/color/color_array.py +447 -0
- vispy/color/color_space.py +181 -0
- vispy/color/colormap.py +1213 -0
- vispy/color/tests/__init__.py +0 -0
- vispy/color/tests/test_color.py +378 -0
- vispy/conftest.py +12 -0
- vispy/ext/__init__.py +0 -0
- vispy/ext/cocoapy.py +1522 -0
- vispy/ext/cubehelix.py +138 -0
- vispy/ext/egl.py +375 -0
- vispy/ext/fontconfig.py +118 -0
- vispy/ext/gdi32plus.py +206 -0
- vispy/ext/osmesa.py +105 -0
- vispy/geometry/__init__.py +23 -0
- vispy/geometry/_triangulation_debugger.py +171 -0
- vispy/geometry/calculations.py +162 -0
- vispy/geometry/curves.py +399 -0
- vispy/geometry/generation.py +643 -0
- vispy/geometry/isocurve.py +175 -0
- vispy/geometry/isosurface.py +465 -0
- vispy/geometry/meshdata.py +700 -0
- vispy/geometry/normals.py +78 -0
- vispy/geometry/parametric.py +56 -0
- vispy/geometry/polygon.py +137 -0
- vispy/geometry/rect.py +210 -0
- vispy/geometry/tests/__init__.py +0 -0
- vispy/geometry/tests/test_calculations.py +23 -0
- vispy/geometry/tests/test_generation.py +56 -0
- vispy/geometry/tests/test_meshdata.py +106 -0
- vispy/geometry/tests/test_triangulation.py +594 -0
- vispy/geometry/torusknot.py +142 -0
- vispy/geometry/triangulation.py +876 -0
- vispy/gloo/__init__.py +56 -0
- vispy/gloo/buffer.py +505 -0
- vispy/gloo/context.py +272 -0
- vispy/gloo/framebuffer.py +257 -0
- vispy/gloo/gl/__init__.py +234 -0
- vispy/gloo/gl/_constants.py +332 -0
- vispy/gloo/gl/_es2.py +986 -0
- vispy/gloo/gl/_gl2.py +1365 -0
- vispy/gloo/gl/_proxy.py +499 -0
- vispy/gloo/gl/_pyopengl2.py +362 -0
- vispy/gloo/gl/dummy.py +24 -0
- vispy/gloo/gl/es2.py +62 -0
- vispy/gloo/gl/gl2.py +98 -0
- vispy/gloo/gl/glplus.py +168 -0
- vispy/gloo/gl/pyopengl2.py +97 -0
- vispy/gloo/gl/tests/__init__.py +0 -0
- vispy/gloo/gl/tests/test_basics.py +282 -0
- vispy/gloo/gl/tests/test_functionality.py +568 -0
- vispy/gloo/gl/tests/test_names.py +246 -0
- vispy/gloo/gl/tests/test_use.py +71 -0
- vispy/gloo/glir.py +1824 -0
- vispy/gloo/globject.py +101 -0
- vispy/gloo/preprocessor.py +67 -0
- vispy/gloo/program.py +543 -0
- vispy/gloo/tests/__init__.py +0 -0
- vispy/gloo/tests/test_buffer.py +558 -0
- vispy/gloo/tests/test_context.py +119 -0
- vispy/gloo/tests/test_framebuffer.py +195 -0
- vispy/gloo/tests/test_glir.py +307 -0
- vispy/gloo/tests/test_globject.py +35 -0
- vispy/gloo/tests/test_program.py +302 -0
- vispy/gloo/tests/test_texture.py +732 -0
- vispy/gloo/tests/test_use_gloo.py +187 -0
- vispy/gloo/tests/test_util.py +60 -0
- vispy/gloo/tests/test_wrappers.py +261 -0
- vispy/gloo/texture.py +1046 -0
- vispy/gloo/util.py +129 -0
- vispy/gloo/wrappers.py +762 -0
- vispy/glsl/__init__.py +42 -0
- vispy/glsl/antialias/antialias.glsl +7 -0
- vispy/glsl/antialias/cap-butt.glsl +31 -0
- vispy/glsl/antialias/cap-round.glsl +29 -0
- vispy/glsl/antialias/cap-square.glsl +30 -0
- vispy/glsl/antialias/cap-triangle-in.glsl +30 -0
- vispy/glsl/antialias/cap-triangle-out.glsl +30 -0
- vispy/glsl/antialias/cap.glsl +67 -0
- vispy/glsl/antialias/caps.glsl +67 -0
- vispy/glsl/antialias/filled.glsl +50 -0
- vispy/glsl/antialias/outline.glsl +40 -0
- vispy/glsl/antialias/stroke.glsl +43 -0
- vispy/glsl/arrowheads/angle.glsl +99 -0
- vispy/glsl/arrowheads/arrowheads.frag +60 -0
- vispy/glsl/arrowheads/arrowheads.glsl +12 -0
- vispy/glsl/arrowheads/arrowheads.vert +83 -0
- vispy/glsl/arrowheads/curved.glsl +48 -0
- vispy/glsl/arrowheads/inhibitor.glsl +26 -0
- vispy/glsl/arrowheads/stealth.glsl +46 -0
- vispy/glsl/arrowheads/triangle.glsl +97 -0
- vispy/glsl/arrowheads/util.glsl +13 -0
- vispy/glsl/arrows/angle-30.glsl +12 -0
- vispy/glsl/arrows/angle-60.glsl +12 -0
- vispy/glsl/arrows/angle-90.glsl +12 -0
- vispy/glsl/arrows/arrow.frag +39 -0
- vispy/glsl/arrows/arrow.vert +49 -0
- vispy/glsl/arrows/arrows.glsl +17 -0
- vispy/glsl/arrows/common.glsl +187 -0
- vispy/glsl/arrows/curved.glsl +63 -0
- vispy/glsl/arrows/stealth.glsl +50 -0
- vispy/glsl/arrows/triangle-30.glsl +12 -0
- vispy/glsl/arrows/triangle-60.glsl +12 -0
- vispy/glsl/arrows/triangle-90.glsl +12 -0
- vispy/glsl/arrows/util.glsl +98 -0
- vispy/glsl/build_spatial_filters.py +660 -0
- vispy/glsl/collections/agg-fast-path.frag +20 -0
- vispy/glsl/collections/agg-fast-path.vert +78 -0
- vispy/glsl/collections/agg-glyph.frag +60 -0
- vispy/glsl/collections/agg-glyph.vert +33 -0
- vispy/glsl/collections/agg-marker.frag +35 -0
- vispy/glsl/collections/agg-marker.vert +48 -0
- vispy/glsl/collections/agg-path.frag +55 -0
- vispy/glsl/collections/agg-path.vert +166 -0
- vispy/glsl/collections/agg-point.frag +21 -0
- vispy/glsl/collections/agg-point.vert +35 -0
- vispy/glsl/collections/agg-segment.frag +32 -0
- vispy/glsl/collections/agg-segment.vert +75 -0
- vispy/glsl/collections/marker.frag +38 -0
- vispy/glsl/collections/marker.vert +48 -0
- vispy/glsl/collections/raw-path.frag +15 -0
- vispy/glsl/collections/raw-path.vert +24 -0
- vispy/glsl/collections/raw-point.frag +14 -0
- vispy/glsl/collections/raw-point.vert +31 -0
- vispy/glsl/collections/raw-segment.frag +18 -0
- vispy/glsl/collections/raw-segment.vert +26 -0
- vispy/glsl/collections/raw-triangle.frag +13 -0
- vispy/glsl/collections/raw-triangle.vert +26 -0
- vispy/glsl/collections/sdf-glyph-ticks.vert +69 -0
- vispy/glsl/collections/sdf-glyph.frag +80 -0
- vispy/glsl/collections/sdf-glyph.vert +59 -0
- vispy/glsl/collections/tick-labels.vert +71 -0
- vispy/glsl/colormaps/autumn.glsl +20 -0
- vispy/glsl/colormaps/blues.glsl +20 -0
- vispy/glsl/colormaps/color-space.glsl +17 -0
- vispy/glsl/colormaps/colormaps.glsl +24 -0
- vispy/glsl/colormaps/cool.glsl +20 -0
- vispy/glsl/colormaps/fire.glsl +21 -0
- vispy/glsl/colormaps/gray.glsl +20 -0
- vispy/glsl/colormaps/greens.glsl +20 -0
- vispy/glsl/colormaps/hot.glsl +22 -0
- vispy/glsl/colormaps/ice.glsl +20 -0
- vispy/glsl/colormaps/icefire.glsl +23 -0
- vispy/glsl/colormaps/parse.py +40 -0
- vispy/glsl/colormaps/reds.glsl +20 -0
- vispy/glsl/colormaps/spring.glsl +20 -0
- vispy/glsl/colormaps/summer.glsl +20 -0
- vispy/glsl/colormaps/user.glsl +22 -0
- vispy/glsl/colormaps/util.glsl +41 -0
- vispy/glsl/colormaps/wheel.glsl +21 -0
- vispy/glsl/colormaps/winter.glsl +20 -0
- vispy/glsl/lines/agg.frag +320 -0
- vispy/glsl/lines/agg.vert +241 -0
- vispy/glsl/markers/arrow.glsl +12 -0
- vispy/glsl/markers/asterisk.glsl +16 -0
- vispy/glsl/markers/chevron.glsl +14 -0
- vispy/glsl/markers/clover.glsl +20 -0
- vispy/glsl/markers/club.glsl +31 -0
- vispy/glsl/markers/cross.glsl +17 -0
- vispy/glsl/markers/diamond.glsl +12 -0
- vispy/glsl/markers/disc.glsl +9 -0
- vispy/glsl/markers/ellipse.glsl +67 -0
- vispy/glsl/markers/hbar.glsl +9 -0
- vispy/glsl/markers/heart.glsl +15 -0
- vispy/glsl/markers/infinity.glsl +15 -0
- vispy/glsl/markers/marker-sdf.frag +74 -0
- vispy/glsl/markers/marker-sdf.vert +41 -0
- vispy/glsl/markers/marker.frag +36 -0
- vispy/glsl/markers/marker.vert +46 -0
- vispy/glsl/markers/markers.glsl +24 -0
- vispy/glsl/markers/pin.glsl +18 -0
- vispy/glsl/markers/ring.glsl +11 -0
- vispy/glsl/markers/spade.glsl +28 -0
- vispy/glsl/markers/square.glsl +10 -0
- vispy/glsl/markers/tag.glsl +11 -0
- vispy/glsl/markers/triangle.glsl +14 -0
- vispy/glsl/markers/vbar.glsl +9 -0
- vispy/glsl/math/circle-through-2-points.glsl +30 -0
- vispy/glsl/math/constants.glsl +48 -0
- vispy/glsl/math/double.glsl +114 -0
- vispy/glsl/math/functions.glsl +20 -0
- vispy/glsl/math/point-to-line-distance.glsl +31 -0
- vispy/glsl/math/point-to-line-projection.glsl +29 -0
- vispy/glsl/math/signed-line-distance.glsl +27 -0
- vispy/glsl/math/signed-segment-distance.glsl +30 -0
- vispy/glsl/misc/regular-grid.frag +244 -0
- vispy/glsl/misc/spatial-filters.frag +1407 -0
- vispy/glsl/misc/viewport-NDC.glsl +20 -0
- vispy/glsl/transforms/azimuthal-equal-area.glsl +32 -0
- vispy/glsl/transforms/azimuthal-equidistant.glsl +38 -0
- vispy/glsl/transforms/hammer.glsl +44 -0
- vispy/glsl/transforms/identity.glsl +6 -0
- vispy/glsl/transforms/identity_forward.glsl +23 -0
- vispy/glsl/transforms/identity_inverse.glsl +23 -0
- vispy/glsl/transforms/linear-scale.glsl +127 -0
- vispy/glsl/transforms/log-scale.glsl +126 -0
- vispy/glsl/transforms/mercator-transverse-forward.glsl +40 -0
- vispy/glsl/transforms/mercator-transverse-inverse.glsl +40 -0
- vispy/glsl/transforms/panzoom.glsl +10 -0
- vispy/glsl/transforms/polar.glsl +41 -0
- vispy/glsl/transforms/position.glsl +44 -0
- vispy/glsl/transforms/power-scale.glsl +139 -0
- vispy/glsl/transforms/projection.glsl +7 -0
- vispy/glsl/transforms/pvm.glsl +13 -0
- vispy/glsl/transforms/rotate.glsl +45 -0
- vispy/glsl/transforms/trackball.glsl +15 -0
- vispy/glsl/transforms/translate.glsl +35 -0
- vispy/glsl/transforms/transverse_mercator.glsl +38 -0
- vispy/glsl/transforms/viewport-clipping.glsl +14 -0
- vispy/glsl/transforms/viewport-transform.glsl +16 -0
- vispy/glsl/transforms/viewport.glsl +50 -0
- vispy/glsl/transforms/x.glsl +24 -0
- vispy/glsl/transforms/y.glsl +19 -0
- vispy/glsl/transforms/z.glsl +14 -0
- vispy/io/__init__.py +20 -0
- vispy/io/_data/spatial-filters.npy +0 -0
- vispy/io/datasets.py +94 -0
- vispy/io/image.py +231 -0
- vispy/io/mesh.py +122 -0
- vispy/io/stl.py +167 -0
- vispy/io/tests/__init__.py +0 -0
- vispy/io/tests/test_image.py +47 -0
- vispy/io/tests/test_io.py +121 -0
- vispy/io/wavefront.py +350 -0
- vispy/plot/__init__.py +36 -0
- vispy/plot/fig.py +58 -0
- vispy/plot/plotwidget.py +522 -0
- vispy/plot/tests/__init__.py +0 -0
- vispy/plot/tests/test_plot.py +46 -0
- vispy/scene/__init__.py +43 -0
- vispy/scene/cameras/__init__.py +27 -0
- vispy/scene/cameras/_base.py +38 -0
- vispy/scene/cameras/arcball.py +105 -0
- vispy/scene/cameras/base_camera.py +551 -0
- vispy/scene/cameras/fly.py +474 -0
- vispy/scene/cameras/magnify.py +163 -0
- vispy/scene/cameras/panzoom.py +311 -0
- vispy/scene/cameras/perspective.py +338 -0
- vispy/scene/cameras/tests/__init__.py +0 -0
- vispy/scene/cameras/tests/test_cameras.py +27 -0
- vispy/scene/cameras/tests/test_link.py +53 -0
- vispy/scene/cameras/tests/test_perspective.py +122 -0
- vispy/scene/cameras/turntable.py +183 -0
- vispy/scene/canvas.py +639 -0
- vispy/scene/events.py +85 -0
- vispy/scene/node.py +644 -0
- vispy/scene/subscene.py +20 -0
- vispy/scene/tests/__init__.py +0 -0
- vispy/scene/tests/test_canvas.py +119 -0
- vispy/scene/tests/test_node.py +142 -0
- vispy/scene/tests/test_visuals.py +141 -0
- vispy/scene/visuals.py +276 -0
- vispy/scene/widgets/__init__.py +18 -0
- vispy/scene/widgets/anchor.py +25 -0
- vispy/scene/widgets/axis.py +88 -0
- vispy/scene/widgets/colorbar.py +176 -0
- vispy/scene/widgets/console.py +351 -0
- vispy/scene/widgets/grid.py +509 -0
- vispy/scene/widgets/label.py +50 -0
- vispy/scene/widgets/tests/__init__.py +0 -0
- vispy/scene/widgets/tests/test_colorbar.py +47 -0
- vispy/scene/widgets/viewbox.py +199 -0
- vispy/scene/widgets/widget.py +478 -0
- vispy/testing/__init__.py +51 -0
- vispy/testing/_runners.py +448 -0
- vispy/testing/_testing.py +416 -0
- vispy/testing/image_tester.py +494 -0
- vispy/testing/rendered_array_tester.py +85 -0
- vispy/testing/tests/__init__.py +0 -0
- vispy/testing/tests/test_testing.py +20 -0
- vispy/util/__init__.py +32 -0
- vispy/util/bunch.py +15 -0
- vispy/util/check_environment.py +57 -0
- vispy/util/config.py +490 -0
- vispy/util/dpi/__init__.py +19 -0
- vispy/util/dpi/_linux.py +69 -0
- vispy/util/dpi/_quartz.py +26 -0
- vispy/util/dpi/_win32.py +34 -0
- vispy/util/dpi/tests/__init__.py +0 -0
- vispy/util/dpi/tests/test_dpi.py +16 -0
- vispy/util/eq.py +41 -0
- vispy/util/event.py +774 -0
- vispy/util/fetching.py +276 -0
- vispy/util/filter.py +44 -0
- vispy/util/fonts/__init__.py +14 -0
- vispy/util/fonts/_freetype.py +73 -0
- vispy/util/fonts/_quartz.py +192 -0
- vispy/util/fonts/_triage.py +36 -0
- vispy/util/fonts/_vispy_fonts.py +20 -0
- vispy/util/fonts/_win32.py +105 -0
- vispy/util/fonts/data/OpenSans-Bold.ttf +0 -0
- vispy/util/fonts/data/OpenSans-BoldItalic.ttf +0 -0
- vispy/util/fonts/data/OpenSans-Italic.ttf +0 -0
- vispy/util/fonts/data/OpenSans-Regular.ttf +0 -0
- vispy/util/fonts/tests/__init__.py +0 -0
- vispy/util/fonts/tests/test_font.py +45 -0
- vispy/util/fourier.py +69 -0
- vispy/util/frozen.py +25 -0
- vispy/util/gallery_scraper.py +268 -0
- vispy/util/keys.py +91 -0
- vispy/util/logs.py +358 -0
- vispy/util/osmesa_gl.py +17 -0
- vispy/util/profiler.py +135 -0
- vispy/util/ptime.py +16 -0
- vispy/util/quaternion.py +229 -0
- vispy/util/svg/__init__.py +18 -0
- vispy/util/svg/base.py +20 -0
- vispy/util/svg/color.py +219 -0
- vispy/util/svg/element.py +51 -0
- vispy/util/svg/geometry.py +478 -0
- vispy/util/svg/group.py +66 -0
- vispy/util/svg/length.py +81 -0
- vispy/util/svg/number.py +25 -0
- vispy/util/svg/path.py +332 -0
- vispy/util/svg/shapes.py +57 -0
- vispy/util/svg/style.py +59 -0
- vispy/util/svg/svg.py +40 -0
- vispy/util/svg/transform.py +223 -0
- vispy/util/svg/transformable.py +28 -0
- vispy/util/svg/viewport.py +73 -0
- vispy/util/tests/__init__.py +0 -0
- vispy/util/tests/test_config.py +58 -0
- vispy/util/tests/test_docstring_parameters.py +123 -0
- vispy/util/tests/test_emitter_group.py +262 -0
- vispy/util/tests/test_event_emitter.py +743 -0
- vispy/util/tests/test_fourier.py +35 -0
- vispy/util/tests/test_gallery_scraper.py +112 -0
- vispy/util/tests/test_import.py +127 -0
- vispy/util/tests/test_key.py +22 -0
- vispy/util/tests/test_logging.py +45 -0
- vispy/util/tests/test_run.py +14 -0
- vispy/util/tests/test_transforms.py +42 -0
- vispy/util/tests/test_vispy.py +48 -0
- vispy/util/transforms.py +201 -0
- vispy/util/wrappers.py +155 -0
- vispy/version.py +21 -0
- vispy/visuals/__init__.py +50 -0
- vispy/visuals/_scalable_textures.py +487 -0
- vispy/visuals/axis.py +678 -0
- vispy/visuals/border.py +208 -0
- vispy/visuals/box.py +79 -0
- vispy/visuals/collections/__init__.py +30 -0
- vispy/visuals/collections/agg_fast_path_collection.py +219 -0
- vispy/visuals/collections/agg_path_collection.py +197 -0
- vispy/visuals/collections/agg_point_collection.py +52 -0
- vispy/visuals/collections/agg_segment_collection.py +142 -0
- vispy/visuals/collections/array_list.py +401 -0
- vispy/visuals/collections/base_collection.py +482 -0
- vispy/visuals/collections/collection.py +253 -0
- vispy/visuals/collections/path_collection.py +23 -0
- vispy/visuals/collections/point_collection.py +19 -0
- vispy/visuals/collections/polygon_collection.py +25 -0
- vispy/visuals/collections/raw_path_collection.py +119 -0
- vispy/visuals/collections/raw_point_collection.py +113 -0
- vispy/visuals/collections/raw_polygon_collection.py +77 -0
- vispy/visuals/collections/raw_segment_collection.py +112 -0
- vispy/visuals/collections/raw_triangle_collection.py +78 -0
- vispy/visuals/collections/segment_collection.py +19 -0
- vispy/visuals/collections/triangle_collection.py +16 -0
- vispy/visuals/collections/util.py +168 -0
- vispy/visuals/colorbar.py +699 -0
- vispy/visuals/cube.py +41 -0
- vispy/visuals/ellipse.py +162 -0
- vispy/visuals/filters/__init__.py +10 -0
- vispy/visuals/filters/base_filter.py +242 -0
- vispy/visuals/filters/clipper.py +60 -0
- vispy/visuals/filters/clipping_planes.py +122 -0
- vispy/visuals/filters/color.py +181 -0
- vispy/visuals/filters/markers.py +28 -0
- vispy/visuals/filters/mesh.py +801 -0
- vispy/visuals/filters/picking.py +60 -0
- vispy/visuals/filters/tests/__init__.py +3 -0
- vispy/visuals/filters/tests/test_primitive_picking_filters.py +70 -0
- vispy/visuals/filters/tests/test_wireframe_filter.py +16 -0
- vispy/visuals/glsl/__init__.py +1 -0
- vispy/visuals/glsl/antialiasing.py +133 -0
- vispy/visuals/glsl/color.py +63 -0
- vispy/visuals/graphs/__init__.py +1 -0
- vispy/visuals/graphs/graph.py +240 -0
- vispy/visuals/graphs/layouts/__init__.py +55 -0
- vispy/visuals/graphs/layouts/circular.py +49 -0
- vispy/visuals/graphs/layouts/force_directed.py +211 -0
- vispy/visuals/graphs/layouts/networkx_layout.py +87 -0
- vispy/visuals/graphs/layouts/random.py +52 -0
- vispy/visuals/graphs/tests/__init__.py +1 -0
- vispy/visuals/graphs/tests/test_layouts.py +139 -0
- vispy/visuals/graphs/tests/test_networkx_layout.py +47 -0
- vispy/visuals/graphs/util.py +120 -0
- vispy/visuals/gridlines.py +161 -0
- vispy/visuals/gridmesh.py +98 -0
- vispy/visuals/histogram.py +58 -0
- vispy/visuals/image.py +701 -0
- vispy/visuals/image_complex.py +130 -0
- vispy/visuals/infinite_line.py +199 -0
- vispy/visuals/instanced_mesh.py +152 -0
- vispy/visuals/isocurve.py +213 -0
- vispy/visuals/isoline.py +241 -0
- vispy/visuals/isosurface.py +113 -0
- vispy/visuals/line/__init__.py +6 -0
- vispy/visuals/line/arrow.py +289 -0
- vispy/visuals/line/dash_atlas.py +90 -0
- vispy/visuals/line/line.py +545 -0
- vispy/visuals/line_plot.py +135 -0
- vispy/visuals/linear_region.py +199 -0
- vispy/visuals/markers.py +819 -0
- vispy/visuals/mesh.py +373 -0
- vispy/visuals/mesh_normals.py +159 -0
- vispy/visuals/plane.py +54 -0
- vispy/visuals/polygon.py +145 -0
- vispy/visuals/rectangle.py +196 -0
- vispy/visuals/regular_polygon.py +56 -0
- vispy/visuals/scrolling_lines.py +197 -0
- vispy/visuals/shaders/__init__.py +17 -0
- vispy/visuals/shaders/compiler.py +206 -0
- vispy/visuals/shaders/expression.py +99 -0
- vispy/visuals/shaders/function.py +788 -0
- vispy/visuals/shaders/multiprogram.py +145 -0
- vispy/visuals/shaders/parsing.py +140 -0
- vispy/visuals/shaders/program.py +161 -0
- vispy/visuals/shaders/shader_object.py +162 -0
- vispy/visuals/shaders/tests/__init__.py +0 -0
- vispy/visuals/shaders/tests/test_function.py +486 -0
- vispy/visuals/shaders/tests/test_multiprogram.py +78 -0
- vispy/visuals/shaders/tests/test_parsing.py +57 -0
- vispy/visuals/shaders/variable.py +272 -0
- vispy/visuals/spectrogram.py +169 -0
- vispy/visuals/sphere.py +80 -0
- vispy/visuals/surface_plot.py +192 -0
- vispy/visuals/tests/__init__.py +0 -0
- vispy/visuals/tests/test_arrows.py +109 -0
- vispy/visuals/tests/test_axis.py +120 -0
- vispy/visuals/tests/test_collections.py +15 -0
- vispy/visuals/tests/test_colorbar.py +179 -0
- vispy/visuals/tests/test_colormap.py +97 -0
- vispy/visuals/tests/test_ellipse.py +122 -0
- vispy/visuals/tests/test_gridlines.py +30 -0
- vispy/visuals/tests/test_histogram.py +24 -0
- vispy/visuals/tests/test_image.py +392 -0
- vispy/visuals/tests/test_image_complex.py +36 -0
- vispy/visuals/tests/test_infinite_line.py +53 -0
- vispy/visuals/tests/test_instanced_mesh.py +50 -0
- vispy/visuals/tests/test_isosurface.py +22 -0
- vispy/visuals/tests/test_linear_region.py +152 -0
- vispy/visuals/tests/test_markers.py +54 -0
- vispy/visuals/tests/test_mesh.py +261 -0
- vispy/visuals/tests/test_mesh_normals.py +218 -0
- vispy/visuals/tests/test_polygon.py +112 -0
- vispy/visuals/tests/test_rectangle.py +163 -0
- vispy/visuals/tests/test_regular_polygon.py +111 -0
- vispy/visuals/tests/test_scalable_textures.py +196 -0
- vispy/visuals/tests/test_sdf.py +73 -0
- vispy/visuals/tests/test_spectrogram.py +42 -0
- vispy/visuals/tests/test_surface_plot.py +57 -0
- vispy/visuals/tests/test_text.py +95 -0
- vispy/visuals/tests/test_volume.py +542 -0
- vispy/visuals/tests/test_windbarb.py +33 -0
- vispy/visuals/text/__init__.py +7 -0
- vispy/visuals/text/_sdf_cpu.cp313-win_amd64.pyd +0 -0
- vispy/visuals/text/_sdf_cpu.pyx +112 -0
- vispy/visuals/text/_sdf_gpu.py +316 -0
- vispy/visuals/text/text.py +675 -0
- vispy/visuals/transforms/__init__.py +34 -0
- vispy/visuals/transforms/_util.py +191 -0
- vispy/visuals/transforms/base_transform.py +233 -0
- vispy/visuals/transforms/chain.py +300 -0
- vispy/visuals/transforms/interactive.py +98 -0
- vispy/visuals/transforms/linear.py +564 -0
- vispy/visuals/transforms/nonlinear.py +398 -0
- vispy/visuals/transforms/tests/__init__.py +0 -0
- vispy/visuals/transforms/tests/test_transforms.py +243 -0
- vispy/visuals/transforms/transform_system.py +339 -0
- vispy/visuals/tube.py +173 -0
- vispy/visuals/visual.py +923 -0
- vispy/visuals/volume.py +1366 -0
- vispy/visuals/windbarb.py +291 -0
- vispy/visuals/xyz_axis.py +34 -0
- vispy-0.15.0.dist-info/METADATA +243 -0
- vispy-0.15.0.dist-info/RECORD +521 -0
- vispy-0.15.0.dist-info/WHEEL +5 -0
- vispy-0.15.0.dist-info/licenses/LICENSE.txt +36 -0
- vispy-0.15.0.dist-info/top_level.txt +1 -0
vispy/ext/cubehelix.py
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Modified from:
|
|
3
|
+
|
|
4
|
+
https://raw.githubusercontent.com/jradavenport/cubehelix/master/cubehelix.py
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2014, James R. A. Davenport and contributors All rights reserved.
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without
|
|
9
|
+
modification, are permitted provided that the following conditions are met:
|
|
10
|
+
|
|
11
|
+
Redistributions of source code must retain the above copyright notice, this
|
|
12
|
+
list of conditions and the following disclaimer.
|
|
13
|
+
|
|
14
|
+
Redistributions in binary form must reproduce the above copyright notice,
|
|
15
|
+
this list of conditions and the following disclaimer in the documentation
|
|
16
|
+
and/or other materials provided with the distribution.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
21
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
22
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
23
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
24
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
25
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
26
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
27
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
28
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
from math import pi
|
|
32
|
+
import numpy as np
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def cubehelix(start=0.5, rot=1, gamma=1.0, reverse=True, nlev=256.,
|
|
36
|
+
minSat=1.2, maxSat=1.2, minLight=0., maxLight=1.,
|
|
37
|
+
**kwargs):
|
|
38
|
+
"""
|
|
39
|
+
A full implementation of Dave Green's "cubehelix" for Matplotlib.
|
|
40
|
+
Based on the FORTRAN 77 code provided in
|
|
41
|
+
D.A. Green, 2011, BASI, 39, 289.
|
|
42
|
+
|
|
43
|
+
http://adsabs.harvard.edu/abs/2011arXiv1108.5083G
|
|
44
|
+
|
|
45
|
+
User can adjust all parameters of the cubehelix algorithm.
|
|
46
|
+
This enables much greater flexibility in choosing color maps, while
|
|
47
|
+
always ensuring the color map scales in intensity from black
|
|
48
|
+
to white. A few simple examples:
|
|
49
|
+
|
|
50
|
+
Default color map settings produce the standard "cubehelix".
|
|
51
|
+
|
|
52
|
+
Create color map in only blues by setting rot=0 and start=0.
|
|
53
|
+
|
|
54
|
+
Create reverse (white to black) backwards through the rainbow once
|
|
55
|
+
by setting rot=1 and reverse=True.
|
|
56
|
+
|
|
57
|
+
Parameters
|
|
58
|
+
----------
|
|
59
|
+
start : scalar, optional
|
|
60
|
+
Sets the starting position in the color space. 0=blue, 1=red,
|
|
61
|
+
2=green. Defaults to 0.5.
|
|
62
|
+
rot : scalar, optional
|
|
63
|
+
The number of rotations through the rainbow. Can be positive
|
|
64
|
+
or negative, indicating direction of rainbow. Negative values
|
|
65
|
+
correspond to Blue->Red direction. Defaults to -1.5
|
|
66
|
+
gamma : scalar, optional
|
|
67
|
+
The gamma correction for intensity. Defaults to 1.0
|
|
68
|
+
reverse : boolean, optional
|
|
69
|
+
Set to True to reverse the color map. Will go from black to
|
|
70
|
+
white. Good for density plots where shade~density. Defaults to False
|
|
71
|
+
nlev : scalar, optional
|
|
72
|
+
Defines the number of discrete levels to render colors at.
|
|
73
|
+
Defaults to 256.
|
|
74
|
+
sat : scalar, optional
|
|
75
|
+
The saturation intensity factor. Defaults to 1.2
|
|
76
|
+
NOTE: this was formerly known as "hue" parameter
|
|
77
|
+
minSat : scalar, optional
|
|
78
|
+
Sets the minimum-level saturation. Defaults to 1.2
|
|
79
|
+
maxSat : scalar, optional
|
|
80
|
+
Sets the maximum-level saturation. Defaults to 1.2
|
|
81
|
+
startHue : scalar, optional
|
|
82
|
+
Sets the starting color, ranging from [0, 360], as in
|
|
83
|
+
D3 version by @mbostock
|
|
84
|
+
NOTE: overrides values in start parameter
|
|
85
|
+
endHue : scalar, optional
|
|
86
|
+
Sets the ending color, ranging from [0, 360], as in
|
|
87
|
+
D3 version by @mbostock
|
|
88
|
+
NOTE: overrides values in rot parameter
|
|
89
|
+
minLight : scalar, optional
|
|
90
|
+
Sets the minimum lightness value. Defaults to 0.
|
|
91
|
+
maxLight : scalar, optional
|
|
92
|
+
Sets the maximum lightness value. Defaults to 1.
|
|
93
|
+
|
|
94
|
+
Returns
|
|
95
|
+
-------
|
|
96
|
+
data : ndarray, shape (N, 3)
|
|
97
|
+
Control points.
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
# override start and rot if startHue and endHue are set
|
|
101
|
+
if kwargs is not None:
|
|
102
|
+
if 'startHue' in kwargs:
|
|
103
|
+
start = (kwargs.get('startHue') / 360. - 1.) * 3.
|
|
104
|
+
if 'endHue' in kwargs:
|
|
105
|
+
rot = kwargs.get('endHue') / 360. - start / 3. - 1.
|
|
106
|
+
if 'sat' in kwargs:
|
|
107
|
+
minSat = kwargs.get('sat')
|
|
108
|
+
maxSat = kwargs.get('sat')
|
|
109
|
+
|
|
110
|
+
# set up the parameters
|
|
111
|
+
fract = np.linspace(minLight, maxLight, nlev)
|
|
112
|
+
angle = 2.0 * pi * (start / 3.0 + rot * fract + 1.)
|
|
113
|
+
fract = fract**gamma
|
|
114
|
+
|
|
115
|
+
satar = np.linspace(minSat, maxSat, nlev)
|
|
116
|
+
amp = satar * fract * (1. - fract) / 2.
|
|
117
|
+
|
|
118
|
+
# compute the RGB vectors according to main equations
|
|
119
|
+
red = fract + amp * (-0.14861 * np.cos(angle) + 1.78277 * np.sin(angle))
|
|
120
|
+
grn = fract + amp * (-0.29227 * np.cos(angle) - 0.90649 * np.sin(angle))
|
|
121
|
+
blu = fract + amp * (1.97294 * np.cos(angle))
|
|
122
|
+
|
|
123
|
+
# find where RBB are outside the range [0,1], clip
|
|
124
|
+
red[np.where((red > 1.))] = 1.
|
|
125
|
+
grn[np.where((grn > 1.))] = 1.
|
|
126
|
+
blu[np.where((blu > 1.))] = 1.
|
|
127
|
+
|
|
128
|
+
red[np.where((red < 0.))] = 0.
|
|
129
|
+
grn[np.where((grn < 0.))] = 0.
|
|
130
|
+
blu[np.where((blu < 0.))] = 0.
|
|
131
|
+
|
|
132
|
+
# optional color reverse
|
|
133
|
+
if reverse is True:
|
|
134
|
+
red = red[::-1]
|
|
135
|
+
blu = blu[::-1]
|
|
136
|
+
grn = grn[::-1]
|
|
137
|
+
|
|
138
|
+
return np.array((red, grn, blu)).T
|
vispy/ext/egl.py
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (c) Vispy Development Team. All Rights Reserved.
|
|
3
|
+
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
|
|
4
|
+
|
|
5
|
+
"""A ctypes-based API to EGL."""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import ctypes
|
|
9
|
+
from ctypes import c_int as _c_int, POINTER as _POINTER, c_void_p, c_char_p
|
|
10
|
+
|
|
11
|
+
_egl_file = None
|
|
12
|
+
if 'EGL_LIBRARY' in os.environ:
|
|
13
|
+
if os.path.exists(os.environ['EGL_LIBRARY']):
|
|
14
|
+
_egl_file = os.path.realpath(os.environ['EGL_LIBRARY'])
|
|
15
|
+
|
|
16
|
+
# Else, try to find it
|
|
17
|
+
if _egl_file is None:
|
|
18
|
+
_egl_file = ctypes.util.find_library('EGL')
|
|
19
|
+
|
|
20
|
+
# Else, we failed and exit
|
|
21
|
+
if _egl_file is None:
|
|
22
|
+
raise OSError('EGL library not found')
|
|
23
|
+
|
|
24
|
+
# Load it
|
|
25
|
+
_lib = ctypes.CDLL(_egl_file)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Constants
|
|
29
|
+
|
|
30
|
+
EGL_FALSE = 0
|
|
31
|
+
EGL_TRUE = 1
|
|
32
|
+
|
|
33
|
+
# Out-of-band handle values
|
|
34
|
+
EGL_DEFAULT_DISPLAY = 0
|
|
35
|
+
EGL_NO_CONTEXT = 0
|
|
36
|
+
EGL_NO_DISPLAY = 0
|
|
37
|
+
EGL_NO_SURFACE = 0
|
|
38
|
+
|
|
39
|
+
# Out-of-band attribute value
|
|
40
|
+
EGL_DONT_CARE = -1
|
|
41
|
+
|
|
42
|
+
# Errors / GetError return values
|
|
43
|
+
EGL_SUCCESS = 0x3000
|
|
44
|
+
EGL_NOT_INITIALIZED = 0x3001
|
|
45
|
+
EGL_BAD_ACCESS = 0x3002
|
|
46
|
+
EGL_BAD_ALLOC = 0x3003
|
|
47
|
+
EGL_BAD_ATTRIBUTE = 0x3004
|
|
48
|
+
EGL_BAD_CONFIG = 0x3005
|
|
49
|
+
EGL_BAD_CONTEXT = 0x3006
|
|
50
|
+
EGL_BAD_CURRENT_SURFACE = 0x3007
|
|
51
|
+
EGL_BAD_DISPLAY = 0x3008
|
|
52
|
+
EGL_BAD_MATCH = 0x3009
|
|
53
|
+
EGL_BAD_NATIVE_PIXMAP = 0x300A
|
|
54
|
+
EGL_BAD_NATIVE_WINDOW = 0x300B
|
|
55
|
+
EGL_BAD_PARAMETER = 0x300C
|
|
56
|
+
EGL_BAD_SURFACE = 0x300D
|
|
57
|
+
EGL_CONTEXT_LOST = 0x300E # EGL 1.1 - IMG_power_management
|
|
58
|
+
|
|
59
|
+
# Reserved 0x300F-0x301F for additional errors
|
|
60
|
+
|
|
61
|
+
# Config attributes
|
|
62
|
+
EGL_BUFFER_SIZE = 0x3020
|
|
63
|
+
EGL_ALPHA_SIZE = 0x3021
|
|
64
|
+
EGL_BLUE_SIZE = 0x3022
|
|
65
|
+
EGL_GREEN_SIZE = 0x3023
|
|
66
|
+
EGL_RED_SIZE = 0x3024
|
|
67
|
+
EGL_DEPTH_SIZE = 0x3025
|
|
68
|
+
EGL_STENCIL_SIZE = 0x3026
|
|
69
|
+
EGL_CONFIG_CAVEAT = 0x3027
|
|
70
|
+
EGL_CONFIG_ID = 0x3028
|
|
71
|
+
EGL_LEVEL = 0x3029
|
|
72
|
+
EGL_MAX_PBUFFER_HEIGHT = 0x302A
|
|
73
|
+
EGL_MAX_PBUFFER_PIXELS = 0x302B
|
|
74
|
+
EGL_MAX_PBUFFER_WIDTH = 0x302C
|
|
75
|
+
EGL_NATIVE_RENDERABLE = 0x302D
|
|
76
|
+
EGL_NATIVE_VISUAL_ID = 0x302E
|
|
77
|
+
EGL_NATIVE_VISUAL_TYPE = 0x302F
|
|
78
|
+
EGL_SAMPLES = 0x3031
|
|
79
|
+
EGL_SAMPLE_BUFFERS = 0x3032
|
|
80
|
+
EGL_SURFACE_TYPE = 0x3033
|
|
81
|
+
EGL_TRANSPARENT_TYPE = 0x3034
|
|
82
|
+
EGL_TRANSPARENT_BLUE_VALUE = 0x3035
|
|
83
|
+
EGL_TRANSPARENT_GREEN_VALUE = 0x3036
|
|
84
|
+
EGL_TRANSPARENT_RED_VALUE = 0x3037
|
|
85
|
+
EGL_NONE = 0x3038 # Attrib list terminator
|
|
86
|
+
EGL_BIND_TO_TEXTURE_RGB = 0x3039
|
|
87
|
+
EGL_BIND_TO_TEXTURE_RGBA = 0x303A
|
|
88
|
+
EGL_MIN_SWAP_INTERVAL = 0x303B
|
|
89
|
+
EGL_MAX_SWAP_INTERVAL = 0x303C
|
|
90
|
+
EGL_LUMINANCE_SIZE = 0x303D
|
|
91
|
+
EGL_ALPHA_MASK_SIZE = 0x303E
|
|
92
|
+
EGL_COLOR_BUFFER_TYPE = 0x303F
|
|
93
|
+
EGL_RENDERABLE_TYPE = 0x3040
|
|
94
|
+
EGL_MATCH_NATIVE_PIXMAP = 0x3041 # Pseudo-attribute (not queryable)
|
|
95
|
+
EGL_CONFORMANT = 0x3042
|
|
96
|
+
|
|
97
|
+
# Reserved 0x3041-0x304F for additional config attributes
|
|
98
|
+
|
|
99
|
+
# Config attribute values
|
|
100
|
+
EGL_SLOW_CONFIG = 0x3050 # EGL_CONFIG_CAVEAT value
|
|
101
|
+
EGL_NON_CONFORMANT_CONFIG = 0x3051 # EGL_CONFIG_CAVEAT value
|
|
102
|
+
EGL_TRANSPARENT_RGB = 0x3052 # EGL_TRANSPARENT_TYPE value
|
|
103
|
+
EGL_RGB_BUFFER = 0x308E # EGL_COLOR_BUFFER_TYPE value
|
|
104
|
+
EGL_LUMINANCE_BUFFER = 0x308F # EGL_COLOR_BUFFER_TYPE value
|
|
105
|
+
|
|
106
|
+
# More config attribute values, for EGL_TEXTURE_FORMAT
|
|
107
|
+
EGL_NO_TEXTURE = 0x305C
|
|
108
|
+
EGL_TEXTURE_RGB = 0x305D
|
|
109
|
+
EGL_TEXTURE_RGBA = 0x305E
|
|
110
|
+
EGL_TEXTURE_2D = 0x305F
|
|
111
|
+
|
|
112
|
+
# Config attribute mask bits
|
|
113
|
+
EGL_PBUFFER_BIT = 0x0001 # EGL_SURFACE_TYPE mask bits
|
|
114
|
+
EGL_PIXMAP_BIT = 0x0002 # EGL_SURFACE_TYPE mask bits
|
|
115
|
+
EGL_WINDOW_BIT = 0x0004 # EGL_SURFACE_TYPE mask bits
|
|
116
|
+
EGL_VG_COLORSPACE_LINEAR_BIT = 0x0020 # EGL_SURFACE_TYPE mask bits
|
|
117
|
+
EGL_VG_ALPHA_FORMAT_PRE_BIT = 0x0040 # EGL_SURFACE_TYPE mask bits
|
|
118
|
+
EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200 # EGL_SURFACE_TYPE mask bits
|
|
119
|
+
EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400 # EGL_SURFACE_TYPE mask bits
|
|
120
|
+
|
|
121
|
+
EGL_OPENGL_ES_BIT = 0x0001 # EGL_RENDERABLE_TYPE mask bits
|
|
122
|
+
EGL_OPENVG_BIT = 0x0002 # EGL_RENDERABLE_TYPE mask bits
|
|
123
|
+
EGL_OPENGL_ES2_BIT = 0x0004 # EGL_RENDERABLE_TYPE mask bits
|
|
124
|
+
EGL_OPENGL_BIT = 0x0008 # EGL_RENDERABLE_TYPE mask bits
|
|
125
|
+
|
|
126
|
+
# QueryString targets
|
|
127
|
+
EGL_VENDOR = 0x3053
|
|
128
|
+
EGL_VERSION = 0x3054
|
|
129
|
+
EGL_EXTENSIONS = 0x3055
|
|
130
|
+
EGL_CLIENT_APIS = 0x308D
|
|
131
|
+
|
|
132
|
+
# QuerySurface / SurfaceAttrib / CreatePbufferSurface targets
|
|
133
|
+
EGL_HEIGHT = 0x3056
|
|
134
|
+
EGL_WIDTH = 0x3057
|
|
135
|
+
EGL_LARGEST_PBUFFER = 0x3058
|
|
136
|
+
EGL_TEXTURE_FORMAT = 0x3080
|
|
137
|
+
EGL_TEXTURE_TARGET = 0x3081
|
|
138
|
+
EGL_MIPMAP_TEXTURE = 0x3082
|
|
139
|
+
EGL_MIPMAP_LEVEL = 0x3083
|
|
140
|
+
EGL_RENDER_BUFFER = 0x3086
|
|
141
|
+
EGL_VG_COLORSPACE = 0x3087
|
|
142
|
+
EGL_VG_ALPHA_FORMAT = 0x3088
|
|
143
|
+
EGL_HORIZONTAL_RESOLUTION = 0x3090
|
|
144
|
+
EGL_VERTICAL_RESOLUTION = 0x3091
|
|
145
|
+
EGL_PIXEL_ASPECT_RATIO = 0x3092
|
|
146
|
+
EGL_SWAP_BEHAVIOR = 0x3093
|
|
147
|
+
EGL_MULTISAMPLE_RESOLVE = 0x3099
|
|
148
|
+
|
|
149
|
+
# EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets
|
|
150
|
+
EGL_BACK_BUFFER = 0x3084
|
|
151
|
+
EGL_SINGLE_BUFFER = 0x3085
|
|
152
|
+
|
|
153
|
+
# OpenVG color spaces
|
|
154
|
+
EGL_VG_COLORSPACE_sRGB = 0x3089 # EGL_VG_COLORSPACE value
|
|
155
|
+
EGL_VG_COLORSPACE_LINEAR = 0x308A # EGL_VG_COLORSPACE value
|
|
156
|
+
|
|
157
|
+
# OpenVG alpha formats
|
|
158
|
+
EGL_VG_ALPHA_FORMAT_NONPRE = 0x308B # EGL_ALPHA_FORMAT value
|
|
159
|
+
EGL_VG_ALPHA_FORMAT_PRE = 0x308C # EGL_ALPHA_FORMAT value
|
|
160
|
+
|
|
161
|
+
# Constant scale factor by which fractional display resolutions &
|
|
162
|
+
# * aspect ratio are scaled when queried as integer values.
|
|
163
|
+
|
|
164
|
+
EGL_DISPLAY_SCALING = 10000
|
|
165
|
+
|
|
166
|
+
# Unknown display resolution/aspect ratio
|
|
167
|
+
EGL_UNKNOWN = -1
|
|
168
|
+
|
|
169
|
+
# Back buffer swap behaviors
|
|
170
|
+
EGL_BUFFER_PRESERVED = 0x3094 # EGL_SWAP_BEHAVIOR value
|
|
171
|
+
EGL_BUFFER_DESTROYED = 0x3095 # EGL_SWAP_BEHAVIOR value
|
|
172
|
+
|
|
173
|
+
# CreatePbufferFromClientBuffer buffer types
|
|
174
|
+
EGL_OPENVG_IMAGE = 0x3096
|
|
175
|
+
|
|
176
|
+
# QueryContext targets
|
|
177
|
+
EGL_CONTEXT_CLIENT_TYPE = 0x3097
|
|
178
|
+
|
|
179
|
+
# CreateContext attributes
|
|
180
|
+
EGL_CONTEXT_CLIENT_VERSION = 0x3098
|
|
181
|
+
|
|
182
|
+
# Multisample resolution behaviors
|
|
183
|
+
EGL_MULTISAMPLE_RESOLVE_DEFAULT = 0x309A # EGL_MULTISAMPLE_RESOLVE value
|
|
184
|
+
EGL_MULTISAMPLE_RESOLVE_BOX = 0x309B # EGL_MULTISAMPLE_RESOLVE value
|
|
185
|
+
|
|
186
|
+
# BindAPI/QueryAPI targets
|
|
187
|
+
EGL_OPENGL_ES_API = 0x30A0
|
|
188
|
+
EGL_OPENVG_API = 0x30A1
|
|
189
|
+
EGL_OPENGL_API = 0x30A2
|
|
190
|
+
|
|
191
|
+
# GetCurrentSurface targets
|
|
192
|
+
EGL_DRAW = 0x3059
|
|
193
|
+
EGL_READ = 0x305A
|
|
194
|
+
|
|
195
|
+
# WaitNative engines
|
|
196
|
+
EGL_CORE_NATIVE_ENGINE = 0x305B
|
|
197
|
+
|
|
198
|
+
# EGL 1.2 tokens renamed for consistency in EGL 1.3
|
|
199
|
+
EGL_COLORSPACE = EGL_VG_COLORSPACE
|
|
200
|
+
EGL_ALPHA_FORMAT = EGL_VG_ALPHA_FORMAT
|
|
201
|
+
EGL_COLORSPACE_sRGB = EGL_VG_COLORSPACE_sRGB
|
|
202
|
+
EGL_COLORSPACE_LINEAR = EGL_VG_COLORSPACE_LINEAR
|
|
203
|
+
EGL_ALPHA_FORMAT_NONPRE = EGL_VG_ALPHA_FORMAT_NONPRE
|
|
204
|
+
EGL_ALPHA_FORMAT_PRE = EGL_VG_ALPHA_FORMAT_PRE
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
# The functions
|
|
208
|
+
|
|
209
|
+
_lib.eglGetDisplay.argtypes = _c_int,
|
|
210
|
+
_lib.eglGetDisplay.restype = c_void_p
|
|
211
|
+
_lib.eglInitialize.argtypes = c_void_p, _POINTER(_c_int), _POINTER(_c_int)
|
|
212
|
+
_lib.eglTerminate.argtypes = c_void_p,
|
|
213
|
+
_lib.eglChooseConfig.argtypes = (c_void_p, _POINTER(_c_int),
|
|
214
|
+
_POINTER(c_void_p), _c_int, _POINTER(_c_int))
|
|
215
|
+
_lib.eglCreateWindowSurface.argtypes = (c_void_p, c_void_p,
|
|
216
|
+
c_void_p, _POINTER(_c_int))
|
|
217
|
+
_lib.eglCreateWindowSurface.restype = c_void_p
|
|
218
|
+
_lib.eglCreatePbufferSurface.argtypes = (c_void_p, c_void_p, _POINTER(_c_int))
|
|
219
|
+
_lib.eglCreatePbufferSurface.restype = c_void_p
|
|
220
|
+
_lib.eglCreateContext.argtypes = c_void_p, c_void_p, c_void_p, _POINTER(_c_int)
|
|
221
|
+
_lib.eglCreateContext.restype = c_void_p
|
|
222
|
+
_lib.eglMakeCurrent.argtypes = (c_void_p,) * 4
|
|
223
|
+
_lib.eglBindAPI.argtypes = _c_int,
|
|
224
|
+
_lib.eglSwapBuffers.argtypes = (c_void_p,) * 2
|
|
225
|
+
_lib.eglDestroySurface.argtypes = (c_void_p,) * 2
|
|
226
|
+
_lib.eglQueryString.argtypes = (c_void_p, _c_int)
|
|
227
|
+
_lib.eglQueryString.restype = c_char_p
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def eglGetError():
|
|
231
|
+
"""Check for errors, returns an enum (int)."""
|
|
232
|
+
return _lib.eglGetError()
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def eglGetDisplay(display=EGL_DEFAULT_DISPLAY):
|
|
236
|
+
"""Connect to the EGL display server."""
|
|
237
|
+
res = _lib.eglGetDisplay(display)
|
|
238
|
+
if not res or res == EGL_NO_DISPLAY:
|
|
239
|
+
raise RuntimeError('Could not create display')
|
|
240
|
+
return c_void_p(res)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def eglInitialize(display):
|
|
244
|
+
"""Initialize EGL and return EGL version tuple."""
|
|
245
|
+
majorVersion = (_c_int*1)()
|
|
246
|
+
minorVersion = (_c_int*1)()
|
|
247
|
+
res = _lib.eglInitialize(display, majorVersion, minorVersion)
|
|
248
|
+
if res == EGL_FALSE:
|
|
249
|
+
raise RuntimeError('Could not initialize')
|
|
250
|
+
return majorVersion[0], minorVersion[0]
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def eglTerminate(display):
|
|
254
|
+
"""Terminate an EGL display connection."""
|
|
255
|
+
_lib.eglTerminate(display)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def eglQueryString(display, name):
|
|
259
|
+
"""Query string from display"""
|
|
260
|
+
out = _lib.eglQueryString(display, name)
|
|
261
|
+
if not out:
|
|
262
|
+
raise RuntimeError('Could not query %s' % name)
|
|
263
|
+
return out
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
DEFAULT_ATTRIB_LIST = (EGL_RED_SIZE, 8, EGL_BLUE_SIZE, 8,
|
|
267
|
+
EGL_GREEN_SIZE, 8, EGL_ALPHA_SIZE, 8,
|
|
268
|
+
EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE,
|
|
269
|
+
EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
|
|
270
|
+
EGL_CONFORMANT, EGL_OPENGL_ES2_BIT,
|
|
271
|
+
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
|
272
|
+
EGL_NATIVE_RENDERABLE, EGL_TRUE,
|
|
273
|
+
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def _convert_attrib_list(attribList):
|
|
277
|
+
attribList = attribList or []
|
|
278
|
+
attribList = [a for a in attribList] + [EGL_NONE]
|
|
279
|
+
attribList = (_c_int*len(attribList))(*attribList)
|
|
280
|
+
return attribList
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def eglChooseConfig(display, attribList=DEFAULT_ATTRIB_LIST):
|
|
284
|
+
attribList = _convert_attrib_list(attribList)
|
|
285
|
+
numConfigs = (_c_int*1)()
|
|
286
|
+
_lib.eglChooseConfig(display, attribList, None, 0, numConfigs)
|
|
287
|
+
n = numConfigs[0]
|
|
288
|
+
if n <= 0:
|
|
289
|
+
raise RuntimeError('Could not find any suitable config.')
|
|
290
|
+
config = (c_void_p*n)()
|
|
291
|
+
_lib.eglChooseConfig(display, attribList, config, n, numConfigs)
|
|
292
|
+
return config
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def _check_res(res):
|
|
296
|
+
if res == EGL_NO_SURFACE:
|
|
297
|
+
e = eglGetError()
|
|
298
|
+
else:
|
|
299
|
+
return res
|
|
300
|
+
if e == EGL_BAD_MATCH:
|
|
301
|
+
raise ValueError('Cannot create surface: attributes do not match ' +
|
|
302
|
+
'or given config cannot render in window.')
|
|
303
|
+
elif e == EGL_BAD_CONFIG:
|
|
304
|
+
raise ValueError('Cannot create surface: given config is not ' +
|
|
305
|
+
'supported by this system.')
|
|
306
|
+
elif e == EGL_BAD_NATIVE_WINDOW:
|
|
307
|
+
raise ValueError('Cannot create surface: the given native window ' +
|
|
308
|
+
'handle is invalid.')
|
|
309
|
+
elif e == EGL_BAD_ALLOC:
|
|
310
|
+
raise RuntimeError('Could not allocate surface: not enough ' +
|
|
311
|
+
'resources or native window already associated ' +
|
|
312
|
+
'with another config.')
|
|
313
|
+
else:
|
|
314
|
+
raise RuntimeError('Could not create window surface due to ' +
|
|
315
|
+
'unknown error: %i' % e)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def eglCreateWindowSurface(display, config, window, attribList=None):
|
|
319
|
+
# Deal with attrib list
|
|
320
|
+
attribList = _convert_attrib_list(attribList)
|
|
321
|
+
surface = c_void_p(_lib.eglCreateWindowSurface(display, config, window, attribList))
|
|
322
|
+
return _check_res(surface)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def eglCreatePbufferSurface(display, config, attribList=None):
|
|
326
|
+
# Deal with attrib list
|
|
327
|
+
attribList = _convert_attrib_list(attribList)
|
|
328
|
+
#
|
|
329
|
+
surface = c_void_p(_lib.eglCreatePbufferSurface(display, config, attribList))
|
|
330
|
+
return _check_res(surface)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def eglCreateContext(display, config, shareContext=EGL_NO_CONTEXT,
|
|
334
|
+
attribList=None):
|
|
335
|
+
# Deal with attrib list
|
|
336
|
+
attribList = attribList or [EGL_CONTEXT_CLIENT_VERSION, 2]
|
|
337
|
+
attribList = [a for a in attribList] + [EGL_NONE]
|
|
338
|
+
attribList = (_c_int*len(attribList))(*attribList)
|
|
339
|
+
#
|
|
340
|
+
res = c_void_p(_lib.eglCreateContext(display, config, shareContext, attribList))
|
|
341
|
+
if res == EGL_NO_CONTEXT:
|
|
342
|
+
e = eglGetError()
|
|
343
|
+
if e == EGL_BAD_CONFIG:
|
|
344
|
+
raise ValueError('Could not create context: given config is ' +
|
|
345
|
+
'not supported by this system.')
|
|
346
|
+
else:
|
|
347
|
+
raise RuntimeError('Could not create context due to ' +
|
|
348
|
+
'unknown error: %i' % e)
|
|
349
|
+
return res
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def eglMakeCurrent(display, draw, read, context):
|
|
353
|
+
res = _lib.eglMakeCurrent(display, draw, read, context)
|
|
354
|
+
if res == EGL_FALSE:
|
|
355
|
+
raise RuntimeError('Could not make the context current.')
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def eglBindAPI(api):
|
|
359
|
+
"""Set the current rendering API (OpenGL, OpenGL ES or OpenVG)"""
|
|
360
|
+
res = _lib.eglBindAPI(api)
|
|
361
|
+
if res == EGL_FALSE:
|
|
362
|
+
raise RuntimeError('Could not bind API %d' % api)
|
|
363
|
+
return res
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def eglSwapBuffers(display, surface):
|
|
367
|
+
res = _lib.eglSwapBuffers(display, surface)
|
|
368
|
+
if res == EGL_FALSE:
|
|
369
|
+
raise RuntimeError('Could not swap buffers.')
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def eglDestroySurface(display, surface):
|
|
373
|
+
res = _lib.eglDestroySurface(display, surface)
|
|
374
|
+
if res == EGL_FALSE:
|
|
375
|
+
raise RuntimeError('Could not destroy surface')
|
vispy/ext/fontconfig.py
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import warnings
|
|
4
|
+
from ctypes import (util, cdll, c_void_p, c_char_p, c_double, c_int, c_bool,
|
|
5
|
+
Union, Structure, byref, POINTER)
|
|
6
|
+
from ..util.wrappers import run_subprocess
|
|
7
|
+
|
|
8
|
+
# Some code adapted from Pyglet
|
|
9
|
+
|
|
10
|
+
fc = util.find_library('fontconfig')
|
|
11
|
+
if fc is None:
|
|
12
|
+
raise ImportError('fontconfig not found')
|
|
13
|
+
fontconfig = cdll.LoadLibrary(fc)
|
|
14
|
+
|
|
15
|
+
FC_FAMILY = 'family'.encode('ASCII')
|
|
16
|
+
FC_SIZE = 'size'.encode('ASCII')
|
|
17
|
+
FC_SLANT = 'slant'.encode('ASCII')
|
|
18
|
+
FC_WEIGHT = 'weight'.encode('ASCII')
|
|
19
|
+
FC_FT_FACE = 'ftface'.encode('ASCII')
|
|
20
|
+
FC_FILE = 'file'.encode('ASCII')
|
|
21
|
+
FC_STYLE = 'style'.encode('ASCII')
|
|
22
|
+
FC_LANG = 'lang'.encode('ASCII')
|
|
23
|
+
FC_WEIGHT_REGULAR = 80
|
|
24
|
+
FC_WEIGHT_BOLD = 200
|
|
25
|
+
FC_SLANT_ROMAN = 0
|
|
26
|
+
FC_SLANT_ITALIC = 100
|
|
27
|
+
|
|
28
|
+
FcMatchPattern = 1
|
|
29
|
+
FcTypeVoid = 0
|
|
30
|
+
FcTypeInteger = 1
|
|
31
|
+
FcTypeDouble = 2
|
|
32
|
+
FcTypeString = 3
|
|
33
|
+
FcTypeBool = 4
|
|
34
|
+
FcTypeMatrix = 5
|
|
35
|
+
FcTypeCharSet = 6
|
|
36
|
+
FcTypeFTFace = 7
|
|
37
|
+
FcTypeLangSet = 8
|
|
38
|
+
FcType = c_int
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class _FcValueUnion(Union):
|
|
42
|
+
_fields_ = [('s', c_char_p), ('i', c_int), ('b', c_int), ('d', c_double),
|
|
43
|
+
('m', c_void_p), ('c', c_void_p), ('f', c_void_p),
|
|
44
|
+
('p', c_void_p), ('l', c_void_p)]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class FcValue(Structure):
|
|
48
|
+
_fields_ = [('type', FcType), ('u', _FcValueUnion)]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class FcFontSet(Structure):
|
|
52
|
+
_fields_ = [('nfont', c_int), ('sfont', c_int),
|
|
53
|
+
('fonts', POINTER(c_void_p))]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class FcObjectSet(Structure):
|
|
57
|
+
_fields_ = [('nobject', c_int), ('sobject', c_int), ('objects', c_void_p)]
|
|
58
|
+
|
|
59
|
+
fontconfig.FcConfigSubstitute.argtypes = [c_void_p, c_void_p, c_int]
|
|
60
|
+
fontconfig.FcDefaultSubstitute.argtypes = [c_void_p]
|
|
61
|
+
fontconfig.FcFontMatch.restype = c_void_p
|
|
62
|
+
fontconfig.FcFontMatch.argtypes = [c_void_p, c_void_p, c_void_p]
|
|
63
|
+
fontconfig.FcPatternBuild.restype = c_void_p
|
|
64
|
+
fontconfig.FcPatternCreate.restype = c_void_p
|
|
65
|
+
fontconfig.FcPatternAddDouble.argtypes = [c_void_p, c_char_p, c_double]
|
|
66
|
+
fontconfig.FcPatternAddInteger.argtypes = [c_void_p, c_char_p, c_int]
|
|
67
|
+
fontconfig.FcPatternAddString.argtypes = [c_void_p, c_char_p, c_char_p]
|
|
68
|
+
fontconfig.FcPatternDestroy.argtypes = [c_void_p]
|
|
69
|
+
fontconfig.FcPatternGetFTFace.argtypes = [c_void_p, c_char_p, c_int, c_void_p]
|
|
70
|
+
fontconfig.FcPatternGet.argtypes = [c_void_p, c_char_p, c_int, c_void_p]
|
|
71
|
+
|
|
72
|
+
fontconfig.FcObjectSetBuild.argtypes = [c_char_p, c_char_p, c_char_p, c_char_p]
|
|
73
|
+
fontconfig.FcObjectSetBuild.restype = FcObjectSet
|
|
74
|
+
fontconfig.FcFontList.restype = FcFontSet
|
|
75
|
+
fontconfig.FcFontList.argtypes = [c_void_p, c_void_p, FcObjectSet]
|
|
76
|
+
fontconfig.FcNameUnparse.restype = c_char_p
|
|
77
|
+
fontconfig.FcNameUnparse.argtypes = [c_void_p]
|
|
78
|
+
fontconfig.FcFontSetDestroy.argtypes = [FcFontSet]
|
|
79
|
+
fontconfig.FcFontSort.restype = FcFontSet
|
|
80
|
+
fontconfig.FcFontSort.argtypes = [c_void_p, c_void_p, c_bool,
|
|
81
|
+
c_void_p, c_void_p]
|
|
82
|
+
fontconfig.FcConfigGetCurrent.restype = c_void_p
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def find_font(face, bold, italic):
|
|
86
|
+
"""Find font"""
|
|
87
|
+
bold = FC_WEIGHT_BOLD if bold else FC_WEIGHT_REGULAR
|
|
88
|
+
italic = FC_SLANT_ITALIC if italic else FC_SLANT_ROMAN
|
|
89
|
+
face = face.encode('utf8')
|
|
90
|
+
fontconfig.FcInit()
|
|
91
|
+
pattern = fontconfig.FcPatternCreate()
|
|
92
|
+
fontconfig.FcPatternAddInteger(pattern, FC_WEIGHT, bold)
|
|
93
|
+
fontconfig.FcPatternAddInteger(pattern, FC_SLANT, italic)
|
|
94
|
+
fontconfig.FcPatternAddString(pattern, FC_FAMILY, face)
|
|
95
|
+
fontconfig.FcConfigSubstitute(0, pattern, FcMatchPattern)
|
|
96
|
+
fontconfig.FcDefaultSubstitute(pattern)
|
|
97
|
+
result = FcType()
|
|
98
|
+
match = fontconfig.FcFontMatch(0, pattern, byref(result))
|
|
99
|
+
fontconfig.FcPatternDestroy(pattern)
|
|
100
|
+
if not match:
|
|
101
|
+
raise RuntimeError('Could not match font "%s"' % face)
|
|
102
|
+
value = FcValue()
|
|
103
|
+
fontconfig.FcPatternGet(match, FC_FAMILY, 0, byref(value))
|
|
104
|
+
if(value.u.s != face):
|
|
105
|
+
warnings.warn('Could not find face match "%s", falling back to "%s"'
|
|
106
|
+
% (face, value.u.s))
|
|
107
|
+
result = fontconfig.FcPatternGet(match, FC_FILE, 0, byref(value))
|
|
108
|
+
if result != 0:
|
|
109
|
+
raise RuntimeError('No filename or FT face for "%s"' % face)
|
|
110
|
+
fname = value.u.s
|
|
111
|
+
return fname.decode('utf-8')
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _list_fonts():
|
|
115
|
+
"""List system fonts"""
|
|
116
|
+
stdout_, stderr = run_subprocess(['fc-list', ':scalable=true', 'family'])
|
|
117
|
+
vals = [v.split(',')[0] for v in stdout_.strip().splitlines(False)]
|
|
118
|
+
return vals
|