unit VDigitizerM;

{VDigitizerManager.p}

{This module is the top-level module for the Video Digitizer Manager (VDM).}
{This module is compiled into a VDM library that is linkable into multiple}
{applications that support the Video Digitizer Specification as proposed}
{by MicroFrontier and extended by Perceptics.}

{Copyright 1990, Perceptics Corporation}

{History:}

{	July 3, 1990  -  Module created.  }


{$SETC debuggingVDEF = FALSE}

interface

	uses
		QuickDraw, OSUtils, Resources, Memory, VDigitizerDefs;

	const
		MaxVDigitizers = 6;


	var
		VDigitizerList: VDHandle;
		ActvVDigitizer: VDHandle;


{ Initialization and selection routines:  }

	procedure InitVDigitizers;
	function GetFirstVDigitizer: VDHandle;
	function GetNextVDigitizer: VDHandle;
	function GetNthVDigitizer (whichDigitizer: Integer): VDHandle;
	function GetActiveVDigitizer: VDHandle;
	function SetFirstVDigitizer: OSErr;
	function SetNextVDigitizer: OSErr;
	function SetNthVDigitizer (whichDigitizer: Integer): OSErr;
	function SetVDigitizer (theDigitizer: VDHandle): OSErr;
	function GetVDigitizerID (var theID: Integer): OSErr;
	function GetVDigitizerSlot (var theSlot: Integer): OSErr;
	function GetVDigitizerMake (var theMake: Str255): OSErr;
	function GetVDigitizerModel (var theModel: Str255): OSErr;
	function GetVDigitizerModelNumber (var theModelNumber: Str255): OSErr;
	function GetVDigitizerDescription (var description: Str255): OSErr;
	function ResetVDigitizer: OSErr;

{ Digitizer modal fields and feature determination routines: }

	function GetVDigitizerNumModes (var numModes: Integer): OSErr;
	function GetVDigitizerModeInfo (modeInfo: VDMInfoPtr; theMode: Integer): OSErr;
	function GetVDigitizerModeName (theMode: Integer; var modeName: Str255): OSErr;
	function TestVDigitizerFeature (modeInfo: VDMInfoPtr; featureID: LongInt; var featurePresent: BOOLEAN): OSErr;
	function TestVDigitizerControl (modeInfo: VDMInfoPtr; controlID: LongInt; var isControllable: BOOLEAN): OSErr;
	function TestVDigitizerFunction (modeInfo: VDMInfoPtr; functionID: LongInt; var doesFunction: BOOLEAN): OSErr;
	function GetVDigitizerNumChannels (modeInfo: VDMInfoPtr; var numChannels: Integer): OSErr;
	function GetVDigitizerBitsPerChannel (modeInfo: VDMInfoPtr; var bitsPerChannel: Integer): OSErr;
	function GetVDigitizerNumInLUTs (modeInfo: VDMInfoPtr; var numInLUTs: Integer): OSErr;
	function GetVDigitizerInLUTSize (modeInfo: VDMInfoPtr; whichLUT: Integer; var inLUTSize: Integer): OSErr;
	function GetVDigitizerNumOutLUTs (modeInfo: VDMInfoPtr; var numOutLUTs: Integer): OSErr;
	function GetVDigitizerOutLUTSize (modeInfo: VDMInfoPtr; whichLUT: Integer; var outLUTSize: Integer): OSErr;
	function GetVDigitizerNumBuffers (modeInfo: VDMInfoPtr; var numBuffers: Integer): OSErr;
	function GetVDigitizerVideoSize (modeInfo: VDMInfoPtr; var videoImage: Point): OSErr;
	function GetVDigitizerFBSize (modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBSize: Point): OSErr;
	function GetVDigitizerFBType (modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBType: Integer): OSErr;
	function GetVDigitizerFBDepth (modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBDepth: Integer): OSErr;
	function GetVDigitizerFBBaseAddr (modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBBaseAddr: LongInt): OSErr;
	function GetVDigitizerFBRowBytes (modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBRowBytes: Integer): OSErr;
	function GetVDigitizerDisplaySize (modeInfo: VDMInfoPtr; var displaySize: Point): OSErr;

{ Digitizer setup routines: }

	function GetVDigitizerMode (var theMode: Integer): OSErr;
	function SetVDigitizerMode (newMode: Integer): OSErr;
	function GetVDigitizerSrc (var source: Integer): OSErr;
	function SetVDigitizerSrc (source: Integer): OSErr;
	function GetVDigitizerInLUT (var LUT: Integer): OSErr;
	function SetVDigitizerInLUT (LUT: Integer): OSErr;
	function ReadVDigitizerInLUT (LUT: Integer; var LUTType: Integer; var LUTHandle: Handle): OSErr;
	function WriteVDigitizerInLUT (LUT: Integer; LUTType: Integer; LUTHandle: Handle): OSErr;
	function GetVDigitizerOutLUT (var LUT: Integer): OSErr;
	function SetVDigitizerOutLUT (LUT: Integer): OSErr;
	function ReadVDigitizerOutLUT (LUT: Integer; var LUTType: Integer; var LUTHandle: Handle): OSErr;
	function WriteVDigitizerOutLUT (LUT: Integer; LUTType: Integer; LUTHandle: Handle): OSErr;
	function GetVDigitizerFrameBuffer (var theBuffer: Integer): OSErr;
	function SetVDigitizerFrameBuffer (whichBuffer: Integer): OSErr;
	function GetVDigitizerTimeOut (var timeOut: Integer): OSErr;
	function SetVDigitizerTimeOut (timeOut: Integer): OSErr;
	function GetVDigitizerModalParams (MPListHdl: VDMPListHdl): OSErr;
	function SetVDigitizerModalParams (MPListHdl: VDMPListHdl): OSErr;
	function GetVDigitizerGainMinMax (var minGain, maxGain: Real): OSErr;
	function GetVDigitizerGain (var gain: Real): OSErr;
	function SetVDigitizerGain (gain: Real): OSErr;
	function GetVDigitizerOffsetMinMax (var minOffset, maxOffset: Real): OSErr;
	function GetVDigitizerOffset (var offset: Real): OSErr;
	function SetVDigitizerOffset (offset: Real): OSErr;
	function GetVDigitizerControlBits (var controlBits: LongInt): OSErr;
	function SetVDigitizerControlBits (controlBits: LongInt): OSErr;

