Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
ae3ca76
feat: Clip layer which behind viewer.
StarryThrone Nov 21, 2025
bb792a6
feat: Draw child with preserve 3D style.
StarryThrone Nov 24, 2025
6fba9b4
feat: Draw offscreen split children for layer which started a 3D rend…
StarryThrone Nov 25, 2025
651e776
feat: Draw layer with depth occultation.
StarryThrone Nov 27, 2025
b43a371
feat: Clip filter image only for layers outside the 3D rendering cont…
StarryThrone Nov 28, 2025
b4e9e05
feat: Calculate render bounds correctly.
StarryThrone Dec 1, 2025
83b3f1a
Merge branch 'main' into feature/jasonrjchen_3D_context
StarryThrone Dec 1, 2025
4a34b31
feat: Draw rasterized image cache.
StarryThrone Dec 2, 2025
7d30598
feat: Hide layer when any point behind viewer.
StarryThrone Dec 2, 2025
e15aac6
feat: Enable MSAA to solve aliasing issue.
StarryThrone Dec 3, 2025
01984d0
feat: Draw image of 3D rendering context into background canvas.
StarryThrone Dec 3, 2025
9f4bafb
feat: Disable the background style of all subsequent sub-layers of th…
StarryThrone Dec 3, 2025
4adb42f
feat: Adjust the clipping area and anti-aliasing method to solve the …
StarryThrone Dec 4, 2025
37590ad
feat: Disable the background style of the subsequent nodes of the 3D …
StarryThrone Dec 4, 2025
f414663
feat: The subsequent layer of the 3D layer obtains the content image …
StarryThrone Dec 5, 2025
ebfb512
Merge branch 'main' into feature/jasonrjchen_3D_context
StarryThrone Dec 5, 2025
091810d
Refactor 3D rendering context propagation and add alpha support for 3…
StarryThrone Dec 9, 2025
2db8bb7
Merge branch 'main' into feature/jasonrjchen_3D_context
StarryThrone Dec 9, 2025
a0fa69f
Translate Chinese comments to English in Layer.cpp.
StarryThrone Dec 9, 2025
16409b5
feat: Resolve build problem.
StarryThrone Dec 9, 2025
d710d42
feat: Resolve build problem.
StarryThrone Dec 9, 2025
5b4956e
feat: Optimize code.
StarryThrone Dec 9, 2025
c1c7c78
feat: Refactor 3D context rendering logic and simplify draw functions.
StarryThrone Dec 16, 2025
22d1417
Move styleSourceTypes from function parameter to DrawArgs.
StarryThrone Dec 16, 2025
a93777a
Add 3D context handling to computeBounds for consistent bounds calcul…
StarryThrone Dec 16, 2025
4e721ed
Rename drawChildByStarting3DContext to drawLayerByStarting3DContext a…
StarryThrone Dec 16, 2025
3f59a7d
Merge branch 'main' into feature/jasonrjchen_3D_context
StarryThrone Dec 16, 2025
a356559
Simplify canExtend3DContext by removing blendMode and allowsGroupOpac…
StarryThrone Dec 16, 2025
2487800
Refactor: remove redundant destructor and optimize structured binding
StarryThrone Dec 17, 2025
a25a667
Add trailing newlines and improve IsTransformedLayerRectBehindViewer …
StarryThrone Dec 17, 2025
b31d902
feat: Remove getContentBounds and use content bounds directly in 3D c…
StarryThrone Dec 17, 2025
0994a31
Refactor 3D rendering context drawing logic and update API documentat…
StarryThrone Dec 17, 2025
e7dee9a
Simplify updateRenderBounds interface by consolidating 3D context par…
StarryThrone Dec 17, 2025
9c2a74e
Simplify dirty region calculation for layers in 3D context.
StarryThrone Dec 17, 2025
040d83c
Refactor 3D rendering context implementation and optimize related com…
StarryThrone Dec 18, 2025
1b3c6d3
Refactor 3D rendering context bounds calculation and fix background b…
StarryThrone Dec 22, 2025
ecad22f
Merge branch 'main' into feature/jasonrjchen_3D_context.
StarryThrone Dec 23, 2025
3aa2334
Merge remote-tracking branch 'origin/main' into feature/jasonrjchen_3…
StarryThrone Dec 23, 2025
fd2c005
Merge branch 'main' into feature/jasonrjchen_3D_context
StarryThrone Dec 25, 2025
b196b60
Refactor 3D compositing with BSP tree depth sorting.
StarryThrone Dec 26, 2025
5161f3b
Refactor 3D rendering to support BSP-split polygon quads.
StarryThrone Dec 31, 2025
51d771b
Fix getGlobalMatrix to project child layer matrix before concatenation.
StarryThrone Dec 31, 2025
e439a6b
Use args.context instead of canvas->getSurface()->getContext().
StarryThrone Dec 31, 2025
456551d
Return empty rect when 3D transform matrix is singular in reverse bou…
StarryThrone Dec 31, 2025
b471520
Merge remote-tracking branch 'origin/main' into feature/jasonrjchen_3…
StarryThrone Dec 31, 2025
6cf364b
Refactor computeBounds to extract content bounds calculation into a s…
StarryThrone Dec 31, 2025
4badc5d
Update baseline version for Matrix3D and Transform3D tests.
StarryThrone Dec 31, 2025
206638d
feat: Optimize code.
StarryThrone Jan 5, 2026
fa176bd
Merge main branch into feature/jasonrjchen_3D_context.
StarryThrone Jan 5, 2026
6c6673b
feat: Optimize code.
StarryThrone Jan 5, 2026
1b5620f
feat: Optimize code.
StarryThrone Jan 5, 2026
94e4722
feat: Optimize code.
StarryThrone Jan 5, 2026
e89e3b9
feat: Optimize code.
StarryThrone Jan 5, 2026
8102d1d
Refactor 3D rendering context code for clarity and robustness.
StarryThrone Jan 5, 2026
64ad2d7
Refactor computeBounds variable ordering and format code.
StarryThrone Jan 6, 2026
d758849
Simplify 3D context checks and fix mask drawing in 3D context.
StarryThrone Jan 6, 2026
58acc98
Replace unordered_set with vector for styleSourceTypes in DrawArgs.
Jan 6, 2026
0b3dcd8
Add RemoveStyleSource helper and fix background style removal for 3D …
StarryThrone Jan 7, 2026
8bff268
Store 3D transform in Render3DContext instead of passing through func…
StarryThrone Jan 7, 2026
f21f13f
Move camera culling from draw phase to updateRenderBounds for early r…
StarryThrone Jan 7, 2026
23ab08b
Refactor Render3DContext to use state stack based recording.
StarryThrone Jan 7, 2026
8519634
Merge origin/main into feature/jasonrjchen_3D_context.
StarryThrone Jan 7, 2026
d618caf
Remove clipContentByCanvas and add clip calculation in Render3DContext.
StarryThrone Jan 8, 2026
29ea7fc
Add Matrix3DRegionTransformer and simplify updateRenderBounds paramet…
StarryThrone Jan 8, 2026
fa888a6
Remove CodeBuddy user commands from gitignore.
StarryThrone Jan 8, 2026
70d3704
Merge branch 'main' into feature/jasonrjchen_3D_context
StarryThrone Jan 8, 2026
7972ca3
feat: Optimize code.
StarryThrone Jan 8, 2026
1645e23
Move 3D compositing files to compositing3d subdirectory.
StarryThrone Jan 8, 2026
2802e82
Add behind-camera checks in computeBounds and fix Create3DContext bou…
StarryThrone Jan 8, 2026
2f1c8a1
Use emplace to construct Render3DContextState in place.
StarryThrone Jan 8, 2026
9e99b06
Remove redundant backgroundCanvas restore call.
StarryThrone Jan 8, 2026
e78b3fc
Use cached matrix3DIsAffine instead of IsMatrix3DAffine call.
Jan 8, 2026
af61ad1
Add behind-camera check to Transform3DImageFilter and defer matrix ad…
Jan 8, 2026
b4a24f3
Add missing include for std::optional in RegionTransformer.h.
Jan 8, 2026
6b2ec12
Remove redundant FloatCeilToInt after roundOut in PictureToImage.
Jan 8, 2026
8604fb5
Refactor behindCamera logic and fix background style processing.
StarryThrone Jan 9, 2026
1ace7c1
Refactor Render3DContext with improved encapsulation and memory safety.
StarryThrone Jan 9, 2026
f1de2a7
Add Matrix3DUtils class to centralize Matrix3D utility functions.
StarryThrone Jan 9, 2026
e425a4f
Remove Transform3DFilter and add ScaleAdaptedMatrix3D utility.
StarryThrone Jan 9, 2026
9d41b69
Merge remote-tracking branch 'origin/main' into feature/jasonrjchen_3…
StarryThrone Jan 9, 2026
2874403
Use makeTextureImage instead of lockTextureProxy in Context3DCompositor.
StarryThrone Jan 9, 2026
04c0a7f
Add boundary checks for Create3DContext function.
StarryThrone Jan 9, 2026
bc6009d
Replace TransformStyle enum with bool preserve3D property.
StarryThrone Jan 9, 2026
006e37c
Replace Matrix3DCombineMode enum with bool canCombine parameter.
StarryThrone Jan 9, 2026
5abed60
Update copyright year to 2026 for newly added files.
StarryThrone Jan 9, 2026
6ff760e
Extract duplicate styleSourceTypes initialization to a static constant.
StarryThrone Jan 9, 2026
d1ee2d8
Extract scroll rect clipping lambda to static function ClipScrollRect.
StarryThrone Jan 9, 2026
30ff73e
Refactor BspTree traversal by extracting visitNode to reduce code dup…
StarryThrone Jan 9, 2026
3b9f227
Merge remote-tracking branch 'origin/main' into feature/jasonrjchen_3…
StarryThrone Jan 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/tgfx/core/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,5 +384,6 @@ class Image {
friend class ImageShader;
friend class Types;
friend class Transform3DImageFilter;
friend class Context3DCompositor;
};
} // namespace tgfx
51 changes: 28 additions & 23 deletions include/tgfx/core/Matrix3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ class Matrix3D {
*/
Vec4 getRow(int i) const;

/**
* Sets the matrix values at the given row.
* @param i Row index, valid range 0..3.
* @param v Vector containing the values to set.
*/
void setRow(int i, const Vec4& v);

/**
* Returns the matrix value at the given row and column.
* @param r Row index, valid range 0..3.
Expand Down Expand Up @@ -204,6 +211,11 @@ class Matrix3D {
postSkew(kxy, 0, kyx, 0, 0, 0);
}

/**
* Concatenates the given matrix with this matrix, and stores the result in this matrix. M' = M * m.
*/
void preConcat(const Matrix3D& m);

/**
* Concatenates this matrix with the given matrix, and stores the result in this matrix. M' = M * m.
*/
Expand Down Expand Up @@ -257,6 +269,13 @@ class Matrix3D {
*/
Vec3 mapVec3(const Vec3& v) const;

/**
* Maps a 4D point (x, y, z, w) using this matrix.
* If the current matrix contains a perspective transformation, the returned Vec4 is not
* perspective-divided; i.e., the w component of the result may not be 1.
*/
Vec4 mapPoint(float x, float y, float z, float w) const;

/**
* Returns true if the matrix is an identity matrix.
*/
Expand Down Expand Up @@ -293,11 +312,6 @@ class Matrix3D {
*/
void setConcat(const Matrix3D& a, const Matrix3D& b);

/**
* Concatenates the given matrix with this matrix, and stores the result in this matrix. M' = M * m.
*/
void preConcat(const Matrix3D& m);

/**
* Pre-concatenates a scale to this matrix. M' = M * S.
*/
Expand All @@ -308,34 +322,25 @@ class Matrix3D {
*/
Matrix3D transpose() const;

/**
* Maps a 4D point (x, y, z, w) using this matrix.
* If the current matrix contains a perspective transformation, the returned Vec4 is not
* perspective-divided; i.e., the w component of the result may not be 1.
*/
Vec4 mapPoint(float x, float y, float z, float w) const;

Vec4 getCol(int i) const {
Vec4 v;
memcpy(&v, values + i * 4, sizeof(Vec4));
return v;
}

void setAll(float m00, float m01, float m02, float m03, float m10, float m11, float m12,
float m13, float m20, float m21, float m22, float m23, float m30, float m31,
float m32, float m33);

void setRow(int i, const Vec4& v) {
values[i + 0] = v.x;
values[i + 4] = v.y;
values[i + 8] = v.z;
values[i + 12] = v.w;
}

/**
* Sets the matrix values at the given column.
* @param i Column index, valid range 0..3.
* @param v Vector containing the values to set.
*/
void setColumn(int i, const Vec4& v) {
memcpy(&values[i * 4], v.ptr(), sizeof(v));
}

void setAll(float m00, float m01, float m02, float m03, float m10, float m11, float m12,
float m13, float m20, float m21, float m22, float m23, float m30, float m31,
float m32, float m33);

void setIdentity() {
*this = Matrix3D();
}
Expand Down
30 changes: 28 additions & 2 deletions include/tgfx/gpu/RenderPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,35 @@ class RenderPassDescriptor {
LoadAction loadAction = LoadAction::DontCare,
StoreAction storeAction = StoreAction::Store,
PMColor clearValue = PMColor::Transparent(),
std::shared_ptr<Texture> resolveTexture = nullptr) {
colorAttachments.emplace_back(std::move(texture), loadAction, storeAction, clearValue,
std::shared_ptr<Texture> resolveTexture = nullptr)
: RenderPassDescriptor(std::move(texture), nullptr, loadAction, storeAction, clearValue,
std::move(resolveTexture)) {
}

/**
* A convenience constructor that initializes a RenderPassDescriptor with a single color attachment
* and an optional depthstencil attachment.
* @param clorTexture The texture to render to.
* @param depthStencilTexture The depth-stencil texture to render to, or nullptr if not using
* depth-stencil.
* @param loadAction The action to perform at the start of the render pass.
* @param storeAction The action to perform at the end of the render pass.
* @param clearValue The color value to clear the attachment with if the load action is
* LoadAction::Clear.
* @param resolveTexture The texture to resolve the color attachment into. This is used for
* multisampled textures. If this is nullptr, the color attachment will not be resolved.
*/
RenderPassDescriptor(std::shared_ptr<Texture> clorTexture,
std::shared_ptr<Texture> depthStencilTexture,
LoadAction loadAction = LoadAction::DontCare,
StoreAction storeAction = StoreAction::Store,
PMColor clearValue = PMColor::Transparent(),
std::shared_ptr<Texture> resolveTexture = nullptr) {
colorAttachments.emplace_back(std::move(clorTexture), loadAction, storeAction, clearValue,
std::move(resolveTexture));
if (depthStencilTexture != nullptr) {
depthStencilAttachment = DepthStencilAttachment(std::move(depthStencilTexture));
}
}

/**
Expand Down
100 changes: 90 additions & 10 deletions include/tgfx/layers/Layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <memory>
#include <optional>
#include <unordered_set>
#include "TransformStyle.h"
#include "tgfx/core/BlendMode.h"
#include "tgfx/core/Canvas.h"
#include "tgfx/core/Matrix.h"
Expand Down Expand Up @@ -177,6 +178,44 @@ class Layer : public std::enable_shared_from_this<Layer> {
*/
void setMatrix3D(const Matrix3D& value);

/**
* Returns the transform style of the layer. The default value is TransformStyle::Flat.
* TransformStyle defines the drawing behavior of child layers containing 3D transformations.
* The Flat type projects 3D child layers directly onto their parent layer, and all child layers
* are drawn in the order they were added. This means that later-added opaque child layers will
* completely cover earlier-added child layers. The Preserve3D type preserves the 3D state of child
* layers.
* If a layer's TransformStyle is Preserve3D and its parent layer is Flat, this layer establishes
* a 3D Rendering Context. If the parent layer is Preserve3D, this layer inherits the parent's 3D
* Rendering Context and passes it to its child layers.
* All child layers within a 3D Rendering Context share the coordinate space of the layer that
* established the context. Within this context, all layers apply depth occlusion based on their
* actual positions: opaque pixels in layers closer to the observer will occlude pixels in layers
* farther from the observer at the same position (same xy coordinates).
*
* Note: TransformStyle::Preserve3D does not support some features. When the following conditions
* are met, even if the layer is set to TransformStyle::Preserve3D, its drawing behavior will be
* TransformStyle::Flat:
* The prerequisite for these features to take effect is that child layers need to be projected
* into the local coordinate system of the current layer.
* 1. layerstyles is not empty
* The following features require the entire layer subtree of the root node to be packaged and
* drawn, and then the corresponding effects are applied.
* 2. Blend mode is set to any value other than BlendMode::SrcOver
* 3. passThroughBackground = false
* 4. allowsGroupOpacity = true
* 5. shouldRasterize = true
* 6. mask is not empty
*/
TransformStyle transformStyle() const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个和CSS一样,加个bool值的preserve3D的开关不行吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经修改。

return _transformStyle;
}

/**
* Sets the transform style of the layer.
*/
void setTransformStyle(TransformStyle style);

/**
* Returns whether the layer is visible. The default value is true.
*/
Expand Down Expand Up @@ -573,7 +612,10 @@ class Layer : public std::enable_shared_from_this<Layer> {

void invalidate();

Rect getBounds(const Matrix3D& matrix, bool computeTightBounds);
/**
* Returns the content bounds of the layer, excluding child layers.
*/
Rect getContentBounds();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

layerStyle和filter目前看起来和在Preserve3D都是互斥的,如果是Preserve3D需要contentRect,应该可以直接通过content获取rect,不需要这个函数。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经删除。


Rect getBoundsInternal(const Matrix3D& coordinateMatrix, bool computeTightBounds);

Expand Down Expand Up @@ -604,20 +646,28 @@ class Layer : public std::enable_shared_from_this<Layer> {
const Matrix3D* transform = nullptr);

void drawOffscreen(const DrawArgs& args, Canvas* canvas, float alpha, BlendMode blendMode,
const Matrix3D* transform);
const Matrix3D* transform, bool excludeChildren = false);

void drawDirectly(const DrawArgs& args, Canvas* canvas, float alpha);

void drawDirectly(const DrawArgs& args, Canvas* canvas, float alpha,
const std::unordered_set<LayerStyleExtraSourceType>& styleExtraSourceTypes);
const std::unordered_set<LayerStyleExtraSourceType>& styleExtraSourceTypes,
bool excludeChildren);

void drawContents(
const DrawArgs& args, Canvas* canvas, float alpha,
const LayerStyleSource* layerStyleSource = nullptr, const Layer* stopChild = nullptr,
const std::unordered_set<LayerStyleExtraSourceType>& styleExtraSourceTypes = {});
void drawByStarting3DContext(const DrawArgs& args, Canvas* canvas, float alpha,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议把Preserve3d流程直接写在drawOffscreen和drawDirectly里。目前看来,Preserve3d就是把child和content的绘制目标从2d变成3d空间。在drawOffscreen里,其实是把离屏的纹理画在3d空间,而drawDirectly里,是把内容和子项都一个个画在3d空间里

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layer的3D空间看起来可以让parent直接提供,这样layer也不需要处理创建3d空间的行为,只需要处理有/无3d空间的绘制流程。
对于layer来说,如果child开了3d空间,如果args存在3d空间,那直接传给child就可以,如果args不存在3d空间,则创建一个3d空间给child

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经修改。

BlendMode blendMode, const Matrix3D* transform);

void drawIn3DContext(const DrawArgs& args, Canvas* canvas, float alpha, BlendMode blendMode,
const Matrix3D* transform);

void drawContents(const DrawArgs& args, Canvas* canvas, float alpha,
const LayerStyleSource* layerStyleSource = nullptr,
const Layer* stopChild = nullptr,
const std::unordered_set<LayerStyleExtraSourceType>& styleExtraSourceTypes = {},
bool excludeChildren = false);

bool drawChildren(const DrawArgs& args, Canvas* canvas, float alpha,
const Layer* stopChild = nullptr);
const Layer* stopChild = nullptr, const Matrix3D* transform = nullptr);

float drawBackgroundLayers(const DrawArgs& args, Canvas* canvas);

Expand Down Expand Up @@ -655,8 +705,25 @@ class Layer : public std::enable_shared_from_this<Layer> {

bool hasValidMask() const;

/**
* Updates the rendering bounds.
* When calculating rendering bounds for layers outside a 3D context, matrix transformations can
* be applied progressively from child layers to parent layers. However, layers inside a 3D
* context need to preserve their 3D state. This approach would lose depth information for these
* layers.
* They need to calculate rendering bounds based on the overall matrix state of the 3D context
* and the relative matrix of the layer itself to the layer that established the context.
* @param transformer The region transformer to be applied to the current layer.
* @param context3DTransformer The overall transformer of the 3D context to which the current
* layer belongs when it is inside a 3D context. This parameter cannot be null when the layer is
* inside a 3D context.
* @param context3DTransform The relative matrix of the current layer to the layer that
* established the 3D context when the current layer is inside a 3D context. This parameter
* cannot be null when the layer is inside a 3D context.
*/
void updateRenderBounds(std::shared_ptr<RegionTransformer> transformer = nullptr,
bool forceDirty = false);
std::shared_ptr<RegionTransformer> context3DTransformer = nullptr,
const Matrix3D* context3DTransform = nullptr, bool forceDirty = false);

void checkBackgroundStyles(std::shared_ptr<RegionTransformer> transformer);

Expand All @@ -679,7 +746,8 @@ class Layer : public std::enable_shared_from_this<Layer> {
std::shared_ptr<Image> getContentImage(const DrawArgs& args, float contentScale,
const std::shared_ptr<Image>& passThroughImage,
const Matrix& passThroughImageMatrix,
std::optional<Rect> clipBounds, Matrix* imageMatrix);
std::optional<Rect> clipBounds, Matrix* imageMatrix,
bool excludeChildren);

/**
* Returns the equivalent transformation matrix adapted for a custom anchor point.
Expand All @@ -692,6 +760,17 @@ class Layer : public std::enable_shared_from_this<Layer> {
*/
Matrix3D anchorAdaptedMatrix(const Matrix3D& matrix, const Point& anchor) const;

/**
* Calculates the 3D context depth matrix for the layer.
* This matrix maps the depth of all sublayers within the 3D render context rooted at this layer
* from [maxDepth, minDepth] to the [-1, 1] range.
*/
Matrix3D calculate3DContextDepthMatrix();

bool canExtend3DContext() const;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

由于alpha、blendmode是由parent传下来的,因此没法在updateRenderBounds里直接判断。建议如果本身在3d空间内了,舍弃GroupAlpha和blendmode的行为,仍然执行drawDirectly。这样可以保证updateRenderBounds和draw的rect是一致的

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经修改。


bool in3DContext() const;

struct {
bool dirtyContent : 1; // layer's content needs updating
bool dirtyContentBounds : 1; // layer's content bounds needs updating
Expand All @@ -712,6 +791,7 @@ class Layer : public std::enable_shared_from_this<Layer> {
float _alpha = 1.0f;
// The actual transformation matrix that determines the geometric position of the layer
Matrix3D _matrix3D = {};
TransformStyle _transformStyle = TransformStyle::Flat;
std::shared_ptr<Layer> _mask = nullptr;
Layer* maskOwner = nullptr;
std::unique_ptr<Rect> _scrollRect = nullptr;
Expand Down
40 changes: 40 additions & 0 deletions include/tgfx/layers/TransformStyle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////////////////////
//
// Tencent is pleased to support the open source community by making tgfx available.
//
// Copyright (C) 2025 Tencent. All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// unless required by applicable law or agreed to in writing, software distributed under the
// license is distributed on an "as is" basis, without warranties or conditions of any kind,
// either express or implied. see the license for the specific language governing permissions
// and limitations under the license.
//
/////////////////////////////////////////////////////////////////////////////////////////////////

#pragma once

namespace tgfx {
/**
* Defines the transform style of a layer.
*/
enum class TransformStyle {
/**
* Does not preserve the 3D state of sublayers. Sublayers with 3D transformations are directly
* projected onto the current layer plane. In this mode, later added layers will cover earlier
* added layers.
*/
Flat,

/**
* Preserves the 3D state of sublayers. In this mode, interacting sublayers will be occluded based
* on the actual depth of pixels, meaning opaque pixels closer to the observer will cover those
* farther away.
*/
Preserve3D
};
} // namespace tgfx
Loading