mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 14:13:45 +00:00
!11575 drawing ts interface region upload
Merge pull request !11575 from 刘伟/drawing_tsInterface_regionUpload
This commit is contained in:
commit
ccf1289af2
156
api/@ohos.graphics.drawing.d.ts
vendored
156
api/@ohos.graphics.drawing.d.ts
vendored
@ -514,6 +514,16 @@ declare namespace drawing {
|
||||
drawPixelMapMesh(pixelmap: image.PixelMap, meshWidth: number, meshHeight: number,
|
||||
vertices: Array<number>, vertOffset: number, colors: Array<number>, colorOffset: number): void;
|
||||
|
||||
/**
|
||||
* Draws a region.
|
||||
* @param { Region } region - Region object.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
drawRegion(region: Region): void;
|
||||
|
||||
/**
|
||||
* Set pen to a canvas.
|
||||
* @param { Pen } pen - object.
|
||||
@ -1100,6 +1110,19 @@ declare namespace drawing {
|
||||
* @since 12
|
||||
*/
|
||||
static createDashPathEffect(intervals: Array<number>, phase: number): PathEffect;
|
||||
|
||||
/**
|
||||
* Makes a corner PathEffect.
|
||||
* @param { number } radius - Indicates the radius of the tangent circle at the corners of the path.
|
||||
* The radius must be greater than 0.
|
||||
* @returns { PathEffect } PathEffect 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 createCornerPathEffect(radius: number): PathEffect;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1519,6 +1542,139 @@ declare namespace drawing {
|
||||
*/
|
||||
setBlendMode(mode: BlendMode): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a region object.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
class Region {
|
||||
/**
|
||||
* Determines whether the test point is in the region.
|
||||
* @param { number } x - Indicates the x coordinate of the point. The parameter must be an integer.
|
||||
* @param { number } y - Indicates the y coordinate of the point. The parameter must be an integer.
|
||||
* @returns { boolean } Returns true if (x, y) is inside region; returns false otherwise.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
isPointContained(x: number, y:number): boolean;
|
||||
|
||||
/**
|
||||
* Determines whether other region is in the region.
|
||||
* @param { Region } other - Other region object.
|
||||
* @returns { boolean } Returns true if other region is completely inside the region object;
|
||||
* <br>returns false otherwise.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
isRegionContained(other: Region): boolean;
|
||||
|
||||
/**
|
||||
* Replaces region with the result of region op region.
|
||||
* @param { Region } region - Region object.
|
||||
* @param { RegionOp } regionOp - Operation type.
|
||||
* @returns { boolean } Returns true if replaced region is not empty; returns false otherwise.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
op(region: Region, regionOp: RegionOp): boolean;
|
||||
|
||||
/**
|
||||
* Determines whether rect and region does not intersect.
|
||||
* @param { number } left - Left position of rectangle. The parameter must be an integer.
|
||||
* @param { number } top - Top position of rectangle. The parameter must be an integer.
|
||||
* @param { number } right - Right position of rectangle. The parameter must be an integer.
|
||||
* @param { number } bottom - Bottom position of rectangle. The parameter must be an integer.
|
||||
* @returns { boolean } Returns true if rect and region is not intersect; returns false otherwise.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
quickReject(left: number, top: number, right: number, bottom: number): boolean;
|
||||
|
||||
/**
|
||||
* Sets the region to match outline of path within clip.
|
||||
* @param { Path } path - Providing outline.
|
||||
* @param { Region } clip - Region object.
|
||||
* @returns { boolean } Returns true if constructed region is not empty; returns false otherwise.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
setPath(path: Path, clip: Region): boolean;
|
||||
|
||||
/**
|
||||
* Sets a rect to region.
|
||||
* @param { number } left - Left position of rectangle. The parameter must be an integer.
|
||||
* @param { number } top - Top position of rectangle. The parameter must be an integer.
|
||||
* @param { number } right - Right position of rectangle. The parameter must be an integer.
|
||||
* @param { number } bottom - Bottom position of rectangle. The parameter must be an integer.
|
||||
* @returns { boolean } Returns true if constructed region is not empty; returns false otherwise.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
|
||||
* <br>2. Incorrect parameter types.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
setRect(left: number, top: number, right: number, bottom: number): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerates of operations when two regions are combined.
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
enum RegionOp {
|
||||
/**
|
||||
* Difference operation.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
DIFFERENCE = 0,
|
||||
|
||||
/**
|
||||
* Intersect operation.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
INTERSECT = 1,
|
||||
|
||||
/**
|
||||
* Union operation.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
UNION = 2,
|
||||
|
||||
/**
|
||||
* Xor operation.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
XOR = 3,
|
||||
|
||||
/**
|
||||
* Reverse difference operation.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
REVERSE_DIFFERENCE = 4,
|
||||
|
||||
/**
|
||||
* Replace operation.
|
||||
* @syscap SystemCapability.Graphics.Drawing
|
||||
* @since 12
|
||||
*/
|
||||
REPLACE = 5
|
||||
}
|
||||
}
|
||||
|
||||
export default drawing;
|
Loading…
Reference in New Issue
Block a user