#include "l_bitmap.h"
L_LTDIS_API L_INT L_SetBitmapRgnEllipse(pBitmap, pXForm, pRect, uCombineMode)
Creates or updates the bitmap region by adding an elliptical region.
Pointer to the bitmap handle referencing the bitmap where the region is to be created or updated.
Pointer to an RGNXFORM structure that LEADTOOLS uses to translate between display coordinates and bitmap coordinates.
If you specify NULL in this parameter, the scalar fields default to 1, the offsets default to 0, and the view perspective defaults to the bitmap's view perspective.
Pointer to the windows RECT structure that specifies the bounding rectangle of the elliptical region. You specify the structure using device context coordinates, and LEADTOOLS translates the coordinates using the values specified in the pXForm
parameter.
The action to take regarding the existing bitmap region, if one is defined. For descriptions of the possible values, refer to Creating a Bitmap Region.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Before calling this function, you must declare an RGNXFORM structure and set its values, which LEADTOOLS uses to translate between device context coordinates and bitmap coordinates. For details about how the structure works refer to the RGNXFORM structure description. For a description of common usage, refer to Translating Coordinates for a Bitmap Region.
To update an existing region, you specify how the new region is to be combined with the existing one. For descriptions of the possibilities, refer to Creating a Bitmap Region.
Required DLLs and Libraries
Win32, x64, Linux.
For complete sample code, refer to the CHILD.C module of the DEMO example. This example creates an elliptical region and lightens the part of the bitmap that is in the region.
L_INT SetBitmapRgnEllipseExample(L_HWND hWnd,pBITMAPHANDLE pBitmap)
{
L_INT nRet;
RGNXFORM XForm; /* Structure for transforming display coordinates */
HDC hWindowDC; /* Device context of the current window */
RECT rClientArea; /* Client area of the current window */
RECT rRgnRect; /* Rectangle that defines the region */
/* Get the device context of the current window */
hWindowDC = GetDC (hWnd);
/* Get the client area of the current window */
GetClientRect(hWnd,&rClientArea);
/* Load a bitmap */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), pBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if(nRet != SUCCESS)
return nRet;
/* Set RGNXFORM fields, assuming that the display rectangle is the same
as the client area of the current window */
XForm.uViewPerspective = TOP_LEFT;
XForm.nXScalarNum = BITMAPWIDTH(pBitmap);
XForm.nXScalarDen = rClientArea.right;
XForm.nYScalarNum = BITMAPHEIGHT(pBitmap);
XForm.nYScalarDen = rClientArea.bottom;
XForm.nXOffset = 0;
XForm.nYOffset = 0;
/* Specify a rectangle to define the region */
SetRect(&rRgnRect, rClientArea.right/8, rClientArea.bottom/8,
rClientArea.right/2, rClientArea.bottom/2);
/* Create an elliptical region */
nRet = L_SetBitmapRgnEllipse(pBitmap, &XForm, &rRgnRect, L_RGN_SET);
if(nRet != SUCCESS)
return nRet;
/* Lighten the region so that we will see it */
nRet = L_ChangeBitmapIntensity(pBitmap,500, 0);
if(nRet != SUCCESS)
return nRet;
/* Free the region */
L_FreeBitmapRgn(pBitmap);
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