Pascal Puffke
bec7ffaf0a
PixelPaint: Port to LibMain
2021-11-22 23:56:22 +01:00
Ben Wiederhake
afc456edd6
PixelPaint: Use better-fitting image size
...
This makes the default image fit perfectly into the default viewport,
which means the first fit_image_to_view call will end up with a scale of
exactly 1. This scale level has no visual artifacts, which is the more
intuitive 'default' behavior.
Fixes #10975 .
2021-11-22 22:14:53 +01:00
Ben Wiederhake
177478dadf
PixelPaint: Add interactive zoom ComboBox to toolbar
...
Before, there was nothing that tells the user the current zoom level,
which is unknown after a 'fit to image' (the initial state).
2021-11-22 22:14:53 +01:00
Ben Wiederhake
9013d0fe38
PixelPaint: Add ability to fit to either width, height, or image
2021-11-22 22:14:53 +01:00
Ben Wiederhake
be697a440f
PixelPaint: Allow setting ImageEditor scale and listening for changes
2021-11-22 22:14:53 +01:00
Ben Wiederhake
7f962cd9d3
PixelPaint: Floor effective viewport size to whole integers
...
We don't have fractional pixels available, so don't attempt to use them.
2021-11-22 22:14:53 +01:00
Ben Wiederhake
f22c0ffe0c
LibGUI+Everywhere: Make sync requests to Clipboard server more obvious
2021-11-21 11:49:06 +00:00
Ben Wiederhake
b6419f2cf2
LibGUI: Make clipboard-as-bitmap parsing less data-race-y
...
This encourages the caller to first fetch data and type atomically, and
then parse that, instead of potentially making multiple requests.
2021-11-21 11:49:06 +00:00
Andreas Kling
4bd4ce439a
PixelPaint: Allow toggling the active layer boundary display rect
...
Let the user opt out of painting a rectangle around the currently
active layer.
2021-11-20 00:25:24 +01:00
Andreas Kling
587f9af960
AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)
...
Also add slightly richer parse errors now that we can include a string
literal with returned errors.
This will allow us to use TRY() when working with JSON data.
2021-11-17 00:21:10 +01:00
Andreas Kling
8b1108e485
Everywhere: Pass AK::StringView by value
2021-11-11 01:27:46 +01:00
Andreas Kling
801d46d02c
PixelPaint: Use ErrorOr<T> for Image and Layer creation helpers
2021-11-08 00:35:27 +01:00
Andreas Kling
9268ed9605
PixelPaint: Use ErrorOr<T> for Image::try_compose_bitmap()
2021-11-08 00:35:27 +01:00
Andreas Kling
77fd4625b5
PixelPaint: Use ErrorOr<T> for Image writing/exporting functions
2021-11-08 00:35:27 +01:00
Andreas Kling
a7f1f1c34b
LibCore: Use ErrorOr<T> for Core::File::open()
2021-11-08 00:35:27 +01:00
Andreas Kling
0f5477c721
AK: Use ErrorOr<T> for MappedFile factories
...
Replace Result<T, E> with ErrorOr<T> and propagate the error to callers.
2021-11-08 00:35:27 +01:00
Andreas Kling
0de33b3d6c
LibGfx: Use ErrorOr<T> for Bitmap::try_create()
...
Another one that was used in a fajillion places.
2021-11-08 00:35:27 +01:00
Andreas Kling
235f39e449
LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
...
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
Andreas Kling
8262bbf624
LibGfx: Use ErrorOr<T> for Bitmap::cropped()
2021-11-08 00:35:27 +01:00
Andreas Kling
db90b4554e
LibGfx: Use ErrorOr<T> for Bitmap::flipped()
2021-11-08 00:35:27 +01:00
Andreas Kling
69c4614a94
LibGfx: Use ErrorOr<T> for Bitmap::rotated()
2021-11-08 00:35:27 +01:00
Andreas Kling
2da4cfcc80
LibGfx: Use ErrorOr<T> for Bitmap::clone()
2021-11-08 00:35:27 +01:00
FrHun
54605794f9
Applications: Remove border from GroupBox margins
2021-11-03 16:13:19 +01:00
Ben Wiederhake
465af4c4d4
Applications: Fix visibility of Object-derivative constructors
...
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
Musab Kılıç
4de7b3ad24
PixelPaint: Map color_distance_squared from 0 to 1
2021-11-02 12:20:48 +01:00
Marco Cutecchia
81b260bd1c
PixelPaint: Use a bucket cursor for the Bucket tool
2021-10-31 12:37:49 +01:00
Marco Cutecchia
0f24678eaf
PixelPaint: Support using a bitmap as a tool's cursor
2021-10-31 12:37:49 +01:00
Filiph Sandström
d6a0726302
Everywhere: Rename left/right-click to primary/secondary
...
This resolves #10641 .
2021-10-27 22:05:58 +03:00
Idan Horowitz
b41954182a
PixelPaint: Move Mask::{get, set, to_index} to the header file
...
They were previously taking up 9% of samples in a profile of PixelPaint
while selecting a mask, and as a result of moving them to the header
they were inlined, which effectively eliminated them from the profile.
2021-10-24 17:02:44 +02:00
Ben Wiederhake
cb868cfa41
AK+Everywhere: Make Base64 decoding fallible
2021-10-23 19:16:40 +01:00
Felix Rauch
183a2ec8bd
PixelPaint: Create an empty layer when the last layer is removed
...
Previously, when the last layer got deleted, the active layer was
set to nullptr, causing a crash.
Now, we create a new transparent background layer with the image
dimensions instead.
2021-10-16 18:10:11 +01:00
Alex Major
d4a0ecac31
PixelPaint: Close tab now prompts for a save
2021-10-07 18:35:56 +02:00
Luke Wilde
eb774aadbf
PixelPaint: Use reorderable tabs
2021-10-07 17:04:12 +02:00
Marco Cutecchia
80e70f95ab
PixelPaint: Fix first undo action not working
2021-10-05 15:41:21 +02:00
Marco Cutecchia
c7431da3f2
PixelPaint: Ensure a layer is selected when restoring a snapshot
...
Previously when restoring the starting snapshot in the UndoStack we
would end up with no layer selected, which was kinda annoying
2021-10-05 15:41:21 +02:00
Gal Horowitz
cd7473d1a3
PixelPaint: Correctly offset stroke position for even thicknesses
2021-10-02 20:54:32 +02:00
Gal Horowitz
be4485fe85
PixelPaint: LayerListWidget::set_selected_layer now handles nullptr
2021-10-02 20:54:12 +02:00
Marcus Nilsson
1026819135
PixelPaint: Add new icons for layer actions
...
Add icons for three more layer actions.
2021-09-29 20:04:20 +02:00
Karol Kosek
5a5f6d11ef
PixelPaint: Close image tabs on middle click
2021-09-25 23:34:02 +02:00
Karol Kosek
df195188bc
PixelPaint: Close New Image dialog after pressing return key
...
13e526de43
added the feature to new Layer
dialog. This patch adds it to Image dialog to stay consistent across
the app. :^)
2021-09-25 23:34:02 +02:00
Marcus Nilsson
f9e0815c3b
PixelPaint: Move Tools to it's own subdirectory
...
The PixelPaint source directory was getting a bit large, let's move all
the Tools to it's own subdirectory. Also remove some unused includes.
2021-09-20 03:04:24 +00:00
Karol Kosek
65a5d66387
PixelPaint: Use main window's icon in the 'Create new image' widget
2021-09-19 20:05:58 +02:00
Mustafa Quraish
090962823b
PixelPaint: Allow selecting a custom aspect ratio for RectangleTool
...
If you enter a custom aspect ratio, and are not holding down shift,
the rectangle will be constrained to the entered aspect ratio
2021-09-17 11:54:13 +02:00
Mustafa Quraish
6ba3fc559f
PixelPaint: Allow selecting a custom aspect ratio for EllipseTool
...
If you enter a custom aspect ratio, and are not holding down shift,
the bounding rect for the ellipse will be constrained to the entered
aspect ratio
2021-09-17 11:54:13 +02:00
Mustafa Quraish
f14c891ba5
LibGfx+PixelPaint: Add Point::end_point_for_aspect_ratio
method
...
Previously we only had `Point::end_point_for_square_aspect_ratio`,
which was convenient for PixelPaint but assumed the aspect ratio
was always fixed at 1. This patch replaces it with a new mthod that
takes in an arbitrary aspect ratio and computes the end point based
off that.
There's some explicit casting going on in `Point.cpp` to ensure that
the types line up, since we're templating Point based on `T`.`
2021-09-17 11:54:13 +02:00
Marcus Nilsson
dc9b18da22
PixelPaint: Implement automatic scrolling in LayerListWidget
...
The previous implementation of automatic scrolling in LayerListWidget
relied on mousemove events to perform the scrolling, which didn't
produce the expected behavior. Instead use the new auto scroll timer.
2021-09-16 22:29:21 +02:00
Marcus Nilsson
9fe43041f5
PixelPaint: Tweak layer/tool properties widget heights
...
There's no use for these two to be larger than necessary when
resizing the window.
2021-09-16 16:54:34 +02:00
Marcus Nilsson
b76fe6357a
PixelPaint: Don't select the same layer twice in LayerListWidget
...
Without this check we would do an unnecessary partial second round
trip because of the call chain:
LayerListWidget::set_selected_layer() ->
LayerListWidget::on_layer_select() ->
ImageEditor::set_active_layer() ->
ImageEditor::on_active_layer_change() ->
LayerListWidget::set_selected_layer()
2021-09-16 16:54:34 +02:00
Marcus Nilsson
eaa99968fb
PixelPaint: Don't update ImageEditor in set_active_layer()
...
Setting the active layer does not cause anything to render differently.
Thus no update is needed and the call to layers_did_change() is
unnecessary.
2021-09-16 16:54:34 +02:00
Zyper
344397557c
PixelPaint: Add ability to draw squares and circles
...
Shift-key modifier for tools forces square aspect ratio.
It allows drawing squares with Rectangle Tool and circles
with Ellipse Tool.
2021-09-15 00:10:14 +00:00