📄 cximage_reference.htm
字号:
<td width="47%"><code>float Mean()</code></td>
<td width="50%">Returns the mean lightness of the image. Useful with <code>Threshold</code>
and <code>Light</code></td>
</tr>
<tr valign="top">
<td width="47%" height="26"><code>bool Erode(long Ksize=2)</code></td>
<td width="50%" height="26">Enhance the dark areas of the image. <code>Ksize</code>
is the size of the kernel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool Dilate(long Ksize=2)</code></td>
<td width="50%">Enhance the light areas of the image. <code>Ksize</code> is
the size of the kernel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool Filter(long* kernel, long Ksize, long Kfactor,
long Koffset)</code></td>
<td width="50%">
<p>2D linear filter. <code>kernel</code> is the convolving matrix, in row
format; <code> Ksize</code> is the size of the kernel. <code>Kfactor</code>
is the normalization constant; <code>Koffset</code> is the bias.<br>
Example: the "soften" filter uses this kernel:</p>
<p align="center">1 1 1<br>
1 8 1<br>
1 1 1</p>
<p align="left">the function needs: <code>kernel</code>={1,1,1,1,8,1,1,1,1};
<code>Ksize</code>=3; <code>Kfactor</code>=16; <code>Koffset</code>=0;</p>
</td>
</tr>
<tr valign="top">
<td width="47%"><code>void Mix(CxImage & imgsrc2, ImageOpType op, long
lXOffset = 0, long lYOffset = 0)<br>
<br>
void MixFrom(CxImage & imagesrc2, long lXOffset, long lYOffset); </code></td>
<td width="50%">Blends two images. <code>op</code> can be : <code>OpAdd, OpAnd,
OpXor, OpOr, OpMask, OpSrcCopy, OpDstCopy, OpSub, OpSrcBlend</code></td>
</tr>
<tr valign="top">
<td width="47%"><code>bool ShiftRGB(long r, long g, long b)</code></td>
<td width="50%">Adjusts separately the red, green, and blue values in the
image.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool Gamma(float gamma)</code></td>
<td width="50%">Adjusts the color balance of the image. <code>gamma</code>
can be from 0.1 to 5.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool Median(long Ksize = 3)</code></td>
<td width="50%">Adjusts the intensity of each pixel to the median intensity
of its surrounding pixels.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool Noise(long level)</code></td>
<td width="50%">Adds an uniform noise to the image, <code>level</code> can
be from 0 to 255.</td>
</tr>
<TR>
<TD width="47%"><code>bool Skew(float xgain, float ygain, long xpivot, long
ypivot)</code></TD>
<TD width="50%">image skewing, <code>xgain</code> and <code>ygain</code> can
be from 0 to 1, <code>xpivot</code> and <code>ypivot</code> is the center
of the transformation.</TD>
</TR>
<TR>
<TD width="47%"><CODE>bool Jitter(long radius = 2)</CODE></TD>
<TD width="50%">Adds a random offset to each pixel in the image</TD>
</TR>
<tr valign="top">
<td width="47%"><code>long Histogram(long* red, long* green = 0, long* blue
= 0, long* gray = 0, long colorspace = 0)</code></td>
<td width="50%">Build the istogram of the image. <code>red</code>, <code>green</code>,
<code>blue</code>, <code>gray</code> are <code>long[256]</code> or NULL.
<code>colorspace</code> can be:<br>
0 = RGB, 1 = HSL, 2 = YUV, 3 = YIQ, 4 = XYZ.<br>
The function returns the maximum value stored in the <code>red</code>, <code>green</code>,
<code>blue</code>, <code>gray</code> buffers.</td>
</tr>
<tr valign="top">
<td width="47%"><code>HistogramStretch(long method = 0);<br>
<br>
HistogramEqualize();<br>
<br>
HistogramNormalize();<br>
<br>
HistogramRoot();<br>
<br>
HistogramLog();</code></td>
<td width="50%">Histogram functions.<br>
methos for HistogramStretch are : 0 = luminance , 1 = linked channels ,
2 = independent channels.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool FFT2(CxImage* srcReal, CxImage* srcImag, CxImage*
dstReal, CxImage* dstImag, long direction = 1, bool bForceFFT = true, bool
bMagnitude = true)</code></td>
<td width="50%">Computes the bidimensional FFT or DFT of the image. If the
dimensions of the image are a power of, 2 the FFT is performed automatically.<br>
If <code>dstReal</code> and/or <code>dstImag</code> are NULL, the resulting
images replaces the original(s).<br>
<code>direction</code>: 1 = forward, -1 = inverse.<br>
<code>bForceFFT</code>: Resample the image to make the dimensions a power
of 2.<br>
<code>bMagnitude</code>: the real part returns the magnitude, the imaginary
part returns the phase.<br>
Note: with 8 bits there is a HUGE loss in the dynamics the function tries
to keep an acceptable SNR, but 8bit = 48dB...</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool Combine(CxImage* r,CxImage* g,CxImage* b,CxImage*
a, long colorspace = 0)</code></td>
<td width="50%">Combines different color components, <code>"a"</code> can
be NULL,<br>
the source colorspace can be:<br>
0 = RGB, 1 = HSL, 2 = YUV, 3 = YIQ, 4 = XYZ </td>
</tr>
<tr valign="top">
<td width="47%"><code>bool Repair(float radius = 0.25f, long niterations =
1, long colorspace = 0)</code></td>
<td width="50%">Smart blurring to remove small defects, dithering or artifacts.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool UnsharpMask(float radius = 5.0, float amount =
0.5, int threshold = 0);</code></td>
<td width="50%"> </td>
</tr>
<tr valign="top">
<td width="47%"><code>bool Lut(BYTE* pLut);<br>
<br>
bool Lut(BYTE* pLutR, BYTE* pLutG, BYTE* pLutB, BYTE* pLutA = 0);</code></td>
<td width="50%">Apply a look up table to the image or for each channel. <code>"pLut"</code>s
are BYTE[256]</td>
</tr>
<tr valign="top">
<td width="47%"> </td>
<td width="50%"> </td>
</tr>
</table>
<h3><b>Painting<a name="Painting"></a> operations</b></h3>
<table width="100%" border="1" cellspacing="0">
<tbody>
<tr valign="top">
<td width="47%"><code>long Draw(HDC pDC, long xoffset, long yoffset, long
xsize = -1, long size = -1, RECT* pClipRect = 0)</code><br>
<br>
<code>long Draw(HDC hdc, const RECT& rect, RECT* pClipRect = 0)</code>
</td>
<td width="50%">Draws the image in the specified device context, with support for
alpha channel, alpha palette, transparency, opacity.</td>
</tr>
<tr valign="top">
<td width="47%"><code>long Draw2(HDC pDC, long xoffset, long yoffset, long
xsize = -1, long size = -1)</code><br>
<br>
<code>long Draw2(HDC hdc, const RECT& rect)</code>
</td>
<td width="50%">Draws the image in the specified device context, using the "true
mask" method (simple transparency)</td>
</tr>
<tr valign="top">
<td width="47%"><code>long Stretch(HDC pDC,long xoffset,long yoffset,long
xsize,long ysize, DWORD dwRop = SRCCOPY)</code><br>
<br>
<code>long Stretch(HDC hdc, const RECT& rect, DWORD dwRop = SRCCOPY)</code>
</td>
<td width="50%">Stretch the image <i>(obsolete, use Draw)</i>, still useful for
printing operations.</td>
</tr>
<tr valign="top">
<td width="47%"><code>long Tile(HDC pDC, RECT *rc)</code></td>
<td width="50%">Tiles the image to fill the specified rectangle.</td>
</tr>
<tr valign="top">
<td width="47%"><code>long DrawString(HDC hdc, long x, long y, const TCHAR*
text, RGBQUAD color, const TCHAR* font, long lSize=0, long lWeight=400,
BYTE bItalic=0, BYTE bUnderline=0, bool bSetAlpha=false);<br>
<br>
long DrawStringEx(HDC hdc, long x, long y, CXTEXTINFO *pTextType, bool bSetAlpha=false
); </code></td>
<td width="50%">Draws a string in the image.</td>
</tr>
<tr valign="top">
<td width="47%"><code>long Blt(HDC pDC, long x=0, long y=0)</code></td>
<td width="50%">
Only for WinCE.</td>
</tr>
</tbody>
</table>
<h3><b>Multiple<a name="Multiple"></a> Images operations</b></h3>
<p>These are specific function to load multiple TIFF, GIF and ICON images.</p>
<table width="100%" border="1" cellspacing="0">
<tbody>
<tr valign="top">
<td width="47%"><code>long GetNumFrames()</code></td>
<td width="50%">Returns the number of images in the file. This function must
be used after a <code>Load()</code> call.<br>
Use the sequence <code>SetFrame(-1); Load(...); GetNumFrames(); </code>to
get the number of images without loading the first image.</td>
</tr>
<tr valign="top">
<td width="47%"><code>long GetFrame()</code></td>
<td width="50%">
Returns the current selected image (zero-based index).</td>
</tr>
<tr valign="top">
<td width="47%"><code>long SetFrame()</code></td>
<td width="50%">Set the image number that the next <code>ReadFile()</code> call
will load.</td>
</tr>
</tbody>
</table>
<h3><b>Transparency<a name="Transparency"></a></b></h3>
<table width="100%" border="1" dwcopytype="CopyTableRow" cellspacing="0">
<tbody>
<tr valign="top">
<td width="47%"><code>long GetTransIndex()</code></td>
<td width="50%">
Gets the index used for transparency. Returns -1 for no transparancy.</td>
</tr>
<tr valign="top">
<td width="47%"><code>RGBQUAD GetTransColor()</code></td>
<td width="50%">Gets the color used for transparency.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetTransIndex(long idx)</code></td>
<td width="50%">Sets the index used for transparency with 1, 4 and 8 bpp images.
Set to -1 to remove the effect.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetTransColor(RGBQUAD rgb)</code></td>
<td width="50%">Sets the color used for transparency with 24 bpp images. You must
call <code>SetTransIndex(0)</code> to enable the effect, <code>SetTransIndex(-1)</code>
to disable it.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool IsTransparent()</code></td>
<td width="50%"> </td>
</tr>
</tbody>
</table>
<h3><b>Palette<a name="Palette"></a> operations</b></h3>
<p>These functions have no effects on RGB images and in this case the returned
value is always 0.</p>
<table width="100%" border="1" cellspacing="0">
<tbody>
<tr valign="top">
<td width="47%"><code>DWORD GetPaletteSize()</code></td>
<td width="50%">Returns the palette dimension in bytes.</td>
</tr>
<tr valign="top">
<td width="47%"><code>RGBQUAD* GetPalette()</code></td>
<td width="50%">Returns the pointer to the first palette index.</td>
</tr>
<tr valign="top">
<td width="47%"><code>RGBQUAD GetPaletteColor(BYTE idx)<br>
<br>
bool GetPaletteColor(int i, BYTE* r, BYTE* g, BYTE* b) </code> </td>
<td width="50%">Returns the color of the specified index.</td>
</tr>
<tr valign="top">
<td width="47%"><code>BYTE GetNearestIndex(RGBQUAD c)</code></td>
<td width="50%">
Returns the best palette index that matches a specified color .</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetPalette(DWORD n, BYTE *r, BYTE *g, BYTE *b)</code><br>
<br>
<code>void SetPalette(RGBQUAD* pPal,DWORD nColors=256)</code><br>
<br>
<code>void SetPalette(rgb_color_struct *rgb,DWORD nColors=256)</code></td>
<td width="50%">Sets the palette entries.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetPaletteColor(BYTE idx, BYTE r, BYTE g, BYTE
b)</code><br>
<br>
<code>void SetPaletteColor(BYTE idx, RGBQUAD c)</code><br>
<br>
<code>void SetPaletteColor(BYTE idx, COLORREF cr)</code></td>
<td width="50%">Sets the color of the specified palette index.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetGrayPalette()</code></td>
<td width="50%">Turns to gray scale palette.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void BlendPalette(COLORREF cr,long perc)</code></td>
<td width="50%">Colorize the palette.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool IsGrayScale()</code></td>
<td width="50%">Returns true if the image has 256 colors and a linear grey scale
palette.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool IsIndexed()</code></td>
<td width="50%">Returns true if the image has 256 colors or less.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SwapIndex(BYTE idx1, BYTE idx2)</code></td>
<td width="50%">Swaps two indexes in the image and their colors in the palette.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetStdPalette()</code></td>
<td width="50%">Sets a palette with standard colors for 4 and 8 bpp images.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void HuePalette(float correction=1)</code></td>
<td width="50%">Generates a "rainbow" palette with saturated colors. <code>correction=1</code>
generates a single hue spectrum. <code>correction=0.75</code> is nice for
scientific applications.</td>
</tr>
<tr valign="top">
<td width="47%"><code>RGBQUAD HSLtoRGB(COLORREF cHSLColor)</code><br>
<code>RGBQUAD RGBtoRGBQUAD(COLORREF cr)</code><br>
<code>COLORREF RGBQUADtoRGB (RGBQUAD c)</code><br>
<code>RGBQUAD RGBtoHSL(RGBQUAD lRGBColor)</code><br>
<code>RGBQUAD HSLtoRGB(RGBQUAD lHSLColor)<br>
RGBQUAD YUVtoRGB(RGBQUAD lYUVColor)<br>
RGBQUAD RGBtoYUV(RGBQUAD lRGBColor)<br>
RGBQUAD YIQtoRGB(RGBQUAD lYIQColor);<br>
RGBQUAD RGBtoYIQ(RGBQUAD lRGBColor);<br>
RGBQUAD XYZtoRGB(RGBQUAD lXYZColor);<br>
RGBQUAD RGBtoXYZ(RGBQUAD lRGBColor);<br>
RGBtoBGR(BYTE *buffer, int length);<br>
RGB2GRAY(r,g,b)<br>
</code>
</td>
<td width="50%">Color transformation utilities.</td>
</tr>
</tbody>
</table>
<h3><b>Pixels<a name="Pixels"></a> operations</b></h3>
<table width="100%" border="1" cellspacing="0">
<TBODY>
<tr valign="top">
<td width="47%"><code>bool IsInside(long x, long y)</code></td>
<td width="50%">Checks if the coordinates are inside the image.</td>
</tr>
<tbody>
<tr valign="top">
<td width="47%"><code>BYTE GetPixelIndex(long x,long y)</code></td>
<td width="50%">Returns the pixel index (0 for RGB images).</td>
</tr>
<tr valign="top">
<td width="47%"><code>RGBQUAD GetPixelColor(long x,long y, bool bGetAlpha
= true)</code></td>
<td width="50%">Returns the pixel color.</td>
</tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -