Design: 04.03.02.02/P10
This is an abstract, language-independent design. Grim
details may be found in the
corresponding source code.
You may return to the
documentation
for the module containing this program design, or to the
entire hierarchical table of
topics covered by the PVT.
PROGRAM 10: Foreground colour
CHARACTERISTICS: ynny
OPERATOR SCRIPT:
FOREGROUND COLOUR: Five of the six labelled squares should
contain a square grid of polymarkers. The polymarkers of all
five should be the same color. Identify the square containing a
different display.
DESIGN:
set colour model = RGB
bg = requested background colour = randomly: green, blue or magenta
set color representation #0 to bg
inquire color representation #0 as realized to determine
bckcol = actual background color
inquire workstation state table lengths to determine
colsiz = number of settable entries in color table
maxci = maximum color index = colsiz-1
fg = foreground color farthest from bckcol in color cube
set color representations from #1 to #maxci to fg
TEST: #SR 30 31 32
"All the positive entries within the reported size of the color
table should control a foreground colour."
sqside = integer number of polymarkers per side of square array
= sqrt(colsiz/4 + 1) + 1
(this ensures all color slots will be used)
side1 = 0.1
side2 = 0.9
sqinc = increment for square = (side2-side1) / (sqside-1)
mrksiz = polymarker size = min(0.05, 0.2 * sqinc)
set polymarker style = plus (+)
set polymarker size = mrksiz (in WC)
divide screen up into six labelled square areas
perm = randomize order from 1 to 6
nxtcol = next color index to use = maxci
draw square grids of polymarkers:
simulated using only color #1,
actual using all foreground colors.
for ix = 1 to 6
window = perm(ix)
set tranformation to scale unit square into this window
if (window = 1) then
simulate incorrect display:
ngsq = ix
set polymarker color = 1
siz = 0
for xloc = side1 to (side2 + 0.5*sqinc) by sqinc
for yloc = side1 to (side2 + 0.5*sqinc) by sqinc
siz = siz+1
xa(siz) = xloc
ya(siz) = yloc
next yloc
next xloc
put a polymarker at a non-aligned position:
siz = siz+1
xa(siz) = side1 + sqinc * ((random integer from 0 to sqside-1) + 0.5)
ya(siz) = side1 + sqinc * ((random integer from 0 to sqside-1) + 0.5)
display polymarker: siz, xa,ya
elseif (window = 2) then
simulate correct display:
set polymarker color = 1
siz = 0
for xloc = side1 to (side2 + 0.5*sqinc) by sqinc
for yloc = side1 to (side2 + 0.5*sqinc) by sqinc
siz = siz+1
xa(siz) = xloc
ya(siz) = yloc
next yloc
next xloc
display polymarker: siz, xa,ya
else
draw an actual grid:
for xloc = side1 to (side2 + 0.5*sqinc) by sqinc
for yloc = side1 to (side2 + 0.5*sqinc) by sqinc
visible aligned marker:
if (nxtcol < maxci) then
nxtcol = nxtcol+1
else
nxtcol = 1
endif
set polymarker color = nxtcol
xa(1) = xloc
ya(1) = yloc
display single polymarker: xa,ya
next yloc
next xloc
endif
next ix
OPQA/FOREGROUND COLOUR: Which polymarker is different in either
color or geometry?
pass/fail depending on (operator response = ngsq)
END PROGRAM 10