7.1 A list of graphics-related functions
This page contains a long list of Windows GDI functions. It was obtained by looking up "GDI reference" at msdn (in January 2009 this was at http://msdn.microsoft.com/en-us/library/ms534260(VS.85).aspx, in March it was at http://msdn.microsoft.com/en-us/library/ms927613.aspx ) and then picking "GDI functions".
For text-related functions go here.
The first (short) table draws attention to a few that you might otherwise find hard to find. Then there is a long table giving brief information (extracted from msdn). A subset of these, for line and curve drawing, is given here.
Short list | |
---|---|
SetROP2 | Allows you to set the plotting mode to things like XOR or AND instead of just putting colour on the screen. |
BitBlt | Can be used copy a bitmap image to screen (fast). |
Long list | |
---|---|
AlphaBlend | displays bitmaps that have transparent or semitransparent pixels. |
BeginPaint | prepares the specified window for painting and fills a PAINTSTRUCT structure with information about the painting. |
BitBlt | transfers pixels from a specified source rectangle to a specified destination rectangle, altering the pixels according to the selected raster operation (ROP) code. |
ChangeDisplaySettingsEx | changes the settings of the specified display device to the specified graphics mode. |
ClientToScreen | converts the client coordinates of a specified point to screen coordinates. |
CombineRgn | combines two regions and stores the result in a third region. The two regions are combined according to the specified mode. |
CopyRect | copies the coordinates of one rectangle to another. |
CreateBitmap | creates a bitmap with the specified width, height, and bit depth. |
CreateCompatibleBitmap | creates a bitmap compatible with the device associated with the specified device context. |
CreateCompatibleDC | creates a memory device context (DC) compatible with the specified device. |
CreateDC | creates a DC for a device. |
CreateDIBPatternBrushPt | creates a logical brush that has the pattern specified by the device-independent bitmap (DIB). |
CreateDIBSection | creates a DIB that applications can write to directly. |
CreatePalette | creates a logical color palette. |
CreatePatternBrush | creates a logical brush with the specified bitmap pattern. |
CreatePen | creates a logical pen that has the specified style, width, and color. |
CreatePenIndirect | creates a logical cosmetic pen that has the style, width, and color specified in the LOGPEN structure. |
CreateRectRgn | creates a rectangular region. |
CreateRectRgnIndirect | creates a rectangular region. |
CreateSolidBrush | creates a logical brush that has the specified solid color. |
DeleteDC | deletes the specified DC. |
DeleteObject | deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. |
DrawEdge | draws one or more edges of a rectangle. |
DrawFocusRect | draws a rectangle in the style used to indicate that the rectangle has the focus. |
DrawFrameControl | draws a frame control of the specified type and style. |
Ellipse | BOOL Ellipse(HDC hdc, int left, int top, int right, int bottom); |
draws an ellipse. The center of the ellipse is the center of the specified bounding rectangle. | |
EndPaint | marks the end of painting in the specified window. |
EnumDisplayDevices | obtains information about the display devices in a system. |
EnumDisplaySettings | retrieves information about one of the graphics modes for a display device. |
EqualRect | determines whether the two specified rectangles are equal by comparing the coordinates of their upper-left and lower-right corners. |
EqualRgn | checks the two specified regions to determine whether they are identical. |
ExcludeClipRect | creates a new clipping region that consists of the existing clipping region minus the specified rectangle. |
ExtCreateRegion | creates a region from the specified region data. |
ExtEscape | allows applications to access capabilities of a particular device that are not available through the GDI. |
FillRect | int FillRect(HDC hdc, const RECT* rect, HBRUSH br); fills a rectangle using the specified brush. (see also: Rectangle) |
FillRgn | BOOL FillRgn(HDC hdc, HRGN hrgn, HBRUSH hbr); |
fills a region using the specified brush. See also Polygon, CreateRectRgn | |
GetBkColor | returns the current background color for the specified device context. |
GetBkMode | returns the current background mix mode for a specified device context. |
GetBValue | This macro retrieves an intensity value for the blue component of a 32-bit RGB value. |
GetClipBox | retrieves the dimensions of the tightest bounding rectangle that can be drawn around the current visible area on the device. |
GetClipRgn | retrieves a handle identifying the current application-defined clipping region for the specified device context. |
GetCurrentObject | returns the currently selected object of the specified type. |
GetCurrentPositionEx | retrieves the current position in logical coordinates. |
GetDC | retrieves a handle to a display device context for the client area of the specified window. |
GetDCEx | retrieves a handle to a display device context for the client area of a specified window or for the entire screen. |
GetDeviceCaps | retrieves information about the capabilities of a specified device. |
GetDIBColorTable | retrieves red, green, and blue color values from a range of entries in the color table of the DIB that is currently selected into a specified device context. |
GetGValue | This macro retrieves an intensity value for the green component of a 32-bit RGB value. |
GetLayout | returns the layout of a device context. |
GetNearestColor | returns the system palette color that will be displayed when the specified color value is used. |
GetNearestPaletteIndex | retrieves the index for the entry in the specified logical palette that most closely matches a specified color value. |
GetObject | obtains information about a specified graphics object. |
GetObjectType | returns the type of the specified object. |
GetPaletteEntries | retrieves a specified range of palette entries from the specified logical palette. |
GetPixel | retrieves the RGB color value of the pixel at the specified coordinates. |
GetRegionData | fills the specified buffer with data describing a region. |
GetRgnBox | retrieves the bounding rectangle of the specified region. |
GetROP2 | retrieves the foreground mix mode of the specified device context. |
GetRValue | This macro retrieves an intensity value for the red component of a 32-bit RGB value. |
GetStockObject | retrieves a handle to one of the predefined stock pens, brushes or fonts. |
GetStretchBltMode | retrieves the current stretching mode. |
GetSysColorBrush | retrieves a handle identifying a logical brush that corresponds to the specified color index. |
GetSystemPaletteEntries | retrieves a range of palette entries from the system palette associated with the specified device context. |
GetOutlineTextMetrics | retrieves text metrics for TrueType fonts. |
GetUpdateRect | retrieves the coordinates of the smallest rectangle that completely encloses the update region of the specified window in client coordinates. |
GetUpdateRgn | retrieves the update region of a window by copying it into the specified region. |
GetViewportExtEx | retrieves the x-extent and y-extent of the current viewport for the specified device context. |
GetViewportOrgEx | retrieves the x-coordinates and y-coordinates of the viewport origin for the specified device context. |
GetWindowDC | retrieves the DC for the entire window, including title bar, menus, and scroll bars. |
GetWindowExtEx | retrieves the x-extent and y-extent of the window for the specified device context. |
GetWindowOrgEx | retrieves the x-coordinates and y-coordinates of the window origin for the specified device context. |
GetWindowRgn | obtains a copy of the window region of a window. |
GradientFill | fills rectangular regions with a background color that is interpolated from color values specified at the vertices. |
InflateRect | increases or decreases the width and height of the specified rectangle. |
IntersectClipRect | creates a new clipping region from the intersection of the current clipping region and the specified rectangle. |
IntersectRect | calculates the intersection of two source rectangles and places the coordinates of the intersection rectangle into the destination rectangle. |
InvalidateRect | adds a rectangle to the specified window's update region. |
InvalidateRgn | invalidates the client area within the specified region by adding the area to the current update region of a window. |
InvertRect | inverts a rectangle in a window by performing a logical NOT operation on the color values for each pixel in the rectangle's interior. |
IsRectEmpty | determines whether the specified rectangle is empty. |
LineTo | draws a line from the current position up to, but not including, the specified point. |
LoadBitmap | loads the specified bitmap resource from the executable file for a module. |
MapWindowPoints | converts, or maps, a set of points from a coordinate space relative to one window to a coordinate space relative to another window. |
MaskBlt | combines the color data for the source and destination bitmaps using the specified mask and raster operation. |
MoveToEx | updates the current position to the specified point and optionally retrieves the previous position. |
OffsetRect | moves the specified rectangle by the specified offsets. |
OffsetRgn | moves a region by the specified offsets. |
OffsetViewportOrgEx | modifies the viewport origin for a device context using the specified horizontal and vertical offsets. |
PatBlt | paints the given rectangle using the brush that is currently selected into the specified device context. |
POINT | typedef struct tagPOINT { LONG x; LONG y; } POINT; |
structure used by functions such as Polyline | |
Polygon | BOOL Polygon(HDC hdc, const POINT* points, int numpts); |
draws a polygon (two or more vertices connected by lines) using current pen and brush. | |
Polyline | draws a series of line segments by connecting the points in the specified array; cf Polygon. |
PtInRect | determines whether the specified point lies within the specified rectangle. |
PtInRegion | determines whether the specified point is inside the specified region. |
RealizePalette | maps palette entries from the current logical palette to the system palette. |
Rectangle | draws a rectangle. (see also: FillRect) |
RectInRegion | determines whether any part of the specified rectangle is within the boundaries of a region. |
RectVisible | determines whether any part of the specified rectangle lies within the clipping region of the specified device context. |
RedrawWindow | updates the specified rectangle or region in the client area of a window. |
ReleaseDC | releases a DC, freeing it for use by other applications. |
RestoreDC | restores a DC to the specified state. |
RoundRect | draws a rectangle with rounded corners. |
SaveDC | saves the current state of the specified device context by copying data describing selected objects and graphic modes (such as the bitmap, brush, palette, font, pen, region, and drawing mode) to a context stack. |
ScreenToClient | converts the screen coordinates of a specified point on the screen to client coordinates. |
SelectClipRgn | selects a region as the current clipping region for the specified device context. |
SelectObject | selects an object into a specified device context. |
SelectPalette | selects the specified logical palette into a device context. |
SetBitmapBits | sets the bits of color data for a bitmap to the specified values. |
SetBkColor | sets the current background color to the specified color. |
SetBkMode | sets the background mix mode of the specified device context. |
SetBrushOrgEx | is called by an application to set the brush origin of the next brush selected into the specified device context. |
SetDIBColorTable | sets red, green, and blue color values in a range of entries in the color table of the DIB that is currently selected into a specified device context. |
SetDIBitsToDevice | sets the pixels in the specified rectangle on the device that is associated with the destination device context using color data from a DIB. |
SetLayout | changes the layout of a device context. |
SetPaletteEntries | sets RGB color values and flags in a range of entries in a logical palette. |
SetPixel | sets the pixel at the specified coordinates to the specified color. |
SetRect | sets the coordinates of the specified rectangle. |
SetRectEmpty | creates an empty rectangle in which all coordinates are set to zero. |
SetRectRgn | changes a region into a rectangular region with the specified coordinates. |
SetROP2 | sets the current foreground mix mode. GDI uses the foreground mix mode to combine pens and interiors of filled objects with the colors already on the screen. |
SetStretchBltMode | sets the bitmap stretching mode in a specified device context. |
SetViewportOrgEx | sets the viewpoint origin of a device context to the specified coordinates. |
SetWindowOrgEx | specifies which window point maps to the viewport origin (0,0). |
SetWindowRgn | sets the window region of a window. |
StretchBlt | 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 | copies the color data for a rectangle of pixels in a DIB to the specified destination rectangle. |
SubtractRect | obtains the coordinates of a rectangle determined by subtracting one rectangle from another. |
TransparentBlt | 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. |
TransparentImage | transfers a bitmap, omitting the portions drawn in a specified color. |
UnionRect | creates the union of two rectangles. |
UpdateWindow | updates the client area of the specified window by sending a WM_PAINT message to the window if the window's update region is not empty. |
ValidateRect | validates the client area within a rectangle by removing the rectangle from the update region of the specified window. |
ValidateRgn | validates the client area within a region by removing the region from the current update region of the specified window. |
A list of names of the above functions:
AlphaBlend BeginPaint BitBlt ChangeDisplaySettingsEx ClientToScreen CombineRgn CopyRect CreateBitmap CreateCompatibleBitmap CreateCompatibleDC CreateDC CreateDIBPatternBrushPt CreateDIBSection CreatePalette (GDI) CreatePatternBrush CreatePen CreatePenIndirect CreateRectRgn CreateRectRgnIndirect CreateSolidBrush DeleteDC DeleteObject DrawEdge DrawFocusRect DrawFrameControl Ellipse EndPaint EnumDisplayDevices EnumDisplaySettings EqualRect EqualRgn ExcludeClipRect ExtCreateRegion ExtEscape FillRect FillRgn GetBkColor GetBkMode GetBValue GetClipBox GetClipRgn GetCurrentObject GetCurrentPositionEx GetDC GetDCEx GetDeviceCaps GetDIBColorTable GetGValue GetLayout GetNearestColor GetNearestPaletteIndex GetObject GetObjectType GetOutlineTextMetrics GetPaletteEntries GetPixel GetRegionData GetRgnBox GetROP2 GetRValue GetStockObject GetStretchBltMode GetSysColorBrush GetSystemPaletteEntries GetUpdateRect GetUpdateRgn GetViewportExtEx GetViewportOrgEx GetWindowDC GetWindowExtEx GetWindowOrgEx GetWindowRgn GradientFill InflateRect IntersectClipRect IntersectRect InvalidateRect InvalidateRgn InvertRect IsRectEmpty LineTo LoadBitmap MapWindowPoints MaskBlt MoveToEx OffsetRect OffsetRgn OffsetViewportOrgEx PatBlt Polygon Polyline PtInRect PtInRegion RealizePalette Rectangle RectInRegion RectVisible RedrawWindow ReleaseDC RestoreDC RoundRect SaveDC ScreenToClient SelectClipRgn SelectObject SelectPalette SetBitmapBits SetBkColor SetBkMode SetBrushOrgEx SetDIBColorTable SetDIBitsToDevice SetLayout SetPaletteEntries SetPixel SetRect SetRectEmpty SetRectRgn SetROP2 SetStretchBltMode SetViewportOrgEx SetWindowOrgEx SetWindowRgn StretchBlt StretchDIBits SubtractRect TransparentBlt TransparentImage UnionRect UpdateWindow ValidateRect ValidateRgn