Coin Logo http://www.sim.no/
http://www.coin3d.org/

SbImage.h
00001 #ifndef COIN_SBIMAGE_H
00002 #define COIN_SBIMAGE_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) by Kongsberg Oil & Gas Technologies.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Kongsberg Oil & Gas Technologies
00018  *  about acquiring a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/SbVec2s.h>
00028 #include <Inventor/SbVec3s.h>
00029 #include <Inventor/SbString.h>
00030 #include <stddef.h> // for NULL
00031 
00032 class SbImage;
00033 
00034 typedef SbBool SbImageScheduleReadCB(const SbString &, SbImage *, void *);
00035 typedef SbBool SbImageReadImageCB(const SbString &, SbImage *, void *);
00036 
00037 class COIN_DLL_API SbImage {
00038 public:
00039   SbImage(void);
00040   SbImage(const unsigned char * bytes,
00041           const SbVec2s & size, const int bytesperpixel);
00042   SbImage(const unsigned char * bytes,
00043           const SbVec3s & size, const int bytesperpixel);
00044   ~SbImage();
00045 
00046   void setValue(const SbVec2s & size, const int bytesperpixel,
00047                 const unsigned char * bytes);
00048   void setValue(const SbVec3s & size, const int bytesperpixel,
00049                 const unsigned char * bytes);
00050   void setValuePtr(const SbVec2s & size, const int bytesperpixel,
00051                    const unsigned char * bytes);
00052   void setValuePtr(const SbVec3s & size, const int bytesperpixel,
00053                    const unsigned char * bytes);
00054   unsigned char * getValue(SbVec2s & size, int & bytesperpixel) const;
00055   unsigned char * getValue(SbVec3s & size, int & bytesperpixel) const;
00056   SbVec3s getSize(void) const;
00057 
00058   SbBool readFile(const SbString & filename,
00059                   const SbString * const * searchdirectories = NULL,
00060                   const int numdirectories = 0);
00061 
00062   int operator==(const SbImage & image) const;
00063   int operator!=(const SbImage & image) const {
00064     return ! operator == (image);
00065   }
00066   SbImage & operator=(const SbImage & image);
00067 
00068   static void addReadImageCB(SbImageReadImageCB * cb, void * closure);
00069   static void removeReadImageCB(SbImageReadImageCB * cb, void * closure);
00070 
00071   static SbString searchForFile(const SbString & basename,
00072                                 const SbString * const * dirlist,
00073                                 const int numdirs);
00074 
00075   SbBool hasData(void) const;
00076 
00077 private:
00078 
00079   class SbImageP * pimpl;
00080   
00081 public:
00082 
00083   // methods for delaying image loading until it is actually needed.
00084   void readLock(void) const;
00085   void readUnlock(void) const;
00086 
00087   SbBool scheduleReadFile(SbImageScheduleReadCB * cb,
00088                           void * closure,
00089                           const SbString & filename,
00090                           const SbString * const * searchdirectories = NULL,
00091                           const int numdirectories = 0);
00092 };
00093 
00094 #endif // !COIN_SBIMAGE_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Fri Dec 11 2015 03:24:52 for Coin by Doxygen 1.7.6.1.