babl-0.1
Description:
babl is pixel encoding and color space conversion engine in C. It allows converting between different methods of storing pixels known as pixel formats that have with different bitdepths and other data representations, color models, color spaces and component permutations. A vocabulary to formulate new pixel formats from existing primitives is provided as well as the framework to add new color models, spaces and data types.
Content:
Namespaces:
- Babl
- Object - The babl API is based around polymorphism and almost everything is a Babl object.
- public const int ALPHA_FLOOR
- public const int ALPHA_FLOOR_F
- public const int MAJOR_VERSION
- public const int MICRO_VERSION
- public const int MINOR_VERSION
- public delegate void FishProcess (Object babl, string src, string dst, long n, void* data)
- public delegate void FuncLinear (Object conversion, string src, string dst, long n)
- public delegate void FuncPlanar (Object conversion, int src_bands, string src, int src_pitch, int dst_bands, string dst, int dst_pitch, long n)
- public unowned Object? component (string name)
Returns the babl object representing the color component given by
name
such as for example "R", "cyan" or "CIE L". - public unowned Object? conversion_get_destination_space (Object conversion)
Returns the RGB space defined for the destination of conversion.
- public unowned Object? conversion_get_source_space (Object conversion)
Returns the RGB space defined for the source of conversion.
- public void exit ()
Deinitializes the babl library and frees any resources used when matched with the number of calls to init.
- public unowned Object? fast_fish (void* source_format, void* destination_format, string performance)
Create a faster than normal fish with specified performance (and thus corresponding precision tradeoff), values tolerance can hold: NULL and "default", means do same as fish, other values understood in increasing order of speed gain are: "exact" "precise" "fast" "glitch"
- public unowned Object? fish (void* source_format, void* destination_format)
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.
- public unowned Object? format (string encoding)
Returns the babl object representing the color format given by
name
such as for example "RGB u8", "CMYK float" or "CIE Lab u16", creates a format using the sRGB space, to also specify the color space and TRCs for a format, see babl_format_with_space. - public int format_exists (string name)
Returns 1 if the provided format name is known by babl or 0 if it is not.
- public int format_get_bytes_per_pixel (Object format)
Returns the bytes per pixel for a babl color format.
- public unowned string format_get_encoding (Object babl)
Returns the components and data type, without space suffix.
- public unowned Object? format_get_model (Object format)
Return the model used for constructing the format.
- public int format_get_n_components (Object format)
Returns the number of components for the given
format
. - public unowned Object? format_get_space (Object format)
- public unowned Object? format_get_type (Object format, int component_index)
Returns the type in the given
format
for the givencomponent_index
. - public int format_has_alpha (Object format)
Returns whether the
format
has an alpha channel. - public int format_is_format_n (Object format)
Returns whether the
format
is a format_n type. - public int format_is_palette (Object format)
check whether a format is a palette backed format.
- public unowned Object? format_n (Object type, int components)
- public unowned Object? format_with_space (string encoding, Object space)
Returns the babl object representing the color format given by
name
such as for example "RGB u8", "R'G'B'A float", "Y float" with a specific RGB working space used as the space, the resulting format has -space suffixed to it, unless the space requested is sRGB then the unsuffixed version is used. - public ModelFlag get_model_flags (Object model)
- public unowned string get_name (Object babl)
Returns a string describing a Babl object.
- public void get_version (out int major, out int minor, out int micro)
Get the version information on the babl library
- public string icc_get_key (string icc_data, int icc_length, string key, string language, string country)
- public unowned Object? icc_make_space (string icc_data, int icc_length, IccIntent intent, string error)
- public void init ()
Initializes the babl library.
- public void introspect (Object babl)
introspect a given BablObject
- public unowned Object? model (string name)
Returns the babl object representing the color model given by
name
such as for example "RGB", "CMYK" or "CIE Lab". - public int model_is (Object babl, string model_name)
- public unowned Object? model_with_space (string name, Object space)
The models for formats also have a space in babl, try to avoid code needing to use this.
- public unowned Object? new_palette (string name, Object format_u8, Object format_u8_with_alpha)
create a new palette based format, name is optional pass in NULL to get an anonymous format.
- public unowned Object? new_palette_with_space (string name, Object space, Object format_u8, Object format_u8_with_alpha)
create a new palette based format, name is optional pass in NULL to get an anonymous format.
- public void palette_reset (Object babl)
reset a palette to initial state, frees up some caches that optimize conversions.
- public void palette_set_palette (Object babl, Object format, uint8[] data, int count)
Assign a palette to a palette format, the data is a single span of pixels representing the colors of the palette.
- public long process (Object babl_fish, void* source, void* destination, long n)
Process n pixels from source to destination using babl_fish, returns number of pixels converted.
- public long process_rows (Object babl_fish, void* source, int source_stride, void* dest, int dest_stride, long n, int rows)
- public unowned Object? sampling (int horizontal, int vertical)
Returns the babl object representing the
horizontal
andvertical
sampling such as for example 2, 2 for the chroma components in YCbCr. - public unowned Object? space (string name)
Returns the babl object representing the specific RGB matrix color working space referred to by name.
- public unowned Object? space_from_chromaticities (string? name, double wx, double wy, double rx, double ry, double gx, double gy, double bx, double by, Object trc_red, Object? trc_green, Object? trc_blue, SpaceFlags flags)
Creates a new babl-space/ RGB matrix color space definition with the specified CIE xy(Y) values for white point: wx, wy and primary chromaticities: rx,ry,gx,gy,bx,by and TRCs to be used.
- public unowned Object? space_from_icc (string icc_data, int icc_length, IccIntent intent, out string error)
Create a babl space from an in memory ICC profile, the profile does no longer need to be loaded for the space to work, multiple calls with the same icc profile and same intent will result in the same babl space.
- public unowned Object? space_from_rgbxyz_matrix (string? name, double wx, double wy, double wz, double rx, double gx, double bx, double ry, double gy, double by, double rz, double gz, double bz, Object trc_red, Object? trc_green, Object? trc_blue)
Creates a new RGB matrix color space definition using a precomputed D50 adapted 3x3 matrix and associated CIE XYZ whitepoint, as possibly read from an ICC profile.
- public void space_get (Object space, out double xw, out double yw, out double xr, out double yr, out double xg, out double yg, out double xb, out double yb, out Object red_trc, out Object green_trc, out Object blue_trc)
query the chromaticities of white point and primaries as well as trcs used for r g a nd b, all arguments are optional (can be null).
- public double space_get_gamma (Object space)
- public unowned string space_get_icc (Object babl, out int length)
Return pointer to ICC profile for space note that this is the ICC profile for R'G'B', though in formats only supporting linear like EXR GEGL chooses to load this lienar data as RGB and use the sRGB TRC.
- public void space_get_rgb_luminance (Object space, out double red_luminance, out double green_luminance, out double blue_luminance)
Retrieve the relevant RGB luminance constants for a babl space.
- public int space_is_cmyk (Object space)
- public int space_is_gray (Object space)
- public unowned Object? space_with_trc (Object space, Object trc)
Creates a variant of an existing space with different trc.
- public unowned Object? trc (string name)
Look up a TRC by name, "sRGB" and "linear" are recognized strings in a stock babl configuration.
- public unowned Object? trc_gamma (double gamma)
Creates a Babl TRC for a specific gamma value, it will be given a name that is a short string representation of the value.
- public unowned Object? type (string name)
Returns the babl object representing the data type given by
name
such as for example "u8", "u16" or "float".