| Framework | ApplicationServices/ApplicationServices.h |
| Companion guide | |
| Declared in | IOMacOSTypes.h ImageCompression.k.h QDOffscreen.h QDPictToCGContext.h QuickTimeComponents.k.h Quickdraw.h QuickdrawAPI.h QuickdrawTypes.h X.h |
QuickDraw is the legacy 2D drawing engine for Macintosh computers. QuickDraw provides routines for drawing, manipulating, and displaying graphic objects such as lines, arcs, rectangles, ovals, regions, and bitmap images. Carbon supports most of the classic QuickDraw programming interface.
Note: QuickDraw has been deprecated for deployment targets Mac OS X version 10.4 and later. The replacement API is Quartz 2D. Because of the fundamental differences in the imaging models and design goals between QuickDraw and Quartz, there is no direct correspondence between QuickDraw and Quartz concepts and interfaces. For certain purposes, some QuickDraw functions may still be needed during a transition period; nevertheless, most of them have been deprecated to express the overriding goal of eliminating the use of QuickDraw in the future.
QDPictCreateWithProvider
QDPictCreateWithURL
QDPictDrawToCGContext
QDPictGetBounds
QDPictGetResolution
QDPictRetain
QDPictRelease
QDBeginCGContext
QDEndCGContext
ClipCGContextToRegion Deprecated in Mac OS X v10.4
CreateCGContextForPort Deprecated in Mac OS X v10.4
SyncCGContextOriginWithPort Deprecated in Mac OS X v10.4
QDGetCGDirectDisplayID
CreateNewPortForCGDisplayID Deprecated in Mac OS X v10.4
LockPortBits Deprecated in Mac OS X v10.4
QDFlushPortBuffer Deprecated in Mac OS X v10.4
UnlockPortBits Deprecated in Mac OS X v10.4
AllocCursor Deprecated in Mac OS X v10.4
DisposeCCursor Deprecated in Mac OS X v10.4
GetCCursor Deprecated in Mac OS X v10.4
SetCCursor Deprecated in Mac OS X v10.4
BackPat Deprecated in Mac OS X v10.4
BackPixPat Deprecated in Mac OS X v10.4
PackBits Deprecated in Mac OS X v10.4
UnpackBits Deprecated in Mac OS X v10.4
CopyBits Deprecated in Mac OS X v10.4
CopyDeepMask Deprecated in Mac OS X v10.4
CopyMask Deprecated in Mac OS X v10.4
NewGWorld
DisposeGWorld Deprecated in Mac OS X v10.4
DisposeScreenBuffer Deprecated in Mac OS X v10.4
NewScreenBuffer Deprecated in Mac OS X v10.4
NewTempScreenBuffer Deprecated in Mac OS X v10.4
UpdateGWorld Deprecated in Mac OS X v10.4
DisposeCTable Deprecated in Mac OS X v10.4
GetCTable Deprecated in Mac OS X v10.4
ClosePicture Deprecated in Mac OS X v10.4
KillPicture Deprecated in Mac OS X v10.4
OpenCPicture Deprecated in Mac OS X v10.4
OpenPicture Deprecated in Mac OS X v10.4
PicComment Deprecated in Mac OS X v10.4
CopyPixPat Deprecated in Mac OS X v10.4
DisposePixPat Deprecated in Mac OS X v10.4
GetPixPat Deprecated in Mac OS X v10.4
MakeRGBPat Deprecated in Mac OS X v10.4
NewPixPat Deprecated in Mac OS X v10.4
ClosePoly Deprecated in Mac OS X v10.4
KillPoly Deprecated in Mac OS X v10.4
OffsetPoly Deprecated in Mac OS X v10.4
OpenPoly Deprecated in Mac OS X v10.4
CopyRgn
DiffRgn
DisposeRgn
EmptyRgn
EqualRgn
InsetRgn
NewRgn
OffsetRgn
PtInRgn
RectInRgn
RectRgn
SectRgn
SetEmptyRgn
SetRectRgn
UnionRgn
XorRgn
CloseRgn Deprecated in Mac OS X v10.4
OpenRgn Deprecated in Mac OS X v10.4
DisposeGDevice Deprecated in Mac OS X v10.4
InitGDevice Deprecated in Mac OS X v10.4
NewGDevice Deprecated in Mac OS X v10.4
SetDeviceAttribute Deprecated in Mac OS X v10.4
SetGDevice Deprecated in Mac OS X v10.4
CopyPixMap Deprecated in Mac OS X v10.4
DisposePixMap Deprecated in Mac OS X v10.4
NewPixMap Deprecated in Mac OS X v10.4
SetPortPix Deprecated in Mac OS X v10.4
SetStdCProcs Deprecated in Mac OS X v10.4
SetStdProcs Deprecated in Mac OS X v10.4
StdArc Deprecated in Mac OS X v10.4
StdBits Deprecated in Mac OS X v10.4
StdComment Deprecated in Mac OS X v10.4
StdGetPic Deprecated in Mac OS X v10.4
StdLine Deprecated in Mac OS X v10.4
StdOval Deprecated in Mac OS X v10.4
StdPoly Deprecated in Mac OS X v10.4
StdPutPic Deprecated in Mac OS X v10.4
StdRect Deprecated in Mac OS X v10.4
StdRgn Deprecated in Mac OS X v10.4
StdRRect Deprecated in Mac OS X v10.4
GetBackColor Deprecated in Mac OS X v10.4
GetCPixel Deprecated in Mac OS X v10.4
GetForeColor Deprecated in Mac OS X v10.4
DeviceLoop Deprecated in Mac OS X v10.4
ScreenRes Deprecated in Mac OS X v10.4
TestDeviceAttribute Deprecated in Mac OS X v10.4
QDDone Deprecated in Mac OS X v10.4
EraseArc Deprecated in Mac OS X v10.4
FillArc Deprecated in Mac OS X v10.4
FrameArc Deprecated in Mac OS X v10.4
InvertArc Deprecated in Mac OS X v10.4
PaintArc Deprecated in Mac OS X v10.4
Line Deprecated in Mac OS X v10.4
LineTo Deprecated in Mac OS X v10.4
Move Deprecated in Mac OS X v10.4
MoveTo Deprecated in Mac OS X v10.4
EraseOval Deprecated in Mac OS X v10.4
FillOval Deprecated in Mac OS X v10.4
FrameOval Deprecated in Mac OS X v10.4
InvertOval Deprecated in Mac OS X v10.4
PaintOval Deprecated in Mac OS X v10.4
DrawPicture Deprecated in Mac OS X v10.4
GetPicture Deprecated in Mac OS X v10.4
ErasePoly Deprecated in Mac OS X v10.4
FillPoly Deprecated in Mac OS X v10.4
FramePoly Deprecated in Mac OS X v10.4
InvertPoly Deprecated in Mac OS X v10.4
PaintPoly Deprecated in Mac OS X v10.4
EraseRect Deprecated in Mac OS X v10.4
FillRect Deprecated in Mac OS X v10.4
FrameRect Deprecated in Mac OS X v10.4
InvertRect Deprecated in Mac OS X v10.4
PaintRect Deprecated in Mac OS X v10.4
EraseRgn Deprecated in Mac OS X v10.4
FillRgn Deprecated in Mac OS X v10.4
FrameRgn Deprecated in Mac OS X v10.4
InvertRgn Deprecated in Mac OS X v10.4
PaintRgn Deprecated in Mac OS X v10.4
EraseRoundRect Deprecated in Mac OS X v10.4
FillRoundRect Deprecated in Mac OS X v10.4
FrameRoundRect Deprecated in Mac OS X v10.4
InvertRoundRect Deprecated in Mac OS X v10.4
PaintRoundRect Deprecated in Mac OS X v10.4
FillCArc Deprecated in Mac OS X v10.4
FillCOval Deprecated in Mac OS X v10.4
FillCPoly Deprecated in Mac OS X v10.4
FillCRect Deprecated in Mac OS X v10.4
FillCRgn Deprecated in Mac OS X v10.4
FillCRoundRect Deprecated in Mac OS X v10.4
HiliteColor Deprecated in Mac OS X v10.4
OpColor Deprecated in Mac OS X v10.4
RGBBackColor Deprecated in Mac OS X v10.4
RGBForeColor Deprecated in Mac OS X v10.4
SetCPixel Deprecated in Mac OS X v10.4
BackColor Deprecated in Mac OS X v10.4
ColorBit Deprecated in Mac OS X v10.4
ForeColor Deprecated in Mac OS X v10.4
GetIndPattern Deprecated in Mac OS X v10.4
GetPattern Deprecated in Mac OS X v10.4
GetDeviceList Deprecated in Mac OS X v10.4
GetGDevice Deprecated in Mac OS X v10.4
GetMainDevice Deprecated in Mac OS X v10.4
GetMaxDevice Deprecated in Mac OS X v10.4
GetNextDevice Deprecated in Mac OS X v10.4
PenPixPat Deprecated in Mac OS X v10.4
GetPixBaseAddr
AllowPurgePixels Deprecated in Mac OS X v10.4
GetGWorldPixMap Deprecated in Mac OS X v10.4
GetPixelsState Deprecated in Mac OS X v10.4
LockPixels Deprecated in Mac OS X v10.4
NoPurgePixels Deprecated in Mac OS X v10.4
PixMap32Bit Deprecated in Mac OS X v10.4
SetPixelsState Deprecated in Mac OS X v10.4
UnlockPixels Deprecated in Mac OS X v10.4
GetClip
SetClip
BitMapToRegion Deprecated in Mac OS X v10.4
ClipRect Deprecated in Mac OS X v10.4
MovePortTo Deprecated in Mac OS X v10.4
PortSize Deprecated in Mac OS X v10.4
ScrollRect Deprecated in Mac OS X v10.4
SetOrigin Deprecated in Mac OS X v10.4
SetPortBits Deprecated in Mac OS X v10.4
GetCTSeed Deprecated in Mac OS X v10.4
ProtectEntry Deprecated in Mac OS X v10.4
ReserveEntry Deprecated in Mac OS X v10.4
RestoreEntries Deprecated in Mac OS X v10.4
SaveEntries Deprecated in Mac OS X v10.4
SetEntries Deprecated in Mac OS X v10.4
Color2Index Deprecated in Mac OS X v10.4
GetSubTable Deprecated in Mac OS X v10.4
Index2Color Deprecated in Mac OS X v10.4
InvertColor Deprecated in Mac OS X v10.4
MakeITable Deprecated in Mac OS X v10.4
RealColor Deprecated in Mac OS X v10.4
GetPen Deprecated in Mac OS X v10.4
GetPenState Deprecated in Mac OS X v10.4
HidePen Deprecated in Mac OS X v10.4
PenMode Deprecated in Mac OS X v10.4
PenNormal Deprecated in Mac OS X v10.4
PenPat Deprecated in Mac OS X v10.4
PenSize Deprecated in Mac OS X v10.4
SetPenState Deprecated in Mac OS X v10.4
ShowPen Deprecated in Mac OS X v10.4
AddPt
EqualPt
SetPt
SubPt
DeltaPoint Deprecated in Mac OS X v10.4
GetPixel Deprecated in Mac OS X v10.4
GlobalToLocal Deprecated in Mac OS X v10.4
LocalToGlobal Deprecated in Mac OS X v10.4
Random Deprecated in Mac OS X v10.4
AddComp Deprecated in Mac OS X v10.4
AddSearch Deprecated in Mac OS X v10.4
DelComp Deprecated in Mac OS X v10.4
DelSearch Deprecated in Mac OS X v10.4
SetClientID Deprecated in Mac OS X v10.4
CTabChanged Deprecated in Mac OS X v10.4
GDeviceChanged Deprecated in Mac OS X v10.4
PixPatChanged Deprecated in Mac OS X v10.4
PortChanged Deprecated in Mac OS X v10.4
QDError Deprecated in Mac OS X v10.4
GetGWorld
SetGWorld
GetGWorldDevice Deprecated in Mac OS X v10.4
GetRegionBounds
HandleToRgn
IsRegionRectangular
IsValidRgnHandle
QDRegionToRects
RgnToHandle
CloseCursorComponent Deprecated in Mac OS X v10.4
CreateNewPort Deprecated in Mac OS X v10.4
CursorComponentChanged Deprecated in Mac OS X v10.4
CursorComponentSetData Deprecated in Mac OS X v10.4
deltapoint Deprecated in Mac OS X v10.4
DisposeColorComplementUPP Deprecated in Mac OS X v10.4
DisposeColorSearchUPP Deprecated in Mac OS X v10.4
DisposeDeviceLoopDrawingUPP Deprecated in Mac OS X v10.4
DisposeDragGrayRgnUPP Deprecated in Mac OS X v10.4
DisposePort Deprecated in Mac OS X v10.4
DisposeQDArcUPP Deprecated in Mac OS X v10.4
DisposeQDBitsUPP Deprecated in Mac OS X v10.4
DisposeQDCommentUPP Deprecated in Mac OS X v10.4
DisposeQDGetPicUPP Deprecated in Mac OS X v10.4
DisposeQDJShieldCursorUPP Deprecated in Mac OS X v10.4
DisposeQDLineUPP Deprecated in Mac OS X v10.4
DisposeQDOpcodeUPP Deprecated in Mac OS X v10.4
DisposeQDOvalUPP Deprecated in Mac OS X v10.4
DisposeQDPolyUPP Deprecated in Mac OS X v10.4
DisposeQDPutPicUPP Deprecated in Mac OS X v10.4
DisposeQDRectUPP Deprecated in Mac OS X v10.4
DisposeQDRgnUPP Deprecated in Mac OS X v10.4
DisposeQDRRectUPP Deprecated in Mac OS X v10.4
DisposeQDStdGlyphsUPP Deprecated in Mac OS X v10.4
DisposeQDTextUPP Deprecated in Mac OS X v10.4
DisposeQDTxMeasUPP Deprecated in Mac OS X v10.4
DisposeRegionToRectsUPP Deprecated in Mac OS X v10.4
GetMaskTable Deprecated in Mac OS X v10.4
GetPixBounds Deprecated in Mac OS X v10.4
GetPixDepth Deprecated in Mac OS X v10.4
GetPixRowBytes Deprecated in Mac OS X v10.4
GetPortBackColor Deprecated in Mac OS X v10.4
GetPortBackPixPat Deprecated in Mac OS X v10.4
GetPortBitMapForCopyBits Deprecated in Mac OS X v10.4
GetPortBounds Deprecated in Mac OS X v10.4
GetPortChExtra Deprecated in Mac OS X v10.4
GetPortClipRegion Deprecated in Mac OS X v10.4
GetPortCustomXFerProc Deprecated in Mac OS X v10.4
GetPortFillPixPat Deprecated in Mac OS X v10.4
GetPortForeColor Deprecated in Mac OS X v10.4
GetPortFracHPenLocation Deprecated in Mac OS X v10.4
GetPortGrafProcs Deprecated in Mac OS X v10.4
GetPortHiliteColor Deprecated in Mac OS X v10.4
GetPortOpColor Deprecated in Mac OS X v10.4
GetPortPenLocation Deprecated in Mac OS X v10.4
GetPortPenMode Deprecated in Mac OS X v10.4
GetPortPenPixPat Deprecated in Mac OS X v10.4
GetPortPenSize Deprecated in Mac OS X v10.4
GetPortPenVisibility Deprecated in Mac OS X v10.4
GetPortPixMap Deprecated in Mac OS X v10.4
GetPortSpExtra Deprecated in Mac OS X v10.4
GetPortTextFace Deprecated in Mac OS X v10.4
GetPortTextFont Deprecated in Mac OS X v10.4
GetPortTextMode Deprecated in Mac OS X v10.4
GetPortTextSize Deprecated in Mac OS X v10.4
GetPortVisibleRegion Deprecated in Mac OS X v10.4
GetQDGlobalsArrow Deprecated in Mac OS X v10.4
GetQDGlobalsBlack Deprecated in Mac OS X v10.4
GetQDGlobalsDarkGray Deprecated in Mac OS X v10.4
GetQDGlobalsGray Deprecated in Mac OS X v10.4
GetQDGlobalsLightGray Deprecated in Mac OS X v10.4
GetQDGlobalsRandomSeed Deprecated in Mac OS X v10.4
GetQDGlobalsScreenBits Deprecated in Mac OS X v10.4
GetQDGlobalsThePort Deprecated in Mac OS X v10.4
GetQDGlobalsWhite Deprecated in Mac OS X v10.4
GrafDevice Deprecated in Mac OS X v10.4
InvokeColorComplementUPP Deprecated in Mac OS X v10.4
InvokeColorSearchUPP Deprecated in Mac OS X v10.4
InvokeDeviceLoopDrawingUPP Deprecated in Mac OS X v10.4
InvokeDragGrayRgnUPP Deprecated in Mac OS X v10.4
InvokeQDArcUPP Deprecated in Mac OS X v10.4
InvokeQDBitsUPP Deprecated in Mac OS X v10.4
InvokeQDCommentUPP Deprecated in Mac OS X v10.4
InvokeQDGetPicUPP Deprecated in Mac OS X v10.4
InvokeQDJShieldCursorUPP Deprecated in Mac OS X v10.4
InvokeQDLineUPP Deprecated in Mac OS X v10.4
InvokeQDOpcodeUPP Deprecated in Mac OS X v10.4
InvokeQDOvalUPP Deprecated in Mac OS X v10.4
InvokeQDPolyUPP Deprecated in Mac OS X v10.4
InvokeQDPutPicUPP Deprecated in Mac OS X v10.4
InvokeQDRectUPP Deprecated in Mac OS X v10.4
InvokeQDRgnUPP Deprecated in Mac OS X v10.4
InvokeQDRRectUPP Deprecated in Mac OS X v10.4
InvokeQDStdGlyphsUPP Deprecated in Mac OS X v10.4
InvokeQDTextUPP Deprecated in Mac OS X v10.4
InvokeQDTxMeasUPP Deprecated in Mac OS X v10.4
InvokeRegionToRectsUPP Deprecated in Mac OS X v10.4
IsPortClipRegionEmpty Deprecated in Mac OS X v10.4
IsPortColor Deprecated in Mac OS X v10.4
IsPortOffscreen Deprecated in Mac OS X v10.4
IsPortPictureBeingDefined Deprecated in Mac OS X v10.4
IsPortPolyBeingDefined Deprecated in Mac OS X v10.4
IsPortRegionBeingDefined Deprecated in Mac OS X v10.4
IsPortVisibleRegionEmpty Deprecated in Mac OS X v10.4
IsValidPort Deprecated in Mac OS X v10.4
LMGetCursorNew Deprecated in Mac OS X v10.4
LMGetDeviceList Deprecated in Mac OS X v10.4
LMGetFractEnable Deprecated in Mac OS X v10.4
LMGetHiliteMode Deprecated in Mac OS X v10.4
LMGetHiliteRGB Deprecated in Mac OS X v10.4
LMGetLastFOND Deprecated in Mac OS X v10.4
LMGetLastSPExtra Deprecated in Mac OS X v10.4
LMGetMainDevice Deprecated in Mac OS X v10.4
LMGetQDColors Deprecated in Mac OS X v10.4
LMGetScrHRes Deprecated in Mac OS X v10.4
LMGetScrVRes Deprecated in Mac OS X v10.4
LMGetTheGDevice Deprecated in Mac OS X v10.4
LMGetWidthListHand Deprecated in Mac OS X v10.4
LMGetWidthPtr Deprecated in Mac OS X v10.4
LMGetWidthTabHandle Deprecated in Mac OS X v10.4
LMSetCursorNew Deprecated in Mac OS X v10.4
LMSetDeviceList Deprecated in Mac OS X v10.4
LMSetFractEnable Deprecated in Mac OS X v10.4
LMSetHiliteMode Deprecated in Mac OS X v10.4
LMSetHiliteRGB Deprecated in Mac OS X v10.4
LMSetLastFOND Deprecated in Mac OS X v10.4
LMSetLastSPExtra Deprecated in Mac OS X v10.4
LMSetMainDevice Deprecated in Mac OS X v10.4
LMSetQDColors Deprecated in Mac OS X v10.4
LMSetScrHRes Deprecated in Mac OS X v10.4
LMSetScrVRes Deprecated in Mac OS X v10.4
LMSetTheGDevice Deprecated in Mac OS X v10.4
LMSetWidthListHand Deprecated in Mac OS X v10.4
LMSetWidthPtr Deprecated in Mac OS X v10.4
LMSetWidthTabHandle Deprecated in Mac OS X v10.4
NewColorComplementUPP Deprecated in Mac OS X v10.4
NewColorSearchUPP Deprecated in Mac OS X v10.4
NewDeviceLoopDrawingUPP Deprecated in Mac OS X v10.4
NewDragGrayRgnUPP Deprecated in Mac OS X v10.4
NewGWorldFromPtr Deprecated in Mac OS X v10.4
NewQDArcUPP Deprecated in Mac OS X v10.4
NewQDBitsUPP Deprecated in Mac OS X v10.4
NewQDCommentUPP Deprecated in Mac OS X v10.4
NewQDGetPicUPP Deprecated in Mac OS X v10.4
NewQDJShieldCursorUPP Deprecated in Mac OS X v10.4
NewQDLineUPP Deprecated in Mac OS X v10.4
NewQDOpcodeUPP Deprecated in Mac OS X v10.4
NewQDOvalUPP Deprecated in Mac OS X v10.4
NewQDPolyUPP Deprecated in Mac OS X v10.4
NewQDPutPicUPP Deprecated in Mac OS X v10.4
NewQDRectUPP Deprecated in Mac OS X v10.4
NewQDRgnUPP Deprecated in Mac OS X v10.4
NewQDRRectUPP Deprecated in Mac OS X v10.4
NewQDStdGlyphsUPP Deprecated in Mac OS X v10.4
NewQDTextUPP Deprecated in Mac OS X v10.4
NewQDTxMeasUPP Deprecated in Mac OS X v10.4
NewRegionToRectsUPP Deprecated in Mac OS X v10.4
OffscreenVersion Deprecated in Mac OS X v10.4
OpenCursorComponent Deprecated in Mac OS X v10.4
QDAddRectToDirtyRegion Deprecated in Mac OS X v10.4
QDAddRegionToDirtyRegion Deprecated in Mac OS X v10.4
QDDisplayWaitCursor Deprecated in Mac OS X v10.4
QDDisposeRegionBits Deprecated in Mac OS X v10.4
QDGetCursorData Deprecated in Mac OS X v10.4
QDGetDirtyRegion Deprecated in Mac OS X v10.4
QDGetPatternOrigin Deprecated in Mac OS X v10.4
QDGetPictureBounds Deprecated in Mac OS X v10.4
QDGlobalToLocalPoint Deprecated in Mac OS X v10.4
QDGlobalToLocalRect Deprecated in Mac OS X v10.4
QDGlobalToLocalRegion Deprecated in Mac OS X v10.4
QDIsNamedPixMapCursorRegistered Deprecated in Mac OS X v10.4
QDIsPortBufferDirty Deprecated in Mac OS X v10.4
QDIsPortBuffered Deprecated in Mac OS X v10.4
QDLocalToGlobalPoint Deprecated in Mac OS X v10.4
QDLocalToGlobalRect Deprecated in Mac OS X v10.4
QDLocalToGlobalRegion Deprecated in Mac OS X v10.4
QDRegisterNamedPixMapCursor Deprecated in Mac OS X v10.4
QDRestoreRegionBits Deprecated in Mac OS X v10.4
QDSaveRegionBits Deprecated in Mac OS X v10.4
QDSetCursorScale Deprecated in Mac OS X v10.4
QDSetDirtyRegion Deprecated in Mac OS X v10.4
QDSetNamedPixMapCursor Deprecated in Mac OS X v10.4
QDSetPatternOrigin Deprecated in Mac OS X v10.4
QDSwapPort Deprecated in Mac OS X v10.4
QDSwapPortTextFlags Deprecated in Mac OS X v10.4
QDSwapTextFlags Deprecated in Mac OS X v10.4
QDUnregisterNamedPixMapCursor Deprecated in Mac OS X v10.4
SectRegionWithPortClipRegion Deprecated in Mac OS X v10.4
SectRegionWithPortVisibleRegion Deprecated in Mac OS X v10.4
SetCursorComponent Deprecated in Mac OS X v10.4
SetPortBackPixPat Deprecated in Mac OS X v10.4
SetPortBounds Deprecated in Mac OS X v10.4
SetPortClipRegion Deprecated in Mac OS X v10.4
SetPortCustomXFerProc Deprecated in Mac OS X v10.4
SetPortFillPixPat Deprecated in Mac OS X v10.4
SetPortFracHPenLocation Deprecated in Mac OS X v10.4
SetPortGrafProcs Deprecated in Mac OS X v10.4
SetPortOpColor Deprecated in Mac OS X v10.4
SetPortPenMode Deprecated in Mac OS X v10.4
SetPortPenPixPat Deprecated in Mac OS X v10.4
SetPortPenSize Deprecated in Mac OS X v10.4
SetPortTextFace Deprecated in Mac OS X v10.4
SetPortTextFont Deprecated in Mac OS X v10.4
SetPortTextMode Deprecated in Mac OS X v10.4
SetPortTextSize Deprecated in Mac OS X v10.4
SetPortVisibleRegion Deprecated in Mac OS X v10.4
SetQDError Deprecated in Mac OS X v10.4
SetQDGlobalsArrow Deprecated in Mac OS X v10.4
SetQDGlobalsRandomSeed Deprecated in Mac OS X v10.4
StdOpcode Deprecated in Mac OS X v10.4
StuffHex Deprecated in Mac OS X v10.4
SwapPortPicSaveHandle Deprecated in Mac OS X v10.4
SwapPortPolySaveHandle Deprecated in Mac OS X v10.4
SwapPortRegionSaveHandle Deprecated in Mac OS X v10.4
Adds the coordinates of two points.
void AddPt ( Point src, Point *dst );
A point, the coordinates of which are to be added to the point in the dstPt parameter.
A pointer to a point, the coordinates of which are to be added to the point in the srcPt parameter. On return, this value contains the result of adding the coordinates of the points you supplied in the srcPt and dstPt parameters.
The AddPt function adds the coordinates of the point specified in the srcPt parameter to the coordinates of the point specified in the dstPt parameter, and returns the result in the dstPt parameter.
QuickdrawAPI.h
Converts a slope value to an angle value.
short AngleFromSlope ( Fixed slope );
The slope, defined as Dx/Dy, which is the horizontal change divided by the vertical change between any two points on a line with the slope.
The angle corresponding to the slope specified in the slope parameter treated MOD 180. Angles are defined in clockwise degrees from 12 o’clock. The negative y-axis is defined as being at 12 o’clock, and the positive y-axis at 6 o’clock. The x-axis is defined as usual, with the positive side defined as being at 3 o’clock.
The AngleFromSlope function is most useful when you require speed more than accuracy in performing the calculation. The integer result is within 1 degree of the correct answer, but not necessarily within half a degree.
QuickdrawAPI.h
Makes a copy of a region.
void CopyRgn ( RgnHandle srcRgn, RgnHandle dstRgn );
A handle to the region to copy.
A handle to the region to receive the copy.
The CopyRgn function copies the mathematical structure of the region whose handle you pass in the srcRgn parameter into the region whose handle you pass in the dstRgn parameter; that is, CopyRgn makes a duplicate copy of srcRgn. When calling CopyRgn, pass handles that have been returned by the NewRgn function in the srcRgn and dstRgn parameters.
Once this is done, the region indicated by srcRgn may be altered (or even disposed of) without affecting the region indicated by dstRgn. The CopyRgn function does not create the destination region; space must already have been allocated for it by using the NewRgn function.
The CopyRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.h
Subtracts one region from another.
void DiffRgn ( RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn );
A handle to the region to subtract from.
A handle to the region to subtract.
On return, a handle to the region holding the resulting area. If the first source region is empty, DiffRgn sets the destination to the empty region defined by the rectangle (0,0,0,0).
The DiffRgn function does not create the destination region; you must have already allocated memory for it by using the NewRgn function.
The destination region may be one of the source regions, if desired.
The DiffRgn procedure subtracts the region whose handle you pass in the srcRgnB parameter from the region whose handle you pass in the srcRgnA parameter and places the difference in the region whose handle you pass in the dstRgn parameter. If the first source region is empty, DiffRgn sets the destination to the empty region defined by the rectangle (0,0,0,0).
The DiffRgn procedure does not create the destination region; you must have already allocated memory for it by using the NewRgn function. The destination region may be one of the source regions, if desired.
The DiffRgn function may temporarily use heap space that’s twice the size of the two input regions.
QuickdrawAPI.h
Releases the memory occupied by a region.
void DisposeRgn ( RgnHandle rgn );
A handle to the region to dispose. This handle should be a region handle returned by the NewRgn function.
Use DisposeRgn only after you are completely through with a region.
The DisposeRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.h
Determines whether a rectangle is an empty rectangle.
Boolean EmptyRect ( const Rect *r );
The rectangle to examine.
TRUE if the rectangle that you specify in the r parameter is an empty rectangle, FALSE if it is not. A rectangle is considered empty if the bottom coordinate is less than or equal to the top coordinate or if the right coordinate is less than or equal to the left.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Determines whether a region is empty.
Boolean EmptyRgn ( RgnHandle rgn );
A handle to the region to test for emptiness.
TRUE if the region whose handle you pass in the rgn parameter is an empty region or FALSE if it is not.
The EmptyRgn function does not create an empty region. To create an empty region, you can perform any of the following operations:
Use NewRgn.
Pass the handle to an empty region to CopyRgn.
Pass an empty rectangle to either SetRectRgn or RectRgn.
Call CloseRgn without performing any drawing after calling OpenRgn.
Pass an empty region to OffsetRgn.
Pass an empty region or too large an inset to InsetRgn
Pass two nonintersecting regions to SectRgn.
Pass two empty regions to UnionRgn.
Pass two identical or nonintersecting regions to DiffRgn or XorRgn.
QuickdrawAPI.h
Determines whether the coordinates of two given points are equal.
Boolean EqualPt ( Point pt1, Point pt2 );
The first of two points to be compared.
The second of two points to be compared.
TRUE if the coordinates of the two points are equal, or FALSE if they are not.
The EqualPt function compares the points specified in the pt1 and pt2 parameters and returns TRUE if their coordinates are equal or FALSE if they are not.
QuickdrawAPI.h
Determines whether two rectangles are equal.
Boolean EqualRect ( const Rect * rect1, const Rect * rect2 );
The first of two rectangles to compare.
The second of two rectangles to compare.
TRUE if the rectangles are equal, FALSE if they are not.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Determines whether two regions have identical sizes, shapes, and locations.
Boolean EqualRgn ( RgnHandle rgnA, RgnHandle rgnB );
A handle to the first of two regions to compare.
A handle to the second of two regions to compare.
TRUE if the two regions are equal; FALSE if they are not. The two regions must have identical sizes, shapes, and locations to be considered equal. Any two empty regions are always equal.
The EqualRgn function compares the two regions whose handles you pass in the rgnA and rgnB parameters and returns TRUE if they’re equal or FALSE if they’re not.
The two regions must have identical sizes, shapes, and locations to be considered equal. Any two empty regions are always equal.
QuickdrawAPI.h
Saves the clipping region of the current graphics port (basic or color). (Deprecated. Use Quartz 2D instead; see Quartz Programming Guide for QuickDraw Developers.)
void GetClip ( RgnHandle rgn );
A handle to the region to be clipped. The GetClip function changes this region to one that’s equivalent to the clipping region of the current graphics port. The GetClip function doesn’t change the region handle.
You can use the GetClip and SetClip functions to preserve the current clipping region: use GetClip to save the current port’s clipping region, and use SetClip to restore it. If, for example, you want to draw a half-circle on the screen, you can set the clipping region to half of the square that would enclose the whole circle, and then draw the whole circle. Only the half within the clipping region is actually drawn in the graphics port.
The GetClip function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.
ImageCompression.k.h
Saves the current graphics port (basic, color, or offscreen) and the current GDevice structure. (Deprecated. Use Quartz 2D instead; see Quartz Programming Guide for QuickDraw Developers.)
void GetGWorld ( CGrafPtr *port, GDHandle *gdh );
On return, a pointer to the current graphics port in the port parameter. This parameter can return values of type GrafPtr, CGrafPtr, or GWorldPtr, depending on whether the current graphics port is a basic graphics port, color graphics port, or offscreen graphics world.
On return, a pointer to a handle to the GDevice structure for the current device.
After using GetGWorld to save a graphics port and a GDevice structure, use the SetGWorld function to restore them.
The GetGWorld function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.
ImageCompression.k.h
Obtains a pointer to an offscreen pixel map.
Ptr GetPixBaseAddr ( PixMapHandle pm );
A handle to an offscreen pixel map. To get a handle to an offscreen pixel map, use the GetGWorldPixMap function.
A 32-bit pointer to the beginning of a pixel image. If the offscreen buffer has been purged, GetPixBaseAddr returns NULL.
The baseAddr field of the PixMap structure for an offscreen graphics world contains a handle instead of a pointer, which is what the baseAddr field for an onscreen pixel map contains. You must use the GetPixBaseAddr function to obtain a pointer to the PixMap structure for an offscreen graphics world.
Your application should never directly access the baseAddr field of the PixMap structure for an offscreen graphics world; instead, always use GetPixBaseAddr. If your application is using 24-bit mode, use the PixMap32Bit function to determine whether a pixel map requires 32-bit addressing mode for access to its pixel image.
Any QuickDraw functions that your application uses after calling GetPixBaseAddr may change the base address for the offscreen pixel image.
The GetPixBaseAddr function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QDOffscreen.h
Rect * GetRegionBounds ( RgnHandle region, Rect *bounds );
QuickdrawAPI.h
void HandleToRgn ( Handle oldRegion, RgnHandle region );
QuickdrawAPI.h
Hides the cursor if it is visible on the screen.
void HideCursor ( void );
The HideCursor function removes the cursor from the screen, restores the bits under the cursor image, and decrements the cursor level (which InitCursor initialized to 0). You might want to use HideCursor when the user is using the keyboard to create content in one of your application’s windows. Every call to HideCursor should be balanced by a subsequent call to the ShowCursor function.
QuickdrawAPI.h
Sets the cursor to the standard arrow and makes the cursor visible.
void InitCursor ( void );
This function initializes the standard arrow cursor, sets the current cursor to the standard arrow, and makes the cursor visible. Classic Mac OS applications need to call this function when launching because the system sets the cursor to the watch cursor. Carbon applications running in Mac OS 9 or Mac OS X do not need to call this function.
QuickdrawAPI.h
Shrinks or expands a rectangle.
void InsetRect ( Rect * r, short dh, short dv );
A pointer to the rectangle to alter.
The horizontal distance to move the left and right sides in toward or outward from the center of the rectangle.
The vertical distance to move the top and bottom sides in toward or outward from the center of the rectangle.
The InsetRect function shrinks or expands the rectangle that you specify in the r parameter: the left and right sides are moved in by the amount you specify in the dh parameter; the top and bottom are moved toward the center by the amount you specify in the dv parameter. If the value you pass in dh or dv is negative, the appropriate pair of sides is moved outward instead of inward. The effect is to alter the size by 2*dh horizontally and 2*dv vertically, with the rectangle remaining centered in the same place on the coordinate plane.
If the resulting width or height becomes less than 1, the rectangle is set to the empty rectangle (0,0,0,0).
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Shrinks or expands a region.
void InsetRgn ( RgnHandle rgn, short dh, short dv );
A handle to the region to alter.
The horizontal distance to move points on the left and right boundaries in toward or outward from the center.
The vertical distance to move points on the top and bottom boundaries in toward or outward from the center.
The InsetRgn function moves all points on the region boundary of the region whose handle you pass in the rgn parameter inward by the vertical distance that you specify in the dv parameter and by the horizontal distance that you specify in the dh parameter. If you specify negative values for dh or dv, the InsetRgn function moves the points outward in that direction.
The InsetRgn function leaves the region’s center at the same position, but moves the outline in (for positive values of dh and dv) or out (for negative values of dh and dv). Using InsetRgn on a rectangular region has the same effect as using the InsetRect function.
The InsetRgn function temporarily uses heap space that’s twice the size of the original region.
The InsetRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.h
Boolean IsRegionRectangular ( RgnHandle region );
QuickdrawAPI.h
Boolean IsValidRgnHandle ( RgnHandle rgn );
QuickdrawAPI.h
Maps a point in one rectangle to an equivalent position in another rectangle.
void MapPt ( Point *pt, const Rect *srcRect, const Rect *dstRect );
Upon input, a pointer to the point in the source rectangle to map; upon completion, a pointer to its mapped position in the destination rectangle.
The source rectangle containing the original point.
The destination rectangle in which the point will be mapped.
The MapPt function maps a point in one rectangle to an equivalent position in another rectangle.
In the pt parameter, you specify a point that lies within the rectangle that you specify in the srcRect parameter. The MapPt function maps this point to a similarly located point within the rectangle that you specify in the dstRect parameter—that is, to where it would fall if it were part of a drawing being expanded or shrunk to fit the destination rectangle. The MapPt function returns the location of the mapped point in the pt parameter. For example, a corner point of the source rectangle would be mapped to the corresponding corner point of the destination rectangle in dstRect, and the center of the source rectangle would be mapped to the center of destination rectangle.
The source and destination rectangles may overlap, and the point you specify need not actually lie within the source rectangle.
If you are going to draw inside the destination rectangle, you’ll probably also want to scale the graphics pen size accordingly with ScalePt.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Maps and scales a rectangle within one rectangle to another rectangle.
void MapRect ( Rect *r, const Rect *srcRect, const Rect *dstRect );
Upon input, a pointer to the rectangle to map; upon completion, the mapped rectangle.
The rectangle containing the rectangle to map.
The rectangle in which the new rectangle will be mapped.
The MapRect function takes a rectangle within one rectangle and maps and scales it to another rectangle. In the r parameter, you specify a rectangle that lies within the rectangle that you specify in the srcRect parameter. By calling the MapPt function to map the upper-left and lower-right corners of the rectangle in the r parameter, MapRect maps and scales it to the rectangle that you specify in the dstRect parameter. The MapRect function returns the newly mapped rectangle in the r parameter.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Maps and scales a region within one rectangle to another rectangle.
void MapRgn ( RgnHandle rgn, const Rect *srcRect, const Rect *dstRect );
A handle to a region. Upon input, this is the region to map. Upon completion, this region is the one mapped to a new location.
The rectangle containing the region to map.
The rectangle in which the new region will be mapped.
The MapRgn function takes a region within one rectangle and maps and scales it to another rectangle. In the rgn parameter, you specify a handle to a region that lies within the rectangle that you specify in the srcRect parameter. By calling the MapPt function to map all the points of the region in the rgn parameter, MapRgn maps and scales it to the rectangle that you specify in the dstRect parameter. The MapRgn function returns the result in the region whose handle you initially passed in the rgn parameter.
The MapRgn function is useful for determining whether a region operation will exceed available memory. By mapping a large region into a smaller one and performing the operation (without actually drawing), you can estimate how much memory will be required by the anticipated operation.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
The MapRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.h
Creates an offscreen graphics world. (Deprecated. Use Quartz 2D instead; see Quartz Programming Guide for QuickDraw Developers.)
QDErr NewGWorld ( GWorldPtr *offscreenGWorld, short PixelDepth, const Rect *boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags );
On return, a pointer to the offscreen graphics world created by this function. You use this pointer when referring to this new offscreen world in other QuickDraw functions.
The pixel depth of the offscreen world; possible depths are 1, 2, 4, 8, 16, and 32 bits per pixel. The default parameter (0) uses the pixel depth of the screen with the greatest pixel depth from among all screens whose boundary rectangles intersect the rectangle that you specify in the boundsRect parameter. If you specify 0 in this parameter, NewGWorld also uses the GDevice structure from this device instead of creating a new GDevice structure for the offscreen world. If you use NewGWorld on a computer that supports only basic QuickDraw, you may specify only 0 or 1 in this parameter.
The boundary rectangle and port rectangle for the offscreen pixel map. This becomes the boundary rectangle for the GDevice structure, if NewGWorld creates one. If you specify 0 in the pixelDepth parameter, NewGWorld interprets the boundaries in global coordinates that it uses to determine which screens intersect the rectangle. NewGWorld then uses the pixel depth, color table, and GDevice structure from the screen with the greatest pixel depth from among all screens whose boundary rectangles intersect this rectangle. Typically, your application supplies this parameter with the port rectangle for the onscreen window into which your application will copy the pixel image from this offscreen world.
A handle to a ColorTable structure. If you pass NULL in this parameter, NewGWorld uses the default color table for the pixel depth that you specify in the pixelDepth parameter. If you set the pixelDepth parameter to 0, NewGWorld ignores the cTable parameter and instead copies and uses the color table of the graphics device with the greatest pixel depth among all graphics devices whose boundary rectangles intersect the rectangle that you specify in the boundsRect parameter. If you use NewGWorld on a computer that supports only basic QuickDraw, you may specify only NULL in this parameter.
A handle to a GDevice structure that is used only when you specify the noNewDevice flag in the flags parameter, in which case NewGWorld attaches this GDevice structure to the new offscreen graphics world. If you set the pixelDepth parameter to 0, or if you do not set the noNewDevice flag, NewGWorld ignores the aGDevice parameter, so set it to NULL. If you set the pixelDepth parameter to 0, NewGWorld uses the GDevice structure for the graphics device with the greatest pixel depth among all graphics devices whose boundary rectangles intersect the rectangle that you specify in the boundsRect parameter. You should pass NULL in this parameter if the computer supports only basic QuickDraw. Generally, your application should never create GDevice structures for offscreen graphics worlds.
Options available to your application. You can set a combination of the flags pixPurge, noNewDevice, useTempMem, and keepLocal. If you don’t wish to use any of these flags, specify 0 in this parameter to accept the default behavior for NewGWorld. The default behavior creates an offscreen graphics world where the base address for the offscreen pixel image is unpurgeable, it uses an existing GDevice structure (if you pass 0 in the depth parameter) or creates a new GDevice structure, it uses memory in your application heap, and it allows graphics accelerators to cache the offscreen pixel image. See “Graphics World Flags” for a description of the values you can use here.
A result code.
Typically, you pass 0 in the pixelDepth parameter, a window’s port rectangle in the boundsRect parameter, NULL in the cTable and aGDevice parameters, and in the flags parameter a 0. This provides your application with the default behavior of NewGWorld, and it supports computers running basic QuickDraw. This also allows QuickDraw to optimize the CopyBits, CopyMask, and CopyDeepMask functions when your application copies the image in an offscreen graphics world into an onscreen graphics port.
The NewGWorld function allocates memory for an offscreen graphics port and its pixel map. On computers that support only basic QuickDraw, NewGWorld creates a 1-bit pixel map that your application can manipulate using other relevant functions described in this chapter. Your application can copy this 1-bit pixel map into basic graphics ports.
Unless you specify 0 in the pixelDepth parameter–or pass the noNewDevice flag in the flags parameter and supply a GDevice structure in the aGDevice parameter– NewGWorld also allocates a new offscreen GDevice structure.
When creating an image, use the NewGWorld function to create an offscreen graphics world that is optimized for an image’s characteristics—for example, its best pixel depth. After creating the image, use the CopyBits, CopyMask, or CopyDeepMask function to copy that image to an onscreen graphics port. Color QuickDraw automatically renders the image at the best available pixel depth for the screen. Creating an image in an offscreen graphics port and then copying it to the screen in this way prevents the visual choppiness that would otherwise occur if your application were to build a complex image directly onscreen.
The NewGWorld function initializes the offscreen graphics port by calling the OpenCPort function. The NewGWorld function sets the offscreen graphics port’s visible region to a rectangular region coincident with its boundary rectangle. The NewGWorld function generates an inverse table with the Color Manager function MakeITable, unless one of the GDevice structures for the screens has the same color table as the GDevice structure for the offscreen world, in which case NewGWorld uses the inverse table from that GDevice structure.
The address of the offscreen pixel image is not directly accessible from the PixMap structure for the offscreen graphics world. However, you can use the GetPixBaseAddr function to get a pointer to the beginning of the offscreen pixel image.
For purposes of estimating memory use, you can compute the size of the offscreen pixel image by using this formula:
rowBytes * (boundsRect.bottom – boundsRect.top)
In the flags parameter, you can specify several options. If you don’t want to use any of these options, pass 0 in the flags parameter:
If you specify the pixPurge flag, NewGWorld stores the offscreen pixel image in a purgeable block of memory. In this case, before drawing to or from the offscreen pixel image, your application should call the LockPixels function and ensure that it returns TRUE. If LockPixels returns FALSE, the memory for the pixel image has been purged, and your application should either call UpdateGWorld to reallocate it and then reconstruct the pixel image, or draw directly in a window instead of preparing the image in an offscreen graphics world. Never draw to or copy from an offscreen pixel image that has been purged without reallocating its memory and then reconstructing it.
If you specify the noNewDevice flag, NewGWorld does not create a new offscreen GDevice structure. Instead, it uses the GDevice structure that you specify in the aGDevice parameter–and its associated pixel depth and color table–to create the offscreen graphics world. (If you set the pixelDepth parameter to 0, NewGWorld uses the GDevice structure for the screen with the greatest pixel depth among all the screens whose boundary rectangles intersect the rectangle that you specify in the boundsRect parameter–even if you specify the noNewDevice flag.) The NewGWorld function keeps a reference to the GDevice structure for the offscreen graphics world, and the SetGWorld function uses that structure to set the current graphics device.
If you set the useTempMem flag, NewGWorld creates the base address for an offscreen pixel image in temporary memory. You generally would not use this flag, because you should use temporary memory only for fleeting purposes and only with the AllowPurgePixels function.
If you specify the keepLocal flag, your offscreen pixel image is kept in Macintosh main memory and is not cached to a graphics accelerator card. use this flag carefully, as it negates the advantages provided by any graphics acceleration card that might be present.
If your application needs to change the pixel depth, boundary rectangle, or color table for an offscreen graphics world, use the UpdateGWorld function.
If you supply a handle to a ColorTable structure in the cTable parameter, NewGWorld makes a copy of the structure and stores its handle in the offscreen PixMap structure. It is your application’s responsibility to make sure that the ColorTable structure you specify in the cTable parameter is valid for the offscreen graphics port’s pixel depth.
If when using NewGWorld you specify a pixel depth, color table, or GDevice structure that differs from those used by the window into which you copy your offscreen image, the CopyBits, CopyMask, and CopyDeepMask functions require extra time to complete.
To use a custom color table in an offscreen graphics world, you need to create the associated offscreen GDevice structure, because Color QuickDraw needs its inverse table.
The NewGWorld function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickTimeComponents.k.h
Begins creating a new region.
RgnHandle NewRgn ( void );
A handle to the new region.
The NewRgn function allocates space for a new, variable-size region and initializes it to the empty region defined by the rectangle (0,0,0,0). This is the only function that creates a new region; other functions merely alter the size or shape of existing regions.
To begin defining a region, use the OpenRgn function.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
The NewRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
Use the Memory Manager function MaxMem to determine whether the memory for the region is valid before using NewRgn.
Ensure that the memory for a region is valid before calling this function to manipulate that region if there isn’t sufficient memory, the system may crash. Regions are limited to 32 KB in size in basic QuickDraw and 64 KB in color QuickDraw. Before defining a region, you can use the Memory Manager function MaxMem to determine whether the memory for the region is valid. You can determine the current size of an existing region by calling the Memory Manager function GetHandleSize. When you record drawing operations in an open region, the resulting region description may overflow the 32 KB or 64 KB limit. Should this happen in color QuickDraw, the QDError function returns the result code regionTooBigError.
QuickdrawAPI.h
Hides the cursor until the next time the user moves the mouse.
void ObscureCursor ( void );
Your application normally calls ObscureCursor when the user begins to type. Unlike HideCursor , ObscureCursor has no effect on the cursor level and must not be balanced by a call to ShowCursor.
QuickdrawAPI.h
Moves a rectangle.
void OffsetRect ( Rect * r, short dh, short dv );
A pointer to the rectangle to move.
The horizontal distance to move the rectangle.
The vertical distance to move the rectangle.
The OffsetRect function moves the rectangle that you specify in the r parameter by adding the value you specify in the dh parameter to each of its horizontal coordinates and the value you specify in the dv parameter to each of its vertical coordinates. If the dh and dv parameters are positive, the movement is to the right and down; if either is negative, the corresponding movement is in the opposite direction. The rectangle retains its shape and size; it is merely moved on the coordinate plane. The movement does not affect the screen unless you subsequently call a function to draw within the rectangle.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Moves a region.
void OffsetRgn ( RgnHandle rgn, short dh, short dv );
A handle to the region to move.
The horizontal distance to move the region.
The vertical distance to move the region.
The OffsetRgn function moves the region whose handle you pass in the rgn parameter by adding the value you specify in the dh parameter to the horizontal coordinates of all points of its region boundary, and by adding the value you specify in the dv parameter to the vertical coordinates of all points of its region boundary. If the values of dh and dv are positive, the movement is to the right and down; if either is negative, the corresponding movement is in the opposite direction. The region retains its size and shape. This does not affect the screen unless you subsequently call a function to draw the region.
The OffsetRgn function is an especially efficient operation, because most of the data defining a region is stored relative to the rgnBBox field in its Region structure and so is not actually changed by OffsetRgn.
QuickdrawAPI.h
Determines the smallest rectangle that encloses two given points.
void Pt2Rect ( Point pt1, Point pt2, Rect *dstRect );
The first of two points to enclose.
The second of two points to enclose.
On return, a pointer to the smallest rectangle that can enclose them.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Determines whether a pixel below is enclosed in a rectangle.
Boolean PtInRect ( Point pt, const Rect * r );
The point to test.
The rectangle to test.
TRUE if the pixel below and to the right of the point specified in the pt parameter is enclosed in the rectangle specified in the r parameter. FALSE if it is not.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Determines whether a pixel is within a region.
Boolean PtInRgn ( Point pt, RgnHandle rgn );
The point whose pixel is to be checked.
A handle to the region to test.
TRUE if the pixel below and to the right of the point specified in the pt parameter is within the region whose handle is specified in the rgn parameter. FALSE if it is not.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Calculates an angle between a vertical line pointing straight up from the center of a rectangle and a line from the center to a given point.
void PtToAngle ( const Rect *r, Point pt, short *angle );
The rectangle to examine.
The point to which an angle is to be calculated.
On return, a pointer to the resulting angle.
The result returned in the angle parameter is specified in degrees from 0 to 359, measured clockwise from 12 o’clock, with 90 at 3 o’clock, 180 at 6 o’clock, and 270 at 9 o’clock. Other angles are measured relative to the rectangle. If the line to the given point goes through the upper-right corner of the rectangle, the angle returned is 45, even if the rectangle is not square if it goes through the lower-right corner, the angle is 135, and so on.
The angle returned can be used as input to one of the functions that manipulate arcs and wedges, in “Drawing Arcs and Wedges”.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Returns a Quartz 2D drawing environment associated with a graphics port.
OSStatus QDBeginCGContext ( CGrafPtr inPort, CGContextRef *outContext );
A color graphics port in which to draw. Offscreen graphics worlds with pixel depths of 1, 2, 4, and 8 are not supported. When using Quartz 2D to draw in a offscreen graphics world, alpha information is always ignored.
A pointer to your storage for a Quartz context. Upon completion, contextPtr points to a context associated with the port. The context matches the port’s pixel depth, width, and height. Otherwise the context is in a default state and does not necessarily match other port attributes such as foreground color, background color, or clip region.
You should not retain or release the context. When you are finished using the context, you should call QDEndCGContext.
A result code. If noErr, the context was successfully initiated.
Applications running in Mac OS X can use Quartz 2D to draw in a QuickDraw graphics port. When you call this function, you obtain a Quartz context that’s associated with the specified port. To improve performance, contexts returned by this function are cached and reused during subsequent calls whenever possible.
Each block of Quartz 2D drawing code in your application should be surrounded by calls to this function and QDEndCGContext. Nested calls to this function for the same graphics port are not permitted—that is, for a given port you should not call this function more than once without an intervening call to QDEndCGContext.
While the Quartz context is in use, all Quickdraw imaging operations in the associated graphics port are disabled. This is done because the operations would fail during printing.
For information about how to use a Quartz context, see Quartz 2D Programming Guide.
QuickdrawAPI.h
Terminates a Quartz 2D drawing environment associated with a graphics port.
OSStatus QDEndCGContext ( CGrafPtr inPort, CGContextRef *inoutContext );
A graphics port specified in a preceding call to QDBeginCGContext.
A pointer to the context obtained in the preceding call to QDBeginCGContext for the port. Upon completion, the storage pointed to by contextPtr is set to NULL.
A result code. If noErr, the context is terminated.
After you finish using Quartz 2D to draw in a graphics port, you should call this function to terminate the context. For more information, see QDBeginCGContext.
Before calling this function, you should do one of the following:
Call CGContextSynchronize to mark the affected areas of the port for update.
Call CGContextFlush to immediately update the destination device.
QuickdrawAPI.hReturns the Quartz display ID that corresponds to a QuickDraw graphics device.
CGDirectDisplayID QDGetCGDirectDisplayID ( GDHandle inGDevice );
A QuickDraw graphics device.
A Quartz display ID, or NULL if the inGDevice parameter does not represent a display. For information about using a display ID, see Quartz Display Services Reference.
QuickdrawAPI.h
Creates a QDPict picture, using QuickDraw picture data supplied with a Quartz data provider.
QDPictRef QDPictCreateWithProvider ( CGDataProviderRef provider );
A Quartz data provider that supplies QuickDraw picture data. The picture data must begin at either the first byte or the 513th byte in the data provider. The picture bounds must not be an empty rectangle.
QuickDraw retains the data provider you pass in, and you may safely release it after this function returns.
A new QDPict picture, or NULL if the picture data is not valid. The initial retain count is 1. After you finish using the picture, you should release it by calling QDPictRelease.
This function creates a QDPict picture that you can draw in a Quartz context. For general information about QDPict pictures, see QDPictRef.
QDPictToCGContext.h
Creates a QDPict picture, using QuickDraw picture data specified with a Core Foundation URL.
QDPictRef QDPictCreateWithURL ( CFURLRef url );
A Core Foundation URL that specifies a PICT file containing the QuickDraw picture data. The picture header data must begin at either the first byte or the 513th byte in the PICT file. The picture bounds must not be an empty rectangle.
A new QDPict picture, or NULL if the picture data is not valid. The initial retain count is 1. After you finish using the picture, you should release it by calling QDPictRelease.
This function creates a QDPict picture that you can draw in a Quartz context. For general information about QDPict pictures, see QDPictRef.
QDPictToCGContext.h
Draws a QuickDraw picture in a Quartz context.
OSStatus QDPictDrawToCGContext ( CGContextRef ctx, CGRect rect, QDPictRef pictRef );
The Quartz context in which to draw.
The rectangular area in which to draw the picture. You should specify the origin and size of this rectangle in user space units. The origin is the lower left corner of the picture when drawn. If necessary, the picture is scaled to fit inside this rectangle. To get unscaled results, you should pass the rectangle returned by QDPictGetBounds. For additional information about scaling, see the discussion below.
A QDPict picture.
A result code. A non-zero result indicates that the picture was not successfully drawn.
This function converts the picture data in a QDPict picture into an equivalent sequence of Quartz 2D graphics operations. Conceptually this is the same processing path taken when an application running in Mac OS X draws into a QuickDraw printing port.
When drawing a QDPict picture in a Quartz context, there are two ways to change the horizontal or vertical scale of the picture:
Construct the drawing rectangle (see the rect parameter) by applying the change of scale to the bounds rectangle returned by QDPictGetBounds. In this case, QuickDraw scales all the graphic elements in the picture except for patterns—the same behavior as DrawPicture.
Prior to calling QDPictDrawToCGContext, apply the change of scale to the current transformation matrix in the Quartz context—for example, by calling CGContextScaleCTM. In this case, QuickDraw scales the entire picture including patterns.
In a bitmap-based context, the picture is rendered into the bitmap. In a PDF-based context, the picture is converted into a PDF content stream. If the picture uses transfer modes such as srcXor that do not have an analog in Quartz 2D, the PDF representation may not match the original exactly.
QDPictToCGContext.h
Returns the intended location and size of a QDPict picture.
CGRect QDPictGetBounds ( QDPictRef pictRef );
A QDPict picture.
A Quartz rectangle that represents the intended location and size of the picture. The rectangle is in default user space with one unit = 1/72 inch, and the origin is the lower-left corner of the picture.
If the native resolution in the picture data is not 72 pixels per inch, the bounding rectangle returned by this function is scaled as follows:
width = width in pixels * 72 / horizontal resolution |
height = height in pixels * 72 / vertical resolution |
QDPictToCGContext.h
Returns the horizontal and vertical resolution of a QDPict picture.
void QDPictGetResolution ( QDPictRef pictRef, float *xRes, float *yRes );
A QDPict picture.
A pointer to your storage for a return value. Upon completion, the value is the picture’s horizontal resolution in pixels per inch.
A pointer to your storage for a return value. Upon completion, the value is the picture’s vertical resolution in pixels per inch.
This function returns resolution data that you can use—together with the rectangle returned by QDPictGetBounds—to compute the picture’s size in pixels.
QDPictToCGContext.h
Releases a QDPict picture.
void QDPictRelease ( QDPictRef pictRef );
A QDPict picture which you created or retained.
After you finish using a QDPict picture that you created or retained, you should call this function to release the picture. If the picture’s retain count becomes 0, this function frees the picture and any associated resources such as the picture’s data provider.
QDPictToCGContext.hRetains a QDPict picture.
QDPictRef QDPictRetain ( QDPictRef pictRef );
A QDPict picture.
The retained picture.
You should call this function when you obtain a QDPict picture that you did not create and you want to retain the picture for later use. When you no longer need the retained picture, you should call QDPictRelease to release it.
QDPictToCGContext.h
OSStatus QDRegionToRects ( RgnHandle rgn, QDRegionParseDirection dir, RegionToRectsUPP proc, void *userData );
QuickdrawAPI.h
Determines whether a rectangle intersects a region.
Boolean RectInRgn ( const Rect *r, RgnHandle rgn );
The rectangle to check for intersection.
A handle to the region to check.
TRUE if the rectangle specified in the r parameter intersects the region whose handle is specified in the rgn parameter. The RectInRgn function returns TRUE if the intersection encloses at least 1 bit or FALSE if it does not.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
The RectInRgn function sometimes returns TRUE when the rectangle merely intersects the region’s bounding rectangle. If you need to know exactly whether a given rectangle intersects the actual region, use RectRgn to set the rectangle to a region, and call SectRgn to see whether the two regions intersect. If the result of SectRgn is an empty region, then the rectangle does not intersect the region.
QuickdrawAPI.h
Changes the structure of an existing region to that of a rectangle.
void RectRgn ( RgnHandle rgn, const Rect *r );
A handle to the region to restructure as a rectangle.
The rectangle structure to use.
The RectRgn function destroys the previous structure of the SetRectRgn function, and it then sets the new structure to a rectangle that you specify in the r parameter.
As an alternative to the RectRgn function, use the SetRectRgn function, which accepts as parameters four coordinates instead of a rectangle.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
The RectRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.h
void RgnToHandle ( RgnHandle region, Handle flattenedRgnDataHdl );
QuickdrawAPI.h
Scales a height and width according to the proportions of two rectangles.
void ScalePt ( Point *pt, const Rect *srcRect, const Rect *dstRect );
On input, a pointer to an initial height and width (specified in the two fields of a Point structure) to scale; on return, vertical and horizontal scaling factors derived by multiplying the height and width by ratios of the height and width of the rectangle in the srcRect parameter to the height and width of the rectangle in the dstRect parameter.
You do not pass coordinates in this parameter. Instead, you pass an initial height to scale in the v (or vertical) field of the Point structure, and you pass an initial width to scale in the h (or horizontal) field.
The ScalePt function scales these measurements by multiplying the initial height by the ratio of the height of the rectangle you specify in the dstRect parameter to the height of the rectangle you specify in the srcRect parameter, and by multiplying the initial width by the ratio of the width of the dstRect rectangle to the width of the srcRect rectangle.
A rectangle. The ratio of this rectangle’s height to the height of the rectangle in the dstRect parameter provides the vertical scaling factor, and the ratio of this rectangle’s width to the width of the rectangle in the dstRect parameter provides the horizontal scaling factor.
A rectangle compared to the rectangle in the srcRect parameter to determine vertical and horizontal scaling factors.
The ScalePt function produces horizontal and vertical scaling factors from the proportions of two rectangles. Use ScalePt, for example, to scale the dimensions of the graphics pen.
Where the width of the dstRect rectangle is twice the width of the srcRect rectangle, and its height is three times the height of srcRect, ScalePt scales the width of the graphics pen from 3 to 6 and scales its height from 2 to 6.
The minimum value ScalePt returns is (1,1).
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Determines whether two rectangles intersect.
Boolean SectRect ( const Rect *src1, const Rect *src2, Rect *dstRect );
The first of two rectangles to test for intersection.
The second of two rectangles to test for intersection.
On return, a pointer to the rectangle marking the intersection of the first two rectangles.
TRUE if the specified rectangles intersect or FALSE if they do not.
The SectRect function calculates the rectangle that delineates the intersection of the two rectangles you specify in the src1 and src2 parameters. Rectangles that touch at a line or a point are not considered intersecting, because their intersection rectangle (actually, in this case, an intersection line or point) does not enclose any pixels in the bit image.
If the rectangles do not intersect, the destination rectangle is set to (0,0,0,0). The SectRect function works correctly even if one of the source rectangles is also the destination.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Calculates the intersection of two regions.
void SectRgn ( RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn );
A handle to the first of two regions whose intersection is to be determined.
A handle to the second of two regions whose intersection is to be determined.
On return, a handle to the region holding the intersection area. If the regions do not intersect, or one of the regions is empty, SectRgn sets the destination to the empty region defined by the rectangle (0,0,0,0).
The SectRgn function does not create a destination region; you must have already allocated memory for it by using the NewRgn function.
The destination region may be one of the source regions, if desired.
The SectRgn procedure calculates the intersection of the two regions whose handles you pass in the srcRgnA and srcRgnB parameters, and it places the intersection in the region whose handle you pass in the dstRgn parameter. If the regions do not intersect, or one of the regions is empty, SectRgn sets the destination to the empty region defined by the rectangle (0,0,0,0).
The SectRgn procedure does not create a destination region; you must have already allocated memory for it by using the NewRgn function.
The destination region may be one of the source regions, if desired.
The SectRgn function may temporarily use heap space that’s twice the size of the two input regions.
The SectRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.h
Changes the clipping region of the current graphics port (basic or color) to a region you specify. (Deprecated. Use Quartz 2D instead; see Quartz Programming Guide for QuickDraw Developers.)
void SetClip ( RgnHandle rgn );
A handle to a region. The SetClip function makes this region the clipping region of the current graphics port. The SetClip function doesn’t change the region handle, but instead affects the clipping region itself.
Since SetClip copies the specified region into the current graphics port’s clipping region, any subsequent changes you make to the region specified in the rgn parameter do not affect the clipping region of the graphics port.
The initial clipping region of a graphics port is an arbitrarily large rectangle. You can set the clipping region to any arbitrary region, to aid you in drawing inside the graphics port—for example, to avoid drawing over scroll bars when drawing into a window, you could define a clipping region that excludes the scroll bars.
You can use the GetClip and SetClip functions to preserve the current clipping region: use GetClip to save the current port’s clipping region, and use SetClip to restore it.
All other system software functions preserve the current clipping region.
The SetClip function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.
ImageCompression.k.h
Sets an existing region to be empty.
void SetEmptyRgn ( RgnHandle rgn );
A handle to the region to be made empty.
The SetEmptyRgn function destroys the previous structure of the region whose handle you pass in the rgn parameter; it then sets the new structure to the empty region defined by the rectangle (0,0,0,0).
The SetEmptyRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.h
Changes the current graphics port (basic, color, or offscreen). (Deprecated. Use Quartz 2D instead; see Quartz Programming Guide for QuickDraw Developers.)
void SetGWorld ( CGrafPtr port, GDHandle gdh );
A pointer to an offscreen graphics world, color graphics port, or basic graphics port. Specify values of type GrafPtr, CGrafPtr, or GWorldPtr, depending on whether you want to set the current graphics port to be a basic graphics port, color graphics port, or offscreen graphics world. Any drawing your application performs then occurs in this graphics port.
A handle to a GDevice structure. If you pass a pointer to an offscreen graphics world in the port parameter, set this parameter to NULL, because SetGWorld ignores this parameter and sets the current device to the device attached to the offscreen graphics world.
The SetGWorld function sets the current graphics port to the one specified by the port parameter and—unless you set the current graphics port to be an offscreen graphics world—sets the current device to that specified by the gdh parameter.
The SetGWorld function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
ImageCompression.k.h
Assigns two coordinates to a point.
void SetPt ( Point *pt, short h, short v );
A pointer to the point to be given new coordinates. On return, this point is assigned the horizontal coordinate you specify in the h parameter and the vertical coordinate you specify in the v parameter.
The horizontal value of the new coordinates.
The vertical value of the new coordinates.
The SetPt procedure assigns the horizontal coordinate specified in the h parameter and the vertical coordinate specified in the v parameter to the point returned in the pt parameter.
QuickdrawAPI.h
Assigns coordinates to a rectangle.
void SetRect ( Rect * r, short left, short top, short right, short bottom );
A pointer to the rectangle to set.
The horizontal coordinate of the new upper-left corner of the rectangle.
The vertical coordinate of the new upper-left corner of the rectangle.
The horizontal coordinate of the new lower-right corner of the rectangle.
The vertical coordinate of the new lower-right corner of the rectangle.
The SetRect function assigns the coordinates you specify in the left, top, right, and bottom parameters to the rectangle that you specify in the r parameter. This function is provided to help you shorten your program text. If you want a more readable text, at the expense of source text length, you can instead assign integers (or points) directly into the fields of a Rect structure.
You can use a rectangle to specify locations and sizes for various graphics operations.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Changes the structure of an existing region to that of a rectangle.
void SetRectRgn ( RgnHandle rgn, short left, short top, short right, short bottom );
A handle to the region to restructure as a rectangle.
The horizontal coordinate of the upper-left corner of the rectangle to set as the new region.
The vertical coordinate of the upper-left corner of the rectangle to set as the new region.
The horizontal coordinate of the lower-right corner of the rectangle to set as the new region.
The vertical coordinate of the lower-right corner of the rectangle to set as the new region.
The SetRectRgn function destroys the previous structure of the region whose handle you pass in the rgn parameter, and it then sets the new structure to the rectangle that you specify in the left, top, right, and bottom parameters. If you specify an empty rectangle (that is, right is greater than or equal to left or bottom = top), the SetRectRgn function sets the region to the empty region defined by the rectangle (0,0,0,0).
As an alternative to the SetRectRgn function, you can change the structure of an existing region to that of a rectangle by using the RectRgn function, which accepts as a parameter a rectangle instead of four coordinates.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
The SetRectRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.h
Hides the cursor in a rectangle.
void ShieldCursor ( const Rect *shieldRect, Point offsetPt );
A rectangle in which the cursor is hidden whenever the cursor intersects the rectangle. The rectangle may be specified in global or local coordinates. If you are using global coordinates, pass (0,0) in the offsetPt parameter. If you are using the local coordinates of a graphics port, pass the coordinates for the upper-left corner of the graphics port’s boundary rectangle in the offsetPt parameter.
A point value for the offset of the rectangle. Like the basic QuickDraw function LocalToGlobal, the ShieldCursor function offsets the coordinates of the rectangle by the coordinates of this point.
If the cursor and the given rectangle intersect, ShieldCursor hides the cursor. If they do not intersect, the cursor remains visible while the mouse is not moving, but is hidden when the mouse moves. Use this function with a feature such as QuickTime to display content in a specified rectangle. When a QuickTime movie is animating, the cursor should not be visible in front of the movie.
The ShieldCursor function decrements the cursor level and should be balanced by a call to the ShowCursor function.
QuickdrawAPI.h
Displays a cursor hidden by the HideCursor or ShieldCursor functions.
void ShowCursor ( void );
ShowCursor increments the cursor level, which has been decremented by the HideCursor or ShieldCursor function and displays the cursor on the screen when the level is 0. A call to the ShowCursor function balances each previous call to the HideCursor or ShieldCursor function. The level is not incremented beyond 0, so extra calls to ShowCursor have no effect.
Low-level interrupt-driven functions link the cursor with the mouse position, so that if the cursor level is 0 and visible, the cursor automatically follows the mouse.
If the cursor has been changed with the SetCursor function while hidden, ShowCursor displays the new cursor.
QuickdrawAPI.h
Converts an angle value to a slope value.
Fixed SlopeFromAngle ( short angle );
The angle, expressed in clockwise degrees from 12 o’clock and treated MOD 180. (90 degrees is thus at 3 o’clock and –90 degrees is at 9 o’clock.
The slope corresponding to the angle specified in the angle parameter. Slopes are defined as Dx/Dy, the horizontal change divided by the vertical change between any two points on a line with the given angle. The negative y-axis is defined as being at 12 o’clock, and the positive y-axis at 6 o’clock. The x-axis is defined as usual, with the positive side defined as being at 3 o’clock.
QuickdrawAPI.h
Subtracts the coordinates of one point from another.
void SubPt ( Point src, Point *dst );
A point, the coordinates of which are to be subtracted from the coordinates of the point specified in the dst parameter.
The address of a point. Upon completion, the coordinates of this point contain the differences between the coordinates of the two points specified in the entry parameters.
If you pass NULL in the dst parameter, this function sets the QDError result code to paramErr and returns.
QuickdrawAPI.h
Calculates the smallest rectangle that encloses two rectangles.
void UnionRect ( const Rect * src1, const Rect * src2, Rect * dstRect );
The first of two rectangles to enclose.
The second of two rectangles to enclose.
On return, a pointer to the smallest rectangle that encloses both of the rectangles you specify in the src1 and src2 parameters. One of the source rectangles may also be the destination.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
QuickdrawAPI.h
Calculates the union of two regions.
void UnionRgn ( RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn );
A handle to the first of two regions whose union is to be determined.
A handle to the second of two regions whose union is to be determined.
On return, a handle to the region holding the resulting union area. If both regions are empty, UnionRgn sets the destination to the empty region defined by the rectangle (0,0,0,0).
The UnionRgn function does not create the destination region; you must have already allocated memory for it by using the NewRgn function.
The destination region may be one of the source regions, if desired.
The UnionRgn procedure calculates the union of the two regions whose handles you pass in the srcRgnA and srcRgnB parameters, and it places the union in the region whose handle you pass in the dstRgn parameter. If both regions are empty, UnionRgn sets the destination to the empty region defined by the rectangle (0,0,0,0).
The UnionRgn function may temporarily use heap space that’s twice the size of the two input regions.
The UnionRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.h
Calculates the difference between the union and the intersection of two regions.
void XorRgn ( RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn );
A handle to the first of two regions to compare.
A handle to the second of two regions to compare.
On return, a handle to the region holding the result.
This does not create the destination region; you must have already allocated memory for it by using the NewRgn function.
If the regions are coincident, XorRgn sets the destination region to the empty region defined by the rectangle (0,0,0,0).
The XorRgn procedure calculates the difference between the union and the intersection of the regions whose handles you pass in the srcRgnA and srcRgnB parameters and places the result in the region whose handle you pass in the dstRgn parameter.
The XorRgn function may temporarily use heap space that’s twice the size of the two input regions.
The XorRgn function may move or purge memory blocks in the application heap; do not call this function at interrupt time.
QuickdrawAPI.hDefines a pointer to a color inversion callback function that overrides the Color Manager’s color inversion method.
typedef Boolean (*ColorComplementProcPtr) ( RGBColor * rgb );
If you name your function MyColorComplementProc, you would declare it like this:
Boolean ColorComplementProcPtr ( RGBColor * rgb );
A pointer to the RGBColor data structure. Change it to reflect the inverted value.
QuickdrawTypes.hDefines a pointer to a color search callback function that overrides the Color Manager’s code for inverse table mapping.
typedef Boolean (*ColorSearchProcPtr) ( RGBColor * rgb, long * position );
If you name your function MyColorSearchProc, you would declare it like this:
Boolean ColorSearchProcPtr ( RGBColor * rgb, long * position );
A pointer to the RGBColor data structure passed to your search function. Your function should set the ColorSpec.value field to the index corresponding to the color indicated here.
A pointer to the index of the best-mapping color your function finds.
True if your function succeeds, false if your function cannot find a match.
Your MyColorSearchCallback function should examine the RGBColor data structure passed to it by the Color Manager and return the index to the best-mapping color in the current GDevice data structure.
The Color Manager specifies the desired color in the RGBColor field of a ColorSpec data structure and passes it by a pointer on the stack. Your function should return the corresponding index in the ColorSpec.value field. If your function cannot handle the search, return false as the function value, and pass the RGBColor data structure back to the Color Manager in the rgb parameter.
The Color Manager calls each search function in the list until one returns the Boolean value true. If no search function installed in the linked list returns true, the Color Manager calls the default search function.
QuickdrawTypes.htypedef void (*CustomXFerProcPtr) ( CustomXFerRecPtr info );
If you name your function MyCustomXFerProc, you would declare it like this:
void CustomXFerProcPtr ( CustomXFerRecPtr info );
QuickdrawAPI.htypedef void (*DeviceLoopDrawingProcPtr) ( short depth, short deviceFlags, GDHandle targetDevice, long userData );
If you name your function MyDeviceLoopDrawingProc, you would declare it like this:
void DeviceLoopDrawingProcPtr ( short depth, short deviceFlags, GDHandle targetDevice, long userData );
The pixel depth of the graphics device.
Constants which represent bits that are set to 1 in the gdFlags field of the GDevice structure for the current device. See “Device Attribute Constants” for a description of the values which you can receive in this parameter.
A handle to the GDevice structure for the current device.
A value that your application supplies to the DeviceLoop function, which in turn passes the value to your drawing function for whatever purpose you deem useful.
For each video device that intersects a drawing region that you define (generally, the update region of a window), DeviceLoop calls your drawing function. Your drawing function should analyze the pixel depth passed in the depth parameter and the values passed in the deviceFlags parameter, and then draw in a manner that is optimized for the current device.
When highlighting, for example, your application might invert black and white when drawing onto a 1-bit video device but use magenta as the highlight color when drawing onto a color video device. In this case, even were your window to span both a black-and-white and a color screen, the user sees the selection inverted on the black-and-white screen, while magenta would be used to highlight the selection on the color screen.
You must provide a pointer to your MyDeviceLoopDrawingCallback function in the drawingProc parameter for DeviceLoop.
QuickdrawTypes.htypedef void (*DragGrayRgnProcPtr) ( );
If you name your function MyDragGrayRgnProc, you would declare it like this:
void DragGrayRgnProcPtr ();
QuickdrawTypes.htypedef void (*QDArcProcPtr) ( GrafVerb verb, const Rect * r, short startAngle, short arcAngle );
If you name your function MyQDArcProc, you would declare it like this:
void QDArcProcPtr ( GrafVerb verb, const Rect * r, short startAngle, short arcAngle );
QuickdrawTypes.htypedef void (*QDBitsProcPtr) ( const BitMap * srcBits, const Rect * srcRect, const Rect * dstRect, short mode, RgnHandle maskRgn );
If you name your function MyQDBitsProc, you would declare it like this:
void QDBitsProcPtr ( const BitMap * srcBits, const Rect * srcRect, const Rect * dstRect, short mode, RgnHandle maskRgn );
QuickdrawTypes.htypedef void (*QDCommentProcPtr) ( short kind, short dataSize, Handle dataHandle );
If you name your function MyQDCommentProc, you would declare it like this:
void QDCommentProcPtr ( short kind, short dataSize, Handle dataHandle );
QuickdrawTypes.htypedef void (*QDGetPicProcPtr) ( void * dataPtr, short byteCount );
If you name your function MyQDGetPicProc, you would declare it like this:
void QDGetPicProcPtr ( void * dataPtr, short byteCount );
QuickdrawTypes.htypedef void (*QDJShieldCursorProcPtr) ( short left, short top, short right, short bottom );
If you name your function MyQDJShieldCursorProc, you would declare it like this:
void QDJShieldCursorProcPtr ( short left, short top, short right, short bottom );
QuickdrawTypes.htypedef void (*QDLineProcPtr) ( Point newPt );
If you name your function MyQDLineProc, you would declare it like this:
void QDLineProcPtr ( Point newPt );
QuickdrawTypes.htypedef void (*QDOpcodeProcPtr) ( const Rect * fromRect, const Rect * toRect, UInt16 opcode, SInt16 version );
If you name your function MyQDOpcodeProc, you would declare it like this:
void QDOpcodeProcPtr ( const Rect * fromRect, const Rect * toRect, UInt16 opcode, SInt16 version );
QuickdrawTypes.htypedef void (*QDOvalProcPtr) ( GrafVerb verb, const Rect * r );
If you name your function MyQDOvalProc, you would declare it like this:
void QDOvalProcPtr ( GrafVerb verb, const Rect * r );
QuickdrawTypes.htypedef void (*QDPolyProcPtr) ( GrafVerb verb, PolyHandle poly );
If you name your function MyQDPolyProc, you would declare it like this:
void QDPolyProcPtr ( GrafVerb verb, PolyHandle poly );
QuickdrawTypes.htypedef OSStatus (*QDPrinterStatusProcPtr) ( PrinterStatusOpcode opcode, CGrafPtr currentPort, void * printerStatus );
If you name your function MyQDPrinterStatusProc, you would declare it like this:
OSStatus QDPrinterStatusProcPtr ( PrinterStatusOpcode opcode, CGrafPtr currentPort, void * printerStatus );
QuickdrawTypes.htypedef void (*QDPutPicProcPtr) ( const void * dataPtr, short byteCount );
If you name your function MyQDPutPicProc, you would declare it like this:
void QDPutPicProcPtr ( const void * dataPtr, short byteCount );
QuickdrawTypes.htypedef void (*QDRectProcPtr) ( GrafVerb verb, const Rect * r );
If you name your function MyQDRectProc, you would declare it like this:
void QDRectProcPtr ( GrafVerb verb, const Rect * r );
QuickdrawTypes.htypedef void (*QDRgnProcPtr) ( GrafVerb verb, RgnHandle rgn );
If you name your function MyQDRgnProc, you would declare it like this:
void QDRgnProcPtr ( GrafVerb verb, RgnHandle rgn );
QuickdrawTypes.htypedef void (*QDRRectProcPtr) ( GrafVerb verb, const Rect * r, short ovalWidth, short ovalHeight );
If you name your function MyQDRRectProc, you would declare it like this:
void QDRRectProcPtr ( GrafVerb verb, const Rect * r, short ovalWidth, short ovalHeight );
QuickdrawTypes.htypedef OSStatus (*QDStdGlyphsProcPtr) ( void * dataStream, ByteCount size );
If you name your function MyQDStdGlyphsProc, you would declare it like this:
OSStatus QDStdGlyphsProcPtr ( void * dataStream, ByteCount size );
QuickdrawTypes.htypedef void (*QDTextProcPtr) ( short byteCount, const void * textBuf, Point numer, Point denom );
If you name your function MyQDTextProc, you would declare it like this:
void QDTextProcPtr ( short byteCount, const void * textBuf, Point numer, Point denom );
QuickdrawTypes.htypedef short (*QDTxMeasProcPtr) ( short byteCount, const void * textAddr, Point * numer, Point * denom, FontInfo * info );
If you name your function MyQDTxMeasProc, you would declare it like this:
short QDTxMeasProcPtr ( short byteCount, const void * textAddr, Point * numer, Point * denom, FontInfo * info );
QuickdrawTypes.htypedef OSStatus (*RegionToRectsProcPtr) ( UInt16 message, RgnHandle rgn, const Rect * rect, void * refCon );
If you name your function MyRegionToRectsProc, you would declare it like this:
OSStatus RegionToRectsProcPtr ( UInt16 message, RgnHandle rgn, const Rect * rect, void * refCon );
QuickdrawAPI.h
struct BitMap {
Ptr baseAddr;
short rowBytes;
Rect bounds;
};
typedef struct BitMap BitMap;
typedef BitMap * BitMapPtr;
baseAddrA pointer to the beginning of the bit image.
rowBytesThe offset in bytes from one row of the image to the next. The value of the rowBytes field must be less than $4000.
boundsThe bitmap’s boundary rectangle by default, the entire main screen.
A bitmap, which is a data structure of type BitMap, defines a bit image in terms of the QuickDraw coordinate plane. (A bit image is a collection of bits in memory that form a grid.)
A bitmap has three parts: a pointer to a bit image, the row width of that image, and a boundary rectangle that links the local coordinate system of a graphics port to QuickDraw’s global coordinate system and defines the area of the bit image into which QuickDraw can draw.
The width of the boundary rectangle determines how many bits of one row are logically owned by the bitmap. This width must not exceed the number of bits in each row of the bit image. The height of the boundary rectangle determines how many rows of the image are logically owned by the bitmap. The number of rows enclosed by the boundary rectangle must not exceed the number of rows in the bit image.
The boundary rectangle defines the local coordinate system used by the port rectangle for a graphics port (described next). The upper-left corner (which for a window is called the window origin) of the port rectangle usually has a vertical coordinate of 0 and a horizontal coordinate of 0, although you can use the function SetOrigin to change the coordinates of the window origin.
QuickdrawTypes.h
typedef short Bits16[16];
The Bits16 array is used by the Cursor structure to hold a black-and-white, 16-by-16 pixel square image.
QuickdrawTypes.h
struct CCrsr {
short crsrType;
PixMapHandle crsrMap;
Handle crsrData;
Handle crsrXData;
short crsrXValid;
Handle crsrXHandle;
Bits16 crsr1Data;
Bits16 crsrMask;
Point crsrHotSpot;
long crsrXTable;
long crsrID;
};
typedef struct CCrsr CCrsr;
typedef CCrsr * CCrsrPtr;
crsrTypeThe type of cursor. Possible values are $8000 for a black-and-white cursor and $8001 for a color cursor.
crsrMapA handle to the PixMap structure defining the cursor’s characteristics. When the screen depth is greater than 2 bits per pixel, the crsrMap field and the crsrData field define the image. The pixels within the mask replace the destination pixels. Color QuickDraw transfers the pixels outside the mask into the destination pixels using the XOR Boolean transfer mode. Therefore, if pixels outside the mask are white, the destination pixels aren’t changed. If pixels outside the mask are all black, the destination pixels are inverted. All other values outside of the mask cause unpredictable results.
crsrDataA handle to the cursor’s pixel data. To work properly, a color cursor’s image should contain white pixels (R=G=
B=$FFFF) for the transparent part of the image, and black pixels (R=G=B=$0000) for the part of the image to be inverted, in addition to the other colors in the cursor’s image. Thus, to define a cursor that contains two colors, it’s necessary to use a 2-bit cursor image (that is, a four-color image.
crsrXDataA handle to the expanded pixel image used internally by Color QuickDraw.
crsrXValidThe depth of the expanded cursor image. If you change the cursor’s data or color table, set this field to 0 to cause the cursor to be re-expanded. Never set it to any other values.
crsrXHandleReserved for future use.
crsr1DataA 16-by-16 pixel image with a pixel depth of 1 to be displayed when the cursor is on screens with pixel depths of 1 or 2 bits.
crsrMaskThe cursor’s mask data. QuickDraw uses the mask to crop the cursor’s outline into a background color or pattern. QuickDraw then draws the cursor into this shape. The same 1-bit mask is used with images specified by the crsrData and crsr1Data fields.
crsrHotSpotThe cursor’s hot spot.
crsrXTableReserved for future use.
crsrIDThe color table seed for the cursor.
Your application typically does not create CCrsr structures. Although you can create a CCrsr structure, it is usually easier to create a color cursor in a color cursor resource, ‘crsr’.
A color cursor is a 256-pixel color image in a 16-by-16 pixel square defined in a color cursor ( 'crsr') resource. When your application uses the GetCCursor function to get a color cursor from a 'crsr' resource, GetCCursor loads the resource into memory as a CCrsr structure. Your application can then display the color cursor by using the SetCCursor function.
CCrsr is substantially different from the Cursor structure. The fields crsr1Data, crsrMask, and crsrHotSpot in the CCrsr structure are the only ones that have counterparts in the Cursor structure.
The first four fields of the CCrsr structure are similar to the first four fields of the PixPat record, and are used in the same manner by QuickDraw.
The display of a cursor involves a relationship between a mask, stored in the crsrMask field with the same format used for 1-bit cursor masks, and an image. There are two possible sources for a color cursor’s image. When the cursor is on a screen whose depth is 1 or 2 bits per pixel, the image for the cursor is taken from the crsr1Data field, which contains bitmap cursor data, similar to the bitmap in a 'CURS' resource.
QuickdrawTypes.h
struct CGrafPort {
SInt16 device;
PixMapHandle portPixMap;
SInt16 portVersion;
Handle grafVars;
SInt16 chExtra;
SInt16 pnLocHFrac;
Rect portRect;
RgnHandle visRgn;
RgnHandle clipRgn;
PixPatHandle bkPixPat;
RGBColor rgbFgColor;
RGBColor rgbBkColor;
Point pnLoc;
Point pnSize;
SInt16 pnMode;
PixPatHandle pnPixPat;
PixPatHandle fillPixPat;
SInt16 pnVis;
SInt16 txFont;
StyleField txFace;
SInt16 txMode;
SInt16 txSize;
Fixed spExtra;
SInt32 fgColor;
SInt32 bkColor;
SInt16 colrBit;
SInt16 patStretch;
Handle picSave;
Handle rgnSave;
Handle polySave;
CQDProcsPtr grafProcs;
};
typedef GrafPtr CGrafPtr;
QuickdrawTypes.h
typedef ColorComplementProcPtr ColorComplementUPP;
QuickdrawTypes.h
typedef ColorSearchProcPtr ColorSearchUPP;
QuickdrawTypes.h
struct ColorSpec {
short value;
RGBColor rgb;
};
typedef struct ColorSpec ColorSpec;
typedef ColorSpec * ColorSpecPtr;
valueThe pixel value assigned by QuickDraw for the color specified in the rgb field of this structure. QuickDraw assigns a pixel value based on the capabilities of the user’s screen. For indexed devices, the pixel value is an index number assigned by QuickDraw to the closest color available on the indexed device for direct devices, this value expresses the best available red, green, and blue values for the color on the direct device.
rgbAn RGBColor structure that fully specifies the color whose approximation QuickDraw specifies in the value field.
When creating a PixMap structure for an indexed device, QuickDraw creates a ColorTable structure that defines the best colors available for the pixel image on that graphics device. QuickDraw also stores a ColorTable structure for the currently available colors in the graphics device’s CLUT.
One of the fields in a ColorTable structure requires a value of type cSpecArray, which is defined as an array of ColorSpec structures. Typically, your application never needs to create ColorTable structures or ColorSpec structures. For completeness, the data structure of type ColorSpec is shown here.
IOMacOSTypes.h
struct ColorTable {
long ctSeed;
short ctFlags;
short ctSize;
CSpecArray ctTable;
};
typedef struct ColorTable ColorTable;
typedef ColorTable * CTabPtr;
typedef CTabPtr * CTabHandle;
ctSeedIdentifies a particular instance of a color table. QuickDraw uses the ctSeed value to compare an indexed device’s color table with its associated inverse table (a table it uses for fast color lookup). When the color table for a graphics device has been changed, QuickDraw needs to rebuild the inverse table.
ctFlagsFlags that distinguish pixel map color tables from color tables in GDevice structures.
ctSizeOne less than the number of entries in the table.
ctTableAn array of ColorSpec entries, each containing a pixel value and a color specified by an RGBColor structure.
When creating a PixMap structure for a particular graphics device, QuickDraw creates a ColorTable structure that defines the best colors available for the pixel image on that particular graphics device. QuickDraw also creates a ColorTable structure of all available colors for use by the CLUT on indexed devices.
Typically, your application needs to create ColorTable structures only if it uses the Palette Manager.
Your application should never need to directly change the fields of a ColorTable structure. If you find it absolutely necessary for your application to do so, immediately use the CTabChanged function to notify QuickDraw that your application has changed the ColorTable structure.
QuickdrawTypes.h
typedef const Pattern* ConstPatternParam;
QuickdrawTypes.h
struct CProcRec {
Handle nxtComp;
ColorComplementUPP compProc;
};
typedef struct CProcRec CProcRec;
typedef CProcRec * CProcPtr;
nxtCompA handle to the next CPRocRec data structure in the list.
compProcA pointer to a complement function, as described in ColorComplementProcPtr.
The CProcRec data structure contains a pointer to a custom complement function and a pointer to the next complement function in the list.
QuickdrawTypes.h
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;
textProcA pointer to the low-level function that draws text. The standard QuickDraw function is the StdText function.
lineProcA pointer to the low-level function that draws lines. The standard QuickDraw function is the StdLine function.
rectProcA pointer to the low-level function that draws rectangles. The standard QuickDraw function is the StdRect function.
rRectProcA pointer to the low-level function that draws rounded rectangles. The standard QuickDraw function is the StdRRect function.
ovalProcA pointer to the low-level function that draws ovals. The standard QuickDraw function is the StdOval function.
arcProcA pointer to the low-level function that draws arcs. The standard QuickDraw function is the StdArc function.
polyProcA pointer to the low-level function that draws polygons. The standard QuickDraw function is the StdPoly function.
rgnProcA pointer to the low-level function that draws regions. The standard QuickDraw function is the StdRgn function.
bitsProcA pointer to the low-level function that copies bitmaps. The standard QuickDraw function is the StdBits function.
commentProcA pointer to the low-level function for processing a picture comment. The standard QuickDraw function is the StdComment function.
txMeasProcA pointer to the low-level function for measuring text width. The standard QuickDraw function is the StdTxMeas function.
getPicProcA pointer to the low-level function for retrieving information from the definition of a picture. The standard QuickDraw function is the StdGetPic function.
putPicProcA pointer to the low-level function for saving information as the definition of a picture. The standard QuickDraw function is the StdPutPic function.
opcodeProcReserved for future use.
newProc1Reserved for future use.
glyphsProcReserved for future use.
printerStatusProcReserved for future use.
newProc4Reserved for future use.
newProc5Reserved for future use.
newProc6Reserved for future use.
Use the CQDProcs structure only if you customize one or more of QuickDraw’s standard low-level drawing functions. Use the SetStdCProcs function to create a CQDProcs structure.
QuickdrawTypes.h
typedef ColorSpec CSpecArray[1];
QuickdrawTypes.h
struct Cursor {
Bits16 data;
Bits16 mask;
Point hotSpot;
};
typedef struct Cursor Cursor;
typedef Cursor * CursPtr;
dataCursor image data, which must begin on a word boundary.
maskThe cursor’s mask. QuickDraw uses the mask to crop the cursor’s outline into a background color or pattern. QuickDraw then draws the cursor into this shape.
hotSpotA point in the image that aligns a point (not a bit) in the image with the mouse location on the screen. Whenever the user moves the mouse, the low-level interrupt-driven mouse functions move the cursor. When the user clicks, the Event Manager function WaitNextEvent reports the location of the cursor’s hot spot in global coordinates.
Your application typically does not create Cursor structures. Although you can create a Cursor structure and its associated Bits16 array in your program code, it is usually easier to create a black-and-white cursor in a cursor resource,‘CURS’.
A cursor is a 256-pixel, black-and-white image in a 16-by-16 pixel square. When your application uses the GetCursor function to get a cursor from a 'CURS' resource, GetCursor loads the resource into memory as a Cursor structure. Your application then displays the color cursor by using the SetCursor function.
The cursor appears on the screen as a 16-by-16 pixel square. The appearance of each bit if the square is determined by the corresponding bits in the data and the mask and, if the mask bit is 0, by the pixel under the cursor. The four possible combinations of values for the data bit and the mask bit are:
Data bit 0, Mask bit 1. The resulting pixel on the screen is white.
Data bit 1, Mask bit 1. The resulting pixel on the screen is black.
Data bit 0, Mask bit 0. The resulting pixel on the screen is the same as the pixel under the cursor.
Data bit 1, Mask bit 0. The resulting pixel on the screen is the inverse of the pixel under the cursor.
Notice that if all mask bits are 0, the cursor is completely transparent, in that the image under the cursor can still be viewed. Pixels under the white part of the cursor appear unchanged; under the black part of the cursor, black pixels show through as white.
Basic QuickDraw supplies a predefined cursor in the global variable named arrow; this is the standard arrow cursor.
X.h
struct CursorImageRec {
UInt16 majorVersion;
UInt16 minorVersion;
PixMapHandle cursorPixMap;
BitMapHandle cursorBitMask;
};
typedef struct CursorImageRec CursorImageRec;
typedef CursorImageRec * CursorImagePtr;
Quickdraw.h
struct CursorInfo {
long version;
long capabilities;
long animateDuration;
Rect bounds;
Point hotspot;
long reserved;
};
typedef struct CursorInfo CursorInfo;
QuickdrawAPI.h
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;
QuickdrawAPI.h
typedef WindowPtr CWindowPtr;
QuickdrawTypes.h
typedef DeviceLoopDrawingProcPtr DeviceLoopDrawingUPP;
QuickdrawTypes.h
typedef unsigned long DeviceLoopFlags;
QuickdrawTypes.hAn opaque type that represents a dialog.
typedef struct OpaqueDialogPtr * DialogPtr;
This is a Dialog Manager data type, defined in QuickDraw for historical reasons. Its role in Mac OS X is to serve as the basis for the widely used DialogRef data type.
QuickdrawTypes.h
typedef UInt16 DragConstraint;
QuickdrawTypes.h
typedef DragGrayRgnProcPtr DragGrayRgnUPP;
QuickdrawTypes.h
struct GammaTbl {
short gVersion;
short gType;
short gFormulaSize;
short gChanCnt;
short gDataCnt;
short gDataWidth;
short gFormulaData[1];
};
typedef struct GammaTbl GammaTbl;
typedef GammaTbl * GammaTblPtr;
IOMacOSTypes.h
struct GDevice {
short gdRefNum;
short gdID;
short gdType;
ITabHandle gdITable;
short gdResPref;
SProcHndl gdSearchProc;
CProcHndl gdCompProc;
short gdFlags;
PixMapHandle gdPMap;
long gdRefCon;
GDHandle gdNextGD;
Rect gdRect;
long gdMode;
short gdCCBytes;
short gdCCDepth;
Handle gdCCXData;
Handle gdCCXMask;
long gdReserved;
};
typedef struct GDevice GDevice;
typedef GDevice * GDPtr;
typedef GDPtr * GDHandle;
gdRefNumThe reference number of the driver for the screen associated with the video device. For most video devices, this information is set at system startup time.
gdIDReserved. If you create your own GDevice structure, set this field to 0.
gdTypeThe general type of graphics device. See “Graphics Device Type Constants” for a description of the values which you can use in this field.
gdITableA handle to the inverse table for color mapping.
gdResPrefThe preferred resolution for inverse tables.
gdSearchProcA handle to the list of search functions. Its value is NULL for the default function.
gdCompProcA handle to a list of complement functions. Its value is NULL for the default function.
gdFlagsThe GDevice structure’s attributes. To set the attribute bits in the gdFlags field, use the SetDeviceAttribute function. Do not set gdFlags directly in the GDevice structure.
gdPMapA handle to a PixMap structure giving the dimension of the image buffer, along with the characteristics of the graphics device (resolution, storage format, color depth, and color table). For GDevice structures, the high bit of the global variable
(((**TheGDevice).**gdPMap).**pmTable).ctFlags
is always set.
gdRefConA value used by system software to pass device-related parameters. Since a graphics device is shared, do not store data here.
gdNextGDA handle to the next graphics device in the device list. If this is the last graphics device in the device list, the field contains 0.
gdRectThe boundary rectangle of the graphics device represented by the GDevice structure. The main screen has the upper-left corner of the rectangle set to (0,0). All other graphics devices are relative to this point.
gdModeThe current setting for the graphics device mode. This value is passed to the video driver to set its pixel depth and to specify color or black and white; applications do not need this information.
gdCCBytesThe rowBytes value of the expanded cursor. Your application should not change this field.
gdCCDepthThe depth of the expanded cursor. Your application should not change this field.
gdCCXDataA handle to the cursor’s expanded data. Your application should not change this field.
gdCCXMaskA handle to the cursor’s expanded mask. Your application should not change this field.
gdReservedReserved for future expansion; it must be set to 0 for future compatibility.
Color QuickDraw stores state information for video devices and offscreen graphics worlds in GDevice structures. When the system starts up, it allocates and initializes one handle to a GDevice structure for each video device it finds. When you use the Offscreen Graphics Devices function, NewGWorld, Color QuickDraw automatically creates a GDevice structure for the new offscreen graphics world. The system links these GDevice structures in a list, called the device list. (You can find a handle to the first element in the device list in the global variable DeviceList.) By default, the GDevice structure corresponding to the first video device found is marked as the current device. All other graphics devices in the list are initially marked as inactive.
When the user moves a window or creates a window on another screen, and your application draws into that window, Color QuickDraw automatically makes the video device for that screen the current device. Color QuickDraw stores that information in the global variable TheGDevice.
GDevice structures that correspond to video devices have drivers associated with them. These drivers can be used to change the mode of the video device from black and white to color and to change the pixel depth. Application-created GDevice structures usually don’t require drivers.
Your application should never need to directly change the fields of a GDevice structure. If you find it absolutely necessary for your application to so, immediately use the GDeviceChanged function to notify QuickDraw that your application has changed the GDevice structure.
QuickdrawTypes.h
struct GrafPort {
SInt16 device;
BitMap portBits;
Rect portRect;
RgnHandle visRgn;
RgnHandle clipRgn;
Pattern bkPat;
Pattern fillPat;
Point pnLoc;
Point pnSize;
SInt16 pnMode;
Pattern pnPat;
SInt16 pnVis;
SInt16 txFont;
StyleField txFace;
SInt16 txMode;
SInt16 txSize;
Fixed spExtra;
SInt32 fgColor;
SInt32 bkColor;
SInt16 colrBit;
SInt16 patStretch;
Handle picSave;
Handle rgnSave;
Handle polySave;
QDProcsPtr grafProcs;
};
typedef struct OpaqueGrafPtr * GrafPtr;
QuickdrawTypes.h
struct GrafVars {
RGBColor rgbOpColor;
RGBColor rgbHiliteColor;
Handle pmFgColor;
short pmFgIndex;
Handle pmBkColor;
short pmBkIndex;
short pmFlags;
};
typedef struct GrafVars GrafVars;
typedef GrafVars * GVarPtr;
rgbOpColorThe color for the arithmetic transfer operations addPin, subPin, and blend.
rgbHiliteColorThe highlight color for this graphics port.
pmFgColorA handle to the palette that contains the foreground color.
pmFgIndexThe index value into the palette for the foreground color.
pmBkColorA handle to the palette that contains the background color.
pmBkIndexThe index value into the palette for the background color.
pmFlagsFlags private to the Palette Manager.
The GrafVars structure contains color information in addition to that in the CGrafPort structure, of which it is logically a part; the information is used by QuickDraw and the Palette Manager.
QuickdrawTypes.h
typedef SInt8 GrafVerb;
QuickdrawTypes.h
typedef unsigned long GWorldFlags;
Several functions expect or return values defined by the GWorldFlags data type. See “Graphics World Flags” for a detailed description of these flags.
QDOffscreen.h
Defines a pointer to a structure that your application can use to refer to an offscreen graphics world.
typedef CGrafPtr GWorldPtr;
An offscreen graphics world in color QuickDraw contains a CGrafPort structure—and its handles to associated PixMap and ColorTable structures—that describes an offscreen graphics port and contains references to a GDevice structure and other state information. The actual data structure for an offscreen graphics world is kept private to allow for future extensions. However, when your application uses the NewGWorld function to create an offscreen world, NewGWorld returns a pointer of type GWorldPtr by which your application refers to the offscreen graphics world.
On computers lacking color QuickDraw, GWorldPtr points to an extension of the GrafPort structure.
QDOffscreen.h
struct ITab {
long iTabSeed;
short iTabRes;
Byte iTTable[1];
};
typedef struct ITab ITab;
typedef ITab * ITabPtr;
typedef ITabPtr * ITabHandle;
iTabSeedThe iTabSeed value, initially set from the corresponding CLUT’s ctSeed field. If at any time these do not match, then the color table was changed, and the inverse table needs to be rebuilt.
iTabResThe resolution of this inverse table.
iTTableAn array of index values. The size of the iTabTable field in bytes is 23*iTabRes.
The ITab data structure contains the inverse table information that the Color Manager uses for fast mapping of RGB color values.
QuickdrawTypes.h
struct MacPolygon {
short polySize;
Rect polyBBox;
Point polyPoints[1];
};
typedef struct MacPolygon MacPolygon;
typedef MacPolygon Polygon;
typedef MacPolygon * PolyPtr;
typedef PolyPtr * PolyHandle;
QuickdrawTypes.h
struct MacRegion {
UInt16 rgnSize;
Rect rgnBBox;
};
typedef struct MacRegion MacRegion;
QuickdrawTypes.h
struct MatchRec {
unsigned short red;
unsigned short green;
unsigned short blue;
long matchData;
};
typedef struct MatchRec MatchRec;
redRed value of the seed.
greenGreen value of the seed.
blueBlue value of the seed.
matchDataThe value passed in the matchData parameter of the SeedCFill or CalcCMask function.
When SeedCFill or CalcCMask calls your color search function, the GDRefCon field of the current GDevice structure contains a pointer to a MatchRec structure. This structure contains the RGB value of the seed pixel or seed color for which your color search function searches.
QuickdrawTypes.h
struct OpenCPicParams {
Rect srcRect;
Fixed hRes;
Fixed vRes;
short version;
short reserved1;
long reserved2;
};
typedef struct OpenCPicParams OpenCPicParams;
srcRectThe optimal bounding rectangle for the resolution indicated by the hRes and vRes fields. When you later call the DrawPicture function to play back the saved picture, specify a destination rectangle and DrawPicture scales the picture so that it is completely aligned with the destination rectangle.
hResThe best horizontal resolution for the picture. A value of $00480000 specifies a horizontal resolution of 72 dpi.
vResThe best vertical resolution for the picture. A value of $00480000 specifies a vertical resolution of 72 dpi.
versionAlways set this field to –2.
reserved1Reserved; set to 0.
reserved2Reserved; set to 0.
When you use the OpenCPicture function to begin creating a picture, you must pass it information in an OpenCPicParams structure. This structure provides a simple mechanism for specifying resolutions when creating images. For example, applications that create pictures from scanned images can specify resolutions higher than 72 dpi for these pictures in OpenCPicParams structures.
QuickdrawTypes.h
struct Pattern {
UInt8 pat[8];
};
typedef struct Pattern Pattern;
typedef Pattern * PatPtr;
typedef PatPtr * PatHandle;
Your application typically does not create Pattern structures. Although you can create Pattern structures in your program code, it is usually easier to create bit patterns using the pattern, ‘PAT’, or pattern list, ‘PAT#’, resource.
A bit pattern is a 64-bit image, organized as an 8-by-8 bit square, that defines a repeating design or tone. When a pattern is drawn, it is aligned so that adjacent areas of the same pattern in the same graphics port form a continuous, coordinated pattern. QuickDraw provides predefined patterns in global variables named white, black, gray, ltGray, and dkGray. The row width of a pattern is 1 byte.
QuickdrawTypes.h
struct PenState {
Point pnLoc;
Point pnSize;
short pnMode;
Pattern pnPat;
};
typedef struct PenState PenState;
pnLocFor the current graphics port at the time the GetPenState function was called, the value of that graphics port’s pnLoc field. This value is the point where QuickDraw begins drawing next. The location of the graphics pen is a point in the graphics port’s coordinate system, not a pixel in a bit image. The upper-left corner of the pen is at the pen location the graphics pen hangs below and to the right of this point.
pnSizeFor the current graphics port at the time the GetPenState function was called, the value of that graphics port’s pnSize field. The graphics pen is rectangular in shape, and its width and height are specified by the values in the pnSize field. The default size is a 1-by-1 bit square; the width and height can range from 0 by 0 to 32,767 by 32,767. If either the pen width or the pen height is 0, the pen does not draw. Heights or widths of less than 0 are undefined.
pnModeThe pattern mode—that is, for the current graphics port at the time the GetPenState function was called, the value of that graphics port’s pnMode field. This value determines how the pen pattern is to affect what’s already in the bit image when lines or shapes are drawn. When the graphics pen draws, QuickDraw first determines what bits in the bit image are affected, finds their corresponding bits in the pattern, and then transfers the bits from the pattern into the image according to this mode, which specifies one of eight Boolean transfer operations. The resulting bit is stored into its proper place in the bit image.
pnPatFor the current graphics port at the time the GetPenState function was called, the pen pattern for that graphics port. This pattern determines how the bits under the graphics pen are affected when lines or shapes are drawn.
The GetPenState function saves the location, size, pattern, and pattern mode of the graphics pen for the current graphics port in a PenState structure, which is a data structure of type PenState. After changing the graphics pen as necessary, you can later restore these pen states with the SetPenState function.
QuickdrawTypes.h
struct Picture {
short picSize;
Rect picFrame;
};
typedef struct Picture Picture;
typedef Picture * PicPtr;
typedef PicPtr * PicHandle;
picSizeThe size of the rest of this structure for a version 1 picture. To maintain compatibility with the version 1 picture format, the picSize field was not changed for the version 2 picture or extended version 2 formats. The information in this field is used only for version 1 pictures, which cannot exceed 32 KB in size. Because version 2 and extended version 2 pictures can be much larger than the 32 KB limit imposed by the 2-byte picSize field, you should use the Memory Manager function GetHandleSize to determine the size of a picture in memory; you should use the File Manager function PBGetFInfo to determine the size of a picture in a 'PICT' file; and you should use the Resource Manager function GetMaxResourceSize to determine the size of a 'PICT' resource.
picFrameThe bounding rectangle for the picture defined in the rest of this structure. The DrawPicture function uses this rectangle to scale the picture if you draw it into a destination rectangle of a different size.
When you use the OpenCPicture or OpenPicture function, QuickDraw begins collecting your subsequent drawing commands in a Picture structure. (You use the ClosePicture function to complete a picture definition.) When you use the GetPicture function to retrieve a picture stored in a resource, GetPicture reads the resource into memory as a Picture structure. By using the DrawPicture procedure, you can draw onscreen the picture defined by the commands stored in the Picture structure.
A picture opcode is a number that the DrawPicture function uses to determine what object to draw or what mode to change for subsequent drawing. Generally, do not read or write this picture data directly. Instead, use the OpenCPicture (or OpenPicture), ClosePicture, and DrawPicture functions to process these opcodes.
The Picture structure can also contain picture comments. Created by applications using the PicComment function, picture comments contain data or commands for special processing by output devices, such as PostScript printers.
You can use File Manager functions to save the picture in a file of type 'PICT', you can use Resource Manager functions to save the picture in a resource of type 'PICT', and you can use the Scrap Manager function PutScrap to store the picture in 'PICT' scrap format.
QuickdrawTypes.h
typedef SInt8 PixelType;
QuickdrawTypes.h
struct PixMap {
Ptr baseAddr;
short rowBytes;
Rect bounds;
short pmVersion;
short packType;
long packSize;
Fixed hRes;
Fixed vRes;
short pixelType;
short pixelSize;
short cmpCount;
short cmpSize;
long planeBytes;
CTabHandle pmTable;
long pmReserved;
};
typedef struct PixMap PixMap;
typedef PixMap * PixMapPtr;
typedef PixMapPtr * PixMapHandle;
baseAddrFor an onscreen pixel image, a pointer to the first byte of the image. For optimal performance, this should be a multiple of 4. The pixel image that appears on a screen is normally stored on a graphics card rather than in main memory.
Note that the baseAddr field of the PixMap structure for an offscreen graphics world contains a handle instead of a pointer. You must use the GetPixBaseAddr function to obtain a pointer to the PixMap structure for an offscreen graphics world. Your application should never directly access the baseAddr field of the PixMap structure for an offscreen graphics world.
rowBytesThe offset in bytes from one row of the image to the next. The value must be even, less than $4000, and for best performance it should be a multiple of 4. The high 2 bits of rowBytes are used as flags. If bit 15 = 1, the data structure pointed to is a PixMap structure; otherwise it is a BitMap structure.
boundsThe boundary rectangle, which links the local coordinate system of a graphics port to QuickDraw’s global coordinate system and defines the area of the bit image into which QuickDraw can draw. By default, the boundary rectangle is the entire main screen. Do not use the value of this field to determine the size of the screen instead use the value of the gdRect field of the GDevice structure for the screen.
pmVersionThe version number of QuickDraw that created this PixMap structure. The value of pmVersion is normally 0. If pmVersion is 4, QuickDraw treats the PixMap structure’s baseAddr field as 32-bit clean. All other flags are private. Most applications never need to set this field.
packTypeThe packing algorithm used to compress image data. QuickDraw currently supports a packType of 0, which means no packing, and values of 1 to 4 for packing direct pixels.
packSizeThe size of the packed image in bytes. When the packType field contains the value 0, this field is always set to 0.
hResThe horizontal resolution of the pixel image in pixels per inch. This value is of type Fixed; by default, the value here is $00480000 (for 72 pixels per inch).
vResThe vertical resolution of the pixel image in pixels per inch. This value is of type Fixed; by default, the value here is $00480000 (for 72 pixels per inch).
pixelTypeThe storage format for a pixel image. Indexed pixels are indicated by a value of 0. Direct pixels are specified by a value of RGBDirect, or 16. In the PixMap structure of the GDevice structure for a direct device, this field is set to the constant RGBDirect when the screen depth is set.
pixelSizePixel depth; that is, the number of bits used to represent a pixel. Indexed pixels can have sizes of 1, 2, 4, and 8 bits; direct pixel sizes are 16 and 32 bits.
cmpCountThe number of components used to represent a color for a pixel. With indexed pixels, each pixel is a single value representing an index in a color table, and therefore this field contains the value 1—the index is the single component. With direct pixels, each pixel contains three components—one integer each for the intensities of red, green, and blue—so this field contains the value 3.
cmpSizeThe size in bits of each component for a pixel. QuickDraw expects that the sizes of all components are the same, and that the value of the cmpCount field multiplied by the value of the cmpSize field is less than or equal to the value in the pixelSize field.
For an indexed pixel value, which has only one component, the value of the cmpSize field is the same as the value of the pixelSize field—that is, 1, 2, 4, or 8.
For direct pixels there are two additional possibilities:
A 16-bit pixel, which has three components, has a cmpSize value of 5. This leaves an unused high-order bit, which QuickDraw sets to 0.
A 32-bit pixel, which has three components (red, green, and blue), has a cmpSize value of 8. This leaves an unused high-order byte, which QuickDraw sets to 0.
Generally, therefore, your application should clear the memory for the image to 0 before creating a 16-bit or 32-bit image. The Memory Manager functions NewHandleClear and NewPtrClear assist you in allocating pre-zeroed memory.
planeBytesThe offset in bytes from one drawing plane to the next. This field is set to 0.
pmTableA handle to a ColorTable structure for the colors in this pixel map.
pmReservedReserved for future expansion. This field must be set to 0 for future compatibility.
The PixMap structure contains information about the dimensions, contents, storage format, depth, resolution, and color usage of a pixel image. The pixel map for a window’s color graphics port always consists of the pixel depth, color table, and boundary rectangle of the main screen, even if the window is created on or moved to an entirely different screen.
QuickdrawTypes.h
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;
patTypeThe pattern’s type. The value 0 specifies a basic QuickDraw bit pattern, the value 1 specifies a full-color pixel pattern, and the value 2 specifies an RGB pattern.
patMapA handle to a PixMap structure that describes the pattern’s pixel image. The PixMap structure can contain indexed or direct pixels.
patDataA handle to the pattern’s pixel image.
patXDataA handle to an expanded pixel image used internally by QuickDraw.
patXValidA flag that, when set to –1, invalidates the expanded data.
patXMapReserved for use by QuickDraw.
pat1DataA bit pattern to be used when this pattern is drawn into a GrafPort structure. The NewPixPat function sets this field to 50 percent gray.
Your application typically does not create PixPat structures. Although you can create such structures in your program code, it is usually easier to create pixel patterns using the pixel pattern resource, 'ppat'.
When used for a color graphics port, the basic QuickDraw functions PenPat and BackPat store pixel patterns in, respectively, the pnPixPat and bkPixPat fields of the CGrafPort structure and set the patType field of the PixPat field to 0 to indicate that the PixPat structure contains a bit pattern. Such patterns are limited to 8-by-8 pixel dimensions and, instead of being drawn in black and white, are always drawn using the colors specified in the CGrafPort structure’s rgbFgColor and rgbBkColor fields, respectively.
In a full-color pixel pattern, the patType field contains the value 1, and the pattern’s dimensions, depth, resolution, set of colors, and other characteristics are defined by a PixMap structure, referenced by the handle in the patMap field of the PixPat structure. Full-color pixel patterns contain color tables that describe the colors they use. Generally such a color table contains one entry for each color used in the pattern. For instance, if your pattern has five colors, you would probably create a 4 bits per pixel pattern that uses pixel values 0–4, and a color table with five entries, numbered 0–4, that contain the RGB specifications for those pixel values.
However, if you don’t specify a color table for a pixel value, QuickDraw assigns a color to that pixel value. The largest unassigned pixel value becomes the foreground color the smallest unassigned pixel value is assigned the background color. Remaining unassigned pixel values are given colors that are evenly distributed between the foreground and background.
For instance, in the color table mentioned above, pixel values 5–15 are unused. Assume that the foreground color is black and the background color is white. Pixel value 15 is assigned the foreground color, black pixel value 5 is assigned the background color, white the nine pixel values between them are assigned evenly distributed shades of gray. If the PixMap structure’s color table is set to NULL, all pixel values are determined by blending the foreground and background colors.
Full-color pixel patterns are not limited to a fixed size: their height and width can be any power of 2, as specified by the height and width of the boundary rectangle for the PixMap structure specified in the patMap field. A pattern 8 bits wide, which is the size of a bit pattern, has a row width of just 1 byte, contrary to the usual rule that the rowBytes field must be even. Read this pattern type into memory using the GetPixPat function, and set it using the PenPixPat or BackPixPat functions.
The pixel map specified in the patMap field of the PixPat structure defines the pattern’s characteristics. The baseAddr field of the PixMap structure for that pixel map is ignored. For a full-color pixel pattern, the actual pixel image defining the pattern is stored in the handle in the patData field of the PixPat structure. The pattern’s pixel depth need not match that of the pixel map into which it’s transferred the depth is adjusted automatically when the pattern is drawn. QuickDraw maintains a private copy of the pattern’s pixel image, expanded to the current screen depth and aligned to the current graphics port, in the patXData field of the PixPat structure.
In an RGB pixel pattern, the patType field contains the value 2. Using the MakeRGBPat function, your application can specify the exact color it wants to use. QuickDraw selects a pattern to approximate that color. In this way, your application can effectively increase the color resolution of the screen. RGB pixel patterns are particularly useful for dithering: mixing existing colors together to create the illusion of a third color that’s unavailable on an indexed device. The MakeRGBPat function aids in this process by constructing a dithered pattern to approximate a given absolute color. An RGB pixel pattern can display 125 different patterns on a 4-bit screen, or 2197 different patterns on an 8-bit screen.
An RGB pixel pattern has an 8-by-8 pixel pattern that is 2 bits deep. For an RGB pixel pattern, the RGBColor structure that you specify to the MakeRGBPat function defines the image; there is no image data.
Your application should never need to directly change the fields of a PixPat structure. If you find it absolutely necessary for your application to so, immediately use the PixPatChanged function to notify QuickDraw that your application has changed the PixPat structure.
QuickdrawTypes.h
typedef MacPolygon Polygon;
After you use the OpenPoly function to create a polygon, QuickDraw begins collecting the line-drawing information you provide into a MacPolygon structure. The OpenPoly function returns a handle to the newly allocated MacPolygon structure. Thereafter, your application normally refers to your new polygon by this handle, because QuickDraw functions such as FramePoly and PaintPoly expect a handle to a Polygon as their first parameter.
A polygon is defined by a sequence of connected lines. A MacPolygon structure consists of two fixed-length fields followed by a variable-length array of points: the starting point followed by each successive point to which a line is drawn.
Your application typically does not need to create a MacPolygon structure.
QuickdrawTypes.h
struct PrinterFontStatus {
SInt32 oResult;
SInt16 iFondID;
Style iStyle;
};
typedef struct PrinterFontStatus PrinterFontStatus;
QuickdrawTypes.h
struct PrinterScalingStatus {
Point oScalingFactors;
};
typedef struct PrinterScalingStatus PrinterScalingStatus;
QuickdrawTypes.h
typedef SInt32 PrinterStatusOpcode;
QuickdrawTypes.h
typedef QDArcProcPtr QDArcUPP;
QuickdrawTypes.h
typedef QDBitsProcPtr QDBitsUPP;
QuickdrawTypes.h
typedef SignedByte QDByte;
QuickdrawTypes.h
typedef QDCommentProcPtr QDCommentUPP;
QuickdrawTypes.h
typedef short QDErr;
QuickdrawTypes.h
typedef QDGetPicProcPtr QDGetPicUPP;
QuickdrawTypes.h
struct QDGlobals {
char privates[76];
long randSeed;
BitMap screenBits;
Cursor arrow;
Pattern dkGray;
Pattern ltGray;
Pattern gray;
Pattern black;
Pattern white;
GrafPtr thePort;
};
typedef struct QDGlobals QDGlobals;
typedef QDGlobals * QDGlobalsPtr;
QuickdrawTypes.h
typedef QDJShieldCursorProcPtr QDJShieldCursorUPP;
QuickdrawTypes.h
typedef QDLineProcPtr QDLineUPP;
QuickdrawTypes.h
typedef QDOpcodeProcPtr QDOpcodeUPP;
QuickdrawTypes.h
typedef QDOvalProcPtr QDOvalUPP;
QuickdrawTypes.h
Defines an opaque data type that represents a QuickDraw picture in the Quartz 2D graphics environment.
typedef struct QDPict * QDPictRef;
This opaque type is used to draw QuickDraw picture data in a Quartz context. (Quartz 2D defines an analogous opaque type called CGPDFDocumentRef which is used to draw PDF data in a Quartz context.) An instance of the QDPictRef type is called a QDPict picture. There are two ways to create a QDPict picture:
You can call QDPictCreateWithProvider, passing in a Quartz data provider for the picture data. Typically the source of this data is a 'PICT' resource.
You can call QDPictCreateWithURL, passing in a Core Foundation URL that specifies a file with picture data in the data fork.
Both functions verify that picture header information is present, starting at either byte 1 or byte 513 of the picture data.
To draw a QDPict picture in a Quartz context, you call QDPictDrawToCGContext. To get the bounds or native resolution of a QDPict picture, you call QDPictGetBounds or QDPictGetResolution.
When you draw a QDPict picture in a PDF context, you can save the drawing in a PDF file. This is the recommended way to convert QuickDraw pictures into single-page PDF documents.
These additional sources of information may be helpful:
The sample Carbon program CGDrawPicture shows how to use this opaque type to draw QuickDraw pictures in a Quartz context.
For general information about QuickDraw pictures and the PICT graphics format, see Chapter 7 in Inside Macintosh: Imaging With QuickDraw.
QDPictToCGContext.h
typedef QDPolyProcPtr QDPolyUPP;
QuickdrawTypes.h
typedef QDPrinterStatusProcPtr QDPrinterStatusUPP;
QuickdrawTypes.h
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;
textProcA pointer to the low-level function that draws text. The standard QuickDraw function is the StdText function.
lineProcA pointer to the low-level function that draws lines. The standard QuickDraw function is the StdLine function.
rectProcA pointer to the low-level function that draws rectangles. The standard QuickDraw function is the StdRect function.
rRectProcA pointer to the low-level function that draws rounded rectangles. The standard QuickDraw function is the StdRRect function.
ovalProcA pointer to the low-level function that draws ovals. The standard QuickDraw function is the StdOval function.
arcProcA pointer to the low-level function that draws arcs. The standard QuickDraw function is the StdArc function.
polyProcA pointer to the low-level function that draws polygons. The standard QuickDraw function is the StdPoly function.
rgnProcA pointer to the low-level function that draws regions. The standard QuickDraw function is the StdRgn function.
bitsProcA pointer to the low-level function that copies bitmaps. The standard QuickDraw function is the StdBits function.
commentProcA pointer to the low-level function for processing a picture comment. The standard QuickDraw function is the StdComment function.
txMeasProcA pointer to the low-level function for measuring text width. The standard QuickDraw function is the StdTxMeas function.
getPicProcA pointer to the low-level function for retrieving information from the definition of a picture. The standard QuickDraw function is the StdGetPic function.
putPicProcA pointer to the low-level function for saving information as the definition of a picture. The standard QuickDraw function is the StdPutPic function.
You need to use the QDProcs structure only if you customize one or more of QuickDraw’s low-level drawing functions. Use SetStdProcs to create a QDProcs structure.
The QDProcs structure contains pointers to low-level drawing functions. You can change the fields of this structure to point to functions of your own devising.
QuickdrawTypes.h
typedef QDPutPicProcPtr QDPutPicUPP;
QuickdrawTypes.h
typedef QDRectProcPtr QDRectUPP;
QuickdrawTypes.h
typedef struct OpaqueQDRegionBitsRef * QDRegionBitsRef;
QuickdrawAPI.h
typedef SInt32 QDRegionParseDirection;
QuickdrawAPI.h
typedef QDRgnProcPtr QDRgnUPP;
QuickdrawTypes.h
typedef QDRRectProcPtr QDRRectUPP;
QuickdrawTypes.h
typedef QDStdGlyphsProcPtr QDStdGlyphsUPP;
QuickdrawTypes.h
typedef QDTextProcPtr QDTextUPP;
QuickdrawTypes.h
typedef QDTxMeasProcPtr QDTxMeasUPP;
QuickdrawTypes.h
typedef RegionToRectsProcPtr RegionToRectsUPP;
QuickdrawAPI.h
struct ReqListRec {
short reqLSize;
short reqLData[1];
};
typedef struct ReqListRec ReqListRec;
reqLSizeThe size of this ReqListRec data structure minus one.
reqLDataAn array of integers representing offsets into a color table.
The ReqListRec data structure is a parameter to the SaveEntries function by which you can describe color table entries to be saved.
QuickdrawTypes.h
struct RGBColor {
unsigned short red;
unsigned short green;
unsigned short blue;
};
typedef struct RGBColor RGBColor;
typedef RGBColor * RGBColorPtr;
redAn unsigned integer specifying the red value of the color.
greenAn unsigned integer specifying the green value of the color.
blueAn unsigned integer specifying the blue value of the color.
You usually specify a color to QuickDraw by creating an RGBColor structure in which you assign the red, green, and blue values of the foreground color. For example, when you want to set the foreground color for drawing, you create an RGBColor structure that defines the foreground color you desire; then you pass that structure as a parameter to the RGBForeColor function.
In an RGBColor structure, three 16-bit unsigned integers give the intensity values for the three additive primary colors.
IOMacOSTypes.h
An opaque type that represents a QuickDraw region.
typedef struct OpaqueRgnHandle * RgnHandle;
A region is an arbitrary area or set of areas on the QuickDraw coordinate plane. The outline of a region should be one or more closed loops.
QuickdrawTypes.h
struct SProcRec {
Handle nxtSrch;
ColorSearchUPP srchProc;
};
typedef struct SProcRec SProcRec;
typedef SProcRec * SProcPtr;
nxtSrchA handle to the next SProcRec data structure in the chain of search functions.
srchProcA pointer to a custom search function (described in ColorSearchProcPtr).
The SProcRec data structure contains a pointer to a custom search function and a handle to the next SProcRec data structure in the function list.
QuickdrawTypes.hAn opaque type that represents a window.
typedef struct OpaqueWindowPtr * WindowPtr;
This is a Window Manager data type, defined in QuickDraw for historical reasons. Its role in Mac OS X is to serve as the basis for the widely used WindowRef data type.
QuickdrawTypes.h
struct xColorSpec {
short value;
RGBColor rgb;
short xalpha;
};
typedef struct xColorSpec xColorSpec;
typedef xColorSpec * xColorSpecPtr;
QuickdrawTypes.h
typedef xColorSpec xCSpecArray[1];
QuickdrawTypes.h
enum {
chunky = 0,
chunkyPlanar = 1,
planar = 2
};
enum {
blackColor = 33,
whiteColor = 30,
redColor = 205,
greenColor = 341,
blueColor = 409,
cyanColor = 273,
magentaColor = 137,
yellowColor = 69
};
blackColorRepresents black.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
whiteColorRepresents white.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
redColorRepresents red.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
greenColorRepresents green.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
blueColorRepresents blue.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
cyanColorRepresents cyan.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
magentaColorRepresents magenta.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
yellowColorRepresents yellow.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
These constants are used in the color parameter of the ForeColor and BackColor functions to specify one of the eight basic QuickDraw colors.
enum {
colorXorXFer = 52,
noiseXFer = 53,
customXFer = 54
};
enum {
sysPatListID = 0,
iBeamCursor = 1,
crossCursor = 2,
plusCursor = 3,
watchCursor = 4
};
iBeamCursorThe I-beam cursor; to select text
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
crossCursorThe crosshairs cursor; to draw graphics
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
plusCursorThe plus sign cursor; to select cells
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
watchCursorThe wristwatch cursor; to indicate a short operation in progress
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
When passing a value to the Show_Cursor function, use the Cursors data type to represent the kind of cursor to show.
enum {
cursorDoesAnimate = 1L << 0,
cursorDoesHardware = 1L << 1,
cursorDoesUnreadableScreenBits = 1L << 2
};
enum {
interlacedDevice = 2,
hwMirroredDevice = 4,
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
};
burstDeviceIf this bit is set to 1, the graphics device supports block transfer.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
ext32DeviceIf this bit is set to 1, the graphics device must be used in 32-bit mode.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
ramInitIf this bit is set to 1, the graphics device has been initialized from RAM.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
mainScreenIf this bit is set to 1,the graphics device is the main screen.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
allInitIf this bit is set to 1, all graphics devices were initialized from the 'scrn' resource.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
screenDeviceIf this bit is set to 1, the graphics device is a screen.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
noDriverIf this bit is set to 1, the GDevice structure has no driver.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
screenActiveIf this bit is set to 1, the graphics device is active.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
These constants are used in the attribute parameters of the SetDeviceAttribute and TestDeviceAttribute functions, and in the deviceFlags parameter of the DeviceLoopDrawingProcPtr callback. These constants represent the GDevice structure’s attributes, as bits in the gdFlags field.
enum {
singleDevices = 1 << singleDevicesBit,
dontMatchSeeds = 1 << dontMatchSeedsBit,
allDevices = 1 << allDevicesBit
};
singleDevicesIf this flag is not set, DeviceLoop calls your drawing function only once for each set of similar graphics devices, and the first one found is passed as the target device. (It is assumed to be representative of all the similar graphics devices.) If you set the singleDevices flag, then DeviceLoop does not group similar graphics devices, (that is, those having identical pixel depths, black-and-white or color settings, and matching color table seeds), when it calls your drawing function.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
dontMatchSeedsIf you set the dontMatchSeeds flag, then DeviceLoop does not consider the ctSeed field of ColorTable structures for graphics devices when comparing them; DeviceLoop ignores this flag if you set the singleDevices flag.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
allDevicesIf you set the allDevices flag, DeviceLoop ignores the drawingRgn parameter and calls your drawing function for every device. The value of the current graphics port’s visRgn field is not affected when you set this flag.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
When you use the DeviceLoop function, you can change its default behavior by using the flags parameter to specify one or more members of the set of flags defined by the DeviceLoopFlags data type. If you want to use the default behavior of DeviceLoop, specify 0 in the flags parameter.
enum {
deviceIsIndirect = (1L << 0),
deviceNeedsLock = (1L << 1),
deviceIsStatic = (1L << 2),
deviceIsExternalBuffer = (1L << 3),
deviceIsDDSurface = (1L << 4),
deviceIsDCISurface = (1L << 5),
deviceIsGDISurface = (1L << 6),
deviceIsAScreen = (1L << 7),
deviceIsOverlaySurface = (1L << 8)
};
When passed to the DragControl function, specify how a user can move a control.
enum {
kNoConstraint = 0,
kVerticalConstraint = 1,
kHorizontalConstraint = 2
};
kNoConstraintNo constraint.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
kVerticalConstraintConstrain movement to horizontal axis only.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
kHorizontalConstraintConstrain movement to vertical axis only.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
enum {
picLParen = 0,
picRParen = 1,
clutType = 0,
fixedType = 1,
directType = 2,
gdDevType = 0
};
clutTypeRepresents a CLUT device--that is, one with colors mapped with a color lookup table.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
fixedTypeRepresents a fixed colors device --that is, the color lookup table can't be changed.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
directTypeRepresents a device with direct RGB colors.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
gdDevTypeIf this bit is set to 0, the graphics device is black and white; if it is set to 1, the graphics device supports color.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
These constants represent the general type of graphics device for the gdType field of the GDevice structure.
Specify additional information passed to and from NewGWorld and related functions in parameters of type GWorldFlags.
enum {
pixPurge = 1L << pixPurgeBit,
noNewDevice = 1L << noNewDeviceBit,
useTempMem = 1L << useTempMemBit,
keepLocal = 1L << keepLocalBit,
useDistantHdwrMem = 1L << useDistantHdwrMemBit,
useLocalHdwrMem = 1L << useLocalHdwrMemBit,
pixelsPurgeable = 1L << pixelsPurgeableBit,
pixelsLocked = 1L << pixelsLockedBit,
kNativeEndianPixMap = 1L << nativeEndianPixMapBit,
kAllocDirectDrawSurface = 1L << 14,
mapPix = 1L << mapPixBit,
newDepth = 1L << newDepthBit,
alignPix = 1L << alignPixBit,
newRowBytes = 1L << newRowBytesBit,
reallocPix = 1L << reallocPixBit,
clipPix = 1L << clipPixBit,
stretchPix = 1L << stretchPixBit,
ditherPix = 1L << ditherPixBit,
gwFlagErr = 1L << gwFlagErrBit
};
pixPurgeIf you specify this flag for the flags parameter of the NewGWorld function, UpdateGWorld makes the base address for the offscreen pixel image purgeable.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
noNewDeviceIf you specify this flag for the flags parameter of the UpdateGWorld function, NewGWorld does not create a new offscreen GDevice structure; instead, NewGWorld uses either the GDevice structure you specify or the GDevice structure for a video card on the user’s system.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
useTempMemIf you specify this in the flags parameter of the UpdateGWorld function, NewGWorld creates the base address for an offscreen pixel image in temporary memory. You generally should not use this flag. You should use temporary memory only for fleeting purposes and only with the GetPixelsState function so that other applications can launch.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
keepLocalIf you specify this in the flags parameter of the UpdateGWorld function, NewGWorld creates a pixel image in Macintosh main memory where it cannot be cached to a graphics accelerator card.
If you specify this in the flags parameter of GetPixelsState, UpdateGWorld keeps the offscreen pixel image in Macintosh main memory.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
pixelsPurgeableIf you specify this in the state parameter of the UpdateGWorld function, SetPixelsState makes the base address for an offscreen pixel map purgeable. If you use the SetPixelsState function without passing it this flag, then SetPixelsState makes the base address for an offscreen pixel map unpurgeable. If the GetPixelsState function returns this flag, then the base address for an offscreen pixel is purgeable.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
pixelsLockedIf you specify this flag for the state parameter of the SetPixelsState function, SetPixelsState locks the base address for an offscreen pixel image. If you use the SetPixelsState function without passing it this flag, then SetPixelsState unlocks the offscreen pixel image. If the GetPixelsState function returns this flag, then the base address for an offscreen pixel is locked.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
kNativeEndianPixMapBy default, the function NewGWorld allocates pixel buffers with big-endian byte ordering regardless of the system architecture. If this flag is passed in the flags parameter of NewGWorld, the pixel format will be set to k32ARGBPixelFormat or k16BE555PixelFormat on a PowerPC system, and to k32BGRAPixelFormat or k16LE555PixelFormat on an Intel system, for depths 32 or 16, respectively. Note that NewGWorld is the only function where this flag is observed; NewGWorldFromPtr and UpdateGWorld ignore it.
Available in Mac OS X v10.3 and later.
Declared in QDOffscreen.h.
mapPixIf the UpdateGWorld function returns this flag, then it remapped the colors in the offscreen pixel map to a new color table.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
newDepthIf the UpdateGWorld function returns this flag, then it translated the offscreen pixel map to a different pixel depth.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
alignPixIf the UpdateGWorld function returns this flag, then it realigned the offscreen pixel image to an onscreen window.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
newRowBytesIf the UpdateGWorld function returns this flag, then it changed the rowBytes field of the PixMap structure for the offscreen graphics world.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
reallocPixIf the UpdateGWorld function returns this flag, then it reallocated the base address for the offscreen pixel image. Your application should then reconstruct the pixel image or draw directly in a window instead of preparing the image in an offscreen graphics world.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
clipPixIf you specify this flag in the flags parameter of the UpdateGWorld function, then UpdateGWorld updates and clips the pixel image to the new boundary rectangle specified. If the UpdateGWorld function returns this flag, then it clipped the pixel image.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
stretchPixIf you specify this flag in the flags parameter of the UpdateGWorld function, then UpdateGWorld updates and stretches or shrinks the pixel image to the new boundary rectangle specified. If the UpdateGWorld function returns this flag, then it stretched or shrank the offscreen image.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
ditherPixIf you specify this flag in the flags parameter of the UpdateGWorld function, then UpdateGWorld dithers the pixel image to the new boundary rectangle specified. Include this flag with the clipPix or stretchPix flag. If the UpdateGWorld function returns this flag, then it dithered the offscreen image.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
gwFlagErr If the UpdateGWorld function returns this flag, then it was unsuccessful and the offscreen graphics world was left unchanged.
Available in Mac OS X v10.0 and later.
Declared in QDOffscreen.h.
enum {
invalColReq = -1
};
enum {
italicBit = 1,
ulineBit = 2,
outlineBit = 3,
shadowBit = 4,
condenseBit = 5,
extendBit = 6
};
enum {
k16LE555PixelFormat = 'L555',
k16LE5551PixelFormat = '5551',
k16BE565PixelFormat = 'B565',
k16LE565PixelFormat = 'L565',
k24BGRPixelFormat = '24BG',
k32BGRAPixelFormat = 'BGRA',
k32ABGRPixelFormat = 'ABGR',
k32RGBAPixelFormat = 'RGBA',
kYUVSPixelFormat = 'yuvs',
kYUVUPixelFormat = 'yuvu',
kYVU9PixelFormat = 'YVU9',
kYUV411PixelFormat = 'Y411',
kYVYU422PixelFormat = 'YVYU',
kUYVY422PixelFormat = 'UYVY',
kYUV211PixelFormat = 'Y211',
k2vuyPixelFormat = '2vuy'
};
enum {
k1MonochromePixelFormat = 0x00000001,
k2IndexedPixelFormat = 0x00000002,
k4IndexedPixelFormat = 0x00000004,
k8IndexedPixelFormat = 0x00000008,
k16BE555PixelFormat = 0x00000010,
k24RGBPixelFormat = 0x00000018,
k32ARGBPixelFormat = 0x00000020,
k1IndexedGrayPixelFormat = 0x00000021,
k2IndexedGrayPixelFormat = 0x00000022,
k4IndexedGrayPixelFormat = 0x00000024,
k8IndexedGrayPixelFormat = 0x00000028
};
enum {
kCursorComponentInit = 0x0001,
kCursorComponentGetInfo = 0x0002,
kCursorComponentSetOutputMode = 0x0003,
kCursorComponentSetData = 0x0004,
kCursorComponentReconfigure = 0x0005,
kCursorComponentDraw = 0x0006,
kCursorComponentErase = 0x0007,
kCursorComponentMove = 0x0008,
kCursorComponentAnimate = 0x0009,
kCursorComponentLastReserved = 0x0050
};
enum {
kCursorComponentsVersion = 0x00010001
};
enum {
kCursorComponentType = 'curs'
};
enum {
kCursorImageMajorVersion = 0x0001,
kCursorImageMinorVersion = 0x0000
};
enum {
kPrinterFontStatus = 0,
kPrinterScalingStatus = 1
};
enum {
kQDGrafVerbFrame = 0,
kQDGrafVerbPaint = 1,
kQDGrafVerbErase = 2,
kQDGrafVerbInvert = 3,
kQDGrafVerbFill = 4
};
enum {
kQDParseRegionFromTop = (1 << 0),
kQDParseRegionFromBottom = (1 << 1),
kQDParseRegionFromLeft = (1 << 2),
kQDParseRegionFromRight = (1 << 3),
kQDParseRegionFromTopLeft = kQDParseRegionFromTop | kQDParseRegionFromLeft,
kQDParseRegionFromBottomRight = kQDParseRegionFromBottom | kQDParseRegionFromRight
};
enum {
kQDRegionToRectsMsgInit = 1,
kQDRegionToRectsMsgParse = 2,
kQDRegionToRectsMsgTerminate = 3
};
enum {
kQDUseDefaultTextRendering = 0,
kQDUseTrueTypeScalerGlyphs = (1 << 0),
kQDUseCGTextRendering = (1 << 1),
kQDUseCGTextMetrics = (1 << 2),
kQDSupportedFlags = kQDUseTrueTypeScalerGlyphs | kQDUseCGTextRendering | kQDUseCGTextMetrics,
kQDDontChangeFlags = 0xFFFFFFFF
};
enum {
kRenderCursorInHardware = 1L << 0,
kRenderCursorInSoftware = 1L << 1
};
enum {
kXFer1PixelAtATime = 0x00000001,
kXFerConvertPixelToRGB32 = 0x00000002
};
enum {
normalBit = 0,
inverseBit = 1,
redBit = 4,
greenBit = 3,
blueBit = 2,
cyanBit = 8,
magentaBit = 7,
yellowBit = 6,
blackBit = 5
};
enum {
pixPurgeBit = 0,
noNewDeviceBit = 1,
useTempMemBit = 2,
keepLocalBit = 3,
useDistantHdwrMemBit = 4,
useLocalHdwrMemBit = 5,
pixelsPurgeableBit = 6,
pixelsLockedBit = 7,
nativeEndianPixMapBit = 8,
mapPixBit = 16,
newDepthBit = 17,
alignPixBit = 18,
newRowBytesBit = 19,
reallocPixBit = 20,
clipPixBit = 28,
stretchPixBit = 29,
ditherPixBit = 30,
gwFlagErrBit = 31
};
enum {
singleDevicesBit = 0,
dontMatchSeedsBit = 1,
allDevicesBit = 2
};
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
};
srcCopyFor basic graphics ports, force the destination pixel black where the source pixel is black; where the source pixel is white, force the destination pixel white.
For color graphics ports, determines how close the color of the source pixel is to black, and assigns this relative amount of foreground color to the destination pixel. Determines how close the color of the source pixel is to white, and assigns this relative amount of background color to the destination pixel.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
srcOrFor basic graphics ports, forces the destination pixel black if the source pixel is black; where the source pixel is white, leaves the destination pixel unaltered.
For color graphics ports, determines how close the color of the source pixel is to black, and assigns this relative amount of foreground color to the destination pixel.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
srcXorFor basic and color graphics ports, inverts destination pixel where the source pixel is black. For a basic graphics port, where the source pixel is white, leaves the destination pixel unaltered.
For a color graphics port, for a colored destination pixel, uses the complement of its color if the pixel is direct, or inverts its index if the pixel is indexed.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
srcBicFor a basic graphics port, forces destination pixel white where source pixel is black; where source pixel is white, leaves the destination pixel unaltered.
For a color graphics port, determines how close the color of the source pixel is to black, and assigns this relative amount of background color to the destination pixel.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
notSrcCopyFor a basic graphics port, forces the destination pixel white where the source pixel is black; where the source pixel is white, forces the destination pixel black.
For a color graphics port, determines how close the color of the source pixel is to black, and assigns this relative amount of background color to the destination pixel. Determines how close the color of the source pixel is to white, and assigns this relative amount of foreground color to the destination pixel.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
notSrcOrFor a basic graphics port, leaves the destination pixel unaltered where the source pixel is black; where the source pixel is white, forces the destination pixel black.
For a color graphics port, determines how close the color of the source pixel is to white, and assigns this relative amount of foreground color to the destination pixel.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
notSrcXorFor basic and color graphics ports, where the source pixel is white, inverts the destination pixel. For a basic graphics port, where the source pixel is black, leaves the destination pixel unaltered.
For a color graphics port, for a colored destination pixel, uses the complement of its color if the pixel is direct, or inverts its index if the pixel is indexed.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
notSrcBicFor a basic graphics port, where the source pixel is black, leaves the destination pixel unaltered; where the source pixel is white, forces the destination pixel white.
For a color graphics port, determines how close the color of the source pixel is to white, and assigns this relative amount of background color to the destination pixel.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
patCopyWhere the pattern pixel is black, applies foreground color to the destination pixel; where the pattern pixel is white, applies background color to the destination pixel.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
patOrWhere the pattern pixel is black, inverts the destination pixel; where the pattern pixel is white, leaves the destination pixel unaltered.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
patXorWhere the pattern pixel is black, inverts the destination pixel; where the pattern pixel is white, leaves the destination pixel unaltered.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
patBicWhere the pattern pixel is black, applies the background color to destination pixel; where the pattern pixel is white, leaves the destination pixel unaltered.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
notPatCopyWhere the pattern pixel is black, applies background color to destination pixel; where the pattern pixel is white, applies foreground color to the destination pixel
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
notPatOrWhere the pattern pixel is black, leaves the destination pixel unaltered; where the pattern pixel is white, applies foreground color to the destination pixel
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
notPatXorWhere the pattern pixel is black, leaves the destination pixel unaltered; where the pattern pixel is white, inverts the destination pixel
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
notPatBicWhere the pattern pixel is black, leaves the destination pixel unaltered; where the pattern pixel is white, applies background color to the destination pixel.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
grayishTextOrDraws dimmed text on the screen. You can use it for black-and-white or color graphics ports. The grayishTextOr transfer mode is not considered a standard transfer mode because currently it is not stored in pictures, and printing with it is undefined. (It does not pass through the QuickDraw bottleneck functions.)
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
hiliteAdds highlighting to the source or pattern mode. With highlighting, QuickDraw replaces the background color with the highlight color when your application copies images between graphics ports. This has the visual effect of using a highlighting pen to select the object. (The global variable HiliteRGB is read from parameter RAM when the machine starts. Basic graphics ports use the color stored in the HiliteRGB global variable as the highlight color. Color graphics ports default to the HiliteRGB global variable, but can be overridden by the HiliteColor function.)
For text, specifies that the caret position should be determined according to the primary line direction, based on the value of SysDirection.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
blendReplaces the destination pixel with a blend of the source and destination pixel colors. If the destination is a bitmap or 1-bit pixel map, reverts to srcCopy mode.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
addPinReplaces the destination pixel with the sum of the source and destination pixel colors-- up to a maximum allowable values. If the destination is a bitmap or 1-bit pixel map, reverts to srcBic mode.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
addOverReplaces the destination pixel with the sum of the source and destination pixel colors, except if the value of the red, green, or blue component exceeds 65,536, then addOver subtracts 65,536 from that value. If the destination is a bitmap or 1-bit pixel map, reverts to srcXor mode.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
subPinReplaces the destination pixel with the difference of the source and destination pixel colors, but not less than a minimum allowable value. If the destination is a bitmap or 1-bit pixel map, reverts to srcOr mode.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
addMaxCompares the source and destination pixels, and replaces the destination pixel with the color containing the greater saturation of each of the RGB components. If the destination is a bitmap or 1-bit pixel map, reverts to srcBic mode.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
subOverReplaces the destination pixel with the difference of the source and destination pixel colors, except if the value of the red, green, or blue component is less than 0, then it adds the negative result to 65,536. if the destination is a bitmap or 1-bit pixel map, revert to srcXor mode.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
adMinCompares the source and destination pixels, and replaces the destination pixel with the color containing the lesser saturation of each of the RGB components. If the destination is a bitmap or 1-bit pixel map, reverts to srcOr mode.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
ditherCopyOn computers running System 7, you can add dithering to any source mode by adding this constant or the value it represents to the source mode.
Dithering is a technique that mixes existing colors to create the effect of additional colors. It also improves images that you shrink or that you copy from a direct pixel device to an indexed device.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
transparentReplaces the destination pixel with the source pixel if the source pixel is not equal to the background color. The transparent mode replaces the destination pixel with the source pixel if the source pixel isn’t equal to the background color. This mode is most useful in 8-bit, 4-bit, or 2-bit color modes.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
CopyBits uses the source and arithmetic transfer mode constants in the mode parameter to specify the manner in which pixels are transferred from a source pixel map to a destination pixel map.
PenMode uses the pattern mode constants in the mode parameter to specify source modes for transferring the bits from a source bitmap to a destination bitmap.
The TextMode function uses these constants to set the transfer mode in the graphics port txMode field.
The transfer mode determines the interplay between what an application is drawing (the source) and what already exists on the display device (the destination), resulting in the text display.
There are two basic kinds of modes: pattern ( pat) and source ( src).
The pattern mode constants are patCopy, patOr, patXor, patBic, notPatCopy, notPatOr, notPatXor, and notPatBic.
Source is the kind that you use for drawing text. There are four basic Boolean operations: Copy, Or, Xor, and Bic (bit clear), each of which has an inverse variant in which the source is inverted before the transfer, yielding eight operations in all. Basic QuickDraw supports these eight transfer modes. Color QuickDraw interprets the source mode constants differently than basic QuickDraw does. Color QuickDraw enables your application to achieve color effects within those basic transfer modes, and offers an additional set of transfer modes that perform arithmetic operations on the RGB values of the source and destination pixels. Other transfer modes are grayishTextOr, transparent mode, and text mask mode.
The arithmetic transfer modes are addOver, addPin, subOver, subPin, addMax, adMax, adMin, and blend. For color, the arithmetic modes change the destination pixels by performing arithmetic operations on the source and destination pixels. Arithmetic transfer modes calculate pixel values by adding, subtracting, or averaging the RGB components of the source and destination pixels. They are most useful for 8-bit color, but they work on 4-bit and 2-bit color also. When the destination bitmap is one bit deep, the mode reverts to the basic transfer mode that best approximates the arithmetic mode requested.
enum {
frame = kQDGrafVerbFrame,
paint = kQDGrafVerbPaint,
erase = kQDGrafVerbErase,
invert = kQDGrafVerbInvert,
fill = kQDGrafVerbFill
};
frameSpecifies the frame action.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
paintSpecifies the paint action.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
eraseSpecifies the erase action.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
invertSpecifies the invert action.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
fillSpecifies the fill action.
Available in Mac OS X v10.0 and later.
Declared in QuickdrawTypes.h.
When you use the StdRect , StdRRect , StdOval , StdArc , StdPoly , or StdRgn functions, these constants are used in the verb parameter to specify the type of action taken by those low-level drawing functions.
The table below lists the result codes specific to QuickDraw.
© 2001, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-06-29)