/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_dither_params_t
 *     enum dt_iop_dither_type_t
 *       DITHER_RANDOM : random
 *       DITHER_FS1BIT : Floyd-Steinberg 1-bit B&W
 *       DITHER_FS4BIT_GRAY : Floyd-Steinberg 4-bit gray
 *       DITHER_FS8BIT : Floyd-Steinberg 8-bit RGB
 *       DITHER_FS16BIT : Floyd-Steinberg 16-bit RGB
 *       DITHER_FSAUTO : Floyd-Steinberg auto
 *     dither_type 
 *       description: method
 *       default: DITHER_FSAUTO
 * 
 *     int
 *     palette 
 *       default: 0
 *       range: G_MININT .. G_MAXINT
 * 
 *     struct 
 *       float
 *       radius 
 *         default: 0.0
 *         range: -G_MAXFLOAT .. G_MAXFLOAT
 * 
 *       float
 *       range [4]
 *         default: 0.0
 *         range: -G_MAXFLOAT .. G_MAXFLOAT
 * 
 *       float
 *       damping 
 *         description: damping
 *         default: -200.0
 *         range: -200.0 .. 0.0
 * 
 *     random 
 * 
 * dt_iop_dither_params_t
 *
 */

#include "/build/darktable/src/darktable-4.0.1/src/iop/dither.c"

#ifdef __cplusplus
extern "C"
{
#endif

#include <string.h>
#include "common/introspection.h"

static dt_introspection_field_t introspection_linear[8+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_dither_type_t", (char*)"dither_type", (char*)"dither_type", N_((char*)"method"), sizeof(((dt_iop_dither_params_t*)NULL)->dither_type), G_STRUCT_OFFSET(dt_iop_dither_params_t, dither_type), NULL },
    /*entries*/ 6, /*values*/ NULL, /*Default*/ DITHER_FSAUTO
  }
},
{
  .Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"palette", (char*)"palette", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->palette), G_STRUCT_OFFSET(dt_iop_dither_params_t, palette), NULL },
    /*Min*/ G_MININT, /*Max*/ G_MAXINT, /*Default*/ 0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"random.radius", (char*)"radius", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->random.radius), G_STRUCT_OFFSET(dt_iop_dither_params_t, random.radius), NULL },
    /*Min*/ -G_MAXFLOAT, /*Max*/ G_MAXFLOAT, /*Default*/ 0.0
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"random.range[0]", (char*)"range[0]", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->random.range[0]), G_STRUCT_OFFSET(dt_iop_dither_params_t, random.range), NULL },
    /*Min*/ -G_MAXFLOAT, /*Max*/ G_MAXFLOAT, /*Default*/ 0.0
  }
},
{
  .Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"random.range", (char*)"range", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->random.range), G_STRUCT_OFFSET(dt_iop_dither_params_t, random.range), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_dither_params_t*)NULL)->random.range), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[3]
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"random.damping", (char*)"damping", N_((char*)"damping"), sizeof(((dt_iop_dither_params_t*)NULL)->random.damping), G_STRUCT_OFFSET(dt_iop_dither_params_t, random.damping), NULL },
    /*Min*/ -200.0, /*Max*/ 0.0, /*Default*/ -200.0
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"", (char*)"random", (char*)"random", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->random), G_STRUCT_OFFSET(dt_iop_dither_params_t, random), NULL },
    /*entries*/ 3, /*fields*/ NULL
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_dither_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_dither_params_t), 0, NULL },
    /*entries*/ 3, /*fields*/ NULL
  }
},
  { .header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL} }
}
#endif
;

static dt_introspection_t introspection = {
  8,
  1,
  "dt_iop_dither_params_t",
  sizeof(dt_iop_dither_params_t),
  &introspection_linear[8-1],
  sizeof(dt_iop_module_t),
  G_STRUCT_OFFSET(dt_iop_module_t, default_params)
};

dt_introspection_field_t* get_introspection_linear()
{
  return introspection_linear;
}

dt_introspection_t* get_introspection()
{
  return &introspection;
}

int introspection_init(struct dt_iop_module_so_t *self, int api_version)
{
  // here we check that the generated code matches the api at compile time and also at runtime
  if(introspection.api_version != DT_INTROSPECTION_VERSION || api_version != DT_INTROSPECTION_VERSION)
    return 1;

#if defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406)
  introspection_linear[0].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_dither_type_t", (char*)"dither_type", (char*)"dither_type", N_((char*)"method"), sizeof(((dt_iop_dither_params_t*)NULL)->dither_type), G_STRUCT_OFFSET(dt_iop_dither_params_t, dither_type), NULL },
    /*entries*/ 6, /*values*/ NULL, /*Default*/ DITHER_FSAUTO
  };
  introspection_linear[1].Int = {
    { DT_INTROSPECTION_TYPE_INT, (char*)"int", (char*)"palette", (char*)"palette", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->palette), G_STRUCT_OFFSET(dt_iop_dither_params_t, palette), NULL },
    /*Min*/ G_MININT, /*Max*/ G_MAXINT, /*Default*/ 0
  };
  introspection_linear[2].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"random.radius", (char*)"radius", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->random.radius), G_STRUCT_OFFSET(dt_iop_dither_params_t, random.radius), NULL },
    /*Min*/ -G_MAXFLOAT, /*Max*/ G_MAXFLOAT, /*Default*/ 0.0
  };
  introspection_linear[3].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"random.range[0]", (char*)"range[0]", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->random.range[0]), G_STRUCT_OFFSET(dt_iop_dither_params_t, random.range), NULL },
    /*Min*/ -G_MAXFLOAT, /*Max*/ G_MAXFLOAT, /*Default*/ 0.0
  };
  introspection_linear[4].Array = {
    { DT_INTROSPECTION_TYPE_ARRAY, (char*)"float[]", (char*)"random.range", (char*)"range", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->random.range), G_STRUCT_OFFSET(dt_iop_dither_params_t, random.range), NULL },
    /*count*/ G_N_ELEMENTS(((dt_iop_dither_params_t*)NULL)->random.range), /*type*/ DT_INTROSPECTION_TYPE_FLOAT, /*field*/ &introspection_linear[3]
  };
  introspection_linear[5].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"random.damping", (char*)"damping", N_((char*)"damping"), sizeof(((dt_iop_dither_params_t*)NULL)->random.damping), G_STRUCT_OFFSET(dt_iop_dither_params_t, random.damping), NULL },
    /*Min*/ -200.0, /*Max*/ 0.0, /*Default*/ -200.0
  };
  introspection_linear[6].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"", (char*)"random", (char*)"random", (char*)"", sizeof(((dt_iop_dither_params_t*)NULL)->random), G_STRUCT_OFFSET(dt_iop_dither_params_t, random), NULL },
    /*entries*/ 3, /*fields*/ NULL
  };
  introspection_linear[7].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_dither_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_dither_params_t), 0, NULL },
    /*entries*/ 3, /*fields*/ NULL
  };
  introspection_linear[8].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

  for(int i = 0; i <= 8; i++)
    introspection_linear[i].header.so = self;

  static dt_introspection_type_enum_tuple_t f0[] = { 
    { "DITHER_RANDOM", DITHER_RANDOM, N_((char*)"random") },
    { "DITHER_FS1BIT", DITHER_FS1BIT, N_((char*)"Floyd-Steinberg 1-bit B&W") },
    { "DITHER_FS4BIT_GRAY", DITHER_FS4BIT_GRAY, N_((char*)"Floyd-Steinberg 4-bit gray") },
    { "DITHER_FS8BIT", DITHER_FS8BIT, N_((char*)"Floyd-Steinberg 8-bit RGB") },
    { "DITHER_FS16BIT", DITHER_FS16BIT, N_((char*)"Floyd-Steinberg 16-bit RGB") },
    { "DITHER_FSAUTO", DITHER_FSAUTO, N_((char*)"Floyd-Steinberg auto") },
    { NULL, 0 },
  };
  static dt_introspection_field_t *f6[] = {
    &introspection_linear[2],
    &introspection_linear[4],
    &introspection_linear[5],
    NULL
  };
  static dt_introspection_field_t *f7[] = {
    &introspection_linear[0],
    &introspection_linear[1],
    &introspection_linear[6],
    NULL
  };

  introspection_linear[0].Enum.values = f0;
  introspection_linear[6].Struct.fields = f6;
  introspection_linear[7].Struct.fields = f7;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_dither_params_t * p = (dt_iop_dither_params_t*)param;
  if(!strcmp(name, "dither_type"))
    return &(p->dither_type);
  else if(!strcmp(name, "palette"))
    return &(p->palette);
  else if(!strcmp(name, "random.radius"))
    return &(p->random.radius);
  else if(!strcmp(name, "random.range[0]"))
    return &(p->random.range[0]);
  else if(!strcmp(name, "random.range"))
    return &(p->random.range);
  else if(!strcmp(name, "random.damping"))
    return &(p->random.damping);
  else if(!strcmp(name, "random"))
    return &(p->random);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!strcmp(name, "dither_type"))
    return &(introspection_linear[0]);
  else if(!strcmp(name, "palette"))
    return &(introspection_linear[1]);
  else if(!strcmp(name, "random.radius"))
    return &(introspection_linear[2]);
  else if(!strcmp(name, "random.range[0]"))
    return &(introspection_linear[3]);
  else if(!strcmp(name, "random.range"))
    return &(introspection_linear[4]);
  else if(!strcmp(name, "random.damping"))
    return &(introspection_linear[5]);
  else if(!strcmp(name, "random"))
    return &(introspection_linear[6]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

