How Dynamic Web TWAIN-- highlight the selected area on the image

You may sometimes want certain parts of the image highlighted. Dynamic Web TWAIN provide OverlayRectangle this way to support this feature.

First, you need to select the area you want to highlight:

// 使用 OnImageAreaSelected 事件来选择想突出显示的区域
function Dynamsoft_OnImageAreaSelected(index, left, top, right, bottom) { 
  _iLeft = left;
  _iTop = top;
  _iRight = right;
  _iBottom = bottom; } 

// 使用 OnImageAreaDeselected 事件取消选择
function Dynamsoft_OnImageAreaDeselected(index) { 
  _iLeft = 0;
  _iTop = 0; 
  _iRight = 0; 
  _iBottom = 0; }

Highlight the area (where we add a gray rectangle)

DWObject.OverlayRectangle(
    DWObject.CurrentImageIndexInBuffer,
    _iLeft, _iTop, _iRight, _iBottom, 0x000000/*指定颜色*/, 0.5/*不透明度*/
);

Designated color: It is specified in the RGB 24-bit value. The default is white (0xffffff). Byte order of 24-bit RGB value is BBGGRR. BB represents blue, GG represents green, RR represents red.

Opacity: Specify the opacity of the rectangle. 1.0 represents 100% opacity, 0.0 is completely transparent.

 

 

Released two original articles · won praise 4 · Views 4053

Guess you like

Origin blog.csdn.net/weixin_42320186/article/details/88912912