Commit Graph

400 Commits

Author SHA1 Message Date
Sam Atkins
84b98da259 Userland: Set tab-widget properties in GML instead of code 2022-05-11 20:16:43 +02:00
MacDue
89445b967d PixelPaint: Add antialiased ellipse option
Currently this option is only supported for filled ellipses as that
is all the AntiAliasingPainter supports.
2022-05-07 22:59:02 +02:00
MacDue
60aba4c9f3 LibGfx: Implement AntiAliasingPainter::draw_ellipse()
This commit adds draw_ellipse() and moves the shared code
for circles and ellipses to draw_ellipse_part().

draw_ellipse_part() can draw an entire circle in one call using
8-way symmetry and an ellipse in two calls using 4-way symmetry.
2022-05-07 22:59:02 +02:00
cflip
e02579bdab PixelPaint: Set title of default image to 'Untitled' 2022-05-02 12:43:46 +02:00
Torstennator
b7e8f32323 PixelPaint: Add a histogram widget
This adds a simple histogram widget that visualizes the rgb-channels
and brightness for a given image. When hovering over the image it will
indicate what brightness level the pixel at the mouse position has.
2022-04-21 17:26:52 +02:00
Sam Atkins
73552c1856 Userland: Always construct Application with try_create() 2022-04-18 12:57:34 +02:00
Olivier De Canniere
be4913c1fb PixelPaint: Add exporting to the QOI image format 2022-04-13 15:21:27 +01:00
Simon Wanner
206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Andreas Kling
3ab7388754 PixelPaint: Draw layer thumbnails with bilinear filtering
This makes them look a little nicer than basic nearest-neighbor.
2022-03-31 18:25:06 +02:00
circl
eeeaf410fb WindowServer+LibGUI: Expose raw scroll wheel values to applications
This is useful, for instance, in games in which you can switch held
items using the scroll wheel. In order to implement this, they
previously would have to either add a hard-coded division by 4, or look
up your mouse settings to adjust correctly.

This commit adds an MouseEvent.wheel_raw_delta_x() and
MouseEvent.wheel_raw_delta_y().
2022-03-27 01:11:27 +01:00
GeekFiftyFive
ff8a6d8e59 PixelPaint: Call set_modified on window
Call set_modified on window in order to reflect unsaved
changed in the titlebar's close button
2022-03-24 03:03:50 +01:00
Jelle Raaijmakers
b8a53e4a17 Applications: Round layer rect before drawing outline in PixelPaint
This fixes differences in drawing the layer and image outlines.
2022-03-23 11:53:34 +01:00
Jelle Raaijmakers
d195972ec2 Applications: Do not crash if decoded bitmap is null
ImageViewer and PixelPaint would crash when the ImageDecoderClient
returns a frame without a bitmap. This can happen with `.ico` files
with an unsupported BPP, for example.
2022-03-22 12:14:09 +01:00
Karol Kosek
677e4845a7 PixelPaint: Add Cut action
It's just the Copy action with erasing selection at the end.
2022-03-19 00:50:59 +01:00
Karol Kosek
580c6080b5 PixelPaint: Put undo/redo actions on top of the Edit menu
To be consistent with the order with other apps on the system. :^)
2022-03-19 00:50:59 +01:00
Tobias Christiansen
be58e5c35b PixelPaint: Expand FastBoxBlur settings to allow vector input
This expands the previously added settings for the asymmetric radii of
th FastBoxBlurFilter to allow the user to specify an angle and the
desired magnitude of blur.
The given values are then calculated forward to corresponding x and y
blur radii.
2022-03-17 20:03:05 +01:00
Tobias Christiansen
ffcc11c31b PixelPaint: Add asymmetric parameters to FastBoxBlur
This allows the user to blur the image not uniformly, but to specify
different radii for the x and y component.
2022-03-17 20:03:05 +01:00
Tobias Christiansen
e8be8f7b6d PixelPaint: Add Timer for displaying previews of filters
This way the preview image is not generated on _every_ update_preview()
call but rather only if the last update_preview() was longer than 100ms
ago.
When rapidly moving the Slider for large blur values in the
FastBoxBlurFilter with the Gaussian approximation the usage became
noticeably sliggush because we queued a lot of preview generation just
to throw it away immediately. This patch fixes that.
2022-03-16 21:45:31 +01:00
Andrew Smith
297e095755 PixelPaint: Correctly apply flip/rotate/crop to layers' alpha mask
-Layer now has methods for flip/rotate/crop, which are responsible
for handling the alpha mask.
-Fixed crash when the display image size is out of sync with
the content image size.
-Changed API for setting content and mask image in Layer. Now, both
must be set at the same time, and it can result in an error if
you provide mismatched dimensions.
2022-03-13 10:34:38 +01:00
Tobias Christiansen
51be2283f5 PixelPaint: Support saving/loading masks to project file 2022-03-09 17:15:17 +01:00
Tobias Christiansen
0dd5f5672c PixelPaint: Rename typo'ed BMPWriter in serialize_as_json() 2022-03-09 17:15:17 +01:00
Tobias Christiansen
937785f6c1 PixelPaint: Fix saving project
Some json objects didn't get finished, so it crashed.
2022-03-09 17:15:17 +01:00
Tobias Christiansen
ebbf977be5 PixelPaint: Draw a colored border around the appropriate thumbnail
According to the edited Bitmap of a Layer, give visual feedback by
drawing a fancy border around the Bitmap in question.
2022-03-08 22:07:12 +01:00
Tobias Christiansen
8b0bd665ec PixelPaint: Add "Add Mask" to Layer context menu 2022-03-08 22:07:12 +01:00
Tobias Christiansen
4b1c31bb36 PixelPaint: Change EditMode of Layer when double clicking on thumbnail 2022-03-08 22:07:12 +01:00
Tobias Christiansen
57772f9708 PixelPaint: Add a mask thumbnail to the LayerListWidget 2022-03-08 22:07:12 +01:00
Tobias Christiansen
f972f8e7a8 PixelPaint: Use the currently_edited_bitmap in the Tools
This way, you can actually edit the mask of a Layer!
2022-03-08 22:07:12 +01:00
Tobias Christiansen
96829565d8 PixelPaint: Keep track of and expose the type of the edited bitmap
This can be either the content bitmap or the mask bitmap.
2022-03-08 22:07:12 +01:00
Tobias Christiansen
a180b5f442 PixelPaint: Respect Mask when generating the display bitmap 2022-03-08 22:07:12 +01:00
Tobias Christiansen
82bfdec790 PixelPaint: Add mask Bitmap to Layer and expose it 2022-03-08 22:07:12 +01:00
Tobias Christiansen
31a9196bfe PixelPaint: Split bitmap() of Layer into {content, display}_bitmap
This is in preparation to support masking of Layers. We now distinguish
between the "display_bitmap" which will be the whole Layer with every
effect applied and the "content_bitmap" which contains the actual
unmodified pixels in the Layer.
2022-03-08 22:07:12 +01:00
Idan Horowitz
feb00b7105 Everywhere: Make JSON serialization fallible
This allows us to eliminate a major source of infallible allocation in
the Kernel, as well as lay down the groundwork for OOM fallibility in
userland.
2022-02-27 20:37:57 +01:00
electrikmilk
97ce19bc68 Base+PixelPaint: Use Merge Active Layer Up/Down Icons
The icons for these actions were added in a previous commit but never
used, now they are.
2022-02-15 10:40:49 +01:00
electrikmilk
7e5b3ce26b PixelPaint: Implement Merge Active Layer Up
Implements 'Merge Active Layer Up' and adds it to the 'Layer' menu.
2022-02-15 10:40:49 +01:00
Lenny Maiorani
160bda7228 Applications: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-02-14 22:06:55 +00:00
Mustafa Quraish
c3e4123ed7 PixelPaint: Change menu shortcut for "Fit Image to View"
This makes it consistent with `ImageViewer`, where `F` was unavailable
for use as a shortcut. A small change, but it's nice having the same
keyboard shortcuts where we can :^)
2022-02-14 11:49:21 +01:00
Mustafa Quraish
5c763e9832 LibGUI+PixelPaint: Move fit_image_to_view to AbstractZoomPanWidget
We often want to zoom and fit the content of the widget into the
visible frame (or some rect within the frame), and it makes sense to
move this functionality into the AbstractZoomPanWidget to minimize
the amount of coordinate math derived classes need to do.

