Resync docs to get is_IS tp_magic_example.c

This commit is contained in:
Bill Kendrick 2023-06-29 17:35:23 -07:00
parent 9ca2bcb8e5
commit 81cf486d4d
6 changed files with 80 additions and 80 deletions

View file

@ -1,7 +1,7 @@
/* tp_magic_example.c
An example of a "Magic" tool plugin for Tux Paint
13 de Abril de 2023
Abril 13, 2023
*/

View file

@ -1,7 +1,7 @@
/* tp_magic_example.c
An example of a "Magic" tool plugin for Tux Paint
13 de Abril de 2023
Abril 13, 2023
*/

View file

@ -1,7 +1,7 @@
/* tp_magic_example.c
An example of a "Magic" tool plugin for Tux Paint
apríl 13, 2023
13. apríl 2023
*/
@ -9,8 +9,8 @@
/* ---------------------------------------------------------------------- */
#include <stdio.h>
#include <string.h> // For "strdup()"
#include <libintl.h> // For "gettext()"
#include <string.h> // Fyrir "strdup()"
#include <libintl.h> // Fyrir "gettext()"
#include "tp_magic_api.h" // Tux Paint "Magic" tool API header
#include "SDL_image.h" // For IMG_Load(), to load our PNG icon
@ -87,7 +87,7 @@ selected in Tux Paint (for tool 1): */
Uint8 example_r, example_g, example_b;
/* The size the user has selected in Tux Paint (for tool 2): */
Uint8 example_size;
Uint8 example_stærð;
/* Our local function prototypes: */
@ -101,11 +101,11 @@ _before_ them.
*/
void example_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int old_x, int old_y, int x, int y,
SDL_Surface * skjámynd, int old_x, int old_y, int x, int y,
SDL_Rect * update_rect);
void example_line_callback(void *pointer, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int x, int y);
SDL_Surface * skjámynd, int x, int y);
/* Setup Functions: */
@ -129,7 +129,7 @@ Uint32 example_api_version(void)
/*
Initialization
Frumstilling
This happens once, when Tux Paint starts up and is loading all of the
'Magic' tool plugins. (Assuming what we returned from api_version was
@ -281,7 +281,7 @@ Report our 'Magic' tool descriptions
When Tux Paint is starting up and loading plugins, it asks us to provide
descriptions of each 'Magic' tool.
*/
char *example_get_description(magic_api * api, int which, int mode)
char *example_get_description(magic_api * api, int which, int hamur)
{
const char *our_desc_english;
const char *our_desc_localized;
@ -340,7 +340,7 @@ int example_modes(magic_api * api, int which)
// Report whether the tools offer sizing options
Uint8 example_accepted_sizes(magic_api * api, int which, int mode)
Uint8 example_accepted_sizes(magic_api * api, int which, int hamur)
{
if (which == TOOL_ONE)
return 1;
@ -351,14 +351,14 @@ Uint8 example_accepted_sizes(magic_api * api, int which, int mode)
// Return our default sizing option
Uint8 example_default_size(magic_api * api, int which, int mode)
Uint8 example_default_size(magic_api * api, int which, int hamur)
{
return 1;
}
/*
Shut down
Slökkva
Tux Paint is quitting. When it quits, it asks all of the plugins to 'clean
up' after themselves. We, for example, loaded some sound effects at
@ -384,8 +384,8 @@ void example_shutdown(magic_api * api)
/* Affect the canvas on click: */
void
example_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y,
example_click(magic_api * api, int which, int hamur,
SDL_Surface * canvas, SDL_Surface * skjámynd, int x, int y,
SDL_Rect * update_rect)
{
/*
@ -397,14 +397,14 @@ example_click(magic_api * api, int which, int mode,
both the beginning and end points of a line.
*/
example_drag(api, which, canvas, snapshot, x, y, x, y, update_rect);
example_drag(api, which, canvas, skjámynd, x, y, x, y, update_rect);
}
/* Affect the canvas on drag: */
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
SDL_Surface * canvas, SDL_Surface * skjámynd,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
{
@ -417,15 +417,15 @@ example_drag(magic_api * api, int which,
coordinates along the line, as well as other useful things (which of our
'Magic' tools is being used and the current and snapshot canvases).
*/
SDL_LockSurface(snapshot);
SDL_LockSurface(skjámynd);
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
api->line((void *) api, which, canvas, skjámynd,
old_x, old_y, x, y, 1,
example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
SDL_UnlockSurface(skjámynd);
/*
If we need to, swap the X and/or Y values, so that the coordinates
@ -436,17 +436,17 @@ example_drag(magic_api * api, int which,
if (old_x > x)
{
int temp = old_x;
int bráðabirgða = old_x;
old_x = x;
x = temp;
x = bráðabirgða;
}
if (old_y > y)
{
int temp = old_y;
int bráðabirgða = old_y;
old_y = y;
y = temp;
y = bráðabirgða;
}
@ -462,10 +462,10 @@ example_drag(magic_api * api, int which,
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
update_rect->h = (y + example_size) - update_rect->y + 1;
update_rect->x = old_x - example_stærð;
update_rect->y = old_y - example_stærð;
update_rect->w = (x + example_stærð) - update_rect->x + 1;
update_rect->h = (y + example_stærð) - update_rect->y + 1;
}
/*
@ -480,7 +480,7 @@ example_drag(magic_api * api, int which,
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
(x * 255) / canvas->w, /* vinstri/hægri hliðrun */
255 /* Near/far distance (loudness) */);
}
@ -489,7 +489,7 @@ example_drag(magic_api * api, int which,
void
example_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y,
SDL_Surface * canvas, SDL_Surface * skjámynd, int x, int y,
SDL_Rect * update_rect)
{
/*
@ -511,7 +511,7 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * skjámynd, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -536,7 +536,7 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * skjámynd, Uint8 stærð, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of
@ -565,7 +565,7 @@ Our callback pays attention to 'which' to determine which of our plugin's
tools is currently selected.
*/
void example_line_callback(void *pointer, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int x, int y)
SDL_Surface * skjámynd, int x, int y)
{
/*
For technical reasons, we can't accept a pointer to the Tux Paint API's
@ -611,14 +611,14 @@ void example_line_callback(void *pointer, int which, SDL_Surface * canvas,
from the opposite side of the canvas and puts it under the cursor.
*/
for (yy = -example_size; yy < example_size; yy++)
for (yy = -example_stærð; yy < example_stærð; yy++)
{
for (xx = -example_size; xx < example_size; xx++)
for (xx = -example_stærð; xx < example_stærð; xx++)
{
api->putpixel(canvas, x + xx, y + yy,
api->getpixel(snapshot,
snapshot->w - x - xx,
snapshot->h - y - yy));
api->getpixel(skjámynd,
skjámynd->w - x - xx,
skjámynd->h - y - yy));
/*
Here we have simply use Tux Paint's "getpixel()" routine to pull pixel
@ -650,7 +650,7 @@ call to 'example_switchout()', below, for the old mode).
Our example doesn't do anything when we switch to, or away from, our Magic
tools, so we just do nothing here.
*/
void example_switchin(magic_api * api, int which, int mode,
void example_switchin(magic_api * api, int which, int hamur,
SDL_Surface * canvas)
{
}
@ -674,7 +674,7 @@ call to 'example_switchin()', above, for the new mode).
Our example doesn't do anything when we switch to, or away from, our Magic
tools, so we just do nothing here.
*/
void example_switchout(magic_api * api, int which, int mode,
void example_switchout(magic_api * api, int which, int hamur,
SDL_Surface * canvas)
{
}

View file

@ -1,7 +1,7 @@
/* tp_magic_example.c
An example of a "Magic" tool plugin for Tux Paint
apríl 13, 2023
13. apríl 2023
*/
@ -9,8 +9,8 @@
/* ---------------------------------------------------------------------- */
#include <stdio.h>
#include <string.h> // For "strdup()"
#include <libintl.h> // For "gettext()"
#include <string.h> // Fyrir "strdup()"
#include <libintl.h> // Fyrir "gettext()"
#include "tp_magic_api.h" // Tux Paint "Magic" tool API header
#include "SDL_image.h" // For IMG_Load(), to load our PNG icon
@ -87,7 +87,7 @@ selected in Tux Paint (for tool 1): */
Uint8 example_r, example_g, example_b;
/* The size the user has selected in Tux Paint (for tool 2): */
Uint8 example_size;
Uint8 example_stærð;
/* Our local function prototypes: */
@ -101,11 +101,11 @@ _before_ them.
*/
void example_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int old_x, int old_y, int x, int y,
SDL_Surface * skjámynd, int old_x, int old_y, int x, int y,
SDL_Rect * update_rect);
void example_line_callback(void *pointer, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int x, int y);
SDL_Surface * skjámynd, int x, int y);
/* Setup Functions: */
@ -129,7 +129,7 @@ Uint32 example_api_version(void)
/*
Initialization
Frumstilling
This happens once, when Tux Paint starts up and is loading all of the
'Magic' tool plugins. (Assuming what we returned from api_version was
@ -281,7 +281,7 @@ Report our 'Magic' tool descriptions
When Tux Paint is starting up and loading plugins, it asks us to provide
descriptions of each 'Magic' tool.
*/
char *example_get_description(magic_api * api, int which, int mode)
char *example_get_description(magic_api * api, int which, int hamur)
{
const char *our_desc_english;
const char *our_desc_localized;
@ -340,7 +340,7 @@ int example_modes(magic_api * api, int which)
// Report whether the tools offer sizing options
Uint8 example_accepted_sizes(magic_api * api, int which, int mode)
Uint8 example_accepted_sizes(magic_api * api, int which, int hamur)
{
if (which == TOOL_ONE)
return 1;
@ -351,14 +351,14 @@ Uint8 example_accepted_sizes(magic_api * api, int which, int mode)
// Return our default sizing option
Uint8 example_default_size(magic_api * api, int which, int mode)
Uint8 example_default_size(magic_api * api, int which, int hamur)
{
return 1;
}
/*
Shut down
Slökkva
Tux Paint is quitting. When it quits, it asks all of the plugins to 'clean
up' after themselves. We, for example, loaded some sound effects at
@ -384,8 +384,8 @@ void example_shutdown(magic_api * api)
/* Affect the canvas on click: */
void
example_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y,
example_click(magic_api * api, int which, int hamur,
SDL_Surface * canvas, SDL_Surface * skjámynd, int x, int y,
SDL_Rect * update_rect)
{
/*
@ -397,14 +397,14 @@ example_click(magic_api * api, int which, int mode,
both the beginning and end points of a line.
*/
example_drag(api, which, canvas, snapshot, x, y, x, y, update_rect);
example_drag(api, which, canvas, skjámynd, x, y, x, y, update_rect);
}
/* Affect the canvas on drag: */
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
SDL_Surface * canvas, SDL_Surface * skjámynd,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
{
@ -417,15 +417,15 @@ example_drag(magic_api * api, int which,
coordinates along the line, as well as other useful things (which of our
'Magic' tools is being used and the current and snapshot canvases).
*/
SDL_LockSurface(snapshot);
SDL_LockSurface(skjámynd);
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
api->line((void *) api, which, canvas, skjámynd,
old_x, old_y, x, y, 1,
example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
SDL_UnlockSurface(skjámynd);
/*
If we need to, swap the X and/or Y values, so that the coordinates
@ -436,17 +436,17 @@ example_drag(magic_api * api, int which,
if (old_x > x)
{
int temp = old_x;
int bráðabirgða = old_x;
old_x = x;
x = temp;
x = bráðabirgða;
}
if (old_y > y)
{
int temp = old_y;
int bráðabirgða = old_y;
old_y = y;
y = temp;
y = bráðabirgða;
}
@ -462,10 +462,10 @@ example_drag(magic_api * api, int which,
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
update_rect->h = (y + example_size) - update_rect->y + 1;
update_rect->x = old_x - example_stærð;
update_rect->y = old_y - example_stærð;
update_rect->w = (x + example_stærð) - update_rect->x + 1;
update_rect->h = (y + example_stærð) - update_rect->y + 1;
}
/*
@ -480,7 +480,7 @@ example_drag(magic_api * api, int which,
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
(x * 255) / canvas->w, /* vinstri/hægri hliðrun */
255 /* Near/far distance (loudness) */);
}
@ -489,7 +489,7 @@ example_drag(magic_api * api, int which,
void
example_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y,
SDL_Surface * canvas, SDL_Surface * skjámynd, int x, int y,
SDL_Rect * update_rect)
{
/*
@ -511,7 +511,7 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * skjámynd, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -536,7 +536,7 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * skjámynd, Uint8 stærð, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of
@ -565,7 +565,7 @@ Our callback pays attention to 'which' to determine which of our plugin's
tools is currently selected.
*/
void example_line_callback(void *pointer, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int x, int y)
SDL_Surface * skjámynd, int x, int y)
{
/*
For technical reasons, we can't accept a pointer to the Tux Paint API's
@ -611,14 +611,14 @@ void example_line_callback(void *pointer, int which, SDL_Surface * canvas,
from the opposite side of the canvas and puts it under the cursor.
*/
for (yy = -example_size; yy < example_size; yy++)
for (yy = -example_stærð; yy < example_stærð; yy++)
{
for (xx = -example_size; xx < example_size; xx++)
for (xx = -example_stærð; xx < example_stærð; xx++)
{
api->putpixel(canvas, x + xx, y + yy,
api->getpixel(snapshot,
snapshot->w - x - xx,
snapshot->h - y - yy));
api->getpixel(skjámynd,
skjámynd->w - x - xx,
skjámynd->h - y - yy));
/*
Here we have simply use Tux Paint's "getpixel()" routine to pull pixel
@ -650,7 +650,7 @@ call to 'example_switchout()', below, for the old mode).
Our example doesn't do anything when we switch to, or away from, our Magic
tools, so we just do nothing here.
*/
void example_switchin(magic_api * api, int which, int mode,
void example_switchin(magic_api * api, int which, int hamur,
SDL_Surface * canvas)
{
}
@ -674,7 +674,7 @@ call to 'example_switchin()', above, for the new mode).
Our example doesn't do anything when we switch to, or away from, our Magic
tools, so we just do nothing here.
*/
void example_switchout(magic_api * api, int which, int mode,
void example_switchout(magic_api * api, int which, int hamur,
SDL_Surface * canvas)
{
}

View file

@ -1,7 +1,7 @@
/* tp_magic_example.c
An example of a "Magic" tool plugin for Tux Paint
2023413
4 13, 2023
*/

View file

@ -1,7 +1,7 @@
/* tp_magic_example.c
An example of a "Magic" tool plugin for Tux Paint
2023413
4 13, 2023
*/