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

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
Standards:


Instance variables

_antialias

@public _antialias;

_interp

@public _interp;

context_data

@public context_data;

context_info

@public context_info;

focus_stack

@public focus_stack;

methods

@public methods;

usedFonts

@public usedFonts;

Method summary

currentContext

+ (NSGraphicsContext*) currentContext;

Returns the current context. Also see the convienience function GSCurrentContext()


currentContextDrawingToScreen

+ (BOOL) currentContextDrawingToScreen;

Returns YES if the current context is a display context


graphicsContextWithAttributes:

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

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


graphicsContextWithWindow:

+ (NSGraphicsContext*) graphicsContextWithWindow: (NSWindow*)aWindow;

Create graphics context with attributes speficied by aWindow's device description.


restoreGraphicsState

+ (void) restoreGraphicsState;

Description forthcoming.


saveGraphicsState

+ (void) saveGraphicsState;

Description forthcoming.


setCurrentContext:

+ (void) setCurrentContext: (NSGraphicsContext*)context;

Set the current context that will handle drawing.


setGraphicsState:

+ (void) setGraphicsState: (int)graphicsState;

Description forthcoming.


attributes

- (NSDictionary*) attributes;

Description forthcoming.


flushGraphics

- (void) flushGraphics;

Description forthcoming.


focusStack

- (void*) focusStack;

Description forthcoming.


graphicsPort

- (void*) graphicsPort;

Description forthcoming.


imageInterpolation

- (NSImageInterpolation) imageInterpolation;

Description forthcoming.


isDrawingToScreen

- (BOOL) isDrawingToScreen;

Description forthcoming.


restoreGraphicsState

- (void) restoreGraphicsState;

Description forthcoming.


saveGraphicsState

- (void) saveGraphicsState;

Description forthcoming.


setFocusStack:

- (void) setFocusStack: (void*)stack;

Description forthcoming.


setImageInterpolation:

- (void) setImageInterpolation: (NSImageInterpolation)interpolation;

Description forthcoming.


setShouldAntialias:

- (void) setShouldAntialias: (BOOL)antialias;

Description forthcoming.


shouldAntialias

- (BOOL) shouldAntialias;

Description forthcoming.


Software documentation for the NSGraphicsContext(GNUstep) category

NSGraphicsContext(GNUstep)

Declared in:
AppKit/NSGraphicsContext.h
Standards:

Description forthcoming.

Method summary

handleExposeRect:forDriver:

+ (void) handleExposeRect: (NSRect)rect forDriver: (void*)driver;

Description forthcoming.


setDefaultContextClass:

+ (void) setDefaultContextClass: (Class)defaultContextClass;

Description forthcoming.


focusView

- (NSView*) focusView;

Description forthcoming.


initWithContextInfo:

- (id) initWithContextInfo: (NSDictionary*)info;

Description forthcoming.


lockFocusView:inRect:

- (void) lockFocusView: (NSView*)aView inRect: (NSRect)rect;

Description forthcoming.


resetUsedFonts

- (void) resetUsedFonts;

Description forthcoming.


unlockFocusView:needsFlush:

- (void) unlockFocusView: (NSView*)aView needsFlush: (BOOL)flush;

Description forthcoming.


useFont:

- (void) useFont: (NSString*)fontName;

Description forthcoming.


usedFonts

- (NSSet*) usedFonts;

Description forthcoming.


Software documentation for the NSGraphicsContext(NSGraphics) category

NSGraphicsContext(NSGraphics)

Declared in:
AppKit/NSGraphicsContext.h
Standards:

Description forthcoming.

Method summary

GSWSetViewIsFlipped:

- (void) GSWSetViewIsFlipped: (BOOL)flipped;

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;

Returns YES if the current focused view is flipped. This is an obsolete method. Use [[NSView focusView] isFlipped] instead


NSBeep

- (void) NSBeep;

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;

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.


NSReadPixel:

- (NSColor*) NSReadPixel: (NSPoint)location;

Read the Color at a Screen Position


Software documentation for the NSGraphicsContext(Ops) category

NSGraphicsContext(Ops)

Declared in:
AppKit/NSGraphicsContext.h
Standards:

Description forthcoming.

Method summary

DPSPrintf::

- (void) DPSPrintf: (char*)fmt : (va_list)args;

Write the string (with printf substitutions) to a PostScript context. Other output contexts will likely ignore this


DPSWriteData::

- (void) DPSWriteData: (char*)buf : (unsigned int)count;

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;

Description forthcoming.


DPSarcn:::::

- (void) DPSarcn: (float)x : (float)y : (float)r : (float)angle1 : (float)angle2;

Description forthcoming.


DPSarct:::::

- (void) DPSarct: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)r;

Description forthcoming.


DPSashow:::

- (void) DPSashow: (float)x : (float)y : (const char*)s;

Displays a string as in the PostScript ashow operator. This operator is obsolete. You should instead use -DPSshow: with appropriate -DPSrmoveto: operations and/or the -GSSetCharacterSpacing: method


DPSawidthshow::::::

- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay : (const char*)s;

Displays a string as in the PostScript awidthshow operator. This operator is obsolete. You should instead use -DPSshow: with appropriate -DPSrmoveto: operations and/or the -GSSetCharacterSpacing: method


DPScharpath::

- (void) DPScharpath: (const char*)s : (int)b;

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


DPSclip

- (void) DPSclip;

Description forthcoming.


DPSclosepath

- (void) DPSclosepath;

Description forthcoming.


DPScomposite::::::::

- (void) DPScomposite: (float)x : (float)y : (float)w : (float)h : (int)gstateNum : (float)dx : (float)dy : (int)op;

Description forthcoming.


DPScompositerect:::::

- (void) DPScompositerect: (float)x : (float)y : (float)w : (float)h : (int)op;

Description forthcoming.


DPSconcat:

- (void) DPSconcat: (const float*)m;

Description forthcoming.


DPScurrentalpha:

- (void) DPScurrentalpha: (float*)a;

Returns the current alpha component


DPScurrentcmykcolor::::

- (void) DPScurrentcmykcolor: (float*)c : (float*)m : (float*)y : (float*)k;

Returns the current color according to the CMYK color model


DPScurrentflat:

- (void) DPScurrentflat: (float*)flatness;

Description forthcoming.


DPScurrentgray:

- (void) DPScurrentgray: (float*)gray;

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


DPScurrenthsbcolor:::

- (void) DPScurrenthsbcolor: (float*)h : (float*)s : (float*)b;

Returns the current color according to the HSB color model.


DPScurrentlinecap:

- (void) DPScurrentlinecap: (int*)linecap;

Description forthcoming.


DPScurrentlinejoin:

- (void) DPScurrentlinejoin: (int*)linejoin;

Description forthcoming.


DPScurrentlinewidth:

- (void) DPScurrentlinewidth: (float*)width;

Description forthcoming.


DPScurrentmiterlimit:

- (void) DPScurrentmiterlimit: (float*)limit;

Description forthcoming.


DPScurrentoffset::

- (void) DPScurrentoffset: (int*)x : (int*)y;

Description forthcoming.


DPScurrentpoint::

- (void) DPScurrentpoint: (float*)x : (float*)y;

Description forthcoming.


DPScurrentrgbcolor:::

- (void) DPScurrentrgbcolor: (float*)r : (float*)g : (float*)b;

Returns the current color according to the RGB color model


DPScurrentstrokeadjust:

- (void) DPScurrentstrokeadjust: (int*)b;

Description forthcoming.


DPScurveto::::::

- (void) DPScurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)x3 : (float)y3;

Description forthcoming.


DPSdissolve::::::::

- (void) DPSdissolve: (float)x : (float)y : (float)w : (float)h : (int)gstateNum : (float)dx : (float)dy : (float)delta;

Description forthcoming.


DPSeoclip

- (void) DPSeoclip;

Description forthcoming.


DPSeofill

- (void) DPSeofill;

Description forthcoming.


DPSfill

- (void) DPSfill;

Description forthcoming.


DPSflattenpath

- (void) DPSflattenpath;

Description forthcoming.


DPSgrestore

- (void) DPSgrestore;

Pops a previously saved gstate from the gstate stack and makes it current. Drawing information in the previously saved gstate becomes the current information


DPSgsave

- (void) DPSgsave;

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.


DPSinitclip

- (void) DPSinitclip;

Description forthcoming.


DPSinitgraphics

- (void) DPSinitgraphics;

Description forthcoming.


DPSinitmatrix

- (void) DPSinitmatrix;

Description forthcoming.


DPSlineto::

- (void) DPSlineto: (float)x : (float)y;

Description forthcoming.


DPSmoveto::

- (void) DPSmoveto: (float)x : (float)y;

Description forthcoming.


DPSnewpath

- (void) DPSnewpath;

Description forthcoming.


DPSpathbbox::::

- (void) DPSpathbbox: (float*)llx : (float*)lly : (float*)urx : (float*)ury;

Description forthcoming.


DPSrcurveto::::::

- (void) DPSrcurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)x3 : (float)y3;

Description forthcoming.


DPSrectclip::::

- (void) DPSrectclip: (float)x : (float)y : (float)w : (float)h;

Description forthcoming.


DPSrectfill::::

- (void) DPSrectfill: (float)x : (float)y : (float)w : (float)h;

Description forthcoming.


DPSrectstroke::::

- (void) DPSrectstroke: (float)x : (float)y : (float)w : (float)h;

Description forthcoming.


DPSreversepath

- (void) DPSreversepath;

Description forthcoming.


DPSrlineto::

- (void) DPSrlineto: (float)x : (float)y;

Description forthcoming.


DPSrmoveto::

- (void) DPSrmoveto: (float)x : (float)y;

Description forthcoming.


DPSrotate:

- (void) DPSrotate: (float)angle;

Description forthcoming.


DPSscale::

- (void) DPSscale: (float)x : (float)y;

Description forthcoming.


DPSsetalpha:

- (void) DPSsetalpha: (float)a;

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.


DPSsetcmykcolor::::

- (void) DPSsetcmykcolor: (float)c : (float)m : (float)y : (float)k;

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.


DPSsetdash:::

- (void) DPSsetdash: (const float*)pat : (int)size : (float)offset;

Description forthcoming.


DPSsetflat:

- (void) DPSsetflat: (float)flatness;

Description forthcoming.


DPSsetgray:

- (void) DPSsetgray: (float)gray;

Sets the current colorspace to Device Gray and the current gray value


DPSsetgstate:

- (void) DPSsetgstate: (int)gst;

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.


DPSsethalftonephase::

- (void) DPSsethalftonephase: (float)x : (float)y;

Description forthcoming.


DPSsethsbcolor:::

- (void) DPSsethsbcolor: (float)h : (float)s : (float)b;

Sets the current colorspace to Device RGB and the current color based on the indicated values


DPSsetlinecap:

- (void) DPSsetlinecap: (int)linecap;

Description forthcoming.


DPSsetlinejoin:

- (void) DPSsetlinejoin: (int)linejoin;

Description forthcoming.


DPSsetlinewidth:

- (void) DPSsetlinewidth: (float)width;

Description forthcoming.


DPSsetmiterlimit:

- (void) DPSsetmiterlimit: (float)limit;

Description forthcoming.


DPSsetoffset::

- (void) DPSsetoffset: (short int)x : (short int)y;

Description forthcoming.


DPSsetrgbcolor:::

- (void) DPSsetrgbcolor: (float)r : (float)g : (float)b;

Sets the current colorspace to Device RGB and the current color based on the indicated values


