home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / dev / c / rkrm / printer / hp / density.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-02  |  2.5 KB  |  64 lines

  1. /*
  2.  * Copyright (c) 1992 Commodore-Amiga, Inc.
  3.  * 
  4.  * This example is provided in electronic form by Commodore-Amiga, Inc. for 
  5.  * use with the "Amiga ROM Kernel Reference Manual: Devices", 3rd Edition, 
  6.  * published by Addison-Wesley (ISBN 0-201-56775-X).
  7.  * 
  8.  * The "Amiga ROM Kernel Reference Manual: Devices" contains additional 
  9.  * information on the correct usage of the techniques and operating system 
  10.  * functions presented in these examples.  The source and executable code 
  11.  * of these examples may only be distributed in free electronic form, via 
  12.  * bulletin board or as part of a fully non-commercial and freely 
  13.  * redistributable diskette.  Both the source and executable code (including 
  14.  * comments) must be included, without modification, in any copy.  This 
  15.  * example may not be published in printed form or distributed with any
  16.  * commercial product.  However, the programming techniques and support
  17.  * routines set forth in these examples may be used in the development
  18.  * of original executable software products for Commodore Amiga computers.
  19.  * 
  20.  * All other rights reserved.
  21.  * 
  22.  * This example is provided "as-is" and is subject to change; no
  23.  * warranties are made.  All use is at your own risk. No liability or
  24.  * responsibility is assumed.
  25.  *
  26.  ***************************************************************************
  27.  *
  28.  *       Density module for HP_LaserJet
  29.  */
  30.  
  31. #include <exec/types.h>
  32. #include <devices/printer.h>
  33. #include <devices/prtbase.h>
  34.  
  35. void
  36. SetDensity(density_code)
  37. ULONG density_code;
  38. {
  39.         extern struct PrinterData *PD;
  40.         extern struct PrinterExtendedData *PED;
  41.         extern char StartCmd[];
  42.  
  43.         /* SPECIAL_DENSITY     0   1   2    3    4    5    6    7 */
  44.         static int XDPI[8] = {75, 75, 100, 150, 300, 300, 300, 300};
  45.         static char codes[8][3] = {
  46.         {'0','7','5'},{'0','7','5'},{'1','0','0'},{'1','5','0'},
  47.         {'3','0','0'},{'3','0','0'},{'3','0','0'},{'3','0','0'},
  48.         };
  49.  
  50.         density_code /= SPECIAL_DENSITY1;
  51.         PED->ped_MaxXDots = XDPI[density_code] * 8; /* 8 inches */
  52.  
  53.         /* David Berezowski - April 22/90 */
  54.         /* default is 10.0, US_LEGAL is 14.0 */
  55.         PED->ped_MaxYDots =
  56.                 PD->pd_Preferences.PaperSize == US_LEGAL ? 14 : 10;
  57.         PED->ped_MaxYDots *= XDPI[density_code];
  58.  
  59.         PED->ped_XDotsInch = PED->ped_YDotsInch = XDPI[density_code];
  60.         StartCmd[8] = codes[density_code][0];
  61.         StartCmd[9] = codes[density_code][1];
  62.         StartCmd[10] = codes[density_code][2];
  63. }
  64.