⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 displaymodeinfo.c

📁 傅立叶变换和小波变换是图像压缩的重要工具。该代大戏是利用小波变换进行图像压缩。
💻 C
字号:
/****************************************************************************************/
/*  DisplayModeInfo.C                                                                   */
/*                                                                                      */
/*  Author:  Mike Sandige                                                               */
/*  Description:  This is a simple container to hold information about available display*/
/*                modes for the software driver.                                        */
/*                                                                                      */
/*  The contents of this file are subject to the Genesis3D Public License               */
/*  Version 1.0 (the "License"); you may not use this file except in                    */
/*  compliance with the License. You may obtain a copy of the License at                */
/*  http://www.genesis3d.com                                                            */
/*                                                                                      */
/*  Software distributed under the License is distributed on an "AS IS"                 */
/*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
/*  the License for the specific language governing rights and limitations              */
/*  under the License.                                                                  */
/*                                                                                      */
/*  The Original Code is Genesis3D, released March 25, 1999.                            */
/*  Copyright (C) 1996-1999 Eclipse Entertainment, L.L.C. All Rights Reserved           */
/*                                                                                      */
/****************************************************************************************/
#include <stdlib.h>
#include <assert.h>
#include "DisplayModeInfo.h"
#include "errorlog.h"


#define DISPLAYMODES_MAX 256

typedef struct DisplayModeInfo_Data
{
	int		Width;
	int		Height;
	int		BitsPerPixel;
	uint	Flags;
}	DisplayModeInfo_Data;


typedef struct DisplayModeInfo
{
	DisplayModeInfo_Data	 Mode[DISPLAYMODES_MAX];
	int						 ModeCount;
}	DisplayModeInfo;


DisplayModeInfo *DisplayModeInfo_Create(void)
{
	DisplayModeInfo *Info;

	Info = malloc(sizeof(*Info));
	if (Info == NULL)
		{
			geErrorLog_AddString(GE_ERR_MEMORY_RESOURCE,"DisplayModeInfo:  unable to get memory for object",NULL);
			return NULL;
		}
	Info-> ModeCount = 0;
	return Info;
}

void DisplayModeInfo_Destroy(DisplayModeInfo **Info)
{
	assert ( Info != NULL );
	assert (*Info != NULL );
	free ( *Info );
	*Info = NULL;
}

int DisplayModeInfo_GetModeCount(DisplayModeInfo *Info)
{
	assert( Info != NULL );

	return Info->ModeCount;
}

bool DisplayModeInfo_AddEntry(DisplayModeInfo *Info, 
				int Width,
				int Height,
				int BitsPerPixel,
				uint Flags)
{
	assert( Info != NULL );

	if (Info->ModeCount<DISPLAYMODES_MAX)
		{
			Info->Mode[Info->ModeCount].Width        = Width;
			Info->Mode[Info->ModeCount].Height       = Height;
			Info->Mode[Info->ModeCount].BitsPerPixel = BitsPerPixel;
			Info->Mode[Info->ModeCount].Flags        = Flags;
			Info->ModeCount++;
			return true;
		}
	else
		{
			geErrorLog_AddString(GE_ERR_INTERNAL_RESOURCE,"GE_DisplayModeInfo_AddEntry:Too many modes",NULL);
			return false;
		}
}

bool DisplayModeInfo_GetNth(DisplayModeInfo *Info, int Nth,
				int *Width, 
				int *Height,
				int *BitsPerPixel,
				uint *Flags)
{
	assert( Info != NULL );
	assert( Width        != NULL );
	assert( Height       != NULL );
	assert( BitsPerPixel != NULL );
	assert( Flags        != NULL );
	if ((Nth < 0) || (Nth > Info->ModeCount))
		{
			geErrorLog_AddString(GE_ERR_BAD_PARAMETER,"DisplayModeInfo_GetNth:  bad mode index",geErrorLog_IntToString(Nth));
			return false;
		}

	*Width        = Info->Mode[Nth].Width;
	*Height       = Info->Mode[Nth].Height;
	*BitsPerPixel = Info->Mode[Nth].BitsPerPixel;
	*Flags        = Info->Mode[Nth].Flags;
	return true;
}

⌨️ 快捷键说明

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