diff --git a/include/Mw/LowLevel.h b/include/Mw/LowLevel.h index db24282..56075ee 100644 --- a/include/Mw/LowLevel.h +++ b/include/Mw/LowLevel.h @@ -22,7 +22,8 @@ typedef void* MwLLPixmap; #ifdef _MILSKO #ifdef USE_X11 -#include +#undef USE_X11 +// #include #endif #ifdef USE_GDI #include diff --git a/src/backend/mac/mac.c b/src/backend/mac/mac.c new file mode 100644 index 0000000..b9a1d89 --- /dev/null +++ b/src/backend/mac/mac.c @@ -0,0 +1,77 @@ +#include "Mw/LowLevel.h" + +#include "mac.h" +#include "quickDraw.h" +#include + +MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) { + void* library; + MwLL r = malloc(sizeof(*r)); + MwLLCreateCommon(r); + + library = dlopen("CarbonLib", RTLD_NOW); + if(library != NULL) { + dlclose(library); + r->backend = getQuickDrawBackend(); + quickDrawBackendUserDataInit(r->userdata); + return r; + } + + printf("ERROR: No supported UI library found. (Searched for: CarbonLib)\n"); + getchar(); + raise(SIGTRAP); + + return NULL; +}; + +void MwLLSleep(int ms) { + usleep(ms * 1000); +} + +void MwLLFreeColor(MwLLColor color) { + free(color); +} + +void MwLLDestroyPixmap(MwLLPixmap pixmap) { + free(pixmap); +} + +void MwLLDestroy(MwLL handle) { + handle->backend.destroy(handle); +}; +void MwLLPolygon(MwLL handle, MwPoint* points, int points_count, MwLLColor color) { + handle->backend.polygon(handle, points, points_count, color); +}; +MwLLColor MwLLAllocColor(MwLL handle, int r, int g, int b) { + return handle->backend.allocColor(handle, r, g, b); +}; +void MwLLGetXYWH(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h) { + return handle->backend.getXYWH(handle, x, y, w, h); +}; +void MwLLSetXY(MwLL handle, int x, int y) { + return handle->backend.setXY(handle, x, y); +}; +void MwLLSetWH(MwLL handle, int w, int h) { + return handle->backend.setWH(handle, w, h); +}; +void MwLLSetTitle(MwLL handle, const char* title) { + return handle->backend.setTitle(handle, title); +}; +int MwLLPending(MwLL handle) { + return handle->backend.pending(handle); +}; +void MwLLNextEvent(MwLL handle) { + return handle->backend.nextEvent(handle); +}; +MwLLPixmap MwLLCreatePixmap(MwLL handle, unsigned char* data, int width, int height) { + return handle->backend.createPixmap(handle, data, width, height); +}; +void MwLLDrawPixmap(MwLL handle, MwRect* rect, MwLLPixmap pixmap) { + return handle->backend.drawPixmap(handle, rect, pixmap); +}; +void MwLLSetIcon(MwLL handle, MwLLPixmap pixmap) { + return handle->backend.setIcon(handle, pixmap); +}; +void MwLLForceRender(MwLL handle) { + return handle->backend.forceRender(handle); +}; diff --git a/src/backend/mac/mac.h b/src/backend/mac/mac.h new file mode 100644 index 0000000..975f6ee --- /dev/null +++ b/src/backend/mac/mac.h @@ -0,0 +1,45 @@ +/* $Id $ */ + +#ifndef __MAC_H__ +#define __MAC_H__ + +#include + +typedef enum { + PLATFORM_QUICKDRAW = 0, + PLATFORM_QUARTZ, +} macPlatform; + +typedef struct mac_backend_t { + MwLL (*create)(MwLL parent, int x, int y, int width, int height); + void (*destroy)(MwLL handle); + void (*polygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color); + MwLLColor (*allocColor)(MwLL handle, int r, int g, int b); + void (*freeColor)(MwLLColor color); + void (*getXYWH)(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h); + void (*setXY)(MwLL handle, int x, int y); + void (*setWH)(MwLL handle, int w, int h); + void (*setTitle)(MwLL handle, const char* title); + int (*pending)(MwLL handle); + void (*nextEvent)(MwLL handle); + MwLLPixmap (*createPixmap)(MwLL handle, unsigned char* data, int width, int height); + void (*drawPixmap)(MwLL handle, MwRect* rect, MwLLPixmap pixmap); + void (*setIcon)(MwLL handle, MwLLPixmap pixmap); + void (*forceRender)(MwLL handle); +} mac_backend; + +typedef struct mac_backend_userdata_t* mac_backend_userdata; + +struct _MwLL { + mac_backend backend; + mac_backend_userdata userdata; + + int copy_buffer; + + unsigned int width; + unsigned int height; + + MwLLHandler handler; +}; + +#endif diff --git a/src/backend/mac/preQuartz.h b/src/backend/mac/preQuartz.h new file mode 100644 index 0000000..7e42fda --- /dev/null +++ b/src/backend/mac/preQuartz.h @@ -0,0 +1,1523 @@ +/* $Id $ */ + +// This is a copy of a bunch of headers from Apple's old SDK with irrelvant things removed. +// The reason this exists is for compiling under modern XCode (which doesn't have these headers). +// As such, our only goal here is that the function pointers can be loaded under PowerPC Mac OS X. +// We don't care about things like compiling for 68k, MetroWorks, etc. +// For Older Mac targets, we will just use the actual headers. +// +// Copyright: © 1985-2001 by Apple Computer, Inc., all rights reserved + +#ifndef __PRE_QUARTZ__ +#define __PRE_QUARTZ__ + +typedef unsigned char UInt8; +typedef signed char SInt8; +typedef unsigned short UInt16; +typedef signed short SInt16; +typedef unsigned long UInt32; +typedef signed long SInt32; +#if TARGET_RT_BIG_ENDIAN +struct wide { + SInt32 hi; + UInt32 lo; +}; +typedef struct wide wide; +struct UnsignedWide { + UInt32 hi; + UInt32 lo; +}; +typedef struct UnsignedWide UnsignedWide; +#else +struct wide { + UInt32 lo; + SInt32 hi; +}; +typedef struct wide wide; +struct UnsignedWide { + UInt32 lo; + UInt32 hi; +}; +typedef struct UnsignedWide UnsignedWide; +#endif +#if TYPE_LONGLONG +typedef signed long long SInt64; +typedef unsigned long long UInt64; +#else +typedef wide SInt64; +typedef UnsignedWide UInt64; +#endif +typedef long Fixed; +typedef Fixed* FixedPtr; +typedef long Fract; +typedef Fract* FractPtr; +typedef unsigned long UnsignedFixed; +typedef UnsignedFixed* UnsignedFixedPtr; +typedef short ShortFixed; +typedef ShortFixed* ShortFixedPtr; +typedef float Float32; + +typedef struct Float32Point Float32Point; +typedef char* Ptr; +typedef Ptr* Handle; +typedef long Size; +typedef SInt16 OSErr; +typedef SInt32 OSStatus; +typedef void* LogicalAddress; +typedef const void* ConstLogicalAddress; +typedef void* PhysicalAddress; +typedef UInt8* BytePtr; +typedef UInt32 ByteCount; +typedef UInt32 ByteOffset; +typedef SInt32 Duration; +typedef UnsignedWide AbsoluteTime; +typedef UInt32 OptionBits; +typedef UInt32 ItemCount; +typedef UInt32 PBVersion; +typedef SInt16 ScriptCode; +typedef SInt16 LangCode; +typedef SInt16 RegionCode; +typedef unsigned long FourCharCode; +typedef FourCharCode OSType; +typedef FourCharCode ResType; +typedef OSType* OSTypePtr; +typedef ResType* ResTypePtr; +enum { + false = 0, + true = 1 +}; +typedef unsigned char Boolean; +typedef long (*PFN_ProcPtr)(); +typedef struct RoutineDescriptor* UniversalProcPtr; +typedef UInt32 UnicodeScalarValue; +typedef UInt32 UTF32Char; +typedef UInt16 UniChar; +typedef UInt16 UTF16Char; +typedef UInt8 UTF8Char; +typedef UniChar* UniCharPtr; +typedef UInt32 UniCharCount; +typedef UniCharCount* UniCharCountPtr; +typedef unsigned char Str255[256]; +typedef unsigned char Str63[64]; +typedef unsigned char Str32[33]; +typedef unsigned char Str31[32]; +typedef unsigned char Str27[28]; +typedef unsigned char Str15[16]; +typedef unsigned char Str32Field[34]; +typedef Str63 StrFileName; +typedef unsigned char* StringPtr; +typedef StringPtr* StringHandle; +typedef const unsigned char* ConstStringPtr; +typedef const unsigned char* ConstStr255Param; +typedef const unsigned char* ConstStr63Param; +typedef const unsigned char* ConstStr32Param; +typedef const unsigned char* ConstStr31Param; +typedef const unsigned char* ConstStr27Param; +typedef const unsigned char* ConstStr15Param; +typedef ConstStr63Param ConstStrFileNameParam; +struct Point { + short v; + short h; +}; +typedef struct Point Point; +typedef Point* PointPtr; +struct Rect { + short top; + short left; + short bottom; + short right; +}; +typedef struct Rect Rect; +typedef Rect* RectPtr; +typedef unsigned char Style; +typedef short StyleParameter; +typedef Style StyleField; +typedef UInt8 Byte; +typedef SInt8 SignedByte; + +enum { + kAppleManufacturer = 'appl', + kComponentResourceType = 'thng', + kComponentAliasResourceType = 'thga' +}; +enum { + kAnyComponentType = 0, + kAnyComponentSubType = 0, + kAnyComponentManufacturer = 0, + kAnyComponentFlagsMask = 0 +}; +enum { + cmpIsMissing = 1L << 29, + cmpWantsRegisterMessage = 1L << 31 +}; +enum { + kComponentOpenSelect = -1, + kComponentCloseSelect = -2, + kComponentCanDoSelect = -3, + kComponentVersionSelect = -4, + kComponentRegisterSelect = -5, + kComponentTargetSelect = -6, + kComponentUnregisterSelect = -7, + kComponentGetMPWorkFunctionSelect = -8, + kComponentExecuteWiredActionSelect = -9, + kComponentGetPublicResourceSelect = -10 +}; +enum { + componentDoAutoVersion = (1 << 0), + componentWantsUnregister = (1 << 1), + componentAutoVersionIncludeFlags = (1 << 2), + componentHasMultiplePlatforms = (1 << 3), + componentLoadResident = (1 << 4) +}; +enum { + defaultComponentIdentical = 0, + defaultComponentAnyFlags = 1, + defaultComponentAnyManufacturer = 2, + defaultComponentAnySubType = 4, + defaultComponentAnyFlagsAnyManufacturer = (defaultComponentAnyFlags + defaultComponentAnyManufacturer), + defaultComponentAnyFlagsAnyManufacturerAnySubType = (defaultComponentAnyFlags + defaultComponentAnyManufacturer + defaultComponentAnySubType) +}; +enum { + registerComponentGlobal = 1, + registerComponentNoDuplicates = 2, + registerComponentAfterExisting = 4, + registerComponentAliasesOnly = 8 +}; +struct ComponentDescription { + OSType componentType; + OSType componentSubType; + OSType componentManufacturer; + unsigned long componentFlags; + unsigned long componentFlagsMask; +}; +typedef struct ComponentDescription ComponentDescription; +struct ResourceSpec { + OSType resType; + short resID; +}; +typedef struct ResourceSpec ResourceSpec; +struct ComponentResource { + ComponentDescription cd; + ResourceSpec component; + ResourceSpec componentName; + ResourceSpec componentInfo; + ResourceSpec componentIcon; +}; +typedef struct ComponentResource ComponentResource; +typedef ComponentResource* ComponentResourcePtr; +typedef ComponentResourcePtr* ComponentResourceHandle; +struct ComponentPlatformInfo { + long componentFlags; + ResourceSpec component; + short platformType; +}; +typedef struct ComponentPlatformInfo ComponentPlatformInfo; +struct ComponentResourceExtension { + long componentVersion; + long componentRegisterFlags; + short componentIconFamily; +}; +typedef struct ComponentResourceExtension ComponentResourceExtension; +struct ComponentPlatformInfoArray { + long count; + ComponentPlatformInfo platformArray[1]; +}; +typedef struct ComponentPlatformInfoArray ComponentPlatformInfoArray; +struct ExtComponentResource { + ComponentDescription cd; + ResourceSpec component; + ResourceSpec componentName; + ResourceSpec componentInfo; + ResourceSpec componentIcon; + long componentVersion; + long componentRegisterFlags; + short componentIconFamily; + long count; + ComponentPlatformInfo platformArray[1]; +}; +typedef struct ExtComponentResource ExtComponentResource; +typedef ExtComponentResource* ExtComponentResourcePtr; +typedef ExtComponentResourcePtr* ExtComponentResourceHandle; +struct ComponentAliasResource { + ComponentResource cr; + ComponentDescription aliasCD; +}; +typedef struct ComponentAliasResource ComponentAliasResource; +struct ComponentParameters { + UInt8 flags; + UInt8 paramSize; + short what; + long params[1]; +}; +typedef struct ComponentParameters ComponentParameters; +struct ComponentRecord { + long data[1]; +}; +typedef struct ComponentRecord ComponentRecord; +typedef ComponentRecord* Component; +struct ComponentInstanceRecord { + long data[1]; +}; +typedef struct ComponentInstanceRecord ComponentInstanceRecord; +typedef ComponentInstanceRecord* ComponentInstance; +struct RegisteredComponentRecord { + long data[1]; +}; +typedef struct RegisteredComponentRecord RegisteredComponentRecord; +typedef RegisteredComponentRecord* RegisteredComponentRecordPtr; +struct RegisteredComponentInstanceRecord { + long data[1]; +}; +typedef struct RegisteredComponentInstanceRecord RegisteredComponentInstanceRecord; +typedef RegisteredComponentInstanceRecord* RegisteredComponentInstanceRecordPtr; +typedef long ComponentResult; +typedef struct ComponentMPWorkFunctionHeaderRecord ComponentMPWorkFunctionHeaderRecord; +typedef ComponentMPWorkFunctionHeaderRecord* ComponentMPWorkFunctionHeaderRecordPtr; +typedef ComponentResult (*PFN_ComponentMPWorkFunctionProcPtr)(void* globalRefCon, ComponentMPWorkFunctionHeaderRecordPtr header); +typedef ComponentResult (*PFN_ComponentRoutineProcPtr)(ComponentParameters* cp, Handle componentStorage); +typedef OSErr (*PFN_GetMissingComponentResourceProcPtr)(Component c, OSType resType, short resID, void* refCon, Handle* resource); +typedef UniversalProcPtr ComponentFunctionUPP; +typedef unsigned short CallingConventionType; +typedef unsigned short registerSelectorType; +typedef unsigned long ProcInfoType; +typedef unsigned short RoutineFlagsType; +typedef UInt8 RDFlagsType; + +typedef OSStatus (*PFN_StandardGlyphs)( + void* dataStream, + ByteCount size); +enum { + leftCaret = 0, + rightCaret = -1, + kHilite = 1 +}; +enum { + smLeftCaret = 0, + smRightCaret = -1, + smHilite = 1 +}; +enum { + onlyStyleRun = 0, + leftStyleRun = 1, + rightStyleRun = 2, + middleStyleRun = 3, + smOnlyStyleRun = 0, + smLeftStyleRun = 1, + smRightStyleRun = 2, + smMiddleStyleRun = 3 +}; +typedef short JustStyleCode; +typedef short TruncCode; +enum { + truncEnd = 0, + truncMiddle = 0x4000, + smTruncEnd = 0, + smTruncMiddle = 0x4000 +}; +enum { + notTruncated = 0, + truncated = 1, + truncErr = -1, + smNotTruncated = 0, + smTruncated = 1, + smTruncErr = -1 +}; +typedef SInt8 StyledLineBreakCode; +enum { + smBreakWord = 0, + smBreakChar = 1, + smBreakOverflow = 2 +}; +enum { + tfAntiAlias = 1 << 0, + tfUnicode = 1 << 1 +}; +struct FontInfo { + short ascent; + short descent; + short widMax; + short leading; +}; +typedef struct FontInfo FontInfo; +typedef short FormatOrder[1]; +typedef FormatOrder* FormatOrderPtr; +typedef Boolean (*StyleRunDirectionProcPtr)(short styleRunIndex, void* dirParam); +typedef UniversalProcPtr StyleRunDirectionUPP; +typedef StyleRunDirectionUPP (*NewStyleRunDirectionUPP)(StyleRunDirectionProcPtr userRoutine); +#if !OPAQUE_UPP_TYPES +enum { + uppStyleRunDirectionProcInfo = 0x00000390 +}; +#define NewStyleRunDirectionUPP(userRoutine) (StyleRunDirectionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, GetCurrentArchitecture()) +#endif +typedef void (*PFN_DisposeStyleRunDirectionUPP)(StyleRunDirectionUPP userUPP); +#if !OPAQUE_UPP_TYPES +#define DisposeStyleRunDirectionUPP(userUPP) DisposeRoutineDescriptor(userUPP) +#endif +typedef Boolean (*PFN_InvokeStyleRunDirectionUPP)( + short styleRunIndex, + void* dirParam, + StyleRunDirectionUPP userUPP); +#if !OPAQUE_UPP_TYPES +#define InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userUPP) (Boolean) CALL_TWO_PARAMETER_UPP((userUPP), uppStyleRunDirectionProcInfo, (styleRunIndex), (dirParam)) +#endif + +enum { + invalColReq = -1 +}; +enum { + srcCopy = 0, + srcOr = 1, + srcXor = 2, + srcBic = 3, + notSrcCopy = 4, + notSrcOr = 5, + notSrcXor = 6, + notSrcBic = 7, + patCopy = 8, + patOr = 9, + patXor = 10, + patBic = 11, + notPatCopy = 12, + notPatOr = 13, + notPatXor = 14, + notPatBic = 15, + grayishTextOr = 49, + hilitetransfermode = 50, + hilite = 50, + blend = 32, + addPin = 33, + addOver = 34, + subPin = 35, + addMax = 37, + adMax = 37, + subOver = 38, + adMin = 39, + ditherCopy = 64, + transparent = 36 +}; +enum { + italicBit = 1, + ulineBit = 2, + outlineBit = 3, + shadowBit = 4, + condenseBit = 5, + extendBit = 6 +}; +enum { + normalBit = 0, + inverseBit = 1, + redBit = 4, + greenBit = 3, + blueBit = 2, + cyanBit = 8, + magentaBit = 7, + yellowBit = 6, + blackBit = 5 +}; +enum { + blackColor = 33, + whiteColor = 30, + redColor = 205, + greenColor = 341, + blueColor = 409, + cyanColor = 273, + magentaColor = 137, + yellowColor = 69 +}; +enum { + picLParen = 0, + picRParen = 1, + clutType = 0, + fixedType = 1, + directType = 2, + gdDevType = 0 +}; +enum { + interlacedDevice = 2, + roundedDevice = 5, + hasAuxMenuBar = 6, + burstDevice = 7, + ext32Device = 8, + ramInit = 10, + mainScreen = 11, + allInit = 12, + screenDevice = 13, + noDriver = 14, + screenActive = 15, + hiliteBit = 7, + pHiliteBit = 0, + defQDColors = 127, + RGBDirect = 16, + baseAddr32 = 4 +}; +enum { + sysPatListID = 0, + iBeamCursor = 1, + crossCursor = 2, + plusCursor = 3, + watchCursor = 4 +}; +enum { + kQDGrafVerbFrame = 0, + kQDGrafVerbPaint = 1, + kQDGrafVerbErase = 2, + kQDGrafVerbInvert = 3, + kQDGrafVerbFill = 4 +}; +typedef SInt8 GrafVerb; +enum { + chunky = 0, + chunkyPlanar = 1, + planar = 2 +}; +typedef SInt8 PixelType; +typedef short Bits16[16]; +struct Pattern { + UInt8 pat[8]; +}; +typedef struct Pattern Pattern; +typedef const Pattern* ConstPatternParam; +typedef Pattern* PatPtr; +typedef PatPtr* PatHandle; +typedef SignedByte QDByte; +typedef QDByte* QDPtr; +typedef QDPtr* QDHandle; +typedef short QDErr; +enum { + singleDevicesBit = 0, + dontMatchSeedsBit = 1, + allDevicesBit = 2 +}; +enum { + singleDevices = 1 << singleDevicesBit, + dontMatchSeeds = 1 << dontMatchSeedsBit, + allDevices = 1 << allDevicesBit +}; +typedef unsigned long DeviceLoopFlags; +typedef SInt32 PrinterStatusOpcode; +enum { + kPrinterFontStatus = 0, + kPrinterScalingStatus = 1 +}; +struct PrinterFontStatus { + SInt32 oResult; + SInt16 iFondID; + Style iStyle; +}; +typedef struct PrinterFontStatus PrinterFontStatus; +struct PrinterScalingStatus { + Point oScalingFactors; +}; +typedef struct PrinterScalingStatus PrinterScalingStatus; +struct BitMap { + Ptr baseAddr; + short rowBytes; + Rect bounds; +}; +typedef struct BitMap BitMap; +typedef BitMap* BitMapPtr; +typedef BitMapPtr* BitMapHandle; +struct MacCursor { + Bits16 data; + Bits16 mask; + Point hotSpot; +}; +typedef struct MacCursor MacCursor; +typedef MacCursor* CursPtr; +typedef CursPtr* CursHandle; +struct PenState { + Point pnLoc; + Point pnSize; + short pnMode; + Pattern pnPat; +}; +typedef struct PenState PenState; +#if !OPAQUE_TOOLBOX_STRUCTS +struct MacRegion { + unsigned short rgnSize; + Rect rgnBBox; +}; +typedef struct MacRegion MacRegion; +typedef MacRegion* RgnPtr; +typedef RgnPtr* RgnHandle; +#else +typedef struct OpaqueRgnHandle* RgnHandle; +#endif +struct Picture { + short picSize; + Rect picFrame; +}; +typedef struct MacPicture MacPicture; +typedef MacPicture* PicPtr; +typedef PicPtr* PicHandle; +struct MacPolygon { + short polySize; + Rect polyBBox; + Point polyPoints[1]; +}; +typedef struct MacPolygon MacPolygon; +typedef MacPolygon Polygon; +typedef MacPolygon* PolyPtr; +typedef PolyPtr* PolyHandle; +typedef void (*PFN_QDTextProcPtr)(short byteCount, const void* textBuf, Point numer, Point denom); +typedef void (*PFN_QDLineProcPtr)(Point newPt); +typedef void (*PFN_QDRectProcPtr)(GrafVerb verb, const Rect* r); +typedef void (*PFN_QDRRectProcPtr)(GrafVerb verb, const Rect* r, short ovalWidth, short ovalHeight); +typedef void (*PFN_QDOvalProcPtr)(GrafVerb verb, const Rect* r); +typedef void (*PFN_QDArcProcPtr)(GrafVerb verb, const Rect* r, short startAngle, short arcAngle); +typedef void (*PFN_QDPolyProcPtr)(GrafVerb verb, PolyHandle poly); +typedef void (*PFN_QDRgnProcPtr)(GrafVerb verb, RgnHandle rgn); +typedef void (*PFN_QDBitsProcPtr)(const BitMap* srcBits, const Rect* srcRect, const Rect* dstRect, short mode, RgnHandle maskRgn); +typedef void (*PFN_QDCommentProcPtr)(short kind, short dataSize, Handle dataHandle); +typedef short (*PFN_QDTxMeasProcPtr)(short byteCount, const void* textAddr, Point* numer, Point* denom, FontInfo* info); +typedef void (*PFN_QDGetPicProcPtr)(void* dataPtr, short byteCount); +typedef void (*PFN_QDPutPicProcPtr)(const void* dataPtr, short byteCount); +typedef void (*PFN_QDOpcodeProcPtr)(const Rect* fromRect, const Rect* toRect, UInt16 opcode, SInt16 version); +typedef OSStatus (*PFN_QDStdGlyphsProcPtr)(void* dataStream, ByteCount size); +typedef void (*PFN_QDJShieldCursorProcPtr)(short left, short top, short right, short bottom); +typedef UniversalProcPtr QDTextUPP; +typedef UniversalProcPtr QDLineUPP; +typedef UniversalProcPtr QDRectUPP; +typedef UniversalProcPtr QDRRectUPP; +typedef UniversalProcPtr QDOvalUPP; +typedef UniversalProcPtr QDArcUPP; +typedef UniversalProcPtr QDPolyUPP; +typedef UniversalProcPtr QDRgnUPP; +typedef UniversalProcPtr QDBitsUPP; +typedef UniversalProcPtr QDCommentUPP; +typedef UniversalProcPtr QDTxMeasUPP; +typedef UniversalProcPtr QDGetPicUPP; +typedef UniversalProcPtr QDPutPicUPP; +typedef UniversalProcPtr QDOpcodeUPP; +typedef UniversalProcPtr QDStdGlyphsUPP; +typedef UniversalProcPtr QDJShieldCursorUPP; +struct QDProcs { + QDTextUPP textProc; + QDLineUPP lineProc; + QDRectUPP rectProc; + QDRRectUPP rRectProc; + QDOvalUPP ovalProc; + QDArcUPP arcProc; + QDPolyUPP polyProc; + QDRgnUPP rgnProc; + QDBitsUPP bitsProc; + QDCommentUPP commentProc; + QDTxMeasUPP txMeasProc; + QDGetPicUPP getPicProc; + QDPutPicUPP putPicProc; +}; +typedef struct QDProcs QDProcs; +typedef QDProcs* QDProcsPtr; +typedef struct CGContext* CGContextRef; + +struct GrafPort { + short device; + BitMap portBits; + Rect portRect; + RgnHandle visRgn; + RgnHandle clipRgn; + Pattern bkPat; + Pattern fillPat; + Point pnLoc; + Point pnSize; + short pnMode; + Pattern pnPat; + short pnVis; + short txFont; + StyleField txFace; + short txMode; + short txSize; + Fixed spExtra; + long fgColor; + long bkColor; + short colrBit; + short patStretch; + Handle picSave; + Handle rgnSave; + Handle polySave; + QDProcsPtr grafProcs; +}; +typedef struct GrafPort GrafPort; +typedef GrafPort* GrafPtr; +typedef GrafPtr WindowPtr; +typedef WindowPtr DialogPtr; +struct RGBColor { + unsigned short red; + unsigned short green; + unsigned short blue; +}; +typedef struct RGBColor RGBColor; +typedef UniversalProcPtr ColorSearchUPP; +typedef UniversalProcPtr ColorComplementUPP; + +struct ColorSpec { + short value; + RGBColor rgb; +}; +typedef struct ColorSpec ColorSpec; +typedef ColorSpec* ColorSpecPtr; +typedef ColorSpec CSpecArray[1]; +typedef struct ColorTable ColorTable; +typedef ColorTable* CTabPtr; +typedef CTabPtr* CTabHandle; +typedef struct PixMap PixMap; +typedef PixMap* PixMapPtr; +typedef PixMapPtr* PixMapHandle; +struct PixPat { + short patType; + PixMapHandle patMap; + Handle patData; + Handle patXData; + short patXValid; + Handle patXMap; + Pattern pat1Data; +}; +typedef struct PixPat PixPat; +typedef PixPat* PixPatPtr; +typedef PixPatPtr* PixPatHandle; +typedef struct CCrsr CCrsr; +typedef CCrsr* CCrsrPtr; +typedef CCrsrPtr* CCrsrHandle; +struct ITab { + long iTabSeed; + short iTabRes; + Byte iTTable[1]; +}; +typedef struct ITab ITab; +typedef ITab* ITabPtr; +typedef ITabPtr* ITabHandle; +typedef struct GDevice GDevice; +typedef GDevice* GDPtr; +typedef GDPtr* GDHandle; +typedef struct CGrafPort CGrafPort; +typedef CGrafPort* CGrafPtr; +typedef UniversalProcPtr QDPrinterStatusUPP; +struct CQDProcs { + QDTextUPP textProc; + QDLineUPP lineProc; + QDRectUPP rectProc; + QDRRectUPP rRectProc; + QDOvalUPP ovalProc; + QDArcUPP arcProc; + QDPolyUPP polyProc; + QDRgnUPP rgnProc; + QDBitsUPP bitsProc; + QDCommentUPP commentProc; + QDTxMeasUPP txMeasProc; + QDGetPicUPP getPicProc; + QDPutPicUPP putPicProc; + QDOpcodeUPP opcodeProc; + UniversalProcPtr newProc1; + QDStdGlyphsUPP glyphsProc; + QDPrinterStatusUPP printerStatusProc; + UniversalProcPtr newProc4; + UniversalProcPtr newProc5; + UniversalProcPtr newProc6; +}; + +typedef struct CQDProcs CQDProcs; +typedef CQDProcs* CQDProcsPtr; +struct ReqListRec { + short reqLSize; + short reqLData[1]; +}; +typedef struct ReqListRec ReqListRec; +struct OpenCPicParams { + Rect srcRect; + Fixed hRes; + Fixed vRes; + short version; + short reserved1; + long reserved2; +}; +typedef struct OpenCPicParams OpenCPicParams; +typedef UniversalProcPtr DeviceLoopDrawingUPP; +typedef SInt32 QDRegionParseDirection; +typedef UniversalProcPtr RegionToRectsUPP; +enum { + colorXorXFer = 52, + noiseXFer = 53, + customXFer = 54 +}; +enum { + kXFer1PixelAtATime = 0x00000001, + kXFerConvertPixelToRGB32 = 0x00000002 +}; +struct CustomXFerRec { + UInt32 version; + void* srcPixels; + void* destPixels; + void* resultPixels; + UInt32 refCon; + UInt32 pixelSize; + UInt32 pixelCount; + Point firstPixelHV; + Rect destBounds; +}; +typedef struct CustomXFerRec CustomXFerRec; +typedef CustomXFerRec* CustomXFerRecPtr; +typedef void (*CustomXFerProcPtr)(CustomXFerRecPtr info); +enum { + kCursorComponentsVersion = 0x00010001 +}; +enum { + kCursorComponentType = 'curs' +}; +enum { + cursorDoesAnimate = 1L << 0, + cursorDoesHardware = 1L << 1, + cursorDoesUnreadableScreenBits = 1L << 2 +}; +enum { + kRenderCursorInHardware = 1L << 0, + kRenderCursorInSoftware = 1L << 1 +}; +struct CursorInfo { + long version; + long capabilities; + long animateDuration; + Rect bounds; + Point hotspot; + long reserved; +}; +typedef struct CursorInfo CursorInfo; +enum { + kCursorComponentInit = 0x0001, + kCursorComponentGetInfo = 0x0002, + kCursorComponentSetOutputMode = 0x0003, + kCursorComponentSetData = 0x0004, + kCursorComponentReconfigure = 0x0005, + kCursorComponentDraw = 0x0006, + kCursorComponentErase = 0x0007, + kCursorComponentMove = 0x0008, + kCursorComponentAnimate = 0x0009, + kCursorComponentLastReserved = 0x0050 +}; + +typedef OSErr (*PFN_GetPortCustomXFerProc)( + CGrafPtr port, + CustomXFerProcPtr* proc, + UInt32* flags, + UInt32* refCon); +typedef OSErr (*PFN_SetPortCustomXFerProc)( + CGrafPtr port, + CustomXFerProcPtr proc, + UInt32 flags, + UInt32 refCon); +typedef OSErr (*PFN_OpenCursorComponent)( + Component c, + ComponentInstance* ci); +typedef OSErr (*PFN_CloseCursorComponent)(ComponentInstance ci); +typedef OSErr (*PFN_SetCursorComponent)(ComponentInstance ci); +typedef OSErr (*PFN_CursorComponentChanged)(ComponentInstance ci); +typedef OSErr (*PFN_CursorComponentSetData)( + ComponentInstance ci, + long data); +typedef Boolean (*PFN_IsValidPort)(CGrafPtr port); +typedef PixMapHandle (*PFN_GetPortPixMap)(CGrafPtr port); +typedef const BitMap* (*PFN_GetPortBitMapForCopyBits)(CGrafPtr port); +typedef Rect* (*PFN_GetPortBounds)( + CGrafPtr port, + Rect* rect); +typedef RGBColor* (*PFN_GetPortForeColor)( + CGrafPtr port, + RGBColor* foreColor); +typedef RGBColor* (*PFN_GetPortBackColor)( + CGrafPtr port, + RGBColor* backColor); +typedef RGBColor* (*PFN_GetPortOpColor)( + CGrafPtr port, + RGBColor* opColor); +typedef RGBColor* (*PFN_GetPortHiliteColor)( + CGrafPtr port, + RGBColor* hiliteColor); +typedef CQDProcsPtr (*PFN_GetPortGrafProcs)(CGrafPtr port); +typedef short (*PFN_GetPortTextFont)(CGrafPtr port); +typedef Style (*PFN_GetPortTextFace)(CGrafPtr port); +typedef short (*PFN_GetPortTextMode)(CGrafPtr port); +typedef short (*PFN_GetPortTextSize)(CGrafPtr port); +typedef short (*PFN_GetPortChExtra)(CGrafPtr port); +typedef short (*PFN_GetPortFracHPenLocation)(CGrafPtr port); +typedef Fixed (*PFN_GetPortSpExtra)(CGrafPtr port); +typedef short (*PFN_GetPortPenVisibility)(CGrafPtr port); +typedef RgnHandle (*PFN_GetPortVisibleRegion)( + CGrafPtr port, + RgnHandle visRgn); +typedef RgnHandle (*PFN_GetPortClipRegion)( + CGrafPtr port, + RgnHandle clipRgn); +typedef PixPatHandle (*PFN_GetPortBackPixPat)( + CGrafPtr port, + PixPatHandle backPattern); +typedef PixPatHandle (*PFN_GetPortPenPixPat)( + CGrafPtr port, + PixPatHandle penPattern); +typedef PixPatHandle (*PFN_GetPortFillPixPat)( + CGrafPtr port, + PixPatHandle fillPattern); +typedef Point* (*PFN_GetPortPenSize)( + CGrafPtr port, + Point* penSize); +typedef SInt32 (*PFN_GetPortPenMode)(CGrafPtr port); +typedef Point* (*PFN_GetPortPenLocation)( + CGrafPtr port, + Point* penLocation); +typedef Boolean (*PFN_IsPortRegionBeingDefined)(CGrafPtr port); +typedef Boolean (*PFN_IsPortPictureBeingDefined)(CGrafPtr port); +typedef Boolean (*PFN_IsPortPolyBeingDefined)(CGrafPtr port); +typedef Boolean (*PFN_IsPortOffscreen)(CGrafPtr port); +typedef Boolean (*PFN_IsPortColor)(CGrafPtr port); +typedef void (*PFN_SetPortBounds)( + CGrafPtr port, + const Rect* rect); +typedef void (*PFN_SetPortOpColor)( + CGrafPtr port, + const RGBColor* opColor); +typedef void (*PFN_SetPortGrafProcs)( + CGrafPtr port, + CQDProcs* procs); +typedef void (*PFN_SetPortVisibleRegion)( + CGrafPtr port, + RgnHandle visRgn); +typedef void (*PFN_SetPortClipRegion)( + CGrafPtr port, + RgnHandle clipRgn); +typedef void (*PFN_SetPortPenPixPat)( + CGrafPtr port, + PixPatHandle penPattern); +typedef void (*PFN_SetPortFillPixPat)( + CGrafPtr port, + PixPatHandle penPattern); +typedef void (*PFN_SetPortBackPixPat)( + CGrafPtr port, + PixPatHandle backPattern); +typedef void (*PFN_SetPortPenSize)( + CGrafPtr port, + Point penSize); +typedef void (*PFN_SetPortPenMode)( + CGrafPtr port, + SInt32 penMode); +typedef void (*PFN_SetPortFracHPenLocation)( + CGrafPtr port, + short pnLocHFrac); +typedef Rect* (*PFN_GetPixBounds)( + PixMapHandle pixMap, + Rect* bounds); +typedef short (*PFN_GetPixDepth)(PixMapHandle pixMap); +typedef long (*PFN_GetQDGlobalsRandomSeed)(void); +typedef BitMap* (*PFN_GetQDGlobalsScreenBits)(BitMap* screenBits); +typedef MacCursor* (*PFN_GetQDGlobalsArrow)(MacCursor* arrow); +typedef Pattern* (*PFN_GetQDGlobalsDarkGray)(Pattern* dkGray); +typedef Pattern* (*PFN_GetQDGlobalsLightGray)(Pattern* ltGray); +typedef Pattern* (*PFN_GetQDGlobalsGray)(Pattern* gray); +typedef Pattern* (*PFN_GetQDGlobalsBlack)(Pattern* black); +typedef Pattern* (*PFN_GetQDGlobalsWhite)(Pattern* white); +typedef CGrafPtr (*PFN_GetQDGlobalsThePort)(void); +typedef void (*PFN_SetQDGlobalsRandomSeed)(long randomSeed); +typedef void (*PFN_SetQDGlobalsArrow)(const MacCursor* arrow); +typedef Rect* (*PFN_GetRegionBounds)( + RgnHandle region, + Rect* bounds); +typedef Boolean (*PFN_IsRegionRectangular)(RgnHandle region); +typedef CGrafPtr (*PFN_CreateNewPort)(void); +typedef void (*PFN_DisposePort)(CGrafPtr port); +typedef void (*PFN_SetQDError)(OSErr err); +typedef Boolean (*PFN_QDIsPortBuffered)(CGrafPtr port); +typedef Boolean (*PFN_QDIsPortBufferDirty)(CGrafPtr port); +typedef void (*PFN_QDFlushPortBuffer)( + CGrafPtr port, + RgnHandle region); +typedef OSStatus (*PFN_QDGetDirtyRegion)( + CGrafPtr port, + RgnHandle rgn); +typedef OSStatus (*PFN_QDSetDirtyRegion)( + CGrafPtr port, + RgnHandle rgn); +typedef OSStatus (*PFN_CreateCGContextForPort)( + CGrafPtr inPort, + CGContextRef* outContext); +typedef OSStatus (*PFN_ClipCGContextToRegion)( + CGContextRef gc, + const Rect* portRect, + RgnHandle region); +typedef OSStatus (*PFN_SyncCGContextOriginWithPort)( + CGContextRef inContext, + CGrafPtr port); +typedef CGrafPtr (*PFN_CreateNewPortForCGDisplayID)(UInt32 inCGDisplayID); +typedef void (*PFN_QDDisplayWaitCursor)(Boolean forceWaitCursor); +typedef void (*PFN_QDSetPatternOrigin)(Point origin); +typedef void (*PFN_QDGetPatternOrigin)(Point* origin); +typedef SInt16 (*PFN_LMGetScrVRes)(void); +typedef void (*PFN_LMSetScrVRes)(SInt16 value); +typedef SInt16 (*PFN_LMGetScrHRes)(void); +typedef void (*PFN_LMSetScrHRes)(SInt16 value); +typedef GDHandle (*PFN_LMGetMainDevice)(void); +typedef void (*PFN_LMSetMainDevice)(GDHandle value); +typedef GDHandle (*PFN_LMGetDeviceList)(void); +typedef void (*PFN_LMSetDeviceList)(GDHandle value); +typedef Handle (*PFN_LMGetQDColors)(void); +typedef void (*PFN_LMSetQDColors)(Handle value); +typedef Handle (*PFN_LMGetWidthListHand)(void); +typedef void (*PFN_LMSetWidthListHand)(Handle value); +typedef UInt8 (*PFN_LMGetHiliteMode)(void); +typedef void (*PFN_LMSetHiliteMode)(UInt8 value); +typedef Ptr (*PFN_LMGetWidthPtr)(void); +typedef void (*PFN_LMSetWidthPtr)(Ptr value); +typedef Handle (*PFN_LMGetWidthTabHandle)(void); +typedef void (*PFN_LMSetWidthTabHandle)(Handle value); +typedef SInt32 (*PFN_LMGetLastSPExtra)(void); +typedef void (*PFN_LMSetLastSPExtra)(SInt32 value); +typedef Handle (*PFN_LMGetLastFOND)(void); +typedef void (*PFN_LMSetLastFOND)(Handle value); +typedef UInt8 (*PFN_LMGetFractEnable)(void); +typedef void (*PFN_LMSetFractEnable)(UInt8 value); +typedef GDHandle (*PFN_LMGetTheGDevice)(void); +typedef void (*PFN_LMSetTheGDevice)(GDHandle value); +typedef void (*PFN_LMGetHiliteRGB)(RGBColor* hiliteRGBValue); +typedef void (*PFN_LMSetHiliteRGB)(const RGBColor* hiliteRGBValue); +typedef Boolean (*PFN_LMGetCursorNew)(void); +typedef void (*PFN_LMSetCursorNew)(Boolean value); +typedef OSStatus (*PFN_QDRegionToRects)( + RgnHandle rgn, + QDRegionParseDirection dir, + RegionToRectsUPP proc, + void* userData); +typedef void (*PFN_SetPort)(GrafPtr port); +typedef void (*PFN_GetPort)(GrafPtr* port); +typedef void (*PFN_GrafDevice)(short device); +typedef void (*PFN_SetPortBits)(const BitMap* bm); +typedef void (*PFN_PortSize)( + short width, + short height); +typedef void (*PFN_MovePortTo)( + short leftGlobal, + short topGlobal); +typedef void (*PFN_SetOrigin)( + short h, + short v); +typedef void (*PFN_SetClip)(RgnHandle rgn); +typedef void (*PFN_GetClip)(RgnHandle rgn); +typedef void (*PFN_ClipRect)(const Rect* r); +typedef void (*PFN_BackPat)(const Pattern* pat); +typedef void (*PFN_InitCursor)(void); +typedef void (*PFN_SetCursor)(const MacCursor* crsr); +typedef void (*PFN_HideCursor)(void); +typedef void (*PFN_ShowCursor)(void); +typedef void (*PFN_ObscureCursor)(void); +typedef void (*PFN_HidePen)(void); +typedef void (*PFN_ShowPen)(void); +typedef void (*PFN_GetPen)(Point* pt); +typedef void (*PFN_GetPenState)(PenState* pnState); +typedef void (*PFN_SetPenState)(const PenState* pnState); +typedef void (*PFN_PenSize)( + short width, + short height); +typedef void (*PFN_PenMode)(short mode); +typedef void (*PFN_PenPat)(const Pattern* pat); +typedef void (*PFN_PenNormal)(void); +typedef void (*PFN_MoveTo)( + short h, + short v); +typedef void (*PFN_Move)( + short dh, + short dv); +typedef void (*PFN_LineTo)( + short h, + short v); +typedef void (*PFN_Line)( + short dh, + short dv); +typedef void (*PFN_ForeColor)(long color); +typedef void (*PFN_BackColor)(long color); +typedef void (*PFN_ColorBit)(short whichBit); +typedef void (*PFN_SetRect)( + Rect* r, + short left, + short top, + short right, + short bottom); +typedef void (*PFN_OffsetRect)( + Rect* r, + short dh, + short dv); +typedef void (*PFN_InsetRect)( + Rect* r, + short dh, + short dv); +typedef Boolean (*PFN_SectRect)( + const Rect* src1, + const Rect* src2, + Rect* dstRect); +typedef void (*PFN_UnionRect)( + const Rect* src1, + const Rect* src2, + Rect* dstRect); +typedef Boolean (*PFN_EqualRect)( + const Rect* rect1, + const Rect* rect2); +typedef Boolean (*PFN_EmptyRect)(const Rect* r); +typedef void (*PFN_FrameRect)(const Rect* r); +typedef void (*PFN_PaintRect)(const Rect* r); +typedef void (*PFN_EraseRect)(const Rect* r); +typedef void (*PFN_InvertRect)(const Rect* r); +typedef void (*PFN_FillRect)( + const Rect* r, + const Pattern* pat); +typedef void (*PFN_FrameOval)(const Rect* r); +typedef void (*PFN_PaintOval)(const Rect* r); +typedef void (*PFN_EraseOval)(const Rect* r); +typedef void (*PFN_InvertOval)(const Rect* r); +typedef void (*PFN_FillOval)( + const Rect* r, + const Pattern* pat); +typedef void (*PFN_FrameRoundRect)( + const Rect* r, + short ovalWidth, + short ovalHeight); +typedef void (*PFN_PaintRoundRect)( + const Rect* r, + short ovalWidth, + short ovalHeight); +typedef void (*PFN_EraseRoundRect)( + const Rect* r, + short ovalWidth, + short ovalHeight); +typedef void (*PFN_InvertRoundRect)( + const Rect* r, + short ovalWidth, + short ovalHeight); +typedef void (*PFN_FillRoundRect)( + const Rect* r, + short ovalWidth, + short ovalHeight, + const Pattern* pat); +typedef void (*PFN_FrameArc)( + const Rect* r, + short startAngle, + short arcAngle); +typedef void (*PFN_PaintArc)( + const Rect* r, + short startAngle, + short arcAngle); +typedef void (*PFN_EraseArc)( + const Rect* r, + short startAngle, + short arcAngle); +typedef void (*PFN_InvertArc)( + const Rect* r, + short startAngle, + short arcAngle); +typedef void (*PFN_FillArc)( + const Rect* r, + short startAngle, + short arcAngle, + const Pattern* pat); +typedef RgnHandle (*PFN_NewRgn)(void); +typedef void (*PFN_OpenRgn)(void); +typedef void (*PFN_CloseRgn)(RgnHandle dstRgn); +typedef OSErr (*PFN_BitMapToRegion)( + RgnHandle region, + const BitMap* bMap); +typedef void (*PFN_HandleToRgn)( + Handle oldRegion, + RgnHandle region); +typedef void (*PFN_RgnToHandle)( + RgnHandle region, + Handle flattenedRgnDataHdl); +typedef void (*PFN_DisposeRgn)(RgnHandle rgn); +typedef void (*PFN_CopyRgn)( + RgnHandle srcRgn, + RgnHandle dstRgn); +typedef void (*PFN_SetEmptyRgn)(RgnHandle rgn); +typedef void (*PFN_SetRectRgn)( + RgnHandle rgn, + short left, + short top, + short right, + short bottom); +typedef void (*PFN_RectRgn)( + RgnHandle rgn, + const Rect* r); +typedef void (*PFN_OffsetRgn)( + RgnHandle rgn, + short dh, + short dv); +typedef void (*PFN_InsetRgn)( + RgnHandle rgn, + short dh, + short dv); +typedef void (*PFN_SectRgn)( + RgnHandle srcRgnA, + RgnHandle srcRgnB, + RgnHandle dstRgn); +typedef void (*PFN_UnionRgn)( + RgnHandle srcRgnA, + RgnHandle srcRgnB, + RgnHandle dstRgn); +typedef void (*PFN_DiffRgn)( + RgnHandle srcRgnA, + RgnHandle srcRgnB, + RgnHandle dstRgn); +typedef void (*PFN_XorRgn)( + RgnHandle srcRgnA, + RgnHandle srcRgnB, + RgnHandle dstRgn); +typedef Boolean (*PFN_RectInRgn)( + const Rect* r, + RgnHandle rgn); +typedef Boolean (*PFN_EqualRgn)( + RgnHandle rgnA, + RgnHandle rgnB); +typedef Boolean (*PFN_EmptyRgn)(RgnHandle rgn); +typedef void (*PFN_FrameRgn)(RgnHandle rgn); +typedef void (*PFN_PaintRgn)(RgnHandle rgn); +typedef void (*PFN_EraseRgn)(RgnHandle rgn); +typedef void (*PFN_InvertRgn)(RgnHandle rgn); +typedef void (*PFN_FillRgn)( + RgnHandle rgn, + const Pattern* pat); +typedef void (*PFN_ScrollRect)( + const Rect* r, + short dh, + short dv, + RgnHandle updateRgn); +typedef void (*PFN_CopyBits)( + const BitMap* srcBits, + const BitMap* dstBits, + const Rect* srcRect, + const Rect* dstRect, + short mode, + RgnHandle maskRgn); +typedef void (*PFN_SeedFill)( + const void* srcPtr, + void* dstPtr, + short srcRow, + short dstRow, + short height, + short words, + short seedH, + short seedV); +typedef void (*PFN_CalcMask)( + const void* srcPtr, + void* dstPtr, + short srcRow, + short dstRow, + short height, + short words); +typedef void (*PFN_CopyMask)( + const BitMap* srcBits, + const BitMap* maskBits, + const BitMap* dstBits, + const Rect* srcRect, + const Rect* maskRect, + const Rect* dstRect); +typedef PicHandle (*PFN_OpenPicture)(const Rect* picFrame); +typedef void (*PFN_PicComment)( + short kind, + short dataSize, + Handle dataHandle); +typedef void (*PFN_ClosePicture)(void); +typedef void (*PFN_DrawPicture)( + PicHandle myPicture, + const Rect* dstRect); +typedef void (*PFN_KillPicture)(PicHandle myPicture); +typedef PolyHandle (*PFN_OpenPoly)(void); +typedef void (*PFN_ClosePoly)(void); +typedef void (*PFN_KillPoly)(PolyHandle poly); +typedef void (*PFN_OffsetPoly)( + PolyHandle poly, + short dh, + short dv); +typedef void (*PFN_FramePoly)(PolyHandle poly); +typedef void (*PFN_PaintPoly)(PolyHandle poly); +typedef void (*PFN_ErasePoly)(PolyHandle poly); +typedef void (*PFN_InvertPoly)(PolyHandle poly); +typedef void (*PFN_FillPoly)( + PolyHandle poly, + const Pattern* pat); +typedef void (*PFN_SetPt)( + Point* pt, + short h, + short v); +typedef void (*PFN_LocalToGlobal)(Point* pt); +typedef void (*PFN_GlobalToLocal)(Point* pt); +typedef short (*PFN_Random)(void); +typedef void (*PFN_StuffHex)( + void* thingPtr, + ConstStr255Param s); +typedef Boolean (*PFN_GetPixel)( + short h, + short v); +typedef void (*PFN_ScalePt)( + Point* pt, + const Rect* srcRect, + const Rect* dstRect); +typedef void (*PFN_MapPt)( + Point* pt, + const Rect* srcRect, + const Rect* dstRect); +typedef void (*PFN_MapRect)( + Rect* r, + const Rect* srcRect, + const Rect* dstRect); +typedef void (*PFN_MapRgn)( + RgnHandle rgn, + const Rect* srcRect, + const Rect* dstRect); +typedef void (*PFN_MapPoly)( + PolyHandle poly, + const Rect* srcRect, + const Rect* dstRect); +typedef void (*PFN_SetStdProcs)(QDProcs* procs); +typedef void (*PFN_StdRect)( + GrafVerb verb, + const Rect* r); +typedef void (*PFN_StdRRect)( + GrafVerb verb, + const Rect* r, + short ovalWidth, + short ovalHeight); +typedef void (*PFN_StdOval)( + GrafVerb verb, + const Rect* r); +typedef void (*PFN_StdArc)( + GrafVerb verb, + const Rect* r, + short startAngle, + short arcAngle); +typedef void (*PFN_StdPoly)( + GrafVerb verb, + PolyHandle poly); +typedef void (*PFN_StdRgn)( + GrafVerb verb, + RgnHandle rgn); +typedef void (*PFN_StdBits)( + const BitMap* srcBits, + const Rect* srcRect, + const Rect* dstRect, + short mode, + RgnHandle maskRgn); +typedef void (*PFN_StdComment)( + short kind, + short dataSize, + Handle dataHandle); +typedef void (*PFN_StdGetPic)( + void* dataPtr, + short byteCount); +typedef void (*PFN_StdPutPic)( + const void* dataPtr, + short byteCount); +typedef void (*PFN_StdOpcode)( + const Rect* fromRect, + const Rect* toRect, + UInt16 opcode, + SInt16 version); +typedef void (*PFN_AddPt)( + Point src, + Point* dst); +typedef Boolean (*PFN_EqualPt)( + Point pt1, + Point pt2); +typedef Boolean (*PFN_PtInRect)( + Point pt, + const Rect* r); +typedef void (*PFN_Pt2Rect)( + Point pt1, + Point pt2, + Rect* dstRect); +typedef void (*PFN_PtToAngle)( + const Rect* r, + Point pt, + short* angle); +typedef void (*PFN_SubPt)( + Point src, + Point* dst); +typedef Boolean (*PFN_PtInRgn)( + Point pt, + RgnHandle rgn); +typedef void (*PFN_StdLine)(Point newPt); +typedef PixMapHandle (*PFN_NewPixMap)(void); +typedef void (*PFN_DisposePixMap)(PixMapHandle pm); +typedef void (*PFN_CopyPixMap)( + PixMapHandle srcPM, + PixMapHandle dstPM); +typedef PixPatHandle (*PFN_NewPixPat)(void); +typedef void (*PFN_DisposePixPat)(PixPatHandle pp); +typedef void (*PFN_CopyPixPat)( + PixPatHandle srcPP, + PixPatHandle dstPP); +typedef void (*PFN_PenPixPat)(PixPatHandle pp); +typedef void (*PFN_BackPixPat)(PixPatHandle pp); +typedef PixPatHandle (*PFN_GetPixPat)(short patID); +typedef void (*PFN_MakeRGBPat)( + PixPatHandle pp, + const RGBColor* myColor); +typedef void (*PFN_FillCRect)( + const Rect* r, + PixPatHandle pp); +typedef void (*PFN_FillCOval)( + const Rect* r, + PixPatHandle pp); +typedef void (*PFN_FillCRoundRect)( + const Rect* r, + short ovalWidth, + short ovalHeight, + PixPatHandle pp); +typedef void (*PFN_FillCArc)( + const Rect* r, + short startAngle, + short arcAngle, + PixPatHandle pp); +typedef void (*PFN_FillCRgn)( + RgnHandle rgn, + PixPatHandle pp); +typedef void (*PFN_FillCPoly)( + PolyHandle poly, + PixPatHandle pp); +typedef void (*PFN_RGBForeColor)(const RGBColor* color); +typedef void (*PFN_RGBBackColor)(const RGBColor* color); +typedef void (*PFN_SetCPixel)( + short h, + short v, + const RGBColor* cPix); +typedef void (*PFN_SetPortPix)(PixMapHandle pm); +typedef void (*PFN_GetCPixel)( + short h, + short v, + RGBColor* cPix); +typedef void (*PFN_GetForeColor)(RGBColor* color); +typedef void (*PFN_GetBackColor)(RGBColor* color); +typedef void (*PFN_SeedCFill)( + const BitMap* srcBits, + const BitMap* dstBits, + const Rect* srcRect, + const Rect* dstRect, + short seedH, + short seedV, + ColorSearchUPP matchProc, + long matchData); +typedef void (*PFN_CalcCMask)( + const BitMap* srcBits, + const BitMap* dstBits, + const Rect* srcRect, + const Rect* dstRect, + const RGBColor* seedRGB, + ColorSearchUPP matchProc, + long matchData); +typedef PicHandle (*PFN_OpenCPicture)(const OpenCPicParams* newHeader); +typedef void (*PFN_OpColor)(const RGBColor* color); +typedef void (*PFN_HiliteColor)(const RGBColor* color); +typedef void (*PFN_DisposeCTable)(CTabHandle cTable); +typedef CTabHandle (*PFN_GetCTable)(short ctID); +typedef CCrsrHandle (*PFN_GetCCursor)(short crsrID); +typedef void (*PFN_SetCCursor)(CCrsrHandle cCrsr); +typedef void (*PFN_AllocCursor)(void); +typedef void (*PFN_DisposeCCursor)(CCrsrHandle cCrsr); +typedef void (*PFN_SetStdCProcs)(CQDProcs* procs); +typedef GDHandle (*PFN_GetMaxDevice)(const Rect* globalRect); +typedef long (*PFN_GetCTSeed)(void); +typedef GDHandle (*PFN_GetDeviceList)(void); +typedef GDHandle (*PFN_GetMainDevice)(void); +typedef GDHandle (*PFN_GetNextDevice)(GDHandle curDevice); +typedef Boolean (*PFN_TestDeviceAttribute)( + GDHandle gdh, + short attribute); +typedef void (*PFN_SetDeviceAttribute)( + GDHandle gdh, + short attribute, + Boolean value); +typedef void (*PFN_InitGDevice)( + short qdRefNum, + long mode, + GDHandle gdh); +typedef GDHandle (*PFN_NewGDevice)( + short refNum, + long mode); +typedef void (*PFN_DisposeGDevice)(GDHandle gdh); +typedef void (*PFN_SetGDevice)(GDHandle gd); +typedef GDHandle (*PFN_GetGDevice)(void); +typedef long (*PFN_Color2Index)(const RGBColor* myColor); +typedef void (*PFN_Index2Color)( + long index, + RGBColor* aColor); +typedef void (*PFN_InvertColor)(RGBColor* myColor); +typedef Boolean (*PFN_RealColor)(const RGBColor* color); +typedef void (*PFN_GetSubTable)( + CTabHandle myColors, + short iTabRes, + CTabHandle targetTbl); +typedef void (*PFN_MakeITable)( + CTabHandle cTabH, + ITabHandle iTabH, + short res); +typedef void (*PFN_AddSearch)(ColorSearchUPP searchProc); +typedef void (*PFN_AddComp)(ColorComplementUPP compProc); +typedef void (*PFN_DelSearch)(ColorSearchUPP searchProc); +typedef void (*PFN_DelComp)(ColorComplementUPP compProc); +typedef void (*PFN_SetClientID)(short id); +typedef void (*PFN_ProtectEntry)( + short index, + Boolean protect); +typedef void (*PFN_ReserveEntry)( + short index, + Boolean reserve); +typedef void (*PFN_SetEntries)( + short start, + short count, + CSpecArray aTable); +typedef void (*PFN_SaveEntries)( + CTabHandle srcTable, + CTabHandle resultTable, + ReqListRec* selection); +typedef void (*PFN_RestoreEntries)( + CTabHandle srcTable, + CTabHandle dstTable, + ReqListRec* selection); +typedef short (*PFN_QDError)(void); +typedef void (*PFN_CopyDeepMask)( + const BitMap* srcBits, + const BitMap* maskBits, + const BitMap* dstBits, + const Rect* srcRect, + const Rect* maskRect, + const Rect* dstRect, + short mode, + RgnHandle maskRgn); +typedef void (*PFN_DeviceLoop)( + RgnHandle drawingRgn, + DeviceLoopDrawingUPP drawingProc, + long userData, + DeviceLoopFlags flags); +typedef Ptr (*PFN_GetMaskTable)(void); +typedef PatHandle (*PFN_GetPattern)(short patternID); +typedef CursHandle (*PFN_GetCursor)(short cursorID); +typedef PicHandle (*PFN_GetPicture)(short pictureID); +typedef long (*PFN_DeltaPoint)( + Point ptA, + Point ptB); +typedef void (*PFN_ShieldCursor)( + const Rect* shieldRect, + Point offsetPt); +typedef void (*PFN_ScreenRes)( + short* scrnHRes, + short* scrnVRes); +typedef void (*PFN_GetIndPattern)( + Pattern* thePat, + short patternListID, + short index); +typedef long (*PFN_deltapoint)( + Point* ptA, + Point* ptB); +typedef void (*PFN_PackBits)( + Ptr* srcPtr, + Ptr* dstPtr, + short srcBytes); +typedef void (*PFN_UnpackBits)( + Ptr* srcPtr, + Ptr* dstPtr, + short dstBytes); +typedef Fixed (*PFN_SlopeFromAngle)(short angle); +typedef short (*PFN_AngleFromSlope)(Fixed slope); + +#endif diff --git a/src/backend/mac/quickDraw.c b/src/backend/mac/quickDraw.c new file mode 100644 index 0000000..c03c3e1 --- /dev/null +++ b/src/backend/mac/quickDraw.c @@ -0,0 +1,406 @@ +/* $Id $ */ + +#include "mac.h" +#include "quickDraw.h" +#include + +void quickDrawBackendUserDataInit(mac_backend_userdata ud) { + void* carbonLib = dlopen("CarbonLib", RTLD_LAZY | RTLD_LOCAL); + + ud = malloc(sizeof(struct mac_backend_userdata_t)); + +#define LOAD_QD_FUNC(name) ud->name = dlsym(carbonLib, #name) + + LOAD_QD_FUNC(GetPortCustomXFerProc); + LOAD_QD_FUNC(SetPortCustomXFerProc); + LOAD_QD_FUNC(OpenCursorComponent); + LOAD_QD_FUNC(CloseCursorComponent); + LOAD_QD_FUNC(SetCursorComponent); + LOAD_QD_FUNC(CursorComponentChanged); + LOAD_QD_FUNC(CursorComponentSetData); + LOAD_QD_FUNC(IsValidPort); + LOAD_QD_FUNC(GetPortPixMap); + LOAD_QD_FUNC(GetPortBitMapForCopyBits); + LOAD_QD_FUNC(GetPortBounds); + LOAD_QD_FUNC(GetPortForeColor); + LOAD_QD_FUNC(GetPortBackColor); + LOAD_QD_FUNC(GetPortOpColor); + LOAD_QD_FUNC(GetPortHiliteColor); + LOAD_QD_FUNC(GetPortGrafProcs); + LOAD_QD_FUNC(GetPortTextFont); + LOAD_QD_FUNC(GetPortTextFace); + LOAD_QD_FUNC(GetPortTextMode); + LOAD_QD_FUNC(GetPortTextSize); + LOAD_QD_FUNC(GetPortChExtra); + LOAD_QD_FUNC(GetPortFracHPenLocation); + LOAD_QD_FUNC(GetPortSpExtra); + LOAD_QD_FUNC(GetPortPenVisibility); + LOAD_QD_FUNC(GetPortVisibleRegion); + LOAD_QD_FUNC(GetPortClipRegion); + LOAD_QD_FUNC(GetPortBackPixPat); + LOAD_QD_FUNC(GetPortPenPixPat); + LOAD_QD_FUNC(GetPortFillPixPat); + LOAD_QD_FUNC(GetPortPenSize); + LOAD_QD_FUNC(GetPortPenMode); + LOAD_QD_FUNC(GetPortPenLocation); + LOAD_QD_FUNC(IsPortRegionBeingDefined); + LOAD_QD_FUNC(IsPortPictureBeingDefined); + LOAD_QD_FUNC(IsPortPolyBeingDefined); + LOAD_QD_FUNC(IsPortOffscreen); + LOAD_QD_FUNC(IsPortColor); + LOAD_QD_FUNC(SetPortBounds); + LOAD_QD_FUNC(SetPortOpColor); + LOAD_QD_FUNC(SetPortGrafProcs); + LOAD_QD_FUNC(SetPortVisibleRegion); + LOAD_QD_FUNC(SetPortClipRegion); + LOAD_QD_FUNC(SetPortPenPixPat); + LOAD_QD_FUNC(SetPortFillPixPat); + LOAD_QD_FUNC(SetPortBackPixPat); + LOAD_QD_FUNC(SetPortPenSize); + LOAD_QD_FUNC(SetPortPenMode); + LOAD_QD_FUNC(SetPortFracHPenLocation); + LOAD_QD_FUNC(GetPixBounds); + LOAD_QD_FUNC(GetPixDepth); + LOAD_QD_FUNC(GetQDGlobalsRandomSeed); + LOAD_QD_FUNC(GetQDGlobalsScreenBits); + LOAD_QD_FUNC(GetQDGlobalsArrow); + LOAD_QD_FUNC(GetQDGlobalsDarkGray); + LOAD_QD_FUNC(GetQDGlobalsLightGray); + LOAD_QD_FUNC(GetQDGlobalsGray); + LOAD_QD_FUNC(GetQDGlobalsBlack); + LOAD_QD_FUNC(GetQDGlobalsWhite); + LOAD_QD_FUNC(GetQDGlobalsThePort); + LOAD_QD_FUNC(SetQDGlobalsRandomSeed); + LOAD_QD_FUNC(SetQDGlobalsArrow); + LOAD_QD_FUNC(GetRegionBounds); + LOAD_QD_FUNC(IsRegionRectangular); + LOAD_QD_FUNC(CreateNewPort); + LOAD_QD_FUNC(DisposePort); + LOAD_QD_FUNC(SetQDError); + LOAD_QD_FUNC(QDIsPortBuffered); + LOAD_QD_FUNC(QDIsPortBufferDirty); + LOAD_QD_FUNC(QDFlushPortBuffer); + LOAD_QD_FUNC(QDGetDirtyRegion); + LOAD_QD_FUNC(QDSetDirtyRegion); + LOAD_QD_FUNC(CreateCGContextForPort); + LOAD_QD_FUNC(ClipCGContextToRegion); + LOAD_QD_FUNC(SyncCGContextOriginWithPort); + LOAD_QD_FUNC(CreateNewPortForCGDisplayID); + LOAD_QD_FUNC(QDDisplayWaitCursor); + LOAD_QD_FUNC(QDSetPatternOrigin); + LOAD_QD_FUNC(QDGetPatternOrigin); + LOAD_QD_FUNC(LMGetScrVRes); + LOAD_QD_FUNC(LMSetScrVRes); + LOAD_QD_FUNC(LMGetScrHRes); + LOAD_QD_FUNC(LMSetScrHRes); + LOAD_QD_FUNC(LMGetMainDevice); + LOAD_QD_FUNC(LMSetMainDevice); + LOAD_QD_FUNC(LMGetDeviceList); + LOAD_QD_FUNC(LMSetDeviceList); + LOAD_QD_FUNC(LMGetQDColors); + LOAD_QD_FUNC(LMSetQDColors); + LOAD_QD_FUNC(LMGetWidthListHand); + LOAD_QD_FUNC(LMSetWidthListHand); + LOAD_QD_FUNC(LMGetHiliteMode); + LOAD_QD_FUNC(LMSetHiliteMode); + LOAD_QD_FUNC(LMGetWidthPtr); + LOAD_QD_FUNC(LMSetWidthPtr); + LOAD_QD_FUNC(LMGetWidthTabHandle); + LOAD_QD_FUNC(LMSetWidthTabHandle); + LOAD_QD_FUNC(LMGetLastSPExtra); + LOAD_QD_FUNC(LMSetLastSPExtra); + LOAD_QD_FUNC(LMGetLastFOND); + LOAD_QD_FUNC(LMSetLastFOND); + LOAD_QD_FUNC(LMGetFractEnable); + LOAD_QD_FUNC(LMSetFractEnable); + LOAD_QD_FUNC(LMGetTheGDevice); + LOAD_QD_FUNC(LMSetTheGDevice); + LOAD_QD_FUNC(LMGetHiliteRGB); + LOAD_QD_FUNC(LMSetHiliteRGB); + LOAD_QD_FUNC(LMGetCursorNew); + LOAD_QD_FUNC(LMSetCursorNew); + LOAD_QD_FUNC(QDRegionToRects); + LOAD_QD_FUNC(SetPort); + LOAD_QD_FUNC(GetPort); + LOAD_QD_FUNC(GrafDevice); + LOAD_QD_FUNC(SetPortBits); + LOAD_QD_FUNC(PortSize); + LOAD_QD_FUNC(MovePortTo); + LOAD_QD_FUNC(SetOrigin); + LOAD_QD_FUNC(SetClip); + LOAD_QD_FUNC(GetClip); + LOAD_QD_FUNC(ClipRect); + LOAD_QD_FUNC(BackPat); + LOAD_QD_FUNC(InitCursor); + LOAD_QD_FUNC(SetCursor); + LOAD_QD_FUNC(HideCursor); + LOAD_QD_FUNC(ShowCursor); + LOAD_QD_FUNC(ObscureCursor); + LOAD_QD_FUNC(HidePen); + LOAD_QD_FUNC(ShowPen); + LOAD_QD_FUNC(GetPen); + LOAD_QD_FUNC(GetPenState); + LOAD_QD_FUNC(SetPenState); + LOAD_QD_FUNC(PenSize); + LOAD_QD_FUNC(PenMode); + LOAD_QD_FUNC(PenPat); + LOAD_QD_FUNC(PenNormal); + LOAD_QD_FUNC(MoveTo); + LOAD_QD_FUNC(Move); + LOAD_QD_FUNC(LineTo); + LOAD_QD_FUNC(Line); + LOAD_QD_FUNC(ForeColor); + LOAD_QD_FUNC(BackColor); + LOAD_QD_FUNC(ColorBit); + LOAD_QD_FUNC(SetRect); + LOAD_QD_FUNC(OffsetRect); + LOAD_QD_FUNC(InsetRect); + LOAD_QD_FUNC(SectRect); + LOAD_QD_FUNC(UnionRect); + LOAD_QD_FUNC(EqualRect); + LOAD_QD_FUNC(EmptyRect); + LOAD_QD_FUNC(FrameRect); + LOAD_QD_FUNC(PaintRect); + LOAD_QD_FUNC(EraseRect); + LOAD_QD_FUNC(InvertRect); + LOAD_QD_FUNC(FillRect); + LOAD_QD_FUNC(FrameOval); + LOAD_QD_FUNC(PaintOval); + LOAD_QD_FUNC(EraseOval); + LOAD_QD_FUNC(InvertOval); + LOAD_QD_FUNC(FillOval); + LOAD_QD_FUNC(FrameRoundRect); + LOAD_QD_FUNC(PaintRoundRect); + LOAD_QD_FUNC(EraseRoundRect); + LOAD_QD_FUNC(InvertRoundRect); + LOAD_QD_FUNC(FillRoundRect); + LOAD_QD_FUNC(FrameArc); + LOAD_QD_FUNC(PaintArc); + LOAD_QD_FUNC(EraseArc); + LOAD_QD_FUNC(InvertArc); + LOAD_QD_FUNC(FillArc); + LOAD_QD_FUNC(NewRgn); + LOAD_QD_FUNC(OpenRgn); + LOAD_QD_FUNC(CloseRgn); + LOAD_QD_FUNC(BitMapToRegion); + LOAD_QD_FUNC(HandleToRgn); + LOAD_QD_FUNC(RgnToHandle); + LOAD_QD_FUNC(DisposeRgn); + LOAD_QD_FUNC(CopyRgn); + LOAD_QD_FUNC(SetEmptyRgn); + LOAD_QD_FUNC(SetRectRgn); + LOAD_QD_FUNC(RectRgn); + LOAD_QD_FUNC(OffsetRgn); + LOAD_QD_FUNC(InsetRgn); + LOAD_QD_FUNC(SectRgn); + LOAD_QD_FUNC(UnionRgn); + LOAD_QD_FUNC(DiffRgn); + LOAD_QD_FUNC(XorRgn); + LOAD_QD_FUNC(RectInRgn); + LOAD_QD_FUNC(EqualRgn); + LOAD_QD_FUNC(EmptyRgn); + LOAD_QD_FUNC(FrameRgn); + LOAD_QD_FUNC(PaintRgn); + LOAD_QD_FUNC(EraseRgn); + LOAD_QD_FUNC(InvertRgn); + LOAD_QD_FUNC(FillRgn); + LOAD_QD_FUNC(ScrollRect); + LOAD_QD_FUNC(CopyBits); + LOAD_QD_FUNC(SeedFill); + LOAD_QD_FUNC(CalcMask); + LOAD_QD_FUNC(CopyMask); + LOAD_QD_FUNC(OpenPicture); + LOAD_QD_FUNC(PicComment); + LOAD_QD_FUNC(ClosePicture); + LOAD_QD_FUNC(DrawPicture); + LOAD_QD_FUNC(KillPicture); + LOAD_QD_FUNC(OpenPoly); + LOAD_QD_FUNC(ClosePoly); + LOAD_QD_FUNC(KillPoly); + LOAD_QD_FUNC(OffsetPoly); + LOAD_QD_FUNC(FramePoly); + LOAD_QD_FUNC(PaintPoly); + LOAD_QD_FUNC(ErasePoly); + LOAD_QD_FUNC(InvertPoly); + LOAD_QD_FUNC(FillPoly); + LOAD_QD_FUNC(SetPt); + LOAD_QD_FUNC(LocalToGlobal); + LOAD_QD_FUNC(GlobalToLocal); + LOAD_QD_FUNC(Random); + LOAD_QD_FUNC(StuffHex); + LOAD_QD_FUNC(GetPixel); + LOAD_QD_FUNC(ScalePt); + LOAD_QD_FUNC(MapPt); + LOAD_QD_FUNC(MapRect); + LOAD_QD_FUNC(MapRgn); + LOAD_QD_FUNC(MapPoly); + LOAD_QD_FUNC(SetStdProcs); + LOAD_QD_FUNC(StdRect); + LOAD_QD_FUNC(StdRRect); + LOAD_QD_FUNC(StdOval); + LOAD_QD_FUNC(StdArc); + LOAD_QD_FUNC(StdPoly); + LOAD_QD_FUNC(StdRgn); + LOAD_QD_FUNC(StdBits); + LOAD_QD_FUNC(StdComment); + LOAD_QD_FUNC(StdGetPic); + LOAD_QD_FUNC(StdPutPic); + LOAD_QD_FUNC(StdOpcode); + LOAD_QD_FUNC(AddPt); + LOAD_QD_FUNC(EqualPt); + LOAD_QD_FUNC(PtInRect); + LOAD_QD_FUNC(Pt2Rect); + LOAD_QD_FUNC(PtToAngle); + LOAD_QD_FUNC(SubPt); + LOAD_QD_FUNC(PtInRgn); + LOAD_QD_FUNC(StdLine); + LOAD_QD_FUNC(NewPixMap); + LOAD_QD_FUNC(DisposePixMap); + LOAD_QD_FUNC(CopyPixMap); + LOAD_QD_FUNC(NewPixPat); + LOAD_QD_FUNC(DisposePixPat); + LOAD_QD_FUNC(CopyPixPat); + LOAD_QD_FUNC(PenPixPat); + LOAD_QD_FUNC(BackPixPat); + LOAD_QD_FUNC(GetPixPat); + LOAD_QD_FUNC(MakeRGBPat); + LOAD_QD_FUNC(FillCRect); + LOAD_QD_FUNC(FillCOval); + LOAD_QD_FUNC(FillCRoundRect); + LOAD_QD_FUNC(FillCArc); + LOAD_QD_FUNC(FillCRgn); + LOAD_QD_FUNC(FillCPoly); + LOAD_QD_FUNC(RGBForeColor); + LOAD_QD_FUNC(RGBBackColor); + LOAD_QD_FUNC(SetCPixel); + LOAD_QD_FUNC(SetPortPix); + LOAD_QD_FUNC(GetCPixel); + LOAD_QD_FUNC(GetForeColor); + LOAD_QD_FUNC(GetBackColor); + LOAD_QD_FUNC(SeedCFill); + LOAD_QD_FUNC(CalcCMask); + LOAD_QD_FUNC(OpenCPicture); + LOAD_QD_FUNC(OpColor); + LOAD_QD_FUNC(HiliteColor); + LOAD_QD_FUNC(DisposeCTable); + LOAD_QD_FUNC(GetCTable); + LOAD_QD_FUNC(GetCCursor); + LOAD_QD_FUNC(SetCCursor); + LOAD_QD_FUNC(AllocCursor); + LOAD_QD_FUNC(DisposeCCursor); + LOAD_QD_FUNC(SetStdCProcs); + LOAD_QD_FUNC(GetMaxDevice); + LOAD_QD_FUNC(GetCTSeed); + LOAD_QD_FUNC(GetDeviceList); + LOAD_QD_FUNC(GetMainDevice); + LOAD_QD_FUNC(GetNextDevice); + LOAD_QD_FUNC(TestDeviceAttribute); + LOAD_QD_FUNC(SetDeviceAttribute); + LOAD_QD_FUNC(InitGDevice); + LOAD_QD_FUNC(NewGDevice); + LOAD_QD_FUNC(DisposeGDevice); + LOAD_QD_FUNC(SetGDevice); + LOAD_QD_FUNC(GetGDevice); + LOAD_QD_FUNC(Color2Index); + LOAD_QD_FUNC(Index2Color); + LOAD_QD_FUNC(InvertColor); + LOAD_QD_FUNC(RealColor); + LOAD_QD_FUNC(GetSubTable); + LOAD_QD_FUNC(MakeITable); + LOAD_QD_FUNC(AddSearch); + LOAD_QD_FUNC(AddComp); + LOAD_QD_FUNC(DelSearch); + LOAD_QD_FUNC(DelComp); + LOAD_QD_FUNC(SetClientID); + LOAD_QD_FUNC(ProtectEntry); + LOAD_QD_FUNC(ReserveEntry); + LOAD_QD_FUNC(SetEntries); + LOAD_QD_FUNC(SaveEntries); + LOAD_QD_FUNC(RestoreEntries); + LOAD_QD_FUNC(QDError); + LOAD_QD_FUNC(CopyDeepMask); + LOAD_QD_FUNC(DeviceLoop); + LOAD_QD_FUNC(GetMaskTable); + LOAD_QD_FUNC(GetPattern); + LOAD_QD_FUNC(GetCursor); + LOAD_QD_FUNC(GetPicture); + LOAD_QD_FUNC(DeltaPoint); + LOAD_QD_FUNC(ShieldCursor); + LOAD_QD_FUNC(ScreenRes); + LOAD_QD_FUNC(GetIndPattern); + LOAD_QD_FUNC(deltapoint); + LOAD_QD_FUNC(PackBits); + LOAD_QD_FUNC(UnpackBits); + LOAD_QD_FUNC(SlopeFromAngle); + LOAD_QD_FUNC(AngleFromSlope); + +#undef LOAD_QD_FUNC +} + +static MwLL quickdraw_create(MwLL parent, int x, int y, int width, int height) { + return NULL; +}; +static void quickdraw_destroy(MwLL handle) { + return; +}; +static void quickdraw_polygon(MwLL handle, MwPoint* points, int points_count, MwLLColor color) { + return; +}; +static MwLLColor quickdraw_allocColor(MwLL handle, int r, int g, int b) { + return NULL; +}; +static void quickdraw_freeColor(MwLLColor color) { + return; +}; +static void quickdraw_getXYWH(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h) { + return; +}; +static void quickdraw_setXY(MwLL handle, int x, int y) { + return; +}; +static void quickdraw_setWH(MwLL handle, int w, int h) { + return; +}; +static void quickdraw_setTitle(MwLL handle, const char* title) { + return; +}; +static int quickdraw_pending(MwLL handle) { + return 0; +}; +static void quickdraw_nextEvent(MwLL handle) { + return; +}; +static MwLLPixmap quickdraw_createPixmap(MwLL handle, unsigned char* data, int width, int height) { + return NULL; +}; +static void quickdraw_drawPixmap(MwLL handle, MwRect* rect, MwLLPixmap pixmap) { + return; +}; +static void quickdraw_setIcon(MwLL handle, MwLLPixmap pixmap) { + return; +}; +static void quickdraw_forceRender(MwLL handle) { + return; +}; + +static mac_backend quickdraw_backend = { + .create = quickdraw_create, + .destroy = quickdraw_destroy, + .polygon = quickdraw_polygon, + .allocColor = quickdraw_allocColor, + .freeColor = quickdraw_freeColor, + .getXYWH = quickdraw_getXYWH, + .setXY = quickdraw_setXY, + .setWH = quickdraw_setWH, + .setTitle = quickdraw_setTitle, + .pending = quickdraw_pending, + .nextEvent = quickdraw_nextEvent, + .createPixmap = quickdraw_createPixmap, + .drawPixmap = quickdraw_drawPixmap, + .setIcon = quickdraw_setIcon, + .forceRender = quickdraw_forceRender, +}; + +mac_backend getQuickDrawBackend(void) { + return quickdraw_backend; +}; diff --git a/src/backend/mac/quickDraw.h b/src/backend/mac/quickDraw.h new file mode 100644 index 0000000..b9e6575 --- /dev/null +++ b/src/backend/mac/quickDraw.h @@ -0,0 +1,335 @@ +#ifndef __QUICKDRAW_H__ +#define __QUICKDRAW_H__ + +#include "preQuartz.h" +#include "mac.h" + +struct mac_backend_userdata_t { + PFN_GetPortCustomXFerProc GetPortCustomXFerProc; + PFN_SetPortCustomXFerProc SetPortCustomXFerProc; + PFN_OpenCursorComponent OpenCursorComponent; + PFN_CloseCursorComponent CloseCursorComponent; + PFN_SetCursorComponent SetCursorComponent; + PFN_CursorComponentChanged CursorComponentChanged; + PFN_CursorComponentSetData CursorComponentSetData; + PFN_IsValidPort IsValidPort; + PFN_GetPortPixMap GetPortPixMap; + PFN_GetPortBitMapForCopyBits GetPortBitMapForCopyBits; + PFN_GetPortBounds GetPortBounds; + PFN_GetPortForeColor GetPortForeColor; + PFN_GetPortBackColor GetPortBackColor; + PFN_GetPortOpColor GetPortOpColor; + PFN_GetPortHiliteColor GetPortHiliteColor; + PFN_GetPortGrafProcs GetPortGrafProcs; + PFN_GetPortTextFont GetPortTextFont; + PFN_GetPortTextFace GetPortTextFace; + PFN_GetPortTextMode GetPortTextMode; + PFN_GetPortTextSize GetPortTextSize; + PFN_GetPortChExtra GetPortChExtra; + PFN_GetPortFracHPenLocation GetPortFracHPenLocation; + PFN_GetPortSpExtra GetPortSpExtra; + PFN_GetPortPenVisibility GetPortPenVisibility; + PFN_GetPortVisibleRegion GetPortVisibleRegion; + PFN_GetPortClipRegion GetPortClipRegion; + PFN_GetPortBackPixPat GetPortBackPixPat; + PFN_GetPortPenPixPat GetPortPenPixPat; + PFN_GetPortFillPixPat GetPortFillPixPat; + PFN_GetPortPenSize GetPortPenSize; + PFN_GetPortPenMode GetPortPenMode; + PFN_GetPortPenLocation GetPortPenLocation; + PFN_IsPortRegionBeingDefined IsPortRegionBeingDefined; + PFN_IsPortPictureBeingDefined IsPortPictureBeingDefined; + PFN_IsPortPolyBeingDefined IsPortPolyBeingDefined; + PFN_IsPortOffscreen IsPortOffscreen; + PFN_IsPortColor IsPortColor; + PFN_SetPortBounds SetPortBounds; + PFN_SetPortOpColor SetPortOpColor; + PFN_SetPortGrafProcs SetPortGrafProcs; + PFN_SetPortVisibleRegion SetPortVisibleRegion; + PFN_SetPortClipRegion SetPortClipRegion; + PFN_SetPortPenPixPat SetPortPenPixPat; + PFN_SetPortFillPixPat SetPortFillPixPat; + PFN_SetPortBackPixPat SetPortBackPixPat; + PFN_SetPortPenSize SetPortPenSize; + PFN_SetPortPenMode SetPortPenMode; + PFN_SetPortFracHPenLocation SetPortFracHPenLocation; + PFN_GetPixBounds GetPixBounds; + PFN_GetPixDepth GetPixDepth; + PFN_GetQDGlobalsRandomSeed GetQDGlobalsRandomSeed; + PFN_GetQDGlobalsScreenBits GetQDGlobalsScreenBits; + PFN_GetQDGlobalsArrow GetQDGlobalsArrow; + PFN_GetQDGlobalsDarkGray GetQDGlobalsDarkGray; + PFN_GetQDGlobalsLightGray GetQDGlobalsLightGray; + PFN_GetQDGlobalsGray GetQDGlobalsGray; + PFN_GetQDGlobalsBlack GetQDGlobalsBlack; + PFN_GetQDGlobalsWhite GetQDGlobalsWhite; + PFN_GetQDGlobalsThePort GetQDGlobalsThePort; + PFN_SetQDGlobalsRandomSeed SetQDGlobalsRandomSeed; + PFN_SetQDGlobalsArrow SetQDGlobalsArrow; + PFN_GetRegionBounds GetRegionBounds; + PFN_IsRegionRectangular IsRegionRectangular; + PFN_CreateNewPort CreateNewPort; + PFN_DisposePort DisposePort; + PFN_SetQDError SetQDError; + PFN_QDIsPortBuffered QDIsPortBuffered; + PFN_QDIsPortBufferDirty QDIsPortBufferDirty; + PFN_QDFlushPortBuffer QDFlushPortBuffer; + PFN_QDGetDirtyRegion QDGetDirtyRegion; + PFN_QDSetDirtyRegion QDSetDirtyRegion; + PFN_CreateCGContextForPort CreateCGContextForPort; + PFN_ClipCGContextToRegion ClipCGContextToRegion; + PFN_SyncCGContextOriginWithPort SyncCGContextOriginWithPort; + PFN_CreateNewPortForCGDisplayID CreateNewPortForCGDisplayID; + PFN_QDDisplayWaitCursor QDDisplayWaitCursor; + PFN_QDSetPatternOrigin QDSetPatternOrigin; + PFN_QDGetPatternOrigin QDGetPatternOrigin; + PFN_LMGetScrVRes LMGetScrVRes; + PFN_LMSetScrVRes LMSetScrVRes; + PFN_LMGetScrHRes LMGetScrHRes; + PFN_LMSetScrHRes LMSetScrHRes; + PFN_LMGetMainDevice LMGetMainDevice; + PFN_LMSetMainDevice LMSetMainDevice; + PFN_LMGetDeviceList LMGetDeviceList; + PFN_LMSetDeviceList LMSetDeviceList; + PFN_LMGetQDColors LMGetQDColors; + PFN_LMSetQDColors LMSetQDColors; + PFN_LMGetWidthListHand LMGetWidthListHand; + PFN_LMSetWidthListHand LMSetWidthListHand; + PFN_LMGetHiliteMode LMGetHiliteMode; + PFN_LMSetHiliteMode LMSetHiliteMode; + PFN_LMGetWidthPtr LMGetWidthPtr; + PFN_LMSetWidthPtr LMSetWidthPtr; + PFN_LMGetWidthTabHandle LMGetWidthTabHandle; + PFN_LMSetWidthTabHandle LMSetWidthTabHandle; + PFN_LMGetLastSPExtra LMGetLastSPExtra; + PFN_LMSetLastSPExtra LMSetLastSPExtra; + PFN_LMGetLastFOND LMGetLastFOND; + PFN_LMSetLastFOND LMSetLastFOND; + PFN_LMGetFractEnable LMGetFractEnable; + PFN_LMSetFractEnable LMSetFractEnable; + PFN_LMGetTheGDevice LMGetTheGDevice; + PFN_LMSetTheGDevice LMSetTheGDevice; + PFN_LMGetHiliteRGB LMGetHiliteRGB; + PFN_LMSetHiliteRGB LMSetHiliteRGB; + PFN_LMGetCursorNew LMGetCursorNew; + PFN_LMSetCursorNew LMSetCursorNew; + PFN_QDRegionToRects QDRegionToRects; + PFN_SetPort SetPort; + PFN_GetPort GetPort; + PFN_GrafDevice GrafDevice; + PFN_SetPortBits SetPortBits; + PFN_PortSize PortSize; + PFN_MovePortTo MovePortTo; + PFN_SetOrigin SetOrigin; + PFN_SetClip SetClip; + PFN_GetClip GetClip; + PFN_ClipRect ClipRect; + PFN_BackPat BackPat; + PFN_InitCursor InitCursor; + PFN_SetCursor SetCursor; + PFN_HideCursor HideCursor; + PFN_ShowCursor ShowCursor; + PFN_ObscureCursor ObscureCursor; + PFN_HidePen HidePen; + PFN_ShowPen ShowPen; + PFN_GetPen GetPen; + PFN_GetPenState GetPenState; + PFN_SetPenState SetPenState; + PFN_PenSize PenSize; + PFN_PenMode PenMode; + PFN_PenPat PenPat; + PFN_PenNormal PenNormal; + PFN_MoveTo MoveTo; + PFN_Move Move; + PFN_LineTo LineTo; + PFN_Line Line; + PFN_ForeColor ForeColor; + PFN_BackColor BackColor; + PFN_ColorBit ColorBit; + PFN_SetRect SetRect; + PFN_OffsetRect OffsetRect; + PFN_InsetRect InsetRect; + PFN_SectRect SectRect; + PFN_UnionRect UnionRect; + PFN_EqualRect EqualRect; + PFN_EmptyRect EmptyRect; + PFN_FrameRect FrameRect; + PFN_PaintRect PaintRect; + PFN_EraseRect EraseRect; + PFN_InvertRect InvertRect; + PFN_FillRect FillRect; + PFN_FrameOval FrameOval; + PFN_PaintOval PaintOval; + PFN_EraseOval EraseOval; + PFN_InvertOval InvertOval; + PFN_FillOval FillOval; + PFN_FrameRoundRect FrameRoundRect; + PFN_PaintRoundRect PaintRoundRect; + PFN_EraseRoundRect EraseRoundRect; + PFN_InvertRoundRect InvertRoundRect; + PFN_FillRoundRect FillRoundRect; + PFN_FrameArc FrameArc; + PFN_PaintArc PaintArc; + PFN_EraseArc EraseArc; + PFN_InvertArc InvertArc; + PFN_FillArc FillArc; + PFN_NewRgn NewRgn; + PFN_OpenRgn OpenRgn; + PFN_CloseRgn CloseRgn; + PFN_BitMapToRegion BitMapToRegion; + PFN_HandleToRgn HandleToRgn; + PFN_RgnToHandle RgnToHandle; + PFN_DisposeRgn DisposeRgn; + PFN_CopyRgn CopyRgn; + PFN_SetEmptyRgn SetEmptyRgn; + PFN_SetRectRgn SetRectRgn; + PFN_RectRgn RectRgn; + PFN_OffsetRgn OffsetRgn; + PFN_InsetRgn InsetRgn; + PFN_SectRgn SectRgn; + PFN_UnionRgn UnionRgn; + PFN_DiffRgn DiffRgn; + PFN_XorRgn XorRgn; + PFN_RectInRgn RectInRgn; + PFN_EqualRgn EqualRgn; + PFN_EmptyRgn EmptyRgn; + PFN_FrameRgn FrameRgn; + PFN_PaintRgn PaintRgn; + PFN_EraseRgn EraseRgn; + PFN_InvertRgn InvertRgn; + PFN_FillRgn FillRgn; + PFN_ScrollRect ScrollRect; + PFN_CopyBits CopyBits; + PFN_SeedFill SeedFill; + PFN_CalcMask CalcMask; + PFN_CopyMask CopyMask; + PFN_OpenPicture OpenPicture; + PFN_PicComment PicComment; + PFN_ClosePicture ClosePicture; + PFN_DrawPicture DrawPicture; + PFN_KillPicture KillPicture; + PFN_OpenPoly OpenPoly; + PFN_ClosePoly ClosePoly; + PFN_KillPoly KillPoly; + PFN_OffsetPoly OffsetPoly; + PFN_FramePoly FramePoly; + PFN_PaintPoly PaintPoly; + PFN_ErasePoly ErasePoly; + PFN_InvertPoly InvertPoly; + PFN_FillPoly FillPoly; + PFN_SetPt SetPt; + PFN_LocalToGlobal LocalToGlobal; + PFN_GlobalToLocal GlobalToLocal; + PFN_Random Random; + PFN_StuffHex StuffHex; + PFN_GetPixel GetPixel; + PFN_ScalePt ScalePt; + PFN_MapPt MapPt; + PFN_MapRect MapRect; + PFN_MapRgn MapRgn; + PFN_MapPoly MapPoly; + PFN_SetStdProcs SetStdProcs; + PFN_StdRect StdRect; + PFN_StdRRect StdRRect; + PFN_StdOval StdOval; + PFN_StdArc StdArc; + PFN_StdPoly StdPoly; + PFN_StdRgn StdRgn; + PFN_StdBits StdBits; + PFN_StdComment StdComment; + PFN_StdGetPic StdGetPic; + PFN_StdPutPic StdPutPic; + PFN_StdOpcode StdOpcode; + PFN_AddPt AddPt; + PFN_EqualPt EqualPt; + PFN_PtInRect PtInRect; + PFN_Pt2Rect Pt2Rect; + PFN_PtToAngle PtToAngle; + PFN_SubPt SubPt; + PFN_PtInRgn PtInRgn; + PFN_StdLine StdLine; + PFN_NewPixMap NewPixMap; + PFN_DisposePixMap DisposePixMap; + PFN_CopyPixMap CopyPixMap; + PFN_NewPixPat NewPixPat; + PFN_DisposePixPat DisposePixPat; + PFN_CopyPixPat CopyPixPat; + PFN_PenPixPat PenPixPat; + PFN_BackPixPat BackPixPat; + PFN_GetPixPat GetPixPat; + PFN_MakeRGBPat MakeRGBPat; + PFN_FillCRect FillCRect; + PFN_FillCOval FillCOval; + PFN_FillCRoundRect FillCRoundRect; + PFN_FillCArc FillCArc; + PFN_FillCRgn FillCRgn; + PFN_FillCPoly FillCPoly; + PFN_RGBForeColor RGBForeColor; + PFN_RGBBackColor RGBBackColor; + PFN_SetCPixel SetCPixel; + PFN_SetPortPix SetPortPix; + PFN_GetCPixel GetCPixel; + PFN_GetForeColor GetForeColor; + PFN_GetBackColor GetBackColor; + PFN_SeedCFill SeedCFill; + PFN_CalcCMask CalcCMask; + PFN_OpenCPicture OpenCPicture; + PFN_OpColor OpColor; + PFN_HiliteColor HiliteColor; + PFN_DisposeCTable DisposeCTable; + PFN_GetCTable GetCTable; + PFN_GetCCursor GetCCursor; + PFN_SetCCursor SetCCursor; + PFN_AllocCursor AllocCursor; + PFN_DisposeCCursor DisposeCCursor; + PFN_SetStdCProcs SetStdCProcs; + PFN_GetMaxDevice GetMaxDevice; + PFN_GetCTSeed GetCTSeed; + PFN_GetDeviceList GetDeviceList; + PFN_GetMainDevice GetMainDevice; + PFN_GetNextDevice GetNextDevice; + PFN_TestDeviceAttribute TestDeviceAttribute; + PFN_SetDeviceAttribute SetDeviceAttribute; + PFN_InitGDevice InitGDevice; + PFN_NewGDevice NewGDevice; + PFN_DisposeGDevice DisposeGDevice; + PFN_SetGDevice SetGDevice; + PFN_GetGDevice GetGDevice; + PFN_Color2Index Color2Index; + PFN_Index2Color Index2Color; + PFN_InvertColor InvertColor; + PFN_RealColor RealColor; + PFN_GetSubTable GetSubTable; + PFN_MakeITable MakeITable; + PFN_AddSearch AddSearch; + PFN_AddComp AddComp; + PFN_DelSearch DelSearch; + PFN_DelComp DelComp; + PFN_SetClientID SetClientID; + PFN_ProtectEntry ProtectEntry; + PFN_ReserveEntry ReserveEntry; + PFN_SetEntries SetEntries; + PFN_SaveEntries SaveEntries; + PFN_RestoreEntries RestoreEntries; + PFN_QDError QDError; + PFN_CopyDeepMask CopyDeepMask; + PFN_DeviceLoop DeviceLoop; + PFN_GetMaskTable GetMaskTable; + PFN_GetPattern GetPattern; + PFN_GetCursor GetCursor; + PFN_GetPicture GetPicture; + PFN_DeltaPoint DeltaPoint; + PFN_ShieldCursor ShieldCursor; + PFN_ScreenRes ScreenRes; + PFN_GetIndPattern GetIndPattern; + PFN_deltapoint deltapoint; + PFN_PackBits PackBits; + PFN_UnpackBits UnpackBits; + PFN_SlopeFromAngle SlopeFromAngle; + PFN_AngleFromSlope AngleFromSlope; +}; + +void quickDrawBackendUserDataInit(mac_backend_userdata); +mac_backend getQuickDrawBackend(void); + +#endif