diff --git a/plug-ins/common/file-cel.c b/plug-ins/common/file-cel.c index bd7de259d6..8c47caf77b 100644 --- a/plug-ins/common/file-cel.c +++ b/plug-ins/common/file-cel.c @@ -615,7 +615,7 @@ load_image (GFile *file, } } - gimp_image_set_colormap (image, palette + 3, colors - 1); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), palette + 3, (colors - 1) * 3); } /* Now get everything redrawn and hand back the finished image */ diff --git a/plug-ins/common/file-gif-export.c b/plug-ins/common/file-gif-export.c index bd304a6daa..4237bbba88 100644 --- a/plug-ins/common/file-gif-export.c +++ b/plug-ins/common/file-gif-export.c @@ -878,7 +878,7 @@ export_image (GFile *file, GeglColor *background; guchar bg[3]; - cmap = gimp_image_get_colormap (image, NULL, &colors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); background = gimp_context_get_background (); gegl_color_get_pixel (background, babl_format_with_space ("R'G'B' u8", NULL), bg); diff --git a/plug-ins/common/file-gif-load.c b/plug-ins/common/file-gif-load.c index 0474f2f634..c9c4a6c753 100644 --- a/plug-ins/common/file-gif-load.c +++ b/plug-ins/common/file-gif-load.c @@ -257,8 +257,8 @@ gif_load (GimpProcedure *procedure, #endif if (! promote_to_rgb) - gimp_image_set_colormap (image, - gimp_cmap, highest_used_index); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), + gimp_cmap, highest_used_index * 3); return_vals = gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, @@ -291,7 +291,7 @@ gif_load_thumb (GimpProcedure *procedure, error); if (! promote_to_rgb) - gimp_image_set_colormap (image, gimp_cmap, highest_used_index); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), gimp_cmap, highest_used_index * 3); return_vals = gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, @@ -1141,7 +1141,7 @@ ReadImage (FILE *fd, used_cmap[2][i] = gimp_cmap[j++] = cmap[2][i]; } - gimp_image_set_colormap (*image, gimp_cmap, ncols); + gimp_palette_set_colormap (gimp_image_get_palette (*image), babl_format ("R'G'B' u8"), gimp_cmap, ncols * 3); if (Gif89.delayTime < 0) framename = g_strdup (_("Background")); diff --git a/plug-ins/common/file-header.c b/plug-ins/common/file-header.c index c2cfcca699..4613777bf6 100644 --- a/plug-ins/common/file-header.c +++ b/plug-ins/common/file-header.c @@ -317,7 +317,7 @@ export_image (GFile *file, } /* save colormap */ - cmap = gimp_image_get_colormap (image, NULL, &colors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); if (! print (output, error, "static unsigned char header_data_cmap[256][3] = {") || diff --git a/plug-ins/common/file-iff.c b/plug-ins/common/file-iff.c index 2a92f41f1c..e45bc28e1d 100644 --- a/plug-ins/common/file-iff.c +++ b/plug-ins/common/file-iff.c @@ -396,7 +396,7 @@ load_image (GFile *file, } if (pixel_size == 1) - gimp_image_set_colormap (image, gimp_cmap, palette_size); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), gimp_cmap, palette_size * 3); g_object_unref (buffer); } diff --git a/plug-ins/common/file-mng.c b/plug-ins/common/file-mng.c index 5d144eb581..d8cee825f5 100644 --- a/plug-ins/common/file-mng.c +++ b/plug-ins/common/file-mng.c @@ -654,7 +654,7 @@ respin_cmap (png_structp pp, gint transparent; gint cols, rows; - before = gimp_image_get_colormap (image, NULL, &colors); + before = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); /* Make sure there is something in the colormap */ if (colors == 0) @@ -1033,7 +1033,7 @@ mng_export_image (GFile *file, guchar *palette; gint numcolors; - palette = gimp_image_get_colormap (image, NULL, &numcolors); + palette = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &numcolors, NULL); if ((numcolors != 0) && (mng_putchunk_plte_wrapper (handle, numcolors, @@ -1285,7 +1285,7 @@ mng_export_image (GFile *file, mngg.has_plte = TRUE; mngg.palette = (png_colorp) - gimp_image_get_colormap (image, NULL, &mngg.num_palette); + gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &mngg.num_palette, NULL); bit_depth = get_bit_depth_for_palette (mngg.num_palette); break; diff --git a/plug-ins/common/file-pcx.c b/plug-ins/common/file-pcx.c index 31521a1e46..a03d183a89 100644 --- a/plug-ins/common/file-pcx.c +++ b/plug-ins/common/file-pcx.c @@ -777,37 +777,49 @@ load_image (GimpProcedure *procedure, 255, 255, 255}; colormap = bw_colormap; } - gimp_image_set_colormap (image, colormap, 2); + gimp_palette_set_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), + (guint8 *) colormap, 6); } else if (pcx_header.bpp == 1 && pcx_header.planes == 2) { dest = g_new (guchar, ((gsize) width) * height); load_sub_8 (fd, width, height, 1, 2, dest, bytesperline); - gimp_image_set_colormap (image, pcx_header.colormap, 4); + gimp_palette_set_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), + pcx_header.colormap, 4 * 3); } else if (pcx_header.bpp == 2 && pcx_header.planes == 1) { dest = g_new (guchar, ((gsize) width) * height); load_sub_8 (fd, width, height, 2, 1, dest, bytesperline); - gimp_image_set_colormap (image, pcx_header.colormap, 4); + gimp_palette_set_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), + pcx_header.colormap, 4 * 3); } else if (pcx_header.bpp == 1 && pcx_header.planes == 3) { dest = g_new (guchar, ((gsize) width) * height); load_sub_8 (fd, width, height, 1, 3, dest, bytesperline); - gimp_image_set_colormap (image, pcx_header.colormap, 8); + gimp_palette_set_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), + pcx_header.colormap, 8 * 3); } else if (pcx_header.bpp == 1 && pcx_header.planes == 4) { dest = g_new (guchar, ((gsize) width) * height); load_4 (fd, width, height, dest, bytesperline); - gimp_image_set_colormap (image, pcx_header.colormap, 16); + gimp_palette_set_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), + pcx_header.colormap, 16 * 3); } else if (pcx_header.bpp == 4 && pcx_header.planes == 1) { dest = g_new (guchar, ((gsize) width) * height); load_sub_8 (fd, width, height, 4, 1, dest, bytesperline); - gimp_image_set_colormap (image, pcx_header.colormap, 16); + gimp_palette_set_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), + pcx_header.colormap, 16 * 3); } else if (pcx_header.bpp == 8 && pcx_header.planes == 1) { @@ -815,7 +827,9 @@ load_image (GimpProcedure *procedure, load_8 (fd, width, height, dest, bytesperline); fseek (fd, -768L, SEEK_END); fread (cmap, 768, 1, fd); - gimp_image_set_colormap (image, cmap, 256); + gimp_palette_set_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), + cmap, 256 * 3); } else if (pcx_header.bpp == 8 && (pcx_header.planes == 3 || pcx_header.planes == 4)) { @@ -1077,7 +1091,8 @@ export_image (GFile *file, switch (drawable_type) { case GIMP_INDEXED_IMAGE: - cmap = gimp_image_get_colormap (image, NULL, &colors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), &colors, NULL); if (colors > 16) { diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c index e03f8559aa..6ddafdcb25 100644 --- a/plug-ins/common/file-png.c +++ b/plug-ins/common/file-png.c @@ -1012,8 +1012,8 @@ load_image (GFile *file, int num_palette; png_get_PLTE (pp, info, &palette, &num_palette); - gimp_image_set_colormap ((GimpImage *) image, (guchar *) palette, - num_palette); + gimp_palette_set_colormap (gimp_image_get_palette ((GimpImage *) image), babl_format ("R'G'B' u8"), + (guchar *) palette, num_palette * 3); } bpp = babl_format_get_bytes_per_pixel (file_format); @@ -1594,9 +1594,9 @@ export_image (GFile *file, color_type = PNG_COLOR_TYPE_PALETTE; file_format = gimp_drawable_get_format (drawable); pngg.has_plte = TRUE; - pngg.palette = (png_colorp) gimp_image_get_colormap (image, - NULL, - &pngg.num_palette); + pngg.palette = (png_colorp) gimp_palette_get_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), + &pngg.num_palette, NULL); if (optimize_palette) bit_depth = get_bit_depth_for_palette (pngg.num_palette); break; @@ -2248,7 +2248,7 @@ respin_cmap (png_structp pp, gint colors; guchar *before; - before = gimp_image_get_colormap (image, NULL, &colors); + before = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); buffer = gimp_drawable_get_buffer (drawable); /* Make sure there is something in the colormap. diff --git a/plug-ins/common/file-pnm.c b/plug-ins/common/file-pnm.c index a70d6089aa..8299d9c2f5 100644 --- a/plug-ins/common/file-pnm.c +++ b/plug-ins/common/file-pnm.c @@ -1790,7 +1790,7 @@ export_image (GFile *file, guchar *cmap; gint num_colors; - cmap = gimp_image_get_colormap (image, NULL, &num_colors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &num_colors, NULL); if (file_type == FILE_TYPE_PBM) { diff --git a/plug-ins/common/file-ps.c b/plug-ins/common/file-ps.c index de5640130f..05c8672aac 100644 --- a/plug-ins/common/file-ps.c +++ b/plug-ins/common/file-ps.c @@ -2348,7 +2348,7 @@ load_ps (GFile *file, { const guchar BWColorMap[2*3] = { 255, 255, 255, 0, 0, 0 }; - gimp_image_set_colormap (image, BWColorMap, 2); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), (guint8 *) BWColorMap, 2 * 3); for (i = 0; i < height; i++) { @@ -2823,9 +2823,8 @@ save_ps_preview (GOutputStream *output, break; case GIMP_INDEXED_IMAGE: - cmap = gimp_image_get_colormap (gimp_item_get_image (GIMP_ITEM (drawable)), - NULL, - &ncols); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (gimp_item_get_image (GIMP_ITEM (drawable))), + babl_format ("R'G'B' u8"), &ncols, NULL); format = gimp_drawable_get_format (drawable); break; @@ -3138,7 +3137,7 @@ save_bw (GOutputStream *output, "level", &level2, NULL); - cmap = gimp_image_get_colormap (image, NULL, &ncols); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &ncols, NULL); buffer = gimp_drawable_get_buffer (drawable); format = gimp_drawable_get_format (drawable); @@ -3327,7 +3326,7 @@ save_index (GOutputStream *output, "level", &level2, NULL); - cmap = cmap_start = gimp_image_get_colormap (image, NULL, &ncols); + cmap = cmap_start = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &ncols, NULL); ct = coltab; bw = 1; diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c index a337dbe351..cc43eab2d0 100644 --- a/plug-ins/common/file-psp.c +++ b/plug-ins/common/file-psp.c @@ -1301,7 +1301,7 @@ read_color_block (FILE *f, memcpy (color_palette, tmpmap, color_palette_entries * 3); g_free (tmpmap); - gimp_image_set_colormap (image, color_palette, color_palette_entries); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), color_palette, color_palette_entries * 3); g_free (color_palette); } diff --git a/plug-ins/common/file-raw-data.c b/plug-ins/common/file-raw-data.c index 96981029e9..a937127611 100644 --- a/plug-ins/common/file-raw-data.c +++ b/plug-ins/common/file-raw-data.c @@ -1314,7 +1314,7 @@ raw_load_palette (RawGimpData *data, } } - gimp_image_set_colormap (data->image, data->cmap, 256); + gimp_palette_set_colormap (gimp_image_get_palette (data->image), babl_format ("R'G'B' u8"), data->cmap, 256 * 3); return TRUE; } @@ -1357,7 +1357,7 @@ export_image (GFile *file, g_return_val_if_fail (bpc * n_components == bpp, FALSE); if (gimp_drawable_is_indexed (drawable)) - cmap = gimp_image_get_colormap (image, NULL, &palsize); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &palsize, NULL); width = gegl_buffer_get_width (buffer); height = gegl_buffer_get_height (buffer); diff --git a/plug-ins/common/file-sunras.c b/plug-ins/common/file-sunras.c index 655ea0f5ed..e522379b4f 100644 --- a/plug-ins/common/file-sunras.c +++ b/plug-ins/common/file-sunras.c @@ -1022,7 +1022,7 @@ set_color_table (GimpImage *image, ColorMap[j*3], ColorMap[j*3+1], ColorMap[j*3+2]); #endif - gimp_image_set_colormap (image, ColorMap, ncols); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), ColorMap, ncols * 3); } @@ -1505,7 +1505,7 @@ save_index (FILE *ofp, } else { - cmap = gimp_image_get_colormap (image, NULL, &ncols); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &ncols, NULL); for (j = 0; j < ncols; j++) { diff --git a/plug-ins/common/file-tga.c b/plug-ins/common/file-tga.c index 5848767412..2ba6661c1b 100644 --- a/plug-ins/common/file-tga.c +++ b/plug-ins/common/file-tga.c @@ -1097,7 +1097,7 @@ ReadImage (FILE *fp, image = gimp_image_new (info->width, info->height, itype); if (gimp_cmap) - gimp_image_set_colormap (image, gimp_cmap, info->colorMapLength); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), gimp_cmap, info->colorMapLength * 3); layer = gimp_layer_new (image, _("Background"), @@ -1231,7 +1231,7 @@ export_image (GFile *file, if (dtype == GIMP_INDEXED_IMAGE) { - gimp_cmap = gimp_image_get_colormap (image, NULL, &num_colors); + gimp_cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &num_colors, NULL); header[1] = 1; /* cmap type */ header[2] = rle ? 9 : 1; @@ -1242,7 +1242,7 @@ export_image (GFile *file, } else if (dtype == GIMP_INDEXEDA_IMAGE) { - gimp_cmap = gimp_image_get_colormap (image, NULL, &num_colors); + gimp_cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &num_colors, NULL); header[1] = 1; /* cmap type */ header[2] = rle ? 9 : 1; diff --git a/plug-ins/common/file-wbmp.c b/plug-ins/common/file-wbmp.c index 8606171a66..a8b7507a27 100644 --- a/plug-ins/common/file-wbmp.c +++ b/plug-ins/common/file-wbmp.c @@ -275,7 +275,8 @@ read_image (FILE *fd, GIMP_INDEXED_IMAGE, 100, gimp_image_get_default_new_layer_mode (image)); - gimp_image_set_colormap (image, mono, 2); + gimp_palette_set_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), (guint8 *) mono, 6); gimp_image_insert_layer (image, layer, NULL, 0); diff --git a/plug-ins/common/file-xbm.c b/plug-ins/common/file-xbm.c index 13f44d8fba..d6bb594b66 100644 --- a/plug-ins/common/file-xbm.c +++ b/plug-ins/common/file-xbm.c @@ -881,7 +881,7 @@ load_image (GFile *file, } /* Set a black-and-white colormap. */ - gimp_image_set_colormap (image, cmap, 2); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), (guint8 *) cmap, 2 * 3); layer = gimp_layer_new (image, _("Background"), @@ -982,7 +982,7 @@ export_image (GFile *file, g_printerr ("%s: save_image '%s'\n", G_STRFUNC, prefix); #endif - cmap = gimp_image_get_colormap (image, NULL, &colors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); if (! gimp_drawable_is_indexed (drawable) || colors > 2) { diff --git a/plug-ins/common/file-xpm.c b/plug-ins/common/file-xpm.c index cc1825cf7b..d9ee6504c3 100644 --- a/plug-ins/common/file-xpm.c +++ b/plug-ins/common/file-xpm.c @@ -767,7 +767,7 @@ export_image (GFile *file, if (indexed) { - guchar *cmap = gimp_image_get_colormap (image, NULL, &ncolors); + guchar *cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &ncolors, NULL); guchar *c; c = cmap; diff --git a/plug-ins/common/file-xwd.c b/plug-ins/common/file-xwd.c index d7a529dba1..8d013397be 100644 --- a/plug-ins/common/file-xwd.c +++ b/plug-ins/common/file-xwd.c @@ -516,7 +516,7 @@ load_image (GFile *file, goto out; } - /* Guard against insanely huge color maps -- gimp_image_set_colormap() only + /* Guard against insanely huge color maps -- gimp_palette_set_colormap() only * accepts colormaps with 0..256 colors anyway. */ if (xwdhdr.l_colormap_entries > 256) { @@ -1319,7 +1319,7 @@ set_color_table (GimpImage *image, ColorMap[j*3], ColorMap[j*3+1], ColorMap[j*3+2]); #endif - gimp_image_set_colormap (image, ColorMap, 256); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), ColorMap, 256 * 3); } @@ -2550,7 +2550,7 @@ save_index (GOutputStream *output, else { vclass = 3; - cmap = gimp_image_get_colormap (image, NULL, &ncolors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &ncolors, NULL); for (j = 0; j < ncolors; j++) { diff --git a/plug-ins/common/grid.c b/plug-ins/common/grid.c index 99447eeb14..2a47bcf1c6 100644 --- a/plug-ins/common/grid.c +++ b/plug-ins/common/grid.c @@ -464,7 +464,7 @@ render_grid (GimpImage *image, break; case GIMP_INDEXED: - cmap = gimp_image_get_colormap (image, NULL, &ncolors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &ncolors, NULL); hcolor[0] = best_cmap_match (cmap, ncolors, hcolor_gegl); vcolor[0] = best_cmap_match (cmap, ncolors, vcolor_gegl); diff --git a/plug-ins/file-bmp/bmp-export.c b/plug-ins/file-bmp/bmp-export.c index 954b283d35..f67168a6df 100644 --- a/plug-ins/file-bmp/bmp-export.c +++ b/plug-ins/file-bmp/bmp-export.c @@ -227,7 +227,7 @@ export_image (GFile *file, case GIMP_INDEXED_IMAGE: format = gimp_drawable_get_format (drawable); - cmap = gimp_image_get_colormap (image, NULL, &colors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); MapSize = 4 * colors; if (drawable_type == GIMP_INDEXEDA_IMAGE) diff --git a/plug-ins/file-bmp/bmp-load.c b/plug-ins/file-bmp/bmp-load.c index 37e2c894da..7fe59002e6 100644 --- a/plug-ins/file-bmp/bmp-load.c +++ b/plug-ins/file-bmp/bmp-load.c @@ -1016,7 +1016,7 @@ ReadImage (FILE *fd, g_free (dest); if ((! gray) && (bpp <= 8)) - gimp_image_set_colormap (image, gimp_cmap, ncols); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), gimp_cmap, ncols * 3); gimp_progress_update (1.0); diff --git a/plug-ins/file-dds/ddsread.c b/plug-ins/file-dds/ddsread.c index 62e7a31d9b..8ea62343ed 100644 --- a/plug-ins/file-dds/ddsread.c +++ b/plug-ins/file-dds/ddsread.c @@ -146,7 +146,7 @@ read_dds (GFile *file, GimpPrecision precision = GIMP_PRECISION_U8_NON_LINEAR; gboolean read_mipmaps; gboolean flip_import; - gint i, j; + gint i; if (interactive) { @@ -516,6 +516,10 @@ read_dds (GFile *file, /* Read palette for indexed DDS */ if (load_info.fmt_flags & DDPF_PALETTEINDEXED8) { + const Babl *format = babl_format ("R'G'B' u8"); + GimpPalette *palette = gimp_image_get_palette (image); + GeglColor *color = gegl_color_new (NULL); + load_info.palette = g_malloc (256 * 4); if (fread (load_info.palette, 1, 1024, fp) != 1024) { @@ -525,13 +529,19 @@ read_dds (GFile *file, gimp_image_delete (image); return GIMP_PDB_EXECUTION_ERROR; } - for (i = j = 0; i < 768; i += 3, j += 4) + for (i = 0; i < 1024; i += 4) { - load_info.palette[i + 0] = load_info.palette[j + 0]; - load_info.palette[i + 1] = load_info.palette[j + 1]; - load_info.palette[i + 2] = load_info.palette[j + 2]; + gint entry_num; + + /* Looks like DDS indexed images have an alpha channel (or + * what else is this fourth byte?) and we just ignore it since + * our own palette colors are opaque? + */ + gegl_color_set_pixel (color, format, &load_info.palette[i]); + gimp_palette_add_entry (palette, NULL, color, &entry_num); } - gimp_image_set_colormap (image, load_info.palette, 256); + + g_object_unref (color); } load_info.tile_height = gimp_tile_height (); diff --git a/plug-ins/file-dds/ddswrite.c b/plug-ins/file-dds/ddswrite.c index 1abf7de6e2..952ef0f52e 100644 --- a/plug-ins/file-dds/ddswrite.c +++ b/plug-ins/file-dds/ddswrite.c @@ -877,7 +877,7 @@ write_layer (FILE *fp, if (basetype == GIMP_INDEXED) { - palette = gimp_image_get_colormap (image, NULL, &colors); + palette = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); if (type == GIMP_INDEXEDA_IMAGE) { @@ -1206,7 +1206,7 @@ write_volume_mipmaps (FILE *fp, format = babl_format ("R'G'B'A u8"); if (gimp_image_get_base_type (image) == GIMP_INDEXED) - palette = gimp_image_get_colormap (image, NULL, &colors); + palette = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); offset = 0; for (i = 0, list = layers; @@ -1652,7 +1652,7 @@ write_image (FILE *fp, (compression == DDS_COMPRESS_NONE)) { const guchar zero[4] = {0, 0, 0, 0}; - cmap = gimp_image_get_colormap (image, NULL, &colors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); for (i = 0; i < colors; ++i) { diff --git a/plug-ins/file-fli/fli-gimp.c b/plug-ins/file-fli/fli-gimp.c index 0729f67d83..e55e120908 100644 --- a/plug-ins/file-fli/fli-gimp.c +++ b/plug-ins/file-fli/fli-gimp.c @@ -624,7 +624,7 @@ load_image (GFile *file, gimp_progress_update ((double) cnt + 1 / (double)(to_frame - from_frame)); } - gimp_image_set_colormap (image, cm, 256); + gimp_palette_set_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), cm, 256 * 3); fclose (fp); @@ -726,7 +726,7 @@ export_image (GFile *file, case GIMP_INDEXED: max = MAXDIFF; bg = 0; - cmap = gimp_image_get_colormap (image, NULL, &colors); + cmap = gimp_palette_get_colormap (gimp_image_get_palette (image), babl_format ("R'G'B' u8"), &colors, NULL); for (i = 0; i < MIN (colors, 256); i++) { cm[i*3+0] = cmap[i*3+0]; diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c index 6caef8f92c..1632b46234 100644 --- a/plug-ins/file-psd/psd-load.c +++ b/plug-ins/file-psd/psd-load.c @@ -1635,8 +1635,9 @@ add_color_map (GimpImage *image, { if (img_a->color_mode != PSD_DUOTONE) { - gimp_image_set_colormap (image, img_a->color_map, - img_a->color_map_entries); + gimp_palette_set_colormap (gimp_image_get_palette (image), + babl_format ("R'G'B' u8"), + img_a->color_map, img_a->color_map_len); } else { diff --git a/plug-ins/file-tiff/file-tiff-load.c b/plug-ins/file-tiff/file-tiff-load.c index b64991b991..4d427d62e9 100644 --- a/plug-ins/file-tiff/file-tiff-load.c +++ b/plug-ins/file-tiff/file-tiff-load.c @@ -1504,7 +1504,9 @@ load_image (GimpProcedure *procedure, } } - gimp_image_set_colormap (*image, cmap, (1 << bps)); + gimp_palette_set_colormap (gimp_image_get_palette (*image), + babl_format ("R'G'B' u8"), + cmap, (1 << bps) * 3); } if (extra > 99)