Commit f4e2ea30 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

reverted, it duplicates existing functionality.

2005-09-01  Sven Neumann  <neumann@jpk.com>

	* app/core/gimppalette.[ch]: reverted, it duplicates existing
	functionality.

	* app/core/gimppalette-import.c
	(gimp_palette_import_from_indexed_image): name the colors using
	their index in the colormap.
parent cf538a33
2005-09-01 Sven Neumann <neumann@jpk.com>
* app/core/gimppalette.[ch]: reverted, it duplicates existing
functionality.
* app/core/gimppalette-import.c
(gimp_palette_import_from_indexed_image): name the colors using
their index in the colormap.
2005-09-01 Sven Neumann <sven@gimp.org>
* app/core/gimppalette.[ch]: added gimp_palette_new_from_colormap().
......
......@@ -358,15 +358,19 @@ gimp_palette_import_from_indexed_image (GimpImage *gimage,
palette = GIMP_PALETTE (gimp_palette_new (palette_name));
for (count= 0; count < gimage->num_cols; ++count)
for (count = 0; count < gimage->num_cols; ++count)
{
gchar name[256];
g_snprintf (name, sizeof (name), _("Index %d"), count);
gimp_rgba_set_uchar (&color,
gimage->cmap[count * 3],
gimage->cmap[count * 3 + 1],
gimage->cmap[count * 3 + 2],
255);
gimp_palette_add_entry (palette, -1, NULL, &color);
gimp_palette_add_entry (palette, -1, name, &color);
}
return palette;
......
......@@ -314,37 +314,6 @@ gimp_palette_new (const gchar *name)
NULL);
}
GimpData *
gimp_palette_new_from_colormap (const gchar *name,
const guchar *cmap,
gint n_colors)
{
GimpPalette *palette;
gint i;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (n_colors == 0 || cmap != NULL, NULL);
palette = g_object_new (GIMP_TYPE_PALETTE,
"name", name,
NULL);
for (i = 0; i < n_colors; i++)
{
GimpRGB color;
gchar name[256];
g_snprintf (name, sizeof (name), _("Index %d"), i + 1);
gimp_rgba_set_uchar (&color,
cmap[i*3], cmap[i*3 + 1], cmap[i*3 + 2], 255);
gimp_palette_add_entry (palette, i, name, &color);
}
return GIMP_DATA (palette);
}
GimpData *
gimp_palette_get_standard (void)
{
......
......@@ -314,37 +314,6 @@ gimp_palette_new (const gchar *name)
NULL);
}
GimpData *
gimp_palette_new_from_colormap (const gchar *name,
const guchar *cmap,
gint n_colors)
{
GimpPalette *palette;
gint i;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (n_colors == 0 || cmap != NULL, NULL);
palette = g_object_new (GIMP_TYPE_PALETTE,
"name", name,
NULL);
for (i = 0; i < n_colors; i++)
{
GimpRGB color;
gchar name[256];
g_snprintf (name, sizeof (name), _("Index %d"), i + 1);
gimp_rgba_set_uchar (&color,
cmap[i*3], cmap[i*3 + 1], cmap[i*3 + 2], 255);
gimp_palette_add_entry (palette, i, name, &color);
}
return GIMP_DATA (palette);
}
GimpData *
gimp_palette_get_standard (void)
{
......
......@@ -314,37 +314,6 @@ gimp_palette_new (const gchar *name)
NULL);
}
GimpData *
gimp_palette_new_from_colormap (const gchar *name,
const guchar *cmap,
gint n_colors)
{
GimpPalette *palette;
gint i;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (n_colors == 0 || cmap != NULL, NULL);
palette = g_object_new (GIMP_TYPE_PALETTE,
"name", name,
NULL);
for (i = 0; i < n_colors; i++)
{
GimpRGB color;
gchar name[256];
g_snprintf (name, sizeof (name), _("Index %d"), i + 1);
gimp_rgba_set_uchar (&color,
cmap[i*3], cmap[i*3 + 1], cmap[i*3 + 2], 255);
gimp_palette_add_entry (palette, i, name, &color);
}
return GIMP_DATA (palette);
}
GimpData *
gimp_palette_get_standard (void)
{
......
......@@ -62,26 +62,23 @@ struct _GimpPaletteClass
};
GType gimp_palette_get_type (void) G_GNUC_CONST;
GimpData * gimp_palette_new (const gchar *name);
GimpData * gimp_palette_new_from_colormap (const gchar *name,
const guchar *cmap,
gint n_colors);
GimpData * gimp_palette_get_standard (void);
GList * gimp_palette_load (const gchar *filename,
GError **error);
GimpPaletteEntry * gimp_palette_add_entry (GimpPalette *palette,
gint position,
const gchar *name,
const GimpRGB *color);
void gimp_palette_delete_entry (GimpPalette *palette,
GimpPaletteEntry *entry);
void gimp_palette_set_columns (GimpPalette *palette,
gint columns);
gint gimp_palette_get_columns (GimpPalette *palette);
GType gimp_palette_get_type (void) G_GNUC_CONST;
GimpData * gimp_palette_new (const gchar *name);
GimpData * gimp_palette_get_standard (void);
GList * gimp_palette_load (const gchar *filename,
GError **error);
GimpPaletteEntry * gimp_palette_add_entry (GimpPalette *palette,
gint position,
const gchar *name,
const GimpRGB *color);
void gimp_palette_delete_entry (GimpPalette *palette,
GimpPaletteEntry *entry);
void gimp_palette_set_columns (GimpPalette *palette,
gint columns);
gint gimp_palette_get_columns (GimpPalette *palette);
#endif /* __GIMP_PALETTE_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment