Commit Graph

474 Commits

Author SHA1 Message Date
David Capello
840a14652f Fix the Image.DiffRgbImages test
Comparing two RGBA pixels with different RGB but Alpha=0 must be
true (because Alpha=0 means both color are totally transparent, RGB
values doesn't matter).
2018-11-13 15:32:38 -03:00
David Capello
dea603753b lua: Add Image:isEqual() 2018-11-13 12:52:51 -03:00
David N Campo
f6bb446031 Combination of CLI args results in jumbled layer order (fix #1644)
- The order is fixed because we now iterate a LayerList (a
  std::vector) instead of a SelectedLayers (a std::set)
- This can be an issue each time we iterate over a std::set (and
  SelectedLayers is a std::set) because it depends on the specific STL
  impl details (which vary depending on msvc/clang/gcc compiler).
- This fix iterates over layers, no matter if are visible or not
  (SelectedLayers::toLayerList() returns only browseable layers)
2018-11-12 09:06:59 -03:00
David Capello
c657038b1a Support --ignore-empty for --save-as (fix #551) 2018-11-07 16:56:32 -03:00
David Capello
43a603cea9 Update color profiles from image sprites in Sprite::setColorSpace()
This is needed for cmd::AssignColorProfile() to change the color space
of all images when we update the color space of the sprite.
2018-10-25 17:28:03 -03:00
David Capello
81965b904f Use current working color space in new created files
* Added the gfx::ColorSpace field in doc::ImageSpec
* Removed some methods like Sprites::add(width, height, etc.)
* Prefer methods with ImageSpec as argument (which now includes the color space)
2018-10-25 15:23:01 -03:00
David Capello
a4d8fc52bf Manage color profiles (fix #1576) 2018-10-19 15:30:30 -03:00
David Capello
4ab94e9982 lua: add Sprite/Image.spec (ImageSpec metatable) 2018-09-11 21:52:53 -03:00
David Capello
4c5637f636 Add missing doc::Image(ImageSpec) impl 2018-09-11 16:53:09 -03:00
David Capello
6abda997d4 lua: Add Selection:add/subtract/intersect/__eq 2018-09-07 14:44:54 -03:00
David Capello
f456f3cba3 lua: Initial support for sprite properties
Frames, Palettes/Color, Layers, Cels, Tags, Slices, etc.
2018-09-04 16:10:32 -03:00
David Capello
a107dd29a4 lua: add image iterators
In this way we can use:

    local img = Image(32, 32)
    for it in img:pixels() do
      local pixelValue = it() -- get pixel
      ...
      it(pixelValue)          -- set pixel
    end
2018-09-03 18:20:23 -03:00
David Capello
a6fab8d1d9 Move os/ft/gfx libraries to laf 2018-08-09 16:36:11 -03:00
David Capello
5cb2d984f0 Rename she -> os 2018-08-09 12:58:43 -03:00
David Capello
f2ed45e795 Replace base::UniquePtr -> std::unique_ptr 2018-08-08 17:27:26 -03:00
David Capello
457a9999b5 Move doc::Context to app::Context (#378)
We've moved everything related to Context/active site/observable
documents from "doc" namespace to "app" namespace.
2018-07-07 02:47:42 -03:00
David Capello
612ad98392 Rename DocumentObserver/Event to DocObserver/Event 2018-07-06 21:06:03 -03:00
David Capello
1c8f2cde7d Fix bug: removing frames weren't saving updated cel frame positions in the backup info 2018-07-04 13:38:54 -03:00
David Capello
4d885b5b8a Use old render engine when there are visible ref layers in zoom > 100% 2018-06-28 16:56:35 -03:00
David Capello
aec65faa2b Add DOC_SPRITE_MAX_WIDTH/HEIGHT constants 2018-06-28 13:53:38 -03:00
David Capello
58b9dfed11 Merge branch 'master' 2018-06-22 16:22:06 -03:00
David Capello
33369c0a5f Add a fast path for RGBA images to convert_image_to_surface()
Most common case in Aseprite where we convert
a IMAGE_RGB doc::Image into a 32bpp she::Surface
and all RGBA masks/shifts match.
2018-06-22 15:56:50 -03:00
Gaspar Capello
2b177601b5 Fix Duplicate Cels ignores collapsed layer groups (fix #1727) 2018-06-21 14:37:52 -03:00
David Capello
8042bbb60d Add Alt+click on timeline to hide all layers except the clicked one
https://community.aseprite.org/t/turn-off-all-other-layers/151
2018-06-08 17:57:58 -03:00
David Capello
744e40b4b7 Show full animation length/tag length on status bar (fix #1528) 2018-06-08 16:41:24 -03:00
David Capello
b8445956ae Restore selected Timeline range after undo/redo 2018-06-08 14:40:02 -03:00
David Capello
96ca735ed5 Add command to Stroke the selection bounds w/the foreground color 2018-05-30 18:05:18 -03:00
David Capello
0f51467768 Fix my common typo "completelly" instead of "completely" 2018-05-24 14:21:00 -03:00
David Capello
a507951871 doc: Update copyright year 2018-04-18 16:57:20 -03:00
David Capello
4873d8d799 doc: Remove SpritesObserver 2018-04-18 16:56:02 -03:00
David Capello
44a920b444 Include base/base.h (and debug.h) for SGN/MID (and ASSERT) 2018-04-16 11:17:51 -03:00
David Capello
08d6cbcf60 Fix crash using --save-as CLI
Reported here:
https://community.aseprite.org/t/command-line-save-as-has-stopped-working/1140
2018-03-17 10:50:24 -03:00
David Capello
589d775d10 Add AniDir parameter to Export dialog (fix #1505) 2018-03-16 08:59:34 -03:00
David Capello
10590da7c1 Add possibility to select the layer content with Ctrl+click (fix #1509) 2018-03-15 16:05:56 -03:00
David Capello
245285f84e Filters: Use the selected cels range instead of target buttons
With this commit we've definitely removed the target buttons to apply a
filter in current cel/layer/frame (which never make too much sense to
the end-user), and now we can just select the range of
layers/frames/cels where we want to apply the filter (like Flip and
Rotate commands that were already working in this way).
2018-03-13 17:05:14 -03:00
David Capello
f9af5c21c7 Fix a compiler error on gcc 4.8.4 2018-03-13 09:56:39 -03:00
David Capello
184736760a Add possibility to rotate ellipses and rectangles (fix #868) 2018-03-06 19:22:51 -03:00
David Capello
5da8b2c8a9 Minor format changes in algo.cpp 2018-02-22 13:52:15 -03:00
Steven
debb8e9f32 similarly for algo_ellipsefill 2018-02-15 02:41:27 -05:00
Steven
8549774060 algo_ellipse restructure/reimplement 2018-02-14 22:51:34 -05:00
David Capello
392312d687 Fix gradient fill on tiled mode 2017-11-10 12:19:44 -03:00
David Capello
ceb9cb3abd Add missing blend modes in blend_mode_to_string() (fix #1605) 2017-11-07 12:31:16 -03:00
David Capello
ed744bb223 Fix warning in PalettePicks::size() 2017-09-26 16:38:00 -03:00
David Capello
825ef892aa Fix warning in SelectedLayers::size() 2017-09-26 16:37:43 -03:00
David Capello
14ba0ab411 Add addition/subtract/divide blending modes
Changes:
* Added SeparatorInView() to add separators inside a ListBox or ComboBox.
* Added BlendModeItem() to represent each item in the blending modes
  ComboBox.
* Now a ComboBox can contain any kind of widgets as children (not just
  ListItem). This is required to add separators in the blending modes
  ComboBox.

Feature request:
https://community.aseprite.org/t/additive-blending-feature/121
2017-07-24 15:25:13 -03:00
David Capello
83e6f877f5 Put all blending function definitions in blend_funcs.h 2017-07-19 10:44:21 -03:00
David Capello
c06ce39357 Remove rgba/graya_blender_normal() without opacity 2017-07-19 10:33:01 -03:00
David Capello
fd408247cf Add some comments in rgba_blender_normal()
In this way we can see how we get the final blending formula which is
equivalent to Rc=(Sc*Sa + Bc*Ba*(1-Sa))/Ra
2017-07-18 23:33:54 -03:00
David Capello
dd3ce20133 Minor changes in rgba_blender_normal() function 2017-07-18 17:05:33 -03:00
David Capello
7cbf5fd420 Add some simple benchmarks for color blending functions 2017-07-18 17:03:12 -03:00
David Capello
f329f8b50c Snap brushes on grid corners (#1465) 2017-06-29 15:57:44 -03:00
David Capello
91c9cc29b0 Use fg/bg color alpha to modify custom brush alpha
Bug reported here: https://twitter.com/dovker/status/880137802142429184
2017-06-29 14:24:53 -03:00
David Capello
19f6dcfc58 Don't alter pasted image position if it's off canvas (fix #1447)
Now we limit only one pixel inside the sprite bounds.
2017-06-23 07:01:12 -03:00
David Capello
ab39ec63a8 Minor change in algo_line() comment 2017-06-23 06:18:08 -03:00
David Capello
88e0596692 Reimplement line algorithm (fix #1395) 2017-06-22 21:10:44 -03:00
David Capello
288b9aa8f9 Pass srcColor as argument to floodfill() 2017-06-15 15:24:27 -03:00
David Capello
ff453e8e83 Add default ctor to doc::Remap() 2017-06-02 10:00:14 -03:00
David Capello
144139f49d Add const modifier to doc::sort_palette() args 2017-06-02 09:59:31 -03:00
David Capello
131336d015 Add progress dialog/bar when we change color mode
Added a new app::RenderTaskJob to execute a lambda function as in a
background thread in a app::Job that can be used as a
render::TaskDelegate by some render functions.
2017-05-17 16:40:19 -03:00
David Capello
23272895c4 Move doc::DitheringMethod -> render::DitheringAlgorithm 2017-05-15 16:26:44 -03:00
David Capello
cc7bde6cd1 Fix some compiler warnings (implicit casts & unused vars) 2017-04-19 19:26:23 -03:00
David Capello
5e1c5af423 Restore slice user data correctly from undo/redo information 2017-04-12 11:51:29 -03:00
David Capello
5246c8341a Minor format fix in mask_boundaries.cpp 2017-04-06 15:22:36 -03:00
David Capello
1671411465 Add simple color selection for tag/user data colors 2017-04-04 20:02:29 -03:00
David Capello
9d2e542b53 Show all frame tags again in some special cases
When we add/remove frame tags or change the active document we have to show all tags again. Related to #920
2017-03-30 15:25:35 -03:00
David Capello
c23967b547 Fix soft light layer blending mode 2017-03-29 17:35:09 -03:00
David Capello
27bc151a37 Improve handling of overlapping frame tags in the Timeline (fix #768) 2017-03-26 21:52:50 -03:00
David Capello
fb64d5406a Add some colors for cel edges/guides in doc pref 2017-03-23 20:23:25 -03:00
David Capello
347ccfbb78 Add --list-slices CLI option 2017-03-16 10:35:26 -03:00
David Capello
9585d75794 Include <limits> needed by gcc 2017-03-15 15:13:08 -03:00
David Capello
f7cf65b245 Move <cursors> to <parts> on theme.xml
For this the "pivot" property was added to doc::SliceKeys.
2017-03-14 19:00:24 -03:00
David Capello
be3c9c1bcc Convert timeline widget to new styles
And remove the old skin::Style.
2017-03-13 18:13:38 -03:00
David Capello
643cad5c97 Add basic implementation of slice tool (#721) to modify theme parts
It still need support to export to .aseprite-data as <slice> XML elements, and animation support.
2017-03-06 19:27:43 -03:00
David Capello
a39627fe28 Merge branch 'master' into beta 2016-12-29 09:56:55 -03:00
David Capello
a56dff5515 Don't ignore "first frame" in tag properties dialog (fix #1350) 2016-12-29 09:42:44 -03:00
David Capello
afdb6b511f Fix all commands using uniqueCels() (sprite size, rotate/flip sprite, etc.)
We have to iterate all layers on commands that modify the whole
sprite. It doesn't matter if the layer is "browsable" (e.g. it's
expanded or collapsed).
2016-12-08 09:11:54 -03:00
David Capello
d0c9266eaf Merge branch 'master' into beta 2016-11-09 18:49:56 -03:00
David Capello
d6f2bec3fe Unlock document from backup thread when UI needs it
Added a new "weak lock" concept to RWLock/Document class. The background
thread that saves data recovery information can obtain this "weak lock"
which can be unlocked by the UI thread in any moment (i.e. when the user
needs the document immediately for UI.)
2016-11-09 17:22:55 -03:00
David Capello
5c3f75c64b Merge branch 'master' into beta 2016-11-07 18:17:42 -03:00
David Capello
ce6c85996e Update laf library (base/path is gone, use base/fs) 2016-11-01 19:14:05 -03:00
David Capello
21b6e8716d Merge branch 'beta' into ref-layer 2016-11-01 14:11:03 -03:00
David Capello
54e60f058f Merge branch 'master' into beta 2016-11-01 14:09:02 -03:00
David Capello
c2103df444 Move base module to laf library 2016-11-01 12:47:48 -03:00
David Capello
2e66b227f6 Merge branch 'beta' into ref-layer 2016-10-31 20:15:41 -03:00
David Capello
c60e0b915c Merge branch 'master' into beta 2016-10-27 13:00:57 -03:00
David Capello
cc18334c5a Changes in LOG/TRACE messages 2016-10-27 12:25:33 -03:00
David Capello
693a68844c New docio-lib to detect file format by content (fix #776) 2016-10-26 19:37:42 -03:00
David Capello
bc939d5638 New eyedropper mode to pick colors from reference layers 2016-10-13 21:19:25 -03:00
David Capello
1b053de2f2 Fix eyedropper/move tool for reference layers 2016-10-13 19:58:42 -03:00
David Capello
1de5837676 Remove fflush() call from Sprite::pickCels()
Probably from an infamous printf() debugging session.
2016-10-13 19:37:04 -03:00
David Capello
080e7e3f68 Add subpixel bounds for reference layer cels
Now we can move a reference layer cel in a X,Y position with floating
point coordinates (i.e. in a subpixel position).
2016-10-10 23:42:47 -03:00
David Capello
512ccb5dd0 Add bounds (width/height) to doc::Cel/CelData 2016-10-04 21:17:17 -03:00
David Capello
99f37ef242 Add LayerFlags::Reference flag to identify a reference layers
With this flag we can show reference layers in a special way on the
Timeline.
2016-10-04 20:06:24 -03:00
David Capello
7fb984b18d Fix compilation errors when HAVE_CONFIG_H isn't defined 2016-09-26 09:44:43 -03:00
David Capello
e46d453356 Merge branch 'master' into beta 2016-09-23 13:21:51 -03:00
David Capello
fac2dd046c Fix generating CompressedImage with mask 2016-09-23 12:59:20 -03:00
David Capello
dfecffd465 Merge branch 'master' into beta 2016-09-19 19:02:49 -03:00
David Capello
18b4008c6f Fix issues creating brushes with transparent color 2016-09-19 16:17:24 -03:00
David Capello
3e9e49caf9 Allow to save specific layers/frames in Save Copy As (fix #1080) 2016-09-17 01:01:28 -03:00
David Capello
1404b0ce7d Merge branch 'master' into beta 2016-09-16 16:02:26 -03:00
David Capello
2e3bbe2968 Show a tooltip with author+link of each palette (fix #540) 2016-09-15 15:30:45 -03:00
David Capello
6377b550e3 Replace base::Signal/Observable* with obs::signal/observable
We can use the obs library directly for signal/slots and observable
objects.
2016-09-13 15:02:00 -03:00
David Capello
6bbd6b27ff Fix "Export Sprite Sheet" for selected layers using groups and children 2016-09-12 17:56:48 -03:00
David Capello
a104afc670 Merge branch 'master' into beta 2016-09-12 17:53:01 -03:00
David Capello
5a55a9e276 Add support to load/save palettes from/to a list of hex values (.hex files) 2016-09-07 09:19:40 -03:00
David Capello
20b726f73b Merge branch 'master' into beta 2016-08-31 19:53:52 -03:00
David Capello
f2f1c1008b Add support to move/copy non-adjacent layers/frames
Changes:
* With this patch we finally removed the LayerIndex class and member
  functions to access layers by index (like Sprite::firstLayer/layerLayer
  /layer/indexToLayer/layerToIndex() etc.). As layer groups can be
  expanded/collapsed, it doesn't make sense to use layer index to
  access layers directly from sprite.
* Now we use a layer_t (int) to access a list of browsable layers each
  time we want to iterate visible layers in the timeline.
* Replaced CelsRange() and Sprite::uniqueCels() param with
  SelectedFrames to iterate non-adjacent cels.
* Updated clipboard operations (copy/paste) in timeline to support
  layer groups.
* Updated Timeline control to support selecting multiple layer/frame
  ranges with Ctrl+ or Alt+click (fix #1157)
* Added more test units for DocumentRange operations (mainly for
  non-adjacent ranges).
2016-08-25 12:31:00 -03:00
David Capello
8bc6149798 Add extra checks to SelectedLayers/Frames 2016-08-23 15:12:24 -03:00
David Capello
356d88b413 Fix crash in SelectedLayers::displace() when layerDelta is out of bounds 2016-08-23 13:50:35 -03:00
David Capello
36719da7b2 Convert SelectedLayers into a class 2016-08-12 18:01:12 -03:00
David Capello
8971c8857a Remove Sprite::countLayers() member function 2016-08-12 14:21:15 -03:00
David Capello
906d76ad41 Add SelectedFrames::displace() member function
We have plans to include a SelectedFrames in DocumentRange to select
non-adjacent frames. This member function will be useful to displace
those frames.
2016-08-12 13:08:22 -03:00
David Capello
e35a26fdeb Replace access to the first sprite layer with Sprite::root()->firstLayer() 2016-08-11 20:51:14 -03:00
David Capello
22203fb4d3 Add SelectedFrames::operator== and != 2016-08-11 15:54:50 -03:00
David Capello
fbc8d72f1f Add doc::are_layers_adjacent() function
It'll be useful to know if a range operation (e.g. restack layers) will
be applied to adjacent layers (i.e. a range of layers like in previous
Aseprite versions), or to a non-adjacent set of layers.
2016-08-11 15:15:53 -03:00
David Capello
b4c63a82e1 Add doc::have_layers_same_parent() 2016-08-11 14:55:18 -03:00
David Capello
e5ef4be54a Add allLayersCount() to LayerGroup and Sprite
This will give us the total number of layers + children.
2016-08-11 14:53:51 -03:00
David Capello
ae91c3d15b Add doc::find_layer_index()
It'll be useful to known the index of a layer inside a list (e.g. a list
of all layers, or a list of all browsable layers, etc.).
2016-08-11 14:30:44 -03:00
David Capello
9fd340751f Add doc::displace_selected_layers() function
This function would be useful for the Timeline to displace the set of
selected layers range when the user drag-and-drop it.
2016-08-11 14:24:23 -03:00
David Capello
866385fe4b Add new layer_t type as a replacement for the old LayerIndex 2016-08-11 14:22:45 -03:00
David Capello
63a7a477ff Fix SelectedFrames::insert() when from > to 2016-08-11 14:11:48 -03:00
David Capello
5950bd7df1 Add SelectedFrames::clear() 2016-08-11 13:45:50 -03:00
David Capello
dc1bc964ce Change memset/memcpy with std::fill/copy in ImageImpl 2016-08-03 16:58:58 -03:00
David Capello
01e8e99fcb Add tests for Image::fillRect 2016-08-03 16:32:06 -03:00
David Capello
36bfa1d641 Merge branch 'beta' into layer-folder 2016-07-28 23:02:24 -03:00
David Capello
8823f6bf21 Merge branch 'master' into beta 2016-07-28 11:03:56 -03:00
David Capello
97d42de696 Improve image resize algorithm
It might be a possible fix for #502
2016-07-25 12:15:42 -03:00
David Capello
f838b8787e Merge branch 'beta' into layer-folder 2016-07-07 12:47:42 -03:00
David Capello
36ffc8d2bd Merge branch 'master' into beta 2016-07-06 15:46:22 -03:00
David Capello
b13ac1d340 Add crop_image() with a gfx::Rect 2016-07-01 18:42:10 -03:00
David Capello
3df6572170 We can return a const& in Cel::position() 2016-07-01 18:41:26 -03:00
David Capello
9897256d26 Don't trim background layer cels automatically (fix #1166) 2016-07-01 11:14:50 -03:00
David Capello
2d6412357c Remove Sprite::getLayersList() member 2016-06-29 10:59:37 -03:00
David Capello
7f4fbb0e85 Fix 'auto select layer' in Move tool for groups 2016-06-21 12:17:18 -03:00
David Capello
7b55037abb Replace LayersRange with Sprite::all*Layers() members 2016-06-21 12:02:31 -03:00
David Capello
0f77bf0712 Move selected layers into the new group
If the Timeline has an active selected range of layers and the user
creates a new layer group, the selected layers will be be grouped as
children of the new layer 'group'.
2016-06-21 00:02:13 -03:00
David Capello
139b8f6d74 Fix goto next/previous layer for multiple group levels 2016-06-20 21:15:35 -03:00
David Capello
6a66e660a7 Update doc library copyright year 2016-06-15 16:34:07 -03:00
David Capello
ebb6825b87 Don't enter in collapsed groups with GotoNext/PrevLayer 2016-06-15 15:49:39 -03:00
David Capello
ac20d1edfc Fix some commands/editor states to check parent group editable/visible state too 2016-06-15 15:27:38 -03:00
David Capello
a2a06965db Show disabled eye/padlock in Timeline when parent is deactivated
We've added a new "disabled" style state to do this.
2016-06-15 12:00:31 -03:00
David Capello
5e89ab3148 Fix GotoNext/PreviousLayer for groups 2016-06-14 15:00:11 -03:00
David Capello
47eeb4f564 Fix CelsRange to iterate over layer groups 2016-06-14 12:57:13 -03:00
David Capello
ad518b7fb2 Add SelectedFrames::reversed() function 2016-06-14 11:14:24 -03:00
David Capello
e58d54600a Fix #endif footer in some files 2016-06-14 11:08:17 -03:00
David Capello
5d222c9c3e Add SelectedFrames::ranges/firstFrame/lastFrame() 2016-06-14 11:05:03 -03:00
David Capello
8a3e74f7ec Add doc::select_all_layers() function 2016-06-14 10:56:30 -03:00
David Capello
147588ff6f Identify different Timeline areas with Site::Focus 2016-06-14 10:15:47 -03:00
David Capello
7ced1c791b Include <algorithm> for binary search in contains() 2016-06-13 17:48:00 -03:00
David Capello
daf4e0e022 Add reverse iterator to SelectedFrames 2016-06-13 17:47:42 -03:00