~ubuntu-branches/ubuntu/trusty/xfractint/trusty

« back to all changes in this revision

Viewing changes to tgaview.c

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio
  • Date: 2010-11-24 21:24:54 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101124212454-a2vxdh9pk5p5lhlm
Tags: 20.4.10-1
* New upstream version
* enable autobuilding, Closes: #410674, #587959
* update watch file. Closes: #449889
* remove bashism from rules, Closes: #581474

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/* Routine to decode Targa 16 bit RGB file
3
 
   */
4
 
 
5
 
/* 16 bit .tga files were generated for continuous potential "potfile"s
6
 
   from version 9.? thru version 14.  Replaced by double row gif type
7
 
   file (.pot) in version 15.  Delete this code after a few more revs.
8
 
*/
9
 
 
10
 
 
11
 
  /* see Fractint.c for a description of the "include"  hierarchy */
12
 
#include "port.h"
13
 
#include "prototyp.h"
14
 
#include "targa_lc.h"
15
 
 
16
 
static FILE *fptarga = NULL;            /* FILE pointer           */
17
 
 
18
 
/* Main entry decoder */
19
 
int
20
 
tgaview()
21
 
{
22
 
   int i;
23
 
   int cs;
24
 
   unsigned int width;
25
 
   struct fractal_info info;
26
 
 
27
 
   if((fptarga = t16_open(readname, (int *)&width, (int *)&height, &cs, (U8 *)&info))==NULL)
28
 
      return(-1);
29
 
 
30
 
   rowcount = 0;
31
 
   for (i=0; i<(int)height; ++i)
32
 
   {
33
 
       t16_getline(fptarga, width, (U16 *)boxx);
34
 
       if ((*outln)((void *)boxx,width))
35
 
       {
36
 
          fclose(fptarga);
37
 
          fptarga = NULL;
38
 
          return(-1);
39
 
       }
40
 
       if (keypressed())
41
 
       {
42
 
          fclose(fptarga);
43
 
          fptarga = NULL;
44
 
          return(-1);
45
 
       }
46
 
   }
47
 
   fclose(fptarga);
48
 
   fptarga = NULL;
49
 
   return(0);
50
 
}
51
 
 
52
 
/* Outline function for 16 bit data with 8 bit fudge */
53
 
int
54
 
outlin16(BYTE *buffer,int linelen)
55
 
{
56
 
    int i;
57
 
    U16 *buf;
58
 
    buf = (U16 *)buffer;
59
 
    for(i=0;i<linelen;i++)
60
 
       putcolor(i,rowcount,buf[i]>>8);
61
 
    rowcount++;
62
 
    return(0);
63
 
}