L_OffsetBitmapRgn (original) (raw)
Summary
Moves the bitmap region by the specified number of rows and columns. The move does not affect the pixels in the region.
Syntax
#include "l_bitmap.h"
L_LTDIS_API L_INT L_OffsetBitmapRgn(pBitmap, nRowOffset, nColOffset)
Parameters
pBITMAPHANDLE pBitmap
Pointer to the bitmap handle referencing the bitmap that has the region.
L_INT nRowOffset
The number of rows to move the region.
L_INT nColOffset
The number of columns to move the region.
Returns
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Comments
This function uses bitmap coordinates to specify the region. Therefore, you must account for the view perspective of the bitmap. For more information, refer to Accounting for View Perspective.
Required DLLs and Libraries
- LTDIS
- 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, Linux.
See Also
Functions
Topics
- Raster Image Functions: Creating and Using a Region
- Raster Image Functions: Region Processing
- Defining and Using a Bitmap Region
Example
This example moves the bitmap region down and to the right.
For a complete sample code, refer to the DRAW example.
L_INT OffsetBitmapRgnExample(pBITMAPHANDLE pBitmap)
{
L_INT nRet;
L_INT nRowOffset; /* Movement on the Y axis */
L_INT nColOffset; /* Movement on the X axis */
L_INT x1, x2;
L_INT y1, y2;
/* We are going to move the region down and to the right */
/* by 1/4 of the display dimensions. */
/* First, get the display width and height */
nRowOffset = BITMAPHEIGHT(pBitmap) / 4;
nColOffset = BITMAPWIDTH(pBitmap) / 4;
/* Now, account for ViewPerspective */
x1 = 0;
y1 = 0;
x2 = nColOffset;
y2 = nRowOffset;
nRet = L_PointToBitmap(pBitmap, TOP_LEFT, &x1, &y1);
if (nRet != SUCCESS)
return nRet;
nRet = L_PointToBitmap(pBitmap, TOP_LEFT, &x2, &y2);
if (nRet != SUCCESS)
return nRet;
nColOffset = x2 - x1;
nRowOffset = y2 - y1;
/* Move the region */
nRet = L_OffsetBitmapRgn(pBitmap, nRowOffset, nColOffset);
if (nRet != SUCCESS)
return nRet;
return SUCCESS;
}
LEADTOOLS Raster Imaging C API Help