tcp: Add APICall trace entry and move TRACEs into locked parts.
[haiku.git] / src / add-ons / translators / gif / GIFSave.h
blob73ba0ce462aac348334e77cf3c2d384953ba535a
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: GIFSave.h
4 //
5 // Date: December 1999
6 //
7 // Author: Daniel Switkin
8 //
9 // Copyright 2003 (c) by Daniel Switkin. This file is made publically available
10 // under the BSD license, with the stipulations that this complete header must
11 // remain at the top of the file indefinitely, and credit must be given to the
12 // original author in any about box using this software.
14 ////////////////////////////////////////////////////////////////////////////////
16 // Additional authors: Stephan Aßmus, <superstippi@gmx.de>
17 // Philippe Saint-Pierre, <stpere@gmail.com>
18 // John Scipione, <jscipione@gmail.com>
20 #ifndef GIF_SAVE_H
21 #define GIF_SAVE_H
24 #include <DataIO.h>
25 #include <Bitmap.h>
26 #include "SavePalette.h"
27 #include "SFHash.h"
29 #include "GIFTranslator.h"
32 #define HASHSIZE 9973
33 #define HASHSTEP 2039
35 #define HASH(index, lastbyte) (((lastbyte << 8) ^ index) % HASHSIZE)
38 class GIFSave {
39 public:
40 GIFSave(BBitmap* bitmap, BPositionIO* output,
41 TranslatorSettings* settings);
42 virtual ~GIFSave();
44 bool fatalerror;
46 private:
47 status_t WriteGIFHeader();
48 status_t WriteGIFControlBlock();
49 status_t WriteGIFImageHeader();
50 status_t WriteGIFImageData();
51 status_t OutputCode(short code, int BITS,
52 bool flush = false);
54 unsigned char NextPixel(int pixel);
55 void InitFrame();
56 void ResetHashtable();
57 int CheckHashtable(int s, unsigned char c);
58 void AddToHashtable(int s, unsigned char c);
60 BPositionIO* output;
61 BBitmap* bitmap;
62 SavePalette* palette;
63 SFHash* hash;
64 TranslatorSettings* fSettings;
66 short* code_value;
67 short* prefix_code;
69 unsigned char* append_char;
70 int BITS;
71 int max_code;
72 char code_size;
73 short clear_code;
74 short end_code;
75 short next_code;
76 int string_code;
77 unsigned char character;
78 int table_size;
80 int bit_count;
81 unsigned int bit_buffer;
82 int byte_count;
83 unsigned char byte_buffer[257];
84 int pass;
85 int row;
86 int pos;
88 unsigned char* gifbits;
90 int width;
91 int height;
93 // For dithering
94 int32* red_error;
95 int32* green_error;
96 int32* blue_error;
98 int16 red_side_error;
99 int16 green_side_error;
100 int16 blue_side_error;
104 #endif // GIF_SAVE_H