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_SOFT_ENGINE_H 17 #define GRAPHIC_LITE_SOFT_ENGINE_H 18 19 #include "engines/gfx/gfx_engine_manager.h" 20 21 namespace OHOS { 22 class SoftEngine : public BaseGfxEngine { 23 public: 24 void DrawArc(BufferInfo& dst, 25 ArcInfo& arcInfo, 26 const Rect& mask, 27 const Style& style, 28 OpacityType opacity, 29 uint8_t cap) override; 30 31 void DrawLine(BufferInfo& dst, 32 const Point& start, 33 const Point& end, 34 const Rect& mask, 35 int16_t width, 36 ColorType color, 37 OpacityType opacity) override; 38 39 void DrawLetter(BufferInfo& gfxDstBuffer, 40 const uint8_t* fontMap, 41 const Rect& fontRect, 42 const Rect& subRect, 43 const uint8_t fontWeight, 44 const ColorType& color, 45 const OpacityType opa) override; 46 47 void DrawCubicBezier(BufferInfo& dst, 48 const Point& start, 49 const Point& control1, 50 const Point& control2, 51 const Point& end, 52 const Rect& mask, 53 int16_t width, 54 ColorType color, 55 OpacityType opacity) override; 56 57 void DrawRect(BufferInfo& dst, 58 const Rect& rect, 59 const Rect& dirtyRect, 60 const Style& style, 61 OpacityType opacity) override; 62 63 void DrawTransform(BufferInfo& dst, 64 const Rect& mask, 65 const Point& position, 66 ColorType color, 67 OpacityType opacity, 68 const TransformMap& transMap, 69 const TransformDataInfo& dataInfo) override; 70 71 // x/y: center of a circle 72 void ClipCircle(const ImageInfo* info, float x, float y, float radius) override; 73 74 void Blit(BufferInfo& dst, 75 const Point& dstPos, 76 const BufferInfo& src, 77 const Rect& subRect, 78 const BlendOption& blendOption) override; 79 80 void Fill(BufferInfo& dst, const Rect& fillArea, const ColorType color, const OpacityType opacity) override; 81 82 void DrawPath(BufferInfo& dst, 83 void* param, 84 const Paint& paint, 85 const Rect& rect, 86 const Rect& invalidatedArea, 87 const Style& style) override; 88 89 void FillPath(BufferInfo& dst, 90 void* param, 91 const Paint& paint, 92 const Rect& rect, 93 const Rect& invalidatedArea, 94 const Style& style) override; 95 96 uint8_t* AllocBuffer(uint32_t size, uint32_t usage) override; 97 98 void FreeBuffer(uint8_t* buffer, uint32_t usage) override; 99 }; 100 } // namespace OHOS 101 #endif 102