{ Digitizer capture and display routines:  }

	function CaptureVDigitizerFrames (var frames: Integer; operation: Integer; trigger: Integer; referencePM: PixMapHandle; params: Ptr; captureRect: Rect; offscreenPM: PixMapHandle; offscreenRect: Rect; theWindow: WindowPtr; displayRect: Rect): OSErr;
	function TaskVDigitizers: OSErr;
	function WaitVDigitizerCaptureDone: OSErr;
	function IsVDigitizerCapture: BOOLEAN;
	function AdjustVDigitizerWindow (theWindow: WindowPtr; captureRect: Rect): OSErr;
	function AdjustVDigitizerDisplayRect (theWindow: WindowPtr; var displayRect: Rect): OSErr;
	function AdjustVDigitizerGrabRect (var captureRect: Rect): OSErr;
	function ReadVDigitizerFrameCount (var NumFrames, NumTicks: LongInt): OSErr;
	function ReadVDigitizerFrmeBuf (buffer: Integer; firstRow, firstCol: Integer; var dstMap: PixMapHandle; dstRect: RectPtr): OSErr;
	function WriteVDigitizerFrmeBuf (buffer: Integer; firstRow, firstCol: Integer; srcMap: PixMapHandle; dstRect: RectPtr): OSErr;

{ Custom Function support routines:  }

	function GetVDigitizerNumCustomFcns (modeInfo: VDMInfoPtr; var numCustomFcns: INTEGER): OSErr;
	function GetVDigitizerCustomFcnName (modeInfo: VDMInfoPtr; customFcn: Integer; var fcnName: Str255): OSErr;
	function DoVDigitizerCustomFunction (functionNumber: Integer): OSErr;

{ Miscellaneous routines:  }

	function PreserveVDigitizer (storage: Handle): OSErr;
	function RestoreVDigitizer (storage: Handle): OSErr;
	function ReadVDigitizerReg (register: Integer; var value: LongInt): OSErr;
	function WriteVDigitizerReg (register: Integer; value: LongInt): OSErr;
	function ReadVDigitizerMemBlk (srcPtr: Ptr; var dstPtr: Ptr; var count: LongInt; read, skip: Integer): OSErr;
	function WriteVDigitizerMemBlk (srcPtr, dstPtr: Ptr; var count: LongInt; write, skip: Integer): OSErr;
	function InstallVDigitizerInterrupts: OSErr;
	function RemoveVDigitizerInterrupts: OSErr;
	function GetVDigitizerHistogram (histRect: Rect; hSampling, vSampling: Integer; histogramArray: histArrayPtr): OSErr;

	{  Routines for AIA-standard camera selection and configuration:  }

	function SetVDigitizerCamera (cameraTypeCode: Integer): OSErr;
	function GetVDigitizerCamera (var cameraTypeCode: Integer): OSErr;
	function SetVDigitizerCameraSize (cameraSize: Point): OSErr;
	function GetVDigitizerCameraSize (var cameraSize: Point): OSErr;
	function SetVDigitizerCameraEdges (cameraEdges: Rect): OSErr;
	function GetVDigitizerCameraEdges (var cameraEdges: Rect): OSErr;
	function SetVDigitizerCameraName (cameraName: Str31): OSErr;
	function GetVDigitizerCameraName (var cameraName: Str31): OSErr;
	function SetVDigitizerCameraLineTime (lineTime: Longint): OSErr;
	function GetVDigitizerCameraLineTime (var lineTime: Longint): OSErr;
	function SetVDigitizerCameraPixelInfo (depth, offset, bitsToShift: Integer): OSErr;
	function GetVDigitizerCameraPixelInfo (var depth, offset, bitsToShift: Integer): OSErr;
	function SetVDigitizerCameraSpecialInfo (specialInfo: Longint): OSErr;
	function GetVDigitizerCameraSpecialInfo (var specialInfo: Longint): OSErr;

implementation


{    function MyVDEFEntry (theDigitizer: VDHandle; message: Integer; vdParamsPtr: ptr): OSErr;}
{    external;}
	function CallMyVDEF (theDigitizer: VDHandle; message: Integer; vdParamsPtr: ptr; VDEFEntryAddr: Ptr): OSErr;
	external;


