📄 pnm.h
字号:
/* //////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright(c) 2004-2005 Intel Corporation. All Rights Reserved.//////*/#ifndef __PNM_H__#define __PNM_H__#include "imagecore.h"#include "stricmp.h"typedef enum{ PNM_BIN, PNM_TXT} PNMNumericFormat;typedef enum{ PNM_BLACKNWHITE, PNM_GRAYSCALE, PNM_COLOR} PNMColorFormat;typedef enum{ PNM_PBM_TXT = 0x5031, PNM_PGM_TXT = 0x5032, PNM_PPM_TXT = 0x5033, PNM_PBM_BIN = 0x5034, PNM_PGM_BIN = 0x5035, PNM_PPM_BIN = 0x5036} PNMMagicNumber;inline PNMMagicNumber MagicNumber(PNMNumericFormat numFmt, PNMColorFormat clrFmt){ switch(clrFmt) { case PNM_BLACKNWHITE: return ( (numFmt == PNM_TXT) ? PNM_PBM_TXT : PNM_PBM_BIN ); case PNM_GRAYSCALE: return ( (numFmt == PNM_TXT) ? PNM_PGM_TXT : PNM_PGM_BIN ); case PNM_COLOR: default: return ( (numFmt == PNM_TXT) ? PNM_PPM_TXT : PNM_PPM_BIN ); }}inline const char* SpecFileNameExt(PNMColorFormat clrFmt){ switch(clrFmt) { case PNM_BLACKNWHITE: return "pbm"; case PNM_GRAYSCALE: return "pgm"; case PNM_COLOR: return "ppm"; default: return "pnm"; }}inline PNMColorFormat SpecColorFormat(const char *fileNameExt){ if(!Stricmp(fileNameExt, "pbm")) return PNM_BLACKNWHITE; if(!Stricmp(fileNameExt, "pgm")) return PNM_GRAYSCALE; return PNM_COLOR;}inline PNMNumericFormat NumericFormat(PNMMagicNumber magic){ return ( (magic == PNM_PBM_TXT || magic == PNM_PGM_TXT || magic == PNM_PPM_TXT) ? PNM_TXT : PNM_BIN );}inline PNMColorFormat ColorFormat(PNMMagicNumber magic){ switch(magic) { case PNM_PGM_TXT: case PNM_PGM_BIN: return PNM_GRAYSCALE; case PNM_PPM_TXT: case PNM_PPM_BIN: return PNM_COLOR; case PNM_PBM_TXT: case PNM_PBM_BIN: default: return PNM_BLACKNWHITE; }}inline unsigned int PNMMaxDataValue(unsigned int bitDepth) { return (Ipp32u)(((Ipp64u)1 << (bitDepth + 1)) - 1); }inline unsigned int NOfChannels (PNMColorFormat clrFmt ) { return ( (clrFmt == PNM_COLOR) ? 3: 1); };inline unsigned int NOfChannels (PNMMagicNumber magic ) { return NOfChannels(ColorFormat(magic)); }#endif // __PNM_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -