From 67b05a05790ee2dfbb844c52659d08fca53466a4 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Mon, 15 Feb 2021 22:06:29 -0800 Subject: [PATCH] Slight cleanup of blind.c; new Checkerboard tool Use enums everywhere; credits/copyright clean-up. --- docs/AUTHORS.txt | 7 +- docs/CHANGES.txt | 10 +- magic/icons/checkerboard.png | Bin 0 -> 9777 bytes magic/magic-docs/en/checkerboard.txt | 6 + magic/magic-docs/en/html/checkerboard.html | 9 + magic/magic-docs/en/html/index.html | 1 + magic/magic-docs/en/index.txt | 1 + magic/magic-docs/src/magic-docs.php | 6 +- magic/sounds/checkerboard.ogg | Bin 0 -> 8024 bytes magic/src/blind.c | 17 +- magic/src/checkerboard.c | 245 +++++++++++++++++++++ 11 files changed, 288 insertions(+), 14 deletions(-) create mode 100644 magic/icons/checkerboard.png create mode 100644 magic/magic-docs/en/checkerboard.txt create mode 100644 magic/magic-docs/en/html/checkerboard.html create mode 100644 magic/sounds/checkerboard.ogg create mode 100644 magic/src/checkerboard.c diff --git a/docs/AUTHORS.txt b/docs/AUTHORS.txt index 941c853ac..45a4c67de 100644 --- a/docs/AUTHORS.txt +++ b/docs/AUTHORS.txt @@ -7,7 +7,7 @@ Various contributors (see below, and CHANGES.txt) http://www.tuxpaint.org/ -June 17, 2002 - February 10, 2021 +June 17, 2002 - February 15, 2021 $Id$ @@ -358,6 +358,11 @@ $Id$ * Cartoon * "cartoon6.wav" from http://www.grsites.com/ + * Checkerboard + * Horse gallop from + https://bigsoundbank.com/detail-0611-horse-gallop.html + Creative Commons CC0 1.0 Universal + * Clone * https://commons.wikimedia.org/wiki/File:Sheep_bleating.ogg Public domain diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 792c6bfe6..939735ff4 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -8,7 +8,7 @@ http://www.tuxpaint.org/ $Id$ -2021.February.10 (0.9.26) +2021.February.15 (0.9.26) * New Features ------------ * [WIP] Larger UI buttons @@ -21,12 +21,16 @@ $Id$ * New Magic Tools: ---------------- - * Pixels - Draws large squares, for classic computer 'pixel art' style drawings. + * Checkerboard + Cover the entire canvas with a checkboard pattern using the + current color. Drag to change the size of the squares. * Clone Clones (copies, via painting) part of a drawing to another position. + * Pixels + Draws large squares, for classic computer 'pixel art' style drawings. + * Documentation updates --------------------- * Documentation is now maintained in a separate source repository, diff --git a/magic/icons/checkerboard.png b/magic/icons/checkerboard.png new file mode 100644 index 0000000000000000000000000000000000000000..71158847437ae9aee14e9181556b99de562a3885 GIT binary patch literal 9777 zcmeHtcT|&Ew?0j(AWaYu2u*4T9fBYbdaqJMkw6j%5Wpn#t{_dCH0gpgDM}HLUKLP~ zswmQiCRI>+zX6>Y=Xbx~_uX0R-v1_RC2!6-&wlnk&)NIDdCy9?fu1@gIWsvP9v-Ep zhKdpH%7=TikrLrPH-{5U@$l$ay-m!qMonEipeCcT_Z=n< z&S1+Xo5)@d|EJq~OFIRX-;Nt@A0MS0?D@@XFBA4z292yAT5K%u?i_rbA?VZoQnR@T zacjDENg<$rx|7_$sef5bN$~q&g%zX2bBc2(zEf6=3w_m2&Q-n>ZJw)BZpU=Q$4p0; zHp12X*$?N|%)=(M#&|uO?@=UWUE8(8S2{^2J31cRlUZyTSxdJMALIrfUWR(ke6gO78F88PSUi|YW0}_XpxW3RcKLSvI_O?(sLzf0`gPDZpW4Z&HHWS~?zu?7`KAKLcbK)A9Ls0*GuwU{ z&J`UCHJ}D>1sJ%>HF zC2y9ocvCc32VFGM2rhW(Q=)(D#nQt`6D}o?n;)Y0jI%}UD8c+`b|xf(KQCRY=xJW2 zax{1@U7KNdi&jhM>8z0!uym8zq2%fO4F}1p_Y=Mpfwm5{iKdp0jhLZ#iC67Bs22Qo zY1A$wXARX@QJb23Ju*W*l|2rKG{3!z3^L{41&W_l@4KfNjovB9@c86bGkzh@y)B$K z!}rb8f{f!hNxRG!$0IvgcD;?2^Dg;V>%A`Kf~4q%HwDb;RSzc~q^_pxkUz=BY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>4y6I^yE&r99>=6Uj>jm-I8QAPczTh&DGTj2}l1`nBNoS|AYI*{%2DDC-Yxn zKdhBqT)l8bYme3UaQ?UM{{`>|gAURb?u>EyccK3Z`60_M_Z?i!Kl*U@Gu-VF^vC`2 zXIh+A&i~=-XS)3#dcaZtwAvg;qY{+0rN3;a)Z{jbSI{^t`m z+!^;n&ja`Tyrkgoi+lDau+dgm!8-|!>1oEb$XqonFnD+rG^cO;0NCv~Tqg-uQ&*K_ zj)0n&TD1A1Rt@g(V^C8?$wZ^G^nIfvy&?U%^~tX*BixYy!LYErkf@VDYhFS7qE%F> z(2;hB8g)qtr#(a~oINAtE@>;|uBt#dzDN5z|6X(0O^K_O*Wi7E!aZXi^W(K^W5#iN zbQhVO>(<5&2NH+CUK96ytUld&OPQ8=wX2XJH{wCwadbyl6X5|ZA(<9w+6NWpkC^F;~nStNdEI&Ps3iS1oFj@0vE_%HjFy8`?L6Zxp!{x}PV1g49_8P}?n(csb*e|E1)t^<+;6FQN8xTrRf;zZ=?iE0lyt!5!Wbq9o%Yt?moj zT7on#)@1Pa6bnb^iokegp47=8_k)77+wtO--B)|fQUs)&7Qw}Kovazt4^QlT;msK} zuD45A7x + + This covers the entire canvas with a checkboard pattern using the current + color. Drag to change the size of the squares. diff --git a/magic/magic-docs/en/html/checkerboard.html b/magic/magic-docs/en/html/checkerboard.html new file mode 100644 index 000000000..c50146ba9 --- /dev/null +++ b/magic/magic-docs/en/html/checkerboard.html @@ -0,0 +1,9 @@ + +Tux Paint "Magic" Tool: Checkerboard + + + +

