globalmapper.GetPixelDataInRect

globalmapper.GetPixelDataInRect(GM_LayerHandle_t32 aLayer, GM_PixelRect_t aPixelRect, GM_RasterLayout_t aRasterLayout, int aDataBuf, uint32 aReserved=0) GM_Error_t32[source]

Retrieves a pixel rectangle of raw band values from the supplied image layer defined by the provided layout.

If you call this with 0 for aDataBuf, the aRasterLayout structure will be filled out before GM_Error_InvalidParam is returned, so you can call this before allocation to determine the proper allocation size.

The following aRasterLayout.mFlags are used:

  • GM_RasterLayout_BGROrder - bands are stored in reverse order. The alpha band is still the last one (if present)

  • GM_RasterLayout_AlphaPresent - an alpha band will be added after the data bands. If there was already a separate alpha channel in the image, it will be one of the data bands and aRasterLayout.mAlphaBandIdx will reference it. Otherwise, a new alpha channel is added where 0 will be stored for invalid pixels, and valid pixels will be 1.0 for float values, or the maximum positive value for int, like 255 for GM_VAL_U8

  • GM_RasterLayout_ReverseRows - last row will be stored first in data buffer

  • GM_RasterLayout_ReverseCols - rows of data will start with the last column

  • GM_RasterLayout_HideProgress - progress will NOT be displayed

Parameters:
  • aLayer (GM_LayerHandle_t32) – Layer to get band values from

  • aPixelRect (GM_PixelRect_t) – Rectangle of pixels to extract from layer (use 0 to extract the entire image)

  • aRasterLayout (GM_RasterLayout_t) – Raster layout (some values used if non-zero, like mBytesPerRow, other values filled in)

  • aDataBuf (int) – Buffer that will be filled with the image data. Must be large enough to hold all data. If 0, aRasterLayout will be filled out before return.

  • aReserved (uint32) – Reserved for future use; defaults to 0

Returns:

Error Code

Return type:

GM_Error_t32