new file (from pdbgen)

* text_tool_cmds.c: new file (from pdbgen)

* Makefile.am: add new file, use AM_CPPFLAGS instead of CPPFLAGS

* internal_procs.c: register pdbgened text_tool procs

* text_tool.c: remove PDB stuff, export text_render and
text_get_extents and SizeType and SUPERSAMPLE symbols

* text_tool.c: remove PDB stuff

* blend.[ch]
* bucket_fill.[ch]
* clone.[ch]
* convolve.[ch]: export some enums

* channel.h
* paint_core.h: #define->enum

* channel.c
* gimpparasite.c
* parasitelist.c
* pixel_processor.c: warning cleanup

* convert_cmds.c
* paths_cmds.c: slight pdbgen changes

-Yosh
This commit is contained in:
Manish Singh 1999-04-10 04:54:34 +00:00
parent 66c75cb53d
commit d6116b8d2c
62 changed files with 1117 additions and 3203 deletions

View File

@ -1,3 +1,32 @@
Fri Apr 9 21:45:10 PDT 1999 Manish Singh <yosh@gimp.org>
* text_tool_cmds.c: new file (from pdbgen)
* Makefile.am: add new file, use AM_CPPFLAGS instead of CPPFLAGS
* internal_procs.c: register pdbgened text_tool procs
* text_tool.c: remove PDB stuff, export text_render and
text_get_extents and SizeType and SUPERSAMPLE symbols
* text_tool.c: remove PDB stuff
* blend.[ch]
* bucket_fill.[ch]
* clone.[ch]
* convolve.[ch]: export some enums
* channel.h
* paint_core.h: #define->enum
* channel.c
* gimpparasite.c
* parasitelist.c
* pixel_processor.c: warning cleanup
* convert_cmds.c
* paths_cmds.c: slight pdbgen changes
1999-04-09 Jay Cox <jaycox@earthlink.net>
* app/gimphistogramF.h: new file containing typedef for

View File

@ -331,6 +331,7 @@ gimp_SOURCES = \
temp_buf.h \
text_tool.c \
text_tool.h \
text_tool_cmds.c \
threshold.c \
threshold.h \
tile.c \
@ -370,7 +371,7 @@ EXTRA_DIST = \
wilber.ico
CPPFLAGS = \
AM_CPPFLAGS = \
-DLIBDIR=\""$(gimpplugindir)"\" \
-DLOCALEDIR=\""$(localedir)"\" \
-DREGEX_MALLOC \

View File

@ -133,7 +133,7 @@ do_parallel_regions(PixelProcessor *p_s)
static void
pixel_regions_do_parallel(PixelProcessor *p_s)
{
int i;
IF_THREAD(int i;)
IF_THREAD(int nthreads;)
IF_THREAD(pthread_t threads[MAX_THREADS];)
IF_THREAD(pthread_attr_t pthread_attr;)

View File

@ -56,39 +56,6 @@
/* the blend structures */
typedef enum
{
Linear,
BiLinear,
Radial,
Square,
ConicalSymmetric,
ConicalAsymmetric,
ShapeburstAngular,
ShapeburstSpherical,
ShapeburstDimpled,
SpiralClockwise,
SpiralAntiClockwise,
GradientTypeLast
} GradientType;
typedef enum
{
FG_BG_RGB_MODE,
FG_BG_HSV_MODE,
FG_TRANS_MODE,
CUSTOM_MODE,
BLEND_MODE_LAST
} BlendMode;
typedef enum
{
REPEAT_NONE,
REPEAT_SAWTOOTH,
REPEAT_TRIANGULAR,
REPEAT_LAST
} RepeatMode;
typedef double (*RepeatFunc)(double);
typedef struct _BlendTool BlendTool;

View File

@ -21,6 +21,39 @@
#include "tools.h"
#include "procedural_db.h"
typedef enum
{
Linear,
BiLinear,
Radial,
Square,
ConicalSymmetric,
ConicalAsymmetric,
ShapeburstAngular,
ShapeburstSpherical,
ShapeburstDimpled,
SpiralClockwise,
SpiralAntiClockwise,
GradientTypeLast /*< skip >*/
} GradientType;
typedef enum
{
FG_BG_RGB_MODE,
FG_BG_HSV_MODE,
FG_TRANS_MODE,
CUSTOM_MODE,
BLEND_MODE_LAST /*< skip >*/
} BlendMode;
typedef enum
{
REPEAT_NONE,
REPEAT_SAWTOOTH,
REPEAT_TRIANGULAR,
REPEAT_LAST /*< skip >*/
} RepeatMode;
Tool * tools_new_blend (void);
void tools_free_blend (Tool *);

View File

@ -36,13 +36,6 @@
/* the bucket fill structures */
typedef enum
{
FgColorFill,
BgColorFill,
PatternFill
} FillMode;
typedef struct _BucketTool BucketTool;
struct _BucketTool
{

View File

@ -21,6 +21,13 @@
#include "tools.h"
#include "procedural_db.h"
typedef enum
{
FgColorFill,
BgColorFill,
PatternFill
} FillMode;
Tool * tools_new_bucket_fill (void);
void tools_free_bucket_fill (Tool *);

View File

@ -825,7 +825,6 @@ channel_sub_segment (Channel *mask, int x, int y, int width, int value)
void
channel_combine_rect (Channel *mask, int op, int x, int y, int w, int h)
{
int i;
int x2, y2;
PixelRegion maskPR;
unsigned char color;

View File

@ -27,10 +27,13 @@
/* OPERATIONS */
#define ADD 0
#define SUB 1
#define REPLACE 2
#define INTERSECT 3
typedef enum
{
ADD,
SUB,
REPLACE,
INTERSECT
} ChannelOps;
/* Half way point where a region is no longer visible in a selection */
#define HALF_WAY 127

View File

@ -38,12 +38,6 @@
/* the clone structures */
typedef enum
{
ImageClone,
PatternClone
} CloneType;
typedef enum
{
AlignNo,

View File

@ -22,6 +22,12 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
ImageClone,
PatternClone
} CloneType;
void * clone_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_clone (void);
void tools_free_clone (Tool *);

View File

@ -140,7 +140,7 @@ convert_indexed_invoker (Argument *args)
if (success)
{
success = (gimage_base_type (gimage) != INDEXED);
success = gimage_base_type (gimage) != INDEXED;
if (num_cols < 1 || num_cols > MAXNUMCOLORS)
success = FALSE;
@ -234,10 +234,10 @@ convert_indexed_palette_invoker (Argument *args)
if (!palette_entries_list)
palette_init_palettes (FALSE);
for (list = palette_entries_list; list; list = g_slist_next (list))
for (list = palette_entries_list; list; list = list->next)
{
entries = (PaletteEntriesP) list->data;
if (strcmp (palette_name, entries->name) == 0)
if (!strcmp (palette_name, entries->name))
{
the_palette = entries;
break;
@ -278,7 +278,7 @@ static ProcArg convert_indexed_palette_inargs[] =
{
PDB_INT32,
"palette_type",
"The type of palette to use: MAKE_PALETTE (0), REUSE_PALETTE (1), WEB_PALETTE (2), MONO_PALETTE (3), CUSTOM_PALETTE (4)"
"The type of palette to use: { MAKE_PALETTE (0), REUSE_PALETTE (1), WEB_PALETTE (2), MONO_PALETTE (3), CUSTOM_PALETTE (4) }"
},
{
PDB_INT32,

View File

@ -39,13 +39,6 @@
/* the convolve structures */
typedef enum
{
Blur,
Sharpen,
Custom
} ConvolveType;
typedef struct _ConvolveOptions ConvolveOptions;
struct _ConvolveOptions
{

View File

@ -22,6 +22,13 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
Blur,
Sharpen,
Custom
} ConvolveType;
void * convolve_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_convolve (void);
void tools_free_convolve (Tool *);

View File

@ -73,7 +73,7 @@ void
gimp_parasiterc_save()
{
FILE *fp;
guint32 num, version = 1;
guint32 version = 1;
if (!(fp = fopen(gimp_personal_rc_file ("#parasiterc.tmp"), "w")))
return;
version = GINT32_TO_BE(version);
@ -91,7 +91,7 @@ void
gimp_parasiterc_load()
{
FILE *fp;
guint32 num, version;
guint32 version;
if (!(fp = fopen(gimp_personal_rc_file ("parasiterc"), "r")))
return;
fread(&version, 4, 1, fp);

View File

@ -825,7 +825,6 @@ channel_sub_segment (Channel *mask, int x, int y, int width, int value)
void
channel_combine_rect (Channel *mask, int op, int x, int y, int w, int h)
{
int i;
int x2, y2;
PixelRegion maskPR;
unsigned char color;

View File

@ -27,10 +27,13 @@
/* OPERATIONS */
#define ADD 0
#define SUB 1
#define REPLACE 2
#define INTERSECT 3
typedef enum
{
ADD,
SUB,
REPLACE,
INTERSECT
} ChannelOps;
/* Half way point where a region is no longer visible in a selection */
#define HALF_WAY 127

View File

@ -825,7 +825,6 @@ channel_sub_segment (Channel *mask, int x, int y, int width, int value)
void
channel_combine_rect (Channel *mask, int op, int x, int y, int w, int h)
{
int i;
int x2, y2;
PixelRegion maskPR;
unsigned char color;

View File

@ -27,10 +27,13 @@
/* OPERATIONS */
#define ADD 0
#define SUB 1
#define REPLACE 2
#define INTERSECT 3
typedef enum
{
ADD,
SUB,
REPLACE,
INTERSECT
} ChannelOps;
/* Half way point where a region is no longer visible in a selection */
#define HALF_WAY 127

View File

@ -56,39 +56,6 @@
/* the blend structures */
typedef enum
{
Linear,
BiLinear,
Radial,
Square,
ConicalSymmetric,
ConicalAsymmetric,
ShapeburstAngular,
ShapeburstSpherical,
ShapeburstDimpled,
SpiralClockwise,
SpiralAntiClockwise,
GradientTypeLast
} GradientType;
typedef enum
{
FG_BG_RGB_MODE,
FG_BG_HSV_MODE,
FG_TRANS_MODE,
CUSTOM_MODE,
BLEND_MODE_LAST
} BlendMode;
typedef enum
{
REPEAT_NONE,
REPEAT_SAWTOOTH,
REPEAT_TRIANGULAR,
REPEAT_LAST
} RepeatMode;
typedef double (*RepeatFunc)(double);
typedef struct _BlendTool BlendTool;

View File

@ -73,7 +73,7 @@ void
gimp_parasiterc_save()
{
FILE *fp;
guint32 num, version = 1;
guint32 version = 1;
if (!(fp = fopen(gimp_personal_rc_file ("#parasiterc.tmp"), "w")))
return;
version = GINT32_TO_BE(version);
@ -91,7 +91,7 @@ void
gimp_parasiterc_load()
{
FILE *fp;
guint32 num, version;
guint32 version;
if (!(fp = fopen(gimp_personal_rc_file ("parasiterc"), "r")))
return;
fread(&version, 4, 1, fp);

View File

@ -239,7 +239,7 @@ void
parasite_list_load(ParasiteList *list, FILE *fp)
{
Parasite *p;
guint32 num, version;
guint32 num;
num = 0;
fread(&num, 4, 1, fp);
num = GINT32_FROM_BE(num);

View File

@ -825,7 +825,6 @@ channel_sub_segment (Channel *mask, int x, int y, int width, int value)
void
channel_combine_rect (Channel *mask, int op, int x, int y, int w, int h)
{
int i;
int x2, y2;
PixelRegion maskPR;
unsigned char color;

View File

@ -27,10 +27,13 @@
/* OPERATIONS */
#define ADD 0
#define SUB 1
#define REPLACE 2
#define INTERSECT 3
typedef enum
{
ADD,
SUB,
REPLACE,
INTERSECT
} ChannelOps;
/* Half way point where a region is no longer visible in a selection */
#define HALF_WAY 127

View File

@ -73,7 +73,7 @@ void
gimp_parasiterc_save()
{
FILE *fp;
guint32 num, version = 1;
guint32 version = 1;
if (!(fp = fopen(gimp_personal_rc_file ("#parasiterc.tmp"), "w")))
return;
version = GINT32_TO_BE(version);
@ -91,7 +91,7 @@ void
gimp_parasiterc_load()
{
FILE *fp;
guint32 num, version;
guint32 version;
if (!(fp = fopen(gimp_personal_rc_file ("parasiterc"), "r")))
return;
fread(&version, 4, 1, fp);

View File

@ -61,7 +61,6 @@
#include "rotate_tool.h"
#include "scale_tool.h"
#include "shear_tool.h"
#include "text_tool.h"
#include "threshold.h"
#include "parasite_cmds.h"
#include "procedural_db.h"
@ -74,8 +73,9 @@ void register_floating_sel_procs (void);
void register_undo_procs (void);
void register_convert_procs (void);
void register_paths_procs (void);
void register_palette_procs (void);
void register_unit_procs (void);
void register_palette_procs (void);
void register_unit_procs (void);
void register_text_tool_procs (void);
void
internal_procs_init ()
@ -111,13 +111,10 @@ internal_procs_init ()
procedural_db_register (&rotate_proc); pcount++;
procedural_db_register (&scale_proc); pcount++;
procedural_db_register (&shear_proc); pcount++;
procedural_db_register (&text_tool_proc); pcount++;
procedural_db_register (&text_tool_proc_ext); pcount++;
procedural_db_register (&text_tool_proc_fontname); pcount++;
procedural_db_register (&text_tool_get_extents_proc); pcount++;
procedural_db_register (&text_tool_get_extents_proc_ext); pcount++;
procedural_db_register (&text_tool_get_extents_proc_fontname); pcount++;
register_text_tool_procs ();
pcount += 6;
app_init_update_status(NULL, _("GDisplay procedures"),
pcount/total_pcount);

View File

@ -38,12 +38,6 @@
/* the clone structures */
typedef enum
{
ImageClone,
PatternClone
} CloneType;
typedef enum
{
AlignNo,

View File

@ -22,6 +22,12 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
ImageClone,
PatternClone
} CloneType;
void * clone_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_clone (void);
void tools_free_clone (Tool *);

View File

@ -39,13 +39,6 @@
/* the convolve structures */
typedef enum
{
Blur,
Sharpen,
Custom
} ConvolveType;
typedef struct _ConvolveOptions ConvolveOptions;
struct _ConvolveOptions
{

View File

@ -22,6 +22,13 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
Blur,
Sharpen,
Custom
} ConvolveType;
void * convolve_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_convolve (void);
void tools_free_convolve (Tool *);

View File

@ -38,12 +38,6 @@
/* the clone structures */
typedef enum
{
ImageClone,
PatternClone
} CloneType;
typedef enum
{
AlignNo,

View File

@ -22,6 +22,12 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
ImageClone,
PatternClone
} CloneType;
void * clone_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_clone (void);
void tools_free_clone (Tool *);

View File

@ -31,13 +31,19 @@
#define FINISH_PAINT 4
/* brush application types */
#define HARD 0 /* pencil */
#define SOFT 1 /* paintbrush */
#define PRESSURE 2 /* paintbrush with variable pressure */
typedef enum
{
HARD, /* pencil */
SOFT, /* paintbrush */
PRESSURE /* paintbrush with variable pressure */
} BrushApplicationMode;
/* paint application modes */
#define CONSTANT 0 /* pencil, paintbrush, airbrush, clone */
#define INCREMENTAL 1 /* convolve, smudge */
typedef enum
{
CONSTANT, /*< nick=CONTINUOUS >*/ /* pencil, paintbrush, airbrush, clone */
INCREMENTAL /* convolve, smudge */
} PaintApplicationMode;
/* gradient paint modes */
#define ONCE_FORWARD 0 /* paint through once, then stop */

View File

@ -239,7 +239,7 @@ void
parasite_list_load(ParasiteList *list, FILE *fp)
{
Parasite *p;
guint32 num, version;
guint32 num;
num = 0;
fread(&num, 4, 1, fp);
num = GINT32_FROM_BE(num);

View File

@ -165,7 +165,7 @@ path_get_points_invoker (Argument *args)
{
pptr = pl->data;
if (strcmp (pname, pptr->name->str) == 0)
if (!strcmp (pname, pptr->name->str))
break; /* Found the path */
pl = pl->next;
@ -542,6 +542,8 @@ path_get_point_at_dist_invoker (Argument *args)
gint32 x_point = 0;
gint32 y_point = 0;
gdouble gradient = 0;
PathsList *plist;
PATHP pptr = NULL;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
@ -551,27 +553,18 @@ path_get_point_at_dist_invoker (Argument *args)
if (success)
{
/* Get the path with the given name */
PathsList *plist = gimage->paths;
if(plist && plist->bz_paths)
{
PATHP pptr = NULL;
if(plist->last_selected_row >= 0)
{
pptr = (PATHP)g_slist_nth_data(plist->bz_paths,plist->last_selected_row);
success = paths_distance(pptr,distance,&x_point,&y_point,&gradient);
}
else
{
success = FALSE;
}
}
else
{
success = FALSE;
}
/* Get the path with the given name */
plist = gimage->paths;
if (plist && plist->bz_paths && plist->last_selected_row >= 0)
{
pptr = (PATHP) g_slist_nth_data (plist->bz_paths,
plist->last_selected_row);
success = paths_distance (pptr, distance, &x_point, &y_point,
&gradient);
}
else
success = FALSE;
}
return_args = procedural_db_return_args (&path_get_point_at_dist_proc, success);
@ -622,7 +615,7 @@ static ProcArg path_get_point_at_dist_outargs[] =
static ProcRecord path_get_point_at_dist_proc =
{
"gimp_path_get_point_at_dist",
"Get point on a path at a specified distance along the path",
"Get point on a path at a specified distance along the path.",
"This will return the x,y position of a point at a given distance along the bezier curve. The distance will the obtained by first digitizing the curve internally an then walking along the curve. For a closed curve the start of the path is the first point on the path that was created. This might not be obvious. Note the current path is used.",
"Andy Thomas",
"Andy Thomas",
@ -644,6 +637,7 @@ path_get_tattoo_invoker (Argument *args)
gchar *pname;
gint32 tattoo = 0;
PathsList *plist;
PATHP pptr = NULL;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
@ -655,7 +649,6 @@ path_get_tattoo_invoker (Argument *args)
if (success)
{
PATHP pptr = NULL;
/* Get the path with the given name */
plist = gimage->paths;
@ -667,7 +660,7 @@ path_get_tattoo_invoker (Argument *args)
{
pptr = pl->data;
if (strcmp (pname, pptr->name->str) == 0)
if (!strcmp (pname, pptr->name->str))
break; /* Found the path */
pl = pl->next;
@ -675,12 +668,12 @@ path_get_tattoo_invoker (Argument *args)
}
if (pl && pptr)
{
tattoo = paths_get_tattoo(pptr);
}
tattoo = paths_get_tattoo (pptr);
else
success = FALSE;
}
}
else
success = FALSE;
}
return_args = procedural_db_return_args (&path_get_tattoo_proc, success);
@ -696,7 +689,7 @@ static ProcArg path_get_tattoo_inargs[] =
{
PDB_IMAGE,
"image",
"The ID of the image"
"The image"
},
{
PDB_STRING,
@ -717,7 +710,7 @@ static ProcArg path_get_tattoo_outargs[] =
static ProcRecord path_get_tattoo_proc =
{
"gimp_path_get_tattoo",
"Returns the tattoo associated with the name path",
"Returns the tattoo associated with the name path.",
"This procedure returns the tattoo associated with the specified path. A tattoo is a unique and permenant identifier attached to a path that can be used to uniquely identify a path within an image even between sessions.",
"Andy Thomas",
"Andy Thomas",
@ -752,10 +745,10 @@ get_path_by_tattoo_invoker (Argument *args)
plist = gimage->paths;
if (plist && plist->bz_paths)
{
if((pptr = paths_get_path_by_tattoo(gimage,tattoo)) == NULL)
success = FALSE;
}
{
if ((pptr = paths_get_path_by_tattoo (gimage, tattoo)) == NULL)
success = FALSE;
}
else
success = FALSE;
}
@ -773,7 +766,7 @@ static ProcArg get_path_by_tattoo_inargs[] =
{
PDB_IMAGE,
"image",
"The ID of the image"
"The image"
},
{
PDB_INT32,
@ -794,7 +787,7 @@ static ProcArg get_path_by_tattoo_outargs[] =
static ProcRecord get_path_by_tattoo_proc =
{
"gimp_get_path_by_tattoo",
"Return the name of the path with the given tattoo",
"Return the name of the path with the given tattoo.",
"The procedure returns the name of the path in the specified image which has the passed tattoo. The tattoos are unique within the image and will be preserved across sessions and through renaming of the path. An error is returned if no path woth the specified tattoo can be found.",
"Andy Thomas",
"Andy Thomas",

View File

@ -133,7 +133,7 @@ do_parallel_regions(PixelProcessor *p_s)
static void
pixel_regions_do_parallel(PixelProcessor *p_s)
{
int i;
IF_THREAD(int i;)
IF_THREAD(int nthreads;)
IF_THREAD(pthread_t threads[MAX_THREADS];)
IF_THREAD(pthread_attr_t pthread_attr;)

File diff suppressed because it is too large Load Diff

View File

@ -19,18 +19,23 @@
#define __TEXT_TOOL_H__
#include "tools.h"
#include "procedural_db.h"
#include "layerF.h"
#include "gimpimageF.h"
#include "gimpdrawableF.h"
typedef enum {
PIXELS,
POINTS
} SizeType;
#define SUPERSAMPLE 3
/* text functions */
Tool * tools_new_text (void);
void tools_free_text (Tool *);
/* Procedure definition and marshalling function */
extern ProcRecord text_tool_proc;
extern ProcRecord text_tool_proc_ext;
extern ProcRecord text_tool_proc_fontname;
extern ProcRecord text_tool_get_extents_proc;
extern ProcRecord text_tool_get_extents_proc_ext;
extern ProcRecord text_tool_get_extents_proc_fontname;
int text_get_extents (char *, char *, int *, int *, int *, int *);
GimpLayer * text_render (GimpImage *, GimpDrawable *, int, int, char *,
char *, int, int);
#endif /* __TEXT_TOOL_H__ */

718
app/text_tool_cmds.c Normal file
View File

@ -0,0 +1,718 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl. */
#include "procedural_db.h"
#include "drawable.h"
#include "layer.h"
#include "text_tool.h"
#include <stdio.h>
static ProcRecord text_fontname_proc;
static ProcRecord text_get_extents_fontname_proc;
static ProcRecord text_proc;
static ProcRecord text_get_extents_proc;
void
register_text_tool_procs (void)
{
procedural_db_register (&text_fontname_proc);
procedural_db_register (&text_get_extents_fontname_proc);
procedural_db_register (&text_proc);
procedural_db_register (&text_get_extents_proc);
}
static gchar *
text_xlfd_insert_size (gchar *fontname,
gdouble size,
SizeType metric,
gboolean antialias)
{
gchar *newfont, *workfont;
gchar buffer[16];
gint pos = 0;
if (size <= 0)
return NULL;
if (antialias)
size *= SUPERSAMPLE;
sprintf (buffer, "%d", (int) size);
newfont = workfont = g_new (char, strlen (fontname) + 16);
while (*fontname)
{
*workfont++ = *fontname;
if (*fontname++ == '-')
{
pos++;
if ((pos == 7 && metric == PIXELS) ||
(pos == 8 && metric == POINTS))
{
int len = strlen (buffer);
memcpy (workfont, buffer, len);
workfont += len;
while (*fontname != '-')
fontname++;
}
}
}
*workfont = '\0';
return newfont;
}
static gchar *
text_xlfd_create (gchar *foundry,
gchar *family,
gchar *weight,
gchar *slant,
gchar *set_width,
gchar *spacing,
gchar *registry,
gchar *encoding)
{
/* create the fontname */
return g_strdup_printf ("-%s-%s-%s-%s-%s-*-*-*-*-*-%s-*-%s-%s",
foundry, family, weight, slant, set_width,
spacing, registry, encoding);
}
static Argument *
text_fontname_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
GimpDrawable *drawable;
gdouble x;
gdouble y;
gchar *text;
gint32 border;
gboolean antialias;
gdouble size;
gint32 size_type;
gchar *fontname;
GimpLayer *text_layer = NULL;
gchar *real_fontname;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
drawable = gimp_drawable_get_ID (args[1].value.pdb_int);
x = args[2].value.pdb_float;
y = args[3].value.pdb_float;
text = (gchar *) args[4].value.pdb_pointer;
if (text == NULL)
success = FALSE;
border = args[5].value.pdb_int;
if (border < -1)
success = FALSE;
antialias = args[6].value.pdb_int ? TRUE : FALSE;
size = args[7].value.pdb_float;
if (size <= 0.0)
success = FALSE;
size_type = args[8].value.pdb_int;
if (size_type < PIXELS || size_type > POINTS)
success = FALSE;
fontname = (gchar *) args[9].value.pdb_pointer;
if (fontname == NULL)
success = FALSE;
if (success)
{
real_fontname = text_xlfd_insert_size (fontname, size, size_type,
antialias);
text_layer = text_render (gimage, drawable, x, y, real_fontname, text,
border, antialias);
if (text_layer == NULL)
success = FALSE;
g_free (real_fontname);
}
return_args = procedural_db_return_args (&text_fontname_proc, success);
if (success)
return_args[1].value.pdb_int = drawable_ID (GIMP_DRAWABLE (text_layer));
return return_args;
}
static ProcArg text_fontname_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
},
{
PDB_DRAWABLE,
"drawable",
"The affected drawable: (-1 for a new text layer)"
},
{
PDB_FLOAT,
"x",
"The x coordinate for the left of the text bounding box"
},
{
PDB_FLOAT,
"y",
"The y coordinate for the top of the text bounding box"
},
{
PDB_STRING,
"text",
"The text to generate"
},
{
PDB_INT32,
"border",
"The size of the border: -1 <= border"
},
{
PDB_INT32,
"antialias",
"Antialiasing (TRUE or FALSE)"
},
{
PDB_FLOAT,
"size",
"The size of text in either pixels or points"
},
{
PDB_INT32,
"size_type",
"The units of specified size: PIXELS (0), POINTS (1)"
},
{
PDB_STRING,
"fontname",
"The fontname (conforming to the X Logical Font Description Conventions)"
}
};
static ProcArg text_fontname_outargs[] =
{
{
PDB_LAYER,
"text_layer",
"The new text layer"
}
};
static ProcRecord text_fontname_proc =
{
"gimp_text_fontname",
"Add text at the specified location as a floating selection or a new layer.",
"This tool requires font information as a fontname conforming to the 'X Logical Font Description Conventions'. You can specify the fontsize in units of pixels or points, and the appropriate metric is specified using the size_type argument. The x and y parameters together control the placement of the new text by specifying the upper left corner of the text bounding box. If the antialias parameter is non-zero, the generated text will blend more smoothly with underlying layers. This option requires more time and memory to compute than non-antialiased text; the resulting floating selection or layer, however, will require the same amount of memory with or without antialiasing. If the specified drawable parameter is valid, the text will be created as a floating selection attached to the drawable. If the drawable parameter is not valid (-1), the text will appear as a new layer. Finally, a border can be specified around the final rendered text. The border is measured in pixels.",
"Martin Edlman & Sven Neumann",
"Spencer Kimball & Peter Mattis",
"1998",
PDB_INTERNAL,
10,
text_fontname_inargs,
1,
text_fontname_outargs,
{ { text_fontname_invoker } }
};
static Argument *
text_get_extents_fontname_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *text;
gdouble size;
gint32 size_type;
gchar *fontname;
gint32 width;
gint32 height;
gint32 ascent;
gint32 descent;
gchar *real_fontname;
text = (gchar *) args[0].value.pdb_pointer;
if (text == NULL)
success = FALSE;
size = args[1].value.pdb_float;
if (size <= 0.0)
success = FALSE;
size_type = args[2].value.pdb_int;
if (size_type < PIXELS || size_type > POINTS)
success = FALSE;
fontname = (gchar *) args[3].value.pdb_pointer;
if (fontname == NULL)
success = FALSE;
if (success)
{
real_fontname = text_xlfd_insert_size (fontname, size, size_type, FALSE);
success = text_get_extents (real_fontname, text,
&width, &height,
&ascent, &descent);
g_free (real_fontname);
}
return_args = procedural_db_return_args (&text_get_extents_fontname_proc, success);
if (success)
{
return_args[1].value.pdb_int = width;
return_args[2].value.pdb_int = height;
return_args[3].value.pdb_int = ascent;
return_args[4].value.pdb_int = descent;
}
return return_args;
}
static ProcArg text_get_extents_fontname_inargs[] =
{
{
PDB_STRING,
"text",
"The text to generate"
},
{
PDB_FLOAT,
"size",
"The size of text in either pixels or points"
},
{
PDB_INT32,
"size_type",
"The units of specified size: PIXELS (0), POINTS (1)"
},
{
PDB_STRING,
"fontname",
"The fontname (conforming to the X Logical Font Description Conventions)"
}
};
static ProcArg text_get_extents_fontname_outargs[] =
{
{
PDB_INT32,
"width",
"The width of the specified font"
},
{
PDB_INT32,
"height",
"The height of the specified font"
},
{
PDB_INT32,
"ascent",
"The ascent of the specified font"
},
{
PDB_INT32,
"descent",
"The descent of the specified font"
}
};
static ProcRecord text_get_extents_fontname_proc =
{
"gimp_text_get_extents_fontname",
"Get extents of the bounding box for the specified text.",
"This tool returns the width and height of a bounding box for the specified text string with the specified font information. Ascent and descent for the specified font are returned as well.",
"Martin Edlman & Sven Neumann",
"Spencer Kimball & Peter Mattis",
"1998",
PDB_INTERNAL,
4,
text_get_extents_fontname_inargs,
4,
text_get_extents_fontname_outargs,
{ { text_get_extents_fontname_invoker } }
};
static Argument *
text_invoker (Argument *args)
{
gboolean success = TRUE;
int i;
Argument argv[10];
gchar *foundry;
gchar *family;
gchar *weight;
gchar *slant;
gchar *set_width;
gchar *spacing;
gchar *registry;
gchar *encoding;
foundry = (gchar *) args[9].value.pdb_pointer;
if (foundry == NULL)
success = FALSE;
family = (gchar *) args[10].value.pdb_pointer;
if (family == NULL)
success = FALSE;
weight = (gchar *) args[11].value.pdb_pointer;
if (weight == NULL)
success = FALSE;
slant = (gchar *) args[12].value.pdb_pointer;
if (slant == NULL)
success = FALSE;
set_width = (gchar *) args[13].value.pdb_pointer;
if (set_width == NULL)
success = FALSE;
spacing = (gchar *) args[14].value.pdb_pointer;
if (spacing == NULL)
success = FALSE;
registry = (gchar *) args[15].value.pdb_pointer;
if (registry == NULL)
success = FALSE;
encoding = (gchar *) args[16].value.pdb_pointer;
if (encoding == NULL)
success = FALSE;
if (!success)
return procedural_db_return_args (&text_proc, FALSE);
for (i = 0; i < 9; i++)
argv[i] = args[i];
argv[9].arg_type = PDB_STRING;
argv[9].value.pdb_pointer =
text_xlfd_create (foundry,
family,
weight,
slant,
set_width,
spacing,
registry,
encoding);
return text_fontname_invoker (argv);
}
static ProcArg text_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
},
{
PDB_DRAWABLE,
"drawable",
"The affected drawable: (-1 for a new text layer)"
},
{
PDB_FLOAT,
"x",
"The x coordinate for the left of the text bounding box"
},
{
PDB_FLOAT,
"y",
"The y coordinate for the top of the text bounding box"
},
{
PDB_STRING,
"text",
"The text to generate"
},
{
PDB_INT32,
"border",
"The size of the border: -1 <= border"
},
{
PDB_INT32,
"antialias",
"Antialiasing (TRUE or FALSE)"
},
{
PDB_FLOAT,
"size",
"The size of text in either pixels or points"
},
{
PDB_INT32,
"size_type",
"The units of specified size: PIXELS (0), POINTS (1)"
},
{
PDB_STRING,
"foundry",
"The font foundry, \"*\" for any"
},
{
PDB_STRING,
"family",
"The font family, \"*\" for any"
},
{
PDB_STRING,
"weight",
"The font weight, \"*\" for any"
},
{
PDB_STRING,
"slant",
"The font slant, \"*\" for any"
},
{
PDB_STRING,
"set_width",
"The font set-width, \"*\" for any"
},
{
PDB_STRING,
"spacing",
"The font spacing, \"*\" for any"
},
{
PDB_STRING,
"registry",
"The font registry, \"*\" for any"
},
{
PDB_STRING,
"encoding",
"The font encoding, \"*\" for any"
}
};
static ProcArg text_outargs[] =
{
{
PDB_LAYER,
"text_layer",
"The new text layer"
}
};
static ProcRecord text_proc =
{
"gimp_text",
"Add text at the specified location as a floating selection or a new layer.",
"This tool requires font information in the form of nine parameters: size, foundry, family, weight, slant, set_width, spacing, registry, encoding. The font size can either be specified in units of pixels or points, and the appropriate metric is specified using the size_type argument. The x and y parameters together control the placement of the new text by specifying the upper left corner of the text bounding box. If the antialias parameter is non-zero, the generated text will blend more smoothly with underlying layers. This option requires more time and memory to compute than non-antialiased text; the resulting floating selection or layer, however, will require the same amount of memory with or without antialiasing. If the specified drawable parameter is valid, the text will be created as a floating selection attached to the drawable. If the drawable parameter is not valid (-1), the text will appear as a new layer. Finally, a border can be specified around the final rendered text."
"The border is measured in pixels.",
"Martin Edlman",
"Spencer Kimball & Peter Mattis",
"1998",
PDB_INTERNAL,
17,
text_inargs,
1,
text_outargs,
{ { text_invoker } }
};
static Argument *
text_get_extents_invoker (Argument *args)
{
gboolean success = TRUE;
int i;
Argument argv[4];
gchar *foundry;
gchar *family;
gchar *weight;
gchar *slant;
gchar *set_width;
gchar *spacing;
gchar *registry;
gchar *encoding;
foundry = (gchar *) args[3].value.pdb_pointer;
if (foundry == NULL)
success = FALSE;
family = (gchar *) args[4].value.pdb_pointer;
if (family == NULL)
success = FALSE;
weight = (gchar *) args[5].value.pdb_pointer;
if (weight == NULL)
success = FALSE;
slant = (gchar *) args[6].value.pdb_pointer;
if (slant == NULL)
success = FALSE;
set_width = (gchar *) args[7].value.pdb_pointer;
if (set_width == NULL)
success = FALSE;
spacing = (gchar *) args[8].value.pdb_pointer;
if (spacing == NULL)
success = FALSE;
registry = (gchar *) args[9].value.pdb_pointer;
if (registry == NULL)
success = FALSE;
encoding = (gchar *) args[10].value.pdb_pointer;
if (encoding == NULL)
success = FALSE;
if (!success)
return procedural_db_return_args (&text_get_extents_proc, FALSE);
for (i = 0; i < 3; i++)
argv[i] = args[i];
argv[3].arg_type = PDB_STRING;
argv[3].value.pdb_pointer =
text_xlfd_create (foundry,
family,
weight,
slant,
set_width,
spacing,
registry,
encoding);
return text_get_extents_fontname_invoker (argv);
}
static ProcArg text_get_extents_inargs[] =
{
{
PDB_STRING,
"text",
"The text to generate"
},
{
PDB_FLOAT,
"size",
"The size of text in either pixels or points"
},
{
PDB_INT32,
"size_type",
"The units of specified size: PIXELS (0), POINTS (1)"
},
{
PDB_STRING,
"foundry",
"The font foundry, \"*\" for any"
},
{
PDB_STRING,
"family",
"The font family, \"*\" for any"
},
{
PDB_STRING,
"weight",
"The font weight, \"*\" for any"
},
{
PDB_STRING,
"slant",
"The font slant, \"*\" for any"
},
{
PDB_STRING,
"set_width",
"The font set-width, \"*\" for any"
},
{
PDB_STRING,
"spacing",
"The font spacing, \"*\" for any"
},
{
PDB_STRING,
"registry",
"The font registry, \"*\" for any"
},
{
PDB_STRING,
"encoding",
"The font encoding, \"*\" for any"
}
};
static ProcArg text_get_extents_outargs[] =
{
{
PDB_INT32,
"width",
"The width of the specified font"
},
{
PDB_INT32,
"height",
"The height of the specified font"
},
{
PDB_INT32,
"ascent",
"The ascent of the specified font"
},
{
PDB_INT32,
"descent",
"The descent of the specified font"
}
};
static ProcRecord text_get_extents_proc =
{
"gimp_text_get_extents",
"Get extents of the bounding box for the specified text.",
"This tool returns the width and height of a bounding box for the specified text string with the specified font information. Ascent and descent for the specified font are returned as well.",
"Martin Edlman",
"Spencer Kimball & Peter Mattis",
"1998",
PDB_INTERNAL,
11,
text_get_extents_inargs,
4,
text_get_extents_outargs,
{ { text_get_extents_invoker } }
};

View File

@ -56,39 +56,6 @@
/* the blend structures */
typedef enum
{
Linear,
BiLinear,
Radial,
Square,
ConicalSymmetric,
ConicalAsymmetric,
ShapeburstAngular,
ShapeburstSpherical,
ShapeburstDimpled,
SpiralClockwise,
SpiralAntiClockwise,
GradientTypeLast
} GradientType;
typedef enum
{
FG_BG_RGB_MODE,
FG_BG_HSV_MODE,
FG_TRANS_MODE,
CUSTOM_MODE,
BLEND_MODE_LAST
} BlendMode;
typedef enum
{
REPEAT_NONE,
REPEAT_SAWTOOTH,
REPEAT_TRIANGULAR,
REPEAT_LAST
} RepeatMode;
typedef double (*RepeatFunc)(double);
typedef struct _BlendTool BlendTool;

View File

@ -21,6 +21,39 @@
#include "tools.h"
#include "procedural_db.h"
typedef enum
{
Linear,
BiLinear,
Radial,
Square,
ConicalSymmetric,
ConicalAsymmetric,
ShapeburstAngular,
ShapeburstSpherical,
ShapeburstDimpled,
SpiralClockwise,
SpiralAntiClockwise,
GradientTypeLast /*< skip >*/
} GradientType;
typedef enum
{
FG_BG_RGB_MODE,
FG_BG_HSV_MODE,
FG_TRANS_MODE,
CUSTOM_MODE,
BLEND_MODE_LAST /*< skip >*/
} BlendMode;
typedef enum
{
REPEAT_NONE,
REPEAT_SAWTOOTH,
REPEAT_TRIANGULAR,
REPEAT_LAST /*< skip >*/
} RepeatMode;
Tool * tools_new_blend (void);
void tools_free_blend (Tool *);

View File

@ -36,13 +36,6 @@
/* the bucket fill structures */
typedef enum
{
FgColorFill,
BgColorFill,
PatternFill
} FillMode;
typedef struct _BucketTool BucketTool;
struct _BucketTool
{

View File

@ -21,6 +21,13 @@
#include "tools.h"
#include "procedural_db.h"
typedef enum
{
FgColorFill,
BgColorFill,
PatternFill
} FillMode;
Tool * tools_new_bucket_fill (void);
void tools_free_bucket_fill (Tool *);

View File

@ -38,12 +38,6 @@
/* the clone structures */
typedef enum
{
ImageClone,
PatternClone
} CloneType;
typedef enum
{
AlignNo,

View File

@ -22,6 +22,12 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
ImageClone,
PatternClone
} CloneType;
void * clone_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_clone (void);
void tools_free_clone (Tool *);

View File

@ -39,13 +39,6 @@
/* the convolve structures */
typedef enum
{
Blur,
Sharpen,
Custom
} ConvolveType;
typedef struct _ConvolveOptions ConvolveOptions;
struct _ConvolveOptions
{

View File

@ -22,6 +22,13 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
Blur,
Sharpen,
Custom
} ConvolveType;
void * convolve_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_convolve (void);
void tools_free_convolve (Tool *);

View File

@ -56,39 +56,6 @@
/* the blend structures */
typedef enum
{
Linear,
BiLinear,
Radial,
Square,
ConicalSymmetric,
ConicalAsymmetric,
ShapeburstAngular,
ShapeburstSpherical,
ShapeburstDimpled,
SpiralClockwise,
SpiralAntiClockwise,
GradientTypeLast
} GradientType;
typedef enum
{
FG_BG_RGB_MODE,
FG_BG_HSV_MODE,
FG_TRANS_MODE,
CUSTOM_MODE,
BLEND_MODE_LAST
} BlendMode;
typedef enum
{
REPEAT_NONE,
REPEAT_SAWTOOTH,
REPEAT_TRIANGULAR,
REPEAT_LAST
} RepeatMode;
typedef double (*RepeatFunc)(double);
typedef struct _BlendTool BlendTool;

View File

@ -21,6 +21,39 @@
#include "tools.h"
#include "procedural_db.h"
typedef enum
{
Linear,
BiLinear,
Radial,
Square,
ConicalSymmetric,
ConicalAsymmetric,
ShapeburstAngular,
ShapeburstSpherical,
ShapeburstDimpled,
SpiralClockwise,
SpiralAntiClockwise,
GradientTypeLast /*< skip >*/
} GradientType;
typedef enum
{
FG_BG_RGB_MODE,
FG_BG_HSV_MODE,
FG_TRANS_MODE,
CUSTOM_MODE,
BLEND_MODE_LAST /*< skip >*/
} BlendMode;
typedef enum
{
REPEAT_NONE,
REPEAT_SAWTOOTH,
REPEAT_TRIANGULAR,
REPEAT_LAST /*< skip >*/
} RepeatMode;
Tool * tools_new_blend (void);
void tools_free_blend (Tool *);

View File

@ -36,13 +36,6 @@
/* the bucket fill structures */
typedef enum
{
FgColorFill,
BgColorFill,
PatternFill
} FillMode;
typedef struct _BucketTool BucketTool;
struct _BucketTool
{

View File

@ -21,6 +21,13 @@
#include "tools.h"
#include "procedural_db.h"
typedef enum
{
FgColorFill,
BgColorFill,
PatternFill
} FillMode;
Tool * tools_new_bucket_fill (void);
void tools_free_bucket_fill (Tool *);

View File

@ -38,12 +38,6 @@
/* the clone structures */
typedef enum
{
ImageClone,
PatternClone
} CloneType;
typedef enum
{
AlignNo,

View File

@ -22,6 +22,12 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
ImageClone,
PatternClone
} CloneType;
void * clone_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_clone (void);
void tools_free_clone (Tool *);

View File

@ -39,13 +39,6 @@
/* the convolve structures */
typedef enum
{
Blur,
Sharpen,
Custom
} ConvolveType;
typedef struct _ConvolveOptions ConvolveOptions;
struct _ConvolveOptions
{

View File

@ -22,6 +22,13 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
Blur,
Sharpen,
Custom
} ConvolveType;
void * convolve_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_convolve (void);
void tools_free_convolve (Tool *);

View File

@ -38,12 +38,6 @@
/* the clone structures */
typedef enum
{
ImageClone,
PatternClone
} CloneType;
typedef enum
{
AlignNo,

View File

@ -22,6 +22,12 @@
#include "procedural_db.h"
#include "tools.h"
typedef enum
{
ImageClone,
PatternClone
} CloneType;
void * clone_paint_func (PaintCore *, GimpDrawable *, int);
Tool * tools_new_clone (void);
void tools_free_clone (Tool *);

File diff suppressed because it is too large Load Diff

View File

@ -19,18 +19,23 @@
#define __TEXT_TOOL_H__
#include "tools.h"
#include "procedural_db.h"
#include "layerF.h"
#include "gimpimageF.h"
#include "gimpdrawableF.h"
typedef enum {
PIXELS,
POINTS
} SizeType;
#define SUPERSAMPLE 3
/* text functions */
Tool * tools_new_text (void);
void tools_free_text (Tool *);
/* Procedure definition and marshalling function */
extern ProcRecord text_tool_proc;
extern ProcRecord text_tool_proc_ext;
extern ProcRecord text_tool_proc_fontname;
extern ProcRecord text_tool_get_extents_proc;
extern ProcRecord text_tool_get_extents_proc_ext;
extern ProcRecord text_tool_get_extents_proc_fontname;
int text_get_extents (char *, char *, int *, int *, int *, int *);
GimpLayer * text_render (GimpImage *, GimpDrawable *, int, int, char *,
char *, int, int);
#endif /* __TEXT_TOOL_H__ */

View File

@ -31,13 +31,19 @@
#define FINISH_PAINT 4
/* brush application types */
#define HARD 0 /* pencil */
#define SOFT 1 /* paintbrush */
#define PRESSURE 2 /* paintbrush with variable pressure */
typedef enum
{
HARD, /* pencil */
SOFT, /* paintbrush */
PRESSURE /* paintbrush with variable pressure */
} BrushApplicationMode;
/* paint application modes */
#define CONSTANT 0 /* pencil, paintbrush, airbrush, clone */
#define INCREMENTAL 1 /* convolve, smudge */
typedef enum
{
CONSTANT, /*< nick=CONTINUOUS >*/ /* pencil, paintbrush, airbrush, clone */
INCREMENTAL /* convolve, smudge */
} PaintApplicationMode;
/* gradient paint modes */
#define ONCE_FORWARD 0 /* paint through once, then stop */

File diff suppressed because it is too large Load Diff

View File

@ -19,18 +19,23 @@
#define __TEXT_TOOL_H__
#include "tools.h"
#include "procedural_db.h"
#include "layerF.h"
#include "gimpimageF.h"
#include "gimpdrawableF.h"
typedef enum {
PIXELS,
POINTS
} SizeType;
#define SUPERSAMPLE 3
/* text functions */
Tool * tools_new_text (void);
void tools_free_text (Tool *);
/* Procedure definition and marshalling function */
extern ProcRecord text_tool_proc;
extern ProcRecord text_tool_proc_ext;
extern ProcRecord text_tool_proc_fontname;
extern ProcRecord text_tool_get_extents_proc;
extern ProcRecord text_tool_get_extents_proc_ext;
extern ProcRecord text_tool_get_extents_proc_fontname;
int text_get_extents (char *, char *, int *, int *, int *, int *);
GimpLayer * text_render (GimpImage *, GimpDrawable *, int, int, char *,
char *, int, int);
#endif /* __TEXT_TOOL_H__ */