~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/PCwin/dump.cpp

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* dump */
  2 
  3 #include <stdio.h>
  4 
  5 #ifdef __STRICT_ANSI__
  6 #include <stdlib.h>
  7 #endif  /* __STRICT_ANSI__ */
  8 
  9 #include <string.h>
 10 
 11 #include <dibapi.h>
 12 
 13 #ifdef __cplusplus
 14 extern "C" {
 15 #endif  /* __cplusplus */
 16 #include <tina/sys.h>
 17 #include <tina/sysfuncs.h>
 18 #include <tina/math.h>
 19 #include <tina/tv.h>
 20 #include <tina/tv_screen.h>
 21 #ifdef __cplusplus
 22 }
 23 #endif  /* __cplusplus */
 24 
 25 extern void (*screen_text) (char *);
 26 #define Print(x)  if(screen_text!=NULL) screen_text(x)
 27 
 28 extern "C" int tv_screen_check_width(Tv_screen * tv_screen);
 29 extern "C" int tv_screen_check_height(Tv_screen * tv_screen);
 30 extern "C" int tv_screen_check_depth(Tv_screen * tv_screen);
 31 
 32 static char dump_command[256] = "lpr -Plw";
 33 static char dumpfile[128] = "JUNK";
 34 
 35 Ipos    ipos();
 36 
 37 extern "C" void dump_file_set(char *fname)
 38 {
 39     strcpy(dumpfile, fname);
 40 }
 41 
 42 extern "C" char *dump_file_get(void)
 43 {
 44     return (dumpfile);
 45 }
 46 
 47 extern "C" void dump_command_set(char *command)
 48 {
 49     (void) strcpy(dump_command, command);
 50 }
 51 
 52 extern "C" char *dump_command_get(void)
 53 {
 54     return dump_command;
 55 }
 56 
 57 extern "C" void tv_screen_print_data(FILE * fp, Tv_screen * tv_screen)
 58 {
 59     int     width, height;
 60 
 61     Print("tv_screen_print_data?");
 62     if (tv_screen == NULL || tv_screen->tv == NULL)
 63         return;
 64 
 65     width = tv_screen_check_width(tv_screen);
 66     height = tv_screen_check_height(tv_screen);
 67 }
 68 
 69 /* ARGSUSED quieten lint */
 70 extern "C" void tv_screen_dump(Tv_screen * tv_screen, double draw_width, 
 71 double draw_height, int darkest, int lightest)
 72 {
 73     FILE   *fp = fopen(dumpfile, "w");
 74     int     width, height, depth;
 75     float   totsize, border = (float)0.05;
 76     char    system_call[256];
 77 
 78     (void) string_append(system_call, dump_command, " ", dumpfile, NULL);
 79 
 80     (void) fprintf(fp, "%%!\n");
 81     (void) fprintf(fp, "72 72 translate\n");
 82     (void) fprintf(fp, "%f %f scale\n", draw_width * 72.0, draw_height * 72.0);
 83 
 84     totsize = (float) (1.0 + 2.0 * border);
 85     (void) fprintf(fp, "newpath\n");
 86     (void) fprintf(fp, "%f %f moveto\n", -border, -border);
 87     (void) fprintf(fp, "%f %f rlineto\n", 0.0, totsize);
 88     (void) fprintf(fp, "%f %f rlineto\n", totsize, 0.0);
 89     (void) fprintf(fp, "%f %f rlineto\n", 0.0, -totsize);
 90     (void) fprintf(fp, "%f %f rlineto\n", -totsize, 0.0);
 91     (void) fprintf(fp, "closepath\n");
 92     (void) fprintf(fp, "0.005 setlinewidth\n");
 93     (void) fprintf(fp, "stroke\n");
 94 
 95     width = tv_screen_check_width(tv_screen);
 96     height = tv_screen_check_height(tv_screen);
 97     depth = tv_screen_check_depth(tv_screen);
 98 
 99     (void) fprintf(fp, "/picstr %d string def\n", width);
100     (void) fprintf(fp, "%d %d %d\n", width, height, depth);
101     (void) fprintf(fp, "[%d %d %d %d %d %d]\n", width, 0, 0, -height, 0, height);
102     (void) fprintf(fp, "{\n");
103     (void) fprintf(fp, "currentfile picstr readhexstring pop\n");
104     (void) fprintf(fp, "} image\n");
105     tv_screen_print_data(fp, tv_screen);
106     (void) fprintf(fp, "\nshowpage\n");
107     (void) fclose(fp);
108 }
109 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.