Delphi and DirectX Delphix (3): First knowledge Tdxdraw

Source: Internet
Author: User

In the Delphix, what can be seen is generally painted in Tdxdraw.

Tdxdraw default Two drawing surfaces: Tdxdraw.surface and tdxdraw.primary;

Generally first in the background (Surface) drawing, and then use the tdxdraw.flip command switch before and after the table, so as to see the rendering effect.

Tdxdraw.flip will replace Surface and Primary two objects, so we can only draw on the Surface;

Because of the working mechanism of DirectX, let this switch speed unusually fast (just switch a pointer), thus can complete the very fluent animation, the game.

The Canvas object can also be obtained from the drawing surface of the Tdxdraw, so gdi/gdi+ drawing commands can also be used in Tdxdraw;

But using gdi/gdi+ with DirectX should make DirectX's performance shrink, but this is always good, at least better than using gdi/gdi+ alone.

The DXDraw1.Surface.Canvas object is used in the following example;

After the use of DXDraw1.Surface.Canvas, must be released (DXDraw1.Surface.Canvas.Release);

In addition, often before drawing to fill the surface with the specified color, such as: DXDraw1.Surface.Fill (color value);

The color format here is different from that of Delphi, and the order of color values used in HTML is the same, for example: $FF 0000 indicates red.

This example effect chart:

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.