-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Background image for tracing #1707
base: main
Are you sure you want to change the base?
Conversation
Quick feedback:
|
@justvanrossum I tried a lot, but sadly without success, yet. The main issue I have, is: how can we display an image stored locally. It's not allowed to access files locally from an http request. Do you have an idea how to solve this issue? Thanks a lot in advance. |
I didn’t realize you’d work on that today. That approach cannot work, as you’ve found out. We need to serve images as part of the font data. |
I am not sure if this is something useful or not, but I figured out, that we can load an image via http://localhost:8000: The image is misplaced (it should actually be at the position of the rectangle), but it's there – yeah :) |
Correct position of the image: Screen.Recording.2024-10-11.at.18.25.16.mp4 |
The Image type should get an attribute named Loading of the image should be done outside of the vis draw func, although loading could perhaps be triggered by draw (but only if it's cheap), then we should trigger a canvas redraw once the image has been loaded. It is vitally important that the draw func does not do any loading itself. The effect will be that if you put a glyph in edit mode, there may be a delay before the background image appears. While it may be desirable to load images via regular http(s) instead of the websocket, this raises questions about how this data should then participate in undo and external changes. To do this correctly may add a lot of complexity that can perhaps be avoided if we allow image data to travel as base64 inside JSON messages. If we go that route, we may have to enforce a maximum image size. I have some ideas that I'm trying to formulate, about potentially avoiding base64 encoding the data, but I'm not there yet. Perhaps we can start with a simplistic approach, without worrying too much about efficiency. (I'm considering to make the infrastructure general for any binary data, not limited to image data.) ReadableFontBackend:
WritableFontBackend:
The The |
Playground draft PR for discussion.