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 52 // Picture formats 53 B_DXF_FORMAT = 'DXF ', 54 B_EPS_FORMAT = 'EPS ', 55 B_PICT_FORMAT = 'PICT', 56 57 // Sound formats 58 B_WAV_FORMAT = 'WAV ', 59 B_AIFF_FORMAT = 'AIFF', 60 B_CD_FORMAT = 'CD ', 61 B_AU_FORMAT = 'AU ', 62 63 // Text formats 64 B_STYLED_TEXT_FORMAT = 'STXT' 65 }; 66 67 68 // Bitmap format (always in big endian) 69 struct TranslatorBitmap { 70 uint32 magic; // B_TRANSLATOR_BITMAP 71 BRect bounds; 72 uint32 rowBytes; 73 color_space colors; 74 uint32 dataSize; 75 76 // actual data follows 77 }; 78 79 80 // Sound format (always in big endian) 81 struct TranslatorSound { 82 uint32 magic; // B_TRANSLATOR_SOUND 83 uint32 channels; 84 float sampleFreq; 85 uint32 numFrames; 86 87 // actual data follows 88 }; 89 90 91 // Text format (always in big endian) 92 struct TranslatorStyledTextRecordHeader { 93 uint32 magic; 94 uint32 header_size; 95 uint32 data_size; 96 }; 97 98 struct TranslatorStyledTextStreamHeader { 99 enum { 100 STREAM_HEADER_MAGIC = 'STXT' 101 }; 102 103 TranslatorStyledTextRecordHeader header; 104 int32 version; 105 }; 106 107 struct TranslatorStyledTextTextHeader { 108 enum { 109 TEXT_HEADER_MAGIC = 'TEXT' 110 }; 111 112 TranslatorStyledTextRecordHeader header; 113 int32 charset; 114 115 // actual data follows 116 }; 117 118 struct TranslatorStyledTextStyleHeader { 119 enum { 120 STYLE_HEADER_MAGIC = 'STYL' 121 }; 122 123 TranslatorStyledTextRecordHeader header; 124 uint32 apply_offset; 125 uint32 apply_length; 126 127 // flattened style follows 128 }; 129 130 131 #endif // _TRANSLATOR_FORMATS_H 132