GrafX2 2.9.3227
The ultimate 256-color painting program
Interchange File Format

Interchange File Format (Electronic Arts) More...

+ Collaboration diagram for Interchange File Format:

Data Structures

struct  T_IFF_Header
 
struct  T_IFF_AnimHeader
 
struct  T_IFF_PCHG_Palette
 

Functions

void Test_IFF (FILE *IFF_file, const char *sub_type)
 Test if a file is in IFF format. More...
 
void Test_PBM (T_IO_Context *context, FILE *f)
 
void Test_LBM (T_IO_Context *context, FILE *f)
 
void Test_ACBM (T_IO_Context *context, FILE *f)
 
static int IFF_Skip_section (FILE *file)
 Skips the current section in an IFF file. More...
 
static byte IFF_Wait_for (FILE *file, const char *expected_section)
 Wait for a specific IFF chunk. More...
 
static dword Get_IFF_color (const byte *buffer, word x_pos, word real_line_size, byte bitplanes)
 Decodes the color of one pixel from the ILBM line buffer. More...
 
static void Set_IFF_color (byte *buffer, word x_pos, byte color, word real_line_size, byte bitplanes)
 chunky to planar More...
 
void Draw_IFF_line (T_IO_Context *context, const byte *buffer, short y_pos, short real_line_size, byte bitplanes)
 Planar to chunky conversion of a line. More...
 
static void Draw_IFF_line_PCHG (T_IO_Context *context, const byte *buffer, short y_pos, short real_line_size, byte bitplanes, const T_IFF_PCHG_Palette *PCHG_palettes)
 decode pixels with palette changes per line (copper list:) More...
 
static void Draw_IFF_line_HAM (T_IO_Context *context, const byte *buffer, short y_pos, short real_line_size, byte bitplanes, const T_IFF_PCHG_Palette *PCHG_palettes)
 Decode a HAM line to 24bits pixels. More...
 
static void PBM_Decode (T_IO_Context *context, FILE *file, byte compression, word width, word height)
 Decode PBM data. More...
 
static void LBM_Decode (T_IO_Context *context, FILE *file, byte compression, byte Image_HAM, byte stored_bit_planes, byte real_bit_planes, const T_IFF_PCHG_Palette *PCHG_palettes)
 Decode LBM data. More...
 
static void RAST_chunk_decode (T_IO_Context *context, FILE *file, dword section_size, T_IFF_PCHG_Palette **PCHG_palettes)
 Decode RAST chunk (from Atari ST pictures) More...
 
static void IFF_Set_EHB_Palette (T_Components *palette)
 Sets 32 upper colors of EHB palette. More...
 
void Load_IFF (T_IO_Context *context)
 Load IFF picture (PBM/ILBM/ACBM) or animation. More...
 
void Save_IFF (T_IO_Context *context)
 Save IFF file (LBM or PBM) More...
 

Detailed Description

Interchange File Format (Electronic Arts)

This is the "native" format of Amiga. We support ILBM/PBM/ACBM

Function Documentation

◆ Test_IFF()

void Test_IFF ( FILE *  IFF_file,
const char *  sub_type 
)

Test if a file is in IFF format.

References File_error, format, Read_bytes(), and Read_dword_be().

Referenced by Test_ACBM(), Test_LBM(), and Test_PBM().

◆ Test_PBM()

void Test_PBM ( T_IO_Context context,
FILE *  f 
)

References Test_IFF().

◆ Test_LBM()

void Test_LBM ( T_IO_Context context,
FILE *  f 
)

References Test_IFF().

◆ Test_ACBM()

void Test_ACBM ( T_IO_Context context,
FILE *  f 
)

References Test_IFF().

◆ IFF_Skip_section()

static int IFF_Skip_section ( FILE *  file)
static

Skips the current section in an IFF file.

This function should be called while the file pointer is right after the 4-character code that identifies the section.

References Read_dword_be().

Referenced by IFF_Wait_for().

◆ IFF_Wait_for()

static byte IFF_Wait_for ( FILE *  file,
const char *  expected_section 
)
static

Wait for a specific IFF chunk.

References IFF_Skip_section(), and Read_bytes().

Referenced by LBM_Decode().

◆ Get_IFF_color()

static dword Get_IFF_color ( const byte buffer,
word  x_pos,
word  real_line_size,
byte  bitplanes 
)
static

Decodes the color of one pixel from the ILBM line buffer.

Planar to chunky conversion

Parameters
bufferPlanar buffer
x_posPosition of the pixel in graphic line
real_line_sizeWidth of one bitplane in memory, in bytes
bitplanesNumber of bitplanes

Referenced by Draw_IFF_line(), Draw_IFF_line_HAM(), and Draw_IFF_line_PCHG().

◆ Set_IFF_color()

static void Set_IFF_color ( byte buffer,
word  x_pos,
byte  color,
word  real_line_size,
byte  bitplanes 
)
static

chunky to planar

Referenced by Load_IFF(), and Save_IFF().

◆ Draw_IFF_line()

void Draw_IFF_line ( T_IO_Context context,
const byte buffer,
short  y_pos,
short  real_line_size,
byte  bitplanes 
)

Planar to chunky conversion of a line.

Parameters
contextthe IO context
bufferPlanar buffer
y_posCurrent line
real_line_sizeWidth of one bitplane in memory, in bytes
bitplanesNumber of bitplanes

References Get_IFF_color(), Set_pixel(), Set_pixel_24b(), and T_IO_Context::Width.

Referenced by LBM_Decode(), Load_IFF(), Load_INFO(), Load_PCX(), and Load_SCx().

◆ Draw_IFF_line_PCHG()

static void Draw_IFF_line_PCHG ( T_IO_Context context,
const byte buffer,
short  y_pos,
short  real_line_size,
byte  bitplanes,
const T_IFF_PCHG_Palette PCHG_palettes 
)
static

◆ Draw_IFF_line_HAM()

static void Draw_IFF_line_HAM ( T_IO_Context context,
const byte buffer,
short  y_pos,
short  real_line_size,
byte  bitplanes,
const T_IFF_PCHG_Palette PCHG_palettes 
)
static

◆ PBM_Decode()

static void PBM_Decode ( T_IO_Context context,
FILE *  file,
byte  compression,
word  width,
word  height 
)
static

Decode PBM data.

Supports compressions :

  • 0 uncompressed
  • 1 compressed

References File_error, GFX2_ERROR, GFX2_Log(), Read_byte(), Read_bytes(), and Set_pixel().

Referenced by Load_IFF().

◆ LBM_Decode()

static void LBM_Decode ( T_IO_Context context,
FILE *  file,
byte  compression,
byte  Image_HAM,
byte  stored_bit_planes,
byte  real_bit_planes,
const T_IFF_PCHG_Palette PCHG_palettes 
)
static

Decode LBM data.

Supports packings :

  • 0 uncompressed
  • 1 packbits (Amiga)
  • 2 Vertical RLE (Atari ST)

References Draw_IFF_line(), Draw_IFF_line_HAM(), Draw_IFF_line_PCHG(), File_error, GFX2_Log(), GFX2_malloc, GFX2_WARNING, T_IO_Context::Height, IFF_Wait_for(), NULL, Read_byte(), Read_bytes(), Read_dword_be(), Read_word_be(), and T_IO_Context::Width.

Referenced by Load_IFF().

◆ RAST_chunk_decode()

static void RAST_chunk_decode ( T_IO_Context context,
FILE *  file,
dword  section_size,
T_IFF_PCHG_Palette **  PCHG_palettes 
)
static

◆ IFF_Set_EHB_Palette()

static void IFF_Set_EHB_Palette ( T_Components palette)
static

Sets 32 upper colors of EHB palette.

32 colors in the palette.

The next 32 colors are the same with values divided by 2

References T_Components::B, T_Components::G, and T_Components::R.

Referenced by Load_IFF().

◆ Load_IFF()

void Load_IFF ( T_IO_Context context)

Load IFF picture (PBM/ILBM/ACBM) or animation.

Todo:
DRNG IFF chunk is read, but complex color cycling are not implemented.

References T_IFF_AnimHeader::abstime, T_Components::B, T_IO_Context::Background_transparent, T_IFF_Header::BitPlanes, T_IFF_AnimHeader::bits, T_Config::Clear_palette, T_IO_Context::Color_cycles, COLOR_CYCLING_SPEED_MAX, T_IO_Context::Comment, COMMENT_SIZE, T_IFF_Header::Compression, Config, CONTEXT_PALETTE, CONTEXT_PREVIEW, CONTEXT_PREVIEW_PALETTE, T_IO_Context::Cycle_range, Draw_IFF_line(), Draw_IFF_line_HAM(), T_Color_cycle::End, File_error, File_length_file(), flags, format, FORMAT_ACBM, FORMAT_LBM, FORMAT_PBM, T_Components::G, GFX2_DEBUG, GFX2_ERROR, GFX2_INFO, GFX2_Log(), GFX2_LogHexDump(), GFX2_malloc, GFX2_WARNING, T_IFF_AnimHeader::h, T_IFF_Header::Height, T_IO_Context::Height, IFF_Set_EHB_Palette(), IMAGE_MODE_ANIMATION, T_IFF_AnimHeader::interleave, T_Color_cycle::Inverse, LBM_Decode(), T_IFF_Header::Mask, T_IFF_AnimHeader::mask, T_IFF_PCHG_Palette::Next, NULL, Open_file_read(), T_IFF_AnimHeader::operation, T_IO_Context::Original_height, Original_screen_X, Original_screen_Y, T_IO_Context::Original_width, T_IFF_AnimHeader::pad0, T_IFF_Header::Pad1, T_IFF_PCHG_Palette::Palette, T_IO_Context::Palette, PBM_Decode(), T_IO_Context::Pitch, PIXEL_SIMPLE, PIXEL_TALL, PIXEL_TALL3, PIXEL_WIDE, Pre_load(), T_Components::R, RAST_chunk_decode(), Read_byte(), Read_bytes(), Read_dword_be(), Read_word_be(), T_IFF_AnimHeader::reltime, Set_frame_duration(), Set_IFF_color(), Set_image_mode(), Set_loading_layer(), T_Color_cycle::Speed, T_Color_cycle::Start, T_IFF_PCHG_Palette::StartLine, SWAP_BYTES, T_IO_Context::Target_address, T_IFF_Header::Transp_col, T_IO_Context::Transparent_color, T_IO_Context::Type, T_IFF_AnimHeader::w, T_IFF_Header::Width, T_IO_Context::Width, T_IFF_AnimHeader::x, T_IFF_Header::X_aspect, T_IFF_Header::X_org, T_IFF_Header::X_screen, T_IFF_AnimHeader::y, T_IFF_Header::Y_aspect, T_IFF_Header::Y_org, and T_IFF_Header::Y_screen.

◆ Save_IFF()