mga_gfl.c

来自「linux下显示各种格式图片」· C语言 代码 · 共 93 行

C
93
字号
/* 	(c) HelDoRe	Gfl unit ...    v0.0.1			Supported formats :			libgfl*/			#define VERGFL " unit v0.0.1"#include <stdio.h>#include "../mga_view.h"#ifdef USE_LIBGFL#include <libgfl.h>#include <libgfle.h>#endifvoid help_gfl(){#ifdef USE_LIBGFLprintf("Gfl%s\n   + libgfl\n",VERGFL);#endif}int detect_gfl(){#ifdef USE_LIBGFL    GFL_FILE_INFORMATION info;    GFL_LOAD_PARAMS	 load_params;    GFL_BITMAP		 *bitmap;    GFL_ERROR		 error;        gflSetPluginsPathname("..\\plugins\\");    gflLibraryInit();    gflEnableLZW(GFL_TRUE);    gflGetDefaultLoadParams( &load_params);    load_params.Flags = 0x0001 + 0x0002 + 0x0008 + 0x0010 + 0x0100;    load_params.ColorModel = GFL_RGB;    if (gflGetFileInformation(mee, -1, &info) != GFL_NO_ERROR)	return 1;        depth = info.NumberOfPlanes * info.BitsPerPlane;    image_x = info.Width;    image_y = info.Height;    gflFreeFileInformation(&info);    check_image(image_x,image_y,depth);    error = gflLoadBitmap(mee, &bitmap, &load_params, &info);    if (error) return 1;    printf("GFL%s\n",VERGFL);    printf("Image detected  : %ix%ix%i (%s)\n", image_x, image_y, depth, info.Description);    if (info.NumberOfComment > 0)    {	printf("Comment         : ");	for (i = 0; i<info.NumberOfComment; i++)	    printf("%s\n                  ",info.Comment[i]);	printf("\n");    }    if (depth <24)    {	GFL_BITMAP *bitmap_temp;	        gflChangeColorDepth(bitmap, &bitmap_temp, GFL_MODE_TO_RGB, 0);	gflFreeBitmap(bitmap);	bitmap = bitmap_temp;	    }    j = 0;    for (i=0;i<image_x*image_y;i++)    {	tabr[i]=bitmap->Data[j++];	tabg[i]=bitmap->Data[j++];	tabb[i]=bitmap->Data[j++];    }    gflFreeBitmap(bitmap);    gflLibraryExit();    return 0;	#else    return 1;	#endif}

⌨️ 快捷键说明

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