This commit moves the code that implements this functionality from
`PixelPaint::ImageEditor` into `AbstractZoomPanWidget` so that we
can also use it for other applications (such as ImageViewer!)
2022-02-14 11:49:21 +01:00
electrikmilk
8c32b42bdf Base+PixelPaint: Add more icons 2022-02-13 10:18:37 +01:00
Idan Horowitz
c8ab45e79f Userland: Run gml-format
This brings the existing GML files up to spec with the new requirements
2022-02-13 02:36:35 +02:00
Andreas Kling
3c108e20a7 PixelPaint: Run gml-format on FilterGallery.gml 2022-02-12 22:30:50 +01:00
snooze
e9d3f3793c PixelPaint: Add a preview in FilterGallery
Now FilterGallery shows the preview of the currently selected filter
applied on the currently active layer
2022-02-12 12:21:35 +01:00
electrikmilk
dece108f9a PixelPaint: Implement IconBag to organize icons
Implement IconBag method of organizing menubar icons from Browser.
2022-02-12 11:24:00 +01:00
Vitaly Dyachkov
32b8795091 LibConfig: Rename pledge_domains(String) => pledge_domain(String)
pledge_domains() that takes only one String argument was specifically
added as a shortcut for pledging a single domain. So, it makes sense to
use singular here.
2022-02-11 18:06:39 +01:00
kleines Filmröllchen
6ee597369d Meta+Userland: Run the GML formatter on CI and pre-commit
Now that the GML formatter is both perserving comments and also mostly
agrees to the existing GML style, it can be used to auto-format all the
GML files in the system. This commit does not only contain the scripts
for running the formatting on CI and the pre-commit hook, but also
initially formats all the existing GML files so that the hook is
successfull.
2022-02-07 18:39:50 +01:00
Hendiadyoin1
3e135f347f Userland: Use AK::pow<I> where applicable 2022-02-06 17:52:33 +00:00
Matthias-Sleurink
032ffbcf64 PixelPaint: Don't overwrite images with project file on save
The ImageEditor tracks whether it was loaded from an image
(the alternative being a project file.) If it was loaded from an image
file we redirect save project actions to save as instead.
2022-02-06 07:22:57 +00:00
Jagger De Leo
d5183cb7ac PixelPaint: Use Escape to clear rectangular selections
Now while dragging a new rectangular selection you can cancel it by
hitting Escape. Existing selections are cleared by Escape as well if the
RectangularSelectTool is active.
2022-02-04 16:11:48 +01:00
Jagger De Leo
a96b15d2bc PixelPaint: Remove conflicting action hotkey
The new CommandPalette feature conflicts with PixelPaint's Clear
Selection action keyboard shortcut (Ctrl + Shift + A).

Fixes: #12222
2022-02-04 16:11:48 +01:00
Andreas Kling
a599f68cfe PixelPaint: Paint layer thumbnails with correct aspect ratio 2022-02-01 10:49:13 +01:00