Skip to content
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

Add image and clipboard paste support via GDClip #115

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hansemro
Copy link
Contributor

@hansemro hansemro commented Apr 21, 2022

This pull request introduces image support and partial clipboard support to resolve the main objective of #100. Image resizing or transform is not yet supported.

Notable changes:

  • Images are drawn as ImageStroke instances, which can check for visibility and work with existing tools with minimal changes.
  • Images are pasted using GDClip cross-platform GDNative library.
    • Tested on macOS (Big Sur), Windows, Linux with Godot 3.4.x.
    • macOS 10.9 and newer should be supported. Please report bugs if there are any.
  • All SelectionTool features work (including undo/redo actions)
    • Images are selected when intersecting selection rectangle. Let me know if you want the images to be selected only if enclosed entirely by selection rectangle.
    • Note: Images copied with SelectionTool do not save to clipboard.
  • New save format that includes images. This breaks compatibility with older versions lacking image support.
    • Images will be compressed to reduce file size and improve save/load performance.
  • Images are now embedded in the SVG export as base64-encoded PNGs.

Additional Tasks:

  • Update manual
  • Update README.md
  • Update CI to build with GDClip libraries
  • Disable image paste feature if gdclip library cannot be found

Pre-Release builds can be found here: https://github.com/hansemro/Lorien/releases

@hansemro
Copy link
Contributor Author

Sorry for the delay, but I finally got around to setup CI infrastructure for GDClip. Let me know if there is a change you want me to make.

@hansemro hansemro changed the title [Draft] Add image and clipboard paste support via GDClip Add image and clipboard paste support via GDClip May 19, 2022
@hansemro hansemro marked this pull request as ready for review May 19, 2022 02:13
lorien/gdclip.gdnlib Outdated Show resolved Hide resolved
@hansemro hansemro force-pushed the gdclip_final branch 3 times, most recently from 1585df4 to e5bb78d Compare May 25, 2022 00:17
@hansemro
Copy link
Contributor Author

hansemro commented Jun 7, 2022

I had forgotten to update interaction with (super) EraserTool on ImageStroke. Should be fixed now.

@MrApplejuice
Copy link
Contributor

Quick question: I read "SvgExporter" - is that to actually make it possible to copy-paste strokes from Lorien to, for example, Inkscape? That was a feature I was about to suggest after finishing my keybindings-PR. If it is already done, however, that changes stuff, and will make me super-duper happy, of course :-)

@hansemro
Copy link
Contributor Author

@MrApplejuice SVG export support is already in v0.5.0 and accessible from hamburger menu -> Export.

fad4ea9 just embeds images in the svg file.

@hansemro hansemro marked this pull request as draft June 23, 2022 10:00
@MrApplejuice
Copy link
Contributor

Ah thanks, for clarification! Maybe I will propose a copy-pasta in SVG format later then. I would find it super-handy to be able to easily exchange stuff among different types of vector-graphics editors. I find Lorien way more convenient for "quick doodles" but then sometimes the doodles outgrow Lorien and I need to go to something more advanced. The indirect way of Export is a bit cumerbsome for fast progress.

That said: Nice PR. Pasting images will make the sketching-process a lot easier again! :-)

This commit introduces image support via ImageStroke and image-paste
support via GDClip GDNative library. ImageStroke extends Sprite to track
visibility of images and to cooperate with SelectionTool.

All SelectionTool features are supported (including selection, movement,
copy, paste, duplication, and deletion), but note that SelectionTool
copy does not copy to clipboard.

Save/load feature supports images as well, but the new save format will
not be compatible with prior versions of Lorien without image support.
Note: Images are compressed to reduce file size and improve save/load
times.

SvgExporter will export images as base64-encoded PNGs
@hansemro
Copy link
Contributor Author

Latest changes include moving paste action to a new thread so that main thread is not blocked.

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.

None yet

2 participants