#define DALI_INTERNAL_KEY_FRAMES_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <memory>
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/internal/event/animation/key-frame-channel.h>
+#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/animation/key-frames.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/animation/alpha-function.h>
-#include <dali/internal/event/animation/key-frame-channel.h>
namespace Dali
{
static KeyFrames* New();
private:
-
/**
* Create a specialization from the given type, and store it to the mSpec
* member variable
*/
Dali::Property::Value GetLastKeyFrameValue() const;
+ /**
+ * @copydoc Dali::DevelKeyFrames::GetKeyFrameCount()
+ */
+ std::size_t GetKeyFrameCount() const;
+
+ /**
+ * @copydoc Dali::DevelKeyFrames::GetKeyFrame()
+ */
+ void GetKeyFrame(std::size_t index, float& time, Property::Value& value) const;
+
private:
Dali::Property::Type mType{Property::NONE}; // Type of the specialization
std::unique_ptr<KeyFrameSpec> mKeyFrames; // Pointer to the specialized key frame object
/**
* Get the key frame value as a Property::Value.
* @param[in] index The index of the key frame to fetch
+ * @param[out] time The progress of the given key frame
* @param[out] value The value of the given key frame
*/
- virtual void GetKeyFrameAsValue( std::size_t index, Property::Value& value ) = 0;
+ virtual void GetKeyFrameAsValue(std::size_t index, float& time, Property::Value& value) const = 0;
};
/**
/**
* @copydoc KeyFrameSpec::GetKeyFrameAsValue()
*/
- void GetKeyFrameAsValue( std::size_t index, Property::Value& value ) override
+ void GetKeyFrameAsValue(std::size_t index, float& time, Property::Value& value) const override
{
- value = mChannel.mValues[index].mValue;
+ const auto& element = mChannel.mValues[index];
+ time = element.mProgress;
+ value = element.mValue;
}
/**
return static_cast<DeriveClass>(keyFrames.GetKeyFramesBase());
}
-} // Internal
-
+} // namespace Internal
// Get impl of handle
inline Internal::KeyFrames& GetImplementation(Dali::KeyFrames& keyFrames)
{
- DALI_ASSERT_ALWAYS( keyFrames && "KeyFrames handle is empty" );
+ DALI_ASSERT_ALWAYS(keyFrames && "KeyFrames handle is empty");
Dali::RefObject& object = keyFrames.GetBaseObject();
return static_cast<Internal::KeyFrames&>(object);
}
inline const Internal::KeyFrames& GetImplementation(const Dali::KeyFrames& keyFrames)
{
- DALI_ASSERT_ALWAYS( keyFrames && "KeyFrames handle is empty" );
+ DALI_ASSERT_ALWAYS(keyFrames && "KeyFrames handle is empty");
const Dali::RefObject& object = keyFrames.GetBaseObject();
return static_cast<const Internal::KeyFrames&>(object);
}
-
-} // Dali
+} // namespace Dali
#endif // DALI_INTERNAL_KEY_FRAMES_H