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

📄 inv_cmap.3

📁 [Game.Programming].Academic - Graphics Gems (6 books source code)
💻 3
字号:
.\" -*- Text -*-.\" Copyright (c) 1990, University of Michigan.\" Template man page.  .TH INV_CMAP 3 "Month DD, YYYY" 1.UC 4 .SH NAMEinv_cmap \- efficiently compute an inverse colormap.SH SYNOPSIS.HP.Bvoid inv_cmap( colors, colormap, bits, dist_buf, rgbmap ).LP.Bint colors, bits;.br.Bunsigned char *colormap[3], *rgbmap;.br.Bunsigned long *dist_buf;.SH DESCRIPTION.I Inv_cmapcomputes an inverse colormap to translate an RGB color to the nearestcolor in the given \fIcolormap\fP.  The arguments are.TP.I colorsThe number of colors in the input colormap.  Must be \(le 256..TP.I colormapThe input colormap.  The \fIi\fPth color is (\fIColormap[0][i]\fP,\fIColormap[1][i]\fP, \fIColormap[2][i]\fP)..TP.I bitsControls the size and precision of the inverse colormap.  Theresulting colormap will be a cube \fI2^bits\fP on a side, and willtherefore contain \fI2^(3*bits)\fP entries.  RGB colors must bequantized to \fIbits\fP bits before using the inverse colormap..TP.I dist_bufTemporary storage used by \fIinv_cmap\fP.  It should contain at least\fI2^(3*bits)\fP elements..TP.I rgbmapThe inverse colormap.  Should be allocated with at least\fI2^(3*bits)\fP elements.  After calling \fIinv_cmap\fP, an RGB color(r,g,b) can be mapped to its closest representative in \fIcolormap\fPby evaluating.br#define quantize(p) ((p)>>(8-bits)).brrgbmap[ (((quantize(r) << bits) | quantize(g)) << bits) | quantize(b) ].PPPredicted performance is \fIO(2^(3*bits)*log(colors))\fP.  Themeasured performance is sublinear (but not as good as \fIlog\fP) inthe number of input colors and also in the size of the output inversecolormap. (I.e., it goes up more slowly than \fI2^(3*bits)\fP.).SH SEE ALSO.IR colorquant (3)..SH AUTHORSpencer W. Thomas

⌨️ 快捷键说明

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