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

Basic image #261

Merged
merged 3 commits into from Jan 15, 2020
Merged

Basic image #261

merged 3 commits into from Jan 15, 2020

Conversation

@donadigo
Copy link
Contributor

donadigo commented Jan 14, 2020

Summary / How this PR fixes the problem?

This branch adds a barebones image support to Akira. At the moment you can:

  • change size/position/rotation of the image
  • change it's opacity

This PR is open also to discuss the workflow regarding importing images. Currently this PR just opens a FileChooser dialog that lets you open multiple images at once however there are of course other ways to do this.

Screenshots

akira-image

Changes in this PR

  • IMAGE is now a new CanvasItemType but it's not an InsertType, that is because adding an image doesn't involve changing the cursor and drawing on the canvas, adding the item is separately done in ActionManager(?)

  • A new method insert_item_default in Canvas was introduced to enable other components to insert items totally on their own

  • A new interface called ImageProvider was introduced to allow implementing new image sources in the future and as a general class to be passed into things that want an image

  • Since images are things that take time to load, initially the item will have width and height of 1. A new signal was added item_bound_changed to signal the selected bounds manager that the bounding box of an item changed and it should update it's selection too

Known Issues / Things To Do

  • The bigger the image the slower the operations become on it. This is unfortunately a limitation of the implementation of Goo.CanvasImage and Cairo in general. The image is drawn by a CPU so it takes a lot of time.

  • Placing the image in the current viewport. Currently the image is just placed to a constant x and y of CANVAS_SIZE/2

  • Handle errors reading the chosen files. Probably throw a dialog here or something else. May need some new classes for general error reporting.

donadigo added 3 commits Jan 12, 2020
Copy link
Member

Alecaddd left a comment

Awesome! This is super cool and a great addition for the alpha release.
There are some minor changes and a couple of comments to address before I can merge it.
Thanks.

src/Lib/Models/CanvasImage.vala Show resolved Hide resolved
src/Lib/Canvas.vala Show resolved Hide resolved
src/Lib/Canvas.vala Show resolved Hide resolved
src/Lib/Canvas.vala Show resolved Hide resolved
Copy link
Member

Alecaddd left a comment

@donadigo let me know if you can do those edits, otherwise I can take care of them and merge.

src/Services/ActionManager.vala Show resolved Hide resolved
@Alecaddd Alecaddd merged commit 41fd7f8 into akiraux:master Jan 15, 2020
0 of 2 checks passed
0 of 2 checks passed
build build
Details
lint lint
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.