Next: 4.15 Color palette tables Up: 4. General features Previous: 4.13 Specifying pen attributes Contents Index

# 4.14 Specifying area fill attributes

Many plotting programs will allow the user to draw filled polygons or symbols. The fill specification may take two forms:

-G fill

-Gp dpi/pattern[:B color[F color]]

fill:
  In the first case we may specify a gray shade (0-255), RGB color (r/g/b all in the 0-255 range or in hexadecimal #rrggbb), HSV color (hue-saturation-value in the 0-360, 0-1, 0-1 range), CMYK color (cyan/magenta/yellow/black, each ranging from 0-100%), or a valid color name; in that respect it is similar to specifying the pen color settings (see pen color discussion under Section 4.13).
pattern:
  The second form allows us to use a predefined bit-image pattern. pattern can either be a number in the range 1-90 or the name of a 1-, 8-, or 24-bit Sun raster file. The former will result in one of the 90 predefined 64 x 64 bit-patterns provided with GMT and reproduced in Appendix E. The latter allows the user to create customized, repeating images using standard Sun raster files4.11. The dpi parameter sets the resolution of this image on the page; the area fill is thus made up of a series of these ``tiles''. Specifying dpi as 0 will result in highest resolution obtainable given the present dpi setting in .gmtdefaults4. By specifying upper case -GP instead of -Gp the image will be bit-reversed, i.e., white and black areas will be interchanged (only applies to 1-bit images or predefined bit-image patterns). For these patterns and other 1-bit images one may specify alternative background and foreground colors (by appending :B color[F color]) that will replace the default white and black pixels, respectively. Setting one of the fore- or background colors to - yields a transparent image where only the back- or foreground pixels will be painted.

Due to PostScript implementation limitations the raster images used with -G must be less than 146 x 146 pixels in size; for larger images see psimage. The format of Sun raster files is outlined in Appendix B. Note that under PostScript Level 1 the patterns are filled by using the polygon as a clip path. Complex clip paths may require more memory than the PostScript interpreter has been assigned. There is therefore the possibility that some PostScript interpreters (especially those supplied with older laserwriters) will run out of memory and abort. Should that occur we recommend that you use a regular grayshade fill instead of the patterns. Installing more memory in your printer may or may not solve the problem!

Table 4.6 contains a few examples of fill specifications.

Table 4.6: A few examples of fill specifications.

Fill example | Comment
-G128 | Solid gray
-G127/255/0 | Chartreuse, R/G/B-style
-G#00ff00 | Green, hexadecimal RGB code
-G25-0.86-0.82 | Chocolate, h-s-v - style
-GDarkOliveGreen1 | One of the named colors
-Gp300/7 | Simple diagonal hachure pattern in b/w at 300 dpi
-Gp300/7:Bred | Same, but with red lines on white
-Gp300/7:BredF- | Now the gaps between red lines are transparent
-Gp100/marble.ras | Using user image of marble as the fill at 100 dpi

Next: 4.15 Color palette tables Up: 4. General features Previous: 4.13 Specifying pen attributes Contents Index