DIRECTORY
ImagerPixelMap USING [PixelMap],
PDFileReader USING [Handle, WhatChanged],
ViewerClasses USING [Viewer];
PDPageReader:
CEDAR
DEFINITIONS =
BEGIN
Handle: TYPE=REF Rep;
Rep:
TYPE=
RECORD [
pixelMap: ImagerPixelMap.PixelMap
];
PageRecRef: TYPE=REF PageRec;
PageRec:
TYPE=
RECORD [
link: PageRecRef, --NIL => end of list
type: PDFileReader.WhatChanged, --imageStart or loadChange
pageNumber: INT, -- -1 if loadChange
index: INT --index in PD file of the startImage or storeLoad command
];
PaintActionProc:
TYPE =
PROC [self: ViewerClasses.Viewer, whatChanged:
REF
ANY];
InterpretPage:
PROC [handle: PDFileReader.Handle, viewer: ViewerClasses.Viewer, pages: PageRecRef, paintAction: PaintActionProc]
RETURNS [ok:
BOOLEAN];
Interprets one page (may be multiple passes), and ships it out.
May raise PDFileReader.Warning or PDFileReader.Error or PDReaderOutput.Error or PDReaderOutput.Abort
Returns FALSE upon document end.
GetPageStructure:
PROCEDURE [handle: PDFileReader.Handle]
RETURNS [PageRecRef,
INT];
assumes filestream is available from Handle and Gets can be executed safely
scans the PD file and returns a linked list of records which contain the indexes
in the file of imageStart or loadChange commands. Allows a client to skip thru the file
to a particular page, building the load for that page as needed. The total number of pages is also returned.
ResetToPage:
PROCEDURE [pdData:
REF
ANY]
RETURNS [PageRecRef];
pdData MUST BE a Preview.PDData
a DUMB routine to reconstruct the load for the given page "pageNumber".
requires that a page structure has already been built using GetPageStructure
and passed in as parameter "pages". Returns a PageRecRef for the page that has been
successfully reset to. Returns NIL if pageNumber is not in the pages list.