Using GDI in C + + Builder to implement virtual platform screen

Source: Internet
Author: User
Tags range xform

Introduction

The operation of the screen is the general operation of control, but due to the inherent reasons of the screen itself, there are some problems, such as: high cost, easy to damage, difficult to repair and so on. So the computer virtual screen has become a suitable substitute. In the field of simulation, the computer virtual of the platform screen becomes a better method. In the software programming of computer virtual platform, because of the particularity of the screen, there are some corresponding difficulties in compiling the software, such as scaling, roaming and rotating of the image of the screen.

C + + Builder is one of the best technology platforms for Visual C language development based on Windows. Using the basic components provided by C + + Builder, combined with the functional functions of the Windows SDK (Software Development Kit), by using the Windows Graphics Device Interface (GDI), the standard application window T form and its properties and methods, A set of virtual platform screen software is developed. The software provides an effective solution for some features of the console screen.

Pointer rotation and transparency displayed on the screen

The realization of the pointer table of the soft screen is the most common problem in the screen, the usual software is to simplify the appearance of the pointer, that is to draw a line to represent the pointer. When the pointer table of the actual screen is not simplified, the programming of the software needs to realize the rotation of the pointer image.

The Windows Graphics Device Interface (GDI) is independent of the graphics device when drawing. It provides an abstraction layer between the software and the hardware. In order to transform the graph drawing coordinates to the coordinate of the graphics equipment, GDI designed a data structure xform. The structure is as follows:

typedef struct _XFORM {
 FLOAT eM11; 水平缩放因子,旋转角度的余弦
 FLOAT eM12; 水平比例因子,旋转角度的正弦
 FLOAT eM21; 垂直比例因子,旋转角度的正弦负值
 FLOAT eM22; 垂直缩放因子,旋转角度的余弦
 FLOAT eDx; 水平转换偏差
 FLOAT eDy; 垂直转换偏差
} XFORM;

The graphics device coordinates (x ', y ') are converted according to the following formula:

X’ = x * eM11 + y * eM21 + eDx
Y’ = x * eM12 + y * eM22 + eDy

A complete set of program source code including center point, pointer value, quantum range, angle range, 0 point angle, pointer bitmap is given and appropriately commented to specify how to rotate a pointer bitmap.

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.