1 /* 2 * Copyright (c) 2021-2022 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_QRCODE_RENDER_QRCODE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_QRCODE_RENDER_QRCODE_H 18 19 #include "base/utils/system_properties.h" 20 #include "core/components/common/properties/color.h" 21 #include "core/components/image/image_component.h" 22 #include "core/components/image/render_image.h" 23 #include "core/components/qrcode/qrcode_component.h" 24 #include "core/pipeline/base/render_node.h" 25 26 namespace OHOS::Ace { 27 28 class RenderQrcode : public RenderNode { 29 DECLARE_ACE_TYPE(RenderQrcode, RenderNode); 30 31 public: 32 static RefPtr<RenderNode> Create(); 33 34 void Update(const RefPtr<Component>& component) override; 35 void PerformLayout() override; GetValue()36 const std::string& GetValue() const 37 { 38 return value_; 39 } GetQrcodeColor()40 const Color& GetQrcodeColor() const 41 { 42 return color_; 43 } GetBackgroundColor()44 const Color& GetBackgroundColor() const 45 { 46 return backgroundColor_; 47 } 48 49 protected: 50 std::string value_; 51 Color color_ = Color::BLACK; 52 Color backgroundColor_ = Color::WHITE; 53 double width_ = 0.0; 54 double height_ = 0.0; 55 RefPtr<QrcodeComponent> qrcode_; 56 RefPtr<ImageComponent> qrcodeImageComponent_; 57 RefPtr<RenderImage> qrcodeRenderImage_; 58 }; 59 60 } // namespace OHOS::Ace 61 62 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_QRCODE_RENDER_QRCODE_H 63