Commit Graph

38 Commits

Author SHA1 Message Date
David Capello
09538f9a1a clang-format all files 2024-12-16 14:52:19 -03:00
Guilherme Belchior
ffc3684b1b Compose groups separately from all other layers
Maintain hierarchical structure of sprite groups instead of flattening.
Allows opacity and blend mode to be applied correctly to groups.
Sets the foundation for future features like mask layers.

Note:
Requires full image rendering and impacts performance in some scenarios.
Avoids complex code changes for minor performance gains.

Co-authored-by: Guilherme Marcondes <guilherme.marcondes@tecnico.ulisboa.pt>
2024-06-24 18:16:42 -03:00
David Capello
b43fbe2249 Add simple rendering of tiles w/flags (x/y/d flip) 2023-11-09 16:44:46 -03:00
David Capello
e84bee0f99 Minor changes removing "using namespace doc" from app/color.h 2023-07-17 15:02:15 -03:00
David Capello
8e91d22b70 Fix experimental "nonactive-layers opacity" mode for the SimpleRenderer
Regression introduced in 24846eae10
2023-05-05 22:11:19 -03:00
David Capello
24846eae10 Add z-index property to cels (fix aseprite/Attachment-System#88)
* Now a Cel has a z-index property to change the order of layers per frame
* A new doc::RenderPlan class can calculate the order of cels to be rendered
* z-index is saved as a int16_t in the .aseprite files
* This new field can be set/get from Lua with Cel.zIndex
2023-04-10 19:23:16 -03:00
David Capello
83857ea600 Merge branch 'main' into beta 2022-08-17 22:58:12 -03:00
David Capello
a66c170ded Add render::BgOptions to simplify some code 2022-08-17 22:40:25 -03:00
David Capello
4e12e427ef Rename "checked" -> "checkered" (background, drawing routines, etc.)
Also rename setBgCheckedSize -> setBgStripeSize in case we add new
background patterns (like horizontal/vertical/diagonal stripes, etc.)
2022-08-17 22:19:07 -03:00
David Capello
db80c2a07e Real-time preview when editing tilemaps in Manual mode
In this way we can see the changes to all instances of the same tile
in the tilemap in real-time. The preview is done through a new
"preview tileset" that is used in the render concept (instead of the
preview image, a preview tileset is used as a temporal tileset to be
used for preview purposes only).
2020-11-04 16:54:12 -03:00
David Capello
26139c4ae2 Add tilemap layers (#977)
This is the first commit with a simple tilemap editor. Still buggy but
functional in several ways. Several changes were made:

* NewLayer command can receive a tilemap=true to create a new tilemap
  layer
* New ToggleTilesMode command added to switch between the palette and
  the tileset in the ColorBar (the ColorBar was expanded to show
  colors or tilesets with a generic AbstractPaletteViewAdapter)
* All commands to create new layers were moved to Layer >
  New... submenu
* There are a new tileset chunk to save tilesets in .aseprite files,
  and a new kind of cels to save tilemaps
* Added doc::LayerTilemap, doc::Tileset, etc. and several other types
  to handle tilesets/tilemaps in the doc layer.
* Added doc::Grid class with grid specifications that indicates how a
  tilemap <-> tileset must be drawn
* Added and expanded cel operations to work with tilemaps and
  conversions between regular LayerImage cels <-> LayerTilemap cels
  (e.g. copy cels in the timeline between layer types)
2020-02-17 09:06:00 -03:00
David Capello
1c8b8051a8 Rename FrameTag -> Tag 2019-10-01 14:55:08 -03:00
David Capello
e3f09525db Refactor the thumbnails generation of cels
A new Render::renderCel() method is used to render the specific cel
thumbnail, useful in the future to render thumbnails of different kind
of layers (e.g. future tilemaps). And now the background is rendered
in a different step (so the thumbnails doesn't contain the
background.)
2019-04-11 14:29:20 -03:00
David Capello
b7b2d4651d Render: Avoid drawing the background image if it's not needed 2019-03-09 15:00:09 -03:00
David Capello
996d385040 Render::renderBg/SpriteLayers() are functions used only inside Render 2019-03-09 12:53:36 -03:00
Gaspar Capello
f53544842c Fix non-normal blend modes when the backdrop is transparent (fix #1096) 2019-03-09 12:40:31 -03:00
David Capello
c3e233f34d Create EditorRender to merge shared render image buffer and AppRender 2018-06-19 23:25:31 -03:00
David Capello
c3c664874d Fix bug where selection tools don't show active layer
Bug introduced in 26b1a2ebb4
2016-12-07 17:05:31 -03:00
David Capello
26b1a2ebb4 Add option to reduce opacity of non-active layers 2016-12-01 15:20:35 -03:00
David Capello
bcb775a88b Render reference layers only in the sprite editor 2016-10-26 15:16:22 -03:00
David Capello
1b053de2f2 Fix eyedropper/move tool for reference layers 2016-10-13 19:58:42 -03:00
David Capello
b83eb89ce4 Use old composite code (faster code) when possible
We use the new general image composite code in case that there is a
reference layer or the background grid is so small that we need a
pixel-by-pixel color blending.
2016-10-11 16:43:37 -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
36ffc8d2bd Merge branch 'master' into beta 2016-07-06 15:46:22 -03:00
David Capello
d566604205 Fix several bugs applying filters to cels smaller than the sprite bounds
Now if we apply a 3x3 (or bigger) convolution matrix to a cel, the cel
will be expanded to so new pixels are included in the new cel content.
2016-07-01 18:49:58 -03:00
David Capello
d84ba2db32 Merge branch 'master' into beta 2016-06-30 12:26:41 -03:00
David Capello
9e6d7632d9 Minor Render improvement
We can return the specific function to composite images depending on the
actual zoom level. In this commit I include a new
composite_image_without_scale() to completely ignore the zoom level when
it's possible.
2016-06-29 10:01:14 -03:00
David Capello
37209a0f5b Add pixel ratio support to the Editor & Render 2016-05-23 19:22:02 -03:00
David Capello
640025e84b Fix selection UX to show white/black negative for the stroke
With this patch now we can use the selection tool in locked or hidden
layers, because the selection doesn't modify the layers (only the
selection). Also we can use the selection tool on any layer and we'll
always see the feedback stroke/shape/rectangle while we're creating
the new selection.
2016-05-02 18:42:02 -03:00
David Capello
bf54fd26d3 Add option to put the onion skin behind the sprite
Fix #526 and fix #412
2015-07-31 15:55:06 -03:00
David Capello
80b47419fd Add an option to onionskin the current layer only (related to #526) 2015-07-31 14:30:11 -03:00
David Capello
5a5579973c Add missing palette parameter to render::composite_image()
This is needed when we copy a cel (or cel range) from an Indexed image
to an RGB image.
2015-07-27 12:24:54 -03:00
David Capello
21ca87862c Add layer blending modes (fix #318)
- Added doc::BlendMode enum and doc::BlendFunc type
- Renamed LayerImage::getBlendMode() -> blendMode()
- BLEND_MODE_COPY is BlendMode::SRC now
- BLEND_MODE_NORMAL is BlendMode::NORMAL now
- Added app::cmd::SetLayerBlendMode
2015-06-13 21:29:16 -03:00
David Capello
3388eaffde Show onion skinning depending on the configured loop section (fix #555)
There is a new option (per document) to disable this behavior.
2015-05-27 17:42:41 -03:00
David Capello
625aa1ee55 Move onionskin options into render::OnionskinOptions class 2015-05-27 14:49:01 -03:00
David Capello
4e6db14cae Use a PreviewToolLoopImpl to preview the current tool ink/point shape/etc
With this we can see the exact preview in real-time of the the left
click paiting (e.g. using real Indexed composition, ink, point shape, etc.)
We are able to preview blur, eraser, or flood fill preview too (anyway
these are not enabled at this moment).
Changes:
* Add render::ExtraType enum to indicate if the extra cel acts like a
  patch for the current cel (e.g. cursor), or as an extra layer for
  composition (e.g. selection/moving pixels)
* Add ExtraCelType property to app::Document and to render::Render
* Add ToolBox::getPointShapeById()
* As the current cursor preview depends on the current layer, when
  we change the current layer we've to update the Preview editor
  with the new selected layer (now we listen to
  Document:.onAfterLayerChanged())
* Add create_tool_loop_preview() and PreviewToolLoopImpl
2015-04-26 15:59:28 -03:00
David Capello
06d18f1e8a Replace doc::FrameNumber with doc::frame_t 2014-12-28 20:39:11 -03:00
David Capello
da1358c5dc Unify all render code in one library
Changes:
* Create render library (move util/render.cpp to render/render.cpp)
* Move app::Zoom class to render::Zoom
* Remove doc::Image::merge() member function
* Add gfx::Clip helper class (to clip dst/src rectangles before a blit)
* Move doc::composite_image() to render::composite_image()
* Remove doc::Sprite::render()
* Replace Sprite::getPixel() with render::get_sprite_pixel()
* Remove doc::layer_render() function
* Convert DitheringMethod to a enum class
* Add AppRender to configure a render::Render with the app configuration
* Move checked background preferences as document-specific configuration
* Add doc::Sprite::layer() and palette() member functions
* Add doc::Layer::cel() member function
* Add doc::Palette::entry() member function()
* Add doc::frame_t type
* Move create_palette_from_rgb/convert_pixel_format to render library
* ExportSpriteSheet doesn't need a temporary image now that we can specify
  the source rectangle in the render routine
2014-12-28 11:06:11 -03:00