chao@polya.Stanford.EDU (Chih-Chao Lam) (12/27/88)
I am having some difficulty getting the Apple Scanner to work in gray
scale mode and would greatly appreciate any help.
I get an scParamErr when I call ScSetScanArea after setting the scanArea
to a 'grayscale type' scanArea and I can't understand why. I use the
following code to initialize the scanArea :
function SetupScanner: OSErr;
var
anErr: OSErr;
bestRes: Integer;
myStdFeatures: ScStdFeaturesRec;
myScanAreas: ScScanAreaRec;
fullPageArea: ScAreaRec;
begin
anErr := ScOpen(scannerRef);
if anErr = noErr then begin {Fill in the standard features record.}
anErr := ScGetStdFeatures(scannerRef, @myStdFeatures,
SizeOf(ScStdFeaturesRec));
if anErr = noErr then begin
with fullPageArea do begin
xDpi := 75;
yDpi := 75;
SetRect(aRect, 0, 0, 200, 200);
scanRect := aRect;
contrast := 0; {And default contrast}
composition := scGrayScale;
bitsPerPixel := $F0;
end;
with myScanAreas do begin
numAreas := 1;
scanAreas[1] := fullPageArea;
end;
anErr := ScSetScanArea(scannerRef, @myScanAreas);
end; {No error getting std features}
end; {No error on ScOpen}
SetupScanner := anErr;
writeln('the error is:',anErr);{Return any error.}
end;
Am I doing anything stupid that I'm not aware of?
Thanks in advance,
Chih-Chao Lam
lam@sumex-aim.stanford.edu
Knowledge System Laboratory
Stanford University