/* * 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 "SkottieProperty.h" #include "SkottieAdapter.h" #include "SkSGColor.h" #include "SkSGOpacityEffect.h" namespace skottie { 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 <> 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::onTransformProperty(const char[], const LazyHandle&) {} } // namespace skottie