Adding support for Kid Pix templates (KPX files) as Starter images.
This commit is contained in:
parent
f243f8976a
commit
dd96740109
4 changed files with 80 additions and 17 deletions
|
|
@ -8,7 +8,7 @@ http://www.tuxpaint.org/
|
|||
|
||||
$Id$
|
||||
|
||||
2009.October.3 (0.9.22)
|
||||
2009.October.7 (0.9.22)
|
||||
* New Tools:
|
||||
----------
|
||||
* Label - A tool to add text to a drawing, which can be modified or
|
||||
|
|
@ -34,9 +34,14 @@ $Id$
|
|||
|
||||
* Other Improvements:
|
||||
-------------------
|
||||
* Starter images can be in SVG format.
|
||||
* Starter images can be in SVG (Scalable Vector Graphics) format.
|
||||
(Avoids loading PNG if SVG with the same name exists.)
|
||||
|
||||
* Starter images can be in KPX (Kid Pix Template) format.
|
||||
(These appear to simply be JPEG with 60 byte's worth of Mac OS
|
||||
resource fork header at the beginning.)
|
||||
(Thanks to Sarah Curry for sharing some example templates to test.)
|
||||
|
||||
* When a default size was not specified, SVG-based Stamps would default
|
||||
to the largest, which was canvas-sized. Now defaulting to a more
|
||||
reasonable size. (And users can click the maximum size choice to get
|
||||
|
|
|
|||
|
|
@ -501,6 +501,11 @@ Fonts
|
|||
transparency, white will be converted to transparent when the Starter
|
||||
is opened.
|
||||
|
||||
Note: Previous to Tux Paint 0.9.22, Starters had to be in PNG or JPEG
|
||||
(backgrounds only) format. As of 0.9.22, they may be in SVG (vector
|
||||
graphics) or KPX (templates from Kid Pix, another childrens' drawing
|
||||
program; they are special files which simply contain a JPEG within).
|
||||
|
||||
Scene-Style
|
||||
|
||||
Along with the 'coloring-book' style overlay, you can also provide a
|
||||
|
|
|
|||
|
|
@ -647,6 +647,12 @@ effect.</p>
|
|||
black and transparent. As of 0.9.21, if a Starter is black and white,
|
||||
with no transparency, white will be converted to transparent when the
|
||||
Starter is opened.</p>
|
||||
|
||||
<p><b>Note:</b> Previous to Tux Paint 0.9.22, Starters had to be in
|
||||
PNG or JPEG (backgrounds only) format. As of 0.9.22, they may be in
|
||||
SVG (vector graphics) or KPX (templates from Kid Pix, another childrens'
|
||||
drawing program; they are special files which simply contain a JPEG
|
||||
within).</p>
|
||||
</blockquote>
|
||||
|
||||
<b>Scene-Style</b>
|
||||
|
|
|
|||
|
|
@ -1683,14 +1683,13 @@ static char *debug_gettext(const char *str);
|
|||
static int charsize(Uint16 c);
|
||||
#endif
|
||||
|
||||
SDL_Surface * load_kpx(char * file);
|
||||
#ifndef NOSVG
|
||||
SDL_Surface * load_svg(char * file);
|
||||
SDL_Surface * myIMG_Load(char * file);
|
||||
float pick_best_scape(unsigned int orig_w, unsigned int orig_h,
|
||||
unsigned int max_w, unsigned int max_h);
|
||||
#else
|
||||
#define myIMG_Load IMG_Load
|
||||
#endif
|
||||
SDL_Surface * myIMG_Load(char * file);
|
||||
|
||||
|
||||
#define MAX_UTF8_CHAR_LENGTH 6
|
||||
|
|
@ -12070,6 +12069,14 @@ static void load_starter(char *img_id)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (tmp_surf == NULL)
|
||||
{
|
||||
/* Try loading a KPX */
|
||||
snprintf(fname, sizeof(fname), "%s/%s.kpx", dirname, img_id);
|
||||
tmp_surf = myIMG_Load(fname);
|
||||
}
|
||||
|
||||
|
||||
if (tmp_surf != NULL)
|
||||
{
|
||||
img_starter = SDL_DisplayFormatAlpha(tmp_surf);
|
||||
|
|
@ -18034,18 +18041,6 @@ SDL_Surface * load_svg(char * file)
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
/* Load an image; call load_svg() (above, to call Cairo and SVG-Cairo funcs)
|
||||
if we notice it's an SVG file,
|
||||
otherwise call SDL_Image lib's IMG_Load() (for PNGs, JPEGs, BMPs, etc.) */
|
||||
SDL_Surface * myIMG_Load(char * file)
|
||||
{
|
||||
if (strlen(file) > 4 && strcasecmp(file + strlen(file) - 4, ".svg") == 0)
|
||||
return(load_svg(file));
|
||||
else
|
||||
return(IMG_Load(file));
|
||||
}
|
||||
|
||||
float pick_best_scape(unsigned int orig_w, unsigned int orig_h,
|
||||
unsigned int max_w, unsigned int max_h)
|
||||
{
|
||||
|
|
@ -18129,6 +18124,48 @@ float pick_best_scape(unsigned int orig_w, unsigned int orig_h,
|
|||
|
||||
#endif
|
||||
|
||||
/* Load an image; call load_svg() (above, to call Cairo and SVG-Cairo funcs)
|
||||
if we notice it's an SVG file (if available!);
|
||||
call load_kpx() if we notice it's a KPX file (JPEG with wrapper);
|
||||
otherwise call SDL_Image lib's IMG_Load() (for PNGs, JPEGs, BMPs, etc.) */
|
||||
SDL_Surface * myIMG_Load(char * file)
|
||||
{
|
||||
if (strlen(file) > 4 && strcasecmp(file + strlen(file) - 4, ".kpx") == 0)
|
||||
return(load_kpx(file));
|
||||
#ifndef NOSVG
|
||||
else if (strlen(file) > 4 && strcasecmp(file + strlen(file) - 4, ".svg") == 0)
|
||||
return(load_svg(file));
|
||||
#endif
|
||||
else
|
||||
return(IMG_Load(file));
|
||||
}
|
||||
|
||||
SDL_Surface * load_kpx(char * file)
|
||||
{
|
||||
SDL_RWops * data;
|
||||
FILE * fi;
|
||||
SDL_Surface * surf;
|
||||
int i;
|
||||
|
||||
fi = fopen(file, "r");
|
||||
if (fi == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Skip header */
|
||||
for (i = 0; i < 60; i++)
|
||||
fgetc(fi);
|
||||
|
||||
data = SDL_RWFromFP(fi, 1); /* 1 = Close when we're done */
|
||||
|
||||
if (data == NULL)
|
||||
return(NULL);
|
||||
|
||||
surf = IMG_Load_RW(data, 1); /* 1 = Free when we're done */
|
||||
if (surf == NULL)
|
||||
return(NULL);
|
||||
|
||||
return(surf);
|
||||
}
|
||||
|
||||
|
||||
void load_magic_plugins(void)
|
||||
|
|
@ -18941,6 +18978,8 @@ int do_new_dialog(void)
|
|||
if (strcasestr(f->d_name, FNAME_EXTENSION) != NULL
|
||||
/* Support legacy BMP files for load: */
|
||||
|| strcasestr(f->d_name, ".bmp") != NULL
|
||||
/* Support for KPX (Kid Pix templates; just a JPEG with resource fork header): */
|
||||
|| strcasestr(f->d_name, ".kpx") != NULL
|
||||
#ifndef NOSVG
|
||||
|| strcasestr(f->d_name, ".svg") != NULL
|
||||
#endif
|
||||
|
|
@ -18975,11 +19014,19 @@ int do_new_dialog(void)
|
|||
d_exts[num_files] = strdup(".bmp");
|
||||
}
|
||||
|
||||
#ifndef NOSVG
|
||||
if (strcasestr(fname, ".svg") != NULL)
|
||||
{
|
||||
strcpy((char *) strcasestr(fname, ".svg"), "");
|
||||
d_exts[num_files] = strdup(".svg");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcasestr(fname, ".kpx") != NULL)
|
||||
{
|
||||
strcpy((char *) strcasestr(fname, ".kpx"), "");
|
||||
d_exts[num_files] = strdup(".kpx");
|
||||
}
|
||||
|
||||
d_names[num_files] = strdup(fname);
|
||||
d_places[num_files] = place;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue