| layout | default-layout |
|---|---|
| title | RectDrawingItem - Dynamsoft Camera Enhancer JavaScript API |
| description | This page shows the RectDrawingItem definitions of Dynamsoft Camera Enhancer JavaScript SDK. |
| keywords | camera enhancer, rectdrawingitem, javascript, js |
| needAutoGenerateSidebar | true |
| needGenerateH3Content | true |
| noTitleIndex | true |
| breadcrumbText | RectDrawingItem |
The RectDrawingItem class extends the functionality of the DrawingItem class and is specifically tailored to handle rectangle-related drawing operations.
| Name | Description |
|---|---|
constructor RectDrawingItem() |
Constructor for the class. |
| getRect() | Retrieves the current rectangle being used for drawing. |
| setRect() | Sets the rectangle to be used for drawing. |
Constructor for the class.
constructor(
rect: Rect,
drawingStyleId?: number
)Parameters
rect: the rectangle to be drawn, of type Rect.
drawingStyleId: [Optional] the unique ID of the DrawingStyle to apply to this DrawingItem.
Code Snippet
let cameraView = cameraEnhancer.getCameraView();
let drawingLayer = cameraView.createDrawingLayer();
let rectItem = new Dynamsoft.DCE.RectDrawingItem(
{
x: 50,
y: 50,
width: 500,
height: 500
}
);
drawingLayer.addDrawingItems([rectItem]);See also
Retrieves the current rectangle being used for drawing.
getRect(): Rect;Parameters
None.
Return Value
The current rectangle being used for drawing, of type Rect.
Code Snippet
rectItem.getRect();Sets the rectangle to be used for drawing. This method allows changing the rectangle after the object has been instantiated.
setRect(rect: Rect): void;Parameters
rect: the rectangle to be drawn, of type Rect.
Return Value
None.
Code Snippet
rectItem.setRect(/*A-New-Rectangle*/);See also