Resource Base
Table of contents

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. NS_ASSUME_NONNULL_BEGIN
    @interface DSDrawingLayer : NSObject
    
  2. 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. @property (assign, nonatomic, readonly) NSInteger layerId;
    
  2. var layerId: Int { get }
    

visible

Set/get the visibility of the layer.

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

drawingItems

Set/get the drawing items on the layer.

  • Objective-C
  • Swift
  1. @property (atomic, copy, nullable) NSArray<DSDrawingItem *> *drawingItems;
    
  2. var drawingItems: [DrawingItem] { get set }
    

initWithId

Create an DrawingLayer with the specified ID.

  • Objective-C
  • Swift
  1. - (instancetype)initWithId:(NSInteger)layerId;
    
  2. init(id layerId: Int)
    

Parameters

layerId: The ID of the layer.

addDrawingItems

Add a group of DrawingItem to the layer.

  • Objective-C
  • Swift
  1. - (void)addDrawingItems:(NSArray<DSDrawingItem *> *)items;
    
  2. 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. - (void)setDefaultStyle:(NSUInteger)styleId;
    
  2. 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. - (void)setDefaultStyle:(NSUInteger)styleId
               forState:(NSUInteger)state
                forType:(NSUInteger)type;
    
  2. 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. - (void)clearDrawingItems;
    
  2. func clearDrawingItems()
    

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 4.x
    • Version 4.2.0
    • Version 4.0.2
    • Version 4.0.1
    • Version 4.0.0
  • Version 3.x
    • Version 3.0.3
    • Version 3.0.2
    • Version 3.0.1
    • Version 3.0.0
  • Version 2.x
    • Version 2.3.21
    • Version 2.3.20
    • Version 2.3.12
    • Version 2.3.11
    • Version 2.3.10
    • Version 2.3.5
    • Version 2.3.4
    • Version 2.3.3
    • Version 2.3.2
    • Version 2.3.1
    • Version 2.3.0
    • Version 2.1.4
    • Version 2.1.3
    • Version 2.1.1
    • Version 2.0.0
Change +