QuikDrawLib

© 1998-2004 Einhugur Software - All Rights Reserved.

E-mail support@einhugur.com
Web Site http://www.einhugur.com/

Version 4.0
Compatible PPC - Carbon. (Win32 for some point operations)
Requirements REALbasic 4.5 or later.
Dependencies *TypeLib 4.3 or later.

QuickDrawLib is not a control, it has no user interface. QuickDrawLib is a REALbasic plugin to access some QuickDraw routines.

Einhugur website:
http://www.einhugur.com/index.html

Note:
To install QuickDrawLib you have to create a folder called Plugins in the same folder as your REALbasic application is located in and drop the QuickDrawLib into it. Remember QuickDrawLib is dependant on TypeLib so you also have to drop the TypeLib into your plugin directory !!.

Agreement
This product is a commercial software, only registered users are allowed to use it.

Einhugur Software will disable all serial numbers found on Internet and all serial numbers of decoded plugins that have illegally been posted on Internet.

Einhugur Software and the author, are in no way responsible for the bugs that might be found in this product. However, Einhugur Software will do its best to fix the bugs.

Officially we only support versions noted above and up to current official (not alpha or beta versions) version of REALbasic at the date of when this plugin is published. We cannot predict what changes might come in future versions of REALbasic.


Einhugur Software


support@einhugur.com


http://www.einhugur.com/index.html


BackPat

To assign a system pixel pattern as the background pattern, you can use the BackPat method; this allows the ScrollRect method and the shape-erasing methods

BackPat patconst as Integer

patconst System pattern constant.


Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


BackPixPat

To assign a pixel pattern as the background pattern, you can use the BackPixPat method; this allows the ScrollRect method and the shape-erasing methods (for example, EraseRect) to fill the background with a colored, patterned Ňink.Ó

BackPixPat(ppat as PixPatHandle

ppat A handle to the pixel pattern to use as the background pattern.


Description:
The BackPixPat method sets the background pattern for the current graphics device to a pixel pattern. The BackPixPat method is similar to the basic QuickDraw method BackPat, except that you pass BackPixPat a handle to a multicolored pixel pattern instead of a bit pattern.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


BitMapToRegion

To convert BitMaps or pixel maps to regions use the BitMapToRegion function.

FUNCTION BitMapToRegion(region as RgnHandle,bMap as BitMapPtr) as Integer

region
A valid region handle, created with the NewRgn
function.

bMap
A BitMapPtr, containing a one bit deep
bitmap or pixelmap.

returns: A error code

0 = no error
-148 = Pixel map record is deeper than 1 bit per pixel
-500 = BitMap would convert to a region greater than 64 kb


Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


CalcCMask

To calculate a mask for use in CopyMask.

CalcCMask srcMap as BitMapPtr, destMap as BitMapPtr, src as Rect, dest as Rect, seedRGB as Color

srcMap:
address of BitMap of source image.

destMap:
address of BitMap where to store 1s and 0s

src:
size, location data from srcBitmap.

dest:
size, location to store data in destination.

seedRGB:
RGB value of seed.


Description:
CalcCMask examines a portion of a bitmap and creates a mask that can be used with CopyMask. It finds the outermost outline of any figure in the bitmap (as in the lasso tool of many paint programs) and creates a mask having 1s in the places where paint would "leak" were you to pour it inside the figure. The object of this procedure is the reverse of SeedCFill in that it protects areas from being filled with color.

See more in inside Macintosh Imaging with QuickDraw.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


ClipRect

To change the clipping region of the current graphics port (basic or color), use the ClipRect method.

ClipRect r as Rect

r A rectangle to define the boundary of the new clipping region for the current graphics port.


Description:
The ClipRect method changes the clipping region of the current graphics port to a region thatŐs equivalent to the rectangle specified in the r parameter. ClipRect doesnŐt change the region handle, but it affects the clipping region itself. Since ClipRect makes a copy of the given rectangle, any subsequent changes you make to that rectangle do not affect the clipping region of the port.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


ClosePicture

To complete collection of drawing commands and picture comments that define your picture, use the ClosePicture method.

ClosePicture


Description:
The ClosePicture method stops collecting drawing commands and picture comments for the currently open picture. You should perform only one call to ClosePicture for every call to OpenPicture.

The ClosePicture method calls the ShowPen method, balancing the call made by OpenPicture to the HidePen method.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


ClosePoly

To compleate the actions started by OpenPoly use the ClosePoly method.

ClosePoly


Description:
This method finishes defining the polygon, after you make this call Line and LineTo will be back to normal, that is they will draw to the screen instead of the polygon-handle.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


CloseRgn

To organize a collection of lines and shapes into a region definition, use the CloseRgn method..

CloseRgn dstRgn as RgnHandle

dstRgn The handle to the region to close.


Description:
The CloseRgn method stops collections of lines and framed shapes, organizes them into a region definition, and saves the result in the region whose handle you pass in the dstRgn parameter. The handle you pass in the dstRgn parameter should be a region handle returned by the NewRgn function.

The CloseRgn method does not create the destination region; you must have a already allocated space for it by using the OpenRgn method. The CloseRgn method calls the ShowPen method, balancing the call to the HidePen method made by OpenRgn.

When you no longer need the memory occupied by the region, use the DisposeRgn method.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


CopyBits

To copy bits with optional scaling, clipping, etc, use the CopyBits function.

CopyBits srcMap as BitMap, destMap as BitMap, src as Rect, dest as Rect, tMode,maskRgn as RgnHandle

srcMap: address of BitMap or PixMap of source image.

destMap: address of BitMap or PixMap to hold the duplicate.

src: size, location data from srcBitmap.

dest: size, location to store data in destination.

tMode: transfer mode (see info bellow)

maskRgn: mask for special clipping; 0 = not needed.


Description:
CopyBits is the basis of most screen image movement on the Mac. An image can be copied verbatim, or it can be scaled horizontally and/or vertically and clipped an arbitrary shape. The image can be combined with a background (e.g., inverted, 0Red, X0Red, etc.). This function can copy to and from an off screen area of memory.

Note:
If foreground color is not set to black and the background color not to white then unwanted colors may be applied to the image when its copied. (This is what they say in inside Macintosh, I have never seen it hapen though).

Transfer modes:
Value Name
-----------------------
0 srcCopy
1 srcOr
2 srcXor
3 srcBic
4 notSrcCopy
5 notSrcOr
6 notSrcXor
7 notSrcBic
32 blend
33 addPin
34 addOver
35 subPin
36 transparent
37 addMax
38 subOver
39 adMin
-----------------------

(in mode 36, the current background color is the transparent color).


See more in inside Macintosh Imaging with QuickDraw.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


CopyDeepMask

To combine the effects of CopyMask and CopyBits, use CopyDeepMask.

CopyDeepMask srcMap as BitMapPtr,
maskMap as BitMapPtr,
dstMap as BitMapPtr,
src as Rect,mask as Rect,
dest as Rect,
mode as Integer,
maskRgn as RgnHandle

srcMap:
address of BitMap of source image.

maskMap:
address of bitmap identifying the mask.

destMap:
address of BitMap or PixMap to recieve
masked image.

src:
size, location data from srcBitmap.

mask:
Position and size of the masking area.

dest:
size, location to store data in destination.

mode:
mode setting. (See transfer modes in CopyBits)

maskRgn:
Handle to mask region.

Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

NOTE:
In this version of QuickDrawLib this medthod has not been verified to work, normally there
would be no special reason to verify it, but in this case it has more parameters than other
functions we have done before, so please send us reports on success or faliure if you try this
function.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


CopyMask

To copy bitMaps or PixMaps, using masking bitmap, use the CopyMask method.

CopyMask srcMap as BitMapPtr, maskMap as BitMapPtr,dstMap as BitMapPtr, src as Rect,mask as Rect, dest as Rect

srcMap:
address of BitMap of source image.

maskMap:
address of bitmap identifying the mask.

destMap:
address of BitMap or PixMap to recieve
masked image.

src:
size, location data from srcBitmap.

mask:
Position and size of the masking area.

dest:
size, location to store data in destination.



Description:
CopyMask copies image data from one BitMap or PixMap to another, under control of a mask. Bits are copied from srcMap, to destMap, only where maskMap is a 1.

Remember to set the foreground to black and background to white during color QuickDraw copybits, since otherise unwanted colors may be applied to the image when its copied.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


CopyRgn

To make a copy of a region, use the CopyRgn method.

CopyRgn srcRgn as RgnHandle, dstRgn as RgnHandle

srcRgn The handle to the region to copy.

dstRgn The handle to recieve the copy.

Description:
The CopyRgn method 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 srcRgn.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


DiffRgn

To subtract one region from another, use the DiffRgn method.

UnionRgn (srcRgnA as RgnHandle,srcRgnB as RgnHandle,dstRgn as RgnHandle

srcRgnA A handle to the region to subtract from.
srcRgnB A handle to the region to subtract.
dstRgn A handle to the region to hold the resulting area.

Description:
The DiffRgn method 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 method does not create the destination region; you must have already allocated memory for it by using the NewRgn function.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


DisposeCIcon

You can use the DisposeCIcon method to release the memory occupied by an icon color record obtained from the GetCIcon function.

DisposeCIcon theIcon as CIconHandle

theIcon A handle to the color icon record to dispose of.


Description:
The DisposeCIcon procedure disposes of any structure allocated by GetCIcon.

Usually you wont need this function unless you want to dispose the memory as soon as possible, otherwise the garbagecollector will dispose it.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


DisposeCTable

To dispose all structures allocated by GetCTable, use the DisposeCTable method.

DisposeCTable theTable

theTable Integer Handle to the color table that you want disposed.


Description:
DisposeCTable removes all data structure created by GetCTable.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


DrawPicture

To draw a picture stored in a picture handle to the current graphics port, use the DrawPicture method.

DrawPicture pic as PicHandle,r as Rect

pic Handle to the picture.
r Rectangle defining location and size.

Description:
Draws a picture stored in a picture handle to the current graphics port.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


DrawString

To draw a string on the current graphics port according to pen's position, use the DrawString method.

DrawString theString

theString the string to draw.


Description:
InvertColor finds a RGB color that complements a specified color.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


EmptyRect

To determine if a rectangle is empty, use the EmptyRect function.

FUNCTION EmptyRect(r as Rect) as Boolean

r:
The rectangle.


Description:
This method tests to see if a rectangle is empty, that is if the bottom border is less than or equal to the top, or the right border is less than or equal to the top, or the right border is less than or equal to the left.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86



EmptyRgn

To determine whether a region is empty, use the EmptyRgn function.

FUNCTION EmptyRgn (rgn as RgnHandle): Boolean

rgn A handle to the region to test for emptiness.

returns a boolean result.

Description:
The EmptyRgn function returns TRUE if the region whose handle you pass in the rgn parameter is an empty region or FALSE if it is not.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


EqualRect

To find if two rectangles are equal then use the EqualRect function.

FUNCTION EqualRect(r1 as Rect,r2 as Rect) as Boolean

r1,r2:
Rectangles to compare.


Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86


EqualRgn

To determine whether two regions have identical sizes, shapes, and locations, use the
EqualRgn function.

FUNCTION EqualRgn (rgnA as RgnHandle,rgnB as RgnHandle): Boolean

srcRgnA A handle to the first of two regions to compare.
srcRgnB A handle to the second of two regions to compare.

returns a boolean result.

Description:
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.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


EraseArc

To erase a wedge, use the EraseArc procedure.

EraseArc r as Rect, startAngle as Integer, arcAngle as Integer

r
The rectangle that defines oval's boundaries.

startAngle
The angle indicating the start of the Arc.

arcAngle
The angle indicating the arc's extent.


Description:
Using the patCopy pattern mode, the EraseArc method draws a wedge of the oval bounded by the rectangle that you specify, with the background pattern for the current graphics port. this method leaves the location of the graphics pen unchanged.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


EraseOval

To erase a oval, use EraseOval method.

EraseOval r as Rect

r The rectangle that defines the oval's boundaries.


Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


ErasePoly

To erase a polygon, use the ErasePoly method.

ErasePoly thePoly as PolyHandle

thePoly
PolyHandle variable containing a handle to
the polygon.

Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


EraseRect

To erase a rectangle, use EraseRect method.

EraseRect r as Rect

r The rectangle to erase.


Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


EraseRgn

To erase a region, use the EraseRgn method.

EraseRgn rgn as RgnHandle

rgn A handle to the region to erase.


Description:
Using the patCopy pattern mode, the EraseRgn method draws the interior of the region whose handle you pass in the rgn parameter with the background pattern for the current graphics port.

This method leaves the location of the graphics pen unchanged.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


EraseRoundRect

To erase a rounded rectangle, use the EraseRoundRect method.

EraseRoundRect r as Rect, ovalWidth as Integer, ovalHeight as Integer

r:
The rectangle that defines the rounded rectangle's
boundaries.

ovalWidth:
The width of the oval defining the rounded corner.

ovalHeight:
The height of the oval defining th rounded corner.


Description:
Using the patCopy pattern mode, the EraseRoundRect method draws the interior of the rounded rectangle bounded by the rectangle that you specify, with the background pattern of the current graphics port. This effectively erases the rounded rectangle. Use the ovalWidth and ovalHeight parameters to specify the diameters of curvature for the corners of the rounded rectangle. This method leaves the location of the graphics pen unchanged.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FillCArc

Use the FillCArc method to fill a wedge with a color pixel pattern.

FillCRect r as Rect, startAngle as Integer, arcAngle as integer, ppat as PixPatHandle

r:
The rect to the oval you want to fill.

ppat:
A Handle to the Color pattern.

startAngle:
The angle indicating the start of the arc.

arcAngle:
The angle indicating the arc's extent.


Description:
Using the patCopy pattern mode, the FillCArc method fills the arc you specify with the pixel pattern defined by a PixPat record, the handle for which you pass in the ppat parameter. This method ignores the pnPat, pnMode, and bkPat fields of the current graphics port and leaves the pen location unchanged.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FillCOval

Use the FillCOval method to fill a oval with a color pixel pattern.

FillCRect r as Rect, ppat as PixPatHandle

r The rect to the oval you want to fill.

ppat A Handle to the Color pattern.


Description:
Using the patCopy pattern mode, the FillCOval method fills the oval you specify with the pixel pattern defined by a PixPat record, the handle for which you pass in the ppat parameter. This method ignores the pnPat, pnMode, and bkPat fields of the current graphics port and leaves the pen location unchanged.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FillCPoly

Use the FillCPoly method to fill a polygon with a color pixel pattern.

FillCPoly thePoly as PolyHandle, ppat as PixPatHandle

thePoly
PolyHandle variable containing a handle to the polygon.
ppat
A PixPatHandle to the Color pattern.

Description:
Using the patCopy pattern mode, the FillCPoly method fills the polygon you specify with the pixel pattern defined by a PixPat record, the handle for which you pass in the ppat parameter. This method ignores the pnPat, pnMode, and bkPat fields of the current graphics port and leaves the pen location unchanged.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FillCRect

Use the FillCRect method to fill a rectangle with a color pixel pattern..

FillCRect r as Rect, ppat as PixPatHandle

r The rectangle to fill.

ppat A Handle to the Color pattern.


Description:
Using the patCopy pattern mode, the FillCRect method fills the rectangle you specify with the pixel pattern defined by a PixPat record, the handle for which you pass in the ppat parameter. This method ignores the pnPat, pnMode, and bkPat fields of the current graphics port and leaves the pen location unchanged.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FillCRgn

Use the FillCRgn method to fill a region with a pixel pattern.

FillCRgn rgn as RgnHandle,ppat as PixPatHandle

rgn A handle to the region to be filled.
ppat A handle to the PixPat record for the pixel pattern to be used for the fill.


Description:
Using the patCopy pattern mode and the pixel pattern defined in a PixPat record (the handle for which you pass in the ppat parameter), the FillCRgn method fills the region whose handle you pass in the rgn parameter. This method ignores the pnPat, pnMode, and bkPat fields of the current graphics port and leaves the pen location unchanged.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FillCRoundRect

Use the FillCRoundRect method to fill a rounded rectangle with a color pixel pattern.

FillCRoundRect r as Rect,ovalWidth as Integer, ovalHeight as Integer, ppat PixPatHandle

r: The rounded rectangle to fill.

ovalWidth:
The width of the oval defining the rounded corner.

ovalHeight:
The height of the oval defining th rounded corner.

ppat: A Handle to the Color pattern.


Description:
Using the patCopy pattern mode, the FillCRoundRect method fills the rounded rectangle you specify with the pixel pattern defined by a PixPat record, the handle for which you pass in the ppat parameter. This method ignores the pnPat, pnMode, and bkPat fields of the current graphics port and leaves the pen location unchanged.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FrameArc

To draw an arc of the oval that fits inside a rectangle, use the FrameArc method.

FrameArc r as Rect, startAngle as Integer, arcAngle as Integer

r
The rectangle that defines oval's boundaries.

startAngle
The angle indicating the start of the Arc.

arcAngle
The angle indicating the arc's extent.


Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FrameOval

FrameOval r as Rect

r The rectangle defining the oval.


Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FramePoly

To draw the frame of a polygon with the current pen, use the FramePoly method.

FramePoly thePoly as PolyHandle

thePoly
PolyHandle variable containing a handle to the polygon.


Description:
FramePoly draws a polygon by "playing back" all the line drawing calls that define it, using the current pen size, pattern and mode. Note on the picture above, that poly-frame is drawn 1 pixel bellow the filling area of the polygon and 1 pixel to the right.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FrameRect

FrameRect r as Rect

r The rectangle to frame.


Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FrameRgn

To draw an outline inside a region, use the FrameRgn method.

FrameRgn rgn as RgnHandle

rgn A handle to the region to frame.


Description:
Using the current graphics portŐs pen pattern, pattern mode, and pen size, the FrameRgn method draws an outline just inside the region whose handle you pass in the rgn parameter. The outline never goes outside the region boundary. The pen location does not change. If a region is open and being formed, the outside outline of the region being framed is mathematically added to that regionŐs boundary.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


FrameRoundRect

To draw an outline inside a rounded rectangle, use the FrameRoundRect method.

FrameRoundRect r as Rect, ovalWidth as Integer, ovalHeight as Integer

r The rectangle that defines the rounded
rectangle's boundaries.

ovalWidth
The width of the oval defining the rounded corner.

ovalHeight
The height of the oval defining th rounded corner.


Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86


GetBackColor

To obtain the backcolor from the currently selected port, use the GetBackColor function

FUNCTION GetBackColor as Color

returns: The currently selected backcolor

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetCIcon

You can use GetCIcon to get a handle to a color icon of resource type 'cicn'.

FUNCTION GetCIcon(iconID as Integer) as CIconHandle

iconID The resource ID for an icon of resource type 'cicn'.

returns a handle to the icon.

Description:
The GetCIcon function reads in the 'cicn' resource with the specified resource ID and returns a handle to it. The GetCIcon function searches the current resource chain for the resource. If GetCIcon finds the resource, it reads the resource, creates a color icon record for the icon, and initializes the fields of the record according to the information contained in the 'cicn' resource. GetCIcon returns a handle to the color icon record as its function result.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetClip

To save the clipping region of the current graphics port (basic or color), use the GetClip method.

GetClip rgn

rgn A handle to the region to be clipped to match the clipping region of the current graphics port.

Description:
The GetClip method changes the region specified in the rgn parameter to one thatŐs equivalent to the clipping region of the current graphics port. The GetClip method doesnŐt change the region handle. You can use the GetClip and SetClip procedures 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.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetColor

To display the Color Picker dialog box, use the GetColor function.

FUNCTION GetColor(whereX, whereY, prompt,inColor): Color

whereX indicates dialogs left corner.

whereY indicates dialogs upper corner. Set whereX and whereY to 0,0 to center on mainscreen horizontally, with 1/3 of the empty space above. If you set it to -1,-1 then the Color picker decides.

prompt a prompt string.

inColor is the starting color.

returns the result color, if the users cancels then the result is the same as inColor.

Description:
Displays the Color picker dialog box.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetCPixel

To determine the color of an individual pixel, use the GetCPixel method.

FUNCTION GetCPixel(h,v) as Color

h The horizontal coordinate of the point at the upper-left corner of the pixel.
v The vertical coordinate of the point at the upper-left corner of the pixel.

returns RGBColor.

Description:
See more in: Inside Macintosh QuickDraw Drawing, chapter 4.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetCTable

Allocate and initialize new color table data structure by using the GetCTable function.

FUNCTION GetCTable(Id): Integer

ID resource id of the desired color table ('clut').

returns a handle leading to the color table (stored in a integer variable).

Description:
GetCTable obtains a new color table data structure and initializes it from data in the 'clut' resource for that specific ID.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetForeColor

To obtain the forecolor from the currently selected port, use the GetForeColor function

FUNCTION GetForeColor as Color

returns: The currently selected forecolor

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetGWorldDev

To get the current graphics world's device, use the GetGWorldDev function.

FUNCTION GetGWorldDev as GDHandle

Returns: The current GWorld device, as GDHandle.

Supported platforms:
* MacOS PPC
* MacOS 68k
* MacOS Carbon
Unsupported platforms:
* Windows x86


GetGWorldPixMap

To get a handle to the pixel map for an offscreen graphics world, use the GetGWorldPixMap function.

FUNCTION GetGWorldPixMap(theGWorld as GWorldPtr) as PixMapHandle

theGWorld: The GWorld that you want to get the PixMapHandle from.

Returns: A pointer to the pixel map of an offscreen graphics world.


Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetGWorldPort

To get the current graphics world's port, use the GetGWorldPort function.

FUNCTION GetGWorldPort as GWorldPtr

Returns: The current GWorld port, as GWorldPtr.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetMainDevice

To get a handle to the main graphics device, use the GetMainDevice function

FUNCTION GetMainDevice as GDHandle

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetPicture

To read a picture from a resource fork (application resource fork is the default), use the GetPicture method.

FUNCTION GetPicture(picId) as PicHandle

picID resource id of the desired picture.

returns a handle leading to the picture.

Description:
GetPicture searces the current resource file (application resource fork is the default) until it finds the specified picture. It reads the resource from disk (if necessary) and returns a handle to a variable-length Picture structure.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetPixPat

To get a pixel pattern ('ppat') resource stored in a resource file, you can use the GetPixPat function.

FUNCTION GetPixPat(patId) as PixPatHandle

patID The resource ID for a resource of type 'ppat'.

returns a handle leading to the pixel pattern (stored in a integer variable).

Description:
Gets a pixel pattern ('ppat') resource stored in a resource file. When you are finished using the pixel pattern you May use the DisposePixPat method to force garbage collection.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GetPort

To save the current graphics port (basic or color), you can use the GetPort method.

FUNCTION GetPort as GrafPtr

returns a A pointer to a GrafPort record. If the current graphics port is a color graphics port, GetPort coerces its CGrafPort record into a GrafPort record.

Description:
The GetPort function returns a pointer to the current graphics port. For example, your program could include GetPort(savePort) before setting a new graphics port, followed by SetPort(savePort) to restore the previous port.

When your application runs in Color QuickDraw and uses offscreen graphics worlds, it should use the more advanced GetGWorld function instead of GetPort. The GetGWorld function saves the current graphics port for basic and color graphics ports as well as offscreen graphics worlds.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


GlobalToLocal

To obtain local value of a global (screen) point then use the GlobalToLocal method.

GlobalToLocal p as Point

p The point to convert (p also recieves the result)


Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86




GraphicsToBits

To get a pointer to a bitmap from a Graphics object, use the GraphicsToBits function.

FUNCTION GraphicsToBits(g) : Integer

g: REALbasic Graphics object.

returns a integer pointer to a bitmap.

Note:

Use this function carefully !! In most cases there are better ways than to use this function !

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


HideCursor

You can use the HideCursor method to remove the cursor from the screen.

HideCursor


WARNIG !!! if you dont call ShowCursor to show the cursor again in your app, then the cursor may not show up again until you restart the computer !!

Description:
The HideCursor method 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 subsequent call to the ShowCursor method.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


HiliteColor

To choose a new highlighting color that should owerwrite the current system highlitecolor for the current graphics port, use the HiliteColor method.

HiliteColor color

color The new RGB color value.


Description:
Changes the highlitecolor in the current graphics port.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


HiliteMode

To hilite a area with the system default hilitecolor use the HiliteMode method and then any invert method right afterwards.

HiliteMode

Description:
Sets hilite mode so the next invert function will replace all all of the curren BackColor with the default hilitecolor from the system. HiliteMode is reset automaticali after next drawing funciton (InvertArc for example).

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


IconIDToRgn

To create a region from a icon mask use the IconIDToRgn function

FUNCTION IconIDToRgn(rgn as RgnHandle,iconRect as Rect, alignment as Integer, resID as Integer) as Integer

rgn RgnHandle - Recives region created
from icon mask. The RngHandle must be
allocated before calling the IconIDToRgn.

iconRect Rectangle indicating the icon position.

alignment Alignment for the icon:

atNone = 0
atVerticalCenter = 1
atTop = 2
atBottom = 3
atHorizontalCenter = 4
atLeft = 8
atRight = 12


resID The resource Id of the family of "icxx"

returns Errorcode, 0 = noError.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


InsetRect

To shrink or expand a rectangle, use the InsetRect method.

InsetRect r as Rect,distHoriz as Integer, distVert as Integer

r:
The rectangle.

distHoriz:
Amount to inset (>0) or expand (<0) width.

distVert:
Amount to inset or expand height.


Description:
This method expands or shrinks a rectangle by adjusting the horizontal and vertical coordinates by the specified distance.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86



InsetRgn

To move a region, use the OffsetRgn method.

InsetRgn rgn as RgnHandle,dh as Integer,dv as Integer

rgn A handle to the region to alter.
dh The horizontal distance to move points on the left and right boundaries in
toward or outward from the center.
dv The vertical distance to move points on the top and bottom boundaries in
toward or outward from the center.


Description:
The InsetRgn method 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 method moves the points outward in that direction.

The InsetRgn method 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 method.

The region on picture A is the source region, the region on picture b is a region that has been inset-ed by 5 pixels in each direction. The region on picture C is a region offset-ed by 5 pixels.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


InvertArc

To invert pixels of a wedge, use the InvertArc method.

InvertArc r as Rect, startAngle as Integer, arcAngle as Integer

r
The rectangle that defines oval's boundaries.

startAngle
The angle indicating the start of the Arc.

arcAngle
The angle indicating the arc's extent.

returns a dummy integer.

Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


InvertColor

To invert a color variable use the InvertColor method.

FUNCTION InvertColor(color as Color) as Color

color An RGB variable.

returns the Inverted color.

Description:
InvertColor finds a RGB color that complements a specified color.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


InvertOval

To invert the pixels enclosed by a oval, use the InvertOval method.

InvertOval r as Rect

r The rectangle that defines the oval's boundaries.


Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


InvertPoly

To invert the pixels enclosed by a polygon, use the InvertPoly method.

InvertPoly thePoly as PolyHandle

thePoly
PolyHandle variable containing a handle to the polygon.

Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


InvertRect

To invert the pixels enclosed by a rectangle, use the InvertRect method.

InvertRect r as Rect

r The rectangle whose enclosed pixels are to be inverted.

Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


InsetRgn

To move a region, use the OffsetRgn method.

InsetRgn rgn as RgnHandle,dh as Integer,dv as Integer

rgn A handle to the region to alter.
dh The horizontal distance to move points on the left and right boundaries in
toward or outward from the center.
dv The vertical distance to move points on the top and bottom boundaries in
toward or outward from the center.


Description:
The InsetRgn method 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 method moves the points outward in that direction.

The InsetRgn method 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 method.

The region on picture A is the source region, the region on picture b is a region that has been inset-ed by 5 pixels in each direction. The region on picture C is a region offset-ed by 5 pixels.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


InvertRoundRect

To invert the pixels enclosed by a rounded rectangle, use the InvertRoundRect method.

InvertRoundRect r as Rect, ovalWidth as Integer, ovalHeight as Integer

r:
The rectangle that defines the rounded rectangle's
boundaries.

ovalWidth:
The width of the oval defining the rounded corner.

ovalHeight:
The height of the oval defining th rounded corner.


Description:
See Inside Macintosh QuickDraw Drawing, chapter 3.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


Line

To draw a line relative to the graphics pen's current location, use the Line method.

LineTo h as Integer,v as Integer

h Distance in points to draw horizontally.

v Distance in points to draw vertically.


Description:
Draws a line relative to the graphics pen's current location in the current graphics port.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


LineTo

To draw a line from the graphics pen's current location, use the LineTo method.

LineTo h as Integer,v as Integer

h The horizontal coordinate of the graphics pen's
new location.
v The vertical coordinate of the graphics pen's
new location.


Description:
Draws a line from the graphics pen's current location in the current graphics port to the new location (h,v).

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


LocalToGlobal

To obtain global (screen) value of a local point then use the LocalToGlobal method.

LocalToGlobal p as Point

p The point to convert (p also recieves the result)


Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86



LockPixels

To lock the offscreen buffer in memory for duration of a draw, use the LockPixels function.

FUNCTION LockPixels(pm as PixMapHandle) as Boolean

pm: The Pixel map handle returned from a GetGWorldPixMap call.

Returns: a boolean, FALSE if buffer has moved (error state).

If it returns FALSE then thats a siginal that no drawing can be made to the buffer memory.

As soon as the drawing is completed, you should call UnlockPixels.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


MapPoly

To resize a polygon use the MapPoly method.

MapPoly thePoly as PolyHandle,src as Rect,dest as Rect

thePoly
PolyHandle variable containing a handle to the polygon.

src
the source rectangle of the polygon.

dest
the destination rectangle of the polygon.


Description:
Mappoly resizes and repositions a polygon, converting its coordinates by the size-ratio and offset of two rectangles, use this to scale and reposition a polygon.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


MapRect

To scale and reposition a rectangle, use the MapRect function.

FUNCTION MapRect(srcRect as Rect,destRect as Rect) as Rect

srcRect:
The address of rectangle to convert from.

destRect:
The address of rectangle to convert to.

returns:
the result as Rect.


Description:
MapRect maps the corner points of a rectangle, converting them by a size ratio and offset of the other rectangles. Use this to scale and reposition an object that is being to a larger or smaller rectangle.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


Move

To move the graphics pen relative to its current location in the current graphics port, use the Move method.

MoveTo h as Integer,v as Integer

h Distance in points to move horizontally.

v Distance in points to move vertically.


Description:
Moves the graphics pen relative to its current location, Move performs no drawing.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86



MoveTo

To move the graphics pen to a particular location in the current graphics port, use the MoveTo method.

MoveTo h as Integer,v as Integer

h The horizontal coordinate of the graphics pen's
new position.

v The vertical coordinate of the graphics pen's new
position.


Description:
Moves the graphics pen to a particular location, MoveTo performs no drawing.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


NewGWorld

To create an offscreen graphics world, use the NewGWorld function.

FUNCTION NewGWorld(pixelDepth as Integer, boundsrect as Rect, cTable as Integer, aGDevice as GDHandle, flags as Integer): Integer

pixelDepth:
Pixel resolution of the offscreen graphics
world, possible values are: 0,1,2,4,8,16
and 32 bits per pixel. If you use 0 then the
screen's default value is used.

boundsrect:
Determines the offscreen pixel map's size
and coordinate system.

cTable:
Handle to the color table to be used
(use 0 for default color table).

aGDevice:
Used when the noDevice flag is set. Usually
you just put nil here.

flags:
The flags can be combination of 0 (pixPurge),
1 (noNewDevice), 3 (keepLocal) and 2
(useTempMem).

Returns: The new GWorld as GWorldPtr, nil if there as an error.

Description:
NewGWorld creates a graphics world, it allocates an offscreen port and pixel map and its associated offscreen memory. It also allocates a new offscreen graphics device record, unless you have specified that an existing graphics device record to be used. Either one you supply or the one having the deepest pixel depth in the rectangle defined by the bounds rect.

Notes:
The flags field provides some options to your application. If you set the pixPurge flag, NewGWorld makes the offscreen buffer a purgeable block.

Before drawing to or from the offscreen graphics world, your application should call the LockPixels function and ensure that it returns TRUE. if LockPixels returns FALSE, the OffScreen buffer has been purged, and your application should either call the UpdateGWorld method to reallocate it or draw directly in the indow it represents. NEVER draw to a purged offscreen buffer.

If you set the keepLocal flag, your offscreen graphics enviroment is kept in Macintosh main memory and is not cached to a graphics accelerator card. Use this flag carefully, as it gives up the advantages of a graphics acceleration card, if present.

If you set the useTempMem flag, NewGWorld allocates pixels in temporary memory. You should use temporary memory only for fleeting purposes, and only in conjuntion with the AllowPurgePixels method so that other applications can launch.

To use a custom color table in an offscreen graphics world, you need to create the associated offscreen device, because Color QuickDraw needs the device's inverse table to draw.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


NewRgn

To begin creating a new region, use the NewRgn function.

FUNCTION NewRgn as RgnHandle

returns a RgnHandle to the new region.

Description:
The NewRgn function allocates space for a new, variable-size region; initalizes it to the empty region defined by the rectangle (0,0,0,0); and returns a handle to the new region. This is the only function that creates a new region; other routines merely alter the size or shape of existing regions.

To begin defining a region, use the OpenRgn method.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


ObscureCursor

You can use the ObscureCursor to temporarily hide the mouse cursor.

ObscureCursor

Description:
Temporarily hide the mouse cursor, the mouse cursor will show up again when the mouse is moved by the user or when the ShowCursor is called.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


OffsetPoly

To change the location of an entire polygon use the OffsetPoly method.

OffsetPoly thePoly as PolyHandle,distHoriz as Integer,distVert as Integer

thePoly
PolyHandle variable containing a handle to the polygon.

distHoriz
The distance you want to move the polygon horizontally.

distVert
The distance you want to move the polygon vertically.


Description:
OffsetPoly modyfies a polygon's definition, moving it in any direction on the coordinate plane. Note, this does not have any visible effects on the screen, until such time as the polygon is drawn or filled.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


OffsetRect

To move a rectangle horizontally and vertically, use the OffsetRect method.

OffsetRect r as Rect,distHoriz as Integer, distVert as Integer

r:
The rectangle.

distHoriz:
Desired horizontal motion.

distVert:
Desired vertical motion.


Description:
This method provides a simple way to adjust the coordinates of a rectangle by adding offsets to all of its fields.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86



OffsetRgn

To move a region, use the OffsetRgn method.

OffsetRgn rgn as RgnHandle,dh as Integer,dv as Integer

rgn A handle to the region to alter.
dh The horizontal distance to move the region.
dv The vertical distance to move the region.


Description:
The OffsetRgn method 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 doesnŐt affect the screen unless you subsequently call a routine to draw the region. The OffsetRgn method is an especially efficient operation, because most of the data defining a region is stored relative to the rgnBBox field in its Region record and so isnŐt actually changed by OffsetRgn.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


OpColor

To set RGB value, used by addPin and subPin blend modes, use the OpColor method.

OpColor(theColor as Color) as Color

theColor An RGB value.


Description:
Sets RGB value used by addPin and subPin blend modes

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


OpenPicture

To create a picture, youcan use use the OpenPicture function.

FUNCTION OpenPicture(r as Rect) as PicHandle

r Rectangle defining location and size.

returns a handle leading to the picture.

Description:
The OpenPicture function returns a handle to a new Picture record. You can use the OpenPicture function to begin defining a picture. OpenPicture collects your subsequent drawing commands in this record. When defining a picture, you can use all other QuickDraw drawing rountines, with the exception of CopyMask, CopyDeepMask, SeedFill, SeedCFill, CalcMask, CalcCMask and PlotCIcon. The OpenPicture function calls the HidePen function, so no drawing accurs on the screen while the picture is open (unless you call ShowPen method). After defining a picture, you have to close it with the ClosePicture method.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


OpenPoly

To initialize a new PolyHandle and start defining a new polygon use the OpenPoly method.

FUNCTION OpenPoly as PolyHandle

returns a new polygon handle.

Description:
This call begins accumulating the defenition of a polygon by recording the endpoints of the line segments drawn with Line> and LineTo. Upom stopping recording (see ClosePoly), the polygon should be series of connected lines. The Macintosh toolbox limits polygons to 32kb. While the polygon is "open" Line and LineTo wont draw to the screen.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


OpenRgn

To begin defining a region, use the OpenRgn method.

OpenRgn

Description:
The OpenRgn method allocates temporary memory to start saving lines and framed shapes for processing as a region definition. Call OpenRgn only after initializing a region with the NewRgn function.

The NewRgn function stores the definition for a region in a Region record.

While a region is open, all calls to Line, LineTo, and the methods that draw framed shapes (except arcs) affect the outline of the region. Only the line endpoints and shape boundaries affect the region definition- the pattern mode, pattern, and size do not affect it.

When you are finished defining the region, call the CloseRgn method.

Note: Regions are limited to 32 kb in standart QuickDraw and 64kb in Color QuickDraw enviroment.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PaintArc

To paint a wedge of the oval that fits inside a rectangle with the graphics pen's pattern
and pattern mode, use the PaintArc method.

PaintArc r as Rect, startAngle as Integer, arcAngle as Integer

r
The rectangle that defines oval's boundaries.

startAngle
The angle indicating the start of the Arc.

arcAngle
The angle indicating the arc's extent.

returns a dummy integer.

Description:
Using the pen pattern and pattern mode of the current graphics port, the PaintArc method draws a wedge of the oval bounded by the rectangle that you specify. As in the FrameArc procedure desribed in the previous section. Use the startAngle and arcAngle parameters to define the arc of the wedge.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PaintOval

To paint a oval with the graphics pen's pattern mode, use the PaintOval method.

PaintOval r as Rect

r The rectangle that defines the oval's boundaries.


Description:
The PaintOval method draws the interior of the oval that you specify, with the pen pattern for the current graphics port, according to the pattern mode for the current graphics port. The pen location does not change.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PaintPoly

To fill the interior of a polygon, using the current pen, pattern and transfer mode use the PaintPoly method.

PaintPoly thePoly as PolyHandle

thePoly
PolyHandle variable containing a handle to the polygon.


Description:
PaintPoly fills the interior of a polygon, using the current pen, pattern and transfer mode. if a polygon is not a true polygon, in that is not closed set of lines, this function works as a line has been drawn between last endpoint and the first.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PaintRect

To paint rectangle with graphics pen's pattern and pattern mode, use the PaintRect method.

PaintRect r as Rect

r The rectangle to paint.

Description:
The PaintRect method draws the interior of the rectangle that you specify, with the pen pattern for the current graphics port, according to the pattern mode for the current graphics port. The pen location does not change.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PaintRgn

To paint a region with the graphics penŐs pattern and pattern mode, use the PaintRgn
method.

PaintRgn rgn as RgnHandle

rgn A handle to the region to paint.


Description:
Using the pen pattern and pattern mode for the current graphics port, the PaintRgn method draws the interior of the region whose handle you pass in the rgn parameter. The pen location does not change.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PaintRoundRect

To paint a rounded rectangle with the graphics pen's pattern mode, use the PaintRoundRect method..

PaintRoundRect r as Rect, ovalWidth as Integer, ovalHeight as Integer

r The rectangle that defines the rounded rectangle's
boundaries.

ovalWidth
The width of the oval defining the rounded corner.

ovalHeight
The height of the oval defining th rounded corner.


Description:
The PaintRoundRect method draws the interior of the roundedrectangle that you specify, with the pen pattern for the current graphics port, according to the pattern mode for the current graphics port. The pen location does not change.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PenMode

To set the pattern mode of the graphics pen in the current graphics port, use the
PenMode method.

PenMode mode

mode The pattern mode. The following list shows the values you can use they representŃfor specifying the pattern mode.

patCopy = 8; {where pattern pixel is black, apply }
{ foreground color to destination pixel; }
{ where pattern pixel is white, apply }
{ background color to destination pixel}
patOr = 9; {overwrite where pattern is black }
{ destination pixel; where pattern }
{ pixel is white, leave }
{ destination pixel unaltered}
patXor = 10; {where pattern pixel is black, invert }
{ destination pixel; where pattern }
{ pixel is white, leave destination }
{ pixel unaltered}
patBic = 11; {where pattern pixel is black, apply }
{ background color to destination pixel; }
{ where pattern pixel is white, leave }
{ destination pixel unaltered}
notPatCopy = 12; {where pattern pixel is black, apply }
{ background color to destination pixel; }
{ where pattern pixel is white, apply }
{ foreground color to destination pixel}
notPatOr = 13; {where pattern pixel is black, leave }
{ destination pixel unaltered; where }
{ pattern pixel is white, apply }
{ foreground color to destination pixel}
notPatXor = 14; {where pattern pixel is black, }
{ leave destination pixel unaltered; }
{ where pattern pixel is white, }
{ invert destination pixel}
notPatBic = 15; {where pattern pixel is black, }
{ leave destination pixel unaltered; }
{ where pattern pixel is white, apply }
{ background color to destination pixel}


Description:
Using the pattern mode you specify in the mode parameter, the PenMode method sets the manner in which the pattern of the graphics pen is transferred onto the bitmap (or pixel map) when you draw lines or shapes in the current graphics port.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PenNormal

To set the size, pattern, and pattern mode of the graphics pen in the current graphics port to their initial values, use the PenNormal method.

PenNormal

Description:
The PenNormal method restores the size, pattern, and pattern mode of the graphics pen in the current graphics port to their initial values: a size of 1 pixel by 1 pixel, a pattern mode of patCopy, and a pattern of black. The pen location does not change.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PenPat

To set the pixel pattern to be used by the graphics pen in the current color graphics port to a standart system pattern, use the PenPat method.

PenPat patconst

patconst System pattern constant.


Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PenPixPat

To set the pixel pattern to be used by the graphics pen in the current color graphics port, use the PenPixPat method. To assign a pixel pattern as the background pattern, you can use the BackPixPat method; this allows the ScrollRect method and the shape-erasing methods (for example, EraseRect) to fill the background with a colored, patterned Ňink.Ó

PenPixPat ppat as PixPatHandle

ppat A handle to the pixel pattern to use as the pen pattern.


Description:
PenPixPat method sets the graphics pen to use the pixel pattern that you specify in the ppat parameter. The PenPixPat procedure is similar to the basic QuickDraw method PenPat, except that you pass PenPixPat a handle to a multicolored pixel pattern rather than a bit pattern.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PenSize

To set the dimensions of the graphics pen in the current graphics port, use the PenSize method.

PenSize width,height

width The pen width, as an integer from 0 to 32,767. If you set the value to 0, the pen does not draw. Values less than 0 are undefined.
height The pen height, as an integer from 0 to 32,767. If you set the value to 0, the pen does not draw. Values less than 0 are undefined.


Description:
The PenSize method sets the width that you specify in the width parameter and the height that you specify in the height parameter for the graphics pen in the current graphics port. All subsequent calls to the Line and LineTo methods and to the methods that draw framed shapes in the current graphics port use the new pen dimensions.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PlotCIcon

You can plot a color icon of resource type 'cicn' using the PlotCIcon procedure. You
must have previously obtained a handle to the icon using GetCIcon.

PlotCIcon r as Rect, theIcon as CIconHandle

r - The rectangle in which to draw the icon,
specified in local coordinates of
the current graphics port.

theIcon A handle to the color icon record of the
color icon to draw.


Description:
The PlotCIcon method draws the color icon specified by the given handle. The iconMask field of the color icon record determines which pixels in the iconPMap field are drawn and which are not. Only pixels with 1s in corresponding positions in the iconMask field are drawn. If the screen depth is 1 or 2 bits per pixel, PlotCIcon uses the iconBMap field instead of the iconPMap field (unless the rowBytes field of IconBMap contains 0, indicating that there is no bitmap for the icon).

When PlotCIcon draws the icon, it uses the bounds field of iconPMap as the source rectangle of the image. If the destination rectangle is not the same size as the icon or its mask, PlotCIcon stretches or shrinks the icon to fit. The iconŐs pixels are remapped to the current depth and color table, if necessary. The bounds fields of iconPMap,iconBMap, and iconMask are expected to be equal in size.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PlotIconID

To display file icons on the screen use the PlotIconID function

FUNCTION PlotIconID(r as Rect,alignment as Integer, transform as Integer, resID as Integer) as Integer

r The rectangle to draw.

alignment This is used in case if the icon does
not excatly fit the given rectangle.

atNone = 0
atVerticalCenter = 1
atTop = 2
atBottom = 3
atHorizontalCenter = 4
atLeft = 8
atRight = 12

transform This parameter is used to control how the Icon
is drawn.

ttNone = 0
ttDisabled = 1
ttOffline = 2
ttOpen = 3
ttSelected = 16384
ttSelectedDisabled = 16385
ttSelectedOffline = 16386
ttSelectedOpen = 16387

resID The resource Id of the family of "icxx"

returns Errorcode, 0 = noError.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


Pt2Rect

To find the smallest rectangle enclosing 2 points, use the Pt2Point function.

FUNCTION Pt2Rect(p1 as Point,p2 as Point) as Rect

p1,p2:
Points to use.

returns:
a rectangle.

Description:
Pt2Rect determines the coordinates of the smallest rectangle that will enclose the pixels represented by two points.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PtInIconID

To hit test a point against indicated icon, use the RectInIconID function.

FUNCTION PtInIconID(testPt as Point,iconRect as Rect, alignment as Integer, resID as Integer) as Boolean

testPt Point to test.

iconRect Rectangle which icon was drawn in.

alignment Alignment for the icon:

atNone = 0
atVerticalCenter = 1
atTop = 2
atBottom = 3
atHorizontalCenter = 4
atLeft = 8
atRight = 12


resID The resource Id of the family of "icxx"

returns a boolean, true if testPt intersects the icon.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PtInLine

To test if a given point is on a specific line, use the PtInLine function.

FUNCTION PtInLine(p as Point,x1 as Integer,y1 as Integer,x2 as Integer,y2 as Integer,tolerance as Integer) as Boolean

p: The point to test.


x1: x cordanate of the first point that defines the line.

y1: y cordanate of the first point that defines the line.

x2: x cordanate of the second point that defines the line.

y1: y cordanate of the second point that defines the line.

tolerance:
Defines how much away from the line the user may click,
0 = just on the line.


Description:
Tests if a given point is on a specific line. This is not a standart Toolbox function.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PtInRect

To determine whether a pixel below is enclosed in a rectangle, use the PtInRect method.

FUNCTION PtInRect(p as Point, r as Rect) as Boolean

p The point to test

r The rectangle to test


Description:
The PtInRect function determines whether the pixel below and to the right of the point you specify in the pt parameters is enclosed in the rectangle that you specify in the Rect parameter. The PtInRect function returns True if it is, False if its not.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86


PtInRgn

To calculate the difference between the union and the intersection of two regions, use the
XorRgn method.

FUNCTION PtInRgn (thePt as Point,rgn as RgnHandle) as Boolean

thePt: The point whose pixel is to be checked.
rgn: A handle to the region to test.

returns a boolean result.

Description:
The PtInRgn function checks whether the pixel below and to the right of the point you specify in the pt parameter is within the region whose handle you pass in the rgn parameter. The PtInRgn function returns TRUE if so or FALSE if not.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


PtToAngle

To obtain angle between point and rectangle center, use the PtToAngle function.

FUNCTION PtToAngle(r as Rect,pt as Point) as Double

r The rectangle defining the angle area.

pt The point you want to test.


Description:
Determines an angular measure between the vertical center of a rectangle and a specified point.

The angle is not a true mathematical angle in circular degrees, as with arc and wedge functions. All angles are based on the corners of a rectangle.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86




QDError

To get a result code from the last applicable Color QuickDraw or Color Manager routine that you called, use the QDError function.

FUNCTION QDError as Integer

returns a error code as integer.

Description:
The QDError function returns the error result from the last applicable Color QuickDraw or Color Manager routine. On a system with only basic QuickDraw, QDError always returns noErr (0).

The QDError function is helpful in determining whether insufficient memory caused a drawing operationŃparticularly those involving regions, polygons, pictures, and images copied with CopyBitsŃto fail in Color QuickDraw.

Basic QuickDraw uses stack space for work buffers. For complex operations such as depth conversion, dithering, and image resizing, stack space may not be sufficient. Color QuickDraw attempts to get temporary memory from other parts of the system. If that is still not enough, QDError returns the nsStackErr (-149) error. If your application receives this result, reduce the memory required by the operationŃfor example, divide the image into left and right halvesŃand try again. When you record drawing operations in an open region, the resulting region description may overflow the 64 KB limit. Should this happen, QDError returns regionTooBigError (-147). Since the resulting region is potentially corrupt, the CloseRgn procedure (described in the chapter ŇQuickDraw DrawingÓ in this book) returns an empty region if it detects QDError has returned regionTooBigError. A similar error, rgnTooBigErr, can occur when using the BitMapToRegion function to convert a bitmap to a region. The BitMapToRegion function can also generate the pixmapTooDeepErr (-148) error if a PixMap record is supplied that is greater than 1 bit per pixel. You may be able to recover from this problem by coercing your PixMap record into a 1-bit PixMap record and calling the BitMapToRegion function again.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


RectInIconID

To hit test a rectangle against indicated icon, use the RectInIconID function.

FUNCTION RectInIconID(testRect as Rect,iconRect as Rect, alignment as Integer, resID as Integer) as Boolean

testRect Rectangle to test.

iconRect Rectangle which icon was drawn in.

alignment Alignment for the icon:

atNone = 0
atVerticalCenter = 1
atTop = 2
atBottom = 3
atHorizontalCenter = 4
atLeft = 8
atRight = 12


resID The resource Id of the family of "icxx"

returns a boolean, true if testRect intersects the icon.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


RectInRgn

To determine whether a rectangle intersects a region, use the RectInRgn function.

FUNCTION RectInRgn (r as Rect,rgn as RgnHandle) as Boolean

r The rectangle to check for intersection.
rgn A integer handle to the region to check.

returns a boolean result.

Description:
The RectInRgn function checks whether the rectangle specified in the r parameter intersects the region whose handle you pass in the rgn parameter. The RectInRgn function returns TRUE if the intersection encloses at least 1 bit or FALSE if it does not.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


RGBBackColor

For the current graphics port, you can use the RGBBackColor method to change the background color. (that is, the color of the pixels in the pixel map or bitmap where no drawing has taken place).

RGBBackColor RGBColor

RGBColor An RGB variable.


Description:
See Inside Macintosh QuickDraw Drawing, chapter 4.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


RGBForeColor

To change the color of the "ink" used for framing and painting you can use the RGBForeColor method.

RGBForeColor RGBColor

RGBColor An RGB variable.


Description:
The RGBForeColor method lets you set the foreground color to any color avalible on the current graphics device.

See more in: Inside Macintosh QuickDraw Drawing, chapter 4.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


ScrollRect

To move bits a specified distance in rectangular area, use the ScrollRect method.

ScrollRect r as Rect, distHoriz as Integer, distVert as Integer, updateRgn as RgnHandle

r Rectangle enclosing area to be scrolled.

distHoriz >0 = Scroll bits right, <0 = scoll left.

distVert >0 = Scroll bits down, <0 = scroll up.

updateRgn Becomes region vacated by the scroll.

Description:
Scroll rect copies bits enclosed by a rectangle and stores them within that same rectangle, at specified horizontal and vertical offset.

Note: The updatedRgn handle must have been created with the NewRgn function before using it with ScrollRect.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SectRect

To get intersection of two rectangles, use the SectRect function.

FUNCTION SectRect(r1 as Rect,r2 as Rect,resultRect as Rect) as Boolean

r1,r2:
Rectangles to check.

resultRect:
Address of a precreated rect to recieve the result

returns: A Boolean value indicating whether or not r1
and r2 share any common points.


Description:
In the sample above:

Figure on the left:
The intersection of A and B is shown in Black, and SectRect will return C.

Figure on the right:
There is no Interception of A and B and SectRect will return nil.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86


SectRgn

To calculate the intersection of two regions, use the SectRgn method.

SectRgn srcRgnA as RgnHandle,srcRgnA as RgnHandle,srcRgnA as RgnHandle

srcRgnA A handle to the first of two regions whose intersection is to be determined.
srcRgnB A handle to the second of two regions whose intersection is to be
determined.
dstRgn A handle to the region to receive the intersection area.

Description:
The SectRgn method 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 method does not create a destination region; you must have already allocated memory for it by using the NewRgn function.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SeedCFill

To determine how far filling will extend to pixels matching the color of a particular pixel,
use the SeedCFill method.

SeedCFill srcMap as BitMapPtr,dstMap as BitMapPtr, src as Rect,dest as Rect, seedH as Integer,seedV as Integer

srcMap:
address of BitMap of source image.

destMap:
The destenation mask.

src:
size, location data from srcBitmap.

dest:
size, location to store data in destination.

seedH:
The horizontal position of the seed point.

seedV:
The vertical position of the seed point.


Description:
The SeedCFill method generates a mask showing where the pixels in an image can be filled from a starting point, like the paint pouring from the MacPaint paint-bucket tool. The SeedCFill method returns this mask in the dstBits parameter. This mask is a bitmap filled with 1Ős to indicate all pixels adjacent to a seed point whose colors do not exactly match the RGBColor record for the pixel at the seed point. You can then use this mask with the CopyBits, CopyMask, and CopyDeepMask methods.

You specify a source image in the srcBits parameter, and in the srcRect parameter you specify a rectangle within that source image. You specify where to begin seeding in the seedH and seedV parameters, which must be the horizontal and vertical coordinates of a point in the local coordinate system of the source bitmap. By default, the 1Ős returned in the mask indicate all pixels adjacent to the seed point whose pixel values do not exactly match the pixel value of the pixel at the seed point.

In generating the mask, SeedCFill uses the CopyBits method to convert the source image to a 1-bit mask. The SeedCFill method installs a default color search function that returns 0 if the pixel value matches that of the seed point; all other pixel values return 1Ős.

The SeedCFill method does not scale: the source and destination rectangles must be the same size. Calls to SeedCFill are not clipped to the current port and are not stored into QuickDraw pictures.

See more in inside Macintosh Imaging with QuickDraw.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SetClip

To change the clipping region of the current graphics port (basic or color) to a region you specify, use the SetClip method.

SetClip rgn

rgn A handle to the region to be set as the current portŐs clipping region.


Description:
The SetClip method changes the clipping region of the current graphics port to the region specified in the rgn parameter. The SetClip method 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 methods 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 routines preserve the current clipping region.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SetCPixel

To set the color of an induvitual pixel, use the SetCPixel method.

SetCPixel h, v, RGBColor as Color

h The horizontal coordinate of the point at the upper-left corner of the pixel.
v The vertical coordinate of the point at the upper-left corner of the pixel.
RGBColor RGB color of the pixel you want to set


Description:
See more in: Inside Macintosh QuickDraw Drawing, chapter 4.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SetEmptyRgn

To set existing region to be empty; use the SetEmptyRgn method.

SetEmptyRgn rgn as RgnHandle

rgn
The integer-handle to the region to be made empty.


Description:
The SetEmptyRgn method destroys the previous structure of the region whose handle you pass in the rgn parameter; it then sets the new structure to be empty region defined by the rectangle (0,0,0,0).

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SetGraphics

To set the current port to a specified REALbasic graphics port, use the SetGraphics method.

Note: This method is not a Macintosh toolbox method, this method is here to make the QuickDrawLib more compatible with REALbasic.

SetGraphics g as Graphics

g The REALbasic Graphics object that you want to set as a current port.


Special considerations
Every time you call a REALbasic object that is on the screen, that object becomes the current graphics object, this is the way REALbasic handles its graphics port. So if you use the SetGraphics command to specify in what port you intend to draw, then draw something, and then do for example button1.Caption = "Cool", then you lose the current graphis port from your object (unless you call SetGraphics again)

So if this is the case then why arent the methods in the QuickDrawLib with g parameter (so they always draw in prefered graphics port). The answer to that is that this way its a lot faster. Not seting the graphics port every time speeds things up, and that is probably the primary reason why most of the methods in the QD lib are faster than the build in methods in REALbasic.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SetGWorld

To set the current graphics world, use the SetGWorld method.

SetGWorld port as GWorldPtr,gdh ad GDHandle

port: graphPort to make the current port.

gdh: Make the current device.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SetOrigin

To redefine the local coordinate system for active GrafPort, use the SetOrigin method.

SetOrigin hOrigin as Integer,vOrigin as Integer

hOrigin New local coordinate for left side.

vOrigin New local coordinate for left top.


Description:
SetOrigin does not affect the screen image. It does affect all subsequent drawing and other operations that use local coordinate system.

The figure on the left side shows the local coordinate plane as it is initially, the dot at point A is at the local coordinate (10,10).

The SetOrigin(-20,0) call slides the coordinate system toward the right. The dot A is now at (-10,10). A new dot drawn at (10,10) would appear at point B, 20 points to the right of the dot originally drawn at (10,10).

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SetPort

To change the current graphics port (basic or color), you can use the SetPort method.

SetPort port as GrafPtr

port pointer to a GrafPort record (or to a GWorldPtr*). Typically, you pass a pointer to a GrafPort record that you previously saved with the GetPort method.

GWorldPtr also works because the GWorldPtr class inherits from the GrafPtr class.

Description:
The SetPort method sets the current graphics port to be that specified by the port parameter. All QuickDraw drawing routines affect the bitmap of, and use the local coordinate system of, the current graphics port. Each graphics port has its own graphics pen and text characteristics, which remain unchanged when the graphics port isnŐt selected as the current graphics port.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


SetRectRgn

To change the structure of an existing region to that of an rectangle, you can use the SetRectRgn method.

SetRectRgn rgn as RgnHandle, left as Integer, top as Integer, right as Integer, bottom as Integer

rgn
The handle to the region to restructure as a
rectangle.

left, top, right, bottom
The rectangle.


Description:
The SetRectRgn method 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.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


ShowCursor

You can use the ShowCursor method display a cursor hidden by the HideCursor method.

ShowCursor

Description:
Shows the cursor after it has been hidden by the HideCursor method.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


StringWidth

To query the width of string in pixels, use the StringWidth function.

FUNCTION StringWidth(str as String) as Integer

str The string you ant to measure.

returns: The string width as Integer.

Description:
String width uses the current drawing device TextFont, Face and size to measure the string.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


TextBold

To set the text face to bold before subsequent text drawing, use the TextBold method.

TextBold Value as Boolean

Value: True or False


Description:
Sets or removes the TextBold face.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


TextFont

To select a font for subsequent text drawing, use the TextFont method.

TextFont fontName as String

fontName The name of the desired font as String.


Description:
Sets the the textfont for the current drawing device.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


TextHeight

To query the height of text in pixels, use the TextHeight function.

FUNCTION TextHeight as Integer


returns: The text height as Integer.

Description:
Text height uses the current drawing device TextFont, Face and size to measure the string.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


TextItalic

To set the text face to italic before subsequent text drawing, use the TextItalic method.

TextItalic Value as Boolean

Value: True or False


Description:
Sets or removes the TextItalic face.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


TextFont

To set the text size for subsequent text drawing, use the TextSize method.

TextSize fontSize as Integer

fontsize The text size in pixels as integer.


Description:
Sets the the textsize for the current drawing device.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


TextUnderline

To set the text face to underline before subsequent text drawing, use the TextUnderline method.

TextUnderline Value as Boolean

Value: True or False


Description:
Sets or removes the TextUnderline face.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


UnionRect

To find smallest Rectangle enclosing 2 rectangles, use the UnionRect function.

FUNCTION UnionRect(r as Rect,r2 as Rect) as Rect

r1,r2:
Rectangles to check.

returns:
a rectangle that encloses both r1 and r2.

Description:
In the sample above:

The black and patterned rects are r1 and r2, the white rectangle is the result rect.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
* Windows x86


UnionRgn

To calculate the union of two regions, use the UnionRgn method.

UnionRgn srcRgnA as RgnHandle,srcRgnB as RgnHandle,dstRgn as RgnHandle

srcRgnA A handle to the first of two regions whose union is to be determined.
srcRgnB A handle to the second of two regions whose union is to be determined.
dstRgn A handle to the region to hold the resulting union area.


Description:
The UnionRgn method 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 method does not create the destination region; you must have already allocated memory for it by using the NewRgn function.

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


UnlockPixels

To unlock the buffer used by an offscreen graphics world, use the UnlockPixels method.

UnlockPixels pm as PixMapHandle

pm: The Pixel map handle returned from a GetGWorldPixMap call.


You dont need to call UnlockPixels if LockPixels returned FALSE, but it does no harm.
You dont need

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


XorRgn

To calculate the difference between the union and the intersection of two regions, use the
XorRgn method.

XorRgn srcRgnA as RgnHandle,srcRgnB as RgnHandle,dstRgn as RgnHandle

srcRgnA A handle to the first of two regions to compare.
srcRgnB A handle to the second of two regions to compare.
dstRgn A handle to the region to hold the result.


Description:
The XorRgn method 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. 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).

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS Mach-O
Unsupported platforms:
* Windows x86


4.0:
* Added support for Mach-O compile.
(A REALbasic 5.5.2 and later feature).

3.8:
* Added support for REALbasic 5.5.
* Fixed a problem with PtInRect on Win32 compiles.
* The QuickDrawLib now comes with a stub for the REALbasic
Windows IDE for the few functions that it supports on Win32
(Which are mostly point and rect calculation functions).

3.7:
* Added support for REALbasic 5.1.

3.6:
* Updated everything to support the new TypeLib syntax.
* Did some fixes for Asian systems.
* Did preliminary tests for REALbasic 5.0 which all went well.

3.5:
* Added Carbon and MacOS X support.
* Added RB Plugin plunger Documentation.
* Did various of tweaks and fixes.
* Added a SeedCFill example project.

3.2:
* Added Carbon support
* Added Platform information to the documentation

3.0:
* Added a Plot method to the PixMapHandle class
* Added toPicHandle function to the PixMapHandle class
* Added toCompressedPicHandle function to the PixMapHandle class
* Added GetBackColor function
* Added GetForeColor function
* Added CopyDeepMask method
* Added a extra constructor to PicHandle object
(PicHandle = new PicHandle(str as String))
Note: This constructor is only avalible with
TypeLib 1.8 or newer installed.
* Optimized even more for codesize, making the plugin
about 10% smaller.
* Some bugs in the documentation were fixed.
* Sample projects updated
* Compiled with REALbasic 2.1.x compatible SDK

2.6:
* New method: GlobalToLocal (68k,PPC,x86)
* New method: LocalToGlobal (68k,PPC,x86)
* Added x86 support for PtInRect
* Added x86 support for EqualRect
* Added x86 support for OffsetRect
* Added x86 support for InsetRect
* Added x86 support for EmptyRect
* Added x86 support for SectRect
* Added x86 support for UnionRect