Delegate image processing to raygeo.image, keep only Cairo wrappers#284
Merged
Conversation
Replace pure-Python implementations of srgb_to_linear, linear_to_srgb, compute_auto_levels, normalize_grayscale, dithering algorithms, and surface_to_* conversions with calls to raygeo.image Rust functions. The surface_to_* functions remain as thin Cairo surface buffer extraction wrappers that delegate to raygeo.image.rgba_to_grayscale/binary/inplace. The pure-array dither functions (apply_floyd_steinberg_dither, apply_bayer_dither, apply_minimum_run_length) are removed from rayforge.image.dither and imported from raygeo.image instead. srgb.py retains create_lut_from_color and resize_linear_nd which have no raygeo equivalents.
knipknap
force-pushed
the
feat/delegate-image-to-raygeo
branch
from
June 8, 2026 19:49
ef624eb to
2280133
Compare
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
Stripped-down version of #278 containing only the image processing delegation to
raygeo.imageRust functions.raygeo.imageRust functionssurface_to_*functions remain as thin Cairo surface buffer extraction wrappersChanges by file
grayscale.pysurface_to_grayscale/binary/inplace→ extract Cairo buffer, callraygeo.image.rgba_to_*. Removedcompute_auto_levels,normalize_grayscale(now fromraygeo.image)srgb.pysrgb_to_linear/linear_to_srgbnow delegate toraygeo.image. Retainscreate_lut_from_colorandresize_linear_nd(no Rust equivalents)dither.pyapply_floyd_steinberg_dither/apply_bayer_dither/apply_minimum_run_lengthremoved, imported fromraygeo.image.surface_to_dithered_arrayusesraygeo.image.rgba_to_grayscale+ Rust dither__init__.pycompute_auto_levels/normalize_grayscalere-exported fromraygeo.imageraster_widget.pycompute_auto_levelsfromraygeo.imagedirectlyfloat32→uint8), adjusted rounding expectationsNot included (compared to #278)