1
c $Id: x30f.fm4 11680 2011-03-27 17:57:51Z airwin $
3
c Alpha color values demonstration
5
c Copyright (C) 2008 Hazen Babcock
6
c Copyright (C) 2008 Andrew Ross
8
c This file is part of PLplot.
10
c PLplot is free software; you can redistribute it and/or modify
11
c it under the terms of the GNU Library General Public License as
12
c published by the Free Software Foundation; either version 2 of the
13
c License, or (at your option) any later version.
15
c PLplot is distributed in the hope that it will be useful,
16
c but WITHOUT ANY WARRANTY; without even the implied warranty of
17
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
c GNU Library General Public License for more details.
20
c You should have received a copy of the GNU Library General Public
21
c License along with PLplot; if not, write to the Free Software
22
c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28
include 'plplot_parameters.h'
30
integer red(4), green(4), blue(4)
31
real*8 alpha(4), px(4), py(4)
32
real*8 pos(2), rcoord(2), gcoord(2), bcoord(2), acoord(2)
35
data red / 0, 255, 0, 0 /
36
data green / 0, 0, 255, 0 /
37
data blue / 0, 0, 0, 255 /
38
data alpha / 1.0d0, 1.0d0, 1.0d0, 1.0d0 /
39
data px / 0.1d0, 0.5d0, 0.5d0, 0.1d0 /
40
data py / 0.1d0, 0.1d0, 0.5d0, 0.5d0 /
41
data pos / 0.0d0, 1.0d0 /
42
data rcoord / 1.0d0, 1.0d0 /
43
data gcoord / 0.0d0, 0.0d0 /
44
data bcoord / 0.0d0, 0.0d0 /
45
data acoord / 0.0d0, 1.0d0 /
46
data rev / .false. , .false. /
54
call plparseopts(PL_PARSE_FULL)
60
call plscmap0a (red, green, blue, alpha, 4)
65
c This is a series of red, green and blue rectangles overlaid
66
c on each other with gradually increasing transparency.
71
call plvpor (0.0d0, 1.0d0, 0.0d0, 1.0d0)
72
call plwind (0.0d0, 1.0d0, 0.0d0, 1.0d0)
74
call plbox ("", 1.0d0, 0, "", 1.0d0, 0)
80
c Get a color, change its transparency and
81
c set it as the current color.
82
call plgcol0a (icol, r, g, b, a)
83
call plscol0a (icol, r, g, b, 1.0d0 - dble(i-1)/9.0d0)
87
call plfill (4, px, py)
89
c Shift the rectangles coordinates
91
px(j) = px(j) + 0.5d0/9.0d0
92
py(j) = py(j) + 0.5d0/9.0d0
98
c This is a bunch of boxes colored red, green or blue with a single
99
c large (red) box of linearly varying transparency overlaid. The
100
c overlaid box is completely transparent at the bottom and completely
106
call plvpor(0.1d0, 0.9d0, 0.1d0, 0.9d0)
107
call plwind(0.0d0, 1.0d0, 0.0d0, 1.0d0)
109
c Draw the boxes. There are 25 of them drawn on a 5 x 5 grid.
112
px(1) = 0.05d0 + 0.2d0 * dble(i-1)
113
px(2) = px(1) + 0.1d0
117
c We don't want the boxes to be transparent, so since we changed
118
c the colors transparencies in the first example we have to change
119
c the transparencies back to completely opaque.
120
icol = mod(i-1,3) + 1
121
call plgcol0a (icol, r, g, b, a)
122
call plscol0a (icol, r, g, b, 1.0d0)
125
c Set box y position and draw the box.
126
py(1) = 0.05d0 + 0.2d0 * dble(j-1)
128
py(3) = py(1) + 0.1d0
130
call plfill(4, px, py)
134
c Create the color map with 128 colors and call plscmap1la to initialize
135
c the color values with a linearly varying red transparency (or alpha)
137
call plscmap1la(1, 2, pos, rcoord, gcoord, bcoord, acoord, rev)
139
c Use that cmap1 to create a transparent red gradient for the whole
151
call plgradient( 4, px, py, 90.d0 )