rgbquant.h

来自「CT工作站具有打印报告、病历管理、图像处理专家词库等功能」· C头文件 代码 · 共 67 行

H
67
字号

//	RGBQuant version 1.0
//	Copyright 1997, Chris Losinger
//	All Rights Reserved
//	
// Redistribution and use in source and binary forms are freely permitted
// provided that the above copyright notice and attibution and date of work
// and this paragraph are duplicated in all such forms.
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
// WARRANTIES OF MERCHANTIBILILTY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// This code is based on Edward McCreary's DIBQuant 1.0

/* 
** DIBQuant version 1.0
** Copyright (c) 1993 Edward McCreary.
** All rights reserved.
**
** Redistribution and use in source and binary forms are freely permitted
** provided that the above copyright notice and attibution and date of work
** and this paragraph are duplicated in all such forms.
** THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
** WARRANTIES OF MERCHANTIBILILTY AND FITNESS FOR A PARTICULAR PURPOSE.
*/

#ifndef _DIBQUANT_H
#define _DIBQUANT_H

/* palette generation methods */
#define IDX_MEDIAN          0       /* perform median cut */
#define IDX_POPULARITY      1       /* perform popularity sort */
#define IDX_DEFAULT         2       /* use default palette */

/* dithering methods */
#define IDX_NONE            0       /* no dither */
#define IDX_ORDERED         1       /* ordered dither */
#define IDX_JITTER          2       /* jitter preprocessing */

#ifdef __cplusplus
extern "C" {
#endif


///////////////////////////////////////////////////////////////////////////
// main procedure, quantize 24-bit rgb to 8-bit
//
//	this procedure was originally called QuantizeDIB, as it operated on DIBs.
//	i stripped all the DIB stuff out, to enable this to operate on plain RGB buffers.
//	-cdl

BOOL FAR PASCAL QuantizeRGB(BYTE * inBuf,		// input 24-bit RGB!! must be (width * height * 3) BYTEs
							BYTE * outBuf,		// output 8-bit, allocated by caller!! must be (width * height) BYTEs
							long width,			// pixels!!
							long height,
							RGBQUAD *outPal,	// 256 vals
							int nPalette,		// type 
							int nDither,		// type
							FARPROC lpStatus);	// callback, if you wish, else NULL


#ifdef __cplusplus
}
#endif

#endif /* _DIBQUANT_H */ 

⌨️ 快捷键说明

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