Sets the transparent color.
#include "ltwrappr.h"
virtual L_INT LAnnStamp::SetTransparentColor(crTransparent, uFlags=0)
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/Medical 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 LBitmapBase::GetPixelColor.
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 LAnnContainer::GetSelectItems and LAnnotation::SetSelected 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. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Only stamp objects that have a bitmap will use the transparent color.
This transparent color is used only if the object is set to transparent using LAnnStamp::SetTransparent.
By default, the transparent color is white (0x00FFFFFF).
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 come up allowing you to select a color 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.
Win32, x64.
L_INT LAnnStamp_SetTransparentColorExample(HWND hWnd)
{
LBitmap MyBitmap;
RECT rect;
ANNRECT annRect;
L_TCHAR szTemp[100];
//Load an image containing color RED
LBitmapBase BitmapBase;
BitmapBase.Load(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\FadeMask.bmp")));
LAnnStamp MyAnnStamp;
//Make RED transparent
MyAnnStamp.SetBitmap(&BitmapBase);
MyAnnStamp.SetTransparentColor(RGB(255,0,0));
MyAnnStamp.SetTransparent(TRUE);
//Verify transparent color
COLORREF ColorRef;
MyAnnStamp.GetTransparentColor(&ColorRef);
wsprintf(szTemp,
TEXT("Transparent Color: %x"),
ColorRef);
AfxMessageBox(szTemp);
//Display the stamp annotation
annRect.left = 50;
annRect.top = 50;
annRect.right = 150;
annRect.bottom = 150;
MyAnnStamp.SetRect(&annRect);
MyAnnStamp.SetVisible(TRUE);
MyAnnStamp.GetBoundingRect(&rect) ;
//Draw the annotation
HDC hDC = ::GetDC(hWnd);
MyAnnStamp.Draw(hDC,&rect);
::ReleaseDC(hWnd, hDC);
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