Blender  V2.93
imbuf.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <sys/types.h>
29 
30 #ifndef WIN32
31 # include <unistd.h>
32 #endif
33 
34 #include <fcntl.h>
35 #include <math.h>
36 #include <string.h>
37 #include <sys/stat.h>
38 
39 #ifndef WIN32
40 # include <sys/mman.h>
41 # define O_BINARY 0
42 #endif
43 
44 #define SWAP_SHORT(x) (((x & 0xff) << 8) | ((x >> 8) & 0xff))
45 #define SWAP_LONG(x) \
46  (((x) << 24) | (((x)&0xff00) << 8) | (((x) >> 8) & 0xff00) | (((x) >> 24) & 0xff))
47 
48 #define ENDIAN_NOP(x) (x)
49 
50 #ifdef __BIG_ENDIAN__
51 # define LITTLE_SHORT SWAP_SHORT
52 # define LITTLE_LONG SWAP_LONG
53 # define BIG_SHORT ENDIAN_NOP
54 # define BIG_LONG ENDIAN_NOP
55 #else
56 # define LITTLE_SHORT ENDIAN_NOP
57 # define LITTLE_LONG ENDIAN_NOP
58 # define BIG_SHORT SWAP_SHORT
59 # define BIG_LONG SWAP_LONG
60 #endif
61 
62 #define IMB_DPI_DEFAULT 72.0f