|
rpm-build |
d2b433 |
/* -*- Mode: C++ -*- */
|
|
rpm-build |
d2b433 |
/*
|
|
rpm-build |
d2b433 |
* libopenraw - rawfile.h
|
|
rpm-build |
d2b433 |
*
|
|
rpm-build |
d2b433 |
* Copyright (C) 2005-2016 Hubert Figuière
|
|
rpm-build |
d2b433 |
*
|
|
rpm-build |
d2b433 |
* This library is free software: you can redistribute it and/or
|
|
rpm-build |
d2b433 |
* modify it under the terms of the GNU Lesser General Public License
|
|
rpm-build |
d2b433 |
* as published by the Free Software Foundation, either version 3 of
|
|
rpm-build |
d2b433 |
* the License, or (at your option) any later version.
|
|
rpm-build |
d2b433 |
*
|
|
rpm-build |
d2b433 |
* This library is distributed in the hope that it will be useful,
|
|
rpm-build |
d2b433 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
rpm-build |
d2b433 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
rpm-build |
d2b433 |
* Lesser General Public License for more details.
|
|
rpm-build |
d2b433 |
*
|
|
rpm-build |
d2b433 |
* You should have received a copy of the GNU Lesser General Public
|
|
rpm-build |
d2b433 |
* License along with this library. If not, see
|
|
rpm-build |
d2b433 |
* <http://www.gnu.org/licenses/>.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
#ifndef LIBOPENRAWPP_RAWFILE_H_
|
|
rpm-build |
d2b433 |
#define LIBOPENRAWPP_RAWFILE_H_
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
#include <string>
|
|
rpm-build |
d2b433 |
#include <vector>
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
#include <libopenraw/rawfile.h>
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
namespace OpenRaw {
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
namespace IO {
|
|
rpm-build |
d2b433 |
class Stream;
|
|
rpm-build |
d2b433 |
}
|
|
rpm-build |
d2b433 |
class Thumbnail;
|
|
rpm-build |
d2b433 |
class RawData;
|
|
rpm-build |
d2b433 |
class BitmapData;
|
|
rpm-build |
d2b433 |
class MetaValue;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
namespace Internals {
|
|
rpm-build |
d2b433 |
class RawContainer;
|
|
rpm-build |
d2b433 |
class ThumbDesc;
|
|
rpm-build |
d2b433 |
struct BuiltinColourMatrix;
|
|
rpm-build |
d2b433 |
}
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
void init();
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
class RawFile
|
|
rpm-build |
d2b433 |
{
|
|
rpm-build |
d2b433 |
public:
|
|
rpm-build |
d2b433 |
typedef ::or_rawfile_type Type;
|
|
rpm-build |
d2b433 |
typedef ::or_rawfile_typeid TypeId;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
RawFile(const RawFile&) = delete;
|
|
rpm-build |
d2b433 |
RawFile & operator=(const RawFile &) = delete;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** return a NULL terminated list of file extensions
|
|
rpm-build |
d2b433 |
* that the library handle. This is purely informational.
|
|
rpm-build |
d2b433 |
* @return a pointer the list, NULL terminated. The pointer is
|
|
rpm-build |
d2b433 |
* owned by the library.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
static const char **fileExtensions();
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** factory method to create the proper RawFile instance.
|
|
rpm-build |
d2b433 |
* @param _filename the name of the file to load
|
|
rpm-build |
d2b433 |
* @param _typeHint a hint on the type. Use UNKNOWN_TYPE
|
|
rpm-build |
d2b433 |
* if you want to let the library detect it for you.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
static RawFile *newRawFile(const char*_filename,
|
|
rpm-build |
d2b433 |
Type _typeHint = OR_RAWFILE_TYPE_UNKNOWN);
|
|
rpm-build |
d2b433 |
/** factory method to create the proper RawFile instance
|
|
rpm-build |
d2b433 |
* from content
|
|
rpm-build |
d2b433 |
* @param buffer the buffer to examine.
|
|
rpm-build |
d2b433 |
* @param len the number of bytes in the length.
|
|
rpm-build |
d2b433 |
* @param _typeHint a hint on the type. Use UNKNOWN_TYPE
|
|
rpm-build |
d2b433 |
* if you want to let the library detect it for you.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
static RawFile *newRawFileFromMemory(const uint8_t *buffer, uint32_t len,
|
|
rpm-build |
d2b433 |
Type _typeHint = OR_RAWFILE_TYPE_UNKNOWN);
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** Destructor */
|
|
rpm-build |
d2b433 |
virtual ~RawFile();
|
|
rpm-build |
d2b433 |
/** Accessor for the type */
|
|
rpm-build |
d2b433 |
Type type() const;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** The RAW file type ID. Identify it if needed.
|
|
rpm-build |
d2b433 |
* @todo figure how to make this const.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
TypeId typeId();
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
// standard api, like get thumbnail
|
|
rpm-build |
d2b433 |
// and get exif.
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** list the available thumbnail sizes
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
const std::vector<uint32_t> & listThumbnailSizes(void);
|
|
rpm-build |
d2b433 |
/** Get the thumbnail from the raw file
|
|
rpm-build |
d2b433 |
* @param size the square size in px
|
|
rpm-build |
d2b433 |
* @param thumbnail the thumbnail to extract into
|
|
rpm-build |
d2b433 |
* @return the error code
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
::or_error getThumbnail(uint32_t size, Thumbnail & thumbnail);
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** Get the RAW data
|
|
rpm-build |
d2b433 |
* @param rawdata the RawData to put the data into
|
|
rpm-build |
d2b433 |
* @param options the option bits defined by %or_options
|
|
rpm-build |
d2b433 |
* @return the error code
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
::or_error getRawData(RawData & rawdata, uint32_t options);
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** Get the rendered image
|
|
rpm-build |
d2b433 |
* @param bitmapdata the BitmapData to put the image into
|
|
rpm-build |
d2b433 |
* @param options the option bits. Pass 0 for now.
|
|
rpm-build |
d2b433 |
* @return the error code
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
::or_error getRenderedImage(BitmapData & bitmapdata, uint32_t options);
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** Get the orientation of the image, using Exif enums.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
int32_t getOrientation();
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/**
|
|
rpm-build |
d2b433 |
* @return the number of items in the colour matrix.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
uint32_t colourMatrixSize();
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** Get colour matrix
|
|
rpm-build |
d2b433 |
* @param index The matrix index.
|
|
rpm-build |
d2b433 |
* @param [out] matrix an array of %size double.
|
|
rpm-build |
d2b433 |
* @param size the size of the buffer. On out the actual size. If it is too
|
|
rpm-build |
d2b433 |
* small the size is adjusted and an error %OR_ERROR_BUF_TOO_SMALL returned.
|
|
rpm-build |
d2b433 |
* @return an error code.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
::or_error getColourMatrix1(double* matrix, uint32_t & size);
|
|
rpm-build |
d2b433 |
::or_error getColourMatrix2(double* matrix, uint32_t & size);
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** Get calibration illuminant that match the colour matrix.
|
|
rpm-build |
d2b433 |
* @return the Exif value. 0 = unknown. Likely not found.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
ExifLightsourceValue getCalibrationIlluminant1();
|
|
rpm-build |
d2b433 |
ExifLightsourceValue getCalibrationIlluminant2();
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
const MetaValue *getMetaValue(int32_t meta_index);
|
|
rpm-build |
d2b433 |
protected:
|
|
rpm-build |
d2b433 |
struct camera_ids_t {
|
|
rpm-build |
d2b433 |
const char * model;
|
|
rpm-build |
d2b433 |
const uint32_t type_id;
|
|
rpm-build |
d2b433 |
};
|
|
rpm-build |
d2b433 |
/**
|
|
rpm-build |
d2b433 |
* Construct a raw file
|
|
rpm-build |
d2b433 |
* @param _type the type
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
RawFile(Type _type);
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** Set the file type id */
|
|
rpm-build |
d2b433 |
void _setTypeId(TypeId _type_id);
|
|
rpm-build |
d2b433 |
/** Just get the type id value. No identification.
|
|
rpm-build |
d2b433 |
* You might want to use %typeId() in the general case.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
TypeId _typeId() const;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** Get the container. */
|
|
rpm-build |
d2b433 |
virtual Internals::RawContainer* getContainer() const = 0;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** enumerate the thumbnail sizes.
|
|
rpm-build |
d2b433 |
* @param list the list to enumerate into
|
|
rpm-build |
d2b433 |
* @return OR_ERROR_NONE if success
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
virtual ::or_error _enumThumbnailSizes(std::vector<uint32_t> &list) = 0;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** get the thumbnail of exact size.
|
|
rpm-build |
d2b433 |
* @param size the size in pixel of the square
|
|
rpm-build |
d2b433 |
* @retval thumbnail the thumbnail to load
|
|
rpm-build |
d2b433 |
* @return OR_ERROR_NONE if success
|
|
rpm-build |
d2b433 |
* @seealso listThumbnailSizes() to understand how to fetch the sizes
|
|
rpm-build |
d2b433 |
* available
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
virtual ::or_error _getThumbnail(uint32_t size, Thumbnail & thumbnail);
|
|
rpm-build |
d2b433 |
void _addThumbnail(uint32_t size, const Internals::ThumbDesc& desc);
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** get the RAW data
|
|
rpm-build |
d2b433 |
* @param data the RAW data
|
|
rpm-build |
d2b433 |
* @param option the option bits
|
|
rpm-build |
d2b433 |
* @return OR_ERROR_NONE if success
|
|
rpm-build |
d2b433 |
* Return the data compressed or uncompressed.
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
virtual ::or_error _getRawData(RawData & data, uint32_t options) = 0;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/** get the colour matrix.
|
|
rpm-build |
d2b433 |
* @param index 1 or 2
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
virtual ::or_error _getColourMatrix(uint32_t index, double* matrix, uint32_t & size);
|
|
rpm-build |
d2b433 |
virtual ExifLightsourceValue _getCalibrationIlluminant(uint16_t index);
|
|
rpm-build |
d2b433 |
virtual MetaValue *_getMetaValue(int32_t /*meta_index*/) = 0;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
TypeId _typeIdFromModel(const std::string& make, const std::string & model);
|
|
rpm-build |
d2b433 |
TypeId _typeIdFromMake(const std::string& make);
|
|
rpm-build |
d2b433 |
void _setIdMap(const camera_ids_t *map);
|
|
rpm-build |
d2b433 |
void _setMatrices(const Internals::BuiltinColourMatrix* matrices);
|
|
rpm-build |
d2b433 |
const Internals::BuiltinColourMatrix* _getMatrices() const;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
virtual void _identifyId() = 0;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
static ::or_error _getBuiltinLevels(const Internals::BuiltinColourMatrix* m,
|
|
rpm-build |
d2b433 |
TypeId type_id,
|
|
rpm-build |
d2b433 |
uint16_t & black,
|
|
rpm-build |
d2b433 |
uint16_t & white);
|
|
rpm-build |
d2b433 |
static ::or_error _getBuiltinColourMatrix(const Internals::BuiltinColourMatrix* m,
|
|
rpm-build |
d2b433 |
TypeId type_id,
|
|
rpm-build |
d2b433 |
double* matrix,
|
|
rpm-build |
d2b433 |
uint32_t & size);
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
private:
|
|
rpm-build |
d2b433 |
static Type identify(const char*_filename);
|
|
rpm-build |
d2b433 |
static ::or_error identifyBuffer(const uint8_t* buff, size_t len,
|
|
rpm-build |
d2b433 |
Type &_type);
|
|
rpm-build |
d2b433 |
static const camera_ids_t s_make[];
|
|
rpm-build |
d2b433 |
static const camera_ids_t* _lookupCameraId(const camera_ids_t * map,
|
|
rpm-build |
d2b433 |
const std::string& value);
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
class Private;
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
Private *d;
|
|
rpm-build |
d2b433 |
};
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
}
|
|
rpm-build |
d2b433 |
|
|
rpm-build |
d2b433 |
/*
|
|
rpm-build |
d2b433 |
Local Variables:
|
|
rpm-build |
d2b433 |
mode:c++
|
|
rpm-build |
d2b433 |
c-file-style:"stroustrup"
|
|
rpm-build |
d2b433 |
c-file-offsets:((innamespace . 0))
|
|
rpm-build |
d2b433 |
indent-tabs-mode:nil
|
|
rpm-build |
d2b433 |
fill-column:80
|
|
rpm-build |
d2b433 |
End:
|
|
rpm-build |
d2b433 |
*/
|
|
rpm-build |
d2b433 |
#endif
|