Introduction
TGFX (Tencent Graphics) is a lightweight 2D graphics library designed for rendering texts, geometries, and images. It provides high-performance APIs that work across a variety of hardware and software platforms. TGFX was initially created as a core component of the PAG project and has since become the default graphics engine for the libpag library, starting from version 4.0. Its main objective is to offer a compelling alternative to the Skia graphics library while maintaining a much smaller binary size. Over time, it has found its way into many other products, such as Hippy, Tencent Docs and various video-editing apps.
Platform Support
Vector Backend | GPU Backend | Target Platforms | Status |
---|---|---|---|
FreeType | OpenGL | All | complete |
CoreGraphics | OpenGL | iOS, macOS | complete |
Canvas2D | WebGL | Web | complete |
CoreGraphics | Metal | iOS, macOS | in progress |
FreeType | Vulkan | Android, Linux | planned |
Branch Management
- The
main
branch is our active developing branch which contains the latest features and bugfixes. - The branches under
release/
are our stable milestone branches which are fully tested. We will periodically cut arelease/{version}
branch from themain
branch. After onerelease/{version}
branch is cut, only high-priority fixes are checked into it.
System Requirements
- iOS 9.0 or later
- Android 4.4 or later
- macOS 10.13 or later
- Windows 7.0 or later
- Chrome 69.0 or later (Web)
- Safari 11.3 or later (Web)
Build Prerequisites
- Xcode 11.0+
- GCC 7.0+
- CMake 3.10.2+
- Visual Studio 2019
- NDK 19.2.5345600 (Please use this exact version of NDK, other versions may fail.)
Dependency Management
TGFX uses depsync tool to manage third-party dependencies.
For macOS platform:
Run the script in the root of the project:
./sync_deps.sh
This script will automatically install the necessary tools and synchronize all third-party repositories.
For other platforms:
First, make sure you have installed the latest version of node.js (You may need to restart your computer after this step). And then run the following command to install depsync tool:
npm install -g depsync
And then run depsync
in the root directory of the project.
depsync
Git account and password may be required during synchronizing. Please make sure you have enabled the
git-credential-store
so that CMakeList.txt
can trigger synchronizing automatically next time.
Build & Run
We recommend using CLion IDE on the macOS platform for development. After the synchronization, you can open the project with CLion and build the TGFX library.
For macOS platform:
There are no extra configurations of CLion required.
For Windows platform:
Please follow the following steps to configure the CLion environment correctly:
- Make sure you have installed at least the [Desktop development with C++] and [Universal Windows Platform development] components for VS2019.
- Open the File->Setting panel, and go to Build, Execution, Deployment->ToolChains, then set the toolchain of CLion to Visual Studio with amd64 (Recommended) or x86 architecture.
Note: If anything goes wrong during cmake building, please update the cmake commandline tool to the latest version and try again.
Support Us
If you find TGFX is helpful, please give us a Star. We sincerely appreciate your support :)
License
TGFX is licensed under the BSD-3-Clause License
Contribution
If you have any ideas or suggestions to improve TGFX, welcome to open a discussion / issue / pull request. Before making a pull request or issue, please make sure to read Contributing Guide.