DPSsetstrokeadjust:

- (void) DPSsetstrokeadjust: (int)b;

Description forthcoming.


DPSshow:

- (void) DPSshow: (const char*)s;

Description forthcoming.


DPSstroke

- (void) DPSstroke;

Description forthcoming.


DPStranslate::

- (void) DPStranslate: (float)x : (float)y;

Description forthcoming.


DPSwidthshow::::

- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s;

Displays a string as in the PostScript widthshow operator. This operator is obsolete. You should instead use -DPSshow: with appropriate -DPSrmoveto: operations.


DPSxshow:::

- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size;

Displays a string as in the PostScript widthshow operator. This operator is obsolete. You should instead use -DPSshow: with appropriate -DPSrmoveto: operations.


DPSxyshow:::

- (void) DPSxyshow: (const char*)s : (const float*)numarray : (int)size;

Displays a string as in the PostScript xyshow operator. This operator is obsolete. You should instead use -DPSshow: with appropriate -DPSrmoveto: operations.


DPSyshow:::

- (void) DPSyshow: (const char*)s : (const float*)numarray : (int)size;

Displays a string as in the PostScript yshow operator. This operator is obsolete. You should instead use -DPSshow: with appropriate -DPSrmoveto: operations.


GSConcatCTM:

- (void) GSConcatCTM: (NSAffineTransform*)ctm;

Description forthcoming.


GSCurrentCTM

- (NSAffineTransform*) GSCurrentCTM;

Description forthcoming.


GSCurrentDevice:::

- (void) GSCurrentDevice: (void**)device : (int*)x : (int*)y;

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;

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.


GSDrawImage::

- (void) GSDrawImage: (NSRect)rect : (void*)imageref;

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;

Description forthcoming.


GSGetTextPosition

- (NSPoint) GSGetTextPosition;

Description forthcoming.


GSRectClipList::

- (void) GSRectClipList: (const NSRect*)rects : (int)count;

Description forthcoming.


GSRectFillList::

- (void) GSRectFillList: (const NSRect*)rects : (int)count;

Description forthcoming.


GSReplaceGState:

- (void) GSReplaceGState: (int)gst;

Replaces the gstate refered to by the tag gst with the current gstate. The former gstate is destroyed.


GSSendBezierPath:

- (void) GSSendBezierPath: (NSBezierPath*)path;

Description forthcoming.


GSSetCTM:

- (void) GSSetCTM: (NSAffineTransform*)ctm;

Description forthcoming.


GSSetCharacterSpacing:

- (void) GSSetCharacterSpacing: (float)extra;

Description forthcoming.


GSSetDevice:::

- (void) GSSetDevice: (void*)device : (int)x : (int)y;

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: (float*)values;

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.


GSSetFillColorspace:

- (void) GSSetFillColorspace: (NSDictionary*)dict;

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


GSSetFont:

- (void) GSSetFont: (NSFont*)font;

Description forthcoming.


GSSetFontSize:

- (void) GSSetFontSize: (float)size;

Description forthcoming.


GSSetStrokeColor:

- (void) GSSetStrokeColor: (float*)values;

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.


GSSetStrokeColorspace:

- (void) GSSetStrokeColorspace: (NSDictionary*)dict;

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


GSSetTextCTM:

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

Description forthcoming.


GSSetTextDrawingMode:

- (void) GSSetTextDrawingMode: (GSTextDrawingMode)mode;

Description forthcoming.


GSSetTextPosition:

- (void) GSSetTextPosition: (NSPoint)loc;

Description forthcoming.


GSShowGlyphs::

- (void) GSShowGlyphs: (const NSGlyph*)glyphs : (size_t)length;

Description forthcoming.


GSShowText::

- (void) GSShowText: (const char*)string : (size_t)length;

Description forthcoming.


GSUndefineGState:

- (void) GSUndefineGState: (int)gst;

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.



Up