Nicomsoft OCR: Developer's Guide


Img_GetBmpData


Syntax

C++:int Img_GetBmpData(HIMG ImgObj, unsigned char* Bytes, int* Width, int* Height, int Flags)
C#:int Img_GetBmpData(int ImgObj, out System.Array Bytes, ref int Width, ref int Height, int Flags)
Visual Basic:Function Img_GetBmpData(ByVal ImgObj As Integer, ByRef Bytes As System.Array, ByRef Width As Integer, ByRef Height As Integer, ByVal Flags As Integer) As Integer
Java:int Img_GetBmpData(HIMG ImgObj, int[] Bits, NSInt Width, NSInt Height, int Flags)
Delphi:function Img_GetBmpData(ImgObj:HIMG; Bits:PBYTE; var Width:integer; var Height:integer; Flags:integer):integer


Description

Copies the raw BMP data of the current image loaded to the Image object to the specified memory buffer. If necessary, scales the image, preserving its proportions.


Parameters

ImgObj [IN] – the Image object.
Bytes [IN] – a pointer to the memory buffer that will receive the BMP data (as a 24-bit RGB bitmap). If NULL, the function will return the size of the buffer (in bytes) required for the BMP data.
Width [IN,OUT] – IN: the maximum allowed width of the drawing rectangle, in pixels; specify 0 to use the image width. OUT: the actual width of the drawing rectangle.
Height [IN,OUT] – IN: the maximum allowed height of the drawing rectangle, in pixels; specify 0 to use the image height. OUT: the actual height of the drawing rectangle.
Flags [IN] – the drawing flags. See the DRAW_XXXXX constants for possible values.


Return value

Depending on the "Flags" parameter value, the returned value is image color depth, required buffer size in bytes, zero, or an error code.


Remarks

Java: This function always returns the image data in the ARGB format (4 bytes per pixel).


Example

See the sample projects in the NSOCR SDK.