home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377b.lha / devices / printer / epsonq / density.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-02-03  |  1.9 KB  |  46 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 SetDensity(ULONG);
  27.  
  28. char SetDensity(density_code)
  29. ULONG density_code;
  30. {
  31.     extern struct PrinterData *PD;
  32.     extern struct PrinterExtendedData *PED;
  33.  
  34.     /* SPECIAL_DENSITY     0   1   2    3    4    5    6    7 */
  35.     static int XDPI[8] = {90, 90, 120, 180, 360, 360, 360, 360};
  36.     static char codes[8] = {38, 38, 33, 39, 40, 40, 40, 40};
  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 = (XDPI[density_code] * PED->ped_MaxColumns) / 10;
  43.     PED->ped_XDotsInch = XDPI[density_code];
  44.     return(codes[density_code]);
  45. }
  46.