GrafX2 2.9.3227
The ultimate 256-color painting program
2gsformats.c File Reference

Formats for the Apple II GS Support APF = Apple Preferred Format. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "global.h"
#include "fileformats.h"
#include "loadsavefuncs.h"
#include "io.h"
#include "gfx2mem.h"
#include "gfx2log.h"
#include "packbytes.h"
+ Include dependency graph for 2gsformats.c:

Data Structures

struct  line_data
 

Macros

#define COMPONENTS(x)   linepal[x].R, linepal[x].G, linepal[x].B
 
#define WRITE2GS_PIXELS
 set the (2 or 4) pixels for the byte. More...
 

Functions

void Test_2GS (T_IO_Context *context, FILE *file)
 Test for an Apple 2 GS picture file. More...
 
static int Load_2GS_Palette (T_Components *palette, FILE *file)
 Load a 16 entry Apple II GS palette from file. More...
 
void Load_2GS (T_IO_Context *context)
 
static int Save_2GS_Palette_Entry (FILE *file, const T_Components *palette)
 Save a 16 entry Apple II GS palette to file. More...
 
void Save_2GS (T_IO_Context *context)
 

Detailed Description

Formats for the Apple II GS Support APF = Apple Preferred Format.

Macro Definition Documentation

◆ COMPONENTS

#define COMPONENTS (   x)    linepal[x].R, linepal[x].G, linepal[x].B

◆ WRITE2GS_PIXELS

#define WRITE2GS_PIXELS
Value:
if (multipalcount > 0) \
{ \
if (linemode & 0x80) \
{ \
Set_pixel_24b(context, x++, y, COMPONENTS(8 + (pixel >> 6))); \
Set_pixel_24b(context, x++, y, COMPONENTS(12 + ((pixel >> 4) & 3))); \
Set_pixel_24b(context, x++, y, COMPONENTS((pixel >> 2) & 3)); \
Set_pixel_24b(context, x++, y, COMPONENTS(4 + (pixel & 3))); \
} \
else \
{ \
Set_pixel_24b(context, x++, y, COMPONENTS(pixel >> 4)); \
Set_pixel_24b(context, x++, y, COMPONENTS(pixel & 15)); \
} \
} \
else \
{ \
if (linemode & 0x80) \
{ \
Set_pixel(context, x++, y, (linemode << 4) | 8 | (pixel >> 6)); \
Set_pixel(context, x++, y, (linemode << 4) | 12 | ((pixel >> 4) & 3)); \
Set_pixel(context, x++, y, (linemode << 4) | ((pixel >> 2) & 3)); \
Set_pixel(context, x++, y, (linemode << 4) | 4 | (pixel & 3)); \
} \
else \
{ \
Set_pixel(context, x++, y, (linemode << 4) | (pixel >> 4)); \
Set_pixel(context, x++, y, (linemode << 4) | (pixel & 15)); \
} \
}
#define COMPONENTS(x)
Definition: 2gsformats.c:77

set the (2 or 4) pixels for the byte.

Function Documentation

◆ Load_2GS_Palette()

static int Load_2GS_Palette ( T_Components palette,
FILE *  file 
)
static

Load a 16 entry Apple II GS palette from file.

References T_Components::B, T_Components::G, T_Components::R, and Read_word_le().

Referenced by Load_2GS().

◆ Save_2GS_Palette_Entry()

static int Save_2GS_Palette_Entry ( FILE *  file,
const T_Components palette 
)
static

Save a 16 entry Apple II GS palette to file.

References T_Components::B, T_Components::G, T_Components::R, and Write_word_le().

Referenced by Save_2GS().