Skip to content

Delegate image processing to raygeo.image, keep only Cairo wrappers#284

Merged
knipknap merged 2 commits into
mainfrom
feat/delegate-image-to-raygeo
Jun 8, 2026
Merged

Delegate image processing to raygeo.image, keep only Cairo wrappers#284
knipknap merged 2 commits into
mainfrom
feat/delegate-image-to-raygeo

Conversation

@knipknap

@knipknap knipknap commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Stripped-down version of #278 containing only the image processing delegation to raygeo.image Rust functions.

  • Replaces all pure-Python image processing implementations with calls to raygeo.image Rust functions
  • surface_to_* functions remain as thin Cairo surface buffer extraction wrappers
  • Removes 525 lines of Python image processing code

Changes by file

File Change
grayscale.py surface_to_grayscale/binary/inplace → extract Cairo buffer, call raygeo.image.rgba_to_*. Removed compute_auto_levels, normalize_grayscale (now from raygeo.image)
srgb.py srgb_to_linear/linear_to_srgb now delegate to raygeo.image. Retains create_lut_from_color and resize_linear_nd (no Rust equivalents)
dither.py apply_floyd_steinberg_dither/apply_bayer_dither/apply_minimum_run_length removed, imported from raygeo.image. surface_to_dithered_array uses raygeo.image.rgba_to_grayscale + Rust dither
__init__.py compute_auto_levels/normalize_grayscale re-exported from raygeo.image
raster_widget.py Imports compute_auto_levels from raygeo.image directly
Tests Updated imports, fixed dtype (float32uint8), adjusted rounding expectations

Not included (compared to #278)

knipknap added 2 commits June 8, 2026 21:41
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
knipknap force-pushed the feat/delegate-image-to-raygeo branch from ef624eb to 2280133 Compare June 8, 2026 19:49
@knipknap
knipknap merged commit e76d3d2 into main Jun 8, 2026
23 of 29 checks passed
@knipknap
knipknap deleted the feat/delegate-image-to-raygeo branch June 12, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant