From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,4370411c07c164af X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Color gradients lib Followup-To: comp.lang.ada Date: Wed, 09 Feb 2011 09:53:18 +0100 Organization: A noiseless patient Spider Message-ID: References: <1lxxuu6fkr6fy.1dw6oop7xv799.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Injection-Date: Wed, 9 Feb 2011 08:53:32 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="w8g++bW4v3KH0+SqtoCNSw"; logging-data="19788"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/p8rnzRTiYnFlptgFPjtwu" User-Agent: KNode/4.4.9 Cancel-Lock: sha1:t2elbWJ4vSjd0LQsseLDFi418J8= Xref: g2news1.google.com comp.lang.ada:17077 Date: 2011-02-09T09:53:18+01:00 List-Id: Dmitry A. Kazakov wrote: > On Tue, 08 Feb 2011 11:58 +0100, Alex R. Mosteo wrote: > >> I need to plot some data (2D maps) and I have everything in my drawing >> library except some readily usable gradients. I was wondering if some Ada >> library out there has this before making my custom one. > > OK, that is an ill-defined problem because the visual appearance of a > gradient (linear function of position) depends on the color space you are > using. The RGB color space is quite unnatural to human eye. L*a*b is much > better, but computationally problematic. HLS is a very coarse > approximation of L*a*b. GtkAda contributions has an implementation of > improved HLS model. > > http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#8 > > For building a gradient I would convert the end points to IHLS and then > use linear functions for hue, luminance and saturation between the points. > The obtained IHLS colors are then converted back to RGB. Thanks everybody for the discussion. I'm going to try this approach.