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.
Contents
- Initialization and denitialization
- Returned values
- Data loading
- Parameters getters/setters
- Auxiliary Functions
- Data Postprocessing, Emulation of dcraw Behavior
- Writing to Output Files
- Writing processing results to memory buffer
Initialization and denitialization
- 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. - void libraw_close(libraw_data_t *);
- Closes libraw_data_t handler and deallocates all memory.
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/Buffer
- int libraw_open_file(libraw_data_t*, const char *)
- int libraw_open_file_ex(libraw_data_t*, const char *,INT64 bigfile_size)
- WIN32: int libraw_open_wfile(libraw_data_t*, const wchar_t *)
- WIN32: int libraw_open_wfile_ex(libraw_data_t*, const wchar_t *,INT64 bigfile_size)
- See LibRaw::open_file()
- int libraw_open_buffer(libraw_data_t*, void *buffer, size_t bufsize)
- See LibRaw::open_buffer()
- int libraw_open_bayer(libraw_data_t *lr, unsigned char *data, unsigned datalen, ushort _raw_width, ushort _raw_height, ushort _left_margin, ushort _top_margin, ushort _right_margin, ushort _bottom_margin, unsigned char procflags, unsigned char bayer_battern, unsigned unused_bits, unsigned otherflags, unsigned black_level)
- See LibRaw::open_bayer()
- int libraw_unpack(libraw_data_t*);
- See LibRaw::unpack()
- int libraw_unpack_thumb(libraw_data_t*);
- See LibRaw::unpack_thumb()
- int libraw_unpack_thumb_ex(libraw_data_t*,int);
- See LibRaw::unpack_thumb_ex()
Parameters setters/getters
These functions provides interface to imgdata.params, .sizes and .color fields which works regardless of LibRaw versions used when building calling app and the library itself.
- int libraw_get_raw_height(libraw_data_t *lr);
- int libraw_get_raw_width(libraw_data_t *lr);
- int libraw_get_iheight(libraw_data_t *lr);
- int libraw_get_iwidth(libraw_data_t *lr);
- float libraw_get_cam_mul(libraw_data_t *lr,int index);
- float libraw_get_pre_mul(libraw_data_t *lr,int index);
- float libraw_get_rgb_cam(libraw_data_t *lr,int index1, int index2);
- libraw_iparams_t *libraw_get_iparams(libraw_data_t *lr);
- libraw_lensinfo_t *libraw_get_lensinfo(libraw_data_t *lr);
- libraw_imgother_t *libraw_get_imgother(libraw_data_t *lr);
- int libraw_get_color_maximum(libraw_data_t *lr);
- void libraw_set_user_mul(libraw_data_t *lr,int index, float val);
- void libraw_set_demosaic(libraw_data_t *lr,int value);
- void libraw_set_adjust_maximum_thr(libraw_data_t *lr,float value);
- void libraw_set_output_color(libraw_data_t *lr,int value);
- void libraw_set_output_bps(libraw_data_t *lr,int value);
- void libraw_set_gamma(libraw_data_t *lr,int index, float value);
- void libraw_set_no_auto_bright(libraw_data_t *lr,int value);
- void libraw_set_bright(libraw_data_t *lr,float value);
- void libraw_set_highlight(libraw_data_t *lr,int value);
- void libraw_set_fbdd_noiserd(libraw_data_t *lr,int value);
Auxiliary Functions
- const char* libraw_version()
- See LibRaw::version()
- int libraw_versionNumber()
- See LibRaw::versionNumber()
- See LibRaw::versionNumber()
- bool LIBRAW_CHECK_VERSION(major,minor,patch)
- See LIBRAW_CHECK_VERSION
- unsigned libraw_capabilities()
- See LibRaw::capabilities()
- int libraw_cameraCount()
- See LibRaw::cameraCount()
- const char* libraw_cameraList()
- See LibRaw::cameraList()
- int libraw_get_decoder_info(libraw_data_t*,libraw_decoder_info_t *);
- See LibRaw::get_decoder_info()
- const char* libraw_unpack_function_name(libraw_data_t*);
- See LibRaw::unpack_function_name()
- int libraw_COLOR(libraw_data_t*,int row,int col);
- See LibRaw::COLOR()
- void libraw_subtract_black(libraw_data_t*);
- See LibRaw::subtract_black()
- void libraw_recycle_datastream(libraw_data_t*);
- See LibRaw::recycle_datastream()
- void libraw_recycle(libraw_data_t*);
- See LibRaw::recycle()
- const char *libraw_strerror(int errorcode);
- See LibRaw::strerror
- const char *libraw_strprogress(enum LibRaw_progress);
- See LibRaw::strprogress
- void libraw_set_dataerror_handler(libraw_data_t*,data_callback func, void *);
- See LibRaw::set_dataerror_handler()
- void libraw_set_progress_handler(libraw_data_t*,progress_callback func, void *);
- See LibRaw::set_progress_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_raw2image(libraw_data_t*);
- See LibRaw::raw2image
- int libraw_free_image(libraw_data_t*);
- See LibRaw::free_image
- int libraw_adjust_sizes_info_only(libraw_data_t*);
- See LibRaw::adjust_sizes_info_only()
- 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()
Writing processing results to memory buffer
- libraw_processed_image_t *libraw_dcraw_make_mem_image(libraw_data_t* lr,int * errcode)
- See LibRaw::dcraw_make_mem_image()
- libraw_processed_image_t *libraw_dcraw_make_mem_thumb(libraw_data_t* lr,int * errcode)
- See LibRaw::dcraw_make_mem_thumb()
- void libraw_dcraw_clear_mem(libraw_processed_image_t *);
- See LibRaw::dcraw_clear_mem()
Recent comments