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

SoSFImage.h
1#ifndef COIN_SOSFIMAGE_H
2#define COIN_SOSFIMAGE_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/fields/SoSField.h>
28#include <Inventor/fields/SoSubField.h>
29#include <Inventor/SbVec2s.h>
30
31
32class COIN_DLL_API SoSFImage : public SoSField {
33 typedef SoSField inherited;
34
35 SO_SFIELD_CONSTRUCTOR_HEADER(SoSFImage);
36 SO_SFIELD_REQUIRED_HEADER(SoSFImage);
37
38public:
39 enum CopyPolicy {
40 COPY,
41 NO_COPY,
42 NO_COPY_AND_DELETE,
43 NO_COPY_AND_FREE
44 };
45
46 static void initClass(void);
47
48 const unsigned char * getValue(SbVec2s & size, int & nc) const;
49 void setValue(const SbVec2s & size, const int nc,
50 const unsigned char * pixels, CopyPolicy copypolicy = COPY);
51
52 int operator==(const SoSFImage & field) const;
53 int operator!=(const SoSFImage & field) const { return ! operator == (field); }
54
55 unsigned char * startEditing(SbVec2s & size, int & nc);
56 void finishEditing(void);
57
58 void setSubValue(const SbVec2s & dims, const SbVec2s & offset, unsigned char * pixels);
59 void setSubValues(const SbVec2s * dims, const SbVec2s * offsets, int num, unsigned char ** pixelblocks);
60 unsigned char * getSubTexture(int idx, SbVec2s & dims, SbVec2s & offset) const;
61 SbBool hasSubTextures(int & numsubtextures);
62
63 void setNeverWrite(SbBool flag);
64 SbBool isNeverWrite(void) const;
65
66 SbBool hasTransparency(void) const;
67
68private:
69 virtual SbBool readValue(SoInput * in);
70 virtual void writeValue(SoOutput * out) const;
71
72 class SoSFImageP * pimpl;
73};
74
75#endif // !COIN_SOSFIMAGE_H
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition: SbVec2s.h:37
int operator==(const SoField &f) const
Definition: SoField.cpp:1547
virtual void writeValue(SoOutput *out) const =0
virtual SbBool readValue(SoInput *in)=0
The SoInput class is an abstraction of file import functionality.
Definition: SoInput.h:55
The SoOutput class is an abstraction of an output stream.
Definition: SoOutput.h:42
The SoSFImage class is used to store pixel images.
Definition: SoSFImage.h:32
int operator!=(const SoSFImage &field) const
Definition: SoSFImage.h:53
The SoSField class is the base class for fields which contains only a single value.
Definition: SoSField.h:29

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

Generated on Wed Jul 20 2022 for Coin by Doxygen. 1.9.5