mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-27 01:11:35 +00:00
!12469 Update TS interface with new graphics drawing methods
Merge pull request !12469 from rodichevilya/int_ts_drawing_api
This commit is contained in:
commit
b12d910ce5
20
api/@ohos.graphics.common2D.d.ts
vendored
20
api/@ohos.graphics.common2D.d.ts
vendored
@ -139,6 +139,26 @@ declare namespace common2D {
|
||||
*/
|
||||
z: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides functionality for common2D objects.
|
||||
*
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
class Utils {
|
||||
/**
|
||||
* Sets rect to the union of rect and other.
|
||||
* @param { Rect } rect - Rect object. Will be updated with the result of the join.
|
||||
* @param { Rect } other - Rect object.
|
||||
* @returns { boolean } Returns true if rect and other are not nullptr and other is not empty
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
static joinRect(rect: Rect, other: Rect): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export default common2D;
|
608
api/@ohos.graphics.drawing.d.ts
vendored
608
api/@ohos.graphics.drawing.d.ts
vendored
@ -20,6 +20,7 @@
|
||||
|
||||
import type image from './@ohos.multimedia.image';
|
||||
import type common2D from './@ohos.graphics.common2D';
|
||||
import type uiEffect from './@ohos.graphics.uiEffect';
|
||||
|
||||
/**
|
||||
* Provides functions such as 2D graphics rendering, text drawing, and image display.
|
||||
@ -273,6 +274,33 @@ declare namespace drawing {
|
||||
INVERSE_EVEN_ODD = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerate path measure flags for matrix.
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
enum PathMeasureMatrixFlags {
|
||||
/**
|
||||
* Gets position.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
GET_POSITION_MATRIX = 0,
|
||||
/**
|
||||
* Gets tangent.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
GET_TANGENT_MATRIX = 1,
|
||||
/**
|
||||
* Gets both position and tangent.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
GET_POSITION_AND_TANGENT_MATRIX = 2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the definition of the roundRect.
|
||||
*
|
||||
@ -291,6 +319,40 @@ declare namespace drawing {
|
||||
* @since 12
|
||||
*/
|
||||
constructor(rect: common2D.Rect, xRadii: number, yRadii: number);
|
||||
|
||||
/**
|
||||
* Sets the radiusX and radiusY for a specific corner position.
|
||||
* @param { CornerPos } pos - Indicates the corner radius position.
|
||||
* @param { number } x - Indicates the corner radius on x-axis.
|
||||
* @param { number } y - Indicates the corner radius on y-axis.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
setCorner(pos: CornerPos, x: number, y: number): void;
|
||||
|
||||
/**
|
||||
* Gets a point with the values of x-axis and y-axis of the selected corner radius.
|
||||
* @param { CornerPos } pos - Indicates the corner radius position.
|
||||
* @returns { common2D.Point } Returns a point with the values of x-axis and y-axis of the corner radius.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getCorner(pos: CornerPos): common2D.Point;
|
||||
|
||||
/**
|
||||
* Translates round rect by (dx, dy).
|
||||
* @param { number } dx - Indicates the offsets added to rect left and rect right.
|
||||
* @param { number } dy - Indicates the offsets added to rect top and rect bottom.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
offset(dx: number, dy: number): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -343,6 +405,21 @@ declare namespace drawing {
|
||||
* @since 11
|
||||
*/
|
||||
class Path {
|
||||
/**
|
||||
* Creates a Path.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Creates a Path from other path.
|
||||
* @param { Path } path - the path to copy content from.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
constructor(path: Path);
|
||||
|
||||
/**
|
||||
* Sets the start point of a path
|
||||
* @param { number } x - Indicates the x coordinate of the start point.
|
||||
@ -657,6 +734,56 @@ declare namespace drawing {
|
||||
* @since 12
|
||||
*/
|
||||
getLength(forceClosed: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the position and tangent of the distance from the starting position of the path.
|
||||
*
|
||||
* @param { boolean } forceClosed - Whether to close the path.
|
||||
* @param { number } distance - The distance from the start of the path, should be greater than 0 and less than 'GetLength()'
|
||||
* @param { common2D.Point } position - Sets to the position of distance from the starting position of the path.
|
||||
* @param { common2D.Point } tangent - Sets to the tangent of distance from the starting position of the path.
|
||||
* @returns { boolean } - Returns true if succeeded, otherwise false.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getPositionAndTangent(forceClosed: boolean, distance: number, position: common2D.Point, tangent: common2D.Point): boolean;
|
||||
|
||||
/**
|
||||
* Determines whether the current contour is closed.
|
||||
*
|
||||
* @returns { boolean } - Returns true if the current contour is closed, otherwise false.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
isClosed(): boolean;
|
||||
|
||||
/**
|
||||
* Computes the corresponding matrix at the specified distance.
|
||||
*
|
||||
* @param { boolean } forceClosed - Whether to close the path.
|
||||
* @param { number } distance - The distance from the start of the path.
|
||||
* @param { drawing.Matrix } matrix - Indicates the pointer to an Matrix object.
|
||||
* @param { PathMeasureMatrixFlags } flags - Indicates what should be returned in the matrix.
|
||||
* @returns { boolean } - Returns false if there is no path, or a zero-length path was specified, in which case matrix is unchanged.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getMatrix(forceClosed: boolean, distance: number, matrix: drawing.Matrix, flags: PathMeasureMatrixFlags): boolean
|
||||
|
||||
/**
|
||||
* Parses the SVG format string that describes the drawing path, and sets the path.
|
||||
*
|
||||
* @param { string } str - A string in SVG format that describes the drawing path.
|
||||
* @returns { boolean } true if build succeeded, otherwise false.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
buildFromSvgString(str: string): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -894,6 +1021,35 @@ declare namespace drawing {
|
||||
*/
|
||||
drawImage(pixelmap: image.PixelMap, left: number, top: number, samplingOptions?: SamplingOptions): void;
|
||||
|
||||
/**
|
||||
* Draws the specified source image onto the canvas,
|
||||
* scaled and translated to the destination rectangle.
|
||||
* @param { image.PixelMap } pixelmap - The source image.
|
||||
* @param { common2D.Rect } dstRect - The area of destination canvas.
|
||||
* @param { SamplingOptions } samplingOptions - SamplingOptions used to describe the sampling mode.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
drawImageRect(pixelmap: image.PixelMap, dstRect: common2D.Rect, samplingOptions?: SamplingOptions): void;
|
||||
|
||||
/**
|
||||
* Draws the specified source rectangle of the image onto the canvas,
|
||||
* scaled and translated to the destination rectangle.
|
||||
* @param { image.PixelMap } pixelmap - The source image.
|
||||
* @param { common2D.Rect } srcRect - The area of source image.
|
||||
* @param { common2D.Rect } dstRect - The area of destination canvas.
|
||||
* @param { SamplingOptions } samplingOptions - SamplingOptions used to describe the sampling mode.
|
||||
* @param { SrcRectConstraint } constraint - Constraint type. The default value is STRICT.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
drawImageRectWithSrc(pixelmap: image.PixelMap, srcRect: common2D.Rect, dstRect: common2D.Rect,
|
||||
samplingOptions?: SamplingOptions, constraint?: SrcRectConstraint): void;
|
||||
|
||||
/**
|
||||
* Fills clip with color color. Mode determines how ARGB is combined with destination.
|
||||
* @param { common2D.Color } color - The range of color channels must be [0, 255].
|
||||
@ -1240,6 +1396,39 @@ declare namespace drawing {
|
||||
*/
|
||||
concatMatrix(matrix: Matrix): void;
|
||||
|
||||
/**
|
||||
* Replace the clipping area with the intersection or difference of the
|
||||
* current clipping area and Region, and use a clipping edge that is aliased or anti-aliased.
|
||||
* @param { Region } region - Region object.
|
||||
* @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
clipRegion(region: Region, clipOp?: ClipOp): void;
|
||||
|
||||
/**
|
||||
* Replaces the clipping area with the intersection or difference between the
|
||||
* current clipping area and RoundRect, and use a clipping edge that is aliased or anti-aliased.
|
||||
* @param { drawing.RoundRect } roundRect - To combine with clipping area.
|
||||
* @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect.
|
||||
* @param { boolean } doAntiAlias - True if clip is to be anti-aliased. The default value is false.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
clipRoundRect(roundRect: drawing.RoundRect, clipOp?: ClipOp, doAntiAlias?: boolean): void;
|
||||
|
||||
/**
|
||||
* Checks whether the drawable area is empty.
|
||||
* @returns { boolean } Returns true if drawable area is empty.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
isClipEmpty(): boolean;
|
||||
|
||||
/**
|
||||
* Sets matrix of canvas.
|
||||
* @param { Matrix } matrix - Declares functions related to the matrix object in the drawing module.
|
||||
@ -1249,6 +1438,13 @@ declare namespace drawing {
|
||||
* @since 12
|
||||
*/
|
||||
setMatrix(matrix: Matrix): void;
|
||||
|
||||
/**
|
||||
* Sets matrix of canvas to the identity matrix.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
resetMatrix(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1359,6 +1555,21 @@ declare namespace drawing {
|
||||
*/
|
||||
static makeFromString(text: string, font: Font, encoding?: TextEncoding): TextBlob;
|
||||
|
||||
/**
|
||||
* Create a textblob from a string, each element of which is located at the given positions.
|
||||
* @param { string } text - Drawn glyph content.
|
||||
* @param { number } len - string length, value must equal to points length.
|
||||
* @param { common2D.Point[] } points - Position coordinates of a textblob elements.
|
||||
* @param { Font } font - Specify text size, font, text scale, etc.
|
||||
* @returns { TextBlob } TextBlob object.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @static
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
static makeFromPosText(text: string, len: number, points: common2D.Point[], font: Font): TextBlob;
|
||||
|
||||
/**
|
||||
* Creating a textblob object based on RunBuffer information
|
||||
* @param { Array<TextBlobRunBuffer> } pos - The array of TextBlobRunBuffer.
|
||||
@ -1380,6 +1591,14 @@ declare namespace drawing {
|
||||
* @since 11
|
||||
*/
|
||||
bounds(): common2D.Rect;
|
||||
|
||||
/**
|
||||
* Returns an unique identifier for a textblob.
|
||||
* @returns { number } Unique ID.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
uniqueID(): number;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1706,6 +1925,57 @@ declare namespace drawing {
|
||||
* @since 12
|
||||
*/
|
||||
textToGlyphs(text: string, glyphCount?: number): Array<number>;
|
||||
|
||||
/**
|
||||
* Returns true if glyphs may be drawn at sub-pixel offsets.
|
||||
* @returns { boolean } True if glyphs may be drawn at sub-pixel offsets.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
isSubpixel(): boolean;
|
||||
/**
|
||||
* Returns true if font and glyph metrics are requested to be linearly scalable.
|
||||
* @returns { boolean } True if font and glyph metrics are requested to be linearly scalable.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
isLinearMetrics(): boolean;
|
||||
/**
|
||||
* Returns text skew on x-axis.
|
||||
* @returns { number } Additional shear on x-axis relative to y-axis.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getSkewX(): number;
|
||||
/**
|
||||
* Gets whether to increase the stroke width to approximate bold fonts.
|
||||
* @returns { boolean } Returns true to increase the stroke width to approximate bold fonts;
|
||||
* returns false otherwise.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
isEmbolden(): boolean;
|
||||
/**
|
||||
* Returns text scale on x-axis.
|
||||
* @returns { number } Text horizontal scale.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getScaleX(): number;
|
||||
/**
|
||||
* Gets font hinting pattern.
|
||||
* @returns { FontHinting } Font hinting level.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getHinting(): FontHinting;
|
||||
/**
|
||||
* Gets font edge pixels pattern.
|
||||
* @returns { FontEdging } Edge pixels pattern.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getEdging(): FontEdging;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2207,8 +2477,55 @@ declare namespace drawing {
|
||||
* @since 11
|
||||
*/
|
||||
static createLumaColorFilter(): ColorFilter;
|
||||
/**
|
||||
* Makes a color filter with a 5x4 color matrix
|
||||
* @param { Array<Number> } matrix - Indicates the matrix, which is represented as a number array of length 20.
|
||||
* @returns { ColorFilter } Colorfilter object.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
||||
* @static
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
static createMatrixColorFilter(matrix: Array<Number>): ColorFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* ImageFilters are optional objects in the drawing pipeline.
|
||||
*
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
class ImageFilter {
|
||||
/**
|
||||
* Makes an ImageFilter object that blurs its input by the separate X and Y sigmas.
|
||||
* @param { number } sigmaX - Indicates the Gaussian sigma value for blurring along the X axis. Must be > 0.
|
||||
* @param { number } sigmaY - Indicates the Gaussian sigma value for blurring along the Y axis. Must be > 0.
|
||||
* @param { uiEffect.TileMode } tileMode - Indicates the tile mode applied at edges.
|
||||
* @param { ImageFilter } imageFilter - Indicates the input filter that is blurred,
|
||||
* uses source bitmap if this is null.
|
||||
* @returns { ImageFilter } ImageFilter object.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
||||
* @static
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
static createBlurImageFilter(sigmaX: number, sigmaY: number,
|
||||
tileMode: uiEffect.TileMode, imageFilter?: ImageFilter): ImageFilter;
|
||||
/**
|
||||
* Makes an ImageFilter object that applies the color filter to the input.
|
||||
* @param { ColorFilter } colorFilter - Indicates the color filter that transforms the input image.
|
||||
* @param { ImageFilter } imageFilter - Indicates the input filter, or uses the source bitmap if this is null.
|
||||
* @returns { ImageFilter } ImageFilter object.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @static
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
static createFromColorFilter(colorFilter: ColorFilter, imageFilter?: ImageFilter): ImageFilter;
|
||||
}
|
||||
/**
|
||||
* Enumerate join styles. The join style defines the shape of the joins of a
|
||||
* polyline segment drawn by the pen.
|
||||
@ -2457,7 +2774,22 @@ declare namespace drawing {
|
||||
* @since 11
|
||||
*/
|
||||
setColorFilter(filter: ColorFilter): void;
|
||||
|
||||
/**
|
||||
* Gets ColorFilter of pen
|
||||
* @returns { ColorFilter } ColorFilter.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getColorFilter(): ColorFilter;
|
||||
/**
|
||||
* Sets ImageFilter to pen
|
||||
* @param { ImageFilter | null } filter - ImageFilter to apply to subsequent draw.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
setImageFilter(filter: ImageFilter | null): void;
|
||||
/**
|
||||
* Sets MaskFilter to pen.
|
||||
*
|
||||
@ -2559,6 +2891,18 @@ declare namespace drawing {
|
||||
* @since 12
|
||||
*/
|
||||
reset(): void;
|
||||
/**
|
||||
* Obtains the filled equivalent of the src path.
|
||||
*
|
||||
* @param { Path } src - The path read to create a filled version.
|
||||
* @param { Path } dst - The resulting path (may be the same as src).
|
||||
* @returns { boolean } true if the path should be filled, or false if it should be drawn with a hairline (width == 0)
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getFillPath(src: Path, dst: Path): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2662,6 +3006,22 @@ declare namespace drawing {
|
||||
*/
|
||||
setColorFilter(filter: ColorFilter): void;
|
||||
|
||||
/**
|
||||
* Gets ColorFilter of brush
|
||||
* @returns { ColorFilter } ColorFilter.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getColorFilter(): ColorFilter;
|
||||
/**
|
||||
* Sets ImageFilter to brush
|
||||
* @param { ImageFilter | null } filter - ImageFilter to apply to subsequent draw.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
setImageFilter(filter: ImageFilter | null): void;
|
||||
/**
|
||||
* Sets MaskFilter to brush.
|
||||
* @param { MaskFilter } filter - MaskFilter to apply to subsequent draw.
|
||||
@ -2819,6 +3179,187 @@ declare namespace drawing {
|
||||
* @since 12
|
||||
*/
|
||||
isIdentity(): Boolean;
|
||||
|
||||
/**
|
||||
* Get one matrix value. Index is between the range of 0-8.
|
||||
* @param { number } index - one of 0-8
|
||||
* @returns { number } Returns value corresponding to index.Returns 0 if out of range.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getValue(index: number): number;
|
||||
/**
|
||||
* Sets matrix to matrix multiplied by matrix constructed from rotating by degrees around pivot point (px, py).
|
||||
* This can be thought of as rotating around a pivot point after applying matrix.
|
||||
* @param { number } degree - Indicates the angle of axes relative to upright axes.
|
||||
* @param { number } px - Indicates the pivot on x-axis.
|
||||
* @param { number } py - Indicates the pivot on y-axis.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
postRotate(degree: number, px: number, py: number): void;
|
||||
/**
|
||||
* Sets matrix to matrix multiplied by matrix constructed from scaling by (sx, sy) relative to pivot point (px, py).
|
||||
* This can be thought of as scaling relative to a pivot point after applying matrix.
|
||||
* @param { number } sx - Indicates the horizontal scale factor.
|
||||
* @param { number } sy - Indicates the vertical scale factor.
|
||||
* @param { number } px - Indicates the pivot on x-axis.
|
||||
* @param { number } py - Indicates the pivot on y-axis.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
postScale(sx: number, sy: number, px: number, py: number): void;
|
||||
/**
|
||||
* Sets matrix to matrix multiplied by matrix constructed from translation (dx, dy).
|
||||
* This can be thought of as moving the point to be mapped after applying matrix.
|
||||
* @param { number } dx - Indicates the horizontal translation.
|
||||
* @param { number } dy - Indicates the vertical translation.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
postTranslate(dx: number, dy: number): void;
|
||||
/**
|
||||
* Sets matrix to matrix multiplied by matrix constructed from rotating by degrees around pivot point (px, py).
|
||||
* This can be thought of as rotating around a pivot point before applying matrix.
|
||||
* @param { number } degree - Indicates the angle of axes relative to upright axes.
|
||||
* @param { number } px - Indicates the pivot on x-axis.
|
||||
* @param { number } py - Indicates the pivot on y-axis.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
preRotate(degree: number, px: number, py: number): void;
|
||||
/**
|
||||
* Sets matrix to matrix multiplied by matrix constructed from scaling by (sx, sy) relative to pivot point (px, py).
|
||||
* This can be thought of as scaling relative to a pivot point before applying matrix.
|
||||
* @param { number } sx - Indicates the horizontal scale factor.
|
||||
* @param { number } sy - Indicates the vertical scale factor.
|
||||
* @param { number } px - Indicates the pivot on x-axis.
|
||||
* @param { number } py - Indicates the pivot on y-axis.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
preScale(sx: number, sy: number, px: number, py: number): void;
|
||||
/**
|
||||
* Sets matrix to matrix multiplied by matrix constructed from translation (dx, dy).
|
||||
* This can be thought of as moving the point to be mapped before applying matrix.
|
||||
* @param { number } dx - Indicates the horizontal translation.
|
||||
* @param { number } dy - Indicates the vertical translation.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
preTranslate(dx: number, dy: number): void;
|
||||
/**
|
||||
* Reset matrix to identity.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
reset(): void;
|
||||
/**
|
||||
* Maps src array of length count to dst array of equal or greater length.
|
||||
* This can be thought of as moving the point to be mapped before applying matrix.
|
||||
* @param { Array<common2D.Point> } src - points to transform.
|
||||
* @returns { Array<common2D.Point> } Return mapped points array.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
mapPoints(src: Array<common2D.Point>): Array<common2D.Point>;
|
||||
/**
|
||||
* Return nine scalar values contained by Matrix.
|
||||
* @returns { Array<number> } nine scalar values contained by Matrix.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
getAll(): Array<number>;
|
||||
/**
|
||||
* Sets dst to bounds of src corners mapped by matrix transformation.
|
||||
* @param { common2D.Rect } dst - Rect to map from.
|
||||
* @param { common2D.Rect } src - Rect to map to.
|
||||
* @returns { boolean } Returns true if the mapped src is equal to the dst; returns false is not equal.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
mapRect(dst: common2D.Rect, src: common2D.Rect): boolean;
|
||||
/**
|
||||
* Sets matrix to scale and translate src rect to dst rect.
|
||||
* @param { common2D.Rect } src - Rect to map from.
|
||||
* @param { common2D.Rect } dst - Rect to map to.
|
||||
* @param { ScaleToFit } scaleToFit - Describes how matrix is constructed to map one rect to another.
|
||||
* @returns { boolean } Returns true if dst is empty, and sets matrix to:
|
||||
| 0 0 0 |
|
||||
| 0 0 0 |
|
||||
| 0 0 1 |.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
setRectToRect(src: common2D.Rect, dst: common2D.Rect, scaleToFit: ScaleToFit): boolean;
|
||||
/**
|
||||
* Sets Matrix to map src to dst. Count must be zero or greater, and four or less.
|
||||
* @param { Array<common2D.Point> } src - Point to map from
|
||||
* @param { Array<common2D.Point> } dst - Point to map to
|
||||
* @param { number } count - Number of Point in src and dst
|
||||
* @returns { boolean } Returns true if Matrix was constructed successfully
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
setPolyToPoly(src: Array<common2D.Point>, dst: Array<common2D.Point>, count: number): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a scale-to-fit values.
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
enum ScaleToFit {
|
||||
/**
|
||||
* Scales in x and y to fill destination Rect.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
FILL_SCALE_TO_FIT = 0,
|
||||
|
||||
/**
|
||||
* Scales and aligns to left and top.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
START_SCALE_TO_FIT = 1,
|
||||
|
||||
/**
|
||||
* Scales and aligns to center.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
CENTER_SCALE_TO_FIT = 2,
|
||||
|
||||
/**
|
||||
* Scales and aligns to right and bottom.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
END_SCALE_TO_FIT = 3
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2953,6 +3494,69 @@ declare namespace drawing {
|
||||
*/
|
||||
REPLACE = 5
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerates of corner radius position.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
enum CornerPos {
|
||||
/**
|
||||
* Index of top-left corner radius.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
TOP_LEFT_POS = 0,
|
||||
|
||||
/**
|
||||
* Index of top-right corner radius.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
TOP_RIGHT_POS = 1,
|
||||
|
||||
/**
|
||||
* Index of bottom-right corner radius.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
BOTTOM_RIGHT_POS = 2,
|
||||
|
||||
/**
|
||||
* Index of bottom-left corner radius.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
BOTTOM_LEFT_POS = 3
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration defines the constraint type.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
enum SrcRectConstraint {
|
||||
|
||||
/**
|
||||
* Using sampling only inside bounds in a slower manner.
|
||||
*
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
STRICT = 0,
|
||||
|
||||
/**
|
||||
* Using sampling outside bounds in a faster manner.
|
||||
*
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
FAST = 1
|
||||
}
|
||||
}
|
||||
|
||||
export default drawing;
|
||||
export default drawing;
|
||||
|
@ -97,6 +97,7 @@ bitrates
|
||||
blending
|
||||
blendmode
|
||||
blocklist
|
||||
blurs
|
||||
bms
|
||||
bolder
|
||||
bonded
|
||||
@ -858,6 +859,7 @@ sar
|
||||
satellites
|
||||
sbas
|
||||
sbc
|
||||
scaletofit
|
||||
scdma
|
||||
scene
|
||||
sco
|
||||
@ -893,6 +895,7 @@ showcounter
|
||||
shrinks
|
||||
shuts
|
||||
sigalgs
|
||||
sigmas
|
||||
silenced
|
||||
singly
|
||||
skews
|
||||
|
Loading…
Reference in New Issue
Block a user