#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnEncryptApply(hObject, uEncryptFlags, uFlags)
Applies an encryptor annotation object to the underlying bitmap.
Handle to the annotation object.
Flags that determine which objects to apply. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR (|). Possible values are:
Value | Meaning |
---|---|
ANNENCRYPTAPPLY_ENCRYPTOR | [0x001] Apply encryptor objects |
ANNENCRYPTAPPLY_DECRYPTOR | [0x002] Apply decryptor objects |
ANNENCRYPTAPPLY_BOTH | [0x003] Apply both encryptor and decryptor objects |
Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR (|). Possible values are:
Value | Meaning |
---|---|
0 | Process only the specified object. |
ANNFLAG_SELECTED | [0x0001] Process only objects that have the selected property set to TRUE. For getting and setting the selected property, use the L_AnnGetSelected and L_AnnSetSelected functions. |
ANNFLAG_NOTTHIS | [0x0004] Process only one level of objects within the specified container, not the container itself. If there are containers within the container, they are modified, but the objects within them are not. |
ANNFLAG_RECURSE | [0x0008] Process objects within a container, and within any subcontainers, down to any level. |
ANNFLAG_NOTCONTAINER | [0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves. |
ANNFLAG_NOINVALIDATE | [0x0010] Do not invalidate the affected rectangle in the window. Use this to avoid generating unwanted paint messages. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
An encrypt object can have two states: it can be an encryptor or it can be a decryptor.
Use this function to apply encryptor(s), decryptor(s), or both. Applying an encryptor means that the part of the bitmap that is under the encryptor is scrambled according to the encryptor properties.
Once applied, the portion of the bitmap under the encrypt object becomes scrambled or unscrambled, and the encrypt object changes state (encryptors become decryptors, and decryptors be encryptors). Using different keys before calling this function gives different scrambling patterns The decryptor state differs from the encryptor state in that a decryptor cannot be moved, and cannot be changed to an encryptor. The scrambling can be removed by calling L_AnnEncryptApply on the decryptor with the appropriate arguments. If successful, the decryptor again changes state to become an encryptor. An encryptor can be moved, and can be changed to a decryptor.
The encrypt object is useful for encrypting portions of a bitmap. After encrypting, the scrambled bitmap cannot easily be unscrambled without the associated annotation file. The scrambling can be removed by using the associated annotation file, or by using automation mode to manually change the encrypt state from encryptor to a decryptor, position the object correctly, and setting the key appropriately.
L_AnnEncryptApply calls L_ScrambleBitmap internally to shuffle the pixels. For more information, refer to L_ScrambleBitmap.
Required DLLs and Libraries
Win32, x64.
This example takes a handle to an encrypt annotation object that is an encryptor, and performs the following steps:
L_INT AnnEncryptApplyExample(HANNOBJECT hObject)
{
L_INT nRet;
L_UINT uObjectType;
ANNENCRYPTOPTIONS EncryptOptions;
nRet = L_AnnGetType(hObject, &uObjectType);
if(nRet != SUCCESS)
return nRet;
if (uObjectType != ANNOBJECT_ENCRYPT)
{
MessageBox(NULL, TEXT("This object is not an encryptor"), TEXT("Error"), MB_OK);
return 0;
}
memset(&EncryptOptions, 0, sizeof(ANNENCRYPTOPTIONS));
EncryptOptions.uStructSize = sizeof(ANNENCRYPTOPTIONS);
EncryptOptions.uFlags = ANNENCRYPT_ALL;
nRet = L_AnnGetEncryptOptions(hObject, &EncryptOptions);
if(nRet != SUCCESS)
return nRet;
if (EncryptOptions.pEncryptBitmap == NULL)
{
MessageBox(NULL, TEXT("The encrypt object is not associated with a bitmap"), TEXT("Error"), MB_OK);
return 0;
}
if (EncryptOptions.bEncryptor == FALSE)
{
MessageBox(NULL, TEXT("This object is a decryptor"), TEXT("Error"), MB_OK);
return 0;
}
// Change the key to '123'
EncryptOptions.uKey = 123;
EncryptOptions.uFlags = ANNENCRYPT_KEY;
nRet = L_AnnSetEncryptOptions(hObject, &EncryptOptions, 0);
if(nRet != SUCCESS)
return nRet;
// Apply the encryptor
nRet = L_AnnEncryptApply(hObject, ANNENCRYPTAPPLY_ENCRYPTOR, 0);
if(nRet != SUCCESS)
return nRet;
nRet = MessageBox(NULL, TEXT("Encryptor has been applied. Would you like to remove the encryption?"), TEXT(""), MB_YESNO);
if (nRet == IDYES)
{
nRet = L_AnnEncryptApply(hObject, ANNENCRYPTAPPLY_DECRYPTOR, 0);
if(nRet != SUCCESS)
return nRet;
}
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document