Skip to content

feat: plane() and planes() take copy=True for an independent, C-contiguous result - #310

Merged
petercorke merged 3 commits into
mainfrom
feat/plane-copy
Nov 26, 2026
Merged

petercorke merged 3 commits into
mainfrom
feat/plane-copy

Conversation

@petercorke

Copy link
Copy Markdown
Owner

plane() and planes() get a copy option. copy=True gives an independent, C-contiguous image, so the result can be drawn into (the draw_* methods refuse non-contiguous images, see PR 162) and changing it does not change the original. This works for a single plane, several planes, a name string and a list, and keeps the colororder.

The default is copy=False, which changes nothing: a single plane is still a view that shares its pixels with the image.

Six new tests in tests/test_image_core.py. The full suite passes (2414 passed, 17 skipped) and mypy is clean.

This branch is stacked on docs/image-indexing (its base here), because it updates the same docstrings. When that PR merges I will rebase this one onto main.

An AI assistant (Claude Code) wrote this change.

🤖 Generated with Claude Code

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 15 complexity · 0 duplication

Metric Results
Complexity 15
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Base automatically changed from docs/image-indexing to main November 26, 2026 00:08
petercorke and others added 2 commits November 26, 2026 10:12
…guous result

The default is unchanged: a single plane is a view that shares its pixels
with the image.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@petercorke
petercorke merged commit 79ec26c into main Nov 26, 2026
33 of 34 checks passed
@petercorke
petercorke deleted the feat/plane-copy branch November 26, 2026 01:23
@github-actions github-actions Bot mentioned this pull request Nov 26, 2026
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