CtClear: CtProc ~ {
rVal, gVal, bVal: CARDINAL;
rArg, gArg, bArg: Args.Arg;
[rArg, gArg, bArg] ¬ Args.ArgsGet[cmd, "[iii" ! Args.Error => {error ¬ reason; CONTINUE}];
IF error # NIL THEN RETURN;
rVal ¬ MIN[255, IF rArg.ok THEN INTEGER[rArg.int] ELSE 255];
gVal ¬ MIN[255, IF gArg.ok THEN INTEGER[gArg.int] ELSE rVal];
bVal ¬ MIN[255, IF bArg.ok THEN INTEGER[bArg.int] ELSE gVal];
CtBasic.FillMaps[maps, rVal, rVal, gVal, bVal];
affect ¬ maps.box;
CtLine: CtProc ~ {
x0, y0, x1, y1, r, g, b: Args.Arg;
[x0, y0, x1, y1, r, g, b] ¬ Args.ArgsGet[cmd, "[iiiiiii"
! Args.Error => {error ¬ reason; CONTINUE}];
IF NOT (error = NIL AND x0.ok AND y0.ok AND x1.ok AND y1.ok AND r.ok) THEN RETURN;
IF maps.bpp = 24
THEN {
IF NOT (g.ok AND b.ok) THEN RETURN[error: "bad arguments"];
CtBasic.PutRGBLine[maps, x0.int, y0.int, x1.int, y1.int, [r.int, g.int, b.int]];
}
ELSE CtBasic.PutBWLine[maps[0].map, x0.int, y0.int, x1.int, y1.int, r.int];
affect ¬ [[y0.int, x0.int], [y1.int, x1.int]];
};
CtColorBars: CtProc ~ {
PutBox:
PROC [x0, y0, x1, y1:
INTEGER, rgb:
RGB] ~ {
CtBasic.PutRGBBox[maps, maps.x+x0, maps.y+y0, maps.x+x1, maps.y+y1, rgb];
};
smpte, eia: Args.Arg;
[smpte, eia] ¬ Args.ArgsGet[cmd, "-smpte%b-eia%b"
! Args.Error => {error ¬ reason; CONTINUE}];
IF error # NIL THEN RETURN;
IF maps.bpp # 24 THEN RETURN[error: "only works for 24 bpp"];
For EIA color bars:
CtMap.Mono[];
CtBasic.FillMaps[maps]; -- Start with black
PutBox[0*91, 0, 1*91, 360, [191, 191, 191]]; -- Gray
PutBox[1*91, 0, 2*91, 360, [191, 191, 000]]; -- Yellow
PutBox[2*91, 0, 3*91, 360, [000, 191, 191]]; -- Cyan
PutBox[3*91, 0, 4*91, 360, [000, 191, 000]]; -- Green
PutBox[4*91, 0, 5*91, 360, [191, 000, 191]]; -- Magenta
PutBox[5*91, 0, 6*91, 360, [191, 000, 000]]; -- Red
PutBox[6*91, 0, 7*91, 360, [000, 000, 191]]; -- Blue
PutBox[0*114, 360, 1*114, 480, [0, 76, 127]]; -- NTSC -I
PutBox[1*114, 360, 2*114, 480, [255, 255, 255]]; -- White
PutBox[2*114, 360, 3*114, 480, [75, 0, 139]]; -- NTSC +Q
For SMPTE split color bars, with PLUGE black:
IF
NOT eia.ok
THEN {
PutBox[0*91, 322, 7*91, 360, [000, 000, 000]]; -- Black for split
PutBox[0*91, 322, 1*91, 360, [000, 000, 191]]; -- Blue
PutBox[2*91, 322, 3*91, 360, [191, 000, 191]]; -- Magenta
PutBox[4*91, 322, 5*91, 360, [000, 191, 191]]; -- Cyan
PutBox[6*91, 322, 7*91, 360, [191, 191, 191]]; -- Gray
PutBox[5*91, 360, 5*91+30, 480, [11, 11, 11]]; -- Black+4 for PLUGE
};
affect ¬ [[0, 0], [480, 7*91]];
CtGrid: CtProc ~ {
InnerGrid:
PROC [map: SampleMap] ~ {
FOR i:
NAT ¬ maps.box.min.f, i+space
WHILE i < maps.box.max.f
DO
FOR j:
NAT ¬ maps.box.min.s, j+1
WHILE j < maps.box.max.s
DO
ImagerSample.Fill[map, [[j, i], [j+width, i+width]], pVal];
ENDLOOP;
ENDLOOP;
FOR j:
NAT ¬ maps.box.min.s, j+space
WHILE j < maps.box.max.s
DO
FOR i:
NAT ¬ maps.box.min.f, i+1
WHILE i < maps.box.max.f
DO
ImagerSample.Fill[map, [[j, i], [j+width, i+width]], pVal];
ENDLOOP;
ENDLOOP;
};
pVal, space, width: CARDINAL;
pValArg, spaceArg, widthArg: Args.Arg;
[pValArg, spaceArg, widthArg] ¬ Args.ArgsGet[cmd, "-pVal%i-space%i-width%i"
! Args.Error => {error ¬ reason; CONTINUE}];
IF error # NIL THEN RETURN;
pVal ¬ IF pValArg.ok THEN pValArg.int ELSE 0;
pVal ¬ 256*pVal+pVal;
space ¬ IF spaceArg.ok THEN spaceArg.int ELSE 40;
width ¬ IF widthArg.ok THEN widthArg.int ELSE 1;
FOR n: NAT IN [0..maps.nChannels) DO InnerGrid[maps[n].map]; ENDLOOP;
affect ¬ maps.box;
};