home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377b.lha / devices / printer / hp / density.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-02-03  |  2.0 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. SetDensity(density_code)
  27. ULONG density_code;
  28. {
  29.     extern struct PrinterExtendedData *PED;
  30.     extern char StartCmd[];
  31.  
  32.     /* SPECIAL_DENSITY     0   1   2    3    4    5    6    7 */
  33.     static int XDPI[8] = {75, 75, 100, 150, 300, 300, 300, 300};
  34.     static char codes[8][3] = {
  35.     {'0','7','5'},{'0','7','5'},{'1','0','0'},{'1','5','0'},
  36.         {'3','0','0'},{'3','0','0'},{'3','0','0'},{'3','0','0'}};
  37.  
  38.     density_code /= SPECIAL_DENSITY1;
  39.     PED->ped_MaxXDots = XDPI[density_code] * 8; /* 8 inches */
  40.     PED->ped_MaxYDots = XDPI[density_code] * 10; /* 10 inches */
  41.     PED->ped_XDotsInch = PED->ped_YDotsInch = XDPI[density_code];
  42.     StartCmd[8] = codes[density_code][0];
  43.     StartCmd[9] = codes[density_code][1];
  44.     StartCmd[10] = codes[density_code][2];
  45. }
  46.