-WPF Overview of WPF Learning Notes (two highlights)

Source: Internet
Author: User

two highlights of WPF
first, hardware acceleration
WPF Graphics display is based on DirectX (the graphical display engine originally developed for game display), not gdi/gdi+.


The goal of WPF is to give as much work as possible to the graphics card processing, so complex graphics are usually rendered in the rendering range (handled by the GPU) and not in the processor range (handled by the computer's CPU). That is, the CPU can be idle to do other work, take full advantage of the capabilities of the graphics card, and can also take full advantage of the new graphics card in the future with the ever-increasing new features.

WPF rendering Level (WPF TIERS)

The difference between the features of the graphics card is very important. When WPF accesses a video card, it takes into account a number of factors, including the amount of RAM on the video card, support for the pixel shader (pixel shader) (the program that the video card provides to calculate each pixel effect, such as the transparency effect), and support for the vertex shader (vertex shader) ( The graphics card provides programs that calculate the value of each triangle vertex, such as the coloring of a 3D object. Based on these details, WPF specifies a render level value.

WPF provides three levels of rendering, as follows:

Rendering Tier 0: The graphics card will not provide any hardware acceleration features. This level corresponds to DirectX version 7.0 or lower.

Rendering Tier1: The graphics card can provide some hardware acceleration features. This level corresponds to DirectX of 7.0 or more of the following versions of 9.0.

Rendering Tier2: All features will be hardware accelerated. This level corresponds to DirectX version 9.0 and above.


Second, resolution-independent

1, the system dpi:1 inches on the pixel point (default is 96). 1 inch = 2.54 cm


How to calculate the system dpi:


23 inch-Contains a border.

Viewable area-is the size of the display panel, converted to inches

509.184/10/2.54 = 20.04 inch-wide

286.416/10/2.54 = 11.28 inch-high

When the resolution is set to 1920x1080, the current system dpi:

1920/20.04 = 96

1080/1128 = 96


changing the "display" or "Resolution" settings will change the system dpi (not the default of 96, the general display by default)

WPF has been highlighting "resolution-independent (resolution Independence)" since its release, claiming that the WPF-crafted user interface is well-displayed on a lightweight Ultra-Mobile PC screen and on a 50-inch TV. Microsoft says that WPF has a "resolution independent" feature, mainly because the coordinate units of WPF are designed to be in 1/96-inch units of logical pixels rather than device-related units of pixels.


(1) WPF can be "resolution-independent" when printing, that is, the same WPF user interface and drawing the graphics size on any one printer output is consistent;

(2) When the physical dimensions of the display's actual cell and the DPI of the system settings are consistent, WPF can do "resolution-independent" on the display, That is, the output of the same WPF user interface and drawing dimensions is consistent on any one display (the physical size of the actual cell and the DPI of the system setting). Conversely, there is no guarantee.

The number of pixels in the 1 inch of the two machines is the same, and the size of the items shown above will not change.

Two days of machine DPI is different, the interface size is different


Personal summary: As long as the device's resolution is the default resolution, the element dimensions of WPF will not change on these devices.


-WPF Overview of WPF Learning Notes (two highlights)

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.