home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
online
/
source
/
cpp
/
graphics
/
Conics.sit.hqx
/
Conics
/
Sources
/
graphics.cpp
< prev
next >
Wrap
Text File
|
1996-11-08
|
934b
|
46 lines
//Copyright 1996 Aidan Cully
//All rights reserved
#include <QuickDraw.h>
#include "graphics.h"
#include "StrStuff.h"
void putline(int left,int top,int right,int bottom,long color ) {
RGBColor rgbColor;
rgbColor.red = (color&0x000000FF)<<8;
rgbColor.blue = ((color&0x0000FF00)>>8)<<8;
rgbColor.green = ((color&0x00FF0000)>>16)<<8;
RGBForeColor( &rgbColor );
PenMode( patCopy );
MoveTo( left, top );
LineTo( right, bottom );
ForeColor( blackColor );
}
unsigned char *gcvt( float num, int precision ) {
int temp;
Str32 buf;
if( num < 0 ) {
StrCpy( buf, "\p-" );
num = -num;
} else
buf[0] = 0;
StrCat( buf, IToA( (int)num ) );
StrCat( buf, "\p." );
temp = precision-buf[0];
while( temp-- ) {
num -= (int)num;
num *= 10;
if( !(int)num )
StrCat( buf, "\p0" );
else
StrCat( buf, IToA( (int)num ) );
}
while( buf[buf[0]] == '0' )
buf[0]--;
if( buf[buf[0]] == '.' )
buf[0]--;
return( buf );
}