mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 20:14:37 +00:00

[issues 1479: Shape](https://github.com/thorvg/thorvg/issues/1479) In order to build you need third party libraries. Before you start please read this: [LearnWebGPU](https://eliemichel.github.io/LearnWebGPU/getting-started/hello-webgpu.html) Usage example: // init glfw glfwInit(); // create a windowed mode window and its opengl context glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); GLFWwindow* window = glfwCreateWindow(800, 800, "WebGPU base app", nullptr, nullptr); // get window size int width{}, height{}; glfwGetWindowSize(window, &width, &height); // init engine webgpu tvg::Initializer::init(tvg::CanvasEngine::Wg, 0); // create wg canvas auto canvasWg = tvg::WgCanvas::gen(); canvas_wg->target(glfwGetWin32Window(window), width, height); //Test for Stroke Dash for Arc, Circle, Rect auto shape = tvg::Shape::gen(); shape->appendArc(70, 600, 160, 10, 30, true); shape->appendCircle(70, 700, 20, 60); shape->appendRect(130, 710, 100, 40); shape->strokeFill(255, 0, 0); shape->strokeWidth(5); shape->strokeJoin(tvg::StrokeJoin::Round); shape->strokeCap(tvg::StrokeCap::Round); if (canvas_wg->push(std::move(shape)) != tvg::Result::Success) return; while (!glfwWindowShouldClose(window)) { // webgpu canvas_wg->draw(); canvas_wg->sync(); // pull events glfwPollEvents(); } // terminate engine and window tvg::Initializer::term(tvg::CanvasEngine::Wg); glfwDestroyWindow(window); glfwTerminate();
17 lines
419 B
Meson
17 lines
419 B
Meson
source_file = [
|
|
'tvgWgGeometry.cpp',
|
|
'tvgWgPipelineBase.cpp',
|
|
'tvgWgPipelineEmpty.cpp',
|
|
'tvgWgPipelineLinear.cpp',
|
|
'tvgWgPipelineSolid.cpp',
|
|
'tvgWgPipelineRadial.cpp',
|
|
'tvgWgPipelineStroke.cpp',
|
|
'tvgWgRenderData.cpp',
|
|
'tvgWgRenderer.cpp',
|
|
'tvgWgShaderSrc.cpp'
|
|
]
|
|
|
|
engine_dep += [declare_dependency(
|
|
include_directories : include_directories('.'),
|
|
sources : source_file
|
|
)]
|