/*
 * @(#)NeoChromeStructs.txt  1.0  2010-06-25
 *
 * Copyright (c) 2010 Werner Randelshofer, Immensee, Switzerland.
 * All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the
 * license agreement you entered into with Werner Randelshofer.
 * For details see accompanying license terms.
 */

/** NeoChrome *.NEO structs
 * http://wiki.multimedia.cx/index.php?title=Neochrome
 */

/* ============================================
 *
 * Primitive Data Types
 *
 * ============================================
 */
typedef uint4   uint4_t;
typedef byte   int8_t;
typedef uint8   uint8_t;
typedef int   int16_t;
typedef uint16   uint16_t;
typedef charbyte   char_t;  //  8 bits unsigned
typedef ubyte   ubyte8_t;


/* ============================================
 *
 * NeoChrome header
 *
 * ============================================
 */
magic Header "Header";
description Header "Header", "NeoChrome image header.";

typedef struct {
  ataricolor color;
} hdrColor;

enum {
  lowRes=0,
  mediumRes=1,
  highRes=2
} hdrResolution;

enum {
  dataIsValid=0x80,
  dataIsInvalid=0x0
} hdrColorAnimationFlags;

enum {
  animationIsOn=0x80,
  animationIsOff=0x0
} hdrColorAnimationActive;

typedef struct {
 uint8_t enum hdrColorAnimationFlags flags;
 uint4_t rangeStart;
 uint4_t rangeEnd;
 uint8_t enum hdrColorAnimationActive active;
 int8_t speeddir;
 uint16_t steps;
} ColorAnimation;

typedef struct {
 uint16_t flags;                      /* flag byte [always 0] */
 uint16_t enum hdrResolution resolution; /* 0 = low (320x200x16), 1 = medium (640x200x4), 2 = high (640x400x2) */
 hdrColor palette[16];                /* 9-bit RGB 00000RRR0GGG0BBB */
 char_t[12] filename;                /* 8 '.' 3 */
 ColorAnimation colorAnimation;
 uint16_t xOffset;                   /* always 0 */
 uint16_t yOffset;                   /* always 0 */
 uint16_t width;
 uint16_t height;
 ubyte8_t[33] reserved[2];
} Header;

/* Image Data. */
magic Data "Data";
description Data "Data", "Image data.";
