Up

# NSGraphicsContext

### Authors

Richard Frith-Macdonald (`richard@brainstorm.co.uk`)
Adam Fedor (`fedor@gnu.org`)

> GNUstep drawing context class.

Copyright: (C) 1998,1999 Free Software Foundation, Inc.

### Contents -

1. NSGraphicsContext
2. Software documentation for the NSGraphicsContext(GNUstep) category
3. Software documentation for the NSGraphicsContext(NSGraphics) category
4. Software documentation for the NSGraphicsContext(Ops) category
5. Software documentation for the NSGraphicsContext(Printing) category

# NSGraphicsContext

This is an abstract class which provides a framework for a device independant drawing.

In addition, this class provides methods to perform the actual drawing. As a convenience, you can also access these through various function interfaces. One is a Display Postscript interface using PS and DPS operations. Another is a Quartz interface (not yet written).

## NSGraphicsContext : NSObject

> Declared in:
>   AppKit/NSGraphicsContext.h

Availability: OpenStep
Description forthcoming.

Instance Variables
Method summary

- +handleExposeRect:forDriver:
- +setDefaultContextClass:
- -focusView
- -initWithContextInfo:
- -lockFocusView:inRect:
- -resetUsedFonts
- -unlockFocusView:needsFlush:
- -useFont:
- -usedFonts
- -GSReadRect:
- -GSWSetViewIsFlipped:
- -GSWViewIsFlipped
- -NSBeep
- -NSDrawBitmap:::::::::::
- -DPSPrintf::
- -DPSWriteData::
- -DPSarc:::::
- -DPSarcn:::::
- -DPSarct:::::
- -DPSashow:::
- -DPSawidthshow::::::
- -DPScharpath::
- -DPSclip
- -DPSclosepath
- -DPScomposite::::::::
- -DPScompositerect:::::
- -DPSconcat:
- -DPScurrentalpha:
- -DPScurrentcmykcolor::::
- -DPScurrentflat:
- -DPScurrentgray:
- -DPScurrenthsbcolor:::
- -DPScurrentlinecap:
- -DPScurrentlinejoin:
- -DPScurrentlinewidth:
- -DPScurrentmiterlimit:
- -DPScurrentoffset::
- -DPScurrentpoint::
- -DPScurrentrgbcolor:::
- -DPScurrentstrokeadjust:
- -DPScurveto::::::
- -DPSdissolve::::::::
- -DPSeoclip
- -DPSeofill
- -DPSfill
- -DPSflattenpath
- -DPSgrestore
- -DPSgsave
- -DPSinitclip
- -DPSinitgraphics
- -DPSinitmatrix
- -DPSlineto::
- -DPSmoveto::
- -DPSnewpath
- -DPSpathbbox::::
- -DPSrcurveto::::::
- -DPSrectclip::::
- -DPSrectfill::::
- -DPSrectstroke::::
- -DPSreversepath
- -DPSrlineto::
- -DPSrmoveto::
- -DPSrotate:
- -DPSscale::
- -DPSsetalpha:
- -DPSsetcmykcolor::::
- -DPSsetdash:::
- -DPSsetflat:
- -DPSsetgray:
- -DPSsetgstate:
- -DPSsethalftonephase::
- -DPSsethsbcolor:::
- -DPSsetlinecap:
- -DPSsetlinejoin:
- -DPSsetlinewidth:
- -DPSsetmiterlimit:
- -DPSsetoffset::
- -DPSsetrgbcolor:::
- -DPSsetstrokeadjust:
- -DPSshfill:
- -DPSshow:
- -DPSstroke
- -DPStranslate::
- -DPSwidthshow::::
- -DPSxshow:::
- -DPSxyshow:::
- -DPSyshow:::
- -GSConcatCTM:
- -GSCurrentCTM
- -GSCurrentDevice:::
- -GSDefineGState
- -GSDrawImage::
- -GSGetTextCTM
- -GSGetTextPosition
- -GSRectClipList::
- -GSRectFillList::
- -GSReplaceGState:
- -GSSendBezierPath:
- -GSSetCTM:
- -GSSetCharacterSpacing:
- -GSSetDevice:::
- -GSSetFillColor:
- -GSSetFillColorspace:
- -GSSetFont:
- -GSSetFontSize:
- -GSSetPatterColor:
- -GSSetStrokeColor:
- -GSSetStrokeColorspace:
- -GSSetTextCTM:
- -GSSetTextDrawingMode:
- -GSSetTextPosition:
- -GSShowGlyphs::
- -GSShowText::
- -GSUndefineGState:
- -GScomposite:toPoint:fromRect:operation:fraction:
- -appendBezierPathWithPackedGlyphs:path:
- -beginPage:label:bBox:fonts:
- -beginPrologueBBox:creationDate:createdBy:fonts:forWhom:pages:title:
- -beginSetup
- -beginTrailer
- -endDocumentPages:documentFonts:
- -endHeaderComments
- -endPageSetup
- -endPrologue
- -endSetup
- -endSheet
- -endTrailer
- -printerProlog
- -showPage
- +currentContext
- +currentContextDrawingToScreen
- +graphicsContextWithAttributes:
- +graphicsContextWithBitmapImageRep:
- +graphicsContextWithGraphicsPort:flipped:
- +graphicsContextWithWindow:
- +restoreGraphicsState
- +saveGraphicsState
- +setCurrentContext:
- +setGraphicsState:
- -attributes
- -compositingOperation
- -flushGraphics
- -focusStack
- -graphicsPort
- -imageInterpolation
- -isDrawingToScreen
- -isFlipped
- -patternPhase
- -restoreGraphicsState
- -saveGraphicsState
- -setCompositingOperation:
- -setFocusStack:
- -setImageInterpolation:
- -setPatternPhase:
- -setShouldAntialias:
- -shouldAntialias

### currentContext

+ (NSGraphicsContext*) currentContext;
Availability: OpenStep
Returns the current context. Also see the convienience function GSCurrentContext()

### currentContextDrawingToScreen

+ (BOOL) currentContextDrawingToScreen;
Availability: OpenStep
Returns `YES` if the current context is a display context

### graphicsContextWithAttributes:

+ (NSGraphicsContext*) graphicsContextWithAttributes: (NSDictionary*)attributes;
Availability: OpenStep

Create a graphics context with attributes, which contains key/value pairs which describe the specifics of how the context is to be initialized.

### graphicsContextWithBitmapImageRep:

+ (NSGraphicsContext*) graphicsContextWithBitmapImageRep: (NSBitmapImageRep*)bitmap;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### graphicsContextWithGraphicsPort: flipped:

+ (NSGraphicsContext*) graphicsContextWithGraphicsPort: (void*)port flipped: (BOOL)flag;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### graphicsContextWithWindow:

+ (NSGraphicsContext*) graphicsContextWithWindow: (NSWindow*)aWindow;
Availability: OpenStep
Create graphics context with attributes speficied by aWindow's device description.

### restoreGraphicsState

+ (void) restoreGraphicsState;
Availability: OpenStep
Description forthcoming.

### saveGraphicsState

+ (void) saveGraphicsState;
Availability: OpenStep
Description forthcoming.

### setCurrentContext:

+ (void) setCurrentContext: (NSGraphicsContext*)context;
Availability: OpenStep
Set the current context that will handle drawing.

### setGraphicsState:

+ (void) setGraphicsState: (int)graphicsState;
Availability: OpenStep
Description forthcoming.

### attributes

- (NSDictionary*) attributes;
Availability: OpenStep
Description forthcoming.

### compositingOperation

- (NSCompositingOperation) compositingOperation;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### flushGraphics

- (void) flushGraphics;
Availability: OpenStep
Description forthcoming.

### focusStack

- (void*) focusStack;
Availability: OpenStep
Description forthcoming.

### graphicsPort

- (void*) graphicsPort;
Availability: OpenStep
Description forthcoming.

### imageInterpolation

- (NSImageInterpolation) imageInterpolation;
Availability: OpenStep
Description forthcoming.

### isDrawingToScreen

- (BOOL) isDrawingToScreen;
Availability: OpenStep
Description forthcoming.

### isFlipped

- (BOOL) isFlipped;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### patternPhase

- (NSPoint) patternPhase;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### restoreGraphicsState

- (void) restoreGraphicsState;
Availability: OpenStep
Description forthcoming.

### saveGraphicsState

- (void) saveGraphicsState;
Availability: OpenStep
Description forthcoming.

### setCompositingOperation:

- (void) setCompositingOperation: (NSCompositingOperation)operation;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### setFocusStack:

- (void) setFocusStack: (void*)stack;
Availability: OpenStep
Description forthcoming.

### setImageInterpolation:

- (void) setImageInterpolation: (NSImageInterpolation)interpolation;
Availability: OpenStep
Description forthcoming.

### setPatternPhase:

- (void) setPatternPhase: (NSPoint)phase;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### setShouldAntialias:

- (void) setShouldAntialias: (BOOL)antialias;
Availability: OpenStep
Description forthcoming.

### shouldAntialias

- (BOOL) shouldAntialias;
Availability: OpenStep
Description forthcoming.

## Instance Variables for NSGraphicsContext Class

### _antialias

@protected BOOL _antialias;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _compositingOperation

@protected NSCompositingOperation _compositingOperation;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _graphicsPort

@protected void* _graphicsPort;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _interp

@protected NSImageInterpolation _interp;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _isFlipped

@protected BOOL _isFlipped;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _patternPhase

@protected NSPoint _patternPhase;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### context_data

@protected NSMutableData* context_data;
Availability: OpenStep
Description forthcoming.

### context_info

@protected NSDictionary* context_info;
Availability: OpenStep
Description forthcoming.

### focus_stack

@protected NSMutableArray* focus_stack;
Availability: OpenStep
Description forthcoming.

### methods

@public const gsMethodTable* methods;
Availability: OpenStep
Description forthcoming.

### usedFonts

@protected NSMutableSet* usedFonts;
Availability: OpenStep
Description forthcoming.

# Software documentation for the NSGraphicsContext(GNUstep) category

## NSGraphicsContext(GNUstep)

> Declared in:
>   AppKit/NSGraphicsContext.h

Availability: Not in OpenStep/MacOS-X
Description forthcoming.
Method summary

- +handleExposeRect:forDriver:
- +setDefaultContextClass:
- -focusView
- -initWithContextInfo:
- -lockFocusView:inRect:
- -resetUsedFonts
- -unlockFocusView:needsFlush:
- -useFont:
- -usedFonts

### handleExposeRect: forDriver:

+ (void) handleExposeRect: (NSRect)rect forDriver: (void*)driver;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### setDefaultContextClass:

+ (void) setDefaultContextClass: (Class)defaultContextClass;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### focusView

- (NSView*) focusView;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### initWithContextInfo:

- (id) initWithContextInfo: (NSDictionary*)info;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### lockFocusView: inRect:

- (void) lockFocusView: (NSView*)aView inRect: (NSRect)rect;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### resetUsedFonts

- (void) resetUsedFonts;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### unlockFocusView: needsFlush:

- (void) unlockFocusView: (NSView*)aView needsFlush: (BOOL)flush;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### useFont:

- (void) useFont: (NSString*)fontName;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### usedFonts

- (NSSet*) usedFonts;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

# Software documentation for the NSGraphicsContext(NSGraphics) category

## NSGraphicsContext(NSGraphics)

> Declared in:
>   AppKit/NSGraphicsContext.h

Availability: OpenStep
Description forthcoming.
Method summary

- -GSReadRect:
- -GSWSetViewIsFlipped:
- -GSWViewIsFlipped
- -NSBeep
- -NSDrawBitmap:::::::::::

### GSReadRect:

- (NSDictionary*) GSReadRect: (NSRect)rect;
Availability: OpenStep

Read raw pixels from the device and return the information as a bitmap. Pixels are read from the smallest device-pixel aligned rectangle containing rect (defined in the current graphics state and clipped to the current window, but not against the clipping path). If the resulting device rectangle is degenerate, Size will be (0,0) and Data will be `nil`, but the other entries in the dictionary will be filled in.

If the device does not support the operation, returns `nil`.

The returned dictionary contains at least the following keys:

Data
  An NSData-instance with the image data.
Size
  An NSValue/NSSize with the size in pixels of the returned image data.
BitsPerSample
  An NSValue/unsigned int.
SamplesPerPixel
  An NSValue/unsigned int.
ColorSpace
  An NSString with the name of the color space the data is in.
HasAlpha
  An NSValue/unsigned int. 0 if the returned image does not have an alpha channel, 1 if it does.
Matrix
  An NSAffineTransform-instance that contains the transform between current user space and image space for this image.

### GSWSetViewIsFlipped:

- (void) GSWSetViewIsFlipped: (BOOL)flipped;
Availability: OpenStep
This method is used by the backend, but has been rendered obsolete. Do not use it in any code or in any backend implementation as it may disappear at any point.

### GSWViewIsFlipped

- (BOOL) GSWViewIsFlipped;
Availability: OpenStep
Returns `YES` if the current focused view is flipped. This is an obsolete method. Use [[NSView focusView] isFlipped] instead

### NSBeep

- (void) NSBeep;
Availability: OpenStep
Play the System Beep

### NSDrawBitmap: : : : : : : : : : :

- (void) NSDrawBitmap: (NSRect)rect : (int)pixelsWide : (int)pixelsHigh : (int)bitsPerSample : (int)samplesPerPixel : (int)bitsPerPixel : (int)bytesPerRow : (BOOL)isPlanar : (BOOL)hasAlpha : (NSString*)colorSpaceName : (const unsigned char*const[5])data;
Availability: OpenStep
Generic method to render bitmap images. This method shouldn't be used anywhere except in the AppKit itself. It will be replaced by the more flexible GSDrawImage method sometime in the future. (Quartz).

# Software documentation for the NSGraphicsContext(Ops) category

## NSGraphicsContext(Ops)

> Declared in:
>   AppKit/NSGraphicsContext.h

Availability: OpenStep
Description forthcoming.
Method summary

- -DPSPrintf::
- -DPSWriteData::
- -DPSarc:::::
- -DPSarcn:::::
- -DPSarct:::::
- -DPSashow:::
- -DPSawidthshow::::::
- -DPScharpath::
- -DPSclip
- -DPSclosepath
- -DPScomposite::::::::
- -DPScompositerect:::::
- -DPSconcat:
- -DPScurrentalpha:
- -DPScurrentcmykcolor::::
- -DPScurrentflat:
- -DPScurrentgray:
- -DPScurrenthsbcolor:::
- -DPScurrentlinecap:
- -DPScurrentlinejoin:
- -DPScurrentlinewidth:
- -DPScurrentmiterlimit:
- -DPScurrentoffset::
- -DPScurrentpoint::
- -DPScurrentrgbcolor:::
- -DPScurrentstrokeadjust:
- -DPScurveto::::::
- -DPSdissolve::::::::
- -DPSeoclip
- -DPSeofill
- -DPSfill
- -DPSflattenpath
- -DPSgrestore
- -DPSgsave
- -DPSinitclip
- -DPSinitgraphics
- -DPSinitmatrix
- -DPSlineto::
- -DPSmoveto::
- -DPSnewpath
- -DPSpathbbox::::
- -DPSrcurveto::::::
- -DPSrectclip::::
- -DPSrectfill::::
- -DPSrectstroke::::
- -DPSreversepath
- -DPSrlineto::
- -DPSrmoveto::
- -DPSrotate:
- -DPSscale::
- -DPSsetalpha:
- -DPSsetcmykcolor::::
- -DPSsetdash:::
- -DPSsetflat:
- -DPSsetgray:
- -DPSsetgstate:
- -DPSsethalftonephase::
- -DPSsethsbcolor:::
- -DPSsetlinecap:
- -DPSsetlinejoin:
- -DPSsetlinewidth:
- -DPSsetmiterlimit:
- -DPSsetoffset::
- -DPSsetrgbcolor:::
- -DPSsetstrokeadjust:
- -DPSshfill:
- -DPSshow:
- -DPSstroke
- -DPStranslate::
- -DPSwidthshow::::
- -DPSxshow:::
- -DPSxyshow:::
- -DPSyshow:::
- -GSConcatCTM:
- -GSCurrentCTM
- -GSCurrentDevice:::
- -GSDefineGState
- -GSDrawImage::
- -GSGetTextCTM
- -GSGetTextPosition
- -GSRectClipList::
- -GSRectFillList::
- -GSReplaceGState:
- -GSSendBezierPath:
- -GSSetCTM:
- -GSSetCharacterSpacing:
- -GSSetDevice:::
- -GSSetFillColor:
- -GSSetFillColorspace:
- -GSSetFont:
- -GSSetFontSize:
- -GSSetPatterColor:
- -GSSetStrokeColor:
- -GSSetStrokeColorspace:
- -GSSetTextCTM:
- -GSSetTextDrawingMode:
- -GSSetTextPosition:
- -GSShowGlyphs::
- -GSShowText::
- -GSUndefineGState:
- -GScomposite:toPoint:fromRect:operation:fraction:
- -appendBezierPathWithPackedGlyphs:path:

### DPSPrintf: :

- (void) DPSPrintf: (const char*)fmt : (va_list)args;
Availability: OpenStep
Write the string (with printf substitutions) to a PostScript context. Other output contexts will likely ignore this

### DPSWriteData: :

- (void) DPSWriteData: (const char*)buf : (unsigned int)count;
Availability: OpenStep
Write the encoded data to a PostScript context. Other output contexts will likely ignore this

### DPSarc: : : : :

- (void) DPSarc: (float)x : (float)y : (float)r : (float)angle1 : (float)angle2;
Availability: OpenStep
Description forthcoming.

### DPSarcn: : : : :

- (void) DPSarcn: (float)x : (float)y : (float)r : (float)angle1 : (float)angle2;
Availability: OpenStep
Description forthcoming.

### DPSarct: : : : :

- (void) DPSarct: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)r;
Availability: OpenStep
Description forthcoming.

### DPSashow: : :

- (void) DPSashow: (float)x : (float)y : (const char*)s;
Availability: OpenStep
Displays a string as in DPSshow, except that ( x,y) is added to the advancement of every glyph. An alternative means of achieving the same effect is to use the -GSSetCharacterSpacing: method. Either approach should be more efficient that using -DPSshow: with appropriate -DPSrmoveto:: operations.

### DPSawidthshow: : : : : :

- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay : (const char*)s;
Availability: OpenStep
Displays a string as in a combination of DPSashow and DPSwidthshow: (ax,ay) is added to the advancement of every glyph, while ( cx,cy) is also added to the advancement for character c's glyph specifically. Using this method should be more efficient that using -DPSshow: with appropriate -DPSrmoveto:: operations.

### DPScharpath: :

- (void) DPScharpath: (const char*)s : (int)b;
Availability: OpenStep
Appends to the current path a path that is equivalent to the outlines of the glyphs in the string. This results in a path that can be used for stroking, filling or clipping (DPS).

### DPSclip

- (void) DPSclip;
Availability: OpenStep
Clip to the current path. (DPS, Quartz).

### DPSclosepath

- (void) DPSclosepath;
Availability: OpenStep
Description forthcoming.

### DPScomposite: : : : : : : :

- (void) DPScomposite: (float)x : (float)y : (float)w : (float)h : (int)gstateNum : (float)dx : (float)dy : (int)op;
Availability: OpenStep
Description forthcoming.

### DPScompositerect: : : : :

- (void) DPScompositerect: (float)x : (float)y : (float)w : (float)h : (int)op;
Availability: OpenStep
Description forthcoming.

### DPSconcat:

- (void) DPSconcat: (const float*)m;
Availability: OpenStep
Concatenates the coordinate transform represented by the matrix m with the current coordinate transform. (DPS).

### DPScurrentalpha:

- (void) DPScurrentalpha: (float*)a;
Availability: OpenStep
Returns the current alpha component (DPS).

### DPScurrentcmykcolor: : : :

- (void) DPScurrentcmykcolor: (float*)c : (float*)m : (float*)y : (float*)k;
Availability: OpenStep
Returns the current color according to the CMYK color model (DPS).

### DPScurrentflat:

- (void) DPScurrentflat: (float*)flatness;
Availability: OpenStep
Returns the current flattness parameter, which controls how curved lines are drawn. (DPS, Quartz).

### DPScurrentgray:

- (void) DPScurrentgray: (float*)gray;
Availability: OpenStep
Returns the gray-level equivalent in the current color space. The value may depend on the current color space and may be 0 if the current color space has no notion of a gray value (DPS)

### DPScurrenthsbcolor: : :

- (void) DPScurrenthsbcolor: (float*)h : (float*)s : (float*)b;
Availability: OpenStep
Returns the current color according to the HSB color model (DPS).

### DPScurrentlinecap:

- (void) DPScurrentlinecap: (int*)linecap;
Availability: OpenStep
Returns the current linecap value. (DPS, Quartz).

### DPScurrentlinejoin:

- (void) DPScurrentlinejoin: (int*)linejoin;
Availability: OpenStep
Returns the current linejoin value. (DPS, Quartz).

### DPScurrentlinewidth:

- (void) DPScurrentlinewidth: (float*)width;
Availability: OpenStep
Returns the current line width. (DPS, Quartz).

### DPScurrentmiterlimit:

- (void) DPScurrentmiterlimit: (float*)limit;
Availability: OpenStep
Returns the current linecap value. (DPS, Quartz).

### DPScurrentoffset: :

- (void) DPScurrentoffset: (int*)x : (int*)y;
Availability: OpenStep
Description forthcoming.

### DPScurrentpoint: :

- (void) DPScurrentpoint: (float*)x : (float*)y;
Availability: OpenStep
Returns the current point. (DPS, Quartz).

### DPScurrentrgbcolor: : :

- (void) DPScurrentrgbcolor: (float*)r : (float*)g : (float*)b;
Availability: OpenStep
Returns the current color according to the RGB color model (DPS).

### DPScurrentstrokeadjust:

- (void) DPScurrentstrokeadjust: (int*)b;
Availability: OpenStep
Returns the strokeadjust value. (DPS).

### DPScurveto: : : : : :

- (void) DPScurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)x3 : (float)y3;
Availability: OpenStep
Description forthcoming.

### DPSdissolve: : : : : : : :

- (void) DPSdissolve: (float)x : (float)y : (float)w : (float)h : (int)gstateNum : (float)dx : (float)dy : (float)delta;
Availability: OpenStep
Description forthcoming.

### DPSeoclip

- (void) DPSeoclip;
Availability: OpenStep
Description forthcoming.

### DPSeofill

- (void) DPSeofill;
Availability: OpenStep
Description forthcoming.

### DPSfill

- (void) DPSfill;
Availability: OpenStep
Fill the current path. (DPS, Quartz).

### DPSflattenpath

- (void) DPSflattenpath;
Availability: OpenStep
Description forthcoming.

### DPSgrestore

- (void) DPSgrestore;
Availability: OpenStep
Pops a previously saved gstate from the gstate stack and makes it current. Drawing information in the previously saved gstate becomes the current information. (DPS, Quartz).

### DPSgsave

- (void) DPSgsave;
Availability: OpenStep
Saves (pushes) a copy of the current gstate information onto the gstate stack. This saves drawing information contained in the gstate, such as the current path, ctm and colors. (DPS, Quartz).

### DPSinitclip

- (void) DPSinitclip;
Availability: OpenStep
Description forthcoming.

### DPSinitgraphics

- (void) DPSinitgraphics;
Availability: OpenStep
Description forthcoming.

### DPSinitmatrix

- (void) DPSinitmatrix;
Availability: OpenStep
Sets the coordinate transform matrix to the initial values for the particular context

### DPSlineto: :

- (void) DPSlineto: (float)x : (float)y;
Availability: OpenStep
Description forthcoming.

### DPSmoveto: :

- (void) DPSmoveto: (float)x : (float)y;
Availability: OpenStep
Description forthcoming.

### DPSnewpath

- (void) DPSnewpath;
Availability: OpenStep
Description forthcoming.

### DPSpathbbox: : : :

- (void) DPSpathbbox: (float*)llx : (float*)lly : (float*)urx : (float*)ury;
Availability: OpenStep
Description forthcoming.

### DPSrcurveto: : : : : :

- (void) DPSrcurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)x3 : (float)y3;
Availability: OpenStep
Description forthcoming.

### DPSrectclip: : : :

- (void) DPSrectclip: (float)x : (float)y : (float)w : (float)h;
Availability: OpenStep
Description forthcoming.

### DPSrectfill: : : :

- (void) DPSrectfill: (float)x : (float)y : (float)w : (float)h;
Availability: OpenStep
Description forthcoming.

### DPSrectstroke: : : :

