September 8th

Merge branch 'master' into sdl2.0
Many changes and improvements by Bill
This commit is contained in:
Pere Pujal i Carabantes 2021-09-08 00:10:35 +02:00
commit 10baa371dd
272 changed files with 54699 additions and 34028 deletions

View file

@ -8,7 +8,7 @@
Credits: Andrew Corcoran <akanewbie@gmail.com>
Copyright (c) 2002-2019 by Bill Kendrick and others; see AUTHORS.txt
Copyright (c) 2002-2021 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
@ -27,7 +27,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: August 29, 2019
Last updated: September 4, 2021
$Id$
*/
@ -114,6 +114,7 @@ float top_advc_y, right_advc_y, bottom_advc_y, left_advc_y;
enum
{
TOOL_PERSPECTIVE,
TOOL_PANELS,
TOOL_ZOOM,
perspective_NUM_TOOLS
};
@ -134,28 +135,29 @@ static Mix_Chunk *perspective_snd_effect[perspective_NUM_TOOLS + 1];
const char *perspective_snd_filenames[perspective_NUM_TOOLS + 1] = {
"perspective.ogg",
"zoom_down.ogg", /* TODO: Could use a different sound */
"zoom_up.ogg",
"zoom_down.ogg",
};
const char *perspective_icon_filenames[perspective_NUM_TOOLS] = {
"perspective.png",
"panels.png",
"zoom.png",
};
const char *perspective_names[perspective_NUM_TOOLS] = {
gettext_noop("Perspective"),
gettext_noop("Panels"),
gettext_noop("Zoom"),
};
const char *perspective_descs[perspective_NUM_TOOLS] = {
gettext_noop("Click on the corners and drag where you want to stretch the picture."),
gettext_noop("Click to turn your picture into 2-by-2 panels."),
gettext_noop("Click and drag up to zoom in or drag down to zoom out the picture."),
};
Uint32 perspective_api_version(void)
@ -358,8 +360,56 @@ void perspective_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
old_h = new_h;
}
break;
case TOOL_PANELS:
{
SDL_Surface *scaled_surf;
scaled_surf = api->scale(canvas, canvas->w / 2, canvas->h / 2, 0);
/* Top left */
update_rect->x = 0;
update_rect->y = 0;
update_rect->w = scaled_surf->w;
update_rect->h = scaled_surf->h;
SDL_BlitSurface(scaled_surf, NULL, canvas, update_rect);
/* Top right */
update_rect->x = scaled_surf->w;
update_rect->y = 0;
update_rect->w = scaled_surf->w;
update_rect->h = scaled_surf->h;
SDL_BlitSurface(scaled_surf, NULL, canvas, update_rect);
/* Bottom left */
update_rect->x = 0;
update_rect->y = scaled_surf->h;
update_rect->w = scaled_surf->w;
update_rect->h = scaled_surf->h;
SDL_BlitSurface(scaled_surf, NULL, canvas, update_rect);
/* Bottom right */
update_rect->x = scaled_surf->w;
update_rect->y = scaled_surf->h;
update_rect->w = scaled_surf->w;
update_rect->h = scaled_surf->h;
SDL_BlitSurface(scaled_surf, NULL, canvas, update_rect);
update_rect->x = 0;
update_rect->y = 0;
update_rect->w = canvas->w;
update_rect->h = canvas->h;
SDL_FreeSurface(scaled_surf);
api->playsound(perspective_snd_effect[which], 127, 255);
}
break;
}
if (which != TOOL_PANELS)
{
perspective_drag(api, which, canvas, last, x, y, x, y, update_rect);
}
perspective_drag(api, which, canvas, last, x, y, x, y, update_rect);
}
@ -482,7 +532,6 @@ void perspective_preview(magic_api * api, int which ATTRIBUTE_UNUSED,
}
}
// No setup happened:
void perspective_shutdown(magic_api * api ATTRIBUTE_UNUSED)
{
//Clean up sounds
@ -546,9 +595,13 @@ void perspective_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE
SDL_FreeSurface(canvas_back);
}
int perspective_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
int perspective_modes(magic_api * api ATTRIBUTE_UNUSED, int which)
{
return (MODE_PAINT_WITH_PREVIEW);
if (which == TOOL_PANELS) {
return (MODE_FULLSCREEN);
} else {
return (MODE_PAINT_WITH_PREVIEW);
}
}
void perspective_line(void *ptr_to_api, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,