groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] color question: numbers


From: Gaius Mulley
Subject: [Groff] color question: numbers
Date: Mon, 24 Sep 2001 10:50:40 +0100

I've almost finished introducing colors into gtroff but a nagging
question is hanging over the implementation.  If my understanding is
correct the numbers in gtroff are held as integers (units) but certain
scaling operators allow for limited floating point constant input.
This makes it difficult to implement a color definition, say:

.defcolor darkred rgb 0.65 0.1 0.2

It could be implemented either:

  (i)   the numbers after rgb can only be literal constants and we call atof
  (ii)  we introduce a new scaling factor (say k for kilo) and
        thus colors can be defined 0..1023 per primary color, and
        the above example becomes: (.defcolor darkred rgb 0.65k 0.1k 0.2k)
  (iii) another method?

are people happy with (ii)?  Maybe there is a better solution?
To get a feel for what (ii) looks like, here is a small example:

.hy 0
.nr HY 0
.defcolor darkred rgb 0.65k 0.1k 0.2k
.defcolor darkgreen rgb 0.1k 0.5k 0.2k
.defcolor blue rgb #0000ff
.defcolor yellow cmy #0000ff
.LP
A green elipse can be produced by the following commands:
.sp .5i
.B1
\fC\&.defcolor darkgreen rgb 0.1k 0.5k 0.2k
.br
\\M[darkgreen]\\h'1i'\\D'E 2i 1i'\fP
.B2
.sp 1i
\M[darkgreen]\h'0.5i'\D'E 2i 1i'

Gaius

reply via email to

[Prev in Thread] Current Thread [Next in Thread]