- (void) DPSrectstroke: (float)x : (float)y : (float)w : (float)h;
Availability: OpenStep
Description forthcoming.

### DPSreversepath

- (void) DPSreversepath;
Availability: OpenStep
Description forthcoming.

### DPSrlineto: :

- (void) DPSrlineto: (float)x : (float)y;
Availability: OpenStep
Description forthcoming.

### DPSrmoveto: :

- (void) DPSrmoveto: (float)x : (float)y;
Availability: OpenStep
Description forthcoming.

### DPSrotate:

- (void) DPSrotate: (float)angle;
Availability: OpenStep
Rotate the coordinate system. (DPS).

### DPSscale: :

- (void) DPSscale: (float)x : (float)y;
Availability: OpenStep
Scale the coordinate system. (DPS).

### DPSsetalpha:

- (void) DPSsetalpha: (float)a;
Availability: OpenStep
Sets the alpha drawing component. For this and other color setting commands that have no differentiation between fill and stroke colors, both the fill and stroke alpha are set (DPS).

### DPSsetcmykcolor: : : :

- (void) DPSsetcmykcolor: (float)c : (float)m : (float)y : (float)k;
Availability: OpenStep
Sets the current colorspace to Device CMYK and the current color based on the indicated values. For this and other color setting commands that have no differentiation between fill and stroke colors, both the fill and stroke colors are set (DPS).

### DPSsetdash: : :

- (void) DPSsetdash: (const float*)pat : (int)size : (float)offset;
Availability: OpenStep
Set the pattern for line dashes like the Postscript setdash operator. (DPS, Quartz).

### DPSsetflat:

- (void) DPSsetflat: (float)flatness;
Availability: OpenStep
Sets the current flattness parameter, which controls how curved lines are drawn. (DPS, Quartz).

### DPSsetgray:

- (void) DPSsetgray: (float)gray;
Availability: OpenStep
Sets the current colorspace to Device Gray and the current gray value (DPS).

### DPSsetgstate:

- (void) DPSsetgstate: (int)gst;
Availability: OpenStep
Makes the gstate indicated by the tag gst the current gstate. Note that the gstate is copied, so that changes to either gstate do not affect the other. (DPS, Quartz).

### DPSsethalftonephase: :

- (void) DPSsethalftonephase: (float)x : (float)y;
Availability: OpenStep
Description forthcoming.

### DPSsethsbcolor: : :

- (void) DPSsethsbcolor: (float)h : (float)s : (float)b;
Availability: OpenStep
Sets the current colorspace to Device RGB and the current color based on the indicated values (DPS).

### DPSsetlinecap:

- (void) DPSsetlinecap: (int)linecap;
Availability: OpenStep
Set the current linecap value. (DPS, Quartz).

### DPSsetlinejoin:

- (void) DPSsetlinejoin: (int)linejoin;
Availability: OpenStep
Set the current linejoin value. (DPS, Quartz).

### DPSsetlinewidth:

- (void) DPSsetlinewidth: (float)width;
Availability: OpenStep
Set the current line width. (DPS, Quartz).

### DPSsetmiterlimit:

- (void) DPSsetmiterlimit: (float)limit;
Availability: OpenStep
Set the current meter limit value. (DPS, Quartz).

### DPSsetoffset: :

- (void) DPSsetoffset: (short int)x : (short int)y;
Availability: OpenStep
Description forthcoming.

### DPSsetrgbcolor: : :

- (void) DPSsetrgbcolor: (float)r : (float)g : (float)b;
Availability: OpenStep
Sets the current colorspace to Device RGB and the current color based on the indicated values (DPS).

### DPSsetstrokeadjust:

- (void) DPSsetstrokeadjust: (int)b;
Availability: OpenStep
Description forthcoming.

### DPSshfill:

- (void) DPSshfill: (NSDictionary*)shaderDictionary;
Availability: OpenStep
Description forthcoming.

### DPSshow:

- (void) DPSshow: (const char*)s;
Availability: OpenStep
Display the string s using the current font (DPS).

### DPSstroke

- (void) DPSstroke;
Availability: OpenStep
Description forthcoming.

### DPStranslate: :

- (void) DPStranslate: (float)x : (float)y;
Availability: OpenStep
Translate the coordinate system. (DPS).

### DPSwidthshow: : : :

- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s;
Availability: OpenStep
Displays a string as in DPSshow, except that, for character c only, the glpyh x and y advancement is determined by the values (x,y), instead of by the glyph itself. This is often used to adjust the length of a line of text by changing the width of the space character. Using this method should be more efficient than using -DPSshow: with appropriate -DPSrmoveto:: operations.

### DPSxshow: : :

- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size;
Availability: OpenStep
Displays a string as in DPSshow, except that the glyph x advancement is determined by the values in numarray, one for each glyph, instead of by the glyphs themselves. size should be equal to the length of s in glyphs. Using this method should be more efficient than using -DPSshow: with appropriate -DPSrmoveto:: operations.

### DPSxyshow: : :

- (void) DPSxyshow: (const char*)s : (const float*)numarray : (int)size;
Availability: OpenStep
Displays a string as in DPSshow, except that the glyph x and y advancement is determined by the values in numarray, one x and one y for each glyph, in alternating order, instead of by the glyphs themselves. size should be equal to the length of s in glyphs. Using this method should be more efficient than using -DPSshow: with appropriate -DPSrmoveto:: operations.

### DPSyshow: : :

- (void) DPSyshow: (const char*)s : (const float*)numarray : (int)size;
Availability: OpenStep
Displays a string as in DPSshow, except that the glyph y advancement is determined by the values in numarray, one for each glyph, instead of by the glyphs themselves. size should be equal to the length of s in glyphs. Using this method should be more efficient than using -DPSshow: with appropriate -DPSrmoveto:: operations.

### GSConcatCTM:

- (void) GSConcatCTM: (NSAffineTransform*)ctm;
Availability: OpenStep
Concatenates the matrix ctm onto the current coordinate transform matrix. (Quartz).

### GSCurrentCTM

- (NSAffineTransform*) GSCurrentCTM;
Availability: OpenStep
Returns the current coordinate transform matrix. (Quartz).

### GSCurrentDevice: : :

- (void) GSCurrentDevice: (void**)device : (int*)x : (int*)y;
Availability: OpenStep
This is a private method used between the window server and the context. It should not be used in any application. Typically used by the window server to find out what window the context is drawing graphics to. The device pointer is an opaque type that contains information about the window. The x and y pointers indicate the offset of the origin of the window from the lower left-hand corner

### GSDefineGState

- (int) GSDefineGState;
Availability: OpenStep
Creates a copy of the current gstate and associates it with a tag, which is given in the return value. This tag can later be used in -DPSsetgstate: to set the gstate as being current again. (DPS, Quartz).

### GSDrawImage: :

- (void) GSDrawImage: (NSRect)rect : (void*)imageref;
Availability: OpenStep
Generic method to draw an image into a rect. The image is defined by imageref, an opaque structure. Support for this method hasn't been implemented yet, so it should not be used anywhere.

### GSGetTextCTM

- (NSAffineTransform*) GSGetTextCTM;
Availability: OpenStep

Returns the transfer function for transforming text from text space to user space. See -GSSetTextCTM: for additiona information. (Quartz).

### GSGetTextPosition

- (NSPoint) GSGetTextPosition;
Availability: OpenStep
Returns the location at which text will be drawn. In text-space coordinates. (Quartz).

### GSRectClipList: :

- (void) GSRectClipList: (const NSRect*)rects : (int)count;
Availability: OpenStep
Append the array of rects to the current clip path (DPS, Quartz).

### GSRectFillList: :

- (void) GSRectFillList: (const NSRect*)rects : (int)count;
Availability: OpenStep
Draw and fill the array of rects. (DPS, Quartz)

### GSReplaceGState:

- (void) GSReplaceGState: (int)gst;
Availability: OpenStep
Replaces the gstate refered to by the tag gst with the current gstate. The former gstate is destroyed. (DPS, Quartz).

### GSSendBezierPath:

- (void) GSSendBezierPath: (NSBezierPath*)path;
Availability: OpenStep
Set the bezier path as the current path

### GSSetCTM:

- (void) GSSetCTM: (NSAffineTransform*)ctm;
Availability: OpenStep
Sets the coordinate transform matrix which describes how graphics will be transformed into device coordinates. (Quartz).

### GSSetCharacterSpacing:

- (void) GSSetCharacterSpacing: (float)extra;
Availability: OpenStep
Use this method to set the additional spacing between characters (glyphs). This spacing is added to the normal spacing for each character. Units are in text-space coordinate system. (Quartz).

### GSSetDevice: : :

- (void) GSSetDevice: (void*)device : (int)x : (int)y;
Availability: OpenStep
This is a private method used between the window server and the context. It should not be used in any application. Typically called by the window server to tell the context what window it should draw graphics to. The device pointer is an opaque type that contains information about the window. The x and y values tell the context that it should put the origin of the transform matrix at the indicated x and y values from the lower left-hand corner of the window

### GSSetFillColor:

- (void) GSSetFillColor: (const float*)values;
Availability: OpenStep
Sets the current color for fill operations. The values array should have n components, where n corresponds to the number of color components required to specify the color in the current colorspace (Quartz).

### GSSetFillColorspace:

- (void) GSSetFillColorspace: (void*)spaceref;
Availability: OpenStep

Sets the colorspace for fill operations based on values in the supplied dictionary dict.

For device colorspaces (GSDeviceGray, GSDeviceRGB, GSDeviceCMYK), only the name of the colorspace needs to be set using the GSColorSpaceName key.

Other colorspaces will be documented later (Quartz).

### GSSetFont:

- (void) GSSetFont: (void*)fontref;
Availability: OpenStep
Set the current font for drawing glyphs. (DPS, Quartz).

### GSSetFontSize:

- (void) GSSetFontSize: (float)size;
Availability: OpenStep
Set the font size of the current NSFont used for drawing glyphs. (DPS, Quartz).

### GSSetPatterColor:

