mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-28 18:32:50 +00:00
Added support to lock lines in special angles with Shift key (feature request #1961397).
Fixed 'Curve' tool when click with the right mouse button (added 'editor_click_continue' routine for this).
This commit is contained in:
parent
8911db458a
commit
4026754881
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2008-09-28 David A. Capello <davidcapello@gmail.com>
|
||||
|
||||
* src/modules/tools.c: Added new Curve tool.
|
||||
(control_tool): Added support to lock lines in more
|
||||
angles (feature request #1961397).
|
||||
|
||||
2008-09-27 David A. Capello <davidcapello@gmail.com>
|
||||
|
||||
* src/widgets/colbar.c: Added support to drag & drop
|
||||
colors (feature request #2109224).
|
||||
|
||||
2008-05-06 David A. Capello <davidcapello@gmail.com>
|
||||
|
||||
* Version 0.6b2 released.
|
||||
|
10
NEWS.txt
10
NEWS.txt
@ -5,6 +5,16 @@ NEWS
|
||||
0.6
|
||||
---
|
||||
|
||||
+ Added 'Curve' tool (bezier-spline).
|
||||
+ Added support to drag and drop colors in color-bar (feature request
|
||||
feature #2109224).
|
||||
+ Added support to lock lines in special angles with the Shift key,
|
||||
useful to draw in isometric views (feature request #1961397).
|
||||
+ Fixed bugs #1958760 and #1958932.
|
||||
|
||||
0.6b2
|
||||
-----
|
||||
|
||||
+ Added the `Background' layer.
|
||||
+ Added support to load and save PNG files (through 'libpng').
|
||||
+ Transparent cel handling for the end-user (you can move a cel and
|
||||
|
@ -79,8 +79,10 @@
|
||||
<key tool="spray" shortcut="S" />
|
||||
<key tool="paint_bucket" shortcut="G" />
|
||||
<key tool="line" shortcut="L" />
|
||||
<key tool="curve" shortcut="V" />
|
||||
<key tool="curve" shortcut="L" />
|
||||
<key tool="rectangle" shortcut="U" />
|
||||
<key tool="ellipse" shortcut="O" />
|
||||
<key tool="ellipse" shortcut="U" />
|
||||
<key tool="blur" shortcut="R" />
|
||||
<key tool="jumble" shortcut="J" />
|
||||
|
@ -5,7 +5,7 @@
|
||||
\palette ase.pcx
|
||||
\image ase.pcx
|
||||
|
||||
Welcome to ASE 0.6 BETA 2
|
||||
Welcome to ASE 0.6
|
||||
|
||||
READ THIS!
|
||||
|
||||
|
@ -82,27 +82,9 @@ static void gen_gfx(void *data)
|
||||
|
||||
int init_module_graphics(void)
|
||||
{
|
||||
/* DIRS *dirs, *dir; */
|
||||
/* PALETTE pal; */
|
||||
int c;
|
||||
|
||||
/* dirs = filename_in_datadir("icons.pcx"); */
|
||||
/* for (dir=dirs; dir; dir=dir->next) { */
|
||||
/* set_color_conversion(COLORCONV_NONE); */
|
||||
/* icons_pcx = load_bitmap(dir->path, pal); */
|
||||
/* set_color_conversion(COLORCONV_TOTAL); */
|
||||
|
||||
/* if (icons_pcx) */
|
||||
/* break; */
|
||||
/* } */
|
||||
/* dirs_free(dirs); */
|
||||
|
||||
/* if (!icons_pcx) { */
|
||||
/* user_printf("Error loading icons.pcx"); */
|
||||
/* return -1; */
|
||||
/* } */
|
||||
|
||||
for(c=0; c<GFX_BITMAP_COUNT; c++)
|
||||
for (c=0; c<GFX_BITMAP_COUNT; c++)
|
||||
gfx_bmps[c] = NULL;
|
||||
|
||||
app_add_hook(APP_PALETTE_CHANGE, gen_gfx, NULL);
|
||||
@ -113,63 +95,17 @@ void exit_module_graphics(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
for(c=0; c<GFX_BITMAP_COUNT; c++)
|
||||
if(gfx_bmps[c]) {
|
||||
for (c=0; c<GFX_BITMAP_COUNT; c++)
|
||||
if (gfx_bmps[c]) {
|
||||
destroy_bitmap(gfx_bmps[c]);
|
||||
gfx_bmps[c] = NULL;
|
||||
}
|
||||
|
||||
/* if (icons_pcx) */
|
||||
/* destroy_bitmap(icons_pcx); */
|
||||
}
|
||||
|
||||
BITMAP *get_gfx(int id)
|
||||
{
|
||||
if (!gfx_bmps[id]) {
|
||||
/* if (id == GFX_TOOL_MARKER) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*0, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else if (id == GFX_TOOL_DOTS) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*1, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else if (id == GFX_TOOL_PENCIL) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*2, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else if (id == GFX_TOOL_BRUSH) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*3, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else if (id == GFX_TOOL_FLOODFILL) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*4, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else if (id == GFX_TOOL_SPRAY) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*5, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else if (id == GFX_TOOL_LINE) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*6, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else if (id == GFX_TOOL_RECTANGLE) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*7, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else if (id == GFX_TOOL_ELLIPSE) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*8, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else if (id == GFX_TOOL_CONFIGURATION) { */
|
||||
/* gfx_bmps[id] = create_bitmap(9, 9); */
|
||||
/* blit(icons_pcx, gfx_bmps[id], 9*1, 9*9, 0, 0, 9, 9); */
|
||||
/* } */
|
||||
/* else { */
|
||||
convert_data_to_bitmap(&gfx_data[id], &gfx_bmps[id]);
|
||||
/* } */
|
||||
}
|
||||
if (!gfx_bmps[id])
|
||||
convert_data_to_bitmap(&gfx_data[id], &gfx_bmps[id]);
|
||||
|
||||
return gfx_bmps[id];
|
||||
}
|
||||
@ -309,10 +245,9 @@ void simple_dotted_mode(BITMAP *bmp, int fg, int bg)
|
||||
drawing_mode(DRAW_MODE_COPY_PATTERN, pattern, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* Set/Restore sub-clip regions */
|
||||
|
||||
|
||||
typedef struct CLIP_DATA
|
||||
{
|
||||
BITMAP *bmp;
|
||||
|
@ -1025,14 +1025,14 @@ void control_tool(JWidget widget, Tool *tool,
|
||||
spray_time = ji_clock;
|
||||
old_x1 = old_y1 = old_x2 = old_y2 = 0;
|
||||
|
||||
next_pts:;
|
||||
|
||||
/* start click */
|
||||
editor_click_start(widget,
|
||||
click2 ? MODE_CLICKANDCLICK:
|
||||
MODE_CLICKANDRELEASE,
|
||||
&start_x, &start_y, &start_b);
|
||||
|
||||
next_pts:;
|
||||
|
||||
for (c=0; c<4; c++) {
|
||||
mouse_x[c] = start_x;
|
||||
mouse_y[c] = start_y;
|
||||
@ -1086,21 +1086,40 @@ next_pts:;
|
||||
if (old_key_shifts & KB_SHIFT_FLAG) {
|
||||
int dx = x2 - x1;
|
||||
int dy = y2 - y1;
|
||||
int size;
|
||||
|
||||
if (tool->flags & TOOL_SNAP_ANGLES)
|
||||
size = MAX(ABS(dx), ABS(dy));
|
||||
else
|
||||
size = MIN(ABS(dx), ABS(dy));
|
||||
|
||||
x2 = x1 + SGN(dx) * size;
|
||||
y2 = y1 + SGN(dy) * size;
|
||||
int minsize = MIN(ABS(dx), ABS(dy));
|
||||
int maxsize = MAX(ABS(dx), ABS(dy));
|
||||
|
||||
if (tool->flags & TOOL_SNAP_ANGLES) {
|
||||
if (ABS(dx) <= ABS(dy)/2)
|
||||
x2 = x1;
|
||||
else if (ABS(dy) <= ABS(dx)/2)
|
||||
double angle = 180.0 * atan((double)-dy / (double)dx) / M_PI;
|
||||
angle = ABS(angle);
|
||||
|
||||
/* snap horizontally */
|
||||
if (angle < 18.0) {
|
||||
y2 = y1;
|
||||
}
|
||||
/* snap at 26.565 */
|
||||
else if (angle < 36.0) {
|
||||
x2 = x1 + SGN(dx)*maxsize;
|
||||
y2 = y1 + SGN(dy)*maxsize/2;
|
||||
}
|
||||
/* snap at 45 */
|
||||
else if (angle < 54.0) {
|
||||
x2 = x1 + SGN(dx)*minsize;
|
||||
y2 = y1 + SGN(dy)*minsize;
|
||||
}
|
||||
/* snap at 63.435 */
|
||||
else if (angle < 72.0) {
|
||||
x2 = x1 + SGN(dx)*maxsize/2;
|
||||
y2 = y1 + SGN(dy)*maxsize;
|
||||
}
|
||||
/* snap vertically */
|
||||
else {
|
||||
x2 = x1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
x2 = x1 + SGN(dx)*minsize;
|
||||
y2 = y1 + SGN(dy)*minsize;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1182,8 +1201,8 @@ next_pts:;
|
||||
pts[3] = pts[5] = pts[7] = y1;
|
||||
break;
|
||||
case 2:
|
||||
pts[2] = x1;
|
||||
pts[3] = y1;
|
||||
pts[2] = pts[4] = x1;
|
||||
pts[3] = pts[5] = y1;
|
||||
break;
|
||||
case 3:
|
||||
pts[4] = x1;
|
||||
@ -1408,28 +1427,40 @@ next_pts:;
|
||||
/* update the state-bar */
|
||||
if (jwidget_is_visible(statusbar)) {
|
||||
if (tool->flags & TOOL_UPDATE_BOX) {
|
||||
char mode[256] = "";
|
||||
char extra[256] = "";
|
||||
|
||||
if (current_tool == tools_list[TOOL_MARKER]) {
|
||||
if (start_b & 1) {
|
||||
if (key_shifts & KB_ALT_FLAG)
|
||||
strcat(mode, _("Replace"));
|
||||
strcat(extra, _("Replace"));
|
||||
else
|
||||
strcat(mode, _("Union"));
|
||||
strcat(extra, _("Union"));
|
||||
}
|
||||
else {
|
||||
if (key_shifts & KB_ALT_FLAG)
|
||||
strcat(mode, _("Intersect"));
|
||||
strcat(extra, _("Intersect"));
|
||||
else
|
||||
strcat(mode, _("Subtract"));
|
||||
strcat(extra, _("Subtract"));
|
||||
}
|
||||
}
|
||||
else if (current_tool == tools_list[TOOL_LINE]) {
|
||||
usprintf(extra, "%s %.1f",
|
||||
_("Angle"),
|
||||
180.0 * atan2(y1-y2, x2-x1) / M_PI);
|
||||
}
|
||||
|
||||
statusbar_set_text(statusbar, 0,
|
||||
"%s %3d %3d %s %3d %3d (%s %3d %3d) %s",
|
||||
_start, x1, y1,
|
||||
_end, x2, y2,
|
||||
_size, ABS(x2-x1)+1, ABS(y2-y1)+1, mode);
|
||||
_size, ABS(x2-x1)+1, ABS(y2-y1)+1, extra);
|
||||
}
|
||||
else if (tool->flags & TOOL_4FIRST2LAST) {
|
||||
statusbar_set_text(statusbar, 0, "%s %3d %3d %s %3d %3d (%3d %3d - %3d %3d)",
|
||||
_start, pts[0], pts[1],
|
||||
_end, pts[6], pts[7],
|
||||
pts[2], pts[3],
|
||||
pts[4], pts[5]);
|
||||
}
|
||||
else {
|
||||
statusbar_set_text(statusbar, 0, "%s %3d %3d", _pos, x1, y1);
|
||||
@ -1479,7 +1510,8 @@ next_pts:;
|
||||
if ((tool->flags & TOOL_4FIRST2LAST) &&
|
||||
(curve_pts < 3)) {
|
||||
++curve_pts;
|
||||
click2 = MODE_CLICKANDCLICK;
|
||||
editor_click_continue(widget, MODE_CLICKANDCLICK,
|
||||
&start_x, &start_y);
|
||||
goto next_pts;
|
||||
}
|
||||
|
||||
|
@ -121,6 +121,7 @@ enum {
|
||||
};
|
||||
|
||||
void editor_click_start(JWidget editor, int mode, int *x, int *y, int *b);
|
||||
void editor_click_continue(JWidget editor, int mode, int *x, int *y);
|
||||
void editor_click_done(JWidget editor);
|
||||
int editor_click(JWidget editor, int *x, int *y, int *update,
|
||||
void (*scroll_callback) (int before_change));
|
||||
|
@ -65,6 +65,18 @@ void editor_click_start(JWidget widget, int mode, int *x, int *y, int *b)
|
||||
jwidget_capture_mouse(widget);
|
||||
}
|
||||
|
||||
void editor_click_continue(JWidget widget, int mode, int *x, int *y)
|
||||
{
|
||||
click_mode = mode;
|
||||
click_first = TRUE;
|
||||
|
||||
click_start_x = click_last_x = jmouse_x(0);
|
||||
click_start_y = click_last_y = jmouse_y(0);
|
||||
click_start_b = click_last_b = click_prev_last_b;
|
||||
|
||||
screen_to_editor(widget, click_start_x, click_start_y, x, y);
|
||||
}
|
||||
|
||||
void editor_click_done(JWidget widget)
|
||||
{
|
||||
jwidget_release_mouse(widget);
|
||||
|
Loading…
x
Reference in New Issue
Block a user