bitmapdata.cpp

00001 /*
00002  * libopenraw - bitmapdata.cpp
00003  *
00004  * Copyright (C) 2007-2008 Hubert Figuiere
00005  * Copyright (C) 2008 Novell Inc.
00006  *
00007  * This library is free software: you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation, either version 3 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library.  If not, see
00019  * <http://www.gnu.org/licenses/>.
00020  */
00021 /* @brief C api for bitmapdata
00022  */
00023 
00024 
00025 #include <libopenraw/libopenraw.h>
00026 
00027 #include <libopenraw++/bitmapdata.h>
00028 
00029 using OpenRaw::BitmapData;
00030 
00031 extern "C" {
00032 
00033 ORBitmapDataRef
00034 or_bitmapdata_new(void)
00035 {
00036     BitmapData * bitmapdata = new BitmapData();
00037     return reinterpret_cast<ORBitmapDataRef>(bitmapdata);
00038 }
00039 
00040 or_error
00041 or_bitmapdata_release(ORBitmapDataRef bitmapdata)
00042 {
00043     if (bitmapdata == NULL) {
00044         return OR_ERROR_NOTAREF;
00045     }
00046     delete reinterpret_cast<BitmapData *>(bitmapdata);
00047     return OR_ERROR_NONE;
00048 }
00049 
00050 
00051 or_data_type 
00052 or_bitmapdata_format(ORBitmapDataRef bitmapdata)
00053 {
00054     return reinterpret_cast<BitmapData *>(bitmapdata)->dataType();
00055 }
00056 
00057 
00058 void *
00059 or_bitmapdata_data(ORBitmapDataRef bitmapdata)
00060 {
00061     return reinterpret_cast<BitmapData *>(bitmapdata)->data();      
00062 }
00063 
00064 
00065 size_t
00066 or_bitmapdata_data_size(ORBitmapDataRef bitmapdata)
00067 {
00068     return reinterpret_cast<BitmapData *>(bitmapdata)->size();      
00069 }
00070 
00071 
00072 void
00073 or_bitmapdata_dimensions(ORBitmapDataRef bitmapdata, 
00074                       uint32_t *x, uint32_t *y)
00075 {
00076     BitmapData* t = reinterpret_cast<BitmapData *>(bitmapdata);
00077     if (x != NULL) {
00078         *x = t->x();
00079     }
00080     if (y != NULL) {
00081         *y = t->y();
00082     }
00083 }
00084 
00085 uint32_t
00086 or_bitmapdata_bpc(ORBitmapDataRef bitmapdata)
00087 {
00088     return reinterpret_cast<BitmapData *>(bitmapdata)->bpc();       
00089 }
00090 
00091 
00092 }

Generated on Wed Aug 25 01:26:34 2010 for libopenraw by  doxygen 1.5.9