 /********************************************************************/
 /****                                                            ****/
 /****                                                            ****/
 /****    Program          : Drucken.c                            ****/
 /****                                                            ****/
 /****    Version          :   03.67                              ****/
 /****                                                            ****/
 /****    Erstversion      : 03.07.1988                           ****/
 /****                                                            ****/
 /****    Letzte Änderung  : 07.07.1990                           ****/
 /****                                                            ****/
 /****    Compiliert mit   : siehe MAKEFILE                       ****/
 /****                                                            ****/
 /****    Gelinkt mit      : siehe MAKEFILE                       ****/
 /****                                                            ****/
 /********************************************************************/
 /****                                                            ****/
 /****                                                            ****/
 /****               Copyright by Rüdiger Dreier                  ****/
 /****                                                            ****/
 /****                                                            ****/
 /********************************************************************/
 
 /* Einbinden der Include-Dateien */
 
 #ifdef DEBUG
 #include "Plotter.h"
 #include <proto/tool.h>
 #endif
 #include <string.h>
 
 #include <devices/printer.h>
 #include <intuition/intuitionbase.h>
 
 UWORD Farb1[]=
  {
   0xfff,0xf0f,0x5f0,0x000
  };
 
 UWORD Farb2[]=
  {
   0x0af,0xf00,0xfff,0x000
   
  };
 
 
 /* Druckt aktuellen Screen aus */
 LONG drucken()
  {
   struct ColorMap *colormap;
   long modes,width,height,error;
   struct MsgPort *printerPort;
   
   union printerIO
    {
     struct IOStdReq ios;
     struct IODRPReq iodrp;
     struct IOPrtCmdReq iopc;
    };
   
   union printerIO *request;
   width= (xx)+30;
   height=(yy)+32;
   
   WindowToFront(Window);
   
   /* Setzt Farben neu */
   
   /* Farben zum Ausdruck */
   LoadRGB4(viep,Farb1,4L);
   
   colormap=Screen->ViewPort.ColorMap;
   modes=Screen->ViewPort.Modes;
   printerPort=CreatePort (0,0);
   if (printerPort==NULL)
    {
     return(1);
    }
   request=(union printerIO *)CreateExtIO(printerPort,sizeof(union printerIO));
   if (request==NULL)
    {
     DeletePort(printerPort);
     return(1);
    }
   if (OpenDevice("printer.device",0,(struct IORequest *)request,0))
    {
     DeleteExtIO((struct IORequest *)request,sizeof(union printerIO));
     DeletePort (printerPort);
     return(1);
    }
   
   request->iodrp.io_Command=PRD_DUMPRPORT;
   request->iodrp.io_RastPort=RastPort;
   request->iodrp.io_ColorMap=colormap;
   request->iodrp.io_Modes=modes;
   request->iodrp.io_SrcWidth=width;
   request->iodrp.io_SrcHeight=height;
   request->iodrp.io_DestCols=width;
   request->iodrp.io_DestRows=2*height;
   request->iodrp.io_Special=SPECIAL_FULLCOLS|SPECIAL_FULLROWS|SPECIAL_ASPECT;
   
   error=DoIO((struct IORequest *)request);
   CloseDevice((struct IORequest *)request);
   DeleteExtIO((struct IORequest *)request,sizeof(union printerIO));
   DeletePort(printerPort);
   return(error);
  }
 
