In Visual C + +. NET for GDI + programming

Source: Internet
Author: User
Tags new features

The GDI + interface, which is part of the Microsoft Whistler operating system, is a new version of GDI, adding many new features on the GDI basis and optimizing the existing GDI functionality. In two-dimensional vector graphics that are provided for developers, text, image processing, area, path and graphics data matrix constructs a series of related classes, such as bitmap (Bitmap Class), Brush (Painting brush Class), color (color Class), font (font Class), Graphics (graphic Class), Images (image classes), pen (brush classes), and region (area classes), and so on. The Graphics class graphics is a core class in the GDI + interface, and many drawing operations can be done with it.

Let's begin by introducing the new features of GDI + and how it is programmed to change, and then introduce Visual C + +. NET is a general method of using GDI + in applications such as dialog boxes and single document/multiple documents.

GDI + new Features

GDI + has added the following new features compared to GDI:

1, gradient painting brush

The previous way for GDI to implement a color-gradient region is by using a different color line to populate a cropped area. GDI + now extends GDI functionality, providing linear gradients and path gradient brushes to populate a graph, path, and area, and even draw lines, curves, and so on. The path here can be seen as a trajectory generated by various drawing functions.

2. Spline curve

For the curve, the most practical significance is the spline curve. Spline curve is produced and developed on the basis of production practice. The designer between the die lines, when drawing the die line, first accurately "point" the type value point to the board on the given data. Then, a tool called "spline" (an elastic plexiglass or wood bar) is used, force it through these types of values, and then adjust the pressure properly so that the shape of the spline changes until the proper shape is obtained, and the desired curve is drawn along the spline. If we look at the spline as an elastic thin beam, then the iron can be seen as a concentration on some points on the beam. Graphics of GDI +:: There is one such parameter in the DrawCurve function to adjust the size of the concentration force. In addition to spline curves, GDI + supports Bezier curves in the original GDI.

3, the Persistent Path object

We know that in GDI the path is subordinate to a device environment (context), which means that once the device environment pointer exceeds its validity period, the path is also deleted. GDI + uses the Graphics object for drawing operations and separates the path operation from the Graphics object, providing a GraphicsPath class for the user to use. This means that we do not have to worry about the path object being affected by the Graphics object operation, so that you can use the same path object for multiple path drawing operations.

4, Matrix and matrix transformation

In the process of graphic processing, it is necessary to transform geometric information to produce complex new graphics, and matrix is the most common method for geometric transformation of graphics. In order to meet people's demand for graphic transformation, GDI + provides powerful matrix classes to transform operations of matrices such as rotation, dislocation, translation, and scale, and GDI + also supports matrix transformations of graphics graphics and regions (Region).

5, Alpha process color

In image processing, alpha is used to measure the transparency of a pixel or image. In uncompressed 32-bit RGB images, each pixel is made up of four parts: an alpha channel and three color components (R, G, and B). When the alpha value is 0 o'clock, the pixel is completely transparent, and when the alpha value is 255, the pixel is completely opaque.

Alpha process color blends the color of the source and background pixels, and the resulting color depends on its RGB color components and alpha values. The relationships between them can be represented by the following formulas:
Display color = source pixel color x alpha/255 + background color x (255-alpha)/255

GDI + 's Color class defines the ARGB color data type, which allows you to change the actual effect of lines, images, and so on with the background color by adjusting the alpha values.

In addition to the new features mentioned above, GDI + will also support features such as recolor, color correction, anti-aliasing, metadata, and graphics containers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.