1. Introduction GDI is a subsystem in Windows XP, which is mainly responsible for outputting information about the display screen and the print device, which is an application programming interface implemented by the C class. As the name suggests, GDI is the successor of previous version of GDI. For compatibility, Windows XP still supports previous version of GDI, but when developing new applications, the developers should use GDI to meet graphic output, because GDI previous The GDI in the Windows version has been optimized and added a lot of new features. GDI as a graphical device interface allows the application developer to output the screen and the printer information, there is no need to consider the details of the specific display device, and they only need to call some methods of the GDI library output to complete the graphics operation, the real drawing work These methods are handed over to specific device drivers, and GDI makes graphics hardware and applications to isolate each other. Thus makes developers write equipment-independent applications very easy. 2.GDI New Function (1) Gradient Brushes GDI allows users to create a painting brush along path or straight lines to fill in Shapes, paths, region, and gradual painting The brush can also draw a straight line, curve, path. When you fill a shape (Shapes) with a line-shaped painting, the color can gradually change along the shape.
(2) Cardinal SPlines GDI supports the base spline function, while GDI does not support. The base spline is a large curve that is connected in a set of single curves in order to connect. The spline is specified by a range of points and passes through each specified point. Since the base spline is smooth through every point in the group (no sharp corners), it is more accurate than the path created with a linear connection. Below is a graphic created by two methods, one uses a base spline, one uses a straight line.
(3) Persistent Path Objects In GDI, the path belongs to the device description table (DC), and the path will be destroyed after the painting. In GDI , the drawing works by the Graphics object, you can create a few path objects separated from Graphics, and the path object is not broken when the drawing is operated so that you can use the same path object multiple times. (4) Transformations & Matrix Objects GDI provides matrix objects, a very powerful tool that makes the pattern of rotation, translation, and zoom code become very easy. A matrix object is always associated with a graphic transformation. For example, the path object (PATH) has a transform method, and one of its parameters can accept the address of the matrix object, and it can be drawn according to the transformation matrix. . The following graphic is an example before and after a graphical transformation, and the transformation is turned until the zoom is scaled.
(5) Scalable Regions GDI Improve GDI in the region (Regions), in GDI, RegionS is stored in the device coordinates, and the only operation of the REGONS unique to graphically transform is translated to the region. GDI uses the World Coordinate Storage Area (Regions), allowing any graphic transformation to the region (such as scaling as shown), graphical transformation to transform matrix storage, the following example is an example (zoom, rotation, translation) before and after a region transform (zoom, rotation, translation )
(6) Alpha Blending You may notice the graphic displayed above, the red unlafered area has a portion of the crossover area, and the fantasy effect of this part is implemented by the Alpha Blending (mixing) supported by GDI . With Alpha Fusion, you can specify the transparency of the fill color, the transparent color is integrated with the background color, the more transparent the color, the more clear the background color, the four ellipses shown below are filled in the same color, but due to different Different display effects in transparency. (7) Multiple image format support. Image possess a lightweight position in the graphical interface program, GDI In addition to supporting GDI supported graphics format such as BMP, GrPhics Interchange Format, PNG Image format such as Exchangeable Image File, Tiff (Tag Image File Format), you can use these image files directly in the program without considering the compressed algorithms used. (8) Others. GDI will also support other technologies, such as reloading, color correction, metadata, graphic containers, perhaps these features we will in future WindowsXP or Microsoft Visualstudio. See it in Net.