gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
gl2gif.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef GL2GIF_H
7 #define GL2GIF_H
8 
9 #include <stdio.h>
10 #include "PixelBuffer.h"
11 
12 #define MAX_GIFCOLORS 256
13 
14 /* New types */
15 
16 typedef unsigned int pixval;
17 typedef unsigned long pixel;
18 typedef int code_int;
19 typedef long int count_int;
20 
21 /* PPM handling */
22 
23 #define PPM_GETR(p) (((p)&0x3ff00000) >> 20)
24 #define PPM_GETG(p) (((p)&0xffc00) >> 10)
25 #define PPM_GETB(p) ((p)&0x3ff)
26 #define PPM_EQUAL(p, q) ((p) == (q))
27 
28 #define PPM_ASSIGN(p, red, grn, blu) \
29  (p) = ((pixel)(red) << 20) | ((pixel)(grn) << 10) | (pixel)(blu)
30 
31 #define PPM_LUMIN(p) \
32  (0.299 * PPM_GETR(p) + 0.587 * PPM_GETG(p) + 0.114 * PPM_GETB(p))
33 
34 #define PPM_DEPTH(newp, p, oldmaxval, newmaxval) \
35  PPM_ASSIGN((newp), \
36  ((int)PPM_GETR(p) * (newmaxval) + (oldmaxval) / 2) / (oldmaxval), \
37  ((int)PPM_GETG(p) * (newmaxval) + (oldmaxval) / 2) / (oldmaxval), \
38  ((int)PPM_GETB(p) * (newmaxval) + (oldmaxval) / 2) / (oldmaxval))
39 
40 /* Public function */
41 
42 void create_gif(FILE *outfile, PixelBuffer *buffer, int dither, int sort,
43  int interlace, int transparency);
44 
45 #endif
PixelBuffer.h
count_int
long int count_int
Definition: gl2gif.h:19
create_gif
void create_gif(FILE *outfile, PixelBuffer *buffer, int dither, int sort, int interlace, int transparency)
Definition: gl2gif.cpp:1110
code_int
int code_int
Definition: gl2gif.h:18
pixval
unsigned int pixval
Definition: gl2gif.h:16
PixelBuffer
Definition: PixelBuffer.h:32
pixel
unsigned long pixel
Definition: gl2gif.h:17