README.md 5.7 KB
Newer Older
M
mamingshuai 已提交
1
# UI<a name="EN-US_TOPIC_0000001123180295"></a>
马明帅 已提交
2

M
mamingshuai 已提交
3 4 5 6 7 8 9
-   [Introduction](#section11660541593)
-   [Directory Structure](#section161941989596)
-   [Constraints](#section119744591305)
-   [Compilation and Building](#section137768191623)
-   [Description](#section1312121216216)
    -   [Component Description](#section66002422015)
    -   [Usage](#section129654513264)
马明帅 已提交
10

M
mamingshuai 已提交
11
-   [Repositories Involved](#section1371113476307)
马明帅 已提交
12

M
mamingshuai 已提交
13
## Introduction<a name="section11660541593"></a>
马明帅 已提交
14

M
mamingshuai 已提交
15
The graphics UI module implements a system-level graphics engine.
马明帅 已提交
16

M
mamingshuai 已提交
17
This module provides the UIKit APIs for application development. You can use the APIs to add animations, manage layouts, transform images, process events, and operates on rich UI components.
马明帅 已提交
18

M
mamingshuai 已提交
19
The graphics UI directly calls the HAL API or uses the client provided by the Window Manager Service \(WMS\) to interact with the hardware to complete operations such as event response and image drawing.
马明帅 已提交
20

M
mamingshuai 已提交
21 22
**Figure  1**  Graphics subsystem architecture<a name="fig1358754417214"></a>  
![](figures/graphics-subsystem-architecture.png "graphics-subsystem-architecture")
马明帅 已提交
23

M
mamingshuai 已提交
24
## Directory Structure<a name="section161941989596"></a>
马明帅 已提交
25

M
mamingshuai 已提交
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
```
/foundation/graphic/ui
├── frameworks                  # Framework code
│   ├── animator                # Animator module
│   ├── common                  # Common module
│   ├── components              # Components
│   ├── core                    # UI main processes (such as rendering and task management)
│   ├── default_resource
│   ├── dfx                     # Maintenance and test
│   ├── dock                    # Driver adaptation layer
│   │   └── ohos                # OHOS platform adaptation
│   ├── draw                    # Drawing logic
│   ├── engines                 # Drawing engines
│   ├── events                  # Events
│   ├── font                    # Fonts
│   ├── imgdecode               # Image management
│   ├── layout                  # Page layout
│   ├── themes                  # Theme management
│   ├── window                  # Window management adaptation layer
│   └── window_manager
│       └── dfb
├── interfaces                  # APIs
│   ├── innerkits               # APIs between modules
│   │   └── xxx                 # Sub-module APIs
L
liuyuxiang-bear 已提交
50
│   └── kits                    # External APIs
M
mamingshuai 已提交
51 52 53 54 55 56 57 58 59 60 61 62
│   │   └── xxx                 # Sub-module APIs
├── test                        # Test code
│   ├── framework
│   │   ├── include             # Header files for the test framework
│   │   └── src                 # Source code for the test framework
│   ├── uitest                  # Display effect test (The executable program is in foundation/graphic/wms/test:sample_ui.)
│   │   └── test_xxx            # Specific UI effect test
│   └── unittest                # Unit testing
│       └── xxx                 # Unit testing for a specific UI component
└── tools                       # Test and simulation tools (simulator projects and resource files)
    └── qt                      # Qt project
```
马明帅 已提交
63

M
mamingshuai 已提交
64
## Constraints<a name="section119744591305"></a>
马明帅 已提交
65

M
mamingshuai 已提交
66 67 68
Platform Constraints

-   The Windows platform supports only Qt and OHOS IDE.
R
Robert Drab 已提交
69
-   For the support of other platforms, see the  **graphic**  tag in  **vendor/hisilicon/\[product\_name\]/config.json**. If the  **graphic**  tag does not exist, it indicates that the product does not have the graphics subsystem.
M
mamingshuai 已提交
70 71 72 73 74

## Compilation and Building<a name="section137768191623"></a>

```
# Generate the libui.so file in the out directory of the product folder through GN compilation.
75
hb build -T //foundation/graphic/ui:ui_lite -f  #build libui.so
76
hb build -T //foundation/graphic/wms/test:sample_ui -f # build UI demo
77
hb build -T //foundation/graphic/ui/test/unittest:arkui_ui_lite_test -f # build TDD testcases
M
mamingshuai 已提交
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97

# To compile the Qt library, see the Qt simulator project at graphic/ui/tools/qt/simulator/simulator.pro.
```

## Description<a name="section1312121216216"></a>

### Component Description<a name="section66002422015"></a>

Components are classified into basic components and container components.

-   Basic components: Implement only a single function, such as  **Text**,  **Button**,  **Image**, and  **List**.
-   Container components: Hold and combine child components to implement complex functions.

**Figure  2**  Graphics subsystem components<a name="fig1594213196218"></a>  
![](figures/graphics-subsystem-components.png "graphics-subsystem-components")

### Usage<a name="section129654513264"></a>

For details about how to use components and APIs of graphics, see the examples provided in  **foundation/graphic/ui/test/uitest**.

Z
Zhouyj_zju 已提交
98
-   The Qt project can be debugged in the Windows environment. [User Guide](https://gitee.com/openharmony/graphic_ui/wikis/%E5%BF%AB%E9%80%9F%E5%8A%A0%E5%85%A5/%E5%8A%A0%E5%85%A5%E6%8C%87%E5%BC%95)
M
mamingshuai 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111 112

    Project file path:

    ```
    graphic/ui/tools/qt/simulator/simulator.pro
    ```

-   For other debugging environments, you can run  **foundation/graphic/wms/test:sample\_ui**.

    After the building is successful, the executable program  **out/\[product\_name\]/dev\_tools/bin/sample\_ui**  is obtained. You can run the program in an environment to view the display effect of a specific component.


## Repositories Involved<a name="section1371113476307"></a>

113
[Graphic subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/graphics.md)
M
mamingshuai 已提交
114

115
[graphic_wms](https://gitee.com/openharmony/graphic_wms/blob/master/README.md)
M
mamingshuai 已提交
116

117
[graphic_surface](https://gitee.com/openharmony/graphic_surface/blob/master/README.md)
马明帅 已提交
118

B
benb365 已提交
119 120
**graphic_ui**

121
[graphic_utils](https://gitee.com/openharmony/graphic_utils/blob/master/README.md)