The content written in the previous two articles in the series is too simple. This article will give a summary of the GDI + I understand and will not involve code details.
There are three types of coordinates in GDI +: Global coordinates, page coordinates, and device coordinates. In the drawing call of GDI +, the input coordinates are within the Global coordinates. The Global coordinates are converted to the page coordinates through the global transformation, and the page coordinates are calculated through the page transformation.
Global transformation is specified by graphics. transform, and its type is matrix. The matrix in GDI + is a 3x3 floating-point matrix. You can use the methods and attributes of the matrix class to modify the global transformation, or use the translatetransform method in the graphics class. Page conversion uses pageunit and pagescale of the graphics class to set the coordinate unit and zoom factor.
Point, size, and rectangle are commonly used metric types in GDI + and all have the corresponding float type. Color indicates the 32-bit a8r8g8b8 color. These are all basic value types. In actual use, remember the features of the value type, such as O. size. width = 100 Code does not work, because. width = 100 is used in O. the temporary variable returned by size has no effect on the O status.
Graphicspath, region, and image are some resource types in GDI +. You must dispose them as soon as they are used. Graphicspath is a series of continuous lines, including straight lines and curves. Region indicates a closed area. The border of this area can be described by graphicspath. An image indicates a graph. The derived class of a bitmap consisting of pixels is bitmap, and the derived class of a graph composed of a map instruction with loss is Metafile. Computer screens are best at displaying two-dimensional data. Therefore, rectangle is regarded as the simplest region and has a wide range of applications. It is also very common to calculate rectangle containing the entire region.
The brush is used to fill in a region. During filling, you can use monochrome filling, texture filling, or linear filling or gradient filling ,. net. The encapsulated GDI + provides the solidbrush, texturebrush, hatchbrush, lineargradientbrush, and pathgradientbrush classes. You can use the static attributes in systembrushes and brushes to obtain a pre-defined brush table, which saves the trouble of dispose.
The pen is used to draw a line. The line of the GDI + has a width and an internal area. Therefore, the pen in the GDI + needs a brush instance to construct it. Likewise, systempens and pens provide predefined monochrome pen instances.
In addition, the font object is used to output different fonts in GDI +. The graphics class provides a measurestring method to calculate the area size occupied by a string when it is drawn.
The graphics class provides a series of draw... methods that use a specific pen to draw a certain shape. The fill... series uses a specific brush to fill a specified area.
The clip attribute of graphics uses a region class instance to specify the region where GDI + is effectively drawn. This is a basic information. The attributes of graphics include clipbounds, isclipempty, isvisibleclipbounds, and visibleclipbounds, and read-only.
Compositingquality, interpolationmode, pixeloffsetmode, smoothingmode, and textrenderinghint are used to control the output quality. The higher the quality, the slower the speed. Compositingmode is used to enable Alpha blend, while textcontrast controls the GAMMA value of the text output. renderingorigin controls the starting point of the 8-bit/16-bit deep color mixing and hatch brush.
These contents are sufficient for the subsequent minesweeper content. If you have any questions, please submit them in the comments.