using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class Gdi32
{
///
/// The LineDDAProc function is an application-defined callback function used with the LineDDA function. It is used to process
/// coordinates. The LINEDDAPROC type defines a pointer to this callback function. LineDDAProc is a placeholder for the
/// application-defined function name.
///
/// Specifies the x-coordinate of the current point.
/// Specifies the y-coordinate of the current point.
/// Points to the application-defined data.
/// This function does not return a value.
/// An application registers a LineDDAProc function by passing its address to the LineDDA function.
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nc-wingdi-lineddaproc LINEDDAPROC Lineddaproc; void Lineddaproc( int
// Arg1, int Arg2, LPARAM Arg3 ) {...}
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
[PInvokeData("wingdi.h", MSDNShortId = "4a8b1120-4b0b-4029-8b49-4371c0627bba")]
public delegate void LineDDAProc(int X, int Y, IntPtr lpData);
///
/// The ArcDirection enumeration is used in setting the drawing direction for arcs and rectangles.
/// AD_COUNTERCLOCKWISE: Figures drawn counterclockwise.
/// AD_CLOCKWISE: Figures drawn clockwise.
///
// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-emf/9886c62f-1788-4118-894a-76d5a8733685
[PInvokeData("wingdi.h")]
public enum ArcDirection
{
/// Figures drawn counterclockwise.
AD_COUNTERCLOCKWISE = 1,
/// Figures drawn clockwise.
AD_CLOCKWISE = 2
}
///
/// The AngleArc function draws a line segment and an arc. The line segment is drawn from the current position to the
/// beginning of the arc. The arc is drawn along the perimeter of a circle with the given radius and center. The length of the arc is
/// defined by the given start and sweep angles.
///
/// Handle to a device context.
/// Specifies the x-coordinate, in logical units, of the center of the circle.
/// Specifies the y-coordinate, in logical units, of the center of the circle.
/// Specifies the radius, in logical units, of the circle. This value must be positive.
/// Specifies the start angle, in degrees, relative to the x-axis.
/// Specifies the sweep angle, in degrees, relative to the starting angle.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The AngleArc function moves the current position to the ending point of the arc.
///
/// The arc drawn by this function may appear to be elliptical, depending on the current transformation and mapping mode. Before
/// drawing the arc, AngleArc draws the line segment from the current position to the beginning of the arc.
///
///
/// The arc is drawn by constructing an imaginary circle around the specified center point with the specified radius. The starting
/// point of the arc is determined by measuring counterclockwise from the x-axis of the circle by the number of degrees in the start
/// angle. The ending point is similarly located by measuring counterclockwise from the starting point by the number of degrees in
/// the sweep angle.
///
/// If the sweep angle is greater than 360 degrees, the arc is swept multiple times.
/// This function draws lines by using the current pen. The figure is not filled.
/// Examples
/// For an example, see Drawing a Pie Chart.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-anglearc BOOL AngleArc( HDC hdc, int x, int y, DWORD r, FLOAT
// StartAngle, FLOAT SweepAngle );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "65c38da1-ab7d-4e80-83e3-ba1db66f8fd9")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool AngleArc(HDC hdc, int x, int y, uint r, float StartAngle, float SweepAngle);
/// The Arc function draws an elliptical arc.
/// A handle to the device context where drawing takes place.
/// The x-coordinate, in logical units, of the upper-left corner of the bounding rectangle.
/// The y-coordinate, in logical units, of the upper-left corner of the bounding rectangle.
/// The x-coordinate, in logical units, of the lower-right corner of the bounding rectangle.
/// The y-coordinate, in logical units, of the lower-right corner of the bounding rectangle.
///
/// The x-coordinate, in logical units, of the ending point of the radial line defining the starting point of the arc.
///
///
/// The y-coordinate, in logical units, of the ending point of the radial line defining the starting point of the arc.
///
///
/// The x-coordinate, in logical units, of the ending point of the radial line defining the ending point of the arc.
///
///
/// The y-coordinate, in logical units, of the ending point of the radial line defining the ending point of the arc.
///
///
/// If the arc is drawn, the return value is nonzero.
/// If the arc is not drawn, the return value is zero.
///
///
///
/// The points (nLeftRect, nTopRect) and (nRightRect, nBottomRect) specify the bounding rectangle. An ellipse formed by the specified
/// bounding rectangle defines the curve of the arc. The arc extends in the current drawing direction from the point where it
/// intersects the radial from the center of the bounding rectangle to the (nXStartArc, nYStartArc) point. The arc ends where it
/// intersects the radial from the center of the bounding rectangle to the (nXEndArc, nYEndArc) point. If the starting point and
/// ending point are the same, a complete ellipse is drawn.
///
/// The arc is drawn using the current pen; it is not filled.
/// The current position is neither used nor updated by Arc.
///
/// Use the GetArcDirection and SetArcDirection functions to get and set the current drawing direction for a device context. The
/// default drawing direction is counterclockwise.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-arc BOOL Arc( HDC hdc, int x1, int y1, int x2, int y2, int x3,
// int y3, int x4, int y4 );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "c15a2173-0fad-4a8a-b0f9-cd39fe4e7bac")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool Arc(HDC hdc, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
/// The ArcTo function draws an elliptical arc.
/// A handle to the device context where drawing takes place.
/// The x-coordinate, in logical units, of the upper-left corner of the bounding rectangle.
/// The y-coordinate, in logical units, of the upper-left corner of the bounding rectangle.
/// The x-coordinate, in logical units, of the lower-right corner of the bounding rectangle.
/// The y-coordinate, in logical units, of the lower-right corner of the bounding rectangle.
/// The x-coordinate, in logical units, of the endpoint of the radial defining the starting point of the arc.
/// The y-coordinate, in logical units, of the endpoint of the radial defining the starting point of the arc.
/// The x-coordinate, in logical units, of the endpoint of the radial defining the ending point of the arc.
/// The y-coordinate, in logical units, of the endpoint of the radial defining the ending point of the arc.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// ArcTo is similar to the Arc function, except that the current position is updated.
///
/// The points (nLeftRect, nTopRect) and (nRightRect, nBottomRect) specify the bounding rectangle. An ellipse formed by the specified
/// bounding rectangle defines the curve of the arc. The arc extends counterclockwise from the point where it intersects the radial
/// line from the center of the bounding rectangle to the (nXRadial1, nYRadial1) point. The arc ends where it intersects the radial
/// line from the center of the bounding rectangle to the (nXRadial2, nYRadial2) point. If the starting point and ending point are
/// the same, a complete ellipse is drawn.
///
///
/// A line is drawn from the current position to the starting point of the arc. If no error occurs, the current position is set to
/// the ending point of the arc.
///
/// The arc is drawn using the current pen; it is not filled.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-arcto BOOL ArcTo( HDC hdc, int left, int top, int right, int
// bottom, int xr1, int yr1, int xr2, int yr2 );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "5e358a14-9f39-4267-9a44-c8bf05b5dfbb")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ArcTo(HDC hdc, int left, int top, int right, int bottom, int xr1, int yr1, int xr2, int yr2);
///
/// The Chord function draws a chord (a region bounded by the intersection of an ellipse and a line segment, called a secant).
/// The chord is outlined by using the current pen and filled by using the current brush.
///
/// A handle to the device context in which the chord appears.
/// The x-coordinate, in logical coordinates, of the upper-left corner of the bounding rectangle.
/// The y-coordinate, in logical coordinates, of the upper-left corner of the bounding rectangle.
/// The x-coordinate, in logical coordinates, of the lower-right corner of the bounding rectangle.
/// The y-coordinate, in logical coordinates, of the lower-right corner of the bounding rectangle.
/// The x-coordinate, in logical coordinates, of the endpoint of the radial defining the beginning of the chord.
/// The y-coordinate, in logical coordinates, of the endpoint of the radial defining the beginning of the chord.
/// The x-coordinate, in logical coordinates, of the endpoint of the radial defining the end of the chord.
/// The y-coordinate, in logical coordinates, of the endpoint of the radial defining the end of the chord.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
///
/// The curve of the chord is defined by an ellipse that fits the specified bounding rectangle. The curve begins at the point where
/// the ellipse intersects the first radial and extends counterclockwise to the point where the ellipse intersects the second radial.
/// The chord is closed by drawing a line from the intersection of the first radial and the curve to the intersection of the second
/// radial and the curve.
///
/// If the starting point and ending point of the curve are the same, a complete ellipse is drawn.
/// The current position is neither used nor updated by Chord.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-chord BOOL Chord( HDC hdc, int x1, int y1, int x2, int y2, int
// x3, int y3, int x4, int y4 );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "d6752c47-96a5-4fac-a1bb-0611a91f03f9")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool Chord(HDC hdc, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
///
/// The Ellipse function draws an ellipse. The center of the ellipse is the center of the specified bounding rectangle. The
/// ellipse is outlined by using the current pen and is filled by using the current brush.
///
/// A handle to the device context.
/// The x-coordinate, in logical coordinates, of the upper-left corner of the bounding rectangle.
/// The y-coordinate, in logical coordinates, of the upper-left corner of the bounding rectangle.
/// The x-coordinate, in logical coordinates, of the lower-right corner of the bounding rectangle.
/// The y-coordinate, in logical coordinates, of the lower-right corner of the bounding rectangle.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The current position is neither used nor updated by Ellipse.
/// Examples
/// For an example, see Using Filled Shapes.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-ellipse BOOL Ellipse( HDC hdc, int left, int top, int right,
// int bottom );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "9bec59dd-6bcb-498e-9ed2-ac641ecd7fa5")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool Ellipse(HDC hdc, int left, int top, int right, int bottom);
///
/// The GetArcDirection function retrieves the current arc direction for the specified device context. Arc and rectangle
/// functions use the arc direction.
///
/// Handle to the device context.
///
/// The return value specifies the current arc direction; it can be any one of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// AD_COUNTERCLOCKWISE
/// Arcs and rectangles are drawn counterclockwise.
///
/// -
/// AD_CLOCKWISE
/// Arcs and rectangles are drawn clockwise.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getarcdirection int GetArcDirection( HDC hdc );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "6bf426cd-e028-4568-9e9a-aca58dd69732")]
public static extern ArcDirection GetArcDirection(HDC hdc);
///
/// The LineDDA function determines which pixels should be highlighted for a line defined by the specified starting and ending points.
///
/// Specifies the x-coordinate, in logical units, of the line's starting point.
/// Specifies the y-coordinate, in logical units, of the line's starting point.
/// Specifies the x-coordinate, in logical units, of the line's ending point.
/// Specifies the y-coordinate, in logical units, of the line's ending point.
///
/// Pointer to an application-defined callback function. For more information, see the LineDDAProc callback function.
///
/// Pointer to the application-defined data.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
///
/// The LineDDA function passes the coordinates for each point along the line, except for the line's ending point, to the
/// application-defined callback function. In addition to passing the coordinates of a point, this function passes any existing
/// application-defined data.
///
///
/// The coordinates passed to the callback function match pixels on a video display only if the default transformations and mapping
/// modes are used.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-linedda BOOL LineDDA( int xStart, int yStart, int xEnd, int
// yEnd, LINEDDAPROC lpProc, LPARAM data );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "1400d947-324a-4921-9f65-f5d3a11005da")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool LineDDA(int xStart, int yStart, int xEnd, int yEnd, LineDDAProc lpProc, [Optional] IntPtr data);
/// The LineTo function draws a line from the current position up to, but not including, the specified point.
/// Handle to a device context.
/// Specifies the x-coordinate, in logical units, of the line's ending point.
/// Specifies the y-coordinate, in logical units, of the line's ending point.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The line is drawn by using the current pen and, if the pen is a geometric pen, the current brush.
/// If LineTo succeeds, the current position is set to the specified ending point.
/// Examples
/// For an example, see Drawing Markers.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-lineto BOOL LineTo( HDC hdc, int x, int y );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "a31b3a9a-110f-4cdf-89d9-19937a2e40b4")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool LineTo(HDC hdc, int x, int y);
///
/// The MoveToEx function updates the current position to the specified point and optionally returns the previous position.
///
/// Handle to a device context.
/// Specifies the x-coordinate, in logical units, of the new position, in logical units.
/// Specifies the y-coordinate, in logical units, of the new position, in logical units.
///
/// Pointer to a POINT structure that receives the previous current position. If this parameter is a NULL pointer, the
/// previous position is not returned.
///
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The MoveToEx function affects all drawing functions.
/// Examples
/// For an example, see Drawing Markers.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-movetoex BOOL MoveToEx( HDC hdc, int x, int y, LPPOINT lppt );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "af11eeb7-4036-4a90-8685-9b5719f79e01")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool MoveToEx(HDC hdc, int x, int y, out Point lppt);
///
/// The Pie function draws a pie-shaped wedge bounded by the intersection of an ellipse and two radials. The pie is outlined
/// by using the current pen and filled by using the current brush.
///
/// A handle to the device context.
/// The x-coordinate, in logical coordinates, of the upper-left corner of the bounding rectangle.
/// The y-coordinate, in logical coordinates, of the upper-left corner of the bounding rectangle.
/// The x-coordinate, in logical coordinates, of the lower-right corner of the bounding rectangle.
/// The y-coordinate, in logical coordinates, of the lower-right corner of the bounding rectangle.
/// The x-coordinate, in logical coordinates, of the endpoint of the first radial.
/// The y-coordinate, in logical coordinates, of the endpoint of the first radial.
/// The x-coordinate, in logical coordinates, of the endpoint of the second radial.
/// The y-coordinate, in logical coordinates, of the endpoint of the second radial.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
///
/// The curve of the pie is defined by an ellipse that fits the specified bounding rectangle. The curve begins at the point where the
/// ellipse intersects the first radial and extends counterclockwise to the point where the ellipse intersects the second radial.
///
/// The current position is neither used nor updated by the Pie function.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-pie BOOL Pie( HDC hdc, int left, int top, int right, int
// bottom, int xr1, int yr1, int xr2, int yr2 );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "86daa936-b483-4432-aa32-0b9328ff76f9")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool Pie(HDC hdc, int left, int top, int right, int bottom, int xr1, int yr1, int xr2, int yr2);
/// The PolyBezier function draws one or more Bézier curves.
/// A handle to a device context.
///
/// A pointer to an array of POINT structures that contain the endpoints and control points of the curve(s), in logical units.
///
///
/// The number of points in the lppt array. This value must be one more than three times the number of curves to be drawn, because
/// each Bézier curve requires two control points and an endpoint, and the initial curve requires an additional starting point.
///
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
///
/// The PolyBezier function draws cubic Bézier curves by using the endpoints and control points specified by the lppt
/// parameter. The first curve is drawn from the first point to the fourth point by using the second and third points as control
/// points. Each subsequent curve in the sequence needs exactly three more points: the ending point of the previous curve is used as
/// the starting point, the next two points in the sequence are control points, and the third is the ending point.
///
/// The current position is neither used nor updated by the PolyBezier function. The figure is not filled.
/// This function draws lines by using the current pen.
/// Examples
/// For an example, see Redrawing in the Update Region.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polybezier BOOL PolyBezier( HDC hdc, const POINT *apt, DWORD
// cpt );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "d1622574-c65e-4265-9a17-22bb4d2cae0e")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PolyBezier(HDC hdc, [In] Point[] apt, uint cpt);
/// The PolyBezierTo function draws one or more Bézier curves.
/// A handle to a device context.
/// A pointer to an array of POINT structures that contains the endpoints and control points, in logical units.
///
/// The number of points in the lppt array. This value must be three times the number of curves to be drawn because each Bézier curve
/// requires two control points and an ending point.
///
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
///
/// This function draws cubic Bézier curves by using the control points specified by the lppt parameter. The first curve is drawn
/// from the current position to the third point by using the first two points as control points. For each subsequent curve, the
/// function needs exactly three more points, and uses the ending point of the previous curve as the starting point for the next.
///
/// PolyBezierTo moves the current position to the ending point of the last Bézier curve. The figure is not filled.
/// This function draws lines by using the current pen.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polybezierto BOOL PolyBezierTo( HDC hdc, const POINT *apt,
// DWORD cpt );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "0c8d6d6d-d0a3-4188-91ad-934e6f054862")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PolyBezierTo(HDC hdc, [In] Point[] apt, uint cpt);
/// The PolyDraw function draws a set of line segments and Bézier curves.
/// A handle to a device context.
///
/// A pointer to an array of POINT structures that contains the endpoints for each line segment and the endpoints and control points
/// for each Bézier curve, in logical units.
///
///
///
/// A pointer to an array that specifies how each point in the lppt array is used. This parameter can be one of the following values.
///
///
///
/// Type
/// Meaning
///
/// -
/// PT_MOVETO
/// Specifies that this point starts a disjoint figure. This point becomes the new current position.
///
/// -
/// PT_LINETO
/// Specifies that a line is to be drawn from the current position to this point, which then becomes the new current position.
///
/// -
/// PT_BEZIERTO
///
/// Specifies that this point is a control point or ending point for a Bézier curve. PT_BEZIERTO types always occur in sets of three.
/// The current position defines the starting point for the Bézier curve. The first two PT_BEZIERTO points are the control points,
/// and the third PT_BEZIERTO point is the ending point. The ending point becomes the new current position. If there are not three
/// consecutive PT_BEZIERTO points, an error results.
///
///
///
///
/// A PT_LINETO or PT_BEZIERTO type can be combined with the following value by using the bitwise operator OR to indicate that the
/// corresponding point is the last point in a figure and the figure is closed.
///
///
///
/// Value
/// Meaning
///
/// -
/// PT_CLOSEFIGURE
///
/// Specifies that the figure is automatically closed after the PT_LINETO or PT_BEZIERTO type for this point is done. A line is drawn
/// from this point to the most recent PT_MOVETO or MoveToEx point. This value is combined with the PT_LINETO type for a line, or
/// with the PT_BEZIERTO type of the ending point for a Bézier curve, by using the bitwise operator OR. The current position is set
/// to the ending point of the closing line.
///
///
///
///
/// The total number of points in the lppt array, the same as the number of bytes in the lpbTypes array.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
///
/// The PolyDraw function can be used in place of consecutive calls to MoveToEx, LineTo, and PolyBezierTo functions to draw
/// disjoint figures. The lines and curves are drawn using the current pen and figures are not filled. If there is an active path
/// started by calling BeginPath, PolyDraw adds to the path.
///
///
/// The points contained in the lppt array and in the lpbTypes array indicate whether each point is part of a MoveTo, LineTo, or
/// PolyBezierTo operation. It is also possible to close figures.
///
/// This function updates the current position.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polydraw BOOL PolyDraw( HDC hdc, const POINT *apt, const BYTE
// *aj, int cpt );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "5fd3f285-dcf3-4cd0-915a-236ba7902353")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PolyDraw(HDC hdc, [In] Point[] apt, [In] VertexType[] aj, int cpt);
///
/// The Polygon function draws a polygon consisting of two or more vertices connected by straight lines. The polygon is
/// outlined by using the current pen and filled by using the current brush and polygon fill mode.
///
/// A handle to the device context.
/// A pointer to an array of POINT structures that specify the vertices of the polygon, in logical coordinates.
/// The number of vertices in the array. This value must be greater than or equal to 2.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The polygon is closed automatically by drawing a line from the last vertex to the first.
/// The current position is neither used nor updated by the Polygon function.
///
/// Any extra points are ignored. To draw a line with more points, divide your data into groups, each of which have less than the
/// maximum number of points, and call the function for each group of points. Remember to connect the line segments.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polygon BOOL Polygon( HDC hdc, const POINT *apt, int cpt );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "2f958b91-039a-4e02-b727-be142bb18b06")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool Polygon(HDC hdc, [In] System.Drawing.Point[] apt, int cpt);
/// The Polyline function draws a series of line segments by connecting the points in the specified array.
/// A handle to a device context.
/// A pointer to an array of POINT structures, in logical units.
/// The number of points in the array. This number must be greater than or equal to two.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The lines are drawn from the first point through subsequent points by using the current pen. Unlike the LineTo or PolylineTo
/// functions, the Polyline function neither uses nor updates the current position.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polyline BOOL Polyline( HDC hdc, const POINT *apt, int cpt );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "55481dd0-3db7-4131-b383-4d0036943e60")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool Polyline(HDC hdc, [In] Point[] apt, int cpt);
/// The PolylineTo function draws one or more straight lines.
/// A handle to the device context.
/// A pointer to an array of POINT structures that contains the vertices of the line, in logical units.
/// The number of points in the array.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// Unlike the Polyline function, the PolylineTo function uses and updates the current position.
///
/// A line is drawn from the current position to the first point specified by the lppt parameter by using the current pen. For each
/// additional line, the function draws from the ending point of the previous line to the next point specified by lppt.
///
/// PolylineTo moves the current position to the ending point of the last line.
/// If the line segments drawn by this function form a closed figure, the figure is not filled.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polylineto BOOL PolylineTo( HDC hdc, const POINT *apt, DWORD
// cpt );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "76020742-b651-4244-82c3-13034573c306")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PolylineTo(HDC hdc, [In] Point[] apt, uint cpt);
///
/// The PolyPolygon function draws a series of closed polygons. Each polygon is outlined by using the current pen and filled
/// by using the current brush and polygon fill mode. The polygons drawn by this function can overlap.
///
/// A handle to the device context.
///
/// A pointer to an array of POINT structures that define the vertices of the polygons, in logical coordinates. The polygons are
/// specified consecutively. Each polygon is closed automatically by drawing a line from the last vertex to the first. Each vertex
/// should be specified once.
///
///
/// A pointer to an array of integers, each of which specifies the number of points in the corresponding polygon. Each integer must
/// be greater than or equal to 2.
///
/// The total number of polygons.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The current position is neither used nor updated by this function.
///
/// Any extra points are ignored. To draw the polygons with more points, divide your data into groups, each of which have less than
/// the maximum number of points, and call the function for each group of points. Note, it is best to have a polygon in only one of
/// the groups.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polypolygon BOOL PolyPolygon( HDC hdc, const POINT *apt, const
// INT *asz, int csz );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "ac0a2802-c8b0-4cd7-9521-5b179f2c70b9")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PolyPolygon(HDC hdc, [In] System.Drawing.Point[] apt, [In] int[] asz, int csz);
/// The PolyPolyline function draws multiple series of connected line segments.
/// A handle to the device context.
///
/// A pointer to an array of POINT structures that contains the vertices of the polylines, in logical units. The polylines are
/// specified consecutively.
///
///
/// A pointer to an array of variables specifying the number of points in the lppt array for the corresponding polyline. Each entry
/// must be greater than or equal to two.
///
/// The total number of entries in the lpdwPolyPoints array.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The line segments are drawn by using the current pen. The figures formed by the segments are not filled.
/// The current position is neither used nor updated by this function.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polypolyline BOOL PolyPolyline( HDC hdc, const POINT *apt,
// const DWORD *asz, DWORD csz );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "71a9273f-321b-4efb-ac73-5979f8151d05")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PolyPolyline(HDC hdc, [In] Point[] apt, [In] uint[] asz, uint csz);
///
/// The Rectangle function draws a rectangle. The rectangle is outlined by using the current pen and filled by using the
/// current brush.
///
/// A handle to the device context.
/// The x-coordinate, in logical coordinates, of the upper-left corner of the rectangle.
/// The y-coordinate, in logical coordinates, of the upper-left corner of the rectangle.
/// The x-coordinate, in logical coordinates, of the lower-right corner of the rectangle.
/// The y-coordinate, in logical coordinates, of the lower-right corner of the rectangle.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The current position is neither used nor updated by Rectangle.
/// 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.
/// Examples
/// For an example, see Using Filled Shapes.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-rectangle BOOL Rectangle( HDC hdc, int left, int top, int
// right, int bottom );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "ed6b9824-1edc-4510-b9da-a4287845aa83")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool Rectangle(HDC hdc, int left, int top, int right, int bottom);
///
/// The RoundRect function draws a rectangle with rounded corners. The rectangle is outlined by using the current pen and
/// filled by using the current brush.
///
/// A handle to the device context.
/// The x-coordinate, in logical coordinates, of the upper-left corner of the rectangle.
/// The y-coordinate, in logical coordinates, of the upper-left corner of the rectangle.
/// The x-coordinate, in logical coordinates, of the lower-right corner of the rectangle.
/// The y-coordinate, in logical coordinates, of the lower-right corner of the rectangle.
/// The width, in logical coordinates, of the ellipse used to draw the rounded corners.
/// The height, in logical coordinates, of the ellipse used to draw the rounded corners.
///
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero.
///
///
/// The current position is neither used nor updated by this function.
/// Examples
/// For an example, see Using Filled Shapes.
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-roundrect BOOL RoundRect( HDC hdc, int left, int top, int
// right, int bottom, int width, int height );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "17808a6a-7bd0-4fd6-81ab-00d5db764b93")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool RoundRect(HDC hdc, int left, int top, int right, int bottom, int width, int height);
/// The SetArcDirection sets the drawing direction to be used for arc and rectangle functions.
/// A handle to the device context.
///
/// The new arc direction. This parameter can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// AD_COUNTERCLOCKWISE
/// Figures drawn counterclockwise.
///
/// -
/// AD_CLOCKWISE
/// Figures drawn clockwise.
///
///
///
///
/// If the function succeeds, the return value specifies the old arc direction.
/// If the function fails, the return value is zero.
///
///
/// The default direction is counterclockwise.
/// The SetArcDirection function specifies the direction in which the following functions draw:
///
/// -
/// Arc
///
/// -
/// ArcTo
///
/// -
/// Chord
///
/// -
/// Ellipse
///
/// -
/// Pie
///
/// -
/// Rectangle
///
/// -
/// RoundRect
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-setarcdirection int SetArcDirection( HDC hdc, int dir );
[DllImport(Lib.Gdi32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("wingdi.h", MSDNShortId = "cec31eb2-cc9d-4384-b973-dd4339b96ed0")]
public static extern ArcDirection SetArcDirection(HDC hdc, ArcDirection dir);
}
}