• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_XCOMPONENT_XCOMPONENT_UTILS_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_XCOMPONENT_XCOMPONENT_UTILS_H
18 
19 #include "base/geometry/ng/rect_t.h"
20 #include "base/memory/ace_type.h"
21 #include "core/event/mouse_event.h"
22 #include "interfaces/inner_api/ace/ai/image_analyzer.h"
23 #include "interfaces/native/native_interface_xcomponent.h"
24 
25 namespace OHOS::Ace::NG {
26 
27 class ACE_FORCE_EXPORT XComponentUtils : public virtual AceType {
28     DECLARE_ACE_TYPE(XComponentUtils, AceType);
29 public:
30     static RectF AdjustPaintRect(float positionX, float positionY, float width, float height, bool isRound);
31     static OH_NativeXComponent_MouseEventAction ConvertNativeXComponentMouseEventAction(MouseAction mouseAction);
32     static OH_NativeXComponent_MouseEventButton ConvertNativeXComponentMouseEventButton(MouseButton mouseButton);
33     static float RoundValueToPixelGrid(float value, bool isRound, bool forceCeil, bool forceFloor);
34     static std::string XComponentRenderFitToString(RenderFit renderFit);
35     static OH_NativeXComponent_TouchEventType ConvertNativeXComponentTouchEvent(const TouchType& touchType);
36     static OH_NativeXComponent_TouchPointToolType ConvertNativeXComponentTouchToolType(const SourceTool& toolType);
37     static OH_NativeXComponent_KeyAction ConvertNativeXComponentKeyAction(const KeyAction& keyAction);
38     static OH_NativeXComponent_EventSourceType ConvertNativeXComponentEventSourceType(const SourceType& sourceType);
39     static OH_NativeXComponent_KeyEvent ConvertNativeXComponentKeyEvent(const KeyEvent& event);
40     static ArkUI_XComponent_ImageAnalyzerState ConvertNativeXComponentAnalyzerStatus(const ImageAnalyzerState state);
41 
42 }; // XComponentUtils
43 } // namespace OHOS::Ace::NG
44 
45 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_XCOMPONENT_XCOMPONENT_UTILS_H
46