On 27.02.2005, at 20:01, Robert L Krawitz wrote:

OK.  The code Daniel posted shouldn't be too hard to convert.  The
only thing it needs is to have the absolute row and column, to index
into the matrix.

That hasn't made it into CVS because Sven was faster...

Here's the current code:
static void
gradient_fill_single_region_rgb_dither (RenderBlendData *rbd,
                                        PixelRegion     *PR)
  GRand  *dither_rand = g_rand_new_with_seed (g_rand_int (rbd->seed));
  guchar *dest        = PR->data;
  gint    endx        = PR->x + PR->w;
  gint    endy        = PR->y + PR->h;
  gint    x, y;

  for (y = PR->y; y < endy; y++)
    for (x = PR->x; x < endx; x++)
        GimpRGB  color;

        gradient_render_pixel (x, y, &color, rbd);

        gradient_dither (dest, dither_rand, color.r);
        gradient_dither (dest, dither_rand, color.g);
        gradient_dither (dest, dither_rand, color.b);
        gradient_dither (dest, dither_rand, color.a);

  g_rand_free (dither_rand);

If needed you can setup your LUT globally or create it
on demand and have a pointer in RenderBlendData, depending
on how big and/or complex it is to compute and replace the
inner loop by your code.

Would it make sense to have several (selectable) dither

Will I be able to compile it against a current (stable) GIMP



Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to