/* * Copyright 2018 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "modules/skottie/include/SkottieProperty.h" #include "modules/skottie/src/SkottieAdapter.h" #include "modules/skottie/src/text/TextAdapter.h" #include "modules/sksg/include/SkSGOpacityEffect.h" #include "modules/sksg/include/SkSGPaint.h" namespace skottie { bool TextPropertyValue::operator==(const TextPropertyValue& other) const { return fTypeface == other.fTypeface && fText == other.fText && fTextSize == other.fTextSize && fStrokeWidth == other.fStrokeWidth && fLineHeight == other.fLineHeight && fHAlign == other.fHAlign && fVAlign == other.fVAlign && fBox == other.fBox && fFillColor == other.fFillColor && fStrokeColor == other.fStrokeColor && fHasFill == other.fHasFill && fHasStroke == other.fHasStroke; } bool TextPropertyValue::operator!=(const TextPropertyValue& other) const { return !(*this== other); } bool TransformPropertyValue::operator==(const TransformPropertyValue& other) const { return this->fAnchorPoint == other.fAnchorPoint && this->fPosition == other.fPosition && this->fScale == other.fScale && this->fSkew == other.fSkew && this->fSkewAxis == other.fSkewAxis; } bool TransformPropertyValue::operator!=(const TransformPropertyValue& other) const { return !(*this == other); } template <> PropertyHandle::~PropertyHandle() {} template <> ColorPropertyValue PropertyHandle::get() const { return fNode->getColor(); } template <> void PropertyHandle::set(const ColorPropertyValue& c) { fNode->setColor(c); } template <> PropertyHandle::~PropertyHandle() {} template <> OpacityPropertyValue PropertyHandle::get() const { return fNode->getOpacity() * 100; } template <> void PropertyHandle::set(const OpacityPropertyValue& o) { fNode->setOpacity(o / 100); } template <> PropertyHandle::~PropertyHandle() {} template <> TextPropertyValue PropertyHandle::get() const { return fNode->getText(); } template<> void PropertyHandle::set(const TextPropertyValue& t) { fNode->setText(t); } template <> PropertyHandle::~PropertyHandle() {} template <> TransformPropertyValue PropertyHandle::get() const { return { fNode->getAnchorPoint(), fNode->getPosition(), fNode->getScale(), fNode->getRotation(), fNode->getSkew(), fNode->getSkewAxis() }; } template <> void PropertyHandle::set( const TransformPropertyValue& t) { fNode->setAnchorPoint(t.fAnchorPoint); fNode->setPosition(t.fPosition); fNode->setScale(t.fScale); fNode->setRotation(t.fRotation); fNode->setSkew(t.fSkew); fNode->setSkewAxis(t.fSkewAxis); } void PropertyObserver::onColorProperty(const char[], const LazyHandle&) {} void PropertyObserver::onOpacityProperty(const char[], const LazyHandle&) {} void PropertyObserver::onTextProperty(const char[], const LazyHandle&) {} void PropertyObserver::onTransformProperty(const char[], const LazyHandle&) {} } // namespace skottie