Skip to content

Latest commit

 

History

History
215 lines (173 loc) · 4.92 KB

File metadata and controls

215 lines (173 loc) · 4.92 KB
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

DSDrawingLayer

The DSDrawingLayer class represents a drawing layer, which is used for managing and controlling drawing items.

Definition

Assembly: DynamsoftCameraEnhancer.xcframework

>- Objective-C >- Swift > >1. ```objc NS_ASSUME_NONNULL_BEGIN @interface DSDrawingLayer : NSObject ``` 2. ```swift class 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 > >1. ```objc @property (assign, nonatomic, readonly) NSInteger layerId; ``` 2. ```swift var layerId: Int { get } ```

visible

Set/get the visibility of the layer.

>- Objective-C >- Swift > >1. ```objc @property (assign, nonatomic) BOOL visible; ``` 2. ```swift var visible: Bool { get set } ```

drawingItems

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 } ```

initWithId

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.

addDrawingItems

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.

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 > >1. ```objc - (void)setDefaultStyle:(NSUInteger)styleId; ``` 2. ```swift 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 > >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.

clearDrawingItems

Remove all DrawingItems from the layer.

>- Objective-C >- Swift > >1. ```objc - (void)clearDrawingItems; ``` 2. ```swift func clearDrawingItems() ```