📄 cximage_reference.htm
字号:
<tr valign="top">
<td width="47%"><code>BYTE GetPixelGray(long x,long y)</code></td>
<td width="50%">Returns the pixel lightness</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetPixelIndex(long x,long y,BYTE i)</code></td>
<td width="50%">Sets the pixel index, only for indexed images.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetPixelColor(long x,long y,RGBQUAD c, bool bSetAlpha
= false)</code><br>
<br>
<code>void SetPixelColor(long x,long y,COLORREF cr)</code></td>
<td width="50%">Sets the pixel color.</td>
</tr>
<tr valign="top">
<td width="47%"> <code>void DrawLine(int StartX, int EndX, int StartY, int
EndY, RGBQUAD color, bool bSetAlpha=false);<br>
<br>
void DrawLine(int StartX, int EndX, int StartY, int EndY, COLORREF cr)</code><br>
</td>
<td width="50%"> </td>
</tr>
</tbody>
</table>
<h3><b>Region<a name="Region"></a> selection</b></h3>
<table width="100%" border="1" cellspacing="0">
<TBODY>
<tr valign="top">
<td width="47%"><code>bool SelectionCreate()</code></td>
<td width="50%"> Allocates an empty selection.</td>
</tr>
<tbody>
<tr valign="top">
<td width="47%"><code>bool SelectionDelete()</code></td>
<td width="50%">Deallocates the selction.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool SelectionClear()</code></td>
<td width="50%"> Empties the selection.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool SelectionCopy(CxImage &from)</code></td>
<td width="50%">Imports an existing region from another image with the same
width and height.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool SelectionInvert()</code></td>
<td width="50%">Inverts the selection.</td>
</tr>
<tr valign="top">
<td width="47%" height="18"><code>bool SelectionAddPixel(int x, int y)</code></td>
<td width="50%" height="18">Adds a single pixel to the existing selection.</td>
</tr>
<tr valign="top">
<td width="47%" height="18"><code>bool SelectionAddRect(RECT r)</code></td>
<td width="50%" height="18">Adds a rectangle to the existing selection.</td>
</tr>
<tr valign="top">
<td width="47%" height="18"><code>bool SelectionAddEllipse(RECT r)</code></td>
<td width="50%" height="18">Adds an ellipse to the existing selection.</td>
</tr>
<tr valign="top">
<td width="47%" height="18"><code>bool SelectionAddPolygon(POINT *points,
long npoints)</code></td>
<td width="50%" height="18">Adds a polygonal region to the existing selection.
<code>points</code> points to an array of <code>POINT</code> structures.
Each structure specifies the x-coordinate and y-coordinate of one vertex
of the polygon. <code>npoints</code> specifies the number of <code>POINT</code>
structures in the array pointed to by <code>points</code>.</td>
</tr>
<tr valign="top">
<td width="47%" height="18"><code>void SelectionGetBox(RECT& r)</code></td>
<td width="50%" height="18">Gets the smallest rectangle that contains the
selection </td>
</tr>
<tr valign="top">
<td width="47%" height="18"><code>bool SelectionIsInside(long x, long y)</code></td>
<td width="50%" height="18">Checks if the coordinates are inside the selection.</td>
</tr>
<tr valign="top">
<td width="47%" height="18"><code>bool SelectionAddColor(RGBQUAD c)</code></td>
<td width="50%" height="18">Adds to the selection all the pixels matching
the specified color.</td>
</tr>
<tr valign="top">
<td width="47%" height="18"><code>bool SelectionToHRGN(HRGN& region)</code></td>
<td width="50%" height="18">Converts the selection in a HRGN object.</td>
</tr>
<tr valign="top">
<td width="47%" height="18"><code>bool SelectionIsValid()</code> </td>
<td width="50%" height="18">Checks if the image has a valid selection.</td>
</tr>
</tbody>
</table>
<h3><b>Alpha<a name="Alpha"></a> channel</b></h3>
<table width="100%" border="1" cellspacing="0">
<TBODY>
<tr valign="top">
<td width="47%"><code>void AlphaCreate()</code></td>
<td width="50%">Allocates an empty (transparent) alpha channel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void AlphaDelete()</code></td>
<td width="50%">Deallocates the alpha channel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void AlphaClear()</code></td>
<td width="50%">Resets the alpha channel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void AlphaInvert()</code></td>
<td width="50%">Inverts the alpha channel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool AlphaMirror()</code></td>
<td width="50%">Mirrors the alpha channel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool AlphaFlip()</code></td>
<td width="50%">Flips the alpha channel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool AlphaCopy(CxImage &from)</code></td>
<td width="50%"> Imports an existing alpa channel from another image with
the same width and height.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void AlphaStrip()</code></td>
<td width="50%">Blends the alpha channel and the alpha palette with the pixels.
The result is a 24 bit image. The background color can be selected using
<code>SetTransColor</code>().</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool AlphaSplit(CxImage *dest)</code></td>
<td width="50%">Exports the alpha channel in a 8bpp grayscale image.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void AlphaSet(BYTE level)<br>
void AlphaSet(long x,long y,BYTE level) </code> </td>
<td width="50%">Sets the alpha level for the whole image or for a single pixel
</td>
</tr>
<tr valign="top">
<td width="47%"><code>void AlphaSet(CxImage &from)</code></td>
<td width="50%">Creates the alpha channel from a gray scale image</td>
</tr>
<tr valign="top">
<td width="47%"><code>BYTE AlphaGet(long x,long y)</code></td>
<td width="50%">Returns the alpha level for the specified pixel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>BYTE AlphaGetMax() / void AlphaSetMax(BYTE nAlphaMax)</code></td>
<td width="50%">Get/Set global Alpha (opacity) value applied to the whole
image.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool AlphaIsValid()</code></td>
<td width="50%">Checks if the image has a valid alpha channel.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void AlphaPaletteClear()</code></td>
<td width="50%">Resets the alpha palette.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void AlphaPaletteEnable(bool enable=true)</code></td>
<td width="50%">Enables the alpha palette, so the Draw() function changes
its behavior.</td>
</tr>
<tbody>
<tr valign="top">
<td width="47%"><code>bool AlphaPaletteIsEnabled()</code></td>
<td width="50%">True if the alpha palette is enabled for painting.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool AlphaPaletteSplit(CxImage *dest)</code></td>
<td width="50%">Exports the alpha channel in a 8bpp grayscale image.</td>
</tr>
<tr valign="top">
<td width="47%"><code>bool AlphaPaletteIsValid()</code></td>
<td width="50%">Checks if the image has a valid alpha palette.</td>
</tr>
<tr valign="top">
<td width="47%"><code>BYTE* AlphaGetBits()</code></td>
<td width="50%">Returns the pointer to the alpha layer (USE CAREFULLY)</td>
</tr>
</tbody>
</table>
<h3>Layers<a name="layers"></a></h3>
<table width="100%" border="1" cellspacing="0">
<tr>
<td width="47%"> <code>bool LayerCreate(long position = -1)</code>
</td>
<td width="50%">Creates an empty layer. If <code>position</code> is less than
0, the new layer will be placed in the last position</td>
</tr>
<tr>
<td width="47%"><code>bool LayerDelete(long position = -1)</code></td>
<td width="50%">Deletes a layer. If <code>position</code> is less than 0,
the last layer will be deleted</td>
</tr>
<tr>
<td width="47%"><code>void LayerDeleteAll()</code></td>
<td width="50%"> </td>
</tr>
<tr>
<td width="47%"><code>CxImage* GetLayer(long position)</code></td>
<td width="50%">Returns a pointer to a layer. If <code>position</code> is
less than 0, the last layer will be returned</td>
</tr>
<tr>
<td width="47%"><code>CxImage* GetParent()</code></td>
<td width="50%">If the object is an internal layer, <code>GetParent</code>
return its parent in the hierarchy.</td>
</tr>
<tr>
<td width="47%"><code>long GetNumLayers()</code></td>
<td width="50%">Number of layers allocated directly by the object.</td>
</tr>
</table>
<h3><b>Attributes<a name="Attributes"></a></b></h3>
<table width="100%" border="1" cellspacing="0">
<tbody>
<tr valign="top">
<td width="47%"><code>long GetSize()</code></td>
<td width="50%">Returns the size in byte of the internal hDib object.</td>
</tr>
<tr valign="top">
<td width="47%"><code>BYTE* GetBits(DWORD row)</code></td>
<td width="50%">Returns the pointer to the image pixels (USE CAREFULLY).</td>
</tr>
<tr valign="top">
<td width="47%"><code>DWORD GetHeight()</code></td>
<td width="50%"> </td>
</tr>
<tr valign="top">
<td width="47%"><code>DWORD GetWidth()</code></td>
<td width="50%"> </td>
</tr>
<tr valign="top">
<td width="47%"><code>DWORD GetEffWidth()</code></td>
<td width="50%">Returns the DWORD aligned width of the image.</td>
</tr>
<tr valign="top">
<td width="47%"><code>DWORD GetNumColors()</code></td>
<td width="50%">Returns 2, 16, 256; 0 for RGB images.</td>
</tr>
<tr valign="top">
<td width="47%"><code>BYTE GetColorType()</code></td>
<td width="50%"> Returns: 1=Palette, 2=RGB, 4=Alpha.</td>
</tr>
<tr valign="top">
<td width="47%"><code>WORD GetBpp()</code></td>
<td width="50%">Returns: 1, 4, 8, 24.</td>
</tr>
<tr valign="top">
<td width="47%"><code>DWORD GetType()</code></td>
<td width="50%">Returns the file extension associated with the image.</td>
</tr>
<tr valign="top">
<td width="47%"><code>LPSTR GetLastError()</code></td>
<td width="50%"> Returns the last reported error.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void* GetDIB()</code></td>
<td width="50%">Returns the internal hDib object.</td>
</tr>
<tr valign="top">
<td width="47%"><code>BYTE GetJpegQuality() / void SetJpegQuality(BYTE q)</code></td>
<td width="50%">Image quality for JPEG and TIFF formats.</td>
</tr>
<tr valign="top">
<td width="47%"><code>long GetXDPI() / void SetXDPI(long dpi)<br>
long GetYDPI() / void SetYDPI(long dpi)</code></td>
<td width="50%">Resolution for TIFF, JPEG, PNG and BMP formats.</td>
</tr>
<tr valign="top">
<td width="47%"><code>DWORD GetCodecOption()<br>
<br>
void SetCodecOption(DWORD opt) </code> </td>
<td width="50%">Encode option for GIF, TIF and JPG.<br>
GIF : 0 = RLE (default), 1 = none, 2 = LZW.<br>
TIF : 0 = automatic (default), or a valid compression code as defined in
"tiff.h" (COMPRESSION_NONE = 1, COMPRESSION_CCITTRLE = 2, ...)<br>
JPG : valid values stored in enum CODEC_OPTION<br>
( ENCODE_BASELINE = 0x01, ENCODE_PROGRESSIVE = 0x10, ...)</td>
</tr>
<tr valign="top">
<td width="47%"><code>DWORD GetFlags()<br>
<br>
SetFlags(DWORD flags, bool bLockReservedFlags = true)</code></td>
<td width="50%">
<p>Image flags, for future use<br>
0x??00000 = reserved for 16 bit, CMYK, multilayer<br>
0x00??0000 = blend modes<br>
0x0000???? = layer id or user flags<br>
<code>bLockReservedFlags</code> protects the "reserved" and
"blend modes" flags </p>
</td>
</tr>
<tr valign="top">
<td width="47%"><code>BYTE GetJpegScale()<br>
<br>
void SetJpegScale(BYTE q) </code></td>
<td width="50%">used for scaling down during JPEG decoding, valid numbers
are 1, 2, 4, 8</td>
</tr>
<tr valign="top">
<td width="47%"><code>void GetOffset(long *x,long *y)<br>
<br>
void SetOffset(long x,long y)</code></td>
<td width="50%">Image offset.</td>
</tr>
</tbody>
</table>
<p>
<h3>Miscellaneous<a name="Miscellaneous"></a></h3>
<p></p>
<table width="100%" border="1" cellspacing="0">
<tbody>
<tr valign="top">
<td width="47%"><code>HBITMAP MakeBitmap(HDC hdc)</code><br>
</td>
<td width="50%">Creates a device-dependent bitmap (DDB) from the image (DIB). If <code>hdc</code>
is NULL, the function returns a DIB.</td>
</tr>
<tr valign="top">
<td width="47%"><code>long GetProgress()</code></td>
<td width="50%">Used to monitor the slow loops. The returned value is from 0 to
100.</td>
</tr>
<tr valign="top">
<td width="47%"><code>long GetEscape()</code></td>
<td width="50%">Returns the escape code.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetProgress(long p)</code></td>
<td width="50%">Forces the value of the internal progress variable.</td>
</tr>
<tr valign="top">
<td width="47%"><code>void SetEscape(long i)</code></td>
<td width="50%">Used to quit the slow loops or the codecs.</td>
</tr>
<tr valign="top">
<td width="47%"><code>const TCHAR* GetVersion()</code></td>
<td width="50%"> </td>
</tr>
<tbody></tbody>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -