forked from koreader/koreader-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blitbuffer.h
110 lines (94 loc) · 2.89 KB
/
blitbuffer.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
KOReader: blitbuffer implementation for jit-disabled platforms
Copyright (C) 2011 Hans-Werner Hilse <[email protected]>
2017 Huang Xin <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _BLITBUFFER_H
#define _BLITBUFFER_H
#include <stdint.h>
typedef struct Color8 {
uint8_t a;
} Color8;
typedef struct Color8A {
uint8_t a;
uint8_t alpha;
} Color8A;
typedef struct ColorRGB16 {
uint16_t v;
} ColorRGB16;
typedef struct ColorRGB24 {
uint8_t r;
uint8_t g;
uint8_t b;
} ColorRGB24;
typedef struct ColorRGB32 {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t alpha;
} ColorRGB32;
typedef struct BlitBuffer {
int w;
int h;
int pitch;
uint8_t *data;
uint8_t config;
} BlitBuffer;
typedef struct BlitBuffer8 {
int w;
int h;
int pitch;
Color8 *data;
uint8_t config;
} BlitBuffer8;
typedef struct BlitBuffer8A {
int w;
int h;
int pitch;
Color8A *data;
uint8_t config;
} BlitBuffer8A;
typedef struct BlitBufferRGB16 {
int w;
int h;
int pitch;
ColorRGB16 *data;
uint8_t config;
} BlitBufferRGB16;
typedef struct BlitBufferRGB24 {
int w;
int h;
int pitch;
ColorRGB24 *data;
uint8_t config;
} BlitBufferRGB24;
typedef struct BlitBufferRGB32 {
int w;
int h;
int pitch;
ColorRGB32 *data;
uint8_t config;
} BlitBufferRGB32;
void BB_fill_rect(BlitBuffer *bb, int x, int y, int w, int h, ColorRGB32 *color);
void BB_blend_rect(BlitBuffer *bb, int x, int y, int w, int h, ColorRGB32 *color);
void BB_blit_to(BlitBuffer *source, BlitBuffer *dest, int dest_x, int dest_y,
int offs_x, int offs_y, int w, int h);
void BB_add_blit_from(BlitBuffer *dest, BlitBuffer *source, int dest_x, int dest_y,
int offs_x, int offs_y, int w, int h, uint8_t alpha);
void BB_alpha_blit_from(BlitBuffer *dest, BlitBuffer *source, int dest_x, int dest_y,
int offs_x, int offs_y, int w, int h);
void BB_invert_blit_from(BlitBuffer *dest, BlitBuffer *source, int dest_x, int dest_y,
int offs_x, int offs_y, int w, int h);
void BB_color_blit_from(BlitBuffer *dest, BlitBuffer *source, int dest_x, int dest_y,
int offs_x, int offs_y, int w, int h, ColorRGB32 *color);
#endif