ENUMMARKERSCALLBACK

#include "l_bitmap.h"

L_INT pEXT_CALLBACK YourFunction (uMarker, uMarkerSize, pMarkerData, pUserData, pfnLEADCallback, pLEADUserData)

L_UINT uMarker;

marker type

L_UINT uMarkerSize;

marker size

L_UCHAR* pMarkerData;

marker data

L_VOID * pUserData;

pointer to additional parameters

LEADMARKERCALLBACK pfnLEADCallback;

LEADMARKERCALLBACK callback function

L_VOID * pLEADUserData;

pointer to additional parameters

Handles each marker provided by calling the L_EnumMarkers function.

Parameter

Description

uMarker

Value that represents the type of marker passed to the callback function. Possible values are range between 0xE0 and 0xFE. Other values are possible. To determine what marker types are allowed, refer to the JPEG specification.

uMarkerSize

Size of the type of marker indicated in uMarker, in bytes.

Note: When inserting JPEG marker data using the pfnLEADCallback parameter, the maximum size of JPEG marker should not exceed 65533 (0xFFFD) bytes.

pMarkerData

A void pointer that you can use to access a variable or structure containing data associated with the marker indicated in uMarker, that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. This parameter is needed only if uMarkerSize > 0. The marker data should be at least uMarkerSize bytes.

 

Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

pUserData

A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of the L_EnumMarkers function.)

 

Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

pfnLEADCallback

Callback function for writing each enumerated marker. Call this function if you want to insert an extra marker at the current position.

 

ENUMMARKERSCALLBACK calls this callback function as it gets the handle of each marker. The callback function is provided by LEADTOOLS and will adhere to the function prototype described in the LEADMARKERCALLBACK Function.

pLEADUserData

Void pointer that you should pass to pfnLEADCallback if you call it directly.

Returns

SUCCESS

Copy the current marker to the resulting marker collection. This resulting marker collection will be referenced by hMarkers when the L_EnumMarkers function successfully returns. Continue enumerating the remaining markers.

SUCCESS_IGNOREMARKER

Ignore the current marker. The current marker will be removed from the resulting marker collection. Continue enumerating the remaining markers.

SUCCESS_IGNOREALLMARKERS

Ignore the current marker and all remaining markers. Abort the enumeration without writing any other markers.

SUCCESS_IGNORETHISCOPYALL

Ignore the current marker but copy all the remaining markers to the resulting marker collection. Abort the enumeration but copy all remaining markers

SUCCESS_ABORT

Copy this and all remaining markers. Abort the enumeration.

Comments

This function will be called for every marker present in the handle. Return SUCCESS to leave the current marker in the marker collection. Return SUCCESS_IGNOREMARKER to delete the current marker from the collection.

Call pfnLEADCallback to insert a new marker in the collection before the current marker. The maximum size for a JPEG marker is 65533 (0xFFFD) bytes. To insert data exceeding 65533 bytes, break the data into several JPEG markers, with each marker size no more than 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.

See Also

Functions:

L_EnumMarkers

Topics:

Working with Markers

Example

This example will demonstrate how you insert a marker AFTER the current marker. I will insert a APP2 marker after the APP1 marker APP2_marker_size and APP2_marker_data describe the APP2 marker data.

L_INT APP2_marker_size; 
L_UCHAR * APP2_marker_data; 
 
// Replace them with your variables 
#define APP1 0xE1 
#define APP2 0xE2 
 
 
L_INT EXT_CALLBACK MyCallback( 
   L_UINT uMarker, 
   L_UINT uMarkerSize, 
   L_UCHAR* pMarkerData, 
   L_VOID* pUserData, 
   L_UINT uTransform, 
   LEADMARKERCALLBACK pfnLEADCallback, 
   L_VOID* pLEADUserData) 
{ 
   UNREFERENCED_PARAMETER(uTransform); 
   UNREFERENCED_PARAMETER(pUserData); 
   L_INT nRet; 
 
   if(uMarker == APP1) 
   { 
      /* Write the APP1 data by calling pfnLEADCallback */ 
      nRet = pfnLEADCallback(uMarker, uMarkerSize, pMarkerData, pLEADUserData); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      /* Write my APP2. You can call this function several times 
         if you need to write more than one marker. Make sure you replace APP2_marker_size and APP2_marker_data with your variables */ 
      nRet = pfnLEADCallback(APP2, APP2_marker_size, APP2_marker_data, pLEADUserData); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      /* do not write the current marker, because I have already done that */ 
      return SUCCESS_IGNOREMARKER; 
   } 
 
   /* preserve the marker */ 
   return SUCCESS; 
} 

Help Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help