about summary refs log tree commit diff
path: root/converter/ppm/mitsu.h
blob: b0ae9aa56388df20335e0c2d5f62f55b08b2924b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef MITSU_H_INCLUDED
#define MITSU_H_INCLUDED

#define MAXLUTCOL   255

#define A4_MAXCOLS  1184
#define A4_MAXROWS  1452
#define A4S_MAXROWS 1754
#define A_MAXCOLS   1216
#define A_MAXROWS   1350
#define AS_MAXROWS  1650

/* To use the macros in this file that generate Mitsu output, define a
   function named 'cmd' that outputs a character.  Like this:

    static void
    cmd(char const arg) {

        fputc(arg, stdout);
    }
*/

#define ONLINE         cmd('\021')
#define CLRMEM         cmd('\033'), cmd('Z')

struct Mediasize {
    char         size;
    unsigned int maxcols;
    unsigned int maxrows;
};

static struct Mediasize const MSize_User={' ',1184,1350};
static struct Mediasize const MSize_A4  ={'0',1184,1452};
static struct Mediasize const MSize_A   ={'1',1216,1350};
static struct Mediasize const MSize_A4S ={'2',1184,1754};
static struct Mediasize const MSize_AS  ={'3',1216,1650};
#define MEDIASIZE(chr) cmd('\033'), cmd('#'), cmd('P'), cmd((chr).size)

#define HENLARGE(enl)  cmd('\033'), cmd('&'), cmd('P'), cmd(enl), cmd('\001')
#define VENLARGE(enl)  cmd('\033'), cmd('&'), cmd('Q'), cmd(enl), cmd('\001')
#define NOENLARGE '\001'
#define ENLARGEx2 '\002'
#define ENLARGEx3 '\003'

#define COLREVERSION(arg) cmd('\033'), cmd('&'), cmd('W'), cmd(arg)
#define DONTREVERTCOLOR '0'
#define REVERTCOLOR   '2'

#define NUMCOPY(num)   cmd('\033'), cmd('#'), cmd('C'), cmd((num) & 0xff)

#define HOFFINCH(off)  cmd('\033'), cmd('&'), cmd('S'), cmd((off) & 0xff)
#define VOFFINCH(off)  cmd('\033'), cmd('&'), cmd('T'), cmd((off) & 0xff)

#define CENTERING(cen) cmd('\033'), cmd('&'), cmd('C'), cmd(cen)
#define DONTCENTER '0'
#define DOCENTER   '1'

#define TRANSFERFORMAT(fmt) cmd('\033'), cmd('&'), cmd('A'), cmd(fmt)
#define FRAMEORDER  '0'
#define LINEORDER   '1'
#define LOOKUPTABLE '3'

#define COLORSYSTEM(cs) cmd('\033'), cmd('&'), cmd('I'), cmd(cs)
#define RGB '0'
#define YMC '1'

#define SHARPNESS(spn) cmd('\033'), cmd('#'), cmd('E'), cmd(spn)
#define SP_USER ' '
#define SP_NONE '0'
#define SP_LOW  '1'
#define SP_MIDLOW '2'
#define SP_MIDHIGH '3'
#define SP_HIGH '4'

#define COLORDES(col) cmd('\033'), cmd('C'), cmd(col)
#define RED   '1'
#define GREEN '2'
#define BLUE  '3'
#define YELLOW  '1'
#define MAGENTA '2'
#define CYAN    '3'

#define HPIXELS(hpix) cmd('\033'), cmd('&'), cmd('H'),\
                                                        cmd(((hpix) >> 8) & 0xff), cmd((hpix) & 0xff)
#define VPIXELS(vpix) cmd('\033'), cmd('&'), cmd('V'),\
                                                        cmd(((vpix) >> 8) & 0xff), cmd((vpix) & 0xff)
#define HPIXELSOFF(hoff) cmd('\033'), cmd('&'), cmd('J'),\
                                                        cmd(((hoff) >> 8) & 0xff), cmd((hoff) & 0xff)
#define VPIXELSOFF(voff) cmd('\033'), cmd('&'), cmd('K'),\
                                                        cmd(((voff) >> 8) & 0xff), cmd((voff) & 0xff)

#define GRAYSCALELVL(lvl) cmd('\033'), cmd('#'), cmd('L'), cmd(lvl)
#define BIT_6 '\006'
#define BIT_8 '\010'

#define LOADLOOKUPTABLE cmd('\033'), cmd('&'), cmd('L')
#define DONELOOKUPTABLE cmd('\004')

#define ROTATEIMG(rot)  cmd('\033'), cmd('#'), cmd('R'), cmd(rot)
#define DONTROTATE '0'
#define DOROTATE   '1'

#define DATASTART cmd('\033'), cmd('O')
#define PRINTIT cmd('\014')
#define OFFLINE cmd('\023')

#endif