AISFileFormat.mesa
Copyright © 1984, 1985, 1986 by Xerox Corporation. All rights reserved.
Doug Wyatt, February 22, 1986 2:53:48 pm PST
DIRECTORY
Basics USING [bitsPerByte, bytesPerWord];
AISFileFormat: CEDAR DEFINITIONS
~ BEGIN
bitsPerAISWord: NAT ~ 16; -- an AIS "word" is 16 bits
wordsPerAISPage: NAT ~ 1024; -- an AIS "page" is 1024 "words"
bytesPerAISWord: NAT ~ bitsPerAISWord/Basics.bitsPerByte;
bytesPerAISPage: NAT ~ bytesPerAISWord*wordsPerAISPage;
nil: CARDINAL ~ 177777B; -- commonly used for a nil value
passwordValue: CARDINAL ~ LOOPHOLE[-31574];
AttributeHeader: TYPE ~ MACHINE DEPENDENT RECORD[
password(0:0..15): CARDINAL, -- password, must equal passwordValue
length(1:0..15): CARDINAL -- length in 16-bit words of attribute section, including this header
-- length must be a multiple of wordsPerAISPage
];
byteSizeAttributeHeader: NAT ~ SIZE[AttributeHeader]*Basics.bytesPerWord;
PartHeader: TYPE ~ MACHINE DEPENDENT RECORD[
type(0:0..5): PartType, -- type of attribute part
length(0:6..15): [0..1777B] -- length of part in 16-bit words, including this one
];
byteSizePartHeader: NAT ~ SIZE[PartHeader]*Basics.bytesPerWord;
PartType: TYPE ~ MACHINE DEPENDENT {
nil(0), -- no more parts
raster(1), -- RasterPart follows
placement(2), -- PlacementPart follows
photometry(3), -- PhotometryPart follows
comment(4), -- CommentPart follows
(77B)
};
RasterPart: TYPE ~ MACHINE DEPENDENT RECORD[
scanCount(0:0..15): CARDINAL, -- number of scan lines
scanLength(1:0..15): CARDINAL, -- pixels per scan line
scanDirection(2:0..15): ScanDirection, -- scanning directions
samplesPerPixel(3:0..15): CARDINAL, -- number of samples
codingType(4:0..15): CodingType -- method of coding
];
byteSizeRasterPart: NAT ~ SIZE[RasterPart]*Basics.bytesPerWord;
ScanDirection: TYPE ~ CARDINAL;
There may not be universal agreement on the interpretation of this value. The AIS documentation disagrees with (at least some versions of) AISFile.d. Fortunately, the two most commonly used values are unambiguous:
3 => pixels go toward the right of the page, scan lines toward the bottom
0, 8 => pixels go toward the top of the page, scan lines toward the right
CodingType: TYPE ~ MACHINE DEPENDENT {
nil(0), -- undefined
uca(1), -- UCACoding folllows
(177777B)
};
UCACoding: TYPE ~ MACHINE DEPENDENT RECORD[ -- UnCompressedArray
bitsPerSample(0:0..15): CARDINAL, -- number of bits for each sample
wordsPerScanLine(1:0..15): CARDINAL, -- number of 16-bit words per scan line
scanLinesPerBlock(2:0..15): CARDINAL, -- scan lines in each block, nil if no blocks
paddingPerBlock(3:0..15): CARDINAL -- words of padding at end of block, nil if no blocks
-- if there are blocks, wordsPerBlock = wordsPerScanLine*scanLinesPerBlock+paddingPerBlock
];
byteSizeUCACoding: NAT ~ SIZE[UCACoding]*Basics.bytesPerWord;
PlacementPart: TYPE ~ MACHINE DEPENDENT RECORD[
xLeft(0:0..15): INTEGER, -- position of lower left corner
yBottom(1:0..15): INTEGER,
xWidth(2:0..15): INTEGER, -- size of image area on page
yHeight(3:0..15): INTEGER
];
byteSizePlacementPart: NAT ~ SIZE[PlacementPart]*Basics.bytesPerWord;
PhotometryPart: TYPE ~ MACHINE DEPENDENT RECORD[
signal(0:0..15): SignalType ← bw, -- what type of signal is sampled
sense(1:0..15): CARDINAL ← 0, -- larger sample values are lighter if sense=0, else darker
scale(2:0..15): ScaleType ← nil, -- specifies the conversion between physical and sample values
scaleA(3:0..31), scaleB(5:0..31), scaleC(7:0..31): Value ← [0, 0],
spotType(9:0..15): SpotType ← nil, -- spot type
spotWidth(10:0..15): CARDINAL ← nil, -- in units of 100*(width in pixels)
spotLength(11:0..15): CARDINAL ← nil, -- in units of 100*(length in scanlines)
sampleMin(12:0..15): INTEGER ← -1, -- sample range, if known
sampleMax(13:0..15): INTEGER ← -1,
histogramLength(14:0..15): CARDINAL ← 0 -- number of words in histogram, nil if no histogram
];
byteSizePhotometryPart: NAT ~ SIZE[PhotometryPart]*Basics.bytesPerWord;
SignalType: TYPE ~ MACHINE DEPENDENT {
bw(0), -- black and white
red(1), -- red separation
blue(2), -- blue separation
green(3), -- green separation
cyan(4), -- cyan separation
magenta(5), -- magenta separation
yellow(6), -- yellow separation
x(7), -- x signal (CIE)
y(8), -- y signal
RGB(100), -- red, green, blue samples, 3 per pixel
CMY(101), -- cyan, magenta, yellow samples, 3 per pixel
CMYB(102), -- cyan, magenta, yellow, black samples, 4 per pixel
Yxy(103), -- Y, x, y (CIE) samples, 3 per pixel
comments(177776B), -- specified in comments
undefined(177777B) -- undefined
};
ScaleType: TYPE ~ MACHINE DEPENDENT {
nil(0), -- undefined
reflectance(1), -- reflectance or transmittance
density(2), -- optical density
comments(177776B), -- specified in comments
undefined(177777B) -- undefined
};
Value: TYPE ~ MACHINE DEPENDENT RECORD[
sample(0:0..15): INTEGER, -- 1000*(actual reflectance or density)
level(1:0..15): CARDINAL -- corresponding digital sample value
];
SpotType: TYPE ~ MACHINE DEPENDENT {
nil(0), -- undefined
rectangular(1), -- spotWidth by spotLength
circular(2), -- diameter=spotWidth, spotLength is undefined
comments(177776B), -- specified in comments
undefined(177777B) -- undefined
};
histogramScale: INTEGER ~ 32767;
CommentPart: TYPE ~ BCPLStringBody;
byteSizeCommentPart: NAT ~ SIZE[CommentPart]*Basics.bytesPerWord; -- maximum
BCPLStringBody: TYPE ~ PACKED ARRAY[0..256) OF CHAR;
If s is a POINTER TO BCPLStringBody, length is ORD[s[0]], text is s[1..length]
END.