Commit Graph

406 Commits

Author SHA1 Message Date
Andrew Smith
bccf0a9346 PixelPaint: Allow layer to "scale" location when resizing 2022-05-23 00:12:19 +02:00
Andrew Smith
02399d4775 PixelPaint: Add Image>Resize Image... dialog. (Front end) 2022-05-23 00:12:19 +02:00
MacDue
9b4aabbcf9 PixelPaint: Allow configuring 'new image' defaults
This allows you to configure the default name, width, and height of
the 'new image' dialog. This is done by editing the config in
~/.config/PixelPaint.ini (no GUI at the moment).

Fixes #13967
2022-05-17 01:01:44 +02:00
Linus Groh
ffc5fed79f PixelPaint: Rebuild FilterGallery tree using TreeViewModel 2022-05-13 16:31:03 +02:00
Sam Atkins
cdffe556c8 LibGUI+Userland: Make Dialog::ExecResult an enum class 2022-05-13 16:27:43 +02:00
Daniel Bertalan
f40b6fbd07 PixelPaint: Fix incorrect use of RefCounted CRTP
I'm not even sure why this worked. How would the compiler know which
type to destruct the FilterInfo object as?

Fixes this janky error from gcc 12:

AK/RefCounted.h:70:13: error: array subscript 0 is outside array bounds
of 'void [56]' [-Werror=array-bounds]
   70 |             delete static_cast<const T*>(this);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-12 13:12:37 +02:00
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