1 /* 2 * Copyright (c) 2020-2021 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 GRAPHIC_LITE_DRAW_RECT_H 17 #define GRAPHIC_LITE_DRAW_RECT_H 18 19 #include "gfx_utils/heap_base.h" 20 #include "gfx_utils/rect.h" 21 #include "gfx_utils/style.h" 22 #include "gfx_utils/color.h" 23 #include "gfx_utils/graphic_buffer.h" 24 25 namespace OHOS { 26 /** @brief Class for drawing rectangle. */ 27 class DrawRect : public HeapBase { 28 public: DrawRect()29 DrawRect() {} ~DrawRect()30 ~DrawRect() {} 31 32 static void Draw(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 33 const Style& style, OpacityType opaScale); 34 35 private: 36 static void DrawRectRadiusWithoutBorder(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 37 const Style& style, OpacityType opaScale); 38 39 static void DrawRectBorderWithoutRadius(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 40 const Style& style, OpacityType opaScale); 41 42 static void DrawRectRadiusEqualBorder(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 43 const Style& style, OpacityType opaScale); 44 45 static void DrawRectRadiusSmallThanBorder(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 46 const Style& style, OpacityType opaScale); 47 48 static void DrawRectRadiusBiggerThanBorder(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 49 const Style& style, OpacityType opaScale); 50 51 static void DrawRectRadiusWithoutBorderCon1(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 52 const Style& style, OpacityType opaScale); 53 54 static void DrawRectRadiusWithoutBorderCon2(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 55 const Style& style, OpacityType opaScale); 56 57 static void DrawRectRadiusWithoutBorderCon3(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 58 const Style& style, OpacityType opaScale); 59 60 static void DrawRectRadiusWithoutBorderCon4(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 61 const Style& style, OpacityType opaScale); 62 63 static void DrawRectRadiusBiggerThanBorderCon1(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 64 const Style& style, OpacityType opaScale); 65 66 static void DrawRectRadiusBiggerThanBorderCon2(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 67 const Style& style, OpacityType opaScale); 68 69 static void DrawRectRadiusBiggerThanBorderCon3(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 70 const Style& style, OpacityType opaScale); 71 72 static void DrawRectRadiusBiggerThanBorderCon4(BufferInfo& gfxDstBuffer, const Rect& rect, const Rect& dirtyRect, 73 const Style& style, OpacityType opaScale); 74 }; 75 } // namespace OHOS 76 #endif // GRAPHIC_LITE_DRAW_RECT_H 77