demOS

- Main Page
- Modules
- Data Structures
- Files

- File List

All Data Structures Files Modules Pages
SURFACE.H
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------ -----------------
2 Copyright J.Hubert 2015
3
4 This file is part of demOS
5
6 demOS is free software: you can redistribute it and/or modify it under the terms of
7 the GNU Lesser General Public License as published by the Free Software Foundation,
8 either version 3 of the License, or (at your option) any later version.
9
10 demOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY ;
11 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 See the GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License along with demOS.
15 If not, see <http://www.gnu.org/licenses/>.
16 ------------------------------------------------------------------------------------------------- */
17
30 #ifndef SURFACE_H
31 #define SURFACE_H
32
33 #include "DEMOSDK\BASTYPES.H"
34
35 #define BIT_DEFAULT_PITCH 0xFFFF
36
37 ENUM(BITlutFormat)
38 {
39 BITlutFormat_BnW,
40 BITlutFormat_STe,
41 BITlutFormat_444,
42 BITlutFormat_x888
43 };
44
45 UNION(BITlutPtr)
46 {
47 void* p;
48 u16* p16;
49 u32* p32;
50 };
51
52 STRUCT(BITlut)
53 {
54 MEMallocator* allocator;
55 BITlutFormat format;
56 BITlutPtr data;
57 u16 size;
58 bool bufferowner;
59 };
60
61 #define BITlutConstruct(INSTANCE_PTR) DEFAULT_CONSTRUCT(INSTANCE_PTR)
62
63 void BITlutDestroy (BITlut* _lut);
64 void BITlutInit (MEMallocator* _allocator, BITlut* _lut, BITlutFormat _format, u16 _lutSize);
65 void BITlutSet (MEMallocator* _allocator, BITlut* _lut, BITlutFormat _format, void* _lutData, u16 _lutSize);
66 void BITlutSetExternal (BITlut* _lut, BITlutFormat _format, void* _lutData, u16 _lutSize);
67 void BITlutConvert (MEMallocator* _allocator, BITlut* _source, BITlut* _dest, BITlutFormat _destFormat);
68
69 ENUM(BITformat)
70 {
71 BITformat_Chunk4P,
72 BITformat_Chunk3P,
73 BITformat_Chunk2P,
74 BITformat_Plane1P,
75 BITformat_Plane2P,
76 BITformat_Plane3P,
77 BITformat_Plane4P,
78 BITformat_4bits,
79 BITformat_8bits,
80 BITformat_888,
81 BITformat_x888,
82
83 BITformat_NBMAX
84 };
85
86 STRUCT(BITsurface)
87 {
88 u8* buffer;
89 u16 width;
90 u16 height;
91 u16 pitch;
92 u32 size;
93 u16 nbPlanes;
94 BITformat format;
95 BITlut lut;
96 bool bufferowner;
97
98 MEMallocator* allocator;
99 };
100
101 #define BITsurfaceConstruct(INSTANCE_PTR) DEFAULT_CONSTRUCT(INSTANCE_PTR)
102
103 void BITsurfaceDestroy (BITsurface* _surface);
104 void BITsurfaceInit (MEMallocator* _allocator, BITsurface* _surface, BITformat _format, u16 _w, u16 _h, u16 _pitch);
105 void BITsurfaceSetExternal (BITsurface* _surface, void* _buffer, BITformat _format, u16 _w, u16 _h, u16 _pitch);
106 void BITsurfaceConvert (MEMallocator* _allocator, BITsurface* _source, BITsurface* _dest, BITformat _destFormat);
107 void BITsurfaceClear (BITsurface* _surface);
108 void BITsurfaceFSErrorDiffuse (MEMallocator* _allocator, BITsurface* _surface, u16 _rbits, u16 _gbits, u16 _bbits);
109
110 #endif
MEMallocator
Definition: BASTYPES.H:125
BITsurface
Definition: SURFACE.H:86
BITlut
Definition: SURFACE.H:52
BITlutPtr
Definition: SURFACE.H:45
BASTYPES.H
BASTYPES