* Rewrote last Translation Kit header.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32757 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,16 +1,7 @@
|
|||||||
/********************************************************************************
|
/*
|
||||||
/
|
* Copyright 2009, Haiku Inc. All Rights Reserved.
|
||||||
/ File: TranslatorFormats.h
|
* Distributed under the terms of the MIT License.
|
||||||
/
|
*/
|
||||||
/ Description: Defines for common "lowest common denominator" formats
|
|
||||||
/ used in the Translation Kit.
|
|
||||||
/
|
|
||||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
|
||||||
/ Copyright 1995-1997, Jon Watte
|
|
||||||
/
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _TRANSLATOR_FORMATS_H
|
#ifndef _TRANSLATOR_FORMATS_H
|
||||||
#define _TRANSLATOR_FORMATS_H
|
#define _TRANSLATOR_FORMATS_H
|
||||||
|
|
||||||
@@ -18,9 +9,8 @@
|
|||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
|
|
||||||
/* extensions used in the extension BMessage. Use of these */
|
|
||||||
/* is described in the documentation. */
|
|
||||||
|
|
||||||
|
// Standard fields for the extension message
|
||||||
extern char B_TRANSLATOR_EXT_HEADER_ONLY[];
|
extern char B_TRANSLATOR_EXT_HEADER_ONLY[];
|
||||||
extern char B_TRANSLATOR_EXT_DATA_ONLY[];
|
extern char B_TRANSLATOR_EXT_DATA_ONLY[];
|
||||||
extern char B_TRANSLATOR_EXT_COMMENT[];
|
extern char B_TRANSLATOR_EXT_COMMENT[];
|
||||||
@@ -34,44 +24,23 @@ extern char B_TRANSLATOR_EXT_SOUND_MONO[];
|
|||||||
extern char B_TRANSLATOR_EXT_SOUND_MARKER[];
|
extern char B_TRANSLATOR_EXT_SOUND_MARKER[];
|
||||||
extern char B_TRANSLATOR_EXT_SOUND_LOOP[];
|
extern char B_TRANSLATOR_EXT_SOUND_LOOP[];
|
||||||
|
|
||||||
#if defined(_DATATYPES_COMPATIBLE_)
|
|
||||||
#define kCommentExtension "/comment"
|
|
||||||
#define kTimeExtension "/time"
|
|
||||||
#define kFrameExtension "/frame"
|
|
||||||
#define kBitsRectExtension "bits/Rect"
|
|
||||||
#define kBitsSpaceExtension "bits/space"
|
|
||||||
#define kHeaderExtension "/headerOnly"
|
|
||||||
#define kDataExtension "/dataOnly"
|
|
||||||
#define kNoisChannelExtension "nois/channel"
|
|
||||||
#define kNoisMonoExtension "nois/mono"
|
|
||||||
#define kNoisMarkerExtension "nois/marker"
|
|
||||||
#define kNoisLoopExtension "nois/loop"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
// Standard formats
|
||||||
|
|
||||||
/* For each data group, there is a "standard" format that */
|
|
||||||
/* all translators should support. */
|
|
||||||
/* These type codes are lower-case because they are already */
|
|
||||||
/* established standards in the Be developer community. */
|
|
||||||
enum TranslatorGroups {
|
enum TranslatorGroups {
|
||||||
B_TRANSLATOR_BITMAP = 'bits', /* TranslatorBitmap */
|
B_TRANSLATOR_BITMAP = 'bits',
|
||||||
B_TRANSLATOR_PICTURE = 'pict', /* BPicture data */
|
B_TRANSLATOR_PICTURE = 'pict',
|
||||||
B_TRANSLATOR_TEXT = 'TEXT', /* B_ASCII_TYPE */
|
B_TRANSLATOR_SOUND = 'nois',
|
||||||
B_TRANSLATOR_SOUND = 'nois', /* TranslatorSound */
|
B_TRANSLATOR_TEXT = 'TEXT',
|
||||||
B_TRANSLATOR_MIDI = 'midi', /* standard MIDI */
|
B_TRANSLATOR_MIDI = 'midi',
|
||||||
B_TRANSLATOR_MEDIA = 'mhi!', /* a stream of stuff */
|
B_TRANSLATOR_MEDIA = 'mhi!',
|
||||||
B_TRANSLATOR_NONE = 'none',
|
B_TRANSLATOR_NONE = 'none',
|
||||||
B_TRANSLATOR_ANY_TYPE = 0
|
B_TRANSLATOR_ANY_TYPE = 0
|
||||||
};
|
};
|
||||||
#if defined(_DATATYPES_COMPATIBLE_)
|
|
||||||
#define kAnyType 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* some pre-defined data format type codes */
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/* bitmap formats (B_TRANSLATOR_BITMAP) */
|
// Bitmap formats
|
||||||
B_GIF_FORMAT = 'GIF ',
|
B_GIF_FORMAT = 'GIF ',
|
||||||
B_JPEG_FORMAT = 'JPEG',
|
B_JPEG_FORMAT = 'JPEG',
|
||||||
B_PNG_FORMAT = 'PNG ',
|
B_PNG_FORMAT = 'PNG ',
|
||||||
@@ -80,100 +49,83 @@ enum {
|
|||||||
B_BMP_FORMAT = 'BMP ',
|
B_BMP_FORMAT = 'BMP ',
|
||||||
B_TIFF_FORMAT = 'TIFF',
|
B_TIFF_FORMAT = 'TIFF',
|
||||||
|
|
||||||
/* line drawing formats (B_TRANSLATOR_PICTURE) */
|
// Picture formats
|
||||||
B_DXF_FORMAT = 'DXF ',
|
B_DXF_FORMAT = 'DXF ',
|
||||||
B_EPS_FORMAT = 'EPS ',
|
B_EPS_FORMAT = 'EPS ',
|
||||||
B_PICT_FORMAT = 'PICT', /* MacOS PICT file */
|
B_PICT_FORMAT = 'PICT',
|
||||||
|
|
||||||
/* sound file formats (B_TRANSLATOR_SOUND) */
|
// Sound formats
|
||||||
B_WAV_FORMAT = 'WAV ',
|
B_WAV_FORMAT = 'WAV ',
|
||||||
B_AIFF_FORMAT = 'AIFF',
|
B_AIFF_FORMAT = 'AIFF',
|
||||||
B_CD_FORMAT = 'CD ', /* 44 kHz, stereo, 16 bit, linear, big-endian */
|
B_CD_FORMAT = 'CD ',
|
||||||
B_AU_FORMAT = 'AU ', /* Sun ulaw */
|
B_AU_FORMAT = 'AU ',
|
||||||
|
|
||||||
/* text file formats (B_TRANSLATOR_TEXT) */
|
// Text formats
|
||||||
B_STYLED_TEXT_FORMAT = 'STXT'
|
B_STYLED_TEXT_FORMAT = 'STXT'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Bitmap format (always in big endian)
|
||||||
/* This is the standard bitmap format */
|
|
||||||
/* Note that data is always in big-endian format in the stream! */
|
|
||||||
struct TranslatorBitmap {
|
struct TranslatorBitmap {
|
||||||
uint32 magic; /* B_TRANSLATOR_BITMAP */
|
uint32 magic; // B_TRANSLATOR_BITMAP
|
||||||
BRect bounds;
|
BRect bounds;
|
||||||
uint32 rowBytes;
|
uint32 rowBytes;
|
||||||
color_space colors;
|
color_space colors;
|
||||||
uint32 dataSize;
|
uint32 dataSize;
|
||||||
}; /* data follows, padded to rowBytes */
|
|
||||||
|
|
||||||
/* This is the standard sound format */
|
// actual data follows
|
||||||
/* Note that data is always in big-endian format in the stream! */
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Sound format (always in big endian)
|
||||||
struct TranslatorSound {
|
struct TranslatorSound {
|
||||||
uint32 magic; /* B_TRANSLATOR_SOUND */
|
uint32 magic; // B_TRANSLATOR_SOUND
|
||||||
uint32 channels; /* Left should always be first */
|
uint32 channels;
|
||||||
float sampleFreq; /* 16 bit linear is assumed */
|
float sampleFreq;
|
||||||
uint32 numFrames;
|
uint32 numFrames;
|
||||||
}; /* data follows */
|
|
||||||
|
|
||||||
/* This is the standard styled text format */
|
// actual data follows
|
||||||
/* Note that it is of group type text! */
|
};
|
||||||
/* Skip any records types you don't know about. */
|
|
||||||
/* Always big-endian. */
|
|
||||||
|
// Text format (always in big endian)
|
||||||
struct TranslatorStyledTextRecordHeader {
|
struct TranslatorStyledTextRecordHeader {
|
||||||
uint32 magic;
|
uint32 magic;
|
||||||
uint32 header_size;
|
uint32 header_size;
|
||||||
uint32 data_size;
|
uint32 data_size;
|
||||||
}; /* any number of records */
|
};
|
||||||
|
|
||||||
struct TranslatorStyledTextStreamHeader {
|
struct TranslatorStyledTextStreamHeader {
|
||||||
#if defined(__cplusplus)
|
|
||||||
enum {
|
enum {
|
||||||
STREAM_HEADER_MAGIC = 'STXT'
|
STREAM_HEADER_MAGIC = 'STXT'
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
TranslatorStyledTextRecordHeader header;
|
TranslatorStyledTextRecordHeader header;
|
||||||
int32 version; /* 100 */
|
int32 version;
|
||||||
}; /* no data for this header */
|
};
|
||||||
|
|
||||||
struct TranslatorStyledTextTextHeader {
|
struct TranslatorStyledTextTextHeader {
|
||||||
#if defined(__cplusplus)
|
|
||||||
enum {
|
enum {
|
||||||
TEXT_HEADER_MAGIC = 'TEXT'
|
TEXT_HEADER_MAGIC = 'TEXT'
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
TranslatorStyledTextRecordHeader header;
|
TranslatorStyledTextRecordHeader header;
|
||||||
int32 charset; /* Always write B_UTF8 for now! */
|
int32 charset;
|
||||||
}; /* text data follows */
|
|
||||||
|
// actual data follows
|
||||||
|
};
|
||||||
|
|
||||||
struct TranslatorStyledTextStyleHeader {
|
struct TranslatorStyledTextStyleHeader {
|
||||||
#if defined(__cplusplus)
|
|
||||||
enum {
|
enum {
|
||||||
STYLE_HEADER_MAGIC = 'STYL'
|
STYLE_HEADER_MAGIC = 'STYL'
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
TranslatorStyledTextRecordHeader header;
|
TranslatorStyledTextRecordHeader header;
|
||||||
uint32 apply_offset;
|
uint32 apply_offset;
|
||||||
uint32 apply_length;
|
uint32 apply_length;
|
||||||
}; /* flattened R3 BTextView style records for preceding text */
|
|
||||||
#if 0
|
// flattened style follows
|
||||||
/* format of the STYL record data (always big-endian) FYI: */
|
|
||||||
struct {
|
|
||||||
uchar magic[4]; /* 41 6c 69 21 */
|
|
||||||
uchar version[4]; /* 00 00 00 00 */
|
|
||||||
int32 count;
|
|
||||||
struct {
|
|
||||||
int32 offset;
|
|
||||||
char family[64];
|
|
||||||
char style[64];
|
|
||||||
float size;
|
|
||||||
float shear; /* typically 90.0 */
|
|
||||||
uint16 face; /* typically 0 */
|
|
||||||
uint8 red;
|
|
||||||
uint8 green;
|
|
||||||
uint8 blue;
|
|
||||||
uint8 alpha; /* 255 == opaque */
|
|
||||||
uint16 _reserved_; /* 0 */
|
|
||||||
} styles[];
|
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _TRANSLATOR_FORMATS_H */
|
|
||||||
|
|
||||||
|
#endif // _TRANSLATOR_FORMATS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user