Commit Graph

76 Commits

Author SHA1 Message Date
Gaspar Capello 715600679d Fix old render engine issue in tilemap layers
Before this fix, first row of pixels (or/and columns) of a tile were not rendered when a scroll down or/and right take place and the zoom was enough to get an image size that exceeds the editor window.
The issue can be reproduced:
- Make a tilemap layer.
- Put tiles on that layer.
- Zoom in until image size exceeds the editor window (and pan the image until hiding two tiles).
- Scroll down (or/and right) to show the hidden tiles.
Then, first pixel rows (or/and columns) of ex-hidden tiles won't be rendered.
2021-02-02 16:57:48 -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 c2e5e69882 Simplify tilesets impl using tile index 0 = an empty tile
In this way we always have an empty tile available in the drawing
process. We've also added the Tileset::firstVisibleIndex field to
change the visible index of the tile 1 so we can offset the visible
number by the user (just as a visual aid / simulate old tilesets with
index=0=non-empty tile).
2020-10-30 16:33:34 -03:00
Gaspar Capello a195487fc0 Fix bounds calculation on tiles drawing outside cel bounds and the filling tile index is tile_i_notile, instead of empty tile. 2020-08-06 10:52:41 -03:00
David Capello d0c95cf46f Add possibility to paint with tiles 2020-06-25 19:21:35 -03:00
David Capello a80af2b304 Merge branch 'master' into tilemap-editor 2020-05-18 20:24:22 -03:00
David Capello 86259a64fc Replace MID() macro with base::clamp() function
In the future we will replace base::clamp() with std::clamp().
2020-04-07 19:47:16 -03:00
David Capello 615fa33188 Fix flashing selected layer for tilemaps
We've also removed the necessity to create a temporary image for the
flashing effect, so it uses less memory.
2020-02-17 09:06:02 -03:00
David Capello 472861ddd9 Fix eyedropper when picking colors from the top or left edge of a tile (in composition mode) 2020-02-17 09:06:02 -03:00
David Capello 04ffea04ee Fix eyedropper on tilemaps when zoom != 100% 2020-02-17 09:06:01 -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 51fa0d471e Fix crash generating thumbnails for certain sprites w/cels in specific positions 2019-08-29 17:51:44 -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 9a75d01efe Improve the File Selector adding new view types: list, small icons, big icons (fix #451) 2019-03-25 22:09:22 -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 2f426e3b2f Fix render_tests with indexed images 2019-03-09 12:46:05 -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 3d57184b56 Render extra/preview cels correctly on linked cels (fix #1664) 2018-02-14 13:29:03 -03:00
David Capello 1b4ffdfbe9 Fix glitch rendering background with colors w/alpha = 0 2017-07-03 19:49:13 -03:00
David Capello cbee0862f3 Add a Color Mode conversion dialog with preview 2017-05-16 17:18:55 -03:00
David Capello cc7bde6cd1 Fix some compiler warnings (implicit casts & unused vars) 2017-04-19 19:26:23 -03:00
David Capello 70f1df4d6b Avoid def variables that aren't used NDEBUG 2017-03-15 15:13:50 -03:00
David Capello 5e711690bf Fix crash with certain reference layers 2017-02-03 15:35:44 -03:00
David Capello 95da8a2441 Fix rendering artifacts when Apply Zoom is disabled and bg grid isn't aligned with pixels (fix #1349) 2016-12-28 12:28:43 -03:00
David Capello 0a68c4626d Fix rendering issues with multiples of 3 zoom factors (fix #1349) 2016-12-28 11:38:28 -03:00
David Capello 08445fbbcb Fix crash resizing reference layers 2016-12-26 13:30:14 -03:00
David Capello dfa90d15c8 Don't use general renderer when "apply zoom" is enabled
Related to #1349
2016-12-16 12:05:54 -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 4e6832782e Fix rendering issues w/ref layers 2016-11-03 12:26:33 -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 bf4d6f1e4e Ask for a file when we add a new reference layer
Also the new reference layer is added centered in the sprite and scaling
it to make it fully visible in the canvas.
2016-10-12 14:41:58 -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 0068a2024a Improve composite_image_general() performance 2016-10-11 11:27:47 -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 4a7d601d5d Add composite_image_general() as a generic (slow) image composer 2016-10-05 21:37:53 -03:00
David Capello f838b8787e Merge branch 'beta' into layer-folder 2016-07-07 12:47:42 -03:00
David Capello f2dc76a844 Fix image composition for non square pixel ratio and odd zoom levels
This new composition function is used in sprites with 1:2 or 2:1 pixel
ratios and odd zoom levels < 100% (e.g. 33%)
2016-07-07 12:27:46 -03:00
David Capello fb3873f396 Fix crash in render w/zoom < 100% for pixel ratio 1:2 or 2:1 2016-07-07 12:08:30 -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 ca3b72ee08 Merge branch 'beta' into layer-folder 2016-06-30 12:30:21 -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 58f8ed6476 Prefer LayerGroup::layers() instead of iterators 2016-06-08 16:46:15 -03:00
David Capello 2f91122c26 Rename layer folder/set -> layer group 2016-06-07 19:38:56 -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