home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377b.lha / devices / printer / epsonx / density.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-02-03  |  2.2 KB  |  57 lines

  1. /* Copyright (c) 1990 Commodore-Amiga, Inc.
  2.  *
  3.  * This example is provided in electronic form by Commodore-Amiga, Inc. for
  4.  * use with the 1.3 revisions of the Addison-Wesley Amiga reference manuals. 
  5.  * The 1.3 Addison-Wesley Amiga Reference Manual series contains additional
  6.  * information on the correct usage of the techniques and operating system
  7.  * functions presented in this example.  The source and executable code of
  8.  * this example may only be distributed in free electronic form, via bulletin
  9.  * board or as part of a fully non-commercial and freely redistributable
  10.  * diskette.  Both the source and executable code (including comments) must
  11.  * be included, without modification, in any copy.  This example may not be
  12.  * published in printed form or distributed with any commercial product.
  13.  * However, the programming techniques and support routines set forth in
  14.  * this example may be used in the development of original executable
  15.  * software products for Commodore Amiga computers.
  16.  * All other rights reserved.
  17.  * This example is provided "as-is" and is subject to change; no warranties
  18.  * are made.  All use is at your own risk.  No liability or responsibility
  19.  * is assumed.
  20.  */
  21.  
  22. #include <exec/types.h>
  23. #include <devices/printer.h>
  24. #include <devices/prtbase.h>
  25.  
  26. char
  27. SetDensity(density_code)
  28. ULONG density_code;
  29. {
  30.     extern struct PrinterData *PD;
  31.     extern struct PrinterExtendedData *PED;
  32.  
  33.     /* SPECIAL_DENSITY     0    1    2    3    4    5    6    7 */
  34.     static int XDPI[8] = {120, 120, 120, 240, 120, 240, 240, 240};
  35.     static int YDPI[8] = {72, 72, 144, 72, 216, 144, 216, 216};
  36.     static char codes[8] = {'L', 'L', 'L', 'Z', 'L', 'Z', 'Z', 'Z'};
  37.  
  38.     PED->ped_MaxColumns = 
  39.         PD->pd_Preferences.PaperSize == W_TRACTOR ? 136 : 80;
  40.     density_code /= SPECIAL_DENSITY1;
  41.     /* default is 80 chars (8.0 in.), W_TRACTOR is 136 chars (13.6 in.) */
  42.     PED->ped_MaxXDots =
  43.         (XDPI[density_code] * PED->ped_MaxColumns) / 10;
  44.     PED->ped_XDotsInch = XDPI[density_code];
  45.     PED->ped_YDotsInch = YDPI[density_code];
  46.     if ((PED->ped_YDotsInch = YDPI[density_code]) == 216) {
  47.         PED->ped_NumRows = 24;
  48.     }
  49.     else if (PED->ped_YDotsInch == 144) {
  50.         PED->ped_NumRows = 16;
  51.     }
  52.     else {
  53.         PED->ped_NumRows = 8;
  54.     }
  55.     return(codes[density_code]);
  56. }
  57.