LMarker::GetMarker

#include "ltwrappr.h"

virtual L_INT LMarker::GetMarker(uIndex, puMarker, puMarkerSize, pMarkerData)

L_UINT uIndex;

marker index

L_UINT* puMarker;

marker type

L_UINT* puMarkerSize;

marker size

L_UCHAR* pMarkerData;

marker data

Gets the specified marker in the collection.

Parameter

Description

uIndex

Index of the marker to retrieve.

puMarker

Pointer to a variable to be updated with a value that represents the type (ID) of marker to get. Recommended values are between 0xE0 and 0xFE. Other values are possible, but before using other values, study the JPEG specs to determine which markers are allowed.

puMarkerSize

Pointer to a variable to be updated with the marker size if pMarkerData is not NULL. The variable should be filled, by the user, with the size of the pMarkerData buffer.

pMarkerData

Pointer to a buffer to be updated with the marker data.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function lets you get access to each individual marker without the use of a callback function.

This function is not as efficient as LMarker::Enum because the data for each marker is copied to your buffer.

To get the size of the specified marker, call this function with pMarkerData set to NULL. puMarkerSize will be filled with the size of the marker data.

If pMarkerData is not NULL, then puMarkerSize should be filled with the size of pMarkerData. If the size is not large enough to hold the marker, the function will fail and return ERROR_BUFFER_TOO_SMALL.

If uIndex is larger than the number of markers present in hMarkers, the function will fail and return ERROR_MARKER_INDEX.

Typically, you would call this function twice:

You can also allocate a buffer of 0xFFFD bytes and use it to hold any marker. You can do this because the size of a marker is limited to 0xFFFD (65533) bytes.

Required DLLs and Libraries

LTFIL

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.

See Also

Functions:

LMarker::Load, LMarker::Create, LMarker::Insert, LMarker::Enum, LMarker::GetCount

Topics:

Raster Image Functions: Markers

 

Working with Markers

Example

L_INT GetMarkerExample(LMarker Markers, HWND hWnd, 
L_UCHAR MarkerBuf[]/* static buffer large 
enough to contain any marker*/ ) 
{ 
   L_UINT uCount; // number of markers present in Markers 
   L_UINT uIndex; // index of the marker I am retrieving 
   L_UINT uMarker; // marker ID (0x01 .. 0xFE) 
   L_UINT uMarkerSize; // size of marker (0 .. 0xFFFD) 
   L_INT nRet; // return code 
   L_TCHAR buf[256]; // buffer used for messages 
   uCount = Markers.GetCount(); 
   for(uIndex = 0; uIndex < uCount; uIndex++) 
   { 
      // Since I pass MarkerBuf, fill uMarkerSize with the buffer size 
      uMarkerSize = 0xFFFD; 
      nRet = Markers.GetMarker(uIndex, &uMarker, &uMarkerSize, MarkerBuf); 
      if(nRet != SUCCESS) 
      { 
         _itot_s(nRet, buf, 10); 
         MessageBox(hWnd, buf, TEXT("Error calling GetMarker"), MB_OK); 
         return nRet; 
      } 
      // the function succeeded 
      // display the results. Note that the some of 
      // the marker data displayed is meaningless if uMarkerSize is < 4 
      wsprintf(buf, TEXT("Marker %d: 0x%02X, size=%d, buf = %02X,%02X,%02X,%02X"), 
      uIndex, uMarker, uMarkerSize, MarkerBuf[0], MarkerBuf[1], MarkerBuf[2], MarkerBuf[3]); 
      MessageBox(hWnd, buf, TEXT("SUCCESS"), MB_OK); 
   } 
   MessageBox(hWnd, TEXT("Done"), TEXT("SUCCESS"), MB_OK); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help