diff options
author | Øyvind Kolås <pippin@gimp.org> | 2012-03-18 15:58:11 +0000 |
---|---|---|
committer | Øyvind Kolås <pippin@gimp.org> | 2012-03-18 15:58:11 +0000 |
commit | afd9b27918e766858724b25ce427af66ed46db2b (patch) | |
tree | 40b4dc807a966783ffbbb26fa5977c55c0f6145d /babl | |
parent | a305fd91ced781f86ed05732a3cac9fb77e5902d (diff) |
constify API
Diffstat (limited to 'babl')
-rw-r--r-- | babl/babl-class.h | 10 | ||||
-rw-r--r-- | babl/babl-component.c | 2 | ||||
-rw-r--r-- | babl/babl-conversion.c | 24 | ||||
-rw-r--r-- | babl/babl-conversion.h | 4 | ||||
-rw-r--r-- | babl/babl-extension.h | 4 | ||||
-rw-r--r-- | babl/babl-fish-path.c | 11 | ||||
-rw-r--r-- | babl/babl-fish-reference.c | 8 | ||||
-rw-r--r-- | babl/babl-fish-stats.c | 8 | ||||
-rw-r--r-- | babl/babl-fish.c | 2 | ||||
-rw-r--r-- | babl/babl-format.c | 75 | ||||
-rw-r--r-- | babl/babl-image.c | 7 | ||||
-rw-r--r-- | babl/babl-image.h | 2 | ||||
-rw-r--r-- | babl/babl-internal.h | 22 | ||||
-rw-r--r-- | babl/babl-model.c | 23 | ||||
-rw-r--r-- | babl/babl-palette.c | 24 | ||||
-rw-r--r-- | babl/babl-sampling.c | 2 | ||||
-rw-r--r-- | babl/babl-type.c | 19 | ||||
-rw-r--r-- | babl/babl.h | 52 |
18 files changed, 152 insertions, 147 deletions
diff --git a/babl/babl-class.h b/babl/babl-class.h index 4e9bbaf..47c783d 100644 --- a/babl/babl-class.h +++ b/babl/babl-class.h @@ -33,11 +33,11 @@ typedef int (*BablEachFunction) (Babl *entry, * to be iterated over, common functionality is defined through these * macros. */ -#define BABL_CLASS_DECLARE(klass) \ - \ -BablDb * babl_##klass##_db (void); \ -Babl * babl_##klass##_from_id (int id); \ -void babl_##klass##_class_for_each (BablEachFunction each_fun, \ +#define BABL_CLASS_DECLARE(klass) \ + \ +BablDb * babl_##klass##_db (void); \ +const Babl * babl_##klass##_from_id (int id); \ +void babl_##klass##_class_for_each (BablEachFunction each_fun, \ void *user_data) /* common header for any item inserted into database, the actual diff --git a/babl/babl-component.c b/babl/babl-component.c index 65e8767..a483b19 100644 --- a/babl/babl-component.c +++ b/babl/babl-component.c @@ -58,7 +58,7 @@ is_component_duplicate (Babl *babl, int luma, int chroma, int alpha) } -Babl * +const Babl * babl_component_new (void *first_arg, ...) { diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c index b88ab1f..15beb91 100644 --- a/babl/babl-conversion.c +++ b/babl/babl-conversion.c @@ -109,8 +109,8 @@ conversion_new (const char *name, if (babl->class_type == BABL_CONVERSION_LINEAR && BABL (babl->conversion.source)->class_type == BABL_MODEL) { - Babl *src_format = NULL; - Babl *dst_format = NULL; + const Babl *src_format = NULL; + const Babl *dst_format = NULL; if (BABL (babl->conversion.source) == babl_model_from_id (BABL_RGBA)) { src_format = babl_format_from_id (BABL_RGBA_DOUBLE); @@ -171,8 +171,8 @@ create_name (Babl *source, Babl *destination, int type) return buf; } -Babl * -babl_conversion_new (void *first_arg, +const Babl * +babl_conversion_new (const void *first_arg, ...) { va_list varg; @@ -344,7 +344,7 @@ babl_conversion_planar_process (BablConversion *conversion, } long -babl_conversion_process (Babl *babl, +babl_conversion_process (const Babl *babl, const char *source, char *destination, long n) @@ -467,13 +467,13 @@ babl_conversion_error (BablConversion *conversion) Babl *fmt_source; Babl *fmt_destination; - Babl *fmt_rgba_double = babl_format_new (babl_model ("RGBA"), - babl_type ("double"), - babl_component ("R"), - babl_component ("G"), - babl_component ("B"), - babl_component ("A"), - NULL); + const Babl *fmt_rgba_double = babl_format_new (babl_model ("RGBA"), + babl_type ("double"), + babl_component ("R"), + babl_component ("G"), + babl_component ("B"), + babl_component ("A"), + NULL); double error = 0.0; long ticks_start = 0; diff --git a/babl/babl-conversion.h b/babl/babl-conversion.h index 15e34a1..902beb5 100644 --- a/babl/babl-conversion.h +++ b/babl/babl-conversion.h @@ -21,9 +21,7 @@ BABL_CLASS_DECLARE (conversion); -Babl * babl_conversion (const char *name); - - +const Babl * babl_conversion (const char *name); /* Signature of functions registered for reference type * conversions, diff --git a/babl/babl-extension.h b/babl/babl-extension.h index 4c2610a..b0b8b36 100644 --- a/babl/babl-extension.h +++ b/babl/babl-extension.h @@ -27,8 +27,8 @@ BABL_CLASS_DECLARE (extension); * BablExtension objects are only used internally in babl. */ -Babl * babl_extension (const char *name); -void babl_extension_load_dir_list (const char *dir_list); +const Babl * babl_extension (const char *name); +void babl_extension_load_dir_list (const char *dir_list); typedef struct { diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c index a2d1a68..7914e0c 100644 --- a/babl/babl-fish-path.c +++ b/babl/babl-fish-path.c @@ -29,16 +29,16 @@ int babl_in_fish_path = 0; typedef struct _FishPathInstrumentation { - Babl *fmt_rgba_double; + const Babl *fmt_rgba_double; double *test; void *source; void *destination; void *ref_destination; double *destination_rgba_double; double *ref_destination_rgba_double; - Babl *fish_rgba_to_source; - Babl *fish_reference; - Babl *fish_destination_to_rgba; + const Babl *fish_rgba_to_source; + const Babl *fish_reference; + const Babl *fish_destination_to_rgba; double reference_cost; int init_instrumentation_done; } FishPathInstrumentation; @@ -378,11 +378,12 @@ babl_fish_process (Babl *babl, } long -babl_process (Babl *babl, +babl_process (const Babl *cbabl, const void *source, void *destination, long n) { + Babl *babl = (Babl*)cbabl; babl_assert (babl); babl_assert (source); babl_assert (destination); diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c index 4f90d12..b00d67d 100644 --- a/babl/babl-fish-reference.c +++ b/babl/babl-fish-reference.c @@ -20,8 +20,8 @@ #include "babl-internal.h" static Babl * -assert_conversion_find (void *source, - void *destination) +assert_conversion_find (const void *source, + const void *destination) { Babl *ret = babl_conversion_find (source, destination); @@ -276,7 +276,7 @@ ncomponent_convert_from_double (BablFormat *destination_fmt, static int -process_same_model (Babl *babl, +process_same_model (const Babl *babl, const BablImage *source, BablImage *destination, long n) @@ -341,7 +341,7 @@ process_same_model (Babl *babl, } long -babl_fish_reference_process (Babl *babl, +babl_fish_reference_process (const Babl *babl, const BablImage *source, BablImage *destination, long n) diff --git a/babl/babl-fish-stats.c b/babl/babl-fish-stats.c index f4893db..ccd4037 100644 --- a/babl/babl-fish-stats.c +++ b/babl/babl-fish-stats.c @@ -35,12 +35,12 @@ static int table_destination_sum_each (Babl *babl, void *userdata) { - Babl *source = userdata; - Babl *destination = babl; + const Babl *source = userdata; + const Babl *destination = babl; if (source != destination) { - Babl *fish = babl_fish (source, destination); + const Babl *fish = babl_fish (source, destination); babl_assert (fish); sum_pixels += fish->fish.pixels; } @@ -76,7 +76,7 @@ table_destination_each (Babl *babl, fprintf (output_file, "<td class='cell'> </td>"); else { - Babl *fish = babl_fish (source, destination); + const Babl *fish = babl_fish (source, destination); babl_assert (fish); diff --git a/babl/babl-fish.c b/babl/babl-fish.c index 67e53fb..76cb53d 100644 --- a/babl/babl-fish.c +++ b/babl/babl-fish.c @@ -138,7 +138,7 @@ babl_fish_get_id (const Babl *source, return id; } -Babl * +const Babl * babl_fish (const void *source, const void *destination) { diff --git a/babl/babl-format.c b/babl/babl-format.c index ef56431..7f43911 100644 --- a/babl/babl-format.c +++ b/babl/babl-format.c @@ -48,7 +48,7 @@ format_new (const char *name, BablModel *model, BablComponent **component, BablSampling **sampling, - BablType **type) + const BablType **type) { Babl *babl; @@ -121,17 +121,17 @@ format_new (const char *name, static char * -create_name (BablModel *model, - int components, - BablComponent **component, - BablType **type) +create_name (const BablModel *model, + int components, + BablComponent **component, + const BablType **type) { char buf[512] = ""; char *p = &buf[0]; int i; int same_types = 1; - BablType **t = type; - BablType *first_type = *type; + const BablType**t = type; + const BablType *first_type = *type; BablComponent **c1 = component; BablComponent **c2 = model->component; @@ -190,8 +190,8 @@ create_name (BablModel *model, static char * -ncomponents_create_name (Babl *type, - int components) +ncomponents_create_name (const Babl *type, + int components) { char buf[512]; sprintf (buf, "%s[%i] ", type->instance.name, components); @@ -207,8 +207,8 @@ babl_format_set_is_format_n (Babl *format) } } -Babl * -babl_format_n (Babl *btype, +const Babl * +babl_format_n (const Babl *btype, int components) { int i; @@ -218,7 +218,7 @@ babl_format_n (Babl *btype, BablModel *model = (BablModel *)babl_model ("Y"); BablComponent *component [components]; BablSampling *sampling [components]; - BablType *type [components]; + const BablType *type [components]; char *name = NULL; for (i = 0; i<components; i++) @@ -252,7 +252,7 @@ babl_format_n (Babl *btype, } int -babl_format_is_format_n (Babl *format) +babl_format_is_format_n (const Babl *format) { if (format->class_type == BABL_FORMAT) { @@ -264,13 +264,13 @@ babl_format_is_format_n (Babl *format) static int -is_format_duplicate (Babl *babl, - int planar, - int components, - BablModel *model, - BablComponent **component, - BablSampling **sampling, - BablType **type) +is_format_duplicate (Babl *babl, + int planar, + int components, + BablModel *model, + BablComponent **component, + BablSampling **sampling, + const BablType **type) { int i; @@ -289,8 +289,8 @@ is_format_duplicate (Babl *babl, return 1; } -Babl * -babl_format_new (void *first_arg, +const Babl * +babl_format_new (const void *first_arg, ...) { va_list varg; @@ -301,12 +301,12 @@ babl_format_new (void *first_arg, BablModel *model = NULL; BablComponent *component [BABL_MAX_COMPONENTS]; BablSampling *sampling [BABL_MAX_COMPONENTS]; - BablType *type [BABL_MAX_COMPONENTS]; + const BablType*type [BABL_MAX_COMPONENTS]; BablSampling *current_sampling = (BablSampling *) babl_sampling (1, 1); BablType *current_type = (BablType *) babl_type_from_id (BABL_DOUBLE); char *name = NULL; - void *arg = first_arg; + const void *arg = first_arg; va_start (varg, first_arg); @@ -498,7 +498,7 @@ babl_format_get_n_components (const Babl *format) return 0; } -Babl * +const Babl * babl_format_get_type (const Babl *format, int component_index) { @@ -512,9 +512,9 @@ babl_format_get_type (const Babl *format, return NULL; } -Babl * -babl_format_with_model_as_type (Babl *model, - Babl *type) +const Babl * +babl_format_with_model_as_type (const Babl *model, + const Babl *type) { BablComponent *component[10]; int i; @@ -561,7 +561,7 @@ test_create (void) } double -babl_format_loss (Babl *babl) +babl_format_loss (const Babl *babl) { double loss = 0.0; double *test; @@ -570,10 +570,10 @@ babl_format_loss (Babl *babl) void *destination; double *transformed; - Babl *ref_fmt; - Babl *fmt; - Babl *fish_to; - Babl *fish_from; + const Babl *ref_fmt; + const Babl *fmt; + Babl *fish_to; + Babl *fish_from; ref_fmt = babl_format_new ( babl_model ("RGBA"), @@ -615,13 +615,13 @@ babl_format_loss (Babl *babl) babl_free (transformed); babl_free (test); - babl->format.loss = loss; + ((Babl*)babl)->format.loss = loss; return loss; } void * -babl_get_user_data (Babl *babl) +babl_get_user_data (const Babl *babl) { switch (babl->instance.class_type) { @@ -637,9 +637,10 @@ babl_get_user_data (Babl *babl) } void -babl_set_user_data (Babl *babl, void *data) +babl_set_user_data (const Babl *cbabl, void *data) { - switch (babl->instance.class_type) + Babl *babl = (Babl*) cbabl; + switch (cbabl->instance.class_type) { case BABL_MODEL: babl->model.data = data; diff --git a/babl/babl-image.c b/babl/babl-image.c index 631fe6d..a5d4e1f 100644 --- a/babl/babl-image.c +++ b/babl/babl-image.c @@ -79,9 +79,10 @@ image_new (BablFormat *format, } Babl * -babl_image_from_linear (char *buffer, - Babl *format) +babl_image_from_linear (char *buffer, + const Babl *cformat) { + Babl *format = (Babl*) cformat; Babl *babl; BablModel *model = NULL; int components = 0; @@ -169,7 +170,7 @@ babl_image_from_linear (char *buffer, } Babl * -babl_image_new (void *first, +babl_image_new (const void *first, ...) { va_list varg; diff --git a/babl/babl-image.h b/babl/babl-image.h index 2b7a2a8..0c93f49 100644 --- a/babl/babl-image.h +++ b/babl/babl-image.h @@ -41,7 +41,7 @@ BABL_CLASS_DECLARE (image); * ...] * NULL); */ -Babl * babl_image_new (void *first_component, +Babl * babl_image_new (const void *first_component, ...) BABL_ARG_NULL_TERMINATED; typedef struct diff --git a/babl/babl-internal.h b/babl/babl-internal.h index bf85727..6f821cd 100644 --- a/babl/babl-internal.h +++ b/babl/babl-internal.h @@ -69,7 +69,7 @@ Babl * babl_conversion_find (const void *source, const void *destination); double babl_conversion_error (BablConversion *conversion); long babl_conversion_cost (BablConversion *conversion); -long babl_conversion_process (Babl *conversion, +long babl_conversion_process (const Babl *conversion, const char *source, char *destination, long n); @@ -82,7 +82,7 @@ void babl_set_extender (Babl *new_extender); Babl * babl_extension_quiet_log (void); void babl_extension_deinit (void); -long babl_fish_reference_process (Babl *babl, +long babl_fish_reference_process (const Babl *babl, const BablImage*source, BablImage *destination, long n); @@ -97,20 +97,20 @@ Babl * babl_fish_path (const Babl *source, int babl_fish_get_id (const Babl *source, const Babl *destination); -double babl_format_loss (Babl *babl); +double babl_format_loss (const Babl *babl); Babl * babl_image_from_linear (char *buffer, - Babl *format); -Babl * babl_image_double_from_image (Babl *source); + const Babl *format); +Babl * babl_image_double_from_image (const Babl *source); -double babl_model_is_symmetric (Babl *babl); +double babl_model_is_symmetric (const Babl *babl); void babl_die (void); int babl_sanity (void); void babl_core_init (void); -Babl * babl_format_with_model_as_type (Babl *model, - Babl *type); +const Babl *babl_format_with_model_as_type (const Babl *model, + const Babl *type); int babl_formats_count (void); /* should maybe be templated? */ -int babl_type_is_symmetric (Babl *babl); +int babl_type_is_symmetric (const Babl *babl); /**** LOGGER ****/ #include <stdarg.h> @@ -259,7 +259,7 @@ babl_##klass##_class_for_each (BablEachFunction each_fun, \ #define BABL_CLASS_IMPLEMENT(klass) \ BABL_CLASS_MINIMAL_IMPLEMENT(klass) \ \ -Babl * \ +const Babl * \ babl_##klass (const char *name) \ { \ Babl *babl; \ @@ -277,7 +277,7 @@ babl_##klass (const char *name) \ return babl; \ } \ \ -Babl * \ +const Babl * \ babl_##klass##_from_id (int id) \ { \ Babl *babl; \ diff --git a/babl/babl-model.c b/babl/babl-model.c index f35e1a3..1f77076 100644 --- a/babl/babl-model.c +++ b/babl/babl-model.c @@ -24,7 +24,7 @@ #include "babl-internal.h" #include "babl-db.h" -static Babl *construct_double_format (Babl *model); +static const Babl *construct_double_format (const Babl *model); static int babl_model_destroy (void *data) @@ -93,7 +93,7 @@ is_model_duplicate (Babl *babl, int components, BablComponent **component) } -Babl * +const Babl * babl_model_new (void *first_argument, ...) { @@ -234,9 +234,9 @@ test_create (void) return test; } -static Babl *reference_format (void) +static const Babl *reference_format (void) { - static Babl *self = NULL; + static const Babl *self = NULL; if (!self) self = babl_format_new ( @@ -250,9 +250,9 @@ static Babl *reference_format (void) return self; } -static Babl *construct_double_format (Babl *model) +static const Babl *construct_double_format (const Babl *model) { - void *argument[44 + 1]; + const void *argument[44 + 1]; int args = 0; int i; @@ -286,8 +286,9 @@ static Babl *construct_double_format (Babl *model) } double -babl_model_is_symmetric (Babl *babl) +babl_model_is_symmetric (const Babl *cbabl) { + Babl *babl = (Babl*)cbabl; double *test; void *original; double *clipped; @@ -295,10 +296,10 @@ babl_model_is_symmetric (Babl *babl) double *transformed; int symmetric = 1; - Babl *ref_fmt; - Babl *fmt; - Babl *fish_to; - Babl *fish_from; + const Babl *ref_fmt; + const Babl *fmt; + Babl *fish_to; + Babl *fish_from; test = test_create (); ref_fmt = reference_format (); diff --git a/babl/babl-palette.c b/babl/babl-palette.c index c2340db..29a0ae4 100644 --- a/babl/babl-palette.c +++ b/babl/babl-palette.c @@ -35,7 +35,7 @@ typedef struct BablPalette } BablPalette; -static BablPalette *make_pal (Babl *format, void *data, int count) +static BablPalette *make_pal (const Babl *format, const void *data, int count) { BablPalette *pal = NULL; int bpp = babl_format_get_bytes_per_pixel (format); @@ -315,13 +315,13 @@ copy_strip_1 (int src_bands, /* should return the BablModel, permitting to fetch * other formats out of it? */ -void babl_new_palette (const char *name, Babl **format_u8, - Babl **format_u8_with_alpha) +void babl_new_palette (const char *name, const Babl **format_u8, + const Babl **format_u8_with_alpha) { - Babl *model; - Babl *model_no_alpha; - Babl *f_pal_u8; - Babl *f_pal_a_u8; + const Babl *model; + const Babl *model_no_alpha; + const Babl *f_pal_u8; + const Babl *f_pal_a_u8; BablPalette **palptr; char cname[64]; @@ -432,10 +432,10 @@ void babl_new_palette (const char *name, Babl **format_u8, } void -babl_palette_set_palette (Babl *babl, - Babl *format, - void *data, - int count) +babl_palette_set_palette (const Babl *babl, + const Babl *format, + void *data, + int count) { BablPalette **palptr = babl_get_user_data (babl); babl_palette_reset (babl); @@ -443,7 +443,7 @@ babl_palette_set_palette (Babl *babl, } void -babl_palette_reset (Babl *babl) +babl_palette_reset (const Babl *babl) { BablPalette **palptr = babl_get_user_data (babl); if (*palptr != default_palette ()) diff --git a/babl/babl-sampling.c b/babl/babl-sampling.c index d2e43d6..15b6532 100644 --- a/babl/babl-sampling.c +++ b/babl/babl-sampling.c @@ -27,7 +27,7 @@ static BablSampling sampling_db[(HORIZONTAL_MAX - HORIZONTAL_MIN + 1) * (VERTICAL_MAX - VERTICAL_MIN + 1)]; -Babl * +const Babl * babl_sampling (int horizontal, int vertical) { diff --git a/babl/babl-type.c b/babl/babl-type.c index b838860..9c3a3e8 100644 --- a/babl/babl-type.c +++ b/babl/babl-type.c @@ -65,7 +65,7 @@ is_type_duplicate (Babl *babl, int bits) return 1; } -Babl * +const Babl * babl_type_new (void *first_arg, ...) { @@ -162,6 +162,9 @@ babl_type_new (void *first_arg, */ babl_db_insert (db, babl); return babl; + + if (min || max || is_integer || max_val || min_val) + return NULL; } @@ -193,9 +196,9 @@ static void test_init (double min, double max) } -static Babl *double_vector_format (void) +static const Babl *double_vector_format (void) { - static Babl *self = NULL; + static const Babl *self = NULL; if (!self) self = babl_format_new ( @@ -207,7 +210,7 @@ static Babl *double_vector_format (void) } int -babl_type_is_symmetric (Babl *babl) +babl_type_is_symmetric (const Babl *babl) { int is_symmetrical = 1; void *original; @@ -215,10 +218,10 @@ babl_type_is_symmetric (Babl *babl) void *destination; double *transformed; - Babl *ref_fmt; - Babl *fmt; - Babl *fish_to; - Babl *fish_from; + const Babl *ref_fmt; + const Babl *fmt; + Babl *fish_to; + Babl *fish_from; test_init (0.0, 182.0); diff --git a/babl/babl.h b/babl/babl.h index 0a11e72..be629a2 100644 --- a/babl/babl.h +++ b/babl/babl.h @@ -45,45 +45,45 @@ void babl_exit (void); * Returns the babl object representing the data type given by @name * such as for example "u8", "u16" or "float". */ -Babl * babl_type (const char *name); +const Babl * babl_type (const char *name); /** * Returns the babl object representing the @horizontal and @vertical * sampling such as for example 2, 2 for the chroma components in * YCbCr. */ -Babl * babl_sampling (int horizontal, +const Babl * babl_sampling (int horizontal, int vertical); /** * Returns the babl object representing the color component given by * @name such as for example "R", "cyan" or "CIE L". */ -Babl * babl_component (const char *name); +const Babl * babl_component (const char *name); /** * Returns the babl object representing the color model given by @name * such as for example "RGB", "CMYK" or "CIE Lab". */ -Babl * babl_model (const char *name); +const Babl * babl_model (const char *name); /** * Returns the babl object representing the color format given by * @name such as for example "RGB u8", "CMYK float" or "CIE Lab u16". */ -Babl * babl_format (const char *name); +const Babl * babl_format (const char *name); /* Create a babl fish capable of converting from source_format to * destination_format, source and destination can be either strings * with the names of the formats or Babl-format objects. */ -Babl * babl_fish (const void *source_format, +const Babl * babl_fish (const void *source_format, const void *destination_format); /** Process n pixels from source to destination using babl_fish, * returns number of pixels converted. */ -long babl_process (Babl *babl_fish, +long babl_process (const Babl *babl_fish, const void *source, void *destination, long n); @@ -113,7 +113,7 @@ int babl_format_get_n_components (const Babl *format); * Returns the type in the given @format for the given * @component_index. */ -Babl * babl_format_get_type (const Babl *format, +const Babl * babl_format_get_type (const Babl *format, int component_index); @@ -128,7 +128,7 @@ Babl * babl_format_get_type (const Babl *format, * ["max_val", double max_val,] * NULL); */ -Babl * babl_type_new (void *first_arg, +const Babl * babl_type_new (void *first_arg, ...) BABL_ARG_NULL_TERMINATED; /** @@ -137,8 +137,8 @@ Babl * babl_type_new (void *first_arg, * babl_component_new (const char *name, * NULL); */ -Babl * babl_component_new (void *first_arg, - ...) BABL_ARG_NULL_TERMINATED; +const Babl * babl_component_new (void *first_arg, + ...) BABL_ARG_NULL_TERMINATED; /** * Defines a new color model in babl. If no name is provided a name is @@ -149,7 +149,7 @@ Babl * babl_component_new (void *first_arg, * [BablComponent *componentN, ...] * NULL); */ -Babl * babl_model_new (void *first_arg, +const Babl * babl_model_new (void *first_arg, ...) BABL_ARG_NULL_TERMINATED; /** @@ -169,8 +169,8 @@ Babl * babl_model_new (void *first_arg, * ["planar",] * NULL); */ -Babl * babl_format_new (void *first_arg, - ...) BABL_ARG_NULL_TERMINATED; +const Babl * babl_format_new (const void *first_arg, + ...) BABL_ARG_NULL_TERMINATED; /* * Defines a new pixel format in babl. With the specified data storage @@ -178,14 +178,14 @@ Babl * babl_format_new (void *first_arg, * conversions are only well defined to other babl_format_n derived formats * with the same number of components. */ -Babl * -babl_format_n (Babl *type, +const Babl * +babl_format_n (const Babl *type, int components); /** * Returns whether the @format is a format_n type. */ -int babl_format_is_format_n (Babl *format); +int babl_format_is_format_n (const Babl *format); /** * Defines a new conversion between either two formats, two models or @@ -197,30 +197,30 @@ int babl_format_is_format_n (Babl *format); * <"linear"|"planar">, <BablFuncLinear | BablFuncPlanar> conv_func, * NULL); */ -Babl * babl_conversion_new (void *first_arg, - ...) BABL_ARG_NULL_TERMINATED; +const Babl * babl_conversion_new (const void *first_arg, + ...) BABL_ARG_NULL_TERMINATED; /** * create a new palette based format, name is optional pass in NULL to get * an anonymous format. If you pass in with_alpha the format also gets * an 8bit alpha channel. */ -void babl_new_palette (const char *name, Babl **format_u8, - Babl **format_u8_with_alpha); +void babl_new_palette (const char *name, const Babl **format_u8, + const Babl **format_u8_with_alpha); /** * Assign a palette to a palette format, the data is a single span of pixels * representing the colors of the palette. */ -void babl_palette_set_palette (Babl *babl, - Babl *format, +void babl_palette_set_palette (const Babl *babl, + const Babl *format, void *data, int count); /** * reset a palette to initial state. */ -void babl_palette_reset (Babl *babl); +void babl_palette_reset (const Babl *babl); /** @@ -228,12 +228,12 @@ void babl_palette_reset (Babl *babl); * used from the conversion functions, encoding color profiles, palettes or * similar with the data. */ -void babl_set_user_data (Babl *babl, void *data); +void babl_set_user_data (const Babl *babl, void *data); /** * get data set with babl_set_user_data */ -void * babl_get_user_data (Babl *babl); +void * babl_get_user_data (const Babl *babl); |