Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_AnnSetTransparentColor

Show in webframe

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnSetTransparentColor(hObject, crTransparent, uFlags)

HANNOBJECT hObject;

/* handle to the annotation object */

COLORREF crTransparent;

/* transparent color */

L_UINT uFlags;

/* flags that determine which objects to process */

Sets the color to be used as a transparent color.

Parameter

Description

hObject

Handle to the annotation object.

crTransparent

The fill color. The standard Windows values for COLORREF represent either red, green, and blue color values, or an index into the bitmap's palette. A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value. If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette which holds the color value. These COLORREF values can be used with any Windows function and macro that takes a COLORREF parameter.

 

In the Document and Medical Imaging toolkits the COLORREF value may represent a 16 bit grayscale value if pBitmap is a 12 or 16-bit grayscale bitmap. So that the value is not confused with an RGB value, the COLORREF_GRAY16 mask (0x04000000) is set. In this case (0x0400YYYY), the lower 16 bits (0xYYYY) of the COLORREF value represent the 16-bit grayscale value. (0x0400FFFF is 16-bit white and 0x04000000is 16-bit black.) This is not a standard Windows value. Therefore, LEADTOOLS functions will recognize a COLORREF having this format, but Windows functions will not. For information on how to use a 16-bit grayscale COLORREF in a non-LEADTOOLS function, refer to L_GetPixelColor.

uFlags

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 ( | ). The following are valid values:

 

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.

 

ANNFLAG_CHECKMENU

[0x0020] Process objects only if the ANNAUTOTEXT_MENU_TRANSPARENTCOLOR menu item has been selected.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The L_AnnSetTransparentColor function is valid only for the following object types when they are using a bitmap:

ANNOBJECT_POINT

ANNOBJECT_STAMP

In addition, the Automation object stores transparency settings along with the other object default settings.

A transparent color is not painted when the image is painted. This transparent color is used only if the object is set to transparent using L_AnnSetTransparent.

By default, the transparent color is white (0x00FFFFFF).

If hObject is a container object, then uFlags indicates which objects to process. If hObject is an automation object, all objects created by this automation object will have this transparent color.

In design mode, the transparent color can be picked by selecting the Transparent color from the properties menu. If the objects bitmap has a palette, a dialog box will appear so that a color can be selected from the palette colors. If the objects bitmap does not have a palette, the standard Windows color pick dialog box is used to select a transparent color.

Call the L_AnnGetTransparent function to get a value that indicates whether the bitmap being used by the annotation object is using a transparent color. Call the L_AnnGetTransparentColor function to get a value that indicates which color is being used as the transparent color.

Required DLLs and Libraries

LTANN

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:

L_AnnGetTransparentColor, L_AnnSetTransparent

Topics:

Annotation Functions: Object Properties

 

Annotation Objects - Default Values

 

Annotation Objects - Automated Features

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

 

Altering Annotation Object Settings

 

Using Color Values in LEADTOOLS

 

Annotation Functions (Document/Medical only): Getting and Setting the Transparency Property

Example

L_INT EXT_CALLBACK annEnumCallback(HANNOBJECT   hObject,L_VOID*       pUserData)
{
   UNREFERENCED_PARAMETER(pUserData);
   L_UINT Type;
   COLORREF TransColor;
   L_INT nRet;

   L_AnnGetType(hObject, &Type);
   switch(Type)
   {
   case ANNOBJECT_STAMP:
      nRet = L_AnnGetTransparentColor(hObject, &TransColor);
      if (nRet == SUCCESS)
      {
         if (TransColor != RGB(0, 0, 0))
         {
            MessageBox(NULL, TEXT("Transparent color set."), TEXT(""), MB_OK);
            L_AnnSetTransparent(hObject, TRUE, 0);
            TransColor = RGB(0, 0, 0);
            L_AnnSetTransparentColor(hObject, TransColor, 0);
         }
      }
      else
         MessageBox(NULL, TEXT("Error getting transparent color."), TEXT(""), MB_OK);
      break;

   default:
      MessageBox(NULL, TEXT("Object must be a stamp."), TEXT(""), MB_OK);
   }
   return SUCCESS;
}

 L_INT AnnSetTransparentColorExample(HANNOBJECT hContainer)
{
   L_INT nRet;
   nRet = L_AnnEnumerate(hContainer, (ANNENUMCALLBACK) annEnumCallback, NULL, ANNFLAG_RECURSE|ANNFLAG_SELECTED, NULL);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.