1 /* 2 * Copyright (c) 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 /** 17 * @file depict_dash.h 18 * 19 * @brief Defines Build dash transform pipe 20 * For the drawing of dotted lines, the basic appearance of 21 * the curve is usually determined by inputting dash array and size 22 * @since 1.0 23 * @version 1.0 24 */ 25 26 #ifndef GRAPHIC_LITE_DEPICT_DASH_H 27 #define GRAPHIC_LITE_DEPICT_DASH_H 28 29 #include "depict_adaptor_vertex_generate.h" 30 31 #include "gfx_utils/diagram/common/common_basics.h" 32 #include "gfx_utils/diagram/depiction/depict_curve.h" 33 #include "gfx_utils/diagram/vertexgenerate/vertex_generate_dash.h" 34 35 namespace OHOS { 36 using GenerateDash = VertexGenerateDash; 37 /** 38 * @template<VertexSource,Markers> struct DepictDash 39 * @brief The dependdash structure is used for vertexsource through the dash class 40 * Carry out specific treatment of dotted line. 41 * @since 1.0 42 * @version 1.0 43 */ 44 struct DepictDash : public DepictAdaptorVertexGenerate<DepictCurve, GenerateDash, EmptyMarkers> { 45 #if defined(GRAPHIC_ENABLE_DASH_GENERATE_FLAG) && GRAPHIC_ENABLE_DASH_GENERATE_FLAG 46 using BaseType = DepictAdaptorVertexGenerate<DepictCurve, GenerateDash, EmptyMarkers>; 47 DepictDashDepictDash48 DepictDash(DepictCurve& vs) : DepictAdaptorVertexGenerate<DepictCurve, GenerateDash, EmptyMarkers>(vs) {} 49 RemoveAllDashesDepictDash50 void RemoveAllDashes() 51 { 52 BaseType::GetGenerator().RemoveAllDashes(); 53 } 54 AddDashDepictDash55 void AddDash(float dashLen, float gapLen) 56 { 57 BaseType::GetGenerator().AddDash(dashLen, gapLen); 58 } 59 DashStartDepictDash60 void DashStart(float dStart) 61 { 62 BaseType::GetGenerator().DashStart(dStart); 63 } 64 ShortenDepictDash65 void Shorten(float shortValue) 66 { 67 BaseType::GetGenerator().Shorten(shortValue); 68 } ShortenDepictDash69 float Shorten() const 70 { 71 return BaseType::GetGenerator().Shorten(); 72 } 73 #endif 74 }; 75 } // namespace OHOS 76 #endif 77