capi.cpp

00001 /*
00002  * libopenraw - capi.cpp
00003  *
00004  * Copyright (C) 2005-2006 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00025 #include <libopenraw/libopenraw.h>
00026 
00027 #include <libopenraw++/thumbnail.h>
00028 
00029 using OpenRaw::Thumbnail;
00030 
00031 extern "C" {
00032 
00033 //  typedef struct Thumbnail _Thumbnail;
00034 
00035     or_error or_get_extract_thumbnail(const char* _filename,
00036                      uint32_t _preferred_size,
00037                      ORThumbnailRef *_thumb)
00038     {
00039         or_error ret = OR_ERROR_NONE;
00040 
00041         Thumbnail ** pThumbnail = reinterpret_cast<Thumbnail **>(_thumb);
00042         *pThumbnail = Thumbnail::getAndExtractThumbnail(_filename,
00043                                                                                                         _preferred_size, ret);
00044         return ret;
00045     }
00046 
00047 
00048     ORThumbnailRef or_thumbnail_new(void)
00049     {
00050         Thumbnail *thumb = new Thumbnail();
00051         return reinterpret_cast<ORThumbnailRef>(thumb);
00052     }
00053 
00054 
00055     or_error 
00056     or_thumbnail_release(ORThumbnailRef thumb)
00057     {
00058         if (thumb == NULL) {
00059             return OR_ERROR_NOTAREF;
00060         }
00061         delete reinterpret_cast<Thumbnail *>(thumb);
00062         return OR_ERROR_NONE;
00063     }
00064 
00065 
00066     or_data_type 
00067     or_thumbnail_format(ORThumbnailRef thumb)
00068     {
00069         return reinterpret_cast<Thumbnail *>(thumb)->dataType();        
00070     }
00071 
00072 
00073     void *
00074     or_thumbnail_data(ORThumbnailRef thumb)
00075     {
00076         return reinterpret_cast<Thumbnail *>(thumb)->data();        
00077     }
00078 
00079     size_t
00080     or_thumbnail_data_size(ORThumbnailRef thumb)
00081     {
00082         return reinterpret_cast<Thumbnail *>(thumb)->size();        
00083     }
00084 
00085     void
00086     or_thumbnail_dimensions(ORThumbnailRef thumb, 
00087                                                     uint32_t *x, uint32_t *y)
00088     {
00089         Thumbnail* t = reinterpret_cast<Thumbnail *>(thumb);
00090         if (x != NULL) {
00091             *x = t->x();
00092         }
00093         if (y != NULL) {
00094             *y = t->y();
00095         }
00096     }
00097 
00098 
00099 }
00100 

Generated on Sat Jan 27 11:36:13 2007 for libopenraw by  doxygen 1.4.7