1 /** \file 2 * \brief Old API 3 * 4 * See Copyright Notice in im_lib.h 5 */ 6 module im.im_old; 7 8 version(IM) : 9 10 import core.stdc.config : c_long; 11 import im.im : IM_ERR_ACCESS, IM_ERR_DATA, IM_ERR_COMPRESS; 12 13 //version(DigitalMars) version(Windows) { pragma(lib, "im.lib"); } // required anyway 14 15 extern(C) : 16 @nogc nothrow { 17 18 enum {IM_BMP, IM_PCX, IM_GIF, IM_TIF, IM_RAS, IM_SGI, IM_JPG, IM_LED, IM_TGA} 19 enum {IM_NONE = 0x0000, IM_DEFAULT = 0x0100, IM_COMPRESSED = 0x0200} 20 21 enum IM_ERR_READ = IM_ERR_ACCESS; 22 enum IM_ERR_WRITE = IM_ERR_ACCESS; 23 enum IM_ERR_TYPE = IM_ERR_DATA; 24 enum IM_ERR_COMP = IM_ERR_COMPRESS; 25 26 c_long imEncodeColor(ubyte red, ubyte green, ubyte blue); 27 void imDecodeColor(ubyte* red, ubyte* green, ubyte* blue, c_long palette); 28 int imFileFormat(char* filename, int* format); 29 int imImageInfo(char* filename, int* width, int* height, int* type, int* palette_count); 30 int imLoadRGB(char* filename, ubyte* red, ubyte* green, ubyte* blue); 31 int imSaveRGB(int width, int height, int format, ubyte* red, ubyte* green, ubyte* blue, char* filename); 32 int imLoadMap(char* filename, ubyte* map, c_long* palette); 33 int imSaveMap(int width, int height, int format, ubyte* map, int palette_count, c_long* palette, char* filename); 34 void imRGB2Map(int width, int height, ubyte* red, ubyte* green, ubyte* blue, ubyte* map, int palette_count, c_long* palette); 35 void imMap2RGB(int width, int height, ubyte* map, int palette_count, c_long* colors, ubyte* red, ubyte* green, ubyte* blue); 36 void imRGB2Gray(int width, int height, ubyte* red, ubyte* green, ubyte* blue, ubyte* map, c_long* grays); 37 void imMap2Gray(int width, int height, ubyte* map, int palette_count, c_long* colors, ubyte* grey_map, c_long* grays); 38 void imResize(int src_width, int src_height, ubyte* src_map, int dst_width, int dst_height, ubyte* dst_map); 39 void imStretch(int src_width, int src_height, ubyte* src_map, int dst_width, int dst_height, ubyte* dst_map); 40 41 } // @nogc nothrow 42 43 alias imCallback = int function(char* filename) nothrow; 44 int imRegisterCallback(imCallback cb, int cb_id, int format) @nogc nothrow; 45 46 enum IM_INTERRUPTED = -1; 47 enum IM_ALL = -1; 48 enum IM_COUNTER_CB = 0; 49 alias imFileCounterCallback = int function(char* filename, int percent, int io) nothrow; 50 51 enum IM_RESOLUTION_CB = 1; 52 alias imResolutionCallback = int function(char* filename, double* xres, double* yres, int* res_unit) nothrow; 53 54 55 enum {IM_RES_NONE, IM_RES_DPI, IM_RES_DPC}; 56 57 enum IM_GIF_TRANSPARENT_COLOR_CB = 0; 58 alias imGifTranspIndex = int function(char* filename, ubyte* transp_index) @nogc nothrow; 59 60 enum IM_TIF_IMAGE_DESCRIPTION_CB = 0; 61 alias imTiffImageDesc = int function(char* filename, char* img_desc) @nogc nothrow;