LBitmap::Scramble

#include "ltwrappr.h"

virtual L_INT LBitmap::Scramble (nColStart, nRowStart, nWidth, nHeight, uKey, uFlags)

Scrambles all or a portion of a bitmap.

Parameters

L_INT32 nColStart

Starting column in pixels (0-based).

L_INT32 nRowStart

Starting row in pixels (0-based).

L_INT32 nWidth

Width of area to scramble in pixels.

L_INT32 nHeight

Height of area to scramble in pixels.

L_UINT32 uKey

Key that determines the scramble. This is an unsigned integer with a minimum value of 0 and a maximum value of 4294967295 (0xffffffff).

L_UINT uFlags

Flag that determines whether to encrypt or decrypt the area. Possible values are:

Value Meaning
SB_ENCRYPT Encrypts the area (the reverse of a decrypt).
SB_DECRYPT Decrypts the area (the reverse of an encrypt).
SB_INTERSECT Intersect the specified rect with the bitmap's rect.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Scrambling a rectangular area means that the pixels in that area are shuffled around into a pseudo-random location within the area.

Some properties of shuffling:

Given the same encrypt area (defined by nColStart, nRowStart, nWidth, nHeight) and the same key, setting (uFlags = SB_ENCRYPT) is the inverse of (uFlags = SB_DECRYPT)

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmap__ScrambleExample(LBitmap *pLBitmap)  
{ 
   if (!pLBitmap->IsAllocated()) 
      return FAILURE;  
 
   
   return pLBitmap->Scramble(0,  
                            0,  
                            pLBitmap->GetWidth()/2,  
                            pLBitmap->GetHeight()/2,  
                            123,  
                            SB_ENCRYPT);  
 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help