1e41f4b71Sopenharmony_ci# Graphics Subsystem
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe 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.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci## Mini System
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci### Introduction
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciThe 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.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci**Figure 1** Graphics subsystem architecture 
12e41f4b71Sopenharmony_ci![](figures/graphics-subsystem-architecture.png "graphics subsystem architecture")
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ciThe related modules are described as follows:
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci-   View: provides application components, including **UIView**, **UIViewGroup**, **UIButton**, **UILabel**, **UILabelButton**, **UIList**, and **UISlider**.
17e41f4b71Sopenharmony_ci-   Animator: defines functions for customizing animations.
18e41f4b71Sopenharmony_ci-   Layout: lays out components, including **FlexLayout**, **GridLayout**, and **ListLayout**.
19e41f4b71Sopenharmony_ci-   Transform: rotates, translates, or scales images.
20e41f4b71Sopenharmony_ci-   Event: processes basic events, including click, press, drag, and long press events.
21e41f4b71Sopenharmony_ci-   Rendering engine: performs rendering and drawing operations.
22e41f4b71Sopenharmony_ci-   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.
23e41f4b71Sopenharmony_ci-   Multi-language: processes the line feed and shaping of texts in different languages.
24e41f4b71Sopenharmony_ci-   Image library: parses and operates images of different types and formats, such as PNG, JPEG, ARGB8888, and ARGB565.
25e41f4b71Sopenharmony_ci-   WindowManager: manages windows, including creating, showing, hiding, and combining windows.
26e41f4b71Sopenharmony_ci-   InputManager: processes input events.
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci### Directory Structure
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci```
31e41f4b71Sopenharmony_ci/foundation/arkui
32e41f4b71Sopenharmony_ci├── ui_lite                  # UI module, including UI components, animations, and fonts
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci/foundation/graphic
35e41f4b71Sopenharmony_ci├── surface_lite  # Shared memory
36e41f4b71Sopenharmony_ci├── graphic_utils_lite       # Basic graphics library and hardware adaptation layer
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci/foundation/window
39e41f4b71Sopenharmony_ci└── window_manager_lite      # Window and input event management
40e41f4b71Sopenharmony_ci```
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci### Constraints
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci-   The Graphics subsystem does not support multi-thread concurrent operations. You are advised to perform related operations in UI threads.
45e41f4b71Sopenharmony_ci-   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.
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci### Usage
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ciFor details, see the README and **test** directory of each repository.
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci### Repositories Involved
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci**Graphics subsystem**
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci[graphic\_surface_lite](https://gitee.com/openharmony/graphic_surface_lite)
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci[arkui\_ui_lite](https://gitee.com/openharmony/arkui_ui_lite)
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci[window\_window_manager_lite](https://gitee.com/openharmony/window_window_manager_lite)
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci[graphic\_graphic_utils_lite](https://gitee.com/openharmony/graphic_graphic_utils_lite)
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci## Standard System
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ci### Introduction
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ciThe Graphics subsystem provides graphics APIs.
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ciThe following figure shows the architecture of the Graphics subsystem.
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci![Graphics subsystem architecture](figures/graphic_rosen_architecture.jpg)
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ciThe OpenHarmony graphics stack is divided into the following layers:
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ciInterface layer: provides native APIs for the Graphics subsystem, including WebGL, native drawing, and OpenGL command-level drawing.
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ciFramework layer: consists of the Render Service, Drawing, Animation, Effect, and Display and Memory Management modules.
78e41f4b71Sopenharmony_ci| Module                    | Description                                                                                      |
79e41f4b71Sopenharmony_ci|------------------------|--------------------------------------------------------------------------------------------|
80e41f4b71Sopenharmony_ci| 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.      |
81e41f4b71Sopenharmony_ci| Drawing          | Provides standard internal interfaces in the Graphics subsystem to implement 2D rendering, 3D rendering, and rendering engine management.                                               |
82e41f4b71Sopenharmony_ci| Animation        | Provides capabilities related to the animation engine.                                                                              |
83e41f4b71Sopenharmony_ci| 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.                              |
84e41f4b71Sopenharmony_ci| 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.|
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ciEngine 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.
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci### Directory Structure
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci```
92e41f4b71Sopenharmony_cifoundation/graphic/standard/
93e41f4b71Sopenharmony_ci├── figures                 # Images referenced by Markdown
94e41f4b71Sopenharmony_ci├── frameworks              # Framework code
95e41f4b71Sopenharmony_ci│   ├── animation_server    # Animation server code
96e41f4b71Sopenharmony_ci│   ├── bootanimation       # Boot animation
97e41f4b71Sopenharmony_ci│   ├── dumper              # Graphic dumper code
98e41f4b71Sopenharmony_ci│   ├── fence               # Fence code
99e41f4b71Sopenharmony_ci│   ├── surface             # Surface code
100e41f4b71Sopenharmony_ci│   ├── vsync               # Vsync code
101e41f4b71Sopenharmony_ci├── rosen                   # Framework code
102e41f4b71Sopenharmony_ci│   ├── build               # Build description
103e41f4b71Sopenharmony_ci│   ├── doc                 # doc
104e41f4b71Sopenharmony_ci│   ├── include             # Code of external header files
105e41f4b71Sopenharmony_ci│   ├── lib                 # lib
106e41f4b71Sopenharmony_ci│   ├── modules             # Graphic subsystem code, organized by module
107e41f4b71Sopenharmony_ci│   ├── samples             # Sample code
108e41f4b71Sopenharmony_ci│   ├── test                # Development and test code
109e41f4b71Sopenharmony_ci│   ├── tools               # Tool code
110e41f4b71Sopenharmony_ci├── interfaces              #  Graphics APIs
111e41f4b71Sopenharmony_ci│   ├── innerkits           # Native APIs
112e41f4b71Sopenharmony_ci│   └── kits                # JS APIs and native APIs
113e41f4b71Sopenharmony_ci└── utils                   # Utilities
114e41f4b71Sopenharmony_ci```
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci### Constraints
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ciProgramming language version: C++ 11 or later
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci### Compilation and Building
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ci### Usage
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ciFor details, see the README and **test** directory of each repository.
125e41f4b71Sopenharmony_ci
126e41f4b71Sopenharmony_ci### Repositories Involved
127e41f4b71Sopenharmony_ci
128e41f4b71Sopenharmony_ci**Graphics subsystem**
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci- [**graphic_graphic_2d**](https://gitee.com/openharmony/graphic_graphic_2d)
131e41f4b71Sopenharmony_ci- [arkui_ace_engine](https://gitee.com/openharmony/arkui_ace_engine)
132e41f4b71Sopenharmony_ci- [ability_ability_runtime](https://gitee.com/openharmony/ability_ability_runtime)
133e41f4b71Sopenharmony_ci- [multimedia_player_framework](https://gitee.com/openharmony/multimedia_player_framework)
134e41f4b71Sopenharmony_ci- [multimedia_image_standard](https://gitee.com/openharmony/multimedia_image_standard)
135e41f4b71Sopenharmony_ci- [Windowmanager](https://gitee.com/openharmony/windowmanager)
136e41f4b71Sopenharmony_ci- [third_party_egl](https://gitee.com/openharmony/third_party_egl)
137e41f4b71Sopenharmony_ci- [third_party_opengles](https://gitee.com/openharmony/third_party_opengles)
138e41f4b71Sopenharmony_ci- [third_party_skia](https://gitee.com/openharmony/third_party_skia)
139e41f4b71Sopenharmony_ci- [third_party_giflib](https://gitee.com/openharmony/third_party_giflib)
140