graphics.md 7.0 KB
Newer Older
W
wusongqing 已提交
1
# Graphics Subsystem
M
mamingshuai 已提交
2 3


W
wusongqing 已提交
4
The Graphics subsystem mainly consists of user interface (UI) components, layout, animator, font, input event, window management, and rendering and drawing modules. It is an application framework that can be built on the LiteOS to develop OpenHarmony applications for Internet of Things (IoT) devices with limited hardware resources or on the standard OS to develop OpenHarmony applications for standard- and large-system devices.
M
mamingshuai 已提交
5

W
wusongqing 已提交
6
## Mini System
M
mamingshuai 已提交
7

W
wusongqing 已提交
8
### Introduction
M
mamingshuai 已提交
9

W
wusongqing 已提交
10 11 12 13
The Graphics subsystem mainly consists of UI components, layout, animator, font, input event, window management, and rendering and drawing modules. It is an application framework that can be built on the LiteOS to develop OpenHarmony applications for IoT devices with limited hardware resources.

**Figure 1** Graphics subsystem architecture 
![](figures/graphics-subsystem-architecture.png "graphics subsystem architecture")
M
mamingshuai 已提交
14 15 16

The related modules are described as follows:

W
wusongqing 已提交
17 18 19
-   View: provides application components, including **UIView**, **UIViewGroup**, **UIButton**, **UILabel**, **UILabelButton**, **UIList**, and **UISlider**.
-   Animator: defines functions for customizing animations.
-   Layout: lays out components, including **Flexlayout**, **GridLayout**, and **ListLayout**.
M
mamingshuai 已提交
20 21 22
-   Transform: rotates, translates, or scales images.
-   Event: processes basic events, including click, press, drag, and long press events.
-   Rendering engine: performs rendering and drawing operations.
W
wusongqing 已提交
23
-   2D graphics library: draws 2D graphical elements including lines, rectangles, circles, arcs, images, and texts. Functions of this module include interconnection with the software drawing and hardware acceleration capabilities.
M
mamingshuai 已提交
24 25
-   Multi-language: processes the line feed and shaping of texts in different languages.
-   Image library: parses and operates images of different types and formats, such as PNG, JPEG, ARGB8888, and ARGB565.
W
wusongqing 已提交
26
-   WindowManager: manages windows, including creating, showing, hiding, and combining windows.
M
mamingshuai 已提交
27 28
-   InputManager: processes input events.

W
wusongqing 已提交
29
### Directory Structure
M
mamingshuai 已提交
30 31 32 33

```
/foundation/graphic
├── surface  # Shared memory
W
wusongqing 已提交
34
├── ui       # UI module, including UI components, animations, and fonts
M
mamingshuai 已提交
35 36 37 38
├── utils    # Basic graphics library and hardware adaptation layer
└── wms      # Window and input event management
```

W
wusongqing 已提交
39
### Constraints
M
mamingshuai 已提交
40 41

-   The Graphics subsystem does not support multi-thread concurrent operations. You are advised to perform related operations in UI threads.
W
wusongqing 已提交
42
-   The **utils/interfaces/innerkits/graphic\_config.h** file provides the configuration information about macro switches that can be used to enable or disable graphics features. You need to configure these switches before compilation. Note that some switches are configured depending on the platform.
M
mamingshuai 已提交
43

W
wusongqing 已提交
44
### Usage
M
mamingshuai 已提交
45

W
wusongqing 已提交
46
For details, see the README and **test** directory of each repository.
M
mamingshuai 已提交
47

W
wusongqing 已提交
48
### Repositories Involved
M
mamingshuai 已提交
49 50 51

**Graphics subsystem**

W
wusongqing 已提交
52
[graphic\_surface](https://gitee.com/openharmony/graphic_surface)
M
mamingshuai 已提交
53

W
wusongqing 已提交
54
[graphic\_ui](https://gitee.com/openharmony/graphic_ui)
M
mamingshuai 已提交
55

W
wusongqing 已提交
56
[graphic\_wms](https://gitee.com/openharmony/graphic_wms)
M
mamingshuai 已提交
57

W
wusongqing 已提交
58
[graphic\_utils](https://gitee.com/openharmony/graphic_utils)
M
mamingshuai 已提交
59

W
wusongqing 已提交
60
## Standard System
M
mamingshuai 已提交
61

W
wusongqing 已提交
62
### Introduction
M
mamingshuai 已提交
63

W
wusongqing 已提交
64
The Graphics subsystem provides graphics APIs.
M
mamingshuai 已提交
65 66 67

The following figure shows the architecture of the Graphics subsystem.

W
wusongqing 已提交
68
![Graphics subsystem architecture](figures/graphic_rosen_architecture.jpg)
M
mamingshuai 已提交
69

W
wusongqing 已提交
70
The OpenHarmony graphics stack is divided into the following layers:
M
mamingshuai 已提交
71

W
wusongqing 已提交
72
Interface layer: provides native APIs for the Graphics subsystem, including WebGL, native drawing, and OpenGL command-level drawing.
M
mamingshuai 已提交
73

W
wusongqing 已提交
74 75 76
Framework layer: consists of the Render Service, Drawing, Animation, Effect, and Display and Memory Management modules.
| Module                    | Description                                                                                      |
|------------------------|--------------------------------------------------------------------------------------------|
W
wusongqing 已提交
77
| Render Service | Performs UI framework drawing. This module converts the ArkUI component description into drawing tree information and renders the optimal path based on the corresponding rendering policy. It also provides the core underlying mechanism for multi-window smoothness and spatial UI sharing.      |
W
wusongqing 已提交
78 79 80 81
| Drawing          | Provides standard internal interfaces in the Graphics subsystem to implement 2D rendering, 3D rendering, and rendering engine management.                                               |
| Animation        | Provides capabilities related to the animation engine.                                                                              |
| Effect           | Processes image effects and rendering effects, including cascading and parallel processing of multiple effects, and adding rendering effects and component interaction effects during layout.                              |
| Display and Memory Management               | Decouples the graphics stack from hardware and provides OpenHarmony display and memory management. OEMs need to adapt the HDIs defined by this module.|
M
mamingshuai 已提交
82

W
wusongqing 已提交
83
Engine layer: consists of the 2D graphics library and 3D graphics engine. The 2D graphics library provides bottom-layer APIs for 2D graphics drawing (including text drawing). The 3D graphics engine capability is being developed.
M
mamingshuai 已提交
84 85


W
wusongqing 已提交
86
### Directory Structure
M
mamingshuai 已提交
87 88 89

```
foundation/graphic/standard/
W
wusongqing 已提交
90
├── figures                 # Images referenced by Markdown
M
mamingshuai 已提交
91
├── frameworks              # Framework code
W
wusongqing 已提交
92 93 94 95
│   ├── animation_server    # Animation server code
│   ├── bootanimation       # Boot animation
│   ├── dumper              # Graphic dumper code
│   ├── fence               # Fence code
M
mamingshuai 已提交
96 97
│   ├── surface             # Surface code
│   ├── vsync               # Vsync code
W
wusongqing 已提交
98 99 100 101 102 103 104 105 106 107
├── rosen                   # Framework code
│   ├── build               # Build description
│   ├── doc                 # doc
│   ├── include             # Code of external header files
│   ├── lib                 # lib
│   ├── modules             # Graphic subsystem code, organized by module
│   ├── samples             # Sample code
│   ├── test                # Development and test code
│   ├── tools               # Tool code
├── interfaces              #  Graphics APIs
M
mamingshuai 已提交
108
│   ├── innerkits           # Native APIs
W
wusongqing 已提交
109
│   └── kits                # JS APIs and native APIs
M
mamingshuai 已提交
110 111 112
└── utils                   # Utilities
```

W
wusongqing 已提交
113
### Constraints
M
mamingshuai 已提交
114

W
wusongqing 已提交
115
Programming language version: C++ 11 or later
M
mamingshuai 已提交
116

W
wusongqing 已提交
117
### Compilation and Building
M
mamingshuai 已提交
118

W
wusongqing 已提交
119
### Usage
M
mamingshuai 已提交
120

W
wusongqing 已提交
121
For details, see the README and **test** directory of each repository.
M
mamingshuai 已提交
122

W
wusongqing 已提交
123
### Repositories Involved
M
mamingshuai 已提交
124 125 126

**Graphics subsystem**

Mr-YX's avatar
Mr-YX 已提交
127 128 129 130
- [ace_ace_engine](https://gitee.com/openharmony/ace_ace_engine)
- [aafwk_standard](https://gitee.com/openharmony/aafwk_standard)
- [multimedia_media_standard](https://gitee.com/openharmony/multimedia_media_standard)
- [multimedia_camera_standard](https://gitee.com/openharmony/multimedia_camera_standard)
W
wusongqing 已提交
131
- [windowmanager](https://gitee.com/openharmony/windowmanager)