📄 components.h
字号:
// Basic types:
typedef char * Ptr;
typedef Ptr * Handle;
typedef long Size;
typedef unsigned char Boolean;
typedef unsigned char Str31[32];
typedef long Fixed;
typedef long OSErr;
typedef int OSType;
typedef long ComponentResult;
typedef unsigned char UInt8;
typedef signed char SInt8;
typedef unsigned short UInt16;
typedef signed short SInt16;
typedef unsigned long UInt32;
typedef signed long SInt32;
#define FOUR_CHAR_CODE(a,b,c,d) ((unsigned long)(a)<<24 | (unsigned long)(b)<<16 | (unsigned long)(c)<<8 | (unsigned long)(d)) /* otherwise compiler will complain about values with high bit set */
// codec private shit:
typedef void *GlobalsPtr;
typedef void **Globals;
//==================== COMPONENTS ===========================
struct __attribute__((__packed__)) ComponentParameters {
UInt8 flags; /* call modifiers: sync/async, deferred, immed, etc */
UInt8 paramSize; /* size in bytes of actual parameters passed to this call */
short what; /* routine selector, negative for Component management calls */
long params[1]; /* actual parameters for the indicated routine */
};
typedef struct ComponentParameters ComponentParameters;
struct __attribute__((__packed__)) ComponentDescription {
OSType componentType; /* A unique 4-byte code indentifying the command set */
OSType componentSubType; /* Particular flavor of this instance */
OSType componentManufacturer; /* Vendor indentification */
unsigned long componentFlags; /* 8 each for Component,Type,SubType,Manuf/revision */
unsigned long componentFlagsMask; /* Mask for specifying which flags to consider in search, zero during registration */
};
typedef struct ComponentDescription ComponentDescription;
struct __attribute__((__packed__)) ResourceSpec {
OSType resType; /* 4-byte code */
short resID; /* */
};
typedef struct ResourceSpec ResourceSpec;
struct __attribute__((__packed__)) ComponentResource {
ComponentDescription cd; /* Registration parameters */
ResourceSpec component; /* resource where Component code is found */
ResourceSpec componentName; /* name string resource */
ResourceSpec componentInfo; /* info string resource */
ResourceSpec componentIcon; /* icon resource */
};
typedef struct ComponentResource ComponentResource;
typedef ComponentResource * ComponentResourcePtr;
typedef ComponentResourcePtr * ComponentResourceHandle;
struct __attribute__((__packed__)) ComponentRecord {
long data[1];
};
typedef struct ComponentRecord ComponentRecord;
typedef ComponentRecord * Component;
struct __attribute__((__packed__)) ComponentInstanceRecord {
long data[1];
};
typedef struct ComponentInstanceRecord ComponentInstanceRecord;
typedef ComponentInstanceRecord * ComponentInstance;
// ========================= QUICKDRAW =========================
struct __attribute__((__packed__)) Rect {
short top;
short left;
short bottom;
short right;
};
typedef struct Rect Rect;
typedef Rect * RectPtr;
struct __attribute__((__packed__)) RGBColor {
unsigned short red; /*magnitude of red component*/
unsigned short green; /*magnitude of green component*/
unsigned short blue; /*magnitude of blue component*/
};
typedef struct RGBColor RGBColor;
typedef RGBColor * RGBColorPtr;
typedef RGBColorPtr * RGBColorHdl;
struct __attribute__((__packed__)) ColorSpec {
short value; /*index or other value*/
RGBColor rgb; /*true color*/
};
typedef struct ColorSpec ColorSpec;
typedef ColorSpec * ColorSpecPtr;
typedef ColorSpec CSpecArray[1];
struct __attribute__((__packed__)) ColorTable {
long ctSeed; /*unique identifier for table*/
short ctFlags; /*high bit: 0 = PixMap; 1 = device*/
short ctSize; /*number of entries in CTTable*/
CSpecArray ctTable; /*array [0..0] of ColorSpec*/
};
typedef struct ColorTable ColorTable;
typedef ColorTable * CTabPtr;
typedef CTabPtr * CTabHandle;
struct __attribute__((__packed__)) MatrixRecord {
Fixed matrix[3][3];
};
typedef struct MatrixRecord MatrixRecord;
typedef MatrixRecord * MatrixRecordPtr;
typedef long ImageSequence;
typedef OSType CodecType;
typedef unsigned short CodecFlags;
typedef unsigned long CodecQ;
struct __attribute__((__packed__)) ImageDescription {
long idSize; /* total size of ImageDescription including extra data ( CLUTs and other per sequence data ) */
CodecType cType; /* what kind of codec compressed this data */
long resvd1; /* reserved for Apple use */
short resvd2; /* reserved for Apple use */
short dataRefIndex; /* set to zero */
short version; /* which version is this data */
short revisionLevel; /* what version of that codec did this */
long vendor; /* whose codec compressed this data */
CodecQ temporalQuality; /* what was the temporal quality factor */
CodecQ spatialQuality; /* what was the spatial quality factor */
short width; /* how many pixels wide is this data */
short height; /* how many pixels high is this data */
Fixed hRes; /* horizontal resolution */
Fixed vRes; /* vertical resolution */
long dataSize; /* if known, the size of data for this image descriptor */
short frameCount; /* number of frames this description applies to */
Str31 name; /* name of codec ( in case not installed ) */
short depth; /* what depth is this data (1-32) or ( 33-40 grayscale ) */
short clutID; /* clut id or if 0 clut follows or -1 if no clut */
};
typedef struct ImageDescription ImageDescription;
typedef ImageDescription * ImageDescriptionPtr;
typedef ImageDescriptionPtr * ImageDescriptionHandle;
/* values for PixMap.pixelFormat*/
enum {
k16LE555PixelFormat = FOUR_CHAR_CODE('L','5','5','5'), /* 16 bit LE rgb 555 (PC)*/
k16LE5551PixelFormat = FOUR_CHAR_CODE('5','5','5','1'), /* 16 bit LE rgb 5551*/
k16BE565PixelFormat = FOUR_CHAR_CODE('B','5','6','5'), /* 16 bit BE rgb 565*/
k16LE565PixelFormat = FOUR_CHAR_CODE('L','5','6','5'), /* 16 bit LE rgb 565*/
k24BGRPixelFormat = FOUR_CHAR_CODE('2','4','B','G'), /* 24 bit bgr */
k32BGRAPixelFormat = FOUR_CHAR_CODE('B','G','R','A'), /* 32 bit bgra (Matrox)*/
k32ABGRPixelFormat = FOUR_CHAR_CODE('A','B','G','R'), /* 32 bit abgr */
k32RGBAPixelFormat = FOUR_CHAR_CODE('R','G','B','A'), /* 32 bit rgba */
kYUVSPixelFormat = FOUR_CHAR_CODE('y','u','v','s'), /* YUV 4:2:2 byte ordering 16-unsigned = 'YUY2'*/
kYUVUPixelFormat = FOUR_CHAR_CODE('y','u','v','u'), /* YUV 4:2:2 byte ordering 16-signed*/
kYVU9PixelFormat = FOUR_CHAR_CODE('Y','V','U','9'), /* YVU9 Planar 9*/
kYUV411PixelFormat = FOUR_CHAR_CODE('Y','4','1','1'), /* YUV 4:1:1 Interleaved 16*/
kYVYU422PixelFormat = FOUR_CHAR_CODE('Y','V','Y','U'), /* YVYU 4:2:2 byte ordering 16*/
kUYVY422PixelFormat = FOUR_CHAR_CODE('U','Y','V','Y'), /* UYVY 4:2:2 byte ordering 16*/
kYUV211PixelFormat = FOUR_CHAR_CODE('Y','2','1','1'), /* YUV 2:1:1 Packed 8*/
k2vuyPixelFormat = FOUR_CHAR_CODE('2','v','u','y') /* UYVY 4:2:2 byte ordering 16*/
};
struct __attribute__((__packed__)) PixMapExtension {
long extSize; /*size of struct, duh!*/
unsigned long pmBits; /*pixmap attributes bitfield*/
void * pmGD; /*this is a GDHandle*/
long pmSeed;
Fixed gammaLevel; /*pixmap gammalevel*/
Fixed requestedGammaLevel;
unsigned long reserved2;
long longRowBytes; /*used when rowBytes > 16382*/
unsigned long signature;
Handle baseAddrHandle;
};
typedef struct PixMapExtension PixMapExtension;
typedef PixMapExtension * PixMapExtPtr;
typedef PixMapExtPtr * PixMapExtHandle;
struct __attribute__((__packed__)) PixMap {
Ptr baseAddr; /*pointer to pixels*/
short rowBytes; /*offset to next line*/
Rect bounds; /*encloses bitmap*/
short pmVersion; /*pixMap version number*/
short packType; /*defines packing format*/
long packSize; /*length of pixel data*/
Fixed hRes; /*horiz. resolution (ppi)*/
Fixed vRes; /*vert. resolution (ppi)*/
short pixelType; /*defines pixel type*/
short pixelSize; /*# bits in pixel*/
short cmpCount; /*# components in pixel*/
short cmpSize; /*# bits per component*/
OSType pixelFormat; /*fourCharCode representation*/
CTabHandle pmTable; /*color map for this pixMap*/
PixMapExtHandle pmExt; /*Handle to pixMap extension*/
};
typedef struct PixMap PixMap;
typedef PixMap * PixMapPtr;
typedef PixMapPtr * PixMapHandle;
struct __attribute__((__packed__)) BitMap {
Ptr baseAddr;
short rowBytes;
Rect bounds;
};
typedef struct BitMap BitMap;
typedef BitMap * BitMapPtr;
typedef BitMapPtr * BitMapHandle;
typedef struct OpaqueRgnHandle* RgnHandle;
struct Pattern {
UInt8 pat[8];
};
typedef struct Pattern Pattern;
typedef unsigned char Style;
typedef Style StyleField;
struct __attribute__((__packed__)) Point {
short v;
short h;
};
typedef struct Point Point;
struct __attribute__((__packed__)) 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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -