Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
DirectSetEntries.c
#include <Resources.h> |
#include <Memory.h> |
#include <Video.h> |
#include <Quickdraw.h> |
#include <Files.h> |
#include <Devices.h> |
#define TRUE 0xFF |
#define FALSE 0 |
struct myVDEntryRecord { |
CSpecArray *csTable; |
short csStart; |
short csCount; |
}; |
typedef struct myVDEntryRecord myVDEntryRecord; |
main() |
{ |
ColorSpec myTable[0xFF]; |
short i; |
OSErr result; |
myVDEntryRecord *VDPtr, **sickHack; |
GDHandle curdev, olddev; |
CntrlParam pRecord; |
VDPtr = (myVDEntryRecord *) NewPtr (sizeof (myVDEntryRecord)); |
if (VDPtr == nil || MemError() != noErr) |
Debugger(); |
olddev = GetGDevice(); |
curdev = GetDeviceList(); |
do { |
if ((**curdev).gdType == 2) { |
for (i=0;i<=0xFE;i++) { |
myTable[i].value = i; |
myTable[i].rgb.red = 0xffff - i*0xff; |
myTable[i].rgb.green = 0x0 + i*0xff; |
myTable[i].rgb.blue = 0x0 + i*0xff; |
} |
VDPtr->csTable = (CSpecArray *)&myTable; |
VDPtr->csStart = 0; |
VDPtr->csCount = 0xfe; |
pRecord.ioCompletion = nil; |
pRecord.ioVRefNum = 0; |
pRecord.ioCRefNum = (**curdev).gdRefNum; |
pRecord.csCode = 8; |
sickHack = (myVDEntryRecord **)&pRecord.csParam; |
*sickHack = VDPtr; |
if (result = PBControl((ParmBlkPtr)&pRecord, false) ) |
Debugger(); |
} |
curdev = GetNextDevice(curdev); |
} while (curdev != nil); |
SetGDevice(olddev); |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14