mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-27 21:19:18 +00:00
Add "slice" ink and tool (it is not yet implemented)
This commit is contained in:
parent
9fe53de8eb
commit
0b8d88d6ee
10
data/gui.xml
10
data/gui.xml
@ -166,6 +166,7 @@
|
||||
<key tool="hand" shortcut="H" />
|
||||
<key tool="move" shortcut="V" />
|
||||
<key tool="zoom" shortcut="Z" />
|
||||
<!-- key tool="slice" shortcut="K" /-->
|
||||
|
||||
<key tool="paint_bucket" shortcut="G" />
|
||||
|
||||
@ -600,6 +601,15 @@
|
||||
ink="move"
|
||||
controller="freehand"
|
||||
/>
|
||||
<!-- tool id="slice"
|
||||
text="Slice Tool"
|
||||
fill="always"
|
||||
ink="slice"
|
||||
controller="two_points"
|
||||
pointshape="pixel"
|
||||
intertwine="as_rectangles"
|
||||
tracepolicy="last"
|
||||
/-->
|
||||
</group>
|
||||
|
||||
<group id="paint_bucket" text="Paint Bucket Tool">
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -125,6 +125,7 @@
|
||||
<tool id="hand" x="176" y="32" w="16" h="16" />
|
||||
<tool id="move" x="192" y="32" w="16" h="16" />
|
||||
<tool id="zoom" x="208" y="32" w="16" h="16" />
|
||||
<tool id="slice" x="224" y="32" w="16" h="16" />
|
||||
|
||||
<tool id="paint_bucket" x="144" y="48" w="16" h="16" />
|
||||
|
||||
|
@ -58,6 +58,9 @@ namespace app {
|
||||
// Returns true if this ink moves cels
|
||||
virtual bool isCelMovement() const { return false; }
|
||||
|
||||
// Returns true if this ink is used to mark slices
|
||||
virtual bool isSlice() const { return false; }
|
||||
|
||||
// It is called when the tool-loop start (generally when the user
|
||||
// presses a mouse button over a sprite editor)
|
||||
virtual void prepareInk(ToolLoop* loop) { }
|
||||
|
@ -135,34 +135,27 @@ public:
|
||||
|
||||
class ZoomInk : public Ink {
|
||||
public:
|
||||
|
||||
bool isZoom() const { return true; }
|
||||
|
||||
void prepareInk(ToolLoop* loop)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void inkHline(int x1, int y, int x2, ToolLoop* loop)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void prepareInk(ToolLoop* loop) { }
|
||||
void inkHline(int x1, int y, int x2, ToolLoop* loop) { }
|
||||
};
|
||||
|
||||
|
||||
class MoveInk : public Ink {
|
||||
public:
|
||||
bool isCelMovement() const { return true; }
|
||||
void prepareInk(ToolLoop* loop) { }
|
||||
void inkHline(int x1, int y, int x2, ToolLoop* loop) { }
|
||||
};
|
||||
|
||||
void prepareInk(ToolLoop* loop)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void inkHline(int x1, int y, int x2, ToolLoop* loop)
|
||||
{
|
||||
// Do nothing
|
||||
class SliceInk : public Ink {
|
||||
public:
|
||||
bool isSlice() const { return true; }
|
||||
void prepareInk(ToolLoop* loop) { }
|
||||
void inkHline(int x1, int y, int x2, ToolLoop* loop) {
|
||||
// TODO show the selection-preview with a XOR color or something like that
|
||||
draw_hline(loop->getDstImage(), x1, y, x2, loop->getPrimaryColor());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -68,6 +68,7 @@ const char* WellKnownInks::PickBg = "pick_bg";
|
||||
const char* WellKnownInks::Zoom = "zoom";
|
||||
const char* WellKnownInks::Scroll = "scroll";
|
||||
const char* WellKnownInks::Move = "move";
|
||||
const char* WellKnownInks::Slice = "slice";
|
||||
const char* WellKnownInks::Blur = "blur";
|
||||
const char* WellKnownInks::Jumble = "jumble";
|
||||
|
||||
@ -95,9 +96,10 @@ ToolBox::ToolBox()
|
||||
m_inks[WellKnownInks::ReplaceBgWithFg] = new EraserInk(EraserInk::ReplaceBgWithFg);
|
||||
m_inks[WellKnownInks::PickFg] = new PickInk(PickInk::Fg);
|
||||
m_inks[WellKnownInks::PickBg] = new PickInk(PickInk::Bg);
|
||||
m_inks[WellKnownInks::Zoom] = new ZoomInk();
|
||||
m_inks[WellKnownInks::Zoom] = new ZoomInk();
|
||||
m_inks[WellKnownInks::Scroll] = new ScrollInk();
|
||||
m_inks[WellKnownInks::Move] = new MoveInk();
|
||||
m_inks[WellKnownInks::Slice] = new SliceInk();
|
||||
m_inks[WellKnownInks::Blur] = new BlurInk();
|
||||
m_inks[WellKnownInks::Jumble] = new JumbleInk();
|
||||
|
||||
|
@ -52,6 +52,7 @@ namespace app {
|
||||
extern const char* Zoom;
|
||||
extern const char* Scroll;
|
||||
extern const char* Move;
|
||||
extern const char* Slice;
|
||||
extern const char* Blur;
|
||||
extern const char* Jumble;
|
||||
};
|
||||
|
@ -269,7 +269,8 @@ void Editor::editor_draw_cursor(int x, int y, bool refresh)
|
||||
color_t brush_color = get_brush_color(m_sprite, m_layer);
|
||||
color_t mask_color = m_sprite->getTransparentColor();
|
||||
|
||||
if (current_tool->getInk(0)->isSelection()) {
|
||||
if (current_tool->getInk(0)->isSelection() ||
|
||||
current_tool->getInk(0)->isSlice()) {
|
||||
cursor_type = CURSOR_CROSS_ONE;
|
||||
}
|
||||
else if (
|
||||
|
@ -443,6 +443,11 @@ bool StandbyState::onSetCursor(Editor* editor)
|
||||
jmouse_set_cursor(kMoveCursor);
|
||||
return true;
|
||||
}
|
||||
else if (current_ink->isSlice()) {
|
||||
jmouse_set_cursor(kNoCursor);
|
||||
editor->showDrawingCursor();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw
|
||||
|
@ -117,6 +117,7 @@ public:
|
||||
((getInk()->isSelection() ||
|
||||
getInk()->isEyedropper() ||
|
||||
getInk()->isScrollMovement() ||
|
||||
getInk()->isSlice() ||
|
||||
getInk()->isZoom()) ? undo::DoesntModifyDocument:
|
||||
undo::ModifyDocument))
|
||||
, m_expandCelCanvas(m_context, m_docSettings->getTiledMode(), m_undoTransaction)
|
||||
|
Loading…
Reference in New Issue
Block a user