Commit Graph

9738 Commits

Author SHA1 Message Date
Gaspar Capello
e70bbbd369 Add 'x' and 'y' as input parameters to app.command.Paste() 2024-09-05 17:22:12 -03:00
Gaspar Capello
de1fc581f2 Fix app.command.Cut/Paste does not work in --batch mode (fix #4354)
This fix adds support for cut/copy/paste selected areas during
script execution when there isn't UI.
2024-09-05 17:22:12 -03:00
David Capello
09bb5cc3d3 Restore transparent color correctly after undoing Indexed -> RGB
When we are in Indexed mode we can have a specific index as the
transparent color, if we convert the sprite to RGB, that transparent
color is lost, so we have to save it (in a cmd::SetTransparentColor)
to restore it correctly when we undo the ChangePixelFormatCommand.
2024-09-04 15:59:18 -03:00
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 4a91d150af
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
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
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
e87f6df72b Avoid loading current dithering matrix on each mouse move (related to #4174)
With this change we are reusing the cached/loaded matrix on each
DitheringMatrixInfo struct, calling the
load_dithering_matrix_from_sprite() function just one time (not on
each brush preview/mouse movement).
2024-08-21 19:49:55 -03:00
David Capello
29479cb231 [win] Fix saving files to network paths (fix #4608) 2024-08-21 18:38:17 -03:00
David Capello
7b24cf2594 Fix "New Frame" button for existing third-party themes (fix #4609)
We made an attempt to change the "+" character with an icon, but we
cannot use an existing style to do this kind of change in themes (as
third-party themes will be using the old version of the style, not the
updated one).

We're reverting part of the change introduced in
e0ff51947a to use the "+" character for
this "New Frame" button in the status bar.
2024-08-21 16:55:11 -03:00
David Capello
1ca4306f9d [win] Fix File > Export > Export As to other drive (fix #4607)
This only affects the Windows platform.
Regression introduced in db639072f7
2024-08-21 13:50:29 -03:00
David Capello
8817724e44 Fix typo using ENABLE_I18N_STRINGS var 2024-08-19 20:08:56 -03:00
Martín Capello
712d84e44e
Avoid div by zero by preventing entering/returning a grid bounds w/zero width/height (fix #4146, #4597) 2024-08-19 18:07:40 -03:00
Christian Kaiser
4df11ac1e3
Reset mask when clicking outside of bounds with the magic wand tool (fix #4490, #4595) 2024-08-15 09:13:18 -03:00
Panagiotis Georgiadis
0bdcdbfc49 [docs] Improve phrasing for Tileset image data length
Clarified the description for the data length field of the
compressed Tileset image when flag 2 is set.
2024-08-12 17:22:05 -03:00
David Capello
d6436647ab Update laf module 2024-08-09 20:51:28 -03:00
Siddhant Madhur
3c876066aa Fix indentation in INSTALL.md
In the MacOS (Apple Silicon) install commands,
"ninja aseprite" was incorrectly indented.
2024-08-09 11:05:17 -03:00
David Capello
4e5dfa9d2c Don't export cel opacity when it's 255 (#4511 / #4552)
In this way we don't modify the current exported JSONs by users that
are not using cel opacity (which might be the most common case).
2024-08-08 19:02:51 -03:00
requizm
a11946ab0e Added opacity field when exporting a cell 2024-08-08 18:57:30 -03:00
Christian Kaiser
e0ff51947a
Add new frame menu to status bar button (#4582) 2024-08-08 17:23:41 -03:00
Gabe Spound
99f1a1ea06 Needed libwebP as a dependency on Arch Linux 2024-08-08 16:51:29 -03:00
David Capello
657e679461 Some extra comments to the coding style guide 2024-08-08 16:17:56 -03:00
David Capello
fcbd50e46f Remove emoji from contributing guide (but don't forget to smile) 2024-08-08 16:13:35 -03:00
David Capello
6f65acb54f Add VS 2022 command prompt from Start menu in INSTALL guide 2024-07-29 17:31:03 -03:00
Gaspar Capello
8f3af748b9
Don't allow to install third-party themes that override the default one (fix #4226) (#4335)
This 1) hides user themes whose name is the same as the default,
and are present in the user folders (i.e.  'extensions' and
'data/themes' folders), and 2) doesn't allow to install themes with
the same content/ID of the default aseprite-theme (fix #4226)
2024-07-29 16:02:05 -03:00
requizm
b65fb3a14e Fixed size calculation on resize_image 2024-07-25 17:59:31 -03:00
David Capello
26279597b6 Add help button "?" in some windows (fix #1980)
We hope to enhance the discoverability of Aseprite features in this
way.
2024-07-25 16:02:21 -03:00
David Capello
3c44831831 We can use = {} for default arg values in function declarations 2024-07-19 17:10:39 -03:00
David Capello
9da10605d3 Remove duplicate code with new sort_slices_by_name() function 2024-07-19 16:47:13 -03:00
requizm
6047ab69de [ui] Fixed slice order in File > Export > Export As > Area 2024-07-04 14:22:51 -03:00
David Capello
79efbd76a1 Update laf module 2024-07-04 11:10:15 -03:00
David Capello
064ddef190 Don't clone strings repository by default (fix #4489)
New ENABLE_I18N_STRINGS option (off by default) to avoid compilation
errors cloning the strings repo (no connection, no git, etc.).
2024-06-27 08:35:55 -03:00
David Capello
abe872aeb2 Convert the tileset serialization format in its own type
To match the new SerialFormat enum (uint16_t), we now have
TilesetSerialFormat enum (uint8_t).
2024-06-26 11:24:09 -03:00
David Capello
cdea6004bd Refactor app::DocFormat to doc::SerialFormat
This fixes a violation of module layers (circular dependency)
introduced in e6cd13d7e1 where doc-lib
started to depend on app-lib (which cannot happen, as app-lib depends
on doc-lib).

This DocFormat/SerialFormat was used only from app-lib previously, but
when properties were introduced in user data, the serialization format
version was needed to read user properties too. So now it makes sense
to move this type/its values to the doc-lib.

A couple of extra issues were found in this refactor:
1) The recursive call inside read_layer() didn't receive this "serial"
   argument
2) read_grid() doesn't need the setId parameter
2024-06-26 10:42:30 -03:00
David Capello
32a099dcb6 Fix crashes with ill-formed fmt format strings (fix #2274)
There is a third-party translation (and can happen with our own
translations) that a fmt format string is ill-formed in the .ini file
of the translation (this could happen even if the en.ini file was
manually modified/broken by hand).

This patch includes a refactor of the Strings class so we can:

1) Static check at compile-time about the number of required arguments
   to format a string (no need to call fmt::format() directly with
   arbitrary number of args)
2) If a string is not valid for the fmt library, the runtime exception
   is caught and the default (English) string is returned.
2024-06-20 20:49:10 -03:00