From 08a316ab66e042ed5999129359f4ad78e7058a83 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Tue, 15 Jan 2019 15:52:04 +0900 Subject: [PATCH] lottie/vector: Added texture and transformation support in brush. Change-Id: I4e433a8f09342051a9ec062f45184709e578fd98 --- src/vector/vbrush.cpp | 15 ++++++++++++++- src/vector/vbrush.h | 6 +++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/vector/vbrush.cpp b/src/vector/vbrush.cpp index c1a3dc9..ca2df7b 100644 --- a/src/vector/vbrush.cpp +++ b/src/vector/vbrush.cpp @@ -85,7 +85,7 @@ VBrush::VBrush(int r, int g, int b, int a) { } -VBrush::VBrush(const VGradient *gradient) : mType(VBrush::Type::NoBrush) +VBrush::VBrush(const VGradient *gradient) { if (!gradient) return; @@ -98,4 +98,17 @@ VBrush::VBrush(const VGradient *gradient) : mType(VBrush::Type::NoBrush) } } +VBrush::VBrush(const VBitmap &texture) +{ + if (!texture.valid()) return; + + mType = VBrush::Type::Texture; + mTexture = texture; +} + +void VBrush::setMatrix(const VMatrix &m) +{ + mMatrix = m; +} + V_END_NAMESPACE diff --git a/src/vector/vbrush.h b/src/vector/vbrush.h index f6a07d4..348e2ec 100644 --- a/src/vector/vbrush.h +++ b/src/vector/vbrush.h @@ -23,6 +23,7 @@ #include "vglobal.h" #include "vmatrix.h" #include "vpoint.h" +#include "vbitmap.h" V_BEGIN_NAMESPACE @@ -78,12 +79,15 @@ public: VBrush(const VColor &color); VBrush(const VGradient *gradient); VBrush(int r, int g, int b, int a); + VBrush(const VBitmap &texture); inline VBrush::Type type() const { return mType; } - + void setMatrix(const VMatrix &m); public: VBrush::Type mType{Type::NoBrush}; VColor mColor; const VGradient *mGradient{nullptr}; + VBitmap mTexture; + VMatrix mMatrix; }; V_END_NAMESPACE -- 2.7.4