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; }
int main (int argc, char **argv) { babl_init (); babl_introspect (NULL); babl_exit (); return 0; }
int main (int argc, char **argv) { babl_init (); if (test ()) return -1; babl_exit (); return 0; }
int main(int argc, char **argv) { babl_init(); gegl_init(0, NULL); int retval = mypaint_test_surface_run(argc, argv, gegl_surface_factory, "MyPaintGeglSurface", NULL); gegl_exit(); return retval; }
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; }
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; }
int main (int argc, char **argv) { int OK = 1; babl_init (); OK = ! babl_format_is_palette (babl_format_n (babl_type ("double"), 3)); if(1) { unsigned char in[][1] = {{ 0},{ 1},{ 2},{15}}; unsigned char out[][4] = {{0,0,0,255},{127,0,0,255},{0,127,0,255},{255,255,255,255}}; const Babl *palA;// = babl_new_palette (NULL, 0); //Babl *palB = babl_new_palette (NULL, 0); // babl_new_palette (NULL, &palA, NULL); assert (palA); CHECK_CONV("pal to rgba", unsigned char, palA, babl_format("RGBA u8"), in, out); }
static gboolean gimp_option_dump_pdb_procedures_deprecated (const gchar *option_name, const gchar *value, gpointer data, GError **error) { Gimp *gimp; GList *deprecated_procs; GList *iter; babl_init (); gimp = g_object_new (GIMP_TYPE_GIMP, NULL); /* Make sure to turn on compatibility mode so deprecated procedures * are included */ gimp->pdb_compat_mode = GIMP_PDB_COMPAT_ON; /* Initialize the list of procedures */ internal_procs_init (gimp->pdb); /* Get deprecated procedures */ deprecated_procs = gimp_pdb_get_deprecated_procedures (gimp->pdb); for (iter = deprecated_procs; iter; iter = g_list_next (iter)) { GimpProcedure *procedure = GIMP_PROCEDURE (iter->data); g_print ("%s\n", procedure->original_name); } g_list_free (deprecated_procs); g_object_unref (gimp); app_exit (EXIT_SUCCESS); return FALSE; }
static gboolean gimp_option_dump_gimprc (const gchar *option_name, const gchar *value, gpointer data, GError **error) { GimpConfigDumpFormat format = GIMP_CONFIG_DUMP_NONE; gimp_open_console_window (); if (strcmp (option_name, "--dump-gimprc") == 0) format = GIMP_CONFIG_DUMP_GIMPRC; if (strcmp (option_name, "--dump-gimprc-system") == 0) format = GIMP_CONFIG_DUMP_GIMPRC_SYSTEM; else if (strcmp (option_name, "--dump-gimprc-manpage") == 0) format = GIMP_CONFIG_DUMP_GIMPRC_MANPAGE; if (format) { Gimp *gimp; gboolean success; gimp = g_object_new (GIMP_TYPE_GIMP, NULL); units_init (gimp); babl_init (); success = gimp_config_dump (format); g_object_unref (gimp); app_exit (success ? EXIT_SUCCESS : EXIT_FAILURE); } return FALSE; }
static gboolean gegl_post_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error) { glong time; if (config) return TRUE; g_assert (global_time == 0); global_time = gegl_ticks (); g_type_init (); gegl_instrument ("gegl", "gegl_init", 0); config = (void*)gegl_config (); if (cmd_gegl_swap) g_object_set (config, "swap", cmd_gegl_swap, NULL); if (cmd_gegl_quality) config->quality = atof (cmd_gegl_quality); if (cmd_gegl_cache_size) config->cache_size = atoi (cmd_gegl_cache_size)*1024*1024; if (cmd_gegl_chunk_size) config->chunk_size = atoi (cmd_gegl_chunk_size); if (cmd_gegl_tile_size) { const gchar *str = cmd_gegl_tile_size; config->tile_width = atoi(str); str = strchr (str, 'x'); if (str) config->tile_height = atoi(str+1); } if (cmd_gegl_threads) config->threads = atoi (cmd_gegl_threads); if (cmd_babl_tolerance) g_object_set (config, "babl-tolerance", atof(cmd_babl_tolerance), NULL); #ifdef GEGL_ENABLE_DEBUG { const char *env_string; env_string = g_getenv ("GEGL_DEBUG"); if (env_string != NULL) { gegl_debug_flags = g_parse_debug_string (env_string, gegl_debug_keys, G_N_ELEMENTS (gegl_debug_keys)); env_string = NULL; } } #endif /* GEGL_ENABLE_DEBUG */ time = gegl_ticks (); babl_init (); gegl_instrument ("gegl_init", "babl_init", gegl_ticks () - time); gegl_init_i18n (); time = gegl_ticks (); if (!module_db) { const gchar *gegl_path = g_getenv ("GEGL_PATH"); module_db = gegl_module_db_new (FALSE); if (gegl_path) { gegl_module_db_load (module_db, gegl_path); } else { gchar *module_path; #ifdef G_OS_WIN32 { gchar *prefix; prefix = g_win32_get_package_installation_directory_of_module ( hLibGeglModule ); module_path = g_build_filename (prefix, "lib", GEGL_LIBRARY, NULL); g_free(prefix); } #else module_path = g_build_filename (LIBDIR, GEGL_LIBRARY, NULL); #endif gegl_module_db_load (module_db, module_path); g_free (module_path); /* also load plug-ins from ~/.local/share/gegl-0.0/plugins */ module_path = g_build_filename (g_get_user_data_dir (), GEGL_LIBRARY, "plug-ins", NULL); if (g_mkdir_with_parents (module_path, S_IRUSR | S_IWUSR | S_IXUSR) == 0) { gchar *makefile_path = g_build_filename (module_path, "Makefile", NULL); if (! g_file_test (makefile_path, G_FILE_TEST_EXISTS)) g_file_set_contents (makefile_path, makefile (), -1, NULL); g_free (makefile_path); } gegl_module_db_load (module_db, module_path); g_free (module_path); } gegl_instrument ("gegl_init", "load modules", gegl_ticks () - time); } gegl_instrument ("gegl", "gegl_init", gegl_ticks () - global_time); if (g_getenv ("GEGL_SWAP")) g_object_set (config, "swap", g_getenv ("GEGL_SWAP"), NULL); if (g_getenv ("GEGL_QUALITY")) { const gchar *quality = g_getenv ("GEGL_QUALITY"); if (g_str_equal (quality, "fast")) g_object_set (config, "quality", 0.0, NULL); if (g_str_equal (quality, "good")) g_object_set (config, "quality", 0.5, NULL); if (g_str_equal (quality, "best")) g_object_set (config, "quality", 1.0, NULL); } swap_clean (); return TRUE; }
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; }
static gboolean gegl_post_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error) { GeglConfig *config; g_assert (global_time == 0); global_time = gegl_ticks (); if (g_getenv ("GEGL_DEBUG_TIME") != NULL) gegl_instrument_enable (); gegl_instrument ("gegl", "gegl_init", 0); config = gegl_config (); gegl_config_parse_env (config); babl_init (); #ifdef GEGL_ENABLE_DEBUG { const char *env_string; env_string = g_getenv ("GEGL_DEBUG"); if (env_string != NULL) { gegl_debug_flags = g_parse_debug_string (env_string, gegl_debug_keys, G_N_ELEMENTS (gegl_debug_keys)); env_string = NULL; } } #endif /* GEGL_ENABLE_DEBUG */ if (cmd_gegl_swap) g_object_set (config, "swap", cmd_gegl_swap, NULL); if (cmd_gegl_quality) config->quality = atof (cmd_gegl_quality); if (cmd_gegl_cache_size) config->tile_cache_size = atoll (cmd_gegl_cache_size)*1024*1024; if (cmd_gegl_chunk_size) config->chunk_size = atoi (cmd_gegl_chunk_size); if (cmd_gegl_tile_size) { const gchar *str = cmd_gegl_tile_size; config->tile_width = atoi(str); str = strchr (str, 'x'); if (str) config->tile_height = atoi(str+1); } if (cmd_gegl_threads) { _gegl_threads = atoi (cmd_gegl_threads); if (_gegl_threads > GEGL_MAX_THREADS) { g_warning ("Tried to use %i threads, max is %i", _gegl_threads, GEGL_MAX_THREADS); _gegl_threads = GEGL_MAX_THREADS; } } if (cmd_gegl_disable_opencl) gegl_cl_hard_disable (); gegl_init_swap_dir (); GEGL_INSTRUMENT_START(); gegl_operation_gtype_init (); if (!module_db) { GSList *paths = gegl_get_default_module_paths (); module_db = gegl_module_db_new (FALSE); g_slist_foreach(paths, (GFunc)load_module_path, module_db); g_slist_free_full (paths, g_free); } GEGL_INSTRUMENT_END ("gegl_init", "load modules"); gegl_instrument ("gegl", "gegl_init", gegl_ticks () - global_time); swap_clean (); g_signal_connect (G_OBJECT (config), "notify::use-opencl", G_CALLBACK (gegl_config_use_opencl_notify), NULL); g_object_set (config, "use-opencl", config->use_opencl, NULL); g_signal_connect (G_OBJECT (config), "notify::application-license", G_CALLBACK (gegl_config_application_license_notify), NULL); gegl_operations_set_licenses_from_string (config->application_license); return TRUE; }