vector: support rendering of texture brush with alpha.
authorsubhransu mohanty <sub.mohanty@samsung.com>
Fri, 11 Oct 2019 00:58:14 +0000 (09:58 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Sun, 13 Oct 2019 21:29:10 +0000 (06:29 +0900)
src/lottie/lottieitem.cpp
src/vector/vbrush.h
src/vector/vdrawhelper.cpp

index 7a59b2d..f8ec21a 100644 (file)
@@ -671,7 +671,7 @@ void LOTImageLayerItem::updateContent()
     }
 
     if (flag() & DirtyFlagBit::Alpha) {
-        //@TODO handle alpha with the image.
+        mTexture.mAlpha = int(combinedAlpha() * 255);
     }
 }
 
index f45f6cc..9500b93 100644 (file)
@@ -62,6 +62,7 @@ public:
 struct VTexture {
     VBitmap  mBitmap;
     VMatrix  mMatrix;
+    int      mAlpha{255};
 };
 
 class VBrush {
index 43050f2..e90c157 100644 (file)
@@ -795,7 +795,7 @@ void VSpanData::setup(const VBrush &brush, VPainter::CompositionMode /*mode*/,
     case VBrush::Type::Texture: {
         mType = VSpanData::Type::Texture;
         initTexture(
-            &brush.mTexture->mBitmap, 255, VBitmapData::Plain,
+            &brush.mTexture->mBitmap, brush.mTexture->mAlpha, VBitmapData::Plain,
             brush.mTexture->mBitmap.rect());
         setupMatrix(brush.mTexture->mMatrix);
         break;