Debian Codegraph @

2dlib/lib2d.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /* internal header to 2dlib
20
21 */
22
23 #ifndef LIB2D_H
24 #define LIB2D_H
25
26 #include "gr.h"
27 #include "renderer.h"
28
29 // structures
30
31 struct mem_bitmap {
32 char *data;
33 int16_t bpp;
34 int rowsize;
35 uint16_t alloced : 2;
36 uint16_t flag : 14;
37 };
38
39 #define MEMFLAG_TRANSBLT 1
40
41 // ---------------------------------------------------------------------------
42 // Line Drawing Functions
43
44 void gr_Line(gr_pen *pen, int x1, int y1, int x2, int y2);
45 void gr_HLine(gr_pen *pen, int x1, int x2, int y);
46 void gr_VLine(gr_pen *pen, int y1, int y2, int x);
47 void gr_Rect(gr_pen *pen, int l, int t, int r, int b);
48 void gr_FillRect(gr_pen *pen, int l, int t, int r, int b);
49
50 // ---------------------------------------------------------------------------
51 // Memory surface functions
52
53 bool gr_mem_surf_Create(ddgr_surface *sf);
54 bool gr_mem_surf_Destroy(ddgr_surface *sf);
55
56 // generic clearing functions
57 void gr_mem_surf_Clear(ddgr_surface *dsf, ddgr_color col, int l, int t, int w, int h);
58
59 // non-scaling bitmap blt functions
60 bool gr_mem_surf_Blt(ddgr_surface *dsf, int dx, int dy, ddgr_surface *ssf, int sx, int sy, int sw, int sh);
61
62 // retrieves a pointer to surface memory. allowed to lock one surface multiple times.
63 bool gr_mem_surf_Lock(ddgr_surface *sf, void **ptr, int *rowsize);
64 bool gr_mem_surf_Unlock(ddgr_surface *sf, void *ptr);
65
66 // initializes a surface based of preinitialized objects by the user.
67 bool gr_mem_surf_Init(ddgr_surface *sf, char *data, int rowsize);
68
69 #endif