Blender  V3.3
Classes | Macros | Typedefs | Functions
targa.c File Reference
#include "BLI_fileops.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "imbuf.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_filetype.h"
#include "IMB_colormanagement.h"
#include "IMB_colormanagement_intern.h"

Go to the source code of this file.

Classes

struct  TARGA
 

Macros

#define GSS(x)   (((uchar *)(x))[1] << 8 | ((uchar *)(x))[0])
 
#define TARGA_HEADER_SIZE   18
 

Typedefs

typedef struct TARGA TARGA
 

Functions

static int tga_out1 (unsigned int data, FILE *file)
 
static int tga_out2 (unsigned int data, FILE *file)
 
static int tga_out3 (unsigned int data, FILE *file)
 
static int tga_out4 (unsigned int data, FILE *file)
 
static bool makebody_tga (ImBuf *ibuf, FILE *file, int(*out)(unsigned int, FILE *))
 
static bool dumptarga (struct ImBuf *ibuf, FILE *file)
 
bool imb_savetarga (struct ImBuf *ibuf, const char *filepath, int UNUSED(flags))
 
static bool checktarga (TARGA *tga, const unsigned char *mem, const size_t size)
 
bool imb_is_a_targa (const unsigned char *buf, size_t size)
 
static void complete_partial_load (struct ImBuf *ibuf, unsigned int *rect)
 
static void decodetarga (struct ImBuf *ibuf, const unsigned char *mem, size_t mem_size, int psize)
 
static void ldtarga (struct ImBuf *ibuf, const unsigned char *mem, size_t mem_size, int psize)
 
ImBufimb_loadtarga (const unsigned char *mem, size_t mem_size, int flags, char colorspace[IM_MAX_SPACE])
 

Macro Definition Documentation

◆ GSS

#define GSS (   x)    (((uchar *)(x))[1] << 8 | ((uchar *)(x))[0])

Definition at line 28 of file targa.c.

◆ TARGA_HEADER_SIZE

#define TARGA_HEADER_SIZE   18

On-disk header size.

Note
In theory it's possible padding would make the struct and on-disk size differ, so use a constant instead of sizeof(TARGA).

Definition at line 53 of file targa.c.

Typedef Documentation

◆ TARGA

typedef struct TARGA TARGA

Function Documentation

◆ checktarga()

static bool checktarga ( TARGA tga,
const unsigned char *  mem,
const size_t  size 
)
static

◆ complete_partial_load()

static void complete_partial_load ( struct ImBuf ibuf,
unsigned int *  rect 
)
static

Definition at line 407 of file targa.c.

References ImBuf::rect, size(), ImBuf::x, and ImBuf::y.

Referenced by decodetarga(), and ldtarga().

◆ decodetarga()

static void decodetarga ( struct ImBuf ibuf,
const unsigned char *  mem,
size_t  mem_size,
int  psize 
)
static

Definition at line 423 of file targa.c.

References col, complete_partial_load(), count, NULL, ImBuf::rect, size(), ImBuf::x, and ImBuf::y.

Referenced by imb_loadtarga().

◆ dumptarga()

static bool dumptarga ( struct ImBuf ibuf,
FILE *  file 
)
static

Definition at line 217 of file targa.c.

References file, if(), NULL, ImBuf::planes, ImBuf::rect, size(), ImBuf::x, and ImBuf::y.

Referenced by imb_savetarga().

◆ imb_is_a_targa()

bool imb_is_a_targa ( const unsigned char *  buf,
size_t  size 
)

Definition at line 400 of file targa.c.

References checktarga(), and size().

◆ imb_loadtarga()

ImBuf* imb_loadtarga ( const unsigned char *  mem,
size_t  mem_size,
int  flags,
char  colorspace[IM_MAX_SPACE] 
)

◆ imb_savetarga()

bool imb_savetarga ( struct ImBuf ibuf,
const char *  filepath,
int   UNUSEDflags 
)

◆ ldtarga()

static void ldtarga ( struct ImBuf ibuf,
const unsigned char *  mem,
size_t  mem_size,
int  psize 
)
static

Definition at line 548 of file targa.c.

References col, complete_partial_load(), NULL, ImBuf::rect, size(), ImBuf::x, and ImBuf::y.

Referenced by imb_loadtarga().

◆ makebody_tga()

static bool makebody_tga ( ImBuf ibuf,
FILE *  file,
int(*)(unsigned int, FILE *)  out 
)
static

Definition at line 120 of file targa.c.

References copy(), file, usdtokens::out(), ImBuf::rect, ImBuf::x, y, and ImBuf::y.

Referenced by imb_savetarga().

◆ tga_out1()

static int tga_out1 ( unsigned int  data,
FILE *  file 
)
static

Definition at line 57 of file targa.c.

References data, and file.

Referenced by imb_savetarga().

◆ tga_out2()

static int tga_out2 ( unsigned int  data,
FILE *  file 
)
static

Definition at line 68 of file targa.c.

References data, and file.

Referenced by imb_savetarga().

◆ tga_out3()

static int tga_out3 ( unsigned int  data,
FILE *  file 
)
static

Definition at line 82 of file targa.c.

References data, and file.

Referenced by imb_savetarga().

◆ tga_out4()

static int tga_out4 ( unsigned int  data,
FILE *  file 
)
static

Definition at line 99 of file targa.c.

References data, and file.

Referenced by imb_savetarga().