An abstract W3Kit base class for 2D PostScript graphics. The main subclass methods are drawPostScript, mouseClick:, and mouseDrag:.
(0,h)------(w,h) | | (0,0)------(w,0)(These initial coordinates are not the same as raw device coordinates, which should be avoided since they are not consistent across DPS platforms.)
By default, a W3PostScript widget only receives mouse click events; these are the only events supported by the HTML 2.0 standard. In HTML 3.0, however, general pen input is supported, and such events can be enabled by including W3_MOUSEDRAG_MASK in the event mask.
#define W3_MOUSECLICK_MASK 0x0001 #define W3_MOUSEDRAG_MASK 0x0002(Warning: The HTML 3.0 features are currently incompletely emulated, using non-standard, undocumented features of X Mosaic.)
The default user coordinate system is in pixel units, with the origin in the lower left corner, x-axis pointing right, and y-axis pointing up.
Note: setDrawOrigin:: moves the user point (x,y) to the lower left corner of the view, while setDrawSize:: scales the user coordinate system, fixing its origin, so as to make the view frame just fit into an x-by-y user rectangle. These two methods are not intended for use inside drawPostScript. Use PS operators there, protected by PSgsave() and PSgrestore().
- setIntSize:(const IntSize *)theSize; - getIntSize:(IntSize *)theSize; - transformUser:(float [6])moveUser; - transformDevice:(float [6])moveDevice; - convertPointUser:(const Point2 *)userPt toDevice:(Point2 *)devPt; - convertPointDevice:(const Point2 *)devPt toUser:(Point2 *)userPt; - getBounds:(Rect2 *)theRect; - setDrawOrigin:(float)x :(float)y; - setDrawSize:(float)width :(float)height; - translate:(float)x :(float)y; - scale:(float)x :(float)y;
- drawPostScript; - mouseClick:(const Point2 *)aPoint; - mouseDrag:(const Path2 *)path; - (unsigned int)eventMask; - setEventMask:(unsigned int)mask;Different ways to route the output of drawing.
- printHtml; // print HTML for inlining the image - display; // send out-of-line image back to user and exit - snapshotDocument; // capture image in a W3Document (returned) - postScriptDocument; // capture PS code in a W3Document (returned)This can be used at the beginning of -drawPostScript to clear the image to white, and set the drawing color to black.
- clearPostScript;Subclasses can override this to adjust their alignment in the layout, relative to other widgets. The default value is "top".
- (const char *)htmlAlignment;On some systems, it is possible to adjust the image depth.
- setImageBitDepth:(int)bits; - takeImageBitDepthFrom:sender;
(Note that the return value of lockFocus is NOT a success flag. It merely indicates whether focus has already been locked on this widget. The call to lockFocus should be balanced with an unlockFocus in any case.)
- (BOOL)lockFocus; - unlockFocus;
Author: Paul Burchard
Comments to:
webmaster@geom.umn.edu
Created: Apr 18 1994 ---
Last modified: Tue Jun 18 10:43:18 1996