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

W
wusongqing 已提交
3
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 已提交
4

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

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

W
wusongqing 已提交
9 10 11 12
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 已提交
13 14 15

The related modules are described as follows:

W
wusongqing 已提交
16 17
-   View: provides application components, including **UIView**, **UIViewGroup**, **UIButton**, **UILabel**, **UILabelButton**, **UIList**, and **UISlider**.
-   Animator: defines functions for customizing animations.
Z
zhumingxian 已提交
18
-   Layout: lays out components, including **FlexLayout**, **GridLayout**, and **ListLayout**.
M
mamingshuai 已提交
19 20 21
-   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 已提交
22
-   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 已提交
23 24
-   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 已提交
25
-   WindowManager: manages windows, including creating, showing, hiding, and combining windows.
M
mamingshuai 已提交
26 27
-   InputManager: processes input events.

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

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

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

-   The Graphics subsystem does not support multi-thread concurrent operations. You are advised to perform related operations in UI threads.
W
wusongqing 已提交
41
-   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 已提交
42

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

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

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

**Graphics subsystem**

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

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

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

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

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

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

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

The following figure shows the architecture of the Graphics subsystem.

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

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

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

W
wusongqing 已提交
73 74 75
Framework layer: consists of the Render Service, Drawing, Animation, Effect, and Display and Memory Management modules.
| Module                    | Description                                                                                      |
|------------------------|--------------------------------------------------------------------------------------------|
G
Gloria 已提交
76
| 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 已提交
77 78 79 80
| 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 已提交
81

W
wusongqing 已提交
82
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 已提交
83 84


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

```
foundation/graphic/standard/
W
wusongqing 已提交
89
├── figures                 # Images referenced by Markdown
M
mamingshuai 已提交
90
├── frameworks              # Framework code
W
wusongqing 已提交
91 92 93 94
│   ├── animation_server    # Animation server code
│   ├── bootanimation       # Boot animation
│   ├── dumper              # Graphic dumper code
│   ├── fence               # Fence code
M
mamingshuai 已提交
95 96
│   ├── surface             # Surface code
│   ├── vsync               # Vsync code
W
wusongqing 已提交
97 98 99 100 101 102 103 104 105 106
├── 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 已提交
107
│   ├── innerkits           # Native APIs
W
wusongqing 已提交
108
│   └── kits                # JS APIs and native APIs
M
mamingshuai 已提交
109 110 111
└── utils                   # Utilities
```

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

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

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

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

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

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

**Graphics subsystem**

G
Gloria 已提交
126 127 128 129 130 131 132 133 134 135
- [**graphic_graphic_2d**](https://gitee.com/abbuu_openharmony/graphic_graphic_2d)
- [arkui_ace_engine](https://gitee.com/openharmony/arkui_ace_engine)
- [ability_ability_runtime](https://gitee.com/openharmony/ability_ability_runtime)
- [multimedia_player_framework](https://gitee.com/openharmony/multimedia_player_framework)
- [multimedia_image_standard](https://gitee.com/openharmony/multimedia_image_standard)
- [Windowmanager](https://gitee.com/openharmony/windowmanager)
- [third_party_egl](https://gitee.com/openharmony/third_party_egl)
- [third_party_opengles](https://gitee.com/openharmony/third_party_opengles)
- [third_party_skia](https://gitee.com/openharmony/third_party_skia)
- [third_party_giflib](https://gitee.com/openharmony/third_party_giflib)