Tux Paint "Magic" Tool: Checkerboard

+

By Bill Kendrick <bill@newbreedsoftware.com>

+

This covers the entire canvas with a checkboard pattern using the current color. Drag to change the size of the squares.

+ \ No newline at end of file diff --git a/magic/magic-docs/en/html/index.html b/magic/magic-docs/en/html/index.html index 08ea33072..ed77bc230 100644 --- a/magic/magic-docs/en/html/index.html +++ b/magic/magic-docs/en/html/index.html @@ -11,6 +11,7 @@
  • Calligraphy
  • Cartoon
  • Chalk
  • +
  • Checkerboard
  • Clone
  • Color and White
  • Color Shift
  • diff --git a/magic/magic-docs/en/index.txt b/magic/magic-docs/en/index.txt index 0d017e19c..667124e6b 100644 --- a/magic/magic-docs/en/index.txt +++ b/magic/magic-docs/en/index.txt @@ -7,6 +7,7 @@ * Calligraphy * Cartoon * Chalk + * Checkerboard * Clone * Color and White * Color Shift diff --git a/magic/magic-docs/src/magic-docs.php b/magic/magic-docs/src/magic-docs.php index ec6b237f3..2904c7b98 100644 --- a/magic/magic-docs/src/magic-docs.php +++ b/magic/magic-docs/src/magic-docs.php @@ -5,7 +5,7 @@ individual HTML files for each of them, and an index.html that links to them all. */ /* Bill Kendrick */ -/* Oct. 8, 2009 - January 10, 2020 */ +/* Oct. 8, 2009 - February 15, 2020 */ /* Authors of the Magic tools: */ @@ -80,6 +80,10 @@ $tools = array( 'desc'=>'This makes parts of the picture (where you move the mouse) look like a chalk drawing.', 'author'=>$AUTHOR_KENDRICK), + array('name'=>'Checkerboard', + 'desc'=>'This covers the entire canvas with a checkboard pattern using the current color. Drag to change the size of the squares.', + 'author'=>$AUTHOR_KENDRICK), + array('name'=>'Clone', 'desc'=>'Clone (copy, via painting) part of the picture. Click ones to choose the source, then click and drag to clone it elsewhere in the drawing. Once you release, click to choose another source and start again.', 'author'=>$AUTHOR_KENDRICK), diff --git a/magic/sounds/checkerboard.ogg b/magic/sounds/checkerboard.ogg new file mode 100644 index 0000000000000000000000000000000000000000..587dccf6f977eb32aa2b6e5eef7c3b71c8759a1e GIT binary patch literal 8024 zcmaiX2|U!@_y1?Ij&)*)Y-5YDl(A)mED3{R7|WpSJ7p)7vL;&$F-FiK_$=lOo0|M&NMeSi0L=g$4ybMHC#obx{Cb3W%iJS>1iz+Y{x(437n z^)E~4fCxiEF9kY#1<@8DF%M{eU<-rn|FuER(@y@Y(N5ARVP~`DVETXle{GQNfRPGF zxAD5{dHj5!2g29O*=nCX!U&bpcE7&5$G_7RK$a@U!!6%g#ScvvIr&f+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QF!(4sw$s21?5RBK9|R8@8PtT9my@8a_i;y?lz5z{BLPhG_}7 znC2@*sO5URzoI>vq5Dg&>HNKPk)5k2x24%zAKV&-uW5W(V*oniN$v8aD_+XyEBMnN zx-vR$6_W<=0xYjw@L$=w9ItI{q|6_?*fPJ{?%sBxt*4vsx{`^gIZFhC%8Bd-yyew72RW^y!M+kvH{}QxpJ&uR95E7~;Og_xRwjDxMU)uCS21$U zw8*nw(zqrr-Up#yCJgBpJcb?NcrwC0U)JXZ5*y^4kWJU4%b{J`J#*9 zsg2ee=Ux3a@u&6L35VN!lU{zbN&`!ZH>Hf)bWs?*lD`hy+Atc+js09U!zOQYCWp< LEwOm7_R#+W>Z9e$ literal 0 HcmV?d00001 diff --git a/magic/src/blind.c b/magic/src/blind.c index 1cf01857a..9ca509699 100644 --- a/magic/src/blind.c +++ b/magic/src/blind.c @@ -1,13 +1,12 @@ /* blind.c -// + BLIND Magic Tools Plugin Tux Paint - A simple drawing program for children. By Pere Pujal Carabantes - Copyright (c) 2002-2009 by Bill Kendrick and others; see AUTHORS.txt - bill@newbreedsoftware.com + Copyright (c) 2009-2021 http://www.tuxpaint.org/ This program is free software; you can redistribute it and/or modify @@ -275,20 +274,20 @@ void blind_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED, { if (x < y) - blind_side = 1; /* left */ + blind_side = BLIND_SIDE_LEFT; else if (canvas->w - x < y) - blind_side = 3; /* right */ + blind_side = BLIND_SIDE_RIGHT; else - blind_side = 0; /* top */ + blind_side = BLIND_SIDE_TOP; } else { if (x < canvas->h - y) - blind_side = 1; /* left */ + blind_side = BLIND_SIDE_LEFT; else if (canvas->w - x < canvas->h - y) - blind_side = 3; /* right */ + blind_side = BLIND_SIDE_RIGHT; else - blind_side = 2; /* bottom */ + blind_side = BLIND_SIDE_BOTTOM; } blind_drag(api, which, canvas, last, x, y, x, y, update_rect); diff --git a/magic/src/checkerboard.c b/magic/src/checkerboard.c new file mode 100644 index 000000000..692fbae4d --- /dev/null +++ b/magic/src/checkerboard.c @@ -0,0 +1,245 @@ +/* + checkeroard.c + + "Checkerboard" Magic Tools Plugin + Tux Paint - A simple drawing program for children. + + By Bill Kendrick + Based on `blind.c` by Pere Pujal Carabantes + + Copyright (c) 2021 + http://www.tuxpaint.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + (See COPYING.txt) +*/ + +#include "tp_magic_api.h" +#include "SDL_image.h" +#include "SDL_mixer.h" + +static Uint8 checkerboard_r, checkerboard_g, checkerboard_b; +int checkerboard_start_x, checkerboard_start_y; + +Mix_Chunk *checkerboard_snd; + +// Prototypes +Uint32 checkerboard_api_version(void); +void checkerboard_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b); +int checkerboard_init(magic_api * api); +int checkerboard_get_tool_count(magic_api * api); +SDL_Surface *checkerboard_get_icon(magic_api * api, int which); +char *checkerboard_get_name(magic_api * api, int which); +char *checkerboard_get_description(magic_api * api, int which, int mode); +int checkerboard_requires_colors(magic_api * api, int which); +void checkerboard_release(magic_api * api, int which, + SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect); +void checkerboard_shutdown(magic_api * api); +void checkerboard_paint_checkerboard(void *ptr_to_api, int which_tool, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y); +void checkerboard_drag(magic_api * api, int which, SDL_Surface * canvas, + SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect); +void checkerboard_click(magic_api * api, int which, int mode, + SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect); +void checkerboard_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas); +void checkerboard_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas); +int checkerboard_modes(magic_api * api, int which); + +// Housekeeping functions + +Uint32 checkerboard_api_version(void) +{ + return (TP_MAGIC_API_VERSION); +} + +void checkerboard_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure +{ + checkerboard_r = r; + checkerboard_g = g; + checkerboard_b = b; +} + +int checkerboard_init(magic_api * api) +{ + char fname[1024]; + + snprintf(fname, sizeof(fname), "%s/sounds/magic/checkerboard.ogg", api->data_directory); + checkerboard_snd = Mix_LoadWAV(fname); + + return (1); +} + +int checkerboard_get_tool_count(magic_api * api ATTRIBUTE_UNUSED) +{ + return 1; +} + +SDL_Surface *checkerboard_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED) +{ + char fname[1024]; + + snprintf(fname, sizeof(fname), "%s/images/magic/checkerboard.png", api->data_directory); + + return (IMG_Load(fname)); +} + +char *checkerboard_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return strdup(gettext_noop("Checkerboard")); +} + +char *checkerboard_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) +{ + return + strdup(gettext_noop + ("Click and drag to fill the canvas with a checkerboard pattern.")); +} + +int checkerboard_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return 1; +} + +void checkerboard_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, + SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED, + int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED) +{ +} + +void checkerboard_shutdown(magic_api * api ATTRIBUTE_UNUSED) +{ + Mix_FreeChunk(checkerboard_snd); +} + +// Interactivity functions + +void checkerboard_drag(magic_api * api, int which, SDL_Surface * canvas, + SDL_Surface * snapshot, + int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, + int x, int y, SDL_Rect * update_rect) +{ + int sz, xx, yy; + Uint8 draw_start, draw_row, draw_cell; + Uint32 colr; + SDL_Rect dest; + + SDL_BlitSurface(snapshot, NULL, canvas, NULL); + + sz = max(10, max(abs(x - checkerboard_start_x), abs(y - checkerboard_start_y))); + + colr = SDL_MapRGB(canvas->format, checkerboard_r, checkerboard_g, checkerboard_b); + + draw_start = 1; + if (x < checkerboard_start_x) + draw_start = !draw_start; + if (y < checkerboard_start_y) + draw_start = !draw_start; + + /* From the mouse Y position down... */ + draw_row = draw_start; + for (yy = checkerboard_start_y; yy <= canvas->h; yy += sz) { + /* From the mouse X position right... */ + draw_cell = draw_row; + for (xx = checkerboard_start_x; xx <= canvas->w; xx += sz) { + if (draw_cell) { + dest.x = xx; + dest.y = yy; + dest.w = sz; + dest.h = sz; + SDL_FillRect(canvas, &dest, colr); + } + draw_cell = !draw_cell; + } + + /* From the mouse X position left... */ + draw_cell = !draw_row; + for (xx = checkerboard_start_x - sz; xx > -sz; xx -= sz) { + if (draw_cell) { + dest.x = xx; + dest.y = yy; + dest.w = sz; + dest.h = sz; + SDL_FillRect(canvas, &dest, colr); + } + draw_cell = !draw_cell; + } + + draw_row = !draw_row; + } + + /* From the mouse Y position up... */ + draw_row = !draw_start; + for (yy = checkerboard_start_y - sz; yy > -sz; yy -= sz) { + /* From the mouse X position right... */ + draw_cell = draw_row; + for (xx = checkerboard_start_x; xx <= canvas->w; xx += sz) { + if (draw_cell) { + dest.x = xx; + dest.y = yy; + dest.w = sz; + dest.h = sz; + SDL_FillRect(canvas, &dest, colr); + } + draw_cell = !draw_cell; + } + + /* From the mouse X position left... */ + draw_cell = !draw_row; + for (xx = checkerboard_start_x - sz; xx > -sz; xx -= sz) { + if (draw_cell) { + dest.x = xx; + dest.y = yy; + dest.w = sz; + dest.h = sz; + SDL_FillRect(canvas, &dest, colr); + } + draw_cell = !draw_cell; + } + + draw_row = !draw_row; + } + + /* Always applies to the whole screen! */ + update_rect->x = 0; + update_rect->y = 0; + update_rect->w = canvas->w; + update_rect->h = canvas->h; + + api->playsound(checkerboard_snd, 128, 255); +} + +void checkerboard_click(magic_api * api, int which, int mode, + SDL_Surface * canvas, SDL_Surface * last, + int x, int y, + SDL_Rect * update_rect) +{ + checkerboard_start_x = x; + checkerboard_start_y = y; + checkerboard_drag(api, which, canvas, last, x, y, x, y, update_rect); +} + +void checkerboard_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, + SDL_Surface * canvas ATTRIBUTE_UNUSED) +{ +} + +void checkerboard_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, + SDL_Surface * canvas ATTRIBUTE_UNUSED) +{ +} + +int checkerboard_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) +{ + return (MODE_PAINT); +}