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

SbImage.h
1 #ifndef COIN_SBIMAGE_H
2 #define COIN_SBIMAGE_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/SbVec2s.h>
28 #include <Inventor/SbVec3s.h>
29 #include <Inventor/SbString.h>
30 #include <stddef.h> // for NULL
31 
32 class SbImage;
33 
34 typedef SbBool SbImageScheduleReadCB(const SbString &, SbImage *, void *);
35 
36 class COIN_DLL_API SbImage {
37 public:
38  SbImage(void);
39  SbImage(const unsigned char * bytes,
40  const SbVec2s & size, const int bytesperpixel);
41  SbImage(const unsigned char * bytes,
42  const SbVec3s & size, const int bytesperpixel);
43  ~SbImage();
44 
45  void setValue(const SbVec2s & size, const int bytesperpixel,
46  const unsigned char * bytes);
47  void setValue(const SbVec3s & size, const int bytesperpixel,
48  const unsigned char * bytes);
49  void setValuePtr(const SbVec2s & size, const int bytesperpixel,
50  const unsigned char * bytes);
51  void setValuePtr(const SbVec3s & size, const int bytesperpixel,
52  const unsigned char * bytes);
53  unsigned char * getValue(SbVec2s & size, int & bytesperpixel) const;
54  unsigned char * getValue(SbVec3s & size, int & bytesperpixel) const;
55  SbVec3s getSize(void) const;
56 
57  SbBool readFile(const SbString & filename,
58  const SbString * const * searchdirectories = NULL,
59  const int numdirectories = 0);
60 
61  int operator==(const SbImage & image) const;
62  int operator!=(const SbImage & image) const {
63  return ! operator == (image);
64  }
65  SbImage & operator=(const SbImage & image);
66 
67  static SbString searchForFile(const SbString & basename,
68  const SbString * const * dirlist,
69  const int numdirs);
70 
71  SbBool hasData(void) const;
72 
73 private:
74 
75  class SbImageP * pimpl;
76 
77 public:
78 
79  // methods for delaying image loading until it is actually needed.
80  void readLock(void) const;
81  void readUnlock(void) const;
82 
83  SbBool scheduleReadFile(SbImageScheduleReadCB * cb,
84  void * closure,
85  const SbString & filename,
86  const SbString * const * searchdirectories = NULL,
87  const int numdirectories = 0);
88 };
89 
90 #endif // !COIN_SBIMAGE_H
int operator!=(const SbImage &image) const
Definition: SbImage.h:62
The SbVec3s class is a 3 dimensional vector with short integer coordinates.
Definition: SbVec3s.h:36
The SbImage class is an abstract datatype for 2D and 3D images.Be aware that this class is an extensi...
Definition: SbImage.h:36
The SbString class is a string class with convenience functions for string operations.This is the class used for storing and working with character strings. It automatically takes care of supporting all the "bookkeeping" tasks usually associated with working with character strings, like memory allocation and deallocation etc.
Definition: SbString.h:42
The SbVec2s class is a 2 dimensional vector with short integer coordinates.This vector class is used ...
Definition: SbVec2s.h:37

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Fri Jul 20 2018 for Coin by Doxygen. 1.8.14