42 Commits

Author SHA1 Message Date
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
David Capello
6814136252 render: change blend function to return the result instead of output param 2016-04-27 12:48:30 -03:00
David Capello
5f97e66a8b Include base/base.h on files that use MIN/MID/MAX 2016-03-03 19:18:46 -03:00
David Capello
a08352d4b5 Add minor ASSERT() in Render::renderLayer() to check preview image pixel format 2015-08-19 12:53:15 -03:00
David Capello
1cd551554b Fix possible ambiguous condition on Render::renderLayer() 2015-08-18 14:29:17 -03:00
David Capello
1b930d4d42 Draw document's extra cel (brush preview) in the current frame only 2015-08-12 17:24:48 -03:00
David Capello
45219abfec Fix brush preview in transparent layers
This bug was introduced bf54fd26d3f44828e044626e8ca2431899446f38
2015-08-11 19:58:39 -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
8f891a4e25 Add asserts to detect bugs adding cels w/pixel format != sprite's pixel format 2015-07-27 12:40:02 -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
318bc2e2f9 Add alpha channel to palette/color bar/color selector (issue #286) 2015-06-30 17:36:37 -03:00
David Capello
fb4b2e76c8 Add layer opacity property (fix #225) 2015-06-14 20:23:49 -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
9a6ac48bfa Fix circular dependencies between image_impl.h <-> image_iterator.h
This problem was introduced in d732f5b05f33ed1fce4c8b900a54f617bfb4c5ae

Now image_iterator.h and image_bits.h use forward declarations. And if
someone want to use the Image implementation, ImageBits, LockImageBits,
ImageIterators, or some function inside primitive_fast.h, they just have
to include image_impl.h file.
2015-06-12 13:56:18 -03:00
David Capello
4d055a7170 Rename gfx::Rect::createIntersect -> createIntersection 2015-06-09 16:22:47 -03:00
David Capello
1eb94d746d Fix red/blue onion skin for Indexed images 2015-06-08 19:58:23 -03:00
David Capello
0a1dfe0633 Merge branch 'onionskin'
Conflicts:
	src/app/ui/editor/play_state.cpp
	src/render/render.cpp
	third_party/gtest
2015-06-05 15:53:15 -03:00
David Capello
557c7854bc Fix random crash using Eyedropper with Alt+click
This was a problem related to uninitialized memory in Render class.
The Render::renderLayer() member function was accessing to an invalid
m_previewImage pointer.
2015-06-05 01:05:35 -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
827eddd459 Fix problem copying background cels in indexed images
Now index 0 is persisted in the copy.
2015-03-16 18:04:57 -03:00
David Capello
6dad428928 Remove unused variables 2015-01-21 11:22:28 -03:00
David Capello
603dde343f Replace doc::LayerImage::getCel() with doc::Layer::cel() 2014-12-28 21:04:08 -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