Removing warnings in half of magic tools by some GCI students.
This commit is contained in:
parent
5a85cef991
commit
0a2072e334
24 changed files with 924 additions and 377 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
alien.c
|
||||
|
||||
//
|
||||
alien, Modifies the colours of the image.
|
||||
Tux Paint - A simple drawing program for children.
|
||||
|
||||
|
|
@ -68,6 +68,31 @@ const char * alien_descs[alien_NUM_TOOLS][2] = {
|
|||
gettext_noop("Click to change the colors in your entire picture."),},
|
||||
};
|
||||
|
||||
// Prototypes
|
||||
Uint32 alien_api_version(void);
|
||||
int alien_init(magic_api * api);
|
||||
int alien_get_tool_count(magic_api * api);
|
||||
SDL_Surface * alien_get_icon(magic_api * api, int which);
|
||||
char * alien_get_name(magic_api * api, int which);
|
||||
char * alien_get_description(magic_api * api, int which, int mode);
|
||||
void alien_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
Mix_Chunk * magic_loadsound(char* file);
|
||||
void alien_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void alien_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void alien_shutdown(magic_api * api);
|
||||
void alien_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int alien_requires_colors(magic_api * api, int which);
|
||||
void alien_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void alien_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int alien_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
Uint32 alien_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
//Load sounds
|
||||
|
|
@ -84,7 +109,7 @@ int alien_init(magic_api * api){
|
|||
return(1);
|
||||
}
|
||||
|
||||
int alien_get_tool_count(magic_api * api){
|
||||
int alien_get_tool_count(magic_api * api ATTRIBUTE_UNUSED){
|
||||
return(alien_NUM_TOOLS);
|
||||
}
|
||||
|
||||
|
|
@ -96,18 +121,18 @@ SDL_Surface * alien_get_icon(magic_api * api, int which){
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * alien_get_name(magic_api * api, int which){
|
||||
char * alien_get_name(magic_api * api ATTRIBUTE_UNUSED, int which){
|
||||
return(strdup(gettext_noop(alien_names[which])));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * alien_get_description(magic_api * api, int which, int mode){
|
||||
char * alien_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode){
|
||||
return(strdup(gettext_noop(alien_descs[which][mode-1])));
|
||||
}
|
||||
|
||||
//Do the effect for one pixel
|
||||
static void do_alien_pixel(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_alien_pixel(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y){
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
||||
|
|
@ -202,14 +227,14 @@ void alien_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void alien_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void alien_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void alien_shutdown(magic_api * api)
|
||||
void alien_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
//Clean up sounds
|
||||
int i;
|
||||
|
|
@ -221,25 +246,25 @@ void alien_shutdown(magic_api * api)
|
|||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void alien_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void alien_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int alien_requires_colors(magic_api * api, int which)
|
||||
int alien_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void alien_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void alien_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void alien_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void alien_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int alien_modes(magic_api * api, int which)
|
||||
int alien_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_FULLSCREEN|MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
blind.c
|
||||
|
||||
//
|
||||
BLIND Magic Tools Plugin
|
||||
Tux Paint - A simple drawing program for children.
|
||||
|
||||
|
|
@ -48,6 +48,31 @@ enum blind_tools{
|
|||
|
||||
Mix_Chunk * blind_snd;
|
||||
|
||||
// Prototypes
|
||||
Uint32 blind_api_version(void);
|
||||
void blind_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int blind_init(magic_api * api);
|
||||
int blind_get_tool_count(magic_api * api);
|
||||
SDL_Surface * blind_get_icon(magic_api * api, int which);
|
||||
char * blind_get_name(magic_api * api, int which);
|
||||
char * blind_get_description(magic_api * api, int which, int mode);
|
||||
int blind_requires_colors(magic_api * api, int which);
|
||||
void blind_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void blind_shutdown(magic_api * api);
|
||||
void blind_paint_blind(void * ptr_to_api, int which_tool,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
||||
void blind_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 blind_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void blind_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void blind_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int blind_modes(magic_api * api, int which);
|
||||
|
||||
// Housekeeping functions
|
||||
|
||||
Uint32 blind_api_version(void)
|
||||
|
|
@ -55,7 +80,7 @@ Uint32 blind_api_version(void)
|
|||
return(TP_MAGIC_API_VERSION);
|
||||
}
|
||||
|
||||
void blind_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure
|
||||
void blind_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure
|
||||
{
|
||||
blind_r = r;
|
||||
blind_g = g;
|
||||
|
|
@ -72,12 +97,12 @@ int blind_init(magic_api * api)
|
|||
return(1);
|
||||
}
|
||||
|
||||
int blind_get_tool_count(magic_api * api)
|
||||
int blind_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return BLIND_NUMTOOLS;
|
||||
}
|
||||
|
||||
SDL_Surface * blind_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * blind_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -87,36 +112,36 @@ SDL_Surface * blind_get_icon(magic_api * api, int which)
|
|||
return(IMG_Load(fname));
|
||||
}
|
||||
|
||||
char * blind_get_name(magic_api * api, int which)
|
||||
char * blind_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return strdup(gettext_noop("Blind"));
|
||||
}
|
||||
|
||||
char * blind_get_description(magic_api * api, int which, int mode)
|
||||
char * blind_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return strdup(gettext_noop("Click towards the edge of your picture to pull window blinds over it. Move perpendicularly to open or close the blinds."));
|
||||
}
|
||||
|
||||
int blind_requires_colors(magic_api * api, int which)
|
||||
int blind_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void blind_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void blind_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 blind_shutdown(magic_api * api)
|
||||
void blind_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
Mix_FreeChunk(blind_snd);
|
||||
}
|
||||
|
||||
// Interactivity functions
|
||||
|
||||
void blind_paint_blind(void * ptr_to_api, int which_tool,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y)
|
||||
void blind_paint_blind(void * ptr_to_api, int which_tool ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr_to_api;
|
||||
|
||||
|
|
@ -240,7 +265,7 @@ void blind_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
}
|
||||
|
||||
void blind_click(magic_api * api, int which, int mode,
|
||||
void blind_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -261,17 +286,17 @@ void blind_click(magic_api * api, int which, int mode,
|
|||
blind_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
||||
void blind_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void blind_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void blind_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void blind_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int blind_modes(magic_api * api, int which)
|
||||
int blind_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_FULLSCREEN | MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
blocks_chalk_drip.c
|
||||
|
||||
//
|
||||
Blocks, Chalk and Drip Magic Tools Plugin
|
||||
Tux Paint - A simple drawing program for children.
|
||||
|
||||
|
|
@ -71,6 +71,10 @@ void blocks_chalk_drip_release(magic_api * api, int which,
|
|||
void blocks_chalk_drip_shutdown(magic_api * api);
|
||||
void blocks_chalk_drip_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int blocks_chalk_drip_requires_colors(magic_api * api, int which);
|
||||
void blocks_chalk_drip_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void blocks_chalk_drip_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int blocks_chalk_drip_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
|
||||
int blocks_chalk_drip_init(magic_api * api)
|
||||
|
|
@ -139,7 +143,7 @@ char * blocks_chalk_drip_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
|||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * blocks_chalk_drip_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
|
||||
char * blocks_chalk_drip_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (which == TOOL_BLOCKS)
|
||||
return(strdup(gettext_noop(
|
||||
|
|
@ -285,7 +289,7 @@ void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void blocks_chalk_drip_click(magic_api * api, int which, int mode,
|
||||
void blocks_chalk_drip_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -321,15 +325,15 @@ int blocks_chalk_drip_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int whic
|
|||
return 0;
|
||||
}
|
||||
|
||||
void blocks_chalk_drip_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void blocks_chalk_drip_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void blocks_chalk_drip_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void blocks_chalk_drip_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int blocks_chalk_drip_modes(magic_api * api, int which)
|
||||
int blocks_chalk_drip_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT); /* FIXME - Blocks and Chalk, at least, can also be turned into a full-image effect */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
blur.c
|
||||
|
||||
//
|
||||
blur, Blur tool
|
||||
Tux Paint - A simple drawing program for children.
|
||||
|
||||
|
|
@ -38,6 +38,29 @@
|
|||
#include <math.h>
|
||||
#include <limits.h>
|
||||
|
||||
// Prototypes
|
||||
Uint32 blur_api_version(void);
|
||||
int blur_init(magic_api * api);
|
||||
int blur_get_tool_count(magic_api * api);
|
||||
SDL_Surface * blur_get_icon(magic_api * api, int which);
|
||||
char * blur_get_name(magic_api * api, int which);
|
||||
char * blur_get_description(magic_api * api, int which, int mode);
|
||||
void blur_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void blur_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void blur_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void blur_shutdown(magic_api * api);
|
||||
void blur_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int blur_requires_colors(magic_api * api, int which);
|
||||
void blur_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void blur_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int blur_modes(magic_api * api, int which);
|
||||
|
||||
enum {
|
||||
TOOL_blur,
|
||||
blur_NUM_TOOLS
|
||||
|
|
@ -76,7 +99,7 @@ int blur_init(magic_api * api){
|
|||
return(1);
|
||||
}
|
||||
|
||||
int blur_get_tool_count(magic_api * api){
|
||||
int blur_get_tool_count(magic_api * api ATTRIBUTE_UNUSED){
|
||||
return(blur_NUM_TOOLS);
|
||||
}
|
||||
|
||||
|
|
@ -88,17 +111,17 @@ SDL_Surface * blur_get_icon(magic_api * api, int which){
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * blur_get_name(magic_api * api, int which){
|
||||
char * blur_get_name(magic_api * api ATTRIBUTE_UNUSED, int which){
|
||||
return(strdup(gettext_noop(blur_names[which])));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * blur_get_description(magic_api * api, int which, int mode){
|
||||
char * blur_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode){
|
||||
return(strdup(gettext_noop(blur_descs[which][mode-1])));
|
||||
}
|
||||
|
||||
//Do the effect for one pixel
|
||||
static void do_blur_pixel(void * ptr, int which,
|
||||
static void do_blur_pixel(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y){
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -134,7 +157,7 @@ static void do_blur_pixel(void * ptr, int which,
|
|||
// Do the effect for the full image
|
||||
static void do_blur_full(void * ptr,SDL_Surface * canvas, SDL_Surface * last, int which){
|
||||
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
//magic_api * api = (magic_api *) ptr;
|
||||
|
||||
int x,y;
|
||||
|
||||
|
|
@ -198,14 +221,14 @@ void blur_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void blur_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void blur_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void blur_shutdown(magic_api * api)
|
||||
void blur_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
//Clean up sounds
|
||||
int i;
|
||||
|
|
@ -217,25 +240,25 @@ void blur_shutdown(magic_api * api)
|
|||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void blur_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void blur_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int blur_requires_colors(magic_api * api, int which)
|
||||
int blur_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void blur_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void blur_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void blur_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void blur_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int blur_modes(magic_api * api, int which)
|
||||
int blur_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_FULLSCREEN|MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,27 @@ static Uint8 bricks_r, bricks_g, bricks_b;
|
|||
|
||||
static void do_brick(magic_api * api, SDL_Surface * canvas,
|
||||
int x, int y, int w, int h);
|
||||
|
||||
int bricks_init(magic_api * api);
|
||||
Uint32 bricks_api_version(void);
|
||||
int bricks_get_tool_count(magic_api * api);
|
||||
SDL_Surface * bricks_get_icon(magic_api * api, int which);
|
||||
char * bricks_get_name(magic_api * api, int which);
|
||||
char * bricks_get_description(magic_api * api, int which, int mode);
|
||||
void bricks_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void bricks_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void bricks_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect); //An empty function. Is there a purpose to this? Ask moderator.
|
||||
void bricks_shutdown(magic_api * api);
|
||||
void bricks_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int bricks_requires_colors(magic_api * api, int which);
|
||||
void bricks_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void bricks_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int bricks_modes(magic_api * api, int which);
|
||||
|
||||
// No setup required:
|
||||
int bricks_init(magic_api * api)
|
||||
|
|
@ -72,7 +92,7 @@ int bricks_init(magic_api * api)
|
|||
Uint32 bricks_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
// We have multiple tools:
|
||||
int bricks_get_tool_count(magic_api * api)
|
||||
int bricks_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(NUM_TOOLS);
|
||||
}
|
||||
|
|
@ -97,7 +117,7 @@ SDL_Surface * bricks_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * bricks_get_name(magic_api * api, int which)
|
||||
char * bricks_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* Both are named "Bricks", at the moment: */
|
||||
|
||||
|
|
@ -105,7 +125,7 @@ char * bricks_get_name(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * bricks_get_description(magic_api * api, int which, int mode)
|
||||
char * bricks_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (which == TOOL_LARGEBRICKS)
|
||||
return(strdup(gettext_noop("Click and move to draw large bricks.")));
|
||||
|
|
@ -117,7 +137,7 @@ char * bricks_get_description(magic_api * api, int which, int mode)
|
|||
|
||||
// Do the effect:
|
||||
|
||||
static void do_bricks(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_bricks(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -224,28 +244,28 @@ void bricks_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void bricks_click(magic_api * api, int which, int mode,
|
||||
void bricks_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
bricks_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
||||
void bricks_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void bricks_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void bricks_shutdown(magic_api * api)
|
||||
void bricks_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (brick_snd != NULL)
|
||||
Mix_FreeChunk(brick_snd);
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void bricks_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void bricks_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
bricks_r = r;
|
||||
bricks_g = g;
|
||||
|
|
@ -253,7 +273,7 @@ void bricks_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int bricks_requires_colors(magic_api * api, int which)
|
||||
int bricks_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -294,15 +314,17 @@ static void do_brick(magic_api * api, SDL_Surface * canvas,
|
|||
api->playsound(brick_snd, (x * 255) / canvas->w, 255);
|
||||
}
|
||||
|
||||
void bricks_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void bricks_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void bricks_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void bricks_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int bricks_modes(magic_api * api, int which)
|
||||
int bricks_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,12 +48,31 @@ static int calligraphy_old_thick;
|
|||
static Uint32 calligraphy_last_time;
|
||||
static SDL_Surface * calligraphy_brush, * calligraphy_colored_brush;
|
||||
|
||||
|
||||
/* Local Function Prototypes */
|
||||
static Point2D calligraphy_PointOnCubicBezier(Point2D* cp, float t);
|
||||
static void calligraphy_ComputeBezier(Point2D* cp, int numberOfPoints, Point2D* curve);
|
||||
static float calligraphy_dist(float x1, float y1, float x2, float y2);
|
||||
|
||||
|
||||
int calligraphy_init(magic_api * api);
|
||||
Uint32 calligraphy_api_version(void);
|
||||
int calligraphy_get_tool_count(magic_api * api);
|
||||
SDL_Surface * calligraphy_get_icon(magic_api * api, int which);
|
||||
char * calligraphy_get_name(magic_api * api, int which);
|
||||
char * calligraphy_get_description(magic_api * api, int which, int mode);
|
||||
void calligraphy_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void calligraphy_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void calligraphy_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void calligraphy_shutdown(magic_api * api);
|
||||
void calligraphy_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int calligraphy_requires_colors(magic_api * api, int which);
|
||||
void calligraphy_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void calligraphy_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int calligraphy_modes(magic_api * api, int which);
|
||||
|
||||
// No setup required:
|
||||
int calligraphy_init(magic_api * api)
|
||||
|
|
@ -87,13 +106,13 @@ int calligraphy_init(magic_api * api)
|
|||
Uint32 calligraphy_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
// Only one tool:
|
||||
int calligraphy_get_tool_count(magic_api * api)
|
||||
int calligraphy_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icon:
|
||||
SDL_Surface * calligraphy_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * calligraphy_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -103,21 +122,21 @@ SDL_Surface * calligraphy_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our name, localized:
|
||||
char * calligraphy_get_name(magic_api * api, int which)
|
||||
char * calligraphy_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Calligraphy")));
|
||||
}
|
||||
|
||||
// Return our description, localized:
|
||||
char * calligraphy_get_description(magic_api * api, int which, int mode)
|
||||
char * calligraphy_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(
|
||||
gettext_noop("Click and move the mouse around to draw in calligraphy.")));
|
||||
}
|
||||
|
||||
|
||||
void calligraphy_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
void calligraphy_drag(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
Point2D * curve;
|
||||
|
|
@ -252,9 +271,9 @@ void calligraphy_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
api->playsound(calligraphy_snd, (x * 255) / canvas->w, 255);
|
||||
}
|
||||
|
||||
void calligraphy_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void calligraphy_click(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
calligraphy_old_thick = 8;
|
||||
calligraphy_last_time = 0;
|
||||
|
|
@ -270,14 +289,14 @@ void calligraphy_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
|
||||
void calligraphy_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void calligraphy_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void calligraphy_shutdown(magic_api * api)
|
||||
void calligraphy_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (calligraphy_snd != NULL)
|
||||
Mix_FreeChunk(calligraphy_snd);
|
||||
|
|
@ -346,7 +365,7 @@ void calligraphy_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// We don't use colors
|
||||
int calligraphy_requires_colors(magic_api * api, int which)
|
||||
int calligraphy_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -420,15 +439,15 @@ static float calligraphy_dist(float x1, float y1, float x2, float y2)
|
|||
return d;
|
||||
}
|
||||
|
||||
void calligraphy_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void calligraphy_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void calligraphy_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void calligraphy_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int calligraphy_modes(magic_api * api, int which)
|
||||
int calligraphy_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,32 @@ static Mix_Chunk * cartoon_snd;
|
|||
|
||||
#define OUTLINE_THRESH 48
|
||||
|
||||
/* Local function prototypes: */
|
||||
int cartoon_init(magic_api * api);
|
||||
Uint32 cartoon_api_version(void);
|
||||
int cartoon_get_tool_count(magic_api * api);
|
||||
SDL_Surface * cartoon_get_icon(magic_api * api, int which);
|
||||
char * cartoon_get_name(magic_api * api, int which);
|
||||
char * cartoon_get_description(magic_api * api, int which, int mode);
|
||||
static void do_cartoon(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
void cartoon_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void cartoon_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void cartoon_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void cartoon_shutdown(magic_api * api);
|
||||
void cartoon_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int cartoon_requires_colors(magic_api * api, int which);
|
||||
void cartoon_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void cartoon_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int cartoon_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
|
||||
// No setup required:
|
||||
int cartoon_init(magic_api * api)
|
||||
|
|
@ -58,13 +84,13 @@ int cartoon_init(magic_api * api)
|
|||
Uint32 cartoon_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
// We have multiple tools:
|
||||
int cartoon_get_tool_count(magic_api * api)
|
||||
int cartoon_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * cartoon_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * cartoon_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -75,13 +101,13 @@ SDL_Surface * cartoon_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * cartoon_get_name(magic_api * api, int which)
|
||||
char * cartoon_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Cartoon")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * cartoon_get_description(magic_api * api, int which, int mode)
|
||||
char * cartoon_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop(
|
||||
"Click and move the mouse around to turn the picture into a cartoon.")));
|
||||
|
|
@ -89,7 +115,7 @@ char * cartoon_get_description(magic_api * api, int which, int mode)
|
|||
|
||||
// Do the effect:
|
||||
|
||||
static void do_cartoon(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_cartoon(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -191,7 +217,7 @@ void cartoon_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void cartoon_click(magic_api * api, int which, int mode,
|
||||
void cartoon_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -199,39 +225,39 @@ void cartoon_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void cartoon_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void cartoon_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void cartoon_shutdown(magic_api * api)
|
||||
void cartoon_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (cartoon_snd != NULL)
|
||||
Mix_FreeChunk(cartoon_snd);
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void cartoon_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void cartoon_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int cartoon_requires_colors(magic_api * api, int which)
|
||||
int cartoon_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cartoon_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void cartoon_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void cartoon_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void cartoon_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int cartoon_modes(magic_api * api, int which)
|
||||
int cartoon_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT); /* FIXME - Can also be turned into a full-image effect */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,28 @@ struct confetti_rgb confetti_colors; //storage for colors, just for having ever
|
|||
|
||||
Mix_Chunk * confetti_snd;
|
||||
|
||||
/* Local function prototypes: */
|
||||
Uint32 confetti_api_version(void);
|
||||
void confetti_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int confetti_init(magic_api * api);
|
||||
int confetti_get_tool_count(magic_api * api);
|
||||
SDL_Surface * confetti_get_icon(magic_api * api, int which);
|
||||
char * confetti_get_name(magic_api * api, int which);
|
||||
char * confetti_get_description(magic_api * api, int which, int mode);
|
||||
int confetti_requires_colors(magic_api * api, int which);
|
||||
void confetti_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void confetti_shutdown(magic_api * api);
|
||||
inline char confetti_get_greater(const char what1, const char what2);
|
||||
inline char confetti_get_lesser(const char what1, const char what2);
|
||||
Uint32 confetti_get_new_color(void * ptr, SDL_Surface * canvas);
|
||||
void confetti_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void confetti_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void confetti_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int confetti_modes(magic_api * api, int which);
|
||||
|
||||
// Housekeeping functions
|
||||
|
||||
|
|
@ -28,7 +50,7 @@ Uint32 confetti_api_version(void)
|
|||
return(TP_MAGIC_API_VERSION);
|
||||
}
|
||||
|
||||
void confetti_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure
|
||||
void confetti_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure
|
||||
{
|
||||
confetti_colors.r=r;
|
||||
confetti_colors.g=g;
|
||||
|
|
@ -45,12 +67,12 @@ int confetti_init(magic_api * api)
|
|||
return(1);
|
||||
}
|
||||
|
||||
int confetti_get_tool_count(magic_api * api)
|
||||
int confetti_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Surface * confetti_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * confetti_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -60,20 +82,20 @@ SDL_Surface * confetti_get_icon(magic_api * api, int which)
|
|||
return(IMG_Load(fname));
|
||||
}
|
||||
|
||||
char * confetti_get_name(magic_api * api, int which) { return strdup(gettext_noop("Confetti")); }
|
||||
char * confetti_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Confetti")); }
|
||||
|
||||
char * confetti_get_description(magic_api * api, int which, int mode) { return strdup(gettext_noop("Click to throw confetti!")); }
|
||||
char * confetti_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Click to throw confetti!")); }
|
||||
|
||||
int confetti_requires_colors(magic_api * api, int which) { return 1; }
|
||||
int confetti_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return 1; }
|
||||
|
||||
void confetti_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void confetti_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 confetti_shutdown(magic_api * api)
|
||||
void confetti_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{ Mix_FreeChunk(confetti_snd); }
|
||||
|
||||
|
||||
|
|
@ -106,8 +128,8 @@ Uint32 confetti_get_new_color(void * ptr, SDL_Surface * canvas) //this function
|
|||
}
|
||||
|
||||
|
||||
static void confetti_circle(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void confetti_circle(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -123,13 +145,13 @@ static void confetti_circle(void * ptr, int which,
|
|||
api->putpixel(canvas, xx, yy, color);
|
||||
}
|
||||
|
||||
void confetti_click(magic_api * api, int which, int mode,
|
||||
void confetti_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
unsigned char i;
|
||||
char min_x, max_x, min_y, max_y;
|
||||
char dx,dy;
|
||||
char min_x = 0, max_x = 0, min_y = 0, max_y = 0;
|
||||
char dx = 0, dy = 0;
|
||||
|
||||
for (i=0; i<CONFETTI_QUANTITY; i++)
|
||||
{
|
||||
|
|
@ -172,15 +194,15 @@ void confetti_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
confetti_click(api, which, MODE_PAINT, canvas, snapshot, x, y, update_rect);
|
||||
}
|
||||
|
||||
void confetti_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void confetti_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void confetti_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void confetti_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int confetti_modes(magic_api * api, int which)
|
||||
int confetti_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,27 @@ static Mix_Chunk * snd_effect;
|
|||
// they accept and return. This lets us use them in other functions
|
||||
// that are declared _before_ them.
|
||||
|
||||
Uint32 distortion_api_version(void);
|
||||
int distortion_init(magic_api * api);
|
||||
int distortion_get_tool_count(magic_api * api);
|
||||
SDL_Surface * distortion_get_icon(magic_api * api, int which);
|
||||
char * distortion_get_name(magic_api * api, int which);
|
||||
char * distortion_get_description(magic_api * api, int which, int mode);
|
||||
int distortion_requires_colors(magic_api * api, int which);
|
||||
void distortion_shutdown(magic_api * api);
|
||||
|
||||
void distortion_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void distortion_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
|
||||
void distortion_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
void distortion_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void distortion_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int distortion_modes(magic_api * api, int which);
|
||||
|
||||
void distortion_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
|
|
@ -92,7 +113,7 @@ int distortion_init(magic_api * api)
|
|||
|
||||
// Report our tool count
|
||||
|
||||
int distortion_get_tool_count(magic_api * api)
|
||||
int distortion_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -100,7 +121,7 @@ int distortion_get_tool_count(magic_api * api)
|
|||
|
||||
// Load icons
|
||||
|
||||
SDL_Surface * distortion_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * distortion_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -116,7 +137,7 @@ SDL_Surface * distortion_get_icon(magic_api * api, int which)
|
|||
|
||||
// Report our "Magic" tool names
|
||||
|
||||
char * distortion_get_name(magic_api * api, int which)
|
||||
char * distortion_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Distortion")));
|
||||
}
|
||||
|
|
@ -124,14 +145,14 @@ char * distortion_get_name(magic_api * api, int which)
|
|||
|
||||
// Report our "Magic" tool descriptions
|
||||
|
||||
char * distortion_get_description(magic_api * api, int which, int mode)
|
||||
char * distortion_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Click and drag the mouse to cause distortion in your picture.")));
|
||||
}
|
||||
|
||||
// Report whether we accept colors
|
||||
|
||||
int distortion_requires_colors(magic_api * api, int which)
|
||||
int distortion_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -139,7 +160,7 @@ int distortion_requires_colors(magic_api * api, int which)
|
|||
|
||||
// Shut down
|
||||
|
||||
void distortion_shutdown(magic_api * api)
|
||||
void distortion_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
Mix_FreeChunk(snd_effect);
|
||||
}
|
||||
|
|
@ -150,7 +171,7 @@ void distortion_shutdown(magic_api * api)
|
|||
|
||||
// Affect the canvas on click:
|
||||
|
||||
void distortion_click(magic_api * api, int which, int mode,
|
||||
void distortion_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -186,21 +207,21 @@ void distortion_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
|
||||
// Affect the canvas on release:
|
||||
|
||||
void distortion_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void distortion_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 distortion_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void distortion_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Our "callback" function
|
||||
|
||||
static void distortion_line_callback(void * ptr, int which,
|
||||
static void distortion_line_callback(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y)
|
||||
{
|
||||
|
|
@ -226,15 +247,15 @@ static void distortion_line_callback(void * ptr, int which,
|
|||
}
|
||||
}
|
||||
|
||||
void distortion_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void distortion_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void distortion_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void distortion_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int distortion_modes(magic_api * api, int which)
|
||||
int distortion_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,33 @@
|
|||
|
||||
static Mix_Chunk * emboss_snd;
|
||||
|
||||
// Prototypes
|
||||
Uint32 emboss_api_version(void);
|
||||
int emboss_init(magic_api * api);
|
||||
int emboss_get_tool_count(magic_api * api);
|
||||
SDL_Surface * emboss_get_icon(magic_api * api, int which);
|
||||
char * emboss_get_name(magic_api * api, int which);
|
||||
char * emboss_get_description(magic_api * api, int which, int mode);
|
||||
|
||||
void emboss_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
|
||||
void emboss_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
|
||||
void emboss_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
|
||||
void emboss_shutdown(magic_api * api);
|
||||
void emboss_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int emboss_requires_colors(magic_api * api, int which);
|
||||
void emboss_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void emboss_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int emboss_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
Uint32 emboss_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
|
|
@ -54,13 +81,13 @@ int emboss_init(magic_api * api)
|
|||
}
|
||||
|
||||
// We have multiple tools:
|
||||
int emboss_get_tool_count(magic_api * api)
|
||||
int emboss_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * emboss_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * emboss_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -71,20 +98,20 @@ SDL_Surface * emboss_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * emboss_get_name(magic_api * api, int which)
|
||||
char * emboss_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Emboss")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * emboss_get_description(magic_api * api, int which, int mode)
|
||||
char * emboss_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Click and drag the mouse to emboss the picture.")));
|
||||
}
|
||||
|
||||
// Do the effect:
|
||||
|
||||
static void do_emboss(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_emboss(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -147,7 +174,7 @@ void emboss_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void emboss_click(magic_api * api, int which, int mode,
|
||||
void emboss_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -155,39 +182,39 @@ void emboss_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void emboss_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void emboss_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void emboss_shutdown(magic_api * api)
|
||||
void emboss_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (emboss_snd != NULL)
|
||||
Mix_FreeChunk(emboss_snd);
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void emboss_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void emboss_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int emboss_requires_colors(magic_api * api, int which)
|
||||
int emboss_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void emboss_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void emboss_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void emboss_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void emboss_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int emboss_modes(magic_api * api, int which)
|
||||
int emboss_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT); /* FIXME - Can also be turned into a full-image effect */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,9 @@ void fade_darken_release(magic_api * api, int which,
|
|||
void fade_darken_shutdown(magic_api * api);
|
||||
void fade_darken_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int fade_darken_requires_colors(magic_api * api, int which);
|
||||
|
||||
void fade_darken_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void fade_darken_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int fade_darken_modes(magic_api * api, int which);
|
||||
|
||||
int fade_darken_init(magic_api * api)
|
||||
{
|
||||
|
|
@ -268,15 +270,15 @@ int fade_darken_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTR
|
|||
return 0;
|
||||
}
|
||||
|
||||
void fade_darken_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void fade_darken_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void fade_darken_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void fade_darken_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int fade_darken_modes(magic_api * api, int which)
|
||||
int fade_darken_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT | MODE_FULLSCREEN);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,27 @@ static int colors_close(magic_api * api, SDL_Surface * canvas,
|
|||
Uint32 c1, Uint32 c2);
|
||||
static void do_flood_fill(magic_api * api, SDL_Surface * canvas, int x, int y,
|
||||
Uint32 cur_colr, Uint32 old_colr);
|
||||
int fill_modes(magic_api * api, int which);
|
||||
void fill_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void fill_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int fill_requires_colors(magic_api * api, int which);
|
||||
void fill_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
void fill_shutdown(magic_api * api);
|
||||
void fill_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void fill_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void fill_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
char * fill_get_description(magic_api * api, int which, int mode);
|
||||
char * fill_get_name(magic_api * api, int which);
|
||||
int fill_get_tool_count(magic_api * api);
|
||||
SDL_Surface * fill_get_icon(magic_api * api, int which);
|
||||
Uint32 fill_api_version(void);
|
||||
int fill_init(magic_api * api);
|
||||
|
||||
|
||||
// No setup required:
|
||||
|
|
@ -65,13 +86,13 @@ int fill_init(magic_api * api)
|
|||
Uint32 fill_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
// We have multiple tools:
|
||||
int fill_get_tool_count(magic_api * api)
|
||||
int fill_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * fill_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * fill_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -82,13 +103,13 @@ SDL_Surface * fill_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * fill_get_name(magic_api * api, int which)
|
||||
char * fill_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Fill")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * fill_get_description(magic_api * api, int which, int mode)
|
||||
char * fill_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop(
|
||||
"Click in the picture to fill that area with color.")));
|
||||
|
|
@ -96,15 +117,15 @@ char * fill_get_description(magic_api * api, int which, int mode)
|
|||
|
||||
|
||||
// Affect the canvas on drag:
|
||||
void fill_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
void fill_drag(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void fill_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
void fill_click(magic_api * api, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
do_flood_fill(api, canvas, x, y, SDL_MapRGB(canvas->format,
|
||||
|
|
@ -117,19 +138,19 @@ void fill_click(magic_api * api, int which, int mode,
|
|||
update_rect->h = canvas->h;
|
||||
}
|
||||
|
||||
void fill_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void fill_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void fill_shutdown(magic_api * api)
|
||||
void fill_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
Mix_FreeChunk(fill_snd);
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void fill_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void fill_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
fill_r = r;
|
||||
fill_g = g;
|
||||
|
|
@ -137,7 +158,7 @@ void fill_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int fill_requires_colors(magic_api * api, int which)
|
||||
int fill_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -246,15 +267,15 @@ static void do_flood_fill(magic_api * api, SDL_Surface * canvas, int x, int y,
|
|||
}
|
||||
}
|
||||
|
||||
void fill_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void fill_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void fill_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void fill_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int fill_modes(magic_api * api, int which)
|
||||
int fill_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,32 @@
|
|||
Mix_Chunk * fisheye_snd;
|
||||
int last_x, last_y;
|
||||
|
||||
/* Local function prototypes */
|
||||
Uint32 fisheye_api_version(void);
|
||||
void fisheye_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int fisheye_init(magic_api * api);
|
||||
int fisheye_get_tool_count(magic_api * api);
|
||||
SDL_Surface * fisheye_get_icon(magic_api * api, int which);
|
||||
char * fisheye_get_name(magic_api * api, int which);
|
||||
char * fisheye_get_description(magic_api * api, int which, int mode);
|
||||
int fisheye_requires_colors(magic_api * api, int which);
|
||||
void fisheye_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void fisheye_shutdown(magic_api * api);
|
||||
void fisheye_draw(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
void fisheye_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 fisheye_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void fisheye_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void fisheye_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int fisheye_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
// Housekeeping functions
|
||||
|
||||
void fisheye_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
|
|
@ -45,7 +71,7 @@ Uint32 fisheye_api_version(void)
|
|||
return(TP_MAGIC_API_VERSION);
|
||||
}
|
||||
|
||||
void fisheye_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void fisheye_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -60,12 +86,12 @@ int fisheye_init(magic_api * api)
|
|||
return(1);
|
||||
}
|
||||
|
||||
int fisheye_get_tool_count(magic_api * api)
|
||||
int fisheye_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Surface * fisheye_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * fisheye_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -75,25 +101,25 @@ SDL_Surface * fisheye_get_icon(magic_api * api, int which)
|
|||
return(IMG_Load(fname));
|
||||
}
|
||||
|
||||
char * fisheye_get_name(magic_api * api, int which) { return strdup(gettext_noop("Fisheye")); } //Needs better name
|
||||
char * fisheye_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Fisheye")); } //Needs better name
|
||||
|
||||
char * fisheye_get_description(magic_api * api, int which, int mode) { return strdup(gettext_noop("Click on part of your picture to create a fisheye effect.")); }
|
||||
char * fisheye_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Click on part of your picture to create a fisheye effect.")); }
|
||||
|
||||
int fisheye_requires_colors(magic_api * api, int which) { return 0; }
|
||||
int fisheye_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return 0; }
|
||||
|
||||
void fisheye_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void fisheye_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 fisheye_shutdown(magic_api * api)
|
||||
void fisheye_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{ Mix_FreeChunk(fisheye_snd); }
|
||||
|
||||
// do-fisheye
|
||||
|
||||
void fisheye_draw(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
void fisheye_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -225,7 +251,7 @@ void fisheye_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
update_rect->h = max(oy, y) - update_rect->y + 40;
|
||||
}
|
||||
|
||||
void fisheye_click(magic_api * api, int which, int mode,
|
||||
void fisheye_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -234,17 +260,17 @@ void fisheye_click(magic_api * api, int which, int mode,
|
|||
fisheye_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
||||
void fisheye_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void fisheye_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void fisheye_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void fisheye_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int fisheye_modes(magic_api * api, int which)
|
||||
int fisheye_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,16 +57,42 @@ typedef struct
|
|||
float x, y;
|
||||
} Point2D;
|
||||
|
||||
static void flower_predrag(magic_api * api, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y);
|
||||
static void flower_drawbase(magic_api * api, SDL_Surface * canvas);
|
||||
static void flower_drawstalk(magic_api * api, SDL_Surface * canvas,
|
||||
int top_x, int top_y, int minx, int maxx,
|
||||
int bottom_x, int bottom_y, int final);
|
||||
static void flower_drawflower(magic_api * api, SDL_Surface * canvas, int x, int y);
|
||||
static Point2D flower_PointOnCubicBezier(Point2D* cp, float t);
|
||||
static void flower_ComputeBezier(Point2D* cp, int numberOfPoints, Point2D* curve);
|
||||
static void flower_colorize_petals(magic_api * api);
|
||||
Uint32 flower_api_version(void);
|
||||
int flower_init(magic_api * api);
|
||||
int flower_get_tool_count(magic_api * api);
|
||||
SDL_Surface * flower_get_icon(magic_api * api, int which);
|
||||
char * flower_get_name(magic_api * api, int which);
|
||||
char * flower_get_description(magic_api * api, int which, int mode);
|
||||
static void flower_predrag(magic_api * api, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y);
|
||||
void flower_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void flower_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void flower_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
static void flower_drawflower(magic_api * api, SDL_Surface * canvas, int x, int y);
|
||||
static void flower_drawbase(magic_api * api, SDL_Surface * canvas);
|
||||
static void flower_drawstalk(magic_api * api, SDL_Surface * canvas,
|
||||
int top_x, int top_y, int minx, int maxx,
|
||||
int bottom_x, int bottom_y, int final);
|
||||
void flower_shutdown(magic_api * api);
|
||||
void flower_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int flower_requires_colors(magic_api * api, int which);
|
||||
static Point2D flower_PointOnCubicBezier( Point2D* cp, float t );
|
||||
static void flower_ComputeBezier( Point2D* cp, int numberOfPoints, Point2D* curve );
|
||||
static void flower_colorize_petals(magic_api * api);
|
||||
void flower_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void flower_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int flower_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
|
||||
|
|
@ -102,13 +128,13 @@ int flower_init(magic_api * api)
|
|||
}
|
||||
|
||||
// We have multiple tools:
|
||||
int flower_get_tool_count(magic_api * api)
|
||||
int flower_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * flower_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * flower_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -119,20 +145,20 @@ SDL_Surface * flower_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * flower_get_name(magic_api * api, int which)
|
||||
char * flower_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Flower")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * flower_get_description(magic_api * api, int which, int mode)
|
||||
char * flower_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Click and drag to draw a flower stalk. Let go to finish the flower.")));
|
||||
}
|
||||
|
||||
// Affect the canvas on drag:
|
||||
static void flower_predrag(magic_api * api, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y)
|
||||
static void flower_predrag(magic_api * api ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, int ox, int oy, int x, int y)
|
||||
{
|
||||
if (x < flower_min_x)
|
||||
flower_min_x = x;
|
||||
|
|
@ -165,7 +191,7 @@ static void flower_predrag(magic_api * api, SDL_Surface * canvas,
|
|||
}
|
||||
}
|
||||
|
||||
void flower_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
void flower_drag(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -192,7 +218,7 @@ void flower_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void flower_click(magic_api * api, int which, int mode,
|
||||
void flower_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -210,7 +236,7 @@ void flower_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void flower_release(magic_api * api, int which,
|
||||
void flower_release(magic_api * api, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -250,7 +276,7 @@ void flower_release(magic_api * api, int which,
|
|||
}
|
||||
|
||||
|
||||
static void flower_drawflower(magic_api * api, SDL_Surface * canvas, int x, int y)
|
||||
static void flower_drawflower(magic_api * api ATTRIBUTE_UNUSED, SDL_Surface * canvas, int x, int y)
|
||||
{
|
||||
SDL_Rect dest;
|
||||
|
||||
|
|
@ -260,7 +286,7 @@ static void flower_drawflower(magic_api * api, SDL_Surface * canvas, int x, int
|
|||
SDL_BlitSurface(flower_petals_colorized, NULL, canvas, &dest);
|
||||
}
|
||||
|
||||
static void flower_drawbase(magic_api * api, SDL_Surface * canvas)
|
||||
static void flower_drawbase(magic_api * api ATTRIBUTE_UNUSED, SDL_Surface * canvas)
|
||||
{
|
||||
SDL_Rect dest;
|
||||
|
||||
|
|
@ -270,7 +296,7 @@ static void flower_drawbase(magic_api * api, SDL_Surface * canvas)
|
|||
SDL_BlitSurface(flower_base, NULL, canvas, &dest);
|
||||
}
|
||||
|
||||
static void flower_drawstalk(magic_api * api, SDL_Surface * canvas,
|
||||
static void flower_drawstalk(magic_api * api ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
||||
int top_x, int top_y, int minx, int maxx,
|
||||
int bottom_x, int bottom_y, int final)
|
||||
{
|
||||
|
|
@ -443,7 +469,7 @@ static void flower_drawstalk(magic_api * api, SDL_Surface * canvas,
|
|||
free(curve);
|
||||
}
|
||||
|
||||
void flower_shutdown(magic_api * api)
|
||||
void flower_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (flower_click_snd != NULL)
|
||||
Mix_FreeChunk(flower_click_snd);
|
||||
|
|
@ -472,7 +498,7 @@ void flower_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int flower_requires_colors(magic_api * api, int which)
|
||||
int flower_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -594,15 +620,15 @@ static void flower_colorize_petals(magic_api * api)
|
|||
SDL_UnlockSurface(flower_petals);
|
||||
}
|
||||
|
||||
void flower_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void flower_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void flower_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void flower_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int flower_modes(magic_api * api, int which)
|
||||
int flower_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT_WITH_PREVIEW);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,27 @@ static int foam_mask_w, foam_mask_h;
|
|||
static int * foam_mask, * foam_mask_tmp;
|
||||
static SDL_Surface * foam_7, * foam_5, * foam_3, * foam_1;
|
||||
|
||||
Uint32 foam_api_version(void);
|
||||
int foam_init(magic_api * api);
|
||||
char * foam_get_description(magic_api * api, int which, int mode);
|
||||
void foam_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
|
||||
void foam_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void foam_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
SDL_Surface * foam_get_icon(magic_api * api, int which);
|
||||
char * foam_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED);
|
||||
void foam_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void foam_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void foam_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
void foam_shutdown(magic_api * api);
|
||||
int foam_get_tool_count(magic_api * api);
|
||||
int foam_modes(magic_api * api, int which);
|
||||
int foam_requires_colors(magic_api * api, int which);
|
||||
|
||||
#define FOAM_PROP 8
|
||||
#define FOAM_RADIUS 3
|
||||
|
|
@ -82,13 +99,13 @@ int foam_init(magic_api * api)
|
|||
}
|
||||
|
||||
// We have multiple tools:
|
||||
int foam_get_tool_count(magic_api * api)
|
||||
int foam_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * foam_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * foam_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -99,20 +116,20 @@ SDL_Surface * foam_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * foam_get_name(magic_api * api, int which)
|
||||
char * foam_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Foam")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * foam_get_description(magic_api * api, int which, int mode)
|
||||
char * foam_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Click and drag the mouse to cover an area with foamy bubbles.")));
|
||||
}
|
||||
|
||||
// Do the effect:
|
||||
|
||||
static void do_foam(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_foam(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -161,9 +178,9 @@ void foam_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void foam_click(magic_api * api, int which, int mode,
|
||||
void foam_click(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -205,9 +222,9 @@ static int foam_mask_test(int r, int x, int y)
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void foam_release(magic_api * api, int which,
|
||||
void foam_release(magic_api * api ATTRIBUTE_UNUSED ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect)
|
||||
{
|
||||
int xx, yy;
|
||||
int changes, max_iters;
|
||||
|
|
@ -385,7 +402,7 @@ void foam_release(magic_api * api, int which,
|
|||
}
|
||||
|
||||
// No setup happened:
|
||||
void foam_shutdown(magic_api * api)
|
||||
void foam_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (foam_snd != NULL)
|
||||
Mix_FreeChunk(foam_snd);
|
||||
|
|
@ -404,7 +421,7 @@ void foam_shutdown(magic_api * api)
|
|||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void foam_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void foam_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
foam_r = r;
|
||||
foam_g = g;
|
||||
|
|
@ -412,20 +429,20 @@ void foam_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int foam_requires_colors(magic_api * api, int which)
|
||||
int foam_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0; /* FIXME: Would be nice to tint the bubbles */
|
||||
}
|
||||
|
||||
void foam_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void foam_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void foam_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void foam_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int foam_modes(magic_api * api, int which)
|
||||
int foam_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,12 +36,33 @@ static void fold_print_line(void * ptr, int which, SDL_Surface * canvas, SDL_Sur
|
|||
static void fold_print_dark_line(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
void translate_xy(SDL_Surface * canvas, int x, int y, int * a, int * b, int rotation);
|
||||
|
||||
Uint32 fold_api_version(void);
|
||||
void fold_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int fold_init(magic_api * api);
|
||||
int fold_get_tool_count(magic_api * api);
|
||||
SDL_Surface * fold_get_icon(magic_api * api, int which);
|
||||
char * fold_get_name(magic_api * api, int which);
|
||||
char * fold_get_description(magic_api * api, int which, int mode);
|
||||
int fold_requires_colors(magic_api * api, int which);
|
||||
void fold_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void fold_shutdown(magic_api * api);
|
||||
void fold_click(magic_api * ptr, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void fold_preview(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
int fold_modes(magic_api * api, int which);
|
||||
// Housekeeping functions
|
||||
|
||||
void fold_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 fold_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
inline Uint8 fold_what_corner(int x, int y, SDL_Surface * canvas);
|
||||
void fold_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
|
||||
Uint32 fold_api_version(void)
|
||||
|
||||
|
|
@ -49,7 +70,7 @@ Uint32 fold_api_version(void)
|
|||
return(TP_MAGIC_API_VERSION);
|
||||
}
|
||||
|
||||
void fold_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure
|
||||
void fold_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure
|
||||
{
|
||||
fold_r=r;
|
||||
fold_g=g;
|
||||
|
|
@ -66,12 +87,12 @@ int fold_init(magic_api * api)
|
|||
return(1);
|
||||
}
|
||||
|
||||
int fold_get_tool_count(magic_api * api)
|
||||
int fold_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Surface * fold_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * fold_get_icon(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -81,14 +102,14 @@ SDL_Surface * fold_get_icon(magic_api * api, int which)
|
|||
return(IMG_Load(fname));
|
||||
}
|
||||
|
||||
char * fold_get_name(magic_api * api, int which) { return(gettext_noop("Fold")); }
|
||||
char * fold_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return(gettext_noop("Fold")); }
|
||||
|
||||
char * fold_get_description(magic_api * api, int which, int mode) { return strdup(gettext_noop("Choose a background color and click to turn the corner of the page over.")); }
|
||||
char * fold_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Choose a background color and click to turn the corner of the page over.")); }
|
||||
|
||||
int fold_requires_colors(magic_api * api, int which) { return 1; } //selected color will be a "backpage" color
|
||||
int fold_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return 1; } //selected color will be a "backpage" color
|
||||
|
||||
|
||||
static void fold_shadow(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * temp,
|
||||
static void fold_shadow(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * temp,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -101,7 +122,7 @@ static void fold_shadow(void * ptr, int which, SDL_Surface * canvas, SDL_Surface
|
|||
|
||||
void fold_draw(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
int x, int y, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
float right_step_x, right_step_y, left_step_x, left_step_y;
|
||||
float dist_x, dist_y;
|
||||
|
|
@ -332,7 +353,7 @@ void fold_release(magic_api * api, int which,
|
|||
api->playsound(fold_snd, (x * 255) / canvas->w, 255);
|
||||
}
|
||||
|
||||
void fold_shutdown(magic_api * api)
|
||||
void fold_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
Mix_FreeChunk(fold_snd);
|
||||
SDL_FreeSurface(fold_surface_dst);
|
||||
|
|
@ -356,27 +377,27 @@ inline Uint8 fold_what_corner(int x, int y, SDL_Surface * canvas)
|
|||
}
|
||||
|
||||
|
||||
static void fold_print_line(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void fold_print_line(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
api->putpixel(canvas, x, y, SDL_MapRGB(last->format, 222, 222, 222)); //Middle gray. Color have been set arbitrary.
|
||||
}
|
||||
static void fold_print_dark_line(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void fold_print_dark_line(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
api->putpixel(canvas, x, y, SDL_MapRGB(last->format, 90, 90, 90)); //It should not look too black nor too white with shadowed colors.
|
||||
}
|
||||
|
||||
static void fold_erase(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void fold_erase(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
api->putpixel(canvas, x, y, SDL_MapRGB(canvas->format, fold_r, fold_g, fold_b));
|
||||
}
|
||||
|
||||
void fold_click(magic_api * ptr, int which, int mode,
|
||||
void fold_click(magic_api * ptr, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -406,7 +427,7 @@ void fold_click(magic_api * ptr, int which, int mode,
|
|||
}
|
||||
|
||||
void fold_preview(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||
SDL_Surface * snapshot, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
int middle_point_x;
|
||||
|
|
@ -473,15 +494,15 @@ void fold_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
fold_preview(api, which, canvas, snapshot, ox, oy, x, y, update_rect);
|
||||
}
|
||||
|
||||
void fold_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void fold_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void fold_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void fold_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int fold_modes(magic_api * api, int which)
|
||||
int fold_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT_WITH_PREVIEW);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,13 +38,37 @@
|
|||
|
||||
static Mix_Chunk * glasstile_snd;
|
||||
|
||||
// Prototypes
|
||||
Uint32 glasstile_api_version(void);
|
||||
int glasstile_init(magic_api * api);
|
||||
int glasstile_get_tool_count(magic_api * api);
|
||||
SDL_Surface * glasstile_get_icon(magic_api * api, int which);
|
||||
char * glasstile_get_name(magic_api * api, int which);
|
||||
char * glasstile_get_description(magic_api * api, int which, int mode);
|
||||
static void do_glasstile(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
void glasstile_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void glasstile_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void glasstile_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void glasstile_shutdown(magic_api * api);
|
||||
void glasstile_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int glasstile_requires_colors(magic_api * api, int which);
|
||||
void glasstile_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void glasstile_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int glasstile_modes(magic_api * api, int which);
|
||||
|
||||
Uint32 glasstile_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
static int * * glasstile_hit;
|
||||
static int glasstile_hit_xsize;
|
||||
static int glasstile_hit_ysize;
|
||||
|
||||
|
||||
// No setup required:
|
||||
int glasstile_init(magic_api * api)
|
||||
{
|
||||
|
|
@ -61,13 +85,13 @@ int glasstile_init(magic_api * api)
|
|||
}
|
||||
|
||||
// We have multiple tools:
|
||||
int glasstile_get_tool_count(magic_api * api)
|
||||
int glasstile_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * glasstile_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * glasstile_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -78,13 +102,13 @@ SDL_Surface * glasstile_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * glasstile_get_name(magic_api * api, int which)
|
||||
char * glasstile_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Glass Tile")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * glasstile_get_description(magic_api * api, int which, int mode)
|
||||
char * glasstile_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
|
||||
{
|
||||
if (mode == MODE_PAINT)
|
||||
return(strdup(gettext_noop("Click and drag the mouse to put glass tile over your picture.")));
|
||||
|
|
@ -94,7 +118,7 @@ char * glasstile_get_description(magic_api * api, int which, int mode)
|
|||
|
||||
// Do the effect:
|
||||
|
||||
static void do_glasstile(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_glasstile(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -260,14 +284,14 @@ void glasstile_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void glasstile_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void glasstile_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void glasstile_shutdown(magic_api * api)
|
||||
void glasstile_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int y;
|
||||
|
||||
|
|
@ -286,25 +310,25 @@ void glasstile_shutdown(magic_api * api)
|
|||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void glasstile_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void glasstile_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int glasstile_requires_colors(magic_api * api, int which)
|
||||
int glasstile_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void glasstile_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void glasstile_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void glasstile_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void glasstile_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int glasstile_modes(magic_api * api, int which)
|
||||
int glasstile_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT | MODE_FULLSCREEN);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
grass.c
|
||||
grass.c
|
||||
|
||||
Grass Magic Tool Plugin
|
||||
Tux Paint - A simple drawing program for children.
|
||||
|
|
@ -41,14 +41,32 @@ static Mix_Chunk * grass_snd;
|
|||
static Uint8 grass_r, grass_g, grass_b;
|
||||
static SDL_Surface * img_grass;
|
||||
|
||||
|
||||
/* Local prototypes: */
|
||||
|
||||
// Prototypes
|
||||
int grass_init(magic_api * api);
|
||||
Uint32 grass_api_version(void);
|
||||
int grass_get_tool_count(magic_api * api);
|
||||
SDL_Surface * grass_get_icon(magic_api * api, int which);
|
||||
char * grass_get_name(magic_api * api, int which);
|
||||
char * grass_get_description(magic_api * api, int which, int mode);
|
||||
void grass_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void grass_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void grass_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void grass_shutdown(magic_api * api);
|
||||
void grass_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int grass_requires_colors(magic_api * api, int which);
|
||||
static void do_grass(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
|
||||
static int log2int(int x);
|
||||
void grass_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void grass_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int grass_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
// No setup required:
|
||||
|
|
@ -67,16 +85,18 @@ int grass_init(magic_api * api)
|
|||
return(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Uint32 grass_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
// We have multiple tools:
|
||||
int grass_get_tool_count(magic_api * api)
|
||||
int grass_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * grass_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * grass_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -87,13 +107,13 @@ SDL_Surface * grass_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * grass_get_name(magic_api * api, int which)
|
||||
char * grass_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Grass")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * grass_get_description(magic_api * api, int which, int mode)
|
||||
char * grass_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Click and move to draw grass. Don’t forget the dirt!")));
|
||||
}
|
||||
|
|
@ -119,28 +139,28 @@ void grass_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void grass_click(magic_api * api, int which, int mode,
|
||||
void grass_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
grass_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
||||
void grass_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void grass_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void grass_shutdown(magic_api * api)
|
||||
void grass_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (grass_snd != NULL)
|
||||
Mix_FreeChunk(grass_snd);
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void grass_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void grass_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
grass_r = r;
|
||||
grass_g = g;
|
||||
|
|
@ -148,13 +168,13 @@ void grass_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int grass_requires_colors(magic_api * api, int which)
|
||||
int grass_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void do_grass(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_grass(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -244,15 +264,15 @@ static int log2int(int x)
|
|||
return y;
|
||||
}
|
||||
|
||||
void grass_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void grass_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void grass_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void grass_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int grass_modes(magic_api * api, int which)
|
||||
int grass_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,13 +42,33 @@ Mix_Chunk * snd_effect[NUM_TOOLS];
|
|||
|
||||
static SDL_Surface * canvas_backup, * square;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
||||
void halftone_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 halftone_line_callback(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y);
|
||||
|
||||
Uint32 halftone_api_version(void);
|
||||
int halftone_init(magic_api * api);
|
||||
int halftone_get_tool_count(magic_api * api);
|
||||
SDL_Surface * halftone_get_icon(magic_api * api, int which);
|
||||
char * halftone_get_name(magic_api * api, int which);
|
||||
char * halftone_get_description(magic_api * api, int which, int mode);
|
||||
int halftone_requires_colors(magic_api * api, int which);
|
||||
int halftone_modes(magic_api * api, int which);
|
||||
void halftone_shutdown(magic_api * api);
|
||||
void halftone_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void halftone_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void halftone_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
void halftone_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void halftone_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void halftone_rgb2cmyk(Uint8 r, Uint8 g, Uint8 b, float cmyk[]);
|
||||
|
||||
Uint32 halftone_api_version(void)
|
||||
{
|
||||
|
|
@ -82,7 +102,7 @@ int halftone_init(magic_api * api)
|
|||
return(1);
|
||||
}
|
||||
|
||||
int halftone_get_tool_count(magic_api * api)
|
||||
int halftone_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(NUM_TOOLS);
|
||||
}
|
||||
|
|
@ -97,7 +117,7 @@ SDL_Surface * halftone_get_icon(magic_api * api, int which)
|
|||
return(IMG_Load(fname));
|
||||
}
|
||||
|
||||
char * halftone_get_name(magic_api * api, int which)
|
||||
char * halftone_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
||||
{
|
||||
const char * our_name_english;
|
||||
const char * our_name_localized;
|
||||
|
|
@ -108,7 +128,7 @@ char * halftone_get_name(magic_api * api, int which)
|
|||
return(strdup(our_name_localized));
|
||||
}
|
||||
|
||||
char * halftone_get_description(magic_api * api, int which, int mode)
|
||||
char * halftone_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
const char * our_desc_english;
|
||||
const char * our_desc_localized;
|
||||
|
|
@ -119,17 +139,17 @@ char * halftone_get_description(magic_api * api, int which, int mode)
|
|||
return(strdup(our_desc_localized));
|
||||
}
|
||||
|
||||
int halftone_requires_colors(magic_api * api, int which)
|
||||
int halftone_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int halftone_modes(magic_api * api, int which)
|
||||
int halftone_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return MODE_PAINT;
|
||||
}
|
||||
|
||||
void halftone_shutdown(magic_api * api)
|
||||
void halftone_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -140,7 +160,7 @@ void halftone_shutdown(magic_api * api)
|
|||
SDL_FreeSurface(square);
|
||||
}
|
||||
|
||||
void halftone_click(magic_api * api, int which, int mode,
|
||||
void halftone_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -191,18 +211,21 @@ int chan_angles[NUM_CHANS] = {
|
|||
45
|
||||
};
|
||||
|
||||
void halftone_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void halftone_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 halftone_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void halftone_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED,
|
||||
Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void halftone_line_callback(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
void halftone_line_callback(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
Uint8 r, g, b, or, og, ob;
|
||||
|
|
@ -283,7 +306,8 @@ void halftone_line_callback(void * ptr, int which,
|
|||
SDL_BlitSurface(square, NULL, canvas, &dest);
|
||||
}
|
||||
|
||||
void halftone_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void halftone_switchin(magic_api * api, int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas)
|
||||
{
|
||||
if (canvas_backup == NULL)
|
||||
canvas_backup = SDL_CreateRGBSurface(SDL_ANYFORMAT, api->canvas_w, api->canvas_h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
|
@ -296,7 +320,8 @@ void halftone_switchin(magic_api * api, int which, int mode, SDL_Surface * canva
|
|||
SDL_BlitSurface(canvas, NULL, canvas_backup, NULL);
|
||||
}
|
||||
|
||||
void halftone_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void halftone_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ static Mix_Chunk * kalidescope_snd;
|
|||
static Uint8 kalidescope_r, kalidescope_g, kalidescope_b;
|
||||
static int square_size = 128;
|
||||
|
||||
Uint32 kalidescope_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
enum {
|
||||
KAL_UD,
|
||||
|
|
@ -58,6 +57,33 @@ char * kal_icon_names[KAL_COUNT] = {
|
|||
"kal_tiles.png"
|
||||
};
|
||||
|
||||
/* Function Declarations: */
|
||||
|
||||
Uint32 kalidescope_api_version(void);
|
||||
int kalidescope_init(magic_api * api);
|
||||
int kalidescope_get_tool_count(magic_api * api);
|
||||
SDL_Surface * kalidescope_get_icon(magic_api * api, int which);
|
||||
char * kalidescope_get_name(magic_api * api, int which);
|
||||
char * kalidescope_get_description(magic_api * api, int which, int mode);
|
||||
static void do_kalidescope(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
void kalidescope_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void kalidescope_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void kalidescope_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void kalidescope_shutdown(magic_api * api);
|
||||
int kalidescope_requires_colors(magic_api * api, int which);
|
||||
void kalidescope_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
void kalidescope_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void kalidescope_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int kalidescope_modes(magic_api * api, int which);
|
||||
|
||||
Uint32 kalidescope_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
// No setup required:
|
||||
int kalidescope_init(magic_api * api)
|
||||
|
|
@ -71,7 +97,7 @@ int kalidescope_init(magic_api * api)
|
|||
return(1);
|
||||
}
|
||||
|
||||
int kalidescope_get_tool_count(magic_api * api)
|
||||
int kalidescope_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(KAL_COUNT);
|
||||
}
|
||||
|
|
@ -88,7 +114,7 @@ SDL_Surface * kalidescope_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * kalidescope_get_name(magic_api * api, int which)
|
||||
char * kalidescope_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
||||
{
|
||||
if (which == KAL_LR) {
|
||||
return(strdup(gettext_noop("Symmetric Left/Right")));
|
||||
|
|
@ -104,7 +130,7 @@ char * kalidescope_get_name(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * kalidescope_get_description(magic_api * api, int which, int mode)
|
||||
char * kalidescope_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (which == KAL_LR) {
|
||||
return(strdup(gettext_noop("Click and drag the mouse to draw with two brushes that are symmetric across the left and right of your picture.")));
|
||||
|
|
@ -121,8 +147,8 @@ char * kalidescope_get_description(magic_api * api, int which, int mode)
|
|||
|
||||
// Do the effect:
|
||||
|
||||
static void do_kalidescope(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y)
|
||||
static void do_kalidescope(void * ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
int xx, yy;
|
||||
|
|
@ -181,7 +207,7 @@ void kalidescope_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void kalidescope_click(magic_api * api, int which, int mode,
|
||||
void kalidescope_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -189,22 +215,23 @@ void kalidescope_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void kalidescope_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void kalidescope_release(magic_api * api, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
api->stopsound();
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void kalidescope_shutdown(magic_api * api)
|
||||
void kalidescope_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (kalidescope_snd != NULL)
|
||||
Mix_FreeChunk(kalidescope_snd);
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void kalidescope_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void kalidescope_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
kalidescope_r = r;
|
||||
kalidescope_g = g;
|
||||
|
|
@ -212,20 +239,22 @@ void kalidescope_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int kalidescope_requires_colors(magic_api * api, int which)
|
||||
int kalidescope_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void kalidescope_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void kalidescope_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void kalidescope_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void kalidescope_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int kalidescope_modes(magic_api * api, int which)
|
||||
int kalidescope_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,29 @@
|
|||
|
||||
static Mix_Chunk * light1_snd, * light2_snd;
|
||||
static float light_h, light_s, light_v;
|
||||
Uint32 light_api_version(void);
|
||||
int light_init(magic_api * api);
|
||||
int light_get_tool_count(magic_api * api);
|
||||
SDL_Surface * light_get_icon(magic_api * api, int which);
|
||||
char * light_get_name(magic_api * api, int which);
|
||||
char * light_get_description(magic_api * api, int which, int mode);
|
||||
static void do_light(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
void light_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void light_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void light_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void light_shutdown(magic_api * api);
|
||||
void light_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int light_requires_colors(magic_api * api, int which);
|
||||
void light_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void light_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int light_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
Uint32 light_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
|
@ -62,13 +85,13 @@ int light_init(magic_api * api)
|
|||
}
|
||||
|
||||
// We have multiple tools:
|
||||
int light_get_tool_count(magic_api * api)
|
||||
int light_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * light_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * light_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -79,20 +102,20 @@ SDL_Surface * light_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * light_get_name(magic_api * api, int which)
|
||||
char * light_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Light")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * light_get_description(magic_api * api, int which, int mode)
|
||||
char * light_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Click and drag to draw a beam of light on your picture.")));
|
||||
}
|
||||
|
||||
// Do the effect:
|
||||
|
||||
static void do_light(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_light(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -171,7 +194,7 @@ void light_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void light_click(magic_api * api, int which, int mode,
|
||||
void light_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -179,15 +202,15 @@ void light_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void light_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void light_release(magic_api * api, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
api->playsound(light2_snd, (x * 255) / canvas->w, 255);
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void light_shutdown(magic_api * api)
|
||||
void light_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (light1_snd != NULL)
|
||||
Mix_FreeChunk(light1_snd);
|
||||
|
|
@ -202,20 +225,20 @@ void light_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int light_requires_colors(magic_api * api, int which)
|
||||
int light_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void light_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void light_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void light_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void light_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
{
|
||||
}
|
||||
|
||||
int light_modes(magic_api * api, int which)
|
||||
int light_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,30 @@
|
|||
static Mix_Chunk * metalpaint_snd;
|
||||
static Uint8 metalpaint_r, metalpaint_g, metalpaint_b;
|
||||
|
||||
Uint32 metalpaint_api_version(void);
|
||||
int metalpaint_init(magic_api * api);
|
||||
int metalpaint_get_tool_count(magic_api * api);
|
||||
SDL_Surface * metalpaint_get_icon(magic_api * api, int which);
|
||||
char * metalpaint_get_name(magic_api * api, int which);
|
||||
char * metalpaint_get_description(magic_api * api, int which, int mode);
|
||||
static void do_metalpaint(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void metalpaint_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void metalpaint_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void metalpaint_shutdown(magic_api * api);
|
||||
void metalpaint_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int metalpaint_requires_colors(magic_api * api, int which);
|
||||
void metalpaint_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void metalpaint_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int metalpaint_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
Uint32 metalpaint_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
|
|
@ -55,13 +79,13 @@ int metalpaint_init(magic_api * api)
|
|||
}
|
||||
|
||||
// We have multiple tools:
|
||||
int metalpaint_get_tool_count(magic_api * api)
|
||||
int metalpaint_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * metalpaint_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * metalpaint_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -72,13 +96,13 @@ SDL_Surface * metalpaint_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * metalpaint_get_name(magic_api * api, int which)
|
||||
char * metalpaint_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Metal Paint")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * metalpaint_get_description(magic_api * api, int which, int mode)
|
||||
char * metalpaint_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Click and drag the mouse to paint with a metallic color.")));
|
||||
}
|
||||
|
|
@ -96,7 +120,7 @@ static int metalpaint_gradient[METALPAINT_CYCLE] = {
|
|||
|
||||
// Do the effect:
|
||||
|
||||
static void do_metalpaint(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_metalpaint(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -138,7 +162,7 @@ void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void metalpaint_click(magic_api * api, int which, int mode,
|
||||
void metalpaint_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -146,21 +170,21 @@ void metalpaint_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void metalpaint_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void metalpaint_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void metalpaint_shutdown(magic_api * api)
|
||||
void metalpaint_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (metalpaint_snd != NULL)
|
||||
Mix_FreeChunk(metalpaint_snd);
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void metalpaint_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void metalpaint_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
metalpaint_r = min(255, r + 64);
|
||||
metalpaint_g = min(255, g + 64);
|
||||
|
|
@ -168,20 +192,20 @@ void metalpaint_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int metalpaint_requires_colors(magic_api * api, int which)
|
||||
int metalpaint_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void metalpaint_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void metalpaint_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void metalpaint_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void metalpaint_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int metalpaint_modes(magic_api * api, int which)
|
||||
int metalpaint_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,29 @@ enum {
|
|||
|
||||
static Mix_Chunk * snd_effects[NUM_TOOLS];
|
||||
|
||||
/* Prototypes */
|
||||
int mirror_flip_init(magic_api *);
|
||||
Uint32 mirror_flip_api_version(void);
|
||||
int mirror_flip_get_tool_count(magic_api *);
|
||||
SDL_Surface * mirror_flip_get_icon(magic_api *, int);
|
||||
char * mirror_flip_get_name(magic_api *, int);
|
||||
char * mirror_flip_get_description(magic_api *, int, int);
|
||||
void mirror_flip_drag(magic_api *, int, SDL_Surface *,
|
||||
SDL_Surface *, int, int, int, int,
|
||||
SDL_Rect *);
|
||||
void mirror_flip_release(magic_api *, int, SDL_Surface *,
|
||||
SDL_Surface *, int, int, int, int,
|
||||
SDL_Rect *);
|
||||
void mirror_flip_click(magic_api *, int, int,
|
||||
SDL_Surface *, SDL_Surface *,
|
||||
int, int,
|
||||
SDL_Rect *);
|
||||
void mirror_flip_shutdown(magic_api *);
|
||||
void mirror_flip_set_color(magic_api *, Uint8, Uint8, Uint8);
|
||||
int mirror_flip_requires_colors(magic_api *, int);
|
||||
void mirror_flip_switchin(magic_api *, int, int, SDL_Surface *);
|
||||
void mirror_flip_switchout(magic_api *, int, int, SDL_Surface *);
|
||||
int mirror_flip_modes(magic_api *, int);
|
||||
|
||||
// No setup required:
|
||||
int mirror_flip_init(magic_api * api)
|
||||
|
|
@ -63,7 +86,7 @@ int mirror_flip_init(magic_api * api)
|
|||
Uint32 mirror_flip_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
// We have multiple tools:
|
||||
int mirror_flip_get_tool_count(magic_api * api)
|
||||
int mirror_flip_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(NUM_TOOLS);
|
||||
}
|
||||
|
|
@ -88,7 +111,7 @@ SDL_Surface * mirror_flip_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * mirror_flip_get_name(magic_api * api, int which)
|
||||
char * mirror_flip_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
||||
{
|
||||
if (which == TOOL_MIRROR)
|
||||
return(strdup(gettext_noop("Mirror")));
|
||||
|
|
@ -99,7 +122,8 @@ char * mirror_flip_get_name(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * mirror_flip_get_description(magic_api * api, int which, int mode)
|
||||
char * mirror_flip_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (which == TOOL_MIRROR)
|
||||
return(strdup(
|
||||
|
|
@ -112,24 +136,30 @@ char * mirror_flip_get_description(magic_api * api, int which, int mode)
|
|||
}
|
||||
|
||||
// We affect the whole canvas, so only do things on click, not drag:
|
||||
void mirror_flip_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
void mirror_flip_drag(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
// No-op
|
||||
}
|
||||
|
||||
void mirror_flip_release(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
void mirror_flip_release(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
// No-op
|
||||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void mirror_flip_click(magic_api * api, int which, int mode,
|
||||
void mirror_flip_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
int xx, yy;
|
||||
|
|
@ -179,7 +209,7 @@ void mirror_flip_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// No setup happened:
|
||||
void mirror_flip_shutdown(magic_api * api)
|
||||
void mirror_flip_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (snd_effects[0] != NULL)
|
||||
Mix_FreeChunk(snd_effects[0]);
|
||||
|
|
@ -188,25 +218,33 @@ void mirror_flip_shutdown(magic_api * api)
|
|||
}
|
||||
|
||||
// We don't use colors:
|
||||
void mirror_flip_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void mirror_flip_set_color(magic_api * api ATTRIBUTE_UNUSED,
|
||||
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// We don't use colors:
|
||||
int mirror_flip_requires_colors(magic_api * api, int which)
|
||||
int mirror_flip_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mirror_flip_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void mirror_flip_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void mirror_flip_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void mirror_flip_switchout(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int mirror_flip_modes(magic_api * api, int which)
|
||||
int mirror_flip_modes(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_FULLSCREEN);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,35 @@ static void mosaic_blur_pixel(void * ptr, SDL_Surface * canvas, SDL_Surface * la
|
|||
static void mosaic_sharpen_pixel(void * ptr, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
static void reset_mosaic_blured(SDL_Surface * canvas);
|
||||
|
||||
/* Prototypes */
|
||||
Uint32 mosaic_api_version(void);
|
||||
int mosaic_init(magic_api *);
|
||||
int mosaic_get_tool_count(magic_api *);
|
||||
SDL_Surface * mosaic_get_icon(magic_api *, int);
|
||||
char * mosaic_get_name(magic_api *, int);
|
||||
char * mosaic_get_description(magic_api *, int, int);
|
||||
void mosaic_paint(void *, int, SDL_Surface *,
|
||||
SDL_Surface *, int, int);
|
||||
void mosaic_drag(magic_api *, int, SDL_Surface *,
|
||||
SDL_Surface *, int, int, int, int,
|
||||
SDL_Rect *);
|
||||
void mosaic_click(magic_api *, int, int,
|
||||
SDL_Surface *, SDL_Surface *,
|
||||
int, int, SDL_Rect *);
|
||||
void mosaic_release(magic_api *, int,
|
||||
SDL_Surface *, SDL_Surface *,
|
||||
int, int, SDL_Rect *);
|
||||
void mosaic_shutdown(magic_api *);
|
||||
void mosaic_set_color(magic_api *, Uint8, Uint8, Uint8);
|
||||
int mosaic_requires_colors(magic_api *, int);
|
||||
void mosaic_switchin(magic_api *, int, int, SDL_Surface *);
|
||||
void mosaic_switchout(magic_api *, int, int, SDL_Surface *);
|
||||
int mosaic_modes(magic_api *, int);
|
||||
|
||||
static const int mosaic_AMOUNT= 300;
|
||||
static const int mosaic_RADIUS = 16;
|
||||
static const double mosaic_SHARPEN = 1.0;
|
||||
static int randnoise;
|
||||
static int randnoise ATTRIBUTE_UNUSED;
|
||||
Uint8 * mosaic_blured;
|
||||
enum {
|
||||
TOOL_MOSAIC,
|
||||
|
|
@ -95,7 +120,7 @@ int mosaic_init(magic_api * api){
|
|||
return(1);
|
||||
}
|
||||
|
||||
int mosaic_get_tool_count(magic_api * api){
|
||||
int mosaic_get_tool_count(magic_api * api ATTRIBUTE_UNUSED){
|
||||
return(mosaic_NUM_TOOLS);
|
||||
}
|
||||
|
||||
|
|
@ -107,12 +132,13 @@ SDL_Surface * mosaic_get_icon(magic_api * api, int which){
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * mosaic_get_name(magic_api * api, int which){
|
||||
char * mosaic_get_name(magic_api * api ATTRIBUTE_UNUSED, int which){
|
||||
return(strdup(gettext_noop(mosaic_names[which])));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * mosaic_get_description(magic_api * api, int which, int mode){
|
||||
char * mosaic_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which, int mode){
|
||||
return(strdup(gettext_noop(mosaic_descs[which][mode-1])));
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +148,8 @@ static int mosaic_grey(Uint8 r1,Uint8 g1,Uint8 b1){
|
|||
}
|
||||
|
||||
// Do the effect for the full image
|
||||
static void do_mosaic_full(void * ptr, SDL_Surface * canvas, SDL_Surface * last, int which){
|
||||
static void do_mosaic_full(void * ptr, SDL_Surface * canvas,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED){
|
||||
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
||||
|
|
@ -163,8 +190,9 @@ Uint32 amask = ~(canvas->format->Rmask |
|
|||
|
||||
/* Paint the brush, noise is yet done at switchin,
|
||||
blurs 2 pixels around the brush in order to get sharpen well done.*/
|
||||
void mosaic_paint(void * ptr_to_api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y)
|
||||
void mosaic_paint(void * ptr_to_api, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
int i, j, pix_row_pos;
|
||||
|
||||
|
|
@ -228,14 +256,17 @@ void mosaic_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void mosaic_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void mosaic_release(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void mosaic_shutdown(magic_api * api)
|
||||
void mosaic_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
//Clean up sounds
|
||||
int i;
|
||||
|
|
@ -247,12 +278,15 @@ void mosaic_shutdown(magic_api * api)
|
|||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void mosaic_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void mosaic_set_color(magic_api * api ATTRIBUTE_UNUSED,
|
||||
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int mosaic_requires_colors(magic_api * api, int which)
|
||||
int mosaic_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -347,7 +381,8 @@ static void mosaic_sharpen_pixel(void * ptr,
|
|||
|
||||
}
|
||||
|
||||
void mosaic_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void mosaic_switchin(magic_api * api, int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas)
|
||||
{
|
||||
int y, x;
|
||||
Uint32 amask;
|
||||
|
|
@ -397,7 +432,9 @@ void mosaic_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
|||
reset_mosaic_blured(canvas);
|
||||
}
|
||||
|
||||
void mosaic_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void mosaic_switchout(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
SDL_FreeSurface(canvas_noise);
|
||||
SDL_FreeSurface(canvas_blur);
|
||||
|
|
@ -405,7 +442,7 @@ void mosaic_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas
|
|||
free (mosaic_blured);
|
||||
}
|
||||
|
||||
int mosaic_modes(magic_api * api, int which)
|
||||
int mosaic_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT|MODE_FULLSCREEN);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue