+++ /dev/null
- Simple Graphics Package (SGP) Documentation
- -------------------------------------------
-
-
- Documentation and Software Written by Kevin Rosenberg
- Copyright (c) 1984, Kevin Rosenberg
-
-
-
-
-
- OVERVIEW
- --------
-
- +------------------------+
- | World Coordinate level |
- +-----------+------------+
- |
- |
- +------------+-------------+
- | Convert to Normalized |
- | device coordinates (NDC) |
- +------------+-------------+
- |
- |
- +------+-------+ +--------------+
- | Segmentation +-----------+ Disk Storage |
- +------+-------+ +--------------+
- |
- +------------+-------------+
- | Convert to Physical |
- | device coordinates (PDC) |
- +--------------------------+
-
-
-World Coordinate Level
-----------------------
- initgrf2 () Initialize 2 dimensional graphics
- termgrf2 () Terminate 2 dimensional graphics
- window2 (xmin, ymin, xmax, ymax) Set window for world coord
- viewprt2 (xmin, ymin, xmax, ymax) Viewport for window in NDC
- moveabs2 (x, y) Move graphics cursor
- moverel2 (dx, dy)
- pntabs2 (x, y) Plot point at current position
- pntrel2 (dx, dy)
- lineabs2 (x, y) Draw line from current point to point
- linerel2 (dx, dy)
- markabs2 (x, y) Draw marker at current position
- markrel2 (dx, dy)
- polylnabs (x[], y[], n) Draw a set of lines
- polylnrel (dx[]. dy[]. n)
- wc_to_ndc (xwc, ywc, xndc, yndc) Convert from world coord to NDC
- ndc_to_wc (xndc, yndc, xwc, ywc) Convert from NDC to world coord
- drawtext (str) Draw text string at current positon
-
- INTERNAL:
- calc_map () Calculate wc to ndc factors
- clip(rectangle[4], x1, y1, x2, y2) Clip a line againt rectangle
-
-
-Normalized Coordinate level
---------------------------
- stylus (x, y, beam) Draw a line from current position
- opendevice (device) Open a device for output
- closedevice (device) Close a device for output
- flushdevice (device) Put all pending data on device
- inqdev (device, xmax, ymax) Return data on device
- setcolor (color) Set current drawing color
- setlinestyle (style) Set current line style
- setlinewidth (width) Set current line width
- settext (h, w, orientation, dir, font) Set text attributes
- settextclr (foreground, background) If back=-1, then transparent backg
- inqtext(h, w, o, dir, font, fore, back) Get current text attributes
- charndc (c, xndc, yndc) Draw char at NDC position
- textndc (str, xndc, yndc) Draw text string at NDC position
-
- setmarker (marker_type, color) Set marker attibutes
- markndc (xndc, yndc) Draw marker at NDC position
-
- ndc_to_pdc (device, xndc, yndc, xpdc, ypdc)
- savescrn (filename, xmin, ymin, xmax, ymax)
- readscrn (filename)
-
-Physical Device Level
----------------------
- crtdot (x, y, c)
- crtline (x1, y1, x2, y2, color, style)
- wrtchar (char, x, y, dotfunc())
- wrttext (str, x, y, dotfunc())
-
- readblock (array, xmin, ymin, xmax, ymax)
- writeblock (array, xmin, ymin, mode)
-
- prtdot (x, y, c)
- prtline (func, x1, y1, x2, y2, color, style)
-
-
-Input Functions
----------------
-Physical device level
- joystk (sticknum, x, y)
-
-Normalized Coordinate level
- readloc (xndc, yndc)
- inithcur (height, width, color) Initialize haircross cursor
- movhcurabs (xndc, yndc) Move haircross cursor to point
- movhcurrel (dxndc, dyndc) Move relatively
- termhcur () Turn off haircross cursor
- readpnt (xndc, yndc) Have cursor track joystick
- User press button at desired point
-
- DATA STRUCTURES
- ---------------
-struct DEVICE {
- int xsize, ysize; Size of device in pixels
- int xmax, ymax; Maximum coordinates
- int colormax; Maximum color number of device
- int style; Current linestyle of device
- int width; Current width of device
- int color; Current color of device
- int curx, cury; Current position
- int charwidth, charheight; Size of characters in pixels
- float aspt Aspect ratio Multiple coord
- int (*dot)(); Dot function for device
- int (*line)(); Line function for device
- int mode; Device mode
-};
-
-struct CHARSPEC {
- float width, height; size of characters in NDC
- int dirflag, orientflag text direction, character orientation
- int fore, back; foreground & background color
-};
-
-struct CURRENT {
- int color;
- int linestyle;
- int linewidth;
- float xndc, yndc;
-}
-
- Map directly from world coords to physical device coords
- --------------------------------------------------------
-
-Window: xwmin, xwmax, ywmin, ywmax
-Viewport: xvmin, xvmax, yvmin, yvmax
-Physical: xpmax, ypmax
-
-To convert from wc to ndc:
- xndc = xvmin + (xwc - xwmin) / (xwmax - xwmin)
- yndc = yvmin + (ywc - ywmin) / (ywmax - ywmin)
-
-To convert from ndc to pdc:
- xpdc = xndc * xpmax
- ypdc = yndc * ypmax
-
-So, for each device set up the following composite transformation:
- xpdc = xpmax * (xvmin + (xwc - xwmin) / (xwmax - xwmin))
- ypdc = ypmax * (yvmin + (ywc - ywmin) / (ywmax - ywmin))
-
- xpdc = xpmax * xvmin + (xwc - xwmin) * (xpmax / (xwmax - xwmin))
- = xadd + (xwc - xsub) * xfact
-
-Characters
-----------
- Fonts:
- NORMAL Regular character set
- BOLD Overstike chars with x offset by 1 pixel
- ITALICS Shear characters along character height
-
- NORMAL BOLD ITALICS
- X XX X
- XXX XXXX XXX
- X X XX XX X X
- X X XX XX X X
- XXXXX XXXXXX XXXXX
- X X XX XX X X
- X X XX XX X X
-
-
-
-
-