-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathGifBlockWriter.h
56 lines (37 loc) · 2.23 KB
/
GifBlockWriter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// Created by succlz123 on 17-9-6.
//
#ifndef BURSTLINKER_GIFBLOCKWRITER_H
#define BURSTLINKER_GIFBLOCKWRITER_H
#include <fstream>
#include <list>
#include <vector>
#include "GifEncoder.h"
namespace blk {
class GifBlockWriter {
public:
static void writeHeaderBlock(std::ofstream &file);
static void writeLogicalScreenDescriptorBlock(std::ofstream &file, int32_t logicalScreenWidth,
int32_t logicalScreenHeight,
bool globalColorTable, int32_t colorResolution, bool sort,
int32_t globalColorTableSize,
int32_t backgroundColorIndex, int32_t pixelAspectRatio);
static void writeNetscapeLoopingExtensionBlock(std::ofstream &file, uint32_t loopCount);
static void writeGraphicsControlExtensionBlock(std::vector<uint8_t> &content, int32_t disposalMethod,
bool userInput, bool transparentColor, int32_t delayCentiseconds,
int32_t transparentColorIndex);
static void writeImageDescriptorBlock(std::vector<uint8_t> &content, uint16_t imageLeft, uint16_t imageTop,
uint16_t imageWidth,
uint16_t imageHeight,
bool localColorTable, bool interlace, bool sort,
int localColorTableSize);
static int32_t paddedSize(int32_t size);
static void
writeColorTableEntity(std::vector<uint8_t> &content, const std::vector<ARGB> &quantize, int paddedSize);
static void writeColorTableTransparency(std::vector<uint8_t> &content, uint8_t r, uint8_t g, uint8_t b);
static void writeColorTableUnpadded(std::vector<uint8_t> &content, int unpaddedSize, int paddedSize);
static void writeImageDataBlock(std::ofstream &file, uint8_t colorDepth, std::list<uint8_t *> lzw, int lzwSize);
static void writeTerminator(std::ofstream &file);
};
}
#endif //BURSTLINKER_GIFBLOCKWRITER_H