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
BucketTool.h
CMakeLists.txt PixelPaint: Use LibConfig to allow custom pixel grid threshold 2021-09-12 00:17:04 +02:00
CreateNewImageDialog.cpp
CreateNewImageDialog.h
CreateNewLayerDialog.cpp
CreateNewLayerDialog.h
EditGuideDialog.cpp
EditGuideDialog.gml
EditGuideDialog.h
EllipseTool.cpp PixelPaint: Call Layer::did_modify_bitmap() after drawing Ellipse 2021-09-13 13:43:53 +02:00
EllipseTool.h
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
Guide.h
GuideTool.cpp
GuideTool.h
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
Layer.h
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
LayerPropertiesWidget.h
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
Mask.h
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
PaletteWidget.h
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
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
RectangleSelectTool.h
RectangleTool.cpp PixelPaint: Fix Line/Rectangle second paint alignment with pixels 2021-09-13 13:43:53 +02:00
RectangleTool.h
Selection.cpp
Selection.h
SprayTool.cpp
SprayTool.h
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
ToolPropertiesWidget.h
ZoomTool.cpp
ZoomTool.h