#include <math.h>
#include <stdlib.h>
#include <memory.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#include <assert.h>
#include <string>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <sstream>
#include <algorithm>
Go to the source code of this file.
|
#define | FIBITMAP_ALIGNMENT 16 |
|
#define | GREY(r, g, b) (BYTE)(((WORD)r * 77 + (WORD)g * 150 + (WORD)b * 29) >> 8) |
|
|
void * | FreeImage_Aligned_Malloc (size_t amount, size_t alignment) |
|
void | FreeImage_Aligned_Free (void *mem) |
|
char * | i2a (unsigned i, char *a, unsigned r) |
|
char * | _itoa (int i, char *a, int r) |
|
unsigned char | HINIBBLE (unsigned char byte) |
|
unsigned char | LOWNIBBLE (unsigned char byte) |
|
int | CalculateUsedBits (int bits) |
|
int | CalculateLine (int width, int bitdepth) |
|
int | CalculatePitch (int line) |
|
int | CalculateUsedPaletteEntries (int bit_count) |
|
unsigned char * | CalculateScanLine (unsigned char *bits, unsigned pitch, int scanline) |
|
void | ReplaceExtension (char *result, const char *filename, const char *extension) |
|
void | SwapShort (WORD *sp) |
|
void | SwapLong (DWORD *lp) |
|
template<class T > |
T | MAX (T a, T b) |
| Max function. More...
|
|
template<class T > |
T | MIN (T a, T b) |
| Min function. More...
|
|
template<class T > |
void | INPLACESWAP (T &a, T &b) |
| INPLACESWAP adopted from codeguru.com. More...
|
|
template<class T > |
void | MAXMIN (const T *L, long n, T &max, T &min) |
|
◆ FIBITMAP_ALIGNMENT
#define FIBITMAP_ALIGNMENT 16 |
◆ GREY
#define GREY |
( |
|
r, |
|
|
|
g, |
|
|
|
b |
|
) |
| (BYTE)(((WORD)r * 77 + (WORD)g * 150 + (WORD)b * 29) >> 8) |
◆ FILE_BGR
◆ FILE_BGRA
◆ FILE_RGB
◆ FILE_RGBA
◆ _itoa()
char* _itoa |
( |
int |
i, |
|
|
char * |
a, |
|
|
int |
r |
|
) |
| |
|
inline |
Transforms integer i into an ascii string and stores the result in a; string is encoded in the base indicated by r.
- Parameters
-
i | Number to be converted |
a | String result |
r | Base of value; must be in the range 2 - 36 |
- Returns
- Returns a
Definition at line 121 of file Utilities.h.
122 r = ((r < 2) || (r > 36)) ? 10 : r;
125 *
i2a(-i, a+1, r) = 0;
127 else *
i2a(i, a, r) = 0;
char * i2a(unsigned i, char *a, unsigned r)
◆ CalculateLine()
int CalculateLine |
( |
int |
width, |
|
|
int |
bitdepth |
|
) |
| |
|
inline |
Definition at line 160 of file Utilities.h.
161 return ((width * bitdepth) + 7) / 8;
◆ CalculatePitch()
int CalculatePitch |
( |
int |
line | ) |
|
|
inline |
◆ CalculateScanLine()
unsigned char* CalculateScanLine |
( |
unsigned char * |
bits, |
|
|
unsigned |
pitch, |
|
|
int |
scanline |
|
) |
| |
|
inline |
Definition at line 178 of file Utilities.h.
179 return (bits + (pitch * scanline));
◆ CalculateUsedBits()
int CalculateUsedBits |
( |
int |
bits | ) |
|
|
inline |
Definition at line 144 of file Utilities.h.
148 for (
unsigned i = 0; i < 32; i++) {
149 if ((bits & bit) == bit) {
◆ CalculateUsedPaletteEntries()
int CalculateUsedPaletteEntries |
( |
int |
bit_count | ) |
|
|
inline |
Definition at line 170 of file Utilities.h.
171 if ((bit_count >= 1) && (bit_count <= 8))
172 return 1 << bit_count;
◆ FreeImage_Aligned_Free()
void FreeImage_Aligned_Free |
( |
void * |
mem | ) |
|
◆ FreeImage_Aligned_Malloc()
void* FreeImage_Aligned_Malloc |
( |
size_t |
amount, |
|
|
size_t |
alignment |
|
) |
| |
◆ HINIBBLE()
unsigned char HINIBBLE |
( |
unsigned char |
byte | ) |
|
|
inline |
◆ i2a()
char* i2a |
( |
unsigned |
i, |
|
|
char * |
a, |
|
|
unsigned |
r |
|
) |
| |
|
inline |
Definition at line 106 of file Utilities.h.
107 if (i/r > 0) a =
i2a(i/r,a,r);
108 *a =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i%r];
char * i2a(unsigned i, char *a, unsigned r)
◆ INPLACESWAP()
template<class T >
void INPLACESWAP |
( |
T & |
a, |
|
|
T & |
b |
|
) |
| |
INPLACESWAP adopted from codeguru.com.
Definition at line 237 of file Utilities.h.
238 a ^= b; b ^= a; a ^= b;
◆ LOWNIBBLE()
unsigned char LOWNIBBLE |
( |
unsigned char |
byte | ) |
|
|
inline |
◆ MAX()
Max function.
Definition at line 227 of file Utilities.h.
228 return (a > b) ? a: b;
◆ MAXMIN()
template<class T >
void MAXMIN |
( |
const T * |
L, |
|
|
long |
n, |
|
|
T & |
max, |
|
|
T & |
min |
|
) |
| |
This procedure computes minimum min and maximum max of n numbers using only (3n/2) - 2 comparisons. min = L[i1] and max = L[i2]. ref: Aho A.V., Hopcroft J.E., Ullman J.D., The design and analysis of computer algorithms, Addison-Wesley, Reading, 1974.
Definition at line 249 of file Utilities.h.
254 i1 = 0; i2 = 0; min = L[0]; max = L[0]; j = 0;
255 if((n % 2) != 0) j = 1;
256 for(i = j; i < n; i+= 2) {
258 x1 = L[k1]; x2 = L[k2];
◆ MIN()
Min function.
Definition at line 232 of file Utilities.h.
233 return (a < b) ? a: b;
◆ ReplaceExtension()
void ReplaceExtension |
( |
char * |
result, |
|
|
const char * |
filename, |
|
|
const char * |
extension |
|
) |
| |
|
inline |
Definition at line 183 of file Utilities.h.
184 for (
size_t i = strlen(filename) - 1; i > 0; --i) {
185 if (filename[i] ==
'.') {
186 memcpy(result, filename, i);
188 memcpy(result + i + 1, extension, strlen(extension) + 1);
193 memcpy(result, filename, strlen(filename));
194 result[strlen(filename)] =
'.';
195 memcpy(result + strlen(filename) + 1, extension, strlen(extension) + 1);
◆ SwapLong()
void SwapLong |
( |
DWORD * |
lp | ) |
|
|
inline |
Definition at line 208 of file Utilities.h.
209 BYTE *cp = (BYTE *)lp, t = cp[0]; cp[0] = cp[3]; cp[3] = t;
210 t = cp[1]; cp[1] = cp[2]; cp[2] = t;
◆ SwapShort()
void SwapShort |
( |
WORD * |
sp | ) |
|
|
inline |
Definition at line 203 of file Utilities.h.
204 BYTE *cp = (BYTE *)sp, t = cp[0]; cp[0] = cp[1]; cp[1] = t;
◆ FI_MSG_ERROR_MEMORY
const char* FI_MSG_ERROR_MEMORY = "Not enough memory" |
|
static |