Commit d899328a authored by Michael Natterer's avatar Michael Natterer 😴

app: some updates in the new colormap palette proxy code

- update the palette when single colormap entries change
- set the palette to 16 columns
- add an accessor for the palette
parent 6e01b285
......@@ -70,6 +70,8 @@ gimp_image_colormap_init (GimpImage *image)
private->colormap = g_new0 (guchar, GIMP_IMAGE_COLORMAP_SIZE);
private->palette = GIMP_PALETTE (gimp_palette_new (NULL, palette_name));
gimp_palette_set_columns (private->palette, 16);
gimp_data_make_internal (GIMP_DATA (private->palette), palette_id);
palettes = gimp_data_factory_get_container (image->gimp->palette_factory);
......@@ -117,6 +119,14 @@ gimp_image_colormap_free (GimpImage *image)
private->palette = NULL;
}
GimpPalette *
gimp_image_get_colormap_palette (GimpImage *image)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
return GIMP_IMAGE_GET_PRIVATE (image)->palette;
}
const guchar *
gimp_image_get_colormap (const GimpImage *image)
{
......@@ -170,8 +180,6 @@ gimp_image_set_colormap (GimpImage *image,
private->n_colors = n_colors;
gimp_image_colormap_changed (image, -1);
if (private->palette)
{
GimpPaletteEntry *entry;
......@@ -187,6 +195,8 @@ gimp_image_set_colormap (GimpImage *image,
gimp_data_thaw (GIMP_DATA (private->palette));
}
gimp_image_colormap_changed (image, -1);
}
void
......@@ -236,6 +246,9 @@ gimp_image_set_colormap_entry (GimpImage *image,
&private->colormap[color_index * 3 + 1],
&private->colormap[color_index * 3 + 2]);
if (private->palette)
gimp_image_colormap_set_palette_entry (image, color_index);
gimp_image_colormap_changed (image, color_index);
}
......@@ -261,6 +274,9 @@ gimp_image_add_colormap_entry (GimpImage *image,
&private->colormap[private->n_colors * 3 + 1],
&private->colormap[private->n_colors * 3 + 2]);
if (private->palette)
gimp_image_colormap_set_palette_entry (image, private->n_colors - 1);
private->n_colors++;
gimp_image_colormap_changed (image, -1);
......
......@@ -22,27 +22,29 @@
#define GIMP_IMAGE_COLORMAP_SIZE 768
void gimp_image_colormap_init (GimpImage *image);
void gimp_image_colormap_dispose (GimpImage *image);
void gimp_image_colormap_free (GimpImage *image);
const guchar * gimp_image_get_colormap (const GimpImage *image);
gint gimp_image_get_colormap_size (const GimpImage *image);
void gimp_image_set_colormap (GimpImage *image,
const guchar *colormap,
gint n_colors,
gboolean push_undo);
void gimp_image_get_colormap_entry (GimpImage *image,
gint color_index,
GimpRGB *color);
void gimp_image_set_colormap_entry (GimpImage *image,
gint color_index,
const GimpRGB *color,
gboolean push_undo);
void gimp_image_add_colormap_entry (GimpImage *image,
const GimpRGB *color);
void gimp_image_colormap_init (GimpImage *image);
void gimp_image_colormap_dispose (GimpImage *image);
void gimp_image_colormap_free (GimpImage *image);
GimpPalette * gimp_image_get_colormap_palette (GimpImage *image);
const guchar * gimp_image_get_colormap (const GimpImage *image);
gint gimp_image_get_colormap_size (const GimpImage *image);
void gimp_image_set_colormap (GimpImage *image,
const guchar *colormap,
gint n_colors,
gboolean push_undo);
void gimp_image_get_colormap_entry (GimpImage *image,
gint color_index,
GimpRGB *color);
void gimp_image_set_colormap_entry (GimpImage *image,
gint color_index,
const GimpRGB *color,
gboolean push_undo);
void gimp_image_add_colormap_entry (GimpImage *image,
const GimpRGB *color);
#endif /* __GIMP_IMAGE_COLORMAP_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