Add in-memory stroke transport#67
Open
codexbountylab wants to merge 3 commits into
Open
Conversation
Author
|
@artreadcode Updated the PR with the follow-up fixes. Main changes:
I tested the in-memory flow again, including reopening the project and checking Stroke Manager previews, and the previously failing Collage case now completes successfully. |
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
This PR addresses #47 by replacing the per-stroke PNG file transport with an in-memory Java/Python effect pipeline.
Previously, each stroke wrote image files such as
_input.pngand_output.pngto disk. With large images and repeated strokes, that can quickly make a project directory grow. This change keeps new stroke inputs and processed results in memory during the active session instead.Java now sends the current canvas image to Python through stdin as PNG bytes using a small length-prefixed binary protocol. Python decodes the image in memory, runs the selected effect, and returns the processed PNG bytes through stdout. Logs and debug output stay on stderr, so they do not interfere with the binary response.
I also added
docs/in-memory-stroke-transport.mdwith the technical workflow.Workflow
flowchart LR A["Java canvas PImage"] --> B["Encode PNG bytes in memory"] B --> C["stdin: JSON instructions + PNG bytes"] C --> D["Python apply_effect.py --stdio"] D --> E["Run brush/effect in memory"] E --> F["stdout: response JSON + result PNG bytes"] F --> G["Java decodes result into PImage"] G --> H["Apply result to canvas"]Changes
apply_effect.py --stdio.Validation
apply_effect.pyhas no Python syntax errors.AI disclosure
I used AI assistance while developing this PR. I reviewed the generated changes and validation results before submitting.