This Macintosh C program generates PostScript thru the print driver to test the RGB spectrum. (Unfortunetly, the angle bracket syntax in the #include commands of C does not show up in preformatted HTML. View Document Source to see what I mean.)

// ColorBoxes.c
	// INCLUDE 1
		#include 
		#include 
		#include 
		#include 
		#include 
		#include 
	// INCLUDE 2
		//#include 
		//#include 
		//#include 
		#include 
	// CONSTANTS
		const short rangeNum = 2; // 2,3, OR 4 ****************************************
		const short pageWidth = 612;
		const short pageHeight = 792; // LETTER
		//const short pageHeight = 1008; // LEGAL
		//const short pageWidth = 792; // TABLOID
		//const short pageHeight = 1224; // TABLOID
		//const short pageWidth = 932; // Super A3
		//const short pageHeight = 1368; // Super A3
		
		const short leftMargin = 9;
		const short topMargin = 9;
		const short bottomMargin = 44;
		const short rightMargin = 9;
		

	// Globals  1
		Rect windRect;
	// Globals  2
		static	THPrint	hPrint = NULL;
	// Prototypes  1
		void Initialize (void);
		void NewBox (void);
		void SetBoxColors (int r, int g, int b);
	// PROTYPES 2
		void CheckPrintHandle(void);
		void DoPageSetUp (void);
		void PrDoc (void);
		void PrintNewBox(void);
		int HowMany( void );
	main (void) {
		Initialize ();
		NewBox ();
		DoPageSetUp ();
		PrintNewBox ();
		NewBox ();
		do {	} while (!Button () );
		}
	void Initialize (void) {
		WindowPtr mainPtr;
		SysEnvRec theWorld;
		OSErr error = SysEnvirons (1, &theWorld);

		if (theWorld.hasColorQD == false) { // COLOR QUICKDRAW?
			SysBeep (50);
			ExitToShell ();
			}
		// INITIALIZE MANAGERS 1
			InitGraf (&qd.thePort);
			InitWindows ();
		// INITIALIZE MANAGERS 2
			//InitFonts();
			//InitMenus();
			//TEInit();
			//InitDialogs(nil);
			InitCursor();
		
		windRect = qd.screenBits.bounds;
		//InsetRect (&windRect, 20, 20); // MAKES WINDOW SMALLER
		mainPtr = NewCWindow (nil, &windRect, "\pColor Boxes", true, documentProc,
		(WindowPtr) -1, false, 0);
		SetPort (mainPtr); // set window to current graf port 
		}
		
	void NewBox (void) {
		int h, i, j, k; // POSITIONS
		int r, g, b; // COLORS
		// INITIALIZE DIMENSIONS
			short areaHeight = pageHeight - topMargin - bottomMargin;
			short areaWidth = pageWidth - leftMargin - rightMargin;
			short sectionHeight = areaHeight / 3;
			short columnWidth = areaWidth / (rangeNum * rangeNum);
			short rowHeight = (sectionHeight) / (rangeNum * rangeNum);
			short gap = 16 - (rangeNum * rangeNum) + 1;
			short boxWidth = (columnWidth - gap) / rangeNum;
			short boxHeight = (rowHeight - gap) / rangeNum;
			

		int m = (rangeNum * rangeNum) - 1; // RANGE NUMBER
		RGBColor boxColor;
		Rect boxRect;
		long int newLeft, newTop;
		for (h=0; h<=2; h++ ){
			for (i=0; i<=m; i++ ){
				for (j=0; j<=m; j++ ){
					for (k=0; k<=m; k++ ){
						switch (h) {
							case 0:
								r=i; g=j; b=k;
								break;
							case 1:
								r=k; g=i; b=j;
								break;
							case 2:
								r=j; g=k; b=i;
								break;
							}
						boxColor.red = 65535 * r/m;
						boxColor.green = 65535 * g/m;
						boxColor.blue = 65535 * b/m;
						RGBForeColor (&boxColor);
					
						newTop = topMargin + ((i / rangeNum) * boxHeight) + (j * rowHeight) + (h * sectionHeight); 
						newLeft = leftMargin + ((i % rangeNum) * boxWidth) + (k * columnWidth);
						
						SetRect (&boxRect, newLeft, newTop, newLeft+boxWidth, newTop+boxHeight);
						PaintRect (&boxRect);
						}
					}
				}
			}
		}

// START PART 2
	void CheckPrintHandle(void) {
		if ( hPrint==NULL ) 
			PrintDefault( hPrint = ( TPrint ** ) NewHandle( sizeof( TPrint )));
		}

	void DoPageSetUp (void) {
		PrOpen( );
		CheckPrintHandle( );
		if ( PrStlDialog( hPrint )) ;
		PrClose( );
		}
		
	void PrDoc (void) {
		TPPrPort printPort = PrOpenDoc( hPrint, 0L, 0L );
		SetPort(( GrafPtr )printPort );
		PrOpenPage( printPort, 0L );
		NewBox();
		PrClosePage( printPort );
		PrCloseDoc( printPort );
		}
	void PrintNewBox(void) {
		// DECLARATIONS
			GrafPtr		savePort;
			TPrStatus	prStatus;
			int			copies;
		PrOpen( );
		CheckPrintHandle( );
		//SetCursor( &arrow );
		if ( PrJobDialog( hPrint ) != 0 ) {
			GetPort( &savePort );
			for ( copies=HowMany( ); copies>0; copies-- ) {
				PrDoc ();
				PrPicFile( hPrint, 0L, 0L, 0L, &prStatus );
				}
			SetPort( savePort );
			}
		PrClose( );
		}
	int HowMany( void ){
		return((( **hPrint ).prJob.bJDocLoop==bDraftLoop ) ? 
					( **hPrint ).prJob.iCopies : 1 );
		}