| 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_Hcxx . . $ `2dlib/lib2d.h:24:9`! |
| 25 | |
| 26 | #include "gr.h"cxx . . $ `<file>/2dlib/gr.h`/ |
| 27 | #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/ |
| 28 | |
| 29 | // structures |
| 30 | |
| 31 | struct mem_bitmapcxx . . $ mem_bitmap# { |
| 32 | char *datacxx . . $ mem_bitmap#data.; |
| 33 | int16_t bppcxx . . $ mem_bitmap#bpp.; |
| 34 | int rowsizecxx . . $ mem_bitmap#rowsize.; |
| 35 | uint16_tcxx . . $ uint16_t# allocedcxx . . $ mem_bitmap#alloced. : 2; |
| 36 | uint16_tcxx . . $ uint16_t# flagcxx . . $ mem_bitmap#flag. : 14; |
| 37 | }; |
| 38 | |
| 39 | #define MEMFLAG_TRANSBLTcxx . . $ `2dlib/lib2d.h:39:9`! 1 |
| 40 | |
| 41 | // --------------------------------------------------------------------------- |
| 42 | // Line Drawing Functions |
| 43 | |
| 44 | void gr_Linecxx . . $ gr_Line(3c2484f95ce11f58).(gr_pencxx . . $ gr_pen# *pen, int x1, int y1, int x2, int y2); |
| 45 | void gr_HLinecxx . . $ gr_HLine(fe8b4266a8701af7).(gr_pencxx . . $ gr_pen# *pen, int x1, int x2, int y); |
| 46 | void gr_VLinecxx . . $ gr_VLine(fe8b4266a8701af7).(gr_pencxx . . $ gr_pen# *pen, int y1, int y2, int x); |
| 47 | void gr_Rectcxx . . $ gr_Rect(3c2484f95ce11f58).(gr_pencxx . . $ gr_pen# *pen, int l, int t, int r, int b); |
| 48 | void gr_FillRectcxx . . $ gr_FillRect(3c2484f95ce11f58).(gr_pencxx . . $ gr_pen# *pen, int l, int t, int r, int b); |
| 49 | |
| 50 | // --------------------------------------------------------------------------- |
| 51 | // Memory surface functions |
| 52 | |
| 53 | bool gr_mem_surf_Createcxx . . $ gr_mem_surf_Create(8a7e7c096868029c).(ddgr_surfacecxx . . $ ddgr_surface# *sf); |
| 54 | bool gr_mem_surf_Destroycxx . . $ gr_mem_surf_Destroy(8a7e7c096868029c).(ddgr_surfacecxx . . $ ddgr_surface# *sf); |
| 55 | |
| 56 | // generic clearing functions |
| 57 | void gr_mem_surf_Clearcxx . . $ gr_mem_surf_Clear(18895a2c8f8b731a).(ddgr_surfacecxx . . $ ddgr_surface# *dsf, ddgr_colorcxx . . $ ddgr_color# col, int l, int t, int w, int h); |
| 58 | |
| 59 | // non-scaling bitmap blt functions |
| 60 | bool gr_mem_surf_Bltcxx . . $ gr_mem_surf_Blt(5ac5614b4169eec2).(ddgr_surfacecxx . . $ ddgr_surface# *dsf, int dx, int dy, ddgr_surfacecxx . . $ 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_Lockcxx . . $ gr_mem_surf_Lock(52c8467f55fe71c1).(ddgr_surfacecxx . . $ ddgr_surface# *sf, void **ptr, int *rowsize); |
| 64 | bool gr_mem_surf_Unlockcxx . . $ gr_mem_surf_Unlock(274a3a14c0c4a006).(ddgr_surfacecxx . . $ ddgr_surface# *sf, void *ptr); |
| 65 | |
| 66 | // initializes a surface based of preinitialized objects by the user. |
| 67 | bool gr_mem_surf_Initcxx . . $ gr_mem_surf_Init(29b5e7245e149caf).(ddgr_surfacecxx . . $ ddgr_surface# *sf, char *data, int rowsize); |
| 68 | |
| 69 | #endif |