📄 my_lib.h
字号:
#ifndef MY_JPEG_H#define MY_JPEG_H// TODO - copied from include/allegro/palette.h#ifdef NATIVE_COMPILE#include <stdio.h>#endif //NATIVE_COMPILEtypedef struct RGB{ unsigned char r, g, b; unsigned char filler;} RGB;#define PAL_SIZE 256typedef RGB PALETTE[PAL_SIZE];// BITMAP from gfx.htypedef struct BITMAP /* a bitmap structure */{ // CHANGED int ppm_filesize; int w, h; /* width and height in pixels */ int clip; /* flag if clipping is turned on */ int cl, cr, ct, cb; /* clip left, right, top and bottom values */ // GFX_VTABLE *vtable; /* drawing functions */ void *write_bank; /* C func on some machines, asm on i386 */ void *read_bank; /* C func on some machines, asm on i386 */ // change void* to int* to write words unsigned char *dat; /* the memory we allocated for the bitmap */ unsigned long id; /* for identifying sub-bitmaps */ void *extra; /* points to a structure with more info */ int x_ofs; /* horizontal offset (for sub-bitmaps) */ int y_ofs; /* vertical offset (for sub-bitmaps) */ int seg; /* bitmap segment */ // unsigned char *line[ZERO_SIZE];} BITMAP;#define FALSE 0#define TRUE 1 #ifndef NULL#define NULL 0#endif// TODO - copied from include/allegro/base.h #define MIN(x,y) (((x) < (y)) ? (x) : (y))#define MID(x,y,z) MAX((x), MIN((y), (z)))#define MAX(x,y) (((x) > (y)) ? (x) : (y))#define BYTES_PER_PIXEL(bpp) (((bpp) <= 8) ? 1 \ : (((bpp) <= 16) ? sizeof (unsigned short) \ : (((bpp) <= 24) ? 3 : sizeof (unsigned long))))BITMAP *create_bitmap_ex(int color_depth, int width, int height);void putpixel(BITMAP *bmp, int xx, int yy, int data);#undef size_t#undef memset/* load_memory_jpg: * Decodes a JPG image from a block of memory data. */BITMAP *load_memory_jpg(void *data, RGB *pal);/* load_jpg: * Decodes a JPG image from a standard JPG file. */BITMAP *load_jpg(char *filename, RGB *pal);#endif // MY_JPEG_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -