xref: /haiku/headers/os/translation/TranslatorFormats.h (revision 3d4afef9cba2f328e238089d4609d00d4b1524f3)
1 /*
2  * Copyright 2009, Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _TRANSLATOR_FORMATS_H
6 #define _TRANSLATOR_FORMATS_H
7 
8 
9 #include <GraphicsDefs.h>
10 #include <Rect.h>
11 
12 
13 // Standard fields for the extension message
14 extern char B_TRANSLATOR_EXT_HEADER_ONLY[];
15 extern char B_TRANSLATOR_EXT_DATA_ONLY[];
16 extern char B_TRANSLATOR_EXT_COMMENT[];
17 extern char B_TRANSLATOR_EXT_TIME[];
18 extern char B_TRANSLATOR_EXT_FRAME[];
19 extern char B_TRANSLATOR_EXT_BITMAP_RECT[];
20 extern char B_TRANSLATOR_EXT_BITMAP_COLOR_SPACE[];
21 extern char B_TRANSLATOR_EXT_BITMAP_PALETTE[];
22 extern char B_TRANSLATOR_EXT_SOUND_CHANNEL[];
23 extern char B_TRANSLATOR_EXT_SOUND_MONO[];
24 extern char B_TRANSLATOR_EXT_SOUND_MARKER[];
25 extern char B_TRANSLATOR_EXT_SOUND_LOOP[];
26 
27 
28 // Standard formats
29 
30 enum TranslatorGroups {
31 	B_TRANSLATOR_BITMAP		= 'bits',
32 	B_TRANSLATOR_PICTURE	= 'pict',
33 	B_TRANSLATOR_SOUND		= 'nois',
34 	B_TRANSLATOR_TEXT		= 'TEXT',
35 	B_TRANSLATOR_MIDI		= 'midi',
36 	B_TRANSLATOR_MEDIA		= 'mhi!',
37 	B_TRANSLATOR_NONE		= 'none',
38 	B_TRANSLATOR_ANY_TYPE	= 0
39 };
40 
41 
42 enum {
43 	// Bitmap formats
44 	B_GIF_FORMAT			= 'GIF ',
45 	B_JPEG_FORMAT			= 'JPEG',
46 	B_PNG_FORMAT			= 'PNG ',
47 	B_PPM_FORMAT			= 'PPM ',
48 	B_TGA_FORMAT			= 'TGA ',
49 	B_BMP_FORMAT			= 'BMP ',
50 	B_TIFF_FORMAT			= 'TIFF',
51 	B_WEBP_FORMAT			= 'WebP',
52 
53 	// Picture formats
54 	B_DXF_FORMAT			= 'DXF ',
55 	B_EPS_FORMAT			= 'EPS ',
56 	B_PICT_FORMAT			= 'PICT',
57 
58 	// Sound formats
59 	B_WAV_FORMAT			= 'WAV ',
60 	B_AIFF_FORMAT			= 'AIFF',
61 	B_CD_FORMAT				= 'CD  ',
62 	B_AU_FORMAT				= 'AU  ',
63 
64 	// Text formats
65 	B_STYLED_TEXT_FORMAT	= 'STXT'
66 };
67 
68 
69 // Bitmap format (always in big endian)
70 struct TranslatorBitmap {
71 	uint32		magic;		// B_TRANSLATOR_BITMAP
72 	BRect		bounds;
73 	uint32		rowBytes;
74 	color_space	colors;
75 	uint32		dataSize;
76 
77 	// actual data follows
78 };
79 
80 
81 // Sound format (always in big endian)
82 struct TranslatorSound {
83 	uint32		magic;		// B_TRANSLATOR_SOUND
84 	uint32		channels;
85 	float		sampleFreq;
86 	uint32		numFrames;
87 
88 	// actual data follows
89 };
90 
91 
92 // Text format (always in big endian)
93 struct TranslatorStyledTextRecordHeader {
94 	uint32		magic;
95 	uint32		header_size;
96 	uint32		data_size;
97 };
98 
99 struct TranslatorStyledTextStreamHeader {
100 	enum {
101 		STREAM_HEADER_MAGIC = 'STXT'
102 	};
103 
104 	TranslatorStyledTextRecordHeader header;
105 	int32		version;
106 };
107 
108 struct TranslatorStyledTextTextHeader {
109 	enum {
110 		TEXT_HEADER_MAGIC = 'TEXT'
111 	};
112 
113 	TranslatorStyledTextRecordHeader header;
114 	int32		charset;
115 
116 	// actual data follows
117 };
118 
119 struct TranslatorStyledTextStyleHeader {
120 	enum {
121 		STYLE_HEADER_MAGIC = 'STYL'
122 	};
123 
124 	TranslatorStyledTextRecordHeader header;
125 	uint32		apply_offset;
126 	uint32		apply_length;
127 
128 	// flattened style follows
129 };
130 
131 
132 #endif	// _TRANSLATOR_FORMATS_H
133