47    if (
gp==NULL) 
return true; 
 
 
  115    memset(
gp, 0, x*y*c);
 
 
  141    fp = fopen(fname, 
"rb");
 
 
  184    int kind = (int)tga.
hd[2];
 
  188    else if (kind == 3) {
 
  191    else if (kind == 10) {
 
  195    else if (kind == 11) {
 
  206        tga.
xs = tga.
hd[12] + tga.
hd[13]*256;
 
  207        tga.
ys = tga.
hd[14] + tga.
hd[15]*256;
 
  210        tga.
xs = tga.
hd[12]*256 + tga.
hd[13];
 
  211        tga.
ys = tga.
hd[14]*256 + tga.
hd[15];
 
  214    uByte alpha = tga.
hd[17] & 0x0f;        
 
  215    if (alpha != 0x08 && alpha != 0x00) {
 
  220    else if (alpha == 0x08) {
 
  223    if (tga.
col*8 != (
int)tga.
hd[16]) {
 
  224        tga.
col = (int)tga.
hd[16]/8;
 
  225        PRINT_MESG(
"JBXL::readTGAData: Warning: Not Match Color Num! set color num = %d\n", tga.
col);
 
  227    PRINT_MESG(
"JBXL::readTGAData: TGA File (%d, %d, %d)\n", tga.
xs, tga.
ys, tga.
col);
 
  229    int datasize = tga.
xs*tga.
ys*tga.
col;
 
  232    tga.
gp = (
uByte*)malloc(datasize);
 
  234        PRINT_MESG(
"JBXL::readTGAData: ERROR: out of Memory!\n");
 
  238    memset(tga.
gp, 0, datasize);
 
  240    fseek(fp, (
int)tga.
hd[0], SEEK_CUR);
 
  247        while (size<datasize && !feof(fp)) {
 
  248            ret = fread(&chunk, 1, 1, fp);
 
  254            int rep = (int)(chunk & 0x7f) + 1;
 
  256                ret = fread(buf, tga.
col, 1, fp);
 
  261                for (
int j=0; j<rep; j++) {
 
  262                    for (
int i=0; i<tga.
col; i++) tga.
gp[size++] = buf[i];
 
  267                    ret = fread(buf, tga.
col*rep, 1, fp);
 
  272                    for (
int i=0; i<tga.
col*rep; i++) tga.
gp[size++] = buf[i];
 
  275                    for (
int j=0; j<rep; j++) {
 
  276                        ret = fread(buf, tga.
col, 1, fp);
 
  281                        for (
int i=0; i<tga.
col; i++) tga.
gp[size++] = buf[i];
 
  286        if (size!=datasize) {
 
  287            DEBUG_MODE PRINT_MESG(
"JBXL::readTGAData: ERROR: unpack RLE failed. (%d != %d), format = %d\n", size, datasize, kind);
 
  294        ret = fread(tga.
gp, datasize, 1, fp);
 
 
  337    fp = fopen(fname, 
"wb");
 
 
  372    fwrite(tga->
gp, tga->
length, 1, fp);
 
 
  395    if      (tga->
col==3 || tga->
col==4) tga->
hd[2] = 2;    
 
  396    else if (tga->
col==1 || tga->
col==2) tga->
hd[2] = 3;    
 
  412    tga->
hd[16] = tga->
col*8;                   
 
  414    tga->
hd[10] = tga->
hd[14];                  
 
  415    tga->
hd[11] = tga->
hd[15];                  
 
  416    if (tga->
col==2 || tga->
col==4) {
 
  421    if (rle && tga->
gp!=NULL) {
 
  422        int len = tga->
xs*tga->
ys;
 
  425        memset(index, 0, len);
 
  430            if (!memcmp(tga->
gp + p*tga->
col, tga->
gp + (p+1)*tga->
col, tga->
col)) {
 
  432                if (index[idx]==127) {
 
  448            if (index[p]!=0x00) p += index[p];
 
  452        if ((
float)n < len*tga->col*0.8f) {
 
  459            memset(buf, 0, len*tga->
col);
 
  464                if (index[i]!=0x00) {
 
  465                    buf[j++] = 0x80 + index[i];
 
  466                    memcpy(buf+j, tga->
gp + i*tga->
col, tga->
col);
 
  472                    memcpy(buf+j, tga->
gp + i*tga->
col, tga->
col);
 
 
void fill(uByte v=(uByte) 0)
全空間を画素値 v にする
 
void init(void)
グラフィックデータは解放しない
 
void setzero(int x, int y, int c)
 
uByte ft[TGA_FOOTER_SIZE]
 
void free(void)
グラフィックデータを開放する
 
bool isNull(void)
グラフィックデータを持っていないか?
 
void clear(void)
全空間を画素値 0 にする
 
void getm(int x, int y, int c)
 
uByte hd[TGA_HEADER_SIZE]
 
#define JBXL_GRAPH_IVDARG_ERROR
無効な引数
 
#define JBXL_GRAPH_NODATA_ERROR
データが無い
 
#define JBXL_FILE_READ_ERROR
ファイル読み込みエラー
 
#define JBXL_GRAPH_OPFILE_ERROR
ファイルのオープンエラー
 
#define JBXL_GRAPH_IVDCOLOR_ERROR
無効なカラー指定
 
#define JBXL_GRAPH_IVDFMT_ERROR
無効なデータ形式
 
#define JBXL_GRAPH_FILESZ_ERROR
ファイルサイズのエラー
 
#define JBXL_GRAPH_MEMORY_ERROR
メモリエラー
 
int writeTGAData(FILE *fp, TGAImage *tga)
 
TGAImage readTGAFile(const char *fname)
 
TGAImage readTGAData(FILE *fp)
 
int setupTGAData(TGAImage *tga, bool rle)
 
int writeTGAFile(const char *fname, TGAImage *tga)