From tkpapp at gmail.com Wed Apr 18 08:17:32 2012 From: tkpapp at gmail.com (Tamas K Papp) Date: Wed, 18 Apr 2012 10:17:32 +0200 Subject: [cl-pdf-devel] gradients Message-ID: <87mx69bgir.fsf@gmail.com> Hi, I would like to write a plotting function that draws image plots (plotting a matrix in 2d using colors). It would be useful to use gradients; in particular, paint a rectangle where the four corners each have a color and the each point in the rectangle has a color which is a convex combination of the corner colors. I think this is called a gradient in most libraries, but I could not figure out how to do it in cl-pdf (I have to admit that I didn't find gradients in the library, maybe I didn't look hard enough). Suggestions/examples would be welcome. Best, Tamas From eric.marsden at free.fr Thu Apr 19 07:17:34 2012 From: eric.marsden at free.fr (Eric Marsden) Date: Thu, 19 Apr 2012 09:17:34 +0200 Subject: [cl-pdf-devel] gradients In-Reply-To: <87mx69bgir.fsf@gmail.com> References: <87mx69bgir.fsf@gmail.com> Message-ID: <4F8FBC0E.2080008@free.fr> On 18/04/2012 10:17, Tamas K Papp wrote: > I would like to write a plotting function that draws image plots > (plotting a matrix in 2d using colors). It would be useful to use > gradients; in particular, paint a rectangle where the four corners each > have a color and the each point in the rectangle has a color which is a > convex combination of the corner colors. I think this is called a > gradient in most libraries, but I could not figure out how to do it in > cl-pdf (I have to admit that I didn't find gradients in the library, > maybe I didn't look hard enough). Hi, Gradients of this sort are called shading patterns in PDF (available from PDF version 1.3). Several types of shading patterns are available: function-based, axial, radial, Gourad-shaded. cl-pdf doesn't have any support for this, but it shouldn't be very hard to add. The PDF specification is available from http://www.adobe.com/devnet/pdf/pdf_reference_archive.html You want section 4.6.3. -- Eric