| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

SoImage.h
1 #ifndef COIN_SOIMAGE_H
2 #define COIN_SOIMAGE_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/nodes/SoSubNode.h>
28 #include <Inventor/nodes/SoShape.h>
29 #include <Inventor/fields/SoSFInt32.h>
30 #include <Inventor/fields/SoSFEnum.h>
31 #include <Inventor/fields/SoSFImage.h>
32 #include <Inventor/fields/SoSFString.h>
33
34 class SoSensor;
35 class SoFieldSensor;
36 class SbImage;
37
38 class COIN_DLL_API SoImage : public SoShape {
39 typedef SoShape inherited;
40
41 SO_NODE_HEADER(SoImage);
42
43 public:
44 static void initClass(void);
45 SoImage(void);
46
47 enum VertAlignment {
48 BOTTOM,
49 HALF,
50 TOP
51 };
52
53 enum HorAlignment {
54 LEFT,
55 CENTER,
56 RIGHT
57 };
58
59 SoSFInt32 width;
60 SoSFInt32 height;
61 SoSFEnum vertAlignment;
62 SoSFEnum horAlignment;
63 SoSFImage image;
64 SoSFString filename;
65
66 virtual void GLRender(SoGLRenderAction * action);
67 virtual void rayPick(SoRayPickAction * action);
68 virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
69
70 protected:
71 virtual ~SoImage();
72
73 virtual void generatePrimitives(SoAction * action);
74 virtual void computeBBox(SoAction * action, SbBox3f & box, SbVec3f & center);
75
76 virtual SbBool readInstance(SoInput * in, unsigned short flags);
77 virtual void notify(SoNotList * list);
78 int getReadStatus(void);
79 void setReadStatus(SbBool flag);
80
81 private:
82 SbVec2s getSize(void) const;
83 static SbVec3f getNilpoint(SoState *state);
84 void getQuad(SoState *state, SbVec3f &v0, SbVec3f &v1,
85 SbVec3f &v2, SbVec3f &v3);
86
87 const unsigned char * getImage(SbVec2s & size, int & nc);
88 SbBool loadFilename(void);
89 SbBool readstatus;
90 SbImage * resizedimage;
91 SbBool resizedimagevalid;
92 class SoFieldSensor * filenamesensor;
93 SbBool transparency;
94 SbBool testtransparency;
95 void testTransparency(void);
96 static void filenameSensorCB(void *, SoSensor *);
97 };
98
99 #endif // !COIN_SOIMAGE_H

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