static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         GeglBuffer          *output,
         const GeglRectangle *result)
{
  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
  guint       channel_bits [4];

  channel_bits [0] = o->red_bits;
  channel_bits [1] = o->green_bits;
  channel_bits [2] = o->blue_bits;
  channel_bits [3] = o->alpha_bits;

  if (!o->dither_type)
    process_no_dither (input, output, result, channel_bits);
  else if (!strcasecmp (o->dither_type, "random"))
    process_random (input, output, result, channel_bits);
  else if (!strcasecmp (o->dither_type, "random-covariant"))
    process_random_covariant (input, output, result, channel_bits);
  else if (!strcasecmp (o->dither_type, "bayer"))
    process_bayer (input, output, result, channel_bits);
  else if (!strcasecmp (o->dither_type, "floyd-steinberg"))
    process_floyd_steinberg (input, output, result, channel_bits);
  else
    process_no_dither (input, output, result, channel_bits);

  return TRUE;
}
Beispiel #2
0
static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         GeglBuffer          *output,
         const GeglRectangle *result,
         gint                 level)
{
    GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
    guint       channel_bits [4];

    channel_bits [0] = o->red_bits;
    channel_bits [1] = o->green_bits;
    channel_bits [2] = o->blue_bits;
    channel_bits [3] = o->alpha_bits;

    switch (o->dither_strategy)
    {
    case GEGL_DITHER_NONE:
        process_no_dither (input, output, result, channel_bits);
        break;
    case GEGL_DITHER_RANDOM:
        process_random (input, output, result, channel_bits);
        break;
    case GEGL_DITHER_RANDOM_COVARIANT:
        process_random_covariant (input, output, result,
                                  channel_bits);
        break;
    case GEGL_DITHER_FLOYD_STEINBERG:
        process_floyd_steinberg (input, output, result,
                                 channel_bits);
        break;
    case GEGL_DITHER_BAYER:
        process_bayer (input, output, result, channel_bits);
        break;
    default:
        process_no_dither (input, output, result, channel_bits);
    }

    return TRUE;
}