MrSID Decode SDK for Raster Reference Manual 9.5.5.5244
UsingCInterface.c
//
// This code is property of Celartem, Inc dba Extensis.
// Copyright (c) 1995-2023. All rights reserved.
// Use permitted only under license from Extensis.
//
/* PUBLIC */
/*
* This demonstrates how to use the C API to decode a scene from a
* MrSID image.
*/
#include "main.h"
#include "support.h"
#include "ltic_api.h"
LT_STATUS UsingCInterface(void)
{
LTICImageH image = NULL;
lt_uint8 redBand[4];
lt_uint8 greenBand[4];
lt_uint8 blueBand[4];
void *bandData[3] = { redBand, greenBand, blueBand };
TEST_SUCCESS(ltic_openMrSIDImageFile(&image, INPUT_PATH("meg_cr20.sid")));
TEST_BOOL(ltic_getWidth(image) == 640);
TEST_BOOL(ltic_getHeight(image) == 480);
TEST_BOOL(ltic_getNumBands(image) == 3);
TEST_BOOL(ltic_getColorSpace(image) == LTI_COLORSPACE_RGB);
TEST_BOOL(ltic_getDataType(image) == LTI_DATATYPE_UINT8);
/* just read the upper-left 4 pixels */
TEST_SUCCESS(ltic_decode(image, 0, 0, 2, 2, 1.0, bandData));
TEST_BOOL(redBand[0] == 17);
TEST_BOOL(redBand[1] == 18);
TEST_BOOL(redBand[2] == 16);
TEST_BOOL(redBand[3] == 17);
TEST_BOOL(greenBand[0] == 29);
TEST_BOOL(greenBand[1] == 28);
TEST_BOOL(greenBand[2] == 26);
TEST_BOOL(greenBand[3] == 26);
TEST_BOOL(blueBand[0] == 20);
TEST_BOOL(blueBand[1] == 20);
TEST_BOOL(blueBand[2] == 18);
TEST_BOOL(blueBand[3] == 19);
TEST_SUCCESS(ltic_closeImage(image));
}
This file contains a simple C API to the Decode SDK.
LT_STATUS ltic_openMrSIDImageFile(LTICImageH *image, const char *fileName)
open MrSID image via filename (C API)
LTIDataType ltic_getDataType(const LTICImageH image)
get image datatype (C API)
LT_STATUS ltic_closeImage(LTICImageH image)
close an image (C API)
lt_uint32 ltic_getWidth(const LTICImageH image)
get image width (C API)
lt_uint32 ltic_getHeight(const LTICImageH image)
get image height (C API)
LTIColorSpace ltic_getColorSpace(const LTICImageH image)
get image colorspace (C API)
LT_STATUS ltic_decode(LTICImageH image, double xUpperLeft, double yUpperLeft, double width, double height, double magnification, void **buffers)
decode a scene from the image (C API)
void * LTICImageH
opaque pointer (handle) to an LTIImage
Definition: ltic_api.h:40
lt_uint16 ltic_getNumBands(const LTICImageH image)
get number of bands in trhe image (C API)
@ LTI_DATATYPE_UINT8
Definition: lti_types.h:103
@ LTI_COLORSPACE_RGB
Definition: lti_types.h:46
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:30
#define LT_STS_Uninit
status code indicating unintialized variable
Definition: lt_status.h:60
#define LT_STS_Success
status code indicating success
Definition: lt_status.h:43
unsigned char lt_uint8
unsigned 8-bit integer
Definition: lt_types.h:36

Extensis