home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 1.2 / amidev_cd_12.iso / reference_library / devices / dev_examples / hp_laserjet_density.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-20  |  1.1 KB  |  37 lines

  1. /*
  2.         Density module for HP_LaserJet
  3. */
  4.  
  5. #include <exec/types.h>
  6. #include <devices/printer.h>
  7. #include <devices/prtbase.h>
  8.  
  9. SetDensity(density_code)
  10. ULONG density_code;
  11. {
  12.         extern struct PrinterData *PD;
  13.         extern struct PrinterExtendedData *PED;
  14.         extern char StartCmd[];
  15.  
  16.         /* SPECIAL_DENSITY     0   1   2    3    4    5    6    7 */
  17.         static int XDPI[8] = {75, 75, 100, 150, 300, 300, 300, 300};
  18.         static char codes[8][3] = {
  19.         {'0','7','5'},{'0','7','5'},{'1','0','0'},{'1','5','0'},
  20.         {'3','0','0'},{'3','0','0'},{'3','0','0'},{'3','0','0'},
  21.         };
  22.  
  23.         density_code /= SPECIAL_DENSITY1;
  24.         PED->ped_MaxXDots = XDPI[density_code] * 8; /* 8 inches */
  25.  
  26.         /* default is 10.0, US_LEGAL is 14.0 */
  27.         PED->ped_MaxYDots =
  28.                 PD->pd_Preferences.PaperSize == US_LEGAL ? 14 : 10;
  29.         PED->ped_MaxYDots *= XDPI[density_code];
  30.  
  31.         PED->ped_XDotsInch = PED->ped_YDotsInch = XDPI[density_code];
  32.         StartCmd[8] = codes[density_code][0];
  33.         StartCmd[9] = codes[density_code][1];
  34.         StartCmd[10] = codes[density_code][2];
  35. }
  36.  
  37.