9911 Commits

Author SHA1 Message Date
Christian Kaiser
d62d279a34
Fix extensions wrongly being detected as "built-in" (#4625) 2024-09-04 15:42:47 -03:00
Gaspar Capello
5798e27993 Fix mask color turns to opaque on RGBA->INDEXED conversion (fix #4438)
Original issue title: When using a background layer, switching to
Indexed Color Mode fills all layer bounding rectangles with
Color 0.
Conditions to reproduce the original issue:
- Opaque RGBA sprite, i.e. the bottom layer is 'Background'.
- There is a second layer with an ellipse (for example).
- There is a mask color #000000 alpha=0 is in the palette.
- The mask color index is greater and not equal than 0.
- Go to Sprite > Color Mode > Indexed.
Result: the transparent color of the second layer will change to
index color = 0 (usually black).

Also added test for RGBA->INDEXED conversion
2024-09-04 13:48:56 -03:00
Gaspar Capello
c8f018f2f1
Fix exporting a Sprite Sheet with Group name has different functionality between CLI and Scripting (fix #4456) (#4475)
Before this fix, the lua command:
app.command.ExportSpriteSheet
could not process a layer within a group when the layer name
was expressed using the layer hierarchy path, for example:
layer = "Group1/Layer1"
2024-09-03 20:20:36 -03:00
David Capello
9429d915ae [lua] Fix default color/bgColor params in app.useTool()
We can select the default color or tile from preferences depending if
we're going to paint pixels or tiles

Fixes a confusing logic from 4a91d150af97e70e588e82d698dc8c5e0db8e6fe
where the bg color was obtained from preferences only when the fg
color type (rgb/gray/index/hsv/tile/etc.) was equal to the bg color
type from the preferences (rgb/gray/index/hsv/tile/etc.).
2024-09-03 19:25:19 -03:00
David Capello
240d481645 Simplify app_get_color_to_clear_layer() in CLI-mode
Just use the background color without preprocessing the index color.
2024-09-03 19:24:02 -03:00
David Capello
afb8a3d94a [lua] Minor change app.pixelColor -> pc in test 2024-09-03 19:11:14 -03:00
Gaspar Capello
4a91d150af Fix transparent color is possible on opaque sprites (fix #4370)
To reproduce the error before this fix on RGBA/Grayscale Color Mode:
- New 100x100 RGBA/Grayscale opaque sprite (white background).
- Draw something with some gray color in the palette.
- Keep the selected gray color as primary color.
- Configure as secondary color the mask color (#000000 alpha=0).
- Pick 'eraser' tool and erase over the gray color with right click.
- Result: The sprite doesn't look more opaque, which is wrong. Also,
  if we export this sprite, the transparent parts will turn black.

A similar problem occurs in Indexed Color Mode, but getting a
transparent color in a Background sprite is inevitable if the color of
a palette entry is transparent or semi-transparent, since the index
must be set as is. This could be fixed in the future at the
render stage, however, this could lead to other perceived
inconsistencies. For now it'll be left as is.

Original issue description:
Downloaded PNG in RGB mode fails to support transparency: erase
uses secondary color and export PNG replaces transparent color
with black

Added tests for 'eraser' in 'Replace Color Mode'
To make the eraser work in 'Replace Color Mode' within the tests,
was implemented the possibility of using the right button in
the creation of the point vector.

During testing with UI available it was observed that the 'bg' color
was copied from the 'fg'. Changed this to be compatible with the way
the default value of 'fg' is assigned when it is not specified.
This last modification resulted in errors during 'tilemap.lua' due to
incompatibility of the type of 'bg' color. This was corrected
considering the color type of 'fg' color.
Furthermore, it was found that the command 'app.range.tiles = { 1 }'
did not finish assigning the tile picks to the activeSite,
then 'assert(1, #app.range.tiles)' was failing. This was fixed too.
2024-09-03 19:08:15 -03:00
David Capello
3d683ac6aa Minor layout change in Color Mode dialog (from vbox to grid) 2024-09-03 18:15:29 -03:00
Gaspar Capello
e1bd7990a3 Add color fit criteria for Color Mode conversion (fix #2787, #4416)
Added other color comparison criterias (fit criteria) during
color mode conversion RGBA to Indexed or Grayscale to Indexed.
The 'fit criteria' will help us to recolor an RGB image with
a limited color palette taking into account different color
perception criteria (color spaces: RGB, linearized RGB,
CIE XYZ, CIE LAB).
2024-09-03 13:17:09 -03:00
Gaspar Capello
3cc1c63274 Add different best fit criteria to compare colors for RgbMaps (fix #2787, #4416) 2024-09-03 13:17:06 -03:00
Gaspar Capello
e12233a19d Tests for new function make_aligned_mask 2024-09-03 11:44:25 -03:00
Gaspar Capello
68730c1c1b [lua] Add get/set 'tilemapMode' Site object 2024-09-03 11:44:25 -03:00
Gaspar Capello
95513af267 Fix multiple tileset layers selection move is broken (fix #3144)
Before this fix, a multi-layer mask movement/scaling (with mixed layer
types: normal layer and tilemap layers with different grids) caused
loss of drawing areas.

The heart of this solution is to correctly align the 'selection mask'
and 'transform data' according to the layer's grid, and also, forcing
'site' TilemapMode/TilesetMode before each
reproduceAllTransformationsWithInnerCmds() iteration.
During the life of a PixelMovement object there is a tilemap mode lock.

Additionally arrow keys now work to move a selected area in
TilemapMode::Tiles.
2024-09-03 11:44:25 -03:00
David Capello
a21f0888ad Merge branch 'main' into beta 2024-09-03 11:26:23 -03:00
David Capello
bf0a47545c Remove #if/endif ENABLE_UI conditional directives (fix #4619)
This was originated for #1279 (CLI-only Aseprite) which can be
achieved with LAF_BACKEND=none anyway.

In this way we simplify the development process, and checking for the
availability of the GUI can be done in run-time through App::isGui()
or Context::isUIAvailable().
2024-09-02 23:16:26 -03:00
David Capello
c4526cf709 Remove ENABLE_UI option (#4619)
Now we use the LAF_BACKEND=none/skia to detect if it's going to be the
CLI/GUI version of the program. The ENABLE_UI flag is still defined at
compile-time just to avoid removing all #ifdef/endif conditional
directives right now.
2024-09-02 18:17:23 -03:00
David Capello
fea3f5fcee Fix English strings considering some comments from Weblate
Comments:
https://hosted.weblate.org/translate/aseprite/aseprite/en/?checksum=10ed5b5794156584#comments
https://hosted.weblate.org/translate/aseprite/aseprite/en/?checksum=a866d26f91d1f329#comments
https://hosted.weblate.org/translate/aseprite/aseprite/en/?checksum=df163b02578e8c01#comments
https://hosted.weblate.org/translate/aseprite/aseprite/en/?checksum=b23f6bf0b6dcbce4#comments
https://hosted.weblate.org/translate/aseprite/aseprite/en/?checksum=1b58980af2aa6bd0#comments
2024-08-30 14:15:30 -03:00
Christian Kaiser
c554f07d28 Adjust strings for clarity/correctness 2024-08-30 13:42:57 -03:00
Martín Capello
75da9c6c51 Revert select_layer_boundaries behavior
select_layer_boundaries was affected by a change made to Mask::fromImage
where a hardcoded threshold was changed from 128 to 0. To make
select_layer_boundaries behave as before, I've added a new parameter to
Mask::fromImage to set the threshold and then use the same hardcoded
value it was using (128)
2024-08-29 15:25:46 -03:00
Martín Capello
55042f89ce Updated copyright date 2024-08-29 15:25:46 -03:00
Martín Capello
8e904761f1 Keep 9-slice borders fixed while scaling bounds
Scaling 9-slice bounds will keep the border size (determined by the
sub-slices surrounding the center sub-slice) fixed.
2024-08-29 15:25:46 -03:00
Martín Capello
d88c22386d Set default tilemap and tileset modes
When layers of different kinds (tilemap and image) are selected set the
default modes when the last selected layer is image type.
2024-08-29 15:25:37 -03:00
Martín Capello
e7f308bbfe Fix fromImage() to avoid missing pixels
Before this, pixels with an alpha < 128 were not taken into account to
build the mask. Now only pixels with alpha = 0 are not taken into
account.
2024-08-29 15:25:37 -03:00
Martín Capello
4f6b997101 Fix indentation and includes order 2024-08-29 15:25:37 -03:00
Martín Capello
777715a56f Avoid clearing slice from a layer with no cel 2024-08-29 15:25:37 -03:00
Martín Capello
0d5ecf3c02 Add some comments 2024-08-29 15:25:37 -03:00
Martín Capello
0c336d8f09 Avoid calculating selected layers when not needed 2024-08-29 15:25:37 -03:00
Martín Capello
23160a9fee Fix slice transform undo after making a cel empty 2024-08-29 15:25:37 -03:00
Martín Capello
2c58669909 Cleanup headers 2024-08-29 15:25:37 -03:00
Martín Capello
fb74feea21 Add 9-slice transformation support 2024-08-29 15:25:35 -03:00
Martín Capello
ca75a98679 Add support to TilemapMode::Tiles mode
When transforming slices in a tilemap layer while Tiles mode is active
2024-08-29 15:24:48 -03:00
Martín Capello
f5baba389b Replace StampInCel command by ExpandCelCanvas
This avoids duplicating logic and reuse an existent command
2024-08-29 15:24:48 -03:00
Martín Capello
7dc01bcdf7 Fix initial state of transform checkbox 2024-08-29 15:24:48 -03:00
Martín Capello
22a4344b14 Try specific logic to transform slices contents
Instead of trying to reuse the PixelsMovement class we create new
commands and logic to handle the slices content transformation
2024-08-29 15:24:48 -03:00
Martín Capello
159b5efa29 Add new_image_from_mask() function variant
This new variant returns an image from a specific layer's frame.
Also a copy_masked_zones() function was created to contain with the
common code for the new_image_from_mask variants
2024-08-29 15:24:48 -03:00
Martín Capello
66af5a7db1 Create Mask::fromImage method
Moved code from select_layer_boundaries to this new
Mask's method to create a mask from an image
2024-08-29 15:24:48 -03:00
Martín Capello
073a1d8794 Move code from StandByState to MovingSliceState 2024-08-29 15:24:48 -03:00
Martín Capello
80afafa45a Use std::move to avoid unnecessary copies 2024-08-29 15:24:48 -03:00
Martín Capello
ead2023cfd Add "Transform" checkbox to slices and introduce moving slice content 2024-08-29 15:24:48 -03:00
Gaspar Capello
8323a55500 Fix Cancel command do not work on scripting
Before this fix, the 'Cancel' command did not work in the following
specific situation:
As soon as Aseprite was started and without hitting the 'Esc' key,
the 'app.command.Cancel()' command did not perform any operation.

It was discovered that the Cancel command is started only once per
session and retains the 'm_type' throughout the session. Only
a specific:
app.command.Cancel {type = "all"} or
app.command.Cancel {type = "noop"}
could change the command type.
2024-08-29 10:50:03 -03:00
دانتي باولا
dd208ebe5d
Use right click action with shading ink (fix #4520) (#4615) 2024-08-29 10:45:52 -03:00
David Capello
f9d2f1ce46 Remove Graphics::measureUIText/Length() functions
With the introduction of Widget::processMnemonicFromText() in
17151cddcd25ab089f5d2ffcc9ec680ba6cd57bf we don't require these
functions anymore because the '&' character isn't not present in the
widget text (so we can just measure the text length as usual).

This was discovered in PR #4604:
https://github.com/aseprite/aseprite/pull/4604#discussion_r1731172284
2024-08-28 15:22:51 -03:00
David Capello
7941b5d971 Merge branch 'new-text-tool' into beta (fix #28) 2024-08-27 16:38:56 -03:00
David Capello
d3a55867c2 Resize text box when more space is needed (more text or bigger font) 2024-08-27 16:18:54 -03:00
David Capello
49afc0dd52 Add support to move the text box when we drag it from the edges 2024-08-27 16:18:50 -03:00
David Capello
241746d04b One click opens a new box to write text with a default size 2024-08-26 18:28:48 -03:00
David Capello
8fa4775def Persist the text selection when we change the font 2024-08-26 18:21:13 -03:00
David Capello
08de330123 Redraw text editor immediately after changing anti-alias option 2024-08-26 18:07:13 -03:00
David Capello
7558504733 Fix caret/highlight positions when we change the font 2024-08-26 18:07:13 -03:00
David Capello
5a877f49e4 Fix caret position in ui::Entry
We have to fill/use the X position of each char box instead of
calculating it through the width of each glyph (because each advance
is different from the glyph width in isolation).
2024-08-26 18:07:08 -03:00