⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcx.htm

📁 各种文件格式说明及程序描述
💻 HTM
📖 第 1 页 / 共 2 页
字号:
    the following is a simple set of c subroutines to read data from a .pcx file.<br>
    <br>
    /* this procedure reads one encoded block from the image file and stores a<br>
    count and data byte.<br>
    <br>
    return result: 0 = valid data stored, eof = out of data in file */<br>
    <br>
    encget(pbyt, pcnt, fid)<br>
    int *pbyt; /* where to place data */<br>
    int *pcnt; /* where to place count */<br>
    file *fid; /* image file handle */<br>
    {<br>
    int i;<br>
    *pcnt = 1; /* assume a &quot;run&quot; length of one */<br>
    if (eof == (i = getc(fid)))<br>
    return (eof);<br>
    if (0xc0 == (0xc0 &amp; i))<br>
    {<br>
    *pcnt = 0x3f &amp; i;<br>
    if (eof == (i = getc(fid)))<br>
    return (eof);<br>
    }<br>
    *pbyt = i;<br>
    return (0);<br>
    }<br>
    /* here's a program fragment using encget. this reads an entire file and<br>
    stores it in a (large) buffer, pointed to by the variable &quot;bufr&quot;. &quot;fp&quot; 
    is<br>
    the file pointer for the image */<br>
    <br>
    int i;<br>
    long l, lsize;<br>
    lsize = (long )hdr.bytesperline * hdr.nplanes * (1 + hdr.ymax - hdr.ymin);<br>
    for (l = 0; l &lt; lsize; ) /* increment by cnt below */<br>
    {<br>
    if (eof == encget(&amp;chr, &amp;cnt, fp))<br>
    break;<br>
    for (i = 0; i &lt; cnt; i++)<br>
    *bufr++ = chr;<br>
    l += cnt;<br>
    }<br>
    <br>
    the following is a set of c subroutines to write data to a .pcx file.<br>
    <br>
    /* subroutine for writing an encoded byte pair (or single byte if it<br>
    doesn't encode) to a file. it returns the count of bytes written, 0 if error */<br>
    <br>
    encput(byt, cnt, fid)<br>
    unsigned char byt, cnt;<br>
    file *fid;<br>
    {<br>
    if (cnt) {<br>
    if ((cnt == 1) &amp;&amp; (0xc0 != (0xc0 &amp; byt)))<br>
    {<br>
    if (eof == putc((int )byt, fid))<br>
    return(0); /* disk write error (probably full) */<br>
    return(1);<br>
    }<br>
    else<br>
    {<br>
    if (eof == putc((int )0xc0 | cnt, fid))<br>
    return (0); /* disk write error */<br>
    if (eof == putc((int )byt, fid))<br>
    return (0); /* disk write error */<br>
    return (2);<br>
    }<br>
    }<br>
    return (0);<br>
    }<br>
    <br>
    &#12;/* this subroutine encodes one scanline and writes it to a file.<br>
    it returns number of bytes written into outbuff, 0 if failed. */<br>
    <br>
    encline(inbuff, inlen, fp)<br>
    unsigned char *inbuff; /* pointer to scanline data */<br>
    int inlen; /* length of raw scanline in bytes */<br>
    file *fp; /* file to be written to */<br>
    {<br>
    unsigned char this, last;<br>
    int srcindex, i;<br>
    register int total;<br>
    register unsigned char runcount; /* max single runlength is 63 */<br>
    total = 0;<br>
    runcount = 1;<br>
    last = *(inbuff);<br>
    <br>
    /* find the pixel dimensions of the image by calculating <br>
    [xsize = xmax - xmin + 1] and [ysize = ymax - ymin + 1]. <br>
    then calculate how many bytes are in a &quot;run&quot; */<br>
    <br>
    for (srcindex = 1; srcindex &lt; inlen; srcindex++)<br>
    {<br>
    this = *(++inbuff);<br>
    if (this == last) /* there is a &quot;run&quot; in the data, encode it */<br>
    {<br>
    runcount++;<br>
    if (runcount == 63)<br>
    {<br>
    if (! (i = encput(last, runcount, fp)))<br>
    return (0);<br>
    total += i;<br>
    runcount = 0;<br>
    }<br>
    }<br>
    else /* no &quot;run&quot; - this != last */<br>
    {<br>
    if (runcount)<br>
    {<br>
    if (! (i = encput(last, runcount, fp)))<br>
    return(0);<br>
    total += i;<br>
    }<br>
    last = this;<br>
    runcount = 1;<br>
    }<br>
    } /* endloop */<br>
    if (runcount) /* finish up */<br>
    {<br>
    if (! (i = encput(last, runcount, fp)))<br>
    return (0);<br>
    return (total + i);<br>
    }<br>
    return (total);<br>
    }<br>
    <br>
    &#12;<a name="frieze technical information">frieze technical information</a><br>
    <br>
    <a name="general frieze information">general frieze information</a><br>
    <br>
    frieze is a memory-resident utility that allows you to capture and save<br>
    graphic images from other programs. you can then bring these images into<br>
    pc paintbrush for editing and enhancement.<br>
    <br>
    frieze 7.10 and later can be removed from memory (this can return you up<br>
    to 90k of dos ram, depending on your configuration). to remove frieze from<br>
    memory, change directories to your paintbrush directory and type the word<br>
    &quot;frieze&quot;.<br>
    <br>
    <a name="7.00 and later frieze">7.00 and later frieze</a><br>
    <br>
    the frieze command line format is:<br>
    <br>
    frieze {pd} {xn[aarr]} {flags} {video} {hres} {vres} {vnum}<br>
    where:<br>
    {pd} printer driver filename (without the .pdv extension)<br>
    {xn[aarr]}<br>
    x=s for serial printer, p for parallel printer, d for disk file.<br>
    (file is always named frieze.prn)<br>
    n = port number<br>
    aa = two digit hex code for which return bits cause<br>
    an abort (optional)<br>
    rr = two digit hex code for which return bits cause<br>
    a retry (optional)<br>
    note: these codes represent return values from serial or<br>
    parallel port bios calls. for values see and ibm<br>
    bios reference (such as ray duncan's advanced ms-dos<br>
    programming).<br>
    {flags}four digit hex code<br>
    first digit controls length flag<br>
    second digit controls width flag<br>
    third digit controls mode flag<br>
    fourth digit controls bios flag<br>
    0 - none<br>
    1 - dual monitor present<br>
    2 - use internal (true) b/w palette for dithering<br>
    2 color images<br>
    4 - capture palette along with screen in vga only<br>
    frieze 8.08 &amp; up only)<br>
    <br>
    note: the length, width and mode flags are printer driver specific.<br>
    see printers.dat on disk 1 (or setup disk) for correct use. in general<br>
    width flag of 1 means wide carriage, and 0 means standard width. length<br>
    flag of 0 and mode flag of 0 means use default printer driver settings.<br>
    <br>
    if you need to use more than one bios flag option, add the needed flag values<br>
    and use the sum as the flag value.<br>
    <br>
    {video} video driver combination, where the leading digit signifies the<br>
    high level video driver and the rest signifies the low<br>
    level video driver<br>
    example = 1ega - uses drive1 and ega.dev<br>
    {hres} horizontal resolution of the desired graphics mode<br>
    {vres} vertical resolution of the desired graphics mode<br>
    {vnum} hardware specific parameter (usually number of color planes)<br>
    <br>
    note: the last four parameters can be obtained from the cards.dat file,<br>
    in your pc paintbrush product directory.<br>
    <br>
    <br>
    <a name="frieze function calls">frieze function calls</a><br>
    <br>
    frieze is operated using software interrupt number 10h (the video interrupt<br>
    call).<br>
    <br>
    to make a frieze function call, load 75 (decimal) into the ah register and<br>
    the function number into the cl register, then either load al with the<br>
    function argument or load es and bx with a segment and offset which point<br>
    to the function argument. do an int 10h. frieze will return a result code<br>
    number in ax. all other registers are preserved. in general, a result<br>
    code of 0 means success and other values indicate errors. however, function<br>
    20 (get frieze version) behaves differently; see below.<br>
    no. definition arguments<br>
    0 reserved<br>
    1 load window<br>
    es:bx - string (filename to read from)<br>
    2 save window<br>
    es:bx - string (filename to write to)<br>
    3 reserved<br>
    4 reserved <br>
    6 reserved <br>
    7 set window size<br>
    es:bx - 4 element word vector of window settings:<br>
    xmin, ymin, xmax, ymax<br>
    8 reserved<br>
    9 set patterns <br>
    es:bx - 16 element vector of byte values<br>
    containing the screen-to-printer color correspondence<br>
    10 get patterns<br>
    es:bx - room for 16 bytes as above<br>
    11 set mode<br>
    12,13,14 reserved<br>
    15 get window<br>
    es:bx - room for 4 words of the current window<br>
    settings<br>
    16 set print options<br>
    es:bx - character string of printer options.<br>
    same format as for the frieze command.<br>
    17, 18, 19 reserved<br>
    20 get frieze version.<br>
    ah gets the whole number portion and al gets the<br>
    decimal portion of the version number. (eg. for<br>
    freize vesion 7.41, ah will contain 7 and al will<br>
    contain 41. if ah =0, you are calling a pre-7.0<br>
    version of frieze).<br>
    21 set parameters<br>
    es:bx points to an 8 word table (16 bytes) of<br>
    parameter settings: topmargin, leftmargin,<br>
    hsize,vsize, quality/draft mode, printhres,<br>
    printvres, reserved.<br>
    margins and sizes are specified in hundredths<br>
    of inches.<br>
    q/d mode parameter values:<br>
    0 - draft print mode<br>
    1 - quality print mode<br>
    print resolutions are specified in dpi.<br>
    any parameter which should be left unchanged may<br>
    be filled with a (-1) (0ffff hex). the reserved<br>
    settings should be filled with a (-1).<br>
    22 get parameters<br>
    es:bx points to an 8 word table (16 bytes) where<br>
    parameter settings are held.<br>
    23 get printer res<br>
    es:bx points to a 12 word table (24 bytes) that<br>
    holds six printer resolution pairs.<br>
    24 reserved (versions 8.00 &amp; up)<br>
    <br>
    <a name="frieze error codes">frieze error codes</a><br>
    <br>
    when frieze is called using interrupt 10 hex, it will return an error code<br>
    in the ax register. a value of zero shows that there was no error. a<br>
    nonzero result means there was an error. these error codes are explained<br>
    below.<br>
    <br>
    0 no error<br>
    1 printout was stopped by user with the esc key<br>
    2 reserved<br>
    3 file read error<br>
    4 file write error<br>
    5 file not found<br>
    6 invalid header - not an image, wrong screen mode<br>
    7 file close error<br>
    8 disk error - usually drive door open<br>
    9 printer error - printer is off or out of paper<br>
    10 invalid command - cl was set to call a nonexistent frieze function<br>
    11 can't create file - write protect tab or disk is full<br>
    12 wrong video mode - frieze cannot capture text screens.&#12;<br>
    <br>
    technical reference manual<br>
    <br>
    including information for:<br>
    publisher's paintbrushr<br>
    pc paintbrush ivtm<br>
    pc paintbrush iv plustm<br>
    pc paintbrush plustm<br>
    pc paintbrushr<br>
    friezetm graphics<br>
    paintbrushtm<br>
    revision 5<br>
    <br>
    zsoft corporation<br>
    450 franklin rd. suite 100<br>
    marietta, ga 30067<br>
    (404) 428-0008<br>
    (404) 427-1150 fax<br>
    (404) 427-1045 bbs<br>
    <br>
    copyright c 1985, 1987, 1988, 1990, 1991, zsoft corporation <br>
    all rights reserved</td>
  </tr>
</table>
</center></div>

<p align="center"><a href="../index.htm">返回</a></p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -