📄 rgbquant.h
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -