L_PutBitmapRowCol

#include "l_bitmap.h"

L_LTKRN_API L_SSIZE_T L_PutBitmapRowCol(pBitmap, pBuffer, nRow, nCol, uBytes)

Copies data from a buffer to a bitmap, with an offset to the bitmap. The buffer to which pBuffer points contains uncompressed data.

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the bitmap to put data into.

L_UCHAR* pBuffer

Pointer to the buffer containing the image data.

L_INT nRow

The number of the row to update. The first row is 0, and the last row is 1 less than the bitmap height.

L_INT nCol

The column offset within the row to update. The first column offset is 0, and the last column offset is 1 less than the bitmap width.

L_SIZE_T uBytes

The number of bytes to update. Consider the bits per pixel, and avoid specifying a number that goes past the end of the row.

Value Meaning
1-bit bitmap Each byte represents 8 pixels.
4-bit bitmap Each byte represents 2 pixels.
8-bit bitmap Each byte represents 1 pixel
16-bit bitmap Every 2 bytes represents one pixel.
24-bit bitmap Every three bytes represents one pixel.
32-bit bitmap Every four bytes represents one pixel.
48-bit bitmap Every six bytes represents one pixel.
64-bit bitmap Every eight bytes represents one pixel.

Returns

Value Meaning
>=1 The number of bytes put.
< 1 An error occurred. Refer to Return Codes.

Comments

By using this low-level function to update any part of a row, you can write a procedure that updates a single pixel or a rectangular area within the bitmap.

This function accepts an offset parameter nCol in pixels and a length uBytes in bytes. Therefore, you must consider the bits per pixel of the bitmap when specifying these parameters. The following table describes the rules:

Bits Per Pixel Column Offset (in Pixels) Bytes to Update
1 Must be a multiple of 8 (such as 0, 8, or 16). Should not go past the end of the row. Consider that there are 8 pixels per byte.
4 Must be an even number (such as 0, 2, or 4). Should not go past the end of the row. Consider that there are 2 pixels per byte.
8 Can be any column within the bitmap. Should not go past the end of the row. Consider that there is 1 pixel per byte.
16 Can be any column within the bitmap. Must be a multiple of 2 (such as 2, 4, or 6), because there are 2 bytes per pixel. Also, it should not go past the end of the row.
24 Can be any column within the bitmap. Must be a multiple of 3 (such as 3, 6, or 9), because there are 3 bytes per pixel. Also, it should not go past the end of the row.
32 Can be any column within the bitmap. Must be a multiple of 4 (such as 4, 8, or 12), because there are 4 bytes per pixel. Also, it should not go past the end of the row.

The bitmap memory must be locked when you use this function. Normally, you can call L_AccessBitmap to lock the memory before starting an operation that uses this function, then call L_ReleaseBitmap when the operation is finished.

Color order of the target bitmap is determined by the Order field in the bitmap handle. This value can be ORDER_RGB, ORDER_BGR, ORDER_GRAY or ORDER_ROMM.

Note: To calculate the correct size for a single row of image data:

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help