home *** CD-ROM | disk | FTP | other *** search
- /*
- * picture.c
- *
- * Complete rewrite of the Rayshade functions.
- *
- * I should really maintain current compatibility by including a lot of hash defines
- * however I simply do not have enough time to do this.
- */
-
- #include <MacHeaders>
- #include "rayshade.h"
- #include "picture.h"
- #include "viewing.h"
- #include "options.h"
- #include "stats.h"
-
- extern void DrawMacWindow(short x, short y, unsigned short r, unsigned short g, unsigned short b) ;
- extern void OpenMacWindow(short width, short height) ;
-
- /*
- * Convert floating-point (0.-1.) to unsigned char (0-255), with no gamma
- * correction.
- */
- unsigned short correct(Float x)
- {
- /*
- * Truncate values < 0 or > 1.
- */
- if (x <= 0.0)
- return (unsigned short) 0;
- if (x >= 1.0)
- return (unsigned short) 65535;
- return (unsigned short)(x * 65535.0);
- }
-
- void PictureStart(char **argv)
- {
- OpenMacWindow((short)Screen.xsize, (short)Screen.ysize) ;
- }
-
-
- void PictureWriteLine(int y, Pixel *buf)
- {
- register short i;
- register unsigned short r,g,b ;
-
- for (i = 0; i < Screen.xsize; i++) {
- r = CORRECT(buf[i].r) ;
- g = CORRECT(buf[i].g) ;
- b = CORRECT(buf[i].b) ;
- DrawMacWindow(i,(short)Screen.ysize-(short)y-1, r, g, b) ;
- }
- }
-
- void
- PictureFrameEnd()
- {
- }
-
- void
- PictureEnd()
- {
- RefreshWindow();
- }
-
-