- (void) GSSetPatterColor: (NSImage*)image;
Availability: OpenStep
Description forthcoming.

### GSSetStrokeColor:

- (void) GSSetStrokeColor: (const float*)values;
Availability: OpenStep
Sets the current color for stroke operations. The values array should have n components, where n corresponds to the number of color components required to specify the color in the current colorspace (Quartz).

### GSSetStrokeColorspace:

- (void) GSSetStrokeColorspace: (void*)spaceref;
Availability: OpenStep
Sets the colorspace for stroke operations based on the values in the supplied dictionary. See -GSSetFillColorspace: for a description of the values that need to be supplied (Quartz).

### GSSetTextCTM:

- (void) GSSetTextCTM: (NSAffineTransform*)ctm;
Availability: OpenStep

Set the transfer function for transforming text from text space to user space. This transform is only applied to text objects and is in addition to the normal coordinate transform matrix. When drawing text, this transform is applied before the normal CTM.

The text matrix can be changed by either modifying it directly, or just by drawing text, in which case the tx and ty offset veriables are modified to point to the location of the next character that could be rendered (Quartz).

### GSSetTextDrawingMode:

- (void) GSSetTextDrawingMode: (GSTextDrawingMode)mode;
Availability: OpenStep
Set the current text drawing mode. The mode can be one of several values that fill/stroke the text or add it to the current clipping path. (Quartz).

### GSSetTextPosition:

- (void) GSSetTextPosition: (NSPoint)loc;
Availability: OpenStep
Set the location at which text will be drawn, in text-space coordinates. This routine updates the current text coordinate matrix. (Quartz).

### GSShowGlyphs: :

- (void) GSShowGlyphs: (const NSGlyph*)glyphs : (size_t)length;
Availability: OpenStep
Paints the glyphs using the current font. (Quartz).

### GSShowText: :

- (void) GSShowText: (const char*)string : (size_t)length;
Availability: OpenStep
Paints text represented by the characters in string in the current font. (Quartz).

### GSUndefineGState:

- (void) GSUndefineGState: (int)gst;
Availability: OpenStep
Disassociates the tag gst with it's gstate and destroys the gstate object. The tag will no longer be valid and should not be used to refer to the gstate again. (DPS, Quartz).

### GScomposite: toPoint: fromRect: operation: fraction:

- (void) GScomposite: (int)gstateNum toPoint: (NSPoint)aPoint fromRect: (NSRect)srcRect operation: (NSCompositingOperation)op fraction: (float)delta;
Availability: OpenStep
Description forthcoming.

### appendBezierPathWithPackedGlyphs: path:

- (void) appendBezierPathWithPackedGlyphs: (const char*)packedGlyphs path: (NSBezierPath*)aPath;
Availability: OpenStep
Description forthcoming.

# Software documentation for the NSGraphicsContext(Printing) category

## NSGraphicsContext(Printing)

> Declared in:
>   AppKit/NSGraphicsContext.h

Availability: OpenStep
Description forthcoming.
Method summary

- -beginPage:label:bBox:fonts:
- -beginPrologueBBox:creationDate:createdBy:fonts:forWhom:pages:title:
- -beginSetup
- -beginTrailer
- -endDocumentPages:documentFonts:
- -endHeaderComments
- -endPageSetup
- -endPrologue
- -endSetup
- -endSheet
- -endTrailer
- -printerProlog
- -showPage

### beginPage: label: bBox: fonts:

- (void) beginPage: (int)ordinalNum label: (NSString*)aString bBox: (NSRect)pageRect fonts: (NSString*)fontNames;
Availability: OpenStep
Description forthcoming.

### beginPrologueBBox: creationDate: createdBy: fonts: forWhom: pages: title:

- (void) beginPrologueBBox: (NSRect)boundingBox creationDate: (NSString*)dateCreated createdBy: (NSString*)anApplication fonts: (NSString*)fontNames forWhom: (NSString*)user pages: (int)numPages title: (NSString*)aTitle;
Availability: OpenStep
Description forthcoming.

### beginSetup

- (void) beginSetup;
Availability: OpenStep
Description forthcoming.

### beginTrailer

- (void) beginTrailer;
Availability: OpenStep
Description forthcoming.

### endDocumentPages: documentFonts:

- (void) endDocumentPages: (int)pages documentFonts: (NSSet*)fontNames;
Availability: OpenStep
Description forthcoming.

### endHeaderComments

- (void) endHeaderComments;
Availability: OpenStep
Description forthcoming.

### endPageSetup

- (void) endPageSetup;
Availability: OpenStep
Description forthcoming.

### endPrologue

- (void) endPrologue;
Availability: OpenStep
Description forthcoming.

### endSetup

- (void) endSetup;
Availability: OpenStep
Description forthcoming.

### endSheet

- (void) endSheet;
Availability: OpenStep
Description forthcoming.

### endTrailer

- (void) endTrailer;
Availability: OpenStep
Description forthcoming.

### printerProlog

- (void) printerProlog;
Availability: OpenStep
Description forthcoming.

### showPage

- (void) showPage;
Availability: OpenStep
Description forthcoming.

Up