From: <ai...@us...> - 2009-12-02 03:36:33
|
Revision: 10663 http://plplot.svn.sourceforge.net/plplot/?rev=10663&view=rev Author: airwin Date: 2009-12-02 03:36:24 +0000 (Wed, 02 Dec 2009) Log Message: ----------- Implement plgradient for f77 bindings and make f77 examples 25 and 30 produce consistent results with their C counterparts (which use plgradient). Modified Paths: -------------- trunk/bindings/f77/plstubs.h trunk/bindings/f77/scstubs.c trunk/examples/f77/x25f.fm4 trunk/examples/f77/x30f.fm4 Modified: trunk/bindings/f77/plstubs.h =================================================================== --- trunk/bindings/f77/plstubs.h 2009-12-02 01:51:25 UTC (rev 10662) +++ trunk/bindings/f77/plstubs.h 2009-12-02 03:36:24 UTC (rev 10663) @@ -218,6 +218,7 @@ #define PLGLEVEL FNAME( PLGLEVEL, plglevel ) #define PLGPAGE FNAME( PLGPAGE, plgpage ) #define PLGRA FNAME( PLGRA, plgra ) +#define PLGRADIENT FNAME( PLGRADIENT, plgradient ) #define PLGRIDDATA FNAME( PLGRIDDATA, plgriddata ) #define PLGSPA FNAME( PLGSPA, plgspa ) #define PLGSTRM FNAME( PLGSTRM, plgstrm ) Modified: trunk/bindings/f77/scstubs.c =================================================================== --- trunk/bindings/f77/scstubs.c 2009-12-02 01:51:25 UTC (rev 10662) +++ trunk/bindings/f77/scstubs.c 2009-12-02 03:36:24 UTC (rev 10663) @@ -368,6 +368,12 @@ } void +PLGRADIENT( PLINT *n, PLFLT *x, PLFLT *y, PLFLT *angle ) +{ + c_plgradient( *n, x, y, *angle ); +} + +void PLGSPA( PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax ) { c_plgspa( xmin, xmax, ymin, ymax ); Modified: trunk/examples/f77/x25f.fm4 =================================================================== --- trunk/examples/f77/x25f.fm4 2009-12-02 01:51:25 UTC (rev 10662) +++ trunk/examples/f77/x25f.fm4 2009-12-02 03:36:24 UTC (rev 10663) @@ -1,13 +1,13 @@ -c $Id$ -c -c Filling and clipping polygons. -c -c -c -------------------------------------------------------------------------- -c main -c -c Test program for filling polygons and proper clipping -c -------------------------------------------------------------------------- +c $Id$ +c +c Filling and clipping polygons. +c +c +c -------------------------------------------------------------------------- +c main +c +c Test program for filling polygons and proper clipping +c -------------------------------------------------------------------------- program x25f @@ -16,8 +16,7 @@ integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) - integer i - integer j + integer i,j,k integer npts real*8 xextreme(2,10) real*8 yextreme(2,10) @@ -25,94 +24,100 @@ real*8 y0(10) data ( xextreme(1,i), xextreme(2,i), yextreme(1,i), yextreme(2,i), - & i=1,9) / - & -120.0, 120.0, -120.0, 120.0, - & -120.0, 120.0, 20.0, 120.0, - & -120.0, 120.0, -20.0, 120.0, - & -80.0, 80.0, -20.0, 120.0, - & -220.0, -120.0, -120.0, 120.0, - & -20.0, 20.0, -120.0, 120.0, - & -20.0, 20.0, -20.0, 20.0, - & -80.0, 80.0, -80.0, 80.0, - & 20.0, 120.0, -120.0, 120.0/ + & i=1,9) / + & -120.0, 120.0, -120.0, 120.0, + & -120.0, 120.0, 20.0, 120.0, + & -120.0, 120.0, -20.0, 120.0, + & -80.0, 80.0, -20.0, 120.0, + & -220.0, -120.0, -120.0, 120.0, + & -20.0, 20.0, -120.0, 120.0, + & -20.0, 20.0, -20.0, 20.0, + & -80.0, 80.0, -80.0, 80.0, + & 20.0, 120.0, -120.0, 120.0/ npts = 0 -c Parse and process command line arguments +c Parse and process command line arguments call plparseopts(PL_PARSE_FULL) -c Initialize plplot +c Initialize plplot call plssub(3,3) call plinit() - do 120 j = 1,4 + do k = 1,2 + do j = 1,4 - if ( j .eq. 1 ) then -c Polygon 1: a diamond - x0(1) = 0 ; y0(1) = -100 - x0(2) = -100 ; y0(2) = 0 - x0(3) = 0 ; y0(3) = 100 - x0(4) = 100 ; y0(4) = 0 - npts = 4 - endif - if ( j .eq. 2 ) then -c Polygon 1: a diamond - reverse direction - x0(4) = 0 ; y0(4) = -100 - x0(3) = -100 ; y0(3) = 0 - x0(2) = 0 ; y0(2) = 100 - x0(1) = 100 ; y0(1) = 0 - npts = 4 - endif - if ( j .eq. 3 ) then -c Polygon 2: a square with punctures - x0(1) = -100 ; y0(1) = -100 - x0(2) = -100 ; y0(2) = -80 - x0(3) = 80 ; y0(3) = 0 - x0(4) = -100 ; y0(4) = 80 - x0(5) = -100 ; y0(5) = 100 - x0(6) = -80 ; y0(6) = 100 - x0(7) = 0 ; y0(7) = 80 - x0(8) = 80 ; y0(8) = 100 - x0(9) = 100 ; y0(9) = 100 - x0(10) = 100 ; y0(10) = -100 - npts = 10 - endif - if ( j .eq. 4 ) then -c Polygon 2: a square with punctures - reversed direction - x0(10) = -100 ; y0(10) = -100 - x0(9) = -100 ; y0(9) = -80 - x0(8) = 80 ; y0(8) = 0 - x0(7) = -100 ; y0(7) = 80 - x0(6) = -100 ; y0(6) = 100 - x0(5) = -80 ; y0(5) = 100 - x0(4) = 0 ; y0(4) = 80 - x0(3) = 80 ; y0(3) = 100 - x0(2) = 100 ; y0(2) = 100 - x0(1) = 100 ; y0(1) = -100 - npts = 10 - endif + if ( j .eq. 1 ) then +c Polygon 1: a diamond + x0(1) = 0 ; y0(1) = -100 + x0(2) = -100 ; y0(2) = 0 + x0(3) = 0 ; y0(3) = 100 + x0(4) = 100 ; y0(4) = 0 + npts = 4 + endif + if ( j .eq. 2 ) then +c Polygon 1: a diamond - reverse direction + x0(4) = 0 ; y0(4) = -100 + x0(3) = -100 ; y0(3) = 0 + x0(2) = 0 ; y0(2) = 100 + x0(1) = 100 ; y0(1) = 0 + npts = 4 + endif + if ( j .eq. 3 ) then +c Polygon 2: a square with punctures + x0(1) = -100 ; y0(1) = -100 + x0(2) = -100 ; y0(2) = -80 + x0(3) = 80 ; y0(3) = 0 + x0(4) = -100 ; y0(4) = 80 + x0(5) = -100 ; y0(5) = 100 + x0(6) = -80 ; y0(6) = 100 + x0(7) = 0 ; y0(7) = 80 + x0(8) = 80 ; y0(8) = 100 + x0(9) = 100 ; y0(9) = 100 + x0(10) = 100 ; y0(10) = -100 + npts = 10 + endif + if ( j .eq. 4 ) then +c Polygon 2: a square with punctures - reversed direction + x0(10) = -100 ; y0(10) = -100 + x0(9) = -100 ; y0(9) = -80 + x0(8) = 80 ; y0(8) = 0 + x0(7) = -100 ; y0(7) = 80 + x0(6) = -100 ; y0(6) = 100 + x0(5) = -80 ; y0(5) = 100 + x0(4) = 0 ; y0(4) = 80 + x0(3) = 80 ; y0(3) = 100 + x0(2) = 100 ; y0(2) = 100 + x0(1) = 100 ; y0(1) = -100 + npts = 10 + endif - do 110 i = 1,9 - call pladv(0) - call plvsta() - call plwind(xextreme(1,i), xextreme(2,i), - & yextreme(1,i), yextreme(2,i)) + do i = 1,9 + call pladv(0) + call plvsta() + call plwind(xextreme(1,i), xextreme(2,i), + & yextreme(1,i), yextreme(2,i)) - call plcol0(2) - call plbox('bc', 1.0d0, 0, 'bcnv', 10.0d0, 0) - call plcol0(1) - call plpsty(0) - call plfill(npts,x0,y0) - call plcol0(2) - call pllsty(1) - call plline(npts,x0,y0) - 110 continue - 120 continue + call plcol0(2) + call plbox('bc', 1.0d0, 0, 'bcnv', 10.0d0, 0) + call plcol0(1) + call plpsty(0) + if(k.eq.1) then + call plfill(npts,x0,y0) + else + call plgradient(npts,x0,y0,45.d0) + endif + call plcol0(2) + call pllsty(1) + call plline(npts,x0,y0) + enddo + enddo + enddo -c Don't forget to call plend() to finish off! +c Don't forget to call plend() to finish off! call plend() end Modified: trunk/examples/f77/x30f.fm4 =================================================================== --- trunk/examples/f77/x30f.fm4 2009-12-02 01:51:25 UTC (rev 10662) +++ trunk/examples/f77/x30f.fm4 2009-12-02 03:36:24 UTC (rev 10663) @@ -46,7 +46,7 @@ integer i, j integer icol, r, g, b - real*8 a, clevel(101), z(2,2) + real*8 a, clevel(101) character*1 defined @@ -133,31 +133,24 @@ enddo enddo -c The overlaid box is drawn using plshades with a color map that is -c the same color but has a linearly varying transparency. - c Create the color map with 128 colors and call plscmap1la to initialize -c the color values with a linear varying transparency (or alpha) +c the color values with a linearly varying red transparency (or alpha) call plscmap1n(128) call plscmap1la(1, 2, pos, rcoord, gcoord, bcoord, acoord, rev) -c Create a 2 x 2 array that contains the z values (0.0 to 1.0) that will -c used for the shade plot. plshades uses linear interpolation to -c calculate the z values of all the intermediate points in this array. - z(1,1) = 0.0d0 - z(2,1) = 0.0d0 - z(1,2) = 1.0d0 - z(2,2) = 1.0d0 +c Use that cmap1 to create a transparent red gradient for the whole +c window. + px(1) = 0.d0 + px(2) = 1.d0 + px(3) = 1.d0 + px(4) = 0.d0 -c Set the color levels array. These levels are also between 0.0 and 1.0 - do i = 1,101 - clevel(i) = 0.01d0 * dble(i-1) - enddo + py(1) = 0.d0 + py(2) = 0.d0 + py(3) = 1.d0 + py(4) = 1.d0 -c Draw the shade plot with zmin = 0.0, zmax = 1.0 and x and y coordinate ranges -c such that it fills the entire plotting area. - call plshades0(z, 2, 2, defined, 0.0d0, 1.0d0, 0.0d0, 1.0d0, - & clevel, 101, 0, -1, 2, 2) + call plgradient( 4, px, py, 90.d0 ) call plend() end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |