Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 8b2b1fb157760a0d31e072e140388824 > files > 122

gri-2.8.0-1mdk.i586.rpm

<html>
<head>
<title>Gri: pen color</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000EE" vlink="#551A8B" alink="FF0000">
<!-- newfile PenColor.html "Gri: pen color" "Getting more control" --> 

<!-- @node   Pen Color, X-y Plots, Fonts, Getting More Control -->
<a name="PenColor" ></a>

<img src="./resources/top_banner.gif" usemap="#navigate_top" border="0">
<table summary="top banner" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" valign="top">
<font size=-1>
<br>
Chapters:
</br>
&nbsp;&nbsp;<a href="Introduction.html">1: Introduction</a><br>
&nbsp;&nbsp;<a href="SimpleExample.html">2: Simple example</a><br>
&nbsp;&nbsp;<a href="InvokingGri.html">3: Invocation</a><br>
&nbsp;&nbsp;<a href="GettingMoreControl.html">4: Finer Control</a><br>
&nbsp;&nbsp;<a href="X-Y.html">5: X-Y Plots</a><br>
&nbsp;&nbsp;<a href="ContourPlots.html">6: Contour Plots</a><br>
&nbsp;&nbsp;<a href="Images.html">7: Image Plots</a><br>
&nbsp;&nbsp;<a href="Examples.html">8: Examples</a><br>
&nbsp;&nbsp;<a href="Commands.html">9: Gri Commands</a><br>
&nbsp;&nbsp;<a href="Programming.html">10: Programming</a><br>
&nbsp;&nbsp;<a href="Environment.html">11: Environment</a><br>
&nbsp;&nbsp;<a href="Emacs.html">12: Emacs Mode</a><br>
&nbsp;&nbsp;<a href="History.html">13: History</a><br>
&nbsp;&nbsp;<a href="Installation.html">14: Installation</a><br>
&nbsp;&nbsp;<a href="Bugs.html">15: Gri Bugs</a><br>
&nbsp;&nbsp;<a href="TestSuite.html">16: Test Suite</a><br>
&nbsp;&nbsp;<a href="Acknowledgments.html">17: Acknowledgments</a><br>
&nbsp;&nbsp;<a href="License.html">18: License</a><br>
<br>
Indices:</br>
&nbsp;&nbsp;<a href="ConceptIndex.html"><i>Concepts</i></a><br>
&nbsp;&nbsp;<a href="CommandIndex.html"><i>Commands</i></a><br>
&nbsp;&nbsp;<a href="BuiltinIndex.html"><i>Variables</i></a><br>
</font>
<td width="500" valign="top">
<map name="navigate_top">
<area alt="index.html#Top" shape="rect" coords="5,2,218,24" href="index.html#Top">
<area alt="GettingMoreControl.html#GettingMoreControl" shape="rect" coords="516,2,532,24" href="GettingMoreControl.html#GettingMoreControl">
<area alt="Gri: fonts" shape="rect" coords="557,2,573,24" href="Fonts.html">
<area alt="Gri: xy plots" shape="rect" coords="581,2,599,24" href="X-Y.html">
</map>
<map name="navigate_bottom">
<area alt="index.html#Top" shape="rect" coords="5,2,218,24" href="index.html#Top">
<area alt="Gri: xy plots" shape="rect" coords="581,2,599,24" href="X-Y.html"></map>
<h2>4.9: Controlling the graylevel of the ``pen''</h2>


The darkness of the ``pen'' used in drawing commands (for either lines or
for text) is set by `<font color="#82140F"><code>set graylevel .brightness.</code></font>'.  A brightness
value of 0 corresponds to black ink, and a brightness value of 1
corresponds to white ink.  Values outside this range are clipped to the
nearer endpoint.  Values inside this range choose a proportional
graylevel in between; for example, `<font color="#82140F"><code>set graylevel 0.5</code></font>' gives a 50
percent gray tone.
<p>
The graylevel applies to text as well as lines.  Often you'll want to
draw a gray line and a black label beside it, or you'll want to set a
graylevel temporarily.  Here's how to do it:
<p>
<TABLE SUMMARY="Example" BORDER="0" BGCOLOR="#efefef" WIDTH="100%">
<TR>
<TD>
<PRE>
<font color="#82140F">
# Save old graylevl, set, then reset to old
.old_gray. = ..graylevel..
set graylevel 0.5
draw curve
set graylevel 0
draw label for last curve "TEST"
set graylevel .old_gray.
</font></PRE>
</TD>
</TR>
</TABLE>
<p>

The color of the "pen" may be set to any value you can describe with an
RGB (red, green, blue) or HSB (hue, saturation, brightness)
specification, or a color name.  This pen color applies to everything,
even text.
<p>
 <b>The</b> `<font color="#82140F"><code>set color \name</code></font>' <b>command</b>
<p>
Set the pen color to the indicated name.  By default, only a handful of
colors are known.  You <b>MUST</b> give color names as written here,
obeying the capitilization shown.  The color mixes are identical to
those used in X11.  The following lists some of the colors Gri knows by
default.
<p>

<TABLE SUMMARY="Example" BORDER="0" BGCOLOR="#efefef" WIDTH="100%">
<TR>
<TD>
<PRE>
<font color="#82140F">
NAME               RED    GREEN  BLUE
"white"            1.000  1.000  1.000
"LightGray"        0.827  0.827  0.827
"darkslategray"    0.184  0.310  0.310
"black"            0.000  0.000  0.000
"red"              1.000  0.000  0.000
"brown"            0.647  0.165  0.165
"tan"              0.824  0.706  0.549
"orange"           1.000  0.647  0.000
"yellow"           1.000  1.000  0.000
"green"            0.000  1.000  0.000
"ForestGreen"      0.133  0.545  0.133
"cyan"             0.000  1.000  1.000
"blue"             0.000  0.000  1.000
"skyblue"          0.529  0.808  0.922
"magenta"          1.000  0.000  1.000
</font></PRE>
</TD>
</TR>
</TABLE>
<p>

To get more colors than this, use the `<font color="#82140F"><code>read colornames</code></font>' command.
<p>
You should do a test case for your printer to see which colors you find
most to your liking.  You'll want to pick colors that look different
from each other.  In some cases you might want to avoid dithered colors,
since they look too broken on really thin lines.  For example, on my
printer I like the following colors: `<font color="#82140F"><code>black</code></font>', `<font color="#82140F"><code>red</code></font>',
`<font color="#82140F"><code>yellow</code></font>', `<font color="#82140F"><code>green</code></font>', `<font color="#82140F"><code>cyan</code></font>', and `<font color="#82140F"><code>magenta</code></font>'.
<p>

 <b>The</b> `<font color="#82140F"><code>set color rgb .red. .green. .blue.</code></font>' <b>command</b>
<p>
This command sets the color using the red-green-blue color model.  If
you are familiar with how colors add (e.g. red plus green yields
yellow), then you might like this, but most people find it easier to use
the `<font color="#82140F"><code>set color hsb ...</code></font>' style described below.
<p>
Set the individual color components as follows.  The numbers
`<font color="#82140F"><code>.red.</code></font>', `<font color="#82140F"><code>.green.</code></font>' and `<font color="#82140F"><code>.blue.</code></font>' range from 0 (for no
contribution of that color component to the final color) to 1 (for
maximal contribution).  Values less than 0 are clipped to 0; values
greater than 1 are clipped to 1. EXAMPLES:
<p>
<TABLE SUMMARY="Example" BORDER="0" BGCOLOR="#efefef" WIDTH="100%">
<TR>
<TD>
<PRE>
<font color="#82140F">
set color rgb 0   0   0  # black
set color rgb 1   1   1  # white
set color rgb 1   0   0  # bright red
set color rgb 0.5 0   0  # dark red
set color rgb 0   1   0  # pure green
set color rgb 1   1   0  # yellow: red + green
</font></PRE>
</TD>
</TR>
</TABLE>
<p>

 <b>The</b> `<font color="#82140F"><code>set color hsb .hue. .saturation. .brightness.</code></font>' <b>command</b>
<p>
In this color model, the color ("hue") is specified with a single
parameter.  Many people find this easier than using the corresponding
`<font color="#82140F"><code>rgb</code></font>' command.
<p>
Set the individual color components as follows.  The numbers
`<font color="#82140F"><code>.hue.</code></font>', `<font color="#82140F"><code>.saturation.</code></font>' and `<font color="#82140F"><code>.brightness.</code></font>' range from 0
to 1.  The color, represented by `<font color="#82140F"><code>.hue.</code></font>', ranges from 0 for pure
red, through 1/3 for pure green, and 2/3 for pure blue, and back to 1
again for pure red.  (HINT: It is a good idea to limit the total range
of hue you use to 2/3, instead of 1; otherwise you'll get confused by
(nearly) repeated colors at the crossover.  For example, limit the hue
to range from 1/3 to 1, or 0 to 2/3.)  The purity of the color,
represented by `<font color="#82140F"><code>.saturation.</code></font>', ranges from 0 (none of the hue is
visible) to 1 (the maximal amount is present).  Less saturated colours
are like those you would get from mixing black paint into colored
paint.  The brightness of the color, represented by `<font color="#82140F"><code>.brightness.</code></font>',
ranges from 0 (black) to 1 (maximal brightness).  Lowering brightness is
like decreasing the intensity of the light you shine on a painting.
<p>
Hue, saturation, and brightness values are all clipped to the range 0 to 1.
EXAMPLES:
<p>
<TABLE SUMMARY="Example" BORDER="0" BGCOLOR="#efefef" WIDTH="100%">
<TR>
<TD>
<PRE>
<font color="#82140F">
set color hsb 0    1   1  # pure, bright red
set color hsb 0    1 0.5  # half black, half red
set color hsb .333 1   1  # pure, bright green
</font></PRE>
</TD>
</TR>
</TABLE>
<p>




</table>
<img src="./resources/bottom_banner.gif" usemap="#navigate_bottom" border="0">

</body>
</html>