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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4370411c07c164af X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.158.31.10.MISMATCH!newsfeed-0.progon.net!progon.net!news-zh.switch.ch!switch.ch!news.belwue.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Color gradients lib Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Tue, 8 Feb 2011 19:00:08 +0100 Message-ID: <1lxxuu6fkr6fy.1dw6oop7xv799.dlg@40tude.net> NNTP-Posting-Date: 08 Feb 2011 19:00:05 CET NNTP-Posting-Host: 6d6bf93c.newsspool3.arcor-online.net X-Trace: DXC=bMD@Q4i^U`A2:OR3:3gaE@McF=Q^Z^V3H4Fo<]lROoRA8kF9SfENmIlQmnodliC@H X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:17006 Date: 2011-02-08T19:00:05+01:00 List-Id: 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. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de