Add extra options to show brush preview with Eraser/Blur/etc. tools

Feature request: https://community.aseprite.org/t/6427
This commit is contained in:
David Capello 2020-08-03 12:12:52 -03:00
parent 8c0f81cbba
commit 8b6116911d
4 changed files with 29 additions and 5 deletions

View File

@ -28,6 +28,8 @@
<value id="NONE" value="0" /> <value id="NONE" value="0" />
<value id="EDGES" value="1" /> <value id="EDGES" value="1" />
<value id="FULL" value="2" /> <value id="FULL" value="2" />
<value id="FULLALL" value="3" />
<value id="FULLNEDGES" value="4" />
</enum> </enum>
<enum id="BgType"> <enum id="BgType">
<value id="CHECKED_16x16" value="0" /> <value id="CHECKED_16x16" value="0" />

View File

@ -1177,8 +1177,10 @@ simple_crosshair = Simple Crosshair
crosshair_on_sprite = Crosshair on Sprite crosshair_on_sprite = Crosshair on Sprite
brush_preview = Brush Preview: brush_preview = Brush Preview:
brush_preview_none = None brush_preview_none = None
brush_preview_edges = Brush Edges brush_preview_edges = Edges Only
brush_preview_full = Full Real-time Brush Preview brush_preview_full = Full Preview
brush_preview_fullall = Full Preview with All Tools
brush_preview_fullnedges = Full Preview and Edges
cursor_color_type = Crosshair && Brush Edges Color: cursor_color_type = Crosshair && Brush Edges Color:
cursor_neg_bw = Negative Black and White cursor_neg_bw = Negative Black and White
cursor_specific_color = Specific Color cursor_specific_color = Specific Color

View File

@ -292,6 +292,8 @@
<listitem text="@.brush_preview_none" value="0" /> <listitem text="@.brush_preview_none" value="0" />
<listitem text="@.brush_preview_edges" value="1" /> <listitem text="@.brush_preview_edges" value="1" />
<listitem text="@.brush_preview_full" value="2" /> <listitem text="@.brush_preview_full" value="2" />
<listitem text="@.brush_preview_fullall" value="3" />
<listitem text="@.brush_preview_fullnedges" value="4" />
</combobox> </combobox>
<label text="@.cursor_color_type" /> <label text="@.cursor_color_type" />

View File

@ -149,7 +149,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
(ink->isEffect()) || (ink->isEffect()) ||
// or when the brush color is transparent and we are not in the background layer // or when the brush color is transparent and we are not in the background layer
(!ink->isShading() && (!ink->isShading() &&
(layer && !layer->isBackground()) && (layer && layer->isTransparent()) &&
((sprite->pixelFormat() == IMAGE_INDEXED && brush_color == mask_index) || ((sprite->pixelFormat() == IMAGE_INDEXED && brush_color == mask_index) ||
(sprite->pixelFormat() == IMAGE_RGB && rgba_geta(brush_color) == 0) || (sprite->pixelFormat() == IMAGE_RGB && rgba_geta(brush_color) == 0) ||
(sprite->pixelFormat() == IMAGE_GRAYSCALE && graya_geta(brush_color) == 0))))) { (sprite->pixelFormat() == IMAGE_GRAYSCALE && graya_geta(brush_color) == 0))))) {
@ -160,6 +160,8 @@ void BrushPreview::show(const gfx::Point& screenPos)
} }
bool showPreview = false; bool showPreview = false;
bool showPreviewWithEdges = false;
bool cancelEdges = false;
auto brushPreview = pref.cursor.brushPreview(); auto brushPreview = pref.cursor.brushPreview();
if (!m_editor->docPref().show.brushPreview()) if (!m_editor->docPref().show.brushPreview())
brushPreview = app::gen::BrushPreview::NONE; brushPreview = app::gen::BrushPreview::NONE;
@ -172,7 +174,18 @@ void BrushPreview::show(const gfx::Point& screenPos)
m_type = BRUSH_BOUNDARIES; m_type = BRUSH_BOUNDARIES;
break; break;
case app::gen::BrushPreview::FULL: case app::gen::BrushPreview::FULL:
case app::gen::BrushPreview::FULLALL:
case app::gen::BrushPreview::FULLNEDGES:
showPreview = m_editor->getState()->requireBrushPreview(); showPreview = m_editor->getState()->requireBrushPreview();
switch (brushPreview) {
case app::gen::BrushPreview::FULLALL:
m_type = CROSSHAIR;
cancelEdges = true;
break;
case app::gen::BrushPreview::FULLNEDGES:
showPreviewWithEdges = true;
break;
}
break; break;
} }
@ -183,6 +196,8 @@ void BrushPreview::show(const gfx::Point& screenPos)
// layer) we don't show the brush preview temporally. // layer) we don't show the brush preview temporally.
if (showPreview && m_editor->isExtraCelLocked()) { if (showPreview && m_editor->isExtraCelLocked()) {
showPreview = false; showPreview = false;
showPreviewWithEdges = false;
cancelEdges = false;
m_type |= BRUSH_BOUNDARIES; m_type |= BRUSH_BOUNDARIES;
} }
@ -195,9 +210,12 @@ void BrushPreview::show(const gfx::Point& screenPos)
// For cursor type 'bounds' we have to generate cursor boundaries // For cursor type 'bounds' we have to generate cursor boundaries
if (m_type & BRUSH_BOUNDARIES) { if (m_type & BRUSH_BOUNDARIES) {
if (brush->type() != kImageBrushType) if (brush->type() != kImageBrushType)
showPreview = false; showPreview = showPreviewWithEdges;
generateBoundaries(); if (cancelEdges)
m_type &= ~BRUSH_BOUNDARIES;
} }
if (m_type & BRUSH_BOUNDARIES)
generateBoundaries();
// Draw pixel/brush preview // Draw pixel/brush preview
if (showPreview) { if (showPreview) {