add new comparison method rgb_difference that resembles arithmetical difference per...
[imager.git] / palimg.c
index 9b68b59d87b33dc35c827981d79b39cda18a81a5..0c37b582219d6359ed641fe3906ebb87597ce628 100644 (file)
--- a/palimg.c
+++ b/palimg.c
@@ -86,9 +86,10 @@ static i_img IIM_base_8bit_pal =
 };
 
 /*
-=item i_img_pal_new(C<x>, C<y>, C<channels>, C<maxpal>)
-
+=item im_img_pal_new(ctx, C<x>, C<y>, C<channels>, C<maxpal>)
+X<im_img_pal_new API>X<i_img_pal_new API>
 =category Image creation/destruction
+=synopsis i_img *img = im_img_pal_new(aIMCTX, width, height, channels, max_palette_size)
 =synopsis i_img *img = i_img_pal_new(width, height, channels, max_palette_size)
 
 Creates a new paletted image of the supplied dimensions.
@@ -97,6 +98,8 @@ C<maxpal> is the maximum palette size and should normally be 256.
 
 Returns a new image or NULL on failure.
 
+Also callable as C<i_img_pal_new(width, height, channels, max_palette_size)>.
+
 =cut
 */
 i_img *
@@ -202,10 +205,12 @@ i_img_to_rgb_inplace(i_img *im) {
   i_img_rgb_convert(&temp, im);
 
   /* nasty hack */
-  (im->i_f_destroy)(im);
-  myfree(im->idata);
+  i_img_exorcise(im);
   *im = temp;
 
+  /* i_img_empty_ch() calls i_img_init() which takes a ref */
+  im_context_refdec(aIMCTX, "img_destroy");
+
   return 1;
 }