Table of contents

DSRect

The DSRect class represents a rectangle in 2D space, which contains four integer values that specify the top, left, right, and bottom edges of the rectangle.

Definition

Namespace: com.dynamsoft.core.basic_structures

Assembly: DynamsoftCaptureVisionBundle.aar

class DSRect

Attributes & Methods

Attributes Type Description
top float The distance between the top of the rect and the x-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the height of the parent. If measuredInPercentage = 0, the value specifies a pixel length.
left float The distance between the left of the rect and the y-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the width of the parent. If measuredInPercentage = 0, the value specifies a pixel length.
right float The distance between the right of the rect and the y-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the width of the parent. If measuredInPercentage = 0, the value specifies a pixel length.
bottom float The distance between the bottom of the rect and the x-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the height of the parent. If measuredInPercentage = 0, the value specifies a pixel length.
measuredInPercentage boolean Indicates if the rectangle’s measurements are in percentages.
Method Description
DSRect The constructor.
DSRect(left,top,right,bottom,measuredInPercentage) Constructs a DSRect from the specified parameters.
fromJson Constructs a DSRect from a JSON string.

top

The distance between the top of the rect and the x-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the height of the parent. If measuredInPercentage = 0, the value specifies a pixel length.

float top;

left

The distance between the left of the rect and the y-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the width of the parent. If measuredInPercentage = 0, the value specifies a pixel length.

float left;

The distance between the right of the rect and the y-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the width of the parent. If measuredInPercentage = 0, the value specifies a pixel length.

float right;

bottom

The distance between the bottom of the rect and the x-axis. If measuredInPercentage = 1, the value specifies the percentage comparing with the height of the parent. If measuredInPercentage = 0, the value specifies a pixel length.

float bottom;

measuredInPercentage

Sets whether to use percentages to measure the region size.

boolean isMeasuredInPercentage;

DSRect

The constructor.

DSRect();

DSRect(left,top,right,bottom,measuredInPercentage)

Constructs a DSRect from the specified parameters.

DSRect(float left, float top, float right, float bottom, boolean measuredInPercentage);

fromJson

Constructs a DSRect from a JSON string.

DSRect fromJson(String jsonString);

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article: