LBitmap::FastMagicWand

#include "ltwrappr.h"

L_INT LBitmap::FastMagicWand(MagicWnd, nTolerance, nXposition, nYposition, pObjectInfo, uFlags = 0)

MAGICWANDHANDLE MagicWnd;

fast magic wand handle

L_INT nTolerance;

tolerance values

L_INT nXposition;

x coordinate

L_INT nYposition;

y coordinate

pOBJECTINFO pObjectInfo;

pointer to OBJECTINFO

L_UINT32 uFlags;

flags

Performs the fast magic wand operation and obtains the region through OBJECTINFO structure depending on color value at nXposition and nYposition

Parameter

Description

MagicWnd

A fast magic wand handle, initialized by calling the LBitmap::StartFastMagicWandEngine function.

nTolerance

The tolerance value sets the stopping upper and lower color boundaries.

nXposition

X-coordinate of the point. The point's color is used to find the region.

nYposition

Y-coordinate of the point. The point's color is used to find the region.

pObjectInfo

Pointer to OBJECTINFO structure to be updated with the obtained region.

uFlags

Reserved for future use. Must be 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function can only be called after the LBitmap::StartFastMagicWandEngine has been called. The MAGICWANDHANDLE structure passed must be the same as the one passed to LBitmap::StartFastMagicWandEngine function.

The MAGICWANDHANDLE and OBJECTINFO structures must be deleted by calling LBitmap::EndFastMagicWandEngine and LBitmap::DeleteObjectInfo functions.

This function is used when it is needed to select many regions over one image, especially large images as it performs faster.

This function supports 1, 8, and 24-bit images.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

LTIMGCOR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LBitmap::DeleteObjectInfo, LBitmap::EndFastMagicWandEngine, LBitmap::ObjectCounter, LBitmap::StartFastMagicWandEngine

Topics:

Raster Image Functions: Image Analysis

 

Processing an Image

Example

L_INT LBitmap__FastMagicWandExample() 
{ 
   L_INT nRet; 
   LBitmap LeadBitmap; 
   MAGICWANDHANDLE MagicWnd; 
   L_INT x, y, tolerance; 
   OBJECTINFO ObjectInfo; 
   x           = 50; 
   y           = 50; 
   tolerance   = 15; 
 
   nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("sample5.cmp")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
 
   nRet = LeadBitmap.StartFastMagicWandEngine(&MagicWnd, 0); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet = LeadBitmap.FastMagicWand(MagicWnd, tolerance, x, y, &ObjectInfo, 0); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet = LeadBitmap.EndFastMagicWandEngine(MagicWnd, 0); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet = LeadBitmap.DeleteObjectInfo(&ObjectInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 20.0.2020.4.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help