home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / HP_550C.LZH / PRINT.C < prev    next >
C/C++ Source or Header  |  1994-06-27  |  4KB  |  181 lines

  1. #include <stdio.h>
  2. #include <stddef.h>
  3. #include <stdlib.h>
  4. #include <ext.h>
  5. #include <aes.h>
  6. #include <vdi.h>
  7. #include <tos.h>
  8. #include <ext.h>
  9. #include <string.h>
  10. #include <math.h>
  11. #define TAILLE 75
  12.  
  13. int   contrl[12];   /* vdi parameter arrays */
  14. int   intin[256];
  15. int   intout[128];
  16. int   ptsin[256];
  17. int   ptsout[128];
  18. int   work_in[11];    /* Input to GSX parameter array        */
  19. int   work_out[57];   /* Output from GSX parameter array    */
  20. int      buffer[8];
  21.  
  22. int h_char,l_char;        /* hauteur et largeur des caracteres    */
  23. int hb_char,lb_char;    /* hauteur et largeur de la boite contenant les caracteres    */
  24. int nb_couleur_vdi;        /* nb de couleur supportées par le vdi sur cette station    */
  25. int hauteur_vdi,largeur_vdi;    /*hauteur et largeur de l'écran utilisé    */
  26.  
  27. int   phys_handle,handle,menu_acc,vdi_handle,g_handle;
  28.  
  29. int   ap_id;
  30. int rgb[16][3];
  31. int rgb2[2][3];
  32.  
  33. char txt[33]="";
  34. int dummy, retour;
  35.  
  36. char filename[15]="D:\\ESSAI.IMG";
  37. int aspect, x_scale, y_scale, h_align, v_align;
  38.  
  39. /*======================================================================*/    
  40. void open_vwork(void);
  41.  
  42. void open_work( void );
  43.     /* la classique ouverture de station de travail    */
  44.     
  45. void open_work( void )
  46.     int i;
  47.     for (i=0;i<10;work_in[i++]=1);
  48.         work_in[10]=2;
  49.  
  50.     work_in[0]=21;
  51.  
  52.   v_opnwk(work_in,&handle,work_out);
  53.   nb_couleur_vdi=work_out[13];    /* nombre de couleur presentes    */
  54.      hauteur_vdi=work_out[1]+1;        /* largeur et hauteur de la virtual    */
  55.      largeur_vdi=work_out[0]+1;        /* workstation    */
  56.     printf("%d\n",largeur_vdi);
  57.     printf("%d\n",hauteur_vdi);
  58.     printf("%d\n",nb_couleur_vdi);
  59.     printf("%d %d %d %d\n",h_char,l_char,hb_char,lb_char);
  60. };
  61.  
  62. void open_vwork( void )
  63.     int i;
  64.     for (i=0;i<10;work_in[i++]=1);
  65.         work_in[10]=2;
  66.  
  67.  
  68.   v_opnvwk(work_in,&handle,work_out);
  69.   nb_couleur_vdi=work_out[13];    /* nombre de couleur presentes    */
  70.      hauteur_vdi=work_out[1]+1;        /* largeur et hauteur de la virtual    */
  71.      largeur_vdi=work_out[0]+1;        /* workstation    */
  72. };
  73.  
  74. void main( void )
  75. {    
  76.     int i, id;
  77.     int pxyarray[4];
  78.     open_vwork();
  79.     vst_load_fonts( handle, 0);
  80.     vswr_mode ( handle, MD_REPLACE);
  81.     for (i=1;i<nb_couleur_vdi;i++)
  82.     {
  83.  
  84.         pxyarray[0]=0;
  85.         pxyarray[1]=0;
  86.         pxyarray[2]=largeur_vdi;
  87.         pxyarray[3]=hauteur_vdi;
  88.         vs_clip(handle, -1 ,pxyarray);
  89.         vq_color(handle,i,0,rgb[i]);
  90.         pxyarray[0]=(TAILLE * i)+100;
  91.         pxyarray[1]=100;
  92.         pxyarray[2]=pxyarray[0]+50;
  93.         pxyarray[3]=200;
  94.         vsf_color(handle,i);
  95.         v_rfbox(handle,pxyarray);
  96.     }
  97.     id = vqt_name( handle, 2, &txt);
  98.     printf("%s\n", txt); 
  99.     vst_font( handle, id);
  100.     vst_arbpt( handle,12,&dummy,&dummy,&dummy,&retour);
  101.     printf("%d\n",retour);
  102.     vst_color( handle, 2);
  103.     v_ftext( handle, 120, 120, txt );
  104.     vst_unload_fonts( handle,0);
  105.     v_clsvwk(handle);
  106.  
  107.     open_work();            
  108.     vst_load_fonts( handle, 0);
  109.     vswr_mode ( handle, MD_REPLACE);
  110.     pxyarray[0]=0;
  111.     pxyarray[1]=0;
  112.     pxyarray[2]=largeur_vdi;
  113.     pxyarray[3]=hauteur_vdi;
  114.     vs_clip(handle, -1 ,pxyarray);
  115.     pxyarray[0]=0;
  116.     pxyarray[1]=0;
  117.     pxyarray[2]=largeur_vdi-1;
  118.     pxyarray[3]=hauteur_vdi-1;
  119. /*    vsf_color(handle,0);
  120.     v_bar(handle,pxyarray); 
  121. */    
  122.     for (i=0;i<nb_couleur_vdi;i++)
  123.     {
  124.  
  125.         vq_color(handle,i,0,rgb2[0]);
  126.         vs_color(handle,i,rgb[i]);
  127.         vq_color(handle,i,0,rgb2[1]);
  128.         printf("Work_out(4) : %d\n", work_out[4]);
  129.         printf("couleur %d: compo r:%4d g:%4d b:%4d\n",i,
  130.                         rgb2[1][0],
  131.                         rgb2[1][1],
  132.                         rgb2[1][2]);
  133.                 
  134.  
  135.  
  136.  
  137.         pxyarray[0]=(TAILLE * i)+100;
  138.         pxyarray[1]=100;
  139.         pxyarray[2]=pxyarray[0]+50;
  140.         pxyarray[3]=200;
  141.         vsf_color(handle,i);
  142.         v_rfbox(handle,pxyarray);
  143.     }
  144.  
  145. /*
  146. v_bit_image( handle, filename, aspect, x_scale, y_scale,
  147.                      h_align, v_align,pxyarray );
  148.  
  149.  
  150.     }
  151.  
  152. */
  153.     id = vqt_name( handle, 2, &txt);
  154.     printf("%s\n", txt); 
  155.     vst_font( handle, id);
  156. /*    vst_arbpt32( handle,12,&dummy,&dummy,&dummy,&retour);*/
  157.     vst_point( handle,12,&dummy,&dummy,&dummy,&retour);
  158.     printf("%d\n",retour);
  159.     vst_color( handle, 2);
  160.     v_gtext( handle, 400, 400, txt );
  161.  
  162. /*
  163.  
  164.     vst_alignment(handle,0,0,&dummy,&dummy);
  165.     vst_arbpt( handle,12,&dummy,&dummy,&dummy,&retour);
  166.     vst_point( handle,12,&dummy,&dummy,&dummy,&retour);
  167.     vst_color( handle, 2);
  168.     v_justified( handle, 150,200,txt,250,1,0);
  169.  
  170.     v_ftext( handle, 200, 200, txt );
  171. */
  172.  
  173.     v_updwk(handle);
  174.     v_clrwk(handle);
  175.     vst_unload_fonts( handle,0);
  176.     v_clswk(handle);
  177.     
  178.  
  179. }