123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci#include "frame_information.h" 1623b3eb3cSopenharmony_ci 1723b3eb3cSopenharmony_ci#include "base/utils/utils.h" 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ci#ifdef __cplusplus 2023b3eb3cSopenharmony_ciextern "C" { 2123b3eb3cSopenharmony_ci#endif 2223b3eb3cSopenharmony_ci 2323b3eb3cSopenharmony_ciArkUI_ImageAnimatorFrameInfo* OH_ArkUI_ImageAnimatorFrameInfo_CreateFromString(char* src) 2423b3eb3cSopenharmony_ci{ 2523b3eb3cSopenharmony_ci CHECK_NULL_RETURN(src, nullptr); 2623b3eb3cSopenharmony_ci ArkUI_ImageAnimatorFrameInfo* imageInfo = new ArkUI_ImageAnimatorFrameInfo; 2723b3eb3cSopenharmony_ci imageInfo->src = src; 2823b3eb3cSopenharmony_ci imageInfo->drawableDescriptor = nullptr; 2923b3eb3cSopenharmony_ci return imageInfo; 3023b3eb3cSopenharmony_ci} 3123b3eb3cSopenharmony_ci 3223b3eb3cSopenharmony_ciArkUI_ImageAnimatorFrameInfo* OH_ArkUI_ImageAnimatorFrameInfo_CreateFromDrawableDescriptor( 3323b3eb3cSopenharmony_ci ArkUI_DrawableDescriptor* drawable) 3423b3eb3cSopenharmony_ci{ 3523b3eb3cSopenharmony_ci CHECK_NULL_RETURN(drawable, nullptr); 3623b3eb3cSopenharmony_ci ArkUI_ImageAnimatorFrameInfo* imageInfo = new ArkUI_ImageAnimatorFrameInfo; 3723b3eb3cSopenharmony_ci imageInfo->src = ""; 3823b3eb3cSopenharmony_ci imageInfo->drawableDescriptor = drawable; 3923b3eb3cSopenharmony_ci return imageInfo; 4023b3eb3cSopenharmony_ci} 4123b3eb3cSopenharmony_ci 4223b3eb3cSopenharmony_civoid OH_ArkUI_ImageAnimatorFrameInfo_Dispose(ArkUI_ImageAnimatorFrameInfo* imageInfo) 4323b3eb3cSopenharmony_ci{ 4423b3eb3cSopenharmony_ci CHECK_NULL_VOID(imageInfo); 4523b3eb3cSopenharmony_ci delete imageInfo; 4623b3eb3cSopenharmony_ci} 4723b3eb3cSopenharmony_ci 4823b3eb3cSopenharmony_civoid OH_ArkUI_ImageAnimatorFrameInfo_SetWidth(ArkUI_ImageAnimatorFrameInfo* imageInfo, int32_t width) 4923b3eb3cSopenharmony_ci{ 5023b3eb3cSopenharmony_ci CHECK_NULL_VOID(imageInfo); 5123b3eb3cSopenharmony_ci imageInfo->width = width; 5223b3eb3cSopenharmony_ci} 5323b3eb3cSopenharmony_ci 5423b3eb3cSopenharmony_ciint32_t OH_ArkUI_ImageAnimatorFrameInfo_GetWidth(ArkUI_ImageAnimatorFrameInfo* imageInfo) 5523b3eb3cSopenharmony_ci{ 5623b3eb3cSopenharmony_ci CHECK_NULL_RETURN(imageInfo, 0); 5723b3eb3cSopenharmony_ci return imageInfo->width.value_or(0); 5823b3eb3cSopenharmony_ci} 5923b3eb3cSopenharmony_ci 6023b3eb3cSopenharmony_civoid OH_ArkUI_ImageAnimatorFrameInfo_SetHeight(ArkUI_ImageAnimatorFrameInfo* imageInfo, int32_t height) 6123b3eb3cSopenharmony_ci{ 6223b3eb3cSopenharmony_ci CHECK_NULL_VOID(imageInfo); 6323b3eb3cSopenharmony_ci imageInfo->height = height; 6423b3eb3cSopenharmony_ci} 6523b3eb3cSopenharmony_ci 6623b3eb3cSopenharmony_ciint32_t OH_ArkUI_ImageAnimatorFrameInfo_GetHeight(ArkUI_ImageAnimatorFrameInfo* imageInfo) 6723b3eb3cSopenharmony_ci{ 6823b3eb3cSopenharmony_ci CHECK_NULL_RETURN(imageInfo, 0); 6923b3eb3cSopenharmony_ci return imageInfo->height.value_or(0); 7023b3eb3cSopenharmony_ci} 7123b3eb3cSopenharmony_ci 7223b3eb3cSopenharmony_civoid OH_ArkUI_ImageAnimatorFrameInfo_SetTop(ArkUI_ImageAnimatorFrameInfo* imageInfo, int32_t top) 7323b3eb3cSopenharmony_ci{ 7423b3eb3cSopenharmony_ci CHECK_NULL_VOID(imageInfo); 7523b3eb3cSopenharmony_ci imageInfo->top = top; 7623b3eb3cSopenharmony_ci} 7723b3eb3cSopenharmony_ci 7823b3eb3cSopenharmony_ciint32_t OH_ArkUI_ImageAnimatorFrameInfo_GetTop(ArkUI_ImageAnimatorFrameInfo* imageInfo) 7923b3eb3cSopenharmony_ci{ 8023b3eb3cSopenharmony_ci CHECK_NULL_RETURN(imageInfo, 0); 8123b3eb3cSopenharmony_ci return imageInfo->top.value_or(0); 8223b3eb3cSopenharmony_ci} 8323b3eb3cSopenharmony_ci 8423b3eb3cSopenharmony_civoid OH_ArkUI_ImageAnimatorFrameInfo_SetLeft(ArkUI_ImageAnimatorFrameInfo* imageInfo, int32_t left) 8523b3eb3cSopenharmony_ci{ 8623b3eb3cSopenharmony_ci CHECK_NULL_VOID(imageInfo); 8723b3eb3cSopenharmony_ci imageInfo->left = left; 8823b3eb3cSopenharmony_ci} 8923b3eb3cSopenharmony_ci 9023b3eb3cSopenharmony_ciint32_t OH_ArkUI_ImageAnimatorFrameInfo_GetLeft(ArkUI_ImageAnimatorFrameInfo* imageInfo) 9123b3eb3cSopenharmony_ci{ 9223b3eb3cSopenharmony_ci CHECK_NULL_RETURN(imageInfo, 0); 9323b3eb3cSopenharmony_ci return imageInfo->left.value_or(0); 9423b3eb3cSopenharmony_ci} 9523b3eb3cSopenharmony_ci 9623b3eb3cSopenharmony_civoid OH_ArkUI_ImageAnimatorFrameInfo_SetDuration(ArkUI_ImageAnimatorFrameInfo* imageInfo, int32_t duration) 9723b3eb3cSopenharmony_ci{ 9823b3eb3cSopenharmony_ci CHECK_NULL_VOID(imageInfo); 9923b3eb3cSopenharmony_ci imageInfo->duration = duration; 10023b3eb3cSopenharmony_ci} 10123b3eb3cSopenharmony_ci 10223b3eb3cSopenharmony_ciint32_t OH_ArkUI_ImageAnimatorFrameInfo_GetDuration(ArkUI_ImageAnimatorFrameInfo* imageInfo) 10323b3eb3cSopenharmony_ci{ 10423b3eb3cSopenharmony_ci CHECK_NULL_RETURN(imageInfo, 0); 10523b3eb3cSopenharmony_ci return imageInfo->duration.value_or(0); 10623b3eb3cSopenharmony_ci} 10723b3eb3cSopenharmony_ci#ifdef __cplusplus 10823b3eb3cSopenharmony_ci}; 10923b3eb3cSopenharmony_ci#endif 110