rawdata.cpp

00001 /*
00002  * libopenraw - rawdata.cpp
00003  *
00004  * Copyright (C) 2007 Hubert Figuiere
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00019  */
00020 /* @brief C api for rawdata
00021  */
00022 
00023 
00024 #include <libopenraw/libopenraw.h>
00025 
00026 #include <libopenraw++/rawdata.h>
00027 
00028 using OpenRaw::RawData;
00029 
00030 extern "C" {
00031 
00032     or_error or_get_extract_rawdata(const char* filename, uint32_t options,
00033                                                                     ORRawDataRef *rawdata)
00034     {
00035         or_error ret = OR_ERROR_NONE;
00036 
00037         RawData ** pRawData = reinterpret_cast<RawData **>(rawdata);
00038         *pRawData = RawData::getAndExtractRawData(filename,
00039                                                                                             options, ret);
00040         return ret;
00041     }
00042 
00043     ORRawDataRef
00044     or_rawdata_new(void)
00045     {
00046         RawData * rawdata = new RawData();
00047         return reinterpret_cast<ORRawDataRef>(rawdata);
00048     }
00049 
00050     or_error
00051     or_rawdata_release(ORRawDataRef rawdata)
00052     {
00053         if (rawdata == NULL) {
00054             return OR_ERROR_NOTAREF;
00055         }
00056         delete reinterpret_cast<RawData *>(rawdata);
00057         return OR_ERROR_NONE;
00058     }
00059 
00060 
00061     or_data_type 
00062     or_rawdata_format(ORRawDataRef rawdata)
00063     {
00064         return reinterpret_cast<RawData *>(rawdata)->dataType();
00065     }
00066 
00067 
00068     void *
00069     or_rawdata_data(ORRawDataRef rawdata)
00070     {
00071         return reinterpret_cast<RawData *>(rawdata)->data();        
00072     }
00073 
00074 
00075     size_t
00076     or_rawdata_data_size(ORRawDataRef rawdata)
00077     {
00078         return reinterpret_cast<RawData *>(rawdata)->size();        
00079     }
00080 
00081 
00082     void
00083     or_rawdata_dimensions(ORRawDataRef rawdata, 
00084                                                 uint32_t *x, uint32_t *y)
00085     {
00086         RawData* t = reinterpret_cast<RawData *>(rawdata);
00087         if (x != NULL) {
00088             *x = t->x();
00089         }
00090         if (y != NULL) {
00091             *y = t->y();
00092         }
00093     }
00094 
00095     uint32_t
00096     or_rawdata_bpc(ORRawDataRef rawdata)
00097     {
00098         return reinterpret_cast<RawData *>(rawdata)->bpc();     
00099     }
00100 
00101     or_cfa_pattern
00102     or_rawdata_get_cfa_pattern(ORRawDataRef rawdata)
00103     {
00104         return reinterpret_cast<RawData *>(rawdata)->cfaPattern();
00105     }
00106 
00107 }

Generated on Tue Jun 17 11:47:19 2008 for libopenraw by  doxygen 1.5.6