/// <summary> /// The SetDIBitsToDevice function sets the pixels in the specified rectangle on the device that /// is associated with the destination device context using color data from a DIB. /// </summary> /// <param name="hdc">Handle to the device context</param> /// <param name="xDest">Specifies the x-coordinate, in logical units, of the upper-left /// corner of the destination rectangle</param> /// <param name="yDest">Specifies the y-coordinate, in logical units, of the upper-left /// corner of the destination rectangle</param> /// <param name="width">Specifies the width, in logical units, of the DIB</param> /// <param name="height">Specifies the height, in logical units, of the DIB</param> /// <param name="xSrc">Specifies the x-coordinate, in logical units, of the lower-left corner of the DIB</param> /// <param name="ySrc">Specifies the y-coordinate, in logical units, of the lower-left corner of the DIB</param> /// <param name="startScan">Specifies the starting scan line in the DIB</param> /// <param name="cLines">Specifies the number of DIB scan lines contained in the array pointed to by the lpvBits parameter</param> /// <param name="lpvBits">Pointer to DIB color data stored as an array of bytes. For more information, /// see the following Remarks section</param> /// <param name="lpbmi">Pointer to a BITMAPINFO structure that contains information about the DIB</param> /// <param name="colorUse">Specifies whether the bmiColors member of the BITMAPINFO structure contains explicit red, green, /// blue (RGB) values or indexes into a palette.</param> /// <returns>If the function succeeds, the return value is the number of scan lines set.</returns> /// <remarks>Windows 98/Me, Windows 2000/XP: SetDIBitsToDevice has been extended to allow a JPEG or PNG /// image to be passed as the source image</remarks> public static int SetDIBitsToDevice([In] IntPtr hdc, int xDest, int yDest, uint width, uint height, int xSrc, int ySrc, uint startScan, uint cLines, [In] IntPtr lpvBits, [In] ref BitmapInfo lpbmi, DIBColorTable colorUse) { return(Native.SetDIBitsToDevice(hdc, xDest, yDest, width, height, xSrc, ySrc, startScan, cLines, lpvBits, ref lpbmi, colorUse)); }
/// <summary> /// The SetDIBits function sets the pixels in a compatible bitmap (DDB) using the color data found in the specified DIB /// </summary> /// <param name="hdc">Handle to a device context</param> /// <param name="hbm">Handle to the compatible bitmap (DDB) that is to be altered using the color data from the specified DIB</param> /// <param name="start">Specifies the starting scan line for the device-independent color data in the array pointed to by the lpBits parameter</param> /// <param name="cLines">Specifies the number of scan lines found in the array containing device-independent color data</param> /// <param name="lpBits">Pointer to the DIB color data, stored as an array of bytes. The format of the bitmap values depends on the biBitCount member of the /// BITMAPINFO structure pointed to by the lpbmi parameter</param> /// <param name="lpbmi">Pointer to a BITMAPINFO structure that contains information about the DIB</param> /// <param name="colorUse">Specifies whether the bmiColors member of the BITMAPINFO structure was provided and, if so, whether bmiColors contains explicit /// red, green, blue (RGB) values or palette indexes.</param> /// <returns>If the function succeeds, the return value is the number of scan lines copied, 0 otherwise</returns> public static int SetDIBits([In] IntPtr hdc, [In] IntPtr hbm, uint start, uint cLines, [In] IntPtr lpBits, [In] ref BitmapInfo lpbmi, DIBColorTable colorUse) { return Native.SetDIBits(hdc, hbm, start, cLines, lpBits, ref lpbmi, colorUse); }
/// <summary> /// The GetDIBits function retrieves the bits of the specified compatible bitmap and copies them into /// a buffer as a DIB using the specified format /// </summary> /// <param name="hdc">Handle to the device context</param> /// <param name="hbm">Handle to the bitmap. This must be a compatible bitmap (DDB)</param> /// <param name="start">Specifies the first scan line to retrieve</param> /// <param name="cLines">Specifies the number of scan lines to retrieve</param> /// <param name="lpvBits">Pointer to a buffer to receive the bitmap data. If this parameter is null, /// the function passes the dimensions and format of the bitmap to the BITMAPINFO structure pointed to /// by the lpbmi parameter</param> /// <param name="lpbmi">Pointer to a BITMAPINFO structure that specifies the desired format for the DIB data</param> /// <param name="usage">Specifies the format of the bmiColors member of the BITMAPINFO structure.</param> /// <returns>If the lpvBits parameter is non-null and the function succeeds, the return value is the number of scan lines copied from the bitmap</returns> public static int GetDIBits([In] IntPtr hdc, [In] IntPtr hbm, uint start, uint cLines, IntPtr lpvBits, ref BitmapInfo lpbmi, DIBColorTable usage) { return Native.GetDIBits(hdc, hbm, start, cLines, lpvBits, ref lpbmi, usage); }
/// <summary> /// The CreateDIBSection function creates a DIB that applications can write to directly. The function gives you a pointer to /// the location of the bitmap bit values. You can supply a handle to a file-mapping object that the function will use to /// create the bitmap, or you can let the system allocate the memory for the bitmap /// </summary> /// <param name="hdc">Handle to a device context. If the value of iUsage is DIB_PAL_COLORS, the function uses this device /// context's logical palette to initialize the DIB colors.</param> /// <param name="pbmi">Pointer to a BITMAPINFO structure that specifies various attributes of the DIB, /// including the bitmap dimensions and colors</param> /// <param name="iUsage">Specifies the type of data contained in the bmiColors array member of the BITMAPINFO structure pointed to /// by pbmi (either logical palette indexes or literal RGB values)</param> /// <param name="ppvBits">Pointer to a variable that receives a pointer to the location of the DIB bit values</param> /// <param name="hSection">Handle to a file-mapping object that the function will use to create the DIB. This parameter can be null. /// <para>If hSection is not null, it must be a handle to a file-mapping object created by calling the CreateFileMapping function with /// the PAGE_READWRITE or PAGE_WRITECOPY flag. Read-only DIB sections are not supported. Handles created by other means will cause CreateDIBSection to fail. /// </para> /// If hSection is not null, the CreateDIBSection function locates the bitmap bit values at offset dwOffset in the file-mapping object referred to by hSection. /// An application can later retrieve the hSection handle by calling the GetObject function with the HBITMAP returned by CreateDIBSection. /// <para> /// If hSection is null, the system allocates memory for the DIB. In this case, the CreateDIBSection function ignores the dwOffset parameter. /// An application cannot later obtain a handle to this memory. The dshSection member of the DIBSECTION structure filled in by calling the GetObject function will be null /// </para></param> /// <param name="dwOffset">Specifies the offset from the beginning of the file-mapping object referenced by hSection where storage for the bitmap bit values is to begin. This value is ignored if hSection is null. /// The bitmap bit values are aligned on doubleword boundaries, so dwOffset must be a multiple of the size of a DWORD</param> /// <returns></returns> public static IntPtr CreateDIBSection([In] IntPtr hdc, [In] ref BitmapInfo pbmi, DIBColorTable iUsage, ref IntPtr ppvBits, [In] IntPtr hSection, uint dwOffset) { return Native.CreateDIBSection(hdc, ref pbmi, iUsage, ref ppvBits, hSection, dwOffset); }
/// <summary> /// The CreateDIBPatternBrushPt function creates a logical brush that has the pattern specified by the device-independent bitmap (DIB). /// </summary> /// <param name="lpPackedDIB">Pointer to a packed DIB consisting of a BITMAPINFO structure immediately followed by an array of bytes defining the pixels of the bitmap</param> /// <param name="iUsage">Specifies whether the bmiColors member of the BITMAPINFO structure contains a valid color table and, if so, whether the entries in this color /// table contain explicit red, green, blue (RGB) values or palette indexes</param> /// <returns>If the function succeeds, the return value identifies a logical brush, else false</returns> public static IntPtr CreateDIBPatternBrushPt([In] IntPtr lpPackedDIB, DIBColorTable iUsage) { return Native.CreateDIBPatternBrushPt(lpPackedDIB, iUsage); }
public static extern IntPtr CreateDIBPatternBrushPt([In] IntPtr lpPackedDIB, DIBColorTable iUsage);
public static extern int SetDIBits([In] IntPtr hdc, [In] IntPtr hbm, uint start, uint cLines, [In] IntPtr lpBits, [In] ref BitmapInfo lpbmi, DIBColorTable colorUse);
public static extern IntPtr CreateDIBSection([In] IntPtr hdc, [In] ref BitmapInfo lpbmi, DIBColorTable usage, ref IntPtr ppvBits, [In] IntPtr hSection, uint offset);
public static extern int GetDIBits([In] IntPtr hdc, [In] IntPtr hbm, uint start, uint cLines, IntPtr lpvBits, ref BitmapInfo lpbmi, DIBColorTable usage);
/// <summary> /// The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits /// </summary> /// <param name="hdc">Handle to a device context</param> /// <param name="pbmih">Pointer to a bitmap information header structure, which may be one of those shown as /// Windows NT 3.51 and earlier - BITMAPINFOHEADER /// Windows 95 and Windows NT 4.0 - BITMAPV4HEADER /// Windows 98/Me and Windows 2000 - BITMAPV5HEADER /// </param> /// <param name="flInit">Specifies how the system initializes the bitmap bits. /// If fdwInit is zero, the system does not initialize the bitmap bits</param> /// <remarks>CBM_INIT : If this flag is set, the system uses the data pointed to by the lpbInit and lpbmi parameters to initialize the bitmap bits. /// If this flag is clear, the data pointed to by those parameters is not used</remarks> /// <param name="pjBits">Pointer to an array of bytes containing the initial bitmap data. The format of the data depends on the biBitCount member of /// the BITMAPINFO structure to which the lpbmi parameter points</param> /// <param name="pbmi">Pointer to a BITMAPINFO structure that describes the dimensions and color format of the array pointed to by the lpbInit parameter</param> /// <param name="iUsage">Specifies whether the bmiColors member of the BITMAPINFO structure was initialized and, if so, whether bmiColors contains explicit red, /// green, blue (RGB) values or palette indexes</param> /// <returns>If the function succeeds, the return value is a handle to the compatible bitmap, else null</returns> public static IntPtr CreateDIBitmap([In] IntPtr hdc, ref IBitmapInfoHeader pbmih, uint flInit, [In] IntPtr pjBits, [In] ref BitmapInfo pbmi, DIBColorTable iUsage) { return(Native.CreateDIBitmap(hdc, ref pbmih, flInit, pjBits, ref pbmi, iUsage)); }
/// <summary> /// The SetDIBits function sets the pixels in a compatible bitmap (DDB) using the color data found in the specified DIB /// </summary> /// <param name="hdc">Handle to a device context</param> /// <param name="hbm">Handle to the compatible bitmap (DDB) that is to be altered using the color data from the specified DIB</param> /// <param name="start">Specifies the starting scan line for the device-independent color data in the array pointed to by the lpBits parameter</param> /// <param name="cLines">Specifies the number of scan lines found in the array containing device-independent color data</param> /// <param name="lpBits">Pointer to the DIB color data, stored as an array of bytes. The format of the bitmap values depends on the biBitCount member of the /// BITMAPINFO structure pointed to by the lpbmi parameter</param> /// <param name="lpbmi">Pointer to a BITMAPINFO structure that contains information about the DIB</param> /// <param name="colorUse">Specifies whether the bmiColors member of the BITMAPINFO structure was provided and, if so, whether bmiColors contains explicit /// red, green, blue (RGB) values or palette indexes.</param> /// <returns>If the function succeeds, the return value is the number of scan lines copied, 0 otherwise</returns> public static int SetDIBits([In] IntPtr hdc, [In] IntPtr hbm, uint start, uint cLines, [In] IntPtr lpBits, [In] ref BitmapInfo lpbmi, DIBColorTable colorUse) { return(Native.SetDIBits(hdc, hbm, start, cLines, lpBits, ref lpbmi, colorUse)); }
/// <summary> /// The GetDIBits function retrieves the bits of the specified compatible bitmap and copies them into /// a buffer as a DIB using the specified format /// </summary> /// <param name="hdc">Handle to the device context</param> /// <param name="hbm">Handle to the bitmap. This must be a compatible bitmap (DDB)</param> /// <param name="start">Specifies the first scan line to retrieve</param> /// <param name="cLines">Specifies the number of scan lines to retrieve</param> /// <param name="lpvBits">Pointer to a buffer to receive the bitmap data. If this parameter is null, /// the function passes the dimensions and format of the bitmap to the BITMAPINFO structure pointed to /// by the lpbmi parameter</param> /// <param name="lpbmi">Pointer to a BITMAPINFO structure that specifies the desired format for the DIB data</param> /// <param name="usage">Specifies the format of the bmiColors member of the BITMAPINFO structure.</param> /// <returns>If the lpvBits parameter is non-null and the function succeeds, the return value is the number of scan lines copied from the bitmap</returns> public static int GetDIBits([In] IntPtr hdc, [In] IntPtr hbm, uint start, uint cLines, IntPtr lpvBits, ref BitmapInfo lpbmi, DIBColorTable usage) { return(Native.GetDIBits(hdc, hbm, start, cLines, lpvBits, ref lpbmi, usage)); }
/// <summary> /// The CreateDIBSection function creates a DIB that applications can write to directly. The function gives you a pointer to /// the location of the bitmap bit values. You can supply a handle to a file-mapping object that the function will use to /// create the bitmap, or you can let the system allocate the memory for the bitmap /// </summary> /// <param name="hdc">Handle to a device context. If the value of iUsage is DIB_PAL_COLORS, the function uses this device /// context's logical palette to initialize the DIB colors.</param> /// <param name="pbmi">Pointer to a BITMAPINFO structure that specifies various attributes of the DIB, /// including the bitmap dimensions and colors</param> /// <param name="iUsage">Specifies the type of data contained in the bmiColors array member of the BITMAPINFO structure pointed to /// by pbmi (either logical palette indexes or literal RGB values)</param> /// <param name="ppvBits">Pointer to a variable that receives a pointer to the location of the DIB bit values</param> /// <param name="hSection">Handle to a file-mapping object that the function will use to create the DIB. This parameter can be null. /// <para>If hSection is not null, it must be a handle to a file-mapping object created by calling the CreateFileMapping function with /// the PAGE_READWRITE or PAGE_WRITECOPY flag. Read-only DIB sections are not supported. Handles created by other means will cause CreateDIBSection to fail. /// </para> /// If hSection is not null, the CreateDIBSection function locates the bitmap bit values at offset dwOffset in the file-mapping object referred to by hSection. /// An application can later retrieve the hSection handle by calling the GetObject function with the HBITMAP returned by CreateDIBSection. /// <para> /// If hSection is null, the system allocates memory for the DIB. In this case, the CreateDIBSection function ignores the dwOffset parameter. /// An application cannot later obtain a handle to this memory. The dshSection member of the DIBSECTION structure filled in by calling the GetObject function will be null /// </para></param> /// <param name="dwOffset">Specifies the offset from the beginning of the file-mapping object referenced by hSection where storage for the bitmap bit values is to begin. This value is ignored if hSection is null. /// The bitmap bit values are aligned on doubleword boundaries, so dwOffset must be a multiple of the size of a DWORD</param> /// <returns></returns> public static IntPtr CreateDIBSection([In] IntPtr hdc, [In] ref BitmapInfo pbmi, DIBColorTable iUsage, ref IntPtr ppvBits, [In] IntPtr hSection, uint dwOffset) { return(Native.CreateDIBSection(hdc, ref pbmi, iUsage, ref ppvBits, hSection, dwOffset)); }
/// <summary> /// The SetDIBitsToDevice function sets the pixels in the specified rectangle on the device that /// is associated with the destination device context using color data from a DIB. /// </summary> /// <param name="hdc">Handle to the device context</param> /// <param name="xDest">Specifies the x-coordinate, in logical units, of the upper-left /// corner of the destination rectangle</param> /// <param name="yDest">Specifies the y-coordinate, in logical units, of the upper-left /// corner of the destination rectangle</param> /// <param name="width">Specifies the width, in logical units, of the DIB</param> /// <param name="height">Specifies the height, in logical units, of the DIB</param> /// <param name="xSrc">Specifies the x-coordinate, in logical units, of the lower-left corner of the DIB</param> /// <param name="ySrc">Specifies the y-coordinate, in logical units, of the lower-left corner of the DIB</param> /// <param name="startScan">Specifies the starting scan line in the DIB</param> /// <param name="cLines">Specifies the number of DIB scan lines contained in the array pointed to by the lpvBits parameter</param> /// <param name="lpvBits">Pointer to DIB color data stored as an array of bytes. For more information, /// see the following Remarks section</param> /// <param name="lpbmi">Pointer to a BITMAPINFO structure that contains information about the DIB</param> /// <param name="colorUse">Specifies whether the bmiColors member of the BITMAPINFO structure contains explicit red, green, /// blue (RGB) values or indexes into a palette.</param> /// <returns>If the function succeeds, the return value is the number of scan lines set.</returns> /// <remarks>Windows 98/Me, Windows 2000/XP: SetDIBitsToDevice has been extended to allow a JPEG or PNG /// image to be passed as the source image</remarks> public static int SetDIBitsToDevice([In] IntPtr hdc, int xDest, int yDest, uint width, uint height, int xSrc, int ySrc, uint startScan, uint cLines, [In] IntPtr lpvBits, [In] ref BitmapInfo lpbmi, DIBColorTable colorUse) { return Native.SetDIBitsToDevice(hdc, xDest, yDest, width, height, xSrc, ySrc, startScan, cLines, lpvBits, ref lpbmi, colorUse); }
public static extern int SetDIBitsToDevice([In] IntPtr hdc, int xDest, int yDest, uint w, uint h, int xSrc, int ySrc, uint startScan, uint cLines, [In] IntPtr lpvBits, [In] ref BitmapInfo lpbmi, DIBColorTable colorUse);
public static extern IntPtr CreateDIBitmap([In] IntPtr hdc, ref IBitmapInfoHeader pbmih, uint flInit, [In] IntPtr pjBits, [In] ref BitmapInfo pbmi, DIBColorTable iUsage);
/// <summary> /// The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits /// </summary> /// <param name="hdc">Handle to a device context</param> /// <param name="pbmih">Pointer to a bitmap information header structure, which may be one of those shown as /// Windows NT 3.51 and earlier - BITMAPINFOHEADER /// Windows 95 and Windows NT 4.0 - BITMAPV4HEADER /// Windows 98/Me and Windows 2000 - BITMAPV5HEADER /// </param> /// <param name="flInit">Specifies how the system initializes the bitmap bits. /// If fdwInit is zero, the system does not initialize the bitmap bits</param> /// <remarks>CBM_INIT : If this flag is set, the system uses the data pointed to by the lpbInit and lpbmi parameters to initialize the bitmap bits. /// If this flag is clear, the data pointed to by those parameters is not used</remarks> /// <param name="pjBits">Pointer to an array of bytes containing the initial bitmap data. The format of the data depends on the biBitCount member of /// the BITMAPINFO structure to which the lpbmi parameter points</param> /// <param name="pbmi">Pointer to a BITMAPINFO structure that describes the dimensions and color format of the array pointed to by the lpbInit parameter</param> /// <param name="iUsage">Specifies whether the bmiColors member of the BITMAPINFO structure was initialized and, if so, whether bmiColors contains explicit red, /// green, blue (RGB) values or palette indexes</param> /// <returns>If the function succeeds, the return value is a handle to the compatible bitmap, else null</returns> public static IntPtr CreateDIBitmap([In] IntPtr hdc, ref IBitmapInfoHeader pbmih, uint flInit, [In] IntPtr pjBits, [In] ref BitmapInfo pbmi, DIBColorTable iUsage) { return Native.CreateDIBitmap(hdc, ref pbmih, flInit, pjBits, ref pbmi, iUsage); }
/// <summary> /// The CreateDIBPatternBrushPt function creates a logical brush that has the pattern specified by the device-independent bitmap (DIB). /// </summary> /// <param name="lpPackedDIB">Pointer to a packed DIB consisting of a BITMAPINFO structure immediately followed by an array of bytes defining the pixels of the bitmap</param> /// <param name="iUsage">Specifies whether the bmiColors member of the BITMAPINFO structure contains a valid color table and, if so, whether the entries in this color /// table contain explicit red, green, blue (RGB) values or palette indexes</param> /// <returns>If the function succeeds, the return value identifies a logical brush, else false</returns> public static IntPtr CreateDIBPatternBrushPt([In] IntPtr lpPackedDIB, DIBColorTable iUsage) { return(Native.CreateDIBPatternBrushPt(lpPackedDIB, iUsage)); }