normalized the names of the fields of gimpressionist_vals_t.

* plug-ins/gimpressionist/*.[ch]: normalized the names of the fields
of gimpressionist_vals_t.
This commit is contained in:
Shlomi Fish 2004-07-29 18:41:47 +00:00
parent c307429a24
commit e8ae7e7f28
15 changed files with 296 additions and 283 deletions

View File

@ -1,3 +1,8 @@
2004-07-29 Shlomi Fish <shlomif@iglu.org.il>
* plug-ins/gimpressionist/*.[ch]: normalized the names of the fields
of gimpressionist_vals_t.
2004-07-29 Sven Neumann <sven@gimp.org>
* libgimpwidgets/Makefile.am

View File

@ -41,10 +41,10 @@ static ppm_t brushppm = {0, 0, NULL};
void brush_restore(void)
{
reselect (brush_list, pcvals.selectedbrush);
reselect (brush_list, pcvals.selected_brush);
gtk_adjustment_set_value (GTK_ADJUSTMENT(brush_gamma_adjust), pcvals.brushgamma);
gtk_adjustment_set_value (GTK_ADJUSTMENT(brush_relief_adjust), pcvals.brushrelief);
gtk_adjustment_set_value (GTK_ADJUSTMENT(brush_aspect_adjust), pcvals.brushaspect);
gtk_adjustment_set_value (GTK_ADJUSTMENT(brush_relief_adjust), pcvals.brush_relief);
gtk_adjustment_set_value (GTK_ADJUSTMENT(brush_aspect_adjust), pcvals.brush_aspect);
}
void brush_store(void)
@ -60,7 +60,7 @@ void brush_free(void)
void brush_get_selected (ppm_t *p)
{
if(brush_from_file)
brush_reload (pcvals.selectedbrush, p);
brush_reload (pcvals.selected_brush, p);
else
ppm_copy (&brushppm, p);
}
@ -74,7 +74,7 @@ static gboolean file_is_color (const char *fn)
void set_colorbrushes (const gchar *fn)
{
pcvals.colorbrushes = file_is_color(fn);
pcvals.color_brushes = file_is_color(fn);
}
static void
@ -158,8 +158,8 @@ brushdmenuselect (GtkWidget *widget,
}
g_free (src_row);
if(bpp >= 3) pcvals.colorbrushes = 1;
else pcvals.colorbrushes = 0;
if(bpp >= 3) pcvals.color_brushes = 1;
else pcvals.color_brushes = 0;
brush_from_file = 0;
update_brush_preview(NULL);
@ -394,8 +394,8 @@ brush_select (GtkTreeSelection *selection)
{
fname = g_build_filename ("Brushes", brush, NULL);
g_strlcpy (pcvals.selectedbrush,
fname, sizeof (pcvals.selectedbrush));
g_strlcpy (pcvals.selected_brush,
fname, sizeof (pcvals.selected_brush));
update_brush_preview (fname);
@ -420,7 +420,7 @@ static void
brush_asepct_adjust_cb (GtkWidget *w, gpointer data)
{
gimp_double_adjustment_update (GTK_ADJUSTMENT(w), data);
update_brush_preview (pcvals.selectedbrush);
update_brush_preview (pcvals.selected_brush);
}
void
@ -483,7 +483,7 @@ create_brushpage(GtkNotebook *notebook)
gtk_box_pack_start (GTK_BOX (box3), tmpw, FALSE, FALSE, 0);
gtk_widget_show (tmpw);
g_signal_connect_swapped (brush_gamma_adjust, "value_changed",
G_CALLBACK(update_brush_preview), pcvals.selectedbrush);
G_CALLBACK(update_brush_preview), pcvals.selected_brush);
gimp_help_set_help_data
(tmpw, _("Changes the gamma (brightness) of the selected brush"), NULL);
@ -524,7 +524,7 @@ create_brushpage(GtkNotebook *notebook)
brush_aspect_adjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 0,
_("Aspect ratio:"),
150, -1, pcvals.brushaspect,
150, -1, pcvals.brush_aspect,
-1.0, 1.0, 0.1, 0.1, 2,
TRUE, 0, 0,
_("Specifies the aspect ratio of the brush"),
@ -532,12 +532,12 @@ create_brushpage(GtkNotebook *notebook)
gtk_size_group_add_widget (group,
GIMP_SCALE_ENTRY_LABEL (brush_aspect_adjust));
g_signal_connect (brush_aspect_adjust, "value_changed",
G_CALLBACK (brush_asepct_adjust_cb), &pcvals.brushaspect);
G_CALLBACK (brush_asepct_adjust_cb), &pcvals.brush_aspect);
brush_relief_adjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 1,
_("Relief:"),
150, -1, pcvals.brushrelief,
150, -1, pcvals.brush_relief,
0.0, 100.0, 1.0, 10.0, 1,
TRUE, 0, 0,
_("Specifies the amount of embossing to apply to the image (in percent)"),
@ -546,10 +546,10 @@ create_brushpage(GtkNotebook *notebook)
GIMP_SCALE_ENTRY_LABEL (brush_relief_adjust));
g_signal_connect (brush_relief_adjust, "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.brushrelief);
&pcvals.brush_relief);
brush_select (selection);
readdirintolist ("Brushes", view, pcvals.selectedbrush);
readdirintolist ("Brushes", view, pcvals.selected_brush);
/*
* This is so the "changed signal won't get sent to the brushes' list

View File

@ -19,8 +19,8 @@ static GtkObject *colornoiseadjust = NULL;
void color_restore(void)
{
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON(colorradio[pcvals.colortype]), TRUE);
gtk_adjustment_set_value(GTK_ADJUSTMENT(colornoiseadjust), pcvals.colornoise);
(GTK_TOGGLE_BUTTON(colorradio[pcvals.color_type]), TRUE);
gtk_adjustment_set_value(GTK_ADJUSTMENT(colornoiseadjust), pcvals.color_noise);
}
int color_type_input (int in)
@ -42,7 +42,7 @@ void create_colorpage(GtkNotebook *notebook)
frame = gimp_int_radio_group_new (TRUE, _("Color"),
G_CALLBACK (gimp_radio_button_update),
&pcvals.colortype, 0,
&pcvals.color_type, 0,
_("A_verage under brush"),
COLOR_TYPE_AVERAGE, &colorradio[COLOR_TYPE_AVERAGE],
@ -69,14 +69,14 @@ void create_colorpage(GtkNotebook *notebook)
colornoiseadjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 0,
_("Color _noise:"),
100, -1, pcvals.colornoise,
100, -1, pcvals.color_noise,
0.0, 100.0, 1.0, 5.0, 0,
TRUE, 0, 0,
_("Adds random noise to the color"),
NULL);
g_signal_connect (colornoiseadjust, "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.colornoise);
&pcvals.color_noise);
color_restore();

View File

@ -35,16 +35,16 @@ static int normalize_bg(int n)
static void general_bg_callback(GtkWidget *wg, void *d)
{
pcvals.generalbgtype = normalize_bg (GPOINTER_TO_INT (d));
pcvals.general_background_type = normalize_bg (GPOINTER_TO_INT (d));
}
void general_store(void)
{
pcvals.general_paint_edges = GTK_TOGGLE_BUTTON(general_paint_edges)->active;
pcvals.generaldarkedge = GTK_ADJUSTMENT(general_dark_edge_adjust)->value;
pcvals.general_dark_edge = GTK_ADJUSTMENT(general_dark_edge_adjust)->value;
pcvals.general_tileable = GTK_TOGGLE_BUTTON(general_tileable)->active;
pcvals.general_drop_shadow = GTK_TOGGLE_BUTTON(general_drop_shadow)->active;
pcvals.generalshadowdarkness = GTK_ADJUSTMENT(general_shadow_adjust)->value;
pcvals.general_shadow_darkness = GTK_ADJUSTMENT(general_shadow_adjust)->value;
pcvals.general_shadow_depth = GTK_ADJUSTMENT(general_shadow_depth)->value;
pcvals.general_shadow_blur = GTK_ADJUSTMENT(general_shadow_blur)->value;
pcvals.devthresh = GTK_ADJUSTMENT(dev_thresh_adjust)->value;
@ -58,7 +58,7 @@ int general_bg_type_input (int in)
void general_restore(void)
{
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (general_bg_radio[normalize_bg (pcvals.generalbgtype)]
GTK_TOGGLE_BUTTON (general_bg_radio[normalize_bg (pcvals.general_background_type)]
),
TRUE
);
@ -66,9 +66,9 @@ void general_restore(void)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (general_paint_edges),
pcvals.general_paint_edges);
gtk_adjustment_set_value (GTK_ADJUSTMENT (general_dark_edge_adjust),
pcvals.generaldarkedge);
pcvals.general_dark_edge);
gtk_adjustment_set_value (GTK_ADJUSTMENT (general_shadow_adjust),
pcvals.generalshadowdarkness);
pcvals.general_shadow_darkness);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (general_drop_shadow),
pcvals.general_drop_shadow);
gtk_adjustment_set_value (GTK_ADJUSTMENT (general_shadow_depth),
@ -163,7 +163,7 @@ void create_generalpage(GtkNotebook *notebook)
gtk_widget_set_sensitive (tmpw, FALSE);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (general_bg_radio[pcvals.generalbgtype]), TRUE);
(GTK_TOGGLE_BUTTON (general_bg_radio[pcvals.general_background_type]), TRUE);
box1 = gtk_hbox_new (FALSE, 12);
gtk_box_pack_start(GTK_BOX(thispage), box1, FALSE, FALSE, 0);
@ -208,7 +208,7 @@ void create_generalpage(GtkNotebook *notebook)
general_dark_edge_adjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 0,
_("Edge darken:"),
150, 6, pcvals.generaldarkedge,
150, 6, pcvals.general_dark_edge,
0.0, 1.0, 0.01, 0.1, 2,
TRUE, 0, 0,
_("How much to \"darken\" the edges of each brush stroke"),
@ -217,7 +217,7 @@ void create_generalpage(GtkNotebook *notebook)
general_shadow_adjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 1,
_("Shadow darken:"),
150, 6, pcvals.generalshadowdarkness,
150, 6, pcvals.general_shadow_darkness,
0.0, 99.0, 0.1, 1, 2,
TRUE, 0, 0,
_("How much to \"darken\" the drop shadow"),

View File

@ -11,6 +11,7 @@
#include "color.h"
#include "general.h"
#include "orientation.h"
#include "orientmap.h"
#include "placement.h"
#include "preview.h"
#include "size.h"

View File

@ -37,53 +37,53 @@ typedef struct smvector
typedef struct
{
int orientnum;
double orientfirst;
double orientlast;
int orienttype;
double brushrelief;
double brushscale;
double brushdensity;
int orient_num;
double orient_first;
double orient_last;
int orient_type;
double brush_relief;
double brush_scale;
double brush_density;
double brushgamma;
int generalbgtype;
double generaldarkedge;
double paperrelief;
double paperscale;
int general_background_type;
double general_dark_edge;
double paper_relief;
double paper_scale;
int paper_invert;
int run;
char selectedbrush[200];
char selectedpaper[200];
char selected_brush[200];
char selected_paper[200];
GimpRGB color;
int general_paint_edges;
int placetype;
vector_t orientvector[MAXORIENTVECT];
int numorientvector;
int place_type;
vector_t orient_vectors[MAXORIENTVECT];
int num_orient_vectors;
int placement_center;
double brushaspect;
double orientangoff;
double orientstrexp;
double brush_aspect;
double orient_angle_offset;
double orient_strength_exponent;
int general_tileable;
int paper_overlay;
int orient_voronoi;
int colorbrushes;
int color_brushes;
int general_drop_shadow;
double generalshadowdarkness;
int sizenum;
double sizefirst;
double sizelast;
int sizetype;
double general_shadow_darkness;
int size_num;
double size_first;
double size_last;
int size_type;
double devthresh;
smvector_t sizevector[MAXSIZEVECT];
int numsizevector;
double sizestrexp;
int sizevoronoi;
smvector_t size_vectors[MAXSIZEVECT];
int num_size_vectors;
double size_strength_exponent;
int size_voronoi;
int general_shadow_depth;
int general_shadow_blur;
int colortype;
double colornoise;
int color_type;
double color_noise;
} gimpressionist_vals_t;
/* Enumerations */
@ -147,7 +147,7 @@ double dist (double x, double y, double dx, double dy);
void restore_default_values (void);
GtkWidget *create_radio_button (GtkWidget *box, int orienttype,
GtkWidget *create_radio_button (GtkWidget *box, int orient_type,
void (*callback)(GtkWidget *wg, void *d),
gchar *label, gchar *help_string,
GSList **radio_group,
@ -158,3 +158,4 @@ GtkWidget *create_radio_button (GtkWidget *box, int orienttype,
#endif /* #ifndef __GIMPRESSIONIST_H */

View File

@ -19,7 +19,7 @@ static GtkObject *orient_last_adjust = NULL;
static void orientation_store (GtkWidget *wg, void *d)
{
pcvals.orienttype = GPOINTER_TO_INT (d);
pcvals.orient_type = GPOINTER_TO_INT (d);
}
int orientation_type_input (int in)
@ -30,20 +30,20 @@ int orientation_type_input (int in)
void orientation_restore(void)
{
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (orient_radio[pcvals.orienttype]),
GTK_TOGGLE_BUTTON (orient_radio[pcvals.orient_type]),
TRUE
);
gtk_adjustment_set_value (
GTK_ADJUSTMENT (orient_num_adjust),
pcvals.orientnum
pcvals.orient_num
);
gtk_adjustment_set_value (
GTK_ADJUSTMENT (orient_first_adjust),
pcvals.orientfirst
pcvals.orient_first
);
gtk_adjustment_set_value (
GTK_ADJUSTMENT (orient_last_adjust),
pcvals.orientlast
pcvals.orient_last
);
}
@ -55,12 +55,12 @@ static void create_orientmap_dialog_helper (void)
}
static void create_orientradio_button (GtkWidget *box, int orienttype,
static void create_orientradio_button (GtkWidget *box, int orient_type,
gchar *label, gchar *help_string,
GSList **radio_group
)
{
create_radio_button (box, orienttype, orientation_store, label,
create_radio_button (box, orient_type, orientation_store, label,
help_string, radio_group, orient_radio);
return;
}
@ -87,38 +87,38 @@ create_orientationpage (GtkNotebook *notebook)
orient_num_adjust =
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Directions:"),
150, -1, pcvals.orientnum,
150, -1, pcvals.orient_num,
1.0, 30.0, 1.0, 1.0, 0,
TRUE, 0, 0,
_("The number of directions (i.e. brushes) to use"),
NULL);
g_signal_connect (orient_num_adjust, "value_changed",
G_CALLBACK (gimp_int_adjustment_update),
&pcvals.orientnum);
&pcvals.orient_num);
orient_first_adjust =
gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("Start angle:"),
150, -1, pcvals.orientfirst,
150, -1, pcvals.orient_first,
0.0, 360.0, 1.0, 10.0, 0,
TRUE, 0, 0,
_("The starting angle of the first brush to create"),
NULL);
g_signal_connect (orient_first_adjust, "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.orientfirst);
&pcvals.orient_first);
orient_last_adjust =
gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
_("Angle span:"),
150, -1, pcvals.orientlast,
150, -1, pcvals.orient_last,
0.0, 360.0, 1.0, 10.0, 0,
TRUE, 0, 0,
_("The angle span of the first brush to create"),
NULL);
g_signal_connect (orient_last_adjust, "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.orientlast);
&pcvals.orient_last);
box2 = gtk_hbox_new (FALSE, 12);
gtk_box_pack_start (GTK_BOX (thispage), box2, FALSE, FALSE, 0);

View File

@ -64,10 +64,10 @@ double get_direction (double x, double y, int from)
strexp = GTK_ADJUSTMENT(orient_map_str_exp_adjust)->value;
voronoi = GTK_TOGGLE_BUTTON(orient_voronoi)->active;
} else {
n = pcvals.numorientvector;
vec = pcvals.orientvector;
angoff = pcvals.orientangoff;
strexp = pcvals.orientstrexp;
n = pcvals.num_orient_vectors;
vec = pcvals.orient_vectors;
angoff = pcvals.orient_angle_offset;
strexp = pcvals.orient_strength_exponent;
voronoi = pcvals.orient_voronoi;
}
@ -374,11 +374,11 @@ orient_map_response (GtkWidget *widget,
gint i;
for(i = 0; i < num_vectors; i++)
pcvals.orientvector[i] = vector[i];
pcvals.orient_vectors[i] = vector[i];
pcvals.numorientvector = num_vectors;
pcvals.orientstrexp = GTK_ADJUSTMENT (orient_map_str_exp_adjust)->value;
pcvals.orientangoff = GTK_ADJUSTMENT (angle_offset_adjust)->value;
pcvals.num_orient_vectors = num_vectors;
pcvals.orient_strength_exponent = GTK_ADJUSTMENT (orient_map_str_exp_adjust)->value;
pcvals.orient_angle_offset = GTK_ADJUSTMENT (angle_offset_adjust)->value;
pcvals.orient_voronoi = GTK_TOGGLE_BUTTON (orient_voronoi)->active;
}
};
@ -389,12 +389,12 @@ orient_map_response (GtkWidget *widget,
static void init_vectors(void)
{
if (pcvals.numorientvector) {
if (pcvals.num_orient_vectors) {
int i;
num_vectors = pcvals.numorientvector;
num_vectors = pcvals.num_orient_vectors;
for(i = 0; i < num_vectors; i++) {
vector[i] = pcvals.orientvector[i];
vector[i] = pcvals.orient_vectors[i];
}
} else {/* Shouldn't happen */
num_vectors = 0;
@ -410,8 +410,8 @@ void update_orientmap_dialog(void)
init_vectors();
gtk_adjustment_set_value (GTK_ADJUSTMENT(orient_map_str_exp_adjust), pcvals.orientstrexp);
gtk_adjustment_set_value (GTK_ADJUSTMENT(angle_offset_adjust), pcvals.orientangoff);
gtk_adjustment_set_value (GTK_ADJUSTMENT(orient_map_str_exp_adjust), pcvals.orient_strength_exponent);
gtk_adjustment_set_value (GTK_ADJUSTMENT(angle_offset_adjust), pcvals.orient_angle_offset);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(orient_voronoi), pcvals.orient_voronoi);
update_vector_prev();

View File

@ -33,7 +33,7 @@ static void paper_update_preview(void)
gdouble sc;
ppm_t p = {0,0,NULL};
ppm_load(pcvals.selectedpaper, &p);
ppm_load(pcvals.selected_paper, &p);
sc = p.width > p.height ? p.width : p.height;
sc = 100.0 / sc;
resize(&p, p.width*sc,p.height*sc);
@ -69,8 +69,8 @@ static void paper_select(GtkTreeSelection *selection, gpointer data)
{
gchar *fname = g_build_filename ("Paper", paper, NULL);
g_strlcpy (pcvals.selectedpaper,
fname, sizeof (pcvals.selectedpaper));
g_strlcpy (pcvals.selected_paper,
fname, sizeof (pcvals.selected_paper));
paper_update_preview ();
@ -82,9 +82,9 @@ static void paper_select(GtkTreeSelection *selection, gpointer data)
void paper_restore(void)
{
reselect(paper_list, pcvals.selectedpaper);
gtk_adjustment_set_value(GTK_ADJUSTMENT(paper_relief_adjust), pcvals.paperrelief);
gtk_adjustment_set_value(GTK_ADJUSTMENT(paper_scale_adjust), pcvals.paperscale);
reselect(paper_list, pcvals.selected_paper);
gtk_adjustment_set_value(GTK_ADJUSTMENT(paper_relief_adjust), pcvals.paper_relief);
gtk_adjustment_set_value(GTK_ADJUSTMENT(paper_scale_adjust), pcvals.paper_scale);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(paper_invert), pcvals.paper_invert);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(paper_overlay), pcvals.paper_overlay);
}
@ -160,32 +160,32 @@ void create_paperpage(GtkNotebook *notebook)
paper_scale_adjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 0,
_("Scale:"),
150, -1, pcvals.paperscale,
150, -1, pcvals.paper_scale,
3.0, 150.0, 1.0, 10.0, 1,
TRUE, 0, 0,
_("Specifies the scale of the texture (in percent of original file)"),
NULL);
g_signal_connect (paper_scale_adjust, "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.paperscale);
&pcvals.paper_scale);
paper_relief_adjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 1,
_("Relief:"),
150, -1, pcvals.paperrelief,
150, -1, pcvals.paper_relief,
0.0, 100.0, 1.0, 10.0, 1,
TRUE, 0, 0,
_("Specifies the amount of embossing to apply to the image (in percent)"),
NULL);
g_signal_connect (paper_relief_adjust, "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.paperrelief);
&pcvals.paper_relief);
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL(paper_store_list), &iter))
gtk_tree_selection_select_iter (selection, &iter);
paper_select(selection, NULL);
readdirintolist("Paper", view, pcvals.selectedpaper);
readdirintolist("Paper", view, pcvals.selected_paper);
gtk_notebook_append_page_menu (notebook, thispage, label, NULL);
}

View File

@ -19,9 +19,9 @@ static GtkObject *brush_density_adjust = NULL;
void place_restore()
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (placement_radio[pcvals.placetype]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (placement_radio[pcvals.place_type]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (placement_center), pcvals.placement_center);
gtk_adjustment_set_value (GTK_ADJUSTMENT (brush_density_adjust), pcvals.brushdensity);
gtk_adjustment_set_value (GTK_ADJUSTMENT (brush_density_adjust), pcvals.brush_density);
}
int place_type_input (int in)
@ -47,7 +47,7 @@ void create_placementpage(GtkNotebook *notebook)
frame = gimp_int_radio_group_new (TRUE, _("Placement"),
G_CALLBACK (gimp_radio_button_update),
&pcvals.placetype, 0,
&pcvals.place_type, 0,
_("Randomly"), PLACEMENT_TYPE_RANDOM,
&placement_radio[PLACEMENT_TYPE_RANDOM],
@ -67,7 +67,7 @@ void create_placementpage(GtkNotebook *notebook)
gtk_widget_show (frame);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (placement_radio[pcvals.placetype]), TRUE);
(GTK_TOGGLE_BUTTON (placement_radio[pcvals.place_type]), TRUE);
table = gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE(table), 6);
@ -77,14 +77,14 @@ void create_placementpage(GtkNotebook *notebook)
brush_density_adjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 0,
_("Stroke _density:"),
100, -1, pcvals.brushdensity,
100, -1, pcvals.brush_density,
1.0, 50.0, 1.0, 5.0, 0,
TRUE, 0, 0,
_("The relative density of the brush strokes"),
NULL);
g_signal_connect (brush_density_adjust, "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.brushdensity);
&pcvals.brush_density);
placement_center = tmpw = gtk_check_button_new_with_mnemonic( _("Centerize"));
gtk_box_pack_start(GTK_BOX (vbox), tmpw, FALSE, FALSE, 0);

View File

@ -254,25 +254,25 @@ static void set_orient_vector (const gchar *str)
n = atoi(tmps);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.orientvector[n].x = g_ascii_strtod (++tmps, NULL);
pcvals.orient_vectors[n].x = g_ascii_strtod (++tmps, NULL);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.orientvector[n].y = g_ascii_strtod (++tmps, NULL);
pcvals.orient_vectors[n].y = g_ascii_strtod (++tmps, NULL);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.orientvector[n].dir = g_ascii_strtod (++tmps, NULL);
pcvals.orient_vectors[n].dir = g_ascii_strtod (++tmps, NULL);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.orientvector[n].dx = g_ascii_strtod (++tmps, NULL);
pcvals.orient_vectors[n].dx = g_ascii_strtod (++tmps, NULL);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.orientvector[n].dy = g_ascii_strtod (++tmps, NULL);
pcvals.orient_vectors[n].dy = g_ascii_strtod (++tmps, NULL);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.orientvector[n].str = g_ascii_strtod (++tmps, NULL);
pcvals.orient_vectors[n].str = g_ascii_strtod (++tmps, NULL);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.orientvector[n].type = atoi (++tmps);
pcvals.orient_vectors[n].type = atoi (++tmps);
}
@ -284,16 +284,16 @@ static void set_size_vector (const gchar *str)
n = atoi(tmps);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.sizevector[n].x = g_ascii_strtod (++tmps, NULL);
pcvals.size_vectors[n].x = g_ascii_strtod (++tmps, NULL);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.sizevector[n].y = g_ascii_strtod (++tmps, NULL);
pcvals.size_vectors[n].y = g_ascii_strtod (++tmps, NULL);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.sizevector[n].siz = g_ascii_strtod (++tmps, NULL);
pcvals.size_vectors[n].siz = g_ascii_strtod (++tmps, NULL);
if(!(tmps = strchr(tmps, ','))) return;
pcvals.sizevector[n].str = g_ascii_strtod (++tmps, NULL);
pcvals.size_vectors[n].str = g_ascii_strtod (++tmps, NULL);
}
@ -311,41 +311,41 @@ static void set_values (const gchar *key, const gchar *val)
if(!strcmp(key, "desc"))
parse_desc(val, presetdesc, sizeof (presetdesc));
else if(!strcmp(key, "orientnum"))
pcvals.orientnum = atoi(val);
pcvals.orient_num = atoi(val);
else if(!strcmp(key, "orientfirst"))
pcvals.orientfirst = g_ascii_strtod (val, NULL);
pcvals.orient_first = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "orientlast"))
pcvals.orientlast = g_ascii_strtod (val, NULL);
pcvals.orient_last = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "orienttype"))
pcvals.orienttype = orientation_type_input (atoi (val));
pcvals.orient_type = orientation_type_input (atoi (val));
else if(!strcmp(key, "sizenum"))
pcvals.sizenum = atoi(val);
pcvals.size_num = atoi(val);
else if(!strcmp(key, "sizefirst"))
pcvals.sizefirst = g_ascii_strtod (val, NULL);
pcvals.size_first = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "sizelast"))
pcvals.sizelast = g_ascii_strtod (val, NULL);
pcvals.size_last = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "sizetype"))
pcvals.sizetype = size_type_input (atoi (val));
pcvals.size_type = size_type_input (atoi (val));
else if(!strcmp(key, "brushrelief"))
pcvals.brushrelief = g_ascii_strtod (val, NULL);
pcvals.brush_relief = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "brushscale")) {
/* For compatibility */
pcvals.sizenum = 1;
pcvals.sizefirst = pcvals.sizelast = g_ascii_strtod (val, NULL);
pcvals.size_num = 1;
pcvals.size_first = pcvals.size_last = g_ascii_strtod (val, NULL);
}
else if(!strcmp(key, "brushdensity"))
pcvals.brushdensity = g_ascii_strtod (val, NULL);
pcvals.brush_density = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "brushgamma"))
pcvals.brushgamma = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "brushaspect"))
pcvals.brushaspect = g_ascii_strtod (val, NULL);
pcvals.brush_aspect = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "generalbgtype"))
pcvals.generalbgtype = general_bg_type_input (atoi(val));
pcvals.general_background_type = general_bg_type_input (atoi(val));
else if(!strcmp(key, "generaldarkedge"))
pcvals.generaldarkedge = g_ascii_strtod (val, NULL);
pcvals.general_dark_edge = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "generalpaintedges"))
pcvals.general_paint_edges = atoi(val);
else if(!strcmp(key, "generaltileable"))
@ -353,7 +353,7 @@ static void set_values (const gchar *key, const gchar *val)
else if(!strcmp(key, "generaldropshadow"))
pcvals.general_drop_shadow = atoi(val);
else if(!strcmp(key, "generalshadowdarkness"))
pcvals.generalshadowdarkness = g_ascii_strtod (val, NULL);
pcvals.general_shadow_darkness = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "generalshadowdepth"))
pcvals.general_shadow_depth = atoi(val);
else if(!strcmp(key, "generalshadowblur"))
@ -362,23 +362,23 @@ static void set_values (const gchar *key, const gchar *val)
pcvals.devthresh = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "paperrelief"))
pcvals.paperrelief = g_ascii_strtod (val, NULL);
pcvals.paper_relief = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "paperscale"))
pcvals.paperscale = g_ascii_strtod (val, NULL);
pcvals.paper_scale = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "paperinvert"))
pcvals.paper_invert = atoi(val);
else if(!strcmp(key, "paperoverlay"))
pcvals.paper_overlay = atoi(val);
else if(!strcmp(key, "placetype"))
pcvals.placetype = place_type_input (atoi (val));
pcvals.place_type = place_type_input (atoi (val));
else if(!strcmp(key, "placecenter"))
pcvals.placement_center = atoi(val);
else if(!strcmp(key, "selectedbrush"))
g_strlcpy (pcvals.selectedbrush, val, sizeof (pcvals.selectedbrush));
g_strlcpy (pcvals.selected_brush, val, sizeof (pcvals.selected_brush));
else if(!strcmp(key, "selectedpaper"))
g_strlcpy (pcvals.selectedpaper, val, sizeof (pcvals.selectedpaper));
g_strlcpy (pcvals.selected_paper, val, sizeof (pcvals.selected_paper));
else if(!strcmp(key, "color")){
char *c = parse_rgb_string(val);
@ -386,29 +386,29 @@ static void set_values (const gchar *key, const gchar *val)
}
else if(!strcmp(key, "numorientvector"))
pcvals.numorientvector = atoi(val);
pcvals.num_orient_vectors = atoi(val);
else if(!strcmp(key, "orientvector"))
set_orient_vector(val);
else if(!strcmp(key, "orientangoff"))
pcvals.orientangoff = g_ascii_strtod (val, NULL);
pcvals.orient_angle_offset = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "orientstrexp"))
pcvals.orientstrexp = g_ascii_strtod (val, NULL);
pcvals.orient_strength_exponent = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "orientvoronoi"))
pcvals.orient_voronoi = atoi(val);
else if(!strcmp(key, "numsizevector"))
pcvals.numsizevector = atoi(val);
pcvals.num_size_vectors = atoi(val);
else if(!strcmp(key, "sizevector"))
set_size_vector(val);
else if(!strcmp(key, "sizestrexp"))
pcvals.sizestrexp = g_ascii_strtod (val, NULL);
pcvals.size_strength_exponent = g_ascii_strtod (val, NULL);
else if(!strcmp(key, "sizevoronoi"))
pcvals.sizevoronoi = atoi(val);
pcvals.size_voronoi = atoi(val);
else if(!strcmp(key, "colortype"))
pcvals.colortype = color_type_input (atoi (val));
pcvals.color_type = color_type_input (atoi (val));
else if(!strcmp(key, "colornoise"))
pcvals.colornoise = g_ascii_strtod (val, NULL);
pcvals.color_noise = g_ascii_strtod (val, NULL);
}
static int load_preset(const gchar *fn)
@ -476,7 +476,7 @@ int select_preset(const gchar *preset)
/* This is so the colorbrushes param (that is not stored in the
* preset will be set correctly upon the preset loading.
* */
set_colorbrushes (pcvals.selectedbrush);
set_colorbrushes (pcvals.selected_brush);
}
return ret;
@ -704,96 +704,98 @@ static void save_preset(void)
preset_name_escaped = g_strescape (preset_name, NULL);
fprintf(f, "name=%s\n", preset_name_escaped);
g_free (preset_name_escaped);
fprintf(f, "orientnum=%d\n", pcvals.orientnum);
fprintf(f, "orientnum=%d\n", pcvals.orient_num);
fprintf(f, "orientfirst=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientfirst));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_first));
fprintf(f, "orientlast=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientlast));
fprintf(f, "orienttype=%d\n", pcvals.orienttype);
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_last));
fprintf(f, "orienttype=%d\n", pcvals.orient_type);
fprintf(f, "sizenum=%d\n", pcvals.sizenum);
fprintf(f, "sizenum=%d\n", pcvals.size_num);
fprintf(f, "sizefirst=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizefirst));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.size_first));
fprintf(f, "sizelast=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizelast));
fprintf(f, "sizetype=%d\n", pcvals.sizetype);
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.size_last));
fprintf(f, "sizetype=%d\n", pcvals.size_type);
fprintf(f, "brushrelief=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brushrelief));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brush_relief));
fprintf(f, "brushdensity=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brushdensity));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brush_density));
fprintf(f, "brushgamma=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brushgamma));
fprintf(f, "brushaspect=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brushaspect));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brush_aspect));
fprintf(f, "generalbgtype=%d\n", pcvals.generalbgtype);
fprintf(f, "generalbgtype=%d\n", pcvals.general_background_type);
fprintf(f, "generaldarkedge=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.generaldarkedge));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.general_dark_edge));
fprintf(f, "generalpaintedges=%d\n", pcvals.general_paint_edges);
fprintf(f, "generaltileable=%d\n", pcvals.general_tileable);
fprintf(f, "generaldropshadow=%d\n", pcvals.general_drop_shadow);
fprintf(f, "generalshadowdarkness=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.generalshadowdarkness));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.general_shadow_darkness));
fprintf(f, "generalshadowdepth=%d\n", pcvals.general_shadow_depth);
fprintf(f, "generalshadowblur=%d\n", pcvals.general_shadow_blur);
fprintf(f, "devthresh=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.devthresh));
fprintf(f, "paperrelief=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.paperrelief));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.paper_relief));
fprintf(f, "paperscale=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.paperscale));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.paper_scale));
fprintf(f, "paperinvert=%d\n", pcvals.paper_invert);
fprintf(f, "paperoverlay=%d\n", pcvals.paper_overlay);
fprintf(f, "selectedbrush=%s\n", pcvals.selectedbrush);
fprintf(f, "selectedpaper=%s\n", pcvals.selectedpaper);
fprintf(f, "selectedbrush=%s\n", pcvals.selected_brush);
fprintf(f, "selectedpaper=%s\n", pcvals.selected_paper);
gimp_rgb_get_uchar(&pcvals.color, &color[0], &color[1], &color[2]);
fprintf(f, "color=%02x%02x%02x\n", color[0], color[1], color[2]);
fprintf(f, "placetype=%d\n", pcvals.placetype);
fprintf(f, "placetype=%d\n", pcvals.place_type);
fprintf(f, "placecenter=%d\n", pcvals.placement_center);
fprintf(f, "numorientvector=%d\n", pcvals.numorientvector);
for(i = 0; i < pcvals.numorientvector; i++)
fprintf(f, "numorientvector=%d\n", pcvals.num_orient_vectors);
for(i = 0; i < pcvals.num_orient_vectors; i++)
{
g_ascii_formatd (vbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].x);
g_ascii_formatd (vbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].y);
g_ascii_formatd (vbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].dir);
g_ascii_formatd (vbuf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].dx);
g_ascii_formatd (vbuf[4], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].dy);
g_ascii_formatd (vbuf[5], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].str);
g_ascii_formatd (vbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_vectors[i].x);
g_ascii_formatd (vbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_vectors[i].y);
g_ascii_formatd (vbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_vectors[i].dir);
g_ascii_formatd (vbuf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_vectors[i].dx);
g_ascii_formatd (vbuf[4], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_vectors[i].dy);
g_ascii_formatd (vbuf[5], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_vectors[i].str);
fprintf (f, "orientvector=%d,%s,%s,%s,%s,%s,%s,%d\n", i,
vbuf[0], vbuf[1], vbuf[2], vbuf[3], vbuf[4], vbuf[5],
pcvals.orientvector[i].type);
pcvals.orient_vectors[i].type);
}
fprintf(f, "orientangoff=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientangoff));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
pcvals.orient_angle_offset));
fprintf(f, "orientstrexp=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientstrexp));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
pcvals.orient_strength_exponent));
fprintf(f, "orientvoronoi=%d\n", pcvals.orient_voronoi);
fprintf(f, "numsizevector=%d\n", pcvals.numsizevector);
for (i = 0; i < pcvals.numsizevector; i++)
fprintf(f, "numsizevector=%d\n", pcvals.num_size_vectors);
for (i = 0; i < pcvals.num_size_vectors; i++)
{
g_ascii_formatd (vbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizevector[i].x);
g_ascii_formatd (vbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizevector[i].y);
g_ascii_formatd (vbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizevector[i].siz);
g_ascii_formatd (vbuf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizevector[i].str);
g_ascii_formatd (vbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.size_vectors[i].x);
g_ascii_formatd (vbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.size_vectors[i].y);
g_ascii_formatd (vbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.size_vectors[i].siz);
g_ascii_formatd (vbuf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.size_vectors[i].str);
fprintf (f, "sizevector=%d,%s,%s,%s,%s\n", i,
vbuf[0], vbuf[1], vbuf[2], vbuf[3]);
}
fprintf(f, "sizestrexp=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizestrexp));
fprintf(f, "sizevoronoi=%d\n", pcvals.sizevoronoi);
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.size_strength_exponent));
fprintf(f, "sizevoronoi=%d\n", pcvals.size_voronoi);
fprintf(f, "colortype=%d\n", pcvals.colortype);
fprintf(f, "colortype=%d\n", pcvals.color_type);
fprintf(f, "colornoise=%s\n",
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.colornoise));
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.color_noise));
fclose (f);
preset_refresh_presets ();

