layout | title | description | keywords | needGenerateH3Content | needAutoGenerateSidebar | noTitleIndex |
---|---|---|---|---|---|---|
default-layout |
DSDrawingLayer - Dynamsoft Camera Enhancer iOS Edition API Reference |
The class DSDrawingLayer of Dynamsoft Camera Enhancer represents a drawing layer, which is used for managing and controlling drawing items. |
drawing layer, Dynamsoft Camera Enhancer, objective-c, swift |
true |
true |
true |
The DSDrawingLayer
class represents a drawing layer, which is used for managing and controlling drawing items.
Assembly: DynamsoftCameraEnhancer.xcframework
>- Objective-C >- Swift > >1. ```objc NS_ASSUME_NONNULL_BEGIN @interface DSDrawingLayer : NSObject ``` 2. ```swift class DrawingLayer : NSObject ```Constants | Description |
---|---|
DDN_LAYER_ID |
The preset DrawingLayer of Dynamsoft Document Normalizer. |
DBR_LAYER_ID |
The preset DrawingLayer of Dynamsoft Barcode Reader. |
DLR_LAYER_ID |
The preset DrawingLayer of Dynamsoft Label Recognizer. |
USER_REFINED_LAYER_BASE_ID |
The IDs of user defined Drawinglayers start from 100. |
Attributes | Type | Description |
---|---|---|
layerId |
NSInteger | Get the layer ID of the layer. |
visible |
BOOL | Set/get the visibility of the layer. |
drawingItems |
*NSArray<DrawingItem > * | Set/get the drawing items on the layer. |
Method | Description |
---|---|
initWithId |
Create an DrawingLayer with the specified ID. |
addDrawingItems |
Add a group of DrawingItem to the layer. |
setDrawingItems |
Set the DrawingItems to be displayed on the layer. |
getDrawingItems |
Get all the DrawingItems on the layer. |
setDefaultStyle(style) |
Set the default style of the layer. |
setDefaultStyle(style,state,mediaType) |
Set the default style of the layer with filter options. |
clearDrawingItems |
Remove all DrawingItems from the layer. |
Get the layer ID of the layer.
>- Objective-C >- Swift > >1. ```objc @property (assign, nonatomic, readonly) NSInteger layerId; ``` 2. ```swift var layerId: Int { get } ```Set/get the visibility of the layer.
>- Objective-C >- Swift > >1. ```objc @property (assign, nonatomic) BOOL visible; ``` 2. ```swift var visible: Bool { get set } ```Set/get the drawing items on the layer.
>- Objective-C >- Swift > >1. ```objc @property (atomic, copy, nullable) NSArray *drawingItems; ``` 2. ```swift var drawingItems: [DrawingItem] { get set } ```Create an DrawingLayer with the specified ID.
>- Objective-C >- Swift > >1. ```objc - (instancetype)initWithId:(NSInteger)layerId; ``` 2. ```swift init(id layerId: Int) ```Parameters
layerId
: The ID of the layer.
Add a group of DrawingItem to the layer.
>- Objective-C >- Swift > >1. ```objc - (void)addDrawingItems:(NSArray *)items; ``` 2. ```swift func addDrawingItems(_ items: [DSDrawingItem]) ``` **Parameters**items
: An array of DrawingItems to be added to the layer.
Set the default style of the layer. A DrawingItem on the layer will use the default style if it doesn't hold a style attribute.
>- Objective-C >- Swift > >1. ```objc - (void)setDefaultStyle:(NSUInteger)styleId; ``` 2. ```swift func setDefaultStyle(_ styleId: UInt) ```Parameters
styleId
: An ID of DrawingStyle.
Set the default style of the layer with filter options. A DrawingItem on the layer will use the default style if it doesn't hold a style attribute.
>- Objective-C >- Swift > >1. ```objc - (void)setDefaultStyle:(NSUInteger)styleId forState:(NSUInteger)state forType:(NSUInteger)type; ``` 2. ```swift func setDefaultStyle(_ styleId: UInt, forState drawingItemState: UInt, forType drawingItemMediaType: UInt) ```Parameters
styleId
: An ID of DrawingStyle.
forState
: Specify a group of DrawingItem state. It filters which kinds of DrawingItems will use this default style.
forType
: Specify a group of DrawingItem media type. It filters which kinds of DrawingItems will use this default style.
Remove all DrawingItems from the layer.
>- Objective-C >- Swift > >1. ```objc - (void)clearDrawingItems; ``` 2. ```swift func clearDrawingItems() ```