1SoSFImage(3IV)()                                              SoSFImage(3IV)()
2
3
4

NAME

6       SoSFImage — Field containing a 2D image
7

INHERITS FROM

9       SoField > SoSField > SoSFImage
10

SYNOPSIS

12       #include <Inventor/fields/SoSFImage.h>
13
14          Methods from class SoSFImage:
15
16     const unsigned char *  getValue(SbVec2s &size, int &nc) const
17     void                   setValue(const   SbVec2s   &size,  int  nc,  const
18                                 unsigned char *bytes)
19     unsigned char *        startEditing(SbVec2s &size, int &nc)
20     void                   finishEditing()
21
22          Methods from class SoSField:
23
24     static SoType       getClassTypeId()
25
26          Methods from class SoField:
27
28     void                setIgnored(SbBool ignore)
29     SbBool              isIgnored() const
30     SbBool              isDefault() const
31     virtual SoType      getTypeId() const
32     virtual SbBool      isOfType(SoType type) const
33     SbBool              set(const char *valueString)
34     void                get(SbString &valueString)
35     int                 operator ==(const SoField &f) const
36     int                 operator !=(const SoField &f) const
37     void                touch()
38     SbBool              connectFrom(SoField *fromField)
39     SbBool              connectFrom(SoEngineOutput *fromEngine)
40     void                disconnect()
41     SbBool              isConnected() const
42     SbBool              isConnectedFromField() const
43     SbBool              getConnectedField(SoField *&writingField) const
44     SbBool              isConnectedFromEngine() const
45     SbBool              getConnectedEngine(SoEngineOutput     *&engineOutput)
46                              const
47     void                enableConnection(SbBool flag)
48     SbBool              isConnectionEnabled() const
49     int                 getForwardConnections(SoFieldList &list) const
50     SoFieldContainer *  getContainer() const
51
52

DESCRIPTION

54       A  field  containing  a  two-dimensional image. Images can be greyscale
55       (intensity), greyscale with transparency information, RGB, or RGB  with
56       transparency.  Each component of the image (intensity, red, green, blue
57       or transparency (alpha)) can have an unsigned one-byte value from 0  to
58       255.
59
60       Values are returned as arrays of unsigned chars. The image is stored in
61       this array starting at the bottom left corner of  the  image  with  the
62       intensity or red component of that pixel, followed by either the alpha,
63       the green and blue, or the green, blue and alpha components  (depending
64       on the number of components in the image).  The next value is the first
65       component of the next pixel to the right.
66
67       SoSFImages are written to  file  as  three  integers  representing  the
68       width,  height  and  number  of  components  in  the image, followed by
69       width*height hexadecimal values representing the pixels in  the  image,
70       separated by whitespace. A one-component image will have one-byte hexa‐
71       decimal values representing the intensity of the  image.  For  example,
72       0xFF  is  full  intensity,  0x00 is no intensity. A two-component image
73       puts the intensity in the first (high) byte and the transparency in the
74       second  (low) byte. Pixels in a three-component image have the red com‐
75       ponent in the first (high) byte, followed by the green and blue  compo‐
76       nents  (so 0xFF0000 is red). Four-component images put the transparency
77       byte after red/green/blue (so  0x0000FF80  is  semi-transparent  blue).
78       Note:  each  pixel  is  actually read as a single unsigned number, so a
79       3-component pixel with value "0x0000FF" can also be written  as  "0xFF"
80       or "255" (decimal).
81
82       For example,
83
84          1 2 1 0xFF 0x00
85
86     is  a 1 pixel wide by 2 pixel high greyscale image, with the bottom pixel
87     white and the top pixel black. And:
88
89          2 4 3 0xFF0000 0xFF00   0 0   0 0   0xFFFFFF 0xFFFF00
90
91     is a 2 pixel wide by 4 pixel high RGB image, with the bottom  left  pixel
92     red,  the  bottom right pixel green, the two middle rows of pixels black,
93     the top left pixel white, and the top right pixel yellow.
94

METHODS

96     const unsigned char *  getValue(SbVec2s &size, int &nc) const
97          Returns the pixels in the image as an array of unsigned  chars.  The
98          size and nc arguments are filled in with the dimensions of the image
99          and the number of components in the image; the number  of  bytes  in
100          the array returned will be size[0]*size[1]*nc.
101
102     void                   setValue(const   SbVec2s   &size,  int  nc,  const
103                                 unsigned char *bytes)
104          Sets the value of this field to be an image of the given size,  with
105          the  given  number  of  components, and with the given pixel values.
106          size[0]*size[1]*nc bytes from the given array will  be  copied  into
107          internal storage maintained by the SoSFImage field.
108
109     unsigned char *        startEditing(SbVec2s &size, int &nc)
110     void                   finishEditing()
111          These methods can be used to efficiently edit the values in an image
112          field. startEditing() returns the size of the image in the size  and
113          nc  arguments;  writing past the end of the array returned is a good
114          way to cause hard-to-find core dumps.
115
116

SEE ALSO

118       SoField, SoSField
119
120
121
122
123                                                              SoSFImage(3IV)()
Impressum