L_ScrambleBitmap

#include "l_bitmap.h"

L_LTKRN_API L_INT L_ScrambleBitmap(pBitmap, nColStart, nRowStart nWidth, nHeight, uKey, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to a bitmap handle for the bitmap to be scrambled */

L_INT nColStart;

/* starting column in pixels (0-based) */

L_INT nRowStart;

/* starting row in pixels (0-based) */

L_INT nWidth;

/* width of area to scramble in pixels */

L_INT nHeight;

/* height of area to scramble in pixels */

L_UINT uKey;

/* key that determines the scramble */

L_UINT uFlags;

/* flag that determines whether to encrypt or decrypt the area. */

Scrambles all or a portion of a bitmap. This function is available in the Document/Medical Toolkits.

Parameter

Description

pBitmap

Pointer to a bitmap handle for the bitmap to be scrambled.

nColStart

Starting column in pixels (0-based).

nRowStart

Starting row in pixels (0-based).

nWidth

Width of area to scramble in pixels.

nHeight

Height of area to scramble in pixels.

uKey

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

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 rectangle with the bitmaps rectangle.

Returns

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:

image\sqrblit.gif No colors are introduced,

image\sqrblit.gif Color counts remain unchanged

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

LTKRN

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

Windows 2000 / XP/Vista, Windows CE.

See Also

Functions:

L_AnnGetMetafile, L_AnnSetMetafile, L_AnnGetPredefinedMetafile, L_AnnSetPredefinedMetafile, L_AnnEncryptApply, L_AnnSetEncryptOptions, L_AnnGetEncryptOptions

Topics:

Annotation Functions: Object Properties

 

Annotation Objects - Default Values

 

Annotation Objects - Automated Features

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

Example

This example scrambles the upper left quadrant of a bitmap using the key 123

 L_INT ScrambleBitmapExample(pBITMAPHANDLE pBitmap)
{
   L_INT nRet;

   if (!pBitmap)
      return ERROR_NO_BITMAP;

   nRet = L_ScrambleBitmap(pBitmap, 0, 0, BITMAPWIDTH(pBitmap)/2, BITMAPHEIGHT(pBitmap)/2, 123, SB_ENCRYPT);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}