{}
	procedure InitVDigitizers;
		var
			i, l: Integer;
			status: OSErr;
			vdParamsPtr: ptr;
			boardsForVDEF: Integer;
			PrevVDigitizer: VDHandle;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
	{ Find all VDEF resources in the application's resource file. }
		VDigitizerList := nil;
		PrevVDigitizer := nil;
		for i := 1 to MaxVDigitizers do begin
{$IFC debuggingVDEF = FALSE}
{$IFC PowerPC}
				VDEFHandle := GetIndResource('VDEP', i);
{$ELSEC}
				VDEFHandle := GetIndResource('VDEF', i);
{$ENDC}
{$ELSEC}
				if i = 1 then
					VDEFHandle := @MyVDEFEntry
				else
					VDEFHandle := nil;
{$ENDC}

				if (VDEFHandle <> nil) then begin
		{ For each VDEF resource found, init the VDEF and its VD structures. }
{$IFC debuggingVDEF = FALSE}
						LoadResource(VDEFHandle);
{$ENDC}
						boardsForVDEF := 0;
						repeat
							VDigHandle := VDHandle(NewHandle(Sizeof(VDRecord)));
							VDigHandle^^.vdID := 0;
							VDigHandle^^.vdSlot := 0;
							VDigHandle^^.vdNextDigitizer := nil;
							VDigHandle^^.vdPrevDigitizer := PrevVDigitizer;
							VDigHandle^^.vdOwner := nil;
							VDigHandle^^.vdCaptureRect.top := 0;
							VDigHandle^^.vdCaptureRect.left := 0;
							VDigHandle^^.vdCaptureRect.bottom := 0;
							VDigHandle^^.vdCaptureRect.right := 0;
							VDigHandle^^.vdDefProc := VDEFHandle;
							VDigHandle^^.vdData := nil;
							VDigHandle^^.vdMake := '';
							VDigHandle^^.vdModel := '';
							VDigHandle^^.vdModelNumber := '';
							VDigHandle^^.vdDescription := '';
							VDigHandle^^.vdNModes := 0;
							VDigHandle^^.vdModalFields := 0;
							VDigHandle^^.vdCurrentMode := 0;
							VDigHandle^^.vdCurrentInLUT := 0;
							VDigHandle^^.vdCurrentOutLUT := 0;
							VDigHandle^^.vdCurrentFB := 0;
							VDigHandle^^.vdReserved1 := 0;

							VDigHandle^^.vdModeInfo.vdFeatures := 0;
							VDigHandle^^.vdModeInfo.vdControls := 0;
							VDigHandle^^.vdModeInfo.vdFunctions := 0;
							VDigHandle^^.vdModeInfo.vdNCustomFcns := 0;
							for l := 1 to MaxCustomFcns do
								VDigHandle^^.vdModeInfo.vdCustomNames[l] := '';
							VDigHandle^^.vdModeInfo.vdNInputLUTs := 0;
							for l := 1 to MaxLUTs do
								VDigHandle^^.vdModeInfo.vdInputLUTSize[l] := 0;
							VDigHandle^^.vdModeInfo.vdNOutputLUTs := 0;
							for l := 1 to MaxLUTs do
								VDigHandle^^.vdModeInfo.vdOutputLUTSize[l] := 0;
							VDigHandle^^.vdModeInfo.vdChannels := 0;
							VDigHandle^^.vdModeInfo.vdBitsPerChannel := 0;
							VDigHandle^^.vdModeInfo.vdVideoSize.h := 0;
							VDigHandle^^.vdModeInfo.vdVideoSize.v := 0;
							VDigHandle^^.vdModeInfo.vdNFrameBuffers := 0;
							for l := 0 to 2 do begin
									VDigHandle^^.vdModeInfo.vdFBSize[l].h := 0;
									VDigHandle^^.vdModeInfo.vdFBSize[l].v := 0;
									VDigHandle^^.vdModeInfo.vdFBType[l] := 0;
									VDigHandle^^.vdModeInfo.vdFBDepth[l] := 0;
									VDigHandle^^.vdModeInfo.vdFBRowBytes[l] := 0;
								end;
							VDigHandle^^.vdModeInfo.vdDispWindowSize.h := 0;
							VDigHandle^^.vdModeInfo.vdDispWindowSize.v := 0;
							VDigHandle^^.vdModeInfo.vdReserved2 := 0;

			{ Invoke the VDefProc's Init function....}
							HLock(Handle(VDigHandle));
							vdParamsPtr := nil;
{$IFC debuggingVDEF = FALSE}
							HLock(Handle(VDEFHandle));
							VDEFEntryAddr := VDEFHandle^;
							status := CallMyVDEF(VDigHandle, vdInitStructures, vdParamsPtr, VDEFEntryAddr);
							HUnlock(Handle(VDEFHandle));
{$ELSEC}
							status := MyVDEFEntry(VDigHandle, vdInitStructures, vdParamsPtr);
{$ENDC}
							HUnlock(Handle(VDigHandle));

			{ If the VDEF Init was successful, add this digitizer to the list. }
							if status = noErr then begin
									if VDigitizerList = nil then
										VDigitizerList := VDigHandle;
									if PrevVDigitizer <> nil then
										PrevVDigitizer^^.vdNextDigitizer := VDigHandle;
									VDigHandle^^.vdPrevDigitizer := PrevVDigitizer;
									PrevVDigitizer := VDigHandle;
									boardsForVDEF := boardsForVDEF + 1;
								end;
						until status <> noErr;
						if boardsForVDEF < 1 then begin
								ReleaseResource(VDEFHandle);
								DisposeHandle(Handle(VDigHandle));
							end;

					end;
			end;
		ActvVDigitizer := VDigitizerList;
	end;

{}

	function GetFirstVDigitizer; { : VDHandle; }
	{ Returns a handle to the first VDRecord in the VDigitizerList. }
	begin
		GetFirstVDigitizer := VDigitizerList;
	end;

{}

	function GetNextVDigitizer; { : VDHandle; }
	{ Returns a handle to the next VDigitizer in the VDigitizerList. }
	begin
		GetNextVDigitizer := ActvVDigitizer^^.vdNextDigitizer;
	end;

{}

	function GetNthVDigitizer; { (whichDigitizer: Integer): VDHandle; }
	{ Returns a handle to the N-th VDigitizer in the VDigitizerList. }
		var
			i: Integer;
			theDigitizer: VDHandle;
	begin
		if whichDigitizer = 0 then begin
				GetNthVDigitizer := VDigitizerList;
				exit(GetNthVDigitizer);
			end
		else begin
				theDigitizer := VDigitizerList;
				for i := 1 to whichDigitizer do
					if theDigitizer <> nil then
						theDigitizer := theDigitizer^^.vdNextDigitizer;
				GetNthVDigitizer := theDigitizer;
				exit(GetNthVDigitizer);
			end;
	end;

{}

	function GetActiveVDigitizer; { : VDHandle; }
	{ Returns the VDHandle for the currently-selected digitizer. }
	begin
		GetActiveVDigitizer := ActvVDigitizer;
	end;

{}

	function SetFirstVDigitizer; { : OSErr; }
	{ Sets the first VDigitizer in the list to be the current VDigitizer. }
	begin
		if VDigitizerList <> nil then begin
				ActvVDigitizer := VDigitizerList;
				SetFirstVDigitizer := noErr;
				exit(SetFirstVDigitizer);
			end
		else
			SetFirstVDigitizer := vdNotFound;
	end;

{}

	function SetNextVDigitizer; { : OSErr; }
	{ Sets the next VDigitizer in the list to be the current VDigitizer. }
		var
			nextDigitizer: VDHandle;
	begin
		nextDigitizer := ActvVDigitizer^^.vdNextDigitizer;
		if nextDigitizer <> nil then begin
				ActvVDigitizer := nextDigitizer;
				SetNextVDigitizer := noErr;
				exit(SetNextVDigitizer);
			end
		else
			SetNextVDigitizer := vdNotFound;
	end;

{}

	function SetNthVDigitizer; { (whichDigitizer: Integer): OSErr; }
	{ Sets the N-th VDigitizer in the list to be the current VDigitizer. }
		var
			i: Integer;
			nextDigitizer: VDHandle;
	begin
		if whichDigitizer = 0 then begin
				ActvVDigitizer := VDigitizerList;
				SetNthVDigitizer := noErr;
				exit(SetNthVDigitizer);
			end
		else begin
				nextDigitizer := VDigitizerList;
				for i := 1 to whichDigitizer do
					if nextDigitizer <> nil then
						nextDigitizer := nextDigitizer^^.vdNextDigitizer;
				if nextDigitizer <> nil then begin
						nextDigitizer := nextDigitizer^^.vdNextDigitizer;
						ActvVDigitizer := nextDigitizer;
						SetNthVDigitizer := noErr;
						exit(SetNthVDigitizer);
					end
				else
					SetNthVDigitizer := vdNotFound;
			end;
	end;

{}

	function SetVDigitizer; { (theDigitizer: VDHandle): OSErr; }
	{ Sets the specified VDigitizer to be the current VDigitizer. }
		var
			i: Integer;
			nextDigitizer: VDHandle;
	begin
		nextDigitizer := VDigitizerList;
		for i := 1 to MaxVDigitizers do
			if nextDigitizer = theDigitizer then begin
					ActvVDigitizer := theDigitizer;
					SetVDigitizer := noErr;
					exit(SetVDigitizer);
				end
			else
				nextDigitizer := nextDigitizer^^.vdNextDigitizer;
		SetVDigitizer := vdNotFound;
	end;

{}

	function GetVDigitizerID;  { (var theID: Integer): OSErr; }
	begin
		theID := ActvVDigitizer^^.vdID;
		GetVDigitizerID := noErr;
	end;

{}

	function GetVDigitizerSlot;  { (var theSlot: Integer): OSErr; }
	begin
		theSlot := ActvVDigitizer^^.vdSlot;
		GetVDigitizerSlot := noErr;
	end;

{}

	function GetVDigitizerMake; { (var theMake: Str255): OSErr; }
	begin
		theMake := ActvVDigitizer^^.vdMake;
		GetVDigitizerMake := noErr;
	end;

{}

	function GetVDigitizerModel; { (var theModel: Str255): OSErr; }
	begin
		theModel := ActvVDigitizer^^.vdModel;
		GetVDigitizerModel := noErr;
	end;

{}

	function GetVDigitizerModelNumber; { (var theModelNumber: Str255): OSErr; }
	begin
		theModelNumber := ActvVDigitizer^^.vdModelNumber;
		GetVDigitizerModelNumber := noErr;
	end;

{}

	function GetVDigitizerDescription; { (var description: Str255): OSErr; }
	begin
		description := ActvVDigitizer^^.vdDescription;
		GetVDigitizerDescription := noErr;
	end;

{}

	function ResetVDigitizer; { : OSErr; }
		var
			i: Integer;
			status: OSErr;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Reset function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := nil;
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdReset, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdReset, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		ResetVDigitizer := status;
	end;

{}

	function GetVDigitizerNumModes; { (var numModes: Integer): OSErr; }
	begin
		numModes := ActvVDigitizer^^.vdNModes;
		GetVDigitizerNumModes := noErr;
	end;

{}

	function GetVDigitizerModeName;  { (theMode: Integer; var modeName: Str255): OSErr;  }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: Ptr;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := theMode;
		vdParams.p2 := Ptr(@modeName);
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetModeName, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetModeName, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		GetVDigitizerModeName := status;
	end;

{}

	function GetVDigitizerModeInfo;  { (modeInfo: VDMInfoPtr; theMode: Integer): OSErr;  }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: VDMInfoPtr;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := theMode;
		vdParams.p2 := modeInfo;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetModeInfo, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetModeInfo, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		GetVDigitizerModeInfo := status;
	end;

{}

	function TestVDigitizerFeature; { (modeInfo: VDMInfoPtr; featureID: LongInt; var featurePresent: BOOLEAN): OSErr; }
	begin
		featurePresent := false;
		if modeInfo = nil then begin
				if BAND(ActvVDigitizer^^.vdModeInfo.vdFeatures, featureID) <> 0 then
					featurePresent := true;
			end
		else begin
				if BAND(modeInfo^.vdFeatures, featureID) <> 0 then
					featurePresent := true;
			end;
		TestVDigitizerFeature := noErr;
	end;

{}

	function TestVDigitizerControl; { (modeInfo: VDMInfoPtr; controlID: LongInt; var isControllable: BOOLEAN): OSErr; }
	begin
		isControllable := false;
		if modeInfo = nil then begin
				if BAND(ActvVDigitizer^^.vdModeInfo.vdControls, controlID) <> 0 then
					isControllable := true;
			end
		else begin
				if BAND(modeInfo^.vdControls, controlID) <> 0 then
					isControllable := true;
			end;
		TestVDigitizerControl := noErr;
	end;

{}

	function TestVDigitizerFunction; { (modeInfo: VDMInfoPtr; functionID: LongInt; var doesFunction: BOOLEAN): OSErr; }
	begin
		doesFunction := false;
		if modeInfo = nil then begin
				if BAND(ActvVDigitizer^^.vdModeInfo.vdFunctions, functionID) <> 0 then
					doesFunction := true;
			end
		else begin
				if BAND(modeInfo^.vdFunctions, functionID) <> 0 then
					doesFunction := true;
			end;
		TestVDigitizerFunction := noErr;
	end;

{}

	function GetVDigitizerNumChannels; { (modeInfo: VDMInfoPtr; var numChannels: Integer): OSErr; }
	begin
		if modeInfo = nil then
			numChannels := ActvVDigitizer^^.vdModeInfo.vdChannels
		else
			numChannels := modeInfo^.vdChannels;
		GetVDigitizerNumChannels := noErr;
	end;

{}

	function GetVDigitizerBitsPerChannel; { (modeInfo: VDMInfoPtr; var bitsPerChannel: Integer): OSErr; }
	begin
		if modeInfo = nil then
			bitsPerChannel := ActvVDigitizer^^.vdModeInfo.vdBitsPerChannel
		else
			bitsPerChannel := modeInfo^.vdBitsPerChannel;
		GetVDigitizerBitsPerChannel := noErr;
	end;

{}

	function GetVDigitizerNumInLUTs; { (modeInfo: VDMInfoPtr; var numInLUTs: Integer): OSErr; }
	begin
		if modeInfo = nil then
			numInLUTs := ActvVDigitizer^^.vdModeInfo.vdNInputLUTs
		else
			numInLUTs := modeInfo^.vdNInputLUTs;
		GetVDigitizerNumInLUTs := noErr;
	end;

{}

	function GetVDigitizerInLUTSize; { (modeInfo: VDMInfoPtr; whichLUT: Integer; var inLUTSize: Integer): OSErr; }
	begin
		if modeInfo = nil then
			inLUTSize := ActvVDigitizer^^.vdModeInfo.vdInputLUTSize[whichLUT - 1]
		else
			inLUTSize := modeInfo^.vdInputLUTSize[whichLUT - 1];
		GetVDigitizerInLUTSize := noErr;
	end;

{}

	function GetVDigitizerNumOutLUTs; { (modeInfo: VDMInfoPtr; var numOutLUTs: Integer): OSErr; }
	begin
		if modeInfo = nil then
			numOutLUTs := ActvVDigitizer^^.vdModeInfo.vdNOutputLUTs
		else
			numOutLUTs := modeInfo^.vdNOutputLUTs;
		GetVDigitizerNumOutLUTs := noErr;
	end;

{}

	function GetVDigitizerOutLUTSize; { (modeInfo: VDMInfoPtr; whichLUT: Integer; var outLUTSize: Integer): OSErr; }
	begin
		if modeInfo = nil then
			outLUTSize := ActvVDigitizer^^.vdModeInfo.vdOutputLUTSize[whichLUT - 1]
		else
			outLUTSize := modeInfo^.vdOutputLUTSize[whichLUT - 1];
		GetVDigitizerOutLUTSize := noErr;
	end;

{}

	function GetVDigitizerNumBuffers; { (modeInfo: VDMInfoPtr; var numBuffers: Integer): OSErr; }
	begin
		if modeInfo = nil then
			numBuffers := ActvVDigitizer^^.vdModeInfo.vdNFrameBuffers
		else
			numBuffers := modeInfo^.vdNFrameBuffers;
		GetVDigitizerNumBuffers := noErr;
	end;

{}

	function GetVDigitizerVideoSize; { (modeInfo: VDMInfoPtr; var videoImage: Point): OSErr; }
	begin
		if modeInfo = nil then begin
				videoImage.h := ActvVDigitizer^^.vdModeInfo.vdVideoSize.h;
				videoImage.v := ActvVDigitizer^^.vdModeInfo.vdVideoSize.v;
			end
		else begin
				videoImage.h := modeInfo^.vdVideoSize.h;
				videoImage.v := modeInfo^.vdVideoSize.v;
			end;
		GetVDigitizerVideoSize := noErr;
	end;

{}

	function GetVDigitizerFBSize; { (modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBSize: Point): OSErr; }
	begin
		if modeInfo = nil then begin
				FBSize.h := ActvVDigitizer^^.vdModeInfo.vdFBSize[whichBuffer - 1].h;
				FBSize.v := ActvVDigitizer^^.vdModeInfo.vdFBSize[whichBuffer - 1].v;
			end
		else begin
				FBSize.h := modeInfo^.vdFBSize[whichBuffer - 1].h;
				FBSize.v := modeInfo^.vdFBSize[whichBuffer - 1].v;
			end;
		GetVDigitizerFBSize := noErr;
	end;

	function GetVDigitizerFBType; { (modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBType: Integer): OSErr; }
	begin
		if modeInfo = nil then
			FBType := ActvVDigitizer^^.vdModeInfo.vdFBType[whichBuffer - 1]
		else
			FBType := modeInfo^.vdFBType[whichBuffer - 1];
		GetVDigitizerFBType := noErr;
	end;

	function GetVDigitizerFBDepth; {(modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBDepth: Integer): OSErr; }
	begin
		if modeInfo = nil then
			FBDepth := ActvVDigitizer^^.vdModeInfo.vdFBDepth[whichBuffer - 1]
		else
			FBDepth := modeInfo^.vdFBDepth[whichBuffer - 1];
		GetVDigitizerFBDepth := noErr;
	end;

	function GetVDigitizerFBBaseAddr; { (modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBBaseAddr: LongInt): OSErr; }
	begin
		if modeInfo = nil then
			FBBaseAddr := ActvVDigitizer^^.vdModeInfo.vdFBBaseAddr[whichBuffer - 1]
		else
			FBBaseAddr := modeInfo^.vdFBBaseAddr[whichBuffer - 1];
		GetVDigitizerFBBaseAddr := noErr;
	end;

	function GetVDigitizerFBRowBytes; { (modeInfo: VDMInfoPtr; whichBuffer: Integer; var FBRowBytes: Integer): OSErr; }
	begin
		if modeInfo = nil then
			FBRowBytes := ActvVDigitizer^^.vdModeInfo.vdFBRowBytes[whichBuffer - 1]
		else
			FBRowBytes := modeInfo^.vdFBRowBytes[whichBuffer - 1];
		GetVDigitizerFBRowBytes := noErr;
	end;

{}

	function GetVDigitizerDisplaySize; { (modeInfo: VDMInfoPtr; var displaySize: Point): OSErr; }
	begin
		if modeInfo = nil then begin
				displaySize.h := ActvVDigitizer^^.vdModeInfo.vdDispWindowSize.h;
				displaySize.v := ActvVDigitizer^^.vdModeInfo.vdDispWindowSize.v;
			end
		else begin
				displaySize.h := modeInfo^.vdDispWindowSize.h;
				displaySize.v := modeInfo^.vdDispWindowSize.v;
			end;
		GetVDigitizerDisplaySize := noErr;
	end;


{ Digitizer setup routines: }

	function GetVDigitizerMode; { (var theMode: Integer): OSErr; }
	begin
		theMode := ActvVDigitizer^^.vdCurrentMode;
		GetVDigitizerMode := noErr;
	end;

{}

	function SetVDigitizerMode;  { (newMode: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := newMode;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetMode, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetMode, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then
			VDigHandle^^.vdCurrentMode := newMode;
		SetVDigitizerMode := status;
	end;

{}

	function GetVDigitizerSrc; { (var source: Integer): OSErr; }
		var
			status: OSErr;
			vdParamsPtr: ptr;
			p1: Integer;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetSource, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetSource, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then
			source := p1;
		GetVDigitizerSrc := status;
	end;

{}

	function SetVDigitizerSrc; { (source: Integer): OSErr; }
		var
			status: OSErr;
			p1: Integer;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		p1 := source;
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetSource, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetSource, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		SetVDigitizerSrc := status;
	end;

{}

	function GetVDigitizerInLUT;  {(VAR LUT: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := 0;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetInputLUT, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetInputLUT, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		LUT := vdParams.p1;
		GetVDigitizerInLUT := status;
	end;

{}

	function SetVDigitizerInLUT;  { (LUT: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := LUT;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetInputLUT, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetInputLUT, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		SetVDigitizerInLUT := status;
	end;

{}

	function ReadVDigitizerInLUT; { (LUT: Integer; var LUTType: Integer;  var LUTHandle: Handle): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: Integer;
					p3: Handle;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := LUT;
		vdParams.p2 := LUTType;
		vdParams.p3 := LUTHandle;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdReadInputLUT, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdReadInputLUT, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		LUTType := vdParams.p2;
		LUTHandle := vdParams.p3;
		ReadVDigitizerInLUT := status;
	end;

{}

	function WriteVDigitizerInLUT; { (LUT: Integer; LUTType: Integer; LUTHandle: Handle): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: Integer;
					p3: Handle;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := LUT;
		vdParams.p2 := LUTType;
		vdParams.p3 := LUTHandle;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdWriteInputLUT, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdWriteInputLUT, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		WriteVDigitizerInLUT := status;
	end;

{}

	function GetVDigitizerOutLUT;  {(VAR LUT: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := 0;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetOutputLUT, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetOutputLUT, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		LUT := vdParams.p1;
		GetVDigitizerOutLUT := status;
	end;

{}

	function SetVDigitizerOutLUT;  { (LUT: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := LUT;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetOutputLUT, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetOutputLUT, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		SetVDigitizerOutLUT := status;
	end;

{}

	function ReadVDigitizerOutLUT; { (LUT: Integer; var LUTType: Integer;  var LUTHandle: Handle): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: Integer;
					p3: Handle;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := LUT;
		vdParams.p2 := LUTType;
		vdParams.p3 := LUTHandle;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdReadOutputLUT, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdReadOutputLUT, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		LUTType := vdParams.p2;
		LUTHandle := vdParams.p3;
		ReadVDigitizerOutLUT := status;
	end;

{}

	function WriteVDigitizerOutLUT; { (LUT: Integer; LUTType: Integer; LUTHandle: Handle): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: Integer;
					p3: Handle;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := LUT;
		vdParams.p2 := LUTType;
		vdParams.p3 := LUTHandle;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdWriteOutputLUT, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdWriteOutputLUT, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		WriteVDigitizerOutLUT := status;
	end;

{}

	function GetVDigitizerFrameBuffer; { (var theBuffer: Integer): OSErr; }
		var
			status: OSErr;
			p1: Integer;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetFrameBuffer, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetFrameBuffer, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then begin
				theBuffer := p1;
				ActvVDigitizer^^.vdCurrentFB := theBuffer;
			end;
		GetVDigitizerFrameBuffer := status;
	end;

{}

	function SetVDigitizerFrameBuffer;  { (whichBuffer:Integer) : OSErr; }
		var
			status: OSErr;
			p1: Integer;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		p1 := whichBuffer;
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetFrameBuffer, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetFrameBuffer, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then
			ActvVDigitizer^^.vdCurrentFB := whichBuffer;
		SetVDigitizerFrameBuffer := status;
	end;

{}

	function GetVDigitizerTimeOut; { (var timeout: LongInt): OSErr; }
		type
			vdParamsBlk = record
					p1: LongInt;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetTimeOut, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetTimeOut, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then
			timeout := vdParams.p1;
		GetVDigitizerTimeOut := status;
	end;

{}

	function SetVDigitizerTimeOut; { (timeout: LongInt): OSErr; }
		type
			vdParamsBlk = record
					p1: LongInt;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := timeout;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetTimeOut, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetTimeOut, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		SetVDigitizerTimeOut := status;
	end;

{}

	function GetVDigitizerModalParams; { (MPListHdl: VDMPListHdl): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: LongInt;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := 0;
		vdParams.p2 := LongInt(MPListHdl);
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetModalParams, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetModalParams, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		GetVDigitizerModalParams := status;
	end;

{}

	function SetVDigitizerModalParams; { (MPListHdl: VDMPListHdl): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: LongInt;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := 0;
		vdParams.p2 := LongInt(MPListHdl);
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetModalParams, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetModalParams, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		SetVDigitizerModalParams := status;
	end;

{}

	function GetVDigitizerGainMinMax; { (var minGain, maxGain: Real): OSErr; }
		type
			Params2Floats = packed record
					p1, p2: Real;
				end;
		var
			status: OSErr;
			vdParamsPtr: ptr;
			params: Params2Floats;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@params);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetGainMinMax, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetGainMinMax, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then begin
				minGain := params.p1;
				maxGain := params.p2;
			end;
		GetVDigitizerGainMinMax := status;
	end;

{}

	function GetVDigitizerGain; { (var gain: Real): OSErr; }
		var
			status: OSErr;
			vdParamsPtr: ptr;
			p1: Real;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetGain, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetGain, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then
			gain := p1;
		GetVDigitizerGain := status;
	end;

{}

	function SetVDigitizerGain; { (gain: Real): OSErr; }
		var
			status: OSErr;
			p1: Real;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		p1 := gain;
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetGain, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetGain, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		SetVDigitizerGain := status;
	end;


{}

	function GetVDigitizerOffsetMinMax; { (var minOffset, maxOffset: Real): OSErr; }
		type
			Params2Floats = packed record
					p1, p2: Real;
				end;
		var
			status: OSErr;
			vdParamsPtr: ptr;
			params: Params2Floats;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@params);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetOffsetMinMax, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetOffsetMinMax, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then begin
				minOffset := params.p1;
				maxOffset := params.p2;
			end;
		GetVDigitizerOffsetMinMax := status;
	end;

{}

	function GetVDigitizerOffset; { (var offset: Real): OSErr; }
		var
			status: OSErr;
			vdParamsPtr: ptr;
			p1: Real;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetOffset, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetOffset, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then
			offset := p1;
		GetVDigitizerOffset := status;
	end;

{}

	function SetVDigitizerOffset; { (offset: Real): OSErr; }
		var
			status: OSErr;
			p1: Real;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		p1 := offset;
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetOffset, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetOffset, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		SetVDigitizerOffset := status;
	end;

{}

	function GetVDigitizerControlBits; { (var controlBits: LongInt): OSErr; }
		var
			status: OSErr;
			vdParamsPtr: ptr;
			p1: LongInt;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetControlBits, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetControlBits, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		if status = noErr then
			controlBits := p1;
		GetVDigitizerControlBits := status;
	end;

{}

	function SetVDigitizerControlBits; { (controlBits: LongInt): OSErr; }
		var
			status: OSErr;
			p1: LongInt;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		p1 := controlBits;
		vdParamsPtr := ptr(@p1);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetControlBits, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetControlBits, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		SetVDigitizerControlBits := status;
	end;


{ Capture and display routines: }

	function CaptureVDigitizerFrames;  { (var frames: Integer; operation: Integer; trigger: Integer; }
													{  referencePM: PixMapHandle; params: Ptr; captureRect: Rect; }
													{  offscreenPM: PixMapHandle; offscreenRect: Rect; }
													{  theWindow: WindowPtr; displayRect: Rect): OSErr;  }
		type
			vdParamsBlk = record
					p1, p2, p3: Integer;
					p4: Ptr;
					p5, p6: PixMapHandle;
					p7, p8: RectPtr;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			i: Integer;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Capture function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		VDigHandle^^.vdOwner := theWindow;
		VDigHandle^^.vdCaptureRect := captureRect;
		vdParams.p1 := frames;
		vdParams.p2 := operation;
		vdParams.p3 := trigger;
		vdParams.p4 := params;
		vdParams.p5 := referencePM;
		vdParams.p6 := offscreenPM;
		vdParams.p7 := @offscreenRect;
		vdParams.p8 := @displayRect;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdCaptureFrames, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdCaptureFrames, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		CaptureVDigitizerFrames := status;
	end;

{}

	function TaskVDigitizers; { :OSErr; }
		var
			status: OSErr;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := nil;
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdTask, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdTask, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		TaskVDigitizers := status;
	end;

{}

	function WaitVDigitizerCaptureDone; { : OSErr; }
		var
			status: OSErr;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := nil;
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdWaitCaptureDone, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdWaitCaptureDone, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		WaitVDigitizerCaptureDone := status;
	end;

{}

	function IsVDigitizerCapture; { : Boolean; }
		type
			vdParamsBlk = record
					p1: Boolean;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdIsCapture, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdIsCapture, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		IsVDigitizerCapture := vdParams.p1;
	end;

{}

	function AdjustVDigitizerWindow; { (theWindow: WindowPtr; captureRect: Rect): OSErr; }
		var
			status: OSErr;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Adjust Window function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		VDigHandle^^.vdOwner := theWindow;
		VDigHandle^^.vdCaptureRect := captureRect;
		vdParamsPtr := nil;
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdAdjustWindow, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdAdjustWindow, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		AdjustVDigitizerWindow := status;
	end;

{}

	function AdjustVDigitizerDisplayRect; { (theWindow: WindowPtr; var displayRect: Rect): OSErr; }
		type
			vdParamsBlk = record
					p1: Rect;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Adjust Window function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		VDigHandle^^.vdOwner := theWindow;
		vdParams.p1 := displayRect;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdAdjustDisplayRect, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdAdjustDisplayRect, vdParamsPtr);
{$ENDC}
		displayRect := vdParams.p1;
		HUnlock(Handle(VDigHandle));
		AdjustVDigitizerDisplayRect := status;
	end;


	function AdjustVDigitizerGrabRect; { (var captureRect: Rect): OSErr; }
		var
			status: OSErr;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Adjust Grab Rect function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		VDigHandle^^.vdCaptureRect := captureRect;
		vdParamsPtr := nil;
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdAdjustGrabRect, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdAdjustGrabRect, vdParamsPtr);
{$ENDC}
		captureRect := VDigHandle^^.vdCaptureRect;
		HUnlock(Handle(VDigHandle));
		AdjustVDigitizerGrabRect := status;
	end;

{}

	function ReadVDigitizerFrameCount;  { (var NumFrames, NumTicks: LongInt): OSErr; }
		type
			vdParamsBlk = record
					p1, p2: LongInt;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Read Frame Counter function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdReadFrameCounter, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdReadFrameCounter, vdParamsPtr);
{$ENDC}
		NumFrames := vdParams.p1;
		NumTicks := vdParams.p2;
		HUnlock(Handle(VDigHandle));
		ReadVDigitizerFrameCount := status;
	end;

{}

	function ReadVDigitizerFrmeBuf; { (buffer: Integer; }
							{firstRow,firstCol:Integer;}
							{dstMap: PixMapHandle; dstRect:RectPtr): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: Integer;
					p3: Integer;
					p4: PixMapHandle;
					p5: RectPtr;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := buffer;
		vdParams.p2 := firstRow;
		vdParams.p3 := firstCol;
		vdParams.p4 := dstMap;
		vdParams.p5 := dstRect;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdReadFrameBuffer, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdReadFrameBuffer, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		ReadVDigitizerFrmeBuf := status;
	end;

{}

	function WriteVDigitizerFrmeBuf; { (buffer: Integer; }
							{firstRow,firstCol:Integer;}
							{srcMap: PixMapHandle; dstRect:RectPtr): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: Integer;
					p3: Integer;
					p4: PixMapHandle;
					p5: RectPtr;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := buffer;
		vdParams.p2 := firstRow;
		vdParams.p3 := firstCol;
		vdParams.p4 := srcMap;
		vdParams.p5 := dstRect;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdWriteFrameBuffer, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdWriteFrameBuffer, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		WriteVDigitizerFrmeBuf := status;
	end;


{ Custom function support routines: }

	function GetVDigitizerNumCustomFcns; { (modeInfo: VDMInfoPtr; var numCustomFcns: INTEGER): OSErr; }
	begin
		if modeInfo = nil then
			numCustomFcns := ActvVDigitizer^^.vdModeInfo.vdNCustomFcns
		else
			numCustomFcns := modeInfo^.vdNCustomFcns;
		GetVDigitizerNumCustomFcns := noErr;
	end;

{}

	function GetVDigitizerCustomFcnName; { (modeInfo: VDMInfoPtr; customFcn: Integer; var fcnName: Str255): OSErr; }
	begin
		if modeInfo = nil then
			fcnName := ActvVDigitizer^^.vdModeInfo.vdCustomNames[customFcn - 1]
		else
			fcnName := modeInfo^.vdCustomNames[customFcn - 1];
		GetVDigitizerCustomFcnName := noErr;
	end;

{}

	function DoVDigitizerCustomFunction; { (functionNumber: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Get Histogram function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := functionNumber;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdDoCustomFcn, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdDoCustomFcn, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		DoVDigitizerCustomFunction := status;
	end;


{ Miscellaneous routines: }

	function PreserveVDigitizer; { (storage: Handle): OSErr; }
		type
			vdParamsBlk = record
					p1: Handle;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			i: Integer;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Preserve function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := storage;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdPreserve, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdPreserve, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		PreserveVDigitizer := status;
	end;

{}

	function RestoreVDigitizer; { (storage: Handle): OSErr; }
		type
			vdParamsBlk = record
					p1: Handle;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			i: Integer;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Restore function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := storage;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdRestore, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdRestore, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		RestoreVDigitizer := status;
	end;

{}

	function ReadVDigitizerReg; { (register: Integer; var value: LongInt): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: LongInt;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := register;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdReadRegister, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdReadRegister, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		value := vdParams.p2;
		ReadVDigitizerReg := status;
	end;

{}

	function WriteVDigitizerReg; { (register: Integer; value: LongInt): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
					p2: LongInt;
					p3: LongInt;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := register;
		vdParams.p2 := value;
		vdParams.p3 := $FFFFFFFF;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdWriteRegister, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdWriteRegister, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));

		WriteVDigitizerReg := status;
	end;

{}

	function ReadVDigitizerMemBlk; { (srcPtr: Ptr; var dstPtr: Ptr; }
				{ var count: LongInt; read, skip: Integer): OSErr; }
	begin
		ReadVDigitizerMemBlk := vdNotSupported;
	end;

{}

	function WriteVDigitizerMemBlk; { (srcPtr: Ptr; dstPtr: Ptr; }
  				{ var count: LongInt; write, skip: Integer): OSErr; }
	begin
		WriteVDigitizerMemBlk := vdNotSupported;
	end;

{}

	function InstallVDigitizerInterrupts; { (theDigitizer: VDHandle): OSErr; }
	begin
		InstallVDigitizerInterrupts := vdNotSupported;
	end;

{}

	function RemoveVDigitizerInterrupts; { (theDigitizer: VDHandle): OSErr; }
	begin
		RemoveVDigitizerInterrupts := vdNotSupported;
	end;

{}

	function GetVDigitizerHistogram; { (histRect: Rect; hSampling, vSampling: Integer; histogramArray: ptr): OSErr; }
		type
			vdParamsBlk = record
					p1, p2: Integer;
					p3: histArrayPtr;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's Get Histogram function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := hSampling;
		vdParams.p2 := vSampling;
		vdParams.p3 := histogramArray;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetHistogram, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetHistogram, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		GetVDigitizerHistogram := status;
	end;

{}

	function SetVDigitizerCamera; { (cameraTypeCode: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's SetVDigitizerCamera function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := cameraTypeCode;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetCameraType, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetCameraType, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		SetVDigitizerCamera := status;
	end;

{}

	function GetVDigitizerCamera; { (var cameraTypeCode: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's GetVDigitizerCamera function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetCameraType, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetCameraType, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		cameraTypeCode := vdParams.p1;
		GetVDigitizerCamera := status;
	end;

{}

	function SetVDigitizerCameraSize; {  (cameraSize: Point): OSErr; }
		type
			vdParamsBlk = record
					p1, p2: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's SetVDigitizerCameraSize function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := cameraSize.h;
		vdParams.p2 := cameraSize.v;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetCameraSize, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetCameraSize, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		SetVDigitizerCameraSize := status;
	end;

{}

	function GetVDigitizerCameraSize; { (var cameraSize: Point): OSErr; }
		type
			vdParamsBlk = record
					p1, p2: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's GetVDigitizerCameraSize function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetCameraSize, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetCameraSize, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		cameraSize.h := vdParams.p1;
		cameraSize.v := vdParams.p2;
		GetVDigitizerCameraSize := status;
	end;

{}

	function SetVDigitizerCameraEdges; {   (cameraEdges: Rect): OSErr; }
		type
			vdParamsBlk = record
					p1, p2, p3, p4: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's SetVDigitizerCameraEdges function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := cameraEdges.top;
		vdParams.p2 := cameraEdges.left;
		vdParams.p3 := cameraEdges.bottom;
		vdParams.p4 := cameraEdges.right;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetCameraEdges, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetCameraEdges, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		SetVDigitizerCameraEdges := status;
	end;

{}

	function GetVDigitizerCameraEdges; { (var cameraEdges: Rect): OSErr; }
		type
			vdParamsBlk = record
					p1, p2, p3, p4: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's GetVDigitizerCameraEdges function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetCameraEdges, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetCameraEdges, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		cameraEdges.top := vdParams.p1;
		cameraEdges.left := vdParams.p2;
		cameraEdges.bottom := vdParams.p3;
		cameraEdges.right := vdParams.p4;
		GetVDigitizerCameraEdges := status;
	end;

{}

	function SetVDigitizerCameraName; {   (cameraName: Str31): OSErr; }
		type
			vdParamsBlk = record
					p1: Ptr;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's SetVDigitizerCameraName function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := ptr(@cameraName);
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetCameraName, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetCameraName, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		SetVDigitizerCameraName := status;
	end;

{}

	function GetVDigitizerCameraName; { (var cameraName: Str31): OSErr; }
		type
			vdParamsBlk = record
					p1: Ptr;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's GetVDigitizerCameraName function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := ptr(@cameraName);
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetCameraName, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetCameraName, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		GetVDigitizerCameraName := status;
	end;

{}

	function SetVDigitizerCameraLineTime; {   (lineTime: Longint): OSErr; }
		type
			vdParamsBlk = record
					p1: longint;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's SetVDigitizerCameraLineTime function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := lineTime;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetCameraLineTime, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetCameraLineTime, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		SetVDigitizerCameraLineTime := status;
	end;

{}

	function GetVDigitizerCameraLineTime; { (var lineTime: Longint): OSErr; }
		type
			vdParamsBlk = record
					p1: Longint;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's GetVDigitizerCameraLineTime function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetCameraLineTime, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetCameraLineTime, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		lineTime := vdParams.p1;
		GetVDigitizerCameraLineTime := status;
	end;

{}

	function SetVDigitizerCameraPixelInfo; {   (depth, offset, bitsToShift: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1, p2, p3: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's SetVDigitizerCameraPixelInfo function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := depth;
		vdParams.p2 := offset;
		vdParams.p3 := bitsToShift;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetCameraPixelInfo, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetCameraPixelInfo, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		SetVDigitizerCameraPixelInfo := status;
	end;

{}

	function GetVDigitizerCameraPixelInfo; { (var depth, offset, bitsToShift: Integer): OSErr; }
		type
			vdParamsBlk = record
					p1, p2, p3: Integer;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's GetVDigitizerCameraPixelInfo function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetCameraPixelInfo, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetCameraPixelInfo, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		depth := vdParams.p1;
		offset := vdParams.p2;
		bitsToShift := vdParams.p3;
		GetVDigitizerCameraPixelInfo := status;
	end;

{}

	function SetVDigitizerCameraSpecialInfo; {   (specialInfo: Longint): OSErr; }
		type
			vdParamsBlk = record
					p1: Longint;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's SetVDigitizerCameraSpecialInfo function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParams.p1 := specialInfo;
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdSetCameraSpecialInfo, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdSetCameraSpecialInfo, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		SetVDigitizerCameraSpecialInfo := status;
	end;

{}

	function GetVDigitizerCameraSpecialInfo; { (var specialInfo: Longint): OSErr; }
		type
			vdParamsBlk = record
					p1: Longint;
				end;
		var
			status: OSErr;
			vdParams: vdParamsBlk;
			vdParamsPtr: ptr;
			VDigHandle: VDHandle;
			VDEFHandle: Handle;
			VDEFEntryAddr: Ptr;
	begin
		{ Invoke the VDefProc's GetVDigitizerCameraSpecialInfo function....}
		VDigHandle := ActvVDigitizer;
		HLock(Handle(VDigHandle));
		vdParamsPtr := ptr(@vdParams);
{$IFC debuggingVDEF = FALSE}
		VDEFHandle := VDigHandle^^.vdDefProc;
		HLock(Handle(VDEFHandle));
		VDEFEntryAddr := VDEFHandle^;
		status := CallMyVDEF(VDigHandle, vdGetCameraSpecialInfo, vdParamsPtr, VDEFEntryAddr);
		HUnlock(Handle(VDEFHandle));
{$ELSEC}
		status := MyVDEFEntry(VDigHandle, vdGetCameraSpecialInfo, vdParamsPtr);
{$ENDC}
		HUnlock(Handle(VDigHandle));
		specialInfo := vdParams.p1;
		GetVDigitizerCameraSpecialInfo := status;
	end;


end.