161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkGraphics2D 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type image from './@ohos.multimedia.image'; 2261847f8eSopenharmony_ciimport type common2D from './@ohos.graphics.common2D'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * Provides functions such as 2D graphics rendering, text drawing, and image display. 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace drawing 2861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 2961847f8eSopenharmony_ci * @since 11 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace drawing { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * Enumerate blending modes for colors. 3461847f8eSopenharmony_ci * Blend is a operation that use 4 components(red, green, blue, alpha) to generate 3561847f8eSopenharmony_ci * a new color from two colors(source, destination). 3661847f8eSopenharmony_ci * @enum { number } 3761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 3861847f8eSopenharmony_ci * @since 11 3961847f8eSopenharmony_ci */ 4061847f8eSopenharmony_ci enum BlendMode { 4161847f8eSopenharmony_ci /** 4261847f8eSopenharmony_ci * Disable 4 regions(red, green, blue, alpha) 4361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 4461847f8eSopenharmony_ci * @since 11 4561847f8eSopenharmony_ci */ 4661847f8eSopenharmony_ci CLEAR = 0, 4761847f8eSopenharmony_ci /** 4861847f8eSopenharmony_ci * Use components of the source 4961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 5061847f8eSopenharmony_ci * @since 11 5161847f8eSopenharmony_ci */ 5261847f8eSopenharmony_ci SRC = 1, 5361847f8eSopenharmony_ci /** 5461847f8eSopenharmony_ci * Use components of the destination 5561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 5661847f8eSopenharmony_ci * @since 11 5761847f8eSopenharmony_ci */ 5861847f8eSopenharmony_ci DST = 2, 5961847f8eSopenharmony_ci /** 6061847f8eSopenharmony_ci * The source is placed above the destination. 6161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 6261847f8eSopenharmony_ci * @since 11 6361847f8eSopenharmony_ci */ 6461847f8eSopenharmony_ci SRC_OVER = 3, 6561847f8eSopenharmony_ci /** 6661847f8eSopenharmony_ci * The Destination is placed above the source. 6761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 6861847f8eSopenharmony_ci * @since 11 6961847f8eSopenharmony_ci */ 7061847f8eSopenharmony_ci DST_OVER = 4, 7161847f8eSopenharmony_ci /** 7261847f8eSopenharmony_ci * Use source replaces the destination, and will not exceed the boundaries of the destination 7361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 7461847f8eSopenharmony_ci * @since 11 7561847f8eSopenharmony_ci */ 7661847f8eSopenharmony_ci SRC_IN = 5, 7761847f8eSopenharmony_ci /** 7861847f8eSopenharmony_ci * Use destination, and will not exceed the boundaries of the source 7961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 8061847f8eSopenharmony_ci * @since 11 8161847f8eSopenharmony_ci */ 8261847f8eSopenharmony_ci DST_IN = 6, 8361847f8eSopenharmony_ci /** 8461847f8eSopenharmony_ci * Source is use in outside of the boundaries of the destination. 8561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 8661847f8eSopenharmony_ci * @since 11 8761847f8eSopenharmony_ci */ 8861847f8eSopenharmony_ci SRC_OUT = 7, 8961847f8eSopenharmony_ci /** 9061847f8eSopenharmony_ci * Destination is use in outside of the boundaries of the source. 9161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 9261847f8eSopenharmony_ci * @since 11 9361847f8eSopenharmony_ci */ 9461847f8eSopenharmony_ci DST_OUT = 8, 9561847f8eSopenharmony_ci /** 9661847f8eSopenharmony_ci * Source which overlaps the destination will replaces the destination. 9761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 9861847f8eSopenharmony_ci * @since 11 9961847f8eSopenharmony_ci */ 10061847f8eSopenharmony_ci SRC_ATOP = 9, 10161847f8eSopenharmony_ci /** 10261847f8eSopenharmony_ci * Destination which overlaps the source will replaces the source. 10361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 10461847f8eSopenharmony_ci * @since 11 10561847f8eSopenharmony_ci */ 10661847f8eSopenharmony_ci DST_ATOP = 10, 10761847f8eSopenharmony_ci /** 10861847f8eSopenharmony_ci * Combine regions where source and destination do not overlap. 10961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 11061847f8eSopenharmony_ci * @since 11 11161847f8eSopenharmony_ci */ 11261847f8eSopenharmony_ci XOR = 11, 11361847f8eSopenharmony_ci /** 11461847f8eSopenharmony_ci * The sum of the source and destination. 11561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 11661847f8eSopenharmony_ci * @since 11 11761847f8eSopenharmony_ci */ 11861847f8eSopenharmony_ci PLUS = 12, 11961847f8eSopenharmony_ci /** 12061847f8eSopenharmony_ci * All components are multiplied. 12161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 12261847f8eSopenharmony_ci * @since 11 12361847f8eSopenharmony_ci */ 12461847f8eSopenharmony_ci MODULATE = 13, 12561847f8eSopenharmony_ci /** 12661847f8eSopenharmony_ci * Multiply the complement values of the background and source color values, 12761847f8eSopenharmony_ci * and then complement the result. 12861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 12961847f8eSopenharmony_ci * @since 11 13061847f8eSopenharmony_ci */ 13161847f8eSopenharmony_ci SCREEN = 14, 13261847f8eSopenharmony_ci /** 13361847f8eSopenharmony_ci * Multiplies or screens the colors, depending on destination 13461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 13561847f8eSopenharmony_ci * @since 11 13661847f8eSopenharmony_ci */ 13761847f8eSopenharmony_ci OVERLAY = 15, 13861847f8eSopenharmony_ci /** 13961847f8eSopenharmony_ci * Choose a darker background and source color. 14061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 14161847f8eSopenharmony_ci * @since 11 14261847f8eSopenharmony_ci */ 14361847f8eSopenharmony_ci DARKEN = 16, 14461847f8eSopenharmony_ci /** 14561847f8eSopenharmony_ci * Choose a lighter background and source color. 14661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 14761847f8eSopenharmony_ci * @since 11 14861847f8eSopenharmony_ci */ 14961847f8eSopenharmony_ci LIGHTEN = 17, 15061847f8eSopenharmony_ci /** 15161847f8eSopenharmony_ci * Brightens destination color to reflect the source color. 15261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 15361847f8eSopenharmony_ci * @since 11 15461847f8eSopenharmony_ci */ 15561847f8eSopenharmony_ci COLOR_DODGE = 18, 15661847f8eSopenharmony_ci /** 15761847f8eSopenharmony_ci * Darkens destination color to reflect the source color. 15861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 15961847f8eSopenharmony_ci * @since 11 16061847f8eSopenharmony_ci */ 16161847f8eSopenharmony_ci COLOR_BURN = 19, 16261847f8eSopenharmony_ci /** 16361847f8eSopenharmony_ci * Multiplies or screens the colors, depending on source 16461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 16561847f8eSopenharmony_ci * @since 11 16661847f8eSopenharmony_ci */ 16761847f8eSopenharmony_ci HARD_LIGHT = 20, 16861847f8eSopenharmony_ci /** 16961847f8eSopenharmony_ci * Lightens or Darkens the colors, depending on the source. 17061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 17161847f8eSopenharmony_ci * @since 11 17261847f8eSopenharmony_ci */ 17361847f8eSopenharmony_ci SOFT_LIGHT = 21, 17461847f8eSopenharmony_ci /** 17561847f8eSopenharmony_ci * Subtract the darker of the two colors from the brighter color. 17661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 17761847f8eSopenharmony_ci * @since 11 17861847f8eSopenharmony_ci */ 17961847f8eSopenharmony_ci DIFFERENCE = 22, 18061847f8eSopenharmony_ci /** 18161847f8eSopenharmony_ci * Produces an effect similar to difference mode, but with lower contrast. 18261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 18361847f8eSopenharmony_ci * @since 11 18461847f8eSopenharmony_ci */ 18561847f8eSopenharmony_ci EXCLUSION = 23, 18661847f8eSopenharmony_ci /** 18761847f8eSopenharmony_ci * Multiply the source color by the destination color and replace the destination. 18861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 18961847f8eSopenharmony_ci * @since 11 19061847f8eSopenharmony_ci */ 19161847f8eSopenharmony_ci MULTIPLY = 24, 19261847f8eSopenharmony_ci /** 19361847f8eSopenharmony_ci * Use the hue of the source and the saturation and brightness of the destination. 19461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 19561847f8eSopenharmony_ci * @since 11 19661847f8eSopenharmony_ci */ 19761847f8eSopenharmony_ci HUE = 25, 19861847f8eSopenharmony_ci /** 19961847f8eSopenharmony_ci * Use the saturation of the source and the hue and brightness of the destination. 20061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 20161847f8eSopenharmony_ci * @since 11 20261847f8eSopenharmony_ci */ 20361847f8eSopenharmony_ci SATURATION = 26, 20461847f8eSopenharmony_ci /** 20561847f8eSopenharmony_ci * Use the hue and saturation of the source and the brightness of the destination. 20661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 20761847f8eSopenharmony_ci * @since 11 20861847f8eSopenharmony_ci */ 20961847f8eSopenharmony_ci COLOR = 27, 21061847f8eSopenharmony_ci /** 21161847f8eSopenharmony_ci * Use the brightness of the source and the hue and saturation of the destination. 21261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 21361847f8eSopenharmony_ci * @since 11 21461847f8eSopenharmony_ci */ 21561847f8eSopenharmony_ci LUMINOSITY = 28, 21661847f8eSopenharmony_ci } 21761847f8eSopenharmony_ci 21861847f8eSopenharmony_ci /** 21961847f8eSopenharmony_ci * Enumerates direction for adding closed contours. 22061847f8eSopenharmony_ci * @enum { number } 22161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 22261847f8eSopenharmony_ci * @since 12 22361847f8eSopenharmony_ci */ 22461847f8eSopenharmony_ci enum PathDirection { 22561847f8eSopenharmony_ci /** 22661847f8eSopenharmony_ci * Clockwise direction for adding closed contours. 22761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 22861847f8eSopenharmony_ci * @since 12 22961847f8eSopenharmony_ci */ 23061847f8eSopenharmony_ci CLOCKWISE = 0, 23161847f8eSopenharmony_ci 23261847f8eSopenharmony_ci /** 23361847f8eSopenharmony_ci * Counter-clockwise direction for adding closed contours. 23461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 23561847f8eSopenharmony_ci * @since 12 23661847f8eSopenharmony_ci */ 23761847f8eSopenharmony_ci COUNTER_CLOCKWISE = 1, 23861847f8eSopenharmony_ci } 23961847f8eSopenharmony_ci 24061847f8eSopenharmony_ci /** 24161847f8eSopenharmony_ci * Enumerates fill type of path. 24261847f8eSopenharmony_ci * @enum { number } 24361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 24461847f8eSopenharmony_ci * @since 12 24561847f8eSopenharmony_ci */ 24661847f8eSopenharmony_ci enum PathFillType { 24761847f8eSopenharmony_ci /** 24861847f8eSopenharmony_ci * Specifies that "inside" is computed by a non-zero sum of signed edge crossings. 24961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 25061847f8eSopenharmony_ci * @since 12 25161847f8eSopenharmony_ci */ 25261847f8eSopenharmony_ci WINDING = 0, 25361847f8eSopenharmony_ci 25461847f8eSopenharmony_ci /** 25561847f8eSopenharmony_ci * Specifies that "inside" is computed by an odd number of edge crossings. 25661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 25761847f8eSopenharmony_ci * @since 12 25861847f8eSopenharmony_ci */ 25961847f8eSopenharmony_ci EVEN_ODD = 1, 26061847f8eSopenharmony_ci 26161847f8eSopenharmony_ci /** 26261847f8eSopenharmony_ci * Same as winding, but draws outside of the path, rather than inside. 26361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 26461847f8eSopenharmony_ci * @since 12 26561847f8eSopenharmony_ci */ 26661847f8eSopenharmony_ci INVERSE_WINDING = 2, 26761847f8eSopenharmony_ci 26861847f8eSopenharmony_ci /** 26961847f8eSopenharmony_ci * Same as evenOdd, but draws outside of the path, rather than inside. 27061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 27161847f8eSopenharmony_ci * @since 12 27261847f8eSopenharmony_ci */ 27361847f8eSopenharmony_ci INVERSE_EVEN_ODD = 3, 27461847f8eSopenharmony_ci } 27561847f8eSopenharmony_ci 27661847f8eSopenharmony_ci /** 27761847f8eSopenharmony_ci * Enumerate path measure flags for matrix. 27861847f8eSopenharmony_ci * @enum { number } 27961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 28061847f8eSopenharmony_ci * @since 12 28161847f8eSopenharmony_ci */ 28261847f8eSopenharmony_ci enum PathMeasureMatrixFlags { 28361847f8eSopenharmony_ci /** 28461847f8eSopenharmony_ci * Gets position. 28561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 28661847f8eSopenharmony_ci * @since 12 28761847f8eSopenharmony_ci */ 28861847f8eSopenharmony_ci GET_POSITION_MATRIX = 0, 28961847f8eSopenharmony_ci /** 29061847f8eSopenharmony_ci * Gets tangent. 29161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 29261847f8eSopenharmony_ci * @since 12 29361847f8eSopenharmony_ci */ 29461847f8eSopenharmony_ci GET_TANGENT_MATRIX = 1, 29561847f8eSopenharmony_ci /** 29661847f8eSopenharmony_ci * Gets both position and tangent. 29761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 29861847f8eSopenharmony_ci * @since 12 29961847f8eSopenharmony_ci */ 30061847f8eSopenharmony_ci GET_POSITION_AND_TANGENT_MATRIX = 2, 30161847f8eSopenharmony_ci } 30261847f8eSopenharmony_ci 30361847f8eSopenharmony_ci /** 30461847f8eSopenharmony_ci * Provides the definition of the roundRect. 30561847f8eSopenharmony_ci * 30661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 30761847f8eSopenharmony_ci * @since 12 30861847f8eSopenharmony_ci */ 30961847f8eSopenharmony_ci class RoundRect { 31061847f8eSopenharmony_ci /** 31161847f8eSopenharmony_ci * Creates a simple round rect with the same four corner radii. 31261847f8eSopenharmony_ci * @param { common2D.Rect } rect - Indicates the Rect object. 31361847f8eSopenharmony_ci * @param { number } xRadii - Indicates the corner radii on x-axis. 31461847f8eSopenharmony_ci * @param { number } yRadii - Indicates the corner radii on y-axis. 31561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 31661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 31761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 31861847f8eSopenharmony_ci * @since 12 31961847f8eSopenharmony_ci */ 32061847f8eSopenharmony_ci constructor(rect: common2D.Rect, xRadii: number, yRadii: number); 32161847f8eSopenharmony_ci 32261847f8eSopenharmony_ci /** 32361847f8eSopenharmony_ci * Sets the radiusX and radiusY for a specific corner position. 32461847f8eSopenharmony_ci * @param { CornerPos } pos - Indicates the corner radius position. 32561847f8eSopenharmony_ci * @param { number } x - Indicates the corner radius on x-axis. 32661847f8eSopenharmony_ci * @param { number } y - Indicates the corner radius on y-axis. 32761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 32861847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 32961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 33061847f8eSopenharmony_ci * @since 12 33161847f8eSopenharmony_ci */ 33261847f8eSopenharmony_ci setCorner(pos: CornerPos, x: number, y: number): void; 33361847f8eSopenharmony_ci 33461847f8eSopenharmony_ci /** 33561847f8eSopenharmony_ci * Gets a point with the values of x-axis and y-axis of the selected corner radius. 33661847f8eSopenharmony_ci * @param { CornerPos } pos - Indicates the corner radius position. 33761847f8eSopenharmony_ci * @returns { common2D.Point } Returns a point with the values of x-axis and y-axis of the corner radius. 33861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 33961847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 34061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 34161847f8eSopenharmony_ci * @since 12 34261847f8eSopenharmony_ci */ 34361847f8eSopenharmony_ci getCorner(pos: CornerPos): common2D.Point; 34461847f8eSopenharmony_ci 34561847f8eSopenharmony_ci /** 34661847f8eSopenharmony_ci * Translates round rect by (dx, dy). 34761847f8eSopenharmony_ci * @param { number } dx - Indicates the offsets added to rect left and rect right. 34861847f8eSopenharmony_ci * @param { number } dy - Indicates the offsets added to rect top and rect bottom. 34961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 35061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 35161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 35261847f8eSopenharmony_ci * @since 12 35361847f8eSopenharmony_ci */ 35461847f8eSopenharmony_ci offset(dx: number, dy: number): void; 35561847f8eSopenharmony_ci } 35661847f8eSopenharmony_ci 35761847f8eSopenharmony_ci /** 35861847f8eSopenharmony_ci * Enumerates of operations when two paths are combined. 35961847f8eSopenharmony_ci * @enum { number } 36061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 36161847f8eSopenharmony_ci * @since 12 36261847f8eSopenharmony_ci */ 36361847f8eSopenharmony_ci enum PathOp { 36461847f8eSopenharmony_ci /** 36561847f8eSopenharmony_ci * Difference operation. 36661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 36761847f8eSopenharmony_ci * @since 12 36861847f8eSopenharmony_ci */ 36961847f8eSopenharmony_ci DIFFERENCE = 0, 37061847f8eSopenharmony_ci 37161847f8eSopenharmony_ci /** 37261847f8eSopenharmony_ci * Intersect operation. 37361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 37461847f8eSopenharmony_ci * @since 12 37561847f8eSopenharmony_ci */ 37661847f8eSopenharmony_ci INTERSECT = 1, 37761847f8eSopenharmony_ci 37861847f8eSopenharmony_ci /** 37961847f8eSopenharmony_ci * Union operation. 38061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 38161847f8eSopenharmony_ci * @since 12 38261847f8eSopenharmony_ci */ 38361847f8eSopenharmony_ci UNION = 2, 38461847f8eSopenharmony_ci 38561847f8eSopenharmony_ci /** 38661847f8eSopenharmony_ci * Xor operation. 38761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 38861847f8eSopenharmony_ci * @since 12 38961847f8eSopenharmony_ci */ 39061847f8eSopenharmony_ci XOR = 3, 39161847f8eSopenharmony_ci 39261847f8eSopenharmony_ci /** 39361847f8eSopenharmony_ci * Reverse difference operation. 39461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 39561847f8eSopenharmony_ci * @since 12 39661847f8eSopenharmony_ci */ 39761847f8eSopenharmony_ci REVERSE_DIFFERENCE = 4, 39861847f8eSopenharmony_ci } 39961847f8eSopenharmony_ci 40061847f8eSopenharmony_ci /** 40161847f8eSopenharmony_ci * Describes a path object. 40261847f8eSopenharmony_ci * 40361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 40461847f8eSopenharmony_ci * @since 11 40561847f8eSopenharmony_ci */ 40661847f8eSopenharmony_ci class Path { 40761847f8eSopenharmony_ci /** 40861847f8eSopenharmony_ci * Creates a Path. 40961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 41061847f8eSopenharmony_ci * @since 12 41161847f8eSopenharmony_ci */ 41261847f8eSopenharmony_ci constructor(); 41361847f8eSopenharmony_ci 41461847f8eSopenharmony_ci /** 41561847f8eSopenharmony_ci * Creates a Path from other path. 41661847f8eSopenharmony_ci * @param { Path } path - the path to copy content from. 41761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 41861847f8eSopenharmony_ci * @since 12 41961847f8eSopenharmony_ci */ 42061847f8eSopenharmony_ci constructor(path: Path); 42161847f8eSopenharmony_ci 42261847f8eSopenharmony_ci /** 42361847f8eSopenharmony_ci * Sets the start point of a path 42461847f8eSopenharmony_ci * @param { number } x - Indicates the x coordinate of the start point. 42561847f8eSopenharmony_ci * @param { number } y - Indicates the y coordinate of the start point. 42661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 42761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 42861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 42961847f8eSopenharmony_ci * @since 11 43061847f8eSopenharmony_ci */ 43161847f8eSopenharmony_ci moveTo(x: number, y: number): void; 43261847f8eSopenharmony_ci 43361847f8eSopenharmony_ci /** 43461847f8eSopenharmony_ci * Draws a line segment from the last point of a path to the target point. 43561847f8eSopenharmony_ci * @param { number } x - Indicates the x coordinate of the target point. 43661847f8eSopenharmony_ci * @param { number } y - Indicates the y coordinate of the target point. 43761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 43861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 43961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 44061847f8eSopenharmony_ci * @since 11 44161847f8eSopenharmony_ci */ 44261847f8eSopenharmony_ci lineTo(x: number, y: number): void; 44361847f8eSopenharmony_ci 44461847f8eSopenharmony_ci /** 44561847f8eSopenharmony_ci * This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first, 44661847f8eSopenharmony_ci * and then a start angle and a sweep angle are specified. 44761847f8eSopenharmony_ci * The arc is a portion of the ellipse defined by the start angle and the sweep angle. 44861847f8eSopenharmony_ci * By default, a line segment from the last point of the path to the start point of the arc is also added. 44961847f8eSopenharmony_ci * @param { number } x1 - Indicates the x coordinate of the upper left corner of the rectangle. 45061847f8eSopenharmony_ci * @param { number } y1 - Indicates the y coordinate of the upper left corner of the rectangle. 45161847f8eSopenharmony_ci * @param { number } x2 - Indicates the x coordinate of the lower right corner of the rectangle. 45261847f8eSopenharmony_ci * @param { number } y2 - Indicates the y coordinate of the lower right corner of the rectangle. 45361847f8eSopenharmony_ci * @param { number } startDeg - Indicates the start angle, in degrees. 45461847f8eSopenharmony_ci * @param { number } sweepDeg - Indicates the angle to sweep, in degrees. 45561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 45661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 45761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 45861847f8eSopenharmony_ci * @since 11 45961847f8eSopenharmony_ci */ 46061847f8eSopenharmony_ci arcTo(x1: number, y1: number, x2: number, y2: number, startDeg: number, sweepDeg: number): void; 46161847f8eSopenharmony_ci 46261847f8eSopenharmony_ci /** 46361847f8eSopenharmony_ci * Draws a quadratic Bezier curve from the last point of a path to the target point. 46461847f8eSopenharmony_ci * @param { number } ctrlX - Indicates the x coordinate of the control point. 46561847f8eSopenharmony_ci * @param { number } ctrlY - Indicates the y coordinate of the control point. 46661847f8eSopenharmony_ci * @param { number } endX - Indicates the x coordinate of the target point. 46761847f8eSopenharmony_ci * @param { number } endY - Indicates the y coordinate of the target point. 46861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 46961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 47061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 47161847f8eSopenharmony_ci * @since 11 47261847f8eSopenharmony_ci */ 47361847f8eSopenharmony_ci quadTo(ctrlX: number, ctrlY: number, endX: number, endY: number): void; 47461847f8eSopenharmony_ci 47561847f8eSopenharmony_ci /** 47661847f8eSopenharmony_ci * Draws a conic from the last point of a path to the target point. 47761847f8eSopenharmony_ci * @param { number } ctrlX - Indicates the x coordinate of the control point. 47861847f8eSopenharmony_ci * @param { number } ctrlY - Indicates the y coordinate of the control point. 47961847f8eSopenharmony_ci * @param { number } endX - Indicates the x coordinate of the target point. 48061847f8eSopenharmony_ci * @param { number } endY - Indicates the y coordinate of the target point. 48161847f8eSopenharmony_ci * @param { number } weight - Indicates the weight of added conic. 48261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 48361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 48461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 48561847f8eSopenharmony_ci * @since 12 48661847f8eSopenharmony_ci */ 48761847f8eSopenharmony_ci conicTo(ctrlX: number, ctrlY: number, endX: number, endY: number, weight: number): void; 48861847f8eSopenharmony_ci 48961847f8eSopenharmony_ci /** 49061847f8eSopenharmony_ci * Draws a cubic Bezier curve from the last point of a path to the target point. 49161847f8eSopenharmony_ci * @param { number } ctrlX1 - Indicates the x coordinate of the first control point. 49261847f8eSopenharmony_ci * @param { number } ctrlY1 - Indicates the y coordinate of the first control point. 49361847f8eSopenharmony_ci * @param { number } ctrlX2 - Indicates the x coordinate of the second control point. 49461847f8eSopenharmony_ci * @param { number } ctrlY2 - Indicates the y coordinate of the second control point. 49561847f8eSopenharmony_ci * @param { number } endX - Indicates the x coordinate of the target point. 49661847f8eSopenharmony_ci * @param { number } endY - Indicates the y coordinate of the target point. 49761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 49861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 49961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 50061847f8eSopenharmony_ci * @since 11 50161847f8eSopenharmony_ci */ 50261847f8eSopenharmony_ci cubicTo(ctrlX1: number, ctrlY1: number, ctrlX2: number, ctrlY2: number, endX: number, endY: number): void; 50361847f8eSopenharmony_ci 50461847f8eSopenharmony_ci /** 50561847f8eSopenharmony_ci * Sets the relative starting point of a path. 50661847f8eSopenharmony_ci * @param { number } dx - Indicates the x coordinate of the relative starting point. 50761847f8eSopenharmony_ci * @param { number } dy - Indicates the y coordinate of the relative starting point. 50861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 50961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 51061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 51161847f8eSopenharmony_ci * @since 12 51261847f8eSopenharmony_ci */ 51361847f8eSopenharmony_ci rMoveTo(dx: number, dy: number): void; 51461847f8eSopenharmony_ci 51561847f8eSopenharmony_ci /** 51661847f8eSopenharmony_ci * Draws a line segment from the last point of a path to the relative target point. 51761847f8eSopenharmony_ci * @param { number } dx - Indicates the x coordinate of the relative target point. 51861847f8eSopenharmony_ci * @param { number } dy - Indicates the y coordinate of the relative target point. 51961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 52061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 52161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 52261847f8eSopenharmony_ci * @since 12 52361847f8eSopenharmony_ci */ 52461847f8eSopenharmony_ci rLineTo(dx: number, dy: number): void; 52561847f8eSopenharmony_ci 52661847f8eSopenharmony_ci /** 52761847f8eSopenharmony_ci * Draws a quadratic bezier curve from the last point of a path to the relative target point. 52861847f8eSopenharmony_ci * @param { number } dx1 - Indicates the x coordinate of the relative control point. 52961847f8eSopenharmony_ci * @param { number } dy1 - Indicates the y coordinate of the relative control point. 53061847f8eSopenharmony_ci * @param { number } dx2 - Indicates the x coordinate of the relative target point. 53161847f8eSopenharmony_ci * @param { number } dy2 - Indicates the y coordinate of the relative target point. 53261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 53361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 53461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 53561847f8eSopenharmony_ci * @since 12 53661847f8eSopenharmony_ci */ 53761847f8eSopenharmony_ci rQuadTo(dx1: number, dy1: number, dx2: number, dy2: number): void; 53861847f8eSopenharmony_ci 53961847f8eSopenharmony_ci /** 54061847f8eSopenharmony_ci * Draws a conic from the last point of a path to the relative target point. 54161847f8eSopenharmony_ci * @param { number } ctrlX - Indicates the x coordinate of the relative control point. 54261847f8eSopenharmony_ci * @param { number } ctrlY - Indicates the y coordinate of the relative control point. 54361847f8eSopenharmony_ci * @param { number } endX - Indicates the x coordinate of the relative target point. 54461847f8eSopenharmony_ci * @param { number } endY - Indicates the y coordinate of the relative target point. 54561847f8eSopenharmony_ci * @param { number } weight - Indicates the weight of added conic. 54661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 54761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 54861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 54961847f8eSopenharmony_ci * @since 12 55061847f8eSopenharmony_ci */ 55161847f8eSopenharmony_ci rConicTo(ctrlX: number, ctrlY: number, endX: number, endY: number, weight: number): void; 55261847f8eSopenharmony_ci 55361847f8eSopenharmony_ci /** 55461847f8eSopenharmony_ci * Draws a cubic bezier curve from the last point of a path to the relative target point. 55561847f8eSopenharmony_ci * @param { number } ctrlX1 - Indicates the x coordinate of the first relative control point. 55661847f8eSopenharmony_ci * @param { number } ctrlY1 - Indicates the y coordinate of the first relative control point. 55761847f8eSopenharmony_ci * @param { number } ctrlX2 - Indicates the x coordinate of the second relative control point. 55861847f8eSopenharmony_ci * @param { number } ctrlY2 - Indicates the y coordinate of the second relative control point. 55961847f8eSopenharmony_ci * @param { number } endX - Indicates the x coordinate of the relative target point. 56061847f8eSopenharmony_ci * @param { number } endY - Indicates the y coordinate of the relative target point. 56161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 56261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 56361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 56461847f8eSopenharmony_ci * @since 12 56561847f8eSopenharmony_ci */ 56661847f8eSopenharmony_ci rCubicTo(ctrlX1: number, ctrlY1: number, ctrlX2: number, ctrlY2: number, endX: number, endY: number): void; 56761847f8eSopenharmony_ci 56861847f8eSopenharmony_ci /** 56961847f8eSopenharmony_ci * Adds contour created from point array, adding (count - 1) line segments. 57061847f8eSopenharmony_ci * @param { Array<common2D.Point> } points - Indicates the point array. 57161847f8eSopenharmony_ci * @param { boolean } close - Indicates Whether to add lines that connect the end and start. 57261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 57361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 57461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 57561847f8eSopenharmony_ci * @since 12 57661847f8eSopenharmony_ci */ 57761847f8eSopenharmony_ci addPolygon(points: Array<common2D.Point>, close: boolean): void; 57861847f8eSopenharmony_ci 57961847f8eSopenharmony_ci /** 58061847f8eSopenharmony_ci * Combines two paths. 58161847f8eSopenharmony_ci * @param { Path } path - Indicates the Path object. 58261847f8eSopenharmony_ci * @param { PathOp } pathOp - Indicates the operator to apply path. 58361847f8eSopenharmony_ci * @returns { boolean } boolean - Returns true if constructed path is not empty; returns false otherwise. 58461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 58561847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 58661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 58761847f8eSopenharmony_ci * @since 12 58861847f8eSopenharmony_ci */ 58961847f8eSopenharmony_ci op(path: Path, pathOp: PathOp): boolean; 59061847f8eSopenharmony_ci 59161847f8eSopenharmony_ci /** 59261847f8eSopenharmony_ci * Appends arc to path, as the start of new contour. 59361847f8eSopenharmony_ci * Arc added is part of ellipse bounded by oval, from startAngle through sweepAngle. 59461847f8eSopenharmony_ci * @param { common2D.Rect } rect - The bounds of the arc is described by a rect. 59561847f8eSopenharmony_ci * @param { number } startAngle - Indicates the starting angle of arc in degrees. 59661847f8eSopenharmony_ci * @param { number } sweepAngle - Indicates the sweep, in degrees. Positive is clockwise. 59761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 59861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 59961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 60061847f8eSopenharmony_ci * @since 12 60161847f8eSopenharmony_ci */ 60261847f8eSopenharmony_ci addArc(rect: common2D.Rect, startAngle: number, sweepAngle: number): void; 60361847f8eSopenharmony_ci 60461847f8eSopenharmony_ci /** 60561847f8eSopenharmony_ci * Adds a circle to the path, and wound in the specified direction. 60661847f8eSopenharmony_ci * @param { number } x - Indicates the x coordinate of the center of the circle. 60761847f8eSopenharmony_ci * @param { number } y - Indicates the y coordinate of the center of the circle. 60861847f8eSopenharmony_ci * @param { number } radius - Indicates the radius of the circle. 60961847f8eSopenharmony_ci * @param { PathDirection } pathDirection - The default value is CLOCKWISE. 61061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 61161847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 61261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 61361847f8eSopenharmony_ci * @since 12 61461847f8eSopenharmony_ci */ 61561847f8eSopenharmony_ci addCircle(x: number, y: number, radius: number, pathDirection?: PathDirection): void; 61661847f8eSopenharmony_ci 61761847f8eSopenharmony_ci /** 61861847f8eSopenharmony_ci * Adds a oval to the path, defined by the rect, and wound in the specified direction. 61961847f8eSopenharmony_ci * @param { common2D.Rect } rect - The bounds of the oval is described by a rect. 62061847f8eSopenharmony_ci * @param { number } start - Indicates the index of initial point of ellipse. 62161847f8eSopenharmony_ci * @param { PathDirection } pathDirection - The default value is CLOCKWISE. 62261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 62361847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 62461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 62561847f8eSopenharmony_ci * @since 12 62661847f8eSopenharmony_ci */ 62761847f8eSopenharmony_ci addOval(rect: common2D.Rect, start: number, pathDirection?: PathDirection): void; 62861847f8eSopenharmony_ci 62961847f8eSopenharmony_ci /** 63061847f8eSopenharmony_ci * Adds a new contour to the path, defined by the rect, and wound in the specified direction. 63161847f8eSopenharmony_ci * @param { common2D.Rect } rect - Indicates the Rect object. 63261847f8eSopenharmony_ci * @param { PathDirection } pathDirection - The default value is CLOCKWISE. 63361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 63461847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 63561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 63661847f8eSopenharmony_ci * @since 12 63761847f8eSopenharmony_ci */ 63861847f8eSopenharmony_ci addRect(rect: common2D.Rect, pathDirection?: PathDirection): void; 63961847f8eSopenharmony_ci 64061847f8eSopenharmony_ci /** 64161847f8eSopenharmony_ci * Adds a new contour to the path, defined by the round rect, and wound in the specified direction. 64261847f8eSopenharmony_ci * @param { RoundRect } roundRect - Indicates the RoundRect object. 64361847f8eSopenharmony_ci * @param { PathDirection } pathDirection - The default value is CLOCKWISE. 64461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 64561847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 64661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 64761847f8eSopenharmony_ci * @since 12 64861847f8eSopenharmony_ci */ 64961847f8eSopenharmony_ci addRoundRect(roundRect: RoundRect, pathDirection?: PathDirection): void; 65061847f8eSopenharmony_ci 65161847f8eSopenharmony_ci /** 65261847f8eSopenharmony_ci * Appends src path to path, transformed by matrix. 65361847f8eSopenharmony_ci * @param { Path } path - Indicates the Path object. 65461847f8eSopenharmony_ci * @param { Matrix | null } matrix - Indicates transform applied to path. The default value is null. 65561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 65661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 65761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 65861847f8eSopenharmony_ci * @since 12 65961847f8eSopenharmony_ci */ 66061847f8eSopenharmony_ci addPath(path: Path, matrix?: Matrix | null): void; 66161847f8eSopenharmony_ci 66261847f8eSopenharmony_ci /** 66361847f8eSopenharmony_ci * Path is replaced by transformed data. 66461847f8eSopenharmony_ci * @param { Matrix } matrix - Indicates transform applied to path. 66561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 66661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 66761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 66861847f8eSopenharmony_ci * @since 12 66961847f8eSopenharmony_ci */ 67061847f8eSopenharmony_ci transform(matrix: Matrix): void; 67161847f8eSopenharmony_ci 67261847f8eSopenharmony_ci /** 67361847f8eSopenharmony_ci * Returns the status that point (x, y) is contained by path. 67461847f8eSopenharmony_ci * @param { number } x - Indicates the x-axis value of containment test. 67561847f8eSopenharmony_ci * @param { number } y - Indicates the y-axis value of containment test. 67661847f8eSopenharmony_ci * @returns { boolean } Returns true if the point (x, y) is contained by path; returns false otherwise. 67761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 67861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 67961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 68061847f8eSopenharmony_ci * @since 12 68161847f8eSopenharmony_ci */ 68261847f8eSopenharmony_ci contains(x: number, y: number): boolean; 68361847f8eSopenharmony_ci 68461847f8eSopenharmony_ci /** 68561847f8eSopenharmony_ci * Sets fill type, the rule used to fill path. 68661847f8eSopenharmony_ci * @param { PathFillType } pathFillType - Indicates the enum path fill type. 68761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 68861847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 68961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 69061847f8eSopenharmony_ci * @since 12 69161847f8eSopenharmony_ci */ 69261847f8eSopenharmony_ci setFillType(pathFillType: PathFillType): void; 69361847f8eSopenharmony_ci 69461847f8eSopenharmony_ci /** 69561847f8eSopenharmony_ci * Gets the smallest bounding box that contains the path. 69661847f8eSopenharmony_ci * @returns { common2D.Rect } Rect object. 69761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 69861847f8eSopenharmony_ci * @since 12 69961847f8eSopenharmony_ci */ 70061847f8eSopenharmony_ci getBounds(): common2D.Rect; 70161847f8eSopenharmony_ci 70261847f8eSopenharmony_ci /** 70361847f8eSopenharmony_ci * Closes a path. A line segment from the start point to the last point of the path is added. 70461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 70561847f8eSopenharmony_ci * @since 11 70661847f8eSopenharmony_ci */ 70761847f8eSopenharmony_ci close(): void; 70861847f8eSopenharmony_ci 70961847f8eSopenharmony_ci /** 71061847f8eSopenharmony_ci * Offsets point array by (dx, dy). Path is replaced by offset data. 71161847f8eSopenharmony_ci * @param { number } dx - Indicates offset added to dst path x-axis coordinates. 71261847f8eSopenharmony_ci * @param { number } dy - Indicates offset added to dst path y-axis coordinates. 71361847f8eSopenharmony_ci * @returns { Path } Returns a new Path object. 71461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 71561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 71661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 71761847f8eSopenharmony_ci * @since 12 71861847f8eSopenharmony_ci */ 71961847f8eSopenharmony_ci offset(dx: number, dy: number): Path; 72061847f8eSopenharmony_ci 72161847f8eSopenharmony_ci /** 72261847f8eSopenharmony_ci * Resets path data. 72361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 72461847f8eSopenharmony_ci * @since 11 72561847f8eSopenharmony_ci */ 72661847f8eSopenharmony_ci reset(): void; 72761847f8eSopenharmony_ci 72861847f8eSopenharmony_ci /** 72961847f8eSopenharmony_ci * Get path length. 73061847f8eSopenharmony_ci * @param { boolean } forceClosed - Whether to close the Path. 73161847f8eSopenharmony_ci * @returns { number } Return path length. 73261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 73361847f8eSopenharmony_ci * @since 12 73461847f8eSopenharmony_ci */ 73561847f8eSopenharmony_ci getLength(forceClosed: boolean): number; 73661847f8eSopenharmony_ci 73761847f8eSopenharmony_ci /** 73861847f8eSopenharmony_ci * Gets the position and tangent of the distance from the starting position of the path. 73961847f8eSopenharmony_ci * 74061847f8eSopenharmony_ci * @param { boolean } forceClosed - Whether to close the path. 74161847f8eSopenharmony_ci * @param { number } distance - The distance from the start of the path, should be greater than 0 and less than 'GetLength()' 74261847f8eSopenharmony_ci * @param { common2D.Point } position - Sets to the position of distance from the starting position of the path. 74361847f8eSopenharmony_ci * @param { common2D.Point } tangent - Sets to the tangent of distance from the starting position of the path. 74461847f8eSopenharmony_ci * @returns { boolean } - Returns true if succeeded, otherwise false. 74561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 74661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 74761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 74861847f8eSopenharmony_ci * @since 12 74961847f8eSopenharmony_ci */ 75061847f8eSopenharmony_ci getPositionAndTangent(forceClosed: boolean, distance: number, position: common2D.Point, tangent: common2D.Point): boolean; 75161847f8eSopenharmony_ci 75261847f8eSopenharmony_ci /** 75361847f8eSopenharmony_ci * Determines whether the current contour is closed. 75461847f8eSopenharmony_ci * 75561847f8eSopenharmony_ci * @returns { boolean } - Returns true if the current contour is closed, otherwise false. 75661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 75761847f8eSopenharmony_ci * @since 12 75861847f8eSopenharmony_ci */ 75961847f8eSopenharmony_ci isClosed(): boolean; 76061847f8eSopenharmony_ci 76161847f8eSopenharmony_ci /** 76261847f8eSopenharmony_ci * Computes the corresponding matrix at the specified distance. 76361847f8eSopenharmony_ci * 76461847f8eSopenharmony_ci * @param { boolean } forceClosed - Whether to close the path. 76561847f8eSopenharmony_ci * @param { number } distance - The distance from the start of the path. 76661847f8eSopenharmony_ci * @param { Matrix } matrix - Indicates the pointer to an Matrix object. 76761847f8eSopenharmony_ci * @param { PathMeasureMatrixFlags } flags - Indicates what should be returned in the matrix. 76861847f8eSopenharmony_ci * @returns { boolean } - Returns false if there is no path, or a zero-length path was specified, in which case matrix is unchanged. 76961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: Mandatory parameters are left unspecified. 77061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 77161847f8eSopenharmony_ci * @since 12 77261847f8eSopenharmony_ci */ 77361847f8eSopenharmony_ci getMatrix(forceClosed: boolean, distance: number, matrix: Matrix, flags: PathMeasureMatrixFlags): boolean; 77461847f8eSopenharmony_ci 77561847f8eSopenharmony_ci /** 77661847f8eSopenharmony_ci * Parses the SVG format string that describes the drawing path, and sets the path. 77761847f8eSopenharmony_ci * 77861847f8eSopenharmony_ci * @param { string } str - A string in SVG format that describes the drawing path. 77961847f8eSopenharmony_ci * @returns { boolean } true if build succeeded, otherwise false. 78061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: Mandatory parameters are left unspecified. 78161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 78261847f8eSopenharmony_ci * @since 12 78361847f8eSopenharmony_ci */ 78461847f8eSopenharmony_ci buildFromSvgString(str: string): boolean; 78561847f8eSopenharmony_ci } 78661847f8eSopenharmony_ci 78761847f8eSopenharmony_ci /** 78861847f8eSopenharmony_ci * Enumerates of scale to fit flags, selects if an array of points are drawn as discrete points, 78961847f8eSopenharmony_ci * as lines, or as an open polygon. 79061847f8eSopenharmony_ci * @enum { number } 79161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 79261847f8eSopenharmony_ci * @since 12 79361847f8eSopenharmony_ci */ 79461847f8eSopenharmony_ci enum PointMode { 79561847f8eSopenharmony_ci /** 79661847f8eSopenharmony_ci * Draws each point separately. 79761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 79861847f8eSopenharmony_ci * @since 12 79961847f8eSopenharmony_ci */ 80061847f8eSopenharmony_ci POINTS = 0, 80161847f8eSopenharmony_ci 80261847f8eSopenharmony_ci /** 80361847f8eSopenharmony_ci * Draws each pair of points as a line segment. 80461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 80561847f8eSopenharmony_ci * @since 12 80661847f8eSopenharmony_ci */ 80761847f8eSopenharmony_ci LINES = 1, 80861847f8eSopenharmony_ci 80961847f8eSopenharmony_ci /** 81061847f8eSopenharmony_ci * Draws the array of points as a open polygon. 81161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 81261847f8eSopenharmony_ci * @since 12 81361847f8eSopenharmony_ci */ 81461847f8eSopenharmony_ci POLYGON = 2, 81561847f8eSopenharmony_ci } 81661847f8eSopenharmony_ci 81761847f8eSopenharmony_ci /** 81861847f8eSopenharmony_ci * Enumerates storage filter mode. 81961847f8eSopenharmony_ci * @enum { number } 82061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 82161847f8eSopenharmony_ci * @since 12 82261847f8eSopenharmony_ci */ 82361847f8eSopenharmony_ci enum FilterMode { 82461847f8eSopenharmony_ci /** 82561847f8eSopenharmony_ci * Single sample point (nearest neighbor). 82661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 82761847f8eSopenharmony_ci * @since 12 82861847f8eSopenharmony_ci */ 82961847f8eSopenharmony_ci FILTER_MODE_NEAREST = 0, 83061847f8eSopenharmony_ci 83161847f8eSopenharmony_ci /** 83261847f8eSopenharmony_ci * Interpolate between 2x2 sample points (bilinear interpolation). 83361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 83461847f8eSopenharmony_ci * @since 12 83561847f8eSopenharmony_ci */ 83661847f8eSopenharmony_ci FILTER_MODE_LINEAR = 1, 83761847f8eSopenharmony_ci } 83861847f8eSopenharmony_ci 83961847f8eSopenharmony_ci /** 84061847f8eSopenharmony_ci * Enumerates of shadow flags. 84161847f8eSopenharmony_ci * @enum { number } 84261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 84361847f8eSopenharmony_ci * @since 12 84461847f8eSopenharmony_ci */ 84561847f8eSopenharmony_ci enum ShadowFlag { 84661847f8eSopenharmony_ci /** 84761847f8eSopenharmony_ci * Use no shadow flags. 84861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 84961847f8eSopenharmony_ci * @since 12 85061847f8eSopenharmony_ci */ 85161847f8eSopenharmony_ci NONE = 0, 85261847f8eSopenharmony_ci 85361847f8eSopenharmony_ci /** 85461847f8eSopenharmony_ci * The occluding object is transparent. 85561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 85661847f8eSopenharmony_ci * @since 12 85761847f8eSopenharmony_ci */ 85861847f8eSopenharmony_ci TRANSPARENT_OCCLUDER = 1, 85961847f8eSopenharmony_ci 86061847f8eSopenharmony_ci /** 86161847f8eSopenharmony_ci * No need to analyze shadows. 86261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 86361847f8eSopenharmony_ci * @since 12 86461847f8eSopenharmony_ci */ 86561847f8eSopenharmony_ci GEOMETRIC_ONLY = 2, 86661847f8eSopenharmony_ci 86761847f8eSopenharmony_ci /** 86861847f8eSopenharmony_ci * Use all shadow flags. 86961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 87061847f8eSopenharmony_ci * @since 12 87161847f8eSopenharmony_ci */ 87261847f8eSopenharmony_ci ALL = 3, 87361847f8eSopenharmony_ci } 87461847f8eSopenharmony_ci 87561847f8eSopenharmony_ci /** 87661847f8eSopenharmony_ci * Provides an interface to the drawing, and samplingOptions used when sampling from the image. 87761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 87861847f8eSopenharmony_ci * @since 12 87961847f8eSopenharmony_ci */ 88061847f8eSopenharmony_ci class SamplingOptions { 88161847f8eSopenharmony_ci /** 88261847f8eSopenharmony_ci * Constructor for the samplingOptions. 88361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 88461847f8eSopenharmony_ci * @since 12 88561847f8eSopenharmony_ci */ 88661847f8eSopenharmony_ci constructor(); 88761847f8eSopenharmony_ci /** 88861847f8eSopenharmony_ci * Constructor for the samplingOptions with filter mode. 88961847f8eSopenharmony_ci * @param { FilterMode } filterMode - Storage filter mode. 89061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 89161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 89261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 89361847f8eSopenharmony_ci * @since 12 89461847f8eSopenharmony_ci */ 89561847f8eSopenharmony_ci constructor(filterMode: FilterMode); 89661847f8eSopenharmony_ci } 89761847f8eSopenharmony_ci 89861847f8eSopenharmony_ci /** 89961847f8eSopenharmony_ci * Provides an interface to the drawing, and how to clip and transform the drawing. 90061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 90161847f8eSopenharmony_ci * @since 11 90261847f8eSopenharmony_ci */ 90361847f8eSopenharmony_ci class Canvas { 90461847f8eSopenharmony_ci /** 90561847f8eSopenharmony_ci * Constructor for the Canvas. 90661847f8eSopenharmony_ci * @param { image.PixelMap } pixelmap - PixelMap. 90761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 90861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 90961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 91061847f8eSopenharmony_ci * @since 11 91161847f8eSopenharmony_ci */ 91261847f8eSopenharmony_ci constructor(pixelmap: image.PixelMap); 91361847f8eSopenharmony_ci 91461847f8eSopenharmony_ci /** 91561847f8eSopenharmony_ci * If rectangle is stroked, use pen to stroke width describes the line thickness, 91661847f8eSopenharmony_ci * else use brush to fill the rectangle. 91761847f8eSopenharmony_ci * @param { common2D.Rect } rect - Rectangle to draw. 91861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 91961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 92061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 92161847f8eSopenharmony_ci * @since 11 92261847f8eSopenharmony_ci */ 92361847f8eSopenharmony_ci drawRect(rect: common2D.Rect): void; 92461847f8eSopenharmony_ci 92561847f8eSopenharmony_ci /** 92661847f8eSopenharmony_ci * If rectangle is stroked, use pen to stroke width describes the line thickness, 92761847f8eSopenharmony_ci * else use brush to fill the rectangle. 92861847f8eSopenharmony_ci * @param { number } left - Indicates the left position of the rectangle. 92961847f8eSopenharmony_ci * @param { number } top - Indicates the top position of the rectangle. 93061847f8eSopenharmony_ci * @param { number } right - Indicates the right position of the rectangle. 93161847f8eSopenharmony_ci * @param { number } bottom - Indicates the bottom position of the rectangle. 93261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 93361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 93461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 93561847f8eSopenharmony_ci * @since 12 93661847f8eSopenharmony_ci */ 93761847f8eSopenharmony_ci drawRect(left: number, top: number, right: number, bottom: number): void; 93861847f8eSopenharmony_ci 93961847f8eSopenharmony_ci /** 94061847f8eSopenharmony_ci * Draws a RoundRect. 94161847f8eSopenharmony_ci * @param { RoundRect } roundRect - Indicates the RectRound object. 94261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 94361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 94461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 94561847f8eSopenharmony_ci * @since 12 94661847f8eSopenharmony_ci */ 94761847f8eSopenharmony_ci drawRoundRect(roundRect: RoundRect): void; 94861847f8eSopenharmony_ci 94961847f8eSopenharmony_ci /** 95061847f8eSopenharmony_ci * Draws a nested RoundRect. 95161847f8eSopenharmony_ci * @param { RoundRect } outer - Indicates the outer RectRound object. 95261847f8eSopenharmony_ci * @param { RoundRect } inner - Indicates the inner RectRound object. 95361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 95461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 95561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 95661847f8eSopenharmony_ci * @since 12 95761847f8eSopenharmony_ci */ 95861847f8eSopenharmony_ci drawNestedRoundRect(outer: RoundRect, inner: RoundRect): void; 95961847f8eSopenharmony_ci 96061847f8eSopenharmony_ci /** 96161847f8eSopenharmony_ci * Fills clipped canvas area with brush. 96261847f8eSopenharmony_ci * @param { Brush } brush - Indicates the Brush object. 96361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 96461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 96561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 96661847f8eSopenharmony_ci * @since 12 96761847f8eSopenharmony_ci */ 96861847f8eSopenharmony_ci drawBackground(brush: Brush): void; 96961847f8eSopenharmony_ci 97061847f8eSopenharmony_ci /** 97161847f8eSopenharmony_ci * Draws an offset spot shadow and outlining ambient shadow for the given path with circular light. 97261847f8eSopenharmony_ci * @param { Path } path - Indicates the Path object. 97361847f8eSopenharmony_ci * @param { common2D.Point3d } planeParams - Represents z offset of the occluder from the canvas based on x and y. 97461847f8eSopenharmony_ci * @param { common2D.Point3d } devLightPos - Represents the position of the light relative to the canvas. 97561847f8eSopenharmony_ci * @param { number } lightRadius - The radius of the circular light. 97661847f8eSopenharmony_ci * @param { common2D.Color } ambientColor - Ambient shadow's color. 97761847f8eSopenharmony_ci * @param { common2D.Color } spotColor - Spot shadow's color. 97861847f8eSopenharmony_ci * @param { ShadowFlag } flag - Indicates the flag to control opaque occluder, shadow, and light position. 97961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 98061847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 98161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 98261847f8eSopenharmony_ci * @since 12 98361847f8eSopenharmony_ci */ 98461847f8eSopenharmony_ci drawShadow(path: Path, planeParams: common2D.Point3d, devLightPos: common2D.Point3d, lightRadius: number, 98561847f8eSopenharmony_ci ambientColor: common2D.Color, spotColor: common2D.Color, flag: ShadowFlag) : void; 98661847f8eSopenharmony_ci 98761847f8eSopenharmony_ci /** 98861847f8eSopenharmony_ci * Draws an offset spot shadow and outlining ambient shadow for the given path with circular light. 98961847f8eSopenharmony_ci * In this function, the input of the parameter 'ambientColor' and 'spotColor' should be number 99061847f8eSopenharmony_ci * @param { Path } path - Indicates the Path object. 99161847f8eSopenharmony_ci * @param { common2D.Point3d } planeParams - Represents z offset of the occluder from the canvas based on x and y. 99261847f8eSopenharmony_ci * @param { common2D.Point3d } devLightPos - Represents the position of the light relative to the canvas. 99361847f8eSopenharmony_ci * @param { number } lightRadius - The radius of the circular light. 99461847f8eSopenharmony_ci * @param { number } ambientColor - Ambient shadow's color represented by ARGB color of hexadecimal format. 99561847f8eSopenharmony_ci * @param { number } spotColor - Spot shadow's color represented by ARGB color of hexadecimal format. 99661847f8eSopenharmony_ci * @param { ShadowFlag } flag - Indicates the flag to control opaque occluder, shadow, and light position. 99761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 99861847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 99961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 100061847f8eSopenharmony_ci * @since 13 100161847f8eSopenharmony_ci */ 100261847f8eSopenharmony_ci drawShadow(path: Path, planeParams: common2D.Point3d, devLightPos: common2D.Point3d, lightRadius: number, 100361847f8eSopenharmony_ci ambientColor: number, spotColor: number, flag: ShadowFlag) : void; 100461847f8eSopenharmony_ci 100561847f8eSopenharmony_ci /** 100661847f8eSopenharmony_ci * If radius is zero or less, nothing is drawn. If circle is stroked, use pen to 100761847f8eSopenharmony_ci * stroke width describes the line thickness, else use brush to fill the circle. 100861847f8eSopenharmony_ci * @param { number } x - X coordinate of the circle center. 100961847f8eSopenharmony_ci * @param { number } y - Y coordinate of the circle center. 101061847f8eSopenharmony_ci * @param { number } radius - The radius of the circle must be greater than 0. 101161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 101261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 101361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 101461847f8eSopenharmony_ci * @since 11 101561847f8eSopenharmony_ci */ 101661847f8eSopenharmony_ci drawCircle(x: number, y: number, radius: number): void; 101761847f8eSopenharmony_ci 101861847f8eSopenharmony_ci /** 101961847f8eSopenharmony_ci * Draw a pixelmap, with the upper left corner at (left, top). 102061847f8eSopenharmony_ci * @param { image.PixelMap } pixelmap - PixelMap. 102161847f8eSopenharmony_ci * @param { number } left - Left side of image. 102261847f8eSopenharmony_ci * @param { number } top - Top side of image. 102361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 102461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 102561847f8eSopenharmony_ci * @since 11 102661847f8eSopenharmony_ci */ 102761847f8eSopenharmony_ci /** 102861847f8eSopenharmony_ci * Draw a pixelmap, with the upper left corner at (left, top). 102961847f8eSopenharmony_ci * @param { image.PixelMap } pixelmap - PixelMap. 103061847f8eSopenharmony_ci * @param { number } left - Left side of image. 103161847f8eSopenharmony_ci * @param { number } top - Top side of image. 103261847f8eSopenharmony_ci * @param { SamplingOptions } samplingOptions - SamplingOptions used to describe the sampling mode. 103361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 103461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 103561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 103661847f8eSopenharmony_ci * @since 12 103761847f8eSopenharmony_ci */ 103861847f8eSopenharmony_ci drawImage(pixelmap: image.PixelMap, left: number, top: number, samplingOptions?: SamplingOptions): void; 103961847f8eSopenharmony_ci 104061847f8eSopenharmony_ci /** 104161847f8eSopenharmony_ci * Draws the specified source image onto the canvas, 104261847f8eSopenharmony_ci * scaled and translated to the destination rectangle. 104361847f8eSopenharmony_ci * @param { image.PixelMap } pixelmap - The source image. 104461847f8eSopenharmony_ci * @param { common2D.Rect } dstRect - The area of destination canvas. 104561847f8eSopenharmony_ci * @param { SamplingOptions } samplingOptions - SamplingOptions used to describe the sampling mode. 104661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 104761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 104861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 104961847f8eSopenharmony_ci * @since 12 105061847f8eSopenharmony_ci */ 105161847f8eSopenharmony_ci drawImageRect(pixelmap: image.PixelMap, dstRect: common2D.Rect, samplingOptions?: SamplingOptions): void; 105261847f8eSopenharmony_ci 105361847f8eSopenharmony_ci /** 105461847f8eSopenharmony_ci * Draws the specified source rectangle of the image onto the canvas, 105561847f8eSopenharmony_ci * scaled and translated to the destination rectangle. 105661847f8eSopenharmony_ci * @param { image.PixelMap } pixelmap - The source image. 105761847f8eSopenharmony_ci * @param { common2D.Rect } srcRect - The area of source image. 105861847f8eSopenharmony_ci * @param { common2D.Rect } dstRect - The area of destination canvas. 105961847f8eSopenharmony_ci * @param { SamplingOptions } samplingOptions - SamplingOptions used to describe the sampling mode. 106061847f8eSopenharmony_ci * @param { SrcRectConstraint } constraint - Constraint type. The default value is STRICT. 106161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 106261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 106361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 106461847f8eSopenharmony_ci * @since 12 106561847f8eSopenharmony_ci */ 106661847f8eSopenharmony_ci drawImageRectWithSrc(pixelmap: image.PixelMap, srcRect: common2D.Rect, dstRect: common2D.Rect, 106761847f8eSopenharmony_ci samplingOptions?: SamplingOptions, constraint?: SrcRectConstraint): void; 106861847f8eSopenharmony_ci 106961847f8eSopenharmony_ci /** 107061847f8eSopenharmony_ci * Fills clip with color color. Mode determines how ARGB is combined with destination. 107161847f8eSopenharmony_ci * @param { common2D.Color } color - The range of color channels must be [0, 255]. 107261847f8eSopenharmony_ci * @param { BlendMode } blendMode - Used to combine source color and destination. The default value is SRC_OVER. 107361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 107461847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 107561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 107661847f8eSopenharmony_ci * @since 11 107761847f8eSopenharmony_ci */ 107861847f8eSopenharmony_ci drawColor(color: common2D.Color, blendMode?: BlendMode): void; 107961847f8eSopenharmony_ci 108061847f8eSopenharmony_ci /** 108161847f8eSopenharmony_ci * Fills clip with the specified ARGB color of hexadecimal format. 108261847f8eSopenharmony_ci * @param { number } color - Number must be ARGB color of hexadecimal format. 108361847f8eSopenharmony_ci * @param { BlendMode } blendMode - Used to combine source color and destination. The default value is SRC_OVER. 108461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 108561847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 108661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 108761847f8eSopenharmony_ci * @since 13 108861847f8eSopenharmony_ci */ 108961847f8eSopenharmony_ci drawColor(color: number, blendMode?: BlendMode): void; 109061847f8eSopenharmony_ci 109161847f8eSopenharmony_ci /** 109261847f8eSopenharmony_ci * Fills the clipped rectangle with the specified ARGB color. 109361847f8eSopenharmony_ci * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255]. 109461847f8eSopenharmony_ci * @param { number } red - Red channel of color. The range of red must be [0, 255]. 109561847f8eSopenharmony_ci * @param { number } green - Green channel of color. The range of green must be [0, 255]. 109661847f8eSopenharmony_ci * @param { number } blue - Blue channel of color. The range of blue must be [0, 255]. 109761847f8eSopenharmony_ci * @param { BlendMode } blendMode - Used to combine source color and destination. The default value is SRC_OVER. 109861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 109961847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 110061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 110161847f8eSopenharmony_ci * @since 12 110261847f8eSopenharmony_ci */ 110361847f8eSopenharmony_ci drawColor(alpha: number, red: number, green: number, blue: number, blendMode?: BlendMode): void; 110461847f8eSopenharmony_ci 110561847f8eSopenharmony_ci /** 110661847f8eSopenharmony_ci * Draws an oval. 110761847f8eSopenharmony_ci * @param { common2D.Rect } oval - The bounds of the oval is described by a rect. 110861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 110961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 111061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 111161847f8eSopenharmony_ci * @since 12 111261847f8eSopenharmony_ci */ 111361847f8eSopenharmony_ci drawOval(oval: common2D.Rect): void; 111461847f8eSopenharmony_ci 111561847f8eSopenharmony_ci /** 111661847f8eSopenharmony_ci * Draws an arc. 111761847f8eSopenharmony_ci * @param { common2D.Rect } arc - The bounds of the arc is described by a rect. 111861847f8eSopenharmony_ci * @param { number } startAngle - Indicates the startAngle of the arc. 111961847f8eSopenharmony_ci * @param { number } sweepAngle - Indicates the sweepAngle of the arc. 112061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 112161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 112261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 112361847f8eSopenharmony_ci * @since 12 112461847f8eSopenharmony_ci */ 112561847f8eSopenharmony_ci drawArc(arc: common2D.Rect, startAngle: number, sweepAngle: number): void; 112661847f8eSopenharmony_ci 112761847f8eSopenharmony_ci /** 112861847f8eSopenharmony_ci * Draw a point. 112961847f8eSopenharmony_ci * @param { number } x - X coordinate position of the point. 113061847f8eSopenharmony_ci * @param { number } y - Y coordinate position of the point. 113161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 113261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 113361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 113461847f8eSopenharmony_ci * @since 11 113561847f8eSopenharmony_ci */ 113661847f8eSopenharmony_ci drawPoint(x: number, y: number): void; 113761847f8eSopenharmony_ci 113861847f8eSopenharmony_ci /** 113961847f8eSopenharmony_ci * Draws point array as separate point, line segment or open polygon according to given point mode. 114061847f8eSopenharmony_ci * @param { Array<common2D.Point> } points - Points array. 114161847f8eSopenharmony_ci * @param { PointMode } mode - Draws points enum method. The default value is POINTS. 114261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 114361847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 114461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 114561847f8eSopenharmony_ci * @since 12 114661847f8eSopenharmony_ci */ 114761847f8eSopenharmony_ci drawPoints(points: Array<common2D.Point>, mode?: PointMode): void; 114861847f8eSopenharmony_ci 114961847f8eSopenharmony_ci /** 115061847f8eSopenharmony_ci * Draws a path. 115161847f8eSopenharmony_ci * @param { Path } path - Path to draw. 115261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 115361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 115461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 115561847f8eSopenharmony_ci * @since 11 115661847f8eSopenharmony_ci */ 115761847f8eSopenharmony_ci drawPath(path: Path): void; 115861847f8eSopenharmony_ci 115961847f8eSopenharmony_ci /** 116061847f8eSopenharmony_ci * Draws line segment from startPt to endPt. 116161847f8eSopenharmony_ci * @param { number } x0 - X coordinate of the start point of the line segment. 116261847f8eSopenharmony_ci * @param { number } y0 - Y coordinate of the start point of the line segment. 116361847f8eSopenharmony_ci * @param { number } x1 - X coordinate of the end point of the line segment. 116461847f8eSopenharmony_ci * @param { number } y1 - Y coordinate of the end point of the line segment. 116561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 116661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 116761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 116861847f8eSopenharmony_ci * @since 11 116961847f8eSopenharmony_ci */ 117061847f8eSopenharmony_ci drawLine(x0: number, y0: number, x1: number, y1: number): void; 117161847f8eSopenharmony_ci 117261847f8eSopenharmony_ci /** 117361847f8eSopenharmony_ci * Draws a single character. 117461847f8eSopenharmony_ci * @param { string } text - A string containing only a single character. 117561847f8eSopenharmony_ci * @param { Font } font - Font object. 117661847f8eSopenharmony_ci * @param { number } x - X coordinate of the single character start point. 117761847f8eSopenharmony_ci * @param { number } y - Y coordinate of the single character start point. 117861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 117961847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 118061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 118161847f8eSopenharmony_ci * @since 12 118261847f8eSopenharmony_ci */ 118361847f8eSopenharmony_ci drawSingleCharacter(text: string, font: Font, x: number, y: number): void; 118461847f8eSopenharmony_ci 118561847f8eSopenharmony_ci /** 118661847f8eSopenharmony_ci * Draws a textBlob 118761847f8eSopenharmony_ci * @param { TextBlob } blob - TextBlob to draw. 118861847f8eSopenharmony_ci * @param { number } x - X coordinate of the text start point. 118961847f8eSopenharmony_ci * @param { number } y - Y coordinate of the text start point. 119061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 119161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 119261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 119361847f8eSopenharmony_ci * @since 11 119461847f8eSopenharmony_ci */ 119561847f8eSopenharmony_ci drawTextBlob(blob: TextBlob, x: number, y: number): void; 119661847f8eSopenharmony_ci 119761847f8eSopenharmony_ci /** 119861847f8eSopenharmony_ci * Draws the pixelmap base on the mesh which is evenly distributed across the pixelmap. 119961847f8eSopenharmony_ci * @param { image.PixelMap } pixelmap - The pixelmap to draw using the mesh. 120061847f8eSopenharmony_ci * @param { number } meshWidth - The number of columns in the mesh. 120161847f8eSopenharmony_ci * @param { number } meshHeight - The number of rows in the mesh. 120261847f8eSopenharmony_ci * @param { Array<number> } vertices - Array of vertices, specifying where the mesh should be drawn. 120361847f8eSopenharmony_ci * @param { number } vertOffset - Number of vert elements to skip before drawing. 120461847f8eSopenharmony_ci * @param { Array<number> } colors - Array of colors, specifying a color at each vertex. 120561847f8eSopenharmony_ci * @param { number } colorOffset - Number of color elements to skip before drawing. 120661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 120761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 120861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 120961847f8eSopenharmony_ci * @since 12 121061847f8eSopenharmony_ci */ 121161847f8eSopenharmony_ci drawPixelMapMesh(pixelmap: image.PixelMap, meshWidth: number, meshHeight: number, 121261847f8eSopenharmony_ci vertices: Array<number>, vertOffset: number, colors: Array<number>, colorOffset: number): void; 121361847f8eSopenharmony_ci 121461847f8eSopenharmony_ci /** 121561847f8eSopenharmony_ci * Draws a region. 121661847f8eSopenharmony_ci * @param { Region } region - Region object. 121761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 121861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 121961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 122061847f8eSopenharmony_ci * @since 12 122161847f8eSopenharmony_ci */ 122261847f8eSopenharmony_ci drawRegion(region: Region): void; 122361847f8eSopenharmony_ci 122461847f8eSopenharmony_ci /** 122561847f8eSopenharmony_ci * Set pen to a canvas. 122661847f8eSopenharmony_ci * @param { Pen } pen - object. 122761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 122861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 122961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 123061847f8eSopenharmony_ci * @since 11 123161847f8eSopenharmony_ci */ 123261847f8eSopenharmony_ci attachPen(pen: Pen): void; 123361847f8eSopenharmony_ci 123461847f8eSopenharmony_ci /** 123561847f8eSopenharmony_ci * Set brush to a canvas. 123661847f8eSopenharmony_ci * @param { Brush } brush - Object. 123761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 123861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 123961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 124061847f8eSopenharmony_ci * @since 11 124161847f8eSopenharmony_ci */ 124261847f8eSopenharmony_ci attachBrush(brush: Brush): void; 124361847f8eSopenharmony_ci 124461847f8eSopenharmony_ci /** 124561847f8eSopenharmony_ci * Unset pen to a canvas. 124661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 124761847f8eSopenharmony_ci * @since 11 124861847f8eSopenharmony_ci */ 124961847f8eSopenharmony_ci detachPen(): void; 125061847f8eSopenharmony_ci 125161847f8eSopenharmony_ci /** 125261847f8eSopenharmony_ci * Unset brush to a canvas. 125361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 125461847f8eSopenharmony_ci * @since 11 125561847f8eSopenharmony_ci */ 125661847f8eSopenharmony_ci detachBrush(): void; 125761847f8eSopenharmony_ci 125861847f8eSopenharmony_ci /** 125961847f8eSopenharmony_ci * Saves the current canvas status (canvas matrix) to the top of the stack. 126061847f8eSopenharmony_ci * @returns { number } Return the number of saved states. 126161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 126261847f8eSopenharmony_ci * @since 12 126361847f8eSopenharmony_ci */ 126461847f8eSopenharmony_ci save(): number; 126561847f8eSopenharmony_ci 126661847f8eSopenharmony_ci /** 126761847f8eSopenharmony_ci * Saves matrix and clip, and allocates a bitmap for subsequent drawing. 126861847f8eSopenharmony_ci * Calling restore discards changes to matrix and clip, and draws the bitmap. 126961847f8eSopenharmony_ci * @param { common2D.Rect | null} rect - Optional layer size. The default value is null. 127061847f8eSopenharmony_ci * @param { Brush | null} brush - Optional brush effect used to draw the layer. The default value is null. 127161847f8eSopenharmony_ci * @returns { number } Return the number of saved states before this call. 127261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: Mandatory parameters are left unspecified. 127361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 127461847f8eSopenharmony_ci * @since 12 127561847f8eSopenharmony_ci */ 127661847f8eSopenharmony_ci saveLayer(rect?: common2D.Rect | null, brush?: Brush | null): number; 127761847f8eSopenharmony_ci 127861847f8eSopenharmony_ci /** 127961847f8eSopenharmony_ci * Clears a canvas by using a specified color. 128061847f8eSopenharmony_ci * @param { common2D.Color } color - Indicates the color, which is a 32-bit (ARGB) variable. 128161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 128261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 128361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 128461847f8eSopenharmony_ci * @since 12 128561847f8eSopenharmony_ci */ 128661847f8eSopenharmony_ci clear(color: common2D.Color): void; 128761847f8eSopenharmony_ci 128861847f8eSopenharmony_ci /** 128961847f8eSopenharmony_ci * Clears a canvas by using a specified color represented by ARGB color of hexadecimal format. 129061847f8eSopenharmony_ci * @param { number } color - Number must be ARGB color of hexadecimal format. 129161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 129261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 129361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 129461847f8eSopenharmony_ci * @since 13 129561847f8eSopenharmony_ci */ 129661847f8eSopenharmony_ci clear(color: number): void; 129761847f8eSopenharmony_ci 129861847f8eSopenharmony_ci /** 129961847f8eSopenharmony_ci * Restores the canvas status (canvas matrix) saved on the top of the stack. 130061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 130161847f8eSopenharmony_ci * @since 12 130261847f8eSopenharmony_ci */ 130361847f8eSopenharmony_ci restore(): void; 130461847f8eSopenharmony_ci 130561847f8eSopenharmony_ci /** 130661847f8eSopenharmony_ci * Restores the specific number of the canvas status (canvas matrix) saved in the stack. 130761847f8eSopenharmony_ci * @param { number } count - Depth of state stack to restore. 130861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 130961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 131061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 131161847f8eSopenharmony_ci * @since 12 131261847f8eSopenharmony_ci */ 131361847f8eSopenharmony_ci restoreToCount(count: number): void; 131461847f8eSopenharmony_ci 131561847f8eSopenharmony_ci /** 131661847f8eSopenharmony_ci * Gets the number of the canvas status (canvas matrix) saved in the stack. 131761847f8eSopenharmony_ci * @returns { number } Return represent depth of save state stack. 131861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 131961847f8eSopenharmony_ci * @since 12 132061847f8eSopenharmony_ci */ 132161847f8eSopenharmony_ci getSaveCount(): number; 132261847f8eSopenharmony_ci 132361847f8eSopenharmony_ci /** 132461847f8eSopenharmony_ci * Gets the width of a canvas. 132561847f8eSopenharmony_ci * @returns { number } Return the width of a canvas. 132661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 132761847f8eSopenharmony_ci * @since 12 132861847f8eSopenharmony_ci */ 132961847f8eSopenharmony_ci getWidth(): number; 133061847f8eSopenharmony_ci 133161847f8eSopenharmony_ci /** 133261847f8eSopenharmony_ci * Gets the height of a canvas. 133361847f8eSopenharmony_ci * @returns { number } Return the height of a canvas. 133461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 133561847f8eSopenharmony_ci * @since 12 133661847f8eSopenharmony_ci */ 133761847f8eSopenharmony_ci getHeight(): number; 133861847f8eSopenharmony_ci 133961847f8eSopenharmony_ci /** 134061847f8eSopenharmony_ci * Gets the bounds of clip of a canvas. 134161847f8eSopenharmony_ci * @returns { common2D.Rect } Rect object. 134261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 134361847f8eSopenharmony_ci * @since 12 134461847f8eSopenharmony_ci */ 134561847f8eSopenharmony_ci getLocalClipBounds(): common2D.Rect; 134661847f8eSopenharmony_ci 134761847f8eSopenharmony_ci /** 134861847f8eSopenharmony_ci * Gets a 3x3 matrix of the transform from local coordinates to 'device'. 134961847f8eSopenharmony_ci * @returns { Matrix } Matrix object. 135061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 135161847f8eSopenharmony_ci * @since 12 135261847f8eSopenharmony_ci */ 135361847f8eSopenharmony_ci getTotalMatrix(): Matrix; 135461847f8eSopenharmony_ci 135561847f8eSopenharmony_ci /** 135661847f8eSopenharmony_ci * Scales by sx on the x-axis and sy on the y-axis. 135761847f8eSopenharmony_ci * @param { number } sx - Indicates the amount to scale on x-axis. 135861847f8eSopenharmony_ci * @param { number } sy - Indicates the amount to scale on y-axis. 135961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 136061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 136161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 136261847f8eSopenharmony_ci * @since 12 136361847f8eSopenharmony_ci */ 136461847f8eSopenharmony_ci scale(sx: number, sy: number): void; 136561847f8eSopenharmony_ci 136661847f8eSopenharmony_ci /** 136761847f8eSopenharmony_ci * Skews by sx on the x-axis and sy on the y-axis. 136861847f8eSopenharmony_ci * @param { number } sx - Indicates the value skew transformation on x-axis. 136961847f8eSopenharmony_ci * @param { number } sy - Indicates the value skew transformation on y-axis. 137061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 137161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 137261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 137361847f8eSopenharmony_ci * @since 12 137461847f8eSopenharmony_ci */ 137561847f8eSopenharmony_ci skew(sx: number, sy: number) : void; 137661847f8eSopenharmony_ci 137761847f8eSopenharmony_ci /** 137861847f8eSopenharmony_ci * Rotates by degrees, positive degrees rotates clockwise. 137961847f8eSopenharmony_ci * @param { number } degrees - Indicates the amount to rotate, in degrees. 138061847f8eSopenharmony_ci * @param { number } sx - Indicates the x-axis value of the point to rotate about. 138161847f8eSopenharmony_ci * @param { number } sy - Indicates the y-axis value of the point to rotate about. 138261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 138361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 138461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 138561847f8eSopenharmony_ci * @since 12 138661847f8eSopenharmony_ci */ 138761847f8eSopenharmony_ci rotate(degrees: number, sx: number, sy: number) : void; 138861847f8eSopenharmony_ci 138961847f8eSopenharmony_ci /** 139061847f8eSopenharmony_ci * Translates by dx along the x-axis and dy along the y-axis. 139161847f8eSopenharmony_ci * @param { number } dx - Indicates the distance to translate on x-axis. 139261847f8eSopenharmony_ci * @param { number } dy - Indicates the distance to translate on y-axis. 139361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 139461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 139561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 139661847f8eSopenharmony_ci * @since 12 139761847f8eSopenharmony_ci */ 139861847f8eSopenharmony_ci translate(dx: number, dy: number): void; 139961847f8eSopenharmony_ci 140061847f8eSopenharmony_ci /** 140161847f8eSopenharmony_ci * Replaces the clipping area with the intersection or difference of the current clipping area and path, 140261847f8eSopenharmony_ci * and use a clipping edge that is aliased or anti-aliased. 140361847f8eSopenharmony_ci * @param { Path } path - To combine with clip. 140461847f8eSopenharmony_ci * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect. 140561847f8eSopenharmony_ci * @param { boolean } doAntiAlias - True if clip is to be anti-aliased. The default value is false. 140661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 140761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 140861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 140961847f8eSopenharmony_ci * @since 12 141061847f8eSopenharmony_ci */ 141161847f8eSopenharmony_ci clipPath(path: Path, clipOp?: ClipOp, doAntiAlias?: boolean): void; 141261847f8eSopenharmony_ci 141361847f8eSopenharmony_ci /** 141461847f8eSopenharmony_ci * Replaces the clipping area with the intersection or difference between the 141561847f8eSopenharmony_ci * current clipping area and Rect, and use a clipping edge that is aliased or anti-aliased. 141661847f8eSopenharmony_ci * @param { common2D.Rect } rect - To combine with clipping area. 141761847f8eSopenharmony_ci * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect. 141861847f8eSopenharmony_ci * @param { boolean } doAntiAlias - True if clip is to be anti-aliased. The default value is false. 141961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 142061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 142161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 142261847f8eSopenharmony_ci * @since 12 142361847f8eSopenharmony_ci */ 142461847f8eSopenharmony_ci clipRect(rect: common2D.Rect, clipOp?: ClipOp, doAntiAlias?: boolean): void; 142561847f8eSopenharmony_ci 142661847f8eSopenharmony_ci /** 142761847f8eSopenharmony_ci * Uses the passed matrix to transforming the geometry, then use existing matrix. 142861847f8eSopenharmony_ci * @param { Matrix } matrix - Declares functions related to the matrix object in the drawing module. 142961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 143061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 143161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 143261847f8eSopenharmony_ci * @since 12 143361847f8eSopenharmony_ci */ 143461847f8eSopenharmony_ci concatMatrix(matrix: Matrix): void; 143561847f8eSopenharmony_ci 143661847f8eSopenharmony_ci /** 143761847f8eSopenharmony_ci * Replace the clipping area with the intersection or difference of the 143861847f8eSopenharmony_ci * current clipping area and Region, and use a clipping edge that is aliased or anti-aliased. 143961847f8eSopenharmony_ci * @param { Region } region - Region object. 144061847f8eSopenharmony_ci * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect. 144161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 144261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 144361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 144461847f8eSopenharmony_ci * @since 12 144561847f8eSopenharmony_ci */ 144661847f8eSopenharmony_ci clipRegion(region: Region, clipOp?: ClipOp): void; 144761847f8eSopenharmony_ci 144861847f8eSopenharmony_ci /** 144961847f8eSopenharmony_ci * Replaces the clipping area with the intersection or difference between the 145061847f8eSopenharmony_ci * current clipping area and RoundRect, and use a clipping edge that is aliased or anti-aliased. 145161847f8eSopenharmony_ci * @param { RoundRect } roundRect - To combine with clipping area. 145261847f8eSopenharmony_ci * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect. 145361847f8eSopenharmony_ci * @param { boolean } doAntiAlias - True if clip is to be anti-aliased. The default value is false. 145461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 145561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 145661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 145761847f8eSopenharmony_ci * @since 12 145861847f8eSopenharmony_ci */ 145961847f8eSopenharmony_ci clipRoundRect(roundRect: RoundRect, clipOp?: ClipOp, doAntiAlias?: boolean): void; 146061847f8eSopenharmony_ci 146161847f8eSopenharmony_ci /** 146261847f8eSopenharmony_ci * Checks whether the drawable area is empty. 146361847f8eSopenharmony_ci * @returns { boolean } Returns true if drawable area is empty. 146461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 146561847f8eSopenharmony_ci * @since 12 146661847f8eSopenharmony_ci */ 146761847f8eSopenharmony_ci isClipEmpty(): boolean; 146861847f8eSopenharmony_ci 146961847f8eSopenharmony_ci /** 147061847f8eSopenharmony_ci * Sets matrix of canvas. 147161847f8eSopenharmony_ci * @param { Matrix } matrix - Declares functions related to the matrix object in the drawing module. 147261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 147361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 147461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 147561847f8eSopenharmony_ci * @since 12 147661847f8eSopenharmony_ci */ 147761847f8eSopenharmony_ci setMatrix(matrix: Matrix): void; 147861847f8eSopenharmony_ci 147961847f8eSopenharmony_ci /** 148061847f8eSopenharmony_ci * Sets matrix of canvas to the identity matrix. 148161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 148261847f8eSopenharmony_ci * @since 12 148361847f8eSopenharmony_ci */ 148461847f8eSopenharmony_ci resetMatrix(): void; 148561847f8eSopenharmony_ci } 148661847f8eSopenharmony_ci 148761847f8eSopenharmony_ci /** 148861847f8eSopenharmony_ci * Enumerates clip operations. 148961847f8eSopenharmony_ci * 149061847f8eSopenharmony_ci * @enum { number } 149161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 149261847f8eSopenharmony_ci * @since 12 149361847f8eSopenharmony_ci */ 149461847f8eSopenharmony_ci enum ClipOp { 149561847f8eSopenharmony_ci /** 149661847f8eSopenharmony_ci * Clips with difference. 149761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 149861847f8eSopenharmony_ci * @since 12 149961847f8eSopenharmony_ci */ 150061847f8eSopenharmony_ci DIFFERENCE = 0, 150161847f8eSopenharmony_ci /** 150261847f8eSopenharmony_ci * Clips with intersection. 150361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 150461847f8eSopenharmony_ci * @since 12 150561847f8eSopenharmony_ci */ 150661847f8eSopenharmony_ci INTERSECT = 1, 150761847f8eSopenharmony_ci } 150861847f8eSopenharmony_ci 150961847f8eSopenharmony_ci /** 151061847f8eSopenharmony_ci * Provide a description of the type and position of the text. 151161847f8eSopenharmony_ci * @typedef TextBlobRunBuffer 151261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 151361847f8eSopenharmony_ci * @since 11 151461847f8eSopenharmony_ci */ 151561847f8eSopenharmony_ci interface TextBlobRunBuffer { 151661847f8eSopenharmony_ci /** 151761847f8eSopenharmony_ci * Text model. 151861847f8eSopenharmony_ci * @type { number } 151961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 152061847f8eSopenharmony_ci * @since 11 152161847f8eSopenharmony_ci */ 152261847f8eSopenharmony_ci glyph: number; 152361847f8eSopenharmony_ci /** 152461847f8eSopenharmony_ci * X-coordinate of the text start point. 152561847f8eSopenharmony_ci * @type { number } 152661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 152761847f8eSopenharmony_ci * @since 11 152861847f8eSopenharmony_ci */ 152961847f8eSopenharmony_ci positionX: number; 153061847f8eSopenharmony_ci /** 153161847f8eSopenharmony_ci * Y-coordinate of the text start point. 153261847f8eSopenharmony_ci * @type { number } 153361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 153461847f8eSopenharmony_ci * @since 11 153561847f8eSopenharmony_ci */ 153661847f8eSopenharmony_ci positionY: number; 153761847f8eSopenharmony_ci } 153861847f8eSopenharmony_ci 153961847f8eSopenharmony_ci /** 154061847f8eSopenharmony_ci * Encoding type of the description text. 154161847f8eSopenharmony_ci * 154261847f8eSopenharmony_ci * @enum { number } 154361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 154461847f8eSopenharmony_ci * @since 11 154561847f8eSopenharmony_ci */ 154661847f8eSopenharmony_ci enum TextEncoding { 154761847f8eSopenharmony_ci /** 154861847f8eSopenharmony_ci * Use 1 byte to represent UTF-8 or ASCII 154961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 155061847f8eSopenharmony_ci * @since 11 155161847f8eSopenharmony_ci */ 155261847f8eSopenharmony_ci TEXT_ENCODING_UTF8 = 0, 155361847f8eSopenharmony_ci /** 155461847f8eSopenharmony_ci * Use 2 bytes to represent most of unicode 155561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 155661847f8eSopenharmony_ci * @since 11 155761847f8eSopenharmony_ci */ 155861847f8eSopenharmony_ci TEXT_ENCODING_UTF16 = 1, 155961847f8eSopenharmony_ci /** 156061847f8eSopenharmony_ci * Use 4 bytes to represent all unicode. 156161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 156261847f8eSopenharmony_ci * @since 11 156361847f8eSopenharmony_ci */ 156461847f8eSopenharmony_ci TEXT_ENCODING_UTF32 = 2, 156561847f8eSopenharmony_ci /** 156661847f8eSopenharmony_ci * Use 2 bytes to represent the glyph index. 156761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 156861847f8eSopenharmony_ci * @since 11 156961847f8eSopenharmony_ci */ 157061847f8eSopenharmony_ci TEXT_ENCODING_GLYPH_ID = 3, 157161847f8eSopenharmony_ci } 157261847f8eSopenharmony_ci 157361847f8eSopenharmony_ci /** 157461847f8eSopenharmony_ci * Provide a description of the text 157561847f8eSopenharmony_ci * 157661847f8eSopenharmony_ci * class TextBlob 157761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 157861847f8eSopenharmony_ci * @since 11 157961847f8eSopenharmony_ci */ 158061847f8eSopenharmony_ci class TextBlob { 158161847f8eSopenharmony_ci /** 158261847f8eSopenharmony_ci * Create a textblob from a string 158361847f8eSopenharmony_ci * @param { string } text - Drawn glyph content. 158461847f8eSopenharmony_ci * @param { Font } font - Specify text size, font, text scale, etc. 158561847f8eSopenharmony_ci * @param { TextEncoding } encoding - The default value is TEXT_ENCODING_UTF8. 158661847f8eSopenharmony_ci * @returns { TextBlob } TextBlob object. 158761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 158861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 158961847f8eSopenharmony_ci * @static 159061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 159161847f8eSopenharmony_ci * @since 11 159261847f8eSopenharmony_ci */ 159361847f8eSopenharmony_ci static makeFromString(text: string, font: Font, encoding?: TextEncoding): TextBlob; 159461847f8eSopenharmony_ci 159561847f8eSopenharmony_ci /** 159661847f8eSopenharmony_ci * Create a textblob from a string, each element of which is located at the given positions. 159761847f8eSopenharmony_ci * @param { string } text - Drawn glyph content. 159861847f8eSopenharmony_ci * @param { number } len - string length, value must equal to points length. 159961847f8eSopenharmony_ci * @param { common2D.Point[] } points - Position coordinates of a textblob elements. 160061847f8eSopenharmony_ci * @param { Font } font - Specify text size, font, text scale, etc. 160161847f8eSopenharmony_ci * @returns { TextBlob } TextBlob object. 160261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 160361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 160461847f8eSopenharmony_ci * @static 160561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 160661847f8eSopenharmony_ci * @since 12 160761847f8eSopenharmony_ci */ 160861847f8eSopenharmony_ci static makeFromPosText(text: string, len: number, points: common2D.Point[], font: Font): TextBlob; 160961847f8eSopenharmony_ci 161061847f8eSopenharmony_ci /** 161161847f8eSopenharmony_ci * Creating a textblob object based on RunBuffer information 161261847f8eSopenharmony_ci * @param { Array<TextBlobRunBuffer> } pos - The array of TextBlobRunBuffer. 161361847f8eSopenharmony_ci * @param { Font } font - Font used for this run. 161461847f8eSopenharmony_ci * @param { common2D.Rect } bounds - Optional run bounding box. The default value is null; 161561847f8eSopenharmony_ci * @returns { TextBlob } TextBlob object. 161661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 161761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 161861847f8eSopenharmony_ci * @static 161961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 162061847f8eSopenharmony_ci * @since 11 162161847f8eSopenharmony_ci */ 162261847f8eSopenharmony_ci static makeFromRunBuffer(pos: Array<TextBlobRunBuffer>, font: Font, bounds?: common2D.Rect): TextBlob; 162361847f8eSopenharmony_ci 162461847f8eSopenharmony_ci /** 162561847f8eSopenharmony_ci * Returns the bounding rectangle shape 162661847f8eSopenharmony_ci * @returns { common2D.Rect } Rect object. 162761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 162861847f8eSopenharmony_ci * @since 11 162961847f8eSopenharmony_ci */ 163061847f8eSopenharmony_ci bounds(): common2D.Rect; 163161847f8eSopenharmony_ci 163261847f8eSopenharmony_ci /** 163361847f8eSopenharmony_ci * Returns an unique identifier for a textblob. 163461847f8eSopenharmony_ci * @returns { number } Unique ID. 163561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 163661847f8eSopenharmony_ci * @since 12 163761847f8eSopenharmony_ci */ 163861847f8eSopenharmony_ci uniqueID(): number; 163961847f8eSopenharmony_ci } 164061847f8eSopenharmony_ci 164161847f8eSopenharmony_ci /** 164261847f8eSopenharmony_ci * The Typeface class specifies the typeface and intrinsic style of a font. 164361847f8eSopenharmony_ci * 164461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 164561847f8eSopenharmony_ci * @since 11 164661847f8eSopenharmony_ci */ 164761847f8eSopenharmony_ci class Typeface { 164861847f8eSopenharmony_ci /** 164961847f8eSopenharmony_ci * Get the family name for this typeface. 165061847f8eSopenharmony_ci * @returns { string } Family name. 165161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 165261847f8eSopenharmony_ci * @since 11 165361847f8eSopenharmony_ci */ 165461847f8eSopenharmony_ci getFamilyName(): string; 165561847f8eSopenharmony_ci 165661847f8eSopenharmony_ci /** 165761847f8eSopenharmony_ci * Generate typeface from file. 165861847f8eSopenharmony_ci * @param { string } filePath - file path for typeface. 165961847f8eSopenharmony_ci * @returns { Typeface } Typeface. 166061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 166161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 166261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 166361847f8eSopenharmony_ci * @since 12 166461847f8eSopenharmony_ci */ 166561847f8eSopenharmony_ci static makeFromFile(filePath: string): Typeface; 166661847f8eSopenharmony_ci } 166761847f8eSopenharmony_ci 166861847f8eSopenharmony_ci /** 166961847f8eSopenharmony_ci * Enumerates text edging types. 167061847f8eSopenharmony_ci * 167161847f8eSopenharmony_ci * @enum { number } 167261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 167361847f8eSopenharmony_ci * @since 12 167461847f8eSopenharmony_ci */ 167561847f8eSopenharmony_ci enum FontEdging { 167661847f8eSopenharmony_ci /** 167761847f8eSopenharmony_ci * Uses anti aliasing, default value. 167861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 167961847f8eSopenharmony_ci * @since 12 168061847f8eSopenharmony_ci */ 168161847f8eSopenharmony_ci ALIAS = 0, 168261847f8eSopenharmony_ci 168361847f8eSopenharmony_ci /** 168461847f8eSopenharmony_ci * Uses sub-pixel anti aliasing. 168561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 168661847f8eSopenharmony_ci * @since 12 168761847f8eSopenharmony_ci */ 168861847f8eSopenharmony_ci ANTI_ALIAS = 1, 168961847f8eSopenharmony_ci 169061847f8eSopenharmony_ci /** 169161847f8eSopenharmony_ci * Uses sub-pixel anti aliasing and enable sub-pixel localization. 169261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 169361847f8eSopenharmony_ci * @since 12 169461847f8eSopenharmony_ci */ 169561847f8eSopenharmony_ci SUBPIXEL_ANTI_ALIAS = 2, 169661847f8eSopenharmony_ci } 169761847f8eSopenharmony_ci 169861847f8eSopenharmony_ci /** 169961847f8eSopenharmony_ci * Enumerates text hinting types. 170061847f8eSopenharmony_ci * 170161847f8eSopenharmony_ci * @enum { number } 170261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 170361847f8eSopenharmony_ci * @since 12 170461847f8eSopenharmony_ci */ 170561847f8eSopenharmony_ci enum FontHinting { 170661847f8eSopenharmony_ci /** 170761847f8eSopenharmony_ci * Not use text hinting. 170861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 170961847f8eSopenharmony_ci * @since 12 171061847f8eSopenharmony_ci */ 171161847f8eSopenharmony_ci NONE = 0, 171261847f8eSopenharmony_ci 171361847f8eSopenharmony_ci /** 171461847f8eSopenharmony_ci * Uses slight text hinting. 171561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 171661847f8eSopenharmony_ci * @since 12 171761847f8eSopenharmony_ci */ 171861847f8eSopenharmony_ci SLIGHT = 1, 171961847f8eSopenharmony_ci 172061847f8eSopenharmony_ci /** 172161847f8eSopenharmony_ci * Uses normal text hinting. 172261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 172361847f8eSopenharmony_ci * @since 12 172461847f8eSopenharmony_ci */ 172561847f8eSopenharmony_ci NORMAL = 2, 172661847f8eSopenharmony_ci 172761847f8eSopenharmony_ci /** 172861847f8eSopenharmony_ci * Uses full text hinting. 172961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 173061847f8eSopenharmony_ci * @since 12 173161847f8eSopenharmony_ci */ 173261847f8eSopenharmony_ci FULL = 3, 173361847f8eSopenharmony_ci } 173461847f8eSopenharmony_ci 173561847f8eSopenharmony_ci /** 173661847f8eSopenharmony_ci * Font controls options applied when drawing and measuring text. 173761847f8eSopenharmony_ci * 173861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 173961847f8eSopenharmony_ci * @since 11 174061847f8eSopenharmony_ci */ 174161847f8eSopenharmony_ci class Font { 174261847f8eSopenharmony_ci /** 174361847f8eSopenharmony_ci * Requests, but does not require, that glyphs respect sub-pixel positioning. 174461847f8eSopenharmony_ci * @param { boolean } isSubpixel - Setting for sub-pixel positioning. 174561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 174661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 174761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 174861847f8eSopenharmony_ci * @since 11 174961847f8eSopenharmony_ci */ 175061847f8eSopenharmony_ci enableSubpixel(isSubpixel: boolean): void; 175161847f8eSopenharmony_ci 175261847f8eSopenharmony_ci /** 175361847f8eSopenharmony_ci * Increases stroke width when creating glyph bitmaps to approximate a bold typeface. 175461847f8eSopenharmony_ci * @param { boolean } isEmbolden - Setting for bold approximation. 175561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 175661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 175761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 175861847f8eSopenharmony_ci * @since 11 175961847f8eSopenharmony_ci */ 176061847f8eSopenharmony_ci enableEmbolden(isEmbolden: boolean): void; 176161847f8eSopenharmony_ci 176261847f8eSopenharmony_ci /** 176361847f8eSopenharmony_ci * Requests linearly scalable font and glyph metrics. 176461847f8eSopenharmony_ci * @param { boolean } isLinearMetrics - Setting for linearly scalable font and glyph metrics. 176561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 176661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 176761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 176861847f8eSopenharmony_ci * @since 11 176961847f8eSopenharmony_ci */ 177061847f8eSopenharmony_ci enableLinearMetrics(isLinearMetrics: boolean): void; 177161847f8eSopenharmony_ci 177261847f8eSopenharmony_ci /** 177361847f8eSopenharmony_ci * Sets text size in points. Has no effect if textSize is not greater than or equal to zero. 177461847f8eSopenharmony_ci * @param { number } textSize - Typographic height of text. The height of the text must be greater than 0. 177561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 177661847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 177761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 177861847f8eSopenharmony_ci * @since 11 177961847f8eSopenharmony_ci */ 178061847f8eSopenharmony_ci setSize(textSize: number): void; 178161847f8eSopenharmony_ci 178261847f8eSopenharmony_ci /** 178361847f8eSopenharmony_ci * Obtains the text size. 178461847f8eSopenharmony_ci * @returns { number } Text size. 178561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 178661847f8eSopenharmony_ci * @since 11 178761847f8eSopenharmony_ci */ 178861847f8eSopenharmony_ci getSize(): number; 178961847f8eSopenharmony_ci 179061847f8eSopenharmony_ci /** 179161847f8eSopenharmony_ci * Sets Typeface to font. 179261847f8eSopenharmony_ci * @param { Typeface } typeface - Font and style used to draw text. 179361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 179461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 179561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 179661847f8eSopenharmony_ci * @since 11 179761847f8eSopenharmony_ci */ 179861847f8eSopenharmony_ci setTypeface(typeface: Typeface): void; 179961847f8eSopenharmony_ci 180061847f8eSopenharmony_ci /** 180161847f8eSopenharmony_ci * Get Typeface to font. 180261847f8eSopenharmony_ci * @returns { Typeface } Typeface. 180361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 180461847f8eSopenharmony_ci * @since 11 180561847f8eSopenharmony_ci */ 180661847f8eSopenharmony_ci getTypeface(): Typeface; 180761847f8eSopenharmony_ci 180861847f8eSopenharmony_ci /** 180961847f8eSopenharmony_ci * Get fontMetrics associated with typeface. 181061847f8eSopenharmony_ci * @returns { FontMetrics } The fontMetrics value returned to the caller. 181161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 181261847f8eSopenharmony_ci * @since 11 181361847f8eSopenharmony_ci */ 181461847f8eSopenharmony_ci getMetrics(): FontMetrics; 181561847f8eSopenharmony_ci 181661847f8eSopenharmony_ci /** 181761847f8eSopenharmony_ci * Measure a single character. 181861847f8eSopenharmony_ci * @param { string } text - A string containing only a single character. 181961847f8eSopenharmony_ci * @returns { number } The width of the single character. 182061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 182161847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 182261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 182361847f8eSopenharmony_ci * @since 12 182461847f8eSopenharmony_ci */ 182561847f8eSopenharmony_ci measureSingleCharacter(text: string): number; 182661847f8eSopenharmony_ci /** 182761847f8eSopenharmony_ci * Measure the width of text. 182861847f8eSopenharmony_ci * @param { string } text - Text Symbol Content. 182961847f8eSopenharmony_ci * @param { TextEncoding } encoding - Encoding format. 183061847f8eSopenharmony_ci * @returns { number } The width of text. 183161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 183261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 183361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 183461847f8eSopenharmony_ci * @since 11 183561847f8eSopenharmony_ci */ 183661847f8eSopenharmony_ci measureText(text: string, encoding: TextEncoding): number; 183761847f8eSopenharmony_ci 183861847f8eSopenharmony_ci /** 183961847f8eSopenharmony_ci * Sets text scale on x-axis to font. 184061847f8eSopenharmony_ci * @param { number } scaleX - Text scaleX. 184161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 184261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 184361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 184461847f8eSopenharmony_ci * @since 12 184561847f8eSopenharmony_ci */ 184661847f8eSopenharmony_ci setScaleX(scaleX: number): void; 184761847f8eSopenharmony_ci 184861847f8eSopenharmony_ci /** 184961847f8eSopenharmony_ci * Sets text skew on x-axis to font. 185061847f8eSopenharmony_ci * @param { number } skewX - Text skewX. 185161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 185261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 185361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 185461847f8eSopenharmony_ci * @since 12 185561847f8eSopenharmony_ci */ 185661847f8eSopenharmony_ci setSkewX(skewX: number): void; 185761847f8eSopenharmony_ci 185861847f8eSopenharmony_ci /** 185961847f8eSopenharmony_ci * Sets the edging effect to font. 186061847f8eSopenharmony_ci * @param { FontEdging } edging - Text edging. 186161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 186261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 186361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 186461847f8eSopenharmony_ci * @since 12 186561847f8eSopenharmony_ci */ 186661847f8eSopenharmony_ci setEdging(edging: FontEdging): void; 186761847f8eSopenharmony_ci 186861847f8eSopenharmony_ci /** 186961847f8eSopenharmony_ci * Sets the hinting pattern to font. 187061847f8eSopenharmony_ci * @param { FontHinting } hinting - Text hinting. 187161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 187261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 187361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 187461847f8eSopenharmony_ci * @since 12 187561847f8eSopenharmony_ci */ 187661847f8eSopenharmony_ci setHinting(hinting: FontHinting): void; 187761847f8eSopenharmony_ci 187861847f8eSopenharmony_ci /** 187961847f8eSopenharmony_ci * Calculates number of glyphs represented by text. 188061847f8eSopenharmony_ci * @param { string } text - Indicates the character storage encoded with text encoding. 188161847f8eSopenharmony_ci * @returns { number } Returns the count of text. 188261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 188361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 188461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 188561847f8eSopenharmony_ci * @since 12 188661847f8eSopenharmony_ci */ 188761847f8eSopenharmony_ci countText(text: string): number; 188861847f8eSopenharmony_ci 188961847f8eSopenharmony_ci /** 189061847f8eSopenharmony_ci * Sets whether the font baselines and pixels alignment when the transformation matrix is axis aligned. 189161847f8eSopenharmony_ci * @param { boolean } isBaselineSnap - Indicates whether the font baselines and pixels alignment. 189261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 189361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 189461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 189561847f8eSopenharmony_ci * @since 12 189661847f8eSopenharmony_ci */ 189761847f8eSopenharmony_ci setBaselineSnap(isBaselineSnap: boolean): void; 189861847f8eSopenharmony_ci 189961847f8eSopenharmony_ci /** 190061847f8eSopenharmony_ci * Gets whether the font baselines and pixels alignment when the transformation matrix is axis aligned. 190161847f8eSopenharmony_ci * @returns { boolean } Returns true if the font baselines and pixels alignment; returns false otherwise. 190261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 190361847f8eSopenharmony_ci * @since 12 190461847f8eSopenharmony_ci */ 190561847f8eSopenharmony_ci isBaselineSnap(): boolean; 190661847f8eSopenharmony_ci 190761847f8eSopenharmony_ci /** 190861847f8eSopenharmony_ci * Sets whether to use bitmaps instead of outlines in the object. 190961847f8eSopenharmony_ci * @param { boolean } isEmbeddedBitmaps - Indicates whether to use bitmaps instead of outlines. 191061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 191161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 191261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 191361847f8eSopenharmony_ci * @since 12 191461847f8eSopenharmony_ci */ 191561847f8eSopenharmony_ci setEmbeddedBitmaps(isEmbeddedBitmaps: boolean): void; 191661847f8eSopenharmony_ci 191761847f8eSopenharmony_ci /** 191861847f8eSopenharmony_ci * Gets whether to use bitmaps instead of outlines in the object. 191961847f8eSopenharmony_ci * @returns { boolean } if using bitmaps instead of outlines; returns false otherwise. 192061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 192161847f8eSopenharmony_ci * @since 12 192261847f8eSopenharmony_ci */ 192361847f8eSopenharmony_ci isEmbeddedBitmaps(): boolean; 192461847f8eSopenharmony_ci 192561847f8eSopenharmony_ci /** 192661847f8eSopenharmony_ci * Sets whether the font outline is automatically adjusted. 192761847f8eSopenharmony_ci * @param { boolean } isForceAutoHinting - Indicates whether the font outline is automatically adjusted. 192861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 192961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 193061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 193161847f8eSopenharmony_ci * @since 12 193261847f8eSopenharmony_ci */ 193361847f8eSopenharmony_ci setForceAutoHinting(isForceAutoHinting: boolean): void; 193461847f8eSopenharmony_ci 193561847f8eSopenharmony_ci /** 193661847f8eSopenharmony_ci * Gets whether the font outline is automatically adjusted. 193761847f8eSopenharmony_ci * @returns { boolean } Returns true if the font outline is automatically adjusted; returns false otherwise. 193861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 193961847f8eSopenharmony_ci * @since 12 194061847f8eSopenharmony_ci */ 194161847f8eSopenharmony_ci isForceAutoHinting(): boolean; 194261847f8eSopenharmony_ci 194361847f8eSopenharmony_ci /** 194461847f8eSopenharmony_ci * Retrieves the advance for each glyph in glyphs. 194561847f8eSopenharmony_ci * @param { Array<number> } glyphs - Array of glyph indices to be measured. 194661847f8eSopenharmony_ci * @returns { Array<number> } Returns the width of each character in a string. 194761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 194861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 194961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 195061847f8eSopenharmony_ci * @since 12 195161847f8eSopenharmony_ci */ 195261847f8eSopenharmony_ci getWidths(glyphs: Array<number>): Array<number>; 195361847f8eSopenharmony_ci 195461847f8eSopenharmony_ci /** 195561847f8eSopenharmony_ci * Gets storage for glyph indexes. 195661847f8eSopenharmony_ci * @param { string } text - Indicates the character storage encoded with text encoding. 195761847f8eSopenharmony_ci * @param { number } glyphCount - The number of glyph. The default value is the result of calling countText. 195861847f8eSopenharmony_ci * @returns { Array<number> } Returns the storage for glyph indices. 195961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 196061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 196161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 196261847f8eSopenharmony_ci * @since 12 196361847f8eSopenharmony_ci */ 196461847f8eSopenharmony_ci textToGlyphs(text: string, glyphCount?: number): Array<number>; 196561847f8eSopenharmony_ci 196661847f8eSopenharmony_ci /** 196761847f8eSopenharmony_ci * Returns true if glyphs may be drawn at sub-pixel offsets. 196861847f8eSopenharmony_ci * @returns { boolean } True if glyphs may be drawn at sub-pixel offsets. 196961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 197061847f8eSopenharmony_ci * @since 12 197161847f8eSopenharmony_ci */ 197261847f8eSopenharmony_ci isSubpixel(): boolean; 197361847f8eSopenharmony_ci /** 197461847f8eSopenharmony_ci * Returns true if font and glyph metrics are requested to be linearly scalable. 197561847f8eSopenharmony_ci * @returns { boolean } True if font and glyph metrics are requested to be linearly scalable. 197661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 197761847f8eSopenharmony_ci * @since 12 197861847f8eSopenharmony_ci */ 197961847f8eSopenharmony_ci isLinearMetrics(): boolean; 198061847f8eSopenharmony_ci /** 198161847f8eSopenharmony_ci * Returns text skew on x-axis. 198261847f8eSopenharmony_ci * @returns { number } Additional shear on x-axis relative to y-axis. 198361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 198461847f8eSopenharmony_ci * @since 12 198561847f8eSopenharmony_ci */ 198661847f8eSopenharmony_ci getSkewX(): number; 198761847f8eSopenharmony_ci /** 198861847f8eSopenharmony_ci * Gets whether to increase the stroke width to approximate bold fonts. 198961847f8eSopenharmony_ci * @returns { boolean } Returns true to increase the stroke width to approximate bold fonts; 199061847f8eSopenharmony_ci * returns false otherwise. 199161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 199261847f8eSopenharmony_ci * @since 12 199361847f8eSopenharmony_ci */ 199461847f8eSopenharmony_ci isEmbolden(): boolean; 199561847f8eSopenharmony_ci /** 199661847f8eSopenharmony_ci * Returns text scale on x-axis. 199761847f8eSopenharmony_ci * @returns { number } Text horizontal scale. 199861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 199961847f8eSopenharmony_ci * @since 12 200061847f8eSopenharmony_ci */ 200161847f8eSopenharmony_ci getScaleX(): number; 200261847f8eSopenharmony_ci /** 200361847f8eSopenharmony_ci * Gets font hinting pattern. 200461847f8eSopenharmony_ci * @returns { FontHinting } Font hinting level. 200561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 200661847f8eSopenharmony_ci * @since 12 200761847f8eSopenharmony_ci */ 200861847f8eSopenharmony_ci getHinting(): FontHinting; 200961847f8eSopenharmony_ci /** 201061847f8eSopenharmony_ci * Gets font edge pixels pattern. 201161847f8eSopenharmony_ci * @returns { FontEdging } Edge pixels pattern. 201261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 201361847f8eSopenharmony_ci * @since 12 201461847f8eSopenharmony_ci */ 201561847f8eSopenharmony_ci getEdging(): FontEdging; 201661847f8eSopenharmony_ci /** 201761847f8eSopenharmony_ci * Create path object of specified Glyph. 201861847f8eSopenharmony_ci * @param { number } index - the index of Glyphs. 201961847f8eSopenharmony_ci * @returns { Path } The path object for specified glyph, undefined if not found. 202061847f8eSopenharmony_ci * Note: Path use y-axis-goes-down system, y axis is inverted to the y-axis-goes-up system. 202161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 202261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 202361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 202461847f8eSopenharmony_ci * @since 14 202561847f8eSopenharmony_ci */ 202661847f8eSopenharmony_ci createPathForGlyph(index: number): Path; 202761847f8eSopenharmony_ci /** 202861847f8eSopenharmony_ci * Retrieves the bounding rect for each glyph in glyphs. 202961847f8eSopenharmony_ci * @param { Array<number> } glyphs - Indicates the array of glyph indices to be measured. 203061847f8eSopenharmony_ci * @returns { Array<common2D.Rect> } Returns bounds for each glyph relative to (0, 0). 203161847f8eSopenharmony_ci * Note: 1. Rect use y-axis-goes-down system, y axis is inverted to the y-axis-goes-up system. 203261847f8eSopenharmony_ci * <br>2. Rect use two points(left-bottom & right-top) to describe the bound. 203361847f8eSopenharmony_ci * <br>3. The bound rect will be snap to integral boundaries. 203461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 203561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 203661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 203761847f8eSopenharmony_ci * @since 14 203861847f8eSopenharmony_ci */ 203961847f8eSopenharmony_ci getBounds(glyphs: Array<number>): Array<common2D.Rect>; 204061847f8eSopenharmony_ci /** 204161847f8eSopenharmony_ci * Get path of text. 204261847f8eSopenharmony_ci * @param { string } text - Indicates the character storage encoded with text encoding. 204361847f8eSopenharmony_ci * @param { number } byteLength - Indicates the byte length of the text. 204461847f8eSopenharmony_ci * @param { number } x - Indicates X coordinate for the starting position of the text within the drawing area. 204561847f8eSopenharmony_ci * @param { number } y - Indicates Y coordinate for the starting position of the text within the drawing area. 204661847f8eSopenharmony_ci * @returns { Path } The path object for Glyph. 204761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 204861847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 204961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 205061847f8eSopenharmony_ci * @since 14 205161847f8eSopenharmony_ci */ 205261847f8eSopenharmony_ci getTextPath(text: string, byteLength: number, x: number, y: number): Path; 205361847f8eSopenharmony_ci } 205461847f8eSopenharmony_ci 205561847f8eSopenharmony_ci /** 205661847f8eSopenharmony_ci * Indicate when certain metrics are valid; the underline or strikeout metrics may be valid and zero. 205761847f8eSopenharmony_ci * Fonts with embedded bitmaps may not have valid underline or strikeout metrics. 205861847f8eSopenharmony_ci * @enum { number } 205961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 206061847f8eSopenharmony_ci * @since 12 206161847f8eSopenharmony_ci */ 206261847f8eSopenharmony_ci enum FontMetricsFlags { 206361847f8eSopenharmony_ci /** 206461847f8eSopenharmony_ci * Set if underlineThickness of FontMetrics is valid. 206561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 206661847f8eSopenharmony_ci * @since 12 206761847f8eSopenharmony_ci */ 206861847f8eSopenharmony_ci UNDERLINE_THICKNESS_VALID = 1 << 0, 206961847f8eSopenharmony_ci 207061847f8eSopenharmony_ci /** 207161847f8eSopenharmony_ci * Set if underlinePosition of FontMetrics is valid. 207261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 207361847f8eSopenharmony_ci * @since 12 207461847f8eSopenharmony_ci */ 207561847f8eSopenharmony_ci UNDERLINE_POSITION_VALID = 1 << 1, 207661847f8eSopenharmony_ci 207761847f8eSopenharmony_ci /** 207861847f8eSopenharmony_ci * Set if strikethroughThickness of FontMetrics is valid. 207961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 208061847f8eSopenharmony_ci * @since 12 208161847f8eSopenharmony_ci */ 208261847f8eSopenharmony_ci STRIKETHROUGH_THICKNESS_VALID = 1 << 2, 208361847f8eSopenharmony_ci 208461847f8eSopenharmony_ci /** 208561847f8eSopenharmony_ci * Set if strikethroughPosition of FontMetrics is valid. 208661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 208761847f8eSopenharmony_ci * @since 12 208861847f8eSopenharmony_ci */ 208961847f8eSopenharmony_ci STRIKETHROUGH_POSITION_VALID = 1 << 3, 209061847f8eSopenharmony_ci 209161847f8eSopenharmony_ci /** 209261847f8eSopenharmony_ci * set if top, bottom, xMin, xMax of FontMetrics invalid. 209361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 209461847f8eSopenharmony_ci * @since 12 209561847f8eSopenharmony_ci */ 209661847f8eSopenharmony_ci BOUNDS_INVALID = 1 << 4, 209761847f8eSopenharmony_ci } 209861847f8eSopenharmony_ci 209961847f8eSopenharmony_ci /** 210061847f8eSopenharmony_ci * The metrics of an Font. 210161847f8eSopenharmony_ci * @typedef FontMetrics 210261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 210361847f8eSopenharmony_ci * @since 11 210461847f8eSopenharmony_ci */ 210561847f8eSopenharmony_ci interface FontMetrics { 210661847f8eSopenharmony_ci /** 210761847f8eSopenharmony_ci * Indicating which metrics are valid. 210861847f8eSopenharmony_ci * @type { ?FontMetricsFlags } 210961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 211061847f8eSopenharmony_ci * @since 12 211161847f8eSopenharmony_ci */ 211261847f8eSopenharmony_ci flags?: FontMetricsFlags; 211361847f8eSopenharmony_ci 211461847f8eSopenharmony_ci /** 211561847f8eSopenharmony_ci * Maximum range above the glyph bounding box. 211661847f8eSopenharmony_ci * @type { number } 211761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 211861847f8eSopenharmony_ci * @since 11 211961847f8eSopenharmony_ci */ 212061847f8eSopenharmony_ci top: number; 212161847f8eSopenharmony_ci /** 212261847f8eSopenharmony_ci * Distance Retained Above Baseline. 212361847f8eSopenharmony_ci * @type { number } 212461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 212561847f8eSopenharmony_ci * @since 11 212661847f8eSopenharmony_ci */ 212761847f8eSopenharmony_ci ascent: number; 212861847f8eSopenharmony_ci /** 212961847f8eSopenharmony_ci * The distance that remains below the baseline. 213061847f8eSopenharmony_ci * @type { number } 213161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 213261847f8eSopenharmony_ci * @since 11 213361847f8eSopenharmony_ci */ 213461847f8eSopenharmony_ci descent: number; 213561847f8eSopenharmony_ci /** 213661847f8eSopenharmony_ci * Maximum range below the glyph bounding box. 213761847f8eSopenharmony_ci * @type { number } 213861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 213961847f8eSopenharmony_ci * @since 11 214061847f8eSopenharmony_ci */ 214161847f8eSopenharmony_ci bottom: number; 214261847f8eSopenharmony_ci /** 214361847f8eSopenharmony_ci * Line Spacing. 214461847f8eSopenharmony_ci * @type { number } 214561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 214661847f8eSopenharmony_ci * @since 11 214761847f8eSopenharmony_ci */ 214861847f8eSopenharmony_ci leading: number; 214961847f8eSopenharmony_ci /** 215061847f8eSopenharmony_ci * Average character width, zero if unknown. 215161847f8eSopenharmony_ci * @type { ?number } 215261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 215361847f8eSopenharmony_ci * @since 12 215461847f8eSopenharmony_ci */ 215561847f8eSopenharmony_ci avgCharWidth?: number; 215661847f8eSopenharmony_ci 215761847f8eSopenharmony_ci /** 215861847f8eSopenharmony_ci * Maximum character width, zero if unknown. 215961847f8eSopenharmony_ci * @type { ?number } 216061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 216161847f8eSopenharmony_ci * @since 12 216261847f8eSopenharmony_ci */ 216361847f8eSopenharmony_ci maxCharWidth?: number; 216461847f8eSopenharmony_ci 216561847f8eSopenharmony_ci /** 216661847f8eSopenharmony_ci * Greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with variable fonts. 216761847f8eSopenharmony_ci * @type { ?number } 216861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 216961847f8eSopenharmony_ci * @since 12 217061847f8eSopenharmony_ci */ 217161847f8eSopenharmony_ci xMin?: number; 217261847f8eSopenharmony_ci 217361847f8eSopenharmony_ci /** 217461847f8eSopenharmony_ci * Greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with variable fonts. 217561847f8eSopenharmony_ci * @type { ?number } 217661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 217761847f8eSopenharmony_ci * @since 12 217861847f8eSopenharmony_ci */ 217961847f8eSopenharmony_ci xMax?: number; 218061847f8eSopenharmony_ci 218161847f8eSopenharmony_ci /** 218261847f8eSopenharmony_ci * Height of lower-case 'x', zero if unknown, typically negative. 218361847f8eSopenharmony_ci * @type { ?number } 218461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 218561847f8eSopenharmony_ci * @since 12 218661847f8eSopenharmony_ci */ 218761847f8eSopenharmony_ci xHeight?: number; 218861847f8eSopenharmony_ci 218961847f8eSopenharmony_ci /** 219061847f8eSopenharmony_ci * Height of an upper-case letter, zero if unknown, typically negative. 219161847f8eSopenharmony_ci * @type { ?number } 219261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 219361847f8eSopenharmony_ci * @since 12 219461847f8eSopenharmony_ci */ 219561847f8eSopenharmony_ci capHeight?: number; 219661847f8eSopenharmony_ci 219761847f8eSopenharmony_ci /** 219861847f8eSopenharmony_ci * Underline thickness. 219961847f8eSopenharmony_ci * @type { ?number } 220061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 220161847f8eSopenharmony_ci * @since 12 220261847f8eSopenharmony_ci */ 220361847f8eSopenharmony_ci underlineThickness?: number; 220461847f8eSopenharmony_ci 220561847f8eSopenharmony_ci /** 220661847f8eSopenharmony_ci * Distance from baseline to top of stroke, typically positive. 220761847f8eSopenharmony_ci * @type { ?number } 220861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 220961847f8eSopenharmony_ci * @since 12 221061847f8eSopenharmony_ci */ 221161847f8eSopenharmony_ci underlinePosition?: number; 221261847f8eSopenharmony_ci 221361847f8eSopenharmony_ci /** 221461847f8eSopenharmony_ci * Strikethrough thickness. 221561847f8eSopenharmony_ci * @type { ?number } 221661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 221761847f8eSopenharmony_ci * @since 12 221861847f8eSopenharmony_ci */ 221961847f8eSopenharmony_ci strikethroughThickness?: number; 222061847f8eSopenharmony_ci 222161847f8eSopenharmony_ci /** 222261847f8eSopenharmony_ci * Distance from baseline to bottom of stroke, typically negative. 222361847f8eSopenharmony_ci * @type { ?number } 222461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 222561847f8eSopenharmony_ci * @since 12 222661847f8eSopenharmony_ci */ 222761847f8eSopenharmony_ci strikethroughPosition?: number; 222861847f8eSopenharmony_ci } 222961847f8eSopenharmony_ci 223061847f8eSopenharmony_ci /** 223161847f8eSopenharmony_ci * Lattice is the class for dividing an image into grids. 223261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 223361847f8eSopenharmony_ci * @since 12 223461847f8eSopenharmony_ci */ 223561847f8eSopenharmony_ci class Lattice { 223661847f8eSopenharmony_ci /** 223761847f8eSopenharmony_ci * Divide an image into a rectangular grid. Grid entries on even columns and even rows are fixed; 223861847f8eSopenharmony_ci * these entries are always drawn at their original size if the destination is large enough. If the destination 223961847f8eSopenharmony_ci * side is too small to hold the fixed entries, all fixed entries are scaled down to fit. 224061847f8eSopenharmony_ci * The grid entries not on even columns and rows are scaled to fit the remaining space, if any. 224161847f8eSopenharmony_ci * @param { Array<number> } xDivs - X coordinate of values used to divide the image. 224261847f8eSopenharmony_ci * @param { Array<number> } yDivs - Y coordinate of values used to divide the image. 224361847f8eSopenharmony_ci * @param { number } fXCount - Number of x coordinates. Must be >= 0. 224461847f8eSopenharmony_ci * @param { number } fYCount - Number of y coordinates. Must be >= 0. 224561847f8eSopenharmony_ci * @param { common2D.Rect | null } fBounds - Source bounds to draw from. The default value is null. 224661847f8eSopenharmony_ci * @param { Array<RectType> | null } fRectTypes - Array of fill types. The default value is null. 224761847f8eSopenharmony_ci * @param { Array<common2D.Color> | null } fColors - Array of colors. The default value is null. 224861847f8eSopenharmony_ci * @returns { Lattice } Lattice object. 224961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 225061847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 225161847f8eSopenharmony_ci * @static 225261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 225361847f8eSopenharmony_ci * @since 12 225461847f8eSopenharmony_ci */ 225561847f8eSopenharmony_ci static createImageLattice(xDivs: Array<number>, yDivs: Array<number>, fXCount: number, fYCount: number, 225661847f8eSopenharmony_ci fBounds?: common2D.Rect | null, fRectTypes?: Array<RectType> | null, fColors?: Array<common2D.Color> | null): Lattice; 225761847f8eSopenharmony_ci 225861847f8eSopenharmony_ci /** 225961847f8eSopenharmony_ci * Divide an image into a rectangular grid. Grid entries on even columns and even rows are fixed; 226061847f8eSopenharmony_ci * these entries are always drawn at their original size if the destination is large enough. If the destination 226161847f8eSopenharmony_ci * side is too small to hold the fixed entries, all fixed entries are scaled down to fit. 226261847f8eSopenharmony_ci * The grid entries not on even columns and rows are scaled to fit the remaining space, if any. 226361847f8eSopenharmony_ci * @param { Array<number> } xDivs - X coordinate of values used to divide the image. 226461847f8eSopenharmony_ci * @param { Array<number> } yDivs - Y coordinate of values used to divide the image. 226561847f8eSopenharmony_ci * @param { number } fXCount - Number of x coordinates. Must be >= 0. 226661847f8eSopenharmony_ci * @param { number } fYCount - Number of y coordinates. Must be >= 0. 226761847f8eSopenharmony_ci * @param { common2D.Rect | null } fBounds - Source bounds to draw from. The default value is null. 226861847f8eSopenharmony_ci * @param { Array<RectType> | null } fRectTypes - Array of fill types. The default value is null. 226961847f8eSopenharmony_ci * @param { Array<number> | null } fColors - Array of colors represented by ARGB color of hexadecimal format. The default value is null. 227061847f8eSopenharmony_ci * @returns { Lattice } Lattice object. 227161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 227261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 227361847f8eSopenharmony_ci * @static 227461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 227561847f8eSopenharmony_ci * @since 13 227661847f8eSopenharmony_ci */ 227761847f8eSopenharmony_ci static createImageLattice(xDivs: Array<number>, yDivs: Array<number>, fXCount: number, fYCount: number, 227861847f8eSopenharmony_ci fBounds?: common2D.Rect | null, fRectTypes?: Array<RectType> | null, fColors?: Array<number> | null): Lattice; 227961847f8eSopenharmony_ci } 228061847f8eSopenharmony_ci 228161847f8eSopenharmony_ci /** 228261847f8eSopenharmony_ci * Enumerate rect types. Optional setting per rectangular grid entry to make it transparent, 228361847f8eSopenharmony_ci * or to fill the grid entry with a color. only used in Lattice. 228461847f8eSopenharmony_ci * @enum { number } 228561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 228661847f8eSopenharmony_ci * @since 12 228761847f8eSopenharmony_ci */ 228861847f8eSopenharmony_ci enum RectType { 228961847f8eSopenharmony_ci /** 229061847f8eSopenharmony_ci * Draws image into lattice rect. 229161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 229261847f8eSopenharmony_ci * @since 12 229361847f8eSopenharmony_ci */ 229461847f8eSopenharmony_ci DEFAULT = 0, 229561847f8eSopenharmony_ci 229661847f8eSopenharmony_ci /** 229761847f8eSopenharmony_ci * Skips lattice rect by making it transparent. 229861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 229961847f8eSopenharmony_ci * @since 12 230061847f8eSopenharmony_ci */ 230161847f8eSopenharmony_ci TRANSPARENT = 1, 230261847f8eSopenharmony_ci 230361847f8eSopenharmony_ci /** 230461847f8eSopenharmony_ci * Draws one of fColors into lattice rect. 230561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 230661847f8eSopenharmony_ci * @since 12 230761847f8eSopenharmony_ci */ 230861847f8eSopenharmony_ci FIXEDCOLOR = 2 230961847f8eSopenharmony_ci } 231061847f8eSopenharmony_ci 231161847f8eSopenharmony_ci /** 231261847f8eSopenharmony_ci * MaskFilter is the class for object that perform transformations on an alpha-channel mask before drawing it. 231361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 231461847f8eSopenharmony_ci * @since 12 231561847f8eSopenharmony_ci */ 231661847f8eSopenharmony_ci class MaskFilter { 231761847f8eSopenharmony_ci /** 231861847f8eSopenharmony_ci * Makes a MaskFilter with a blur effect. 231961847f8eSopenharmony_ci * @param { BlurType } blurType - Indicates the blur type. 232061847f8eSopenharmony_ci * @param { number } sigma - Indicates the standard deviation of the Gaussian blur to apply. Must be > 0. 232161847f8eSopenharmony_ci * @returns { MaskFilter } MaskFilter object. 232261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 232361847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 232461847f8eSopenharmony_ci * @static 232561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 232661847f8eSopenharmony_ci * @since 12 232761847f8eSopenharmony_ci */ 232861847f8eSopenharmony_ci static createBlurMaskFilter(blurType: BlurType, sigma: number): MaskFilter; 232961847f8eSopenharmony_ci } 233061847f8eSopenharmony_ci 233161847f8eSopenharmony_ci /** 233261847f8eSopenharmony_ci * Defines a PathEffect, which is used to affects stroked paths. 233361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 233461847f8eSopenharmony_ci * @since 12 233561847f8eSopenharmony_ci */ 233661847f8eSopenharmony_ci class PathEffect { 233761847f8eSopenharmony_ci /** 233861847f8eSopenharmony_ci * Makes a dash PathEffect. 233961847f8eSopenharmony_ci * @param { Array<number> } intervals - Array of ON and OFF distances. Must contain an even number of entries (>=2), 234061847f8eSopenharmony_ci * with the even indices specifying the "on" intervals, and the odd indices specifying the "off" intervals. 234161847f8eSopenharmony_ci * @param { number } phase - Offset into the intervals array. 234261847f8eSopenharmony_ci * @returns { PathEffect } PathEffect object. 234361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 234461847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 234561847f8eSopenharmony_ci * @static 234661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 234761847f8eSopenharmony_ci * @since 12 234861847f8eSopenharmony_ci */ 234961847f8eSopenharmony_ci static createDashPathEffect(intervals: Array<number>, phase: number): PathEffect; 235061847f8eSopenharmony_ci 235161847f8eSopenharmony_ci /** 235261847f8eSopenharmony_ci * Makes a corner PathEffect. 235361847f8eSopenharmony_ci * @param { number } radius - Indicates the radius of the tangent circle at the corners of the path. 235461847f8eSopenharmony_ci * The radius must be greater than 0. 235561847f8eSopenharmony_ci * @returns { PathEffect } PathEffect object. 235661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 235761847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 235861847f8eSopenharmony_ci * @static 235961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 236061847f8eSopenharmony_ci * @since 12 236161847f8eSopenharmony_ci */ 236261847f8eSopenharmony_ci static createCornerPathEffect(radius: number): PathEffect; 236361847f8eSopenharmony_ci } 236461847f8eSopenharmony_ci 236561847f8eSopenharmony_ci /** 236661847f8eSopenharmony_ci * Describes a shader effect object. 236761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 236861847f8eSopenharmony_ci * @since 12 236961847f8eSopenharmony_ci */ 237061847f8eSopenharmony_ci class ShaderEffect { 237161847f8eSopenharmony_ci /** 237261847f8eSopenharmony_ci * Creates an ShaderEffect object that generates a shader with single color. 237361847f8eSopenharmony_ci * @param { number } color - Indicates the color used by the shader. 237461847f8eSopenharmony_ci * @returns { ShaderEffect } Returns the shader with single color ShaderEffect object. 237561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 237661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 237761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 237861847f8eSopenharmony_ci * @since 12 237961847f8eSopenharmony_ci */ 238061847f8eSopenharmony_ci static createColorShader(color: number): ShaderEffect; 238161847f8eSopenharmony_ci 238261847f8eSopenharmony_ci /** 238361847f8eSopenharmony_ci * Creates an ShaderEffect object that generates a linear gradient between the two specified points. 238461847f8eSopenharmony_ci * @param { common2D.Point } startPt - Indicates the start point for the gradient. 238561847f8eSopenharmony_ci * @param { common2D.Point } endPt - Indicates the end point for the gradient. 238661847f8eSopenharmony_ci * @param { Array<number> } colors - Indicates the colors to be distributed between the two points. 238761847f8eSopenharmony_ci * @param { TileMode } mode - Indicates the tile mode. 238861847f8eSopenharmony_ci * @param { Array<number> | null } pos - Indicates the relative position of each corresponding color 238961847f8eSopenharmony_ci * <br> in the colors array. The default value is empty for uniform distribution. 239061847f8eSopenharmony_ci * @param { Matrix | null } matrix - Indicates the Matrix object. The default value is null. 239161847f8eSopenharmony_ci * @returns { ShaderEffect } Returns a linear gradient ShaderEffect object. 239261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 239361847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 239461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 239561847f8eSopenharmony_ci * @since 12 239661847f8eSopenharmony_ci */ 239761847f8eSopenharmony_ci static createLinearGradient(startPt: common2D.Point, endPt: common2D.Point, colors: Array<number>, 239861847f8eSopenharmony_ci mode: TileMode, pos?: Array<number> | null, matrix?: Matrix | null): ShaderEffect; 239961847f8eSopenharmony_ci 240061847f8eSopenharmony_ci /** 240161847f8eSopenharmony_ci * Creates an ShaderEffect object that generates a radial gradient given the center and radius. 240261847f8eSopenharmony_ci * @param { common2D.Point } centerPt - Indicates the center of the circle for the gradient. 240361847f8eSopenharmony_ci * @param { number } radius - Indicates the radius of the circle for this gradient. 240461847f8eSopenharmony_ci * @param { Array<number> } colors - Indicates the colors to be distributed between the two points. 240561847f8eSopenharmony_ci * @param { TileMode } mode - Indicates the tile mode. 240661847f8eSopenharmony_ci * @param { Array<number> | null } pos - Indicates the relative position of each corresponding color 240761847f8eSopenharmony_ci * <br> in the colors array. The default value is empty for uniform distribution. 240861847f8eSopenharmony_ci * @param { Matrix | null } matrix - Indicates the Matrix object. The default value is null. 240961847f8eSopenharmony_ci * @returns { ShaderEffect } Returns a radial gradient ShaderEffect object. 241061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 241161847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 241261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 241361847f8eSopenharmony_ci * @since 12 241461847f8eSopenharmony_ci */ 241561847f8eSopenharmony_ci static createRadialGradient(centerPt: common2D.Point, radius: number, colors: Array<number>, 241661847f8eSopenharmony_ci mode: TileMode, pos?: Array<number> | null, matrix?: Matrix | null): ShaderEffect; 241761847f8eSopenharmony_ci 241861847f8eSopenharmony_ci /** 241961847f8eSopenharmony_ci * Creates an ShaderEffect object that generates a sweep gradient given a center. 242061847f8eSopenharmony_ci * @param { common2D.Point } centerPt - Indicates the center of the circle for the gradient. 242161847f8eSopenharmony_ci * @param { Array<number> } colors - Indicates the colors to be distributed between the two points. 242261847f8eSopenharmony_ci * @param { TileMode } mode - Indicates the tile mode. 242361847f8eSopenharmony_ci * @param { number } startAngle - The starting angle of the gradient. 242461847f8eSopenharmony_ci * @param { number } endAngle - The ending angle of the gradient. 242561847f8eSopenharmony_ci * @param { Array<number> | null } pos - Indicates the relative position of each corresponding color 242661847f8eSopenharmony_ci * <br> in the colors array. The default value is empty for uniform distribution. 242761847f8eSopenharmony_ci * @param { Matrix | null } matrix - Indicates the Matrix object. The default value is null. 242861847f8eSopenharmony_ci * @returns { ShaderEffect } Returns a sweep gradient ShaderEffect object. 242961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 243061847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 243161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 243261847f8eSopenharmony_ci * @since 12 243361847f8eSopenharmony_ci */ 243461847f8eSopenharmony_ci static createSweepGradient(centerPt: common2D.Point, colors: Array<number>, 243561847f8eSopenharmony_ci mode: TileMode, startAngle: number, endAngle: number, pos?: Array<number> | null, 243661847f8eSopenharmony_ci matrix?: Matrix | null): ShaderEffect; 243761847f8eSopenharmony_ci 243861847f8eSopenharmony_ci /** 243961847f8eSopenharmony_ci * Creates an ShaderEffect object that generates a conical gradient given two circles. 244061847f8eSopenharmony_ci * @param { common2D.Point } startPt - Indicates the center of the start circle for the gradient. 244161847f8eSopenharmony_ci * @param { number } startRadius - Indicates the radius of the start circle for this gradient. 244261847f8eSopenharmony_ci * @param { common2D.Point } endPt - Indicates the center of the end circle for the gradient. 244361847f8eSopenharmony_ci * @param { number } endRadius - Indicates the radius of the end circle for this gradient. 244461847f8eSopenharmony_ci * @param { Array<number> } colors - Indicates the colors to be distributed between the two points. 244561847f8eSopenharmony_ci * @param { TileMode } mode - Indicates the tile mode. 244661847f8eSopenharmony_ci * @param { Array<number> | null } pos - Indicates the relative position of each corresponding color 244761847f8eSopenharmony_ci * <br> in the colors array. The default value is empty for uniform distribution. 244861847f8eSopenharmony_ci * @param { Matrix | null } matrix - Indicates the Matrix object. The default value is null. 244961847f8eSopenharmony_ci * @returns { ShaderEffect } Returns a conical gradient ShaderEffect object. 245061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 245161847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 245261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 245361847f8eSopenharmony_ci * @since 12 245461847f8eSopenharmony_ci */ 245561847f8eSopenharmony_ci static createConicalGradient(startPt: common2D.Point, startRadius: number, endPt: common2D.Point, 245661847f8eSopenharmony_ci endRadius: number, colors: Array<number>, mode: TileMode, 245761847f8eSopenharmony_ci pos?: Array<number> | null, matrix?: Matrix | null): ShaderEffect; 245861847f8eSopenharmony_ci } 245961847f8eSopenharmony_ci 246061847f8eSopenharmony_ci /** 246161847f8eSopenharmony_ci * Enumerates tile modes that describe an image or texture. 246261847f8eSopenharmony_ci * @enum { number } 246361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 246461847f8eSopenharmony_ci * @since 12 246561847f8eSopenharmony_ci */ 246661847f8eSopenharmony_ci enum TileMode { 246761847f8eSopenharmony_ci /** 246861847f8eSopenharmony_ci * Replicate the edge color if the shader effect draws outside of its original bounds. 246961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 247061847f8eSopenharmony_ci * @since 12 247161847f8eSopenharmony_ci */ 247261847f8eSopenharmony_ci CLAMP = 0, 247361847f8eSopenharmony_ci 247461847f8eSopenharmony_ci /** 247561847f8eSopenharmony_ci * Repeat the shader effect image horizontally and vertically. 247661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 247761847f8eSopenharmony_ci * @since 12 247861847f8eSopenharmony_ci */ 247961847f8eSopenharmony_ci REPEAT = 1, 248061847f8eSopenharmony_ci 248161847f8eSopenharmony_ci /** 248261847f8eSopenharmony_ci * Repeat the shader effect image horizontally and vertically, alternating mirror images 248361847f8eSopenharmony_ci * so that adjacent images always seam. 248461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 248561847f8eSopenharmony_ci * @since 12 248661847f8eSopenharmony_ci */ 248761847f8eSopenharmony_ci MIRROR = 2, 248861847f8eSopenharmony_ci 248961847f8eSopenharmony_ci /** 249061847f8eSopenharmony_ci * Only draw within the original domain, return transparent-black everywhere else. 249161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 249261847f8eSopenharmony_ci * @since 12 249361847f8eSopenharmony_ci */ 249461847f8eSopenharmony_ci DECAL = 3, 249561847f8eSopenharmony_ci } 249661847f8eSopenharmony_ci 249761847f8eSopenharmony_ci /** 249861847f8eSopenharmony_ci * Defines a ShadowLayer, which is used to specify the color, blur radius, and offset of the shadow. 249961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 250061847f8eSopenharmony_ci * @since 12 250161847f8eSopenharmony_ci */ 250261847f8eSopenharmony_ci class ShadowLayer { 250361847f8eSopenharmony_ci /** 250461847f8eSopenharmony_ci * Makes a new ShadowLayer. 250561847f8eSopenharmony_ci * 250661847f8eSopenharmony_ci * @param { number } blurRadius - The blur radius of the shadow. The blur radius must be greater than 0. 250761847f8eSopenharmony_ci * @param { number } x - The offset point on x-axis. 250861847f8eSopenharmony_ci * @param { number } y - The offset point on y-axis. 250961847f8eSopenharmony_ci * @param { common2D.Color } color - The shadow color. The range of color channels must be [0, 255]. 251061847f8eSopenharmony_ci * @returns { ShadowLayer } ShadowLayer object. 251161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 251261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 251361847f8eSopenharmony_ci * @static 251461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 251561847f8eSopenharmony_ci * @since 12 251661847f8eSopenharmony_ci */ 251761847f8eSopenharmony_ci static create(blurRadius: number, x: number, y: number, color: common2D.Color): ShadowLayer; 251861847f8eSopenharmony_ci 251961847f8eSopenharmony_ci /** 252061847f8eSopenharmony_ci * Makes a new ShadowLayer with the specified ARGB color of hexadecimal format. 252161847f8eSopenharmony_ci * 252261847f8eSopenharmony_ci * @param { number } blurRadius - The blur radius of the shadow. The blur radius must be greater than 0. 252361847f8eSopenharmony_ci * @param { number } x - The offset point on x-axis. 252461847f8eSopenharmony_ci * @param { number } y - The offset point on y-axis. 252561847f8eSopenharmony_ci * @param { number } color - The shadow color. Number must be ARGB color of hexadecimal format. 252661847f8eSopenharmony_ci * @returns { ShadowLayer } ShadowLayer object. 252761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 252861847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 252961847f8eSopenharmony_ci * @static 253061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 253161847f8eSopenharmony_ci * @since 13 253261847f8eSopenharmony_ci */ 253361847f8eSopenharmony_ci static create(blurRadius: number, x: number, y: number, color: number): ShadowLayer; 253461847f8eSopenharmony_ci } 253561847f8eSopenharmony_ci 253661847f8eSopenharmony_ci /** 253761847f8eSopenharmony_ci * ColorFilters are optional objects in the drawing pipeline. 253861847f8eSopenharmony_ci * 253961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 254061847f8eSopenharmony_ci * @since 11 254161847f8eSopenharmony_ci */ 254261847f8eSopenharmony_ci class ColorFilter { 254361847f8eSopenharmony_ci /** 254461847f8eSopenharmony_ci * Makes a color filter with the given color and blend mode. 254561847f8eSopenharmony_ci * @param { common2D.Color } color - The range of color channels must be [0, 255]. 254661847f8eSopenharmony_ci * @param { BlendMode } mode - BlendMode. 254761847f8eSopenharmony_ci * @returns { ColorFilter } Colorfilter object. 254861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 254961847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 255061847f8eSopenharmony_ci * @static 255161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 255261847f8eSopenharmony_ci * @since 11 255361847f8eSopenharmony_ci */ 255461847f8eSopenharmony_ci static createBlendModeColorFilter(color: common2D.Color, mode: BlendMode): ColorFilter; 255561847f8eSopenharmony_ci 255661847f8eSopenharmony_ci /** 255761847f8eSopenharmony_ci * Makes a color filter with the given ARGB color of hexadecimal format and blend mode. 255861847f8eSopenharmony_ci * @param { number } color - Number must be ARGB color of hexadecimal format. 255961847f8eSopenharmony_ci * @param { BlendMode } mode - BlendMode. 256061847f8eSopenharmony_ci * @returns { ColorFilter } Colorfilter object. 256161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 256261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 256361847f8eSopenharmony_ci * @static 256461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 256561847f8eSopenharmony_ci * @since 13 256661847f8eSopenharmony_ci */ 256761847f8eSopenharmony_ci static createBlendModeColorFilter(color: number, mode: BlendMode): ColorFilter; 256861847f8eSopenharmony_ci 256961847f8eSopenharmony_ci /** 257061847f8eSopenharmony_ci * Create a color filter consisting of two filters. 257161847f8eSopenharmony_ci * @param { ColorFilter } outer - The filter is used next. 257261847f8eSopenharmony_ci * @param { ColorFilter } inner - The filter is used first. 257361847f8eSopenharmony_ci * @returns { ColorFilter } Colorfilter object. 257461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 257561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 257661847f8eSopenharmony_ci * @static 257761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 257861847f8eSopenharmony_ci * @since 11 257961847f8eSopenharmony_ci */ 258061847f8eSopenharmony_ci static createComposeColorFilter(outer: ColorFilter, inner: ColorFilter): ColorFilter; 258161847f8eSopenharmony_ci /** 258261847f8eSopenharmony_ci * Makes a color filter that converts between linear colors and sRGB colors. 258361847f8eSopenharmony_ci * @returns { ColorFilter } Colorfilter object. 258461847f8eSopenharmony_ci * @static 258561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 258661847f8eSopenharmony_ci * @since 11 258761847f8eSopenharmony_ci */ 258861847f8eSopenharmony_ci static createLinearToSRGBGamma(): ColorFilter; 258961847f8eSopenharmony_ci /** 259061847f8eSopenharmony_ci * Makes a color filter that converts between sRGB colors and linear colors. 259161847f8eSopenharmony_ci * @returns { ColorFilter } Colorfilter object. 259261847f8eSopenharmony_ci * @static 259361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 259461847f8eSopenharmony_ci * @since 11 259561847f8eSopenharmony_ci */ 259661847f8eSopenharmony_ci static createSRGBGammaToLinear(): ColorFilter; 259761847f8eSopenharmony_ci /** 259861847f8eSopenharmony_ci * Makes a color filter that multiplies the luma of its input into the alpha channel, 259961847f8eSopenharmony_ci * and sets the red, green, and blue channels to zero. 260061847f8eSopenharmony_ci * @returns { ColorFilter } Colorfilter. 260161847f8eSopenharmony_ci * @static 260261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 260361847f8eSopenharmony_ci * @since 11 260461847f8eSopenharmony_ci */ 260561847f8eSopenharmony_ci static createLumaColorFilter(): ColorFilter; 260661847f8eSopenharmony_ci /** 260761847f8eSopenharmony_ci * Makes a color filter with a 5x4 color matrix 260861847f8eSopenharmony_ci * @param { Array<number> } matrix - Indicates the matrix, which is represented as a number array of length 20. 260961847f8eSopenharmony_ci * @returns { ColorFilter } Colorfilter object. 261061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 261161847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 261261847f8eSopenharmony_ci * @static 261361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 261461847f8eSopenharmony_ci * @since 12 261561847f8eSopenharmony_ci */ 261661847f8eSopenharmony_ci static createMatrixColorFilter(matrix: Array<number>): ColorFilter; 261761847f8eSopenharmony_ci } 261861847f8eSopenharmony_ci 261961847f8eSopenharmony_ci /** 262061847f8eSopenharmony_ci * ImageFilters are optional objects in the drawing pipeline. 262161847f8eSopenharmony_ci * 262261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 262361847f8eSopenharmony_ci * @since 12 262461847f8eSopenharmony_ci */ 262561847f8eSopenharmony_ci class ImageFilter { 262661847f8eSopenharmony_ci /** 262761847f8eSopenharmony_ci * Makes an ImageFilter object that blurs its input by the separate X and Y sigmas. 262861847f8eSopenharmony_ci * @param { number } sigmaX - Indicates the Gaussian sigma value for blurring along the X axis. Must be > 0. 262961847f8eSopenharmony_ci * @param { number } sigmaY - Indicates the Gaussian sigma value for blurring along the Y axis. Must be > 0. 263061847f8eSopenharmony_ci * @param { TileMode } tileMode - Indicates the tile mode applied at edges. 263161847f8eSopenharmony_ci * @param { ImageFilter | null } imageFilter - Indicates the input filter that is blurred, 263261847f8eSopenharmony_ci * uses source bitmap if this is null. 263361847f8eSopenharmony_ci * @returns { ImageFilter } ImageFilter object. 263461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 263561847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 263661847f8eSopenharmony_ci * @static 263761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 263861847f8eSopenharmony_ci * @since 12 263961847f8eSopenharmony_ci */ 264061847f8eSopenharmony_ci static createBlurImageFilter(sigmaX: number, sigmaY: number, 264161847f8eSopenharmony_ci tileMode: TileMode, imageFilter?: ImageFilter | null): ImageFilter; 264261847f8eSopenharmony_ci /** 264361847f8eSopenharmony_ci * Makes an ImageFilter object that applies the color filter to the input. 264461847f8eSopenharmony_ci * @param { ColorFilter } colorFilter - Indicates the color filter that transforms the input image. 264561847f8eSopenharmony_ci * @param { ImageFilter | null } imageFilter - Indicates the input filter, or uses the source bitmap if this is null. 264661847f8eSopenharmony_ci * @returns { ImageFilter } ImageFilter object. 264761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 264861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 264961847f8eSopenharmony_ci * @static 265061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 265161847f8eSopenharmony_ci * @since 12 265261847f8eSopenharmony_ci */ 265361847f8eSopenharmony_ci static createFromColorFilter(colorFilter: ColorFilter, imageFilter?: ImageFilter | null): ImageFilter; 265461847f8eSopenharmony_ci } 265561847f8eSopenharmony_ci /** 265661847f8eSopenharmony_ci * Enumerate join styles. The join style defines the shape of the joins of a 265761847f8eSopenharmony_ci * polyline segment drawn by the pen. 265861847f8eSopenharmony_ci * @enum { number } 265961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 266061847f8eSopenharmony_ci * @since 12 266161847f8eSopenharmony_ci */ 266261847f8eSopenharmony_ci enum JoinStyle { 266361847f8eSopenharmony_ci /** 266461847f8eSopenharmony_ci * Miter corner. If the angle of a polyline is small, its miter length may be inappropriate. 266561847f8eSopenharmony_ci * In this case, you need to use the miter limit to limit the miter length. 266661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 266761847f8eSopenharmony_ci * @since 12 266861847f8eSopenharmony_ci */ 266961847f8eSopenharmony_ci MITER_JOIN = 0, 267061847f8eSopenharmony_ci 267161847f8eSopenharmony_ci /** 267261847f8eSopenharmony_ci * Round corner. 267361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 267461847f8eSopenharmony_ci * @since 12 267561847f8eSopenharmony_ci */ 267661847f8eSopenharmony_ci ROUND_JOIN = 1, 267761847f8eSopenharmony_ci 267861847f8eSopenharmony_ci /** 267961847f8eSopenharmony_ci * Bevel corner. 268061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 268161847f8eSopenharmony_ci * @since 12 268261847f8eSopenharmony_ci */ 268361847f8eSopenharmony_ci BEVEL_JOIN = 2 268461847f8eSopenharmony_ci } 268561847f8eSopenharmony_ci 268661847f8eSopenharmony_ci /** 268761847f8eSopenharmony_ci * Enumerates cap styles of a pen. The cap style defines 268861847f8eSopenharmony_ci * the style of both ends of a segment drawn by the pen. 268961847f8eSopenharmony_ci * @enum { number } 269061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 269161847f8eSopenharmony_ci * @since 12 269261847f8eSopenharmony_ci */ 269361847f8eSopenharmony_ci enum CapStyle { 269461847f8eSopenharmony_ci /** 269561847f8eSopenharmony_ci * No cap style. Both ends of the segment are cut off square. 269661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 269761847f8eSopenharmony_ci * @since 12 269861847f8eSopenharmony_ci */ 269961847f8eSopenharmony_ci FLAT_CAP = 0, 270061847f8eSopenharmony_ci 270161847f8eSopenharmony_ci /** 270261847f8eSopenharmony_ci * Square cap style. Both ends have a square, the height of which 270361847f8eSopenharmony_ci * is half of the width of the segment, with the same width. 270461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 270561847f8eSopenharmony_ci * @since 12 270661847f8eSopenharmony_ci */ 270761847f8eSopenharmony_ci SQUARE_CAP = 1, 270861847f8eSopenharmony_ci 270961847f8eSopenharmony_ci /** 271061847f8eSopenharmony_ci * Round cap style. Both ends have a semicircle centered, the diameter of which 271161847f8eSopenharmony_ci * is the same as the width of the segment. 271261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 271361847f8eSopenharmony_ci * @since 12 271461847f8eSopenharmony_ci */ 271561847f8eSopenharmony_ci ROUND_CAP = 2 271661847f8eSopenharmony_ci } 271761847f8eSopenharmony_ci 271861847f8eSopenharmony_ci /** 271961847f8eSopenharmony_ci * Enumerates blur type. 272061847f8eSopenharmony_ci * @enum { number } 272161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 272261847f8eSopenharmony_ci * @since 12 272361847f8eSopenharmony_ci */ 272461847f8eSopenharmony_ci enum BlurType { 272561847f8eSopenharmony_ci /** 272661847f8eSopenharmony_ci * Fuzzy inside and outside. 272761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 272861847f8eSopenharmony_ci * @since 12 272961847f8eSopenharmony_ci */ 273061847f8eSopenharmony_ci NORMAL = 0, 273161847f8eSopenharmony_ci 273261847f8eSopenharmony_ci /** 273361847f8eSopenharmony_ci * Solid inside, fuzzy outside. 273461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 273561847f8eSopenharmony_ci * @since 12 273661847f8eSopenharmony_ci */ 273761847f8eSopenharmony_ci SOLID = 1, 273861847f8eSopenharmony_ci 273961847f8eSopenharmony_ci /** 274061847f8eSopenharmony_ci * Nothing inside, fuzzy outside. 274161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 274261847f8eSopenharmony_ci * @since 12 274361847f8eSopenharmony_ci */ 274461847f8eSopenharmony_ci OUTER = 2, 274561847f8eSopenharmony_ci 274661847f8eSopenharmony_ci /** 274761847f8eSopenharmony_ci * Fuzzy inside, nothing outside. 274861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 274961847f8eSopenharmony_ci * @since 12 275061847f8eSopenharmony_ci */ 275161847f8eSopenharmony_ci INNER = 3 275261847f8eSopenharmony_ci } 275361847f8eSopenharmony_ci 275461847f8eSopenharmony_ci /** 275561847f8eSopenharmony_ci * Provides settings for strokes during drawing. 275661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 275761847f8eSopenharmony_ci * @since 11 275861847f8eSopenharmony_ci */ 275961847f8eSopenharmony_ci class Pen { 276061847f8eSopenharmony_ci /** 276161847f8eSopenharmony_ci * Constructor for the pen. 276261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 276361847f8eSopenharmony_ci * @since 12 276461847f8eSopenharmony_ci */ 276561847f8eSopenharmony_ci constructor(); 276661847f8eSopenharmony_ci 276761847f8eSopenharmony_ci /** 276861847f8eSopenharmony_ci * Constructor for the pen from an existing pen object pen. 276961847f8eSopenharmony_ci * @param { Pen } pen - Indicates the Pen object. 277061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 277161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 277261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 277361847f8eSopenharmony_ci * @since 12 277461847f8eSopenharmony_ci */ 277561847f8eSopenharmony_ci constructor(pen: Pen); 277661847f8eSopenharmony_ci 277761847f8eSopenharmony_ci /** 277861847f8eSopenharmony_ci * Sets the stroke miter limit for a polyline drawn by a pen. 277961847f8eSopenharmony_ci * @param { number } miter - Indicates a variable that describes the miter limit. 278061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 278161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 278261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 278361847f8eSopenharmony_ci * @since 12 278461847f8eSopenharmony_ci */ 278561847f8eSopenharmony_ci setMiterLimit(miter: number): void; 278661847f8eSopenharmony_ci 278761847f8eSopenharmony_ci /** 278861847f8eSopenharmony_ci * Obtains the stroke miter limit of a polyline drawn by a pen. 278961847f8eSopenharmony_ci * @returns { number } Returns the miter limit. 279061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 279161847f8eSopenharmony_ci * @since 12 279261847f8eSopenharmony_ci */ 279361847f8eSopenharmony_ci getMiterLimit(): number; 279461847f8eSopenharmony_ci 279561847f8eSopenharmony_ci /** 279661847f8eSopenharmony_ci * Sets the shaderEffect for a pen. 279761847f8eSopenharmony_ci * @param { ShaderEffect } shaderEffect - Indicates the ShaderEffect object. 279861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 279961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 280061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 280161847f8eSopenharmony_ci * @since 12 280261847f8eSopenharmony_ci */ 280361847f8eSopenharmony_ci setShaderEffect(shaderEffect: ShaderEffect): void; 280461847f8eSopenharmony_ci 280561847f8eSopenharmony_ci /** 280661847f8eSopenharmony_ci * Set the color of the pen. 280761847f8eSopenharmony_ci * @param { common2D.Color } color - The range of color channels must be [0, 255]. 280861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 280961847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 281061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 281161847f8eSopenharmony_ci * @since 11 281261847f8eSopenharmony_ci */ 281361847f8eSopenharmony_ci setColor(color: common2D.Color): void; 281461847f8eSopenharmony_ci 281561847f8eSopenharmony_ci /** 281661847f8eSopenharmony_ci * Set the specified ARGB color of hexadecimal format to the pen. 281761847f8eSopenharmony_ci * @param { number } color - Number must be ARGB color of hexadecimal format. 281861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 281961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 282061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 282161847f8eSopenharmony_ci * @since 13 282261847f8eSopenharmony_ci */ 282361847f8eSopenharmony_ci setColor(color: number): void; 282461847f8eSopenharmony_ci 282561847f8eSopenharmony_ci /** 282661847f8eSopenharmony_ci * Set the AGRB color of the pen. 282761847f8eSopenharmony_ci * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255]. 282861847f8eSopenharmony_ci * @param { number } red - Red channel of color. The range of red must be [0, 255]. 282961847f8eSopenharmony_ci * @param { number } green - Green channel of color. The range of green must be [0, 255]. 283061847f8eSopenharmony_ci * @param { number } blue - Blue channel of color. The range of blue must be [0, 255]. 283161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 283261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 283361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 283461847f8eSopenharmony_ci * @since 12 283561847f8eSopenharmony_ci */ 283661847f8eSopenharmony_ci setColor(alpha: number, red: number, green: number, blue: number): void; 283761847f8eSopenharmony_ci 283861847f8eSopenharmony_ci /** 283961847f8eSopenharmony_ci * Obtains the color of a pen. The color is used by the pen to outline a shape. 284061847f8eSopenharmony_ci * @returns { common2D.Color } Returns a 32-bit (ARGB) variable that describes the color. 284161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 284261847f8eSopenharmony_ci * @since 12 284361847f8eSopenharmony_ci */ 284461847f8eSopenharmony_ci getColor(): common2D.Color; 284561847f8eSopenharmony_ci 284661847f8eSopenharmony_ci /** 284761847f8eSopenharmony_ci * Obtains the color of a pen. The color is used by the pen to outline a shape. 284861847f8eSopenharmony_ci * @returns { number } Returns a 32-bit (ARGB) variable that describes the color of hexadecimal format. 284961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 285061847f8eSopenharmony_ci * @since 13 285161847f8eSopenharmony_ci */ 285261847f8eSopenharmony_ci getHexColor(): number; 285361847f8eSopenharmony_ci 285461847f8eSopenharmony_ci /** 285561847f8eSopenharmony_ci * Sets the thickness of the pen used by the paint to outline the shape. 285661847f8eSopenharmony_ci * 285761847f8eSopenharmony_ci * @param { number } width - Zero thickness for hairline; greater than zero for pen thickness. 285861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 285961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 286061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 286161847f8eSopenharmony_ci * @since 11 286261847f8eSopenharmony_ci */ 286361847f8eSopenharmony_ci setStrokeWidth(width: number): void; 286461847f8eSopenharmony_ci 286561847f8eSopenharmony_ci /** 286661847f8eSopenharmony_ci * Obtains the thickness of a pen. This thickness determines the width of the outline of a shape. 286761847f8eSopenharmony_ci * @returns { number } Returns the thickness. 286861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 286961847f8eSopenharmony_ci * @since 12 287061847f8eSopenharmony_ci */ 287161847f8eSopenharmony_ci getWidth(): number; 287261847f8eSopenharmony_ci 287361847f8eSopenharmony_ci /** 287461847f8eSopenharmony_ci * Requests, but does not require, that edge pixels draw opaque or with partial transparency. 287561847f8eSopenharmony_ci * @param { boolean } aa - Setting for antialiasing. 287661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 287761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 287861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 287961847f8eSopenharmony_ci * @since 11 288061847f8eSopenharmony_ci */ 288161847f8eSopenharmony_ci setAntiAlias(aa: boolean): void; 288261847f8eSopenharmony_ci 288361847f8eSopenharmony_ci /** 288461847f8eSopenharmony_ci * Checks whether anti-aliasing is enabled for a pen. If anti-aliasing is enabled, 288561847f8eSopenharmony_ci * edges will be drawn with partial transparency. 288661847f8eSopenharmony_ci * @returns { boolean } Returns true if the anti-aliasing is enabled; returns false otherwise. 288761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 288861847f8eSopenharmony_ci * @since 12 288961847f8eSopenharmony_ci */ 289061847f8eSopenharmony_ci isAntiAlias(): boolean; 289161847f8eSopenharmony_ci 289261847f8eSopenharmony_ci /** 289361847f8eSopenharmony_ci * Replaces alpha, leaving RGB 289461847f8eSopenharmony_ci * 289561847f8eSopenharmony_ci * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255]. 289661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 289761847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 289861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 289961847f8eSopenharmony_ci * @since 11 290061847f8eSopenharmony_ci */ 290161847f8eSopenharmony_ci setAlpha(alpha: number): void; 290261847f8eSopenharmony_ci 290361847f8eSopenharmony_ci /** 290461847f8eSopenharmony_ci * Obtains the alpha of a pen. The alpha is used by the pen to outline a shape. 290561847f8eSopenharmony_ci * @returns { number } Returns a 8-bit variable that describes the alpha. 290661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 290761847f8eSopenharmony_ci * @since 12 290861847f8eSopenharmony_ci */ 290961847f8eSopenharmony_ci getAlpha(): number; 291061847f8eSopenharmony_ci 291161847f8eSopenharmony_ci /** 291261847f8eSopenharmony_ci * Sets ColorFilter to pen 291361847f8eSopenharmony_ci * 291461847f8eSopenharmony_ci * @param { ColorFilter } filter - ColorFilter to apply to subsequent draw. 291561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 291661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 291761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 291861847f8eSopenharmony_ci * @since 11 291961847f8eSopenharmony_ci */ 292061847f8eSopenharmony_ci setColorFilter(filter: ColorFilter): void; 292161847f8eSopenharmony_ci /** 292261847f8eSopenharmony_ci * Gets ColorFilter of pen 292361847f8eSopenharmony_ci * @returns { ColorFilter } ColorFilter. 292461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 292561847f8eSopenharmony_ci * @since 12 292661847f8eSopenharmony_ci */ 292761847f8eSopenharmony_ci getColorFilter(): ColorFilter; 292861847f8eSopenharmony_ci /** 292961847f8eSopenharmony_ci * Sets ImageFilter to pen 293061847f8eSopenharmony_ci * @param { ImageFilter | null } filter - ImageFilter to apply to subsequent draw. 293161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 293261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 293361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 293461847f8eSopenharmony_ci * @since 12 293561847f8eSopenharmony_ci */ 293661847f8eSopenharmony_ci setImageFilter(filter: ImageFilter | null): void; 293761847f8eSopenharmony_ci /** 293861847f8eSopenharmony_ci * Sets MaskFilter to pen. 293961847f8eSopenharmony_ci * 294061847f8eSopenharmony_ci * @param { MaskFilter } filter - MaskFilter to apply to subsequent draw. 294161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 294261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 294361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 294461847f8eSopenharmony_ci * @since 12 294561847f8eSopenharmony_ci */ 294661847f8eSopenharmony_ci setMaskFilter(filter: MaskFilter): void; 294761847f8eSopenharmony_ci 294861847f8eSopenharmony_ci /** 294961847f8eSopenharmony_ci * Sets PathEffect to pen. 295061847f8eSopenharmony_ci * 295161847f8eSopenharmony_ci * @param { PathEffect } effect - PathEffect to apply to subsequent draw. 295261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 295361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 295461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 295561847f8eSopenharmony_ci * @since 12 295661847f8eSopenharmony_ci */ 295761847f8eSopenharmony_ci setPathEffect(effect: PathEffect): void; 295861847f8eSopenharmony_ci 295961847f8eSopenharmony_ci /** 296061847f8eSopenharmony_ci * Sets ShadowLayer to pen. 296161847f8eSopenharmony_ci * 296261847f8eSopenharmony_ci * @param { ShadowLayer } shadowLayer - ShadowLayer to apply to subsequent draw. 296361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 296461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 296561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 296661847f8eSopenharmony_ci * @since 12 296761847f8eSopenharmony_ci */ 296861847f8eSopenharmony_ci setShadowLayer(shadowLayer: ShadowLayer): void; 296961847f8eSopenharmony_ci 297061847f8eSopenharmony_ci /** 297161847f8eSopenharmony_ci * Sets a blender that implements the specified blendmode enum. 297261847f8eSopenharmony_ci * 297361847f8eSopenharmony_ci * @param { BlendMode } mode - Blendmode. 297461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 297561847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 297661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 297761847f8eSopenharmony_ci * @since 11 297861847f8eSopenharmony_ci */ 297961847f8eSopenharmony_ci setBlendMode(mode: BlendMode): void; 298061847f8eSopenharmony_ci 298161847f8eSopenharmony_ci /** 298261847f8eSopenharmony_ci * Request color distribution error. 298361847f8eSopenharmony_ci * 298461847f8eSopenharmony_ci * @param { boolean } dither - Whether the color is distributed incorrectly. 298561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 298661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 298761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 298861847f8eSopenharmony_ci * @since 11 298961847f8eSopenharmony_ci */ 299061847f8eSopenharmony_ci setDither(dither: boolean): void; 299161847f8eSopenharmony_ci 299261847f8eSopenharmony_ci /** 299361847f8eSopenharmony_ci * Sets the JoinStyle for a pen. 299461847f8eSopenharmony_ci * 299561847f8eSopenharmony_ci * @param { JoinStyle } style - The JoinStyle. 299661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 299761847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 299861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 299961847f8eSopenharmony_ci * @since 12 300061847f8eSopenharmony_ci */ 300161847f8eSopenharmony_ci setJoinStyle(style: JoinStyle): void; 300261847f8eSopenharmony_ci 300361847f8eSopenharmony_ci /** 300461847f8eSopenharmony_ci * Obtains the JoinStyle of a pen. 300561847f8eSopenharmony_ci * 300661847f8eSopenharmony_ci * @returns { JoinStyle } The JoinStyle. 300761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 300861847f8eSopenharmony_ci * @since 12 300961847f8eSopenharmony_ci */ 301061847f8eSopenharmony_ci getJoinStyle(): JoinStyle; 301161847f8eSopenharmony_ci 301261847f8eSopenharmony_ci /** 301361847f8eSopenharmony_ci * Sets the CapStyle for a pen. 301461847f8eSopenharmony_ci * 301561847f8eSopenharmony_ci * @param { CapStyle } style - The CapStyle. 301661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 301761847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 301861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 301961847f8eSopenharmony_ci * @since 12 302061847f8eSopenharmony_ci */ 302161847f8eSopenharmony_ci setCapStyle(style: CapStyle): void; 302261847f8eSopenharmony_ci 302361847f8eSopenharmony_ci /** 302461847f8eSopenharmony_ci * Obtains the CapStyle of a pen. 302561847f8eSopenharmony_ci * 302661847f8eSopenharmony_ci * @returns { CapStyle } The CapStyle. 302761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 302861847f8eSopenharmony_ci * @since 12 302961847f8eSopenharmony_ci */ 303061847f8eSopenharmony_ci getCapStyle(): CapStyle; 303161847f8eSopenharmony_ci 303261847f8eSopenharmony_ci /** 303361847f8eSopenharmony_ci * Resets all pen contents to their initial values. 303461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 303561847f8eSopenharmony_ci * @since 12 303661847f8eSopenharmony_ci */ 303761847f8eSopenharmony_ci reset(): void; 303861847f8eSopenharmony_ci /** 303961847f8eSopenharmony_ci * Obtains the filled equivalent of the src path. 304061847f8eSopenharmony_ci * 304161847f8eSopenharmony_ci * @param { Path } src - The path read to create a filled version. 304261847f8eSopenharmony_ci * @param { Path } dst - The resulting path (may be the same as src). 304361847f8eSopenharmony_ci * @returns { boolean } true if the path should be filled, or false if it should be drawn with a hairline (width == 0) 304461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 304561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 304661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 304761847f8eSopenharmony_ci * @since 12 304861847f8eSopenharmony_ci */ 304961847f8eSopenharmony_ci getFillPath(src: Path, dst: Path): boolean; 305061847f8eSopenharmony_ci } 305161847f8eSopenharmony_ci 305261847f8eSopenharmony_ci /** 305361847f8eSopenharmony_ci * Provides settings for brush fill when drawing. 305461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 305561847f8eSopenharmony_ci * @since 11 305661847f8eSopenharmony_ci */ 305761847f8eSopenharmony_ci class Brush { 305861847f8eSopenharmony_ci /** 305961847f8eSopenharmony_ci * Constructor for the Brush. 306061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 306161847f8eSopenharmony_ci * @since 12 306261847f8eSopenharmony_ci */ 306361847f8eSopenharmony_ci constructor(); 306461847f8eSopenharmony_ci 306561847f8eSopenharmony_ci /** 306661847f8eSopenharmony_ci * Constructor for the Brush from an existing brush object brush. 306761847f8eSopenharmony_ci * @param { Brush } brush - Indicates the Brush object. 306861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 306961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 307061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 307161847f8eSopenharmony_ci * @since 12 307261847f8eSopenharmony_ci */ 307361847f8eSopenharmony_ci constructor(brush: Brush); 307461847f8eSopenharmony_ci 307561847f8eSopenharmony_ci /** 307661847f8eSopenharmony_ci * Set the color of the brush. 307761847f8eSopenharmony_ci * @param { common2D.Color } color - The range of color channels must be [0, 255]. 307861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 307961847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 308061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 308161847f8eSopenharmony_ci * @since 11 308261847f8eSopenharmony_ci */ 308361847f8eSopenharmony_ci setColor(color: common2D.Color): void; 308461847f8eSopenharmony_ci 308561847f8eSopenharmony_ci /** 308661847f8eSopenharmony_ci * Set the specified ARGB color of hexadecimal format to the brush. 308761847f8eSopenharmony_ci * @param { number } color - Number must be ARGB color of hexadecimal format. 308861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 308961847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 309061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 309161847f8eSopenharmony_ci * @since 13 309261847f8eSopenharmony_ci */ 309361847f8eSopenharmony_ci setColor(color: number): void; 309461847f8eSopenharmony_ci 309561847f8eSopenharmony_ci /** 309661847f8eSopenharmony_ci * Set the ARGB color of the brush. 309761847f8eSopenharmony_ci * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255]. 309861847f8eSopenharmony_ci * @param { number } red - Red channel of color. The range of red must be [0, 255]. 309961847f8eSopenharmony_ci * @param { number } green - Green channel of color. The range of green must be [0, 255]. 310061847f8eSopenharmony_ci * @param { number } blue - Blue channel of color. The range of blue must be [0, 255]. 310161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 310261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 310361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 310461847f8eSopenharmony_ci * @since 12 310561847f8eSopenharmony_ci */ 310661847f8eSopenharmony_ci setColor(alpha: number, red: number, green: number, blue: number): void; 310761847f8eSopenharmony_ci 310861847f8eSopenharmony_ci /** 310961847f8eSopenharmony_ci * Obtains the color of a brush. The color is used by the brush to fill in a shape. 311061847f8eSopenharmony_ci * @returns { common2D.Color } Returns a 32-bit (ARGB) variable that describes the color. 311161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 311261847f8eSopenharmony_ci * @since 12 311361847f8eSopenharmony_ci */ 311461847f8eSopenharmony_ci getColor(): common2D.Color; 311561847f8eSopenharmony_ci 311661847f8eSopenharmony_ci /** 311761847f8eSopenharmony_ci * Obtains the color of a brush. The color is used by the brush to fill in a shape. 311861847f8eSopenharmony_ci * @returns { number } Returns a 32-bit (ARGB) variable that describes the color of hexadecimal format. 311961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 312061847f8eSopenharmony_ci * @since 13 312161847f8eSopenharmony_ci */ 312261847f8eSopenharmony_ci getHexColor(): number; 312361847f8eSopenharmony_ci 312461847f8eSopenharmony_ci /** 312561847f8eSopenharmony_ci * Requests, but does not require, that edge pixels draw opaque or with partial transparency. 312661847f8eSopenharmony_ci * @param { boolean } aa - Setting for antialiasing. 312761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 312861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 312961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 313061847f8eSopenharmony_ci * @since 11 313161847f8eSopenharmony_ci */ 313261847f8eSopenharmony_ci setAntiAlias(aa: boolean): void; 313361847f8eSopenharmony_ci 313461847f8eSopenharmony_ci /** 313561847f8eSopenharmony_ci * Checks whether anti-aliasing is enabled for a brush. If anti-aliasing is enabled, 313661847f8eSopenharmony_ci * edges will be drawn with partial transparency. 313761847f8eSopenharmony_ci * @returns { boolean } Returns true if anti-aliasing is enabled; returns false otherwise. 313861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 313961847f8eSopenharmony_ci * @since 12 314061847f8eSopenharmony_ci */ 314161847f8eSopenharmony_ci isAntiAlias(): boolean; 314261847f8eSopenharmony_ci 314361847f8eSopenharmony_ci /** 314461847f8eSopenharmony_ci * Replaces alpha, leaving RGB 314561847f8eSopenharmony_ci * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255]. 314661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 314761847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 314861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 314961847f8eSopenharmony_ci * @since 11 315061847f8eSopenharmony_ci */ 315161847f8eSopenharmony_ci setAlpha(alpha: number): void; 315261847f8eSopenharmony_ci 315361847f8eSopenharmony_ci /** 315461847f8eSopenharmony_ci * Obtains the alpha of a brush. The alpha is used by the brush to fill in a shape. 315561847f8eSopenharmony_ci * @returns { number } Returns a 8-bit variable that describes the alpha. 315661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 315761847f8eSopenharmony_ci * @since 12 315861847f8eSopenharmony_ci */ 315961847f8eSopenharmony_ci getAlpha(): number; 316061847f8eSopenharmony_ci 316161847f8eSopenharmony_ci /** 316261847f8eSopenharmony_ci * Sets ColorFilter to brush 316361847f8eSopenharmony_ci * @param { ColorFilter } filter - ColorFilter to apply to subsequent draw. 316461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 316561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 316661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 316761847f8eSopenharmony_ci * @since 11 316861847f8eSopenharmony_ci */ 316961847f8eSopenharmony_ci setColorFilter(filter: ColorFilter): void; 317061847f8eSopenharmony_ci 317161847f8eSopenharmony_ci /** 317261847f8eSopenharmony_ci * Gets ColorFilter of brush 317361847f8eSopenharmony_ci * @returns { ColorFilter } ColorFilter. 317461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 317561847f8eSopenharmony_ci * @since 12 317661847f8eSopenharmony_ci */ 317761847f8eSopenharmony_ci getColorFilter(): ColorFilter; 317861847f8eSopenharmony_ci /** 317961847f8eSopenharmony_ci * Sets ImageFilter to brush 318061847f8eSopenharmony_ci * @param { ImageFilter | null } filter - ImageFilter to apply to subsequent draw. 318161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 318261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 318361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 318461847f8eSopenharmony_ci * @since 12 318561847f8eSopenharmony_ci */ 318661847f8eSopenharmony_ci setImageFilter(filter: ImageFilter | null): void; 318761847f8eSopenharmony_ci /** 318861847f8eSopenharmony_ci * Sets MaskFilter to brush. 318961847f8eSopenharmony_ci * @param { MaskFilter } filter - MaskFilter to apply to subsequent draw. 319061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 319161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 319261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 319361847f8eSopenharmony_ci * @since 12 319461847f8eSopenharmony_ci */ 319561847f8eSopenharmony_ci setMaskFilter(filter: MaskFilter): void; 319661847f8eSopenharmony_ci 319761847f8eSopenharmony_ci /** 319861847f8eSopenharmony_ci * Sets ShadowLayer to brush. 319961847f8eSopenharmony_ci * 320061847f8eSopenharmony_ci * @param { ShadowLayer } shadowLayer - ShadowLayer painting. 320161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 320261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 320361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 320461847f8eSopenharmony_ci * @since 12 320561847f8eSopenharmony_ci */ 320661847f8eSopenharmony_ci setShadowLayer(shadowLayer: ShadowLayer): void; 320761847f8eSopenharmony_ci 320861847f8eSopenharmony_ci /** 320961847f8eSopenharmony_ci * Sets the shaderEffect for a brush. 321061847f8eSopenharmony_ci * @param { ShaderEffect } shaderEffect - Indicates the ShaderEffect object. 321161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 321261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 321361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 321461847f8eSopenharmony_ci * @since 12 321561847f8eSopenharmony_ci */ 321661847f8eSopenharmony_ci setShaderEffect(shaderEffect: ShaderEffect): void; 321761847f8eSopenharmony_ci 321861847f8eSopenharmony_ci /** 321961847f8eSopenharmony_ci * Sets a blender that implements the specified blendmode enum. 322061847f8eSopenharmony_ci * @param { BlendMode } mode - Blendmode. 322161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 322261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 322361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 322461847f8eSopenharmony_ci * @since 11 322561847f8eSopenharmony_ci */ 322661847f8eSopenharmony_ci setBlendMode(mode: BlendMode): void; 322761847f8eSopenharmony_ci 322861847f8eSopenharmony_ci /** 322961847f8eSopenharmony_ci * Resets all brush contents to their initial values. 323061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 323161847f8eSopenharmony_ci * @since 12 323261847f8eSopenharmony_ci */ 323361847f8eSopenharmony_ci reset(): void; 323461847f8eSopenharmony_ci } 323561847f8eSopenharmony_ci 323661847f8eSopenharmony_ci /** 323761847f8eSopenharmony_ci * Declares functions related to the matrix object in the drawing module. 323861847f8eSopenharmony_ci * 323961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 324061847f8eSopenharmony_ci * @since 12 324161847f8eSopenharmony_ci */ 324261847f8eSopenharmony_ci class Matrix { 324361847f8eSopenharmony_ci /** 324461847f8eSopenharmony_ci * Creates an identity matrix. 324561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 324661847f8eSopenharmony_ci * @since 12 324761847f8eSopenharmony_ci */ 324861847f8eSopenharmony_ci constructor(); 324961847f8eSopenharmony_ci 325061847f8eSopenharmony_ci /** 325161847f8eSopenharmony_ci * Sets matrix to rotate by degrees about a pivot point at (px, py). 325261847f8eSopenharmony_ci * @param { number } degree - Indicates the angle of axes relative to upright axes. 325361847f8eSopenharmony_ci * @param { number } px - Indicates the pivot on x-axis. 325461847f8eSopenharmony_ci * @param { number } py - Indicates the pivot on y-axis. 325561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 325661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 325761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 325861847f8eSopenharmony_ci * @since 12 325961847f8eSopenharmony_ci */ 326061847f8eSopenharmony_ci setRotation(degree: number, px: number, py: number): void; 326161847f8eSopenharmony_ci 326261847f8eSopenharmony_ci /** 326361847f8eSopenharmony_ci * Sets matrix to scale by sx and sy, about a pivot point at (px, py). 326461847f8eSopenharmony_ci * @param { number } sx - Indicates the horizontal scale factor. 326561847f8eSopenharmony_ci * @param { number } sy - Indicates the vertical scale factor. 326661847f8eSopenharmony_ci * @param { number } px - Indicates the pivot on x-axis. 326761847f8eSopenharmony_ci * @param { number } py - Indicates the pivot on y-axis. 326861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 326961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 327061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 327161847f8eSopenharmony_ci * @since 12 327261847f8eSopenharmony_ci */ 327361847f8eSopenharmony_ci setScale(sx: number, sy: number, px: number, py: number): void; 327461847f8eSopenharmony_ci 327561847f8eSopenharmony_ci /** 327661847f8eSopenharmony_ci * Sets matrix to translate by (dx, dy). 327761847f8eSopenharmony_ci * @param { number } dx - Indicates the horizontal translation. 327861847f8eSopenharmony_ci * @param { number } dy - Indicates the vertical translation. 327961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 328061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 328161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 328261847f8eSopenharmony_ci * @since 12 328361847f8eSopenharmony_ci */ 328461847f8eSopenharmony_ci setTranslation(dx: number, dy: number): void; 328561847f8eSopenharmony_ci 328661847f8eSopenharmony_ci /** 328761847f8eSopenharmony_ci * Sets the params for a matrix. 328861847f8eSopenharmony_ci * @param { Array<number> } values - Each value in the array represents the following parameters: 328961847f8eSopenharmony_ci * values[0] - horizontal scale factor to store. 329061847f8eSopenharmony_ci * values[1] - horizontal skew factor to store. 329161847f8eSopenharmony_ci * values[2] - horizontal translation to store. 329261847f8eSopenharmony_ci * values[3] - vertical skew factor to store. 329361847f8eSopenharmony_ci * values[4] - vertical scale factor to store. 329461847f8eSopenharmony_ci * values[5] - vertical translation to store. 329561847f8eSopenharmony_ci * values[6] - input x-axis values perspective factor to store. 329661847f8eSopenharmony_ci * values[7] - input y-axis values perspective factor to store. 329761847f8eSopenharmony_ci * values[8] - perspective scale factor to store. 329861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 329961847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 330061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 330161847f8eSopenharmony_ci * @since 12 330261847f8eSopenharmony_ci */ 330361847f8eSopenharmony_ci setMatrix(values: Array<number>): void; 330461847f8eSopenharmony_ci 330561847f8eSopenharmony_ci /** 330661847f8eSopenharmony_ci * Sets matrix total to matrix a multiplied by matrix b. 330761847f8eSopenharmony_ci * @param { Matrix } matrix - Indicates the Matrix object. 330861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 330961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 331061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 331161847f8eSopenharmony_ci * @since 12 331261847f8eSopenharmony_ci */ 331361847f8eSopenharmony_ci preConcat(matrix: Matrix): void; 331461847f8eSopenharmony_ci 331561847f8eSopenharmony_ci /** 331661847f8eSopenharmony_ci * Returns true if the first matrix equals the second matrix. 331761847f8eSopenharmony_ci * @param { Matrix } matrix - Indicates the Matrix object. 331861847f8eSopenharmony_ci * @returns { Boolean } Returns true if the two matrices are equal; returns false otherwise. 331961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 332061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 332161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 332261847f8eSopenharmony_ci * @since 12 332361847f8eSopenharmony_ci */ 332461847f8eSopenharmony_ci isEqual(matrix: Matrix): Boolean; 332561847f8eSopenharmony_ci 332661847f8eSopenharmony_ci /** 332761847f8eSopenharmony_ci * Sets inverse to reciprocal matrix, returning true if matrix can be inverted. 332861847f8eSopenharmony_ci * @param { Matrix } matrix - Indicates the Matrix object. 332961847f8eSopenharmony_ci * @returns { Boolean } Returns true if matrix can be inverted; returns false otherwise. 333061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 333161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 333261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 333361847f8eSopenharmony_ci * @since 12 333461847f8eSopenharmony_ci */ 333561847f8eSopenharmony_ci invert(matrix: Matrix): Boolean; 333661847f8eSopenharmony_ci 333761847f8eSopenharmony_ci /** 333861847f8eSopenharmony_ci * Returns true if matrix is identity. 333961847f8eSopenharmony_ci * @returns { Boolean } Returns true if matrix is identity; returns false otherwise. 334061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 334161847f8eSopenharmony_ci * @since 12 334261847f8eSopenharmony_ci */ 334361847f8eSopenharmony_ci isIdentity(): Boolean; 334461847f8eSopenharmony_ci 334561847f8eSopenharmony_ci /** 334661847f8eSopenharmony_ci * Get one matrix value. Index is between the range of 0-8. 334761847f8eSopenharmony_ci * @param { number } index - one of 0-8 334861847f8eSopenharmony_ci * @returns { number } Returns value corresponding to index.Returns 0 if out of range. 334961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 335061847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 335161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 335261847f8eSopenharmony_ci * @since 12 335361847f8eSopenharmony_ci */ 335461847f8eSopenharmony_ci getValue(index: number): number; 335561847f8eSopenharmony_ci /** 335661847f8eSopenharmony_ci * Sets matrix to matrix multiplied by matrix constructed from rotating by degrees around pivot point (px, py). 335761847f8eSopenharmony_ci * This can be thought of as rotating around a pivot point after applying matrix. 335861847f8eSopenharmony_ci * @param { number } degree - Indicates the angle of axes relative to upright axes. 335961847f8eSopenharmony_ci * @param { number } px - Indicates the pivot on x-axis. 336061847f8eSopenharmony_ci * @param { number } py - Indicates the pivot on y-axis. 336161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 336261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 336361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 336461847f8eSopenharmony_ci * @since 12 336561847f8eSopenharmony_ci */ 336661847f8eSopenharmony_ci postRotate(degree: number, px: number, py: number): void; 336761847f8eSopenharmony_ci /** 336861847f8eSopenharmony_ci * Sets matrix to matrix multiplied by matrix constructed from scaling by (sx, sy) relative to pivot point (px, py). 336961847f8eSopenharmony_ci * This can be thought of as scaling relative to a pivot point after applying matrix. 337061847f8eSopenharmony_ci * @param { number } sx - Indicates the horizontal scale factor. 337161847f8eSopenharmony_ci * @param { number } sy - Indicates the vertical scale factor. 337261847f8eSopenharmony_ci * @param { number } px - Indicates the pivot on x-axis. 337361847f8eSopenharmony_ci * @param { number } py - Indicates the pivot on y-axis. 337461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 337561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 337661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 337761847f8eSopenharmony_ci * @since 12 337861847f8eSopenharmony_ci */ 337961847f8eSopenharmony_ci postScale(sx: number, sy: number, px: number, py: number): void; 338061847f8eSopenharmony_ci /** 338161847f8eSopenharmony_ci * Sets matrix to matrix multiplied by matrix constructed from translation (dx, dy). 338261847f8eSopenharmony_ci * This can be thought of as moving the point to be mapped after applying matrix. 338361847f8eSopenharmony_ci * @param { number } dx - Indicates the horizontal translation. 338461847f8eSopenharmony_ci * @param { number } dy - Indicates the vertical translation. 338561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 338661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 338761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 338861847f8eSopenharmony_ci * @since 12 338961847f8eSopenharmony_ci */ 339061847f8eSopenharmony_ci postTranslate(dx: number, dy: number): void; 339161847f8eSopenharmony_ci /** 339261847f8eSopenharmony_ci * Sets matrix to matrix multiplied by matrix constructed from rotating by degrees around pivot point (px, py). 339361847f8eSopenharmony_ci * This can be thought of as rotating around a pivot point before applying matrix. 339461847f8eSopenharmony_ci * @param { number } degree - Indicates the angle of axes relative to upright axes. 339561847f8eSopenharmony_ci * @param { number } px - Indicates the pivot on x-axis. 339661847f8eSopenharmony_ci * @param { number } py - Indicates the pivot on y-axis. 339761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 339861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 339961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 340061847f8eSopenharmony_ci * @since 12 340161847f8eSopenharmony_ci */ 340261847f8eSopenharmony_ci preRotate(degree: number, px: number, py: number): void; 340361847f8eSopenharmony_ci /** 340461847f8eSopenharmony_ci * Sets matrix to matrix multiplied by matrix constructed from scaling by (sx, sy) relative to pivot point (px, py). 340561847f8eSopenharmony_ci * This can be thought of as scaling relative to a pivot point before applying matrix. 340661847f8eSopenharmony_ci * @param { number } sx - Indicates the horizontal scale factor. 340761847f8eSopenharmony_ci * @param { number } sy - Indicates the vertical scale factor. 340861847f8eSopenharmony_ci * @param { number } px - Indicates the pivot on x-axis. 340961847f8eSopenharmony_ci * @param { number } py - Indicates the pivot on y-axis. 341061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 341161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 341261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 341361847f8eSopenharmony_ci * @since 12 341461847f8eSopenharmony_ci */ 341561847f8eSopenharmony_ci preScale(sx: number, sy: number, px: number, py: number): void; 341661847f8eSopenharmony_ci /** 341761847f8eSopenharmony_ci * Sets matrix to matrix multiplied by matrix constructed from translation (dx, dy). 341861847f8eSopenharmony_ci * This can be thought of as moving the point to be mapped before applying matrix. 341961847f8eSopenharmony_ci * @param { number } dx - Indicates the horizontal translation. 342061847f8eSopenharmony_ci * @param { number } dy - Indicates the vertical translation. 342161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 342261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 342361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 342461847f8eSopenharmony_ci * @since 12 342561847f8eSopenharmony_ci */ 342661847f8eSopenharmony_ci preTranslate(dx: number, dy: number): void; 342761847f8eSopenharmony_ci /** 342861847f8eSopenharmony_ci * Reset matrix to identity. 342961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 343061847f8eSopenharmony_ci * @since 12 343161847f8eSopenharmony_ci */ 343261847f8eSopenharmony_ci reset(): void; 343361847f8eSopenharmony_ci /** 343461847f8eSopenharmony_ci * Maps src array of length count to dst array of equal or greater length. 343561847f8eSopenharmony_ci * This can be thought of as moving the point to be mapped before applying matrix. 343661847f8eSopenharmony_ci * @param { Array<common2D.Point> } src - points to transform. 343761847f8eSopenharmony_ci * @returns { Array<common2D.Point> } Return mapped points array. 343861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 343961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 344061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 344161847f8eSopenharmony_ci * @since 12 344261847f8eSopenharmony_ci */ 344361847f8eSopenharmony_ci mapPoints(src: Array<common2D.Point>): Array<common2D.Point>; 344461847f8eSopenharmony_ci /** 344561847f8eSopenharmony_ci * Return nine scalar values contained by Matrix. 344661847f8eSopenharmony_ci * @returns { Array<number> } nine scalar values contained by Matrix. 344761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 344861847f8eSopenharmony_ci * @since 12 344961847f8eSopenharmony_ci */ 345061847f8eSopenharmony_ci getAll(): Array<number>; 345161847f8eSopenharmony_ci /** 345261847f8eSopenharmony_ci * Sets dst to bounds of src corners mapped by matrix transformation. 345361847f8eSopenharmony_ci * @param { common2D.Rect } dst - Rect to map from. 345461847f8eSopenharmony_ci * @param { common2D.Rect } src - Rect to map to. 345561847f8eSopenharmony_ci * @returns { boolean } Returns true if the mapped src is equal to the dst; returns false is not equal. 345661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 345761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 345861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 345961847f8eSopenharmony_ci * @since 12 346061847f8eSopenharmony_ci */ 346161847f8eSopenharmony_ci mapRect(dst: common2D.Rect, src: common2D.Rect): boolean; 346261847f8eSopenharmony_ci /** 346361847f8eSopenharmony_ci * Sets matrix to scale and translate src rect to dst rect. 346461847f8eSopenharmony_ci * @param { common2D.Rect } src - Rect to map from. 346561847f8eSopenharmony_ci * @param { common2D.Rect } dst - Rect to map to. 346661847f8eSopenharmony_ci * @param { ScaleToFit } scaleToFit - Describes how matrix is constructed to map one rect to another. 346761847f8eSopenharmony_ci * @returns { boolean } Returns true if dst is empty, and sets matrix to: 346861847f8eSopenharmony_ci | 0 0 0 | 346961847f8eSopenharmony_ci | 0 0 0 | 347061847f8eSopenharmony_ci | 0 0 1 |. 347161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 347261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 347361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 347461847f8eSopenharmony_ci * @since 12 347561847f8eSopenharmony_ci */ 347661847f8eSopenharmony_ci setRectToRect(src: common2D.Rect, dst: common2D.Rect, scaleToFit: ScaleToFit): boolean; 347761847f8eSopenharmony_ci /** 347861847f8eSopenharmony_ci * Sets Matrix to map src to dst. Count must be zero or greater, and four or less. 347961847f8eSopenharmony_ci * @param { Array<common2D.Point> } src - Point to map from 348061847f8eSopenharmony_ci * @param { Array<common2D.Point> } dst - Point to map to 348161847f8eSopenharmony_ci * @param { number } count - Number of Point in src and dst 348261847f8eSopenharmony_ci * @returns { boolean } Returns true if Matrix was constructed successfully 348361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 348461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 348561847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 348661847f8eSopenharmony_ci * @since 12 348761847f8eSopenharmony_ci */ 348861847f8eSopenharmony_ci setPolyToPoly(src: Array<common2D.Point>, dst: Array<common2D.Point>, count: number): boolean; 348961847f8eSopenharmony_ci } 349061847f8eSopenharmony_ci 349161847f8eSopenharmony_ci /** 349261847f8eSopenharmony_ci * Describes a scale-to-fit values. 349361847f8eSopenharmony_ci * @enum { number } 349461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 349561847f8eSopenharmony_ci * @since 12 349661847f8eSopenharmony_ci */ 349761847f8eSopenharmony_ci enum ScaleToFit { 349861847f8eSopenharmony_ci /** 349961847f8eSopenharmony_ci * Scales in x and y to fill destination Rect. 350061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 350161847f8eSopenharmony_ci * @since 12 350261847f8eSopenharmony_ci */ 350361847f8eSopenharmony_ci FILL_SCALE_TO_FIT = 0, 350461847f8eSopenharmony_ci 350561847f8eSopenharmony_ci /** 350661847f8eSopenharmony_ci * Scales and aligns to left and top. 350761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 350861847f8eSopenharmony_ci * @since 12 350961847f8eSopenharmony_ci */ 351061847f8eSopenharmony_ci START_SCALE_TO_FIT = 1, 351161847f8eSopenharmony_ci 351261847f8eSopenharmony_ci /** 351361847f8eSopenharmony_ci * Scales and aligns to center. 351461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 351561847f8eSopenharmony_ci * @since 12 351661847f8eSopenharmony_ci */ 351761847f8eSopenharmony_ci CENTER_SCALE_TO_FIT = 2, 351861847f8eSopenharmony_ci 351961847f8eSopenharmony_ci /** 352061847f8eSopenharmony_ci * Scales and aligns to right and bottom. 352161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 352261847f8eSopenharmony_ci * @since 12 352361847f8eSopenharmony_ci */ 352461847f8eSopenharmony_ci END_SCALE_TO_FIT = 3 352561847f8eSopenharmony_ci } 352661847f8eSopenharmony_ci 352761847f8eSopenharmony_ci /** 352861847f8eSopenharmony_ci * Describes a region object. 352961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 353061847f8eSopenharmony_ci * @since 12 353161847f8eSopenharmony_ci */ 353261847f8eSopenharmony_ci class Region { 353361847f8eSopenharmony_ci /** 353461847f8eSopenharmony_ci * Determines whether the test point is in the region. 353561847f8eSopenharmony_ci * @param { number } x - Indicates the x coordinate of the point. The parameter must be an integer. 353661847f8eSopenharmony_ci * @param { number } y - Indicates the y coordinate of the point. The parameter must be an integer. 353761847f8eSopenharmony_ci * @returns { boolean } Returns true if (x, y) is inside region; returns false otherwise. 353861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 353961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 354061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 354161847f8eSopenharmony_ci * @since 12 354261847f8eSopenharmony_ci */ 354361847f8eSopenharmony_ci isPointContained(x: number, y:number): boolean; 354461847f8eSopenharmony_ci 354561847f8eSopenharmony_ci /** 354661847f8eSopenharmony_ci * Determines whether other region is in the region. 354761847f8eSopenharmony_ci * @param { Region } other - Other region object. 354861847f8eSopenharmony_ci * @returns { boolean } Returns true if other region is completely inside the region object; 354961847f8eSopenharmony_ci * <br>returns false otherwise. 355061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 355161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 355261847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 355361847f8eSopenharmony_ci * @since 12 355461847f8eSopenharmony_ci */ 355561847f8eSopenharmony_ci isRegionContained(other: Region): boolean; 355661847f8eSopenharmony_ci 355761847f8eSopenharmony_ci /** 355861847f8eSopenharmony_ci * Replaces region with the result of region op region. 355961847f8eSopenharmony_ci * @param { Region } region - Region object. 356061847f8eSopenharmony_ci * @param { RegionOp } regionOp - Operation type. 356161847f8eSopenharmony_ci * @returns { boolean } Returns true if replaced region is not empty; returns false otherwise. 356261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 356361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 356461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 356561847f8eSopenharmony_ci * @since 12 356661847f8eSopenharmony_ci */ 356761847f8eSopenharmony_ci op(region: Region, regionOp: RegionOp): boolean; 356861847f8eSopenharmony_ci 356961847f8eSopenharmony_ci /** 357061847f8eSopenharmony_ci * Determines whether rect and region does not intersect. 357161847f8eSopenharmony_ci * @param { number } left - Left position of rectangle. The parameter must be an integer. 357261847f8eSopenharmony_ci * @param { number } top - Top position of rectangle. The parameter must be an integer. 357361847f8eSopenharmony_ci * @param { number } right - Right position of rectangle. The parameter must be an integer. 357461847f8eSopenharmony_ci * @param { number } bottom - Bottom position of rectangle. The parameter must be an integer. 357561847f8eSopenharmony_ci * @returns { boolean } Returns true if rect and region is not intersect; returns false otherwise. 357661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 357761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 357861847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 357961847f8eSopenharmony_ci * @since 12 358061847f8eSopenharmony_ci */ 358161847f8eSopenharmony_ci quickReject(left: number, top: number, right: number, bottom: number): boolean; 358261847f8eSopenharmony_ci 358361847f8eSopenharmony_ci /** 358461847f8eSopenharmony_ci * Sets the region to match outline of path within clip. 358561847f8eSopenharmony_ci * @param { Path } path - Providing outline. 358661847f8eSopenharmony_ci * @param { Region } clip - Region object. 358761847f8eSopenharmony_ci * @returns { boolean } Returns true if constructed region is not empty; returns false otherwise. 358861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 358961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 359061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 359161847f8eSopenharmony_ci * @since 12 359261847f8eSopenharmony_ci */ 359361847f8eSopenharmony_ci setPath(path: Path, clip: Region): boolean; 359461847f8eSopenharmony_ci 359561847f8eSopenharmony_ci /** 359661847f8eSopenharmony_ci * Sets a rect to region. 359761847f8eSopenharmony_ci * @param { number } left - Left position of rectangle. The parameter must be an integer. 359861847f8eSopenharmony_ci * @param { number } top - Top position of rectangle. The parameter must be an integer. 359961847f8eSopenharmony_ci * @param { number } right - Right position of rectangle. The parameter must be an integer. 360061847f8eSopenharmony_ci * @param { number } bottom - Bottom position of rectangle. The parameter must be an integer. 360161847f8eSopenharmony_ci * @returns { boolean } Returns true if constructed region is not empty; returns false otherwise. 360261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 360361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 360461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 360561847f8eSopenharmony_ci * @since 12 360661847f8eSopenharmony_ci */ 360761847f8eSopenharmony_ci setRect(left: number, top: number, right: number, bottom: number): boolean; 360861847f8eSopenharmony_ci } 360961847f8eSopenharmony_ci 361061847f8eSopenharmony_ci /** 361161847f8eSopenharmony_ci * Enumerates of operations when two regions are combined. 361261847f8eSopenharmony_ci * @enum { number } 361361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 361461847f8eSopenharmony_ci * @since 12 361561847f8eSopenharmony_ci */ 361661847f8eSopenharmony_ci enum RegionOp { 361761847f8eSopenharmony_ci /** 361861847f8eSopenharmony_ci * Difference operation. 361961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 362061847f8eSopenharmony_ci * @since 12 362161847f8eSopenharmony_ci */ 362261847f8eSopenharmony_ci DIFFERENCE = 0, 362361847f8eSopenharmony_ci 362461847f8eSopenharmony_ci /** 362561847f8eSopenharmony_ci * Intersect operation. 362661847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 362761847f8eSopenharmony_ci * @since 12 362861847f8eSopenharmony_ci */ 362961847f8eSopenharmony_ci INTERSECT = 1, 363061847f8eSopenharmony_ci 363161847f8eSopenharmony_ci /** 363261847f8eSopenharmony_ci * Union operation. 363361847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 363461847f8eSopenharmony_ci * @since 12 363561847f8eSopenharmony_ci */ 363661847f8eSopenharmony_ci UNION = 2, 363761847f8eSopenharmony_ci 363861847f8eSopenharmony_ci /** 363961847f8eSopenharmony_ci * Xor operation. 364061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 364161847f8eSopenharmony_ci * @since 12 364261847f8eSopenharmony_ci */ 364361847f8eSopenharmony_ci XOR = 3, 364461847f8eSopenharmony_ci 364561847f8eSopenharmony_ci /** 364661847f8eSopenharmony_ci * Reverse difference operation. 364761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 364861847f8eSopenharmony_ci * @since 12 364961847f8eSopenharmony_ci */ 365061847f8eSopenharmony_ci REVERSE_DIFFERENCE = 4, 365161847f8eSopenharmony_ci 365261847f8eSopenharmony_ci /** 365361847f8eSopenharmony_ci * Replace operation. 365461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 365561847f8eSopenharmony_ci * @since 12 365661847f8eSopenharmony_ci */ 365761847f8eSopenharmony_ci REPLACE = 5 365861847f8eSopenharmony_ci } 365961847f8eSopenharmony_ci 366061847f8eSopenharmony_ci /** 366161847f8eSopenharmony_ci * Enumerates of corner radius position. 366261847f8eSopenharmony_ci * 366361847f8eSopenharmony_ci * @enum { number } 366461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 366561847f8eSopenharmony_ci * @since 12 366661847f8eSopenharmony_ci */ 366761847f8eSopenharmony_ci enum CornerPos { 366861847f8eSopenharmony_ci /** 366961847f8eSopenharmony_ci * Index of top-left corner radius. 367061847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 367161847f8eSopenharmony_ci * @since 12 367261847f8eSopenharmony_ci */ 367361847f8eSopenharmony_ci TOP_LEFT_POS = 0, 367461847f8eSopenharmony_ci 367561847f8eSopenharmony_ci /** 367661847f8eSopenharmony_ci * Index of top-right corner radius. 367761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 367861847f8eSopenharmony_ci * @since 12 367961847f8eSopenharmony_ci */ 368061847f8eSopenharmony_ci TOP_RIGHT_POS = 1, 368161847f8eSopenharmony_ci 368261847f8eSopenharmony_ci /** 368361847f8eSopenharmony_ci * Index of bottom-right corner radius. 368461847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 368561847f8eSopenharmony_ci * @since 12 368661847f8eSopenharmony_ci */ 368761847f8eSopenharmony_ci BOTTOM_RIGHT_POS = 2, 368861847f8eSopenharmony_ci 368961847f8eSopenharmony_ci /** 369061847f8eSopenharmony_ci * Index of bottom-left corner radius. 369161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 369261847f8eSopenharmony_ci * @since 12 369361847f8eSopenharmony_ci */ 369461847f8eSopenharmony_ci BOTTOM_LEFT_POS = 3 369561847f8eSopenharmony_ci } 369661847f8eSopenharmony_ci 369761847f8eSopenharmony_ci /** 369861847f8eSopenharmony_ci * Enumeration defines the constraint type. 369961847f8eSopenharmony_ci * 370061847f8eSopenharmony_ci * @enum { number } 370161847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 370261847f8eSopenharmony_ci * @since 12 370361847f8eSopenharmony_ci */ 370461847f8eSopenharmony_ci enum SrcRectConstraint { 370561847f8eSopenharmony_ci 370661847f8eSopenharmony_ci /** 370761847f8eSopenharmony_ci * Using sampling only inside bounds in a slower manner. 370861847f8eSopenharmony_ci * 370961847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 371061847f8eSopenharmony_ci * @since 12 371161847f8eSopenharmony_ci */ 371261847f8eSopenharmony_ci STRICT = 0, 371361847f8eSopenharmony_ci 371461847f8eSopenharmony_ci /** 371561847f8eSopenharmony_ci * Using sampling outside bounds in a faster manner. 371661847f8eSopenharmony_ci * 371761847f8eSopenharmony_ci * @syscap SystemCapability.Graphics.Drawing 371861847f8eSopenharmony_ci * @since 12 371961847f8eSopenharmony_ci */ 372061847f8eSopenharmony_ci FAST = 1 372161847f8eSopenharmony_ci } 372261847f8eSopenharmony_ci} 372361847f8eSopenharmony_ci 372461847f8eSopenharmony_ciexport default drawing; 3725