GrafX2 2.9.3227
The ultimate 256-color painting program
oldies.c File Reference
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include "struct.h"
#include "oldies.h"
#include "global.h"
#include "errors.h"
#include "io.h"
#include "misc.h"
#include "palette.h"
#include "pages.h"
#include "windows.h"
#include "layers.h"
#include "graph.h"
#include "bitcount.h"
#include "loadsavefuncs.h"
+ Include dependency graph for oldies.c:

Functions

const char * Constraint_mode_label (enum IMAGE_MODES mode)
 identifier for each Image mode More...
 
int Constraint_mode_from_label (const char *label)
 Search constraint mode for a label. More...
 
int C64_FLI (T_IO_Context *context, byte *bitmap, byte *screen_ram, byte *color_ram, byte *background)
 Save a 3 layer picture to C64 FLI format. More...
 
int C64_pixels_to_FLI (byte *bitmap, byte *screen_ram, byte *color_ram, byte *background, const byte *pixels, long pitch, int errmode)
 Convert a (1 layer) picture to C64 FLI format. More...
 
void C64_set_palette (T_Components *palette)
 Set the 16 colors Commodore 64 palette. More...
 
void ZX_Spectrum_set_palette (T_Components *palette)
 Set the 16 colors ZX Spectrum palette. More...
 
void CPC_set_HW_palette (T_Components *palette)
 Set 32 color HW Amstrad CPC palette. More...
 
int CPC_compare_colors (T_Components *col1, T_Components *col2)
 compare two RGB colors More...
 
int CPC_is_CPC_old_color (T_Components *col)
 Check if the color is likely to be a CPC RGB tri level color. More...
 
void CPC_set_default_BASIC_palette (T_Components *palette)
 Set 16 color default Amstrad CPC BASIC palette. More...
 
byte CPC_Firmware_to_Hardware_color (byte fw_color)
 Convert CPC firmware color to hardware color (Gate Array) More...
 
int CPC_check_AMSDOS (FILE *file, word *loading_address, word *exec_address, unsigned long *file_length)
 Check AMSDOS header. More...
 
int CPC_write_AMSDOS_header (FILE *file, const char *filename, const char *ext, byte type, word load_address, word exec_address, word file_length)
 Write AMSDOS header. More...
 
int DECB_Check_binary_file (FILE *f)
 Check if the file is in the DECB Binary format. More...
 
int MOTO_Check_binary_file (FILE *f)
 Checks if the file is a Thomson binary file (SAVEM/LOADM format) More...
 
int DECB_BIN_Add_Chunk (FILE *f, word size, word address, const byte *data)
 Add a chunk to a DECB binary file. More...
 
int DECB_BIN_Add_End (FILE *f, word address)
 Add a chunk to a DECB binary file. More...
 
word MOTO_gamma_correct_RGB_to_MOTO (const T_Components *color)
 Convert a RGB value to Thomson BGR value with gamma correction. More...
 
void MOTO_gamma_correct_MOTO_to_RGB (T_Components *color, word bgr)
 Convert a Thomson BGR value to RGB values with gamma correction. More...
 
void MOTO_set_MO5_palette (T_Components *palette)
 Set MO5 Palette. More...
 
void MOTO_set_TO7_palette (T_Components *palette)
 Set TO7/70 Palette. More...
 
void HGR_set_palette (T_Components *palette)
 Set the 6 color Apple II HGR palette. More...
 
void DHGR_set_palette (T_Components *palette)
 Set the 16 color Apple II DHGR palette. More...
 
void MSX_set_palette (T_Components *palette)
 Set the 15 color MSX palette. More...
 

Variables

struct {
   enum IMAGE_MODES   mode
 
