Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorperepujal <perepujal>2011-05-15 08:09:40 (GMT)
committer perepujal <perepujal>2011-05-15 08:09:40 (GMT)
commitf4783657eb60326da1b7afffd4e9e161cfe5a1c4 (patch)
treeec01e2a397cdf910d07c312fcc96388f6201d830
parent26b35e1976622879d9d59ad2f9dcbeb51ff5745d (diff)
Workaround for api->data directory pointing to the local user directory at magic switchin. Giving proper credits.
-rw-r--r--magic/src/mosaic_shaped.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/magic/src/mosaic_shaped.c b/magic/src/mosaic_shaped.c
index 4162bf3..138fafe 100644
--- a/magic/src/mosaic_shaped.c
+++ b/magic/src/mosaic_shaped.c
@@ -2,10 +2,14 @@
mosaic_shaped.c
mosaic_shaped, Add a mosaic_shaped effect to the image using a combination of other tools.
- Requires the mosaic_shapedAll sharpen and noise tools.
Tux Paint - A simple drawing program for children.
- Credits: Andrew Corcoran <akanewbie@gmail.com>
+ Credits:
+ * Andrew Corcoran <akanewbie@gmail.com> for the edge step used in hexagon
+ * Whoever who wrote the "Fill" magic tool
+ * Bill Kendrick for the code derived from api->touched
+ * Pere Pujal for joining all toghether
+ * Caroline Ford for the text descriptions
Copyright (c) 2002-2009 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
@@ -27,7 +31,7 @@
(See COPYING.txt)
Last updated: May 6, 2009
- $Id: mosaic_shaped.c,v 1.4 2009/12/03 07:05:23 scottmc Exp $
+ $Id: mosaic_shaped.c,v 1.5 2011/05/15 08:09:40 perepujal Exp $
*/
#include <stdio.h>
@@ -100,6 +104,10 @@ Uint8 mosaic_shaped_r, mosaic_shaped_g, mosaic_shaped_b;
int mosaic_shaped_average_r, mosaic_shaped_average_g, mosaic_shaped_average_b, mosaic_shaped_average_count;
Uint32 pixel_average, black, white;
+/* FIXME This is just a workaround, the problem is that at switchin(),
+ api->data_directory points to the local user directory instead of the system wide instalation. */
+char api_data_directory_at_init[1024];
+
enum {
TOOL_SQUARE,
TOOL_HEX,
@@ -159,6 +167,7 @@ int mosaic_shaped_init(magic_api * api){
snprintf(fname, sizeof(fname), "%s/sounds/magic/%s", api->data_directory, mosaic_shaped_snd_filenames[i]);
mosaic_shaped_snd_effect[i] = Mix_LoadWAV(fname);
}
+ snprintf(api_data_directory_at_init, sizeof(api_data_directory_at_init), api->data_directory);
return(1);
}
@@ -404,7 +413,8 @@ void mosaic_shaped_switchin(magic_api * api, int which, int mode ATTRIBUTE_UNUSE
canvas->format->Rmask,
canvas->format->Gmask,
canvas->format->Bmask, amask);
- snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory, mosaic_shaped_pattern_filenames[which]);
+ snprintf(fname, sizeof(fname), "%simages/magic/%s", api_data_directory_at_init, mosaic_shaped_pattern_filenames[which]);
+
mosaic_shaped_pattern = IMG_Load(fname);
rect.w = mosaic_shaped_pattern->w;
rect.h = mosaic_shaped_pattern->h;