/* CMUgraphics Package Macintosh version 1.0 Copyright (c) 1998 by Mark Stehlik. All rights reserved. Portions of the code in this file may be derived from code written by Geoff Washburn, Patrick Doane, Jim Roberts, and Lily Hou. Please send all bug reports via e-mail to Mark Stehlik at 'mjs@cs.cmu.edu'. Redistribution and use in source and binary forms of this library, with or without modification, are permitted provided that the following conditions are met: 1. Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistribution in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. When redistributing modified version of this library it must carry prominent notices stating the name of individual(s) that altered the files, the nature of the modifications, and the date they were performed. 4. No fee is charged for redistribution or use without prior written permission from the author. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This file was last modified on 10.06.1998 */ /* Header file for 15-127 Graphics Routines Original file written for 15-125 by Lily Hou Edited by Jim Roberts and Mark Stehlik during the summer of 1995 for use in 15-127. Modified Sep 1995 these three graphics functions provided by Pat Doane: SelectConsoleWindow SelectDrawingWindow GetWindowDimensions Modified Dec 1995 € GetMouseLocation overloaded to return a point type or to return (x,y) coordinates via reference parameters € GetClick overloaded to return a point type or to return (x,y) coordinates via reference parameters Modified Jul 1997, MJS € added DrawStringVariable € added GetKey (non-blocking input, i.e., input without return) € range-checked Drawint and provided warning messages */ #ifndef _127_GRAPHICS_H #define _127_GRAPHICS_H #include #include #include "apstring.h" #define RED 1 #define GREEN 2 #define BLUE 3 #define YELLOW 4 #define PINK 5 #define PURPLE 6 #define BROWN 7 #define AQUA 8 #define WHITE 9 #define BLACK 10 #define DKGREY 11 #define LTBLUE 12 #define ALMOND 13 #define LTGREY 14 #define TAN 15 #define DKGREEN 16 #define kMyWindowID 128 #define kMoveToFront (WindowPtr)-1L #define kBaseSoundResID 128 #define kNilSoundChannel nil #define kSynchronous 0 #define kEmptyString "\p" #define kNilFilterProc nil #define kErrorAlertID kBaseSoundResID #define kAsync 1 // prototypes void SelectConsoleWindow(); void SelectDrawingWindow(); Point GetWindowDimensions(int windowID); void DrawStringVariable(apstring word); void GetKey(char & dir); void SetColor(int whichcolor); void ToolboxInit( void ); void WindowInit(int windowID); void PlaySound(int sndID); Point GetMouseLocation(); void GetMouseLocation (int &x, int &y); int FoundAClick(Point*); // not documented in handout, used by GetClick Point GetClick(); void GetClick(int &x, int &y); void RectangleDraw(int x1, int y1 , int x2, int y2); void RectangleInvert(int x1, int y1 , int x2, int y2); void RectangleFrame(int x1, int y1 , int x2, int y2); void RoundRectangleDraw(int x1, int y1, int x2, int y2, int ovWd, int ovHt); void RoundRectangleInvert(int x1, int y1, int x2, int y2, int ovWd, int ovHt); void RoundRectangleFrame(int x1, int y1, int x2, int y2, int ovWd, int ovHt); void CircleDraw(int x, int y, int rad); void CircleInvert( int x, int y, int rad); void CircleFrame(int x, int y, int rad); void OvalDraw(int x1, int y1 , int x2, int y2); void OvalInvert(int x1, int y1 , int x2, int y2); void OvalFrame(int x1, int y1 , int x2, int y2); void LineDraw(int x1, int y1, int x2, int y2); void ArcDraw( int x, int y,int radius,int startDegrees, int NumDegrees); void ArcDraw( int x, int y,int radius,int startDegrees, int NumDegrees); void ArcFrame( int x, int y,int radius,int startDegrees, int NumDegrees); void ArcInvert( int x, int y,int radius,int startDegrees, int NumDegrees); void ShowWindowDimensions(); void NumToStr(int n, char str[]); void DrawInt(int n); #endif