   const char *   label
 
image_modes_labels []
 
static const T_Components CPC_Hw_Palette []
 
static const byte CPC_Firmware_Colors []
 The CPC firmware palette is ordered by luminosity see http://www.cpcwiki.eu/index.php/CPC_Palette. More...
 

Function Documentation

◆ Constraint_mode_label()

const char * Constraint_mode_label ( enum IMAGE_MODES  mode)

identifier for each Image mode

Returns
an ASCII label for the mode

References image_modes_labels, mode, and NULL.

Referenced by Save_GIF().

◆ Constraint_mode_from_label()

int Constraint_mode_from_label ( const char *  label)

Search constraint mode for a label.

Returns
-1 for unknown mode or one of IMAGE_MODES value

References image_modes_labels, and label.

Referenced by Load_GIF().

◆ MSX_set_palette()

void MSX_set_palette ( T_Components palette)

Set the 15 color MSX palette.

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

Referenced by Button_Constraint_menu(), and Load_MSX().

Variable Documentation

◆ mode

◆ label

◆ 

const struct { ... } image_modes_labels[]
Initial value:
= {
{ IMAGE_MODE_LAYERED, "LAYERED" },
{ IMAGE_MODE_ANIMATION, "ANIMATION" },
{ IMAGE_MODE_ZX, "ZX_SPECTRUM" },
{ IMAGE_MODE_GBC, "GAMEBOYCOLOR" },
{ IMAGE_MODE_THOMSON, "THOMSON40COL" },
{ IMAGE_MODE_EGX, "CPC_EGX" },
{ IMAGE_MODE_EGX2, "CPC_EGX2" },
{ IMAGE_MODE_MODE5, "CPC_MODE5" },
{ IMAGE_MODE_RASTER, "CPC_RASTER" },
{ IMAGE_MODE_C64HIRES, "C64_HIRES" },
{ IMAGE_MODE_C64MULTI, "C64_MULTICOLOR" },
{ IMAGE_MODE_C64FLI, "C64_FLI" },
{ IMAGE_MODE_HGR, "APPLE2_HGR" },
{ IMAGE_MODE_DHGR, "APPLE2_DHGR" },
{ IMAGE_MODE_MEGADRIVE, "SEGAMEGADRIVE" },
{ IMAGE_MODE_TMS9918G2, "TMS9918_G2" },
}
@ IMAGE_MODE_ZX
ZX Spectrum (note "SPECTRUM" is kept for later... Spectrum 512 anyone?)
Definition: const.h:607
@ IMAGE_MODE_DHGR
Apple 2 DHGR.
Definition: const.h:618
@ IMAGE_MODE_LAYERED
Layered image.
Definition: const.h:605
@ IMAGE_MODE_C64MULTI
C64 Multicolor.
Definition: const.h:615
@ IMAGE_MODE_EGX
CPC EGX.
Definition: const.h:610
@ IMAGE_MODE_C64HIRES
C64 HiRes.
Definition: const.h:614
@ IMAGE_MODE_MODE5
CPC mode 5.
Definition: const.h:612
@ IMAGE_MODE_HGR
Apple 2 HGR.
Definition: const.h:617
@ IMAGE_MODE_RASTER
CPC generic rasters.
Definition: const.h:613
@ IMAGE_MODE_ANIMATION
Animation.
Definition: const.h:606
@ IMAGE_MODE_C64FLI
C64 Flexible Line Interpretation.
Definition: const.h:616
@ IMAGE_MODE_GBC
Game Boy Color.
Definition: const.h:608
@ IMAGE_MODE_MEGADRIVE
Sega Mega Drive / Genesis.
Definition: const.h:619
@ IMAGE_MODE_TMS9918G2
TMS9918 Mode 2 (MSX, ColecoVision, SC-3000, etc.)
Definition: const.h:620
@ IMAGE_MODE_EGX2
CPC EGX2.
Definition: const.h:611
@ IMAGE_MODE_THOMSON
"40 columns" mode on Thomson machines
Definition: const.h:609

Referenced by Constraint_mode_from_label(), and Constraint_mode_label().

◆ CPC_Hw_Palette

const T_Components CPC_Hw_Palette[]
static

◆ CPC_Firmware_Colors

const byte CPC_Firmware_Colors[]
static
Initial value:
= {
0x54, 0x44, 0x55, 0x5c, 0x58, 0x5d, 0x4c, 0x45, 0x4d,
0x56, 0x46, 0x57, 0x5e, 0x40, 0x5f, 0x4e, 0x47, 0x4f,
0x52, 0x42, 0x53, 0x5a, 0x59, 0x5b, 0x4a, 0x43, 0x4b
}

The CPC firmware palette is ordered by luminosity see http://www.cpcwiki.eu/index.php/CPC_Palette.

Referenced by CPC_Firmware_to_Hardware_color().