DSDrawingLayer
The DSDrawingLayer class represents a drawing layer, which is used for managing and controlling drawing items.
Definition
Assembly: DynamsoftCameraEnhancer.xcframework
- Objective-C
- Swift
NS_ASSUME_NONNULL_BEGIN @interface DSDrawingLayer : NSObjectclass DrawingLayer : NSObject
Constants
| 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
| 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. |
Methods
| 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. |
layerId
Get the layer ID of the layer.
- Objective-C
- Swift
@property (assign, nonatomic, readonly) NSInteger layerId;var layerId: Int { get }
visible
Set/get the visibility of the layer.
- Objective-C
- Swift
@property (assign, nonatomic) BOOL visible;var visible: Bool { get set }
drawingItems
Set/get the drawing items on the layer.
- Objective-C
- Swift
@property (atomic, copy, nullable) NSArray<DSDrawingItem *> *drawingItems;var drawingItems: [DrawingItem] { get set }
initWithId
Create an DrawingLayer with the specified ID.
- Objective-C
- Swift
- (instancetype)initWithId:(NSInteger)layerId;init(id layerId: Int)
Parameters
layerId: The ID of the layer.
addDrawingItems
Add a group of DrawingItem to the layer.
- Objective-C
- Swift
- (void)addDrawingItems:(NSArray<DSDrawingItem *> *)items;func addDrawingItems(_ items: [DSDrawingItem])Parameters
items: An array of DrawingItems to be added to the layer.
setDefaultStyle(style)
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
- (void)setDefaultStyle:(NSUInteger)styleId;func setDefaultStyle(_ styleId: UInt)
Parameters
styleId: An ID of DrawingStyle.
setDefaultStyle(style,state,mediaType)
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
- (void)setDefaultStyle:(NSUInteger)styleId forState:(NSUInteger)state forType:(NSUInteger)type;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.
clearDrawingItems
Remove all DrawingItems from the layer.
- Objective-C
- Swift
- (void)clearDrawingItems;func clearDrawingItems()