[back to Index]

LibRaw: C API

LibRaw C API is a wrapper around C++ API; therefore, virtually all documentation to C API functions is represented by a set of hyperlinks to the corresponding places in the description of C++ API.

Initialization: libraw_data_t *libraw_init(unsigned int flags);

The function returns the pointer to the instance of libraw_data_t structure.
The resultant pointer should be passed as the first argument to all C API functions (except for libraw_strerror).

Returns NULL in case of error, pointer to the structure in all other cases.

Returned values

Functions of C API return EINVAL (see errno.h) if the null pointer was passed to them as the first argument. In all other cases, the C++ API return code is returned.

Data Loading from a File

int libraw_open_file(libraw_data_t*, const char *)
See LibRaw::open_file()
int libraw_unpack(libraw_data_t*);
See LibRaw::unpack()
int libraw_unpack_thumb(libraw_data_t*);
See LibRaw::unpack_thumb()

Auxiliary Functions

void libraw_recycle(libraw_data_t*);
See LibRaw::recycle()
void libraw_close(libraw_data_t*);
See LibRaw::~LibRaw()
const char *libraw_strerror(int errorcode);
See libraw_strerror
void libraw_set_memerror_handler(libraw_data_t*, memory_callback cb);
See LibRaw::set_memerror_handler()
void libraw_set_dataerror_handler(libraw_data_t*,data_callback func);
See LibRaw::set_dataerror_handler()

Data Postprocessing, Emulation of dcraw Behavior

Setting of Parameters

The postprocessing parameters for the calls described below are set, just as for C++ API, via setting of fields in the libraw_output_params_t structure:

 libraw_data_t *ptr = libraw_init(0);
 ptr->params.output_tiff = 1; //  output to TIFF
    

Fields of this structure are described in the documentation to libraw_output_params_t. For notes on their use, see API notes.

Emulation of dcraw Behavior

int libraw_adjust_sizes_info_only(libraw_data_t*);
See LibRaw::adjust_sizes_info_only()
int libraw_dcraw_document_mode_processing(libraw_data_t*);
See LibRaw::dcraw_document_mode_processing()
int libraw_dcraw_process(libraw_data_t* lr);
See LibRaw::dcraw_process()

Writing to Output Files

int libraw_dcraw_ppm_tiff_writer(libraw_data_t* lr,const char *filename);
See LibRaw::dcraw_ppm_tiff_writer()
int libraw_dcraw_thumb_writer(libraw_data_t* lr,const char *fname);
See LibRaw::dcraw_thumb_writer()
[back to Index]
Alex Tutubalin
Last modified: Sun Mar 23 19:20:07 MSK 2008