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