📄 orchid_u.h
字号:
// LEUTRON VISION Orchid_U.DLL
// This DLL contains various useful utilities which might help with bitmap manipulations etc.
// version 1.03
// Internal comment: when making changes, make the same also in: Orchid_U.h in the .Net project
#ifndef Orchid_UH
#define Orchid_UH
#include <windows.h>
#if defined(__cplusplus)
#define DLLENTRY extern "C"
#else
#define DLLENTRY
#endif
// definitions for lvx_BmpRgbColorCorrection
#define LVXBMP_PRESERVE_LUMINANCE 0x1ul
#define LVXBMP_HIGHLIGHT 0x2ul
#define LVXBMP_MIDTONES 0x4ul
#define LVXBMP_SHADOWS 0x8ul
#define LVXBMP_SETTINGS_BUFFER_SIZE 1068
//--------------------------------------------------------------------------------------
// Returns the pixel value as COLORREF from a bitmap
// COLORREF in Win32 defines the colors as 0x00bbggrr
DLLENTRY COLORREF WINAPI lvx_BmpGetPixel (BITMAPINFO* pBmpInfo, BYTE* pBmpData,
int iXPos, int iYPos);
//--------------------------------------------------------------------------------------
// Paints the bitmap in the specified window.
// The iClipFrame defines the thickness of an "invisible frame" which cuts of edges of the image.
// Set iClipFrame to 0, if you do not want to use this feature.
DLLENTRY void WINAPI lvx_BmpDisplay (BITMAPINFO* pBmpInfo, BYTE* pBmpData, HWND hWnd, int iClipFrame);
// the same function, but places the bitmap always to top-left corner
DLLENTRY void WINAPI lvx_BmpDisplayTopLeft (BITMAPINFO* pBmpInfo, BYTE* pBmpData, HWND hWnd, int iClipFrame);
//--------------------------------------------------------------------------------------
// Paints the bitmap in the specified window scaled/streched by Windows GDI to fit in the window.
// The iClipFrame defines the thickness of an "invisible frame" which reduces the size of the image.
// Set iClipFrame to 0, if you do not want to use this feature
// If bKeepAspectRatio is TRUE, the image is painted with the preserved aspect ratio, with possible
// vertical or horizontal stripes around the image in case the window dows not have its client area
// in the same aspect ratio.
DLLENTRY void WINAPI lvx_BmpDisplayStretch (BITMAPINFO* pBmpInfo, BYTE* pBmpData, HWND hWnd,
int iClipFrame, BOOL bKeepAspectRatio);
//--------------------------------------------------------------------------------------
// Returns the size of single line in bytes.
DLLENTRY int WINAPI lvx_BmpGetLineIncrement (BITMAPINFO* pBmpInfo);
//--------------------------------------------------------------------------------------
// Returns the width of the bitmap.
DLLENTRY int WINAPI lvx_BmpGetWidth (BITMAPINFO* pBmpInfo);
//--------------------------------------------------------------------------------------
// Returns the height of the bitmap as positive value, regardless whether the bitmap
// is top-down or bottom-up
DLLENTRY int WINAPI lvx_BmpGetHeight (BITMAPINFO* pBmpInfo);
//--------------------------------------------------------------------------------------
// Returns the number of bits per pixel of the bitmap.
DLLENTRY int WINAPI lvx_BmpGetBitCount (BITMAPINFO* pBmpInfo);
//--------------------------------------------------------------------------------------
// Returns TRUE if the bitmap is top-down oriented, or FALSE if it is bottom-up
DLLENTRY BOOL WINAPI lvx_BmpIsTopDown (BITMAPINFO* pBmpInfo);
//--------------------------------------------------------------------------------------
// Reverses the order of lines, making from top-down the bottom-up or vice versa
// Changes also the height value to negative/positive
DLLENTRY BOOL WINAPI lvx_BmpReverseLines (BITMAPINFO* pBmpInfo, BYTE* pBmpData);
//--------------------------------------------------------------------------------------
// Deinterlaces the bitmap by averaging each 2 lines. This function is significantly slower
// in 15/16 bit format than in 8-, 24- and 32-bit format
DLLENTRY void WINAPI lvx_BmpDeinterlace(BITMAPINFO* pBmpInfo, BYTE* pBmpData);
//-----------------------------------------------------------------------------
// Mirrors the image along vertical axis (bLeftRightMirror) and/or the
// horizontal axis (bTopBottomMirror). The destination bitmap data pointer
// (pDstBmpData) can be the same as the source bitmap (pSrcBmpData).
DLLENTRY BOOL WINAPI lvx_BmpMirror (BITMAPINFO* pSrcBmpInfo, BYTE* pSrcBmpData,
BYTE* pDstBmpData,
BOOL bTopBottomMirror, BOOL bLeftRightMirror);
//--------------------------------------------------------------------------------------
// Rotates the bitmap by 90 degrees either clockwise or counterclockwise.
// Reallocates *ppDstBmpData and *ppDstBmpInfo if needed. Allocation is done
// with the GMEM_FIXED option, so there is no need to lock/unlock allocated
// memory. The caller is resposible for calling GlobalFree() when the bitmap is
// no longer used.
DLLENTRY BOOL WINAPI lvx_BmpRotate (BITMAPINFO* pSrcBmpInfo, BYTE* pSrcBmpData,
BITMAPINFO** ppDstBmpInfo, BYTE** ppDstBmpData,
BOOL bClockWise);
// obsolete name of the same function:
DLLENTRY BOOL WINAPI lvx_RotateBitmap (BITMAPINFO* pSrcBmpInfo, BYTE* pSrcBmpData,
BITMAPINFO** ppDstBmpInfo, BYTE** ppDstBmpData,
BOOL bClockWise);
//--------------------------------------------------------------------------------------
// Mirrors the bitmap and then rotates it.
// Reallocates *ppDstBmpData and *ppDstBmpInfo if needed. Allocation is done
// with the GMEM_FIXED option, so there is no need to lock/unlock allocated
// memory. The caller is resposible for calling GlobalFree() when the bitmap is
// no longer used.
DLLENTRY BOOL WINAPI lvx_BmpMirrorAndRotate (BITMAPINFO* pSrcBmpInfo, BYTE* pSrcBmpData,
BITMAPINFO** ppDstBmpInfo, BYTE** ppDstBmpData,
BOOL bTopBottomMirror, BOOL bLeftRightMirror, BOOL bClockWise);
//--------------------------------------------------------------------------------------
// Extracts a rectangle from a bitmap and returns it as a new bitmap.
// Reallocates *ppDstBmpData and *ppDstBmpInfo if needed. Allocation is done
// with the GMEM_FIXED option, so there is no need to lock/unlock allocated
// memory. The caller is resposible for calling GlobalFree() when the bitmap is
// no longer used.
DLLENTRY BOOL WINAPI lvx_BmpGetAreaAsBitmap (BITMAPINFO* pSrcBmpInfo, BYTE* pSrcBmpData,
BITMAPINFO** ppDstBmpInfo, BYTE** ppDstBmpData,
int iDstXOffset, int iDstYOffset,
int iDstWidth, int iDstHeight);
//--------------------------------------------------------------------------------------
// obsolete name of the same function:
DLLENTRY BOOL WINAPI lvx_GetAreaAsBitmap (BITMAPINFO* pSrcBmpInfo, BYTE* pSrcBmpData,
BITMAPINFO** ppDstBmpInfo, BYTE** ppDstBmpData,
int iDstXOffset, int iDstYOffset,
int iDstWidth, int iDstHeight);
//--------------------------------------------------------------------------------------
// Loads the bitmap from file. Allocates single buffer in global heap, containing both BmpInfo and
// BmpData. The user's resposibility is to deallocate the buffer after use - deallocate only the
// pBmpInfo, not pBmpData. Deallocate by GlobalFree(pBmpInfo) without using GlobalUnlock
// (allocation is done with GMEM_FIXED option).
// Does not support less than 8 bits per pixel color format.
DLLENTRY BOOL WINAPI lvx_BmpLoadFromFile (const char* szFileName, BITMAPINFO* &pBmpInfo, BYTE* &pBmpData);
//--------------------------------------------------------------------------------------
// Saves the bitmap to a file.
// Does not support less than 8 bits per pixel color format.
DLLENTRY BOOL WINAPI lvx_BmpSaveToFile (const char* szFileName, BITMAPINFO* pBmpInfo, BYTE* pBmpData);
//--------------------------------------------------------------------------------------
// Copies the bitmap to clipboard.
// Does not support less than 8 bits per pixel color format.
DLLENTRY BOOL WINAPI lvx_BmpCopyToClipboard(BITMAPINFO* pBmpInfo, BYTE* pBmpData);
//--------------------------------------------------------------------------------------
// Applies RGB color correction to the image. The image must be in 24-bit or 32-bit color
// format. The source image can be the same as the destination image. If it is not the
// same, the destination pDstBmpData must point to properly allocated bufer of size
// lvx_BmpGetLineIncrement * lvx_BmpGetHeight.
// iRedCorrection = value in range -50 to 50, zero means no correction in red channel
// iGreenCorrection = value in range -50 to 50, zero means no correction in green channel
// iBlueCorrection = value in range -50 to 50, zero means no correction in blue channel
// dwSettings: OR-ed combination of the following flags:
// LVXBMP_PRESERVE_LUMINANCE - the luminance of the pixel is preserved
// LVXBMP_HIGHLIGHT - color correction is applied to light pixels
// LVXBMP_MIDTONES - color correction is applied to middle-intensity pixels
// LVXBMP_SHADOWS - color correction is applied to dark pixels
// void* pSettingsBuffer - pointer to a buffer of LVXBMP_SETTINGS_BUFFER_SIZE size.
// This buffer holds calculated parameters, so that they are not needed to be
// recalculated each time the function is called.
// If this buffer is NULL, the parameters are recalculated each time the function
// is called.
DLLENTRY BOOL WINAPI lvx_BmpRgbColorCorrection (BITMAPINFO* pBmpInfo, BYTE* pSrcBmpData, BYTE* pDstBmpData,
int iRedCorrection, int iGreenCorrection, int iBlueCorrection,
DWORD dwSettings, void* pSettingsBuffer);
//--------------------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -