예제 #1
0
int main (void)
{
  babl_init ();
  test_init ();

  babl_set_extender (babl_extension_quiet_log ());
  babl_format_class_for_each (source_each, NULL);
  {
    int i;

    for (i = 0; i < babl_formats_count (); i++) printf ("|");printf ("\n");
    for (i = 0; i < babl_formats_count (); i++) if (i / 10 == 0) printf ("|");else printf ("%i", (i / 10) % 10);printf ("\n");
    /* for (i=0;i<babl_formats_count ();i++) printf ("│"); printf ("\n");
       for (i=0;i<babl_formats_count ();i++) if (i/10==0) printf("│"); else printf ("%i", (i/10)%10); printf ("\n");*/
    for (i = 0; i < babl_formats_count (); i++) printf ("%i", (i) % 10);printf ("\n");
  }
  printf ("total length: %i\n", total_length);
  printf ("total cost  : %i\n", total_cost);
  /*printf ("ok / total : %i %i %f\n", ok, total, (1.0*ok) / total);
   */

  babl_exit ();

  return 0;
}
예제 #2
0
int
main (int    argc,
      char **argv)
{
  babl_init ();
  babl_introspect (NULL);
  babl_exit ();
  return 0;
}
예제 #3
0
파일: n_components.c 프로젝트: GNOME/babl
int
main (int    argc,
      char **argv)
{
  babl_init ();
  if (test ())
    return -1;
  babl_exit ();
  return 0;
}
예제 #4
0
int
main (void)
{
  babl_init ();

  printf ("<br/><a href='javascript:");
  printf ("show(\"x_types\");show(\"x_models\");show(\"x_formats\");show(\"x_conversions\");");
  babl_type_class_for_each (show_item, NULL);
  babl_model_class_for_each (show_item, NULL);
  babl_format_class_for_each (show_item, NULL);
/*  babl_conversion_each (show_item, NULL);*/
  printf ("'>+</a>");

  printf ("<a href='javascript:");
  printf ("hide(\"x_types\");hide(\"x_models\");hide(\"x_formats\");hide(\"x_conversions\");");
  babl_type_class_for_each (hide_item, NULL);
  babl_model_class_for_each (hide_item, NULL);
  babl_format_class_for_each (hide_item, NULL);
  /*babl_conversion_each (hide_item, NULL);*/
  printf ("'>-</a>");

  printf ("<div class='expander'>");
  printf ("<div class='expander_title'><a style='font-size:110%%' name='Data-types' href='javascript:toggle_visible(\"x_types\")'>Data types</a></div><div class='expander_content' id='x_types'>\n");
  babl_type_class_for_each (each_item, NULL);
  printf ("</div>\n");
  printf ("</div>\n");

  printf ("<div class='expander'>");
  printf ("<div class='expander_title'><a style='font-size:110%%' name='Color-models' href='javascript:toggle_visible(\"x_models\")'>Color models</a></div><div class='expander_content' id='x_models'>\n");
  babl_model_class_for_each (each_item, NULL);
  printf ("</div>\n");
  printf ("</div>\n");


  printf ("<div class='expander'>");
  printf ("<div class='expander_title'><a style='font-size:110%%' name='Pixel-formats' href='javascript:toggle_visible(\"x_formats\")'>Pixel formats</a></div><div class='expander_content' id='x_formats'>\n");
  babl_format_class_for_each (each_item, NULL);
  printf ("</div>\n");
  printf ("</div>\n");

/*
   printf ("<div class='expander'>");
   printf ("<div class='expander_title'><a style='font-size:110%%' name='Conversions' href='javascript:toggle_visible(\"x_conversions\")'>Conversions</a></div><div class='expander_content' id='x_conversions'>\n");
   babl_conversion_each (each_item, NULL);
   printf ("</div>\n");
   printf ("</div>\n");
 */
  babl_exit ();

  return 0;
}
예제 #5
0
파일: floatclamp.c 프로젝트: GNOME/babl
int
main (int    argc,
      char **argv)
{
  int OK = 1;
  babl_init ();
  {
    float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.0, 1.0, 2.0, 3.0}};
    unsigned char out[][4]  = {{ 55, 0, 0, 255 }, {0,255,255,255}};

    CHECK_CONV("float -> u8", unsigned char,
        babl_format("R'G'B'A float"),
        babl_format("R'G'B'A u8"),
        in, out);
  }

  babl_exit ();
  return !OK;
}
예제 #6
0
void
gegl_exit (void)
{
  glong timing = gegl_ticks ();

  gegl_tile_storage_cache_cleanup ();
  gegl_tile_cache_destroy ();
  gegl_operation_gtype_cleanup ();
  gegl_extension_handler_cleanup ();

  if (module_db != NULL)
    {
      g_object_unref (module_db);
      module_db = NULL;
    }

  babl_exit ();

  timing = gegl_ticks () - timing;
  gegl_instrument ("gegl", "gegl_exit", timing);

  /* used when tracking buffer and tile leaks */
  if (g_getenv ("GEGL_DEBUG_BUFS") != NULL)
    {
      gegl_buffer_stats ();
      gegl_tile_backend_ram_stats ();
      gegl_tile_backend_file_stats ();
#if HAVE_GIO
      gegl_tile_backend_tiledir_stats ();
#endif
    }
  global_time = gegl_ticks () - global_time;
  gegl_instrument ("gegl", "gegl", global_time);

  if (g_getenv ("GEGL_DEBUG_TIME") != NULL)
    {
      g_printf ("\n%s", gegl_instrument_utf8 ());
    }

  if (gegl_buffer_leaks ())
    g_printf ("  buffer-leaks: %i\n", gegl_buffer_leaks ());
  gegl_tile_cache_destroy ();

  if (gegl_swap_dir ())
    {
      /* remove all files matching <$GEGL_SWAP>/GEGL-<pid>-*.swap */

      guint         pid     = getpid ();
      GDir         *dir     = g_dir_open (gegl_swap_dir (), 0, NULL);

      gchar        *glob    = g_strdup_printf ("%i-*", pid);
      GPatternSpec *pattern = g_pattern_spec_new (glob);
      g_free (glob);

      if (dir != NULL)
        {
          const gchar *name;

          while ((name = g_dir_read_name (dir)) != NULL)
            {
              if (g_pattern_match_string (pattern, name))
                {
                  gchar *fname = g_build_filename (gegl_swap_dir (),
                                                   name,
                                                   NULL);
                  g_unlink (fname);
                  g_free (fname);
                }
            }

          g_dir_close (dir);
        }

      g_pattern_spec_free (pattern);
    }
  g_object_unref (config);
  config = NULL;
}
예제 #7
0
int
main (int    argc,
      char **argv)
{
  int OK = 1;

  babl_init ();
  
  //for (i = 0; i < 400000; i++)
  {
  {
    float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.2, 0.3, 0.5, 0.6}, {0.0, 1.0, 2.0, 3.0}};
    unsigned char out[][4]  = {{ 55, 0, 0, 255 }, {51,77,128,153}, {0,255,255,255}};

    CHECK_CONV("float -> u8 1", unsigned char,
        babl_format("R'G'B'A float"),
        babl_format("R'G'B'A u8"),
        in, out);
  }

  {
    float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.2, 0.3, 0.5, 0.6}, {0.0, 1.0, 2.0, 3.0}};
    unsigned char out[][4]  = {{ 10, 0, 0, 255 }, {8,19,55,153}, {0,255,255,255}};

    CHECK_CONV("float -> u8 2", unsigned char,
        babl_format("R'G'B'A float"),
        babl_format("RGBA u8"),
        in, out);
  }

  {
    float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.2, 0.3, 0.5, 0.6}, {0.0, 1.0, 2.0, 3.0}};
    unsigned char out[][4]  = {{ 55, 0, 0, 255 }, {51,77,128,153}, {0,255,255,255}};

    CHECK_CONV("float -> u8 3", unsigned char,
        babl_format("RGBA float"),
        babl_format("RGBA u8"),
        in, out);
  }

  {
    float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.2, 0.3, 0.5, 0.6}, {0.0, 1.0, 2.0, 3.0}};
    unsigned char out[][3]  = {{128, 0, 0}, {124,149,188}, {0,255,255}};

    CHECK_CONV("float -> u8 4", unsigned char,
        babl_format("RGBA float"),
        babl_format("R'G'B' u8"),
        in, out);
  }

  {
    float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.2, 0.3, 0.5, 0.6}, {0.0, 1.0, 2.0, 3.0}};
    unsigned char out[][4]  = {{128, 0, 0, 255 }, {156,188,235,153}, {0,156,213,255}};

    CHECK_CONV("float -> u8 5", unsigned char,
        babl_format("RaGaBaA float"),
        babl_format("R'G'B'A u8"),
        in, out);
  }

  {
    float in[][4]   = {{ 0.21582, -0.55, -0.14, 1.0 }, {0.2, 0.301, 0.5, 0.6}, {0.0, 3.0, 6.0, 3.0}};
    unsigned char out[][4]  = {{55, 0, 0, 255 }, {85,128,212,153}, {0,255,255,255}};

    CHECK_CONV("float -> u8 6", unsigned char,
        babl_format("R'aG'aB'aA float"),
        babl_format("R'G'B'A u8"),
        in, out);
  }
  }

  babl_exit ();
  return !OK;
}
예제 #8
0
파일: gegl-init.c 프로젝트: Distrotech/gegl
void
gegl_exit (void)
{
  if (!config)
    {
      g_warning("gegl_exit() called without matching call to gegl_init()");
      return;
    }

  GEGL_INSTRUMENT_START()

  gegl_tile_backend_swap_cleanup ();
  gegl_tile_cache_destroy ();
  gegl_operation_gtype_cleanup ();
  gegl_extension_handler_cleanup ();
  gegl_random_cleanup ();
  gegl_cl_cleanup ();

  gegl_temp_buffer_free ();

  if (module_db != NULL)
    {
      g_object_unref (module_db);
      module_db = NULL;
    }

  babl_exit ();

  GEGL_INSTRUMENT_END ("gegl", "gegl_exit")

  /* used when tracking buffer and tile leaks */
  if (g_getenv ("GEGL_DEBUG_BUFS") != NULL)
    {
      gegl_buffer_stats ();
      gegl_tile_backend_ram_stats ();
      gegl_tile_backend_file_stats ();
    }
  global_time = gegl_ticks () - global_time;
  gegl_instrument ("gegl", "gegl", global_time);

  if (gegl_instrument_enabled)
    {
      g_printf ("\n%s", gegl_instrument_utf8 ());
    }

  if (gegl_buffer_leaks ())
    {
      g_printf ("EEEEeEeek! %i GeglBuffers leaked\n", gegl_buffer_leaks ());
#ifdef GEGL_ENABLE_DEBUG
      if (!(gegl_debug_flags & GEGL_DEBUG_BUFFER_ALLOC))
        g_printerr ("To debug GeglBuffer leaks, set the environment "
                    "variable GEGL_DEBUG to \"buffer-alloc\"\n");
#endif
    }
  gegl_tile_cache_destroy ();

  if (gegl_swap_dir ())
    {
      /* remove all files matching <$GEGL_SWAP>/GEGL-<pid>-*.swap */

      guint         pid     = getpid ();
      GDir         *dir     = g_dir_open (gegl_swap_dir (), 0, NULL);

      gchar        *glob    = g_strdup_printf ("%i-*", pid);
      GPatternSpec *pattern = g_pattern_spec_new (glob);
      g_free (glob);

      if (dir != NULL)
        {
          const gchar *name;

          while ((name = g_dir_read_name (dir)) != NULL)
            {
              if (g_pattern_match_string (pattern, name))
                {
                  gchar *fname = g_build_filename (gegl_swap_dir (),
                                                   name,
                                                   NULL);
                  g_unlink (fname);
                  g_free (fname);
                }
            }

          g_dir_close (dir);
        }

      g_pattern_spec_free (pattern);
    }
  g_object_unref (config);
  config = NULL;
  global_time = 0;
}