ladybird/Userland/Applications/PixelPaint
Mustafa Quraish 1d47d41c01 PixelPaint: Fix Line/Rectangle second paint alignment with pixels
The problem was a bit more complex than originally anticipated,
and the root of the problem is that the "coordinates" of a pixel
are actually the top left of the pixel, and when we're really
zoomed in, the difference in editor coordinates of the top-left
and the center of the pixel is significant.

So, we need to offset the "start" point when we are painting on
the editor to account for this, based on the current scale. This
patch adds a `editor_stroke_position` in `Tool` which can be used
to compute what point (in editor coords) we should use for a given
pixel and it's corresponding stroke thickness.

Note that this doesn't really work well with the ellipse, since that
is drawn with a different mechanism. Using this new method with the
`EllipseTool` seems to give the same (or slightly worse) results, so
I have not changed anything there for now.
2021-09-13 13:43:53 +02:00
..
BrushTool.cpp PixelPaint: Reoriganize drawing in BrushTool to allow more code reuse 2021-09-09 11:35:50 +02:00
BrushTool.h PixelPaint: Reoriganize drawing in BrushTool to allow more code reuse 2021-09-09 11:35:50 +02:00
BucketTool.cpp PixelPaint: Fix BucketTool out of memory crashes 2021-09-09 11:27:48 +02:00
BucketTool.h PixelPaint: Make Layer passed to tools a pointer 2021-08-27 12:45:06 +02:00
CMakeLists.txt PixelPaint: Use LibConfig to allow custom pixel grid threshold 2021-09-12 00:17:04 +02:00
CreateNewImageDialog.cpp Userland+LibGUI: Add shorthand versions of the Margins constructor 2021-08-18 10:30:50 +02:00
CreateNewImageDialog.h PixelPaint: Convert to east-const style 2021-06-11 22:51:10 +02:00
CreateNewLayerDialog.cpp Userland+LibGUI: Add shorthand versions of the Margins constructor 2021-08-18 10:30:50 +02:00
CreateNewLayerDialog.h PixelPaint: Convert to east-const style 2021-06-11 22:51:10 +02:00
EditGuideDialog.cpp PixelPaint: Allow initial values for the EditGuideDialog 2021-09-01 13:46:44 +02:00
EditGuideDialog.gml PixelPaint: Rename CreateNewGuideDialog to EditGuideDialog 2021-09-01 13:46:44 +02:00
EditGuideDialog.h PixelPaint: Allow initial values for the EditGuideDialog 2021-09-01 13:46:44 +02:00
EllipseTool.cpp PixelPaint: Call Layer::did_modify_bitmap() after drawing Ellipse 2021-09-13 13:43:53 +02:00
EllipseTool.h PixelPaint: Use correct thickness in EllipseTool::on_second_paint() 2021-09-07 16:53:40 +02:00
EraseTool.cpp PixelPaint: Add "Brush Mode" to EraseTool :^) 2021-09-09 11:35:50 +02:00
EraseTool.h PixelPaint: Add "Brush Mode" to EraseTool :^) 2021-09-09 11:35:50 +02:00
FilterParams.h PixelPaint: Add invert filter 2021-09-04 03:35:17 +02:00
Guide.h AK: Rename create<T> => make_ref_counted<T> 2021-09-03 02:36:09 +02:00
GuideTool.cpp PixelPaint: Make tools use the new API for property change shortcuts 2021-09-04 03:33:44 +02:00
GuideTool.h PixelPaint: Make Layer passed to tools a pointer 2021-08-27 12:45:06 +02:00
Image.cpp PixelPaint: Let PickerTool optionally sample all layers 2021-09-12 17:48:14 +02:00
Image.h PixelPaint: Let PickerTool optionally sample all layers 2021-09-12 17:48:14 +02:00
ImageEditor.cpp PixelPaint: Use config to get default values for Guides/Rulers/PixelGrid 2021-09-12 17:15:30 +02:00
ImageEditor.h PixelPaint: Add setter/getter for ImageEditor::m_pan_origin 2021-09-12 17:14:57 +02:00
Layer.cpp LibGfx: Use "try_" prefix for static factory functions 2021-07-21 18:02:15 +02:00
Layer.h PixelPaint: Allow partial invalidation of Layer and Image 2021-07-07 13:01:20 +02:00
LayerListWidget.cpp PixelPaint: Draw layers from the top of LayerList 2021-09-13 13:43:53 +02:00
LayerListWidget.h PixelPaint: Draw layers from the top of LayerList 2021-09-13 13:43:53 +02:00
LayerPropertiesWidget.cpp Userland+LibGUI: Add shorthand versions of the Margins constructor 2021-08-18 10:30:50 +02:00
LayerPropertiesWidget.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
LineTool.cpp PixelPaint: Fix Line/Rectangle second paint alignment with pixels 2021-09-13 13:43:53 +02:00
LineTool.h PixelPaint: Allowing drawing line from center, like other shapes 2021-09-13 13:43:53 +02:00
main.cpp PixelPaint: Use FileSystemAccessServer exclusively, remove unveil 2021-09-12 00:17:04 +02:00
MainWidget.cpp PixelPaint: Adjust menu ampersand shortcut characters 2021-09-13 13:43:53 +02:00
MainWidget.h PixelPaint: Remove unused methods to access files directly 2021-09-12 00:17:04 +02:00
Mask.cpp PixelPaint: Add a Mask class 2021-06-22 11:00:00 +02:00
Mask.h PixelPaint: Add a Mask class 2021-06-22 11:00:00 +02:00
MoveTool.cpp PixelPaint: Allow panning when right-clicking with MoveTool 2021-09-12 17:14:57 +02:00
MoveTool.h PixelPaint: Allow panning when right-clicking with MoveTool 2021-09-12 17:14:57 +02:00
PaletteWidget.cpp PixelPaint: Ctrl+click on palette colors now sets primary/secondary 2021-09-02 09:09:12 +02:00
PaletteWidget.h PixelPaint: Allow changing colors temporarily without palette 2021-09-02 09:09:12 +02:00
PenTool.cpp PixelPaint: Make PenTool inherit from BrushTool 2021-09-09 11:35:50 +02:00
PenTool.h PixelPaint: Make PenTool inherit from BrushTool 2021-09-09 11:35:50 +02:00
PickerTool.cpp PixelPaint: Let PickerTool optionally sample all layers 2021-09-12 17:48:14 +02:00
PickerTool.h PixelPaint: Let PickerTool optionally sample all layers 2021-09-12 17:48:14 +02:00
PixelPaintWindow.gml Userland+LibGUI: Add shorthand versions of the Margins constructor 2021-08-18 10:30:50 +02:00
ProjectLoader.cpp PixelPaint: Remove unused methods to access files directly 2021-09-12 00:17:04 +02:00
ProjectLoader.h PixelPaint: Remove unused methods to access files directly 2021-09-12 00:17:04 +02:00
RectangleSelectTool.cpp PixelPaint: Make tools use the new API for property change shortcuts 2021-09-04 03:33:44 +02:00
RectangleSelectTool.h PixelPaint: Make Layer passed to tools a pointer 2021-08-27 12:45:06 +02:00
RectangleTool.cpp PixelPaint: Fix Line/Rectangle second paint alignment with pixels 2021-09-13 13:43:53 +02:00
RectangleTool.h PixelPaint: Use correct thickness in RectangleTool::on_second_paint() 2021-09-07 16:53:40 +02:00
Selection.cpp PixelPaint: Revert update rect tightening for Selection 2021-08-14 12:45:48 +02:00
Selection.h PixelPaint: Expose more complex selection operations 2021-06-22 11:00:00 +02:00
SprayTool.cpp PixelPaint: Make tools use the new API for property change shortcuts 2021-09-04 03:33:44 +02:00
SprayTool.h PixelPaint: Make Layer passed to tools a pointer 2021-08-27 12:45:06 +02:00
Tool.cpp PixelPaint: Fix Line/Rectangle second paint alignment with pixels 2021-09-13 13:43:53 +02:00
Tool.h PixelPaint: Fix Line/Rectangle second paint alignment with pixels 2021-09-13 13:43:53 +02:00
ToolboxWidget.cpp PixelPaint: Have ToolboxWidget keep track of active tool 2021-09-13 13:43:53 +02:00
ToolboxWidget.h PixelPaint: Have ToolboxWidget keep track of active tool 2021-09-13 13:43:53 +02:00
ToolPropertiesWidget.cpp Userland+LibGUI: Add shorthand versions of the Margins constructor 2021-08-18 10:30:50 +02:00
ToolPropertiesWidget.h PixelPaint: Use a StackWidget in ToolPropertiesWidget 2021-08-06 23:59:14 +02:00
ZoomTool.cpp PixelPaint: Make tools use the new API for property change shortcuts 2021-09-04 03:33:44 +02:00
ZoomTool.h PixelPaint: Use Zoom and Eyedropper cursors 2021-09-04 03:35:23 +02:00