From 251f26064f0ce721a635dd6e9358fd867181fcd5 Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 26 Mar 2015 09:07:44 -0400 Subject: headers for gdi bitmaps, reflecting an idea about one possible principle/system that the winapi could follow: * if a header traditionally provided information about multiple implementation areas (i.e. bitmaps, brushes, clipping, etc.), provide the definitions for each of these areas in a designated header, and have the canonical header include them. * within each header, ideally begin by providing all of the enums, and then similarly all #defines, typedefs, and function signatures and/or forward declarations. --- wingdi_bitmap_const.h | 99 ++++++++++++++++++ wingdi_bitmap_fnapi.h | 270 +++++++++++++++++++++++++++++++++++++++++++++++++ wingdi_bitmap_struct.h | 177 ++++++++++++++++++++++++++++++++ wingdi_common.h | 44 ++++++++ 4 files changed, 590 insertions(+) create mode 100644 wingdi_bitmap_const.h create mode 100644 wingdi_bitmap_fnapi.h create mode 100644 wingdi_bitmap_struct.h create mode 100644 wingdi_common.h diff --git a/wingdi_bitmap_const.h b/wingdi_bitmap_const.h new file mode 100644 index 0000000..427521e --- /dev/null +++ b/wingdi_bitmap_const.h @@ -0,0 +1,99 @@ +#define BI_RGB 0L +#define BI_RLE8 1L +#define BI_RLE4 2L +#define BI_BITFIELDS 3L +#define BI_JPEG 4L +#define BI_PNG 5L + +#define ILLUMINANT_DEVICE_DEFAULT 0 +#define ILLUMINANT_A 1 +#define ILLUMINANT_B 2 +#define ILLUMINANT_C 3 +#define ILLUMINANT_D50 4 +#define ILLUMINANT_D55 5 +#define ILLUMINANT_D65 6 +#define ILLUMINANT_D75 7 +#define ILLUMINANT_F2 8 +#define ILLUMINANT_MAX_INDEX ILLUMINANT_F2 + +#define ILLUMINANT_TUNGSTEN ILLUMINANT_A +#define ILLUMINANT_DAYLIGHT ILLUMINANT_C +#define ILLUMINANT_FLUORESCENT ILLUMINANT_F2 +#define ILLUMINANT_NTSC ILLUMINANT_C + +#define RGB_GAMMA_MIN (USHORT)02500 +#define RGB_GAMMA_MAX (USHORT)65000 + +#define REFERENCE_WHITE_MIN (USHORT)6000 +#define REFERENCE_WHITE_MAX (USHORT)10000 +#define REFERENCE_BLACK_MIN (USHORT)0 +#define REFERENCE_BLACK_MAX (USHORT)4000 + +#define COLOR_ADJ_MIN (SHORT)-100 +#define COLOR_ADJ_MAX (SHORT)100 + +/* raster operations */ +#define R2_BLACK 1 +#define R2_NOTMERGEPEN 2 +#define R2_MASKNOTPEN 3 +#define R2_NOTCOPYPEN 4 +#define R2_MASKPENNOT 5 +#define R2_NOT 6 +#define R2_XORPEN 7 +#define R2_NOTMASKPEN 8 +#define R2_MASKPEN 9 +#define R2_NOTXORPEN 10 +#define R2_NOP 11 +#define R2_MERGENOTPEN 12 +#define R2_COPYPEN 13 +#define R2_MERGEPENNOT 14 +#define R2_MERGEPEN 15 +#define R2_WHITE 16 +#define R2_LAST 16 + +#define SRCCOPY (DWORD)0x00CC0020 +#define SRCPAINT (DWORD)0x00EE0086 +#define SRCAND (DWORD)0x008800C6 +#define SRCINVERT (DWORD)0x00660046 +#define SRCERASE (DWORD)0x00440328 +#define NOTSRCCOPY (DWORD)0x00330008 +#define NOTSRCERASE (DWORD)0x001100A6 +#define MERGECOPY (DWORD)0x00C000CA +#define MERGEPAINT (DWORD)0x00BB0226 +#define PATCOPY (DWORD)0x00F00021 +#define PATPAINT (DWORD)0x00FB0A09 +#define PATINVERT (DWORD)0x005A0049 +#define DSTINVERT (DWORD)0x00550009 +#define BLACKNESS (DWORD)0x00000042 +#define WHITENESS (DWORD)0x00FF0062 +#define NOMIRRORBITMAP (DWORD)0x80000000 +#define CAPTUREBLT (DWORD)0x40000000 +#define MAKE_ROP4(f,b) (DWORD)((((b)<<8) & 0xFF000000)|(f)) + +/* dib flags */ +#define CBM_INIT 0x04L +#define DIB_RGB_COLORS 0 +#define DIB_PAL_COLORS 1 + +/* flood types */ +#define FLOODFILLBORDER 0 +#define FLOODFILLSURFACE 1 + +/* gradient fill flags */ +#define GRADIENT_FILL_RECT_H 0x00 +#define GRADIENT_FILL_RECT_V 0x01 +#define GRADIENT_FILL_TRIANGLE 0x02 +#define GRADIENT_FILL_OP_FLAG 0xff + +/* stretch blt modes */ +#define STRETCH_ANDSCANS 1 +#define STRETCH_ORSCANS 2 +#define STRETCH_DELETESCANS 3 +#define STRETCH_HALFTONE 4 + +/* stretch blt legacy modes */ +#define BLACKONWHITE 1 +#define WHITEONBLACK 2 +#define COLORONCOLOR 3 +#define HALFTONE 4 +#define MAXSTRETCHBLTMODE 4 diff --git a/wingdi_bitmap_fnapi.h b/wingdi_bitmap_fnapi.h new file mode 100644 index 0000000..4642ca1 --- /dev/null +++ b/wingdi_bitmap_fnapi.h @@ -0,0 +1,270 @@ +#include + +BOOL __stdcall AlphaBlend( + HDC hdcDest, + int xoriginDest, + int yoriginDest, + int wDest, + int hDest, + HDC hdcSrc, + int xoriginSrc, + int yoriginSrc, + int wSrc, + int hSrc, + BLENDFUNCTION ftn); + + +BOOL __stdcall BitBlt( + HDC hdcDest, + int nXDest, + int nYDest, + int nWidth, + int nHeight, + HDC hdcSrc, + int nXSrc, + int nYSrc, + DWORD dwRop); + + +HBITMAP __stdcall CreateBitmap( + int nWidth, + int nHeight, + UINT cPlanes, + UINT cBitsPerPel, + const void * lpvBits); + +HBITMAP __stdcall CreateBitmapIndirect( + const BITMAP * lpbm); + + +HBITMAP __stdcall CreateCompatibleBitmap( + HDC hdc, + int nWidth, + int nHeight); + + +HBITMAP __stdcall CreateDIBitmap( + HDC hdc, + const BITMAPINFOHEADER * lpbmih, + DWORD fdwInit, + const void * lpbInit, + const BITMAPINFO * lpbmi, + UINT fuUsage); + + +HBITMAP __stdcall CreateDIBSection( + HDC hdc, + const BITMAPINFO * pbmi, + UINT iUsage, + VOID ** ppvBits, + HANDLE hSection, + DWORD dwOffset); + + +HBITMAP __stdcall CreateDiscardableBitmap( + HDC hdc, + int nWidth, + int nHeight); + +BOOL __stdcall ExtFloodFill( + HDC hdc, + int nXStart, + int nYStart, + COLORREF crColor, + UINT fuFillType); + + +BOOL __stdcall GradientFill( + HDC hdc, + PTRIVERTEX pVertex, + ULONG nVertex, + PVOID pMesh, + ULONG nMesh, + ULONG ulMode); + + +BOOL __stdcall TransparentBlt( + HDC hdcDest, + int xoriginDest, + int yoriginDest, + int wDest, + int hDest, + HDC hdcSrc, + int xoriginSrc, + int yoriginSrc, + int wSrc, + int hSrc, + UINT crTransparent); + + +LONG __stdcall GetBitmapBits( + HBITMAP hbmp, + LONG cbBuffer, + LPVOID lpvBits); + + +BOOL __stdcall GetBitmapDimensionEx( + HBITMAP hBitmap, + LPSIZE lpDimension); + + +UINT __stdcall GetDIBColorTable( + HDC hdc, + UINT uStartIndex, + UINT cEntries, + RGBQUAD * pColors); + + +int __stdcall GetDIBits( + HDC hdc, + HBITMAP hbmp, + UINT uStartScan, + UINT cScanLines, + LPVOID lpvBits, + LPBITMAPINFO lpbi, + UINT uUsage); + + +COLORREF __stdcall GetPixel( + HDC hdc, + int nXPos, + int nYPos); + + +int __stdcall GetStretchBltMode( + HDC hdc); + + +HBITMAP __stdcall LoadBitmapA( + HINSTANCE hInstance, + char * lpBitmapName); + +HBITMAP __stdcall LoadBitmapM( + HINSTANCE hInstance, + char * lpBitmapName); + +HBITMAP __stdcall LoadBitmapW( + HINSTANCE hInstance, + WCHAR lpBitmapName); + +#define __default_variant (LoadBitmap) + + +BOOL __stdcall MaskBlt( + HDC hdcDest, + int nXDest, + int nYDest, + int nWidth, + int nHeight, + HDC hdcSrc, + int nXSrc, + int nYSrc, + HBITMAP hbmMask, + int xMask, + int yMask, + DWORD dwRop); + + +BOOL __stdcall PlgBlt( + HDC hdcDest, + const POINT * lpPoint, + HDC hdcSrc, + int nXSrc, + int nYSrc, + int nWidth, + int nHeight, + HBITMAP hbmMask, + int xMask, + int yMask); + + +LONG __stdcall SetBitmapBits( + HBITMAP hbmp, + DWORD cBytes, + const void * lpBits); + +BOOL __stdcall SetBitmapDimensionEx( + HBITMAP hBitmap, + int nWidth, + int nHeight, + LPSIZE lpSize); + + +UINT __stdcall SetDIBColorTable( + HDC hdc, + UINT uStartIndex, + UINT cEntries, + const RGBQUAD * pColors); + + +int __stdcall SetDIBits( + HDC hdc, + HBITMAP hbmp, + UINT uStartScan, + UINT cScanLines, + const void * lpvBits, + const BITMAPINFO *l pbmi, + UINT fuColorUse); + +int __stdcall SetDIBitsToDevice( + HDC hdc, + int XDest, + int YDest, + DWORD dwWidth, + DWORD dwHeight, + int XSrc, + int YSrc, + UINT uStartScan, + UINT cScanLines, + const void * lpvBits, + const BITMAPINFO * lpbmi, + UINT fuColorUse); + + +COLORREF __stdcall SetPixel( + HDC hdc, + int X, + int Y, + COLORREF crColor); + + +BOOL __stdcall SetPixelV( + HDC hdc, + int X, + int Y, + COLORREF crColor); + + +int __stdcall SetStretchBltMode( + HDC hdc, + int iStretchMode); + + +BOOL __stdcall StretchBlt( + HDC hdcDest, + int nXOriginDest, + int nYOriginDest, + int nWidthDest, + int nHeightDest, + HDC hdcSrc, + int nXOriginSrc, + int nYOriginSrc, + int nWidthSrc, + int nHeightSrc, + DWORD dwRop); + + +int __stdcall StretchDIBits( + HDC hdc, + int XDest, + int YDest, + int nDestWidth, + int nDestHeight, + int XSrc, + int YSrc, + int nSrcWidth, + int nSrcHeight, + const void * lpBits, + const BITMAPINFO * lpBitsInfo, + UINT iUsage, + DWORD dwRop); diff --git a/wingdi_bitmap_struct.h b/wingdi_bitmap_struct.h new file mode 100644 index 0000000..2cfde26 --- /dev/null +++ b/wingdi_bitmap_struct.h @@ -0,0 +1,177 @@ +typedef struct tagRGBTRIPLE { + unsigned char rgbtBlue; + unsigned char rgbtGreen; + unsigned char rgbtRed; +} RGBTRIPLE, *PRGBTRIPLE, *NPRGBTRIPLE, *LPRGBTRIPLE; + +typedef struct tagRGBQUAD { + unsigned char rgbBlue; + unsigned char rgbGreen; + unsigned char rgbRed; + unsigned char rgbReserved; +} RGBQUAD; + +typedef struct tagCIEXYZ { + FXPT2DOT30 ciexyzX; + FXPT2DOT30 ciexyzY; + FXPT2DOT30 ciexyzZ; +} CIEXYZ; + +typedef struct tagCIEXYZTRIPLE { + CIEXYZ ciexyzRed; + CIEXYZ ciexyzGreen; + CIEXYZ ciexyzBlue; +} CIEXYZTRIPLE; + +typedef struct _GRADIENT_RECT { + ULONG UpperLeft; + ULONG LowerRight; +} GRADIENT_RECT, *PGRADIENT_RECT, *LPGRADIENT_RECT; + +typedef struct _GRADIENT_TRIANGLE { + ULONG Vertex1; + ULONG Vertex2; + ULONG Vertex3; +} GRADIENT_TRIANGLE, *PGRADIENT_TRIANGLE, *LPGRADIENT_TRIANGLE; + +typedef struct _TRIVERTEX { + LONG x; + LONG y; + COLOR16 Red; + COLOR16 Green; + COLOR16 Blue; + COLOR16 Alpha; +} TRIVERTEX, *PTRIVERTEX, *LPTRIVERTEX; + +typedef struct tagBITMAP { + LONG bmType; + LONG bmWidth; + LONG bmHeight; + LONG bmWidthBytes; + WORD bmPlanes; + WORD bmBitsPixel; + void * bmBits; +} BITMAP, *PBITMAP, *NPBITMAP, *LPBITMAP; + +typedef struct tagBITMAPCOREHEADER { + DWORD bcSize; + WORD bcWidth; + WORD bcHeight; + WORD bcPlanes; + WORD bcBitCount; +} BITMAPCOREHEADER, *PBITMAPCOREHEADER, *LPBITMAPCOREHEADER; + +typedef struct _BITMAPCOREINFO { + BITMAPCOREHEADER bmciHeader; + RGBTRIPLE bmciColors[]; +} BITMAPCOREINFO; + +typedef struct tagBITMAPFILEHEADER { + WORD bfType; + DWORD bfSize; + WORD bfReserved1; + WORD bfReserved2; + DWORD bfOffBits; +} BITMAPFILEHEADER, *PBITMAPFILEHEADER; + +typedef struct tagBITMAPINFOHEADER { + DWORD biSize; + LONG biWidth; + LONG biHeight; + WORD biPlanes; + WORD biBitCount; + DWORD biCompression; + DWORD biSizeImage; + LONG biXPelsPerMeter; + LONG biYPelsPerMeter; + DWORD biClrUsed; + DWORD biClrImportant; +} BITMAPINFOHEADER, *PBITMAPINFOHEADER; + +typedef struct tagBITMAPINFO { + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[]; +} BITMAPINFO, *PBITMAPINFO; + + +typedef struct tagBITMAPV4HEADER { + DWORD bV4Size; + LONG bV4Width; + LONG bV4Height; + WORD bV4Planes; + WORD bV4BitCount; + DWORD bV4V4Compression; + DWORD bV4SizeImage; + LONG bV4XPelsPerMeter; + LONG bV4YPelsPerMeter; + DWORD bV4ClrUsed; + DWORD bV4ClrImportant; + DWORD bV4RedMask; + DWORD bV4GreenMask; + DWORD bV4BlueMask; + DWORD bV4AlphaMask; + DWORD bV4CSType; + CIEXYZTRIPLE bV4Endpoints; + DWORD bV4GammaRed; + DWORD bV4GammaGreen; + DWORD bV4GammaBlue; +} BITMAPV4HEADER, *PBITMAPV4HEADER; + + +typedef struct tagBITMAPV5HEADER { + DWORD bV4Size; + LONG bV4Width; + LONG bV4Height; + WORD bV4Planes; + WORD bV4BitCount; + DWORD bV4V4Compression; + DWORD bV4SizeImage; + LONG bV4XPelsPerMeter; + LONG bV4YPelsPerMeter; + DWORD bV4ClrUsed; + DWORD bV4ClrImportant; + DWORD bV4RedMask; + DWORD bV4GreenMask; + DWORD bV4BlueMask; + DWORD bV4AlphaMask; + DWORD bV4CSType; + CIEXYZTRIPLE bV4Endpoints; + DWORD bV4GammaRed; + DWORD bV4GammaGreen; + DWORD bV4GammaBlue; + DWORD bV5Intent; + DWORD bV5ProfileData; + DWORD bV5ProfileSize; + DWORD bV5Reserved; +} BITMAPV5HEADER, *PBITMAPV5HEADER; + + +typedef struct _BLENDFUNCTION { + unsigned char BlendOp; + unsigned char BlendFlags; + unsigned char SourceConstantAlpha; + unsigned char AlphaFormat; +} BLENDFUNCTION, *PBLENDFUNCTION, *LPBLENDFUNCTION; + +typedef struct tagCOLORADJUSTMENT { + WORD caSize; + WORD caFlags; + WORD caIlluminantIndex; + WORD caRedGamma; + WORD caGreenGamma; + WORD caBlueGamma; + WORD caReferenceBlack; + WORD caReferenceWhite; + SHORT caContrast; + SHORT caBrightness; + SHORT caColorfulness; + SHORT caRedGreenTint; +} COLORADJUSTMENT, *PCOLORADJUSTMENT; + +typedef struct tagDIBSECTION { + BITMAP dsBm; + BITMAPINFOHEADER dsBmih; + DWORD dsBitfields[3]; + HANDLE dshSection; + DWORD dsOffset; +} DIBSECTION, *PDIBSECTION; diff --git a/wingdi_common.h b/wingdi_common.h new file mode 100644 index 0000000..0d2cd56 --- /dev/null +++ b/wingdi_common.h @@ -0,0 +1,44 @@ +#ifndef _GDI_COMMON_H_ +#define _GDI_COMMON_H_ + +#include + +typedef uint COLORREF; +typedef unsigned short COLOR16; +typedef int FXPT16DOT16; +typedef int FXPT2DOT30; + + +typedef struct tagPOINT { + int x; + int y; +} POINT, *PPOINT, *NPPOINT, *LPPOINT; + +typedef struct _POINTL { + int x; + int y; +} POINTL, *PPOINTL, *NPPOINTL, *LPPOINTL; + +typedef struct tagPOINTS { + int x; + int y; +} POINTS, *PPOINTS, *NPPOINTS, *LPPOINTS; + +typedef struct tagSIZE { + int cx; + int cy; +} SIZE, *PSIZE, *LPSIZE; + +typedef struct _SIZEL { + int cx; + int cy; +} SIZEL, *PSIZEL, *LPSIZEL; + +typedef struct tagRECT { + int left; + int top; + int right; + int bottom; +} RECT, *PRECT, *NPRECT, *LPRECT; + +#endif /* _GDI_COMMON_H_ */ -- cgit v1.2.3