Replace Python raster scan loops with Rust-accelerated raygeo functions#277
Merged
Conversation
Delegate rasterization to raygeo.ops.raster high-level functions (rasterize_power_modulation, rasterize_mask_scan, rasterize_multi_pass) and raygeo.image (compute_auto_levels, normalize_grayscale) instead of the pure-Python raster_util implementations. Reduces raster_producer.py from 735 to 500 lines while keeping identical behavior through all 39 existing tests.
The Windows CI was installing raygeo from PyPI (v0.4.1) which doesn't include the new image and raster modules. Install from the local git checkout instead so the build always uses the current raygeo source.
… build" This reverts commit 1882c59.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rasterizerwith single calls to the Rust-acceleratedraygeo.ops.rasterfunctions (rasterize_power_modulation,rasterize_mask_scan,rasterize_multi_pass)compute_auto_levelsandnormalize_grayscaleimports with theirraygeo.imageRust equivalents_rasterize_maskhelper method (no longer needed)raster_producer.pyfrom 735 to 500 lines (-32%)Details
All four raster modes now delegate to Rust:
POWER_MODULATIONrasterize_power_modulation()CONSTANT_POWERrasterize_mask_scan()DITHERrasterize_mask_scan()MULTI_PASS_rasterize_maskrasterize_multi_pass()Cairo surface→mask conversion (binary/dithered) still happens in Python since it requires Cairo interaction. The Y-axis inversion is now handled entirely within the Rust functions.
Depends on raygeo v0.5.0 (tagged).
Testing
All 39 existing rasterizer producer tests and 51 raster_util tests pass unchanged.