Hi, trying to get to know babl (wrt the LCH layer modes), quite a few questions came up that made me wish for a babl 'Conversion implentor's guide'. (If such a document exists just disregard the rest of this mail -- but please show me where).
So maybe the best I could do for starters is write such guide -- as long as I still remember what the questions are of someone newly confronted with babl. But I'll need a little help with the answers... ;o) First, two general questions about babl: - babl decides which conversion to use, based on speed and accuracy. Is that a build-time or run-time decision? - What is the reference for judging accuracy? Adding conversions to babl: I haven't gone deep into the babl source yet (and hope I won't have to), so the following is a mixture of my best guesses and some open questions. I'll be glad for 'yes/no' confirmations and of course any additional info/answers: - Create source file in subdirectory 'extensions' and add it to extensions/Makefile.am. The rest is automagic. - Source must have 'int init (void)' function which announces/registers the new conversions: - Register color model and its components using babl_component_new() [ what about "luma", "chroma", "alpha"? ] babl_model_new() [ lots of parameter possibilities... ] [ naive-CMYK e.g. registers "CMYK" but not "RGBA". I assume RGBA is a core-format that can always be relied on to exist? Is there a list of such formats? PS: babl-core.c suggests that RGBA (+ its components) is the only hardcoded model, along with the PAD component and the double type. PPS: babl-base.c has additional types and models: types: float/u8/u16/u32 models: (plus respective components Ra/R'/R'a etc.) RGB: RGB/RaGaBaA/R'G'B'/R'G'B'A/R'aG'aB'aA Gray: Y/YA/YaA/Y'/Y'A/Y'aA YCbCr: YCbCr/YCbCrA... now it gets confusing. Where the hell does "y'" come from? PPPS: Maybe I should just compile w/o extensions and see what comes out? ] - Register the new provided conversions using babl_conversion_new(). [ What are "linear", "plane", "planar" ? ] - Default data type of components is 'double'. Others can be registered using babl_format_new(). - Specifying additional formats with babl_format_new() doesn't mean you have to provide conversions for those. You can leave it to babl to find a way. [ Or maybe not? naive-CMYK registers a "CMYK float" format without defining any conversions. BablFishPath.html shows that format w/o any conversions to or from it. ] - The components of one format don't all have to have the same data type. - New data types (e.g. integer with certain ranges) can be added using babl_type_new(). That's it for now. Regards Rupert _______________________________________________ Gegl-developer mailing list Gegl-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer