forked from captainjack64/hacktv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphics.h
executable file
·68 lines (58 loc) · 2.25 KB
/
graphics.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
/* hacktv - Analogue video transmitter for the HackRF */
/*=======================================================================*/
/* Copyright 2020 Philip Heron <[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 GRAPHICS_H_
#define GRAPHICS_H_
#include <png.h>
#include "video.h"
#define IMG_POS_CENTRE 0
#define IMG_POS_TL 1
#define IMG_POS_TR 2
#define IMG_POS_BL 3
#define IMG_POS_BR 4
#define IMG_POS_FULL 5
#define IMG_TEST 0
#define IMG_LOGO 1
#define MAX_PNG_SIZE 128
typedef struct {
char *name;
int width;
int height;
int img_width;
int img_height;
uint32_t *logo;
png_bytep *row_pointers;
int position;
} image_t;
typedef struct {
const uint8_t data[MAX_PNG_SIZE * 1024];
} png_t;
typedef struct {
const char *name;
const png_t *png;
const int position;
size_t size;
} pngs_t;
typedef struct {
size_t size;
const uint8_t *data;
const uint8_t *cursor;
} png_mem_t;
extern int read_png_file(image_t *image);
extern void overlay_image(uint32_t *framebuffer, image_t *l, int vid_width, int vid_height, int pos);
extern int load_png(image_t *image, int width, int height, char *filename, float scale, float ratio, int type);
extern void resize_bitmap(uint32_t *input, uint32_t *output, int old_width, int old_height, int new_width, int new_height);
#endif