From: <ai...@us...> - 2009-12-02 08:39:01
|
Revision: 10668 http://plplot.svn.sourceforge.net/plplot/?rev=10668&view=rev Author: airwin Date: 2009-12-02 08:38:49 +0000 (Wed, 02 Dec 2009) Log Message: ----------- Implement plgradient for lua bindings and make lua examples 25 and 30 that _should_ produce consistent results with their C counterparts (which use plgradient). In this case example 25 is consistent (which verifies the lua bindings are fine, but for some unknown reason example 30 is not. Modified Paths: -------------- trunk/bindings/lua/plplotluac.i trunk/examples/lua/x25.lua trunk/examples/lua/x30.lua Modified: trunk/bindings/lua/plplotluac.i =================================================================== --- trunk/bindings/lua/plplotluac.i 2009-12-02 07:53:05 UTC (rev 10667) +++ trunk/bindings/lua/plplotluac.i 2009-12-02 08:38:49 UTC (rev 10668) @@ -1038,6 +1038,7 @@ %rename(glevel) plglevel; %rename(gpage) plgpage; %rename(gra) plgra; +%rename(gradient) plgradient; %rename(griddata) plgriddata; %rename(gspa) plgspa; %rename(gstrm) plgstrm; Modified: trunk/examples/lua/x25.lua =================================================================== --- trunk/examples/lua/x25.lua 2009-12-02 07:53:05 UTC (rev 10667) +++ trunk/examples/lua/x25.lua 2009-12-02 08:38:49 UTC (rev 10668) @@ -48,6 +48,7 @@ yextreme = { { -120, 120 }, { 20, 120 }, { -20, 120 }, { -20, 120 }, { -120, 120 }, { -120, 120 }, { -20, 20 }, { -80, 80 }, { -120, 120 } } +for k = 1, 2 do for j = 1, 4 do if j==1 then -- Polygon 1: a diamond @@ -79,12 +80,17 @@ pl.box("bc", 1, 0, "bcnv", 10, 0) pl.col0(1) pl.psty(0) - pl.fill(x0, y0) + if k==1 then + pl.fill(x0, y0) + else + pl.gradient(x0, y0, 45.) + end pl.col0(2) pl.lsty(1) pl.line(x0, y0) end end +end -- Don't forget to call plend() to finish off! pl.plend() Modified: trunk/examples/lua/x30.lua =================================================================== --- trunk/examples/lua/x30.lua 2009-12-02 07:53:05 UTC (rev 10667) +++ trunk/examples/lua/x30.lua 2009-12-02 08:38:49 UTC (rev 10668) @@ -39,8 +39,6 @@ acoord = { 0, 1 } rev = { 0, 0 } -clevel = {} - pl.parseopts (arg, pl.PL_PARSE_FULL); pl.init() @@ -117,26 +115,23 @@ end end --- The overlaid box is drawn using plshades with a color map that is --- the same color but has a linearly varying transparency. - -- Create the color map with 128 colors and use plscmap1la to initialize --- the color values with a linear varying transparency (or alpha) +-- the color values with a linearly varying red transparency (or alpha) pl.scmap1n(128) pl.scmap1la(1, pos, rcoord, gcoord, bcoord, acoord, rev) --- Create a 2 x 2 array that contains the z values (0.0 to 1.0) that will --- used for the shade plot. plshades will use linear interpolation to --- calculate the z values of all the intermediate points in this array. -z = { {0, 1}, {0, 1} } +-- Use that cmap1 to create a transparent red gradient for the whole +-- window. +px[1] = 0. +px[2] = 1. +px[3] = 1. +px[4] = 0. --- Set the color levels array. These levels are also between 0.0 and 1.0 -for i=1, 101 do - clevel[i] = 0.01 * (i-1) -end +py[1] = 0. +py[2] = 0. +py[3] = 1. +py[4] = 1. --- Draw the shade plot with zmin = 0.0, zmax = 1.0 and x and y coordinate ranges --- such that it fills the entire plotting area. -pl.shades(z, 0, 1, 0, 1, clevel, 0, -1, 2, 1); +pl.gradient(px, py, 90.) pl.plend() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |