Coder Social home page Coder Social logo

tencent / tgfx Goto Github PK

View Code? Open in Web Editor NEW
1.0K 17.0 62.0 2.46 MB

A lightweight 2D graphics library for rendering texts, geometries, and images with high-performance APIs that work across various platforms.

License: Other

CMake 1.22% Python 0.09% Shell 0.34% C++ 91.04% Objective-C 1.08% Objective-C++ 2.97% CSS 0.01% HTML 0.02% TypeScript 2.61% JavaScript 0.34% Kotlin 0.25% QML 0.02%
2d graphics tgfx rendering gpu

tgfx's Introduction

TGFX Logo

license PRs Welcome codecov autotest build GitHub release (latest SemVer)

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 GPU hardware and software platforms, including iOS, Android, macOS, Windows, Linux, Web, and more. TGFX was originally designed to serve as the default graphics engine for the PAG project 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

  • iOS 9.0 or later
  • Android 4.4 or later
  • macOS 10.15 or later
  • Windows 7.0 or later
  • Chrome 69.0 or later (Web)
  • Safari 11.3 or later (Web)

Backing Renderers

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 a release/{version} branch from the main branch. After one release/{version} branch is cut, only high-priority fixes are checked into it.

Build Prerequisites

TGFX utilizes the C++17 features for development. Below are the minimum tools needed for building tgfx on different platforms:

  • Xcode 11.0+
  • GCC 9.0+
  • Visual Studio 2019+
  • NodeJS 14.14.0+
  • Ninja 1.9.0+
  • CMake 3.13.0+
  • QT 5.13.0+
  • NDK 19.2+ (19.2.5345600 recommended)
  • Emscripten 3.1.20+ (3.1.20 recommended)

Please pay attention to the following additional notices:

  • Make sure you have installed at least the [Desktop development with C++] and [Universal Windows Platform development] components for VS2019.
  • It is highly recommended to use the latest version of CMake, Numerous outdated versions of CMake may carry various bugs across different platforms.

Dependencies

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.

Getting Started

We offer concise demos for different platforms, demonstrating how to integrate the tgfx library into your project. Once you've built the project, you'll find a straightforward app rendering various test cases from the drawers/ directory. These test cases include rendering shapes, images, and simple texts. With a simple touch on the screen, you can switch between different test cases. If you are looking for further guidance on API usage, consider exploring the test cases found in the test/ directories. They may provide valuable insights and assistance.

Before you begin building the demo projects, please make sure to carefully follow the instructions provided above in the Build Prerequisites and Dependencies sections. They will guide you through the necessary steps to configure your development environment.

Android

The android demo project requires the Android NDK. We recommend using the 19.2.5345600 version, which has been fully tested with the tgfx library. If you open the project with Android Studio, it will automatically download the NDK during Gradle synchronization. Alternatively, you can download it from the NDK Downloads page.

If you choose to manually download the Android NDK, please extract it to the default location. On macOS, this would be:

/Users/yourname/Library/Android/sdk/ndk/19.2.5345600

On Windows, it would be:

C:\Users\yourname\AppData\Local\Android\Sdk\ndk\19.2.5345600

Alternatively, you can set one of the following environment variables for tgfx to locate the NDK:

["ANDROID_NDK_HOME", "ANDROID_NDK_ROOT", "ANDROID_NDK", "NDK_HOME", "NDK_ROOT", "NDK_PATH"]

To get started, open the android/ directory in Android Studio, and you'll be all set! If you encounter any issues during Gradle synchronization, please ensure that you haven't accidentally clicked on the pop-up hints for Gradle version upgrades. If you have, undo the changes you made to the project and attempt synchronization again. If the issue is related to your IDE configuration, please search for a solution on Google. However, if you believe the problem is associated with the project configuration, you can open an Issue to address it.

iOS

Run the following command in the ios/ directory or double-click on it:

./gen_ios

This will generate an XCode project for iPhone devices. If you prefer to generate a project for the simulators, use the following command instead:

./gen_simulator

This will generate a simulator project for the native architecture, for example, arm64 for Apple Silicon Macs and x64 for Intel Macs. If you want to generate a project for the specific architecture, you can use the -a option:

./gen_simulator -a x64

Additionally, you can pass cmake options using the -D option. For instance, if you want to generate a project with webp encoding support, please run the following command:

./gen_ios -DTGFX_USE_WEBP_ENCODE=ON

Finally, open XCode and launch the ios/Hello2D.xcworkspace to build and run the demo project.

macOS

Run the following command in the mac/ directory or double-click on it:

./gen_mac

This will generate a project for the native architecture, for example, arm64 for Apple Silicon Macs and x64 for Intel Macs. If you want to generate a project for the specific architecture, you can use the -a option, for example:

./gen_mac -a x64

Additionally, you can pass cmake options using the -D option. For example, if you want to generate a project with freetype support, please run the following command:

./gen_mac -DTGFX_USE_FREETYPE=ON

At last, launch XCode and open the mac/Hello2D.xcworkspace. You'll be ready to go!

Web

The web demo project requires the Emscripten SDK. You can download and install it from the official website. We recommend using the 3.1.20 version, which has been fully tested with the tgfx library. If you are on macOS, you can also install it using the following script:

web/script/install-emscripten.sh

To begin, navigate to the web/ directory and execute the following command to install the necessary node modules:

npm install

And then run the following command in the web/ directory to build the demo project:

npm run build

This will generate hello2d.js and hello2d.wasm files into the web/demo/wasm directory. Afterward, you can start an HTTP server by running the following command:

npm run server

This will open http://localhost:8081/web/demo/index.html in your default browser. You can also open it manually to see the demo.

To debug the C++ code, ensure that you have installed the browser plugin: C/C++ DevTools Support (DWARF). Next, open Chrome DevTools and navigate to Settings > Experiments. Check the option WebAssembly Debugging: Enable DWARF support to enable SourceMap support.

And then, replace the previous build command with the following:

npm run build:debug

With these steps completed, you will be able to debug C++ files directly within Chrome DevTools.

To build the demo project in CLion, please Open the Settings panel in CLion and go to Build, Execution, Deployment > CMake. Create a new build target. And then set the CMake options to the following value:

DCMAKE_TOOLCHAIN_FILE="path/to/emscripten/emscripten/version/cmake/Modules/Platform/Emscripten.cmake"

Once you have created the build target, make sure to adjust the Configurations accordingly to align with the newly created build target. By doing so, you will gain the ability to build the tgfx library in CLion.

Additionally, please note that when using ESModule for your project, it is necessary to manually pack the generated .wasm file into the final web program. This is because common packing tools usually ignore the .wasm file. Moreover, remember to upload the .wasm file to a server, enabling users to access it from the network.

Linux

When running Linux, the system usually lacks GPU hardware support. Therefore, we utilize the SwiftShader library to emulate the GPU rendering environment. Since SwiftShader relies on certain X11 header files, it is necessary to install the following packages before building the demo project:

yum install libX11-devel --nogpg

Next, execute the following commands in the linux/ directory:

cmake -B ./build -DCMAKE_BUILD_TYPE=Release
cmake --build ./build -- -j 12

You will get the demo executable file in the build directory. You also have the option of opening the linux/ directory in CLion and building the demo project directly in the IDE.

Windows

To start, open the win/ directory in CLion. Next, open the File->Setting panel and navigate to Build, Execution, Deployment->ToolChains. Set the toolchain of CLion to Visual Studio with either amd64 (Recommended) or x86 architecture. Once done, you'll be able to build and run the Hello2D target.

If you prefer to use the VS Studio IDE, you can open the x64 Native Tools Command Prompt for VS 2019 and execute the following command in the win/ directory:

cmake -G "Visual Studio 16 2019" -A x64 -B ./build-x64

This will generate a project for the x64 architecture. If you want to generate a project for the x86 architecture, open the x86 Native Tools Command Prompt for VS 2019 and run the following command instead:

cmake -G "Visual Studio 16 2019" -A Win32 -B ./build-x86

Finally, go to the build-x64/ or build-x86/ directory and open the Hello2D.sln file. You'll be ready to go!

QT

For macOS users, just open the qt/ directory in CLion. Then, navigate to the qt/QTCMAKE.cfg file to modify the QT path with your local QT installation path. Once done, you can proceed to build and run the Hello2D target.

For Windows users, ensure that the ToolChain of CLion is set to Visual Studio with amd64 architecture. Then, navigate to the qt/ folder in CLion and find the qt/QTCMAKE.cfg file. Modify the QT path to match your local QT installation path. Afterward, access the configuration panel of the Hello2D target in CLion. Enter the local QT DLL library path in the Environment Variables row, e.g., PATH=C:\Qt\6.6.1\msvc2019_64\bin. Finally, you're ready to build and run the Hello2D target.

Build Library

Aside from directly integrating the source code of tgfx into your project, you also have the option of linking with the precompiled libraries. TGFX utilizes the vendor_tools project as its build system, enabling a unified approach to build the tgfx library across all platforms.

To quickly get started, execute the following command in the root directory:

node build_tgfx

This command will build the release version of the tgfx library for the native platform. After the execution, you will find the compiled tgfx libraries in the out/release directory. If you wish to target a specific platform, please use the -p [--platform] option. The supported platform names are as follows: win, mac, ios, linux, android, web.

node build_tgfx -p ios

When developing for apple platforms, you have the convenient -x [--xcframework] option available. This option enables you to effortlessly create xcframeworks:

node build_tgfx -p mac -x

After the execution, you will find the tgfx.xcframework in the out/release/mac directory.

Additionally, you can pass cmake options using the -D prefix. For example, if you want to build tgfx with the freetype option enabled, please run the following command:

node build_tgfx -DTGFX_USE_FREETYPE=ON

To access more details and options, execute the command along with the -h [--help] option:

node build_tgfx -h

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.

Support Us

If you find tgfx is helpful, please give us a Star. We sincerely appreciate your support :)

Star History Chart

License

TGFX is licensed under the BSD-3-Clause License

tgfx's People

Contributors

domchen avatar fusionxu avatar hparty avatar kevingpqi123 avatar lvpengwei avatar zhalice2011 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tgfx's Issues

web目录下执行 npm run build 报错

tgfx版本: 1.0.0
node版本:14/16 都不行

[email protected] build
node script/build.demo.js && npm run build:tgfx && rollup -c ./script/rollup.demo.js

emcmake cmake -S /Users/apple/Documents/code/open-code/tgfx/web/demo -B /Users/apple/Documents/code/open-code/tgfx/web/demo/cmake-build-release -G Ninja -DCMAKE_BUILD_TYPE=Releaseconfigure: cmake -S /Users/apple/Documents/code/open-code/tgfx/web/demo -B /Users/apple/Documents/code/open-code/tgfx/web/demo/cmake-build-release -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/Users/apple/Documents/code/open-code/emsdk/node/14.18.2_64bit/bin/node;--experimental-wasm-threads
The DEPS config requires a higher version of depsync tool: /Users/apple/Documents/code/open-code/tgfx/DEPS
Requires version: 1.3.12
Current version: 1.3.11
Please update the depsync tool and try again.
TGFX_USE_OPENGL: ON
TGFX_USE_QT: OFF
TGFX_USE_SWIFTSHADER: OFF
TGFX_USE_FREETYPE: OFF
TGFX_USE_PNG_DECODE:
TGFX_USE_PNG_ENCODE:
TGFX_USE_JPEG_DECODE:
TGFX_USE_JPEG_ENCODE:
TGFX_USE_WEBP_DECODE: ON
TGFX_USE_WEBP_ENCODE:
TGFX_BUILD_TESTS: OFF
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/apple/Documents/code/open-code/tgfx/web/demo/cmake-build-release
[0/2] Generating tgfx-vendor
[2/2] Linking CXX executable hello2d.js
FAILED: hello2d.js
: && /Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/em++ -O3 -DNDEBUG --no-entry -lembind -sEXPORT_NAME='Hello2D' -sWASM=1 -sASYNCIFY -sUSE_WEBGL2=1 -sEXPORTED_RUNTIME_METHODS=['GL','Asyncify'] -sALLOW_MEMORY_GROWTH=1 -sMODULARIZE=1 -sENVIRONMENT='web,worker' -sEXPORT_ES6=1 -sUSE_ES6_IMPORT_META=0 -Oz CMakeFiles/hello2d.dir/src/TGFXView.cpp.o -o hello2d.js tgfx/tgfx-drawers.a tgfx/tgfx.a && :
em++: warning: cannot check node version: [Errno 2] No such file or directory: '/Users/apple/Documents/code/open-code/emsdk/node/14.18.2_64bit/bin/node' [-Wversion-check]
Traceback (most recent call last):
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/em++.py", line 14, in
sys.exit(emcc.run(sys.argv))
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emcc.py", line 1208, in run
phase_post_link(options, state, wasm_target, wasm_target, target)
File "/Users/apple/Documents/code/open-code/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emcc.py", line 2883, in phase_post_link
phase_emscript(options, in_wasm, wasm_target, memfile)
File "/Users/apple/Documents/code/open-code/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emcc.py", line 2913, in phase_emscript
emscripten.run(in_wasm, wasm_target, final_js, memfile)
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emscripten.py", line 892, in run
emscript(in_wasm, out_wasm, outfile_js, memfile)
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emscripten.py", line 371, in emscript
glue, forwarded_data = compile_settings()
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emscripten.py", line 201, in compile_settings
out = shared.run_js_tool(path_from_root('src/compiler.js'),
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/tools/shared.py", line 245, in run_js_tool
check_node()
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/tools/shared.py", line 269, in helper
result = func()
File "/Users/apple/Documents/code/open-code/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/tools/shared.py", line 348, in check_node
check_node_version()
File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/tools/shared.py", line 340, in check_node_version
if version < MINIMUM_NODE_VERSION:
UnboundLocalError: local variable 'version' referenced before assignment
ninja: build stopped: subcommand failed.
node:child_process:935
throw err;
^

Error: Command failed: cmake --build /Users/apple/Documents/code/open-code/tgfx/web/demo/cmake-build-release --target hello2d
at checkExecSyncError (node:child_process:861:11)
at Object.execSync (node:child_process:932:15)
at Object. (/Users/apple/Documents/code/open-code/tgfx/web/script/build.demo.js:51:14)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 39473,
stdout: null,
stderr: null
}

Unknown CMake command "add_vendor_target".

Unknown CMake command "add_vendor_target".
at com.android.builder.errors.IssueReporter.reportError(IssueReporter.kt:114)
at com.android.builder.errors.IssueReporter.reportError$default(IssueReporter.kt:110)
at com.android.build.gradle.internal.cxx.logging.IssueReporterLoggingEnvironment.log(IssueReporterLoggingEnvironment.kt:114)
at com.android.build.gradle.internal.cxx.logging.ThreadLoggingEnvironment$Companion.reportFormattedErrorToCurrentLogger(LoggingEnvironment.kt:227)
at com.android.build.gradle.internal.cxx.logging.LoggingEnvironmentKt.errorln(LoggingEnvironment.kt:60)
at com.android.build.gradle.tasks.ExternalNativeJsonGenerator.configure(ExternalNativeJsonGenerator.kt:110)
at com.android.build.gradle.tasks.ExternalNativeBuildJsonTask.doTaskAction(ExternalNativeBuildJsonTask.kt:90)
at com.android.build.gradle.internal.tasks.UnsafeOutputsTask$taskAction$$inlined$recordTaskAction$1.invoke(BaseTask.kt:65)
at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:51)
at com.android.build.gradle.internal.tasks.UnsafeOutputsTask.taskAction(UnsafeOutputsTask.kt:63)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:242)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
at org.gradle.api.internal.tasks.execution.TaskExecution.executeAction(TaskExecution.java:227)
at org.gradle.api.internal.tasks.execution.TaskExecution.executeActions(TaskExecution.java:210)
at org.gradle.api.internal.tasks.execution.TaskExecution.executeWithPreviousOutputFiles(TaskExecution.java:193)
at org.gradle.api.internal.tasks.execution.TaskExecution.execute(TaskExecution.java:166)
at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:93)
at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:44)
at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:57)
at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:54)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:54)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:44)
at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:67)
at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:37)
at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:50)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:28)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.executeDelegateBroadcastingChanges(CaptureStateAfterExecutionStep.java:100)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:72)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:50)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:40)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:29)
at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:166)
at org.gradle.internal.execution.steps.BuildCacheStep.lambda$execute$1(BuildCacheStep.java:70)
at org.gradle.internal.Either$Right.fold(Either.java:175)
at org.gradle.internal.execution.caching.CachingState.fold(CachingState.java:59)
at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:68)
at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:46)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:36)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:25)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:91)
at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$2(SkipUpToDateStep.java:55)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:37)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:65)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:36)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:76)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:37)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:94)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:49)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:71)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:45)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNonEmptySources(SkipEmptyWorkStep.java:177)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:81)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:53)
at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32)
at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:36)
at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:23)
at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:75)
at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:41)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:32)
at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:287)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:21)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:42)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:31)
at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:64)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:146)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:135)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:338)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:325)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:318)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:304)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)

macOS 运行Hello2D crash

字体注册返回nullptr, 这个字体我电脑上是已经安装了的
image
而且在SimpleText里面使用的时候, 取的是"default"这个字符串, 但是外面使用的人, 并不知道要填default, 如果填了其他值, 岂不是和底层对不上了?
image
macos平台没有实现字体注册的功能
image

Which Version of tgfx are you using?

1.1.2

What Platform are you on?

macOS 14.3.1 (23D60)

build cmd

./gen_mac -DTGFX_USE_FREETYPE=ON

Android Studio Sync error

error message:
Cannot invoke (class=AddRunTaskListener, method=onImportFinished, topic=project data import listener)

image

Android Studio version :

Android Studio Iguana | 2023.2.1 Canary 8
Build #AI-232.9921.47.2321.10958940, built on October 17, 2023
Runtime version: 17.0.8+0-17.0.8b1000.22-10799086 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.4

web目录下build报错

tgfx版本: 1.0.0
node版本:14
执行 npm run build :

[email protected] build /Users/apple/Documents/code/open-code/tgfx/web
node script/build.demo.js && npm run build:tgfx && rollup -c ./script/rollup.demo.js

From https://github.com/libpag/vendor_tools

  • branch 41a96c0ce95f8d064c51257887f6229051173477 -> FETCH_HEAD
    emcmake cmake -S /Users/apple/Documents/code/open-code/tgfx/web/demo -B /Users/apple/Documents/code/open-code/tgfx/web/demo/cmake-build-release -G Ninja -DCMAKE_BUILD_TYPE=Releaseconfigure: cmake -S /Users/apple/Documents/code/open-code/tgfx/web/demo -B /Users/apple/Documents/code/open-code/tgfx/web/demo/cmake-build-release -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/Users/apple/Documents/code/open-code/emsdk/node/14.18.2_64bit/bin/node;--experimental-wasm-threads
    TGFX_USE_OPENGL: ON
    TGFX_USE_QT: OFF
    TGFX_USE_SWIFTSHADER: OFF
    TGFX_USE_FREETYPE: OFF
    TGFX_USE_PNG_DECODE:
    TGFX_USE_PNG_ENCODE:
    TGFX_USE_JPEG_DECODE:
    TGFX_USE_JPEG_ENCODE:
    TGFX_USE_WEBP_DECODE: ON
    TGFX_USE_WEBP_ENCODE:
    TGFX_BUILD_TESTS: OFF
    -- Configuring done (0.8s)
    -- Generating done (0.0s)
    -- Build files have been written to: /Users/apple/Documents/code/open-code/tgfx/web/demo/cmake-build-release
    [0/2] Generating tgfx-vendor
    [2/2] Linking CXX executable hello2d.js
    FAILED: hello2d.js
    : && /Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/em++ -O3 -DNDEBUG --no-entry -lembind "-sEXPORT_NAME='Hello2D'" -sWASM=1 -sASYNCIFY -sUSE_WEBGL2=1 "-sEXPORTED_RUNTIME_METHODS=['GL','Asyncify']" -sALLOW_MEMORY_GROWTH=1 -sMODULARIZE=1 "-sENVIRONMENT='web,worker'" -sEXPORT_ES6=1 -sUSE_ES6_IMPORT_META=0 -Oz CMakeFiles/hello2d.dir/src/TGFXView.cpp.o -o hello2d.js tgfx/tgfx-drawers.a tgfx/tgfx.a && :
    em++: warning: cannot check node version: [Errno 2] No such file or directory: '/Users/apple/Documents/code/open-code/emsdk/node/14.18.2_64bit/bin/node' [-Wversion-check]
    Traceback (most recent call last):
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/em++.py", line 14, in
    sys.exit(emcc.run(sys.argv))
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emcc.py", line 1208, in run
    phase_post_link(options, state, wasm_target, wasm_target, target)
    File "/Users/apple/Documents/code/open-code/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emcc.py", line 2883, in phase_post_link
    phase_emscript(options, in_wasm, wasm_target, memfile)
    File "/Users/apple/Documents/code/open-code/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emcc.py", line 2913, in phase_emscript
    emscripten.run(in_wasm, wasm_target, final_js, memfile)
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emscripten.py", line 892, in run
    emscript(in_wasm, out_wasm, outfile_js, memfile)
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emscripten.py", line 371, in emscript
    glue, forwarded_data = compile_settings()
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/emscripten.py", line 201, in compile_settings
    out = shared.run_js_tool(path_from_root('src/compiler.js'),
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/tools/shared.py", line 245, in run_js_tool
    check_node()
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/tools/shared.py", line 269, in helper
    result = func()
    File "/Users/apple/Documents/code/open-code/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/tools/shared.py", line 348, in check_node
    check_node_version()
    File "/Users/apple/Documents/code/open-code/emsdk/upstream/emscripten/tools/shared.py", line 340, in check_node_version
    if version < MINIMUM_NODE_VERSION:
    UnboundLocalError: local variable 'version' referenced before assignment
    ninja: build stopped: subcommand failed.
    node:child_process:935
    throw err;
    ^

Error: Command failed: cmake --build /Users/apple/Documents/code/open-code/tgfx/web/demo/cmake-build-release --target hello2d
at checkExecSyncError (node:child_process:861:11)
at Object.execSync (node:child_process:932:15)
at Object. (/Users/apple/Documents/code/open-code/tgfx/web/script/build.demo.js:53:14)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 43757,
stdout: null,
stderr: null
}
 ELIFECYCLE  Command failed with exit code 1.

绘制的时候是否不上屏,只在Framebuffer中绘制?

if (tgfxWindow == nullptr) {
tgfxWindow = tgfx::EGLWindow::Current();
}
if (tgfxWindow == nullptr) {
return -1;
}
auto device = tgfxWindow->getDevice();
auto context = device->lockContext();
if (context == nullptr) {
return -1;
}
auto tgfxSurface = tgfx::Surface::Make(context, width, height);
if (tgfxSurface == nullptr) {
device->unlock();
return -1;
}
auto canvas = tgfxSurface->getCanvas();
canvas->clear();
canvas->save();

//实体类绘制内容,如矩形,线条
drawShape(frameInfo, canvas);

canvas->restore();
tgfxSurface->flush();
tgfx::GLTextureInfo textureInfo;
tgfxSurface->getBackendTexture().getGLTextureInfo(&textureInfo);
device->unlock();
glBindFramebuffer(GL_FRAMEBUFFER,0);
YMLOGV("textureId %d", textureInfo.id);
return textureInfo.id;

使用以上代码会直接让tgfx绘制内容直接上屏,不需要直接上屏

windwos平台编辑android库和demo

Which Version of tgfx are you using?

1.0.0

What Platform are you on?

win10

Expected Behavior

windows平台编译android 库和demo报错,1是strip不是可执行的程序(这个最后在环境变量中设置了strip.exe才继续执行),2是
后面继续执行报错invalid argument, mkdir 'G:\code\tgfx-1.0.0\android\app\

2
1

Actual Behavior

Code Example

Related File

2
1

安卓平台使用显示不出来

Which Version of tgfx are you using?

1.0.0

What Platform are you on?

Android 11

Expected Behavior

你好请问,,我模仿项目中的demo,新建了个android工程,链接了编译出来的tgfx.a,new了一个textureview,把surface传了进去,然后获取了windows device surface对象,draw了示例中的背景,但是没有任何显示,请问这个问题是哪里使用不对吗?或者有没有android平台下渲染图片或者文字的demo? 或者相关的接口使用文档?

4

5

Actual Behavior

Code Example

Related File

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.