|
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{
/// <content>
/// Contains extern methods from "GDI32.dll".
/// </content>
internal static partial class PInvokeCore
{
/// <summary>The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.</summary>
/// <param name="hdc">A handle to the destination device context.</param>
/// <param name="x">The x-coordinate, in logical units, of the upper-left corner of the destination rectangle.</param>
/// <param name="y">The y-coordinate, in logical units, of the upper-left corner of the destination rectangle.</param>
/// <param name="cx">The width, in logical units, of the source and destination rectangles.</param>
/// <param name="cy">The height, in logical units, of the source and the destination rectangles.</param>
/// <param name="hdcSrc">A handle to the source device context.</param>
/// <param name="x1">The x-coordinate, in logical units, of the upper-left corner of the source rectangle.</param>
/// <param name="y1">The y-coordinate, in logical units, of the upper-left corner of the source rectangle.</param>
/// <param name="rop">
/// <para>A raster-operation code. These codes define how the color data for the source rectangle is to be combined with the color data for the destination rectangle to achieve the final color. The following list shows some common raster operation codes. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-bitblt#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call <a href="https://docs.microsoft.com/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a>.</para>
/// </returns>
/// <remarks>
/// <para><b>BitBlt</b> only does clipping on the destination DC. If a rotation or shear transformation is in effect in the source device context, <b>BitBlt</b> returns an error. If other transformations exist in the source device context (and a matching transformation is not in effect in the destination device context), the rectangle in the destination device context is stretched, compressed, or rotated, as necessary. If the color formats of the source and destination device contexts do not match, the <b>BitBlt</b> function converts the source color format to match the destination format. When an enhanced metafile is being recorded, an error occurs if the source device context identifies an enhanced-metafile device context. Not all devices support the <b>BitBlt</b> function. For more information, see the RC_BITBLT raster capability entry in the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getdevicecaps">GetDeviceCaps</a> function as well as the following functions: <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-maskblt">MaskBlt</a>, <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-plgblt">PlgBlt</a>, and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-stretchblt">StretchBlt</a>. <b>BitBlt</b> returns an error if the source and destination device contexts represent different devices. To transfer data between DCs for different devices, convert the memory bitmap to a DIB by calling <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getdibits">GetDIBits</a>. To display the DIB to the second device, call <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-setdibits">SetDIBits</a> or <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-stretchdibits">StretchDIBits</a>. <b>ICM:</b> No color management is performed when blits occur.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-bitblt#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[SupportedOSPlatform("windows5.0")]
internal static winmdroot.Foundation.BOOL BitBlt(winmdroot.Graphics.Gdi.HDC hdc, int x, int y, int cx, int cy, winmdroot.Graphics.Gdi.HDC hdcSrc, int x1, int y1, winmdroot.Graphics.Gdi.ROP_CODE rop)
{
Marshal.SetLastSystemError(0);
winmdroot.Foundation.BOOL __retVal = LocalExternFunction(hdc, x, y, cx, cy, hdcSrc, x1, y1, rop);
Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
return __retVal;
[DllImport("GDI32.dll", ExactSpelling = true, EntryPoint = "BitBlt"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
static extern winmdroot.Foundation.BOOL LocalExternFunction(winmdroot.Graphics.Gdi.HDC hdc, int x, int y, int cx, int cy, winmdroot.Graphics.Gdi.HDC hdcSrc, int x1, int y1, winmdroot.Graphics.Gdi.ROP_CODE rop);
}
/// <summary>The DeleteEnhMetaFile function deletes an enhanced-format metafile or an enhanced-format metafile handle.</summary>
/// <param name="hmf">A handle to an enhanced metafile.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>If the <i>hemf</i> parameter identifies an enhanced metafile stored in memory, the <b>DeleteEnhMetaFile</b> function deletes the metafile. If <i>hemf</i> identifies a metafile stored on a disk, the function deletes the metafile handle but does not destroy the actual metafile. An application can retrieve the file by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getenhmetafilea">GetEnhMetaFile</a> function.</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Foundation.BOOL DeleteEnhMetaFile(winmdroot.Graphics.Gdi.HENHMETAFILE hmf);
/// <summary>The CloseEnhMetaFile function closes an enhanced-metafile device context and returns a handle that identifies an enhanced-format metafile.</summary>
/// <param name="hdc">Handle to an enhanced-metafile device context.</param>
/// <returns>
/// <para>If the function succeeds, the return value is a handle to an enhanced metafile. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>An application can use the enhanced-metafile handle returned by the <b>CloseEnhMetaFile</b> function to perform the following tasks: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-closeenhmetafile#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.HENHMETAFILE CloseEnhMetaFile(winmdroot.Graphics.Gdi.HDC hdc);
/// <summary>The DeleteObject function deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid.</summary>
/// <param name="ho">A handle to a logical pen, brush, font, bitmap, region, or palette.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the specified handle is not valid or is currently selected into a DC, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>Do not delete a drawing object (pen or brush) while it is still selected into a DC. When a pattern brush is deleted, the bitmap associated with the brush is not deleted. The bitmap must be deleted independently.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-deleteobject#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Foundation.BOOL DeleteObject(winmdroot.Graphics.Gdi.HGDIOBJ ho);
/// <summary>The CombineRgn function combines two regions and stores the result in a third region. The two regions are combined according to the specified mode.</summary>
/// <param name="hrgnDst">A handle to a new region with dimensions defined by combining two other regions. (This region must exist before <b>CombineRgn</b> is called.)</param>
/// <param name="hrgnSrc1">A handle to the first of two regions to be combined.</param>
/// <param name="hrgnSrc2">A handle to the second of two regions to be combined.</param>
/// <param name="iMode"></param>
/// <returns>
/// <para>The return value specifies the type of the resulting region. It can be one of the following values. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>The three regions need not be distinct. For example, the <i>hrgnSrc1</i> parameter can equal the <i>hrgnDest</i> parameter.</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.GDI_REGION_TYPE CombineRgn(winmdroot.Graphics.Gdi.HRGN hrgnDst, winmdroot.Graphics.Gdi.HRGN hrgnSrc1, winmdroot.Graphics.Gdi.HRGN hrgnSrc2, winmdroot.Graphics.Gdi.RGN_COMBINE_MODE iMode);
/// <summary>The CreateBitmap function creates a bitmap with the specified width, height, and color format (color planes and bits-per-pixel).</summary>
/// <param name="nWidth">The bitmap width, in pixels.</param>
/// <param name="nHeight">The bitmap height, in pixels.</param>
/// <param name="nPlanes">The number of color planes used by the device.</param>
/// <param name="nBitCount">The number of bits required to identify the color of a single pixel.</param>
/// <param name="lpBits">
/// <para>A pointer to an array of color data used to set the colors in a rectangle of pixels. Each scan line in the rectangle must be word aligned (scan lines that are not word aligned must be padded with zeros). The buffer size expected, *cj*, can be calculated using the formula: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createbitmap#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is a handle to a bitmap. If the function fails, the return value is <b>NULL</b>. This function can return the following value. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>The <b>CreateBitmap</b> function creates a device-dependent bitmap. After a bitmap is created, it can be selected into a device context by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-selectobject">SelectObject</a> function. However, the bitmap can only be selected into a device context if the bitmap and the DC have the same format. The <b>CreateBitmap</b> function can be used to create color bitmaps. However, for performance reasons applications should use <b>CreateBitmap</b> to create monochrome bitmaps and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createcompatiblebitmap">CreateCompatibleBitmap</a> to create color bitmaps. Whenever a color bitmap returned from <b>CreateBitmap</b> is selected into a device context, the system checks that the bitmap matches the format of the device context it is being selected into. Because <b>CreateCompatibleBitmap</b> takes a device context, it returns a bitmap that has the same format as the specified device context. Thus, subsequent calls to <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-selectobject">SelectObject</a> are faster with a color bitmap from <b>CreateCompatibleBitmap</b> than with a color bitmap returned from <b>CreateBitmap</b>. If the bitmap is monochrome, zeros represent the foreground color and ones represent the background color for the destination device context. If an application sets the <i>nWidth</i> or <i>nHeight</i> parameters to zero, <b>CreateBitmap</b> returns the handle to a 1-by-1 pixel, monochrome bitmap. When you no longer need the bitmap, call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteobject">DeleteObject</a> function to delete it.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createbitmap#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Graphics.Gdi.HBITMAP CreateBitmap(int nWidth, int nHeight, uint nPlanes, uint nBitCount, [Optional] void* lpBits);
/// <summary>The CreateCompatibleBitmap function creates a bitmap compatible with the device that is associated with the specified device context.</summary>
/// <param name="hdc">A handle to a device context.</param>
/// <param name="cx">The bitmap width, in pixels.</param>
/// <param name="cy">The bitmap height, in pixels.</param>
/// <returns>
/// <para>If the function succeeds, the return value is a handle to the compatible bitmap (DDB). If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>The color format of the bitmap created by the <b>CreateCompatibleBitmap</b> function matches the color format of the device identified by the <i>hdc</i> parameter. This bitmap can be selected into any memory device context that is compatible with the original device. Because memory device contexts allow both color and monochrome bitmaps, the format of the bitmap returned by the <b>CreateCompatibleBitmap</b> function differs when the specified device context is a memory device context. However, a compatible bitmap that was created for a nonmemory device context always possesses the same color format and uses the same color palette as the specified device context. Note: When a memory device context is created, it initially has a 1-by-1 monochrome bitmap selected into it. If this memory device context is used in <b>CreateCompatibleBitmap</b>, the bitmap that is created is a <i>monochrome</i> bitmap. To create a color bitmap, use the <b>HDC</b> that was used to create the memory device context, as shown in the following code:</para>
/// <para></para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createcompatiblebitmap#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.HBITMAP CreateCompatibleBitmap(winmdroot.Graphics.Gdi.HDC hdc, int cx, int cy);
/// <summary>The CreateCompatibleDC function creates a memory device context (DC) compatible with the specified device.</summary>
/// <param name="hdc">A handle to an existing DC. If this handle is <b>NULL</b>, the function creates a memory DC compatible with the application's current screen.</param>
/// <returns>
/// <para>If the function succeeds, the return value is the handle to a memory DC. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>A memory DC exists only in memory. When the memory DC is created, its display surface is exactly one monochrome pixel wide and one monochrome pixel high. Before an application can use a memory DC for drawing operations, it must select a bitmap of the correct width and height into the DC. To select a bitmap into a DC, use the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createcompatiblebitmap">CreateCompatibleBitmap</a> function, specifying the height, width, and color organization required. When a memory DC is created, all attributes are set to normal default values. The memory DC can be used as a normal DC. You can set the attributes; obtain the current settings of its attributes; and select pens, brushes, and regions. The <b>CreateCompatibleDC</b> function can only be used with devices that support raster operations. An application can determine whether a device supports these operations by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getdevicecaps">GetDeviceCaps</a> function. When you no longer need the memory DC, call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deletedc">DeleteDC</a> function. We recommend that you call <b>DeleteDC</b> to delete the DC. However, you can also call <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteobject">DeleteObject</a> with the HDC to delete the DC. If <i>hdc</i> is <b>NULL</b>, the thread that calls <b>CreateCompatibleDC</b> owns the HDC that is created. When this thread is destroyed, the HDC is no longer valid. Thus, if you create the HDC and pass it to another thread, then exit the first thread, the second thread will not be able to use the HDC. <b>ICM:</b> If the DC that is passed to this function is enabled for Image Color Management (ICM), the DC created by the function is ICM-enabled. The source and destination color spaces are specified in the DC.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createcompatibledc#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.HDC CreateCompatibleDC(winmdroot.Graphics.Gdi.HDC hdc);
/// <inheritdoc cref="CreateDCW(winmdroot.Foundation.PCWSTR, winmdroot.Foundation.PCWSTR, winmdroot.Foundation.PCWSTR, winmdroot.Graphics.Gdi.DEVMODEW*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Graphics.Gdi.HDC CreateDCW(string pwszDriver, string pwszDevice, string pszPort, winmdroot.Graphics.Gdi.DEVMODEW? pdm)
{
fixed (char* pszPortLocal = pszPort)
{
fixed (char* pwszDeviceLocal = pwszDevice)
{
fixed (char* pwszDriverLocal = pwszDriver)
{
winmdroot.Graphics.Gdi.DEVMODEW pdmLocal = pdm ?? default(winmdroot.Graphics.Gdi.DEVMODEW);
winmdroot.Graphics.Gdi.HDC __result = PInvokeCore.CreateDCW(pwszDriverLocal, pwszDeviceLocal, pszPortLocal, pdm.HasValue ? &pdmLocal : null);
return __result;
}
}
}
}
/// <summary>The CreateDC function creates a device context (DC) for a device using the specified name. (Unicode)</summary>
/// <param name="pwszDriver">A pointer to a null-terminated character string that specifies either DISPLAY or the name of a specific display device. For printing, we recommend that you pass <b>NULL</b> to <i>lpszDriver</i> because GDI ignores <i>lpszDriver</i> for printer devices.</param>
/// <param name="pwszDevice">
/// <para>A pointer to a null-terminated character string that specifies the name of the specific output device being used, as shown by the Print Manager (for example, Epson FX-80). It is not the printer model name. The <i>lpszDevice</i> parameter must be used. To obtain valid names for displays, call <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-enumdisplaydevicesw">EnumDisplayDevices</a>. If <i>lpszDriver</i> is DISPLAY or the device name of a specific display device, then <i>lpszDevice</i> must be <b>NULL</b> or that same device name. If <i>lpszDevice</i> is <b>NULL</b>, then a DC is created for the primary display device. If there are multiple monitors on the system, calling <c>CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL)</c> will create a DC covering all the monitors.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createdcw#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="pszPort">This parameter is ignored and should be set to <b>NULL</b>. It is provided only for compatibility with 16-bit Windows.</param>
/// <param name="pdm">
/// <para>A pointer to a <a href="https://docs.microsoft.com/windows/win32/api/wingdi/ns-wingdi-devmodew">DEVMODE</a> structure containing device-specific initialization data for the device driver. The <a href="https://docs.microsoft.com/windows/desktop/printdocs/documentproperties">DocumentProperties</a> function retrieves this structure filled in for a specified device. The <i>pdm</i> parameter must be <b>NULL</b> if the device driver is to use the default initialization (if any) specified by the user. If <i>lpszDriver</i> is DISPLAY, <i>pdm</i> must be <b>NULL</b>; GDI then uses the display device's current <a href="https://docs.microsoft.com/windows/win32/api/wingdi/ns-wingdi-devmodea">DEVMODE</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createdcw#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is the handle to a DC for the specified device. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>Note that the handle to the DC can only be used by a single thread at any one time. For parameters <i>lpszDriver</i> and <i>lpszDevice</i>, call <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-enumdisplaydevicesw">EnumDisplayDevices</a> to obtain valid names for displays. When you no longer need the DC, call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deletedc">DeleteDC</a> function. If <i>lpszDriver</i> or <i>lpszDevice</i> is DISPLAY, the thread that calls <b>CreateDC</b> owns the <b>HDC</b> that is created. When this thread is destroyed, the <b>HDC</b> is no longer valid. Thus, if you create the <b>HDC</b> and pass it to another thread, then exit the first thread, the second thread will not be able to use the <b>HDC</b>. When you call <b>CreateDC</b> to create the <b>HDC</b> for a display device, you must pass to <i>pdm</i> either <b>NULL</b> or a pointer to <a href="https://docs.microsoft.com/windows/win32/api/wingdi/ns-wingdi-devmodew">DEVMODE</a> that matches the current <b>DEVMODE</b> of the display device that <i>lpszDevice</i> specifies. We recommend to pass <b>NULL</b> and not to try to exactly match the <b>DEVMODE</b> for the current display device. When you call <b>CreateDC</b> to create the <b>HDC</b> for a printer device, the printer driver validates the <a href="https://docs.microsoft.com/windows/win32/api/wingdi/ns-wingdi-devmodew">DEVMODE</a>. If the printer driver determines that the <b>DEVMODE</b> is invalid (that is, printer driver can’t convert or consume the DEVMODE), the printer driver provides a default <b>DEVMODE</b> to create the HDC for the printer device. <b>ICM:</b> To enable ICM, set the <b>dmICMMethod</b> member of the <a href="https://docs.microsoft.com/windows/win32/api/wingdi/ns-wingdi-devmodew">DEVMODE</a> structure (pointed to by the <i>pInitData</i> parameter) to the appropriate value.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createdcw#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Graphics.Gdi.HDC CreateDCW(winmdroot.Foundation.PCWSTR pwszDriver, winmdroot.Foundation.PCWSTR pwszDevice, winmdroot.Foundation.PCWSTR pszPort, [Optional] winmdroot.Graphics.Gdi.DEVMODEW* pdm);
/// <inheritdoc cref="CreateDIBSection(winmdroot.Graphics.Gdi.HDC, winmdroot.Graphics.Gdi.BITMAPINFO*, winmdroot.Graphics.Gdi.DIB_USAGE, void**, winmdroot.Foundation.HANDLE, uint)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Graphics.Gdi.HBITMAP CreateDIBSection(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.BITMAPINFO* pbmi, winmdroot.Graphics.Gdi.DIB_USAGE usage, out void* ppvBits, winmdroot.Foundation.HANDLE hSection, uint offset)
{
fixed (void** ppvBitsLocal = &ppvBits)
{
winmdroot.Graphics.Gdi.HBITMAP __result = PInvokeCore.CreateDIBSection(hdc, pbmi, usage, ppvBitsLocal, hSection, offset);
return __result;
}
}
/// <summary>The CreateDIBSection function creates a DIB that applications can write to directly.</summary>
/// <param name="hdc">A handle to a device context. If the value of <i>iUsage</i> is DIB_PAL_COLORS, the function uses this device context's logical palette to initialize the DIB colors.</param>
/// <param name="pbmi">A pointer to a <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-bitmapinfo">BITMAPINFO</a> structure that specifies various attributes of the DIB, including the bitmap dimensions and colors.</param>
/// <param name="usage">
/// <para>The type of data contained in the <b>bmiColors</b> array member of the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-bitmapinfo">BITMAPINFO</a> structure pointed to by <i>pbmi</i> (either logical palette indexes or literal RGB values). The following values are defined. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createdibsection#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="ppvBits">A pointer to a variable that receives a pointer to the location of the DIB bit values.</param>
/// <param name="hSection">
/// <para>A handle to a file-mapping object that the function will use to create the DIB. This parameter can be <b>NULL</b>. If <i>hSection</i> is not <b>NULL</b>, it must be a handle to a file-mapping object created by calling the <a href="https://docs.microsoft.com/windows/desktop/api/winbase/nf-winbase-createfilemappinga">CreateFileMapping</a> function with the PAGE_READWRITE or PAGE_WRITECOPY flag. Read-only DIB sections are not supported. Handles created by other means will cause <b>CreateDIBSection</b> to fail. If <i>hSection</i> is not <b>NULL</b>, the <b>CreateDIBSection</b> function locates the bitmap bit values at offset <i>dwOffset</i> in the file-mapping object referred to by <i>hSection</i>. An application can later retrieve the <i>hSection</i> handle by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getobject">GetObject</a> function with the <b>HBITMAP</b> returned by <b>CreateDIBSection</b>. If <i>hSection</i> is <b>NULL</b>, the system allocates memory for the DIB. In this case, the <b>CreateDIBSection</b> function ignores the <i>dwOffset</i> parameter. An application cannot later obtain a handle to this memory. The <b>dshSection</b> member of the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-dibsection">DIBSECTION</a> structure filled in by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getobject">GetObject</a> function will be <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createdibsection#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="offset">The offset from the beginning of the file-mapping object referenced by <i>hSection</i> where storage for the bitmap bit values is to begin. This value is ignored if <i>hSection</i> is <b>NULL</b>. The bitmap bit values are aligned on doubleword boundaries, so <i>dwOffset</i> must be a multiple of the size of a <b>DWORD</b>.</param>
/// <returns>
/// <para>If the function succeeds, the return value is a handle to the newly created DIB, and *<i>ppvBits</i> points to the bitmap bit values. If the function fails, the return value is <b>NULL</b>, and *<i>ppvBits</i> is <b>NULL</b>. To get extended error information, call <a href="https://docs.microsoft.com/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a>. <a href="https://docs.microsoft.com/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a> can return the following value: </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>As noted above, if <i>hSection</i> is <b>NULL</b>, the system allocates memory for the DIB. The system closes the handle to that memory when you later delete the DIB by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteobject">DeleteObject</a> function. If <i>hSection</i> is not <b>NULL</b>, you must close the <i>hSection</i> memory handle yourself after calling <b>DeleteObject</b> to delete the bitmap. You cannot paste a DIB section from one application into another application. <b>CreateDIBSection</b> does not use the <a href="https://docs.microsoft.com/windows/win32/api/wingdi/ns-wingdi-bitmapinfoheader">BITMAPINFOHEADER</a> parameters <i>biXPelsPerMeter</i> or <i>biYPelsPerMeter</i> and will not provide resolution information in the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-bitmapinfo">BITMAPINFO</a> structure. You need to guarantee that the GDI subsystem has completed any drawing to a bitmap created by <b>CreateDIBSection</b> before you draw to the bitmap yourself. Access to the bitmap must be synchronized. Do this by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-gdiflush">GdiFlush</a> function. This applies to any use of the pointer to the bitmap bit values, including passing the pointer in calls to functions such as <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-setdibits">SetDIBits</a>. <b>ICM:</b> No color management is done.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createdibsection#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Graphics.Gdi.HBITMAP CreateDIBSection(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.BITMAPINFO* pbmi, winmdroot.Graphics.Gdi.DIB_USAGE usage, void** ppvBits, winmdroot.Foundation.HANDLE hSection, uint offset)
{
Marshal.SetLastSystemError(0);
winmdroot.Graphics.Gdi.HBITMAP __retVal = LocalExternFunction(hdc, pbmi, usage, ppvBits, hSection, offset);
Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
return __retVal;
[DllImport("GDI32.dll", ExactSpelling = true, EntryPoint = "CreateDIBSection"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
static extern unsafe winmdroot.Graphics.Gdi.HBITMAP LocalExternFunction(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.BITMAPINFO* pbmi, winmdroot.Graphics.Gdi.DIB_USAGE usage, void** ppvBits, winmdroot.Foundation.HANDLE hSection, uint offset);
}
/// <inheritdoc cref="CreateEnhMetaFile(winmdroot.Graphics.Gdi.HDC, winmdroot.Foundation.PCWSTR, winmdroot.Foundation.RECT*, winmdroot.Foundation.PCWSTR)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Graphics.Gdi.HDC CreateEnhMetaFile(winmdroot.Graphics.Gdi.HDC hdc, string lpFilename, winmdroot.Foundation.RECT? lprc, string lpDesc)
{
fixed (char* lpDescLocal = lpDesc)
{
fixed (char* lpFilenameLocal = lpFilename)
{
winmdroot.Foundation.RECT lprcLocal = lprc ?? default(winmdroot.Foundation.RECT);
winmdroot.Graphics.Gdi.HDC __result = PInvokeCore.CreateEnhMetaFile(hdc, lpFilenameLocal, lprc.HasValue ? &lprcLocal : null, lpDescLocal);
return __result;
}
}
}
/// <summary>The CreateEnhMetaFile function creates a device context for an enhanced-format metafile. This device context can be used to store a device-independent picture. (Unicode)</summary>
/// <param name="hdc">A handle to a reference device for the enhanced metafile. This parameter can be <b>NULL</b>; for more information, see Remarks.</param>
/// <param name="lpFilename">A pointer to the file name for the enhanced metafile to be created. If this parameter is <b>NULL</b>, the enhanced metafile is memory based and its contents are lost when it is deleted by using the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteenhmetafile">DeleteEnhMetaFile</a> function.</param>
/// <param name="lprc">A pointer to a <a href="https://docs.microsoft.com/windows/desktop/api/windef/ns-windef-rect">RECT</a> structure that specifies the dimensions (in .01-millimeter units) of the picture to be stored in the enhanced metafile.</param>
/// <param name="lpDesc">A pointer to a string that specifies the name of the application that created the picture, as well as the picture's title. This parameter can be <b>NULL</b>; for more information, see Remarks.</param>
/// <returns>
/// <para>If the function succeeds, the return value is a handle to the device context for the enhanced metafile. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>Where text arguments must use Unicode characters, use the <b>CreateEnhMetaFile</b> function as a wide-character function. Where text arguments must use characters from the Windows character set, use this function as an ANSI function. The system uses the reference device identified by the <i>hdcRef</i> parameter to record the resolution and units of the device on which a picture originally appeared. If the <i>hdcRef</i> parameter is <b>NULL</b>, it uses the current display device for reference. The <b>left</b> and <b>top</b> members of the <a href="https://docs.microsoft.com/windows/desktop/api/windef/ns-windef-rect">RECT</a> structure pointed to by the <i>lpRect</i> parameter must be less than the <b>right</b> and <b>bottom</b> members, respectively. Points along the edges of the rectangle are included in the picture. If <i>lpRect</i> is <b>NULL</b>, the graphics device interface (GDI) computes the dimensions of the smallest rectangle that surrounds the picture drawn by the application. The <i>lpRect</i> parameter should be provided where possible. The string pointed to by the <i>lpDescription</i> parameter must contain a null character between the application name and the picture name and must terminate with two null characters, for example, "XYZ Graphics Editor\0Bald Eagle\0\0", where \0 represents the null character. If <i>lpDescription</i> is <b>NULL</b>, there is no corresponding entry in the enhanced-metafile header. Applications use the device context created by this function to store a graphics picture in an enhanced metafile. The handle identifying this device context can be passed to any GDI function. After an application stores a picture in an enhanced metafile, it can display the picture on any output device by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-playenhmetafile">PlayEnhMetaFile</a> function. When displaying the picture, the system uses the rectangle pointed to by the <i>lpRect</i> parameter and the resolution data from the reference device to position and scale the picture. The device context returned by this function contains the same default attributes associated with any new device context. Applications must use the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getwinmetafilebits">GetWinMetaFileBits</a> function to convert an enhanced metafile to the older Windows metafile format. The file name for the enhanced metafile should use the .emf extension.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createenhmetafilew#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true, EntryPoint = "CreateEnhMetaFileW"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Graphics.Gdi.HDC CreateEnhMetaFile(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Foundation.PCWSTR lpFilename, [Optional] winmdroot.Foundation.RECT* lprc, winmdroot.Foundation.PCWSTR lpDesc);
/// <inheritdoc cref="CreateFontIndirect(winmdroot.Graphics.Gdi.LOGFONTW*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Graphics.Gdi.HFONT CreateFontIndirect(in winmdroot.Graphics.Gdi.LOGFONTW lplf)
{
fixed (winmdroot.Graphics.Gdi.LOGFONTW* lplfLocal = &lplf)
{
winmdroot.Graphics.Gdi.HFONT __result = PInvokeCore.CreateFontIndirect(lplfLocal);
return __result;
}
}
/// <summary>The CreateFontIndirect function creates a logical font that has the specified characteristics. The font can subsequently be selected as the current font for any device context. (Unicode)</summary>
/// <param name="lplf">A pointer to a <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-logfonta">LOGFONT</a> structure that defines the characteristics of the logical font.</param>
/// <returns>
/// <para>If the function succeeds, the return value is a handle to a logical font. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>The <b>CreateFontIndirect</b> function creates a logical font with the characteristics specified in the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-logfonta">LOGFONT</a> structure. When this font is selected by using the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-selectobject">SelectObject</a> function, GDI's font mapper attempts to match the logical font with an existing physical font. If it fails to find an exact match, it provides an alternative whose characteristics match as many of the requested characteristics as possible. To get the appropriate font on different language versions of the OS, call <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-enumfontfamiliesexa">EnumFontFamiliesEx</a> with the desired font characteristics in the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-logfonta">LOGFONT</a> structure, retrieve the appropriate typeface name, and create the font using <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createfonta">CreateFont</a> or <b>CreateFontIndirect</b>. When you no longer need the font, call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteobject">DeleteObject</a> function to delete it. The fonts for many East Asian languages have two typeface names: an English name and a localized name. <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createfonta">CreateFont</a> and <b>CreateFontIndirect</b> take the localized typeface name only on a system locale that matches the language, while they take the English typeface name on all other system locales. The best method is to try one name and, on failure, try the other. Note that <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-enumfontsa">EnumFonts</a>, <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-enumfontfamiliesa">EnumFontFamilies</a>, and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-enumfontfamiliesexa">EnumFontFamiliesEx</a> return the English typeface name if the system locale does not match the language of the font. The font mapper for <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createfonta">CreateFont</a>, <b>CreateFontIndirect</b>, and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createfontindirectexa">CreateFontIndirectEx</a> recognizes both the English and the localized typeface name, regardless of locale.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createfontindirectw#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true, EntryPoint = "CreateFontIndirectW"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Graphics.Gdi.HFONT CreateFontIndirect(winmdroot.Graphics.Gdi.LOGFONTW* lplf);
/// <inheritdoc cref="CreateICW(winmdroot.Foundation.PCWSTR, winmdroot.Foundation.PCWSTR, winmdroot.Foundation.PCWSTR, winmdroot.Graphics.Gdi.DEVMODEW*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Graphics.Gdi.HDC CreateICW(string pszDriver, string pszDevice, string pszPort, winmdroot.Graphics.Gdi.DEVMODEW? pdm)
{
fixed (char* pszPortLocal = pszPort)
{
fixed (char* pszDeviceLocal = pszDevice)
{
fixed (char* pszDriverLocal = pszDriver)
{
winmdroot.Graphics.Gdi.DEVMODEW pdmLocal = pdm ?? default(winmdroot.Graphics.Gdi.DEVMODEW);
winmdroot.Graphics.Gdi.HDC __result = PInvokeCore.CreateICW(pszDriverLocal, pszDeviceLocal, pszPortLocal, pdm.HasValue ? &pdmLocal : null);
return __result;
}
}
}
}
/// <summary>The CreateIC function creates an information context for the specified device. (Unicode)</summary>
/// <param name="pszDriver">A pointer to a null-terminated character string that specifies the name of the device driver (for example, Epson).</param>
/// <param name="pszDevice">A pointer to a null-terminated character string that specifies the name of the specific output device being used, as shown by the Print Manager (for example, Epson FX-80). It is not the printer model name. The <i>lpszDevice</i> parameter must be used.</param>
/// <param name="pszPort">This parameter is ignored and should be set to <b>NULL</b>. It is provided only for compatibility with 16-bit Windows.</param>
/// <param name="pdm">A pointer to a <a href="https://docs.microsoft.com/windows/win32/api/wingdi/ns-wingdi-devmodea">DEVMODE</a> structure containing device-specific initialization data for the device driver. The <a href="https://docs.microsoft.com/windows/desktop/printdocs/documentproperties">DocumentProperties</a> function retrieves this structure filled in for a specified device. The <i>lpdvmInit</i> parameter must be <b>NULL</b> if the device driver is to use the default initialization (if any) specified by the user.</param>
/// <returns>
/// <para>If the function succeeds, the return value is the handle to an information context. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>When you no longer need the information DC, call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deletedc">DeleteDC</a> function.</para>
/// <para>> [!NOTE] > The wingdi.h header defines CreateIC as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see [Conventions for Function Prototypes](/windows/win32/intl/conventions-for-function-prototypes).</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createicw#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Graphics.Gdi.HDC CreateICW(winmdroot.Foundation.PCWSTR pszDriver, winmdroot.Foundation.PCWSTR pszDevice, winmdroot.Foundation.PCWSTR pszPort, [Optional] winmdroot.Graphics.Gdi.DEVMODEW* pdm);
/// <summary>The CreatePen function creates a logical pen that has the specified style, width, and color. The pen can subsequently be selected into a device context and used to draw lines and curves.</summary>
/// <param name="iStyle"></param>
/// <param name="cWidth">
/// <para>The width of the pen, in logical units. If <i>nWidth</i> is zero, the pen is a single pixel wide, regardless of the current transformation. <b>CreatePen</b> returns a pen with the specified width but with the PS_SOLID style if you specify a width greater than one for the following styles: PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createpen#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="color">A color reference for the pen color. To generate a <a href="https://docs.microsoft.com/windows/desktop/gdi/colorref">COLORREF</a> structure, use the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-rgb">RGB</a> macro.</param>
/// <returns>
/// <para>If the function succeeds, the return value is a handle that identifies a logical pen. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>After an application creates a logical pen, it can select that pen into a device context by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-selectobject">SelectObject</a> function. After a pen is selected into a device context, it can be used to draw lines and curves. If the value specified by the <i>nWidth</i> parameter is zero, a line drawn with the created pen always is a single pixel wide regardless of the current transformation. If the value specified by <i>nWidth</i> is greater than 1, the <i>fnPenStyle</i> parameter must be PS_NULL, PS_SOLID, or PS_INSIDEFRAME. If the value specified by <i>nWidth</i> is greater than 1 and <i>fnPenStyle</i> is PS_INSIDEFRAME, the line associated with the pen is drawn inside the frame of all primitives except polygons and polylines. If the value specified by <i>nWidth</i> is greater than 1, <i>fnPenStyle</i> is PS_INSIDEFRAME, and the color specified by the <i>crColor</i> parameter does not match one of the entries in the logical palette, the system draws lines by using a dithered color. Dithered colors are not available with solid pens. When using an <i>iStyle</i> parameter of PS_DASH, PS_DOT, PS_DASHDOT or PS_DASHDOTDOT, in order to make the gaps between the dashes or dots transparent, use <a href="https://docs.microsoft.com/windows/win32/api/wingdi/nf-wingdi-setbkmode">SetBkMode</a> to set the mode to TRANSPARENT. When you no longer need the pen, call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteobject">DeleteObject</a> function to delete it. <b>ICM:</b> No color management is done at creation. However, color management is performed when the pen is selected into an ICM-enabled device context.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createpen#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.HPEN CreatePen(winmdroot.Graphics.Gdi.PEN_STYLE iStyle, int cWidth, winmdroot.Foundation.COLORREF color);
/// <summary>The CreateRectRgn function creates a rectangular region.</summary>
/// <param name="x1">Specifies the x-coordinate of the upper-left corner of the region in logical units.</param>
/// <param name="y1">Specifies the y-coordinate of the upper-left corner of the region in logical units.</param>
/// <param name="x2">Specifies the x-coordinate of the lower-right corner of the region in logical units.</param>
/// <param name="y2">Specifies the y-coordinate of the lower-right corner of the region in logical units.</param>
/// <returns>
/// <para>If the function succeeds, the return value is the handle to the region. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>When you no longer need the <b>HRGN</b> object, call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteobject">DeleteObject</a> function to delete it. Region coordinates are represented as 27-bit signed integers. Regions created by the Create<shape>Rgn methods (such as <b>CreateRectRgn</b> and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createpolygonrgn">CreatePolygonRgn</a>) only include the interior of the shape; the shape's outline is excluded from the region. This means that any point on a line between two sequential vertices is not included in the region. If you were to call <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-ptinregion">PtInRegion</a> for such a point, it would return zero as the result.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createrectrgn#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.HRGN CreateRectRgn(int x1, int y1, int x2, int y2);
/// <summary>The CreateSolidBrush function creates a logical brush that has the specified solid color.</summary>
/// <param name="color">The color of the brush. To create a <a href="https://docs.microsoft.com/windows/desktop/gdi/colorref">COLORREF</a> color value, use the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-rgb">RGB</a> macro.</param>
/// <returns>
/// <para>If the function succeeds, the return value identifies a logical brush. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>When you no longer need the <b>HBRUSH</b> object, call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteobject">DeleteObject</a> function to delete it. A solid brush is a bitmap that the system uses to paint the interiors of filled shapes. After an application creates a brush by calling <b>CreateSolidBrush</b>, it can select that brush into any device context by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-selectobject">SelectObject</a> function. To paint with a system color brush, an application should use <c>GetSysColorBrush (nIndex)</code> instead of <code>CreateSolidBrush(GetSysColor(nIndex))</c>, because <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-getsyscolorbrush">GetSysColorBrush</a> returns a cached brush instead of allocating a new one. <b>ICM:</b> No color management is done at brush creation. However, color management is performed when the brush is selected into an ICM-enabled device context.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-createsolidbrush#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.HBRUSH CreateSolidBrush(winmdroot.Foundation.COLORREF color);
/// <summary>The DeleteDC function deletes the specified device context (DC).</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>An application must not delete a DC whose handle was obtained by calling the <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-getdc">GetDC</a> function. Instead, it must call the <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-releasedc">ReleaseDC</a> function to free the DC.</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Foundation.BOOL DeleteDC(winmdroot.Graphics.Gdi.HDC hdc);
/// <inheritdoc cref="EnumEnhMetaFile(winmdroot.Graphics.Gdi.HDC, winmdroot.Graphics.Gdi.HENHMETAFILE, delegate *unmanaged[Stdcall]{global::Windows.Win32.Graphics.Gdi.HDC,global::Windows.Win32.Graphics.Gdi.HANDLETABLE*,global::Windows.Win32.Graphics.Gdi.ENHMETARECORD*,int,global::Windows.Win32.Foundation.LPARAM,int}, void*, winmdroot.Foundation.RECT*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Foundation.BOOL EnumEnhMetaFile(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.HENHMETAFILE hmf, delegate *unmanaged[Stdcall]<global::Windows.Win32.Graphics.Gdi.HDC,global::Windows.Win32.Graphics.Gdi.HANDLETABLE*,global::Windows.Win32.Graphics.Gdi.ENHMETARECORD*,int,global::Windows.Win32.Foundation.LPARAM,int> proc, void* param3, winmdroot.Foundation.RECT? lpRect)
{
winmdroot.Foundation.RECT lpRectLocal = lpRect ?? default(winmdroot.Foundation.RECT);
winmdroot.Foundation.BOOL __result = PInvokeCore.EnumEnhMetaFile(hdc, hmf, proc, param3, lpRect.HasValue ? &lpRectLocal : null);
return __result;
}
/// <summary>The EnumEnhMetaFile function enumerates the records within an enhanced-format metafile by retrieving each record and passing it to the specified callback function.</summary>
/// <param name="hdc">A handle to a device context. This handle is passed to the callback function.</param>
/// <param name="hmf">A handle to an enhanced metafile.</param>
/// <param name="proc">A pointer to the application-supplied callback function. For more information, see the <a href="https://docs.microsoft.com/previous-versions/dd162606(v=vs.85)">EnhMetaFileProc</a> function.</param>
/// <param name="lpRect">A pointer to a <a href="https://docs.microsoft.com/windows/desktop/api/windef/ns-windef-rect">RECT</a> structure that specifies the coordinates, in logical units, of the picture's upper-left and lower-right corners.</param>
/// <returns>
/// <para>If the callback function successfully enumerates all the records in the enhanced metafile, the return value is nonzero. If the callback function does not successfully enumerate all the records in the enhanced metafile, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>Points along the edge of the rectangle pointed to by the <i>lpRect</i> parameter are included in the picture. If the <i>hdc</i> parameter is <b>NULL</b>, the system ignores <i>lpRect</i>. If the callback function calls the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-playenhmetafilerecord">PlayEnhMetaFileRecord</a> function, <i>hdc</i> must identify a valid device context. The system uses the device context's transformation and mapping mode to transform the picture displayed by the <b>PlayEnhMetaFileRecord</b> function. You can use the <b>EnumEnhMetaFile</b> function to embed one enhanced-metafile within another.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-enumenhmetafile#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Foundation.BOOL EnumEnhMetaFile(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.HENHMETAFILE hmf, delegate *unmanaged[Stdcall]<global::Windows.Win32.Graphics.Gdi.HDC,global::Windows.Win32.Graphics.Gdi.HANDLETABLE*,global::Windows.Win32.Graphics.Gdi.ENHMETARECORD*,int,global::Windows.Win32.Foundation.LPARAM,int> proc, [Optional] void* param3, [Optional] winmdroot.Foundation.RECT* lpRect);
/// <summary>The GetClipRgn function retrieves a handle identifying the current application-defined clipping region for the specified device context.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="hrgn">A handle to an existing region before the function is called. After the function returns, this parameter is a handle to a copy of the current clipping region.</param>
/// <returns>If the function succeeds and there is no clipping region for the given device context, the return value is zero. If the function succeeds and there is a clipping region for the given device context, the return value is 1. If an error occurs, the return value is -1.</returns>
/// <remarks>
/// <para>An application-defined clipping region is a clipping region identified by the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-selectcliprgn">SelectClipRgn</a> function. It is not a clipping region created when the application calls the <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-beginpaint">BeginPaint</a> function. If the function succeeds, the <i>hrgn</i> parameter is a handle to a copy of the current clipping region. Subsequent changes to this copy will not affect the current clipping region.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getcliprgn#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern int GetClipRgn(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.HRGN hrgn);
/// <summary>The GetDeviceCaps function retrieves device-specific information for the specified device.</summary>
/// <param name="hdc">A handle to the DC.</param>
/// <param name="index"></param>
/// <returns>
/// <para>The return value specifies the value of the desired item. When <i>nIndex</i> is BITSPIXEL and the device has 15bpp or 16bpp, the return value is 16.</para>
/// </returns>
/// <remarks>
/// <para>When <i>nIndex</i> is SHADEBLENDCAPS: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getdevicecaps#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[SupportedOSPlatform("windows5.0")]
internal static int GetDeviceCaps(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.GET_DEVICE_CAPS_INDEX index)
{
int __retVal = LocalExternFunction(hdc, (int)index);
return __retVal;
[DllImport("GDI32.dll", ExactSpelling = true, EntryPoint = "GetDeviceCaps"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
static extern int LocalExternFunction(winmdroot.Graphics.Gdi.HDC hdc, int index);
}
/// <inheritdoc cref="GetEnhMetaFileBits(winmdroot.Graphics.Gdi.HENHMETAFILE, uint, byte*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe uint GetEnhMetaFileBits(winmdroot.Graphics.Gdi.HENHMETAFILE hEMF, Span<byte> lpData)
{
fixed (byte* lpDataLocal = lpData)
{
uint __result = PInvokeCore.GetEnhMetaFileBits(hEMF, (uint )lpData.Length, lpDataLocal);
return __result;
}
}
/// <summary>The GetEnhMetaFileBits function retrieves the contents of the specified enhanced-format metafile and copies them into a buffer.</summary>
/// <param name="hEMF">A handle to the enhanced metafile.</param>
/// <param name="nSize">The size, in bytes, of the buffer to receive the data.</param>
/// <param name="lpData">A pointer to a buffer that receives the metafile data. The buffer must be sufficiently large to contain the data. If <i>lpbBuffer</i> is <b>NULL</b>, the function returns the size necessary to hold the data.</param>
/// <returns>
/// <para>If the function succeeds and the buffer pointer is <b>NULL</b>, the return value is the size of the enhanced metafile, in bytes. If the function succeeds and the buffer pointer is a valid pointer, the return value is the number of bytes copied to the buffer. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>After the enhanced-metafile bits are retrieved, they can be used to create a memory-based metafile by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-setenhmetafilebits">SetEnhMetaFileBits</a> function. The <b>GetEnhMetaFileBits</b> function does not invalidate the enhanced-metafile handle. The application must call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteenhmetafile">DeleteEnhMetaFile</a> function to delete the handle when it is no longer needed. The metafile contents retrieved by this function are in the enhanced format. To retrieve the metafile contents in the Windows format, use the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getwinmetafilebits">GetWinMetaFileBits</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getenhmetafilebits#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe uint GetEnhMetaFileBits(winmdroot.Graphics.Gdi.HENHMETAFILE hEMF, uint nSize, [Optional] byte* lpData);
/// <summary>The GetObjectW (Unicode) function (wingdi.h) retrieves information for the specified graphics object.</summary>
/// <returns>
/// <para>If the function succeeds, and <i>lpvObject</i> is a valid pointer, the return value is the number of bytes stored into the buffer. If the function succeeds, and <i>lpvObject</i> is <b>NULL</b>, the return value is the number of bytes required to hold the information the function would store into the buffer. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>The buffer pointed to by the <i>lpvObject</i> parameter must be sufficiently large to receive the information about the graphics object. Depending on the graphics object, the function uses a <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-bitmap">BITMAP</a>, <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-dibsection">DIBSECTION</a>, <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-extlogpen">EXTLOGPEN</a>, <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-logbrush">LOGBRUSH</a>, <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-logfonta">LOGFONT</a>, or <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-logpen">LOGPEN</a> structure, or a count of table entries (for a logical palette). If <i>hgdiobj</i> is a handle to a bitmap created by calling <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createdibsection">CreateDIBSection</a>, and the specified buffer is large enough, the <b>GetObject</b> function returns a <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-dibsection">DIBSECTION</a> structure. In addition, the <b>bmBits</b> member of the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-bitmap">BITMAP</a> structure contained within the <b>DIBSECTION</b> will contain a pointer to the bitmap's bit values. If <i>hgdiobj</i> is a handle to a bitmap created by any other means, <b>GetObject</b> returns only the width, height, and color format information of the bitmap. You can obtain the bitmap's bit values by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getdibits">GetDIBits</a> or <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getbitmapbits">GetBitmapBits</a> function. If <i>hgdiobj</i> is a handle to a logical palette, <b>GetObject</b> retrieves a 2-byte integer that specifies the number of entries in the palette. The function does not retrieve the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-logpalette">LOGPALETTE</a> structure defining the palette. To retrieve information about palette entries, an application can call the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getpaletteentries">GetPaletteEntries</a> function. If <i>hgdiobj</i> is a handle to a font, the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-logfonta">LOGFONT</a> that is returned is the <b>LOGFONT</b> used to create the font. If Windows had to make some interpolation of the font because the precise <b>LOGFONT</b> could not be represented, the interpolation will not be reflected in the <b>LOGFONT</b>. For example, if you ask for a vertical version of a font that doesn't support vertical painting, the <b>LOGFONT</b> indicates the font is vertical, but Windows will paint it horizontally.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getobjectw#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true, EntryPoint = "GetObjectW"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe int GetObject(winmdroot.Graphics.Gdi.HGDIOBJ h, int c, [Optional] void* pv);
/// <summary>The GetObjectType retrieves the type of the specified object.</summary>
/// <param name="h">A handle to the graphics object.</param>
/// <returns>
/// <para>If the function succeeds, the return value identifies the object. This value can be one of the following. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getobjecttype">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern uint GetObjectType(winmdroot.Graphics.Gdi.HGDIOBJ h);
/// <inheritdoc cref="GetPaletteEntries(winmdroot.Graphics.Gdi.HPALETTE, uint, uint, winmdroot.Graphics.Gdi.PALETTEENTRY*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe uint GetPaletteEntries(winmdroot.Graphics.Gdi.HPALETTE hpal, uint iStart, Span<winmdroot.Graphics.Gdi.PALETTEENTRY> pPalEntries)
{
fixed (winmdroot.Graphics.Gdi.PALETTEENTRY* pPalEntriesLocal = pPalEntries)
{
uint __result = PInvokeCore.GetPaletteEntries(hpal, iStart, (uint )pPalEntries.Length, pPalEntriesLocal);
return __result;
}
}
/// <summary>The GetPaletteEntries function retrieves a specified range of palette entries from the given logical palette.</summary>
/// <param name="hpal">A handle to the logical palette.</param>
/// <param name="iStart">The first entry in the logical palette to be retrieved.</param>
/// <param name="cEntries">The number of entries in the logical palette to be retrieved.</param>
/// <param name="pPalEntries">A pointer to an array of <a href="https://docs.microsoft.com/previous-versions/dd162769(v=vs.85)">PALETTEENTRY</a> structures to receive the palette entries. The array must contain at least as many structures as specified by the <i>nEntries</i> parameter.</param>
/// <returns>
/// <para>If the function succeeds and the handle to the logical palette is a valid pointer (not <b>NULL</b>), the return value is the number of entries retrieved from the logical palette. If the function succeeds and handle to the logical palette is <b>NULL</b>, the return value is the number of entries in the given palette. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>An application can determine whether a device supports palette operations by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getdevicecaps">GetDeviceCaps</a> function and specifying the RASTERCAPS constant. If the <i>nEntries</i> parameter specifies more entries than exist in the palette, the remaining members of the <a href="https://docs.microsoft.com/previous-versions/dd162769(v=vs.85)">PALETTEENTRY</a> structure are not altered.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getpaletteentries#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe uint GetPaletteEntries(winmdroot.Graphics.Gdi.HPALETTE hpal, uint iStart, uint cEntries, [Optional] winmdroot.Graphics.Gdi.PALETTEENTRY* pPalEntries);
/// <summary>The GetRegionData function fills the specified buffer with data describing a region. This data includes the dimensions of the rectangles that make up the region.</summary>
/// <param name="hrgn">A handle to the region.</param>
/// <param name="nCount">The size, in bytes, of the <i>lpRgnData</i> buffer.</param>
/// <param name="lpRgnData">A pointer to a <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-rgndata">RGNDATA</a> structure that receives the information. The dimensions of the region are in logical units. If this parameter is <b>NULL</b>, the return value contains the number of bytes needed for the region data.</param>
/// <returns>
/// <para>If the function succeeds and <i>dwCount</i> specifies an adequate number of bytes, the return value is always <i>dwCount</i>. If <i>dwCount</i> is too small or the function fails, the return value is 0. If <i>lpRgnData</i> is <b>NULL</b>, the return value is the required number of bytes. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>The <b>GetRegionData</b> function is used in conjunction with the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-extcreateregion">ExtCreateRegion</a> function.</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe uint GetRegionData(winmdroot.Graphics.Gdi.HRGN hrgn, uint nCount, [Optional] winmdroot.Graphics.Gdi.RGNDATA* lpRgnData);
/// <summary>The GetStockObject function retrieves a handle to one of the stock pens, brushes, fonts, or palettes.</summary>
/// <param name="i"></param>
/// <returns>
/// <para>If the function succeeds, the return value is a handle to the requested logical object. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>It is not recommended that you employ this method to obtain the current font used by dialogs and windows. Instead, use the <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-systemparametersinfoa">SystemParametersInfo</a> function with the SPI_GETNONCLIENTMETRICS parameter to retrieve the current font. <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-systemparametersinfoa">SystemParametersInfo</a> will take into account the current theme and provides font information for captions, menus, and message dialogs. Use the DKGRAY_BRUSH, GRAY_BRUSH, and LTGRAY_BRUSH stock objects only in windows with the CS_HREDRAW and CS_VREDRAW styles. Using a gray stock brush in any other style of window can lead to misalignment of brush patterns after a window is moved or sized. The origins of stock brushes cannot be adjusted. The HOLLOW_BRUSH and NULL_BRUSH stock objects are equivalent. It is not necessary (but it is not harmful) to delete stock objects by calling <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-deleteobject">DeleteObject</a>. Both DC_BRUSH and DC_PEN can be used interchangeably with other stock objects like BLACK_BRUSH and BLACK_PEN. For information on retrieving the current pen or brush color, see <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getdcbrushcolor">GetDCBrushColor</a> and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getdcpencolor">GetDCPenColor</a>. See <a href="https://docs.microsoft.com/windows/desktop/gdi/setting-the-pen-or-brush-color">Setting the Pen or Brush Color</a> for an example of setting colors. The <b>GetStockObject</b> function with an argument of DC_BRUSH or DC_PEN can be used interchangeably with the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-setdcpencolor">SetDCPenColor</a> and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-setdcbrushcolor">SetDCBrushColor</a> functions.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getstockobject#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.HGDIOBJ GetStockObject(winmdroot.Graphics.Gdi.GET_STOCK_OBJECT_FLAGS i);
/// <inheritdoc cref="GetViewportExtEx(winmdroot.Graphics.Gdi.HDC, winmdroot.Foundation.SIZE*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Foundation.BOOL GetViewportExtEx(winmdroot.Graphics.Gdi.HDC hdc, out winmdroot.Foundation.SIZE lpsize)
{
fixed (winmdroot.Foundation.SIZE* lpsizeLocal = &lpsize)
{
winmdroot.Foundation.BOOL __result = PInvokeCore.GetViewportExtEx(hdc, lpsizeLocal);
return __result;
}
}
/// <summary>The GetViewportExtEx function retrieves the x-extent and y-extent of the current viewport for the specified device context.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="lpsize">A pointer to a <a href="https://docs.microsoft.com/windows/win32/api/windef/ns-windef-size">SIZE</a> structure that receives the x- and y-extents, in device units.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getviewportextex">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Foundation.BOOL GetViewportExtEx(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Foundation.SIZE* lpsize);
/// <inheritdoc cref="GetViewportOrgEx(winmdroot.Graphics.Gdi.HDC, global::System.Drawing.Point*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Foundation.BOOL GetViewportOrgEx(winmdroot.Graphics.Gdi.HDC hdc, out global::System.Drawing.Point lppoint)
{
fixed (global::System.Drawing.Point* lppointLocal = &lppoint)
{
winmdroot.Foundation.BOOL __result = PInvokeCore.GetViewportOrgEx(hdc, lppointLocal);
return __result;
}
}
/// <summary>The GetViewportOrgEx function retrieves the x-coordinates and y-coordinates of the viewport origin for the specified device context.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="lppoint">A pointer to a <a href="https://docs.microsoft.com/windows/win32/api/windef/ns-windef-point">POINT</a> structure that receives the coordinates of the origin, in device units.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getviewportorgex">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Foundation.BOOL GetViewportOrgEx(winmdroot.Graphics.Gdi.HDC hdc, global::System.Drawing.Point* lppoint);
/// <inheritdoc cref="GetWindowOrgEx(winmdroot.Graphics.Gdi.HDC, global::System.Drawing.Point*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Foundation.BOOL GetWindowOrgEx(winmdroot.Graphics.Gdi.HDC hdc, out global::System.Drawing.Point lppoint)
{
fixed (global::System.Drawing.Point* lppointLocal = &lppoint)
{
winmdroot.Foundation.BOOL __result = PInvokeCore.GetWindowOrgEx(hdc, lppointLocal);
return __result;
}
}
/// <summary>The GetWindowOrgEx function retrieves the x-coordinates and y-coordinates of the window origin for the specified device context.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="lppoint">A pointer to a <a href="https://docs.microsoft.com/windows/win32/api/windef/ns-windef-point">POINT</a> structure that receives the coordinates, in logical units, of the window origin.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-getwindoworgex">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Foundation.BOOL GetWindowOrgEx(winmdroot.Graphics.Gdi.HDC hdc, global::System.Drawing.Point* lppoint);
/// <inheritdoc cref="GetWorldTransform(winmdroot.Graphics.Gdi.HDC, winmdroot.Graphics.Gdi.XFORM*)"/>
[SupportedOSPlatform("windows5.0")]
internal static unsafe winmdroot.Foundation.BOOL GetWorldTransform(winmdroot.Graphics.Gdi.HDC hdc, out winmdroot.Graphics.Gdi.XFORM lpxf)
{
fixed (winmdroot.Graphics.Gdi.XFORM* lpxfLocal = &lpxf)
{
winmdroot.Foundation.BOOL __result = PInvokeCore.GetWorldTransform(hdc, lpxfLocal);
return __result;
}
}
/// <summary>The GetWorldTransform function retrieves the current world-space to page-space transformation.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="lpxf">A pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/ns-wingdi-xform">XFORM</a> structure that receives the current world-space to page-space transformation.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>The precision of the transformation may be altered if an application calls the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-modifyworldtransform">ModifyWorldTransform</a> function prior to calling <b>GetWorldTransform</b>. (This is because the internal format for storing transformation values uses a higher precision than a <b>FLOAT</b> value.)</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Foundation.BOOL GetWorldTransform(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.XFORM* lpxf);
/// <summary>The IntersectClipRect function creates a new clipping region from the intersection of the current clipping region and the specified rectangle.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="left">The x-coordinate, in logical units, of the upper-left corner of the rectangle.</param>
/// <param name="top">The y-coordinate, in logical units, of the upper-left corner of the rectangle.</param>
/// <param name="right">The x-coordinate, in logical units, of the lower-right corner of the rectangle.</param>
/// <param name="bottom">The y-coordinate, in logical units, of the lower-right corner of the rectangle.</param>
/// <returns>
/// <para>The return value specifies the new clipping region's type and can be one of the following values. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>The lower and right-most edges of the given rectangle are excluded from the clipping region. If a clipping region does not already exist then the system may apply a default clipping region to the specified HDC. A clipping region is then created from the intersection of that default clipping region and the rectangle specified in the function parameters.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-intersectcliprect#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.GDI_REGION_TYPE IntersectClipRect(winmdroot.Graphics.Gdi.HDC hdc, int left, int top, int right, int bottom);
/// <summary>The OffsetViewportOrgEx function modifies the viewport origin for a device context using the specified horizontal and vertical offsets.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="x">The horizontal offset, in device units.</param>
/// <param name="y">The vertical offset, in device units.</param>
/// <param name="lppt">A pointer to a <a href="https://docs.microsoft.com/windows/win32/api/windef/ns-windef-point">POINT</a> structure. The previous viewport origin, in device units, is placed in this structure. If <i>lpPoint</i> is <b>NULL</b>, the previous viewport origin is not returned.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>The new origin is the sum of the current origin and the horizontal and vertical offsets.</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe winmdroot.Foundation.BOOL OffsetViewportOrgEx(winmdroot.Graphics.Gdi.HDC hdc, int x, int y, [Optional] global::System.Drawing.Point* lppt);
/// <summary>The DeleteMetaFile function deletes a Windows-format metafile or Windows-format metafile handle.</summary>
/// <param name="hmf">A handle to a Windows-format metafile.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>If the metafile identified by the <i>hmf</i> parameter is stored in memory (rather than on a disk), its content is lost when it is deleted by using the <b>DeleteMetaFile</b> function.</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Foundation.BOOL DeleteMetaFile(winmdroot.Graphics.Gdi.HMETAFILE hmf);
/// <summary>The RealizePalette function maps palette entries from the current logical palette to the system palette.</summary>
/// <param name="hdc">A handle to the device context into which a logical palette has been selected.</param>
/// <returns>
/// <para>If the function succeeds, the return value is the number of entries in the logical palette mapped to the system palette. If the function fails, the return value is GDI_ERROR.</para>
/// </returns>
/// <remarks>
/// <para>An application can determine whether a device supports palette operations by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getdevicecaps">GetDeviceCaps</a> function and specifying the RASTERCAPS constant. The <b>RealizePalette</b> function modifies the palette for the device associated with the specified device context. If the device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device context is a display DC, the physical palette for that device is modified. A logical palette is a buffer between color-intensive applications and the system, allowing these applications to use as many colors as needed without interfering with colors displayed by other windows. When an application's window has the focus and it calls the <b>RealizePalette</b> function, the system attempts to realize as many of the requested colors as possible. The same is also true for applications with inactive windows.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-realizepalette#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern uint RealizePalette(winmdroot.Graphics.Gdi.HDC hdc);
/// <summary>The Rectangle function draws a rectangle. The rectangle is outlined by using the current pen and filled by using the current brush.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="left">The x-coordinate, in logical coordinates, of the upper-left corner of the rectangle.</param>
/// <param name="top">The y-coordinate, in logical coordinates, of the upper-left corner of the rectangle.</param>
/// <param name="right">The x-coordinate, in logical coordinates, of the lower-right corner of the rectangle.</param>
/// <param name="bottom">The y-coordinate, in logical coordinates, of the lower-right corner of the rectangle.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>The current position is neither used nor updated by <b>Rectangle</b>. The rectangle that is drawn excludes the bottom and right edges. If a PS_NULL pen is used, the dimensions of the rectangle are 1 pixel less in height and 1 pixel less in width.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-rectangle#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Foundation.BOOL Rectangle(winmdroot.Graphics.Gdi.HDC hdc, int left, int top, int right, int bottom);
/// <summary>The RestoreDC function restores a device context (DC) to the specified state. The DC is restored by popping state information off a stack created by earlier calls to the SaveDC function.</summary>
/// <param name="hdc">A handle to the DC.</param>
/// <param name="nSavedDC">The saved state to be restored. If this parameter is positive, <i>nSavedDC</i> represents a specific instance of the state to be restored. If this parameter is negative, <i>nSavedDC</i> represents an instance relative to the current state. For example, -1 restores the most recently saved state.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>Each DC maintains a stack of saved states. The <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-savedc">SaveDC</a> function pushes the current state of the DC onto its stack of saved states. That state can be restored only to the same DC from which it was created. After a state is restored, the saved state is destroyed and cannot be reused. Furthermore, any states saved after the restored state was created are also destroyed and cannot be used. In other words, the <b>RestoreDC</b> function pops the restored state (and any subsequent states) from the state information stack.</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Foundation.BOOL RestoreDC(winmdroot.Graphics.Gdi.HDC hdc, int nSavedDC);
/// <summary>The SaveDC function saves the current state of the specified device context (DC) by copying data describing selected objects and graphic modes (such as the bitmap, brush, palette, font, pen, region, drawing mode, and mapping mode) to a context stack.</summary>
/// <param name="hdc">A handle to the DC whose state is to be saved.</param>
/// <returns>
/// <para>If the function succeeds, the return value identifies the saved state. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>The <b>SaveDC</b> function can be used any number of times to save any number of instances of the DC state. A saved state can be restored by using the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-restoredc">RestoreDC</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-savedc#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern int SaveDC(winmdroot.Graphics.Gdi.HDC hdc);
/// <summary>The SelectClipRgn function selects a region as the current clipping region for the specified device context.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="hrgn">A handle to the region to be selected.</param>
/// <returns>
/// <para>The return value specifies the region's complexity and can be one of the following values. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>Only a copy of the selected region is used. The region itself can be selected for any number of other device contexts or it can be deleted. The <b>SelectClipRgn</b> function assumes that the coordinates for a region are specified in device units. To remove a device-context's clipping region, specify a <b>NULL</b> region handle.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-selectcliprgn#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.GDI_REGION_TYPE SelectClipRgn(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.HRGN hrgn);
/// <summary>The SelectObject function selects an object into the specified device context (DC). The new object replaces the previous object of the same type.</summary>
/// <param name="hdc">A handle to the DC.</param>
/// <param name="h">
/// <para>A handle to the object to be selected. The specified object must have been created by using one of the following functions. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-selectobject#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the selected object is not a region and the function succeeds, the return value is a handle to the object being replaced. If the selected object is a region and the function succeeds, the return value is one of the following values. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>This function returns the previously selected object of the specified type. An application should always replace a new object with the original, default object after it has finished drawing with the new object. An application cannot select a single bitmap into more than one DC at a time. <b>ICM:</b> If the object being selected is a brush or a pen, color management is performed.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-selectobject#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.HGDIOBJ SelectObject(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.HGDIOBJ h);
/// <summary>The SelectPalette function selects the specified logical palette into a device context.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="hPal">A handle to the logical palette to be selected.</param>
/// <param name="bForceBkgd">
/// <para>Specifies whether the logical palette is forced to be a background palette. If this value is <b>TRUE</b>, the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-realizepalette">RealizePalette</a> function causes the logical palette to be mapped to the colors already in the physical palette in the best possible way. This is always done, even if the window for which the palette is realized belongs to a thread without active focus. If this value is <b>FALSE</b>, <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-realizepalette">RealizePalette</a> causes the logical palette to be copied into the device palette when the application is in the foreground. (If the <i>hdc</i> parameter is a memory device context, this parameter is ignored.)</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-selectpalette#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is a handle to the device context's previous logical palette. If the function fails, the return value is <b>NULL</b>.</para>
/// </returns>
/// <remarks>
/// <para>An application can determine whether a device supports palette operations by calling the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-getdevicecaps">GetDeviceCaps</a> function and specifying the RASTERCAPS constant. An application can select a logical palette into more than one device context only if device contexts are compatible. Otherwise <b>SelectPalette</b> fails. To create a device context that is compatible with another device context, call <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createcompatibledc">CreateCompatibleDC</a> with the first device context as the parameter. If a logical palette is selected into more than one device context, changes to the logical palette will affect all device contexts for which it is selected. An application might call the <b>SelectPalette</b> function with the <i>bForceBackground</i> parameter set to <b>TRUE</b> if the child windows of a top-level window each realize their own palettes. However, only the child window that needs to realize its palette must set <i>bForceBackground</i> to <b>TRUE</b>; other child windows must set this value to <b>FALSE</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-selectpalette#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Graphics.Gdi.HPALETTE SelectPalette(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.HPALETTE hPal, winmdroot.Foundation.BOOL bForceBkgd);
/// <summary>The SetBkColor function sets the current background color to the specified color value, or to the nearest physical color if the device cannot represent the specified color value.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="color">The new background color. To make a <a href="https://docs.microsoft.com/windows/desktop/gdi/colorref">COLORREF</a> value, use the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-rgb">RGB</a> macro.</param>
/// <returns>
/// <para>If the function succeeds, the return value specifies the previous background color as a <a href="https://docs.microsoft.com/windows/desktop/gdi/colorref">COLORREF</a> value. If the function fails, the return value is CLR_INVALID.</para>
/// </returns>
/// <remarks>
/// <para>This function fills the gaps between styled lines drawn using a pen created by the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createpen">CreatePen</a> function; it does not fill the gaps between styled lines drawn using a pen created by the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-extcreatepen">ExtCreatePen</a> function. The <b>SetBkColor</b> function also sets the background colors for <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-textouta">TextOut</a> and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-exttextouta">ExtTextOut</a>. If the background mode is OPAQUE, the background color is used to fill gaps between styled lines, gaps between hatched lines in brushes, and character cells. The background color is also used when converting bitmaps from color to monochrome and vice versa.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-setbkcolor#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Foundation.COLORREF SetBkColor(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Foundation.COLORREF color);
/// <summary>The SetBkMode function sets the background mix mode of the specified device context. The background mix mode is used with text, hatched brushes, and pen styles that are not solid lines.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="mode"></param>
/// <returns>
/// <para>If the function succeeds, the return value specifies the previous background mode. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>The <b>SetBkMode</b> function affects the line styles for lines drawn using a pen created by the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-createpen">CreatePen</a> function. <b>SetBkMode</b> does not affect lines drawn using a pen created by the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-extcreatepen">ExtCreatePen</a> function.</remarks>
[SupportedOSPlatform("windows5.0")]
internal static int SetBkMode(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.BACKGROUND_MODE mode)
{
int __retVal = LocalExternFunction(hdc, (int)mode);
return __retVal;
[DllImport("GDI32.dll", ExactSpelling = true, EntryPoint = "SetBkMode"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
static extern int LocalExternFunction(winmdroot.Graphics.Gdi.HDC hdc, int mode);
}
/// <summary>The SetMapMode function sets the mapping mode of the specified device context. The mapping mode defines the unit of measure used to transform page-space units into device-space units, and also defines the orientation of the device's x and y axes.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="iMode"></param>
/// <returns>
/// <para>If the function succeeds, the return value identifies the previous mapping mode. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>The MM_TEXT mode allows applications to work in device pixels, whose size varies from device to device. The MM_HIENGLISH, MM_HIMETRIC, MM_LOENGLISH, MM_LOMETRIC, and MM_TWIPS modes are useful for applications drawing in physically meaningful units (such as inches or millimeters). The MM_ISOTROPIC mode ensures a 1:1 aspect ratio. The MM_ANISOTROPIC mode allows the x-coordinates and y-coordinates to be adjusted independently.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-setmapmode#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern int SetMapMode(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.HDC_MAP_MODE iMode);
/// <summary>The SetROP2 function sets the current foreground mix mode.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="rop2"></param>
/// <returns>
/// <para>If the function succeeds, the return value specifies the previous mix mode. If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>Mix modes define how GDI combines source and destination colors when drawing with the current pen. The mix modes are binary raster operation codes, representing all possible Boolean functions of two variables, using the binary operations AND, OR, and XOR (exclusive OR), and the unary operation NOT. The mix mode is for raster devices only; it is not available for vector devices.</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern int SetROP2(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.R2_MODE rop2);
/// <summary>The SetTextAlign function sets the text-alignment flags for the specified device context.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="align">
/// <para>The text alignment by using a mask of the values in the following list. Only one flag can be chosen from those that affect horizontal and vertical alignment. In addition, only one of the two flags that alter the current position can be chosen. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-settextalign#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is the previous text-alignment setting. If the function fails, the return value is GDI_ERROR.</para>
/// </returns>
/// <remarks>
/// <para>The <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-textouta">TextOut</a> and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-exttextouta">ExtTextOut</a> functions use the text-alignment flags to position a string of text on a display or other device. The flags specify the relationship between a reference point and a rectangle that bounds the text. The reference point is either the current position or a point passed to a text output function. The rectangle that bounds the text is formed by the character cells in the text string. The best way to get left-aligned text is to use either</para>
/// <para></para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/wingdi/nf-wingdi-settextalign#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern uint SetTextAlign(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Graphics.Gdi.TEXT_ALIGN_OPTIONS align);
/// <summary>The SetTextColor function sets the text color for the specified device context to the specified color.</summary>
/// <param name="hdc">A handle to the device context.</param>
/// <param name="color">The color of the text.</param>
/// <returns>
/// <para>If the function succeeds, the return value is a color reference for the previous text color as a <a href="https://docs.microsoft.com/windows/desktop/gdi/colorref">COLORREF</a> value. If the function fails, the return value is CLR_INVALID.</para>
/// </returns>
/// <remarks>The text color is used to draw the face of each character written by the <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-textouta">TextOut</a> and <a href="https://docs.microsoft.com/windows/desktop/api/wingdi/nf-wingdi-exttextouta">ExtTextOut</a> functions. The text color is also used in converting bitmaps from color to monochrome and vice versa.</remarks>
[DllImport("GDI32.dll", ExactSpelling = true),DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Foundation.COLORREF SetTextColor(winmdroot.Graphics.Gdi.HDC hdc, winmdroot.Foundation.COLORREF color);
}
}
|