mirror of https://github.com/GNOME/gimp.git
Use g_ascii_dtostr() instead of g_ascii_formatd()
The latter is broken and doesn't guarantee a decimal point with the current bug. Also, g_ascii_dtostr() doesn't need the format parameter and produces nicer output.
This commit is contained in:
parent
82cfa9c25f
commit
c0fb66254e
|
@ -334,8 +334,8 @@ gimp_unitrc_save (Gimp *gimp)
|
|||
|
||||
gimp_config_writer_open (writer, "factor");
|
||||
gimp_config_writer_print (writer,
|
||||
g_ascii_formatd (buf, sizeof (buf), "%f",
|
||||
_gimp_unit_get_factor (gimp, i)),
|
||||
g_ascii_dtostr (buf, sizeof (buf),
|
||||
_gimp_unit_get_factor (gimp, i)),
|
||||
-1);
|
||||
gimp_config_writer_close (writer);
|
||||
|
||||
|
|
|
@ -76,13 +76,13 @@ gimp_brush_generated_save (GimpData *data,
|
|||
|
||||
/* write brush spacing */
|
||||
g_string_append_printf (string, "%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
gimp_brush_get_spacing (GIMP_BRUSH (brush))));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
gimp_brush_get_spacing (GIMP_BRUSH (brush))));
|
||||
|
||||
/* write brush radius */
|
||||
g_string_append_printf (string, "%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
brush->radius));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
brush->radius));
|
||||
|
||||
if (have_shape)
|
||||
{
|
||||
|
@ -92,18 +92,18 @@ gimp_brush_generated_save (GimpData *data,
|
|||
|
||||
/* write brush hardness */
|
||||
g_string_append_printf (string, "%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
brush->hardness));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
brush->hardness));
|
||||
|
||||
/* write brush aspect_ratio */
|
||||
g_string_append_printf (string, "%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
brush->aspect_ratio));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
brush->aspect_ratio));
|
||||
|
||||
/* write brush angle */
|
||||
g_string_append_printf (string, "%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
brush->angle));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
brush->angle));
|
||||
|
||||
if (! g_output_stream_write_all (output, string->str, string->len,
|
||||
NULL, NULL, error))
|
||||
|
|
|
@ -72,28 +72,17 @@ gimp_gradient_save (GimpData *data,
|
|||
{
|
||||
gchar buf[11][G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->left);
|
||||
g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->middle);
|
||||
g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->right);
|
||||
g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->left_color.r);
|
||||
g_ascii_formatd (buf[4], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->left_color.g);
|
||||
g_ascii_formatd (buf[5], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->left_color.b);
|
||||
g_ascii_formatd (buf[6], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->left_color.a);
|
||||
g_ascii_formatd (buf[7], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->right_color.r);
|
||||
g_ascii_formatd (buf[8], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->right_color.g);
|
||||
g_ascii_formatd (buf[9], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->right_color.b);
|
||||
g_ascii_formatd (buf[10], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
"%f", seg->right_color.a);
|
||||
g_ascii_dtostr (buf[0], G_ASCII_DTOSTR_BUF_SIZE, seg->left);
|
||||
g_ascii_dtostr (buf[1], G_ASCII_DTOSTR_BUF_SIZE, seg->middle);
|
||||
g_ascii_dtostr (buf[2], G_ASCII_DTOSTR_BUF_SIZE, seg->right);
|
||||
g_ascii_dtostr (buf[3], G_ASCII_DTOSTR_BUF_SIZE, seg->left_color.r);
|
||||
g_ascii_dtostr (buf[4], G_ASCII_DTOSTR_BUF_SIZE, seg->left_color.g);
|
||||
g_ascii_dtostr (buf[5], G_ASCII_DTOSTR_BUF_SIZE, seg->left_color.b);
|
||||
g_ascii_dtostr (buf[6], G_ASCII_DTOSTR_BUF_SIZE, seg->left_color.a);
|
||||
g_ascii_dtostr (buf[7], G_ASCII_DTOSTR_BUF_SIZE, seg->right_color.r);
|
||||
g_ascii_dtostr (buf[8], G_ASCII_DTOSTR_BUF_SIZE, seg->right_color.g);
|
||||
g_ascii_dtostr (buf[9], G_ASCII_DTOSTR_BUF_SIZE, seg->right_color.b);
|
||||
g_ascii_dtostr (buf[10], G_ASCII_DTOSTR_BUF_SIZE, seg->right_color.a);
|
||||
|
||||
g_string_append_printf (string,
|
||||
"%s %s %s %s %s %s %s %s %s %s %s %d %d %d %d\n",
|
||||
|
@ -148,16 +137,16 @@ gimp_gradient_save_pov (GimpGradient *gradient,
|
|||
for (seg = gradient->segments; seg; seg = seg->next)
|
||||
{
|
||||
/* Left */
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
seg->left);
|
||||
g_ascii_formatd (color_buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
seg->left_color.r);
|
||||
g_ascii_formatd (color_buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
seg->left_color.g);
|
||||
g_ascii_formatd (color_buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
seg->left_color.b);
|
||||
g_ascii_formatd (color_buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
1.0 - seg->left_color.a);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
seg->left);
|
||||
g_ascii_dtostr (color_buf[0], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
seg->left_color.r);
|
||||
g_ascii_dtostr (color_buf[1], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
seg->left_color.g);
|
||||
g_ascii_dtostr (color_buf[2], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
seg->left_color.b);
|
||||
g_ascii_dtostr (color_buf[3], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
1.0 - seg->left_color.a);
|
||||
|
||||
g_string_append_printf (string,
|
||||
"\t[%s color rgbt <%s, %s, %s, %s>]\n",
|
||||
|
@ -166,16 +155,16 @@ gimp_gradient_save_pov (GimpGradient *gradient,
|
|||
color_buf[2], color_buf[3]);
|
||||
|
||||
/* Middle */
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
seg->middle);
|
||||
g_ascii_formatd (color_buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
(seg->left_color.r + seg->right_color.r) / 2.0);
|
||||
g_ascii_formatd (color_buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
(seg->left_color.g + seg->right_color.g) / 2.0);
|
||||
g_ascii_formatd (color_buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
(seg->left_color.b + seg->right_color.b) / 2.0);
|
||||
g_ascii_formatd (color_buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
1.0 - (seg->left_color.a + seg->right_color.a) / 2.0);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
seg->middle);
|
||||
g_ascii_dtostr (color_buf[0], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
(seg->left_color.r + seg->right_color.r) / 2.0);
|
||||
g_ascii_dtostr (color_buf[1], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
(seg->left_color.g + seg->right_color.g) / 2.0);
|
||||
g_ascii_dtostr (color_buf[2], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
(seg->left_color.b + seg->right_color.b) / 2.0);
|
||||
g_ascii_dtostr (color_buf[3], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
1.0 - (seg->left_color.a + seg->right_color.a) / 2.0);
|
||||
|
||||
g_string_append_printf (string,
|
||||
"\t[%s color rgbt <%s, %s, %s, %s>]\n",
|
||||
|
@ -184,16 +173,16 @@ gimp_gradient_save_pov (GimpGradient *gradient,
|
|||
color_buf[2], color_buf[3]);
|
||||
|
||||
/* Right */
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
seg->right);
|
||||
g_ascii_formatd (color_buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
seg->right_color.r);
|
||||
g_ascii_formatd (color_buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
seg->right_color.g);
|
||||
g_ascii_formatd (color_buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
seg->right_color.b);
|
||||
g_ascii_formatd (color_buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
1.0 - seg->right_color.a);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
seg->right);
|
||||
g_ascii_dtostr (color_buf[0], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
seg->right_color.r);
|
||||
g_ascii_dtostr (color_buf[1], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
seg->right_color.g);
|
||||
g_ascii_dtostr (color_buf[2], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
seg->right_color.b);
|
||||
g_ascii_dtostr (color_buf[3], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
1.0 - seg->right_color.a);
|
||||
|
||||
g_string_append_printf (string,
|
||||
"\t[%s color rgbt <%s, %s, %s, %s>]\n",
|
||||
|
|
|
@ -167,14 +167,10 @@ gimp_palette_mru_save (GimpPaletteMru *mru,
|
|||
GimpPaletteEntry *entry = list->data;
|
||||
gchar buf[4][G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
g_ascii_formatd (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", entry->color.r);
|
||||
g_ascii_formatd (buf[1],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", entry->color.g);
|
||||
g_ascii_formatd (buf[2],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", entry->color.b);
|
||||
g_ascii_formatd (buf[3],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", entry->color.a);
|
||||
g_ascii_dtostr (buf[0], G_ASCII_DTOSTR_BUF_SIZE, entry->color.r);
|
||||
g_ascii_dtostr (buf[1], G_ASCII_DTOSTR_BUF_SIZE, entry->color.g);
|
||||
g_ascii_dtostr (buf[2], G_ASCII_DTOSTR_BUF_SIZE, entry->color.b);
|
||||
g_ascii_dtostr (buf[3], G_ASCII_DTOSTR_BUF_SIZE, entry->color.a);
|
||||
|
||||
gimp_config_writer_open (writer, "color-rgba");
|
||||
gimp_config_writer_printf (writer, "%s %s %s %s",
|
||||
|
|
|
@ -955,8 +955,8 @@ gimp_levels_config_save_cruft (GimpLevelsConfig *config,
|
|||
(gint) (config->high_input[i] * 255.999),
|
||||
(gint) (config->low_output[i] * 255.999),
|
||||
(gint) (config->high_output[i] * 255.999),
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
config->gamma[i]));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
config->gamma[i]));
|
||||
}
|
||||
|
||||
if (! g_output_stream_write_all (output, string->str, string->len,
|
||||
|
|
|
@ -418,7 +418,7 @@ gimp_config_serialize_value (const GValue *value,
|
|||
else
|
||||
v_double = (gdouble) g_value_get_float (value);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%f", v_double);
|
||||
g_ascii_dtostr (buf, sizeof (buf), v_double);
|
||||
g_string_append (str, buf);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -441,8 +441,8 @@ gimp_config_serialize_value (const GValue *value,
|
|||
|
||||
for (i = 0, k = 0; i < 2; i++)
|
||||
for (j = 0; j < 2; j++, k++)
|
||||
g_ascii_formatd (buf[k],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", trafo->coeff[i][j]);
|
||||
g_ascii_dtostr (buf[k], G_ASCII_DTOSTR_BUF_SIZE,
|
||||
trafo->coeff[i][j]);
|
||||
|
||||
g_string_append_printf (str, "(matrix %s %s %s %s)",
|
||||
buf[0], buf[1], buf[2], buf[3]);
|
||||
|
@ -552,13 +552,13 @@ gimp_config_serialize_rgb (const GValue *value,
|
|||
{
|
||||
gchar buf[4][G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->r);
|
||||
g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->g);
|
||||
g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->b);
|
||||
g_ascii_dtostr (buf[0], G_ASCII_DTOSTR_BUF_SIZE, rgb->r);
|
||||
g_ascii_dtostr (buf[1], G_ASCII_DTOSTR_BUF_SIZE, rgb->g);
|
||||
g_ascii_dtostr (buf[2], G_ASCII_DTOSTR_BUF_SIZE, rgb->b);
|
||||
|
||||
if (has_alpha)
|
||||
{
|
||||
g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->a);
|
||||
g_ascii_dtostr (buf[3], G_ASCII_DTOSTR_BUF_SIZE, rgb->a);
|
||||
|
||||
g_string_append_printf (str, "(color-rgba %s %s %s %s)",
|
||||
buf[0], buf[1], buf[2], buf[3]);
|
||||
|
|
|
@ -173,7 +173,7 @@ static gint fits_ieee64_motorola = 0;
|
|||
|
||||
#define FITS_WRITE_DOUBLECARD(fp,key,value) \
|
||||
{ gchar card[81], dbl[21], *istr; \
|
||||
g_ascii_formatd (dbl, sizeof(dbl), "%f", (gdouble)value); \
|
||||
g_ascii_dtostr (dbl, sizeof(dbl), (gdouble)value); \
|
||||
istr = strstr (dbl, "e"); \
|
||||
if (istr) *istr = 'E'; \
|
||||
g_snprintf (card, sizeof (card), \
|
||||
|
|
|
@ -1492,34 +1492,34 @@ save_options (FILE * fp)
|
|||
|
||||
fprintf (fp, "fractaltype: %i\n", wvals.fractaltype);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.xmin);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.xmin);
|
||||
fprintf (fp, "xmin: %s\n", buf);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.xmax);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.xmax);
|
||||
fprintf (fp, "xmax: %s\n", buf);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.ymin);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.ymin);
|
||||
fprintf (fp, "ymin: %s\n", buf);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.ymax);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.ymax);
|
||||
fprintf (fp, "ymax: %s\n", buf);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.iter);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.iter);
|
||||
fprintf (fp, "iter: %s\n", buf);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.cx);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.cx);
|
||||
fprintf (fp, "cx: %s\n", buf);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.cy);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.cy);
|
||||
fprintf (fp, "cy: %s\n", buf);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.redstretch * 128.0);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.redstretch * 128.0);
|
||||
fprintf (fp, "redstretch: %s\n", buf);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.greenstretch * 128.0);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.greenstretch * 128.0);
|
||||
fprintf (fp, "greenstretch: %s\n", buf);
|
||||
|
||||
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.bluestretch * 128.0);
|
||||
g_ascii_dtostr (buf, sizeof (buf), wvals.bluestretch * 128.0);
|
||||
fprintf (fp, "bluestretch: %s\n", buf);
|
||||
|
||||
fprintf (fp, "redmode: %i\n", wvals.redmode);
|
||||
|
|
|
@ -776,44 +776,44 @@ save_preset (void)
|
|||
g_free (preset_name_escaped);
|
||||
fprintf (f, "orientnum=%d\n", pcvals.orient_num);
|
||||
fprintf (f, "orientfirst=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_first));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.orient_first));
|
||||
fprintf (f, "orientlast=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orient_last));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.orient_last));
|
||||
fprintf (f, "orienttype=%d\n", pcvals.orient_type);
|
||||
|
||||
fprintf (f, "sizenum=%d\n", pcvals.size_num);
|
||||
fprintf (f, "sizefirst=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.size_first));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.size_first));
|
||||
fprintf (f, "sizelast=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.size_last));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, 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.brush_relief));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.brush_relief));
|
||||
fprintf (f, "brushdensity=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brush_density));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.brush_density));
|
||||
fprintf (f, "brushgamma=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brushgamma));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.brushgamma));
|
||||
fprintf (f, "brushaspect=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brush_aspect));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.brush_aspect));
|
||||
|
||||
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.general_dark_edge));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, 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.general_shadow_darkness));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, 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));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.devthresh));
|
||||
|
||||
fprintf (f, "paperrelief=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.paper_relief));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.paper_relief));
|
||||
fprintf (f, "paperscale=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.paper_scale));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.paper_scale));
|
||||
fprintf (f, "paperinvert=%d\n", pcvals.paper_invert);
|
||||
fprintf (f, "paperoverlay=%d\n", pcvals.paper_overlay);
|
||||
|
||||
|
@ -829,12 +829,12 @@ save_preset (void)
|
|||
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.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);
|
||||
g_ascii_dtostr (vbuf[0], G_ASCII_DTOSTR_BUF_SIZE, pcvals.orient_vectors[i].x);
|
||||
g_ascii_dtostr (vbuf[1], G_ASCII_DTOSTR_BUF_SIZE, pcvals.orient_vectors[i].y);
|
||||
g_ascii_dtostr (vbuf[2], G_ASCII_DTOSTR_BUF_SIZE, pcvals.orient_vectors[i].dir);
|
||||
g_ascii_dtostr (vbuf[3], G_ASCII_DTOSTR_BUF_SIZE, pcvals.orient_vectors[i].dx);
|
||||
g_ascii_dtostr (vbuf[4], G_ASCII_DTOSTR_BUF_SIZE, pcvals.orient_vectors[i].dy);
|
||||
g_ascii_dtostr (vbuf[5], G_ASCII_DTOSTR_BUF_SIZE, 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],
|
||||
|
@ -842,30 +842,30 @@ save_preset (void)
|
|||
}
|
||||
|
||||
fprintf (f, "orientangoff=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
pcvals.orient_angle_offset));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
pcvals.orient_angle_offset));
|
||||
fprintf (f, "orientstrexp=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f",
|
||||
pcvals.orient_strength_exponent));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
pcvals.orient_strength_exponent));
|
||||
fprintf (f, "orientvoronoi=%d\n", pcvals.orient_voronoi);
|
||||
|
||||
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.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);
|
||||
g_ascii_dtostr (vbuf[0], G_ASCII_DTOSTR_BUF_SIZE, pcvals.size_vectors[i].x);
|
||||
g_ascii_dtostr (vbuf[1], G_ASCII_DTOSTR_BUF_SIZE, pcvals.size_vectors[i].y);
|
||||
g_ascii_dtostr (vbuf[2], G_ASCII_DTOSTR_BUF_SIZE, pcvals.size_vectors[i].siz);
|
||||
g_ascii_dtostr (vbuf[3], G_ASCII_DTOSTR_BUF_SIZE, 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.size_strength_exponent));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.size_strength_exponent));
|
||||
fprintf (f, "sizevoronoi=%d\n", pcvals.size_voronoi);
|
||||
|
||||
fprintf (f, "colortype=%d\n", pcvals.color_type);
|
||||
fprintf (f, "colornoise=%s\n",
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.color_noise));
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, pcvals.color_noise));
|
||||
|
||||
fclose (f);
|
||||
preset_refresh_presets ();
|
||||
|
|
|
@ -1506,50 +1506,50 @@ gflare_save (GFlare *gflare)
|
|||
}
|
||||
|
||||
fprintf (fp, "%s", GFLARE_FILE_HEADER);
|
||||
g_ascii_formatd (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->glow_opacity);
|
||||
g_ascii_dtostr (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->glow_opacity);
|
||||
fprintf (fp, "%s %s\n", buf[0], gflare_modes[gflare->glow_mode]);
|
||||
g_ascii_formatd (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_opacity);
|
||||
g_ascii_dtostr (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->rays_opacity);
|
||||
fprintf (fp, "%s %s\n", buf[0], gflare_modes[gflare->rays_mode]);
|
||||
g_ascii_formatd (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->sflare_opacity);
|
||||
g_ascii_dtostr (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->sflare_opacity);
|
||||
fprintf (fp, "%s %s\n", buf[0], gflare_modes[gflare->sflare_mode]);
|
||||
|
||||
gflare_write_gradient_name (gflare->glow_radial, fp);
|
||||
gflare_write_gradient_name (gflare->glow_angular, fp);
|
||||
gflare_write_gradient_name (gflare->glow_angular_size, fp);
|
||||
g_ascii_formatd (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->glow_size);
|
||||
g_ascii_formatd (buf[1],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->glow_rotation);
|
||||
g_ascii_formatd (buf[2],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->glow_hue);
|
||||
g_ascii_dtostr (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->glow_size);
|
||||
g_ascii_dtostr (buf[1],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->glow_rotation);
|
||||
g_ascii_dtostr (buf[2],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->glow_hue);
|
||||
fprintf (fp, "%s %s %s\n", buf[0], buf[1], buf[2]);
|
||||
|
||||
gflare_write_gradient_name (gflare->rays_radial, fp);
|
||||
gflare_write_gradient_name (gflare->rays_angular, fp);
|
||||
gflare_write_gradient_name (gflare->rays_angular_size, fp);
|
||||
g_ascii_formatd (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_size);
|
||||
g_ascii_formatd (buf[1],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_rotation);
|
||||
g_ascii_formatd (buf[2],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_hue);
|
||||
g_ascii_dtostr (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->rays_size);
|
||||
g_ascii_dtostr (buf[1],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->rays_rotation);
|
||||
g_ascii_dtostr (buf[2],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->rays_hue);
|
||||
fprintf (fp, "%s %s %s\n", buf[0], buf[1], buf[2]);
|
||||
g_ascii_formatd (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_thickness);
|
||||
g_ascii_dtostr (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->rays_thickness);
|
||||
fprintf (fp, "%d %s\n", gflare->rays_nspikes, buf[0]);
|
||||
|
||||
gflare_write_gradient_name (gflare->sflare_radial, fp);
|
||||
gflare_write_gradient_name (gflare->sflare_sizefac, fp);
|
||||
gflare_write_gradient_name (gflare->sflare_probability, fp);
|
||||
g_ascii_formatd (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->sflare_size);
|
||||
g_ascii_formatd (buf[1],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->sflare_rotation);
|
||||
g_ascii_formatd (buf[2],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->sflare_hue);
|
||||
g_ascii_dtostr (buf[0],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->sflare_size);
|
||||
g_ascii_dtostr (buf[1],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->sflare_rotation);
|
||||
g_ascii_dtostr (buf[2],
|
||||
G_ASCII_DTOSTR_BUF_SIZE, gflare->sflare_hue);
|
||||
fprintf (fp, "%s %s %s\n", buf[0], buf[1], buf[2]);
|
||||
fprintf (fp, "%s %d %d\n",
|
||||
gflare_shapes[gflare->sflare_shape],
|
||||
|
|
|
@ -466,69 +466,69 @@ ifsvals_stringify (IfsComposeVals *vals,
|
|||
g_string_append_printf (result, "iterations %d\n", vals->iterations);
|
||||
g_string_append_printf (result, "max_memory %d\n", vals->max_memory);
|
||||
g_string_append_printf (result, "subdivide %d\n", vals->subdivide);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", vals->radius);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, vals->radius);
|
||||
g_string_append_printf (result, "radius %s\n", buf);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", vals->aspect_ratio);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, vals->aspect_ratio);
|
||||
g_string_append_printf (result, "aspect_ratio %s\n", buf);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", vals->center_x);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, vals->center_x);
|
||||
g_string_append_printf (result, "center_x %s\n", buf);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", vals->center_y);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, vals->center_y);
|
||||
g_string_append_printf (result, "center_y %s\n", buf);
|
||||
|
||||
for (i=0; i<vals->num_elements; i++)
|
||||
{
|
||||
g_string_append (result, "element {\n");
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.x);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.x);
|
||||
g_string_append_printf (result, " x %s\n", buf);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.y);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.y);
|
||||
g_string_append_printf (result, " y %s\n", buf);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.theta);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.theta);
|
||||
g_string_append_printf (result, " theta %s\n", buf);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.scale);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.scale);
|
||||
g_string_append_printf (result, " scale %s\n", buf);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.asym);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.asym);
|
||||
g_string_append_printf (result, " asym %s\n", buf);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.shear);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.shear);
|
||||
g_string_append_printf (result, " shear %s\n", buf);
|
||||
g_string_append_printf (result, " flip %d\n", elements[i]->v.flip);
|
||||
|
||||
g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.red_color.r);
|
||||
g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.red_color.g);
|
||||
g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.red_color.b);
|
||||
g_ascii_dtostr (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.red_color.r);
|
||||
g_ascii_dtostr (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.red_color.g);
|
||||
g_ascii_dtostr (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.red_color.b);
|
||||
g_string_append_printf (result, " red_color { %s,%s,%s }\n",
|
||||
cbuf[0], cbuf[1], cbuf[2]);
|
||||
|
||||
g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.green_color.r);
|
||||
g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.green_color.g);
|
||||
g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.green_color.b);
|
||||
g_ascii_dtostr (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.green_color.r);
|
||||
g_ascii_dtostr (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.green_color.g);
|
||||
g_ascii_dtostr (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.green_color.b);
|
||||
g_string_append_printf (result, " green_color { %s,%s,%s }\n",
|
||||
cbuf[0], cbuf[1], cbuf[2]);
|
||||
|
||||
g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.blue_color.r);
|
||||
g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.blue_color.g);
|
||||
g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.blue_color.b);
|
||||
g_ascii_dtostr (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.blue_color.r);
|
||||
g_ascii_dtostr (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.blue_color.g);
|
||||
g_ascii_dtostr (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.blue_color.b);
|
||||
g_string_append_printf (result, " blue_color { %s,%s,%s }\n",
|
||||
cbuf[0], cbuf[1], cbuf[2]);
|
||||
|
||||
g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.black_color.r);
|
||||
g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.black_color.g);
|
||||
g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.black_color.b);
|
||||
g_ascii_dtostr (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.black_color.r);
|
||||
g_ascii_dtostr (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.black_color.g);
|
||||
g_ascii_dtostr (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.black_color.b);
|
||||
g_string_append_printf (result, " black_color { %s,%s,%s }\n",
|
||||
cbuf[0], cbuf[1], cbuf[2]);
|
||||
|
||||
g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.target_color.r);
|
||||
g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.target_color.g);
|
||||
g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.target_color.b);
|
||||
g_ascii_dtostr (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.target_color.r);
|
||||
g_ascii_dtostr (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.target_color.g);
|
||||
g_ascii_dtostr (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.target_color.b);
|
||||
g_string_append_printf (result, " target_color { %s,%s,%s }\n",
|
||||
cbuf[0], cbuf[1], cbuf[2]);
|
||||
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.hue_scale);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.hue_scale);
|
||||
g_string_append_printf (result, " hue_scale %s\n", buf);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.value_scale);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.value_scale);
|
||||
g_string_append_printf (result, " value_scale %s\n", buf);
|
||||
g_string_append_printf (result, " simple_color %d\n",
|
||||
elements[i]->v.simple_color);
|
||||
g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.prob);
|
||||
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, elements[i]->v.prob);
|
||||
g_string_append_printf (result, " prob %s\n", buf);
|
||||
g_string_append (result, "}\n");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue