libstb 0.7.0__tar.gz → 0.9.0__tar.gz
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.
- libstb-0.9.0/CHANGELOG.md +416 -0
- {libstb-0.7.0 → libstb-0.9.0}/CMakeLists.txt +67 -20
- libstb-0.9.0/NOTICE.md +63 -0
- libstb-0.9.0/PKG-INFO +270 -0
- libstb-0.9.0/README.md +238 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/README.md +12 -12
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/outputs/benchmark.json +1 -1
- libstb-0.9.0/benchmarks/outputs/index.html +1501 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/outputs/results/sizes.json +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/bench_sizes.py +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/runners.py +2 -2
- libstb-0.9.0/benchmarks/report/CMakeLists.txt +36 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/report/generate_report.py +34 -93
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/report/template.html.jinja2 +114 -307
- libstb-0.9.0/checklist.md +139 -0
- {libstb-0.7.0 → libstb-0.9.0}/cmake/coverage_iframe.html.in +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/docs/CMakeLists.txt +6 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/CreateDocs.cmake +8 -3
- {libstb-0.7.0 → libstb-0.9.0}/docs/assets/libstb-docs.css +130 -78
- {libstb-0.7.0 → libstb-0.9.0}/docs/cpp/CreateDocs.cmake +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/docs/cpp/Doxyfile.in +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/docs/cpp/footer.html.in +1 -1
- libstb-0.9.0/docs/cpp/index-install.txt +18 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/cpp/libstb-doxygen.css +7 -7
- libstb-0.9.0/docs/cpp/mainpage.md +77 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/generate_index.py +37 -30
- {libstb-0.7.0 → libstb-0.9.0}/docs/guide.md +135 -30
- {libstb-0.7.0 → libstb-0.9.0}/docs/index.html.in +115 -92
- {libstb-0.7.0 → libstb-0.9.0}/docs/initial_comment.in +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/docs/make_showcase.py +27 -2
- libstb-0.9.0/docs/python/index-install.txt +2 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/_themes/libstb/layout.html +8 -6
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/_themes/libstb/static/libstb-sphinx.css +12 -12
- libstb-0.9.0/docs/python/source/font.rst +61 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/supported_langs.json +13 -13
- libstb-0.9.0/examples/cpp/CMakeLists.txt +7 -0
- libstb-0.9.0/examples/cpp/canvas.cpp +53 -0
- libstb-0.9.0/examples/cpp/tour.cpp +118 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/notebooks/01_getting_started.ipynb +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/examples/notebooks/04_edit_and_orient.ipynb +7 -7
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/01_open_and_inspect.py +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/05_font_render.py +9 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/06_imread_imwrite.py +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/09_channels_and_alpha.py +9 -8
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/11_pillow.py +1 -1
- libstb-0.9.0/include/stb/color.hpp +242 -0
- libstb-0.9.0/include/stb/draw.hpp +412 -0
- {libstb-0.7.0 → libstb-0.9.0}/include/stb/error.hpp +7 -5
- libstb-0.9.0/include/stb/export.hpp +25 -0
- {libstb-0.7.0 → libstb-0.9.0}/include/stb/font.hpp +31 -5
- {libstb-0.7.0 → libstb-0.9.0}/include/stb/image.hpp +207 -38
- libstb-0.9.0/include/stb/shaping.hpp +51 -0
- libstb-0.7.0/include/stb/env.hpp → libstb-0.9.0/include/stb/util.hpp +10 -1
- {libstb-0.7.0 → libstb-0.9.0}/include/stb/zlib.hpp +7 -5
- {libstb-0.7.0 → libstb-0.9.0}/include/stb.h +6 -4
- {libstb-0.7.0 → libstb-0.9.0}/pyproject.toml +13 -2
- libstb-0.9.0/src/bindings/python/CMakeLists.txt +131 -0
- libstb-0.9.0/src/bindings/python/bind_font.cpp +357 -0
- {libstb-0.7.0 → libstb-0.9.0}/src/bindings/python/bind_image.cpp +138 -53
- {libstb-0.7.0 → libstb-0.9.0}/src/bindings/python/bind_resizer.cpp +14 -18
- libstb-0.9.0/src/bindings/python/binding.hpp +96 -0
- {libstb-0.7.0 → libstb-0.9.0}/src/bindings/python/libstb/__init__.py +18 -10
- libstb-0.9.0/src/bindings/python/libstb/__main__.py +179 -0
- {libstb-0.7.0 → libstb-0.9.0}/src/bindings/python/libstb/font.py +8 -0
- {libstb-0.7.0 → libstb-0.9.0}/src/bindings/python/libstb/image.py +17 -7
- libstb-0.9.0/src/codec/bmp_tga.cpp +169 -0
- libstb-0.9.0/src/codec/codec.hpp +112 -0
- libstb-0.9.0/src/codec/decode/bmp.cpp +418 -0
- libstb-0.9.0/src/codec/decode/convert.cpp +115 -0
- libstb-0.9.0/src/codec/decode/dispatch.cpp +167 -0
- libstb-0.9.0/src/codec/decode/formats.hpp +260 -0
- libstb-0.9.0/src/codec/decode/gif.cpp +447 -0
- libstb-0.9.0/src/codec/decode/hdr.cpp +287 -0
- libstb-0.9.0/src/codec/decode/idct.cpp +290 -0
- libstb-0.9.0/src/codec/decode/inflate.cpp +494 -0
- libstb-0.9.0/src/codec/decode/inflate.hpp +57 -0
- libstb-0.9.0/src/codec/decode/jpeg.cpp +1318 -0
- libstb-0.9.0/src/codec/decode/jpeg.hpp +148 -0
- libstb-0.9.0/src/codec/decode/pic.cpp +282 -0
- libstb-0.9.0/src/codec/decode/png.cpp +659 -0
- libstb-0.9.0/src/codec/decode/pnm.cpp +149 -0
- libstb-0.9.0/src/codec/decode/psd.cpp +291 -0
- libstb-0.9.0/src/codec/decode/tga.cpp +346 -0
- libstb-0.9.0/src/codec/decode/upsample.cpp +298 -0
- libstb-0.9.0/src/codec/decode.cpp +80 -0
- libstb-0.9.0/src/codec/deflate.cpp +582 -0
- libstb-0.9.0/src/codec/jpeg.cpp +492 -0
- libstb-0.9.0/src/codec/png.cpp +158 -0
- libstb-0.9.0/src/draw/color.cpp +131 -0
- libstb-0.9.0/src/draw/shape.cpp +117 -0
- {libstb-0.7.0/src/core → libstb-0.9.0/src/font}/font.cpp +182 -87
- libstb-0.9.0/src/font/shaper/arabic.cpp +226 -0
- libstb-0.9.0/src/font/shaper/arabic.hpp +39 -0
- libstb-0.9.0/src/font/shaper/bidi.cpp +327 -0
- libstb-0.9.0/src/font/shaper/bidi.hpp +30 -0
- libstb-0.9.0/src/font/shaper/gsub.cpp +561 -0
- libstb-0.9.0/src/font/shaper/gsub.hpp +151 -0
- libstb-0.9.0/src/font/shaper/otl.cpp +109 -0
- libstb-0.9.0/src/font/shaper/otl.hpp +133 -0
- libstb-0.9.0/src/font/shaper/text_shaper.cpp +198 -0
- libstb-0.9.0/src/font/shaper/text_shaper.hpp +76 -0
- libstb-0.9.0/src/font/shaping.cpp +38 -0
- libstb-0.9.0/src/font/truetype/atlas.cpp +198 -0
- libstb-0.9.0/src/font/truetype/cff.cpp +460 -0
- libstb-0.9.0/src/font/truetype/face.cpp +454 -0
- libstb-0.9.0/src/font/truetype/raster.cpp +460 -0
- libstb-0.9.0/src/font/truetype/truetype.hpp +170 -0
- libstb-0.9.0/src/image/blend.cpp +249 -0
- libstb-0.9.0/src/image/image.cpp +218 -0
- libstb-0.7.0/src/core/image_kernels.hpp → libstb-0.9.0/src/image/kernels.hpp +3 -3
- libstb-0.7.0/src/core/image_kernels_scalar.cpp → libstb-0.9.0/src/image/kernels_scalar.cpp +3 -5
- libstb-0.7.0/src/core/image_kernels_sse2.cpp → libstb-0.9.0/src/image/kernels_sse2.cpp +1 -1
- libstb-0.7.0/src/core/image_ops.cpp → libstb-0.9.0/src/image/ops.cpp +101 -82
- libstb-0.9.0/src/image/pixels.hpp +76 -0
- libstb-0.9.0/src/image/resize/README.md +11 -0
- libstb-0.9.0/src/image/resize/api.hpp +747 -0
- libstb-0.9.0/src/image/resize/coders.hpp +533 -0
- libstb-0.9.0/src/image/resize/coders.inl +1635 -0
- libstb-0.9.0/src/image/resize/coefficients.hpp +954 -0
- libstb-0.9.0/src/image/resize/config.hpp +313 -0
- libstb-0.9.0/src/image/resize/decode.hpp +100 -0
- libstb-0.9.0/src/image/resize/engine.hpp +622 -0
- libstb-0.9.0/src/image/resize/filters.hpp +235 -0
- libstb-0.9.0/src/image/resize/horizontal.hpp +1376 -0
- libstb-0.9.0/src/image/resize/horizontals.inl +353 -0
- libstb-0.9.0/src/image/resize/sampler.hpp +810 -0
- libstb-0.9.0/src/image/resize/scanline.hpp +392 -0
- libstb-0.9.0/src/image/resize/simd.hpp +1733 -0
- libstb-0.9.0/src/image/resize/srgb.hpp +78 -0
- libstb-0.9.0/src/image/resize/vertical.hpp +85 -0
- libstb-0.9.0/src/image/resize/verticals.inl +386 -0
- libstb-0.7.0/src/core/resizer.cpp → libstb-0.9.0/src/image/resize.cpp +21 -9
- {libstb-0.7.0/src/core → libstb-0.9.0/src/image}/simd.cpp +2 -2
- libstb-0.7.0/src/core/utf8.cpp → libstb-0.9.0/src/util/util.cpp +3 -3
- libstb-0.9.0/src/zlib/zlib.cpp +83 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/CMakeLists.txt +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/tests/cmake/consumer_project/CMakeLists.txt +9 -1
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/CMakeLists.txt +9 -2
- libstb-0.9.0/tests/cpp/test_blend.cpp +327 -0
- libstb-0.9.0/tests/cpp/test_codec.cpp +127 -0
- libstb-0.9.0/tests/cpp/test_color.cpp +384 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/test_common.hpp +5 -2
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/test_edit.cpp +124 -63
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/test_encode.cpp +111 -2
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/test_env.cpp +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/test_exif.cpp +1 -1
- libstb-0.9.0/tests/cpp/test_font.cpp +839 -0
- libstb-0.9.0/tests/cpp/test_gsub.cpp +547 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/test_image.cpp +43 -23
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/test_resizer.cpp +3 -3
- libstb-0.9.0/tests/data/OFL-Vazirmatn.txt +93 -0
- libstb-0.9.0/tests/data/libstb-fa-gsub-test.ttf +0 -0
- libstb-0.9.0/tests/data/libstb-fa-test.ttf +0 -0
- libstb-0.9.0/tests/data/make_persian_font.py +67 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/genhtml.css +20 -20
- libstb-0.9.0/tests/python/test_blend.py +206 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_channels.py +31 -17
- libstb-0.9.0/tests/python/test_cli.py +71 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_errors.py +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_exif.py +1 -1
- libstb-0.9.0/tests/python/test_font.py +652 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_functional.py +2 -2
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_geometry.py +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_image.py +13 -7
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_lossless_exact.py +1 -2
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_memory.py +37 -6
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_no_numpy.py +2 -2
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_oop.py +29 -4
- libstb-0.9.0/tests/python/test_packaging.py +61 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_pillow_convert.py +1 -1
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_pillow_parity.py +2 -2
- libstb-0.9.0/tests/python/test_roundtrip.py +174 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_simd.py +7 -7
- libstb-0.9.0/tests/tools/decode_snapshot.py +78 -0
- libstb-0.9.0/tests/tools/jpeg_vs_upstream.py +97 -0
- libstb-0.9.0/tests/tools/make_corpus.py +198 -0
- libstb-0.9.0/tests/tools/snapshot.py +292 -0
- libstb-0.9.0/tests/tools/wheel_diag.py +34 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/tools/zlib_fuzz.py +16 -17
- libstb-0.9.0/tools/gen_arabic_shaping.py +91 -0
- {libstb-0.7.0 → libstb-0.9.0}/tools/gen_font_metrics.py +6 -6
- libstb-0.7.0/CHANGELOG.md +0 -186
- libstb-0.7.0/PKG-INFO +0 -170
- libstb-0.7.0/README.md +0 -139
- libstb-0.7.0/benchmarks/outputs/index.html +0 -7726
- libstb-0.7.0/benchmarks/report/CMakeLists.txt +0 -94
- libstb-0.7.0/docs/cpp/index-install.txt +0 -11
- libstb-0.7.0/docs/cpp/mainpage.md +0 -51
- libstb-0.7.0/docs/images/libstb-logo.png +0 -0
- libstb-0.7.0/docs/images/libstb-sq.png +0 -0
- libstb-0.7.0/docs/python/index-install.txt +0 -2
- libstb-0.7.0/docs/python/source/_themes/libstb/static/libstb-docs.css +0 -418
- libstb-0.7.0/docs/python/source/font.rst +0 -40
- libstb-0.7.0/include/stb/resizer.hpp +0 -72
- libstb-0.7.0/include/stb/utf8.hpp +0 -13
- libstb-0.7.0/src/bindings/python/CMakeLists.txt +0 -64
- libstb-0.7.0/src/bindings/python/bind_font.cpp +0 -139
- libstb-0.7.0/src/bindings/python/binding.hpp +0 -33
- libstb-0.7.0/src/core/image.cpp +0 -320
- libstb-0.7.0/src/core/zlib.cpp +0 -137
- libstb-0.7.0/src/core/zlib_bridge.hpp +0 -23
- libstb-0.7.0/src/third_party/README.md +0 -36
- libstb-0.7.0/src/third_party/stb/stb_image.h +0 -7988
- libstb-0.7.0/src/third_party/stb/stb_image_resize2.h +0 -10679
- libstb-0.7.0/src/third_party/stb/stb_image_write.h +0 -2111
- libstb-0.7.0/src/third_party/stb/stb_rect_pack.h +0 -623
- libstb-0.7.0/src/third_party/stb/stb_truetype.h +0 -5079
- libstb-0.7.0/tests/cpp/test_font.cpp +0 -235
- libstb-0.7.0/tests/python/test_font.py +0 -197
- libstb-0.7.0/tests/tools/jpeg_vs_upstream.py +0 -77
- {libstb-0.7.0 → libstb-0.9.0}/.github/workflows/cmake.yml +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/.github/workflows/orchestrator.yml +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/.github/workflows/release_template.md +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/.github/workflows/wheels.yml +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/.gitignore +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/LICENSE.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/.gitignore +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/CMakeLists.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/cmake/Download.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/cmake/FetchRealCorpus.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/corpus/.gitignore +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/outputs/results/fonts.json +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/outputs/results/scaling.json +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/outputs/results/system_info.json +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/outputs/results/throughput.json +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/outputs/results/throughput_memory.json +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/outputs/results/verify.json +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/CMakeLists.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/bench_fonts.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/bench_op_memory_driver.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/bench_op_memory_one.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/bench_scaling.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/bench_throughput.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/corpus.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/real_corpus_manifest.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/requirements.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/system_info.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/python/verify.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/benchmarks/report/gather.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/cmake/DynamicVersion.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/cmake/FixLCovPaths.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/cmake/GenerateIframe.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/cmake/Optimize.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/cmake/Startup.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/cmake/libstbConfig.cmake.in +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/InjectComment.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/assets/bench-teaser.js +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/cpp/index-docs.json +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/cpp/index-example.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/cpp/topbar.html.in +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/images/libstb-sq.svg +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/images/libstb-sq.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/images/libstb-theme.svg +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/CreateDocs.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/index-docs.json +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/index-example.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/_themes/libstb/libstb-nav.html +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/_themes/libstb/page.html +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/_themes/libstb/theme.toml +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/conf.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/errors.rst +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/image.rst +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/index.rst +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/resizer.rst +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/simd.rst +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/docs/python/source/zlib.rst +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/cpp/.gitignore +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/notebooks/.gitignore +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/notebooks/02_resize_filters.ipynb +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/notebooks/03_font_rendering.ipynb +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/notebooks/requirements.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/.gitignore +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/02_encode_formats.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/03_resize_filters.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/04_numpy_interop.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/07_dlpack.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/08_geometry.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/10_exif_orientation.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/examples/python/requirements.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/requirements-dev.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/src/bindings/python/bind_zlib.cpp +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/src/bindings/python/binding.cpp +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/src/bindings/python/libstb/compress.py +0 -0
- {libstb-0.7.0/src/core → libstb-0.9.0/src/image}/exif.cpp +0 -0
- {libstb-0.7.0/src/core → libstb-0.9.0/src/image}/simd.hpp +0 -0
- {libstb-0.7.0/src/core → libstb-0.9.0/src/util}/file.hpp +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/cmake/CMakeLists.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/cmake/consumer_project/main.cpp +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/cmake/run_consumer_test.cmake +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/coverage_dashboard.html.in +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/test_utf8.cpp +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/cpp/test_zlib.cpp +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/data/libstb-test.ttf +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/data/make_test_font.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/CMakeLists.txt +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/conftest.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/pngbomb.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_array_interface.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_dlpack.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_encode.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_gc.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_lossy_tolerance.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_png_bomb.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_resizer.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_torch.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/test_zlib.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/python/tolerances.py +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/utest/utest.h +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/tests/utest/utest_main.cxx +0 -0
- {libstb-0.7.0 → libstb-0.9.0}/version.py +0 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to libstb are listed here, newest first. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Dates are commit dates.
|
|
5
|
+
|
|
6
|
+
This file was generated from the git history (61 commits, tags `v0.3.0`, `v0.4.0`, `v0.5.0`, `v0.6.0`, `v0.7.0`); 0.8.0 was written by hand from the 26 commits after `v0.7.0`.
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.9.0] - 2026-11-01
|
|
11
|
+
|
|
12
|
+
libstb no longer vendors any stb header: the decoders, encoders, resizer and font reader are libstb's
|
|
13
|
+
own code, derived from stb's algorithms (see `NOTICE.md`). The C++ core is now a shared library, so
|
|
14
|
+
the wheel is 0.55 MB instead of 4.3 MB, there is a `libstb` command line, and the image API gained
|
|
15
|
+
blend modes, fills, masks and stacking. Several names changed on the way (see Breaking).
|
|
16
|
+
|
|
17
|
+
### Breaking
|
|
18
|
+
- `image::composite` and `image::composite_in_place` are gone: `blend` replaces
|
|
19
|
+
both and changes the image it is called on (it returns `*this`, so calls chain, and a
|
|
20
|
+
temporary comes back by value: `base.copy().blend(logo, 16, 16)` is the old `composite`).
|
|
21
|
+
In Python `Image.composite` is `Image.blend` and still returns a new image. `blend_mode::normal`
|
|
22
|
+
at opacity 1 runs the same integer kernels as before, so its output is byte for byte the old
|
|
23
|
+
one (the 533-case snapshot of the whole library shows 0 differences).
|
|
24
|
+
- the channel count is no longer a bare number anywhere in the public API. A new
|
|
25
|
+
`enum class pixel_format { gray, gray_alpha, rgb, rgba }` (Python: `PixelFormat.GRAY`,
|
|
26
|
+
`GRAY_ALPHA`, `RGB`, `RGBA`) replaces it: `image(w, h, format)`, `image::wrap`,
|
|
27
|
+
`convert(format)`, `load_options::format` (an empty `std::optional` keeps the file's format),
|
|
28
|
+
`image_info::format`, and in Python `Image.open(..., format=)`, `imread(..., format=)`,
|
|
29
|
+
`Image.convert(format)`, `ImageInfo.format`. Python also takes the lower case name
|
|
30
|
+
(`"gray"`, `"gray_alpha"`, `"rgb"`, `"rgba"`); a bare number is a `TypeError`. `channels()` /
|
|
31
|
+
`.channels` stay as the plain count. `iminfo()` now returns `(width, height, format)`, and
|
|
32
|
+
`ImageInfo.channels` is a property.
|
|
33
|
+
- the CMake target is `libstb::libstb` (was `libstb::core`), both in the build tree
|
|
34
|
+
(an alias of `stb_core`) and in the installed `find_package(libstb)` package.
|
|
35
|
+
- public headers merged by cohesion: `stb/resizer.hpp` is part of `stb/image.hpp`,
|
|
36
|
+
`stb/shape.hpp` and `stb/canvas.hpp` became `stb/draw.hpp`, `stb/env.hpp` and `stb/utf8.hpp`
|
|
37
|
+
became `stb/util.hpp`. `<stb.h>` still includes everything.
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
- Command line: `libstb` and `python -m libstb` (argparse, no dependencies). `--version`,
|
|
41
|
+
`--cmake-dir`, `--include-dir`, `--lib-dir`; `info FILE... [--json]`; `convert SRC DST` (format
|
|
42
|
+
from the extension, `--resize WxH|Wx|xH`, `--filter`, `--pixel-format`, `--orient`, `--quality`,
|
|
43
|
+
`--compression`, `--no-rle`); `zlib compress|decompress SRC DST` (`-` is stdin or stdout).
|
|
44
|
+
- `image::blend(overlay, x, y, mode, opacity)`: blend modes `normal`, `multiply`, `screen`,
|
|
45
|
+
`overlay`, `darken`, `lighten`, `add` and `difference` (`enum class blend_mode`, Python
|
|
46
|
+
`BlendMode` or the lower case name), and an `opacity` between 0 and 1 that scales the overlay's
|
|
47
|
+
alpha. Works with every channel count and with alpha below and above. Python:
|
|
48
|
+
`Image.blend(overlay, x, y, mode="normal", opacity=1.0)`.
|
|
49
|
+
- `image::fill(color, x, y, width, height)` (and `fill(color)` for the whole image): overwrites
|
|
50
|
+
pixels with a colour, clipped to the image, stored in the image's format (gray takes the
|
|
51
|
+
luma, alpha is dropped where there is none). Python: `Image.fill(color, x, y, width, height)`.
|
|
52
|
+
- `image::alpha()` (the alpha channel as a gray mask) and `image::with_alpha(mask)` (add or
|
|
53
|
+
replace the alpha channel). Python: `Image.alpha()`, `Image.with_alpha(mask)`.
|
|
54
|
+
- `image::hstack` and `image::vstack` (also `Image.hstack`, `Image.vstack`): several images side
|
|
55
|
+
by side or one above the other, with `gap`, `background` and `align` (`enum class align`,
|
|
56
|
+
Python `Align` or `"start"`, `"center"`, `"end"`). The result has colour and alpha if any
|
|
57
|
+
input has.
|
|
58
|
+
- `canvas::add_image(image, x, y)` with `.blend(mode)` and `.opacity(o)` on the returned
|
|
59
|
+
`image_item` (Python `Canvas.add_image`, `CanvasImage`). The canvas keeps its own copy, and its
|
|
60
|
+
items (images, texts, shapes) are drawn in the order they were added.
|
|
61
|
+
- `pixel_format` helpers: `image::format()`, `Image.format`, `channel_count`, `has_alpha`,
|
|
62
|
+
`pixel_format_name`, `pixel_format_from_name`, `pixel_format_from_channels` (the one place a
|
|
63
|
+
number becomes a format).
|
|
64
|
+
- `&&` overloads of `image::convert`, `flatten`, `orient`, `rotate90` and `pad`. When the call
|
|
65
|
+
changes nothing (same channel count, no alpha to flatten, orientation 1, whole turns, no border)
|
|
66
|
+
a temporary or `std::move(img)` hands its pixels back instead of copying them; every other case
|
|
67
|
+
and every error is the same as the `const&` version. The `const&` overloads still copy.
|
|
68
|
+
- `include/stb/export.hpp` with the `STB_API` macro (see Changed), the `STB_BUILD_EXAMPLES` CMake
|
|
69
|
+
option (off by default) and `examples/cpp/tour.cpp`: one walk through load, inspect, geometry,
|
|
70
|
+
resize, canvas, masks, stacking and encode.
|
|
71
|
+
|
|
72
|
+
### Changed
|
|
73
|
+
- **The C++ core is a shared library** (`libstb.so`, `libstb.dylib`, `stb.dll`) and the Python
|
|
74
|
+
extension links to it, so a wheel holds one copy of the engine instead of two. The wheel went
|
|
75
|
+
from 4.3 MB to 0.55 MB (the old one shipped an LTO `libstb_core.a` next to an extension that
|
|
76
|
+
already contained the same code). `find_package(libstb)` after `pip install libstb` links C++
|
|
77
|
+
programs to that `libstb.so`, with an rpath, so nothing needs `LD_LIBRARY_PATH`. Linux and
|
|
78
|
+
macOS set `$ORIGIN/lib` / `@loader_path/lib` on the extension; on Windows `stb.dll` is installed
|
|
79
|
+
in `libstb/lib` too and `libstb/__init__.py` registers that folder with `os.add_dll_directory`.
|
|
80
|
+
- Public headers mark the exported classes and functions with `STB_API` (`dllexport`/`dllimport` on
|
|
81
|
+
Windows, default visibility elsewhere, empty for a static build or for sources compiled into a
|
|
82
|
+
target). The library is built with `-fvisibility=hidden`, so the decoders, the font reader and
|
|
83
|
+
the kernels are not part of its interface.
|
|
84
|
+
- musl (musllinux wheels, or a build on Alpine; CMake detects it from the C library): the Python
|
|
85
|
+
extension carries its own statically linked copy of the core instead of using `libstb.so`.
|
|
86
|
+
nanobind links extensions there with `-static-libstdc++ -static-libgcc`, and a dynamic libstdc++
|
|
87
|
+
crashes on the first C++ exception on musl, so the shared core cannot be used from Python there;
|
|
88
|
+
two C++ runtimes (static in the extension, dynamic in `libstb.so`) cannot pass an exception to
|
|
89
|
+
each other either. `libstb.so` is still installed for C++ programs.
|
|
90
|
+
- PNG encoder: the best filtered row is kept while the five filters are tried, instead of filtering
|
|
91
|
+
it a second time (one pass less per row, 216 encodes byte for byte identical). BMP and TGA
|
|
92
|
+
encoding is faster.
|
|
93
|
+
|
|
94
|
+
### Fixed
|
|
95
|
+
- musllinux wheels crashed on the first C++ exception (see the musl entry above).
|
|
96
|
+
- Windows: `stb.dll` is found when the extension is imported (copied next to the extension in the
|
|
97
|
+
build tree, `os.add_dll_directory` in the installed package).
|
|
98
|
+
- A typo in an `assert` and a stream reference in the JPEG and PNG decoders.
|
|
99
|
+
|
|
100
|
+
### Removed
|
|
101
|
+
- `image::composite` and `image::composite_in_place` (use `blend`).
|
|
102
|
+
- `src/third_party/`: no stb header is vendored any more. `NOTICE.md` records the lineage and the
|
|
103
|
+
license.
|
|
104
|
+
|
|
105
|
+
### Internal (refactor, no behaviour change)
|
|
106
|
+
- **Decoders:** `stb_image.h` is split into `src/codec/decode/`, one file per format, with `stream`,
|
|
107
|
+
`inflater`, `jpeg_decoder`, `png_decoder` and `gif_decoder` classes; the callback IO, 16-bit and
|
|
108
|
+
linear loaders and unused setters are removed. 23,680 decodes (every format, damaged files too)
|
|
109
|
+
give the same pixels or the same error as the stb build.
|
|
110
|
+
- **Encoders and zlib compressor:** libstb's own code in `src/codec/` (`png.cpp`, `jpeg.cpp`,
|
|
111
|
+
`bmp_tga.cpp`, `deflate.cpp`), written as classes with no global state (the old mutex around
|
|
112
|
+
`stb_image_write`'s globals is gone). Output bytes are unchanged (PNG at every level, JPEG, BMP,
|
|
113
|
+
TGA, zlib), and the JPEG encoder still writes the same bytes as upstream `stb_image_write` v1.16
|
|
114
|
+
built with the same compiler.
|
|
115
|
+
- **Resizer:** `stb_image_resize2.h` is split by topic into `src/image/resize/` (api, config, srgb,
|
|
116
|
+
simd, filters, coefficients, coders, decode, horizontal, vertical, scanline, sampler, engine, and
|
|
117
|
+
the three template `.inl` files that upstream produced by including its own header again).
|
|
118
|
+
Declarations of functions that no longer exist (`stbir_set_pixel_callbacks`,
|
|
119
|
+
`stbir_set_user_data`, `stbir_set_pixel_layouts`, the subrect setters), the unused
|
|
120
|
+
`stbir_quick_resize_helper` and the documentation of the removed setters are deleted, which also
|
|
121
|
+
silences the matching `-Wunused-function` warnings.
|
|
122
|
+
- **Font reader:** `src/font/truetype/` replaces `stb_truetype.h` and `stb_rect_pack.h` (font file,
|
|
123
|
+
cmap, GPOS / kern kerning, TrueType and CFF outlines, the anti-aliasing rasterizer and the atlas
|
|
124
|
+
packer). Every read is bounds-checked and composite glyphs have a recursion limit. Glyph bitmaps,
|
|
125
|
+
metrics, kerning and atlases are byte-for-byte what stb produced on 150 real fonts (TrueType,
|
|
126
|
+
CFF, collections).
|
|
127
|
+
- **Source layout:** `src/core/` is gone. One folder per module: `src/util`, `src/image`,
|
|
128
|
+
`src/codec`, `src/zlib`, `src/font` (with `shaper/`), `src/draw`. Internal headers are included
|
|
129
|
+
relative to `src/` (`"image/simd.hpp"`).
|
|
130
|
+
- `include/stb/color.hpp` went from 1051 to 240 lines: string parsing (`from_string`, `from_hash`,
|
|
131
|
+
`from_name`), `to_string`, `blend` and the stream operators moved to `src/draw/color.cpp`, and
|
|
132
|
+
`from_name` looks names up in one table (values still come from the named factories, so each
|
|
133
|
+
color is defined once). 40,000 parse, error-message and blend outputs match the previous header
|
|
134
|
+
byte for byte.
|
|
135
|
+
- Decoder cleanup: redundant `this->` and local `stream *s` aliases are gone from the JPEG and PNG
|
|
136
|
+
decoders, local macros became `constexpr` values and inline functions (`zfast_bits`, `fast_bits`,
|
|
137
|
+
`marker_none`, `is_restart`, `is_sof`, `png_type`, `div4`, `float2fixed`, `hdr_buflen`, ...), and
|
|
138
|
+
`typedef` became `using` or a plain `struct`. Data members of the stateful decoder classes
|
|
139
|
+
(`jpeg_decoder`, `png_decoder`, `gif_decoder`, `inflater`) end in an underscore like the rest of
|
|
140
|
+
the project, and cryptic ones got real names (`s_` became `stream_`; in the GIF decoder `w_`,
|
|
141
|
+
`h_`, `pal_` and `lpal_` became `width_`, `height_`, `palette_` and `local_palette_`). The renames
|
|
142
|
+
were made with libclang; 23,680 decoder cases are unchanged.
|
|
143
|
+
- Shaper complexity (clang-tidy `readability-function-cognitive-complexity`, no warnings left in
|
|
144
|
+
`src/font/shaper`): `bidi::classify_wide` reads an ordered range table, `arabic::joining_forms`
|
|
145
|
+
uses small join helpers, and the GSUB context engine splits `try_rule` into `match_input`,
|
|
146
|
+
`match_side` and `run_records`, with one `read_rule` instead of two copies of the rule layout
|
|
147
|
+
code. `bidi::resolve` is a class with one method per UAX #9 rule, and `text_shaper::shape_line`
|
|
148
|
+
and `gsub_table::make_plan` are split into steps. Verified over every code point (classification,
|
|
149
|
+
mirroring, joining type), 200,000 random Arabic strings (forms, bidi order and levels) and new
|
|
150
|
+
format 2 GSUB tests that also pass on the old code.
|
|
151
|
+
- Move semantics and special members reviewed (clang-tidy `performance-*`,
|
|
152
|
+
`bugprone-use-after-move`, `cppcoreguidelines-special-member-functions`): no use-after-move and no
|
|
153
|
+
avoidable by-value copies were found. `canvas`, `simd_scope` and `font_bytes` now say explicitly
|
|
154
|
+
that they are neither copied nor moved, the polymorphic bases `glyph_source` and `subtable`
|
|
155
|
+
cannot be sliced, and two no-op `std::move` calls are gone.
|
|
156
|
+
- The three `thumbnail` overloads and the two `Resizer` constructors share their code, constants
|
|
157
|
+
are snake_case.
|
|
158
|
+
|
|
159
|
+
### Tests and tooling
|
|
160
|
+
- `tests/cpp/test_blend.cpp` and `tests/python/test_blend.py` (blend, fill, masks, stacking),
|
|
161
|
+
`tests/python/test_packaging.py` (one `libstb.so` in the wheel, no `.a`, public symbols exported
|
|
162
|
+
and internal ones hidden, an extension never mixes the two C++ runtimes) and
|
|
163
|
+
`tests/python/test_cli.py`.
|
|
164
|
+
- Round-trip tests (`tests/python/test_roundtrip.py`, `tests/cpp/test_codec.cpp`): files go through
|
|
165
|
+
`open`, `write` and `open` for png, bmp, tga and jpeg, in a chain of formats and from a loaded
|
|
166
|
+
ppm; new tests for the `&&` overloads and their errors.
|
|
167
|
+
- Development checks that are not tests: `tests/tools/snapshot.py` (byte-for-byte comparison of two
|
|
168
|
+
builds), `tests/tools/decode_snapshot.py` (the decoder corpus), and updated
|
|
169
|
+
`tests/tools/jpeg_vs_upstream.py` and `zlib_fuzz.py`.
|
|
170
|
+
- The CI consumer test builds a C++ program against the installed package with `find_package`.
|
|
171
|
+
|
|
172
|
+
## [0.8.0] - 2026-10-22
|
|
173
|
+
|
|
174
|
+
### Added
|
|
175
|
+
- Drawing text (`4ab53e3`, `15ad30c`): `stb::font::draw_text` and `Image.draw_text` write multi-line
|
|
176
|
+
UTF-8 text onto a 1 to 4 channel image with alpha blending. `text_align` (`left`, `center`,
|
|
177
|
+
`right`) aligns every line to the x you give.
|
|
178
|
+
- `stb::color` (`<stb/color.hpp>`, `ededbef`): colours from names, `#hex`, `{r, g, b[, a]}` and
|
|
179
|
+
string literals, and `color::from_value(0xRRGGBB)`. Used by `draw_text` and the canvas.
|
|
180
|
+
- Canvas (`stb::canvas`, `Image.canvas`, `1fc491a`, `4201852`, `bcc2e39`): collect texts and
|
|
181
|
+
shapes, drawn together by `finish()`. `add_text` returns an item with its own `.font()`,
|
|
182
|
+
`.size()`, `.color()`, `.align()`, `.bg_color()` and `.padding()`. `add_rect` (with `.radius()`),
|
|
183
|
+
`add_ellipse` and `add_line` return a shape with `.fill()`, `.no_fill()` and `.stroke()`, with
|
|
184
|
+
smooth edges (`6243481`). The API is the same in C++ and Python, and golden-hash tests keep
|
|
185
|
+
their output byte-identical.
|
|
186
|
+
- Right-to-left text (Persian, Arabic, Urdu, Hebrew) in `draw_text`, `measure`, `render` and the
|
|
187
|
+
canvas: pass the text as typed, with no `arabic-reshaper` or `python-bidi`. The line is
|
|
188
|
+
ordered with the Unicode bidirectional algorithm (UAX #9, without explicit embeddings and
|
|
189
|
+
isolates), ZWNJ and ZWJ are honoured and brackets are mirrored.
|
|
190
|
+
- Letter shapes and ligatures come from the font's GSUB table for Arabic script: `isol`,
|
|
191
|
+
`init`, `medi`, `fina`, `ccmp`, `rlig` (lam-alef), `calt` and `liga` (so "الله" is the one
|
|
192
|
+
glyph the font draws for it). Lookup types 1 to 7 are read (single, multiple, alternate,
|
|
193
|
+
ligature, context, chaining context in all three formats, extension), with lookup flags and
|
|
194
|
+
GDEF. A font without GSUB but with the Arabic Presentation Forms in its `cmap` is shaped
|
|
195
|
+
through those, and a form it lacks falls back to the plain letter (`cea22ba`, `79fce16`).
|
|
196
|
+
- Marks (harakat) sit over or under their letter by a simple rule, with no room of their own
|
|
197
|
+
(`7c301be`).
|
|
198
|
+
- Checked against HarfBuzz: identical glyph ids on 3,000 random strings, with and without
|
|
199
|
+
marks, on each of Vazirmatn, Noto Naskh Arabic and Noto Sans Arabic. About 0.2 microseconds
|
|
200
|
+
per character, 2.4 times faster than Pillow with raqm for the layout of a 438-character
|
|
201
|
+
paragraph. The GSUB table is parsed the first time right-to-left text is drawn with a font
|
|
202
|
+
(about 0.1 ms); opening a font is as fast as before.
|
|
203
|
+
- The font is untrusted input. Every read is range-checked, the growth of the glyph run and
|
|
204
|
+
the work of the lookups are limited in proportion to the text, and 50,000 damaged fonts
|
|
205
|
+
shaped under AddressSanitizer and UBSan without a crash.
|
|
206
|
+
- Not done: GPOS (kerning is the `kern` table only, marks are not placed by the font's
|
|
207
|
+
anchors, so fonts that depend on GPOS for their shapes, some Nastaliq fonts, look wrong),
|
|
208
|
+
GSUB lookup type 8, `locl` per language, and the Syriac features. Not checked: Hebrew,
|
|
209
|
+
Urdu-specific letters, OpenType-CFF (`.otf`) fonts and B Nazanin.
|
|
210
|
+
- `stb::font::shape_glyphs` / `Font.shape_glyphs(text)`: the glyph indices shaping chose, in
|
|
211
|
+
visual order, for diagnostics and tests.
|
|
212
|
+
- `<stb/shaping.hpp>`: `stb::shape_for_display`, `stb::has_rtl`, `stb::is_arabic_mark` and
|
|
213
|
+
`stb::is_arabic_mark_below`, the code-point level steps behind the above.
|
|
214
|
+
- Tests: white-box tests of the GSUB engine with hand-made tables (every lookup type and
|
|
215
|
+
format, a stage mask, truncated and damaged tables), HarfBuzz reference glyph ids in C++ and
|
|
216
|
+
Python, a live HarfBuzz comparison in Python when `uharfbuzz` is installed (now in the `test`
|
|
217
|
+
extra), a Persian golden hash shared by C++ and Python, and two Vazirmatn subsets under the
|
|
218
|
+
SIL OFL 1.1 in `tests/data` (`make_persian_font.py` rebuilds them).
|
|
219
|
+
|
|
220
|
+
### Changed
|
|
221
|
+
- `Image.canvas` and `Image.draw_text` are nanobind methods, and a font argument of the wrong
|
|
222
|
+
type raises `TypeError` (`fc3aaff`, `402153d`).
|
|
223
|
+
- `stb::color` converts implicitly from string literals and brace lists.
|
|
224
|
+
- Benchmark report and docs: Chart.js and KaTeX load from cdnjs, brand colours, download buttons
|
|
225
|
+
for the benchmark data, and zero Doxygen and Sphinx warnings (`641561c`, `054ea1f`, `ee3af4f`).
|
|
226
|
+
|
|
227
|
+
### Fixed
|
|
228
|
+
- Windows: a test variable named `small` collided with an `rpcndr.h` macro, and the canvas box
|
|
229
|
+
arithmetic is 64-bit with parenthesized `min`/`max` (`3145a8a`).
|
|
230
|
+
- Windows (MSVC): the C++ tests are built with `/utf-8`, so Persian and Arabic text written as
|
|
231
|
+
`"\u0633"` in a narrow string literal stays UTF-8 instead of becoming `?` in the ANSI code page,
|
|
232
|
+
and the shaping tests parenthesize `std::min`/`std::max` against the `windows.h` macros.
|
|
233
|
+
|
|
234
|
+
## [0.7.0] - 2026-10-17
|
|
235
|
+
|
|
236
|
+
### Breaking
|
|
237
|
+
- CMake names changed (`016551c`, `c76d406`, `3b02769`). Targets `libstb_*` are now `stb_*`:
|
|
238
|
+
`stb_core` (the library; still exported as `libstb::core`), `stb_test`, `stb_test_cpp`,
|
|
239
|
+
`stb_test_python`, `stb_test_cmake`, `stb_docs` (`_cpp`, `_python`, `_index`), `stb_coverage`
|
|
240
|
+
(`_cpp`, `_python`, `_total`), `stb_benchmark` and `stb_bench_*`; the C++ test executable
|
|
241
|
+
`test_libstb_cpp` is now `test_stb_cpp`. The options `LIBSTB_BUILD_TESTS`, `LIBSTB_BUILD_PYTHON`
|
|
242
|
+
and `LIBSTB_BUILD_DOCS` are now `STB_BUILD_TESTS`, `STB_BUILD_PYTHON` and `STB_BUILD_DOCS`.
|
|
243
|
+
Scripts and CI that call the old names must be updated. Not renamed: the package and project
|
|
244
|
+
name `libstb`, `find_package(libstb CONFIG)`, `libstb::core`, `import libstb`, the extension
|
|
245
|
+
module `libstb_py`, and environment variables such as `LIBSTB_SIMD`.
|
|
246
|
+
|
|
247
|
+
### Added
|
|
248
|
+
- `stb::zlib_compress` / `stb::zlib_decompress` (`<stb/zlib.hpp>`; Python: `libstb.zlib_compress`,
|
|
249
|
+
`libstb.zlib_decompress`, `DEFAULT_ZLIB_LEVEL`, `DEFAULT_ZLIB_MAX_BYTES`) (`0088cb8`): zlib streams
|
|
250
|
+
with the PNG compressor and stb_image's inflate. `level` uses zlib's numbering (0 stores, 1 to 9,
|
|
251
|
+
-1 default 6). The output of `zlib_decompress` is bounded by `max_bytes` (a zip bomb is a
|
|
252
|
+
`limit_error` / `LimitError`, never an out-of-memory), the Adler-32 is verified, and both
|
|
253
|
+
directions interoperate with zlib. Compression was 1.2x to 1.9x faster than zlib level 6 with
|
|
254
|
+
0.4% to 3.3% larger output on our samples; decompression is **not** faster than zlib (about
|
|
255
|
+
2.5x slower on very compressible text). Any bytes-like object is accepted in Python and the GIL
|
|
256
|
+
is released.
|
|
257
|
+
- `stb::estimate_text` / `stb::estimate_metrics` (Python: `libstb.estimate_text`,
|
|
258
|
+
`libstb.estimate_metrics`): rough text size without a font file, from fixed width tables for
|
|
259
|
+
`sans`, `serif` and `mono` (Liberation metrics, generated by `tools/gen_font_metrics.py`, no font
|
|
260
|
+
bundled). No kerning; CJK and emoji count as 1 em and other non-Latin text is approximated.
|
|
261
|
+
- Tests: a real PNG decompression bomb (a valid 0.5 MB file that declares 576 MB), generated on
|
|
262
|
+
demand by `tests/python/pngbomb.py`, checked from Python (`test_png_bomb.py`, with a memray bound)
|
|
263
|
+
and C++ (`test_a_real_png_bomb_is_refused_from_its_header`) (`83226ea`); zlib tests against
|
|
264
|
+
python's `zlib` in both directions, zip bombs and exact `max_bytes` bounds; font estimator
|
|
265
|
+
tests, including agreement with the real Liberation fonts when they are installed.
|
|
266
|
+
- `docs/guide.md`: the complete reference that used to be the README (`ec879bb`).
|
|
267
|
+
- Documentation pages for the zlib and estimator APIs (Sphinx and Doxygen).
|
|
268
|
+
|
|
269
|
+
### Changed
|
|
270
|
+
- README rewritten as a short landing page: Python first, then C++ with CMake, then which stb
|
|
271
|
+
modules are used and how libstb differs from plain stb in API and performance (`ec879bb`).
|
|
272
|
+
- Internal: stb's headers are still compiled in one translation unit (`src/core/image.cpp`); the
|
|
273
|
+
zlib API reaches them through `src/core/zlib_bridge.hpp`, so the compressor and inflater exist
|
|
274
|
+
once. The Python bindings share one `py_buffer` helper (`binding.hpp`).
|
|
275
|
+
|
|
276
|
+
### Fixed
|
|
277
|
+
- The C++ install snippets (`docs/cpp/index-install.txt`, `docs/cpp/mainpage.md`) used
|
|
278
|
+
`GIT_TAG main`, but the default branch is `master`.
|
|
279
|
+
|
|
280
|
+
## [0.6.0] - 2026-10-16
|
|
281
|
+
|
|
282
|
+
### Breaking
|
|
283
|
+
- `Image.rotate90(turns=1)` (C++: `stb::image::rotate90`) now turns **counter-clockwise**, like
|
|
284
|
+
`numpy.rot90` and Pillow. A negative `turns` turns clockwise. Before, positive meant clockwise.
|
|
285
|
+
`orient()` (EXIF) is unchanged.
|
|
286
|
+
|
|
287
|
+
### Added
|
|
288
|
+
- Image editing API on `Image` and `stb::image`: `crop`, `flip_horizontal`, `flip_vertical`,
|
|
289
|
+
`rotate90`, `transpose`, `orient`, `pad`, `thumbnail`, `convert`, `split`, `Image.merge`,
|
|
290
|
+
`composite`, `flatten`. Every operation returns a new image.
|
|
291
|
+
- EXIF orientation support (`exif_orientation`, `orient`).
|
|
292
|
+
- Channel and alpha handling (gray, RGB, RGBA conversion and compositing).
|
|
293
|
+
- `libstb.imresize(array, width, height, resizer=None)`: ndarray in, ndarray out.
|
|
294
|
+
- Runtime SIMD backend selection: `simd_backends()`, `simd_name()`, `set_simd()`, the `LIBSTB_SIMD`
|
|
295
|
+
environment variable (an unknown or unavailable name prints one line on stderr and falls back to
|
|
296
|
+
auto), and a per-thread override: `with libstb.simd("scalar"):` (C++: `stb::simd_scope`).
|
|
297
|
+
- Hand-written SSE2 kernels (RGB/RGBA to gray, RGBA over RGB), bit identical to the scalar backend.
|
|
298
|
+
- `stb::env()` in `include/stb/env.hpp`: cross-platform, copy-returning environment variable reader
|
|
299
|
+
(uses `_dupenv_s` on MSVC).
|
|
300
|
+
- `Image.to_pil()` / `Image.from_pil()`. Pillow is loaded only when these are called
|
|
301
|
+
(`pip install "libstb[pillow]"`). Only 8-bit L/RGBA modes are supported, others raise `TypeError`.
|
|
302
|
+
- Examples 08 to 11 (geometry, channels and alpha, EXIF orientation, Pillow) and the notebook
|
|
303
|
+
`04_edit_and_orient`.
|
|
304
|
+
- Tests: edit, EXIF, channels, geometry, SIMD, array interface, functional, Pillow conversion,
|
|
305
|
+
garbage collection (`test_gc.py`) and allocation checks with `pytest-memray` (`test_memory.py`).
|
|
306
|
+
- `tests/python/test_torch.py`: DLPack in both directions with real torch (CPU). torch is not a
|
|
307
|
+
test dependency: the module is skipped when it cannot be imported.
|
|
308
|
+
- Documentation site: `-DLIBSTB_BUILD_DOCS=ON`, then `cmake --build build --target libstb_docs` builds the
|
|
309
|
+
C++ reference (Doxygen), the Python reference (Sphinx) and a landing page into `build/docs/out`.
|
|
310
|
+
- Coverage: `cmake --build build --target libstb_coverage` builds an lcov report for the C++ core, a
|
|
311
|
+
coverage.py report for the Python layer, a merged total and a dashboard in `build/coverage` (needs
|
|
312
|
+
`lcov` and `coverage`). The C++ tests compile the core sources into the test executable, so
|
|
313
|
+
coverage is just a few flags on that target; the shipped `libstb::core` and the Python extension are
|
|
314
|
+
unchanged.
|
|
315
|
+
- CI: QEMU user-mode job (`emulate`) that checks the fallback to portable SIMD backends on a CPU
|
|
316
|
+
without AVX2 (Nehalem) and the use of AVX2 kernels when available (Haswell).
|
|
317
|
+
- CI: native ARM64 runners (Linux and Windows) in the wheel matrix.
|
|
318
|
+
- CI: `build-docs` and `build-coverage` jobs in `cmake.yml` (coverage is also sent to Codecov), and a
|
|
319
|
+
`deploy-pages` job in the orchestrator that publishes the docs with the coverage dashboard under
|
|
320
|
+
`/coverage`. The coverage job installs the CPU build of torch so `test_torch.py` runs there.
|
|
321
|
+
|
|
322
|
+
### Changed
|
|
323
|
+
- The scalar backend is compiled without compiler auto-vectorization, so it is really scalar.
|
|
324
|
+
- Wheel matrix runs with `fail-fast: false`.
|
|
325
|
+
- Python examples, notebooks, tests, benchmarks, README and docs import the package as
|
|
326
|
+
`import libstb as stb` and write `stb.Image`, `stb.imread`, ... (the package name is still `libstb`).
|
|
327
|
+
- Python 3.12+ builds use the stable ABI: `wheel.py-api = "cp312"` is set in `pyproject.toml`, giving
|
|
328
|
+
one `cp312-abi3` wheel for 3.12 and newer.
|
|
329
|
+
- `pytest-memray` is only required on x86_64 and arm64, and not on Windows. `numpy` is not required
|
|
330
|
+
for the test extra on Windows ARM64 with Python < 3.11; the test modules use
|
|
331
|
+
`pytest.importorskip` for numpy and Pillow.
|
|
332
|
+
- Benchmarks: new `imresize` and editing runners (`crop`, `rotate90`, `flip_horizontal`,
|
|
333
|
+
`convert_gray`, `composite`).
|
|
334
|
+
- README: image manipulation, EXIF, SIMD diagnosis, memory checks and GC support are documented.
|
|
335
|
+
|
|
336
|
+
### Fixed
|
|
337
|
+
- `nanobind: leaked 1 instances!` at interpreter exit. An `Image` that views a Python object holds a
|
|
338
|
+
reference the GC cannot see, which could form an uncollectable cycle. `Image` now implements
|
|
339
|
+
`tp_traverse` / `tp_clear` and the keep-alive deleter reports the object it holds
|
|
340
|
+
(`image::owner_deleter<D>()` in `image.hpp`).
|
|
341
|
+
- Windows build: a test variable named `small` collided with the `small` macro from Windows headers
|
|
342
|
+
(renamed to `tiny`).
|
|
343
|
+
- `test_simd.py`: emulator backend detection in an assertion.
|
|
344
|
+
|
|
345
|
+
## [0.5.0] - 2026-10-07
|
|
346
|
+
|
|
347
|
+
### Added
|
|
348
|
+
- DLPack interop (`Image.from_dlpack`, `__dlpack__`) and image I/O helpers `imread` / `imwrite`.
|
|
349
|
+
- Examples `06_imread_imwrite.py` and `07_dlpack.py`, and updated notebooks.
|
|
350
|
+
- Tests for DLPack and the functional API.
|
|
351
|
+
|
|
352
|
+
### Changed
|
|
353
|
+
- Legacy DLPack behavior on numpy < 2.1 (read-only views, no `copy=` / `device=` arguments) is
|
|
354
|
+
handled and documented; the affected tests are skipped on those versions.
|
|
355
|
+
- README API examples updated.
|
|
356
|
+
|
|
357
|
+
## [0.4.0] - 2026-10-04
|
|
358
|
+
|
|
359
|
+
### Added
|
|
360
|
+
- Standalone benchmark suite (`benchmarks/`) with its own build system and an HTML report, with
|
|
361
|
+
LaTeX formulas rendered by KaTeX (inlined, so the report stays self-contained).
|
|
362
|
+
- Pillow as a test-only dependency, with image format parity tests.
|
|
363
|
+
- Exhaustive PNG roundtrip exactness tests (noise, flat, gradient, tiled, sparse, photo-like,
|
|
364
|
+
degenerate sizes, more than 64K deflate tokens), a lossy tolerance test and a JPEG golden test.
|
|
365
|
+
- `Font.open()` accepts a file path and uses memory mapping on Unix and macOS.
|
|
366
|
+
- Getting Started, resize filters and font rendering example notebooks and the first Python examples
|
|
367
|
+
(`01` to `05`).
|
|
368
|
+
|
|
369
|
+
### Changed
|
|
370
|
+
- Faster font loading (memory mapping, fast integer conversion).
|
|
371
|
+
- Faster JPEG encoding on GCC/Clang (`-fno-trapping-math` enables vectorized float to int
|
|
372
|
+
conversion) and a faster PNG encoder in the bundled `stb_image_write.h`. The default PNG
|
|
373
|
+
compression level is 8 (was 6).
|
|
374
|
+
- libdeflate was vendored and then removed again within this cycle; the PNG path uses the optimized
|
|
375
|
+
`stb_image_write.h`.
|
|
376
|
+
- Lossy tolerances in tests are standardized; benchmarks and `verify.py` use normalized mean
|
|
377
|
+
absolute error (NMAE).
|
|
378
|
+
- Documentation states that the optimized JPEG encoder is not guaranteed to be byte-identical across
|
|
379
|
+
compilers and flags (rare rounding ties, for example Apple clang on ARM64 or x86 with `-mfma`).
|
|
380
|
+
A tool, `tests/tools/jpeg_vs_upstream.py`, checks equivalence for identical build settings.
|
|
381
|
+
|
|
382
|
+
## [0.3.0] - 2026-09-30
|
|
383
|
+
|
|
384
|
+
### Added
|
|
385
|
+
- Python binding: errors map OS error codes to `FileNotFoundError`, `PermissionError` and similar;
|
|
386
|
+
the GIL is released during font rendering (`render_glyph`, `render`, `make_atlas`).
|
|
387
|
+
|
|
388
|
+
### Changed
|
|
389
|
+
- C++ namespace and headers renamed from `libstb` to `stb` (`include/libstb.h` became
|
|
390
|
+
`include/stb.h`, `include/libstb/` became `include/stb/`). The Python package is still `libstb`.
|
|
391
|
+
- The abstract encoder hierarchy (`PngEncoder`, `JpegEncoder`, ...) was removed in favor of direct
|
|
392
|
+
methods on the image type (`to_png`, `write_jpg`, ...).
|
|
393
|
+
- `save()` was replaced by `write()`; the format is detected from the file extension
|
|
394
|
+
(case-insensitive).
|
|
395
|
+
- Resize accepts a filter by name (for example `"cubic"`).
|
|
396
|
+
- Documentation clarifies the move-only semantics of `stb::image` and pixel memory ownership, and
|
|
397
|
+
the difference between numpy views and copies.
|
|
398
|
+
|
|
399
|
+
### Fixed
|
|
400
|
+
- Windows: `utest.h` macro collision, and the `NOMINMAX` / `WIN32_LEAN_AND_MEAN` guards in the test
|
|
401
|
+
headers.
|
|
402
|
+
|
|
403
|
+
## Initial commit - 2026-09-28 (tag `__beta__`)
|
|
404
|
+
|
|
405
|
+
First state: C++17 core over the stb single-header libraries with image decoding and
|
|
406
|
+
encoding (PNG, JPEG, BMP, TGA), resizing with selectable filters, TrueType font rendering, and a
|
|
407
|
+
nanobind Python binding.
|
|
408
|
+
|
|
409
|
+
[Unreleased]: https://github.com/mohammadraziei/libstb/compare/v0.9.0...HEAD
|
|
410
|
+
[0.9.0]: https://github.com/mohammadraziei/libstb/compare/v0.8.0...v0.9.0
|
|
411
|
+
[0.8.0]: https://github.com/mohammadraziei/libstb/compare/v0.7.0...v0.8.0
|
|
412
|
+
[0.7.0]: https://github.com/mohammadraziei/libstb/compare/v0.6.0...v0.7.0
|
|
413
|
+
[0.6.0]: https://github.com/mohammadraziei/libstb/compare/v0.5.0...v0.6.0
|
|
414
|
+
[0.5.0]: https://github.com/mohammadraziei/libstb/compare/v0.4.0...v0.5.0
|
|
415
|
+
[0.4.0]: https://github.com/mohammadraziei/libstb/compare/v0.3.0...v0.4.0
|
|
416
|
+
[0.3.0]: https://github.com/mohammadraziei/libstb/compare/__beta__...v0.3.0
|
|
@@ -21,36 +21,60 @@ include(Optimize)
|
|
|
21
21
|
|
|
22
22
|
option(STB_BUILD_TESTS "Build tests" ${PROJECT_IS_TOP_LEVEL})
|
|
23
23
|
option(STB_BUILD_PYTHON "Build Python bindings" ${PROJECT_IS_TOP_LEVEL})
|
|
24
|
+
option(STB_BUILD_EXAMPLES "Build the C++ examples in examples/cpp" OFF)
|
|
24
25
|
option(STB_BUILD_DOCS "Build documentation (Doxygen + Sphinx)" OFF)
|
|
25
26
|
|
|
26
27
|
# --- libstb C++ core ---
|
|
27
|
-
# stb
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
# There is no stb header in the tree any more: the decoders, encoders, font reader and resizer are
|
|
29
|
+
# libstb's own code derived from stb (see NOTICE.md), and no public include/ header includes any of it.
|
|
30
|
+
# One folder per module (util, image, codec, zlib, font, draw); the bindings live elsewhere.
|
|
31
|
+
#
|
|
32
|
+
# The core is always a shared library (libstb.so, libstb.dylib, stb.dll): the Python extension and
|
|
33
|
+
# every C++ program link to the same copy, which is what lets a wheel carry one engine instead
|
|
34
|
+
# of two. Only what the public headers mark STB_API is exported (include/stb/export.hpp); the rest
|
|
35
|
+
# is hidden.
|
|
36
|
+
file(GLOB_RECURSE LIBSTB_CORE_SOURCES CONFIGURE_DEPENDS
|
|
37
|
+
${PROJECT_SOURCE_DIR}/src/util/*.cpp
|
|
38
|
+
${PROJECT_SOURCE_DIR}/src/image/*.cpp
|
|
39
|
+
${PROJECT_SOURCE_DIR}/src/codec/*.cpp
|
|
40
|
+
${PROJECT_SOURCE_DIR}/src/zlib/*.cpp
|
|
41
|
+
${PROJECT_SOURCE_DIR}/src/font/*.cpp
|
|
42
|
+
${PROJECT_SOURCE_DIR}/src/draw/*.cpp)
|
|
43
|
+
|
|
44
|
+
add_library(stb_core SHARED ${LIBSTB_CORE_SOURCES})
|
|
45
|
+
target_compile_definitions(stb_core PRIVATE STB_BUILDING_LIBRARY)
|
|
46
|
+
add_library(libstb::libstb ALIAS stb_core)
|
|
36
47
|
|
|
37
48
|
set_target_properties(stb_core PROPERTIES
|
|
38
|
-
POSITION_INDEPENDENT_CODE ON # linked into the Python extension
|
|
39
49
|
CXX_VISIBILITY_PRESET hidden
|
|
40
50
|
VISIBILITY_INLINES_HIDDEN ON
|
|
41
|
-
EXPORT_NAME
|
|
42
|
-
OUTPUT_NAME
|
|
51
|
+
EXPORT_NAME libstb # consumers link libstb::libstb
|
|
52
|
+
OUTPUT_NAME stb # libstb.so / libstb.dylib / stb.dll
|
|
43
53
|
)
|
|
54
|
+
if(NOT DEFINED SKBUILD)
|
|
55
|
+
# libstb.so -> libstb.so.0.8 -> libstb.so.0.8.0 in a plain install. A wheel carries a single
|
|
56
|
+
# file (zip has no symlinks), so it gets no version suffix.
|
|
57
|
+
set_target_properties(stb_core PROPERTIES
|
|
58
|
+
VERSION ${PROJECT_VERSION}
|
|
59
|
+
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
|
60
|
+
)
|
|
61
|
+
endif()
|
|
62
|
+
# MSVC: the exported classes hold std::string / std::vector members (C4251) and derive from std
|
|
63
|
+
# exceptions (C4275). Both are fine as long as the library and its users use the same compiler and
|
|
64
|
+
# runtime, which a DLL of C++ classes already requires.
|
|
65
|
+
target_compile_options(stb_core PUBLIC $<$<CXX_COMPILER_ID:MSVC>:/wd4251 /wd4275>)
|
|
44
66
|
|
|
45
67
|
# Install layout: the wheel carries include/, lib/ and cmake/ inside the
|
|
46
68
|
# `libstb` package (httpp's pattern, see get_cmake_dir() in the Python
|
|
47
69
|
# package); a plain `cmake --install` uses the usual prefix layout.
|
|
48
70
|
if(DEFINED SKBUILD)
|
|
49
71
|
set(_libstb_lib_dest libstb/lib)
|
|
72
|
+
set(_libstb_bin_dest libstb/lib) # stb.dll beside stb.lib; libstb/__init__.py adds it with os.add_dll_directory
|
|
50
73
|
set(_libstb_inc_dest libstb/include)
|
|
51
74
|
set(_libstb_cmake_dest libstb/cmake)
|
|
52
75
|
else()
|
|
53
76
|
set(_libstb_lib_dest lib)
|
|
77
|
+
set(_libstb_bin_dest bin)
|
|
54
78
|
set(_libstb_inc_dest include)
|
|
55
79
|
set(_libstb_cmake_dest lib/cmake/libstb)
|
|
56
80
|
endif()
|
|
@@ -64,9 +88,14 @@ target_include_directories(stb_core
|
|
|
64
88
|
# that compiles them itself (tests/cpp does, to attach coverage flags) gets exactly the same
|
|
65
89
|
# settings as stb_core.
|
|
66
90
|
function(libstb_apply_core_build_settings target)
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
|
|
91
|
+
# Internal headers are included relative to src/ ("image/simd.hpp", "font/shaper/gsub.hpp").
|
|
92
|
+
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/src)
|
|
93
|
+
|
|
94
|
+
# A target that compiles the core sources itself (the C++ tests) has no library to import
|
|
95
|
+
# from: STB_API must be empty there. stb_core builds with STB_BUILDING_LIBRARY instead.
|
|
96
|
+
if(NOT target STREQUAL "stb_core")
|
|
97
|
+
target_compile_definitions(${target} PRIVATE STB_STATIC_DEFINE)
|
|
98
|
+
endif()
|
|
70
99
|
|
|
71
100
|
target_compile_options(${target} PRIVATE
|
|
72
101
|
$<$<CXX_COMPILER_ID:MSVC>:/W4 /EHsc>
|
|
@@ -80,15 +109,24 @@ function(libstb_apply_core_build_settings target)
|
|
|
80
109
|
)
|
|
81
110
|
apply_optimization_flags(${target})
|
|
82
111
|
|
|
83
|
-
#
|
|
112
|
+
# shape.cpp draws with floating point and the result must be the same on every platform
|
|
113
|
+
# (the C++ and Python canvas tests compare against one fixed hash), so no fused multiply-add
|
|
114
|
+
# contraction: GCC and Clang would otherwise use FMA on ARM and give last-bit differences.
|
|
115
|
+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
116
|
+
set_source_files_properties(${PROJECT_SOURCE_DIR}/src/draw/shape.cpp
|
|
117
|
+
TARGET_DIRECTORY ${target}
|
|
118
|
+
PROPERTIES COMPILE_OPTIONS "-ffp-contract=off")
|
|
119
|
+
endif()
|
|
120
|
+
|
|
121
|
+
# kernels_scalar.cpp is the "scalar" SIMD backend: the same pixel loops with the
|
|
84
122
|
# compiler's auto-vectoriser off. (MSVC has no such switch: there it may still vectorise,
|
|
85
123
|
# with identical results.) TARGET_DIRECTORY: source file properties are per directory scope.
|
|
86
124
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
87
|
-
set_source_files_properties(${PROJECT_SOURCE_DIR}/src/
|
|
125
|
+
set_source_files_properties(${PROJECT_SOURCE_DIR}/src/image/kernels_scalar.cpp
|
|
88
126
|
TARGET_DIRECTORY ${target}
|
|
89
127
|
PROPERTIES COMPILE_OPTIONS "-fno-tree-vectorize;-fno-tree-slp-vectorize")
|
|
90
128
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
91
|
-
set_source_files_properties(${PROJECT_SOURCE_DIR}/src/
|
|
129
|
+
set_source_files_properties(${PROJECT_SOURCE_DIR}/src/image/kernels_scalar.cpp
|
|
92
130
|
TARGET_DIRECTORY ${target}
|
|
93
131
|
PROPERTIES COMPILE_OPTIONS "-fno-vectorize;-fno-slp-vectorize")
|
|
94
132
|
endif()
|
|
@@ -96,9 +134,13 @@ endfunction()
|
|
|
96
134
|
|
|
97
135
|
libstb_apply_core_build_settings(stb_core)
|
|
98
136
|
|
|
99
|
-
# --- install (find_package(libstb) -> libstb::
|
|
137
|
+
# --- install (find_package(libstb) -> libstb::libstb) ---
|
|
100
138
|
include(CMakePackageConfigHelpers)
|
|
101
|
-
install(TARGETS stb_core EXPORT libstbTargets
|
|
139
|
+
install(TARGETS stb_core EXPORT libstbTargets
|
|
140
|
+
LIBRARY DESTINATION ${_libstb_lib_dest} # libstb.so, libstb.dylib
|
|
141
|
+
RUNTIME DESTINATION ${_libstb_bin_dest} # stb.dll
|
|
142
|
+
ARCHIVE DESTINATION ${_libstb_lib_dest} # stb.lib, the import library on Windows
|
|
143
|
+
)
|
|
102
144
|
install(DIRECTORY include/ DESTINATION ${_libstb_inc_dest})
|
|
103
145
|
install(EXPORT libstbTargets FILE libstbTargets.cmake NAMESPACE libstb:: DESTINATION ${_libstb_cmake_dest})
|
|
104
146
|
configure_package_config_file(
|
|
@@ -131,6 +173,11 @@ if(STB_BUILD_TESTS)
|
|
|
131
173
|
add_subdirectory(${PROJECT_SOURCE_DIR}/tests)
|
|
132
174
|
endif()
|
|
133
175
|
|
|
176
|
+
# The C++ examples (one executable per examples/cpp/*.cpp), against the same library the users link.
|
|
177
|
+
if(STB_BUILD_EXAMPLES)
|
|
178
|
+
add_subdirectory(${PROJECT_SOURCE_DIR}/examples/cpp)
|
|
179
|
+
endif()
|
|
180
|
+
|
|
134
181
|
# Documentation (Doxygen + Sphinx). Needs the Python extension: the Sphinx build imports it.
|
|
135
182
|
if(STB_BUILD_DOCS)
|
|
136
183
|
add_subdirectory(${PROJECT_SOURCE_DIR}/docs)
|
libstb-0.9.0/NOTICE.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# NOTICE
|
|
2
|
+
|
|
3
|
+
libstb is MIT licensed (see LICENSE.txt). Its image decoders, encoders, zlib compressor, font reader,
|
|
4
|
+
glyph rasterizer, rectangle packer and resizer are derived from Sean Barrett's stb libraries
|
|
5
|
+
(https://github.com/nothings/stb) and from the contributors acknowledged in them. stb is available
|
|
6
|
+
under two licenses, public domain or MIT; libstb uses the MIT option, reproduced below.
|
|
7
|
+
|
|
8
|
+
| libstb | derived from | stb version |
|
|
9
|
+
| :--- | :--- | :--- |
|
|
10
|
+
| `src/codec/decode/` (decoders and the inflater) | `stb_image.h` | v2.30 |
|
|
11
|
+
| `src/codec/` (`png.cpp`, `jpeg.cpp`, `bmp_tga.cpp`, `deflate.cpp`) | `stb_image_write.h` | v1.16 |
|
|
12
|
+
| `src/image/resize/` | `stb_image_resize2.h` | v2.18 |
|
|
13
|
+
| `src/font/truetype/` | `stb_truetype.h`, `stb_rect_pack.h` | v1.26, v1.01 |
|
|
14
|
+
|
|
15
|
+
The JPEG encoder is based on Jon Olick's jo_jpeg.cpp (public domain / MIT).
|
|
16
|
+
|
|
17
|
+
No stb header is vendored: the algorithms are the same, the code is reorganised (one file per format and
|
|
18
|
+
topic, classes for stateful decoders, bounds-checked reads). `tests/tools/snapshot.py` and
|
|
19
|
+
`decode_snapshot.py` compare libstb with a build of the original stb code, byte for byte.
|
|
20
|
+
|
|
21
|
+
## stb license (MIT option)
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
------------------------------------------------------------------------------
|
|
25
|
+
This software is available under 2 licenses -- choose whichever you prefer.
|
|
26
|
+
------------------------------------------------------------------------------
|
|
27
|
+
ALTERNATIVE A - MIT License
|
|
28
|
+
Copyright (c) 2017 Sean Barrett
|
|
29
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
30
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
31
|
+
the Software without restriction, including without limitation the rights to
|
|
32
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
33
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
34
|
+
so, subject to the following conditions:
|
|
35
|
+
The above copyright notice and this permission notice shall be included in all
|
|
36
|
+
copies or substantial portions of the Software.
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
|
44
|
+
------------------------------------------------------------------------------
|
|
45
|
+
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
|
46
|
+
This is free and unencumbered software released into the public domain.
|
|
47
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
|
48
|
+
software, either in source code form or as a compiled binary, for any purpose,
|
|
49
|
+
commercial or non-commercial, and by any means.
|
|
50
|
+
In jurisdictions that recognize copyright laws, the author or authors of this
|
|
51
|
+
software dedicate any and all copyright interest in the software to the public
|
|
52
|
+
domain. We make this dedication for the benefit of the public at large and to
|
|
53
|
+
the detriment of our heirs and successors. We intend this dedication to be an
|
|
54
|
+
overt act of relinquishment in perpetuity of all present and future rights to
|
|
55
|
+
this software under copyright law.
|
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
57
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
58
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
59
|
+
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
60
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
61
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
62
|
+
------------------------------------------------------------------------------
|
|
63
|
+
*/
|