Annotation of Examples/AppKit/Lines/UserPath.h, revision 1.1.1.1

1.1       root        1: /* 
                      2:  * UserPath.h by Bruce Blumberg, NeXT Computer, Inc.
                      3:  *
                      4:  * You may freely copy,distribute and re-use the code in this example. NeXT
                      5:  * disclaims any warranty of any kind, expressed or implied, as to its fitness
                      6:  * for any particular purpose
                      7:  *
                      8:  * This file and its associated .m file define a data structure and set of
                      9:  * functions aimed at facilitating the use of user paths. Here is a simple
                     10:  * example:
                     11:  *
                     12:  * UserPath *arect;
                     13:  * arect = newUserPath(); // creates an empty user path
                     14:  * beginUserPath(arect,YES);  // initialize user path and cache
                     15:  *   UPmoveto(arect,0.0,0.0); // add moveto to userpath; update bounding box
                     16:  *   UPrlineto(arect,0.0,100.0); // add rlineto to path; update bounding box
                     17:  *   UPrlineto(arect,100.0,0.0); // add rlineto to path; update bounding box
                     18:  *   UPrlineto(arect,0.0,-100.0); // add rlineto to path; update bounding box
                     19:  *   closePath(arect); // close path
                     20:  * endUserPath(arect,dps_stroke); // close user path and specify operator
                     21:  * sendUserPath(arect);
                     22:  *
                     23:  * As you will note, the set of routines manage the allocation and growth of
                     24:  * the operator and operand arrays, as well as the calculation of the bounding
                     25:  * box. A user path created via these functions may be optionally cached down
                     26:  * at the window server, or repeatedly sent down.  The user paths created by
                     27:  * this set of functions are all allocated in a unique zone.
                     28:  *
                     29:  * Note: the associated file is a .m file because it pulls in some .h files
                     30:  * which reference objective C methods. 
                     31:  */
                     32: 
                     33: #import <objc/objc.h>
                     34: #import <dpsclient/dpsclient.h>
                     35: 
                     36: typedef struct _UP {
                     37:     float          *points;
                     38:     int             numberOfPoints;
                     39:     char           *ops;
                     40:     NXPoint         cp;
                     41:     int             numberOfOps;
                     42:     int             max;
                     43:     float           bbox[4];
                     44:     int             opForUserPath;
                     45:     BOOL            ping;
                     46: } UserPath;
                     47: 
                     48: /* UserPath functions */
                     49: NXZone *userPathZone();
                     50: UserPath *newUserPath();
                     51: void freeUserPath(UserPath *up);
                     52: void debugUserPath(UserPath *up, BOOL shouldPing);
                     53: void growUserPath(UserPath *up);
                     54: void beginUserPath(UserPath *up, BOOL cache);
                     55: void endUserPath(UserPath *up, int op);
                     56: int sendUserPath(UserPath *up);
                     57: void UPmoveto(UserPath *up, float x, float y);
                     58: void UPrmoveto(UserPath *up, float x, float y);
                     59: void UPlineto(UserPath *up, float x, float y);
                     60: void UPrlineto(UserPath *up, float x, float y);
                     61: void UPcurveto(UserPath *up, float x1, float y1, float x2, float y2, float x3,
                     62:               float y3);
                     63: void UPrcurveto(UserPath *up, float dx1, float dy1, float dx2, float dy2,
                     64:                float dx3, float dy3);
                     65: void UParc(UserPath *up, float x, float y, float r, float ang1, float ang2);
                     66: void UParcn(UserPath *up, float x, float y, float r, float ang1, float ang2);
                     67: void UParct(UserPath *up, float x1, float y1, float x2, float y2, float r);
                     68: void closePath(UserPath *up);
                     69: void addPts(UserPath *up, float x, float y);
                     70: void addOp(UserPath *up, int op);
                     71: void add(UserPath *up, int op, float x, float y);
                     72: void checkBBox(UserPath *up, float x, float y);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.