View File

@ -23,8 +23,8 @@ static gimpressionist_vals_t runningvals;
static double get_siz_from_pcvals(double x, double y)
{
return getsiz_proto(x,y, pcvals.numsizevector, pcvals.sizevector,
pcvals.sizestrexp, pcvals.sizevoronoi);
return getsiz_proto(x,y, pcvals.num_size_vectors, pcvals.size_vectors,
pcvals.size_strength_exponent, pcvals.size_voronoi);
}
static int get_pixel_value (double dir)
@ -64,6 +64,9 @@ static double sum_brush (ppm_t *p)
return sum;
}
/* TODO : Use r = rgb[0]; g = rgb[1] ; b = rgb[2]; instead of
* the direct references here.
* */
static int get_hue (guchar *rgb)
{
double h, v, temp, diff;
@ -107,6 +110,7 @@ static int choose_best_brush (ppm_t *p, ppm_t *a, int tx, int ty,
#endif
thissum = brushes_sum[i];
/* TODO: Pointer-arithmeticize this code */
r = g = b = 0.0;
for(y = 0; y < brush->height; y++) {
guchar *row = p->col + (ty+y)*p->width*3;
@ -181,8 +185,8 @@ static void apply_brush (ppm_t *brush,
ppm_t atmp;
double v, h;
int x, y;
double edgedarken = 1.0 - runningvals.generaldarkedge;
double relief = runningvals.brushrelief / 100.0;
double edgedarken = 1.0 - runningvals.general_dark_edge;
double relief = runningvals.brush_relief / 100.0;
int shadowdepth = pcvals.general_shadow_depth;
int shadowblur = pcvals.general_shadow_blur;
@ -205,7 +209,7 @@ static void apply_brush (ppm_t *brush,
if((sx + x) >= tmp.width) break;
h = shadow->col[y*shadow->width*3+x*3+2];
if(!h) continue;
v = 1.0 - (h / 255.0 * runningvals.generalshadowdarkness / 100.0);
v = 1.0 - (h / 255.0 * runningvals.general_shadow_darkness / 100.0);
row[k+0] *= v;
row[k+1] *= v;
row[k+2] *= v;
@ -223,7 +227,7 @@ static void apply_brush (ppm_t *brush,
h = brush->col[y*brush->width*3+x*3];
if(!h) continue;
if(runningvals.colorbrushes) {
if(runningvals.color_brushes) {
v = 1.0 - brush->col[y*brush->width*3+x*3+2] / 255.0;
row[k+0] *= v;
row[k+1] *= v;
@ -299,13 +303,13 @@ void repaint(ppm_t *p, ppm_t *a)
return;
}
num_brushes = runningvals.orientnum * runningvals.sizenum;
startangle = runningvals.orientfirst;
anglespan = runningvals.orientlast;
num_brushes = runningvals.orient_num * runningvals.size_num;
startangle = runningvals.orient_first;
anglespan = runningvals.orient_last;
density = runningvals.brushdensity;
density = runningvals.brush_density;
if(runningvals.placetype == PLACEMENT_TYPE_EVEN_DIST)
if(runningvals.place_type == PLACEMENT_TYPE_EVEN_DIST)
density /= 3.0;
bgamma = runningvals.brushgamma;
@ -321,8 +325,8 @@ void repaint(ppm_t *p, ppm_t *a)
brushes[0].col = NULL;
brush_get_selected (&brushes[0]);
resize(&brushes[0], brushes[0].width, brushes[0].height * pow(10,runningvals.brushaspect));
scale = runningvals.sizelast / MAX(brushes[0].width, brushes[0].height);
resize(&brushes[0], brushes[0].width, brushes[0].height * pow(10,runningvals.brush_aspect));
scale = runningvals.size_last / MAX(brushes[0].width, brushes[0].height);
if(bgamma != 1.0)
ppm_apply_gamma(&brushes[0], 1.0/bgamma, 1,1,1);
@ -338,16 +342,16 @@ void repaint(ppm_t *p, ppm_t *a)
ppm_copy(&brushes[0], &brushes[i]);
}
for(i = 0; i < runningvals.sizenum; i++) {
for(i = 0; i < runningvals.size_num; i++) {
double sv;
if(runningvals.sizenum > 1)
sv = i / (runningvals.sizenum - 1.0);
if(runningvals.size_num > 1)
sv = i / (runningvals.size_num - 1.0);
else sv = 1.0;
for(j = 0; j < runningvals.orientnum; j++) {
h = j + i * runningvals.orientnum;
for(j = 0; j < runningvals.orient_num; j++) {
h = j + i * runningvals.orient_num;
free_rotate(&brushes[h],
startangle + j * anglespan / runningvals.orientnum);
rescale(&brushes[h], (sv * runningvals.sizefirst + (1.0-sv) * runningvals.sizelast) / runningvals.sizelast);
startangle + j * anglespan / runningvals.orient_num);
rescale(&brushes[h], (sv * runningvals.size_first + (1.0-sv) * runningvals.size_last) / runningvals.size_last);
autocrop(&brushes[h],1);
}
}
@ -362,7 +366,7 @@ void repaint(ppm_t *p, ppm_t *a)
#endif
for(i = 0; i < num_brushes; i++) {
if(!runningvals.colorbrushes)
if(!runningvals.color_brushes)
prepare_brush(&brushes[i]);
brushes_sum[i] = sum_brush(&brushes[i]);
}
@ -420,7 +424,7 @@ void repaint(ppm_t *p, ppm_t *a)
if(img_has_alpha) {
/* Initially fully transparent */
if(runningvals.generalbgtype == BG_TYPE_TRANSPARENT) {
if(runningvals.general_background_type == BG_TYPE_TRANSPARENT) {
guchar tmpcol[3] = {255,255,255};
ppm_new(&atmp, a->width, a->height);
fill(&atmp, tmpcol);
@ -429,17 +433,17 @@ void repaint(ppm_t *p, ppm_t *a)
}
}
if(runningvals.generalbgtype == BG_TYPE_SOLID) {
if(runningvals.general_background_type == BG_TYPE_SOLID) {
guchar tmpcol[3];
ppm_new(&tmp, p->width, p->height);
gimp_rgb_get_uchar(&runningvals.color, &tmpcol[0], &tmpcol[1], &tmpcol[2]);
fill(&tmp, tmpcol);
} else if(runningvals.generalbgtype == BG_TYPE_KEEP_ORIGINAL) {
} else if(runningvals.general_background_type == BG_TYPE_KEEP_ORIGINAL) {
ppm_copy(p, &tmp);
} else {
scale = runningvals.paperscale / 100.0;
scale = runningvals.paper_scale / 100.0;
ppm_new(&tmp, p->width, p->height);
ppm_load(runningvals.selectedpaper, &paper_ppm);
ppm_load(runningvals.selected_paper, &paper_ppm);
resize(&paper_ppm, paper_ppm.width * scale, paper_ppm.height * scale);
if(runningvals.paper_invert)
ppm_apply_gamma(&paper_ppm, -1.0, 1, 1, 1);
@ -456,7 +460,7 @@ void repaint(ppm_t *p, ppm_t *a)
cy = p->height / 2;
maxdist = sqrt(cx*cx+cy*cy);
switch(runningvals.orienttype)
switch(runningvals.orient_type)
{
case ORIENTATION_VALUE:
ppm_new(&dirmap, p->width, p->height);
@ -527,7 +531,7 @@ void repaint(ppm_t *p, ppm_t *a)
break;
}
if(runningvals.sizetype == SIZE_TYPE_VALUE)
if(runningvals.size_type == SIZE_TYPE_VALUE)
{
ppm_new(&sizmap, p->width, p->height);
for(y = 0; y < sizmap.height; y++) {
@ -538,7 +542,7 @@ void repaint(ppm_t *p, ppm_t *a)
}
}
}
else if(runningvals.sizetype == SIZE_TYPE_RADIUS)
else if(runningvals.size_type == SIZE_TYPE_RADIUS)
{
ppm_new(&sizmap, p->width, p->height);
for(y = 0; y < sizmap.height; y++) {
@ -549,7 +553,7 @@ void repaint(ppm_t *p, ppm_t *a)
}
}
}
else if(runningvals.sizetype == SIZE_TYPE_RADIAL)
else if(runningvals.size_type == SIZE_TYPE_RADIAL)
{
ppm_new(&sizmap, p->width, p->height);
for(y = 0; y < sizmap.height; y++) {
@ -559,7 +563,7 @@ void repaint(ppm_t *p, ppm_t *a)
}
}
}
else if(runningvals.sizetype == SIZE_TYPE_FLOWING)
else if(runningvals.size_type == SIZE_TYPE_FLOWING)
{
ppm_new(&sizmap, p->width / 6 + 5, p->height / 6 + 5);
mkgrayplasma(&sizmap, 15);
@ -570,7 +574,7 @@ void repaint(ppm_t *p, ppm_t *a)
if(runningvals.general_paint_edges)
edgepad(&sizmap, maxbrushwidth, maxbrushheight,maxbrushwidth, maxbrushheight);
}
else if(runningvals.sizetype == SIZE_TYPE_HUE)
else if(runningvals.size_type == SIZE_TYPE_HUE)
{
ppm_new(&sizmap, p->width, p->height);
for(y = 0; y < sizmap.height; y++) {
@ -581,14 +585,14 @@ void repaint(ppm_t *p, ppm_t *a)
}
}
}
else if(runningvals.sizetype == SIZE_TYPE_ADAPTIVE)
else if(runningvals.size_type == SIZE_TYPE_ADAPTIVE)
{
guchar tmpcol[3] = {0,0,0};
ppm_new(&sizmap, p->width, p->height);
fill(&sizmap, tmpcol);
}
else if(runningvals.sizetype == SIZE_TYPE_MANUAL)
else if(runningvals.size_type == SIZE_TYPE_MANUAL)
{
ppm_new(&sizmap, p->width-maxbrushwidth*2, p->height-maxbrushheight*2);
for(y = 0; y < sizmap.height; y++) {
@ -603,10 +607,10 @@ void repaint(ppm_t *p, ppm_t *a)
#if 0
ppm_save(&sizmap, "/tmp/_sizmap.ppm");
#endif
if(runningvals.placetype == PLACEMENT_TYPE_RANDOM) {
if(runningvals.place_type == PLACEMENT_TYPE_RANDOM) {
i = tmp.width * tmp.height / (maxbrushwidth * maxbrushheight);
i *= density;
} else if(runningvals.placetype == PLACEMENT_TYPE_EVEN_DIST) {
} else if(runningvals.place_type == PLACEMENT_TYPE_EVEN_DIST) {
i = (int)(tmp.width * density / maxbrushwidth) *
(int)(tmp.height * density / maxbrushheight);
step = i;
@ -620,7 +624,7 @@ void repaint(ppm_t *p, ppm_t *a)
progstep = max_progress / 30;
if(progstep < 10) progstep = 10;
if(runningvals.placetype == PLACEMENT_TYPE_EVEN_DIST) {
if(runningvals.place_type == PLACEMENT_TYPE_EVEN_DIST) {
int j;
xpos = g_new (int, i);
ypos = g_new (int, i);
@ -653,12 +657,12 @@ void repaint(ppm_t *p, ppm_t *a)
}
}
if(runningvals.placetype == PLACEMENT_TYPE_RANDOM) {
if(runningvals.place_type == PLACEMENT_TYPE_RANDOM) {
tx = g_rand_int_range (random_generator, maxbrushwidth/2,
tmp.width - maxbrushwidth/2);
ty = g_rand_int_range (random_generator, maxbrushheight/2,
tmp.height - maxbrushheight/2);
} else if(runningvals.placetype == PLACEMENT_TYPE_EVEN_DIST) {
} else if(runningvals.place_type == PLACEMENT_TYPE_EVEN_DIST) {
tx = xpos[i-1];
ty = ypos[i-1];
}
@ -684,9 +688,9 @@ void repaint(ppm_t *p, ppm_t *a)
n = sn = on = 0;
switch(runningvals.orienttype) {
switch(runningvals.orient_type) {
case ORIENTATION_RANDOM:
on = g_rand_int_range (random_generator, 0, runningvals.orientnum);
on = g_rand_int_range (random_generator, 0, runningvals.orient_num);
break;
case ORIENTATION_VALUE:
case ORIENTATION_RADIUS:
@ -694,7 +698,7 @@ void repaint(ppm_t *p, ppm_t *a)
case ORIENTATION_FLOWING:
case ORIENTATION_HUE:
case ORIENTATION_MANUAL:
on = runningvals.orientnum * dirmap.col[ty*dirmap.width*3+tx*3] / 256;
on = runningvals.orient_num * dirmap.col[ty*dirmap.width*3+tx*3] / 256;
break;
case ORIENTATION_ADAPTIVE:
break; /* Handled below */
@ -704,9 +708,9 @@ void repaint(ppm_t *p, ppm_t *a)
break;
}
switch(runningvals.sizetype) {
switch(runningvals.size_type) {
case SIZE_TYPE_RANDOM:
sn = g_rand_int_range (random_generator, 0, runningvals.sizenum);
sn = g_rand_int_range (random_generator, 0, runningvals.size_num);
break;
case SIZE_TYPE_VALUE:
case SIZE_TYPE_RADIUS:
@ -714,41 +718,41 @@ void repaint(ppm_t *p, ppm_t *a)
case SIZE_TYPE_FLOWING:
case SIZE_TYPE_HUE:
case SIZE_TYPE_MANUAL:
sn = runningvals.sizenum * sizmap.col[ty*sizmap.width*3+tx*3] / 256;
sn = runningvals.size_num * sizmap.col[ty*sizmap.width*3+tx*3] / 256;
break;
case SIZE_TYPE_ADAPTIVE:
break; /* Handled below */
default:
g_printerr("Internal error; Unknown sizetype\n");
g_printerr("Internal error; Unknown size_type\n");
sn = 0;
break;
}
/* Handle Adaptive selections */
if (runningvals.orienttype == ORIENTATION_ADAPTIVE)
if (runningvals.orient_type == ORIENTATION_ADAPTIVE)
{
if (runningvals.sizetype == SIZE_TYPE_ADAPTIVE)
if (runningvals.size_type == SIZE_TYPE_ADAPTIVE)
n = choose_best_brush (p, a, tx-maxbrushwidth/2,
ty-maxbrushheight/2, brushes,
num_brushes, brushes_sum, 0, 1);
else
{
int st = sn * runningvals.orientnum;
int st = sn * runningvals.orient_num;
n = choose_best_brush (p, a, tx-maxbrushwidth/2,
ty-maxbrushheight/2, brushes,
st+runningvals.orientnum, brushes_sum,
st+runningvals.orient_num, brushes_sum,
st, 1);
}
}
else
{
if (runningvals.sizetype == SIZE_TYPE_ADAPTIVE)
if (runningvals.size_type == SIZE_TYPE_ADAPTIVE)
n = choose_best_brush (p, a, tx-maxbrushwidth/2,
ty-maxbrushheight/2, brushes,
num_brushes, brushes_sum,
on, runningvals.orientnum);
on, runningvals.orient_num);
else
n = sn * runningvals.orientnum + on;
n = sn * runningvals.orient_num + on;
}
/* Should never happen, but hey... */
if(n < 0) n = 0;
@ -763,7 +767,7 @@ void repaint(ppm_t *p, ppm_t *a)
thissum = brushes_sum[n];
/* Calculate color - avg. of in-brush pixels */
if(runningvals.colortype == 0) {
if(runningvals.color_type == 0) {
r = g = b = 0;
for(y = 0; y < brush->height; y++) {
guchar *row = &p->col[(ty+y)*p->width*3];
@ -781,7 +785,7 @@ void repaint(ppm_t *p, ppm_t *a)
r = r * 255.0 / thissum;
g = g * 255.0 / thissum;
b = b * 255.0 / thissum;
} else if(runningvals.colortype == 1) {
} else if(runningvals.color_type == 1) {
guchar *pixel;
y = ty + (brush->height / 2);
x = tx + (brush->width / 2);
@ -790,11 +794,11 @@ void repaint(ppm_t *p, ppm_t *a)
g = pixel[1];
b = pixel[2];
} else {
/* No such colortype! */
/* No such color_type! */
r = g = b = 0;
}
if(runningvals.colornoise > 0.0) {
double v = runningvals.colornoise;
if(runningvals.color_noise > 0.0) {
double v = runningvals.color_noise;
#define BOUNDS(a) (((a) < 0) ? (a) : ((a) > 255) ? 255 : (a))
#define MYASSIGN(a) \
{ \
@ -863,16 +867,16 @@ void repaint(ppm_t *p, ppm_t *a)
a->col = atmp.col;
}
relief = runningvals.paperrelief / 100.0;
relief = runningvals.paper_relief / 100.0;
if(relief > 0.001) {
scale = runningvals.paperscale / 100.0;
scale = runningvals.paper_scale / 100.0;
if (PPM_IS_INITED (&paper_ppm)) {
tmp = paper_ppm;
paper_ppm.col = NULL;
} else {
tmp.col = NULL;
ppm_load(runningvals.selectedpaper, &tmp);
ppm_load(runningvals.selected_paper, &tmp);
resize(&tmp, tmp.width * scale, tmp.height * scale);
if(runningvals.paper_invert)
ppm_apply_gamma(&tmp, -1.0, 1,1,1);

View File

@ -20,7 +20,7 @@ static GtkWidget *sizeradio[NUMSIZERADIO];
static void size_store(GtkWidget *wg, void *d)
{
pcvals.sizetype = GPOINTER_TO_INT (d);
pcvals.size_type = GPOINTER_TO_INT (d);
}
int size_type_input (int in)
@ -31,7 +31,7 @@ int size_type_input (int in)
static void size_type_restore(void)
{
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON(sizeradio[pcvals.sizetype]),
GTK_TOGGLE_BUTTON(sizeradio[pcvals.size_type]),
TRUE
);
}
@ -39,9 +39,9 @@ static void size_type_restore(void)
void size_restore(void)
{
size_type_restore();
gtk_adjustment_set_value(GTK_ADJUSTMENT(sizenumadjust), pcvals.sizenum);
gtk_adjustment_set_value(GTK_ADJUSTMENT(sizefirstadjust), pcvals.sizefirst);
gtk_adjustment_set_value(GTK_ADJUSTMENT(sizelastadjust), pcvals.sizelast);
gtk_adjustment_set_value(GTK_ADJUSTMENT(sizenumadjust), pcvals.size_num);
gtk_adjustment_set_value(GTK_ADJUSTMENT(sizefirstadjust), pcvals.size_first);
gtk_adjustment_set_value(GTK_ADJUSTMENT(sizelastadjust), pcvals.size_last);
}
static void create_sizemap_dialog_helper(void)
@ -50,12 +50,12 @@ static void create_sizemap_dialog_helper(void)
create_sizemap_dialog();
}
static void create_size_radio_button (GtkWidget *box, int orienttype,
static void create_size_radio_button (GtkWidget *box, int orient_type,
gchar *label, gchar *help_string,
GSList **radio_group
)
{
create_radio_button (box, orienttype, size_store, label,
create_radio_button (box, orient_type, size_store, label,
help_string, radio_group, sizeradio);
}
@ -81,38 +81,38 @@ void create_sizepage(GtkNotebook *notebook)
sizenumadjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 0,
_("Sizes:"),
150, -1, pcvals.sizenum,
150, -1, pcvals.size_num,
1.0, 30.0, 1.0, 1.0, 0,
TRUE, 0, 0,
_("The number of sizes of brushes to use"),
NULL);
g_signal_connect (sizenumadjust, "value_changed",
G_CALLBACK (gimp_int_adjustment_update),
&pcvals.sizenum);
&pcvals.size_num);
sizefirstadjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 1,
_("Minimum size:"),
150, -1, pcvals.sizefirst,
150, -1, pcvals.size_first,
0.0, 360.0, 1.0, 10.0, 0,
TRUE, 0, 0,
_("The smallest brush to create"),
NULL);
g_signal_connect (sizefirstadjust, "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.sizefirst);
&pcvals.size_first);
sizelastadjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 2,
_("Maximum size:"),
150, -1, pcvals.sizelast,
150, -1, pcvals.size_last,
0.0, 360.0, 1.0, 10.0, 0,
TRUE, 0, 0,
_("The largest brush to create"),
NULL);
g_signal_connect (sizelastadjust, "value_changed",
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.sizelast);
&pcvals.size_last);
box2 = gtk_hbox_new (FALSE, 12);
gtk_box_pack_start(GTK_BOX(thispage), box2,FALSE,FALSE,0);

View File

@ -37,7 +37,7 @@ static GtkObject *smvectprevbrightadjust = NULL;
static GtkObject *sizadjust = NULL;
static GtkObject *smstradjust = NULL;
static GtkObject *smstrexpadjust = NULL;
static GtkWidget *sizevoronoi = NULL;
static GtkWidget *size_voronoi = NULL;
#define OMWIDTH 150
#define OMHEIGHT 150
@ -49,7 +49,7 @@ static double getsiz_from_gui(double x, double y)
{
return getsiz_proto(x,y, numsmvect, smvector,
GTK_ADJUSTMENT(smstrexpadjust)->value,
GTK_TOGGLE_BUTTON(sizevoronoi)->active);
GTK_TOGGLE_BUTTON(size_voronoi)->active);
}
static void updatesmpreviewprev(void)
@ -287,11 +287,11 @@ smresponse (GtkWidget *widget,
gint i;
for (i = 0; i < numsmvect; i++)
pcvals.sizevector[i] = smvector[i];
pcvals.size_vectors[i] = smvector[i];
pcvals.numsizevector = numsmvect;
pcvals.sizestrexp = GTK_ADJUSTMENT (smstrexpadjust)->value;
pcvals.sizevoronoi = GTK_TOGGLE_BUTTON (sizevoronoi)->active;
pcvals.num_size_vectors = numsmvect;
pcvals.size_strength_exponent = GTK_ADJUSTMENT (smstrexpadjust)->value;
pcvals.size_voronoi = GTK_TOGGLE_BUTTON (size_voronoi)->active;
}
break;
}
@ -302,14 +302,14 @@ smresponse (GtkWidget *widget,
static void initsmvectors(void)
{
if (pcvals.numsizevector)
if (pcvals.num_size_vectors)
{
gint i;
numsmvect = pcvals.numsizevector;
numsmvect = pcvals.num_size_vectors;
for (i = 0; i < numsmvect; i++)
{
smvector[i] = pcvals.sizevector[i];
smvector[i] = pcvals.size_vectors[i];
}
}
else
@ -333,9 +333,9 @@ static void update_sizemap_dialog(void)
initsmvectors();
gtk_adjustment_set_value(GTK_ADJUSTMENT(smstrexpadjust),
pcvals.sizestrexp);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sizevoronoi),
pcvals.sizevoronoi);
pcvals.size_strength_exponent);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(size_voronoi),
pcvals.size_voronoi);
updatesmvectorprev();
updatesmpreviewprev();
@ -496,11 +496,11 @@ void create_sizemap_dialog(void)
g_signal_connect (smstrexpadjust, "value_changed",
G_CALLBACK(smstrexpsmadjmove), NULL);
sizevoronoi = tmpw = gtk_check_button_new_with_mnemonic( _("_Voronoi"));
size_voronoi = tmpw = gtk_check_button_new_with_mnemonic( _("_Voronoi"));
gtk_table_attach_defaults(GTK_TABLE(table2), tmpw, 3, 4, 0, 1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tmpw), FALSE);
gtk_widget_show (tmpw);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tmpw), pcvals.sizevoronoi);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tmpw), pcvals.size_voronoi);
g_signal_connect(tmpw, "clicked",
G_CALLBACK(smstrexpsmadjmove), NULL);
gimp_help_set_help_data (tmpw, _("Voronoi-mode makes only the smvector closest to the given point have any influence"), NULL);

View File

@ -39,14 +39,14 @@ double getsiz_proto (double x, double y, int n, smvector_t *vec,
n = numsmvect;
vec = smvector;
smstrexp = GTK_ADJUSTMENT(smstrexpadjust)->value;
voronoi = GTK_TOGGLE_BUTTON(sizevoronoi)->active;
voronoi = GTK_TOGGLE_BUTTON(size_voronoi)->active;
}
else
{
n = pcvals.numsizevector;
vec = pcvals.sizevector;
smstrexp = pcvals.sizestrexp;
voronoi = pcvals.sizevoronoi;
n = pcvals.num_size_vectors;
vec = pcvals.size_vectors;
smstrexp = pcvals.size_strength_exponent;
voronoi = pcvals.size_voronoi;
}
#endif
@ -350,7 +350,7 @@ void readdirintolist (char *subdir, GtkWidget *view, char *selected)
/*
* Creates a radio button.
* box - the containing box.
* orienttype - The orientation ID
* orient_type - The orientation ID
* label, help_string - self-describing
* radio_group -
* A pointer to a radio group. The function assigns its value
@ -359,7 +359,7 @@ void readdirintolist (char *subdir, GtkWidget *view, char *selected)
* This is useful to group buttons. Just reset the variable to NULL,
* to create a new group.
* */
GtkWidget *create_radio_button (GtkWidget *box, int orienttype,
GtkWidget *create_radio_button (GtkWidget *box, int orient_type,
void (*callback)(GtkWidget *wg, void *d),
gchar *label, gchar *help_string,
GSList **radio_group,
@ -367,12 +367,12 @@ GtkWidget *create_radio_button (GtkWidget *box, int orienttype,
)
{
GtkWidget *tmpw;
buttons_array[orienttype] = tmpw =
buttons_array[orient_type] = tmpw =
gtk_radio_button_new_with_label ((*radio_group), label);
gtk_box_pack_start (GTK_BOX (box), tmpw, FALSE, FALSE, 0);
gtk_widget_show (tmpw);
g_signal_connect (tmpw, "clicked",
G_CALLBACK (callback), GINT_TO_POINTER (orienttype));
G_CALLBACK (callback), GINT_TO_POINTER (orient_type));
gimp_help_set_help_data (tmpw, help_string, NULL);
*radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (tmpw));
return tmpw;