fractalsqueeze.h

来自「分形图像压缩源代码」· C头文件 代码 · 共 29 行

H
29
字号
#ifndef FRACTAL_SQUEEZE_H_INCLUDED__
#define FRACTAL_SQUEEZE_H_INCLUDED__

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used Windows cruft

#include <windows.h>

#define GREY_LEVELS 255

#define bound(a)   ((a) < 0.0 ? 0 : ((a)>255.0? 255 : a))
#define IMAGE_TYPE unsigned char

#define ERROROUT(_x) MessageBox(0, _x, "FractalSqueeze", MB_OK | MB_ICONEXCLAMATION)

/* The following #define allocates an hsize x vsize  matrix of type TYPE */
#define matrix_allocate(matrix, hsize, vsize, TYPE) {\
    TYPE *imptr; \
    int _i; \
    matrix = (TYPE **)malloc((vsize)*sizeof(TYPE *));\
    imptr = (TYPE*)malloc((long)(hsize)*(long)(vsize)*sizeof(TYPE));\
    if (imptr == NULL) \
        ERROROUT("\nNo memory in matrix allocate."); \
    for (_i = 0; _i<vsize; ++_i, imptr += hsize) \
        matrix[_i] = imptr; \
 }

#define swap(a,b,TYPE)           {TYPE _temp; _temp=b; b=a; a= _temp;}

#endif //FRACTAL_SQUEEZE_H_INCLUDED__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?