home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 449a.lha / Plotter / src / Drucken.c < prev    next >
Text File  |  1990-12-02  |  3KB  |  109 lines

  1.  /********************************************************************/
  2.  /****                                                            ****/
  3.  /****                                                            ****/
  4.  /****    Program          : Drucken.c                            ****/
  5.  /****                                                            ****/
  6.  /****    Version          :   03.67                              ****/
  7.  /****                                                            ****/
  8.  /****    Erstversion      : 03.07.1988                           ****/
  9.  /****                                                            ****/
  10.  /****    Letzte Änderung  : 07.07.1990                           ****/
  11.  /****                                                            ****/
  12.  /****    Compiliert mit   : siehe MAKEFILE                       ****/
  13.  /****                                                            ****/
  14.  /****    Gelinkt mit      : siehe MAKEFILE                       ****/
  15.  /****                                                            ****/
  16.  /********************************************************************/
  17.  /****                                                            ****/
  18.  /****                                                            ****/
  19.  /****               Copyright by Rüdiger Dreier                  ****/
  20.  /****                                                            ****/
  21.  /****                                                            ****/
  22.  /********************************************************************/
  23.  
  24.  /* Einbinden der Include-Dateien */
  25.  
  26.  #ifdef DEBUG
  27.  #include "Plotter.h"
  28.  #include <proto/tool.h>
  29.  #endif
  30.  #include <string.h>
  31.  
  32.  #include <devices/printer.h>
  33.  #include <intuition/intuitionbase.h>
  34.  
  35.  UWORD Farb1[]=
  36.   {
  37.    0xfff,0xf0f,0x5f0,0x000
  38.   };
  39.  
  40.  UWORD Farb2[]=
  41.   {
  42.    0x0af,0xf00,0xfff,0x000
  43.    
  44.   };
  45.  
  46.  
  47.  /* Druckt aktuellen Screen aus */
  48.  LONG drucken()
  49.   {
  50.    struct ColorMap *colormap;
  51.    long modes,width,height,error;
  52.    struct MsgPort *printerPort;
  53.    
  54.    union printerIO
  55.     {
  56.      struct IOStdReq ios;
  57.      struct IODRPReq iodrp;
  58.      struct IOPrtCmdReq iopc;
  59.     };
  60.    
  61.    union printerIO *request;
  62.    width= (xx)+30;
  63.    height=(yy)+32;
  64.    
  65.    WindowToFront(Window);
  66.    
  67.    /* Setzt Farben neu */
  68.    
  69.    /* Farben zum Ausdruck */
  70.    LoadRGB4(viep,Farb1,4L);
  71.    
  72.    colormap=Screen->ViewPort.ColorMap;
  73.    modes=Screen->ViewPort.Modes;
  74.    printerPort=CreatePort (0,0);
  75.    if (printerPort==NULL)
  76.     {
  77.      return(1);
  78.     }
  79.    request=(union printerIO *)CreateExtIO(printerPort,sizeof(union printerIO));
  80.    if (request==NULL)
  81.     {
  82.      DeletePort(printerPort);
  83.      return(1);
  84.     }
  85.    if (OpenDevice("printer.device",0,(struct IORequest *)request,0))
  86.     {
  87.      DeleteExtIO((struct IORequest *)request,sizeof(union printerIO));
  88.      DeletePort (printerPort);
  89.      return(1);
  90.     }
  91.    
  92.    request->iodrp.io_Command=PRD_DUMPRPORT;
  93.    request->iodrp.io_RastPort=RastPort;
  94.    request->iodrp.io_ColorMap=colormap;
  95.    request->iodrp.io_Modes=modes;
  96.    request->iodrp.io_SrcWidth=width;
  97.    request->iodrp.io_SrcHeight=height;
  98.    request->iodrp.io_DestCols=width;
  99.    request->iodrp.io_DestRows=2*height;
  100.    request->iodrp.io_Special=SPECIAL_FULLCOLS|SPECIAL_FULLROWS|SPECIAL_ASPECT;
  101.    
  102.    error=DoIO((struct IORequest *)request);
  103.    CloseDevice((struct IORequest *)request);
  104.    DeleteExtIO((struct IORequest *)request,sizeof(union printerIO));
  105.    DeletePort(printerPort);
  106.    return(error);
  107.   }
  108.  
  109.