gdi32 topic

Windows GDI

The Windows Graphics Device Interface, which provides functions that perform primitive drawing functions for output to video displays and printers. Traditional Windows applications call GDI functions directly to perform low-level drawing (line, rectangle, ellipse), text output, font management, and similar functions.

Functions

AbortPath(HDC hdc) bool gdi32
Closes and discards any paths in the specified device context.
AddFontResource(PCWSTR param0) int gdi32
Adds the font resource from the specified file to the system font table.
AddFontResourceEx(PCWSTR name, FONT_RESOURCE_CHARACTERISTICS fl) int gdi32
Adds the font resource from the specified file to the system.
AngleArc(HDC hdc, int x, int y, int r, double startAngle, double sweepAngle) bool gdi32
Draws a line segment and an arc.
AnimatePalette(HPALETTE hPal, int iStartIndex, int cEntries, Pointer<PALETTEENTRY> ppe) bool gdi32
Replaces entries in the specified logical palette.
Arc(HDC hdc, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) bool gdi32
Draws an elliptical arc.
ArcTo(HDC hdc, int left, int top, int right, int bottom, int xr1, int yr1, int xr2, int yr2) bool gdi32
Draws an elliptical arc.
BeginPath(HDC hdc) bool gdi32
Opens a path bracket in the specified device context.
BitBlt(HDC hdc, int x, int y, int cx, int cy, HDC? hdcSrc, int x1, int y1, ROP_CODE rop) Win32Result<bool> gdi32
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.
CancelDC(HDC hdc) bool gdi32
Cancels any pending operation on the specified device context (DC).
Chord(HDC hdc, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) bool gdi32
Draws a chord (a region bounded by the intersection of an ellipse and a line segment, called a secant).
CloseFigure(HDC hdc) bool gdi32
Closes an open figure in a path.
CreateBitmap(int nWidth, int nHeight, int nPlanes, int nBitCount, Pointer<NativeType>? lpBits) HBITMAP gdi32
Creates a bitmap with the specified width, height, and color format (color planes and bits-per-pixel).
CreateBitmapIndirect(Pointer<BITMAP> pbm) HBITMAP gdi32
Creates a bitmap with the specified width, height, and color format (color planes and bits-per-pixel).
CreateCompatibleBitmap(HDC hdc, int cx, int cy) HBITMAP gdi32
Creates a bitmap compatible with the device that is associated with the specified device context.
CreateCompatibleDC(HDC? hdc) HDC gdi32
Creates a memory device context (DC) compatible with the specified device.
CreateDC(PCWSTR? pwszDriver, PCWSTR? pwszDevice, PCWSTR? pszPort, Pointer<DEVMODE>? pdm) HDC gdi32
Creates a device context (DC) for a device using the specified name.
CreateDIBitmap(HDC hdc, Pointer<BITMAPINFOHEADER>? pbmih, int flInit, Pointer<NativeType>? pjBits, Pointer<BITMAPINFO>? pbmi, DIB_USAGE iUsage) HBITMAP gdi32
Creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits.
CreateDIBPatternBrushPt(Pointer<NativeType> lpPackedDIB, DIB_USAGE iUsage) HBRUSH gdi32
Creates a logical brush that has the pattern specified by the device-independent bitmap (DIB).
CreateDIBSection(HDC? hdc, Pointer<BITMAPINFO> pbmi, DIB_USAGE usage, Pointer<Pointer<NativeType>> ppvBits, HANDLE? hSection, int offset) Win32Result<HBITMAP> gdi32
Creates a DIB that applications can write to directly.
CreateEllipticRgn(int x1, int y1, int x2, int y2) HRGN gdi32
Creates an elliptical region.
CreateFont(int cHeight, int cWidth, int cEscapement, int cOrientation, int cWeight, int bItalic, int bUnderline, int bStrikeOut, FONT_CHARSET iCharSet, FONT_OUTPUT_PRECISION iOutPrecision, FONT_CLIP_PRECISION iClipPrecision, FONT_QUALITY iQuality, int iPitchAndFamily, PCWSTR? pszFaceName) HFONT gdi32
Creates a logical font with the specified characteristics.
CreateFontIndirect(Pointer<LOGFONT> lplf) HFONT gdi32
Creates a logical font that has the specified characteristics.
CreateHalftonePalette(HDC? hdc) HPALETTE gdi32
Creates a halftone palette for the specified device context (DC).
CreateHatchBrush(HATCH_BRUSH_STYLE iHatch, COLORREF color) HBRUSH gdi32
Creates a logical brush that has the specified hatch pattern and color.
CreatePen(PEN_STYLE iStyle, int cWidth, COLORREF color) HPEN gdi32
Creates a logical pen that has the specified style, width, and color.
CreateRectRgn(int x1, int y1, int x2, int y2) HRGN gdi32
Creates a rectangular region.
CreateSolidBrush(COLORREF color) HBRUSH gdi32
Creates a logical brush that has the specified solid color.
DeleteDC(HDC hdc) bool gdi32
Deletes the specified device context (DC).
DeleteMetaFile(HMETAFILE hmf) bool gdi32
Deletes a Windows-format metafile or Windows-format metafile handle.
DeleteObject(HGDIOBJ ho) bool gdi32
Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object.
DrawEscape(HDC hdc, int iEscape, int cjIn, PCSTR? lpIn) int gdi32
Provides drawing capabilities of the specified video display that are not directly available through the graphics device interface (GDI).
Ellipse(HDC hdc, int left, int top, int right, int bottom) bool gdi32
Creates a D2D1_ELLIPSE structure.
EndPath(HDC hdc) bool gdi32
Closes a path bracket and selects the path defined by the bracket into the specified device context.
EnumFontFamiliesEx(HDC hdc, Pointer<LOGFONT> lpLogfont, Pointer<NativeFunction<FONTENUMPROC>> lpProc, LPARAM lParam, int dwFlags) int gdi32
Enumerates all uniquely-named fonts in the system that match the font characteristics specified by the LOGFONT structure.
ExtCreatePen(PEN_STYLE iPenStyle, int cWidth, Pointer<LOGBRUSH> plbrush, int cStyle, Pointer<Uint32>? pstyle) HPEN gdi32
Creates a logical cosmetic or geometric pen that has the specified style, width, and brush attributes.
ExtTextOut(HDC hdc, int x, int y, ETO_OPTIONS options, Pointer<RECT>? lprect, PCWSTR? lpString, int c, Pointer<Int32>? lpDx) bool gdi32
Draws text using the currently selected font, background color, and text color.
FillPath(HDC hdc) bool gdi32
Closes any open figures in the current path and fills the path's interior by using the current brush and polygon-filling mode.
FlattenPath(HDC hdc) bool gdi32
Transforms any curves in the path that is selected into the current device context (DC), turning each curve into a sequence of lines.
GetDeviceCaps(HDC? hdc, GET_DEVICE_CAPS_INDEX index) int gdi32
Retrieves device-specific information for the specified device.
GetDIBits(HDC hdc, HBITMAP hbm, int start, int cLines, Pointer<NativeType>? lpvBits, Pointer<BITMAPINFO> lpbmi, DIB_USAGE usage) int gdi32
Retrieves the bits of the specified compatible bitmap and copies them into a buffer as a DIB using the specified format.
GetNearestColor(HDC hdc, COLORREF color) COLORREF gdi32
Retrieves a color value identifying a color from the system palette that will be displayed when the specified color value is used.
GetObject(HGDIOBJ h, int c, Pointer<NativeType>? pv) int gdi32
Retrieves information for the specified graphics object.
GetPath(HDC hdc, Pointer<POINT>? apt, Pointer<Uint8>? aj, int cpt) int gdi32
Retrieves the coordinates defining the endpoints of lines and the control points of curves found in the path that is selected into the specified device context.
GetPixel(HDC hdc, int x, int y) COLORREF gdi32
Retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.
GetStockObject(GET_STOCK_OBJECT_FLAGS i) HGDIOBJ gdi32
Retrieves a handle to one of the stock pens, brushes, fonts, or palettes.
GetTextMetrics(HDC hdc, Pointer<TEXTMETRIC> lptm) bool gdi32
Fills the specified buffer with the metrics for the currently selected font.
GetWindowExtEx(HDC hdc, Pointer<SIZE> lpsize) bool gdi32
This function retrieves the x-extent and y-extent of the window for the specified device context.
GetWindowOrgEx(HDC hdc, Pointer<POINT> lppoint) bool gdi32
Retrieves the x-coordinates and y-coordinates of the window origin for the specified device context.
LineTo(HDC hdc, int x, int y) bool gdi32
Draws a line from the current position up to, but not including, the specified point.
MoveToEx(HDC hdc, int x, int y, Pointer<POINT>? lppt) bool gdi32
Updates the current position to the specified point and optionally returns the previous position.
Pie(HDC hdc, int left, int top, int right, int bottom, int xr1, int yr1, int xr2, int yr2) bool gdi32
Draws a pie-shaped wedge bounded by the intersection of an ellipse and two radials.
PolyBezier(HDC hdc, Pointer<POINT> apt, int cpt) bool gdi32
Draws one or more Bézier curves.
PolyBezierTo(HDC hdc, Pointer<POINT> apt, int cpt) bool gdi32
Draws one or more Bézier curves.
PolyDraw(HDC hdc, Pointer<POINT> apt, Pointer<Uint8> aj, int cpt) bool gdi32
Draws a set of line segments and Bézier curves.
Polygon(HDC hdc, Pointer<POINT> apt, int cpt) bool gdi32
Draws a polygon consisting of two or more vertices connected by straight lines.
Polyline(HDC hdc, Pointer<POINT> apt, int cpt) bool gdi32
Draws a series of line segments by connecting the points in the specified array.
PolylineTo(HDC hdc, Pointer<POINT> apt, int cpt) bool gdi32
Draws one or more straight lines.
PolyPolygon(HDC hdc, Pointer<POINT> apt, Pointer<Int32> asz, int csz) bool gdi32
Draws a series of closed polygons.
PolyPolyline(HDC hdc, Pointer<POINT> apt, Pointer<Uint32> asz, int csz) bool gdi32
Draws multiple series of connected line segments.
PtInRegion(HRGN hrgn, int x, int y) bool gdi32
Determines whether the specified point is inside the specified region.
Rectangle(HDC hdc, int left, int top, int right, int bottom) bool gdi32
Draws a rectangle.
RectInRegion(HRGN hrgn, Pointer<RECT> lprect) bool gdi32
Determines whether any part of the specified rectangle is within the boundaries of a region.
RoundRect(HDC hdc, int left, int top, int right, int bottom, int width, int height) bool gdi32
Draws a rectangle with rounded corners.
SaveDC(HDC hdc) int gdi32
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.
SelectClipPath(HDC hdc, RGN_COMBINE_MODE mode) bool gdi32
Selects the current path as a clipping region for a device context, combining the new region with any existing clipping region using the specified mode.
SelectObject(HDC hdc, HGDIOBJ h) HGDIOBJ gdi32
Selects an object into the specified device context (DC).
SetBkColor(HDC hdc, COLORREF color) COLORREF gdi32
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.
SetBkMode(HDC hdc, BACKGROUND_MODE mode) int gdi32
Sets the background mix mode of the specified device context.
SetMapMode(HDC hdc, HDC_MAP_MODE iMode) int gdi32
Sets the mapping mode of the specified device context.
SetPixel(HDC hdc, int x, int y, COLORREF color) COLORREF gdi32
Sets the pixel at the specified coordinates to the specified color.
SetStretchBltMode(HDC hdc, STRETCH_BLT_MODE mode) int gdi32
Sets the bitmap stretching mode in the specified device context.
SetTextColor(HDC hdc, COLORREF color) COLORREF gdi32
Sets the text color for the specified device context to the specified color.
SetViewportExtEx(HDC hdc, int x, int y, Pointer<SIZE>? lpsz) bool gdi32
Sets the horizontal and vertical extents of the viewport for a device context by using the specified values.
SetViewportOrgEx(HDC hdc, int x, int y, Pointer<POINT>? lppt) bool gdi32
Specifies which device point maps to the window origin (0,0).
SetWindowExtEx(HDC hdc, int x, int y, Pointer<SIZE>? lpsz) bool gdi32
Sets the horizontal and vertical extents of the window for a device context by using the specified values.
StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC? hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, ROP_CODE rop) bool gdi32
Copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary.
StretchDIBits(HDC hdc, int xDest, int yDest, int destWidth, int destHeight, int xSrc, int ySrc, int srcWidth, int srcHeight, Pointer<NativeType>? lpBits, Pointer<BITMAPINFO> lpbmi, DIB_USAGE iUsage, ROP_CODE rop) int gdi32
Copies the color data for a rectangle of pixels in a DIB, JPEG, or PNG image to the specified destination rectangle.
StrokeAndFillPath(HDC hdc) bool gdi32
Closes any open figures in a path, strokes the outline of the path by using the current pen, and fills its interior by using the current brush.
StrokePath(HDC hdc) bool gdi32
Renders the specified path by using the current pen.
TextOut(HDC hdc, int x, int y, PCWSTR lpString, int c) bool gdi32
Writes a character string at the specified location, using the currently selected font, background color, and text color.
WidenPath(HDC hdc) bool gdi32
Redefines the current path as the area that would be painted if the path were stroked using the pen currently selected into the given device context.